@vielzeug/spell 26.11.9 → 26.11.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (236) hide show
  1. package/README.md +1 -1
  2. package/dist/_dev.cjs.map +1 -1
  3. package/dist/_dev.js.map +1 -1
  4. package/dist/_object.cjs +2 -0
  5. package/dist/_object.cjs.map +1 -0
  6. package/dist/_object.d.ts +9 -0
  7. package/dist/_object.d.ts.map +1 -0
  8. package/dist/_object.js +2 -0
  9. package/dist/_object.js.map +1 -0
  10. package/dist/_parse.cjs +2 -0
  11. package/dist/_parse.cjs.map +1 -0
  12. package/dist/_parse.d.ts +38 -0
  13. package/dist/_parse.d.ts.map +1 -0
  14. package/dist/_parse.js +2 -0
  15. package/dist/_parse.js.map +1 -0
  16. package/dist/errors.cjs +2 -2
  17. package/dist/errors.cjs.map +1 -1
  18. package/dist/errors.d.ts +15 -26
  19. package/dist/errors.d.ts.map +1 -1
  20. package/dist/errors.js +2 -2
  21. package/dist/errors.js.map +1 -1
  22. package/dist/index.cjs +1 -1
  23. package/dist/index.d.ts +4 -4
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +1 -1
  26. package/dist/json.cjs +2 -1
  27. package/dist/json.cjs.map +1 -0
  28. package/dist/json.d.ts +8 -1
  29. package/dist/json.d.ts.map +1 -1
  30. package/dist/json.js +2 -1
  31. package/dist/json.js.map +1 -0
  32. package/dist/messages.cjs +1 -1
  33. package/dist/messages.cjs.map +1 -1
  34. package/dist/messages.d.ts +7 -6
  35. package/dist/messages.d.ts.map +1 -1
  36. package/dist/messages.js +1 -1
  37. package/dist/messages.js.map +1 -1
  38. package/dist/predicates.cjs +2 -1
  39. package/dist/predicates.cjs.map +1 -0
  40. package/dist/predicates.d.ts +41 -2
  41. package/dist/predicates.d.ts.map +1 -1
  42. package/dist/predicates.js +2 -1
  43. package/dist/predicates.js.map +1 -0
  44. package/dist/s.cjs +1 -1
  45. package/dist/s.cjs.map +1 -1
  46. package/dist/s.d.ts +21 -22
  47. package/dist/s.d.ts.map +1 -1
  48. package/dist/s.js +1 -1
  49. package/dist/s.js.map +1 -1
  50. package/dist/schema.cjs +2 -0
  51. package/dist/schema.cjs.map +1 -0
  52. package/dist/schema.d.ts +93 -0
  53. package/dist/schema.d.ts.map +1 -0
  54. package/dist/schema.js +2 -0
  55. package/dist/schema.js.map +1 -0
  56. package/dist/schemas/array.cjs +1 -1
  57. package/dist/schemas/array.cjs.map +1 -1
  58. package/dist/schemas/array.d.ts +22 -32
  59. package/dist/schemas/array.d.ts.map +1 -1
  60. package/dist/schemas/array.js +1 -1
  61. package/dist/schemas/array.js.map +1 -1
  62. package/dist/schemas/bigint.cjs +1 -1
  63. package/dist/schemas/bigint.cjs.map +1 -1
  64. package/dist/schemas/bigint.d.ts +14 -18
  65. package/dist/schemas/bigint.d.ts.map +1 -1
  66. package/dist/schemas/bigint.js +1 -1
  67. package/dist/schemas/bigint.js.map +1 -1
  68. package/dist/schemas/date.cjs +1 -1
  69. package/dist/schemas/date.cjs.map +1 -1
  70. package/dist/schemas/date.d.ts +7 -6
  71. package/dist/schemas/date.d.ts.map +1 -1
  72. package/dist/schemas/date.js +1 -1
  73. package/dist/schemas/date.js.map +1 -1
  74. package/dist/schemas/discriminated-union.cjs +2 -0
  75. package/dist/schemas/discriminated-union.cjs.map +1 -0
  76. package/dist/schemas/discriminated-union.d.ts +39 -0
  77. package/dist/schemas/discriminated-union.d.ts.map +1 -0
  78. package/dist/schemas/discriminated-union.js +2 -0
  79. package/dist/schemas/discriminated-union.js.map +1 -0
  80. package/dist/schemas/intersect.cjs +1 -1
  81. package/dist/schemas/intersect.cjs.map +1 -1
  82. package/dist/schemas/intersect.d.ts +10 -9
  83. package/dist/schemas/intersect.d.ts.map +1 -1
  84. package/dist/schemas/intersect.js +1 -1
  85. package/dist/schemas/intersect.js.map +1 -1
  86. package/dist/schemas/lazy.cjs +1 -1
  87. package/dist/schemas/lazy.cjs.map +1 -1
  88. package/dist/schemas/lazy.d.ts +10 -10
  89. package/dist/schemas/lazy.d.ts.map +1 -1
  90. package/dist/schemas/lazy.js +1 -1
  91. package/dist/schemas/lazy.js.map +1 -1
  92. package/dist/schemas/map.cjs +1 -1
  93. package/dist/schemas/map.cjs.map +1 -1
  94. package/dist/schemas/map.d.ts +8 -7
  95. package/dist/schemas/map.d.ts.map +1 -1
  96. package/dist/schemas/map.js +1 -1
  97. package/dist/schemas/map.js.map +1 -1
  98. package/dist/schemas/number.cjs +1 -1
  99. package/dist/schemas/number.cjs.map +1 -1
  100. package/dist/schemas/number.d.ts +20 -27
  101. package/dist/schemas/number.d.ts.map +1 -1
  102. package/dist/schemas/number.js +1 -1
  103. package/dist/schemas/number.js.map +1 -1
  104. package/dist/schemas/object.cjs +1 -1
  105. package/dist/schemas/object.cjs.map +1 -1
  106. package/dist/schemas/object.d.ts +40 -88
  107. package/dist/schemas/object.d.ts.map +1 -1
  108. package/dist/schemas/object.js +1 -1
  109. package/dist/schemas/object.js.map +1 -1
  110. package/dist/schemas/primitives.cjs +2 -0
  111. package/dist/schemas/primitives.cjs.map +1 -0
  112. package/dist/schemas/primitives.d.ts +38 -0
  113. package/dist/schemas/primitives.d.ts.map +1 -0
  114. package/dist/schemas/primitives.js +2 -0
  115. package/dist/schemas/primitives.js.map +1 -0
  116. package/dist/schemas/record.cjs +1 -1
  117. package/dist/schemas/record.cjs.map +1 -1
  118. package/dist/schemas/record.d.ts +7 -8
  119. package/dist/schemas/record.d.ts.map +1 -1
  120. package/dist/schemas/record.js +1 -1
  121. package/dist/schemas/record.js.map +1 -1
  122. package/dist/schemas/set.cjs +1 -1
  123. package/dist/schemas/set.cjs.map +1 -1
  124. package/dist/schemas/set.d.ts +8 -7
  125. package/dist/schemas/set.d.ts.map +1 -1
  126. package/dist/schemas/set.js +1 -1
  127. package/dist/schemas/set.js.map +1 -1
  128. package/dist/schemas/string.cjs +1 -1
  129. package/dist/schemas/string.cjs.map +1 -1
  130. package/dist/schemas/string.d.ts +42 -98
  131. package/dist/schemas/string.d.ts.map +1 -1
  132. package/dist/schemas/string.js +1 -1
  133. package/dist/schemas/string.js.map +1 -1
  134. package/dist/schemas/tuple.cjs +1 -1
  135. package/dist/schemas/tuple.cjs.map +1 -1
  136. package/dist/schemas/tuple.d.ts +9 -9
  137. package/dist/schemas/tuple.d.ts.map +1 -1
  138. package/dist/schemas/tuple.js +1 -1
  139. package/dist/schemas/tuple.js.map +1 -1
  140. package/dist/schemas/union.cjs +1 -1
  141. package/dist/schemas/union.cjs.map +1 -1
  142. package/dist/schemas/union.d.ts +9 -7
  143. package/dist/schemas/union.d.ts.map +1 -1
  144. package/dist/schemas/union.js +1 -1
  145. package/dist/schemas/union.js.map +1 -1
  146. package/dist/spell.cjs +2 -2
  147. package/dist/spell.cjs.map +1 -1
  148. package/dist/spell.iife.js +2 -2
  149. package/dist/spell.iife.js.map +1 -1
  150. package/dist/spell.js +842 -1601
  151. package/dist/spell.js.map +1 -1
  152. package/dist/types.cjs +1 -1
  153. package/dist/types.cjs.map +1 -1
  154. package/dist/types.d.ts +151 -265
  155. package/dist/types.d.ts.map +1 -1
  156. package/dist/types.js +1 -1
  157. package/dist/types.js.map +1 -1
  158. package/package.json +2 -2
  159. package/dist/core.cjs +0 -2
  160. package/dist/core.cjs.map +0 -1
  161. package/dist/core.d.ts +0 -101
  162. package/dist/core.d.ts.map +0 -1
  163. package/dist/core.js +0 -2
  164. package/dist/core.js.map +0 -1
  165. package/dist/formats.cjs +0 -2
  166. package/dist/formats.cjs.map +0 -1
  167. package/dist/formats.d.ts +0 -41
  168. package/dist/formats.d.ts.map +0 -1
  169. package/dist/formats.js +0 -2
  170. package/dist/formats.js.map +0 -1
  171. package/dist/json-schema.cjs +0 -2
  172. package/dist/json-schema.cjs.map +0 -1
  173. package/dist/json-schema.d.ts +0 -5
  174. package/dist/json-schema.d.ts.map +0 -1
  175. package/dist/json-schema.js +0 -2
  176. package/dist/json-schema.js.map +0 -1
  177. package/dist/safe-object.cjs +0 -2
  178. package/dist/safe-object.cjs.map +0 -1
  179. package/dist/safe-object.d.ts +0 -6
  180. package/dist/safe-object.d.ts.map +0 -1
  181. package/dist/safe-object.js +0 -2
  182. package/dist/safe-object.js.map +0 -1
  183. package/dist/schemas/boolean.cjs +0 -2
  184. package/dist/schemas/boolean.cjs.map +0 -1
  185. package/dist/schemas/boolean.d.ts +0 -9
  186. package/dist/schemas/boolean.d.ts.map +0 -1
  187. package/dist/schemas/boolean.js +0 -2
  188. package/dist/schemas/boolean.js.map +0 -1
  189. package/dist/schemas/enum.cjs +0 -2
  190. package/dist/schemas/enum.cjs.map +0 -1
  191. package/dist/schemas/enum.d.ts +0 -12
  192. package/dist/schemas/enum.d.ts.map +0 -1
  193. package/dist/schemas/enum.js +0 -2
  194. package/dist/schemas/enum.js.map +0 -1
  195. package/dist/schemas/instanceof.cjs +0 -2
  196. package/dist/schemas/instanceof.cjs.map +0 -1
  197. package/dist/schemas/instanceof.d.ts +0 -9
  198. package/dist/schemas/instanceof.d.ts.map +0 -1
  199. package/dist/schemas/instanceof.js +0 -2
  200. package/dist/schemas/instanceof.js.map +0 -1
  201. package/dist/schemas/literal.cjs +0 -2
  202. package/dist/schemas/literal.cjs.map +0 -1
  203. package/dist/schemas/literal.d.ts +0 -9
  204. package/dist/schemas/literal.d.ts.map +0 -1
  205. package/dist/schemas/literal.js +0 -2
  206. package/dist/schemas/literal.js.map +0 -1
  207. package/dist/schemas/never.cjs +0 -2
  208. package/dist/schemas/never.cjs.map +0 -1
  209. package/dist/schemas/never.d.ts +0 -8
  210. package/dist/schemas/never.d.ts.map +0 -1
  211. package/dist/schemas/never.js +0 -2
  212. package/dist/schemas/never.js.map +0 -1
  213. package/dist/schemas/raw-or.cjs +0 -2
  214. package/dist/schemas/raw-or.cjs.map +0 -1
  215. package/dist/schemas/raw-or.d.ts +0 -17
  216. package/dist/schemas/raw-or.d.ts.map +0 -1
  217. package/dist/schemas/raw-or.js +0 -2
  218. package/dist/schemas/raw-or.js.map +0 -1
  219. package/dist/schemas/variant.cjs +0 -2
  220. package/dist/schemas/variant.cjs.map +0 -1
  221. package/dist/schemas/variant.d.ts +0 -37
  222. package/dist/schemas/variant.d.ts.map +0 -1
  223. package/dist/schemas/variant.js +0 -2
  224. package/dist/schemas/variant.js.map +0 -1
  225. package/dist/tolerate.cjs +0 -2
  226. package/dist/tolerate.cjs.map +0 -1
  227. package/dist/tolerate.d.ts +0 -10
  228. package/dist/tolerate.d.ts.map +0 -1
  229. package/dist/tolerate.js +0 -2
  230. package/dist/tolerate.js.map +0 -1
  231. package/dist/validators.cjs +0 -2
  232. package/dist/validators.cjs.map +0 -1
  233. package/dist/validators.d.ts +0 -20
  234. package/dist/validators.d.ts.map +0 -1
  235. package/dist/validators.js +0 -2
  236. package/dist/validators.js.map +0 -1
