@umijs/utils 4.0.56 → 4.0.58

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 (56) hide show
  1. package/compiled/lodash/common/array.d.ts +0 -0
  2. package/compiled/lodash/common/collection.d.ts +0 -0
  3. package/compiled/lodash/common/common.d.ts +0 -0
  4. package/compiled/lodash/common/date.d.ts +0 -0
  5. package/compiled/lodash/common/function.d.ts +0 -0
  6. package/compiled/lodash/common/lang.d.ts +0 -0
  7. package/compiled/lodash/common/math.d.ts +0 -0
  8. package/compiled/lodash/common/number.d.ts +0 -0
  9. package/compiled/lodash/common/object.d.ts +0 -0
  10. package/compiled/lodash/common/seq.d.ts +0 -0
  11. package/compiled/lodash/common/string.d.ts +0 -0
  12. package/compiled/lodash/common/util.d.ts +0 -0
  13. package/compiled/zod/LICENSE +21 -0
  14. package/compiled/zod/index.d.ts +2 -0
  15. package/compiled/zod/index.js +1 -0
  16. package/compiled/zod/lib/ZodError.d.ts +159 -0
  17. package/compiled/zod/lib/__tests__/Mocker.d.ts +17 -0
  18. package/compiled/zod/lib/benchmarks/discriminatedUnion.d.ts +5 -0
  19. package/compiled/zod/lib/benchmarks/index.d.ts +1 -0
  20. package/compiled/zod/lib/benchmarks/object.d.ts +5 -0
  21. package/compiled/zod/lib/benchmarks/primitives.d.ts +5 -0
  22. package/compiled/zod/lib/benchmarks/realworld.d.ts +5 -0
  23. package/compiled/zod/lib/benchmarks/string.d.ts +5 -0
  24. package/compiled/zod/lib/benchmarks/union.d.ts +5 -0
  25. package/compiled/zod/lib/errors.d.ts +5 -0
  26. package/compiled/zod/lib/external.d.ts +6 -0
  27. package/compiled/zod/lib/helpers/enumUtil.d.ts +8 -0
  28. package/compiled/zod/lib/helpers/errorUtil.d.ts +9 -0
  29. package/compiled/zod/lib/helpers/parseUtil.d.ts +78 -0
  30. package/compiled/zod/lib/helpers/partialUtil.d.ts +8 -0
  31. package/compiled/zod/lib/helpers/typeAliases.d.ts +2 -0
  32. package/compiled/zod/lib/helpers/util.d.ts +47 -0
  33. package/compiled/zod/lib/index.d.ts +4 -0
  34. package/compiled/zod/lib/locales/en.d.ts +3 -0
  35. package/compiled/zod/lib/types.d.ts +975 -0
  36. package/compiled/zod/package.json +1 -0
  37. package/dist/BaseGenerator/BaseGenerator.js +4 -0
  38. package/dist/BaseGenerator/generateFile.js +1 -4
  39. package/dist/Generator/Generator.js +4 -0
  40. package/dist/getDevBanner.js +11 -22
  41. package/dist/getFileGitIno.d.ts +47 -0
  42. package/dist/getFileGitIno.js +130 -0
  43. package/dist/getGitInfo.js +1 -4
  44. package/dist/importLazy.js +2 -7
  45. package/dist/index.d.ts +5 -1
  46. package/dist/index.js +10 -2
  47. package/dist/installDeps.js +10 -16
  48. package/dist/npmClient.js +4 -0
  49. package/dist/printHelp.js +2 -7
  50. package/dist/randomColor/randomColor.js +1 -4
  51. package/dist/register.js +2 -0
  52. package/dist/zod/isZodSchema.d.ts +2 -0
  53. package/dist/zod/isZodSchema.js +31 -0
  54. package/dist/zod/zod2string.d.ts +2 -0
  55. package/dist/zod/zod2string.js +49 -0
  56. package/package.json +12 -10
