@mastra/voice-aws-nova-sonic 0.2.2 → 0.2.3

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 (60) hide show
  1. package/dist/_types/@internal_voice/dist/_types/@internal_ai-sdk-v5/dist/index.d.ts +371 -29
  2. package/dist/_types/@internal_voice/dist/_types/@internal_core/dist/request-context/index.d.ts +35 -1
  3. package/dist/_types/@internal_voice/dist/_types/zod/v3/ZodError.d.ts +1 -1
  4. package/dist/_types/@internal_voice/dist/_types/zod/v4/classic/checks.d.ts +1 -1
  5. package/dist/_types/@internal_voice/dist/_types/zod/v4/classic/compat.d.ts +9 -11
  6. package/dist/_types/@internal_voice/dist/_types/zod/v4/classic/deep-partial.d.ts +14 -0
  7. package/dist/_types/@internal_voice/dist/_types/zod/v4/classic/errors.d.ts +3 -4
  8. package/dist/_types/@internal_voice/dist/_types/zod/v4/classic/external.d.ts +5 -2
  9. package/dist/_types/@internal_voice/dist/_types/zod/v4/classic/in-out.d.ts +8 -0
  10. package/dist/_types/@internal_voice/dist/_types/zod/v4/classic/index.d.ts +1 -2
  11. package/dist/_types/@internal_voice/dist/_types/zod/v4/classic/iso.d.ts +2 -17
  12. package/dist/_types/@internal_voice/dist/_types/zod/v4/classic/parse.d.ts +17 -4
  13. package/dist/_types/@internal_voice/dist/_types/zod/v4/classic/schemas.d.ts +68 -19
  14. package/dist/_types/@internal_voice/dist/_types/zod/v4/core/api.d.ts +22 -12
  15. package/dist/_types/@internal_voice/dist/_types/zod/v4/core/checks.d.ts +29 -13
  16. package/dist/_types/@internal_voice/dist/_types/zod/v4/core/compile.d.ts +65 -0
  17. package/dist/_types/@internal_voice/dist/_types/zod/v4/core/core.d.ts +16 -4
  18. package/dist/_types/@internal_voice/dist/_types/zod/v4/core/doc.d.ts +3 -1
  19. package/dist/_types/@internal_voice/dist/_types/zod/v4/core/errors.d.ts +4 -0
  20. package/dist/_types/@internal_voice/dist/_types/zod/v4/core/index.d.ts +3 -0
  21. package/dist/_types/@internal_voice/dist/_types/zod/v4/core/json-schema-generator.d.ts +2 -2
  22. package/dist/_types/@internal_voice/dist/_types/zod/v4/core/json-schema-processors.d.ts +16 -0
  23. package/dist/_types/@internal_voice/dist/_types/zod/v4/core/json-schema.d.ts +2 -1
  24. package/dist/_types/@internal_voice/dist/_types/zod/v4/core/memoizer.d.ts +15 -0
  25. package/dist/_types/@internal_voice/dist/_types/zod/v4/core/parse.d.ts +14 -11
  26. package/dist/_types/@internal_voice/dist/_types/zod/v4/core/regexes.d.ts +5 -0
  27. package/dist/_types/@internal_voice/dist/_types/zod/v4/core/schemas.d.ts +123 -34
  28. package/dist/_types/@internal_voice/dist/_types/zod/v4/core/to-json-schema.d.ts +45 -5
  29. package/dist/_types/@internal_voice/dist/_types/zod/v4/core/util.d.ts +79 -1
  30. package/dist/_types/@internal_voice/dist/_types/zod/v4/core/versions.d.ts +1 -1
  31. package/dist/_types/@internal_voice/dist/_types/zod/v4/index.d.cts +2 -2
  32. package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/bn.d.ts +4 -0
  33. package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/ckb.d.ts +4 -0
  34. package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/gu.d.ts +4 -0
  35. package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/hi.d.ts +4 -0
  36. package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/index.d.ts +11 -0
  37. package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/kn.d.ts +4 -0
  38. package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/ne.d.ts +4 -0
  39. package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/nn.d.ts +4 -0
  40. package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/pt-BR.d.ts +4 -0
  41. package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/sk.d.ts +4 -0
  42. package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/tg.d.ts +4 -0
  43. package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/tk.d.ts +4 -0
  44. package/dist/_types/@internal_voice/dist/index.d.ts +2 -2
  45. package/dist/_types/@internal_voice/dist/voice/aisdk/speech.d.ts +1 -1
  46. package/dist/_types/@internal_voice/dist/voice/aisdk/transcription.d.ts +1 -1
  47. package/dist/_types/@internal_voice/dist/voice/composite-voice.d.ts +2 -2
  48. package/dist/_types/@internal_voice/dist/voice/voice.d.ts +2 -2
  49. package/dist/_types/@internal_voice/package.json +1 -0
  50. package/dist/docs/SKILL.md +1 -1
  51. package/dist/docs/assets/SOURCE_MAP.json +1 -1
  52. package/dist/docs/references/reference-voice-overview.md +25 -0
  53. package/dist/index.cjs +4 -5
  54. package/dist/index.cjs.map +1 -1
  55. package/dist/index.d.ts +2 -2
  56. package/dist/index.d.ts.map +1 -1
  57. package/dist/index.js +4 -5
  58. package/dist/index.js.map +1 -1
  59. package/package.json +8 -8
  60. package/dist/_types/@internal_voice/dist/_types/zod/v3/index.d.cts +0 -4
@@ -1,4 +1,6 @@
1
1
  import * as checks from "./checks.js";
2
+ import type { $ZodNumberFormats } from "./checks.js";
3
+ import type { $ZodBigIntFormats } from "./checks.js";
2
4
  import * as core from "./core.js";
3
5
  import type * as errors from "./errors.js";
4
6
  import type * as JSONSchema from "./json-schema.js";
@@ -19,17 +21,23 @@ export interface ParseContextInternal<T extends errors.$ZodIssueBase = never> ex
19
21
  readonly async?: boolean | undefined;
20
22
  readonly direction?: "forward" | "backward";
21
23
  readonly skipChecks?: boolean;
24
+ /** Set only by `validate`/`validateAsync`. A container may stop before its next child, never inside one, so a map entry and a tuple's fixed items parse whole. */
25
+ readonly abortEarly?: boolean;
26
+ }
27
+ /** Gives a container cycle support: `attach` wraps its parse, and `alloc` registers the object it builds into before any child is parsed so a reference back to the same input resolves to it. */
28
+ export interface $ZodMemoizer {
29
+ attach(inst: $ZodType): void;
30
+ guard(inst: $ZodType): void;
31
+ alloc<T extends object>(inst: $ZodType, payload: ParsePayload, empty: T, ctx: ParseContextInternal): T;
22
32
  }
23
33
  export interface ParsePayload<T = unknown> {
24
34
  value: T;
25
35
  issues: errors.$ZodRawIssue[];
26
36
  /** A way to mark a whole payload as aborted. Used in codecs/pipes. */
27
37
  aborted?: boolean;
28
- /** @internal Marks a value as a fallback that an outer wrapper (e.g.
29
- * $ZodOptional) may override with its own interpretation when input was
30
- * undefined. Set by $ZodCatch when catchValue substitutes and by every
31
- * $ZodTransform invocation. */
32
- fallback?: boolean | undefined;
38
+ /** @internal Set when the value came from a repeat visit to a node still being
39
+ * parsed. Its checks run on the node itself, against the finished value. */
40
+ memo?: boolean | undefined;
33
41
  }
34
42
  export type CheckFn<T> = (input: ParsePayload<T>) => util.MaybeAsync<void>;
35
43
  export interface $ZodTypeDef {
@@ -54,8 +62,13 @@ export interface _$ZodTypeInternals {
54
62
  /** @internal Indicates that a schema output type should be considered optional inside objects.
55
63
  * @default Required
56
64
  */
57
- /** @internal */
58
- optin?: "optional" | undefined;
65
+ /** @internal Three rungs, each strictly stronger than the last:
66
+ * undefined — required; the container may not omit this slot
67
+ * "optional" — the container may omit it; nothing is supplied in its place
68
+ * "defaulted" — the container may omit it AND this schema substitutes a value
69
+ * Consumers asking "may the slot be absent?" test `!== undefined`.
70
+ * $ZodOptional asks the stronger question and tests `=== "defaulted"`. */
71
+ optin?: "optional" | "defaulted" | undefined;
59
72
  /** @internal */
60
73
  optout?: "optional" | undefined;
61
74
  /** @internal The set of literal values that will pass validation. Must be an exhaustive set. Used to determine optionality in z.record().
@@ -101,6 +114,7 @@ export interface $ZodType<O = unknown, I = unknown, Internals extends $ZodTypeIn
101
114
  export interface _$ZodType<T extends $ZodTypeInternals = $ZodTypeInternals> extends $ZodType<T["output"], T["input"], T> {
102
115
  }
103
116
  export declare const $ZodType: core.$constructor<$ZodType>;
117
+ export declare function standardProps(inst: $ZodType): StandardSchemaV1.Props<any, any>;
104
118
  export { clone } from "./util.js";
105
119
  export interface $ZodStringDef extends $ZodTypeDef {
106
120
  type: "string";
@@ -119,6 +133,8 @@ export interface $ZodStringInternals<Input> extends $ZodTypeInternals<string, In
119
133
  patterns: Set<RegExp>;
120
134
  format: string;
121
135
  contentEncoding: string;
136
+ /** the pattern admits strings its `format` keyword forbids, so `toJSONSchema` must not emit it */
137
+ laxFormat: boolean;
122
138
  }>;
123
139
  }
124
140
  export interface $ZodString<Input = unknown> extends _$ZodType<$ZodStringInternals<Input>> {
@@ -170,6 +186,18 @@ export interface $ZodURLInternals extends $ZodStringFormatInternals<"url"> {
170
186
  export interface $ZodURL extends $ZodType {
171
187
  _zod: $ZodURLInternals;
172
188
  }
189
+ /** The `://` guard rejected the input before the URL constructor saw it. */
190
+ export declare const URL_BAD_FORMAT = 1;
191
+ /** The URL parser rejected the input. */
192
+ export declare const URL_UNPARSEABLE = 2;
193
+ export declare function canParseURL(input: string): boolean;
194
+ export declare function validateURL(trimmed: string, def: Pick<$ZodURLDef, "protocol" | "hostname" | "normalize">): URL | true | typeof URL_BAD_FORMAT | typeof URL_UNPARSEABLE;
195
+ /** Parses a URL while preserving the non-normalizing HTTP guard. */
196
+ export declare function parseURLObject(trimmed: string, def: Pick<$ZodURLDef, "protocol" | "normalize">): URL | typeof URL_BAD_FORMAT | typeof URL_UNPARSEABLE;
197
+ /** The URL parser deletes every ASCII tab, LF and CR from its input before it parses, so `new URL("https://exa\nmple.com")` reports on `example.com`. Applying the same deletion to the returned value closes the half of that divergence which can move the host; the parser's other rewrite, stripping C0 controls at the edges, cannot. */
198
+ export declare function stripTabAndNewline(value: string): string;
199
+ export declare function urlHostnameOk(url: URL, hostname: RegExp): boolean;
200
+ export declare function urlProtocolOk(url: URL, protocol: RegExp): boolean;
173
201
  export declare const $ZodURL: core.$constructor<$ZodURL>;
174
202
  export interface $ZodEmojiDef extends $ZodStringFormatDef<"emoji"> {
175
203
  }
@@ -180,8 +208,10 @@ export interface $ZodEmoji extends $ZodType {
180
208
  }
181
209
  export declare const $ZodEmoji: core.$constructor<$ZodEmoji>;
182
210
  export interface $ZodNanoIDDef extends $ZodStringFormatDef<"nanoid"> {
211
+ length?: number | undefined;
183
212
  }
184
213
  export interface $ZodNanoIDInternals extends $ZodStringFormatInternals<"nanoid"> {
214
+ def: $ZodNanoIDDef;
185
215
  }
186
216
  export interface $ZodNanoID extends $ZodType {
187
217
  _zod: $ZodNanoIDInternals;
@@ -304,6 +334,7 @@ export interface $ZodIPv6Internals extends $ZodStringFormatInternals<"ipv6"> {
304
334
  export interface $ZodIPv6 extends $ZodType {
305
335
  _zod: $ZodIPv6Internals;
306
336
  }
337
+ export declare function isValidIPv6(value: string): boolean;
307
338
  export declare const $ZodIPv6: core.$constructor<$ZodIPv6>;
308
339
  export interface $ZodMACDef extends $ZodStringFormatDef<"mac"> {
309
340
  delimiter?: string;
@@ -334,6 +365,7 @@ export interface $ZodCIDRv6Internals extends $ZodStringFormatInternals<"cidrv6">
334
365
  export interface $ZodCIDRv6 extends $ZodType {
335
366
  _zod: $ZodCIDRv6Internals;
336
367
  }
368
+ export declare function isValidCIDRv6(value: string): boolean;
337
369
  export declare const $ZodCIDRv6: core.$constructor<$ZodCIDRv6>;
338
370
  export declare function isValidBase64(data: string): boolean;
339
371
  export interface $ZodBase64Def extends $ZodStringFormatDef<"base64"> {
@@ -343,7 +375,9 @@ export interface $ZodBase64Internals extends $ZodStringFormatInternals<"base64">
343
375
  export interface $ZodBase64 extends $ZodType {
344
376
  _zod: $ZodBase64Internals;
345
377
  }
378
+ export declare const base64Charset: RegExp;
346
379
  export declare const $ZodBase64: core.$constructor<$ZodBase64>;
380
+ export declare const base64urlCharset: RegExp;
347
381
  export declare function isValidBase64URL(data: string): boolean;
348
382
  export interface $ZodBase64URLDef extends $ZodStringFormatDef<"base64url"> {
349
383
  }
@@ -361,6 +395,26 @@ export interface $ZodE164 extends $ZodType {
361
395
  _zod: $ZodE164Internals;
362
396
  }
363
397
  export declare const $ZodE164: core.$constructor<$ZodE164>;
398
+ export declare function isValidCreditCard(input: string): boolean;
399
+ export interface $ZodCreditCardDef extends $ZodStringFormatDef<"credit_card"> {
400
+ }
401
+ export interface $ZodCreditCardInternals extends $ZodStringFormatInternals<"credit_card"> {
402
+ def: $ZodCreditCardDef;
403
+ }
404
+ export interface $ZodCreditCard extends $ZodType {
405
+ _zod: $ZodCreditCardInternals;
406
+ }
407
+ export declare const $ZodCreditCard: core.$constructor<$ZodCreditCard>;
408
+ export declare function isValidIBAN(input: string): boolean;
409
+ export interface $ZodIBANDef extends $ZodStringFormatDef<"iban"> {
410
+ }
411
+ export interface $ZodIBANInternals extends $ZodStringFormatInternals<"iban"> {
412
+ def: $ZodIBANDef;
413
+ }
414
+ export interface $ZodIBAN extends $ZodType {
415
+ _zod: $ZodIBANInternals;
416
+ }
417
+ export declare const $ZodIBAN: core.$constructor<$ZodIBAN>;
364
418
  export declare function isValidJWT(token: string, algorithm?: util.JWTAlgorithm | null): boolean;
365
419
  export interface $ZodJWTDef extends $ZodStringFormatDef<"jwt"> {
366
420
  alg?: util.JWTAlgorithm | undefined;
@@ -405,14 +459,14 @@ export interface $ZodNumber<Input = unknown> extends $ZodType {
405
459
  _zod: $ZodNumberInternals<Input>;
406
460
  }
407
461
  export declare const $ZodNumber: core.$constructor<$ZodNumber>;
408
- export interface $ZodNumberFormatDef extends $ZodNumberDef, checks.$ZodCheckNumberFormatDef {
462
+ export interface $ZodNumberFormatDef<Format extends $ZodNumberFormats = $ZodNumberFormats> extends $ZodNumberDef, checks.$ZodCheckNumberFormatDef<Format> {
409
463
  }
410
- export interface $ZodNumberFormatInternals extends $ZodNumberInternals<number>, checks.$ZodCheckNumberFormatInternals {
411
- def: $ZodNumberFormatDef;
464
+ export interface $ZodNumberFormatInternals<Format extends $ZodNumberFormats = $ZodNumberFormats> extends $ZodNumberInternals<number>, checks.$ZodCheckNumberFormatInternals<Format> {
465
+ def: $ZodNumberFormatDef<Format>;
412
466
  isst: errors.$ZodIssueInvalidType;
413
467
  }
414
- export interface $ZodNumberFormat extends $ZodType {
415
- _zod: $ZodNumberFormatInternals;
468
+ export interface $ZodNumberFormat<Format extends $ZodNumberFormats = $ZodNumberFormats> extends $ZodType {
469
+ _zod: $ZodNumberFormatInternals<Format>;
416
470
  }
417
471
  export declare const $ZodNumberFormat: core.$constructor<$ZodNumberFormat>;
418
472
  export interface $ZodBooleanDef extends $ZodTypeDef {
@@ -448,14 +502,14 @@ export interface $ZodBigInt<T = unknown> extends $ZodType {
448
502
  _zod: $ZodBigIntInternals<T>;
449
503
  }
450
504
  export declare const $ZodBigInt: core.$constructor<$ZodBigInt>;
451
- export interface $ZodBigIntFormatDef extends $ZodBigIntDef, checks.$ZodCheckBigIntFormatDef {
505
+ export interface $ZodBigIntFormatDef<Format extends $ZodBigIntFormats = $ZodBigIntFormats> extends $ZodBigIntDef, checks.$ZodCheckBigIntFormatDef<Format> {
452
506
  check: "bigint_format";
453
507
  }
454
- export interface $ZodBigIntFormatInternals extends $ZodBigIntInternals<bigint>, checks.$ZodCheckBigIntFormatInternals {
455
- def: $ZodBigIntFormatDef;
508
+ export interface $ZodBigIntFormatInternals<Format extends $ZodBigIntFormats = $ZodBigIntFormats> extends $ZodBigIntInternals<bigint>, checks.$ZodCheckBigIntFormatInternals<Format> {
509
+ def: $ZodBigIntFormatDef<Format>;
456
510
  }
457
- export interface $ZodBigIntFormat extends $ZodType {
458
- _zod: $ZodBigIntFormatInternals;
511
+ export interface $ZodBigIntFormat<Format extends $ZodBigIntFormats = $ZodBigIntFormats> extends $ZodType {
512
+ _zod: $ZodBigIntFormatInternals<Format>;
459
513
  }
460
514
  export declare const $ZodBigIntFormat: core.$constructor<$ZodBigIntFormat>;
461
515
  export interface $ZodSymbolDef extends $ZodTypeDef {
@@ -576,15 +630,19 @@ type OptionalOutSchema = {
576
630
  };
577
631
  type OptionalInSchema = {
578
632
  _zod: {
579
- optin: "optional";
633
+ optin: "optional" | "defaulted";
580
634
  };
581
635
  };
582
- export type $InferObjectOutput<T extends $ZodLooseShape, Extra extends Record<string, unknown>> = string extends keyof T ? util.IsAny<T[keyof T]> extends true ? Record<string, unknown> : Record<string, core.output<T[keyof T]>> : keyof (T & Extra) extends never ? Record<string, never> : util.Prettify<{
636
+ export type $InferObjectOutput<T extends $ZodLooseShape, Extra extends Record<string, unknown>> = string extends keyof T ? util.IsAny<T[keyof T]> extends true ? Record<string, unknown> : {
637
+ [k in string]: core.output<T[keyof T]>;
638
+ } : keyof (T & Extra) extends never ? Record<string, never> : util.Prettify<{
583
639
  -readonly [k in keyof T as T[k] extends OptionalOutSchema ? never : k]: T[k]["_zod"]["output"];
584
640
  } & {
585
641
  -readonly [k in keyof T as T[k] extends OptionalOutSchema ? k : never]?: T[k]["_zod"]["output"];
586
642
  } & Extra>;
587
- export type $InferObjectInput<T extends $ZodLooseShape, Extra extends Record<string, unknown>> = string extends keyof T ? util.IsAny<T[keyof T]> extends true ? Record<string, unknown> : Record<string, core.input<T[keyof T]>> : keyof (T & Extra) extends never ? Record<string, never> : util.Prettify<{
643
+ export type $InferObjectInput<T extends $ZodLooseShape, Extra extends Record<string, unknown>> = string extends keyof T ? util.IsAny<T[keyof T]> extends true ? Record<string, unknown> : {
644
+ [k in string]: core.input<T[keyof T]>;
645
+ } : keyof (T & Extra) extends never ? Record<string, never> : util.Prettify<{
588
646
  -readonly [k in keyof T as T[k] extends OptionalInSchema ? never : k]: T[k]["_zod"]["input"];
589
647
  } & {
590
648
  -readonly [k in keyof T as T[k] extends OptionalInSchema ? k : never]?: T[k]["_zod"]["input"];
@@ -656,7 +714,7 @@ export interface $ZodUnionInternals<T extends readonly SomeType[] = readonly $Zo
656
714
  values: T[number]["_zod"]["values"];
657
715
  output: $InferUnionOutput<T[number]>;
658
716
  input: $InferUnionInput<T[number]>;
659
- optin: IsOptionalIn<T[number]> extends false ? "optional" | undefined : "optional";
717
+ optin: IsOptionalIn<T[number]> extends false ? "optional" | "defaulted" | undefined : "optional" | "defaulted";
660
718
  optout: IsOptionalOut<T[number]> extends false ? "optional" | undefined : "optional";
661
719
  }
662
720
  export interface $ZodUnion<T extends readonly SomeType[] = readonly $ZodType[]> extends $ZodType<any, any, $ZodUnionInternals<T>> {
@@ -676,7 +734,28 @@ export interface $ZodDiscriminatedUnionDef<Options extends readonly SomeType[] =
676
734
  export interface $ZodDiscriminatedUnionInternals<Options extends readonly SomeType[] = readonly $ZodType[], Disc extends string = string> extends $ZodUnionInternals<Options> {
677
735
  def: $ZodDiscriminatedUnionDef<Options, Disc>;
678
736
  propValues: util.PropValues;
737
+ bag: util.LoosePartial<{
738
+ optionsMap: Map<util.Primitive, $ZodType | null>;
739
+ }>;
679
740
  }
741
+ /** The discriminator values a member of `Options` can declare. An omittable discriminator contributes `undefined`, matching what `propValues` claims for it. */
742
+ export type $DiscriminatorValue<Options extends readonly SomeType[], Disc extends string> = {
743
+ [I in keyof Options]: Options[I] extends {
744
+ _zod: {
745
+ output: infer Out;
746
+ };
747
+ } ? Disc extends keyof Out ? Out[Disc] : never : never;
748
+ }[number];
749
+ /** The member of `Options` that declares `V`. */
750
+ export type $DiscriminatedOption<Options extends readonly SomeType[], Disc extends string, V> = {
751
+ [I in keyof Options]: Options[I] extends {
752
+ _zod: {
753
+ output: infer Out;
754
+ };
755
+ } ? Disc extends keyof Out ? V extends Out[Disc] ? Options[I] : never : never : never;
756
+ }[number];
757
+ /** Returns the option whose discriminator claims `value`, or throws if ambiguous. */
758
+ export declare function getDiscriminatedOption<Options extends readonly SomeType[], Disc extends string, const V extends $DiscriminatorValue<Options, Disc>>(union: $ZodDiscriminatedUnion<Options, Disc>, value: V): $DiscriminatedOption<Options, Disc, V>;
680
759
  export interface $ZodDiscriminatedUnion<Options extends readonly SomeType[] = readonly $ZodType[], Disc extends string = string> extends $ZodType {
681
760
  _zod: $ZodDiscriminatedUnionInternals<Options, Disc>;
682
761
  }
@@ -698,6 +777,13 @@ export interface $ZodIntersection<A extends SomeType = $ZodType, B extends SomeT
698
777
  _zod: $ZodIntersectionInternals<A, B>;
699
778
  }
700
779
  export declare const $ZodIntersection: core.$constructor<$ZodIntersection>;
780
+ export declare function mergeValues(a: any, b: any): {
781
+ valid: true;
782
+ data: any;
783
+ } | {
784
+ valid: false;
785
+ mergeErrorPath: (string | number)[];
786
+ };
701
787
  export interface $ZodTupleDef<T extends util.TupleItems = readonly $ZodType[], Rest extends SomeType | null = $ZodType | null> extends $ZodTypeDef {
702
788
  type: "tuple";
703
789
  items: T;
@@ -713,7 +799,7 @@ type TupleInputTypeNoOptionals<T extends util.TupleItems> = {
713
799
  type TupleInputTypeWithOptionals<T extends util.TupleItems> = T extends readonly [
714
800
  ...infer Prefix extends SomeType[],
715
801
  infer Tail extends SomeType
716
- ] ? Tail["_zod"]["optin"] extends "optional" ? [...TupleInputTypeWithOptionals<Prefix>, core.input<Tail>?] : TupleInputTypeNoOptionals<T> : [];
802
+ ] ? Tail["_zod"]["optin"] extends "optional" | "defaulted" ? [...TupleInputTypeWithOptionals<Prefix>, core.input<Tail>?] : TupleInputTypeNoOptionals<T> : [];
717
803
  export type $InferTupleOutputType<T extends util.TupleItems, Rest extends SomeType | null> = [
718
804
  ...TupleOutputTypeWithOptionals<T>,
719
805
  ...(Rest extends SomeType ? core.output<Rest>[] : [])
@@ -742,9 +828,12 @@ export interface $ZodRecordDef<Key extends $ZodRecordKey = $ZodRecordKey, Value
742
828
  valueType: Value;
743
829
  /** @default "strict" - errors on keys not matching keyType. "loose" passes through non-matching keys unchanged. */
744
830
  mode?: "strict" | "loose";
831
+ partial?: boolean;
745
832
  }
746
833
  export type $InferZodRecordOutput<Key extends $ZodRecordKey = $ZodRecordKey, Value extends SomeType = $ZodType> = Key extends $partial ? Partial<Record<core.output<Key>, core.output<Value>>> : Record<core.output<Key>, core.output<Value>>;
747
- export type $InferZodRecordInput<Key extends $ZodRecordKey = $ZodRecordKey, Value extends SomeType = $ZodType> = Key extends $partial ? Partial<Record<core.input<Key> & PropertyKey, core.input<Value>>> : Record<core.input<Key> & PropertyKey, core.input<Value>>;
834
+ export type $InferZodRecordInput<Key extends $ZodRecordKey = $ZodRecordKey, Value extends SomeType = $ZodType> = Key extends $partial ? Partial<Record<core.input<Key> & PropertyKey, core.input<Value>>> : [
835
+ Value
836
+ ] extends [OptionalInSchema] ? Partial<Record<core.input<Key> & PropertyKey, core.input<Value>>> : Record<core.input<Key> & PropertyKey, core.input<Value>>;
748
837
  export interface $ZodRecordInternals<Key extends $ZodRecordKey = $ZodRecordKey, Value extends SomeType = $ZodType> extends $ZodTypeInternals<$InferZodRecordOutput<Key, Value>, $InferZodRecordInput<Key, Value>> {
749
838
  def: $ZodRecordDef<Key, Value>;
750
839
  isst: errors.$ZodIssueInvalidType | errors.$ZodIssueInvalidKey<Record<PropertyKey, unknown>>;
@@ -863,7 +952,7 @@ export interface $ZodOptionalDef<T extends SomeType = $ZodType> extends $ZodType
863
952
  }
864
953
  export interface $ZodOptionalInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<core.output<T> | undefined, core.input<T> | undefined> {
865
954
  def: $ZodOptionalDef<T>;
866
- optin: "optional";
955
+ optin: "optional" | "defaulted";
867
956
  optout: "optional";
868
957
  isst: never;
869
958
  values: T["_zod"]["values"];
@@ -908,7 +997,7 @@ export interface $ZodDefaultDef<T extends SomeType = $ZodType> extends $ZodTypeD
908
997
  }
909
998
  export interface $ZodDefaultInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<util.NoUndefined<core.output<T>>, core.input<T> | undefined> {
910
999
  def: $ZodDefaultDef<T>;
911
- optin: "optional";
1000
+ optin: "defaulted";
912
1001
  optout?: "optional" | undefined;
913
1002
  isst: never;
914
1003
  values: T["_zod"]["values"];
@@ -923,9 +1012,9 @@ export interface $ZodPrefaultDef<T extends SomeType = $ZodType> extends $ZodType
923
1012
  /** The default value. May be a getter. */
924
1013
  defaultValue: core.input<T>;
925
1014
  }
926
- export interface $ZodPrefaultInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<util.NoUndefined<core.output<T>>, core.input<T> | undefined> {
1015
+ export interface $ZodPrefaultInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<core.output<T>, core.input<T> | undefined> {
927
1016
  def: $ZodPrefaultDef<T>;
928
- optin: "optional";
1017
+ optin: "defaulted";
929
1018
  optout?: "optional" | undefined;
930
1019
  isst: never;
931
1020
  values: T["_zod"]["values"];
@@ -1035,17 +1124,17 @@ export interface $ZodCodec<A extends SomeType = $ZodType, B extends SomeType = $
1035
1124
  _zod: $ZodCodecInternals<A, B>;
1036
1125
  }
1037
1126
  export declare const $ZodCodec: core.$constructor<$ZodCodec>;
1038
- export interface $ZodPreprocessDef<B extends SomeType = $ZodType> extends $ZodPipeDef<$ZodTransform, B> {
1039
- in: $ZodTransform;
1127
+ export interface $ZodPreprocessDef<B extends SomeType = $ZodType, I = unknown> extends $ZodPipeDef<$ZodTransform<unknown, I>, B> {
1128
+ in: $ZodTransform<unknown, I>;
1040
1129
  out: B;
1041
1130
  }
1042
- export interface $ZodPreprocessInternals<B extends SomeType = $ZodType> extends $ZodPipeInternals<$ZodTransform, B> {
1043
- def: $ZodPreprocessDef<B>;
1131
+ export interface $ZodPreprocessInternals<B extends SomeType = $ZodType, I = unknown> extends $ZodPipeInternals<$ZodTransform<unknown, I>, B> {
1132
+ def: $ZodPreprocessDef<B, I>;
1044
1133
  optin: B["_zod"]["optin"];
1045
1134
  optout: B["_zod"]["optout"];
1046
1135
  }
1047
- export interface $ZodPreprocess<B extends SomeType = $ZodType> extends $ZodPipe<$ZodTransform, B> {
1048
- _zod: $ZodPreprocessInternals<B>;
1136
+ export interface $ZodPreprocess<B extends SomeType = $ZodType, I = unknown> extends $ZodPipe<$ZodTransform<unknown, I>, B> {
1137
+ _zod: $ZodPreprocessInternals<B, I>;
1049
1138
  }
1050
1139
  export declare const $ZodPreprocess: core.$constructor<$ZodPreprocess>;
1051
1140
  export interface $ZodReadonlyDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
@@ -1181,4 +1270,4 @@ export interface $ZodCustom<O = unknown, I = unknown> extends $ZodType {
1181
1270
  }
1182
1271
  export declare const $ZodCustom: core.$constructor<$ZodCustom>;
1183
1272
  export type $ZodTypes = $ZodString | $ZodNumber | $ZodBigInt | $ZodBoolean | $ZodDate | $ZodSymbol | $ZodUndefined | $ZodNullable | $ZodNull | $ZodAny | $ZodUnknown | $ZodNever | $ZodVoid | $ZodArray | $ZodObject | $ZodUnion | $ZodIntersection | $ZodTuple | $ZodRecord | $ZodMap | $ZodSet | $ZodLiteral | $ZodEnum | $ZodFunction | $ZodPromise | $ZodLazy | $ZodOptional | $ZodDefault | $ZodPrefault | $ZodTemplateLiteral | $ZodCustom | $ZodTransform | $ZodNonOptional | $ZodReadonly | $ZodNaN | $ZodPipe | $ZodSuccess | $ZodCatch | $ZodFile;
1184
- export type $ZodStringFormatTypes = $ZodGUID | $ZodUUID | $ZodEmail | $ZodURL | $ZodEmoji | $ZodNanoID | $ZodCUID | $ZodCUID2 | $ZodULID | $ZodXID | $ZodKSUID | $ZodISODateTime | $ZodISODate | $ZodISOTime | $ZodISODuration | $ZodIPv4 | $ZodIPv6 | $ZodMAC | $ZodCIDRv4 | $ZodCIDRv6 | $ZodBase64 | $ZodBase64URL | $ZodE164 | $ZodJWT | $ZodCustomStringFormat<"hex"> | $ZodCustomStringFormat<util.HashFormat> | $ZodCustomStringFormat<"hostname">;
1273
+ export type $ZodStringFormatTypes = $ZodGUID | $ZodUUID | $ZodEmail | $ZodURL | $ZodEmoji | $ZodNanoID | $ZodCUID | $ZodCUID2 | $ZodULID | $ZodXID | $ZodKSUID | $ZodISODateTime | $ZodISODate | $ZodISOTime | $ZodISODuration | $ZodIPv4 | $ZodIPv6 | $ZodMAC | $ZodCIDRv4 | $ZodCIDRv6 | $ZodBase64 | $ZodBase64URL | $ZodE164 | $ZodCreditCard | $ZodIBAN | $ZodJWT | $ZodCustomStringFormat<"hex"> | $ZodCustomStringFormat<util.HashFormat> | $ZodCustomStringFormat<"hostname"> | $ZodCustomStringFormat<"currency_code">;
@@ -4,6 +4,18 @@ import { type $ZodRegistry } from "./registries.js";
4
4
  import type * as schemas from "./schemas.js";
5
5
  import type { StandardJSONSchemaV1, StandardSchemaWithJSONProps } from "./standard-schema.js";
6
6
  export type Processor<T extends schemas.$ZodType = schemas.$ZodType> = (schema: T, ctx: ToJSONSchemaContext, json: JSONSchema.BaseSchema, params: ProcessParams) => void;
7
+ /**
8
+ * Called for each schema that has no JSON Schema equivalent. Return a JSON Schema to use in its
9
+ * place, `"any"` to fall back to the `unrepresentable: "any"` behavior, or `"throw"`/`undefined` to
10
+ * throw the default error. Throwing from the handler propagates, so custom errors work too.
11
+ */
12
+ export type UnrepresentableHandler<T extends schemas.$ZodType = schemas.$ZodType> = (ctx: {
13
+ zodSchema: T;
14
+ path: (string | number)[];
15
+ /** The error Zod would throw. Distinguishes sites that share a `zodSchema`, e.g. an `undefined`
16
+ * vs a `bigint` member of the same literal. */
17
+ message: string;
18
+ }) => JSONSchema.BaseSchema | "throw" | "any" | undefined;
7
19
  export interface JSONSchemaGeneratorParams {
8
20
  processors: Record<string, Processor>;
9
21
  /** A registry used to look up metadata for each schema. Any schema with an `id` property will be extracted as a $def.
@@ -17,8 +29,9 @@ export interface JSONSchemaGeneratorParams {
17
29
  target?: "draft-04" | "draft-07" | "draft-2020-12" | "openapi-3.0" | ({} & string) | undefined;
18
30
  /** How to handle unrepresentable types.
19
31
  * - `"throw"` — Default. Unrepresentable types throw an error
20
- * - `"any"` — Unrepresentable types become `{}` */
21
- unrepresentable?: "throw" | "any";
32
+ * - `"any"` — Unrepresentable types become `{}`
33
+ * - A function — called once per unrepresentable schema; see {@link UnrepresentableHandler}. */
34
+ unrepresentable?: "throw" | "any" | UnrepresentableHandler<schemas.$ZodTypes>;
22
35
  /** Arbitrary custom logic that can be used to modify the generated JSON Schema. */
23
36
  override?: (ctx: {
24
37
  zodSchema: schemas.$ZodTypes;
@@ -73,7 +86,7 @@ export interface ToJSONSchemaContext {
73
86
  processors: Record<string, Processor>;
74
87
  metadataRegistry: $ZodRegistry<Record<string, any>>;
75
88
  target: "draft-04" | "draft-07" | "draft-2020-12" | "openapi-3.0" | ({} & string);
76
- unrepresentable: "throw" | "any";
89
+ unrepresentable: "throw" | "any" | UnrepresentableHandler;
77
90
  override: (ctx: {
78
91
  zodSchema: schemas.$ZodType;
79
92
  jsonSchema: JSONSchema.BaseSchema;
@@ -82,8 +95,28 @@ export interface ToJSONSchemaContext {
82
95
  io: "input" | "output";
83
96
  counter: number;
84
97
  seen: Map<schemas.$ZodType, Seen>;
98
+ /** Registry conversions share one `seen` map across every emitted schema. These hold the
99
+ * `external` the whole-map passes below last ran for, so the passes are not repeated once per
100
+ * schema — and still re-run if the map grows or `external` is swapped. `sharedEmitDoneFor`
101
+ * covers both passes in `finalize`: the ref flattening and the `$defs` build.
102
+ *
103
+ * The passes are valid only while nothing they read has changed, so both are cleared in
104
+ * `processSchema()` when the map grows, and in `JSONSchemaGenerator.emit()`, which can also change
105
+ * the `cycles` and `reused` they branch on.
106
+ *
107
+ * One case is deliberately not covered: an `override` callback that writes to
108
+ * `metadataRegistry` mid-conversion. It runs inside `finalize`, so a registry conversion has
109
+ * nowhere left to clear the guards, and later schemas keep the ids the first pass saw. That
110
+ * output was never coherent — before this, whether a shared subschema was inlined or extracted
111
+ * depended on which registry entry happened to be emitted when the callback fired. */
112
+ sharedDefsExtractedFor?: ToJSONSchemaContext["external"];
113
+ sharedEmitDoneFor?: ToJSONSchemaContext["external"];
85
114
  cycles: "ref" | "throw";
86
115
  reused: "ref" | "inline";
116
+ /** The `allOf` array of each intersection encountered during traversal, innermost first. `finalize` folds every emitted object holding one; see `foldIntersection`. */
117
+ intersections: JSONSchema.BaseSchema[][];
118
+ /** Rewrites a processor deferred to `finalize`, where the flatten has resolved every ref and the union branches are in place. */
119
+ deferred: (() => void)[];
87
120
  external?: {
88
121
  registry: $ZodRegistry<{
89
122
  id?: string | undefined;
@@ -93,7 +126,15 @@ export interface ToJSONSchemaContext {
93
126
  } | undefined;
94
127
  }
95
128
  export declare function initializeContext(params: JSONSchemaGeneratorParams): ToJSONSchemaContext;
96
- export declare function process<T extends schemas.$ZodType>(schema: T, ctx: ToJSONSchemaContext, _params?: ProcessParams): JSONSchema.BaseSchema;
129
+ /**
130
+ * Applies the `unrepresentable` setting at a site that has no JSON Schema equivalent. Throws
131
+ * `message` unless the setting (or the handler's return value) says otherwise. Returns `true` if a
132
+ * custom JSON Schema was written into `json`, in which case the caller must not write its own.
133
+ */
134
+ export declare function handleUnrepresentable(schema: schemas.$ZodType, ctx: ToJSONSchemaContext, json: JSONSchema.BaseSchema, params: ProcessParams, message: string): boolean;
135
+ export declare function processSchema<T extends schemas.$ZodType>(schema: T, ctx: ToJSONSchemaContext, _params?: ProcessParams): JSONSchema.BaseSchema;
136
+ /** @deprecated Renamed to `processSchema`. An export alias declares no binding, so it is safe to keep. */
137
+ export { processSchema as process };
97
138
  export declare function extractDefs<T extends schemas.$ZodType>(ctx: ToJSONSchemaContext, schema: T): void;
98
139
  export declare function finalize<T extends schemas.$ZodType>(ctx: ToJSONSchemaContext, schema: T): ZodStandardJSONSchemaPayload<T>;
99
140
  export type ZodStandardSchemaWithJSON<T> = StandardSchemaWithJSONProps<core.input<T>, core.output<T>>;
@@ -111,4 +152,3 @@ export declare const createToJSONSchemaMethod: <T extends schemas.$ZodType>(sche
111
152
  */
112
153
  type StandardJSONSchemaMethodParams = Parameters<StandardJSONSchemaV1["~standard"]["jsonSchema"]["input"]>[0];
113
154
  export declare const createStandardJSONSchemaMethod: <T extends schemas.$ZodType>(schema: T, io: "input" | "output", processors?: Record<string, Processor>) => (params?: StandardJSONSchemaMethodParams) => JSONSchema.BaseSchema;
114
- export {};
@@ -15,6 +15,32 @@ export type ParsedTypes = "string" | "number" | "bigint" | "boolean" | "symbol"
15
15
  export type AssertEqual<T, U> = (<V>() => V extends T ? 1 : 2) extends <V>() => V extends U ? 1 : 2 ? true : false;
16
16
  export type AssertNotEqual<T, U> = (<V>() => V extends T ? 1 : 2) extends <V>() => V extends U ? 1 : 2 ? false : true;
17
17
  export type AssertExtends<T, U> = T extends U ? T : never;
18
+ type ToZodMismatch<T, S extends schemas.$ZodType> = {
19
+ "types do not match": {
20
+ expected: T;
21
+ received: S["_zod"]["output"];
22
+ };
23
+ };
24
+ type ToZodKeyMismatch<Expected, Received> = schemas.$ZodType & {
25
+ "types do not match": {
26
+ expected: Expected;
27
+ received: Received;
28
+ };
29
+ };
30
+ declare const toZodDummy: unique symbol;
31
+ type ToZodNormalize<T> = [T] extends [(...args: any[]) => any] ? T : [T] extends [object] ? {
32
+ [K in keyof T]: ToZodNormalize<T[K]>;
33
+ } : T | typeof toZodDummy;
34
+ type ToZodEqual<Output, T> = AssertEqual<Output, T> extends true ? true : IsAny<Output> extends true ? false : IsAny<T> extends true ? false : AssertEqual<ToZodNormalize<Output>, ToZodNormalize<T>>;
35
+ type ToZodShape<Shape, T> = {
36
+ [K in keyof Shape]: Shape[K] extends schemas.$ZodType ? K extends keyof T ? ToZodEqual<Shape[K]["_zod"]["output"], T[K]> extends true ? Shape[K] : ToZodKeyMismatch<T[K], Shape[K]["_zod"]["output"]> : ToZodKeyMismatch<never, Shape[K]["_zod"]["output"]> : Shape[K];
37
+ } & {
38
+ [K in Exclude<keyof T, keyof Shape>]: ToZodKeyMismatch<T[K], never>;
39
+ };
40
+ type ToZodExpand<X> = {
41
+ [K in keyof X]: X[K];
42
+ } & {};
43
+ type ToZodTarget<S extends schemas.$ZodType, T> = S extends schemas.$ZodObject<infer Shape, infer Config> ? T extends object ? AssertEqual<ToZodExpand<ToZodShape<Shape, T>>, ToZodExpand<Shape>> extends true ? S & ToZodMismatch<T, S> : schemas.$ZodObject<ToZodExpand<ToZodShape<Shape, T>>, Config> : S & ToZodMismatch<T, S> : S & ToZodMismatch<T, S>;
18
44
  export type IsAny<T> = 0 extends 1 & T ? true : false;
19
45
  export type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
20
46
  export type OmitKeys<T, K extends string> = Pick<T, Exclude<keyof T, K>>;
@@ -23,6 +49,7 @@ export type MakeRequired<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K
23
49
  export type Exactly<T, X> = T & Record<Exclude<keyof X, keyof T>, never>;
24
50
  export type NoUndefined<T> = T extends undefined ? never : T;
25
51
  export type Whatever = {} | undefined | null;
52
+ export type Widen<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T extends bigint ? bigint : T;
26
53
  export type LoosePartial<T extends object> = InexactPartial<T> & {
27
54
  [k: string]: unknown;
28
55
  };
@@ -110,6 +137,7 @@ export type PropValues = Record<string, Set<Primitive>>;
110
137
  export type PrimitiveSet = Set<Primitive>;
111
138
  export declare function assertEqual<A, B>(val: AssertEqual<A, B>): AssertEqual<A, B>;
112
139
  export declare function assertNotEqual<A, B>(val: AssertNotEqual<A, B>): AssertNotEqual<A, B>;
140
+ export declare function toZod<T>(): <S extends schemas.$ZodType>(schema: ToZodEqual<S["_zod"]["output"], T> extends true ? S : ToZodTarget<S, T>) => S;
113
141
  export declare function assertIs<T>(_arg: T): void;
114
142
  export declare function assertNever(_x: never): never;
115
143
  export declare function assert<T>(_: any): asserts _ is T;
@@ -125,6 +153,17 @@ export declare function floatSafeRemainder(val: number, step: number): number;
125
153
  export declare function defineLazy<T, K extends keyof T>(object: T, key: K, getter: () => T[K]): void;
126
154
  export declare function objectClone(obj: object): any;
127
155
  export declare function assignProp<T extends object, K extends PropertyKey>(target: T, prop: K, value: K extends keyof T ? T[K] : any): void;
156
+ /** A def's `shape` accessor, carrying whichever object it currently answers from. */
157
+ export interface ShapeGetter {
158
+ (): Record<PropertyKey, any>;
159
+ raw: Record<PropertyKey, any>;
160
+ }
161
+ /**
162
+ * Whichever object a def's `shape` currently answers from: the one the caller passed until the first read, the frozen copy after it.
163
+ *
164
+ * Its keys and descriptors read without invoking anything, which is what lets a discriminated union check its discriminator, and the cycle walk read a shape, without resolving a getter that references the schema being constructed. A def that answers `shape` from an accessor of its own has none.
165
+ */
166
+ export declare function rawShape(def: any): Record<PropertyKey, any> | undefined;
128
167
  export declare function mergeDefs(...defs: Record<string, any>[]): any;
129
168
  export declare function cloneDef(schema: schemas.$ZodType): any;
130
169
  export declare function getElementAtPath(obj: any, path: (string | number)[] | null | undefined): any;
@@ -173,7 +212,7 @@ export declare function omit(schema: schemas.$ZodObject, mask: object): any;
173
212
  export declare function extend(schema: schemas.$ZodObject, shape: schemas.$ZodShape): any;
174
213
  export declare function safeExtend(schema: schemas.$ZodObject, shape: schemas.$ZodShape): any;
175
214
  export declare function merge(a: schemas.$ZodObject, b: schemas.$ZodObject): any;
176
- export declare function partial(Class: SchemaClass<schemas.$ZodOptional> | null, schema: schemas.$ZodObject, mask: object | undefined): any;
215
+ export declare function partial(Class: SchemaClass<schemas.$ZodOptional> | null, schema: schemas.$ZodObject, mask: object | undefined, name?: string): any;
177
216
  export declare function required(Class: SchemaClass<schemas.$ZodNonOptional>, schema: schemas.$ZodObject, mask: object | undefined): any;
178
217
  export type Constructor<T, Def extends any[] = any[]> = new (...args: Def) => T;
179
218
  export declare function aborted(x: schemas.ParsePayload, startIndex?: number): boolean;
@@ -182,8 +221,10 @@ export declare function prefixIssues(path: PropertyKey, issues: errors.$ZodRawIs
182
221
  export declare function unwrapMessage(message: string | {
183
222
  message: string;
184
223
  } | undefined | null): string | undefined;
224
+ export declare function attachSchema(issues: errors.$ZodRawIssue[], start: number, inst: schemas.$ZodType): void;
185
225
  export declare function finalizeIssue(iss: errors.$ZodRawIssue, ctx: schemas.ParseContextInternal | undefined, config: $ZodConfig): errors.$ZodIssue;
186
226
  export declare function getSizableOrigin(input: any): "set" | "map" | "file" | "unknown";
227
+ export declare function codePointLength(str: string): number;
187
228
  export declare function getLengthableOrigin(input: any): "array" | "string" | "unknown";
188
229
  export declare function parsedType(data: unknown): errors.$ZodInvalidTypeExpected;
189
230
  export declare function issue(_iss: string, input: any, inst: any): errors.$ZodRawIssue;
@@ -198,3 +239,40 @@ export declare function uint8ArrayToHex(bytes: Uint8Array): string;
198
239
  export declare abstract class Class {
199
240
  constructor(..._args: any[]);
200
241
  }
242
+ /**
243
+ * Installs a trait's members on its prototype. Each value builds that member for the instance on first read; the built value shadows the accessor as an own property, so a detached `const { parse } = schema` keeps working.
244
+ *
245
+ * Call this from a `proto` initializer, which runs once per prototype — never per instance.
246
+ */
247
+ export declare function members(proto: object, table: object): void;
248
+ /** Shadows a prototype member with an own value, so a getter that builds from the instance runs once. */
249
+ export declare function own<T>(inst: object, key: PropertyKey, value: T, enumerable?: boolean): T;
250
+ /** Like {@link own}, for a member that was never an own data property and has to stay out of `Object.keys`. */
251
+ export declare function hide<T>(inst: object, key: PropertyKey, value: T): T;
252
+ /** Adds members a table derives from the instance: each builds on first read and shadows as own data, and assignment shadows the same way, as when these were own properties. */
253
+ export declare function derived<T>(computes: {
254
+ [K in keyof T]?: (inst: T) => T[K];
255
+ }, table: ProtoOf<T>): ProtoOf<T>;
256
+ /** A trait's prototype members: a partial view of its own interface, with `this` typed as the instance. */
257
+ export type ProtoOf<T> = {
258
+ [K in keyof T]?: (T[K] extends (...args: infer A) => infer R ? (...args: A) => R : T[K]) | undefined;
259
+ } & ThisType<T>;
260
+ /**
261
+ * Installs a lazily-derived internal on the `_zod` prototype of `inst`'s
262
+ * constructor, computed from the internals object itself and cached there on
263
+ * first read. One accessor per constructor rather than one per instance.
264
+ */
265
+ export declare function defineLazyInternal<T extends {
266
+ _zod: any;
267
+ }>(inst: T, key: string, compute: (zod: T["_zod"]) => unknown): void;
268
+ /**
269
+ * Installs `key` on `inst`'s prototype, computed by `make` on first read and cached there as an own
270
+ * data property. One accessor per constructor rather than one per instance, because an own accessor
271
+ * puts every instance after the first into v8 dictionary mode. The key doubles as the sentinel.
272
+ */
273
+ export declare function installLazyProp(inst: object, key: string, make: (self: any) => unknown, enumerable: boolean): void;
274
+ /** Marks the thunk `_catch` synthesises for a constant catch value. `Function.length` cannot tell that thunk from a user callback — rest and defaulted parameters both report arity 0 — and a user callback reads `ctx.error`, whose issues only finalize correctly against the caller's per-parse error map. Provenance can say what arity cannot. A plain string key rather than `Symbol.for`, whose call at module scope no bundler can prove pure — the same shape that anchored `urlCanParse` into every build. */
275
+ export declare const CONSTANT_CATCH = "~constantCatch";
276
+ /** Wraps a constant catch value in a thunk tagged with {@link CONSTANT_CATCH}. */
277
+ export declare function constantCatch<T>(value: T): () => T;
278
+ export {};
@@ -1,5 +1,5 @@
1
1
  export declare const version: {
2
2
  readonly major: 4;
3
- readonly minor: 4;
3
+ readonly minor: 6;
4
4
  readonly patch: number;
5
5
  };
@@ -1,3 +1,3 @@
1
- import z4 from "./classic/index.cjs";
1
+ import * as z4 from "./classic/external.cjs";
2
2
  export * from "./classic/index.cjs";
3
- export default z4;
3
+ export { z4 as default };
@@ -0,0 +1,4 @@
1
+ import type * as errors from "../core/errors.js";
2
+ export default function (): {
3
+ localeError: errors.$ZodErrorMap;
4
+ };
@@ -0,0 +1,4 @@
1
+ import type * as errors from "../core/errors.js";
2
+ export default function (): {
3
+ localeError: errors.$ZodErrorMap;
4
+ };
@@ -0,0 +1,4 @@
1
+ import type * as errors from "../core/errors.js";
2
+ export default function (): {
3
+ localeError: errors.$ZodErrorMap;
4
+ };
@@ -0,0 +1,4 @@
1
+ import type * as errors from "../core/errors.js";
2
+ export default function (): {
3
+ localeError: errors.$ZodErrorMap;
4
+ };