{"name":"@standard-schema/spec","description":"A family of specs for interoperable TypeScript","version":"1.1.0","license":"MIT","author":{"name":"Colin McDonnell"},"homepage":"https://standardschema.dev","repository":{"type":"git","url":"git+https://github.com/standard-schema/standard-schema.git"},"keywords":["typescript","schema","validation","standard","interface"],"type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"standard-schema-spec":"./src/index.ts","import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"sideEffects":false,"publishConfig":{"access":"public"},"devDependencies":{"tsup":"^8.3.0","typescript":"^5.6.2"},"scripts":{"lint":"pnpm biome lint ./src","format":"pnpm biome format --write ./src","check":"pnpm biome check ./src","build":"tsup"},"_id":"@standard-schema/spec@1.1.0","bugs":{"url":"https://github.com/standard-schema/standard-schema/issues"},"_integrity":"sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==","_resolved":"/tmp/f2c1cda6513eef9a66a2729cbb7934e4/standard-schema-spec-1.1.0.tgz","_from":"file:standard-schema-spec-1.1.0.tgz","_nodeVersion":"20.19.6","_npmVersion":"10.8.2","dist":{"integrity":"sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==","shasum":"a79b55dbaf8604812f52d140b2c9ab41bc150bb8","tarball":"http://registry-npm.ywwl.com/@standard-schema/spec/download/@standard-schema/spec-1.1.0.tgz","fileCount":7,"unpackedSize":22634,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@standard-schema%2fspec@1.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIGdCUE4g1c6RO81SGehjWNra28GX4mcyQ77hk1CGKESMAiBiyPqcj8S2TGWwYdiiDGoeurLutzxBTPQRNVt0c/IfUQ=="}],"size":4178,"noattachment":false,"key":"/@standard-schema/spec/-/@standard-schema/spec-1.1.0.tgz"},"_npmUser":{"name":"fabian-hiller","email":"hillerfabian11@gmail.com"},"directories":{},"maintainers":[{"name":"fabian-hiller","email":"hillerfabian11@gmail.com"},{"name":"colinhacks","email":"colinmcd94@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/spec_1.1.0_1765831786291_0.4301069348914006"},"_hasShrinkwrap":false,"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":1765831786431,"_cnpm_publish_time":1765831786431,"dist-tags":{"latest":"1.1.0"}}