{
  "package": "@arki/schema",
  "version": "0.2.0",
  "entries": [
    {
      "subpath": ".",
      "name": "assert",
      "kind": "function",
      "signature": "export declare function assert<Schema extends StandardSchemaV1>(value: unknown, schema: Schema, options?: AssertOptions): asserts value is StandardSchemaV1.InferInput<Schema>;",
      "jsdocSummary": "Throw `AssertError` unless `value` matches the schema, and narrow the variable to the schema's input type. It never transforms: use {@link ensure} for the output. A rejection is a bug in the caller (`ARKI_SCHEMA_E004`); use `parse` where bad data is expected."
    },
    {
      "subpath": ".",
      "name": "AssertError",
      "kind": "class",
      "signature": "export declare class AssertError extends Error { readonly code: AssertErrorCode; /** The schema's issues, with the value redacted out of each message. Empty for `asyncAssert`. */ readonly issues: readonly StandardSchemaV1.Issue[]; /** What to do about it, in one sentence. */ readonly remediation: string; constructor(code: AssertErrorCode, message: string, remediation: string, issues: readonly StandardSchemaV1.Issue[], options?: ErrorOptions); }",
      "jsdocSummary": "A value failed `assert` or `ensure`, or a schema could not run synchronously. The message lists the issues with their paths. It never contains the value, because asserted values are often secrets: `issues` holds redacted messages and plain-key paths."
    },
    {
      "subpath": ".",
      "name": "AssertErrorCode",
      "kind": "type",
      "signature": "export type AssertErrorCode = typeof SCHEMA_ERROR_CODES.assertFailed | typeof SCHEMA_ERROR_CODES.asyncAssert;",
      "jsdocSummary": "The code of an {@link AssertError}."
    },
    {
      "subpath": ".",
      "name": "AssertOptions",
      "kind": "type",
      "signature": "export type AssertOptions = { /** Replaces the default headline. A function is called only on failure. */ readonly message?: string | (() => string); /** Names the value in the message, such as `\"PORT\"`. */ readonly at?: string; };",
      "jsdocSummary": "How a failed `assert` or `ensure` describes itself."
    },
    {
      "subpath": ".",
      "name": "ensure",
      "kind": "function",
      "signature": "export declare function ensure<Schema extends StandardSchemaV1>(value: unknown, schema: Schema, options?: AssertOptions): StandardSchemaV1.InferOutput<Schema>;",
      "jsdocSummary": "The schema's output, or `AssertError`: a throwing `parse`."
    },
    {
      "subpath": ".",
      "name": "formatIssues",
      "kind": "function",
      "signature": "export declare function formatIssues(issues: readonly StandardSchemaV1.Issue[]): string;",
      "jsdocSummary": "One line for people: `\"a.0.b: message; message\"`. A root issue has no path prefix."
    },
    {
      "subpath": ".",
      "name": "hasJsonSchema",
      "kind": "function",
      "signature": "export declare function hasJsonSchema<Input, Output>(schema: StandardSchemaV1<Input, Output>): schema is SchemaWithJson<Input, Output>;",
      "jsdocSummary": "True when the schema can also describe itself as JSON Schema (`~standard.jsonSchema`)."
    },
    {
      "subpath": ".",
      "name": "is",
      "kind": "function",
      "signature": "export declare function is<Schema extends StandardSchemaV1>(value: unknown, schema: Schema): value is StandardSchemaV1.InferInput<Schema>;",
      "jsdocSummary": "True when `value` matches the schema. It is a guard, so a rejected value is `false`, never a throw. An async schema throws `ARKI_SCHEMA_E005` instead of answering `false`, because `false` would silently mean \"invalid\" for data that may be fine."
    },
    {
      "subpath": ".",
      "name": "isStandardSchema",
      "kind": "function",
      "signature": "export declare function isStandardSchema(value: unknown): value is StandardSchemaV1;",
      "jsdocSummary": "True when `value` is a Standard Schema v1: it has `~standard` with `version` 1, a string `vendor` and a `validate` function. Functions count, because ArkType types are callable."
    },
    {
      "subpath": ".",
      "name": "parse",
      "kind": "function",
      "signature": "export declare function parse<Output>(schema: StandardSchemaV1<unknown, Output>, value: unknown): Output | import(\"./failure.js\").Failure<\"schema.async_required\", undefined> | import(\"./failure.js\").Failure<\"schema.invalid_input\", { issues: readonly StandardSchemaV1.Issue[]; }> | import(\"./failure.js\").Failure<\"schema.validator_defect\", undefined>;",
      "jsdocSummary": "The schema's output, or an invalid-input, async-schema or validator-defect failure."
    },
    {
      "subpath": ".",
      "name": "parseAsync",
      "kind": "function",
      "signature": "export declare function parseAsync<Output>(schema: StandardSchemaV1<unknown, Output>, value: unknown): Promise<Output | import(\"./failure.js\").Failure<\"schema.invalid_input\", { issues: readonly StandardSchemaV1.Issue[]; }> | import(\"./failure.js\").Failure<\"schema.validator_defect\", undefined>>;",
      "jsdocSummary": "The schema's output, or an invalid-input or validator-defect failure."
    },
    {
      "subpath": ".",
      "name": "pathOf",
      "kind": "function",
      "signature": "export declare function pathOf(issue: StandardSchemaV1.Issue): readonly PropertyKey[];",
      "jsdocSummary": "The path of an issue as plain keys: `{ key }` segments (Valibot writes these) are unwrapped. Empty when the issue is about the whole value."
    },
    {
      "subpath": ".",
      "name": "plainObjectSchema",
      "kind": "variable",
      "signature": "export declare const plainObjectSchema: StandardSchemaV1<Record<string, unknown>>;",
      "jsdocSummary": "Accepts an object whose prototype is `Object.prototype` or `null`: object literals and `Object.create(null)`, not class instances, dates or arrays. The value is returned as it is."
    },
    {
      "subpath": ".",
      "name": "recordSchema",
      "kind": "variable",
      "signature": "export declare const recordSchema: StandardSchemaV1<Record<string, unknown>>;",
      "jsdocSummary": "Accepts a non-null object that is not an array: safe to read string keys from. Class instances and dates count. The value is returned as it is. Use it as `is(value, recordSchema)`."
    },
    {
      "subpath": ".",
      "name": "SCHEMA_ERROR_CODES",
      "kind": "variable",
      "signature": "export declare const SCHEMA_ERROR_CODES: { /** * A `withJsonSchema` converter was asked for a target other than draft-2020-12. * * @fix Ask for the `draft-2020-12` target. * @verify bun run test -- src/vendors.test.ts */ readonly unsupportedTarget: 'ARKI_SCHEMA_E003'; /** * `assert` or `ensure` got a value the schema rejects. The value is a bug in the caller, so it throws instead of returning a failure. * * @fix Read `issues` on the error, then fix the code that produced the value. Use `parse` where bad data is expected. * @verify bun run test -- src/assert.test.ts */ readonly assertFailed: 'ARKI_SCHEMA_E004'; /** * `is`, `assert` or `ensure` got a schema that validates asynchronously. They are synchronous and cannot wait for it. * * @fix Use `parseAsync`, or a schema that validates synchronously. * @verify bun run test -- src/assert.test.ts */ readonly asyncAssert: 'ARKI_SCHEMA_E005'; };",
      "jsdocSummary": "Stable error codes of `@arki/schema`."
    },
    {
      "subpath": ".",
      "name": "SchemaInput",
      "kind": "type",
      "signature": "export type SchemaInput<Schema extends StandardSchemaV1> = StandardSchemaV1.InferInput<Schema>;",
      "jsdocSummary": "The type a schema accepts."
    },
    {
      "subpath": ".",
      "name": "SchemaOutput",
      "kind": "type",
      "signature": "export type SchemaOutput<Schema extends StandardSchemaV1> = StandardSchemaV1.InferOutput<Schema>;",
      "jsdocSummary": "The type a schema returns after validation."
    },
    {
      "subpath": ".",
      "name": "SchemaRunError",
      "kind": "class",
      "signature": "export declare class SchemaRunError extends Error { readonly code: SchemaRunErrorCode; /** What to do about it, in one sentence. */ readonly remediation: string; constructor(code: SchemaRunErrorCode, message: string, remediation: string, options?: ErrorOptions); }",
      "jsdocSummary": "A JSON Schema converter was asked for an unsupported target."
    },
    {
      "subpath": ".",
      "name": "SchemaRunErrorCode",
      "kind": "type",
      "signature": "export type SchemaRunErrorCode = typeof SCHEMA_ERROR_CODES.unsupportedTarget;",
      "jsdocSummary": "The code of a {@link SchemaRunError}."
    },
    {
      "subpath": ".",
      "name": "SchemaWithJson",
      "kind": "type",
      "signature": "export type SchemaWithJson<Input = unknown, Output = Input> = StandardSchemaV1<Input, Output> & StandardJSONSchemaV1<Input, Output>;",
      "jsdocSummary": "A Standard Schema that can also describe itself as JSON Schema."
    },
    {
      "subpath": ".",
      "name": "StandardJSONSchemaV1",
      "kind": "interface",
      "signature": "interface StandardJSONSchemaV1<Input = unknown, Output = Input> { /** The Standard JSON Schema properties. */ readonly \"~standard\": StandardJSONSchemaV1.Props<Input, Output>; } ; declare namespace StandardJSONSchemaV1 { /** The Standard JSON Schema properties interface. */ interface Props<Input = unknown, Output = Input> extends StandardTypedV1.Props<Input, Output> { /** Methods for generating the input/output JSON Schema. */ readonly jsonSchema: StandardJSONSchemaV1.Converter; } /** The Standard JSON Schema converter interface. */ interface Converter { /** Converts the input type to JSON Schema. May throw if conversion is not supported. */ readonly input: (options: StandardJSONSchemaV1.Options) => Record<string, unknown>; /** Converts the output type to JSON Schema. May throw if conversion is not supported. */ readonly output: (options: StandardJSONSchemaV1.Options) => Record<string, unknown>; } /** * The target version of the generated JSON Schema. * * It is *strongly recommended* that implementers support `\"draft-2020-12\"` and `\"draft-07\"`, as they are both in wide use. All other targets can be implemented on a best-effort basis. Libraries should throw if they don't support a specified target. * * The `\"openapi-3.0\"` target is intended as a standardized specifier for OpenAPI 3.0 which is a superset of JSON Schema `\"draft-04\"`. */ type Target = \"draft-2020-12\" | \"draft-07\" | \"openapi-3.0\" | ({} & string); /** The options for the input/output methods. */ interface Options { /** Specifies the target version of the generated JSON Schema. Support for all versions is on a best-effort basis. If a given version is not supported, the library should throw. */ readonly target: Target; /** Explicit support for additional vendor-specific parameters, if needed. */ readonly libraryOptions?: Record<string, unknown> | undefined; } /** The Standard types interface. */ interface Types<Input = unknown, Output = Input> extends StandardTypedV1.Types<Input, Output> { } /** Infers the input type of a Standard. */ type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>; /** Infers the output type of a Standard. */ type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>; }",
      "jsdocSummary": "The Standard JSON Schema interface."
    },
    {
      "subpath": ".",
      "name": "StandardSchemaV1",
      "kind": "interface",
      "signature": "interface StandardSchemaV1<Input = unknown, Output = Input> { /** The Standard Schema properties. */ readonly \"~standard\": StandardSchemaV1.Props<Input, Output>; } ; declare namespace StandardSchemaV1 { /** The Standard Schema properties interface. */ interface Props<Input = unknown, Output = Input> extends StandardTypedV1.Props<Input, Output> { /** Validates unknown input values. */ readonly validate: (value: unknown, options?: StandardSchemaV1.Options | undefined) => Result<Output> | Promise<Result<Output>>; } /** The result interface of the validate function. */ type Result<Output> = SuccessResult<Output> | FailureResult; /** The result interface if validation succeeds. */ interface SuccessResult<Output> { /** The typed output value. */ readonly value: Output; /** A falsy value for `issues` indicates success. */ readonly issues?: undefined; } interface Options { /** Explicit support for additional vendor-specific parameters, if needed. */ readonly libraryOptions?: Record<string, unknown> | undefined; } /** The result interface if validation fails. */ interface FailureResult { /** The issues of failed validation. */ readonly issues: ReadonlyArray<Issue>; } /** The issue interface of the failure output. */ interface Issue { /** The error message of the issue. */ readonly message: string; /** The path of the issue, if any. */ readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined; } /** The path segment interface of the issue. */ interface PathSegment { /** The key representing a path segment. */ readonly key: PropertyKey; } /** The Standard types interface. */ interface Types<Input = unknown, Output = Input> extends StandardTypedV1.Types<Input, Output> { } /** Infers the input type of a Standard. */ type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>; /** Infers the output type of a Standard. */ type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>; }",
      "jsdocSummary": "The Standard Schema interface."
    },
    {
      "subpath": ".",
      "name": "withJsonSchema",
      "kind": "function",
      "signature": "export declare function withJsonSchema<Input, Output>(schema: StandardSchemaV1<Input, Output>, input: Record<string, unknown>, output?: Record<string, unknown>): SchemaWithJson<Input, Output>;",
      "jsdocSummary": "A new schema that validates like `schema` and describes itself with the given JSON Schema (`output` defaults to `input`). Use it for a validator that cannot produce JSON Schema on its own. It answers only the `draft-2020-12` target; any other throws `ARKI_SCHEMA_E003`."
    }
  ],
  "groups": [],
  "errorCodes": [
    "ARKI_SCHEMA_E003",
    "ARKI_SCHEMA_E004",
    "ARKI_SCHEMA_E005"
  ]
}
