New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@ark/schema

Package Overview
Dependencies
Maintainers
0
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ark/schema - npm Package Compare versions

Comparing version 0.22.0 to 0.23.0

7

out/roots/root.d.ts

@@ -15,3 +15,3 @@ import { inferred, type array } from "@ark/util";

import type { JsonSchema } from "../shared/jsonSchema.ts";
import type { StandardSchema } from "../shared/standardSchema.ts";
import type { ArkTypeStandardSchemaProps, StandardSchema } from "../shared/standardSchema.ts";
import { arkKind } from "../shared/utils.ts";

@@ -33,6 +33,3 @@ import type { Prop } from "../structure/prop.ts";

get internal(): this;
get "~standard"(): 1;
get "~vendor"(): "arktype";
"~validate"(input: StandardSchema.Input): StandardSchema.Result<unknown>;
"~types": StandardSchema.Types<unknown, unknown>;
get "~standard"(): ArkTypeStandardSchemaProps;
get optionalMeta(): boolean;

@@ -39,0 +36,0 @@ /** returns unset if there is no default */

@@ -25,13 +25,13 @@ import { includes, inferred, omit, throwInternalError, throwParseError, unset } from "@ark/util";

get "~standard"() {
return 1;
return {
vendor: "arktype",
version: 1,
validate: input => {
const out = this(input);
if (out instanceof ArkErrors)
return out;
return { value: out };
}
};
}
get "~vendor"() {
return "arktype";
}
"~validate"(input) {
const out = this(input.value);
if (out instanceof ArkErrors)
return out;
return { value: out };
}
get optionalMeta() {

@@ -38,0 +38,0 @@ return this.cacheGetter("optionalMeta", this.meta.optional === true ||

import { CastableBase, ReadonlyArray, ReadonlyPath, type array, type propwiseXor, type show } from "@ark/util";
import type { Prerequisite, errorContext } from "../kinds.ts";
import type { NodeKind } from "./implement.ts";
import type { StandardSchema } from "./standardSchema.ts";
import type { StandardFailureResult } from "./standardSchema.ts";
import type { TraversalContext } from "./traversal.ts";

@@ -24,3 +24,3 @@ import { arkKind } from "./utils.ts";

}
export declare class ArkErrors extends ReadonlyArray<ArkError> implements StandardSchema.Failure {
export declare class ArkErrors extends ReadonlyArray<ArkError> implements StandardFailureResult {
protected ctx: TraversalContext;

@@ -27,0 +27,0 @@ constructor(ctx: TraversalContext);

/** Subset of types from https://github.com/standard-schema/standard-schema */
export interface StandardSchema<In, Out> extends StandardSchema.ConstantProps {
readonly "~types": StandardSchema.Types<In, Out>;
"~validate": StandardSchema.Validator<Out>;
/**
* The Standard Schema interface.
*/
export interface StandardSchema<Input = unknown, Output = Input> {
/**
* The Standard Schema properties.
*/
readonly "~standard": StandardSchemaProps<Input, Output>;
}
export declare namespace StandardSchema {
interface ConstantProps {
readonly "~standard": 1;
readonly "~vendor": "arktype";
}
interface Types<In, Out> {
input: In;
output: Out;
}
type Validator<Out> = (input: Input) => Result<Out>;
interface Input {
value: unknown;
}
type Result<Out> = Success<Out> | Failure;
interface Success<Out> {
value: Out;
issues?: undefined;
}
interface Failure {
readonly issues: readonly Issue[];
}
interface Issue {
readonly message: string;
readonly path: readonly PropertyKey[];
}
/**
* The Standard Schema properties interface.
*/
export interface StandardSchemaProps<Input = unknown, Output = Input> {
/**
* The version number of the standard.
*/
readonly version: 1;
/**
* The vendor name of the schema library.
*/
readonly vendor: string;
/**
* Validates unknown input values.
*/
readonly validate: (value: unknown) => StandardResult<Output> | Promise<StandardResult<Output>>;
/**
* Inferred types associated with the schema.
*/
readonly types?: StandardTypes<Input, Output> | undefined;
}
export interface ArkTypeStandardSchemaProps<Input = unknown, Output = Input> extends StandardSchemaProps<Input, Output> {
readonly vendor: "arktype";
}
/**
* The result interface of the validate function.
*/
type StandardResult<Output> = StandardSuccessResult<Output> | StandardFailureResult;
/**
* The result interface if validation succeeds.
*/
interface StandardSuccessResult<Output> {
/**
* The typed output value.
*/
readonly value: Output;
/**
* The non-existent issues.
*/
readonly issues?: undefined;
}
/**
* The result interface if validation fails.
*/
export interface StandardFailureResult {
/**
* The issues of failed validation.
*/
readonly issues: ReadonlyArray<StandardIssue>;
}
/**
* The issue interface of the failure output.
*/
export interface StandardIssue {
/**
* The error message of the issue.
*/
readonly message: string;
/**
* The path of the issue, if any.
*/
readonly path?: ReadonlyArray<PropertyKey | StandardPathSegment> | undefined;
}
/**
* The path segment interface of the issue.
*/
interface StandardPathSegment {
/**
* The key representing a path segment.
*/
readonly key: PropertyKey;
}
/**
* The base types interface of Standard Schema.
*/
interface StandardTypes<Input, Output> {
/**
* The input type of the schema.
*/
readonly input: Input;
/**
* The output type of the schema.
*/
readonly output: Output;
}
export {};

@@ -0,1 +1,2 @@

/** Subset of types from https://github.com/standard-schema/standard-schema */
export {};
{
"name": "@ark/schema",
"version": "0.22.0",
"version": "0.23.0",
"license": "MIT",

@@ -32,3 +32,3 @@ "author": {

"dependencies": {
"@ark/util": "0.22.0"
"@ark/util": "0.23.0"
},

@@ -35,0 +35,0 @@ "publishConfig": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc