@rexeus/typeweaver-clients 0.0.1

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.
@@ -0,0 +1,1618 @@
1
+ /** The Standard Schema interface. */
2
+ interface StandardSchemaV1<Input = unknown, Output = Input> {
3
+ /** The Standard Schema properties. */
4
+ readonly "~standard": StandardSchemaV1.Props<Input, Output>;
5
+ }
6
+ declare namespace StandardSchemaV1 {
7
+ /** The Standard Schema properties interface. */
8
+ interface Props<Input = unknown, Output = Input> {
9
+ /** The version number of the standard. */
10
+ readonly version: 1;
11
+ /** The vendor name of the schema library. */
12
+ readonly vendor: string;
13
+ /** Validates unknown input values. */
14
+ readonly validate: (value: unknown) => Result<Output> | Promise<Result<Output>>;
15
+ /** Inferred types associated with the schema. */
16
+ readonly types?: Types<Input, Output> | undefined;
17
+ }
18
+ /** The result interface of the validate function. */
19
+ type Result<Output> = SuccessResult<Output> | FailureResult;
20
+ /** The result interface if validation succeeds. */
21
+ interface SuccessResult<Output> {
22
+ /** The typed output value. */
23
+ readonly value: Output;
24
+ /** The non-existent issues. */
25
+ readonly issues?: undefined;
26
+ }
27
+ /** The result interface if validation fails. */
28
+ interface FailureResult {
29
+ /** The issues of failed validation. */
30
+ readonly issues: ReadonlyArray<Issue>;
31
+ }
32
+ /** The issue interface of the failure output. */
33
+ interface Issue {
34
+ /** The error message of the issue. */
35
+ readonly message: string;
36
+ /** The path of the issue, if any. */
37
+ readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
38
+ }
39
+ /** The path segment interface of the issue. */
40
+ interface PathSegment {
41
+ /** The key representing a path segment. */
42
+ readonly key: PropertyKey;
43
+ }
44
+ /** The Standard Schema types interface. */
45
+ interface Types<Input = unknown, Output = Input> {
46
+ /** The input type of the schema. */
47
+ readonly input: Input;
48
+ /** The output type of the schema. */
49
+ readonly output: Output;
50
+ }
51
+ /** Infers the input type of a Standard Schema. */
52
+ type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["input"];
53
+ /** Infers the output type of a Standard Schema. */
54
+ type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["output"];
55
+ }
56
+
57
+ type JWTAlgorithm = "HS256" | "HS384" | "HS512" | "RS256" | "RS384" | "RS512" | "ES256" | "ES384" | "ES512" | "PS256" | "PS384" | "PS512" | "EdDSA" | (string & {});
58
+ type Omit$1<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
59
+ type MakePartial<T, K extends keyof T> = Omit$1<T, K> & InexactPartial<Pick<T, K>>;
60
+ type Exactly<T, X> = T & Record<Exclude<keyof X, keyof T>, never>;
61
+ type NoUndefined<T> = T extends undefined ? never : T;
62
+ type Whatever = {} | undefined | null;
63
+ type LoosePartial<T extends object> = InexactPartial<T> & {
64
+ [k: string]: unknown;
65
+ };
66
+ type Mask<Keys extends PropertyKey> = {
67
+ [K in Keys]?: true;
68
+ };
69
+ type InexactPartial<T> = {
70
+ [P in keyof T]?: T[P] | undefined;
71
+ };
72
+ type BuiltIn = (((...args: any[]) => any) | (new (...args: any[]) => any)) | {
73
+ readonly [Symbol.toStringTag]: string;
74
+ } | Date | Error | Generator | Promise<unknown> | RegExp;
75
+ type MakeReadonly<T> = T extends Map<infer K, infer V> ? ReadonlyMap<K, V> : T extends Set<infer V> ? ReadonlySet<V> : T extends [infer Head, ...infer Tail] ? readonly [Head, ...Tail] : T extends Array<infer V> ? ReadonlyArray<V> : T extends BuiltIn ? T : Readonly<T>;
76
+ type SomeObject = Record<PropertyKey, any>;
77
+ type Identity<T> = T;
78
+ type Flatten<T> = Identity<{
79
+ [k in keyof T]: T[k];
80
+ }>;
81
+ type Prettify<T> = {
82
+ [K in keyof T]: T[K];
83
+ } & {};
84
+ type Extend<A extends SomeObject, B extends SomeObject> = Flatten<keyof A & keyof B extends never ? A & B : {
85
+ [K in keyof A as K extends keyof B ? never : K]: A[K];
86
+ } & {
87
+ [K in keyof B]: B[K];
88
+ }>;
89
+ type AnyFunc = (...args: any[]) => any;
90
+ type MaybeAsync<T> = T | Promise<T>;
91
+ type EnumValue = string | number;
92
+ type EnumLike = Readonly<Record<string, EnumValue>>;
93
+ type ToEnum<T extends EnumValue> = Flatten<{
94
+ [k in T]: k;
95
+ }>;
96
+ type Literal = string | number | bigint | boolean | null | undefined;
97
+ type Primitive = string | number | symbol | bigint | boolean | null | undefined;
98
+ type HasLength = {
99
+ length: number;
100
+ };
101
+ type PropValues = Record<string, Set<Primitive>>;
102
+ type PrimitiveSet = Set<Primitive>;
103
+ type EmptyToNever<T> = keyof T extends never ? never : T;
104
+ declare abstract class Class {
105
+ constructor(..._args: any[]);
106
+ }
107
+
108
+ declare const version: {
109
+ readonly major: 4;
110
+ readonly minor: 0;
111
+ readonly patch: number;
112
+ };
113
+
114
+ interface ParseContext<T extends $ZodIssueBase = never> {
115
+ /** Customize error messages. */
116
+ readonly error?: $ZodErrorMap<T>;
117
+ /** Include the `input` field in issue objects. Default `false`. */
118
+ readonly reportInput?: boolean;
119
+ /** Skip eval-based fast path. Default `false`. */
120
+ readonly jitless?: boolean;
121
+ }
122
+ /** @internal */
123
+ interface ParseContextInternal<T extends $ZodIssueBase = never> extends ParseContext<T> {
124
+ readonly async?: boolean | undefined;
125
+ }
126
+ interface ParsePayload<T = unknown> {
127
+ value: T;
128
+ issues: $ZodRawIssue[];
129
+ }
130
+ type CheckFn<T> = (input: ParsePayload<T>) => MaybeAsync<void>;
131
+ interface $ZodTypeDef {
132
+ type: "string" | "number" | "int" | "boolean" | "bigint" | "symbol" | "null" | "undefined" | "void" | "never" | "any" | "unknown" | "date" | "object" | "record" | "file" | "array" | "tuple" | "union" | "intersection" | "map" | "set" | "enum" | "literal" | "nullable" | "optional" | "nonoptional" | "success" | "transform" | "default" | "prefault" | "catch" | "nan" | "pipe" | "readonly" | "template_literal" | "promise" | "lazy" | "custom";
133
+ error?: $ZodErrorMap<never> | undefined;
134
+ checks?: $ZodCheck<never>[];
135
+ }
136
+ interface _$ZodTypeInternals {
137
+ /** The `@zod/core` version of this schema */
138
+ version: typeof version;
139
+ /** Schema definition. */
140
+ def: $ZodTypeDef;
141
+ /** @internal Randomly generated ID for this schema. */
142
+ id: string;
143
+ /** @internal List of deferred initializers. */
144
+ deferred: AnyFunc[] | undefined;
145
+ /** @internal Parses input and runs all checks (refinements). */
146
+ run(payload: ParsePayload<any>, ctx: ParseContextInternal): MaybeAsync<ParsePayload>;
147
+ /** @internal Parses input, doesn't run checks. */
148
+ parse(payload: ParsePayload<any>, ctx: ParseContextInternal): MaybeAsync<ParsePayload>;
149
+ /** @internal Stores identifiers for the set of traits implemented by this schema. */
150
+ traits: Set<string>;
151
+ /** @internal Indicates that a schema output type should be considered optional inside objects.
152
+ * @default Required
153
+ */
154
+ /** @internal */
155
+ optin?: "optional" | undefined;
156
+ /** @internal */
157
+ optout?: "optional" | undefined;
158
+ /** @internal The set of literal values that will pass validation. Must be an exhaustive set. Used to determine optionality in z.record().
159
+ *
160
+ * Defined on: enum, const, literal, null, undefined
161
+ * Passthrough: optional, nullable, branded, default, catch, pipe
162
+ * Todo: unions?
163
+ */
164
+ values?: PrimitiveSet | undefined;
165
+ /** @internal A set of literal discriminators used for the fast path in discriminated unions. */
166
+ propValues?: PropValues | undefined;
167
+ /** @internal This flag indicates that a schema validation can be represented with a regular expression. Used to determine allowable schemas in z.templateLiteral(). */
168
+ pattern: RegExp | undefined;
169
+ /** @internal The constructor function of this schema. */
170
+ constr: new (def: any) => $ZodType;
171
+ /** @internal A catchall object for bag metadata related to this schema. Commonly modified by checks using `onattach`. */
172
+ bag: Record<string, unknown>;
173
+ /** @internal The set of issues this schema might throw during type checking. */
174
+ isst: $ZodIssueBase;
175
+ /** An optional method used to override `toJSONSchema` logic. */
176
+ toJSONSchema?: () => unknown;
177
+ /** @internal The parent of this schema. Only set during certain clone operations. */
178
+ parent?: $ZodType | undefined;
179
+ }
180
+ /** @internal */
181
+ interface $ZodTypeInternals<out O = unknown, out I = unknown> extends _$ZodTypeInternals {
182
+ /** @internal The inferred output type */
183
+ output: O;
184
+ /** @internal The inferred input type */
185
+ input: I;
186
+ }
187
+ type $ZodStandardSchema<T> = StandardSchemaV1.Props<input<T>, output<T>>;
188
+ type SomeType = {
189
+ _zod: _$ZodTypeInternals;
190
+ };
191
+ interface $ZodType<O = unknown, I = unknown, Internals extends $ZodTypeInternals<O, I> = $ZodTypeInternals<O, I>> {
192
+ _zod: Internals;
193
+ "~standard": $ZodStandardSchema<this>;
194
+ }
195
+ declare const $ZodType: $constructor<$ZodType>;
196
+
197
+ interface $ZodStringDef extends $ZodTypeDef {
198
+ type: "string";
199
+ coerce?: boolean;
200
+ checks?: $ZodCheck<string>[];
201
+ }
202
+ interface $ZodStringInternals<Input> extends $ZodTypeInternals<string, Input> {
203
+ def: $ZodStringDef;
204
+ /** @deprecated Internal API, use with caution (not deprecated) */
205
+ pattern: RegExp;
206
+ /** @deprecated Internal API, use with caution (not deprecated) */
207
+ isst: $ZodIssueInvalidType;
208
+ bag: LoosePartial<{
209
+ minimum: number;
210
+ maximum: number;
211
+ patterns: Set<RegExp>;
212
+ format: string;
213
+ contentEncoding: string;
214
+ }>;
215
+ }
216
+ interface $ZodStringFormatDef<Format extends $ZodStringFormats = $ZodStringFormats> extends $ZodStringDef, $ZodCheckStringFormatDef<Format> {
217
+ }
218
+ interface $ZodStringFormatInternals<Format extends $ZodStringFormats = $ZodStringFormats> extends $ZodStringInternals<string>, $ZodCheckStringFormatInternals {
219
+ def: $ZodStringFormatDef<Format>;
220
+ }
221
+ interface $ZodStringFormat<Format extends $ZodStringFormats = $ZodStringFormats> extends $ZodType {
222
+ _zod: $ZodStringFormatInternals<Format>;
223
+ }
224
+ declare const $ZodStringFormat: $constructor<$ZodStringFormat>;
225
+ interface $ZodGUIDInternals extends $ZodStringFormatInternals<"guid"> {
226
+ }
227
+ interface $ZodGUID extends $ZodType {
228
+ _zod: $ZodGUIDInternals;
229
+ }
230
+ declare const $ZodGUID: $constructor<$ZodGUID>;
231
+ interface $ZodUUIDDef extends $ZodStringFormatDef<"uuid"> {
232
+ version?: "v1" | "v2" | "v3" | "v4" | "v5" | "v6" | "v7" | "v8";
233
+ }
234
+ interface $ZodUUIDInternals extends $ZodStringFormatInternals<"uuid"> {
235
+ def: $ZodUUIDDef;
236
+ }
237
+ interface $ZodUUID extends $ZodType {
238
+ _zod: $ZodUUIDInternals;
239
+ }
240
+ declare const $ZodUUID: $constructor<$ZodUUID>;
241
+ interface $ZodEmailInternals extends $ZodStringFormatInternals<"email"> {
242
+ }
243
+ interface $ZodEmail extends $ZodType {
244
+ _zod: $ZodEmailInternals;
245
+ }
246
+ declare const $ZodEmail: $constructor<$ZodEmail>;
247
+ interface $ZodURLDef extends $ZodStringFormatDef<"url"> {
248
+ hostname?: RegExp | undefined;
249
+ protocol?: RegExp | undefined;
250
+ }
251
+ interface $ZodURLInternals extends $ZodStringFormatInternals<"url"> {
252
+ def: $ZodURLDef;
253
+ }
254
+ interface $ZodURL extends $ZodType {
255
+ _zod: $ZodURLInternals;
256
+ }
257
+ declare const $ZodURL: $constructor<$ZodURL>;
258
+ interface $ZodEmojiInternals extends $ZodStringFormatInternals<"emoji"> {
259
+ }
260
+ interface $ZodEmoji extends $ZodType {
261
+ _zod: $ZodEmojiInternals;
262
+ }
263
+ declare const $ZodEmoji: $constructor<$ZodEmoji>;
264
+ interface $ZodNanoIDInternals extends $ZodStringFormatInternals<"nanoid"> {
265
+ }
266
+ interface $ZodNanoID extends $ZodType {
267
+ _zod: $ZodNanoIDInternals;
268
+ }
269
+ declare const $ZodNanoID: $constructor<$ZodNanoID>;
270
+ interface $ZodCUIDInternals extends $ZodStringFormatInternals<"cuid"> {
271
+ }
272
+ interface $ZodCUID extends $ZodType {
273
+ _zod: $ZodCUIDInternals;
274
+ }
275
+ declare const $ZodCUID: $constructor<$ZodCUID>;
276
+ interface $ZodCUID2Internals extends $ZodStringFormatInternals<"cuid2"> {
277
+ }
278
+ interface $ZodCUID2 extends $ZodType {
279
+ _zod: $ZodCUID2Internals;
280
+ }
281
+ declare const $ZodCUID2: $constructor<$ZodCUID2>;
282
+ interface $ZodULIDInternals extends $ZodStringFormatInternals<"ulid"> {
283
+ }
284
+ interface $ZodULID extends $ZodType {
285
+ _zod: $ZodULIDInternals;
286
+ }
287
+ declare const $ZodULID: $constructor<$ZodULID>;
288
+ interface $ZodXIDInternals extends $ZodStringFormatInternals<"xid"> {
289
+ }
290
+ interface $ZodXID extends $ZodType {
291
+ _zod: $ZodXIDInternals;
292
+ }
293
+ declare const $ZodXID: $constructor<$ZodXID>;
294
+ interface $ZodKSUIDInternals extends $ZodStringFormatInternals<"ksuid"> {
295
+ }
296
+ interface $ZodKSUID extends $ZodType {
297
+ _zod: $ZodKSUIDInternals;
298
+ }
299
+ declare const $ZodKSUID: $constructor<$ZodKSUID>;
300
+ interface $ZodISODateTimeDef extends $ZodStringFormatDef<"datetime"> {
301
+ precision: number | null;
302
+ offset: boolean;
303
+ local: boolean;
304
+ }
305
+ interface $ZodISODateTimeInternals extends $ZodStringFormatInternals {
306
+ def: $ZodISODateTimeDef;
307
+ }
308
+ interface $ZodISODateTime extends $ZodType {
309
+ _zod: $ZodISODateTimeInternals;
310
+ }
311
+ declare const $ZodISODateTime: $constructor<$ZodISODateTime>;
312
+ interface $ZodISODateInternals extends $ZodStringFormatInternals<"date"> {
313
+ }
314
+ interface $ZodISODate extends $ZodType {
315
+ _zod: $ZodISODateInternals;
316
+ }
317
+ declare const $ZodISODate: $constructor<$ZodISODate>;
318
+ interface $ZodISOTimeDef extends $ZodStringFormatDef<"time"> {
319
+ precision?: number | null;
320
+ }
321
+ interface $ZodISOTimeInternals extends $ZodStringFormatInternals<"time"> {
322
+ def: $ZodISOTimeDef;
323
+ }
324
+ interface $ZodISOTime extends $ZodType {
325
+ _zod: $ZodISOTimeInternals;
326
+ }
327
+ declare const $ZodISOTime: $constructor<$ZodISOTime>;
328
+ interface $ZodISODurationInternals extends $ZodStringFormatInternals<"duration"> {
329
+ }
330
+ interface $ZodISODuration extends $ZodType {
331
+ _zod: $ZodISODurationInternals;
332
+ }
333
+ declare const $ZodISODuration: $constructor<$ZodISODuration>;
334
+ interface $ZodIPv4Def extends $ZodStringFormatDef<"ipv4"> {
335
+ version?: "v4";
336
+ }
337
+ interface $ZodIPv4Internals extends $ZodStringFormatInternals<"ipv4"> {
338
+ def: $ZodIPv4Def;
339
+ }
340
+ interface $ZodIPv4 extends $ZodType {
341
+ _zod: $ZodIPv4Internals;
342
+ }
343
+ declare const $ZodIPv4: $constructor<$ZodIPv4>;
344
+ interface $ZodIPv6Def extends $ZodStringFormatDef<"ipv6"> {
345
+ version?: "v6";
346
+ }
347
+ interface $ZodIPv6Internals extends $ZodStringFormatInternals<"ipv6"> {
348
+ def: $ZodIPv6Def;
349
+ }
350
+ interface $ZodIPv6 extends $ZodType {
351
+ _zod: $ZodIPv6Internals;
352
+ }
353
+ declare const $ZodIPv6: $constructor<$ZodIPv6>;
354
+ interface $ZodCIDRv4Def extends $ZodStringFormatDef<"cidrv4"> {
355
+ version?: "v4";
356
+ }
357
+ interface $ZodCIDRv4Internals extends $ZodStringFormatInternals<"cidrv4"> {
358
+ def: $ZodCIDRv4Def;
359
+ }
360
+ interface $ZodCIDRv4 extends $ZodType {
361
+ _zod: $ZodCIDRv4Internals;
362
+ }
363
+ declare const $ZodCIDRv4: $constructor<$ZodCIDRv4>;
364
+ interface $ZodCIDRv6Def extends $ZodStringFormatDef<"cidrv6"> {
365
+ version?: "v6";
366
+ }
367
+ interface $ZodCIDRv6Internals extends $ZodStringFormatInternals<"cidrv6"> {
368
+ def: $ZodCIDRv6Def;
369
+ }
370
+ interface $ZodCIDRv6 extends $ZodType {
371
+ _zod: $ZodCIDRv6Internals;
372
+ }
373
+ declare const $ZodCIDRv6: $constructor<$ZodCIDRv6>;
374
+ interface $ZodBase64Internals extends $ZodStringFormatInternals<"base64"> {
375
+ }
376
+ interface $ZodBase64 extends $ZodType {
377
+ _zod: $ZodBase64Internals;
378
+ }
379
+ declare const $ZodBase64: $constructor<$ZodBase64>;
380
+ interface $ZodBase64URLInternals extends $ZodStringFormatInternals<"base64url"> {
381
+ }
382
+ interface $ZodBase64URL extends $ZodType {
383
+ _zod: $ZodBase64URLInternals;
384
+ }
385
+ declare const $ZodBase64URL: $constructor<$ZodBase64URL>;
386
+ interface $ZodE164Internals extends $ZodStringFormatInternals<"e164"> {
387
+ }
388
+ interface $ZodE164 extends $ZodType {
389
+ _zod: $ZodE164Internals;
390
+ }
391
+ declare const $ZodE164: $constructor<$ZodE164>;
392
+ interface $ZodJWTDef extends $ZodStringFormatDef<"jwt"> {
393
+ alg?: JWTAlgorithm | undefined;
394
+ }
395
+ interface $ZodJWTInternals extends $ZodStringFormatInternals<"jwt"> {
396
+ def: $ZodJWTDef;
397
+ }
398
+ interface $ZodJWT extends $ZodType {
399
+ _zod: $ZodJWTInternals;
400
+ }
401
+ declare const $ZodJWT: $constructor<$ZodJWT>;
402
+ interface $ZodArrayDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
403
+ type: "array";
404
+ element: T;
405
+ }
406
+ interface $ZodArrayInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<output<T>[], input<T>[]> {
407
+ def: $ZodArrayDef<T>;
408
+ isst: $ZodIssueInvalidType;
409
+ }
410
+ interface $ZodArray<T extends SomeType = $ZodType> extends $ZodType<output<T>[], input<T>[], $ZodArrayInternals<T>> {
411
+ }
412
+ declare const $ZodArray: $constructor<$ZodArray>;
413
+ type OptionalOutSchema = {
414
+ _zod: {
415
+ optout: "optional";
416
+ };
417
+ };
418
+ type OptionalInSchema = {
419
+ _zod: {
420
+ optin: "optional";
421
+ };
422
+ };
423
+ type $InferObjectOutput<T extends $ZodLooseShape, Extra extends Record<string, unknown>> = string extends keyof T ? Record<string, unknown> : keyof (T & Extra) extends never ? Record<string, never> : Prettify<{
424
+ -readonly [k in keyof T as T[k] extends OptionalOutSchema ? never : k]: T[k]["_zod"]["output"];
425
+ } & {
426
+ -readonly [k in keyof T as T[k] extends OptionalOutSchema ? k : never]?: T[k]["_zod"]["output"];
427
+ } & Extra>;
428
+ type $InferObjectInput<T extends $ZodLooseShape, Extra extends Record<string, unknown>> = string extends keyof T ? Record<string, unknown> : keyof (T & Extra) extends never ? Record<string, never> : Prettify<{
429
+ -readonly [k in keyof T as T[k] extends OptionalInSchema ? never : k]: T[k]["_zod"]["input"];
430
+ } & {
431
+ -readonly [k in keyof T as T[k] extends OptionalInSchema ? k : never]?: T[k]["_zod"]["input"];
432
+ } & Extra>;
433
+ type $ZodObjectConfig = {
434
+ out: Record<string, unknown>;
435
+ in: Record<string, unknown>;
436
+ };
437
+ type $loose = {
438
+ out: Record<string, unknown>;
439
+ in: Record<string, unknown>;
440
+ };
441
+ type $strict = {
442
+ out: {};
443
+ in: {};
444
+ };
445
+ type $strip = {
446
+ out: {};
447
+ in: {};
448
+ };
449
+ type $catchall<T extends SomeType> = {
450
+ out: {
451
+ [k: string]: output<T>;
452
+ };
453
+ in: {
454
+ [k: string]: input<T>;
455
+ };
456
+ };
457
+ type $ZodShape = Readonly<{
458
+ [k: string]: $ZodType;
459
+ }>;
460
+ interface $ZodObjectDef<Shape extends $ZodShape = $ZodShape> extends $ZodTypeDef {
461
+ type: "object";
462
+ shape: Shape;
463
+ catchall?: $ZodType | undefined;
464
+ }
465
+ interface $ZodObjectInternals<
466
+ /** @ts-ignore Cast variance */
467
+ out Shape extends Readonly<$ZodShape> = Readonly<$ZodShape>, out Config extends $ZodObjectConfig = $ZodObjectConfig> extends _$ZodTypeInternals {
468
+ def: $ZodObjectDef<Shape>;
469
+ config: Config;
470
+ isst: $ZodIssueInvalidType | $ZodIssueUnrecognizedKeys;
471
+ propValues: PropValues;
472
+ output: $InferObjectOutput<Shape, Config["out"]>;
473
+ input: $InferObjectInput<Shape, Config["in"]>;
474
+ }
475
+ type $ZodLooseShape = Record<string, any>;
476
+ interface $ZodObject<
477
+ /** @ts-ignore Cast variance */
478
+ out Shape extends Readonly<$ZodShape> = Readonly<$ZodShape>, out Params extends $ZodObjectConfig = $ZodObjectConfig> extends $ZodType<any, any, $ZodObjectInternals<Shape, Params>> {
479
+ "~standard": $ZodStandardSchema<this>;
480
+ }
481
+ declare const $ZodObject: $constructor<$ZodObject>;
482
+ type $InferUnionOutput<T extends SomeType> = T extends any ? output<T> : never;
483
+ type $InferUnionInput<T extends SomeType> = T extends any ? input<T> : never;
484
+ interface $ZodUnionDef<Options extends readonly SomeType[] = readonly $ZodType[]> extends $ZodTypeDef {
485
+ type: "union";
486
+ options: Options;
487
+ }
488
+ interface $ZodUnionInternals<T extends readonly SomeType[] = readonly $ZodType[]> extends $ZodTypeInternals<$InferUnionOutput<T[number]>, $InferUnionInput<T[number]>> {
489
+ def: $ZodUnionDef<T>;
490
+ isst: $ZodIssueInvalidUnion;
491
+ pattern: T[number]["_zod"]["pattern"];
492
+ }
493
+ interface $ZodUnion<T extends readonly SomeType[] = readonly $ZodType[]> extends $ZodType {
494
+ _zod: $ZodUnionInternals<T>;
495
+ }
496
+ declare const $ZodUnion: $constructor<$ZodUnion>;
497
+ interface $ZodIntersectionDef<Left extends SomeType = $ZodType, Right extends SomeType = $ZodType> extends $ZodTypeDef {
498
+ type: "intersection";
499
+ left: Left;
500
+ right: Right;
501
+ }
502
+ interface $ZodIntersectionInternals<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends $ZodTypeInternals<output<A> & output<B>, input<A> & input<B>> {
503
+ def: $ZodIntersectionDef<A, B>;
504
+ isst: never;
505
+ }
506
+ interface $ZodIntersection<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends $ZodType {
507
+ _zod: $ZodIntersectionInternals<A, B>;
508
+ }
509
+ declare const $ZodIntersection: $constructor<$ZodIntersection>;
510
+ type $InferEnumOutput<T extends EnumLike> = T[keyof T] & {};
511
+ type $InferEnumInput<T extends EnumLike> = T[keyof T] & {};
512
+ interface $ZodEnumDef<T extends EnumLike = EnumLike> extends $ZodTypeDef {
513
+ type: "enum";
514
+ entries: T;
515
+ }
516
+ interface $ZodEnumInternals<
517
+ /** @ts-ignore Cast variance */
518
+ out T extends EnumLike = EnumLike> extends $ZodTypeInternals<$InferEnumOutput<T>, $InferEnumInput<T>> {
519
+ def: $ZodEnumDef<T>;
520
+ /** @deprecated Internal API, use with caution (not deprecated) */
521
+ values: PrimitiveSet;
522
+ /** @deprecated Internal API, use with caution (not deprecated) */
523
+ pattern: RegExp;
524
+ isst: $ZodIssueInvalidValue;
525
+ }
526
+ interface $ZodEnum<T extends EnumLike = EnumLike> extends $ZodType {
527
+ _zod: $ZodEnumInternals<T>;
528
+ }
529
+ declare const $ZodEnum: $constructor<$ZodEnum>;
530
+ interface $ZodLiteralDef<T extends Literal> extends $ZodTypeDef {
531
+ type: "literal";
532
+ values: T[];
533
+ }
534
+ interface $ZodLiteralInternals<T extends Literal = Literal> extends $ZodTypeInternals<T, T> {
535
+ def: $ZodLiteralDef<T>;
536
+ values: Set<T>;
537
+ pattern: RegExp;
538
+ isst: $ZodIssueInvalidValue;
539
+ }
540
+ interface $ZodLiteral<T extends Literal = Literal> extends $ZodType {
541
+ _zod: $ZodLiteralInternals<T>;
542
+ }
543
+ declare const $ZodLiteral: $constructor<$ZodLiteral>;
544
+ declare global {
545
+ interface File {
546
+ }
547
+ }
548
+ interface $ZodTransformDef extends $ZodTypeDef {
549
+ type: "transform";
550
+ transform: (input: unknown, payload: ParsePayload<unknown>) => MaybeAsync<unknown>;
551
+ }
552
+ interface $ZodTransformInternals<O = unknown, I = unknown> extends $ZodTypeInternals<O, I> {
553
+ def: $ZodTransformDef;
554
+ isst: never;
555
+ }
556
+ interface $ZodTransform<O = unknown, I = unknown> extends $ZodType {
557
+ _zod: $ZodTransformInternals<O, I>;
558
+ }
559
+ declare const $ZodTransform: $constructor<$ZodTransform>;
560
+ interface $ZodOptionalDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
561
+ type: "optional";
562
+ innerType: T;
563
+ }
564
+ interface $ZodOptionalInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<output<T> | undefined, input<T> | undefined> {
565
+ def: $ZodOptionalDef<T>;
566
+ optin: "optional";
567
+ optout: "optional";
568
+ isst: never;
569
+ values: T["_zod"]["values"];
570
+ pattern: T["_zod"]["pattern"];
571
+ }
572
+ interface $ZodOptional<T extends SomeType = $ZodType> extends $ZodType {
573
+ _zod: $ZodOptionalInternals<T>;
574
+ }
575
+ declare const $ZodOptional: $constructor<$ZodOptional>;
576
+ interface $ZodNullableDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
577
+ type: "nullable";
578
+ innerType: T;
579
+ }
580
+ interface $ZodNullableInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<output<T> | null, input<T> | null> {
581
+ def: $ZodNullableDef<T>;
582
+ optin: T["_zod"]["optin"];
583
+ optout: T["_zod"]["optout"];
584
+ isst: never;
585
+ values: T["_zod"]["values"];
586
+ pattern: T["_zod"]["pattern"];
587
+ }
588
+ interface $ZodNullable<T extends SomeType = $ZodType> extends $ZodType {
589
+ _zod: $ZodNullableInternals<T>;
590
+ }
591
+ declare const $ZodNullable: $constructor<$ZodNullable>;
592
+ interface $ZodDefaultDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
593
+ type: "default";
594
+ innerType: T;
595
+ /** The default value. May be a getter. */
596
+ defaultValue: NoUndefined<output<T>>;
597
+ }
598
+ interface $ZodDefaultInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<NoUndefined<output<T>>, input<T> | undefined> {
599
+ def: $ZodDefaultDef<T>;
600
+ optin: "optional";
601
+ isst: never;
602
+ values: T["_zod"]["values"];
603
+ }
604
+ interface $ZodDefault<T extends SomeType = $ZodType> extends $ZodType {
605
+ _zod: $ZodDefaultInternals<T>;
606
+ }
607
+ declare const $ZodDefault: $constructor<$ZodDefault>;
608
+ interface $ZodPrefaultDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
609
+ type: "prefault";
610
+ innerType: T;
611
+ /** The default value. May be a getter. */
612
+ defaultValue: input<T>;
613
+ }
614
+ interface $ZodPrefaultInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<NoUndefined<output<T>>, input<T> | undefined> {
615
+ def: $ZodPrefaultDef<T>;
616
+ optin: "optional";
617
+ isst: never;
618
+ values: T["_zod"]["values"];
619
+ }
620
+ interface $ZodPrefault<T extends SomeType = $ZodType> extends $ZodType {
621
+ _zod: $ZodPrefaultInternals<T>;
622
+ }
623
+ declare const $ZodPrefault: $constructor<$ZodPrefault>;
624
+ interface $ZodNonOptionalDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
625
+ type: "nonoptional";
626
+ innerType: T;
627
+ }
628
+ interface $ZodNonOptionalInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<NoUndefined<output<T>>, NoUndefined<input<T>>> {
629
+ def: $ZodNonOptionalDef<T>;
630
+ isst: $ZodIssueInvalidType;
631
+ values: T["_zod"]["values"];
632
+ }
633
+ interface $ZodNonOptional<T extends SomeType = $ZodType> extends $ZodType {
634
+ _zod: $ZodNonOptionalInternals<T>;
635
+ }
636
+ declare const $ZodNonOptional: $constructor<$ZodNonOptional>;
637
+ interface $ZodCatchCtx extends ParsePayload {
638
+ /** @deprecated Use `ctx.issues` */
639
+ error: {
640
+ issues: $ZodIssue[];
641
+ };
642
+ /** @deprecated Use `ctx.value` */
643
+ input: unknown;
644
+ }
645
+ interface $ZodCatchDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
646
+ type: "catch";
647
+ innerType: T;
648
+ catchValue: (ctx: $ZodCatchCtx) => unknown;
649
+ }
650
+ interface $ZodCatchInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<output<T>, input<T> | Whatever> {
651
+ def: $ZodCatchDef<T>;
652
+ optin: T["_zod"]["optin"];
653
+ optout: T["_zod"]["optout"];
654
+ isst: never;
655
+ values: T["_zod"]["values"];
656
+ }
657
+ interface $ZodCatch<T extends SomeType = $ZodType> extends $ZodType {
658
+ _zod: $ZodCatchInternals<T>;
659
+ }
660
+ declare const $ZodCatch: $constructor<$ZodCatch>;
661
+ interface $ZodPipeDef<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends $ZodTypeDef {
662
+ type: "pipe";
663
+ in: A;
664
+ out: B;
665
+ }
666
+ interface $ZodPipeInternals<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends $ZodTypeInternals<output<B>, input<A>> {
667
+ def: $ZodPipeDef<A, B>;
668
+ isst: never;
669
+ values: A["_zod"]["values"];
670
+ optin: A["_zod"]["optin"];
671
+ optout: B["_zod"]["optout"];
672
+ }
673
+ interface $ZodPipe<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends $ZodType {
674
+ _zod: $ZodPipeInternals<A, B>;
675
+ }
676
+ declare const $ZodPipe: $constructor<$ZodPipe>;
677
+ interface $ZodReadonlyDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
678
+ type: "readonly";
679
+ innerType: T;
680
+ }
681
+ interface $ZodReadonlyInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<MakeReadonly<output<T>>, MakeReadonly<input<T>>> {
682
+ def: $ZodReadonlyDef<T>;
683
+ optin: T["_zod"]["optin"];
684
+ optout: T["_zod"]["optout"];
685
+ isst: never;
686
+ propValues: T["_zod"]["propValues"];
687
+ }
688
+ interface $ZodReadonly<T extends SomeType = $ZodType> extends $ZodType {
689
+ _zod: $ZodReadonlyInternals<T>;
690
+ }
691
+ declare const $ZodReadonly: $constructor<$ZodReadonly>;
692
+ interface $ZodCustomDef<O = unknown> extends $ZodTypeDef, $ZodCheckDef {
693
+ type: "custom";
694
+ check: "custom";
695
+ path?: PropertyKey[] | undefined;
696
+ error?: $ZodErrorMap | undefined;
697
+ params?: Record<string, any> | undefined;
698
+ fn: (arg: O) => unknown;
699
+ }
700
+ interface $ZodCustomInternals<O = unknown, I = unknown> extends $ZodTypeInternals<O, I>, $ZodCheckInternals<O> {
701
+ def: $ZodCustomDef;
702
+ issc: $ZodIssue;
703
+ isst: never;
704
+ bag: LoosePartial<{
705
+ Class: typeof Class;
706
+ }>;
707
+ }
708
+ interface $ZodCustom<O = unknown, I = unknown> extends $ZodType {
709
+ _zod: $ZodCustomInternals<O, I>;
710
+ }
711
+ declare const $ZodCustom: $constructor<$ZodCustom>;
712
+
713
+ interface $ZodCheckDef {
714
+ check: string;
715
+ error?: $ZodErrorMap<never> | undefined;
716
+ /** If true, no later checks will be executed if this check fails. Default `false`. */
717
+ abort?: boolean | undefined;
718
+ }
719
+ interface $ZodCheckInternals<T> {
720
+ def: $ZodCheckDef;
721
+ /** The set of issues this check might throw. */
722
+ issc?: $ZodIssueBase;
723
+ check(payload: ParsePayload<T>): MaybeAsync<void>;
724
+ onattach: ((schema: $ZodType) => void)[];
725
+ when?: ((payload: ParsePayload) => boolean) | undefined;
726
+ }
727
+ interface $ZodCheck<in T = never> {
728
+ _zod: $ZodCheckInternals<T>;
729
+ }
730
+ declare const $ZodCheck: $constructor<$ZodCheck<any>>;
731
+ interface $ZodCheckMaxLengthDef extends $ZodCheckDef {
732
+ check: "max_length";
733
+ maximum: number;
734
+ }
735
+ interface $ZodCheckMaxLengthInternals<T extends HasLength = HasLength> extends $ZodCheckInternals<T> {
736
+ def: $ZodCheckMaxLengthDef;
737
+ issc: $ZodIssueTooBig<T>;
738
+ }
739
+ interface $ZodCheckMaxLength<T extends HasLength = HasLength> extends $ZodCheck<T> {
740
+ _zod: $ZodCheckMaxLengthInternals<T>;
741
+ }
742
+ declare const $ZodCheckMaxLength: $constructor<$ZodCheckMaxLength>;
743
+ interface $ZodCheckMinLengthDef extends $ZodCheckDef {
744
+ check: "min_length";
745
+ minimum: number;
746
+ }
747
+ interface $ZodCheckMinLengthInternals<T extends HasLength = HasLength> extends $ZodCheckInternals<T> {
748
+ def: $ZodCheckMinLengthDef;
749
+ issc: $ZodIssueTooSmall<T>;
750
+ }
751
+ interface $ZodCheckMinLength<T extends HasLength = HasLength> extends $ZodCheck<T> {
752
+ _zod: $ZodCheckMinLengthInternals<T>;
753
+ }
754
+ declare const $ZodCheckMinLength: $constructor<$ZodCheckMinLength>;
755
+ interface $ZodCheckLengthEqualsDef extends $ZodCheckDef {
756
+ check: "length_equals";
757
+ length: number;
758
+ }
759
+ interface $ZodCheckLengthEqualsInternals<T extends HasLength = HasLength> extends $ZodCheckInternals<T> {
760
+ def: $ZodCheckLengthEqualsDef;
761
+ issc: $ZodIssueTooBig<T> | $ZodIssueTooSmall<T>;
762
+ }
763
+ interface $ZodCheckLengthEquals<T extends HasLength = HasLength> extends $ZodCheck<T> {
764
+ _zod: $ZodCheckLengthEqualsInternals<T>;
765
+ }
766
+ declare const $ZodCheckLengthEquals: $constructor<$ZodCheckLengthEquals>;
767
+ type $ZodStringFormats = "email" | "url" | "emoji" | "uuid" | "guid" | "nanoid" | "cuid" | "cuid2" | "ulid" | "xid" | "ksuid" | "datetime" | "date" | "time" | "duration" | "ipv4" | "ipv6" | "cidrv4" | "cidrv6" | "base64" | "base64url" | "json_string" | "e164" | "lowercase" | "uppercase" | "regex" | "jwt" | "starts_with" | "ends_with" | "includes";
768
+ interface $ZodCheckStringFormatDef<Format extends $ZodStringFormats = $ZodStringFormats> extends $ZodCheckDef {
769
+ check: "string_format";
770
+ format: Format;
771
+ pattern?: RegExp | undefined;
772
+ }
773
+ interface $ZodCheckStringFormatInternals extends $ZodCheckInternals<string> {
774
+ def: $ZodCheckStringFormatDef;
775
+ issc: $ZodIssueInvalidStringFormat;
776
+ }
777
+ interface $ZodCheckRegexDef extends $ZodCheckStringFormatDef {
778
+ format: "regex";
779
+ pattern: RegExp;
780
+ }
781
+ interface $ZodCheckRegexInternals extends $ZodCheckInternals<string> {
782
+ def: $ZodCheckRegexDef;
783
+ issc: $ZodIssueInvalidStringFormat;
784
+ }
785
+ interface $ZodCheckRegex extends $ZodCheck<string> {
786
+ _zod: $ZodCheckRegexInternals;
787
+ }
788
+ declare const $ZodCheckRegex: $constructor<$ZodCheckRegex>;
789
+ interface $ZodCheckLowerCaseDef extends $ZodCheckStringFormatDef<"lowercase"> {
790
+ }
791
+ interface $ZodCheckLowerCaseInternals extends $ZodCheckInternals<string> {
792
+ def: $ZodCheckLowerCaseDef;
793
+ issc: $ZodIssueInvalidStringFormat;
794
+ }
795
+ interface $ZodCheckLowerCase extends $ZodCheck<string> {
796
+ _zod: $ZodCheckLowerCaseInternals;
797
+ }
798
+ declare const $ZodCheckLowerCase: $constructor<$ZodCheckLowerCase>;
799
+ interface $ZodCheckUpperCaseDef extends $ZodCheckStringFormatDef<"uppercase"> {
800
+ }
801
+ interface $ZodCheckUpperCaseInternals extends $ZodCheckInternals<string> {
802
+ def: $ZodCheckUpperCaseDef;
803
+ issc: $ZodIssueInvalidStringFormat;
804
+ }
805
+ interface $ZodCheckUpperCase extends $ZodCheck<string> {
806
+ _zod: $ZodCheckUpperCaseInternals;
807
+ }
808
+ declare const $ZodCheckUpperCase: $constructor<$ZodCheckUpperCase>;
809
+ interface $ZodCheckIncludesDef extends $ZodCheckStringFormatDef<"includes"> {
810
+ includes: string;
811
+ position?: number | undefined;
812
+ }
813
+ interface $ZodCheckIncludesInternals extends $ZodCheckInternals<string> {
814
+ def: $ZodCheckIncludesDef;
815
+ issc: $ZodIssueInvalidStringFormat;
816
+ }
817
+ interface $ZodCheckIncludes extends $ZodCheck<string> {
818
+ _zod: $ZodCheckIncludesInternals;
819
+ }
820
+ declare const $ZodCheckIncludes: $constructor<$ZodCheckIncludes>;
821
+ interface $ZodCheckStartsWithDef extends $ZodCheckStringFormatDef<"starts_with"> {
822
+ prefix: string;
823
+ }
824
+ interface $ZodCheckStartsWithInternals extends $ZodCheckInternals<string> {
825
+ def: $ZodCheckStartsWithDef;
826
+ issc: $ZodIssueInvalidStringFormat;
827
+ }
828
+ interface $ZodCheckStartsWith extends $ZodCheck<string> {
829
+ _zod: $ZodCheckStartsWithInternals;
830
+ }
831
+ declare const $ZodCheckStartsWith: $constructor<$ZodCheckStartsWith>;
832
+ interface $ZodCheckEndsWithDef extends $ZodCheckStringFormatDef<"ends_with"> {
833
+ suffix: string;
834
+ }
835
+ interface $ZodCheckEndsWithInternals extends $ZodCheckInternals<string> {
836
+ def: $ZodCheckEndsWithDef;
837
+ issc: $ZodIssueInvalidStringFormat;
838
+ }
839
+ interface $ZodCheckEndsWith extends $ZodCheckInternals<string> {
840
+ _zod: $ZodCheckEndsWithInternals;
841
+ }
842
+ declare const $ZodCheckEndsWith: $constructor<$ZodCheckEndsWith>;
843
+
844
+ interface $ZodIssueBase {
845
+ readonly code?: string;
846
+ readonly input?: unknown;
847
+ readonly path: PropertyKey[];
848
+ readonly message: string;
849
+ }
850
+ interface $ZodIssueInvalidType<Input = unknown> extends $ZodIssueBase {
851
+ readonly code: "invalid_type";
852
+ readonly expected: $ZodType["_zod"]["def"]["type"];
853
+ readonly input: Input;
854
+ }
855
+ interface $ZodIssueTooBig<Input = unknown> extends $ZodIssueBase {
856
+ readonly code: "too_big";
857
+ readonly origin: "number" | "int" | "bigint" | "date" | "string" | "array" | "set" | "file" | (string & {});
858
+ readonly maximum: number | bigint;
859
+ readonly inclusive?: boolean;
860
+ readonly input: Input;
861
+ }
862
+ interface $ZodIssueTooSmall<Input = unknown> extends $ZodIssueBase {
863
+ readonly code: "too_small";
864
+ readonly origin: "number" | "int" | "bigint" | "date" | "string" | "array" | "set" | "file" | (string & {});
865
+ readonly minimum: number | bigint;
866
+ readonly inclusive?: boolean;
867
+ readonly input: Input;
868
+ }
869
+ interface $ZodIssueInvalidStringFormat extends $ZodIssueBase {
870
+ readonly code: "invalid_format";
871
+ readonly format: $ZodStringFormats | (string & {});
872
+ readonly pattern?: string;
873
+ readonly input: string;
874
+ }
875
+ interface $ZodIssueNotMultipleOf<Input extends number | bigint = number | bigint> extends $ZodIssueBase {
876
+ readonly code: "not_multiple_of";
877
+ readonly divisor: number;
878
+ readonly input: Input;
879
+ }
880
+ interface $ZodIssueUnrecognizedKeys extends $ZodIssueBase {
881
+ readonly code: "unrecognized_keys";
882
+ readonly keys: string[];
883
+ readonly input: Record<string, unknown>;
884
+ }
885
+ interface $ZodIssueInvalidUnion extends $ZodIssueBase {
886
+ readonly code: "invalid_union";
887
+ readonly errors: $ZodIssue[][];
888
+ readonly input: unknown;
889
+ }
890
+ interface $ZodIssueInvalidKey<Input = unknown> extends $ZodIssueBase {
891
+ readonly code: "invalid_key";
892
+ readonly origin: "map" | "record";
893
+ readonly issues: $ZodIssue[];
894
+ readonly input: Input;
895
+ }
896
+ interface $ZodIssueInvalidElement<Input = unknown> extends $ZodIssueBase {
897
+ readonly code: "invalid_element";
898
+ readonly origin: "map" | "set";
899
+ readonly key: unknown;
900
+ readonly issues: $ZodIssue[];
901
+ readonly input: Input;
902
+ }
903
+ interface $ZodIssueInvalidValue<Input = unknown> extends $ZodIssueBase {
904
+ readonly code: "invalid_value";
905
+ readonly values: Primitive[];
906
+ readonly input: Input;
907
+ }
908
+ interface $ZodIssueCustom extends $ZodIssueBase {
909
+ readonly code: "custom";
910
+ readonly params?: Record<string, any> | undefined;
911
+ readonly input: unknown;
912
+ }
913
+ type $ZodIssue = $ZodIssueInvalidType | $ZodIssueTooBig | $ZodIssueTooSmall | $ZodIssueInvalidStringFormat | $ZodIssueNotMultipleOf | $ZodIssueUnrecognizedKeys | $ZodIssueInvalidUnion | $ZodIssueInvalidKey | $ZodIssueInvalidElement | $ZodIssueInvalidValue | $ZodIssueCustom;
914
+ type $ZodRawIssue<T extends $ZodIssueBase = $ZodIssue> = T extends any ? RawIssue<T> : never;
915
+ type RawIssue<T extends $ZodIssueBase> = Flatten<MakePartial<T, "message" | "path"> & {
916
+ /** The input data */
917
+ readonly input?: unknown;
918
+ /** The schema or check that originated this issue. */
919
+ readonly inst?: $ZodType | $ZodCheck;
920
+ /** @deprecated Internal use only. If `true`, Zod will continue executing validation despite this issue. */
921
+ readonly continue?: boolean | undefined;
922
+ } & Record<string, any>>;
923
+ interface $ZodErrorMap<T extends $ZodIssueBase = $ZodIssue> {
924
+ (issue: $ZodRawIssue<T>): {
925
+ message: string;
926
+ } | string | undefined | null;
927
+ }
928
+ interface $ZodError<T = unknown> extends Error {
929
+ type: T;
930
+ issues: $ZodIssue[];
931
+ _zod: {
932
+ output: T;
933
+ def: $ZodIssue[];
934
+ };
935
+ stack?: string;
936
+ name: string;
937
+ }
938
+ declare const $ZodError: $constructor<$ZodError>;
939
+ type $ZodFlattenedError<T, U = string> = _FlattenedError<T, U>;
940
+ type _FlattenedError<T, U = string> = {
941
+ formErrors: U[];
942
+ fieldErrors: {
943
+ [P in keyof T]?: U[];
944
+ };
945
+ };
946
+ type _ZodFormattedError<T, U = string> = T extends [any, ...any[]] ? {
947
+ [K in keyof T]?: $ZodFormattedError<T[K], U>;
948
+ } : T extends any[] ? {
949
+ [k: number]: $ZodFormattedError<T[number], U>;
950
+ } : T extends object ? Flatten<{
951
+ [K in keyof T]?: $ZodFormattedError<T[K], U>;
952
+ }> : any;
953
+ type $ZodFormattedError<T, U = string> = {
954
+ _errors: U[];
955
+ } & Flatten<_ZodFormattedError<T, U>>;
956
+
957
+ type ZodTrait = {
958
+ _zod: {
959
+ def: any;
960
+ [k: string]: any;
961
+ };
962
+ };
963
+ interface $constructor<T extends ZodTrait, D = T["_zod"]["def"]> {
964
+ new (def: D): T;
965
+ init(inst: T, def: D): asserts inst is T;
966
+ }
967
+ declare function $constructor<T extends ZodTrait, D = T["_zod"]["def"]>(name: string, initializer: (inst: T, def: D) => void, params?: {
968
+ Parent?: typeof Class;
969
+ }): $constructor<T, D>;
970
+ declare const $brand: unique symbol;
971
+ type $brand<T extends string | number | symbol = string | number | symbol> = {
972
+ [$brand]: {
973
+ [k in T]: true;
974
+ };
975
+ };
976
+ type $ZodBranded<T extends SomeType, Brand extends string | number | symbol> = T & Record<"_zod", Record<"output", output<T> & $brand<Brand>>>;
977
+ type input<T> = T extends {
978
+ _zod: {
979
+ input: any;
980
+ };
981
+ } ? Required<T["_zod"]>["input"] : unknown;
982
+ type output<T> = T extends {
983
+ _zod: {
984
+ output: any;
985
+ };
986
+ } ? Required<T["_zod"]>["output"] : unknown;
987
+
988
+ declare const $output: unique symbol;
989
+ type $output = typeof $output;
990
+ declare const $input: unique symbol;
991
+ type $input = typeof $input;
992
+ type $replace<Meta, S extends $ZodType> = Meta extends $output ? output<S> : Meta extends $input ? input<S> : Meta extends (infer M)[] ? $replace<M, S>[] : Meta extends (...args: infer P) => infer R ? (...args: {
993
+ [K in keyof P]: $replace<P[K], S>;
994
+ }) => $replace<R, S> : Meta extends object ? {
995
+ [K in keyof Meta]: $replace<Meta[K], S>;
996
+ } : Meta;
997
+ type MetadataType = Record<string, unknown> | undefined;
998
+ declare class $ZodRegistry<Meta extends MetadataType = MetadataType, Schema extends $ZodType = $ZodType> {
999
+ _meta: Meta;
1000
+ _schema: Schema;
1001
+ _map: WeakMap<Schema, $replace<Meta, Schema>>;
1002
+ _idmap: Map<string, Schema>;
1003
+ add<S extends Schema>(schema: S, ..._meta: undefined extends Meta ? [$replace<Meta, S>?] : [$replace<Meta, S>]): this;
1004
+ remove(schema: Schema): this;
1005
+ get<S extends Schema>(schema: S): $replace<Meta, S> | undefined;
1006
+ has(schema: Schema): boolean;
1007
+ }
1008
+ interface JSONSchemaMeta {
1009
+ id?: string | undefined;
1010
+ title?: string | undefined;
1011
+ description?: string | undefined;
1012
+ example?: unknown | undefined;
1013
+ examples?: unknown[] | Record<string, {
1014
+ value: unknown;
1015
+ [k: string]: unknown;
1016
+ }> | undefined;
1017
+ deprecated?: boolean | undefined;
1018
+ [k: string]: unknown;
1019
+ }
1020
+ interface GlobalMeta extends JSONSchemaMeta {
1021
+ }
1022
+
1023
+ type Params<T extends $ZodType | $ZodCheck, IssueTypes extends $ZodIssueBase, OmitKeys extends keyof T["_zod"]["def"] = never> = Flatten<Partial<EmptyToNever<Omit<T["_zod"]["def"], OmitKeys> & ([IssueTypes] extends [never] ? {} : {
1024
+ error?: string | $ZodErrorMap<IssueTypes> | undefined;
1025
+ /** @deprecated This parameter is deprecated. Use `error` instead. */
1026
+ message?: string | undefined;
1027
+ })>>>;
1028
+ type TypeParams<T extends $ZodType = $ZodType & {
1029
+ _isst: never;
1030
+ }, AlsoOmit extends Exclude<keyof T["_zod"]["def"], "type" | "checks" | "error"> = never> = Params<T, NonNullable<T["_zod"]["isst"]>, "type" | "checks" | "error" | AlsoOmit>;
1031
+ type CheckParams<T extends $ZodCheck = $ZodCheck, // & { _issc: never },
1032
+ AlsoOmit extends Exclude<keyof T["_zod"]["def"], "check" | "error"> = never> = Params<T, NonNullable<T["_zod"]["issc"]>, "check" | "error" | AlsoOmit>;
1033
+ type CheckStringFormatParams<T extends $ZodStringFormat = $ZodStringFormat, AlsoOmit extends Exclude<keyof T["_zod"]["def"], "type" | "coerce" | "checks" | "error" | "check" | "format"> = never> = Params<T, NonNullable<T["_zod"]["issc"]>, "type" | "coerce" | "checks" | "error" | "check" | "format" | AlsoOmit>;
1034
+ type CheckTypeParams<T extends $ZodType & $ZodCheck = $ZodType & $ZodCheck, AlsoOmit extends Exclude<keyof T["_zod"]["def"], "type" | "checks" | "error" | "check"> = never> = Params<T, NonNullable<T["_zod"]["isst"] | T["_zod"]["issc"]>, "type" | "checks" | "error" | "check" | AlsoOmit>;
1035
+ type $ZodCheckEmailParams = CheckStringFormatParams<$ZodEmail>;
1036
+ type $ZodCheckGUIDParams = CheckStringFormatParams<$ZodGUID, "pattern">;
1037
+ type $ZodCheckUUIDParams = CheckStringFormatParams<$ZodUUID, "pattern">;
1038
+ type $ZodCheckURLParams = CheckStringFormatParams<$ZodURL>;
1039
+ type $ZodCheckEmojiParams = CheckStringFormatParams<$ZodEmoji>;
1040
+ type $ZodCheckNanoIDParams = CheckStringFormatParams<$ZodNanoID>;
1041
+ type $ZodCheckCUIDParams = CheckStringFormatParams<$ZodCUID>;
1042
+ type $ZodCheckCUID2Params = CheckStringFormatParams<$ZodCUID2>;
1043
+ type $ZodCheckULIDParams = CheckStringFormatParams<$ZodULID>;
1044
+ type $ZodCheckXIDParams = CheckStringFormatParams<$ZodXID>;
1045
+ type $ZodCheckKSUIDParams = CheckStringFormatParams<$ZodKSUID>;
1046
+ type $ZodCheckIPv4Params = CheckStringFormatParams<$ZodIPv4, "pattern">;
1047
+ type $ZodCheckIPv6Params = CheckStringFormatParams<$ZodIPv6, "pattern">;
1048
+ type $ZodCheckCIDRv4Params = CheckStringFormatParams<$ZodCIDRv4, "pattern">;
1049
+ type $ZodCheckCIDRv6Params = CheckStringFormatParams<$ZodCIDRv6, "pattern">;
1050
+ type $ZodCheckBase64Params = CheckStringFormatParams<$ZodBase64, "pattern">;
1051
+ type $ZodCheckBase64URLParams = CheckStringFormatParams<$ZodBase64URL, "pattern">;
1052
+ type $ZodCheckE164Params = CheckStringFormatParams<$ZodE164>;
1053
+ type $ZodCheckJWTParams = CheckStringFormatParams<$ZodJWT, "pattern">;
1054
+ type $ZodCheckISODateTimeParams = CheckStringFormatParams<$ZodISODateTime, "pattern">;
1055
+ type $ZodCheckISODateParams = CheckStringFormatParams<$ZodISODate, "pattern">;
1056
+ type $ZodCheckISOTimeParams = CheckStringFormatParams<$ZodISOTime, "pattern">;
1057
+ type $ZodCheckISODurationParams = CheckStringFormatParams<$ZodISODuration>;
1058
+ type $ZodCheckMaxLengthParams = CheckParams<$ZodCheckMaxLength, "maximum">;
1059
+ type $ZodCheckMinLengthParams = CheckParams<$ZodCheckMinLength, "minimum">;
1060
+ type $ZodCheckLengthEqualsParams = CheckParams<$ZodCheckLengthEquals, "length">;
1061
+ type $ZodCheckRegexParams = CheckParams<$ZodCheckRegex, "format" | "pattern">;
1062
+ type $ZodCheckLowerCaseParams = CheckParams<$ZodCheckLowerCase, "format">;
1063
+ type $ZodCheckUpperCaseParams = CheckParams<$ZodCheckUpperCase, "format">;
1064
+ type $ZodCheckIncludesParams = CheckParams<$ZodCheckIncludes, "includes" | "format" | "pattern">;
1065
+ type $ZodCheckStartsWithParams = CheckParams<$ZodCheckStartsWith, "prefix" | "format" | "pattern">;
1066
+ type $ZodCheckEndsWithParams = CheckParams<$ZodCheckEndsWith, "suffix" | "format" | "pattern">;
1067
+ type $ZodEnumParams = TypeParams<$ZodEnum, "entries">;
1068
+ type $ZodNonOptionalParams = TypeParams<$ZodNonOptional, "innerType">;
1069
+ type $ZodCustomParams = CheckTypeParams<$ZodCustom, "fn">;
1070
+
1071
+ /** An Error-like class used to store Zod validation issues. */
1072
+ interface ZodError<T = unknown> extends $ZodError<T> {
1073
+ /** @deprecated Use the `z.treeifyError(err)` function instead. */
1074
+ format(): $ZodFormattedError<T>;
1075
+ format<U>(mapper: (issue: $ZodIssue) => U): $ZodFormattedError<T, U>;
1076
+ /** @deprecated Use the `z.treeifyError(err)` function instead. */
1077
+ flatten(): $ZodFlattenedError<T>;
1078
+ flatten<U>(mapper: (issue: $ZodIssue) => U): $ZodFlattenedError<T, U>;
1079
+ /** @deprecated Push directly to `.issues` instead. */
1080
+ addIssue(issue: $ZodIssue): void;
1081
+ /** @deprecated Push directly to `.issues` instead. */
1082
+ addIssues(issues: $ZodIssue[]): void;
1083
+ /** @deprecated Check `err.issues.length === 0` instead. */
1084
+ isEmpty: boolean;
1085
+ }
1086
+ declare const ZodError: $constructor<ZodError>;
1087
+
1088
+ type ZodSafeParseResult<T> = ZodSafeParseSuccess<T> | ZodSafeParseError<T>;
1089
+ type ZodSafeParseSuccess<T> = {
1090
+ success: true;
1091
+ data: T;
1092
+ error?: never;
1093
+ };
1094
+ type ZodSafeParseError<T> = {
1095
+ success: false;
1096
+ data?: never;
1097
+ error: ZodError<T>;
1098
+ };
1099
+
1100
+ interface RefinementCtx<T = unknown> extends ParsePayload<T> {
1101
+ addIssue(arg: string | $ZodRawIssue | Partial<$ZodIssueCustom>): void;
1102
+ }
1103
+ interface _ZodType<out Internals extends $ZodTypeInternals = $ZodTypeInternals> extends ZodType<any, any, Internals> {
1104
+ }
1105
+ interface ZodType<out Output = unknown, out Input = unknown, out Internals extends $ZodTypeInternals<Output, Input> = $ZodTypeInternals<Output, Input>> extends $ZodType<Output, Input, Internals> {
1106
+ def: Internals["def"];
1107
+ type: Internals["def"]["type"];
1108
+ /** @deprecated Use `.def` instead. */
1109
+ _def: Internals["def"];
1110
+ /** @deprecated Use `z.output<typeof schema>` instead. */
1111
+ _output: Internals["output"];
1112
+ /** @deprecated Use `z.input<typeof schema>` instead. */
1113
+ _input: Internals["input"];
1114
+ check(...checks: (CheckFn<output<this>> | $ZodCheck<output<this>>)[]): this;
1115
+ clone(def?: Internals["def"], params?: {
1116
+ parent: boolean;
1117
+ }): this;
1118
+ register<R extends $ZodRegistry>(registry: R, ...meta: this extends R["_schema"] ? undefined extends R["_meta"] ? [$replace<R["_meta"], this>?] : [$replace<R["_meta"], this>] : ["Incompatible schema"]): this;
1119
+ brand<T extends PropertyKey = PropertyKey>(value?: T): PropertyKey extends T ? this : $ZodBranded<this, T>;
1120
+ parse(data: unknown, params?: ParseContext<$ZodIssue>): output<this>;
1121
+ safeParse(data: unknown, params?: ParseContext<$ZodIssue>): ZodSafeParseResult<output<this>>;
1122
+ parseAsync(data: unknown, params?: ParseContext<$ZodIssue>): Promise<output<this>>;
1123
+ safeParseAsync(data: unknown, params?: ParseContext<$ZodIssue>): Promise<ZodSafeParseResult<output<this>>>;
1124
+ spa: (data: unknown, params?: ParseContext<$ZodIssue>) => Promise<ZodSafeParseResult<output<this>>>;
1125
+ refine(check: (arg: output<this>) => unknown | Promise<unknown>, params?: string | $ZodCustomParams): this;
1126
+ /** @deprecated Use `.check()` instead. */
1127
+ superRefine(refinement: (arg: output<this>, ctx: RefinementCtx<output<this>>) => void | Promise<void>): this;
1128
+ overwrite(fn: (x: output<this>) => output<this>): this;
1129
+ optional(): ZodOptional<this>;
1130
+ nonoptional(params?: string | $ZodNonOptionalParams): ZodNonOptional<this>;
1131
+ nullable(): ZodNullable<this>;
1132
+ nullish(): ZodOptional<ZodNullable<this>>;
1133
+ default(def: output<this>): ZodDefault<this>;
1134
+ default(def: () => NoUndefined<output<this>>): ZodDefault<this>;
1135
+ prefault(def: () => input<this>): ZodPrefault<this>;
1136
+ prefault(def: input<this>): ZodPrefault<this>;
1137
+ array(): ZodArray<this>;
1138
+ or<T extends SomeType>(option: T): ZodUnion<[this, T]>;
1139
+ and<T extends SomeType>(incoming: T): ZodIntersection<this, T>;
1140
+ transform<NewOut>(transform: (arg: output<this>, ctx: RefinementCtx<output<this>>) => NewOut | Promise<NewOut>): ZodPipe<this, ZodTransform<Awaited<NewOut>, output<this>>>;
1141
+ catch(def: output<this>): ZodCatch<this>;
1142
+ catch(def: (ctx: $ZodCatchCtx) => output<this>): ZodCatch<this>;
1143
+ pipe<T extends $ZodType<any, output<this>>>(target: T | $ZodType<any, output<this>>): ZodPipe<this, T>;
1144
+ readonly(): ZodReadonly<this>;
1145
+ /** Returns a new instance that has been registered in `z.globalRegistry` with the specified description */
1146
+ describe(description: string): this;
1147
+ description?: string;
1148
+ /** Returns the metadata associated with this instance in `z.globalRegistry` */
1149
+ meta(): $replace<GlobalMeta, this> | undefined;
1150
+ /** Returns a new instance that has been registered in `z.globalRegistry` with the specified metadata */
1151
+ meta(data: $replace<GlobalMeta, this>): this;
1152
+ /** @deprecated Try safe-parsing `undefined` (this is what `isOptional` does internally):
1153
+ *
1154
+ * ```ts
1155
+ * const schema = z.string().optional();
1156
+ * const isOptional = schema.safeParse(undefined).success; // true
1157
+ * ```
1158
+ */
1159
+ isOptional(): boolean;
1160
+ /**
1161
+ * @deprecated Try safe-parsing `null` (this is what `isNullable` does internally):
1162
+ *
1163
+ * ```ts
1164
+ * const schema = z.string().nullable();
1165
+ * const isNullable = schema.safeParse(null).success; // true
1166
+ * ```
1167
+ */
1168
+ isNullable(): boolean;
1169
+ }
1170
+ declare const ZodType: $constructor<ZodType>;
1171
+ interface _ZodString<T extends $ZodStringInternals<unknown> = $ZodStringInternals<unknown>> extends _ZodType<T> {
1172
+ format: string | null;
1173
+ minLength: number | null;
1174
+ maxLength: number | null;
1175
+ regex(regex: RegExp, params?: string | $ZodCheckRegexParams): this;
1176
+ includes(value: string, params?: $ZodCheckIncludesParams): this;
1177
+ startsWith(value: string, params?: string | $ZodCheckStartsWithParams): this;
1178
+ endsWith(value: string, params?: string | $ZodCheckEndsWithParams): this;
1179
+ min(minLength: number, params?: string | $ZodCheckMinLengthParams): this;
1180
+ max(maxLength: number, params?: string | $ZodCheckMaxLengthParams): this;
1181
+ length(len: number, params?: string | $ZodCheckLengthEqualsParams): this;
1182
+ nonempty(params?: string | $ZodCheckMinLengthParams): this;
1183
+ lowercase(params?: string | $ZodCheckLowerCaseParams): this;
1184
+ uppercase(params?: string | $ZodCheckUpperCaseParams): this;
1185
+ trim(): this;
1186
+ normalize(form?: "NFC" | "NFD" | "NFKC" | "NFKD" | (string & {})): this;
1187
+ toLowerCase(): this;
1188
+ toUpperCase(): this;
1189
+ }
1190
+ /** @internal */
1191
+ declare const _ZodString: $constructor<_ZodString>;
1192
+ interface ZodString extends _ZodString<$ZodStringInternals<string>> {
1193
+ /** @deprecated Use `z.email()` instead. */
1194
+ email(params?: string | $ZodCheckEmailParams): this;
1195
+ /** @deprecated Use `z.url()` instead. */
1196
+ url(params?: string | $ZodCheckURLParams): this;
1197
+ /** @deprecated Use `z.jwt()` instead. */
1198
+ jwt(params?: string | $ZodCheckJWTParams): this;
1199
+ /** @deprecated Use `z.emoji()` instead. */
1200
+ emoji(params?: string | $ZodCheckEmojiParams): this;
1201
+ /** @deprecated Use `z.guid()` instead. */
1202
+ guid(params?: string | $ZodCheckGUIDParams): this;
1203
+ /** @deprecated Use `z.uuid()` instead. */
1204
+ uuid(params?: string | $ZodCheckUUIDParams): this;
1205
+ /** @deprecated Use `z.uuid()` instead. */
1206
+ uuidv4(params?: string | $ZodCheckUUIDParams): this;
1207
+ /** @deprecated Use `z.uuid()` instead. */
1208
+ uuidv6(params?: string | $ZodCheckUUIDParams): this;
1209
+ /** @deprecated Use `z.uuid()` instead. */
1210
+ uuidv7(params?: string | $ZodCheckUUIDParams): this;
1211
+ /** @deprecated Use `z.nanoid()` instead. */
1212
+ nanoid(params?: string | $ZodCheckNanoIDParams): this;
1213
+ /** @deprecated Use `z.guid()` instead. */
1214
+ guid(params?: string | $ZodCheckGUIDParams): this;
1215
+ /** @deprecated Use `z.cuid()` instead. */
1216
+ cuid(params?: string | $ZodCheckCUIDParams): this;
1217
+ /** @deprecated Use `z.cuid2()` instead. */
1218
+ cuid2(params?: string | $ZodCheckCUID2Params): this;
1219
+ /** @deprecated Use `z.ulid()` instead. */
1220
+ ulid(params?: string | $ZodCheckULIDParams): this;
1221
+ /** @deprecated Use `z.base64()` instead. */
1222
+ base64(params?: string | $ZodCheckBase64Params): this;
1223
+ /** @deprecated Use `z.base64url()` instead. */
1224
+ base64url(params?: string | $ZodCheckBase64URLParams): this;
1225
+ /** @deprecated Use `z.xid()` instead. */
1226
+ xid(params?: string | $ZodCheckXIDParams): this;
1227
+ /** @deprecated Use `z.ksuid()` instead. */
1228
+ ksuid(params?: string | $ZodCheckKSUIDParams): this;
1229
+ /** @deprecated Use `z.ipv4()` instead. */
1230
+ ipv4(params?: string | $ZodCheckIPv4Params): this;
1231
+ /** @deprecated Use `z.ipv6()` instead. */
1232
+ ipv6(params?: string | $ZodCheckIPv6Params): this;
1233
+ /** @deprecated Use `z.cidrv4()` instead. */
1234
+ cidrv4(params?: string | $ZodCheckCIDRv4Params): this;
1235
+ /** @deprecated Use `z.cidrv6()` instead. */
1236
+ cidrv6(params?: string | $ZodCheckCIDRv6Params): this;
1237
+ /** @deprecated Use `z.e164()` instead. */
1238
+ e164(params?: string | $ZodCheckE164Params): this;
1239
+ /** @deprecated Use `z.iso.datetime()` instead. */
1240
+ datetime(params?: string | $ZodCheckISODateTimeParams): this;
1241
+ /** @deprecated Use `z.iso.date()` instead. */
1242
+ date(params?: string | $ZodCheckISODateParams): this;
1243
+ /** @deprecated Use `z.iso.time()` instead. */
1244
+ time(params?: string | $ZodCheckISOTimeParams): this;
1245
+ /** @deprecated Use `z.iso.duration()` instead. */
1246
+ duration(params?: string | $ZodCheckISODurationParams): this;
1247
+ }
1248
+ declare const ZodString: $constructor<ZodString>;
1249
+ interface ZodStringFormat<Format extends $ZodStringFormats = $ZodStringFormats> extends _ZodString<$ZodStringFormatInternals<Format>> {
1250
+ }
1251
+ declare const ZodStringFormat: $constructor<ZodStringFormat>;
1252
+ interface ZodArray<T extends SomeType = $ZodType> extends _ZodType<$ZodArrayInternals<T>>, $ZodArray<T> {
1253
+ element: T;
1254
+ min(minLength: number, params?: string | $ZodCheckMinLengthParams): this;
1255
+ nonempty(params?: string | $ZodCheckMinLengthParams): this;
1256
+ max(maxLength: number, params?: string | $ZodCheckMaxLengthParams): this;
1257
+ length(len: number, params?: string | $ZodCheckLengthEqualsParams): this;
1258
+ unwrap(): T;
1259
+ }
1260
+ declare const ZodArray: $constructor<ZodArray>;
1261
+ interface ZodObject<
1262
+ /** @ts-ignore Cast variance */
1263
+ out Shape extends $ZodShape = $ZodLooseShape, out Config extends $ZodObjectConfig = $strip> extends _ZodType<$ZodObjectInternals<Shape, Config>>, $ZodObject<Shape, Config> {
1264
+ shape: Shape;
1265
+ keyof(): ZodEnum<ToEnum<keyof Shape & string>>;
1266
+ /** Define a schema to validate all unrecognized keys. This overrides the existing strict/loose behavior. */
1267
+ catchall<T extends SomeType>(schema: T): ZodObject<Shape, $catchall<T>>;
1268
+ /** @deprecated Use `z.looseObject()` or `.loose()` instead. */
1269
+ passthrough(): ZodObject<Shape, $loose>;
1270
+ /** Consider `z.looseObject(A.shape)` instead */
1271
+ loose(): ZodObject<Shape, $loose>;
1272
+ /** Consider `z.strictObject(A.shape)` instead */
1273
+ strict(): ZodObject<Shape, $strict>;
1274
+ /** This is the default behavior. This method call is likely unnecessary. */
1275
+ strip(): ZodObject<Shape, $strip>;
1276
+ extend<U extends $ZodLooseShape & Partial<Record<keyof Shape, SomeType>>>(shape: U): ZodObject<Extend<Shape, U>, Config>;
1277
+ /**
1278
+ * @deprecated Use spread syntax and the `.shape` property to combine two object schemas:
1279
+ *
1280
+ * ```ts
1281
+ * const A = z.object({ a: z.string() });
1282
+ * const B = z.object({ b: z.number() });
1283
+ *
1284
+ * const C = z.object({
1285
+ * ...A.shape,
1286
+ * ...B.shape
1287
+ * });
1288
+ * ```
1289
+ */
1290
+ merge<U extends ZodObject>(other: U): ZodObject<Extend<Shape, U["shape"]>, U["_zod"]["config"]>;
1291
+ pick<M extends Exactly<Mask<keyof Shape>, M>>(mask: M): ZodObject<Flatten<Pick<Shape, Extract<keyof Shape, keyof M>>>, Config>;
1292
+ omit<M extends Exactly<Mask<keyof Shape>, M>>(mask: M): ZodObject<Flatten<Omit<Shape, Extract<keyof Shape, keyof M>>>, Config>;
1293
+ partial(): ZodObject<{
1294
+ [k in keyof Shape]: ZodOptional<Shape[k]>;
1295
+ }, Config>;
1296
+ partial<M extends Exactly<Mask<keyof Shape>, M>>(mask: M): ZodObject<{
1297
+ [k in keyof Shape]: k extends keyof M ? ZodOptional<Shape[k]> : Shape[k];
1298
+ }, Config>;
1299
+ required(): ZodObject<{
1300
+ [k in keyof Shape]: ZodNonOptional<Shape[k]>;
1301
+ }, Config>;
1302
+ required<M extends Exactly<Mask<keyof Shape>, M>>(mask: M): ZodObject<{
1303
+ [k in keyof Shape]: k extends keyof M ? ZodNonOptional<Shape[k]> : Shape[k];
1304
+ }, Config>;
1305
+ }
1306
+ declare const ZodObject: $constructor<ZodObject>;
1307
+ interface ZodUnion<T extends readonly SomeType[] = readonly $ZodType[]> extends _ZodType<$ZodUnionInternals<T>>, $ZodUnion<T> {
1308
+ options: T;
1309
+ }
1310
+ declare const ZodUnion: $constructor<ZodUnion>;
1311
+ interface ZodIntersection<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends _ZodType<$ZodIntersectionInternals<A, B>>, $ZodIntersection<A, B> {
1312
+ }
1313
+ declare const ZodIntersection: $constructor<ZodIntersection>;
1314
+ interface ZodEnum<
1315
+ /** @ts-ignore Cast variance */
1316
+ out T extends EnumLike = EnumLike> extends _ZodType<$ZodEnumInternals<T>>, $ZodEnum<T> {
1317
+ enum: T;
1318
+ options: Array<T[keyof T]>;
1319
+ extract<const U extends readonly (keyof T)[]>(values: U, params?: string | $ZodEnumParams): ZodEnum<Flatten<Pick<T, U[number]>>>;
1320
+ exclude<const U extends readonly (keyof T)[]>(values: U, params?: string | $ZodEnumParams): ZodEnum<Flatten<Omit<T, U[number]>>>;
1321
+ }
1322
+ declare const ZodEnum: $constructor<ZodEnum>;
1323
+ interface ZodLiteral<T extends Literal = Literal> extends _ZodType<$ZodLiteralInternals<T>>, $ZodLiteral<T> {
1324
+ values: Set<T>;
1325
+ /** @legacy Use `.values` instead. Accessing this property will throw an error if the literal accepts multiple values. */
1326
+ value: T;
1327
+ }
1328
+ declare const ZodLiteral: $constructor<ZodLiteral>;
1329
+ interface ZodTransform<O = unknown, I = unknown> extends _ZodType<$ZodTransformInternals<O, I>>, $ZodTransform<O, I> {
1330
+ }
1331
+ declare const ZodTransform: $constructor<ZodTransform>;
1332
+ interface ZodOptional<T extends SomeType = $ZodType> extends _ZodType<$ZodOptionalInternals<T>>, $ZodOptional<T> {
1333
+ unwrap(): T;
1334
+ }
1335
+ declare const ZodOptional: $constructor<ZodOptional>;
1336
+ interface ZodNullable<T extends SomeType = $ZodType> extends _ZodType<$ZodNullableInternals<T>>, $ZodNullable<T> {
1337
+ unwrap(): T;
1338
+ }
1339
+ declare const ZodNullable: $constructor<ZodNullable>;
1340
+ interface ZodDefault<T extends SomeType = $ZodType> extends _ZodType<$ZodDefaultInternals<T>>, $ZodDefault<T> {
1341
+ unwrap(): T;
1342
+ /** @deprecated Use `.unwrap()` instead. */
1343
+ removeDefault(): T;
1344
+ }
1345
+ declare const ZodDefault: $constructor<ZodDefault>;
1346
+ interface ZodPrefault<T extends SomeType = $ZodType> extends _ZodType<$ZodPrefaultInternals<T>>, $ZodPrefault<T> {
1347
+ unwrap(): T;
1348
+ }
1349
+ declare const ZodPrefault: $constructor<ZodPrefault>;
1350
+ interface ZodNonOptional<T extends SomeType = $ZodType> extends _ZodType<$ZodNonOptionalInternals<T>>, $ZodNonOptional<T> {
1351
+ unwrap(): T;
1352
+ }
1353
+ declare const ZodNonOptional: $constructor<ZodNonOptional>;
1354
+ interface ZodCatch<T extends SomeType = $ZodType> extends _ZodType<$ZodCatchInternals<T>>, $ZodCatch<T> {
1355
+ unwrap(): T;
1356
+ /** @deprecated Use `.unwrap()` instead. */
1357
+ removeCatch(): T;
1358
+ }
1359
+ declare const ZodCatch: $constructor<ZodCatch>;
1360
+ interface ZodPipe<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends _ZodType<$ZodPipeInternals<A, B>>, $ZodPipe<A, B> {
1361
+ in: A;
1362
+ out: B;
1363
+ }
1364
+ declare const ZodPipe: $constructor<ZodPipe>;
1365
+ interface ZodReadonly<T extends SomeType = $ZodType> extends _ZodType<$ZodReadonlyInternals<T>>, $ZodReadonly<T> {
1366
+ }
1367
+ declare const ZodReadonly: $constructor<ZodReadonly>;
1368
+
1369
+ type HttpHeaderValue = ZodString | ZodStringFormat | ZodLiteral<string> | ZodEnum<Record<string, string>>;
1370
+ type HttpHeaderSchema = ZodObject<Record<string, HttpHeaderValue | ZodOptional<HttpHeaderValue> | ZodArray<HttpHeaderValue> | ZodOptional<ZodArray<HttpHeaderValue>>>>;
1371
+ type HttpParamValue = ZodString | ZodStringFormat | ZodLiteral<string> | ZodEnum<Record<string, string>>;
1372
+ type HttpParamSchema = ZodObject<Record<string, HttpParamValue | ZodOptional<HttpParamValue>>>;
1373
+ type HttpBodySchema = ZodType;
1374
+ type HttpQueryValue = ZodString | ZodStringFormat | ZodLiteral<string> | ZodEnum<Record<string, string>>;
1375
+ type HttpQuerySchema = ZodObject<Record<string, HttpQueryValue | ZodOptional<HttpQueryValue> | ZodArray<HttpQueryValue> | ZodOptional<ZodArray<HttpQueryValue>>>>;
1376
+
1377
+ declare enum HttpMethod {
1378
+ GET = "GET",
1379
+ POST = "POST",
1380
+ PUT = "PUT",
1381
+ DELETE = "DELETE",
1382
+ PATCH = "PATCH",
1383
+ OPTIONS = "OPTIONS",
1384
+ HEAD = "HEAD",
1385
+ TRACE = "TRACE",
1386
+ CONNECT = "CONNECT"
1387
+ }
1388
+
1389
+ declare enum HttpStatusCode {
1390
+ OK = 200,
1391
+ CREATED = 201,
1392
+ ACCEPTED = 202,
1393
+ NO_CONTENT = 204,
1394
+ RESET_CONTENT = 205,
1395
+ PARTIAL_CONTENT = 206,
1396
+ MULTI_STATUS = 207,
1397
+ ALREADY_REPORTED = 208,
1398
+ IM_USED = 226,
1399
+ BAD_REQUEST = 400,
1400
+ UNAUTHORIZED = 401,
1401
+ PAYMENT_REQUIRED = 402,
1402
+ FORBIDDEN = 403,
1403
+ NOT_FOUND = 404,
1404
+ METHOD_NOT_ALLOWED = 405,
1405
+ NOT_ACCEPTABLE = 406,
1406
+ PROXY_AUTHENTICATION_REQUIRED = 407,
1407
+ REQUEST_TIMEOUT = 408,
1408
+ CONFLICT = 409,
1409
+ GONE = 410,
1410
+ LENGTH_REQUIRED = 411,
1411
+ PRECONDITION_FAILED = 412,
1412
+ PAYLOAD_TOO_LARGE = 413,
1413
+ URI_TOO_LONG = 414,
1414
+ UNSUPPORTED_MEDIA_TYPE = 415,
1415
+ RANGE_NOT_SATISFIABLE = 416,
1416
+ EXPECTATION_FAILED = 417,
1417
+ IM_A_TEAPOT = 418,
1418
+ MISDIRECTED_REQUEST = 421,
1419
+ UNPROCESSABLE_ENTITY = 422,
1420
+ LOCKED = 423,
1421
+ FAILED_DEPENDENCY = 424,
1422
+ UPGRADE_REQUIRED = 426,
1423
+ PRECONDITION_REQUIRED = 428,
1424
+ TOO_MANY_REQUESTS = 429,
1425
+ REQUEST_HEADER_FIELDS_TOO_LARGE = 431,
1426
+ UNAVAILABLE_FOR_LEGAL_REASONS = 451,
1427
+ INTERNAL_SERVER_ERROR = 500,
1428
+ NOT_IMPLEMENTED = 501,
1429
+ BAD_GATEWAY = 502,
1430
+ SERVICE_UNAVAILABLE = 503,
1431
+ GATEWAY_TIMEOUT = 504,
1432
+ HTTP_VERSION_NOT_SUPPORTED = 505,
1433
+ VARIANT_ALSO_NEGOTIATES = 506,
1434
+ INSUFFICIENT_STORAGE = 507,
1435
+ LOOP_DETECTED = 508,
1436
+ NOT_EXTENDED = 510,
1437
+ NETWORK_AUTHENTICATION_REQUIRED = 511
1438
+ }
1439
+
1440
+ type IHttpRequestDefinition<THeader extends HttpHeaderSchema | undefined = HttpHeaderSchema | undefined, TParam extends HttpParamSchema | undefined = HttpParamSchema | undefined, TQuery extends HttpQuerySchema | undefined = HttpQuerySchema | undefined, TBody extends HttpBodySchema | undefined = HttpBodySchema | undefined> = {
1441
+ header?: THeader;
1442
+ param?: TParam;
1443
+ query?: TQuery;
1444
+ body?: TBody;
1445
+ };
1446
+
1447
+ type IHttpResponseDefinition<TName extends string = string, TStatusCode extends HttpStatusCode = HttpStatusCode, TDescription extends string = string, THeader extends HttpHeaderSchema | undefined = HttpHeaderSchema | undefined, TBody extends HttpBodySchema | undefined = HttpBodySchema | undefined, TIsShared extends boolean = boolean> = {
1448
+ name: TName;
1449
+ statusCode: TStatusCode;
1450
+ description: TDescription;
1451
+ header?: THeader;
1452
+ body?: TBody;
1453
+ isShared?: TIsShared;
1454
+ };
1455
+
1456
+ /**
1457
+ * Interface for HTTP operation definitions.
1458
+ *
1459
+ * Represents a complete HTTP API operation with:
1460
+ * - Unique operation identifier
1461
+ * - HTTP method and path
1462
+ * - Request definition (headers, params, query, body)
1463
+ * - Response definitions for different status codes
1464
+ *
1465
+ * @template TOperationId - The operation identifier literal type
1466
+ * @template TPath - The URL path literal type
1467
+ * @template TMethod - The HTTP method type
1468
+ * @template TSummary - The operation summary literal type
1469
+ * @template THeader - The header schema type
1470
+ * @template TParam - The path parameter schema type
1471
+ * @template TQuery - The query parameter schema type
1472
+ * @template TBody - The request body schema type
1473
+ * @template TRequest - The complete request definition type
1474
+ * @template TResponses - The array of response definitions
1475
+ */
1476
+ type IHttpOperationDefinition<TOperationId extends string = string, TPath extends string = string, TMethod extends HttpMethod = HttpMethod, TSummary extends string = string, THeader extends HttpHeaderSchema | undefined = HttpHeaderSchema | undefined, TParam extends HttpParamSchema | undefined = HttpParamSchema | undefined, TQuery extends HttpQuerySchema | undefined = HttpQuerySchema | undefined, TBody extends HttpBodySchema | undefined = HttpBodySchema | undefined, TRequest extends IHttpRequestDefinition<THeader, TParam, TQuery, TBody> = IHttpRequestDefinition<THeader, TParam, TQuery, TBody>, TResponses extends IHttpResponseDefinition[] = IHttpResponseDefinition[]> = {
1477
+ operationId: TOperationId;
1478
+ path: TPath;
1479
+ method: TMethod;
1480
+ summary: TSummary;
1481
+ request: TRequest;
1482
+ responses: TResponses;
1483
+ };
1484
+
1485
+ type GetResourcesResult = {
1486
+ entityResources: EntityResources;
1487
+ sharedResponseResources: SharedResponseResource[];
1488
+ };
1489
+ type ExtendedResponseDefinition = IHttpResponseDefinition & {
1490
+ statusCodeName: string;
1491
+ };
1492
+ type EntityName = string;
1493
+ type OperationResource = {
1494
+ sourceDir: string;
1495
+ sourceFile: string;
1496
+ sourceFileName: string;
1497
+ definition: Omit<IHttpOperationDefinition, "responses"> & {
1498
+ responses: ExtendedResponseDefinition[];
1499
+ };
1500
+ outputDir: string;
1501
+ entityName: EntityName;
1502
+ outputRequestFile: string;
1503
+ outputRequestFileName: string;
1504
+ outputResponseFile: string;
1505
+ outputResponseFileName: string;
1506
+ outputRequestValidationFile: string;
1507
+ outputRequestValidationFileName: string;
1508
+ outputResponseValidationFile: string;
1509
+ outputResponseValidationFileName: string;
1510
+ outputClientFile: string;
1511
+ outputClientFileName: string;
1512
+ };
1513
+ type EntityResources = Record<EntityName, OperationResource[]>;
1514
+ type SharedResponseResource = IHttpResponseDefinition & {
1515
+ isShared: true;
1516
+ sourceDir: string;
1517
+ sourceFile: string;
1518
+ sourceFileName: string;
1519
+ outputFile: string;
1520
+ outputFileName: string;
1521
+ outputDir: string;
1522
+ };
1523
+
1524
+ /**
1525
+ * Configuration for a TypeWeaver plugin
1526
+ */
1527
+ type PluginConfig = Record<string, unknown>;
1528
+ /**
1529
+ * Context provided to plugins during initialization and finalization
1530
+ */
1531
+ interface PluginContext {
1532
+ outputDir: string;
1533
+ inputDir: string;
1534
+ config: PluginConfig;
1535
+ }
1536
+ /**
1537
+ * Context provided to plugins during generation
1538
+ */
1539
+ interface GeneratorContext extends PluginContext {
1540
+ resources: GetResourcesResult;
1541
+ templateDir: string;
1542
+ coreDir: string;
1543
+ writeFile: (relativePath: string, content: string) => void;
1544
+ renderTemplate: (templatePath: string, data: unknown) => string;
1545
+ addGeneratedFile: (relativePath: string) => void;
1546
+ getGeneratedFiles: () => string[];
1547
+ }
1548
+ /**
1549
+ * Plugin metadata
1550
+ */
1551
+ interface PluginMetadata {
1552
+ name: string;
1553
+ }
1554
+ /**
1555
+ * TypeWeaver plugin interface
1556
+ */
1557
+ interface TypeWeaverPlugin extends PluginMetadata {
1558
+ /**
1559
+ * Initialize the plugin
1560
+ * Called before any generation happens
1561
+ */
1562
+ initialize?(context: PluginContext): Promise<void> | void;
1563
+ /**
1564
+ * Collect and transform resources
1565
+ * Allows plugins to modify the resource collection
1566
+ */
1567
+ collectResources?(resources: GetResourcesResult): Promise<GetResourcesResult> | GetResourcesResult;
1568
+ /**
1569
+ * Main generation logic
1570
+ * Called with all resources and utilities
1571
+ */
1572
+ generate?(context: GeneratorContext): Promise<void> | void;
1573
+ /**
1574
+ * Finalize the plugin
1575
+ * Called after all generation is complete
1576
+ */
1577
+ finalize?(context: PluginContext): Promise<void> | void;
1578
+ }
1579
+
1580
+ /**
1581
+ * Base class for TypeWeaver plugins
1582
+ * Provides default implementations and common utilities
1583
+ */
1584
+ declare abstract class BasePlugin implements TypeWeaverPlugin {
1585
+ abstract name: string;
1586
+ description?: string;
1587
+ author?: string;
1588
+ depends?: string[];
1589
+ protected config: PluginConfig;
1590
+ constructor(config?: PluginConfig);
1591
+ /**
1592
+ * Default implementation - override in subclasses if needed
1593
+ */
1594
+ initialize(context: PluginContext): Promise<void>;
1595
+ /**
1596
+ * Default implementation - override in subclasses if needed
1597
+ */
1598
+ collectResources(resources: GetResourcesResult): GetResourcesResult;
1599
+ /**
1600
+ * Main generation logic - must be implemented by subclasses
1601
+ */
1602
+ abstract generate(context: GeneratorContext): Promise<void> | void;
1603
+ /**
1604
+ * Default implementation - override in subclasses if needed
1605
+ */
1606
+ finalize(context: PluginContext): Promise<void>;
1607
+ /**
1608
+ * Copy lib files from plugin package to generated lib folder
1609
+ */
1610
+ protected copyLibFiles(context: GeneratorContext, libSourceDir: string, libNamespace: string): void;
1611
+ }
1612
+
1613
+ declare class ClientsPlugin extends BasePlugin {
1614
+ name: string;
1615
+ generate(context: GeneratorContext): Promise<void> | void;
1616
+ }
1617
+
1618
+ export { ClientsPlugin as default };