@@ -0,0 +1,975 @@
1
+ import { enumUtil } from "./helpers/enumUtil";
2
+ import { errorUtil } from "./helpers/errorUtil";
3
+ import { AsyncParseReturnType, ParseContext, ParseInput, ParseParams, ParseReturnType, ParseStatus, SyncParseReturnType } from "./helpers/parseUtil";
4
+ import { partialUtil } from "./helpers/partialUtil";
5
+ import { Primitive } from "./helpers/typeAliases";
6
+ import { util } from "./helpers/util";
7
+ import { IssueData, StringValidation, ZodCustomIssue, ZodError, ZodErrorMap } from "./ZodError";
8
+ export declare type RefinementCtx = {
9
+ addIssue: (arg: IssueData) => void;
10
+ path: (string | number)[];
11
+ };
12
+ export declare type ZodRawShape = {
13
+ [k: string]: ZodTypeAny;
14
+ };
15
+ export declare type ZodTypeAny = ZodType<any, any, any>;
16
+ export declare type TypeOf<T extends ZodType<any, any, any>> = T["_output"];
17
+ export declare type input<T extends ZodType<any, any, any>> = T["_input"];
18
+ export declare type output<T extends ZodType<any, any, any>> = T["_output"];
19
+ export type { TypeOf as infer };
20
+ export declare type CustomErrorParams = Partial<util.Omit<ZodCustomIssue, "code">>;
21
+ export interface ZodTypeDef {
22
+ errorMap?: ZodErrorMap;
23
+ description?: string;
24
+ }
25
+ export declare type RawCreateParams = {
26
+ errorMap?: ZodErrorMap;
27
+ invalid_type_error?: string;
28
+ required_error?: string;
29
+ description?: string;
30
+ } | undefined;
31
+ export declare type ProcessedCreateParams = {
32
+ errorMap?: ZodErrorMap;
33
+ description?: string;
34
+ };
35
+ export declare type SafeParseSuccess<Output> = {
36
+ success: true;
37
+ data: Output;
38
+ };
39
+ export declare type SafeParseError<Input> = {
40
+ success: false;
41
+ error: ZodError<Input>;
42
+ };
43
+ export declare type SafeParseReturnType<Input, Output> = SafeParseSuccess<Output> | SafeParseError<Input>;
44
+ export declare abstract class ZodType<Output = any, Def extends ZodTypeDef = ZodTypeDef, Input = Output> {
45
+ readonly _type: Output;
46
+ readonly _output: Output;
47
+ readonly _input: Input;
48
+ readonly _def: Def;
49
+ get description(): string | undefined;
50
+ abstract _parse(input: ParseInput): ParseReturnType<Output>;
51
+ _getType(input: ParseInput): string;
52
+ _getOrReturnCtx(input: ParseInput, ctx?: ParseContext | undefined): ParseContext;
53
+ _processInputParams(input: ParseInput): {
54
+ status: ParseStatus;
55
+ ctx: ParseContext;
56
+ };
57
+ _parseSync(input: ParseInput): SyncParseReturnType<Output>;
58
+ _parseAsync(input: ParseInput): AsyncParseReturnType<Output>;
59
+ parse(data: unknown, params?: Partial<ParseParams>): Output;
60
+ safeParse(data: unknown, params?: Partial<ParseParams>): SafeParseReturnType<Input, Output>;
61
+ parseAsync(data: unknown, params?: Partial<ParseParams>): Promise<Output>;
62
+ safeParseAsync(data: unknown, params?: Partial<ParseParams>): Promise<SafeParseReturnType<Input, Output>>;
63
+ /** Alias of safeParseAsync */
64
+ spa: (data: unknown, params?: Partial<ParseParams> | undefined) => Promise<SafeParseReturnType<Input, Output>>;
65
+ refine<RefinedOutput extends Output>(check: (arg: Output) => arg is RefinedOutput, message?: string | CustomErrorParams | ((arg: Output) => CustomErrorParams)): ZodEffects<this, RefinedOutput, Input>;
66
+ refine(check: (arg: Output) => unknown | Promise<unknown>, message?: string | CustomErrorParams | ((arg: Output) => CustomErrorParams)): ZodEffects<this, Output, Input>;
67
+ refinement<RefinedOutput extends Output>(check: (arg: Output) => arg is RefinedOutput, refinementData: IssueData | ((arg: Output, ctx: RefinementCtx) => IssueData)): ZodEffects<this, RefinedOutput, Input>;
68
+ refinement(check: (arg: Output) => boolean, refinementData: IssueData | ((arg: Output, ctx: RefinementCtx) => IssueData)): ZodEffects<this, Output, Input>;
69
+ _refinement(refinement: RefinementEffect<Output>["refinement"]): ZodEffects<this, Output, Input>;
70
+ superRefine<RefinedOutput extends Output>(refinement: (arg: Output, ctx: RefinementCtx) => arg is RefinedOutput): ZodEffects<this, RefinedOutput, Input>;
71
+ superRefine(refinement: (arg: Output, ctx: RefinementCtx) => void): ZodEffects<this, Output, Input>;
72
+ constructor(def: Def);
73
+ optional(): ZodOptional<this>;
74
+ nullable(): ZodNullable<this>;
75
+ nullish(): ZodOptional<ZodNullable<this>>;
76
+ array(): ZodArray<this>;
77
+ promise(): ZodPromise<this>;
78
+ or<T extends ZodTypeAny>(option: T): ZodUnion<[this, T]>;
79
+ and<T extends ZodTypeAny>(incoming: T): ZodIntersection<this, T>;
80
+ transform<NewOut>(transform: (arg: Output, ctx: RefinementCtx) => NewOut | Promise<NewOut>): ZodEffects<this, NewOut>;
81
+ default(def: util.noUndefined<Input>): ZodDefault<this>;
82
+ default(def: () => util.noUndefined<Input>): ZodDefault<this>;
83
+ brand<B extends string | number | symbol>(brand?: B): ZodBranded<this, B>;
84
+ catch(def: Output): ZodCatch<this>;
85
+ catch(def: () => Output): ZodCatch<this>;
86
+ describe(description: string): this;
87
+ pipe<T extends ZodTypeAny>(target: T): ZodPipeline<this, T>;
88
+ isOptional(): boolean;
89
+ isNullable(): boolean;
90
+ }
91
+ export declare type ZodStringCheck = {
92
+ kind: "min";
93
+ value: number;
94
+ message?: string;
95
+ } | {
96
+ kind: "max";
97
+ value: number;
98
+ message?: string;
99
+ } | {
100
+ kind: "length";
101
+ value: number;
102
+ message?: string;
103
+ } | {
104
+ kind: "email";
105
+ message?: string;
106
+ } | {
107
+ kind: "url";
108
+ message?: string;
109
+ } | {
110
+ kind: "uuid";
111
+ message?: string;
112
+ } | {
113
+ kind: "cuid";
114
+ message?: string;
115
+ } | {
116
+ kind: "cuid2";
117
+ message?: string;
118
+ } | {
119
+ kind: "startsWith";
120
+ value: string;
121
+ message?: string;
122
+ } | {
123
+ kind: "endsWith";
124
+ value: string;
125
+ message?: string;
126
+ } | {
127
+ kind: "regex";
128
+ regex: RegExp;
129
+ message?: string;
130
+ } | {
131
+ kind: "trim";
132
+ message?: string;
133
+ } | {
134
+ kind: "datetime";
135
+ offset: boolean;
136
+ precision: number | null;
137
+ message?: string;
138
+ };
139
+ export interface ZodStringDef extends ZodTypeDef {
140
+ checks: ZodStringCheck[];
141
+ typeName: ZodFirstPartyTypeKind.ZodString;
142
+ coerce: boolean;
143
+ }
144
+ export declare class ZodString extends ZodType<string, ZodStringDef> {
145
+ _parse(input: ParseInput): ParseReturnType<string>;
146
+ protected _regex: (regex: RegExp, validation: StringValidation, message?: errorUtil.ErrMessage | undefined) => ZodEffects<this, string, string>;
147
+ _addCheck(check: ZodStringCheck): ZodString;
148
+ email(message?: errorUtil.ErrMessage): ZodString;
149
+ url(message?: errorUtil.ErrMessage): ZodString;
150
+ uuid(message?: errorUtil.ErrMessage): ZodString;
151
+ cuid(message?: errorUtil.ErrMessage): ZodString;
152
+ cuid2(message?: errorUtil.ErrMessage): ZodString;
153
+ datetime(options?: string | {
154
+ message?: string | undefined;
155
+ precision?: number | null;
156
+ offset?: boolean;
157
+ }): ZodString;
158
+ regex(regex: RegExp, message?: errorUtil.ErrMessage): ZodString;
159
+ startsWith(value: string, message?: errorUtil.ErrMessage): ZodString;
160
+ endsWith(value: string, message?: errorUtil.ErrMessage): ZodString;
161
+ min(minLength: number, message?: errorUtil.ErrMessage): ZodString;
162
+ max(maxLength: number, message?: errorUtil.ErrMessage): ZodString;
163
+ length(len: number, message?: errorUtil.ErrMessage): ZodString;
164
+ /**
165
+ * @deprecated Use z.string().min(1) instead.
166
+ * @see {@link ZodString.min}
167
+ */
168
+ nonempty: (message?: errorUtil.ErrMessage | undefined) => ZodString;
169
+ trim: () => ZodString;
170
+ get isDatetime(): boolean;
171
+ get isEmail(): boolean;
172
+ get isURL(): boolean;
173
+ get isUUID(): boolean;
174
+ get isCUID(): boolean;
175
+ get isCUID2(): boolean;
176
+ get minLength(): number | null;
177
+ get maxLength(): number | null;
178
+ static create: (params?: ({
179
+ errorMap?: ZodErrorMap | undefined;
180
+ invalid_type_error?: string | undefined;
181
+ required_error?: string | undefined;
182
+ description?: string | undefined;
183
+ } & {
184
+ coerce?: true | undefined;
185
+ }) | undefined) => ZodString;
186
+ }
187
+ export declare type ZodNumberCheck = {
188
+ kind: "min";
189
+ value: number;
190
+ inclusive: boolean;
191
+ message?: string;
192
+ } | {
193
+ kind: "max";
194
+ value: number;
195
+ inclusive: boolean;
196
+ message?: string;
197
+ } | {
198
+ kind: "int";
199
+ message?: string;
200
+ } | {
201
+ kind: "multipleOf";
202
+ value: number;
203
+ message?: string;
204
+ } | {
205
+ kind: "finite";
206
+ message?: string;
207
+ };
208
+ export interface ZodNumberDef extends ZodTypeDef {
209
+ checks: ZodNumberCheck[];
210
+ typeName: ZodFirstPartyTypeKind.ZodNumber;
211
+ coerce: boolean;
212
+ }
213
+ export declare class ZodNumber extends ZodType<number, ZodNumberDef> {
214
+ _parse(input: ParseInput): ParseReturnType<number>;
215
+ static create: (params?: ({
216
+ errorMap?: ZodErrorMap | undefined;
217
+ invalid_type_error?: string | undefined;
218
+ required_error?: string | undefined;
219
+ description?: string | undefined;
220
+ } & {
221
+ coerce?: boolean | undefined;
222
+ }) | undefined) => ZodNumber;
223
+ gte(value: number, message?: errorUtil.ErrMessage): ZodNumber;
224
+ min: (value: number, message?: errorUtil.ErrMessage | undefined) => ZodNumber;
225
+ gt(value: number, message?: errorUtil.ErrMessage): ZodNumber;
226
+ lte(value: number, message?: errorUtil.ErrMessage): ZodNumber;
227
+ max: (value: number, message?: errorUtil.ErrMessage | undefined) => ZodNumber;
228
+ lt(value: number, message?: errorUtil.ErrMessage): ZodNumber;
229
+ protected setLimit(kind: "min" | "max", value: number, inclusive: boolean, message?: string): ZodNumber;
230
+ _addCheck(check: ZodNumberCheck): ZodNumber;
231
+ int(message?: errorUtil.ErrMessage): ZodNumber;
232
+ positive(message?: errorUtil.ErrMessage): ZodNumber;
233
+ negative(message?: errorUtil.ErrMessage): ZodNumber;
234
+ nonpositive(message?: errorUtil.ErrMessage): ZodNumber;
235
+ nonnegative(message?: errorUtil.ErrMessage): ZodNumber;
236
+ multipleOf(value: number, message?: errorUtil.ErrMessage): ZodNumber;
237
+ finite(message?: errorUtil.ErrMessage): ZodNumber;
238
+ step: (value: number, message?: errorUtil.ErrMessage | undefined) => ZodNumber;
239
+ get minValue(): number | null;
240
+ get maxValue(): number | null;
241
+ get isInt(): boolean;
242
+ get isFinite(): boolean;
243
+ }
244
+ export interface ZodBigIntDef extends ZodTypeDef {
245
+ typeName: ZodFirstPartyTypeKind.ZodBigInt;
246
+ coerce: boolean;
247
+ }
248
+ export declare class ZodBigInt extends ZodType<bigint, ZodBigIntDef> {
249
+ _parse(input: ParseInput): ParseReturnType<bigint>;
250
+ static create: (params?: ({
251
+ errorMap?: ZodErrorMap | undefined;
252
+ invalid_type_error?: string | undefined;
253
+ required_error?: string | undefined;
254
+ description?: string | undefined;
255
+ } & {
256
+ coerce?: boolean | undefined;
257
+ }) | undefined) => ZodBigInt;
258
+ }
259
+ export interface ZodBooleanDef extends ZodTypeDef {
260
+ typeName: ZodFirstPartyTypeKind.ZodBoolean;
261
+ coerce: boolean;
262
+ }
263
+ export declare class ZodBoolean extends ZodType<boolean, ZodBooleanDef> {
264
+ _parse(input: ParseInput): ParseReturnType<boolean>;
265
+ static create: (params?: ({
266
+ errorMap?: ZodErrorMap | undefined;
267
+ invalid_type_error?: string | undefined;
268
+ required_error?: string | undefined;
269
+ description?: string | undefined;
270
+ } & {
271
+ coerce?: boolean | undefined;
272
+ }) | undefined) => ZodBoolean;
273
+ }
274
+ export declare type ZodDateCheck = {
275
+ kind: "min";
276
+ value: number;
277
+ message?: string;
278
+ } | {
279
+ kind: "max";
280
+ value: number;
281
+ message?: string;
282
+ };
283
+ export interface ZodDateDef extends ZodTypeDef {
284
+ checks: ZodDateCheck[];
285
+ coerce: boolean;
286
+ typeName: ZodFirstPartyTypeKind.ZodDate;
287
+ }
288
+ export declare class ZodDate extends ZodType<Date, ZodDateDef> {
289
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
290
+ _addCheck(check: ZodDateCheck): ZodDate;
291
+ min(minDate: Date, message?: errorUtil.ErrMessage): ZodDate;
292
+ max(maxDate: Date, message?: errorUtil.ErrMessage): ZodDate;
293
+ get minDate(): Date | null;
294
+ get maxDate(): Date | null;
295
+ static create: (params?: ({
296
+ errorMap?: ZodErrorMap | undefined;
297
+ invalid_type_error?: string | undefined;
298
+ required_error?: string | undefined;
299
+ description?: string | undefined;
300
+ } & {
301
+ coerce?: boolean | undefined;
302
+ }) | undefined) => ZodDate;
303
+ }
304
+ export interface ZodSymbolDef extends ZodTypeDef {
305
+ typeName: ZodFirstPartyTypeKind.ZodSymbol;
306
+ }
307
+ export declare class ZodSymbol extends ZodType<symbol, ZodSymbolDef, symbol> {
308
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
309
+ static create: (params?: RawCreateParams) => ZodSymbol;
310
+ }
311
+ export interface ZodUndefinedDef extends ZodTypeDef {
312
+ typeName: ZodFirstPartyTypeKind.ZodUndefined;
313
+ }
314
+ export declare class ZodUndefined extends ZodType<undefined, ZodUndefinedDef> {
315
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
316
+ params?: RawCreateParams;
317
+ static create: (params?: RawCreateParams) => ZodUndefined;
318
+ }
319
+ export interface ZodNullDef extends ZodTypeDef {
320
+ typeName: ZodFirstPartyTypeKind.ZodNull;
321
+ }
322
+ export declare class ZodNull extends ZodType<null, ZodNullDef> {
323
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
324
+ static create: (params?: RawCreateParams) => ZodNull;
325
+ }
326
+ export interface ZodAnyDef extends ZodTypeDef {
327
+ typeName: ZodFirstPartyTypeKind.ZodAny;
328
+ }
329
+ export declare class ZodAny extends ZodType<any, ZodAnyDef> {
330
+ _any: true;
331
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
332
+ static create: (params?: RawCreateParams) => ZodAny;
333
+ }
334
+ export interface ZodUnknownDef extends ZodTypeDef {
335
+ typeName: ZodFirstPartyTypeKind.ZodUnknown;
336
+ }
337
+ export declare class ZodUnknown extends ZodType<unknown, ZodUnknownDef> {
338
+ _unknown: true;
339
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
340
+ static create: (params?: RawCreateParams) => ZodUnknown;
341
+ }
342
+ export interface ZodNeverDef extends ZodTypeDef {
343
+ typeName: ZodFirstPartyTypeKind.ZodNever;
344
+ }
345
+ export declare class ZodNever extends ZodType<never, ZodNeverDef> {
346
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
347
+ static create: (params?: RawCreateParams) => ZodNever;
348
+ }
349
+ export interface ZodVoidDef extends ZodTypeDef {
350
+ typeName: ZodFirstPartyTypeKind.ZodVoid;
351
+ }
352
+ export declare class ZodVoid extends ZodType<void, ZodVoidDef> {
353
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
354
+ static create: (params?: RawCreateParams) => ZodVoid;
355
+ }
356
+ export interface ZodArrayDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
357
+ type: T;
358
+ typeName: ZodFirstPartyTypeKind.ZodArray;
359
+ exactLength: {
360
+ value: number;
361
+ message?: string;
362
+ } | null;
363
+ minLength: {
364
+ value: number;
365
+ message?: string;
366
+ } | null;
367
+ maxLength: {
368
+ value: number;
369
+ message?: string;
370
+ } | null;
371
+ }
372
+ export declare type ArrayCardinality = "many" | "atleastone";
373
+ export declare type arrayOutputType<T extends ZodTypeAny, Cardinality extends ArrayCardinality = "many"> = Cardinality extends "atleastone" ? [T["_output"], ...T["_output"][]] : T["_output"][];
374
+ export declare class ZodArray<T extends ZodTypeAny, Cardinality extends ArrayCardinality = "many"> extends ZodType<arrayOutputType<T, Cardinality>, ZodArrayDef<T>, Cardinality extends "atleastone" ? [T["_input"], ...T["_input"][]] : T["_input"][]> {
375
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
376
+ get element(): T;
377
+ min(minLength: number, message?: errorUtil.ErrMessage): this;
378
+ max(maxLength: number, message?: errorUtil.ErrMessage): this;
379
+ length(len: number, message?: errorUtil.ErrMessage): this;
380
+ nonempty(message?: errorUtil.ErrMessage): ZodArray<T, "atleastone">;
381
+ static create: <T_1 extends ZodTypeAny>(schema: T_1, params?: RawCreateParams) => ZodArray<T_1, "many">;
382
+ }
383
+ export declare type ZodNonEmptyArray<T extends ZodTypeAny> = ZodArray<T, "atleastone">;
384
+ export declare namespace objectUtil {
385
+ export type MergeShapes<U extends ZodRawShape, V extends ZodRawShape> = {
386
+ [k in Exclude<keyof U, keyof V>]: U[k];
387
+ } & V;
388
+ type optionalKeys<T extends object> = {
389
+ [k in keyof T]: undefined extends T[k] ? k : never;
390
+ }[keyof T];
391
+ type requiredKeys<T extends object> = {
392
+ [k in keyof T]: undefined extends T[k] ? never : k;
393
+ }[keyof T];
394
+ export type addQuestionMarks<T extends object> = Partial<Pick<T, optionalKeys<T>>> & Pick<T, requiredKeys<T>>;
395
+ export type identity<T> = T;
396
+ export type flatten<T extends object> = identity<{
397
+ [k in keyof T]: T[k];
398
+ }>;
399
+ export type noNeverKeys<T extends ZodRawShape> = {
400
+ [k in keyof T]: [T[k]] extends [never] ? never : k;
401
+ }[keyof T];
402
+ export type noNever<T extends ZodRawShape> = identity<{
403
+ [k in noNeverKeys<T>]: k extends keyof T ? T[k] : never;
404
+ }>;
405
+ export const mergeShapes: <U extends ZodRawShape, T extends ZodRawShape>(first: U, second: T) => T & U;
406
+ export {};
407
+ }
408
+ export declare type extendShape<A, B> = util.flatten<Omit<A, keyof B> & B>;
409
+ export declare type UnknownKeysParam = "passthrough" | "strict" | "strip";
410
+ export interface ZodObjectDef<T extends ZodRawShape = ZodRawShape, UnknownKeys extends UnknownKeysParam = UnknownKeysParam, Catchall extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
411
+ typeName: ZodFirstPartyTypeKind.ZodObject;
412
+ shape: () => T;
413
+ catchall: Catchall;
414
+ unknownKeys: UnknownKeys;
415
+ }
416
+ export declare type mergeTypes<A, B> = {
417
+ [k in keyof A | keyof B]: k extends keyof B ? B[k] : k extends keyof A ? A[k] : never;
418
+ };
419
+ export declare type processType<T extends object> = util.flatten<objectUtil.addQuestionMarks<T>>;
420
+ export declare type baseObjectOutputType<Shape extends ZodRawShape> = objectUtil.addQuestionMarks<{
421
+ [k in keyof Shape]: Shape[k]["_output"];
422
+ }>;
423
+ export declare type objectOutputType<Shape extends ZodRawShape, Catchall extends ZodTypeAny> = ZodTypeAny extends Catchall ? objectUtil.flatten<baseObjectOutputType<Shape>> : objectUtil.flatten<baseObjectOutputType<Shape> & {
424
+ [k: string]: Catchall["_output"];
425
+ }>;
426
+ export declare type baseObjectInputType<Shape extends ZodRawShape> = objectUtil.flatten<objectUtil.addQuestionMarks<{
427
+ [k in keyof Shape]: Shape[k]["_input"];
428
+ }>>;
429
+ export declare type objectInputType<Shape extends ZodRawShape, Catchall extends ZodTypeAny> = ZodTypeAny extends Catchall ? baseObjectInputType<Shape> : objectUtil.flatten<baseObjectInputType<Shape> & {
430
+ [k: string]: Catchall["_input"];
431
+ }>;
432
+ export declare type deoptional<T extends ZodTypeAny> = T extends ZodOptional<infer U> ? deoptional<U> : T extends ZodNullable<infer U> ? ZodNullable<deoptional<U>> : T;
433
+ export declare type SomeZodObject = ZodObject<ZodRawShape, UnknownKeysParam, ZodTypeAny>;
434
+ export declare type objectKeyMask<Obj> = {
435
+ [k in keyof Obj]?: true;
436
+ };
437
+ export declare type noUnrecognized<Obj extends object, Shape extends object> = {
438
+ [k in keyof Obj]: k extends keyof Shape ? Obj[k] : never;
439
+ };
440
+ export declare class ZodObject<T extends ZodRawShape, UnknownKeys extends UnknownKeysParam = UnknownKeysParam, Catchall extends ZodTypeAny = ZodTypeAny, Output = objectOutputType<T, Catchall>, Input = objectInputType<T, Catchall>> extends ZodType<Output, ZodObjectDef<T, UnknownKeys, Catchall>, Input> {
441
+ private _cached;
442
+ _getCached(): {
443
+ shape: T;
444
+ keys: string[];
445
+ };
446
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
447
+ get shape(): T;
448
+ strict(message?: errorUtil.ErrMessage): ZodObject<T, "strict", Catchall>;
449
+ strip(): ZodObject<T, "strip", Catchall>;
450
+ passthrough(): ZodObject<T, "passthrough", Catchall>;
451
+ /**
452
+ * @deprecated In most cases, this is no longer needed - unknown properties are now silently stripped.
453
+ * If you want to pass through unknown properties, use `.passthrough()` instead.
454
+ */
455
+ nonstrict: () => ZodObject<T, "passthrough", Catchall>;
456
+ extend<Augmentation extends ZodRawShape>(augmentation: Augmentation): ZodObject<extendShape<T, Augmentation>, UnknownKeys, Catchall>;
457
+ /**
458
+ * @deprecated Use `.extend` instead
459
+ * */
460
+ augment: <Augmentation extends ZodRawShape>(augmentation: Augmentation) => ZodObject<{ [k in keyof (Omit<T, keyof Augmentation> & Augmentation)]: (Omit<T, keyof Augmentation> & Augmentation)[k]; }, UnknownKeys, Catchall, objectOutputType<{ [k in keyof (Omit<T, keyof Augmentation> & Augmentation)]: (Omit<T, keyof Augmentation> & Augmentation)[k]; }, Catchall>, objectInputType<{ [k in keyof (Omit<T, keyof Augmentation> & Augmentation)]: (Omit<T, keyof Augmentation> & Augmentation)[k]; }, Catchall>>;
461
+ /**
462
+ * Prior to zod@1.0.12 there was a bug in the
463
+ * inferred type of merged objects. Please
464
+ * upgrade if you are experiencing issues.
465
+ */
466
+ merge<Incoming extends AnyZodObject, Augmentation extends Incoming["shape"]>(merging: Incoming): ZodObject<extendShape<T, Augmentation>, Incoming["_def"]["unknownKeys"], Incoming["_def"]["catchall"]>;
467
+ setKey<Key extends string, Schema extends ZodTypeAny>(key: Key, schema: Schema): ZodObject<T & {
468
+ [k in Key]: Schema;
469
+ }, UnknownKeys, Catchall>;
470
+ catchall<Index extends ZodTypeAny>(index: Index): ZodObject<T, UnknownKeys, Index>;
471
+ pick<Mask extends objectKeyMask<T>>(mask: noUnrecognized<Mask, T>): ZodObject<Pick<T, Extract<keyof T, keyof Mask>>, UnknownKeys, Catchall>;
472
+ omit<Mask extends objectKeyMask<T>>(mask: noUnrecognized<Mask, objectKeyMask<T>>): ZodObject<Omit<T, keyof Mask>, UnknownKeys, Catchall>;
473
+ deepPartial(): partialUtil.DeepPartial<this>;
474
+ partial(): ZodObject<{
475
+ [k in keyof T]: ZodOptional<T[k]>;
476
+ }, UnknownKeys, Catchall>;
477
+ partial<Mask extends objectKeyMask<T>>(mask: noUnrecognized<Mask, objectKeyMask<T>>): ZodObject<objectUtil.noNever<{
478
+ [k in keyof T]: k extends keyof Mask ? ZodOptional<T[k]> : T[k];
479
+ }>, UnknownKeys, Catchall>;
480
+ required(): ZodObject<{
481
+ [k in keyof T]: deoptional<T[k]>;
482
+ }, UnknownKeys, Catchall>;
483
+ required<Mask extends objectKeyMask<T>>(mask: noUnrecognized<Mask, objectKeyMask<T>>): ZodObject<objectUtil.noNever<{
484
+ [k in keyof T]: k extends keyof Mask ? deoptional<T[k]> : T[k];
485
+ }>, UnknownKeys, Catchall>;
486
+ keyof(): ZodEnum<enumUtil.UnionToTupleString<keyof T>>;
487
+ static create: <T_1 extends ZodRawShape>(shape: T_1, params?: RawCreateParams) => ZodObject<T_1, "strip", ZodTypeAny, { [k in keyof baseObjectOutputType<T_1>]: baseObjectOutputType<T_1>[k]; }, { [k_2 in keyof objectUtil.addQuestionMarks<{ [k_1 in keyof T_1]: T_1[k_1]["_input"]; }>]: objectUtil.addQuestionMarks<{ [k_1 in keyof T_1]: T_1[k_1]["_input"]; }>[k_2]; }>;
488
+ static strictCreate: <T_1 extends ZodRawShape>(shape: T_1, params?: RawCreateParams) => ZodObject<T_1, "strict", ZodTypeAny, { [k in keyof baseObjectOutputType<T_1>]: baseObjectOutputType<T_1>[k]; }, { [k_2 in keyof objectUtil.addQuestionMarks<{ [k_1 in keyof T_1]: T_1[k_1]["_input"]; }>]: objectUtil.addQuestionMarks<{ [k_1 in keyof T_1]: T_1[k_1]["_input"]; }>[k_2]; }>;
489
+ static lazycreate: <T_1 extends ZodRawShape>(shape: () => T_1, params?: RawCreateParams) => ZodObject<T_1, "strip", ZodTypeAny, { [k in keyof baseObjectOutputType<T_1>]: baseObjectOutputType<T_1>[k]; }, { [k_2 in keyof objectUtil.addQuestionMarks<{ [k_1 in keyof T_1]: T_1[k_1]["_input"]; }>]: objectUtil.addQuestionMarks<{ [k_1 in keyof T_1]: T_1[k_1]["_input"]; }>[k_2]; }>;
490
+ }
491
+ export declare type AnyZodObject = ZodObject<any, any, any>;
492
+ export declare type ZodUnionOptions = Readonly<[ZodTypeAny, ...ZodTypeAny[]]>;
493
+ export interface ZodUnionDef<T extends ZodUnionOptions = Readonly<[
494
+ ZodTypeAny,
495
+ ZodTypeAny,
496
+ ...ZodTypeAny[]
497
+ ]>> extends ZodTypeDef {
498
+ options: T;
499
+ typeName: ZodFirstPartyTypeKind.ZodUnion;
500
+ }
501
+ export declare class ZodUnion<T extends ZodUnionOptions> extends ZodType<T[number]["_output"], ZodUnionDef<T>, T[number]["_input"]> {
502
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
503
+ get options(): T;
504
+ static create: <T_1 extends readonly [ZodTypeAny, ZodTypeAny, ...ZodTypeAny[]]>(types: T_1, params?: RawCreateParams) => ZodUnion<T_1>;
505
+ }
506
+ export declare type ZodDiscriminatedUnionOption<Discriminator extends string> = ZodObject<{
507
+ [key in Discriminator]: ZodTypeAny;
508
+ } & ZodRawShape, UnknownKeysParam, ZodTypeAny>;
509
+ export interface ZodDiscriminatedUnionDef<Discriminator extends string, Options extends ZodDiscriminatedUnionOption<string>[] = ZodDiscriminatedUnionOption<string>[]> extends ZodTypeDef {
510
+ discriminator: Discriminator;
511
+ options: Options;
512
+ optionsMap: Map<Primitive, ZodDiscriminatedUnionOption<any>>;
513
+ typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion;
514
+ }
515
+ export declare class ZodDiscriminatedUnion<Discriminator extends string, Options extends ZodDiscriminatedUnionOption<Discriminator>[]> extends ZodType<output<Options[number]>, ZodDiscriminatedUnionDef<Discriminator, Options>, input<Options[number]>> {
516
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
517
+ get discriminator(): Discriminator;
518
+ get options(): Options;
519
+ get optionsMap(): Map<Primitive, ZodDiscriminatedUnionOption<any>>;
520
+ /**
521
+ * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.
522
+ * However, it only allows a union of objects, all of which need to share a discriminator property. This property must
523
+ * have a different value for each object in the union.
524
+ * @param discriminator the name of the discriminator property
525
+ * @param types an array of object schemas
526
+ * @param params
527
+ */
528
+ static create<Discriminator extends string, Types extends [
529
+ ZodDiscriminatedUnionOption<Discriminator>,
530
+ ...ZodDiscriminatedUnionOption<Discriminator>[]
531
+ ]>(discriminator: Discriminator, options: Types, params?: RawCreateParams): ZodDiscriminatedUnion<Discriminator, Types>;
532
+ }
533
+ export interface ZodIntersectionDef<T extends ZodTypeAny = ZodTypeAny, U extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
534
+ left: T;
535
+ right: U;
536
+ typeName: ZodFirstPartyTypeKind.ZodIntersection;
537
+ }
538
+ export declare class ZodIntersection<T extends ZodTypeAny, U extends ZodTypeAny> extends ZodType<T["_output"] & U["_output"], ZodIntersectionDef<T, U>, T["_input"] & U["_input"]> {
539
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
540
+ static create: <T_1 extends ZodTypeAny, U_1 extends ZodTypeAny>(left: T_1, right: U_1, params?: RawCreateParams) => ZodIntersection<T_1, U_1>;
541
+ }
542
+ export declare type ZodTupleItems = [ZodTypeAny, ...ZodTypeAny[]];
543
+ export declare type AssertArray<T> = T extends any[] ? T : never;
544
+ export declare type OutputTypeOfTuple<T extends ZodTupleItems | []> = AssertArray<{
545
+ [k in keyof T]: T[k] extends ZodType<any, any> ? T[k]["_output"] : never;
546
+ }>;
547
+ export declare type OutputTypeOfTupleWithRest<T extends ZodTupleItems | [], Rest extends ZodTypeAny | null = null> = Rest extends ZodTypeAny ? [...OutputTypeOfTuple<T>, ...Rest["_output"][]] : OutputTypeOfTuple<T>;
548
+ export declare type InputTypeOfTuple<T extends ZodTupleItems | []> = AssertArray<{
549
+ [k in keyof T]: T[k] extends ZodType<any, any> ? T[k]["_input"] : never;
550
+ }>;
551
+ export declare type InputTypeOfTupleWithRest<T extends ZodTupleItems | [], Rest extends ZodTypeAny | null = null> = Rest extends ZodTypeAny ? [...InputTypeOfTuple<T>, ...Rest["_input"][]] : InputTypeOfTuple<T>;
552
+ export interface ZodTupleDef<T extends ZodTupleItems | [] = ZodTupleItems, Rest extends ZodTypeAny | null = null> extends ZodTypeDef {
553
+ items: T;
554
+ rest: Rest;
555
+ typeName: ZodFirstPartyTypeKind.ZodTuple;
556
+ }
557
+ export declare type AnyZodTuple = ZodTuple<[
558
+ ZodTypeAny,
559
+ ...ZodTypeAny[]
560
+ ] | [], ZodTypeAny | null>;
561
+ export declare class ZodTuple<T extends [ZodTypeAny, ...ZodTypeAny[]] | [] = [ZodTypeAny, ...ZodTypeAny[]], Rest extends ZodTypeAny | null = null> extends ZodType<OutputTypeOfTupleWithRest<T, Rest>, ZodTupleDef<T, Rest>, InputTypeOfTupleWithRest<T, Rest>> {
562
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
563
+ get items(): T;
564
+ rest<Rest extends ZodTypeAny>(rest: Rest): ZodTuple<T, Rest>;
565
+ static create: <T_1 extends [] | [ZodTypeAny, ...ZodTypeAny[]]>(schemas: T_1, params?: RawCreateParams) => ZodTuple<T_1, null>;
566
+ }
567
+ export interface ZodRecordDef<Key extends KeySchema = ZodString, Value extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
568
+ valueType: Value;
569
+ keyType: Key;
570
+ typeName: ZodFirstPartyTypeKind.ZodRecord;
571
+ }
572
+ export declare type KeySchema = ZodType<string | number | symbol, any, any>;
573
+ export declare type RecordType<K extends string | number | symbol, V> = [
574
+ string
575
+ ] extends [K] ? Record<K, V> : [number] extends [K] ? Record<K, V> : [symbol] extends [K] ? Record<K, V> : Partial<Record<K, V>>;
576
+ export declare class ZodRecord<Key extends KeySchema = ZodString, Value extends ZodTypeAny = ZodTypeAny> extends ZodType<RecordType<Key["_output"], Value["_output"]>, ZodRecordDef<Key, Value>, RecordType<Key["_input"], Value["_input"]>> {
577
+ get keySchema(): Key;
578
+ get valueSchema(): Value;
579
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
580
+ get element(): Value;
581
+ static create<Value extends ZodTypeAny>(valueType: Value, params?: RawCreateParams): ZodRecord<ZodString, Value>;
582
+ static create<Keys extends KeySchema, Value extends ZodTypeAny>(keySchema: Keys, valueType: Value, params?: RawCreateParams): ZodRecord<Keys, Value>;
583
+ }
584
+ export interface ZodMapDef<Key extends ZodTypeAny = ZodTypeAny, Value extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
585
+ valueType: Value;
586
+ keyType: Key;
587
+ typeName: ZodFirstPartyTypeKind.ZodMap;
588
+ }
589
+ export declare class ZodMap<Key extends ZodTypeAny = ZodTypeAny, Value extends ZodTypeAny = ZodTypeAny> extends ZodType<Map<Key["_output"], Value["_output"]>, ZodMapDef<Key, Value>, Map<Key["_input"], Value["_input"]>> {
590
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
591
+ static create: <Key_1 extends ZodTypeAny = ZodTypeAny, Value_1 extends ZodTypeAny = ZodTypeAny>(keyType: Key_1, valueType: Value_1, params?: RawCreateParams) => ZodMap<Key_1, Value_1>;
592
+ }
593
+ export interface ZodSetDef<Value extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
594
+ valueType: Value;
595
+ typeName: ZodFirstPartyTypeKind.ZodSet;
596
+ minSize: {
597
+ value: number;
598
+ message?: string;
599
+ } | null;
600
+ maxSize: {
601
+ value: number;
602
+ message?: string;
603
+ } | null;
604
+ }
605
+ export declare class ZodSet<Value extends ZodTypeAny = ZodTypeAny> extends ZodType<Set<Value["_output"]>, ZodSetDef<Value>, Set<Value["_input"]>> {
606
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
607
+ min(minSize: number, message?: errorUtil.ErrMessage): this;
608
+ max(maxSize: number, message?: errorUtil.ErrMessage): this;
609
+ size(size: number, message?: errorUtil.ErrMessage): this;
610
+ nonempty(message?: errorUtil.ErrMessage): ZodSet<Value>;
611
+ static create: <Value_1 extends ZodTypeAny = ZodTypeAny>(valueType: Value_1, params?: RawCreateParams) => ZodSet<Value_1>;
612
+ }
613
+ export interface ZodFunctionDef<Args extends ZodTuple<any, any> = ZodTuple<any, any>, Returns extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
614
+ args: Args;
615
+ returns: Returns;
616
+ typeName: ZodFirstPartyTypeKind.ZodFunction;
617
+ }
618
+ export declare type OuterTypeOfFunction<Args extends ZodTuple<any, any>, Returns extends ZodTypeAny> = Args["_input"] extends Array<any> ? (...args: Args["_input"]) => Returns["_output"] : never;
619
+ export declare type InnerTypeOfFunction<Args extends ZodTuple<any, any>, Returns extends ZodTypeAny> = Args["_output"] extends Array<any> ? (...args: Args["_output"]) => Returns["_input"] : never;
620
+ export declare class ZodFunction<Args extends ZodTuple<any, any>, Returns extends ZodTypeAny> extends ZodType<OuterTypeOfFunction<Args, Returns>, ZodFunctionDef<Args, Returns>, InnerTypeOfFunction<Args, Returns>> {
621
+ _parse(input: ParseInput): ParseReturnType<any>;
622
+ parameters(): Args;
623
+ returnType(): Returns;
624
+ args<Items extends Parameters<typeof ZodTuple["create"]>[0]>(...items: Items): ZodFunction<ZodTuple<Items, ZodUnknown>, Returns>;
625
+ returns<NewReturnType extends ZodType<any, any>>(returnType: NewReturnType): ZodFunction<Args, NewReturnType>;
626
+ implement<F extends InnerTypeOfFunction<Args, Returns>>(func: F): ReturnType<F> extends Returns["_output"] ? (...args: Args["_input"]) => ReturnType<F> : OuterTypeOfFunction<Args, Returns>;
627
+ strictImplement(func: InnerTypeOfFunction<Args, Returns>): InnerTypeOfFunction<Args, Returns>;
628
+ validate: <F extends InnerTypeOfFunction<Args, Returns>>(func: F) => ReturnType<F> extends Returns["_output"] ? (...args: Args["_input"]) => ReturnType<F> : OuterTypeOfFunction<Args, Returns>;
629
+ static create(): ZodFunction<ZodTuple<[], ZodUnknown>, ZodUnknown>;
630
+ static create<T extends AnyZodTuple = ZodTuple<[], ZodUnknown>>(args: T): ZodFunction<T, ZodUnknown>;
631
+ static create<T extends AnyZodTuple, U extends ZodTypeAny>(args: T, returns: U): ZodFunction<T, U>;
632
+ static create<T extends AnyZodTuple = ZodTuple<[], ZodUnknown>, U extends ZodTypeAny = ZodUnknown>(args: T, returns: U, params?: RawCreateParams): ZodFunction<T, U>;
633
+ }
634
+ export interface ZodLazyDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
635
+ getter: () => T;
636
+ typeName: ZodFirstPartyTypeKind.ZodLazy;
637
+ }
638
+ export declare class ZodLazy<T extends ZodTypeAny> extends ZodType<output<T>, ZodLazyDef<T>, input<T>> {
639
+ get schema(): T;
640
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
641
+ static create: <T_1 extends ZodTypeAny>(getter: () => T_1, params?: RawCreateParams) => ZodLazy<T_1>;
642
+ }
643
+ export interface ZodLiteralDef<T = any> extends ZodTypeDef {
644
+ value: T;
645
+ typeName: ZodFirstPartyTypeKind.ZodLiteral;
646
+ }
647
+ export declare class ZodLiteral<T> extends ZodType<T, ZodLiteralDef<T>> {
648
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
649
+ get value(): T;
650
+ static create: <T_1 extends Primitive>(value: T_1, params?: RawCreateParams) => ZodLiteral<T_1>;
651
+ }
652
+ export declare type ArrayKeys = keyof any[];
653
+ export declare type Indices<T> = Exclude<keyof T, ArrayKeys>;
654
+ export declare type EnumValues = [string, ...string[]];
655
+ export declare type Values<T extends EnumValues> = {
656
+ [k in T[number]]: k;
657
+ };
658
+ export interface ZodEnumDef<T extends EnumValues = EnumValues> extends ZodTypeDef {
659
+ values: T;
660
+ typeName: ZodFirstPartyTypeKind.ZodEnum;
661
+ }
662
+ export declare type Writeable<T> = {
663
+ -readonly [P in keyof T]: T[P];
664
+ };
665
+ export declare type FilterEnum<Values, ToExclude> = Values extends [] ? [] : Values extends [infer Head, ...infer Rest] ? Head extends ToExclude ? FilterEnum<Rest, ToExclude> : [Head, ...FilterEnum<Rest, ToExclude>] : never;
666
+ export declare type typecast<A, T> = A extends T ? A : never;
667
+ declare function createZodEnum<U extends string, T extends Readonly<[U, ...U[]]>>(values: T, params?: RawCreateParams): ZodEnum<Writeable<T>>;
668
+ declare function createZodEnum<U extends string, T extends [U, ...U[]]>(values: T, params?: RawCreateParams): ZodEnum<T>;
669
+ export declare class ZodEnum<T extends [string, ...string[]]> extends ZodType<T[number], ZodEnumDef<T>> {
670
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
671
+ get options(): T;
672
+ get enum(): Values<T>;
673
+ get Values(): Values<T>;
674
+ get Enum(): Values<T>;
675
+ extract<ToExtract extends readonly [T[number], ...T[number][]]>(values: ToExtract): ZodEnum<Writeable<ToExtract>>;
676
+ exclude<ToExclude extends readonly [T[number], ...T[number][]]>(values: ToExclude): ZodEnum<typecast<Writeable<FilterEnum<T, ToExclude[number]>>, [string, ...string[]]>>;
677
+ static create: typeof createZodEnum;
678
+ }
679
+ export interface ZodNativeEnumDef<T extends EnumLike = EnumLike> extends ZodTypeDef {
680
+ values: T;
681
+ typeName: ZodFirstPartyTypeKind.ZodNativeEnum;
682
+ }
683
+ export declare type EnumLike = {
684
+ [k: string]: string | number;
685
+ [nu: number]: string;
686
+ };
687
+ export declare class ZodNativeEnum<T extends EnumLike> extends ZodType<T[keyof T], ZodNativeEnumDef<T>> {
688
+ _parse(input: ParseInput): ParseReturnType<T[keyof T]>;
689
+ get enum(): T;
690
+ static create: <T_1 extends EnumLike>(values: T_1, params?: RawCreateParams) => ZodNativeEnum<T_1>;
691
+ }
692
+ export interface ZodPromiseDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
693
+ type: T;
694
+ typeName: ZodFirstPartyTypeKind.ZodPromise;
695
+ }
696
+ export declare class ZodPromise<T extends ZodTypeAny> extends ZodType<Promise<T["_output"]>, ZodPromiseDef<T>, Promise<T["_input"]>> {
697
+ unwrap(): T;
698
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
699
+ static create: <T_1 extends ZodTypeAny>(schema: T_1, params?: RawCreateParams) => ZodPromise<T_1>;
700
+ }
701
+ export declare type Refinement<T> = (arg: T, ctx: RefinementCtx) => any;
702
+ export declare type SuperRefinement<T> = (arg: T, ctx: RefinementCtx) => void;
703
+ export declare type RefinementEffect<T> = {
704
+ type: "refinement";
705
+ refinement: (arg: T, ctx: RefinementCtx) => any;
706
+ };
707
+ export declare type TransformEffect<T> = {
708
+ type: "transform";
709
+ transform: (arg: T, ctx: RefinementCtx) => any;
710
+ };
711
+ export declare type PreprocessEffect<T> = {
712
+ type: "preprocess";
713
+ transform: (arg: T) => any;
714
+ };
715
+ export declare type Effect<T> = RefinementEffect<T> | TransformEffect<T> | PreprocessEffect<T>;
716
+ export interface ZodEffectsDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
717
+ schema: T;
718
+ typeName: ZodFirstPartyTypeKind.ZodEffects;
719
+ effect: Effect<any>;
720
+ }
721
+ export declare class ZodEffects<T extends ZodTypeAny, Output = output<T>, Input = input<T>> extends ZodType<Output, ZodEffectsDef<T>, Input> {
722
+ innerType(): T;
723
+ sourceType(): T;
724
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
725
+ static create: <I extends ZodTypeAny>(schema: I, effect: Effect<I["_output"]>, params?: RawCreateParams) => ZodEffects<I, I["_output"], input<I>>;
726
+ static createWithPreprocess: <I extends ZodTypeAny>(preprocess: (arg: unknown) => unknown, schema: I, params?: RawCreateParams) => ZodEffects<I, I["_output"], unknown>;
727
+ }
728
+ export { ZodEffects as ZodTransformer };
729
+ export interface ZodOptionalDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
730
+ innerType: T;
731
+ typeName: ZodFirstPartyTypeKind.ZodOptional;
732
+ }
733
+ export declare type ZodOptionalType<T extends ZodTypeAny> = ZodOptional<T>;
734
+ export declare class ZodOptional<T extends ZodTypeAny> extends ZodType<T["_output"] | undefined, ZodOptionalDef<T>, T["_input"] | undefined> {
735
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
736
+ unwrap(): T;
737
+ static create: <T_1 extends ZodTypeAny>(type: T_1, params?: RawCreateParams) => ZodOptional<T_1>;
738
+ }
739
+ export interface ZodNullableDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
740
+ innerType: T;
741
+ typeName: ZodFirstPartyTypeKind.ZodNullable;
742
+ }
743
+ export declare type ZodNullableType<T extends ZodTypeAny> = ZodNullable<T>;
744
+ export declare class ZodNullable<T extends ZodTypeAny> extends ZodType<T["_output"] | null, ZodNullableDef<T>, T["_input"] | null> {
745
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
746
+ unwrap(): T;
747
+ static create: <T_1 extends ZodTypeAny>(type: T_1, params?: RawCreateParams) => ZodNullable<T_1>;
748
+ }
749
+ export interface ZodDefaultDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
750
+ innerType: T;
751
+ defaultValue: () => util.noUndefined<T["_input"]>;
752
+ typeName: ZodFirstPartyTypeKind.ZodDefault;
753
+ }
754
+ export declare class ZodDefault<T extends ZodTypeAny> extends ZodType<util.noUndefined<T["_output"]>, ZodDefaultDef<T>, T["_input"] | undefined> {
755
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
756
+ removeDefault(): T;
757
+ static create: <T_1 extends ZodTypeAny>(type: T_1, params: {
758
+ errorMap?: ZodErrorMap | undefined;
759
+ invalid_type_error?: string | undefined;
760
+ required_error?: string | undefined;
761
+ description?: string | undefined;
762
+ } & {
763
+ default: T_1["_input"] | (() => util.noUndefined<T_1["_input"]>);
764
+ }) => ZodDefault<T_1>;
765
+ }
766
+ export interface ZodCatchDef<T extends ZodTypeAny = ZodTypeAny, C extends T["_input"] = T["_input"]> extends ZodTypeDef {
767
+ innerType: T;
768
+ catchValue: () => C;
769
+ typeName: ZodFirstPartyTypeKind.ZodCatch;
770
+ }
771
+ export declare class ZodCatch<T extends ZodTypeAny> extends ZodType<T["_output"], ZodCatchDef<T>, unknown> {
772
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
773
+ removeCatch(): T;
774
+ static create: <T_1 extends ZodTypeAny>(type: T_1, params: {
775
+ errorMap?: ZodErrorMap | undefined;
776
+ invalid_type_error?: string | undefined;
777
+ required_error?: string | undefined;
778
+ description?: string | undefined;
779
+ } & {
780
+ catch: T_1["_output"] | (() => T_1["_output"]);
781
+ }) => ZodCatch<T_1>;
782
+ }
783
+ export interface ZodNaNDef extends ZodTypeDef {
784
+ typeName: ZodFirstPartyTypeKind.ZodNaN;
785
+ }
786
+ export declare class ZodNaN extends ZodType<number, ZodNaNDef> {
787
+ _parse(input: ParseInput): ParseReturnType<any>;
788
+ static create: (params?: RawCreateParams) => ZodNaN;
789
+ }
790
+ export interface ZodBrandedDef<T extends ZodTypeAny> extends ZodTypeDef {
791
+ type: T;
792
+ typeName: ZodFirstPartyTypeKind.ZodBranded;
793
+ }
794
+ export declare const BRAND: unique symbol;
795
+ export declare type BRAND<T extends string | number | symbol> = {
796
+ [BRAND]: {
797
+ [k in T]: true;
798
+ };
799
+ };
800
+ export declare class ZodBranded<T extends ZodTypeAny, B extends string | number | symbol> extends ZodType<T["_output"] & BRAND<B>, ZodBrandedDef<T>, T["_input"]> {
801
+ _parse(input: ParseInput): ParseReturnType<any>;
802
+ unwrap(): T;
803
+ }
804
+ export interface ZodPipelineDef<A extends ZodTypeAny, B extends ZodTypeAny> extends ZodTypeDef {
805
+ in: A;
806
+ out: B;
807
+ typeName: ZodFirstPartyTypeKind.ZodPipeline;
808
+ }
809
+ export declare class ZodPipeline<A extends ZodTypeAny, B extends ZodTypeAny> extends ZodType<B["_output"], ZodPipelineDef<A, B>, A["_input"]> {
810
+ _parse(input: ParseInput): ParseReturnType<any>;
811
+ static create<A extends ZodTypeAny, B extends ZodTypeAny>(a: A, b: B): ZodPipeline<A, B>;
812
+ }
813
+ export declare const custom: <T>(check?: ((data: unknown) => any) | undefined, params?: Parameters<ZodTypeAny["refine"]>[1], fatal?: boolean | undefined) => ZodType<T, ZodTypeDef, T>;
814
+ export { ZodType as Schema, ZodType as ZodSchema };
815
+ export declare const late: {
816
+ object: <T extends ZodRawShape>(shape: () => T, params?: RawCreateParams) => ZodObject<T, "strip", ZodTypeAny, { [k in keyof baseObjectOutputType<T>]: baseObjectOutputType<T>[k]; }, { [k_2 in keyof objectUtil.addQuestionMarks<{ [k_1 in keyof T]: T[k_1]["_input"]; }>]: objectUtil.addQuestionMarks<{ [k_1 in keyof T]: T[k_1]["_input"]; }>[k_2]; }>;
817
+ };
818
+ export declare enum ZodFirstPartyTypeKind {
819
+ ZodString = "ZodString",
820
+ ZodNumber = "ZodNumber",
821
+ ZodNaN = "ZodNaN",
822
+ ZodBigInt = "ZodBigInt",
823
+ ZodBoolean = "ZodBoolean",
824
+ ZodDate = "ZodDate",
825
+ ZodSymbol = "ZodSymbol",
826
+ ZodUndefined = "ZodUndefined",
827
+ ZodNull = "ZodNull",
828
+ ZodAny = "ZodAny",
829
+ ZodUnknown = "ZodUnknown",
830
+ ZodNever = "ZodNever",
831
+ ZodVoid = "ZodVoid",
832
+ ZodArray = "ZodArray",
833
+ ZodObject = "ZodObject",
834
+ ZodUnion = "ZodUnion",
835
+ ZodDiscriminatedUnion = "ZodDiscriminatedUnion",
836
+ ZodIntersection = "ZodIntersection",
837
+ ZodTuple = "ZodTuple",
838
+ ZodRecord = "ZodRecord",
839
+ ZodMap = "ZodMap",
840
+ ZodSet = "ZodSet",
841
+ ZodFunction = "ZodFunction",
842
+ ZodLazy = "ZodLazy",
843
+ ZodLiteral = "ZodLiteral",
844
+ ZodEnum = "ZodEnum",
845
+ ZodEffects = "ZodEffects",
846
+ ZodNativeEnum = "ZodNativeEnum",
847
+ ZodOptional = "ZodOptional",
848
+ ZodNullable = "ZodNullable",
849
+ ZodDefault = "ZodDefault",
850
+ ZodCatch = "ZodCatch",
851
+ ZodPromise = "ZodPromise",
852
+ ZodBranded = "ZodBranded",
853
+ ZodPipeline = "ZodPipeline"
854
+ }
855
+ export declare type ZodFirstPartySchemaTypes = ZodString | ZodNumber | ZodNaN | ZodBigInt | ZodBoolean | ZodDate | ZodUndefined | ZodNull | ZodAny | ZodUnknown | ZodNever | ZodVoid | ZodArray<any, any> | ZodObject<any, any, any> | ZodUnion<any> | ZodDiscriminatedUnion<any, any> | ZodIntersection<any, any> | ZodTuple<any, any> | ZodRecord<any, any> | ZodMap<any> | ZodSet<any> | ZodFunction<any, any> | ZodLazy<any> | ZodLiteral<any> | ZodEnum<any> | ZodEffects<any, any, any> | ZodNativeEnum<any> | ZodOptional<any> | ZodNullable<any> | ZodDefault<any> | ZodCatch<any> | ZodPromise<any> | ZodBranded<any, any> | ZodPipeline<any, any>;
856
+ declare abstract class Class {
857
+ constructor(..._: any[]);
858
+ }
859
+ declare const instanceOfType: <T extends typeof Class>(cls: T, params?: Parameters<ZodTypeAny["refine"]>[1]) => ZodType<InstanceType<T>, ZodTypeDef, InstanceType<T>>;
860
+ declare const stringType: (params?: ({
861
+ errorMap?: ZodErrorMap | undefined;
862
+ invalid_type_error?: string | undefined;
863
+ required_error?: string | undefined;
864
+ description?: string | undefined;
865
+ } & {
866
+ coerce?: true | undefined;
867
+ }) | undefined) => ZodString;
868
+ declare const numberType: (params?: ({
869
+ errorMap?: ZodErrorMap | undefined;
870
+ invalid_type_error?: string | undefined;
871
+ required_error?: string | undefined;
872
+ description?: string | undefined;
873
+ } & {
874
+ coerce?: boolean | undefined;
875
+ }) | undefined) => ZodNumber;
876
+ declare const nanType: (params?: RawCreateParams) => ZodNaN;
877
+ declare const bigIntType: (params?: ({
878
+ errorMap?: ZodErrorMap | undefined;
879
+ invalid_type_error?: string | undefined;
880
+ required_error?: string | undefined;
881
+ description?: string | undefined;
882
+ } & {
883
+ coerce?: boolean | undefined;
884
+ }) | undefined) => ZodBigInt;
885
+ declare const booleanType: (params?: ({
886
+ errorMap?: ZodErrorMap | undefined;
887
+ invalid_type_error?: string | undefined;
888
+ required_error?: string | undefined;
889
+ description?: string | undefined;
890
+ } & {
891
+ coerce?: boolean | undefined;
892
+ }) | undefined) => ZodBoolean;
893
+ declare const dateType: (params?: ({
894
+ errorMap?: ZodErrorMap | undefined;
895
+ invalid_type_error?: string | undefined;
896
+ required_error?: string | undefined;
897
+ description?: string | undefined;
898
+ } & {
899
+ coerce?: boolean | undefined;
900
+ }) | undefined) => ZodDate;
901
+ declare const symbolType: (params?: RawCreateParams) => ZodSymbol;
902
+ declare const undefinedType: (params?: RawCreateParams) => ZodUndefined;
903
+ declare const nullType: (params?: RawCreateParams) => ZodNull;
904
+ declare const anyType: (params?: RawCreateParams) => ZodAny;
905
+ declare const unknownType: (params?: RawCreateParams) => ZodUnknown;
906
+ declare const neverType: (params?: RawCreateParams) => ZodNever;
907
+ declare const voidType: (params?: RawCreateParams) => ZodVoid;
908
+ declare const arrayType: <T extends ZodTypeAny>(schema: T, params?: RawCreateParams) => ZodArray<T, "many">;
909
+ declare const objectType: <T extends ZodRawShape>(shape: T, params?: RawCreateParams) => ZodObject<T, "strip", ZodTypeAny, { [k in keyof baseObjectOutputType<T>]: baseObjectOutputType<T>[k]; }, { [k_2 in keyof objectUtil.addQuestionMarks<{ [k_1 in keyof T]: T[k_1]["_input"]; }>]: objectUtil.addQuestionMarks<{ [k_1 in keyof T]: T[k_1]["_input"]; }>[k_2]; }>;
910
+ declare const strictObjectType: <T extends ZodRawShape>(shape: T, params?: RawCreateParams) => ZodObject<T, "strict", ZodTypeAny, { [k in keyof baseObjectOutputType<T>]: baseObjectOutputType<T>[k]; }, { [k_2 in keyof objectUtil.addQuestionMarks<{ [k_1 in keyof T]: T[k_1]["_input"]; }>]: objectUtil.addQuestionMarks<{ [k_1 in keyof T]: T[k_1]["_input"]; }>[k_2]; }>;
911
+ declare const unionType: <T extends readonly [ZodTypeAny, ZodTypeAny, ...ZodTypeAny[]]>(types: T, params?: RawCreateParams) => ZodUnion<T>;
912
+ declare const discriminatedUnionType: typeof ZodDiscriminatedUnion.create;
913
+ declare const intersectionType: <T extends ZodTypeAny, U extends ZodTypeAny>(left: T, right: U, params?: RawCreateParams) => ZodIntersection<T, U>;
914
+ declare const tupleType: <T extends [] | [ZodTypeAny, ...ZodTypeAny[]]>(schemas: T, params?: RawCreateParams) => ZodTuple<T, null>;
915
+ declare const recordType: typeof ZodRecord.create;
916
+ declare const mapType: <Key extends ZodTypeAny = ZodTypeAny, Value extends ZodTypeAny = ZodTypeAny>(keyType: Key, valueType: Value, params?: RawCreateParams) => ZodMap<Key, Value>;
917
+ declare const setType: <Value extends ZodTypeAny = ZodTypeAny>(valueType: Value, params?: RawCreateParams) => ZodSet<Value>;
918
+ declare const functionType: typeof ZodFunction.create;
919
+ declare const lazyType: <T extends ZodTypeAny>(getter: () => T, params?: RawCreateParams) => ZodLazy<T>;
920
+ declare const literalType: <T extends Primitive>(value: T, params?: RawCreateParams) => ZodLiteral<T>;
921
+ declare const enumType: typeof createZodEnum;
922
+ declare const nativeEnumType: <T extends EnumLike>(values: T, params?: RawCreateParams) => ZodNativeEnum<T>;
923
+ declare const promiseType: <T extends ZodTypeAny>(schema: T, params?: RawCreateParams) => ZodPromise<T>;
924
+ declare const effectsType: <I extends ZodTypeAny>(schema: I, effect: Effect<I["_output"]>, params?: RawCreateParams) => ZodEffects<I, I["_output"], input<I>>;
925
+ declare const optionalType: <T extends ZodTypeAny>(type: T, params?: RawCreateParams) => ZodOptional<T>;
926
+ declare const nullableType: <T extends ZodTypeAny>(type: T, params?: RawCreateParams) => ZodNullable<T>;
927
+ declare const preprocessType: <I extends ZodTypeAny>(preprocess: (arg: unknown) => unknown, schema: I, params?: RawCreateParams) => ZodEffects<I, I["_output"], unknown>;
928
+ declare const pipelineType: typeof ZodPipeline.create;
929
+ declare const ostring: () => ZodOptional<ZodString>;
930
+ declare const onumber: () => ZodOptional<ZodNumber>;
931
+ declare const oboolean: () => ZodOptional<ZodBoolean>;
932
+ export declare const coerce: {
933
+ string: (params?: ({
934
+ errorMap?: ZodErrorMap | undefined;
935
+ invalid_type_error?: string | undefined;
936
+ required_error?: string | undefined;
937
+ description?: string | undefined;
938
+ } & {
939
+ coerce?: true | undefined;
940
+ }) | undefined) => ZodString;
941
+ number: (params?: ({
942
+ errorMap?: ZodErrorMap | undefined;
943
+ invalid_type_error?: string | undefined;
944
+ required_error?: string | undefined;
945
+ description?: string | undefined;
946
+ } & {
947
+ coerce?: boolean | undefined;
948
+ }) | undefined) => ZodNumber;
949
+ boolean: (params?: ({
950
+ errorMap?: ZodErrorMap | undefined;
951
+ invalid_type_error?: string | undefined;
952
+ required_error?: string | undefined;
953
+ description?: string | undefined;
954
+ } & {
955
+ coerce?: boolean | undefined;
956
+ }) | undefined) => ZodBoolean;
957
+ bigint: (params?: ({
958
+ errorMap?: ZodErrorMap | undefined;
959
+ invalid_type_error?: string | undefined;
960
+ required_error?: string | undefined;
961
+ description?: string | undefined;
962
+ } & {
963
+ coerce?: boolean | undefined;
964
+ }) | undefined) => ZodBigInt;
965
+ date: (params?: ({
966
+ errorMap?: ZodErrorMap | undefined;
967
+ invalid_type_error?: string | undefined;
968
+ required_error?: string | undefined;
969
+ description?: string | undefined;
970
+ } & {
971
+ coerce?: boolean | undefined;
972
+ }) | undefined) => ZodDate;
973
+ };
974
+ export { anyType as any, arrayType as array, bigIntType as bigint, booleanType as boolean, dateType as date, discriminatedUnionType as discriminatedUnion, effectsType as effect, enumType as enum, functionType as function, instanceOfType as instanceof, intersectionType as intersection, lazyType as lazy, literalType as literal, mapType as map, nanType as nan, nativeEnumType as nativeEnum, neverType as never, nullType as null, nullableType as nullable, numberType as number, objectType as object, oboolean, onumber, optionalType as optional, ostring, pipelineType as pipeline, preprocessType as preprocess, promiseType as promise, recordType as record, setType as set, strictObjectType as strictObject, stringType as string, symbolType as symbol, effectsType as transformer, tupleType as tuple, undefinedType as undefined, unionType as union, unknownType as unknown, voidType as void, };
975
+ export declare const NEVER: never;