package/dist/types.cjs CHANGED
@@ -1,2 +1,2 @@
1
- var e={custom:`custom`,invalid_base64:`invalid_base64`,invalid_date:`invalid_date`,invalid_duration:`invalid_duration`,invalid_enum:`invalid_enum`,invalid_finite:`invalid_finite`,invalid_integer:`invalid_integer`,invalid_keys:`invalid_keys`,invalid_length:`invalid_length`,invalid_literal:`invalid_literal`,invalid_multiple_of:`invalid_multiple_of`,invalid_safe:`invalid_safe`,invalid_string:`invalid_string`,invalid_type:`invalid_type`,invalid_union:`invalid_union`,invalid_unique:`invalid_unique`,invalid_url:`invalid_url`,invalid_variant:`invalid_variant`,too_big:`too_big`,too_small:`too_small`};exports.ErrorCode=e;
1
+ var e={custom:`custom`,invalid_date:`invalid_date`,invalid_discriminator:`invalid_discriminator`,invalid_enum:`invalid_enum`,invalid_finite:`invalid_finite`,invalid_format:`invalid_format`,invalid_integer:`invalid_integer`,invalid_keys:`invalid_keys`,invalid_length:`invalid_length`,invalid_literal:`invalid_literal`,invalid_multiple_of:`invalid_multiple_of`,invalid_safe:`invalid_safe`,invalid_type:`invalid_type`,invalid_union:`invalid_union`,invalid_unique:`invalid_unique`,too_big:`too_big`,too_small:`too_small`};exports.ErrorCode=e;
2
2
  //# sourceMappingURL=types.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.cjs","names":["ErrorCode"],"sources":["../src/types.ts"],"sourcesContent":["/* -------------------- Error Codes -------------------- */\n\nexport const ErrorCode = {\n custom: 'custom',\n invalid_base64: 'invalid_base64',\n invalid_date: 'invalid_date',\n invalid_duration: 'invalid_duration',\n invalid_enum: 'invalid_enum',\n invalid_finite: 'invalid_finite',\n invalid_integer: 'invalid_integer',\n invalid_keys: 'invalid_keys',\n invalid_length: 'invalid_length',\n invalid_literal: 'invalid_literal',\n invalid_multiple_of: 'invalid_multiple_of',\n invalid_safe: 'invalid_safe',\n invalid_string: 'invalid_string',\n invalid_type: 'invalid_type',\n invalid_union: 'invalid_union',\n invalid_unique: 'invalid_unique',\n invalid_url: 'invalid_url',\n invalid_variant: 'invalid_variant',\n too_big: 'too_big',\n too_small: 'too_small',\n} as const;\n\nexport type ErrorCode = (typeof ErrorCode)[keyof typeof ErrorCode];\n\n/* -------------------- Messages -------------------- */\n\n/**\n * A validation message: either a static string or a function that receives context and returns a string.\n * **Note:** Static string values are used verbatim with no interpolation. Use the function form\n * for context-dependent messages (e.g. `(ctx) => \\`Must be at least ${ctx.min}\\``).\n */\nexport type MessageFn<Ctx extends Record<string, unknown> = Record<string, unknown>> = string | ((ctx: Ctx) => string);\n\n/* -------------------- JSON Schema -------------------- */\n\n/** Plain JSON Schema object (targeting JSON Schema 2020-12). */\nexport type JsonSchema = Record<string, unknown>;\n\nexport interface StandardSchemaV1<Input = unknown, Output = Input> {\n readonly '~standard': StandardSchemaV1.Props<Input, Output>;\n}\n\nexport declare namespace StandardSchemaV1 {\n interface Props<Input = unknown, Output = Input> {\n readonly types?: Types<Input, Output> | undefined;\n readonly validate: (value: unknown, options?: Options | undefined) => Result<Output> | Promise<Result<Output>>;\n readonly vendor: string;\n readonly version: 1;\n }\n\n type Result<Output> = { readonly issues: readonly Issue[] } | { readonly issues?: undefined; readonly value: Output };\n\n interface Options {\n readonly libraryOptions?: Record<string, unknown> | undefined;\n }\n\n interface Issue {\n readonly message: string;\n readonly path?: readonly (PropertyKey | PathSegment)[] | undefined;\n }\n\n interface PathSegment {\n readonly key: PropertyKey;\n }\n\n interface Types<Input = unknown, Output = Input> {\n readonly input: Input;\n readonly output: Output;\n }\n\n type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema['~standard']['types']>['input'];\n type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema['~standard']['types']>['output'];\n}\n\n/* -------------------- Issues -------------------- */\n\n/**\n * A typed discriminated union of all issues emitted by built-in validators.\n *\n * Narrowing on `code` gives precise access to `params`:\n * ```ts\n * if (error.code === 'too_small') {\n * const min = error.params.min; // number | bigint | Date\n * }\n * ```\n */\nexport type Issue =\n | { code: 'custom'; message: string; params?: Record<string, unknown>; path: (string | number)[] }\n | { code: 'invalid_base64'; message: string; params: { format: string }; path: (string | number)[] }\n | { code: 'invalid_date'; message: string; params?: undefined; path: (string | number)[] }\n | { code: 'invalid_duration'; message: string; params: { format: string }; path: (string | number)[] }\n | { code: 'invalid_enum'; message: string; params: { values: readonly unknown[] }; path: (string | number)[] }\n | { code: 'invalid_finite'; message: string; params?: undefined; path: (string | number)[] }\n | { code: 'invalid_integer'; message: string; params?: undefined; path: (string | number)[] }\n | { code: 'invalid_keys'; message: string; params: { keys: string[] }; path: (string | number)[] }\n | { code: 'invalid_length'; message: string; params: { exact: number }; path: (string | number)[] }\n | { code: 'invalid_literal'; message: string; params: { expected: unknown }; path: (string | number)[] }\n | { code: 'invalid_multiple_of'; message: string; params: { step: number | bigint }; path: (string | number)[] }\n | { code: 'invalid_safe'; message: string; params?: undefined; path: (string | number)[] }\n | {\n code: 'invalid_string';\n message: string;\n params: { format?: string; includes?: string; pattern?: string; prefix?: string; suffix?: string };\n path: (string | number)[];\n }\n | { code: 'invalid_type'; message: string; params?: undefined; path: (string | number)[] }\n | { code: 'invalid_union'; message: string; params: { errors: Issue[][] }; path: (string | number)[] }\n | { code: 'invalid_unique'; message: string; params: { unique: true }; path: (string | number)[] }\n | { code: 'invalid_url'; message: string; params: { format: string }; path: (string | number)[] }\n | {\n code: 'invalid_variant';\n message: string;\n params: { discriminator: string; expected: string[] };\n path: (string | number)[];\n }\n | {\n code: 'too_big';\n message: string;\n params: { exclusive?: boolean; max: number | bigint | Date };\n path: (string | number)[];\n }\n | {\n code: 'too_small';\n message: string;\n params: { exclusive?: boolean; min: number | bigint | Date };\n path: (string | number)[];\n }\n | { code: string & {}; message: string; params?: Record<string, unknown>; path: (string | number)[] };\n\n/** ParseContext carries the active message set through the parse pipeline. */\nexport type ParseContext = {\n messages: import('./messages').Messages;\n};\n\n/**\n * Validator function. Receives the value after type-checking and the active ParseContext.\n * Returns an Issue array on failure, null on success, or a Promise for async validators.\n */\nexport type ValidateFn = (value: unknown, ctx?: ParseContext) => Issue[] | null | Promise<Issue[] | null>;\n\nexport type CheckContext = {\n addIssue: (issue: {\n code: string;\n message: string;\n params?: Record<string, unknown>;\n path?: (string | number)[];\n }) => void;\n};\n\n/**\n * Return type of a `check()` callback.\n * - `string`: validation failed; the string becomes the error message.\n * - `false`: validation failed with no message (use `addIssue` for a message).\n * - `true` / `null` / `void`: validation passed.\n *\n * The shorthand `condition || 'message'` works naturally:\n * ```ts\n * s.string().check((value) => value.length > 0 || 'Cannot be empty')\n * ```\n */\nexport type ValidateResult = boolean | null | undefined | string;\n\n/** Re-exported from errors for convenience: defined there. */\nexport type { FlatError, FlatErrorFirst } from './errors';\n\ntype BaseDescriptor = {\n description?: string;\n isNullable?: boolean;\n isOptional?: boolean;\n};\n\nexport type SchemaDescriptor = BaseDescriptor &\n (\n | { kind: 'unknown' | 'never' | 'boolean' | 'bigint' | 'date' | 'lazy' }\n | { className: string; kind: 'instanceof' }\n | {\n contentEncoding?: string;\n format?: string;\n kind: 'string';\n maxLength?: number;\n minLength?: number;\n pattern?: string | null;\n }\n | {\n exclusiveMaximum?: number;\n exclusiveMinimum?: number;\n kind: 'number';\n maximum?: number;\n minimum?: number;\n multipleOf?: number;\n typeHint?: 'integer';\n }\n | { kind: 'literal'; value: string | number | boolean | null | undefined }\n | { kind: 'enum'; values: readonly (string | number)[] }\n | { items: SchemaDescriptor; kind: 'array'; maxItems?: number; minItems?: number }\n | { items: SchemaDescriptor[]; kind: 'tuple'; rest: SchemaDescriptor | null }\n | { fields: Record<string, SchemaDescriptor>; kind: 'object'; strict: boolean }\n | { key: SchemaDescriptor; kind: 'record'; value: SchemaDescriptor }\n | { items: SchemaDescriptor; kind: 'set' }\n | { key: SchemaDescriptor; kind: 'map'; value: SchemaDescriptor }\n | { branches: SchemaDescriptor[]; kind: 'union' | 'intersect' }\n | { branches: Record<string, SchemaDescriptor>; discriminator: string; kind: 'variant' }\n | { from: SchemaDescriptor; kind: 'pipe'; to: SchemaDescriptor }\n );\n\n/* -------------------- ParseResult (forward-references SpellValidationError) -------------------- */\n\nimport type { Schema } from './core';\n// Import only the type to avoid circular dependencies\nimport type { SpellValidationError } from './errors';\n\nexport type ParseResult<T> = { data: T; success: true } | { error: SpellValidationError; success: false };\n\n/* -------------------- Schema execution mode / Infer (forward-references Schema) -------------------- */\n\n/** Structural marker for a schema's input type. Emitted so public types can key on it. */\nexport const schemaInput = Symbol('spell.schemaInput');\n/** Structural marker for a schema's output type. Emitted so public types can key on it. */\nexport const schemaOutput = Symbol('spell.schemaOutput');\nexport declare const schemaAcceptsMissing: unique symbol;\nexport type AcceptsMissing = { readonly [schemaAcceptsMissing]: true };\n\n/** A structural schema surface accepted by composition helpers. */\nexport type SchemaSurface<Output = unknown, Input = Output> = {\n /** @internal */\n _parseFullAsync(value: unknown, ctx?: ParseContext): Promise<{ data: unknown; issues: Issue[] }>;\n /** @internal */\n _parseFullSync(value: unknown, ctx?: ParseContext): { data: unknown; issues: Issue[] };\n safeParseAsync(value: unknown, ctx?: ParseContext): Promise<ParseResult<Output>>;\n definition(): SchemaDescriptor;\n isOptional: boolean;\n optional(): SchemaSurface<Output | undefined, Input | undefined>;\n required(): SchemaSurface<Exclude<Output, undefined>, Exclude<Input, undefined>>;\n readonly [schemaInput]: Input;\n readonly [schemaOutput]: Output;\n};\n\nexport type AnySchema<Output = unknown, Input = Output> = SchemaSurface<Output, Input>;\n\n/**\n * The synchronous parse capability every schema carries. UI adapters that accept\n * `AnySchema` cannot call `safeParse` on it (the surface type omits it); type adapter\n * parameters against this instead.\n *\n * The shape is structural, so a schema with async checks is assignable to it; calling\n * `safeParse` on one returns a failed `ParseResult` (\"parse() cannot evaluate async\n * checks\"). Use `safeParseAsync` when async checks may be present.\n */\nexport type SyncParsable<T = unknown> = { safeParse(value: unknown): ParseResult<T> };\n\n/**\n * An issue path in either shape: spell-native `(string | number)[]` or the\n * Standard Schema `(PropertyKey | { key })[]` format.\n */\nexport type IssuePathSegment = PropertyKey | { readonly key: PropertyKey };\nexport type IssuePath = readonly IssuePathSegment[];\n\nexport type InferOutput<T> =\n T extends Schema<infer Output, unknown>\n ? Output\n : T extends { readonly [schemaOutput]: infer Output }\n ? Output\n : never;\ntype RawInferInput<T> = T extends { readonly [schemaInput]: infer Input } ? Input : unknown;\nexport type InferInput<T> = T extends AcceptsMissing ? RawInferInput<T> | undefined : RawInferInput<T>;\nexport type Infer<T> = InferOutput<T>;\n\n/** Re-exported for convenience: defined in messages.ts. */\nexport type { Messages } from './messages';\n"],"mappings":"AAEA,IAAaA,EAAY,CACvB,OAAQ,SACR,eAAgB,iBAChB,aAAc,eACd,iBAAkB,mBAClB,aAAc,eACd,eAAgB,iBAChB,gBAAiB,kBACjB,aAAc,eACd,eAAgB,iBAChB,gBAAiB,kBACjB,oBAAqB,sBACrB,aAAc,eACd,eAAgB,iBAChB,aAAc,eACd,cAAe,gBACf,eAAgB,iBAChB,YAAa,cACb,gBAAiB,kBACjB,QAAS,UACT,UAAW,WACb,E"}
