{"name":"@standard-schema/spec","version":"1.0.0","keywords":["typescript","schema","validation","standard","interface"],"author":{"name":"Colin McDonnell"},"license":"MIT","_id":"@standard-schema/spec@1.0.0","maintainers":[{"name":"fabian-hiller","email":"hillerfabian11@gmail.com"},{"name":"colinhacks","email":"colinmcd94@gmail.com"}],"homepage":"https://standardschema.dev","bugs":{"url":"https://github.com/standard-schema/standard-schema/issues"},"dist":{"shasum":"f193b73dc316c4170f2e82a881da0f550d551b9c","tarball":"http://registry-npm.ywwl.com/@standard-schema/spec/download/@standard-schema/spec-1.0.0.tgz","fileCount":7,"integrity":"sha512-m2bOd0f2RT9k8QJx1JN85cZYyH1RqFBdlwtkSlf4tBDYLCiiZnv1fIIwacK6cqwXavOydf0NPToMQgpKq+dVlA==","signatures":[{"sig":"MEUCICTWJMg9W+i+lPtG+3RATbCunvUNxvQj18/6IhHF6lpRAiEAjE09RnIUp7AyNhrlbFFOw3ENa8JVlMzCxZDIsXI4wwA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@standard-schema%2fspec@1.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":25008,"size":7412,"noattachment":false,"key":"/@standard-schema/spec/-/@standard-schema/spec-1.0.0.tgz"},"main":"./dist/index.js","type":"module","_from":"file:standard-schema-spec-1.0.0.tgz","types":"./dist/index.d.ts","exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"scripts":{"lint":"pnpm biome lint ./src","build":"tsup","check":"pnpm biome check ./src","format":"pnpm biome format --write ./src"},"_npmUser":{"name":"fabian-hiller","email":"hillerfabian11@gmail.com"},"_resolved":"/tmp/092ac65b2db5e85815b20835b0230da5/standard-schema-spec-1.0.0.tgz","_integrity":"sha512-m2bOd0f2RT9k8QJx1JN85cZYyH1RqFBdlwtkSlf4tBDYLCiiZnv1fIIwacK6cqwXavOydf0NPToMQgpKq+dVlA==","repository":{"url":"git+https://github.com/standard-schema/standard-schema.git","type":"git"},"_npmVersion":"10.8.2","description":"A standard interface for TypeScript schema validation libraries","directories":{},"sideEffects":false,"_nodeVersion":"20.18.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.0","typescript":"^5.6.2"},"_npmOperationalInternal":{"tmp":"tmp/spec_1.0.0_1737946999155_0.8220776792324331","host":"s3://npm-registry-packages-npm-production"},"readme":"<h1 align=\"center\">\n  <img alt=\"Standard Schema fire logo\" loading=\"lazy\" width=\"50\" height=\"50\" decoding=\"async\" data-nimg=\"1\" style=\"color:transparent\" src=\"https://standardschema.dev/favicon.svg\">\n  </br>\n  Standard Schema</h1>\n<p align=\"center\">\n  A family of specs for interoperable TypeScript\n  <br/>\n  <a href=\"https://standardschema.dev\">standardschema.dev</a>\n</p>\n<br/>\n\n<!-- start -->\n\nThe Standard Schema project is a set of interfaces that standardize the provision and consumption of shared functionality in the TypeScript ecosystem.\n\nIts goal is to allow tools to accept a single input that includes all the types and capabilities they need— no library-specific adapters, no extra dependencies. The result is an ecosystem that's fair for implementers, friendly for consumers, and open for end users.\n\n## The specifications\n\nThe specifications can be found below in their entirety. Libraries wishing to implement a spec can copy/paste the code block below into their codebase. They're also available at `@standard-schema/spec` on [npm](https://www.npmjs.com/package/@standard-schema/spec) and [JSR](https://jsr.io/@standard-schema/spec).\n\n```ts\n// #########################\n// ###   Standard Typed  ###\n// #########################\n\n/** The Standard Typed interface. This is a base type extended by other specs. */\nexport interface StandardTypedV1<Input = unknown, Output = Input> {\n  /** The Standard properties. */\n  readonly \"~standard\": StandardTypedV1.Props<Input, Output>;\n}\n\nexport declare namespace StandardTypedV1 {\n  /** The Standard Typed properties interface. */\n  export interface Props<Input = unknown, Output = Input> {\n    /** The version number of the standard. */\n    readonly version: 1;\n    /** The vendor name of the schema library. */\n    readonly vendor: string;\n    /** Inferred types associated with the schema. */\n    readonly types?: Types<Input, Output> | undefined;\n  }\n\n  /** The Standard Typed types interface. */\n  export interface Types<Input = unknown, Output = Input> {\n    /** The input type of the schema. */\n    readonly input: Input;\n    /** The output type of the schema. */\n    readonly output: Output;\n  }\n\n  /** Infers the input type of a Standard Typed. */\n  export type InferInput<Schema extends StandardTypedV1> = NonNullable<\n    Schema[\"~standard\"][\"types\"]\n  >[\"input\"];\n\n  /** Infers the output type of a Standard Typed. */\n  export type InferOutput<Schema extends StandardTypedV1> = NonNullable<\n    Schema[\"~standard\"][\"types\"]\n  >[\"output\"];\n}\n\n// ##########################\n// ###   Standard Schema  ###\n// ##########################\n\n/** The Standard Schema interface. */\nexport interface StandardSchemaV1<Input = unknown, Output = Input> {\n  /** The Standard Schema properties. */\n  readonly \"~standard\": StandardSchemaV1.Props<Input, Output>;\n}\n\nexport declare namespace StandardSchemaV1 {\n  /** The Standard Schema properties interface. */\n  export interface Props<Input = unknown, Output = Input>\n    extends StandardTypedV1.Props<Input, Output> {\n    /** Validates unknown input values. */\n    readonly validate: (\n      value: unknown,\n      options?: StandardSchemaV1.Options | undefined\n    ) => Result<Output> | Promise<Result<Output>>;\n  }\n\n  /** The result interface of the validate function. */\n  export type Result<Output> = SuccessResult<Output> | FailureResult;\n\n  /** The result interface if validation succeeds. */\n  export interface SuccessResult<Output> {\n    /** The typed output value. */\n    readonly value: Output;\n    /** A falsy value for `issues` indicates success. */\n    readonly issues?: undefined;\n  }\n\n  export interface Options {\n    /** Explicit support for additional vendor-specific parameters, if needed. */\n    readonly libraryOptions?: Record<string, unknown> | undefined;\n  }\n\n  /** The result interface if validation fails. */\n  export interface FailureResult {\n    /** The issues of failed validation. */\n    readonly issues: ReadonlyArray<Issue>;\n  }\n\n  /** The issue interface of the failure output. */\n  export interface Issue {\n    /** The error message of the issue. */\n    readonly message: string;\n    /** The path of the issue, if any. */\n    readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;\n  }\n\n  /** The path segment interface of the issue. */\n  export interface PathSegment {\n    /** The key representing a path segment. */\n    readonly key: PropertyKey;\n  }\n\n  /** The Standard types interface. */\n  export interface Types<Input = unknown, Output = Input>\n    extends StandardTypedV1.Types<Input, Output> {}\n\n  /** Infers the input type of a Standard. */\n  export type InferInput<Schema extends StandardTypedV1> =\n    StandardTypedV1.InferInput<Schema>;\n\n  /** Infers the output type of a Standard. */\n  export type InferOutput<Schema extends StandardTypedV1> =\n    StandardTypedV1.InferOutput<Schema>;\n}\n\n// ###############################\n// ###   Standard JSON Schema  ###\n// ###############################\n\n/** The Standard JSON Schema interface. */\nexport interface StandardJSONSchemaV1<Input = unknown, Output = Input> {\n  /** The Standard JSON Schema properties. */\n  readonly \"~standard\": StandardJSONSchemaV1.Props<Input, Output>;\n}\n\nexport declare namespace StandardJSONSchemaV1 {\n  /** The Standard JSON Schema properties interface. */\n  export interface Props<Input = unknown, Output = Input>\n    extends StandardTypedV1.Props<Input, Output> {\n    /** Methods for generating the input/output JSON Schema. */\n    readonly jsonSchema: StandardJSONSchemaV1.Converter;\n  }\n\n  /** The Standard JSON Schema converter interface. */\n  export interface Converter {\n    /** Converts the input type to JSON Schema. May throw if conversion is not supported. */\n    readonly input: (\n      options: StandardJSONSchemaV1.Options\n    ) => Record<string, unknown>;\n    /** Converts the output type to JSON Schema. May throw if conversion is not supported. */\n    readonly output: (\n      options: StandardJSONSchemaV1.Options\n    ) => Record<string, unknown>;\n  }\n\n  /**\n   * The target version of the generated JSON Schema.\n   *\n   * 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.\n   *\n   * The `\"openapi-3.0\"` target is intended as a standardized specifier for OpenAPI 3.0 which is a superset of JSON Schema `\"draft-04\"`.\n   */\n  export type Target =\n    | \"draft-2020-12\"\n    | \"draft-07\"\n    | \"openapi-3.0\"\n    // Accepts any string for future targets while preserving autocomplete\n    | ({} & string);\n\n  /** The options for the input/output methods. */\n  export interface Options {\n    /** 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. */\n    readonly target: Target;\n\n    /** Explicit support for additional vendor-specific parameters, if needed. */\n    readonly libraryOptions?: Record<string, unknown> | undefined;\n  }\n\n  /** The Standard types interface. */\n  export interface Types<Input = unknown, Output = Input>\n    extends StandardTypedV1.Types<Input, Output> {}\n\n  /** Infers the input type of a Standard. */\n  export type InferInput<Schema extends StandardTypedV1> =\n    StandardTypedV1.InferInput<Schema>;\n\n  /** Infers the output type of a Standard. */\n  export type InferOutput<Schema extends StandardTypedV1> =\n    StandardTypedV1.InferOutput<Schema>;\n}\n```\n","publish_time":1737946999334,"_cnpm_publish_time":1737946999334,"dist-tags":{"latest":"1.1.0"}}