1
+ {"version":3,"file":"types.cjs","names":["ErrorCode"],"sources":["../src/types.ts"],"sourcesContent":["import type { SpellValidationError } from './errors';\nimport type { Messages } from './messages';\nimport type { Schema } from './schema';\n\n/* -------------------- Error codes -------------------- */\n\nexport const ErrorCode = {\n custom: 'custom',\n invalid_date: 'invalid_date',\n invalid_discriminator: 'invalid_discriminator',\n invalid_enum: 'invalid_enum',\n invalid_finite: 'invalid_finite',\n invalid_format: 'invalid_format',\n invalid_integer: 'invalid_integer',\n invalid_keys: 'invalid_keys',\n invalid_length: 'invalid_length',\n invalid_literal: 'invalid_literal',\n invalid_multiple_of: 'invalid_multiple_of',\n invalid_safe: 'invalid_safe',\n invalid_type: 'invalid_type',\n invalid_union: 'invalid_union',\n invalid_unique: 'invalid_unique',\n too_big: 'too_big',\n too_small: 'too_small',\n} as const;\n\nexport type ErrorCode = (typeof ErrorCode)[keyof typeof ErrorCode];\n\n/* -------------------- Issues -------------------- */\n\ntype IssueOf<C extends string, P> = { code: C; message: string; path: (string | number)[] } & (undefined extends P\n ? { params?: P }\n : { params: P });\n\n/**\n * A typed discriminated union of all issues emitted by built-in validators.\n * Narrowing on `code` gives precise access to `params`:\n *\n * ```ts\n * if (issue.code === 'too_small') issue.params.min; // number | bigint | Date\n * ```\n */\nexport type Issue =\n | IssueOf<'custom', Record<string, unknown> | undefined>\n | IssueOf<'invalid_date', undefined>\n | IssueOf<'invalid_discriminator', { discriminator: string; expected: string[] }>\n | IssueOf<'invalid_enum', { values: readonly unknown[] }>\n | IssueOf<'invalid_finite', undefined>\n | IssueOf<'invalid_format', { format: string; includes?: string; pattern?: string; prefix?: string; suffix?: string }>\n | IssueOf<'invalid_integer', undefined>\n | IssueOf<'invalid_keys', { keys: string[] }>\n | IssueOf<'invalid_length', { exact: number }>\n | IssueOf<'invalid_literal', { expected: unknown }>\n | IssueOf<'invalid_multiple_of', { step: number | bigint }>\n | IssueOf<'invalid_safe', undefined>\n | IssueOf<'invalid_type', undefined>\n | IssueOf<'invalid_union', { errors: Issue[][] }>\n | IssueOf<'invalid_unique', undefined>\n | IssueOf<'too_big', { exclusive?: boolean; max: number | bigint | Date }>\n | IssueOf<'too_small', { exclusive?: boolean; min: number | bigint | Date }>\n | { code: string & {}; message: string; params?: Record<string, unknown>; path: (string | number)[] };\n\n/**\n * An issue path in either shape: spell-native `(string | number)[]` or the\n * Standard Schema `(PropertyKey | { key })[]` format.\n */\nexport type IssuePathSegment = PropertyKey | { readonly key: PropertyKey };\nexport type IssuePath = readonly IssuePathSegment[];\n\n/* -------------------- Messages and contexts -------------------- */\n\n/**\n * A validation message: a static string used verbatim, or a function of the constraint context\n * (e.g. `({ min }) => \\`At least ${min}\\``).\n */\nexport type MessageFn<Ctx extends Record<string, unknown> = Record<string, unknown>> = string | ((ctx: Ctx) => string);\n\n/** Carries the active message set through a parse. Create one with `createParseContext()`. */\nexport type ParseContext = { readonly messages: Messages };\n\nexport type CheckContext = {\n addIssue: (issue: {\n code: string;\n message: string;\n params?: Record<string, unknown>;\n path?: (string | number)[];\n }) => void;\n};\n\n/**\n * Return type of a `check()` callback.\n * - `string`: validation failed; the string becomes the error message.\n * - `false`: validation failed (with the default message unless `addIssue` reported one).\n * - `true` / `null` / `undefined`: validation passed.\n *\n * ```ts\n * s.string().check((value) => value.length > 0 || 'Cannot be empty');\n * ```\n */\nexport type ValidateResult = boolean | null | undefined | string;\n\nexport type ParseResult<T> = { data: T; success: true } | { error: SpellValidationError; success: false };\n\n/* -------------------- Definitions -------------------- */\n\n/** A regular expression captured as data. */\nexport type PatternDescriptor = { readonly flags: string; readonly source: string };\n\ntype BaseDescriptor = {\n description?: string;\n isNullable?: true;\n isOptional?: true;\n};\n\ntype NumericBounds<N> = {\n exclusiveMaximum?: N;\n exclusiveMinimum?: N;\n maximum?: N;\n minimum?: N;\n multipleOf?: N;\n};\n\n/** Declarative, frozen description of a schema returned by `schema.definition()`. */\nexport type SchemaDescriptor = BaseDescriptor &\n (\n | { kind: 'unknown' | 'never' | 'boolean' | 'lazy' }\n | ({ kind: 'bigint' } & NumericBounds<bigint>)\n | ({ finite?: true; integer?: true; kind: 'number' } & NumericBounds<number>)\n | {\n formats?: readonly string[];\n kind: 'string';\n maxLength?: number;\n minLength?: number;\n patterns?: readonly PatternDescriptor[];\n }\n | { kind: 'date'; maximum?: string; minimum?: string }\n | { className: string; kind: 'instanceof' }\n | { kind: 'literal'; value: string | number | boolean | null | undefined }\n | { kind: 'enum'; values: readonly (string | number)[] }\n | { items: SchemaDescriptor; kind: 'array'; maxItems?: number; minItems?: number; uniqueItems?: true }\n | { items: readonly SchemaDescriptor[]; kind: 'tuple'; rest: SchemaDescriptor | null }\n | {\n fields: Readonly<Record<string, SchemaDescriptor>>;\n kind: 'object';\n strict: boolean;\n tolerated?: readonly string[];\n }\n | { key: SchemaDescriptor; kind: 'record'; value: SchemaDescriptor }\n | { items: SchemaDescriptor; kind: 'set'; maxSize?: number; minSize?: number }\n | { key: SchemaDescriptor; kind: 'map'; maxSize?: number; minSize?: number; value: SchemaDescriptor }\n | { branches: readonly SchemaDescriptor[]; kind: 'union' | 'intersect' }\n | { branches: Readonly<Record<string, SchemaDescriptor>>; discriminator: string; kind: 'discriminatedUnion' }\n | { from: SchemaDescriptor; kind: 'pipe'; to: SchemaDescriptor }\n );\n\nexport type SchemaKind = SchemaDescriptor['kind'];\n\n/* -------------------- Standard Schema v1 -------------------- */\n\nexport interface StandardSchemaV1<Input = unknown, Output = Input> {\n readonly '~standard': StandardSchemaV1.Props<Input, Output>;\n}\n\nexport declare namespace StandardSchemaV1 {\n interface Props<Input = unknown, Output = Input> {\n readonly types?: Types<Input, Output> | undefined;\n readonly validate: (value: unknown, options?: Options | undefined) => Result<Output> | Promise<Result<Output>>;\n readonly vendor: string;\n readonly version: 1;\n }\n\n type Result<Output> = { readonly issues: readonly Issue[] } | { readonly issues?: undefined; readonly value: Output };\n\n interface Options {\n readonly libraryOptions?: Record<string, unknown> | undefined;\n }\n\n interface Issue {\n readonly message: string;\n readonly path?: readonly (PropertyKey | PathSegment)[] | undefined;\n }\n\n interface PathSegment {\n readonly key: PropertyKey;\n }\n\n interface Types<Input = unknown, Output = Input> {\n readonly input: Input;\n readonly output: Output;\n }\n\n type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema['~standard']['types']>['input'];\n type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema['~standard']['types']>['output'];\n}\n\n/* -------------------- Inference -------------------- */\n\n/** Structural marker for a schema's input type. */\nexport const schemaInput = Symbol('spell.schemaInput');\n/** Structural marker for a schema's output type. */\nexport const schemaOutput = Symbol('spell.schemaOutput');\nexport declare const schemaAcceptsMissing: unique symbol;\n/** Marks a schema whose input may be missing (`optional()`, `nullish()`, `default()`, `catch()`). */\nexport type AcceptsMissing = { readonly [schemaAcceptsMissing]: true };\n\n/** Any schema. Use as a generic constraint: `<T extends AnySchema>`. */\nexport type AnySchema = Schema<unknown, unknown>;\n\nexport type InferOutput<T> = T extends { readonly [schemaOutput]: infer Output } ? Output : never;\ntype RawInferInput<T> = T extends { readonly [schemaInput]: infer Input } ? Input : unknown;\nexport type InferInput<T> = T extends AcceptsMissing ? RawInferInput<T> | undefined : RawInferInput<T>;\nexport type Infer<T> = InferOutput<T>;\n"],"mappings":"AAMA,IAAaA,EAAY,CACvB,OAAQ,SACR,aAAc,eACd,sBAAuB,wBACvB,aAAc,eACd,eAAgB,iBAChB,eAAgB,iBAChB,gBAAiB,kBACjB,aAAc,eACd,eAAgB,iBAChB,gBAAiB,kBACjB,oBAAqB,sBACrB,aAAc,eACd,aAAc,eACd,cAAe,gBACf,eAAgB,iBAChB,QAAS,UACT,UAAW,WACb,E"}
package/dist/types.d.ts CHANGED
@@ -1,227 +1,93 @@
1
+ import type { SpellValidationError } from './errors';
2
+ import type { Messages } from './messages';
3
+ import type { Schema } from './schema';
1
4
  export declare const ErrorCode: {
2
5
  readonly custom: "custom";
3
- readonly invalid_base64: "invalid_base64";
4
6
  readonly invalid_date: "invalid_date";
5
- readonly invalid_duration: "invalid_duration";
7
+ readonly invalid_discriminator: "invalid_discriminator";
6
8
  readonly invalid_enum: "invalid_enum";
7
9
  readonly invalid_finite: "invalid_finite";
10
+ readonly invalid_format: "invalid_format";
8
11
  readonly invalid_integer: "invalid_integer";
9
12
  readonly invalid_keys: "invalid_keys";
10
13
  readonly invalid_length: "invalid_length";
11
14
  readonly invalid_literal: "invalid_literal";
12
15
  readonly invalid_multiple_of: "invalid_multiple_of";
13
16
  readonly invalid_safe: "invalid_safe";
14
- readonly invalid_string: "invalid_string";
15
17
  readonly invalid_type: "invalid_type";
16
18
  readonly invalid_union: "invalid_union";
17
19
  readonly invalid_unique: "invalid_unique";
18
- readonly invalid_url: "invalid_url";
19
- readonly invalid_variant: "invalid_variant";
20
20
  readonly too_big: "too_big";
21
21
  readonly too_small: "too_small";
22
22
  };
23
23
  export type ErrorCode = (typeof ErrorCode)[keyof typeof ErrorCode];
24
- /**
25
- * A validation message: either a static string or a function that receives context and returns a string.
26
- * **Note:** Static string values are used verbatim with no interpolation. Use the function form
27
- * for context-dependent messages (e.g. `(ctx) => \`Must be at least ${ctx.min}\``).
28
- */
29
- export type MessageFn<Ctx extends Record<string, unknown> = Record<string, unknown>> = string | ((ctx: Ctx) => string);
30
- /** Plain JSON Schema object (targeting JSON Schema 2020-12). */
31
- export type JsonSchema = Record<string, unknown>;
32
- export interface StandardSchemaV1<Input = unknown, Output = Input> {
33
- readonly '~standard': StandardSchemaV1.Props<Input, Output>;
34
- }
35
- export declare namespace StandardSchemaV1 {
36
- interface Props<Input = unknown, Output = Input> {
37
- readonly types?: Types<Input, Output> | undefined;
38
- readonly validate: (value: unknown, options?: Options | undefined) => Result<Output> | Promise<Result<Output>>;
39
- readonly vendor: string;
40
- readonly version: 1;
41
- }
42
- type Result<Output> = {
43
- readonly issues: readonly Issue[];
44
- } | {
45
- readonly issues?: undefined;
46
- readonly value: Output;
47
- };
48
- interface Options {
49
- readonly libraryOptions?: Record<string, unknown> | undefined;
50
- }
51
- interface Issue {
52
- readonly message: string;
53
- readonly path?: readonly (PropertyKey | PathSegment)[] | undefined;
54
- }
55
- interface PathSegment {
56
- readonly key: PropertyKey;
57
- }
58
- interface Types<Input = unknown, Output = Input> {
59
- readonly input: Input;
60
- readonly output: Output;
61
- }
62
- type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema['~standard']['types']>['input'];
63
- type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema['~standard']['types']>['output'];
64
- }
24
+ type IssueOf<C extends string, P> = {
25
+ code: C;
26
+ message: string;
27
+ path: (string | number)[];
28
+ } & (undefined extends P ? {
29
+ params?: P;
30
+ } : {
31
+ params: P;
32
+ });
65
33
  /**
66
34
  * A typed discriminated union of all issues emitted by built-in validators.
67
- *
68
35
  * Narrowing on `code` gives precise access to `params`:
36
+ *
69
37
  * ```ts
70
- * if (error.code === 'too_small') {
71
- * const min = error.params.min; // number | bigint | Date
72
- * }
38
+ * if (issue.code === 'too_small') issue.params.min; // number | bigint | Date
73
39
  * ```
74
40
  */
75
- export type Issue = {
76
- code: 'custom';
77
- message: string;
78
- params?: Record<string, unknown>;
79
- path: (string | number)[];
80
- } | {
81
- code: 'invalid_base64';
82
- message: string;
83
- params: {
84
- format: string;
85
- };
86
- path: (string | number)[];
87
- } | {
88
- code: 'invalid_date';
89
- message: string;
90
- params?: undefined;
91
- path: (string | number)[];
92
- } | {
93
- code: 'invalid_duration';
94
- message: string;
95
- params: {
96
- format: string;
97
- };
98
- path: (string | number)[];
99
- } | {
100
- code: 'invalid_enum';
101
- message: string;
102
- params: {
103
- values: readonly unknown[];
104
- };
105
- path: (string | number)[];
106
- } | {
107
- code: 'invalid_finite';
108
- message: string;
109
- params?: undefined;
110
- path: (string | number)[];
111
- } | {
112
- code: 'invalid_integer';
113
- message: string;
114
- params?: undefined;
115
- path: (string | number)[];
116
- } | {
117
- code: 'invalid_keys';
118
- message: string;
119
- params: {
120
- keys: string[];
121
- };
122
- path: (string | number)[];
123
- } | {
124
- code: 'invalid_length';
125
- message: string;
126
- params: {
127
- exact: number;
128
- };
129
- path: (string | number)[];
130
- } | {
131
- code: 'invalid_literal';
132
- message: string;
133
- params: {
134
- expected: unknown;
135
- };
136
- path: (string | number)[];
137
- } | {
138
- code: 'invalid_multiple_of';
139
- message: string;
140
- params: {
141
- step: number | bigint;
142
- };
143
- path: (string | number)[];
144
- } | {
145
- code: 'invalid_safe';
146
- message: string;
147
- params?: undefined;
148
- path: (string | number)[];
149
- } | {
150
- code: 'invalid_string';
151
- message: string;
152
- params: {
153
- format?: string;
154
- includes?: string;
155
- pattern?: string;
156
- prefix?: string;
157
- suffix?: string;
158
- };
159
- path: (string | number)[];
160
- } | {
161
- code: 'invalid_type';
162
- message: string;
163
- params?: undefined;
164
- path: (string | number)[];
165
- } | {
166
- code: 'invalid_union';
167
- message: string;
168
- params: {
169
- errors: Issue[][];
170
- };
171
- path: (string | number)[];
172
- } | {
173
- code: 'invalid_unique';
174
- message: string;
175
- params: {
176
- unique: true;
177
- };
178
- path: (string | number)[];
179
- } | {
180
- code: 'invalid_url';
181
- message: string;
182
- params: {
183
- format: string;
184
- };
185
- path: (string | number)[];
186
- } | {
187
- code: 'invalid_variant';
188
- message: string;
189
- params: {
190
- discriminator: string;
191
- expected: string[];
192
- };
193
- path: (string | number)[];
194
- } | {
195
- code: 'too_big';
196
- message: string;
197
- params: {
198
- exclusive?: boolean;
199
- max: number | bigint | Date;
200
- };
201
- path: (string | number)[];
202
- } | {
203
- code: 'too_small';
204
- message: string;
205
- params: {
206
- exclusive?: boolean;
207
- min: number | bigint | Date;
208
- };
209
- path: (string | number)[];
210
- } | {
41
+ export type Issue = IssueOf<'custom', Record<string, unknown> | undefined> | IssueOf<'invalid_date', undefined> | IssueOf<'invalid_discriminator', {
42
+ discriminator: string;
43
+ expected: string[];
44
+ }> | IssueOf<'invalid_enum', {
45
+ values: readonly unknown[];
46
+ }> | IssueOf<'invalid_finite', undefined> | IssueOf<'invalid_format', {
47
+ format: string;
48
+ includes?: string;
49
+ pattern?: string;
50
+ prefix?: string;
51
+ suffix?: string;
52
+ }> | IssueOf<'invalid_integer', undefined> | IssueOf<'invalid_keys', {
53
+ keys: string[];
54
+ }> | IssueOf<'invalid_length', {
55
+ exact: number;
56
+ }> | IssueOf<'invalid_literal', {
57
+ expected: unknown;
58
+ }> | IssueOf<'invalid_multiple_of', {
59
+ step: number | bigint;
60
+ }> | IssueOf<'invalid_safe', undefined> | IssueOf<'invalid_type', undefined> | IssueOf<'invalid_union', {
61
+ errors: Issue[][];
62
+ }> | IssueOf<'invalid_unique', undefined> | IssueOf<'too_big', {
63
+ exclusive?: boolean;
64
+ max: number | bigint | Date;
65
+ }> | IssueOf<'too_small', {
66
+ exclusive?: boolean;
67
+ min: number | bigint | Date;
68
+ }> | {
211
69
  code: string & {};
212
70
  message: string;
213
71
  params?: Record<string, unknown>;
214
72
  path: (string | number)[];
215
73
  };
216
- /** ParseContext carries the active message set through the parse pipeline. */
217
- export type ParseContext = {
218
- messages: import('./messages').Messages;
74
+ /**
75
+ * An issue path in either shape: spell-native `(string | number)[]` or the
76
+ * Standard Schema `(PropertyKey | { key })[]` format.
77
+ */
78
+ export type IssuePathSegment = PropertyKey | {
79
+ readonly key: PropertyKey;
219
80
  };
81
+ export type IssuePath = readonly IssuePathSegment[];
220
82
  /**
221
- * Validator function. Receives the value after type-checking and the active ParseContext.
222
- * Returns an Issue array on failure, null on success, or a Promise for async validators.
83
+ * A validation message: a static string used verbatim, or a function of the constraint context
84
+ * (e.g. `({ min }) => \`At least ${min}\``).
223
85
  */
224
- export type ValidateFn = (value: unknown, ctx?: ParseContext) => Issue[] | null | Promise<Issue[] | null>;
86
+ export type MessageFn<Ctx extends Record<string, unknown> = Record<string, unknown>> = string | ((ctx: Ctx) => string);
87
+ /** Carries the active message set through a parse. Create one with `createParseContext()`. */
88
+ export type ParseContext = {
89
+ readonly messages: Messages;
90
+ };
225
91
  export type CheckContext = {
226
92
  addIssue: (issue: {
227
93
  code: string;
@@ -233,42 +99,60 @@ export type CheckContext = {
233
99
  /**
234
100
  * Return type of a `check()` callback.
235
101
  * - `string`: validation failed; the string becomes the error message.
236
- * - `false`: validation failed with no message (use `addIssue` for a message).
237
- * - `true` / `null` / `void`: validation passed.
102
+ * - `false`: validation failed (with the default message unless `addIssue` reported one).
103
+ * - `true` / `null` / `undefined`: validation passed.
238
104
  *
239
- * The shorthand `condition || 'message'` works naturally:
240
105
  * ```ts
241
- * s.string().check((value) => value.length > 0 || 'Cannot be empty')
106
+ * s.string().check((value) => value.length > 0 || 'Cannot be empty');
242
107
  * ```
243
108
  */
244
109
  export type ValidateResult = boolean | null | undefined | string;
245
- /** Re-exported from errors for convenience: defined there. */
246
- export type { FlatError, FlatErrorFirst } from './errors';
110
+ export type ParseResult<T> = {
111
+ data: T;
112
+ success: true;
113
+ } | {
114
+ error: SpellValidationError;
115
+ success: false;
116
+ };
117
+ /** A regular expression captured as data. */
118
+ export type PatternDescriptor = {
119
+ readonly flags: string;
120
+ readonly source: string;
121
+ };
247
122
  type BaseDescriptor = {
248
123
  description?: string;
249
- isNullable?: boolean;
250
- isOptional?: boolean;
124
+ isNullable?: true;
125
+ isOptional?: true;
126
+ };
127
+ type NumericBounds<N> = {
128
+ exclusiveMaximum?: N;
129
+ exclusiveMinimum?: N;
130
+ maximum?: N;
131
+ minimum?: N;
132
+ multipleOf?: N;
251
133
  };
134
+ /** Declarative, frozen description of a schema returned by `schema.definition()`. */
252
135
  export type SchemaDescriptor = BaseDescriptor & ({
253
- kind: 'unknown' | 'never' | 'boolean' | 'bigint' | 'date' | 'lazy';
254
- } | {
255
- className: string;
256
- kind: 'instanceof';
257
- } | {
258
- contentEncoding?: string;
259
- format?: string;
136
+ kind: 'unknown' | 'never' | 'boolean' | 'lazy';
137
+ } | ({
138
+ kind: 'bigint';
139
+ } & NumericBounds<bigint>) | ({
140
+ finite?: true;
141
+ integer?: true;
142
+ kind: 'number';
143
+ } & NumericBounds<number>) | {
144
+ formats?: readonly string[];
260
145
  kind: 'string';
261
146
  maxLength?: number;
262
147
  minLength?: number;
263
- pattern?: string | null;
148
+ patterns?: readonly PatternDescriptor[];
264
149
  } | {
265
- exclusiveMaximum?: number;
266
- exclusiveMinimum?: number;
267
- kind: 'number';
268
- maximum?: number;
269
- minimum?: number;
270
- multipleOf?: number;
271
- typeHint?: 'integer';
150
+ kind: 'date';
151
+ maximum?: string;
152
+ minimum?: string;
153
+ } | {
154
+ className: string;
155
+ kind: 'instanceof';
272
156
  } | {
273
157
  kind: 'literal';
274
158
  value: string | number | boolean | null | undefined;
@@ -280,14 +164,16 @@ export type SchemaDescriptor = BaseDescriptor & ({
280
164
  kind: 'array';
281
165
  maxItems?: number;
282
166
  minItems?: number;
167
+ uniqueItems?: true;
283
168
  } | {
284
- items: SchemaDescriptor[];
169
+ items: readonly SchemaDescriptor[];
285
170
  kind: 'tuple';
286
171
  rest: SchemaDescriptor | null;
287
172
  } | {
288
- fields: Record<string, SchemaDescriptor>;
173
+ fields: Readonly<Record<string, SchemaDescriptor>>;
289
174
  kind: 'object';
290
175
  strict: boolean;
176
+ tolerated?: readonly string[];
291
177
  } | {
292
178
  key: SchemaDescriptor;
293
179
  kind: 'record';
@@ -295,71 +181,72 @@ export type SchemaDescriptor = BaseDescriptor & ({
295
181
  } | {
296
182
  items: SchemaDescriptor;
297
183
  kind: 'set';
184
+ maxSize?: number;
185
+ minSize?: number;
298
186
  } | {
299
187
  key: SchemaDescriptor;
300
188
  kind: 'map';
189
+ maxSize?: number;
190
+ minSize?: number;
301
191
  value: SchemaDescriptor;
302
192
  } | {
303
- branches: SchemaDescriptor[];
193
+ branches: readonly SchemaDescriptor[];
304
194
  kind: 'union' | 'intersect';
305
195
  } | {
306
- branches: Record<string, SchemaDescriptor>;
196
+ branches: Readonly<Record<string, SchemaDescriptor>>;
307
197
  discriminator: string;
308
- kind: 'variant';
198
+ kind: 'discriminatedUnion';
309
199
  } | {
310
200
  from: SchemaDescriptor;
311
201
  kind: 'pipe';
312
202
  to: SchemaDescriptor;
313
203
  });
314
- import type { Schema } from './core';
315
- import type { SpellValidationError } from './errors';
316
- export type ParseResult<T> = {
317
- data: T;
318
- success: true;
319
- } | {
320
- error: SpellValidationError;
321
- success: false;
322
- };
323
- /** Structural marker for a schema's input type. Emitted so public types can key on it. */
204
+ export type SchemaKind = SchemaDescriptor['kind'];
205
+ export interface StandardSchemaV1<Input = unknown, Output = Input> {
206
+ readonly '~standard': StandardSchemaV1.Props<Input, Output>;
207
+ }
208
+ export declare namespace StandardSchemaV1 {
209
+ interface Props<Input = unknown, Output = Input> {
210
+ readonly types?: Types<Input, Output> | undefined;
211
+ readonly validate: (value: unknown, options?: Options | undefined) => Result<Output> | Promise<Result<Output>>;
212
+ readonly vendor: string;
213
+ readonly version: 1;
214
+ }
215
+ type Result<Output> = {
216
+ readonly issues: readonly Issue[];
217
+ } | {
218
+ readonly issues?: undefined;
219
+ readonly value: Output;
220
+ };
221
+ interface Options {
222
+ readonly libraryOptions?: Record<string, unknown> | undefined;
223
+ }
224
+ interface Issue {
225
+ readonly message: string;
226
+ readonly path?: readonly (PropertyKey | PathSegment)[] | undefined;
227
+ }
228
+ interface PathSegment {
229
+ readonly key: PropertyKey;
230
+ }
231
+ interface Types<Input = unknown, Output = Input> {
232
+ readonly input: Input;
233
+ readonly output: Output;
234
+ }
235
+ type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema['~standard']['types']>['input'];
236
+ type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema['~standard']['types']>['output'];
237
+ }
238
+ /** Structural marker for a schema's input type. */
324
239
  export declare const schemaInput: unique symbol;
325
- /** Structural marker for a schema's output type. Emitted so public types can key on it. */
240
+ /** Structural marker for a schema's output type. */
326
241
  export declare const schemaOutput: unique symbol;
327
242
  export declare const schemaAcceptsMissing: unique symbol;
243
+ /** Marks a schema whose input may be missing (`optional()`, `nullish()`, `default()`, `catch()`). */
328
244
  export type AcceptsMissing = {
329
245
  readonly [schemaAcceptsMissing]: true;
330
246
  };
331
- /** A structural schema surface accepted by composition helpers. */
332
- export type SchemaSurface<Output = unknown, Input = Output> = {
333
- safeParseAsync(value: unknown, ctx?: ParseContext): Promise<ParseResult<Output>>;
334
- definition(): SchemaDescriptor;
335
- isOptional: boolean;
336
- optional(): SchemaSurface<Output | undefined, Input | undefined>;
337
- required(): SchemaSurface<Exclude<Output, undefined>, Exclude<Input, undefined>>;
338
- readonly [schemaInput]: Input;
339
- readonly [schemaOutput]: Output;
340
- };
341
- export type AnySchema<Output = unknown, Input = Output> = SchemaSurface<Output, Input>;
342
- /**
343
- * The synchronous parse capability every schema carries. UI adapters that accept
344
- * `AnySchema` cannot call `safeParse` on it (the surface type omits it); type adapter
345
- * parameters against this instead.
346
- *
347
- * The shape is structural, so a schema with async checks is assignable to it; calling
348
- * `safeParse` on one returns a failed `ParseResult` ("parse() cannot evaluate async
349
- * checks"). Use `safeParseAsync` when async checks may be present.
350
- */
351
- export type SyncParsable<T = unknown> = {
352
- safeParse(value: unknown): ParseResult<T>;
353
- };
354
- /**
355
- * An issue path in either shape: spell-native `(string | number)[]` or the
356
- * Standard Schema `(PropertyKey | { key })[]` format.
357
- */
358
- export type IssuePathSegment = PropertyKey | {
359
- readonly key: PropertyKey;
360
- };
361
- export type IssuePath = readonly IssuePathSegment[];
362
- export type InferOutput<T> = T extends Schema<infer Output, unknown> ? Output : T extends {
247
+ /** Any schema. Use as a generic constraint: `<T extends AnySchema>`. */
248
+ export type AnySchema = Schema<unknown, unknown>;
249
+ export type InferOutput<T> = T extends {
363
250
  readonly [schemaOutput]: infer Output;
364
251
  } ? Output : never;
365
252
  type RawInferInput<T> = T extends {
@@ -367,6 +254,5 @@ type RawInferInput<T> = T extends {
367
254
  } ? Input : unknown;
368
255
  export type InferInput<T> = T extends AcceptsMissing ? RawInferInput<T> | undefined : RawInferInput<T>;
369
256
  export type Infer<T> = InferOutput<T>;
370
- /** Re-exported for convenience: defined in messages.ts. */
371
- export type { Messages } from './messages';
257
+ export {};
372
258
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],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