@adaptive-ai/sdk 0.1.13 → 0.1.14
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.
- package/dist/server/index.d.ts +1622 -8
- package/package.json +1 -1
package/dist/server/index.d.ts
CHANGED
|
@@ -10,13 +10,1631 @@ declare const ProductKind: {
|
|
|
10
10
|
readonly IN_APP_PURCHASE: "IN_APP_PURCHASE";
|
|
11
11
|
};
|
|
12
12
|
export type ProductKind = (typeof ProductKind)[keyof typeof ProductKind];
|
|
13
|
+
export type Primitive = string | number | symbol | bigint | boolean | null | undefined;
|
|
14
|
+
export type Scalars = Primitive | Primitive[];
|
|
15
|
+
declare namespace util {
|
|
16
|
+
type AssertEqual<T, U> = (<V>() => V extends T ? 1 : 2) extends <V>() => V extends U ? 1 : 2 ? true : false;
|
|
17
|
+
export type isAny<T> = 0 extends 1 & T ? true : false;
|
|
18
|
+
export const assertEqual: <A, B>(_: AssertEqual<A, B>) => void;
|
|
19
|
+
export function assertIs<T>(_arg: T): void;
|
|
20
|
+
export function assertNever(_x: never): never;
|
|
21
|
+
export type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
|
22
|
+
export type OmitKeys<T, K extends string> = Pick<T, Exclude<keyof T, K>>;
|
|
23
|
+
export type MakePartial<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
24
|
+
export type Exactly<T, X> = T & Record<Exclude<keyof X, keyof T>, never>;
|
|
25
|
+
export type InexactPartial<T> = {
|
|
26
|
+
[k in keyof T]?: T[k] | undefined;
|
|
27
|
+
};
|
|
28
|
+
export const arrayToEnum: <T extends string, U extends [
|
|
29
|
+
T,
|
|
30
|
+
...T[]
|
|
31
|
+
]>(items: U) => {
|
|
32
|
+
[k in U[number]]: k;
|
|
33
|
+
};
|
|
34
|
+
export const getValidEnumValues: (obj: any) => any[];
|
|
35
|
+
export const objectValues: (obj: any) => any[];
|
|
36
|
+
export const objectKeys: ObjectConstructor["keys"];
|
|
37
|
+
export const find: <T>(arr: T[], checker: (arg: T) => any) => T | undefined;
|
|
38
|
+
export type identity<T> = objectUtil.identity<T>;
|
|
39
|
+
export type flatten<T> = objectUtil.flatten<T>;
|
|
40
|
+
export type noUndefined<T> = T extends undefined ? never : T;
|
|
41
|
+
export const isInteger: NumberConstructor["isInteger"];
|
|
42
|
+
export function joinValues<T extends any[]>(array: T, separator?: string): string;
|
|
43
|
+
export const jsonStringifyReplacer: (_: string, value: any) => any;
|
|
44
|
+
export {};
|
|
45
|
+
}
|
|
46
|
+
declare namespace objectUtil {
|
|
47
|
+
export type MergeShapes<U, V> = keyof U & keyof V extends never ? U & V : {
|
|
48
|
+
[k in Exclude<keyof U, keyof V>]: U[k];
|
|
49
|
+
} & V;
|
|
50
|
+
type optionalKeys<T extends object> = {
|
|
51
|
+
[k in keyof T]: undefined extends T[k] ? k : never;
|
|
52
|
+
}[keyof T];
|
|
53
|
+
type requiredKeys<T extends object> = {
|
|
54
|
+
[k in keyof T]: undefined extends T[k] ? never : k;
|
|
55
|
+
}[keyof T];
|
|
56
|
+
export type addQuestionMarks<T extends object, _O = any> = {
|
|
57
|
+
[K in requiredKeys<T>]: T[K];
|
|
58
|
+
} & {
|
|
59
|
+
[K in optionalKeys<T>]?: T[K];
|
|
60
|
+
} & {
|
|
61
|
+
[k in keyof T]?: unknown;
|
|
62
|
+
};
|
|
63
|
+
export type identity<T> = T;
|
|
64
|
+
export type flatten<T> = identity<{
|
|
65
|
+
[k in keyof T]: T[k];
|
|
66
|
+
}>;
|
|
67
|
+
export type noNeverKeys<T> = {
|
|
68
|
+
[k in keyof T]: [
|
|
69
|
+
T[k]
|
|
70
|
+
] extends [
|
|
71
|
+
never
|
|
72
|
+
] ? never : k;
|
|
73
|
+
}[keyof T];
|
|
74
|
+
export type noNever<T> = identity<{
|
|
75
|
+
[k in noNeverKeys<T>]: k extends keyof T ? T[k] : never;
|
|
76
|
+
}>;
|
|
77
|
+
export const mergeShapes: <U, T>(first: U, second: T) => T & U;
|
|
78
|
+
export type extendShape<A extends object, B extends object> = keyof A & keyof B extends never ? A & B : {
|
|
79
|
+
[K in keyof A as K extends keyof B ? never : K]: A[K];
|
|
80
|
+
} & {
|
|
81
|
+
[K in keyof B]: B[K];
|
|
82
|
+
};
|
|
83
|
+
export {};
|
|
84
|
+
}
|
|
85
|
+
declare const ZodParsedType: {
|
|
86
|
+
string: "string";
|
|
87
|
+
nan: "nan";
|
|
88
|
+
number: "number";
|
|
89
|
+
integer: "integer";
|
|
90
|
+
float: "float";
|
|
91
|
+
boolean: "boolean";
|
|
92
|
+
date: "date";
|
|
93
|
+
bigint: "bigint";
|
|
94
|
+
symbol: "symbol";
|
|
95
|
+
function: "function";
|
|
96
|
+
undefined: "undefined";
|
|
97
|
+
null: "null";
|
|
98
|
+
array: "array";
|
|
99
|
+
object: "object";
|
|
100
|
+
unknown: "unknown";
|
|
101
|
+
promise: "promise";
|
|
102
|
+
void: "void";
|
|
103
|
+
never: "never";
|
|
104
|
+
map: "map";
|
|
105
|
+
set: "set";
|
|
106
|
+
};
|
|
107
|
+
export type ZodParsedType = keyof typeof ZodParsedType;
|
|
108
|
+
declare const getParsedType: (data: any) => ZodParsedType;
|
|
13
109
|
export type allKeys<T> = T extends any ? keyof T : never;
|
|
110
|
+
export type inferFlattenedErrors<T extends ZodType<any, any, any>, U = string> = typeToFlattenedError<TypeOf<T>, U>;
|
|
14
111
|
export type typeToFlattenedError<T, U = string> = {
|
|
15
112
|
formErrors: U[];
|
|
16
113
|
fieldErrors: {
|
|
17
114
|
[P in allKeys<T>]?: U[];
|
|
18
115
|
};
|
|
19
116
|
};
|
|
117
|
+
declare const ZodIssueCode: {
|
|
118
|
+
invalid_type: "invalid_type";
|
|
119
|
+
invalid_literal: "invalid_literal";
|
|
120
|
+
custom: "custom";
|
|
121
|
+
invalid_union: "invalid_union";
|
|
122
|
+
invalid_union_discriminator: "invalid_union_discriminator";
|
|
123
|
+
invalid_enum_value: "invalid_enum_value";
|
|
124
|
+
unrecognized_keys: "unrecognized_keys";
|
|
125
|
+
invalid_arguments: "invalid_arguments";
|
|
126
|
+
invalid_return_type: "invalid_return_type";
|
|
127
|
+
invalid_date: "invalid_date";
|
|
128
|
+
invalid_string: "invalid_string";
|
|
129
|
+
too_small: "too_small";
|
|
130
|
+
too_big: "too_big";
|
|
131
|
+
invalid_intersection_types: "invalid_intersection_types";
|
|
132
|
+
not_multiple_of: "not_multiple_of";
|
|
133
|
+
not_finite: "not_finite";
|
|
134
|
+
};
|
|
135
|
+
export type ZodIssueCode = keyof typeof ZodIssueCode;
|
|
136
|
+
export type ZodIssueBase = {
|
|
137
|
+
path: (string | number)[];
|
|
138
|
+
message?: string | undefined;
|
|
139
|
+
};
|
|
140
|
+
export interface ZodInvalidTypeIssue extends ZodIssueBase {
|
|
141
|
+
code: typeof ZodIssueCode.invalid_type;
|
|
142
|
+
expected: ZodParsedType;
|
|
143
|
+
received: ZodParsedType;
|
|
144
|
+
}
|
|
145
|
+
export interface ZodInvalidLiteralIssue extends ZodIssueBase {
|
|
146
|
+
code: typeof ZodIssueCode.invalid_literal;
|
|
147
|
+
expected: unknown;
|
|
148
|
+
received: unknown;
|
|
149
|
+
}
|
|
150
|
+
export interface ZodUnrecognizedKeysIssue extends ZodIssueBase {
|
|
151
|
+
code: typeof ZodIssueCode.unrecognized_keys;
|
|
152
|
+
keys: string[];
|
|
153
|
+
}
|
|
154
|
+
export interface ZodInvalidUnionIssue extends ZodIssueBase {
|
|
155
|
+
code: typeof ZodIssueCode.invalid_union;
|
|
156
|
+
unionErrors: ZodError[];
|
|
157
|
+
}
|
|
158
|
+
export interface ZodInvalidUnionDiscriminatorIssue extends ZodIssueBase {
|
|
159
|
+
code: typeof ZodIssueCode.invalid_union_discriminator;
|
|
160
|
+
options: Primitive[];
|
|
161
|
+
}
|
|
162
|
+
export interface ZodInvalidEnumValueIssue extends ZodIssueBase {
|
|
163
|
+
received: string | number;
|
|
164
|
+
code: typeof ZodIssueCode.invalid_enum_value;
|
|
165
|
+
options: (string | number)[];
|
|
166
|
+
}
|
|
167
|
+
export interface ZodInvalidArgumentsIssue extends ZodIssueBase {
|
|
168
|
+
code: typeof ZodIssueCode.invalid_arguments;
|
|
169
|
+
argumentsError: ZodError;
|
|
170
|
+
}
|
|
171
|
+
export interface ZodInvalidReturnTypeIssue extends ZodIssueBase {
|
|
172
|
+
code: typeof ZodIssueCode.invalid_return_type;
|
|
173
|
+
returnTypeError: ZodError;
|
|
174
|
+
}
|
|
175
|
+
export interface ZodInvalidDateIssue extends ZodIssueBase {
|
|
176
|
+
code: typeof ZodIssueCode.invalid_date;
|
|
177
|
+
}
|
|
178
|
+
export type StringValidation = "email" | "url" | "emoji" | "uuid" | "nanoid" | "regex" | "cuid" | "cuid2" | "ulid" | "datetime" | "date" | "time" | "duration" | "ip" | "cidr" | "base64" | "jwt" | "base64url" | {
|
|
179
|
+
includes: string;
|
|
180
|
+
position?: number | undefined;
|
|
181
|
+
} | {
|
|
182
|
+
startsWith: string;
|
|
183
|
+
} | {
|
|
184
|
+
endsWith: string;
|
|
185
|
+
};
|
|
186
|
+
export interface ZodInvalidStringIssue extends ZodIssueBase {
|
|
187
|
+
code: typeof ZodIssueCode.invalid_string;
|
|
188
|
+
validation: StringValidation;
|
|
189
|
+
}
|
|
190
|
+
export interface ZodTooSmallIssue extends ZodIssueBase {
|
|
191
|
+
code: typeof ZodIssueCode.too_small;
|
|
192
|
+
minimum: number | bigint;
|
|
193
|
+
inclusive: boolean;
|
|
194
|
+
exact?: boolean;
|
|
195
|
+
type: "array" | "string" | "number" | "set" | "date" | "bigint";
|
|
196
|
+
}
|
|
197
|
+
export interface ZodTooBigIssue extends ZodIssueBase {
|
|
198
|
+
code: typeof ZodIssueCode.too_big;
|
|
199
|
+
maximum: number | bigint;
|
|
200
|
+
inclusive: boolean;
|
|
201
|
+
exact?: boolean;
|
|
202
|
+
type: "array" | "string" | "number" | "set" | "date" | "bigint";
|
|
203
|
+
}
|
|
204
|
+
export interface ZodInvalidIntersectionTypesIssue extends ZodIssueBase {
|
|
205
|
+
code: typeof ZodIssueCode.invalid_intersection_types;
|
|
206
|
+
}
|
|
207
|
+
export interface ZodNotMultipleOfIssue extends ZodIssueBase {
|
|
208
|
+
code: typeof ZodIssueCode.not_multiple_of;
|
|
209
|
+
multipleOf: number | bigint;
|
|
210
|
+
}
|
|
211
|
+
export interface ZodNotFiniteIssue extends ZodIssueBase {
|
|
212
|
+
code: typeof ZodIssueCode.not_finite;
|
|
213
|
+
}
|
|
214
|
+
export interface ZodCustomIssue extends ZodIssueBase {
|
|
215
|
+
code: typeof ZodIssueCode.custom;
|
|
216
|
+
params?: {
|
|
217
|
+
[k: string]: any;
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
export type DenormalizedError = {
|
|
221
|
+
[k: string]: DenormalizedError | string[];
|
|
222
|
+
};
|
|
223
|
+
export type ZodIssueOptionalMessage = ZodInvalidTypeIssue | ZodInvalidLiteralIssue | ZodUnrecognizedKeysIssue | ZodInvalidUnionIssue | ZodInvalidUnionDiscriminatorIssue | ZodInvalidEnumValueIssue | ZodInvalidArgumentsIssue | ZodInvalidReturnTypeIssue | ZodInvalidDateIssue | ZodInvalidStringIssue | ZodTooSmallIssue | ZodTooBigIssue | ZodInvalidIntersectionTypesIssue | ZodNotMultipleOfIssue | ZodNotFiniteIssue | ZodCustomIssue;
|
|
224
|
+
export type ZodIssue = ZodIssueOptionalMessage & {
|
|
225
|
+
fatal?: boolean | undefined;
|
|
226
|
+
message: string;
|
|
227
|
+
};
|
|
228
|
+
declare const quotelessJson: (obj: any) => string;
|
|
229
|
+
export type recursiveZodFormattedError<T> = T extends [
|
|
230
|
+
any,
|
|
231
|
+
...any[]
|
|
232
|
+
] ? {
|
|
233
|
+
[K in keyof T]?: ZodFormattedError<T[K]>;
|
|
234
|
+
} : T extends any[] ? {
|
|
235
|
+
[k: number]: ZodFormattedError<T[number]>;
|
|
236
|
+
} : T extends object ? {
|
|
237
|
+
[K in keyof T]?: ZodFormattedError<T[K]>;
|
|
238
|
+
} : unknown;
|
|
239
|
+
export type ZodFormattedError<T, U = string> = {
|
|
240
|
+
_errors: U[];
|
|
241
|
+
} & recursiveZodFormattedError<NonNullable<T>>;
|
|
242
|
+
export type inferFormattedError<T extends ZodType<any, any, any>, U = string> = ZodFormattedError<TypeOf<T>, U>;
|
|
243
|
+
declare class ZodError<T = any> extends Error {
|
|
244
|
+
issues: ZodIssue[];
|
|
245
|
+
get errors(): ZodIssue[];
|
|
246
|
+
constructor(issues: ZodIssue[]);
|
|
247
|
+
format(): ZodFormattedError<T>;
|
|
248
|
+
format<U>(mapper: (issue: ZodIssue) => U): ZodFormattedError<T, U>;
|
|
249
|
+
static create: (issues: ZodIssue[]) => ZodError<any>;
|
|
250
|
+
static assert(value: unknown): asserts value is ZodError;
|
|
251
|
+
toString(): string;
|
|
252
|
+
get message(): string;
|
|
253
|
+
get isEmpty(): boolean;
|
|
254
|
+
addIssue: (sub: ZodIssue) => void;
|
|
255
|
+
addIssues: (subs?: ZodIssue[]) => void;
|
|
256
|
+
flatten(): typeToFlattenedError<T>;
|
|
257
|
+
flatten<U>(mapper?: (issue: ZodIssue) => U): typeToFlattenedError<T, U>;
|
|
258
|
+
get formErrors(): typeToFlattenedError<T, string>;
|
|
259
|
+
}
|
|
260
|
+
export type stripPath<T extends object> = T extends any ? util.OmitKeys<T, "path"> : never;
|
|
261
|
+
export type IssueData = stripPath<ZodIssueOptionalMessage> & {
|
|
262
|
+
path?: (string | number)[];
|
|
263
|
+
fatal?: boolean | undefined;
|
|
264
|
+
};
|
|
265
|
+
export type ErrorMapCtx = {
|
|
266
|
+
defaultError: string;
|
|
267
|
+
data: any;
|
|
268
|
+
};
|
|
269
|
+
export type ZodErrorMap = (issue: ZodIssueOptionalMessage, _ctx: ErrorMapCtx) => {
|
|
270
|
+
message: string;
|
|
271
|
+
};
|
|
272
|
+
declare const errorMap: ZodErrorMap;
|
|
273
|
+
declare function setErrorMap(map: ZodErrorMap): void;
|
|
274
|
+
declare function getErrorMap(): ZodErrorMap;
|
|
275
|
+
declare const makeIssue: (params: {
|
|
276
|
+
data: any;
|
|
277
|
+
path: (string | number)[];
|
|
278
|
+
errorMaps: ZodErrorMap[];
|
|
279
|
+
issueData: IssueData;
|
|
280
|
+
}) => ZodIssue;
|
|
281
|
+
export type ParseParams = {
|
|
282
|
+
path: (string | number)[];
|
|
283
|
+
errorMap: ZodErrorMap;
|
|
284
|
+
async: boolean;
|
|
285
|
+
};
|
|
286
|
+
export type ParsePathComponent = string | number;
|
|
287
|
+
export type ParsePath = ParsePathComponent[];
|
|
288
|
+
declare const EMPTY_PATH: ParsePath;
|
|
289
|
+
export interface ParseContext {
|
|
290
|
+
readonly common: {
|
|
291
|
+
readonly issues: ZodIssue[];
|
|
292
|
+
readonly contextualErrorMap?: ZodErrorMap | undefined;
|
|
293
|
+
readonly async: boolean;
|
|
294
|
+
};
|
|
295
|
+
readonly path: ParsePath;
|
|
296
|
+
readonly schemaErrorMap?: ZodErrorMap | undefined;
|
|
297
|
+
readonly parent: ParseContext | null;
|
|
298
|
+
readonly data: any;
|
|
299
|
+
readonly parsedType: ZodParsedType;
|
|
300
|
+
}
|
|
301
|
+
export type ParseInput = {
|
|
302
|
+
data: any;
|
|
303
|
+
path: (string | number)[];
|
|
304
|
+
parent: ParseContext;
|
|
305
|
+
};
|
|
306
|
+
declare function addIssueToContext(ctx: ParseContext, issueData: IssueData): void;
|
|
307
|
+
export type ObjectPair = {
|
|
308
|
+
key: SyncParseReturnType<any>;
|
|
309
|
+
value: SyncParseReturnType<any>;
|
|
310
|
+
};
|
|
311
|
+
declare class ParseStatus {
|
|
312
|
+
value: "aborted" | "dirty" | "valid";
|
|
313
|
+
dirty(): void;
|
|
314
|
+
abort(): void;
|
|
315
|
+
static mergeArray(status: ParseStatus, results: SyncParseReturnType<any>[]): SyncParseReturnType;
|
|
316
|
+
static mergeObjectAsync(status: ParseStatus, pairs: {
|
|
317
|
+
key: ParseReturnType<any>;
|
|
318
|
+
value: ParseReturnType<any>;
|
|
319
|
+
}[]): Promise<SyncParseReturnType<any>>;
|
|
320
|
+
static mergeObjectSync(status: ParseStatus, pairs: {
|
|
321
|
+
key: SyncParseReturnType<any>;
|
|
322
|
+
value: SyncParseReturnType<any>;
|
|
323
|
+
alwaysSet?: boolean;
|
|
324
|
+
}[]): SyncParseReturnType;
|
|
325
|
+
}
|
|
326
|
+
export interface ParseResult {
|
|
327
|
+
status: "aborted" | "dirty" | "valid";
|
|
328
|
+
data: any;
|
|
329
|
+
}
|
|
330
|
+
export type INVALID = {
|
|
331
|
+
status: "aborted";
|
|
332
|
+
};
|
|
333
|
+
declare const INVALID: INVALID;
|
|
334
|
+
export type DIRTY<T> = {
|
|
335
|
+
status: "dirty";
|
|
336
|
+
value: T;
|
|
337
|
+
};
|
|
338
|
+
declare const DIRTY: <T>(value: T) => DIRTY<T>;
|
|
339
|
+
export type OK<T> = {
|
|
340
|
+
status: "valid";
|
|
341
|
+
value: T;
|
|
342
|
+
};
|
|
343
|
+
declare const OK: <T>(value: T) => OK<T>;
|
|
344
|
+
export type SyncParseReturnType<T = any> = OK<T> | DIRTY<T> | INVALID;
|
|
345
|
+
export type AsyncParseReturnType<T> = Promise<SyncParseReturnType<T>>;
|
|
346
|
+
export type ParseReturnType<T> = SyncParseReturnType<T> | AsyncParseReturnType<T>;
|
|
347
|
+
declare const isAborted: (x: ParseReturnType<any>) => x is INVALID;
|
|
348
|
+
declare const isDirty: <T>(x: ParseReturnType<T>) => x is OK<T> | DIRTY<T>;
|
|
349
|
+
declare const isValid: <T>(x: ParseReturnType<T>) => x is OK<T>;
|
|
350
|
+
declare const isAsync: <T>(x: ParseReturnType<T>) => x is AsyncParseReturnType<T>;
|
|
351
|
+
declare namespace enumUtil {
|
|
352
|
+
type UnionToIntersectionFn<T> = (T extends unknown ? (k: () => T) => void : never) extends (k: infer Intersection) => void ? Intersection : never;
|
|
353
|
+
type GetUnionLast<T> = UnionToIntersectionFn<T> extends () => infer Last ? Last : never;
|
|
354
|
+
type UnionToTuple<T, Tuple extends unknown[] = [
|
|
355
|
+
]> = [
|
|
356
|
+
T
|
|
357
|
+
] extends [
|
|
358
|
+
never
|
|
359
|
+
] ? Tuple : UnionToTuple<Exclude<T, GetUnionLast<T>>, [
|
|
360
|
+
GetUnionLast<T>,
|
|
361
|
+
...Tuple
|
|
362
|
+
]>;
|
|
363
|
+
type CastToStringTuple<T> = T extends [
|
|
364
|
+
string,
|
|
365
|
+
...string[]
|
|
366
|
+
] ? T : never;
|
|
367
|
+
export type UnionToTupleString<T> = CastToStringTuple<UnionToTuple<T>>;
|
|
368
|
+
export {};
|
|
369
|
+
}
|
|
370
|
+
declare namespace errorUtil {
|
|
371
|
+
type ErrMessage = string | {
|
|
372
|
+
message?: string | undefined;
|
|
373
|
+
};
|
|
374
|
+
const errToObj: (message?: ErrMessage) => {
|
|
375
|
+
message?: string | undefined;
|
|
376
|
+
};
|
|
377
|
+
const toString: (message?: ErrMessage) => string | undefined;
|
|
378
|
+
}
|
|
379
|
+
declare namespace partialUtil {
|
|
380
|
+
type DeepPartial<T extends ZodTypeAny> = T extends ZodObject<ZodRawShape> ? ZodObject<{
|
|
381
|
+
[k in keyof T["shape"]]: ZodOptional<DeepPartial<T["shape"][k]>>;
|
|
382
|
+
}, T["_def"]["unknownKeys"], T["_def"]["catchall"]> : T extends ZodArray<infer Type, infer Card> ? ZodArray<DeepPartial<Type>, Card> : T extends ZodOptional<infer Type> ? ZodOptional<DeepPartial<Type>> : T extends ZodNullable<infer Type> ? ZodNullable<DeepPartial<Type>> : T extends ZodTuple<infer Items> ? {
|
|
383
|
+
[k in keyof Items]: Items[k] extends ZodTypeAny ? DeepPartial<Items[k]> : never;
|
|
384
|
+
} extends infer PI ? PI extends ZodTupleItems ? ZodTuple<PI> : never : never : T;
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* The Standard Schema interface.
|
|
388
|
+
*/
|
|
389
|
+
export type StandardSchemaV1<Input = unknown, Output = Input> = {
|
|
390
|
+
/**
|
|
391
|
+
* The Standard Schema properties.
|
|
392
|
+
*/
|
|
393
|
+
readonly "~standard": StandardSchemaV1.Props<Input, Output>;
|
|
394
|
+
};
|
|
395
|
+
declare namespace StandardSchemaV1 {
|
|
396
|
+
/**
|
|
397
|
+
* The Standard Schema properties interface.
|
|
398
|
+
*/
|
|
399
|
+
export interface Props<Input = unknown, Output = Input> {
|
|
400
|
+
/**
|
|
401
|
+
* The version number of the standard.
|
|
402
|
+
*/
|
|
403
|
+
readonly version: 1;
|
|
404
|
+
/**
|
|
405
|
+
* The vendor name of the schema library.
|
|
406
|
+
*/
|
|
407
|
+
readonly vendor: string;
|
|
408
|
+
/**
|
|
409
|
+
* Validates unknown input values.
|
|
410
|
+
*/
|
|
411
|
+
readonly validate: (value: unknown) => Result<Output> | Promise<Result<Output>>;
|
|
412
|
+
/**
|
|
413
|
+
* Inferred types associated with the schema.
|
|
414
|
+
*/
|
|
415
|
+
readonly types?: Types<Input, Output> | undefined;
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* The result interface of the validate function.
|
|
419
|
+
*/
|
|
420
|
+
export type Result<Output> = SuccessResult<Output> | FailureResult;
|
|
421
|
+
/**
|
|
422
|
+
* The result interface if validation succeeds.
|
|
423
|
+
*/
|
|
424
|
+
export interface SuccessResult<Output> {
|
|
425
|
+
/**
|
|
426
|
+
* The typed output value.
|
|
427
|
+
*/
|
|
428
|
+
readonly value: Output;
|
|
429
|
+
/**
|
|
430
|
+
* The non-existent issues.
|
|
431
|
+
*/
|
|
432
|
+
readonly issues?: undefined;
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* The result interface if validation fails.
|
|
436
|
+
*/
|
|
437
|
+
export interface FailureResult {
|
|
438
|
+
/**
|
|
439
|
+
* The issues of failed validation.
|
|
440
|
+
*/
|
|
441
|
+
readonly issues: ReadonlyArray<Issue>;
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* The issue interface of the failure output.
|
|
445
|
+
*/
|
|
446
|
+
export interface Issue {
|
|
447
|
+
/**
|
|
448
|
+
* The error message of the issue.
|
|
449
|
+
*/
|
|
450
|
+
readonly message: string;
|
|
451
|
+
/**
|
|
452
|
+
* The path of the issue, if any.
|
|
453
|
+
*/
|
|
454
|
+
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* The path segment interface of the issue.
|
|
458
|
+
*/
|
|
459
|
+
export interface PathSegment {
|
|
460
|
+
/**
|
|
461
|
+
* The key representing a path segment.
|
|
462
|
+
*/
|
|
463
|
+
readonly key: PropertyKey;
|
|
464
|
+
}
|
|
465
|
+
/**
|
|
466
|
+
* The Standard Schema types interface.
|
|
467
|
+
*/
|
|
468
|
+
export interface Types<Input = unknown, Output = Input> {
|
|
469
|
+
/**
|
|
470
|
+
* The input type of the schema.
|
|
471
|
+
*/
|
|
472
|
+
readonly input: Input;
|
|
473
|
+
/**
|
|
474
|
+
* The output type of the schema.
|
|
475
|
+
*/
|
|
476
|
+
readonly output: Output;
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* Infers the input type of a Standard Schema.
|
|
480
|
+
*/
|
|
481
|
+
export type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["input"];
|
|
482
|
+
/**
|
|
483
|
+
* Infers the output type of a Standard Schema.
|
|
484
|
+
*/
|
|
485
|
+
export type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["output"];
|
|
486
|
+
export {};
|
|
487
|
+
}
|
|
488
|
+
export interface RefinementCtx {
|
|
489
|
+
addIssue: (arg: IssueData) => void;
|
|
490
|
+
path: (string | number)[];
|
|
491
|
+
}
|
|
492
|
+
export type ZodRawShape = {
|
|
493
|
+
[k: string]: ZodTypeAny;
|
|
494
|
+
};
|
|
495
|
+
export type ZodTypeAny = ZodType<any, any, any>;
|
|
496
|
+
export type TypeOf<T extends ZodType<any, any, any>> = T["_output"];
|
|
497
|
+
export type input<T extends ZodType<any, any, any>> = T["_input"];
|
|
498
|
+
export type output<T extends ZodType<any, any, any>> = T["_output"];
|
|
499
|
+
export type CustomErrorParams = Partial<util.Omit<ZodCustomIssue, "code">>;
|
|
500
|
+
export interface ZodTypeDef {
|
|
501
|
+
errorMap?: ZodErrorMap | undefined;
|
|
502
|
+
description?: string | undefined;
|
|
503
|
+
}
|
|
504
|
+
export type RawCreateParams = {
|
|
505
|
+
errorMap?: ZodErrorMap | undefined;
|
|
506
|
+
invalid_type_error?: string | undefined;
|
|
507
|
+
required_error?: string | undefined;
|
|
508
|
+
message?: string | undefined;
|
|
509
|
+
description?: string | undefined;
|
|
510
|
+
} | undefined;
|
|
511
|
+
export type ProcessedCreateParams = {
|
|
512
|
+
errorMap?: ZodErrorMap | undefined;
|
|
513
|
+
description?: string | undefined;
|
|
514
|
+
};
|
|
515
|
+
export type SafeParseSuccess<Output> = {
|
|
516
|
+
success: true;
|
|
517
|
+
data: Output;
|
|
518
|
+
error?: never;
|
|
519
|
+
};
|
|
520
|
+
export type SafeParseError<Input> = {
|
|
521
|
+
success: false;
|
|
522
|
+
error: ZodError<Input>;
|
|
523
|
+
data?: never;
|
|
524
|
+
};
|
|
525
|
+
export type SafeParseReturnType<Input, Output> = SafeParseSuccess<Output> | SafeParseError<Input>;
|
|
526
|
+
declare abstract class ZodType<Output = any, Def extends ZodTypeDef = ZodTypeDef, Input = Output> {
|
|
527
|
+
readonly _type: Output;
|
|
528
|
+
readonly _output: Output;
|
|
529
|
+
readonly _input: Input;
|
|
530
|
+
readonly _def: Def;
|
|
531
|
+
get description(): string | undefined;
|
|
532
|
+
"~standard": StandardSchemaV1.Props<Input, Output>;
|
|
533
|
+
abstract _parse(input: ParseInput): ParseReturnType<Output>;
|
|
534
|
+
_getType(input: ParseInput): string;
|
|
535
|
+
_getOrReturnCtx(input: ParseInput, ctx?: ParseContext | undefined): ParseContext;
|
|
536
|
+
_processInputParams(input: ParseInput): {
|
|
537
|
+
status: ParseStatus;
|
|
538
|
+
ctx: ParseContext;
|
|
539
|
+
};
|
|
540
|
+
_parseSync(input: ParseInput): SyncParseReturnType<Output>;
|
|
541
|
+
_parseAsync(input: ParseInput): AsyncParseReturnType<Output>;
|
|
542
|
+
parse(data: unknown, params?: util.InexactPartial<ParseParams>): Output;
|
|
543
|
+
safeParse(data: unknown, params?: util.InexactPartial<ParseParams>): SafeParseReturnType<Input, Output>;
|
|
544
|
+
"~validate"(data: unknown): StandardSchemaV1.Result<Output> | Promise<StandardSchemaV1.Result<Output>>;
|
|
545
|
+
parseAsync(data: unknown, params?: util.InexactPartial<ParseParams>): Promise<Output>;
|
|
546
|
+
safeParseAsync(data: unknown, params?: util.InexactPartial<ParseParams>): Promise<SafeParseReturnType<Input, Output>>;
|
|
547
|
+
/** Alias of safeParseAsync */
|
|
548
|
+
spa: (data: unknown, params?: util.InexactPartial<ParseParams>) => Promise<SafeParseReturnType<Input, Output>>;
|
|
549
|
+
refine<RefinedOutput extends Output>(check: (arg: Output) => arg is RefinedOutput, message?: string | CustomErrorParams | ((arg: Output) => CustomErrorParams)): ZodEffects<this, RefinedOutput, Input>;
|
|
550
|
+
refine(check: (arg: Output) => unknown | Promise<unknown>, message?: string | CustomErrorParams | ((arg: Output) => CustomErrorParams)): ZodEffects<this, Output, Input>;
|
|
551
|
+
refinement<RefinedOutput extends Output>(check: (arg: Output) => arg is RefinedOutput, refinementData: IssueData | ((arg: Output, ctx: RefinementCtx) => IssueData)): ZodEffects<this, RefinedOutput, Input>;
|
|
552
|
+
refinement(check: (arg: Output) => boolean, refinementData: IssueData | ((arg: Output, ctx: RefinementCtx) => IssueData)): ZodEffects<this, Output, Input>;
|
|
553
|
+
_refinement(refinement: RefinementEffect<Output>["refinement"]): ZodEffects<this, Output, Input>;
|
|
554
|
+
superRefine<RefinedOutput extends Output>(refinement: (arg: Output, ctx: RefinementCtx) => arg is RefinedOutput): ZodEffects<this, RefinedOutput, Input>;
|
|
555
|
+
superRefine(refinement: (arg: Output, ctx: RefinementCtx) => void): ZodEffects<this, Output, Input>;
|
|
556
|
+
superRefine(refinement: (arg: Output, ctx: RefinementCtx) => Promise<void>): ZodEffects<this, Output, Input>;
|
|
557
|
+
constructor(def: Def);
|
|
558
|
+
optional(): ZodOptional<this>;
|
|
559
|
+
nullable(): ZodNullable<this>;
|
|
560
|
+
nullish(): ZodOptional<ZodNullable<this>>;
|
|
561
|
+
array(): ZodArray<this>;
|
|
562
|
+
promise(): ZodPromise<this>;
|
|
563
|
+
or<T extends ZodTypeAny>(option: T): ZodUnion<[
|
|
564
|
+
this,
|
|
565
|
+
T
|
|
566
|
+
]>;
|
|
567
|
+
and<T extends ZodTypeAny>(incoming: T): ZodIntersection<this, T>;
|
|
568
|
+
transform<NewOut>(transform: (arg: Output, ctx: RefinementCtx) => NewOut | Promise<NewOut>): ZodEffects<this, NewOut>;
|
|
569
|
+
default(def: util.noUndefined<Input>): ZodDefault<this>;
|
|
570
|
+
default(def: () => util.noUndefined<Input>): ZodDefault<this>;
|
|
571
|
+
brand<B extends string | number | symbol>(brand?: B): ZodBranded<this, B>;
|
|
572
|
+
catch(def: Output): ZodCatch<this>;
|
|
573
|
+
catch(def: (ctx: {
|
|
574
|
+
error: ZodError;
|
|
575
|
+
input: Input;
|
|
576
|
+
}) => Output): ZodCatch<this>;
|
|
577
|
+
describe(description: string): this;
|
|
578
|
+
pipe<T extends ZodTypeAny>(target: T): ZodPipeline<this, T>;
|
|
579
|
+
readonly(): ZodReadonly<this>;
|
|
580
|
+
isOptional(): boolean;
|
|
581
|
+
isNullable(): boolean;
|
|
582
|
+
}
|
|
583
|
+
export type IpVersion = "v4" | "v6";
|
|
584
|
+
export type ZodStringCheck = {
|
|
585
|
+
kind: "min";
|
|
586
|
+
value: number;
|
|
587
|
+
message?: string | undefined;
|
|
588
|
+
} | {
|
|
589
|
+
kind: "max";
|
|
590
|
+
value: number;
|
|
591
|
+
message?: string | undefined;
|
|
592
|
+
} | {
|
|
593
|
+
kind: "length";
|
|
594
|
+
value: number;
|
|
595
|
+
message?: string | undefined;
|
|
596
|
+
} | {
|
|
597
|
+
kind: "email";
|
|
598
|
+
message?: string | undefined;
|
|
599
|
+
} | {
|
|
600
|
+
kind: "url";
|
|
601
|
+
message?: string | undefined;
|
|
602
|
+
} | {
|
|
603
|
+
kind: "emoji";
|
|
604
|
+
message?: string | undefined;
|
|
605
|
+
} | {
|
|
606
|
+
kind: "uuid";
|
|
607
|
+
message?: string | undefined;
|
|
608
|
+
} | {
|
|
609
|
+
kind: "nanoid";
|
|
610
|
+
message?: string | undefined;
|
|
611
|
+
} | {
|
|
612
|
+
kind: "cuid";
|
|
613
|
+
message?: string | undefined;
|
|
614
|
+
} | {
|
|
615
|
+
kind: "includes";
|
|
616
|
+
value: string;
|
|
617
|
+
position?: number | undefined;
|
|
618
|
+
message?: string | undefined;
|
|
619
|
+
} | {
|
|
620
|
+
kind: "cuid2";
|
|
621
|
+
message?: string | undefined;
|
|
622
|
+
} | {
|
|
623
|
+
kind: "ulid";
|
|
624
|
+
message?: string | undefined;
|
|
625
|
+
} | {
|
|
626
|
+
kind: "startsWith";
|
|
627
|
+
value: string;
|
|
628
|
+
message?: string | undefined;
|
|
629
|
+
} | {
|
|
630
|
+
kind: "endsWith";
|
|
631
|
+
value: string;
|
|
632
|
+
message?: string | undefined;
|
|
633
|
+
} | {
|
|
634
|
+
kind: "regex";
|
|
635
|
+
regex: RegExp;
|
|
636
|
+
message?: string | undefined;
|
|
637
|
+
} | {
|
|
638
|
+
kind: "trim";
|
|
639
|
+
message?: string | undefined;
|
|
640
|
+
} | {
|
|
641
|
+
kind: "toLowerCase";
|
|
642
|
+
message?: string | undefined;
|
|
643
|
+
} | {
|
|
644
|
+
kind: "toUpperCase";
|
|
645
|
+
message?: string | undefined;
|
|
646
|
+
} | {
|
|
647
|
+
kind: "jwt";
|
|
648
|
+
alg?: string;
|
|
649
|
+
message?: string | undefined;
|
|
650
|
+
} | {
|
|
651
|
+
kind: "datetime";
|
|
652
|
+
offset: boolean;
|
|
653
|
+
local: boolean;
|
|
654
|
+
precision: number | null;
|
|
655
|
+
message?: string | undefined;
|
|
656
|
+
} | {
|
|
657
|
+
kind: "date";
|
|
658
|
+
message?: string | undefined;
|
|
659
|
+
} | {
|
|
660
|
+
kind: "time";
|
|
661
|
+
precision: number | null;
|
|
662
|
+
message?: string | undefined;
|
|
663
|
+
} | {
|
|
664
|
+
kind: "duration";
|
|
665
|
+
message?: string | undefined;
|
|
666
|
+
} | {
|
|
667
|
+
kind: "ip";
|
|
668
|
+
version?: IpVersion | undefined;
|
|
669
|
+
message?: string | undefined;
|
|
670
|
+
} | {
|
|
671
|
+
kind: "cidr";
|
|
672
|
+
version?: IpVersion | undefined;
|
|
673
|
+
message?: string | undefined;
|
|
674
|
+
} | {
|
|
675
|
+
kind: "base64";
|
|
676
|
+
message?: string | undefined;
|
|
677
|
+
} | {
|
|
678
|
+
kind: "base64url";
|
|
679
|
+
message?: string | undefined;
|
|
680
|
+
};
|
|
681
|
+
export interface ZodStringDef extends ZodTypeDef {
|
|
682
|
+
checks: ZodStringCheck[];
|
|
683
|
+
typeName: ZodFirstPartyTypeKind.ZodString;
|
|
684
|
+
coerce: boolean;
|
|
685
|
+
}
|
|
686
|
+
declare function datetimeRegex(args: {
|
|
687
|
+
precision?: number | null;
|
|
688
|
+
offset?: boolean;
|
|
689
|
+
local?: boolean;
|
|
690
|
+
}): RegExp;
|
|
691
|
+
declare class ZodString extends ZodType<string, ZodStringDef, string> {
|
|
692
|
+
_parse(input: ParseInput): ParseReturnType<string>;
|
|
693
|
+
protected _regex(regex: RegExp, validation: StringValidation, message?: errorUtil.ErrMessage): ZodEffects<this, string, string>;
|
|
694
|
+
_addCheck(check: ZodStringCheck): ZodString;
|
|
695
|
+
email(message?: errorUtil.ErrMessage): ZodString;
|
|
696
|
+
url(message?: errorUtil.ErrMessage): ZodString;
|
|
697
|
+
emoji(message?: errorUtil.ErrMessage): ZodString;
|
|
698
|
+
uuid(message?: errorUtil.ErrMessage): ZodString;
|
|
699
|
+
nanoid(message?: errorUtil.ErrMessage): ZodString;
|
|
700
|
+
cuid(message?: errorUtil.ErrMessage): ZodString;
|
|
701
|
+
cuid2(message?: errorUtil.ErrMessage): ZodString;
|
|
702
|
+
ulid(message?: errorUtil.ErrMessage): ZodString;
|
|
703
|
+
base64(message?: errorUtil.ErrMessage): ZodString;
|
|
704
|
+
base64url(message?: errorUtil.ErrMessage): ZodString;
|
|
705
|
+
jwt(options?: {
|
|
706
|
+
alg?: string;
|
|
707
|
+
message?: string | undefined;
|
|
708
|
+
}): ZodString;
|
|
709
|
+
ip(options?: string | {
|
|
710
|
+
version?: IpVersion;
|
|
711
|
+
message?: string | undefined;
|
|
712
|
+
}): ZodString;
|
|
713
|
+
cidr(options?: string | {
|
|
714
|
+
version?: IpVersion;
|
|
715
|
+
message?: string | undefined;
|
|
716
|
+
}): ZodString;
|
|
717
|
+
datetime(options?: string | {
|
|
718
|
+
message?: string | undefined;
|
|
719
|
+
precision?: number | null;
|
|
720
|
+
offset?: boolean;
|
|
721
|
+
local?: boolean;
|
|
722
|
+
}): ZodString;
|
|
723
|
+
date(message?: string): ZodString;
|
|
724
|
+
time(options?: string | {
|
|
725
|
+
message?: string | undefined;
|
|
726
|
+
precision?: number | null;
|
|
727
|
+
}): ZodString;
|
|
728
|
+
duration(message?: errorUtil.ErrMessage): ZodString;
|
|
729
|
+
regex(regex: RegExp, message?: errorUtil.ErrMessage): ZodString;
|
|
730
|
+
includes(value: string, options?: {
|
|
731
|
+
message?: string;
|
|
732
|
+
position?: number;
|
|
733
|
+
}): ZodString;
|
|
734
|
+
startsWith(value: string, message?: errorUtil.ErrMessage): ZodString;
|
|
735
|
+
endsWith(value: string, message?: errorUtil.ErrMessage): ZodString;
|
|
736
|
+
min(minLength: number, message?: errorUtil.ErrMessage): ZodString;
|
|
737
|
+
max(maxLength: number, message?: errorUtil.ErrMessage): ZodString;
|
|
738
|
+
length(len: number, message?: errorUtil.ErrMessage): ZodString;
|
|
739
|
+
/**
|
|
740
|
+
* Equivalent to `.min(1)`
|
|
741
|
+
*/
|
|
742
|
+
nonempty(message?: errorUtil.ErrMessage): ZodString;
|
|
743
|
+
trim(): ZodString;
|
|
744
|
+
toLowerCase(): ZodString;
|
|
745
|
+
toUpperCase(): ZodString;
|
|
746
|
+
get isDatetime(): boolean;
|
|
747
|
+
get isDate(): boolean;
|
|
748
|
+
get isTime(): boolean;
|
|
749
|
+
get isDuration(): boolean;
|
|
750
|
+
get isEmail(): boolean;
|
|
751
|
+
get isURL(): boolean;
|
|
752
|
+
get isEmoji(): boolean;
|
|
753
|
+
get isUUID(): boolean;
|
|
754
|
+
get isNANOID(): boolean;
|
|
755
|
+
get isCUID(): boolean;
|
|
756
|
+
get isCUID2(): boolean;
|
|
757
|
+
get isULID(): boolean;
|
|
758
|
+
get isIP(): boolean;
|
|
759
|
+
get isCIDR(): boolean;
|
|
760
|
+
get isBase64(): boolean;
|
|
761
|
+
get isBase64url(): boolean;
|
|
762
|
+
get minLength(): number | null;
|
|
763
|
+
get maxLength(): number | null;
|
|
764
|
+
static create: (params?: RawCreateParams & {
|
|
765
|
+
coerce?: true;
|
|
766
|
+
}) => ZodString;
|
|
767
|
+
}
|
|
768
|
+
export type ZodNumberCheck = {
|
|
769
|
+
kind: "min";
|
|
770
|
+
value: number;
|
|
771
|
+
inclusive: boolean;
|
|
772
|
+
message?: string | undefined;
|
|
773
|
+
} | {
|
|
774
|
+
kind: "max";
|
|
775
|
+
value: number;
|
|
776
|
+
inclusive: boolean;
|
|
777
|
+
message?: string | undefined;
|
|
778
|
+
} | {
|
|
779
|
+
kind: "int";
|
|
780
|
+
message?: string | undefined;
|
|
781
|
+
} | {
|
|
782
|
+
kind: "multipleOf";
|
|
783
|
+
value: number;
|
|
784
|
+
message?: string | undefined;
|
|
785
|
+
} | {
|
|
786
|
+
kind: "finite";
|
|
787
|
+
message?: string | undefined;
|
|
788
|
+
};
|
|
789
|
+
export interface ZodNumberDef extends ZodTypeDef {
|
|
790
|
+
checks: ZodNumberCheck[];
|
|
791
|
+
typeName: ZodFirstPartyTypeKind.ZodNumber;
|
|
792
|
+
coerce: boolean;
|
|
793
|
+
}
|
|
794
|
+
declare class ZodNumber extends ZodType<number, ZodNumberDef, number> {
|
|
795
|
+
_parse(input: ParseInput): ParseReturnType<number>;
|
|
796
|
+
static create: (params?: RawCreateParams & {
|
|
797
|
+
coerce?: boolean;
|
|
798
|
+
}) => ZodNumber;
|
|
799
|
+
gte(value: number, message?: errorUtil.ErrMessage): ZodNumber;
|
|
800
|
+
min: (value: number, message?: errorUtil.ErrMessage) => ZodNumber;
|
|
801
|
+
gt(value: number, message?: errorUtil.ErrMessage): ZodNumber;
|
|
802
|
+
lte(value: number, message?: errorUtil.ErrMessage): ZodNumber;
|
|
803
|
+
max: (value: number, message?: errorUtil.ErrMessage) => ZodNumber;
|
|
804
|
+
lt(value: number, message?: errorUtil.ErrMessage): ZodNumber;
|
|
805
|
+
protected setLimit(kind: "min" | "max", value: number, inclusive: boolean, message?: string): ZodNumber;
|
|
806
|
+
_addCheck(check: ZodNumberCheck): ZodNumber;
|
|
807
|
+
int(message?: errorUtil.ErrMessage): ZodNumber;
|
|
808
|
+
positive(message?: errorUtil.ErrMessage): ZodNumber;
|
|
809
|
+
negative(message?: errorUtil.ErrMessage): ZodNumber;
|
|
810
|
+
nonpositive(message?: errorUtil.ErrMessage): ZodNumber;
|
|
811
|
+
nonnegative(message?: errorUtil.ErrMessage): ZodNumber;
|
|
812
|
+
multipleOf(value: number, message?: errorUtil.ErrMessage): ZodNumber;
|
|
813
|
+
step: (value: number, message?: errorUtil.ErrMessage) => ZodNumber;
|
|
814
|
+
finite(message?: errorUtil.ErrMessage): ZodNumber;
|
|
815
|
+
safe(message?: errorUtil.ErrMessage): ZodNumber;
|
|
816
|
+
get minValue(): number | null;
|
|
817
|
+
get maxValue(): number | null;
|
|
818
|
+
get isInt(): boolean;
|
|
819
|
+
get isFinite(): boolean;
|
|
820
|
+
}
|
|
821
|
+
export type ZodBigIntCheck = {
|
|
822
|
+
kind: "min";
|
|
823
|
+
value: bigint;
|
|
824
|
+
inclusive: boolean;
|
|
825
|
+
message?: string | undefined;
|
|
826
|
+
} | {
|
|
827
|
+
kind: "max";
|
|
828
|
+
value: bigint;
|
|
829
|
+
inclusive: boolean;
|
|
830
|
+
message?: string | undefined;
|
|
831
|
+
} | {
|
|
832
|
+
kind: "multipleOf";
|
|
833
|
+
value: bigint;
|
|
834
|
+
message?: string | undefined;
|
|
835
|
+
};
|
|
836
|
+
export interface ZodBigIntDef extends ZodTypeDef {
|
|
837
|
+
checks: ZodBigIntCheck[];
|
|
838
|
+
typeName: ZodFirstPartyTypeKind.ZodBigInt;
|
|
839
|
+
coerce: boolean;
|
|
840
|
+
}
|
|
841
|
+
declare class ZodBigInt extends ZodType<bigint, ZodBigIntDef, bigint> {
|
|
842
|
+
_parse(input: ParseInput): ParseReturnType<bigint>;
|
|
843
|
+
_getInvalidInput(input: ParseInput): INVALID;
|
|
844
|
+
static create: (params?: RawCreateParams & {
|
|
845
|
+
coerce?: boolean;
|
|
846
|
+
}) => ZodBigInt;
|
|
847
|
+
gte(value: bigint, message?: errorUtil.ErrMessage): ZodBigInt;
|
|
848
|
+
min: (value: bigint, message?: errorUtil.ErrMessage) => ZodBigInt;
|
|
849
|
+
gt(value: bigint, message?: errorUtil.ErrMessage): ZodBigInt;
|
|
850
|
+
lte(value: bigint, message?: errorUtil.ErrMessage): ZodBigInt;
|
|
851
|
+
max: (value: bigint, message?: errorUtil.ErrMessage) => ZodBigInt;
|
|
852
|
+
lt(value: bigint, message?: errorUtil.ErrMessage): ZodBigInt;
|
|
853
|
+
protected setLimit(kind: "min" | "max", value: bigint, inclusive: boolean, message?: string): ZodBigInt;
|
|
854
|
+
_addCheck(check: ZodBigIntCheck): ZodBigInt;
|
|
855
|
+
positive(message?: errorUtil.ErrMessage): ZodBigInt;
|
|
856
|
+
negative(message?: errorUtil.ErrMessage): ZodBigInt;
|
|
857
|
+
nonpositive(message?: errorUtil.ErrMessage): ZodBigInt;
|
|
858
|
+
nonnegative(message?: errorUtil.ErrMessage): ZodBigInt;
|
|
859
|
+
multipleOf(value: bigint, message?: errorUtil.ErrMessage): ZodBigInt;
|
|
860
|
+
get minValue(): bigint | null;
|
|
861
|
+
get maxValue(): bigint | null;
|
|
862
|
+
}
|
|
863
|
+
export interface ZodBooleanDef extends ZodTypeDef {
|
|
864
|
+
typeName: ZodFirstPartyTypeKind.ZodBoolean;
|
|
865
|
+
coerce: boolean;
|
|
866
|
+
}
|
|
867
|
+
declare class ZodBoolean extends ZodType<boolean, ZodBooleanDef, boolean> {
|
|
868
|
+
_parse(input: ParseInput): ParseReturnType<boolean>;
|
|
869
|
+
static create: (params?: RawCreateParams & {
|
|
870
|
+
coerce?: boolean;
|
|
871
|
+
}) => ZodBoolean;
|
|
872
|
+
}
|
|
873
|
+
export type ZodDateCheck = {
|
|
874
|
+
kind: "min";
|
|
875
|
+
value: number;
|
|
876
|
+
message?: string | undefined;
|
|
877
|
+
} | {
|
|
878
|
+
kind: "max";
|
|
879
|
+
value: number;
|
|
880
|
+
message?: string | undefined;
|
|
881
|
+
};
|
|
882
|
+
export interface ZodDateDef extends ZodTypeDef {
|
|
883
|
+
checks: ZodDateCheck[];
|
|
884
|
+
coerce: boolean;
|
|
885
|
+
typeName: ZodFirstPartyTypeKind.ZodDate;
|
|
886
|
+
}
|
|
887
|
+
declare class ZodDate extends ZodType<Date, ZodDateDef, Date> {
|
|
888
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
889
|
+
_addCheck(check: ZodDateCheck): ZodDate;
|
|
890
|
+
min(minDate: Date, message?: errorUtil.ErrMessage): ZodDate;
|
|
891
|
+
max(maxDate: Date, message?: errorUtil.ErrMessage): ZodDate;
|
|
892
|
+
get minDate(): Date | null;
|
|
893
|
+
get maxDate(): Date | null;
|
|
894
|
+
static create: (params?: RawCreateParams & {
|
|
895
|
+
coerce?: boolean;
|
|
896
|
+
}) => ZodDate;
|
|
897
|
+
}
|
|
898
|
+
export interface ZodSymbolDef extends ZodTypeDef {
|
|
899
|
+
typeName: ZodFirstPartyTypeKind.ZodSymbol;
|
|
900
|
+
}
|
|
901
|
+
declare class ZodSymbol extends ZodType<symbol, ZodSymbolDef, symbol> {
|
|
902
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
903
|
+
static create: (params?: RawCreateParams) => ZodSymbol;
|
|
904
|
+
}
|
|
905
|
+
export interface ZodUndefinedDef extends ZodTypeDef {
|
|
906
|
+
typeName: ZodFirstPartyTypeKind.ZodUndefined;
|
|
907
|
+
}
|
|
908
|
+
declare class ZodUndefined extends ZodType<undefined, ZodUndefinedDef, undefined> {
|
|
909
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
910
|
+
params?: RawCreateParams;
|
|
911
|
+
static create: (params?: RawCreateParams) => ZodUndefined;
|
|
912
|
+
}
|
|
913
|
+
export interface ZodNullDef extends ZodTypeDef {
|
|
914
|
+
typeName: ZodFirstPartyTypeKind.ZodNull;
|
|
915
|
+
}
|
|
916
|
+
declare class ZodNull extends ZodType<null, ZodNullDef, null> {
|
|
917
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
918
|
+
static create: (params?: RawCreateParams) => ZodNull;
|
|
919
|
+
}
|
|
920
|
+
export interface ZodAnyDef extends ZodTypeDef {
|
|
921
|
+
typeName: ZodFirstPartyTypeKind.ZodAny;
|
|
922
|
+
}
|
|
923
|
+
declare class ZodAny extends ZodType<any, ZodAnyDef, any> {
|
|
924
|
+
_any: true;
|
|
925
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
926
|
+
static create: (params?: RawCreateParams) => ZodAny;
|
|
927
|
+
}
|
|
928
|
+
export interface ZodUnknownDef extends ZodTypeDef {
|
|
929
|
+
typeName: ZodFirstPartyTypeKind.ZodUnknown;
|
|
930
|
+
}
|
|
931
|
+
declare class ZodUnknown extends ZodType<unknown, ZodUnknownDef, unknown> {
|
|
932
|
+
_unknown: true;
|
|
933
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
934
|
+
static create: (params?: RawCreateParams) => ZodUnknown;
|
|
935
|
+
}
|
|
936
|
+
export interface ZodNeverDef extends ZodTypeDef {
|
|
937
|
+
typeName: ZodFirstPartyTypeKind.ZodNever;
|
|
938
|
+
}
|
|
939
|
+
declare class ZodNever extends ZodType<never, ZodNeverDef, never> {
|
|
940
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
941
|
+
static create: (params?: RawCreateParams) => ZodNever;
|
|
942
|
+
}
|
|
943
|
+
export interface ZodVoidDef extends ZodTypeDef {
|
|
944
|
+
typeName: ZodFirstPartyTypeKind.ZodVoid;
|
|
945
|
+
}
|
|
946
|
+
declare class ZodVoid extends ZodType<void, ZodVoidDef, void> {
|
|
947
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
948
|
+
static create: (params?: RawCreateParams) => ZodVoid;
|
|
949
|
+
}
|
|
950
|
+
export interface ZodArrayDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
951
|
+
type: T;
|
|
952
|
+
typeName: ZodFirstPartyTypeKind.ZodArray;
|
|
953
|
+
exactLength: {
|
|
954
|
+
value: number;
|
|
955
|
+
message?: string | undefined;
|
|
956
|
+
} | null;
|
|
957
|
+
minLength: {
|
|
958
|
+
value: number;
|
|
959
|
+
message?: string | undefined;
|
|
960
|
+
} | null;
|
|
961
|
+
maxLength: {
|
|
962
|
+
value: number;
|
|
963
|
+
message?: string | undefined;
|
|
964
|
+
} | null;
|
|
965
|
+
}
|
|
966
|
+
export type ArrayCardinality = "many" | "atleastone";
|
|
967
|
+
export type arrayOutputType<T extends ZodTypeAny, Cardinality extends ArrayCardinality = "many"> = Cardinality extends "atleastone" ? [
|
|
968
|
+
T["_output"],
|
|
969
|
+
...T["_output"][]
|
|
970
|
+
] : T["_output"][];
|
|
971
|
+
declare class ZodArray<T extends ZodTypeAny, Cardinality extends ArrayCardinality = "many"> extends ZodType<arrayOutputType<T, Cardinality>, ZodArrayDef<T>, Cardinality extends "atleastone" ? [
|
|
972
|
+
T["_input"],
|
|
973
|
+
...T["_input"][]
|
|
974
|
+
] : T["_input"][]> {
|
|
975
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
976
|
+
get element(): T;
|
|
977
|
+
min(minLength: number, message?: errorUtil.ErrMessage): this;
|
|
978
|
+
max(maxLength: number, message?: errorUtil.ErrMessage): this;
|
|
979
|
+
length(len: number, message?: errorUtil.ErrMessage): this;
|
|
980
|
+
nonempty(message?: errorUtil.ErrMessage): ZodArray<T, "atleastone">;
|
|
981
|
+
static create: <El extends ZodTypeAny>(schema: El, params?: RawCreateParams) => ZodArray<El>;
|
|
982
|
+
}
|
|
983
|
+
export type ZodNonEmptyArray<T extends ZodTypeAny> = ZodArray<T, "atleastone">;
|
|
984
|
+
export type UnknownKeysParam = "passthrough" | "strict" | "strip";
|
|
985
|
+
export interface ZodObjectDef<T extends ZodRawShape = ZodRawShape, UnknownKeys extends UnknownKeysParam = UnknownKeysParam, Catchall extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
986
|
+
typeName: ZodFirstPartyTypeKind.ZodObject;
|
|
987
|
+
shape: () => T;
|
|
988
|
+
catchall: Catchall;
|
|
989
|
+
unknownKeys: UnknownKeys;
|
|
990
|
+
}
|
|
991
|
+
export type mergeTypes<A, B> = {
|
|
992
|
+
[k in keyof A | keyof B]: k extends keyof B ? B[k] : k extends keyof A ? A[k] : never;
|
|
993
|
+
};
|
|
994
|
+
export type objectOutputType<Shape extends ZodRawShape, Catchall extends ZodTypeAny, UnknownKeys extends UnknownKeysParam = UnknownKeysParam> = objectUtil.flatten<objectUtil.addQuestionMarks<baseObjectOutputType<Shape>>> & CatchallOutput<Catchall> & PassthroughType<UnknownKeys>;
|
|
995
|
+
export type baseObjectOutputType<Shape extends ZodRawShape> = {
|
|
996
|
+
[k in keyof Shape]: Shape[k]["_output"];
|
|
997
|
+
};
|
|
998
|
+
export type objectInputType<Shape extends ZodRawShape, Catchall extends ZodTypeAny, UnknownKeys extends UnknownKeysParam = UnknownKeysParam> = objectUtil.flatten<baseObjectInputType<Shape>> & CatchallInput<Catchall> & PassthroughType<UnknownKeys>;
|
|
999
|
+
export type baseObjectInputType<Shape extends ZodRawShape> = objectUtil.addQuestionMarks<{
|
|
1000
|
+
[k in keyof Shape]: Shape[k]["_input"];
|
|
1001
|
+
}>;
|
|
1002
|
+
export type CatchallOutput<T extends ZodType> = ZodType extends T ? unknown : {
|
|
1003
|
+
[k: string]: T["_output"];
|
|
1004
|
+
};
|
|
1005
|
+
export type CatchallInput<T extends ZodType> = ZodType extends T ? unknown : {
|
|
1006
|
+
[k: string]: T["_input"];
|
|
1007
|
+
};
|
|
1008
|
+
export type PassthroughType<T extends UnknownKeysParam> = T extends "passthrough" ? {
|
|
1009
|
+
[k: string]: unknown;
|
|
1010
|
+
} : unknown;
|
|
1011
|
+
export type deoptional<T extends ZodTypeAny> = T extends ZodOptional<infer U> ? deoptional<U> : T extends ZodNullable<infer U> ? ZodNullable<deoptional<U>> : T;
|
|
1012
|
+
export type SomeZodObject = ZodObject<ZodRawShape, UnknownKeysParam, ZodTypeAny>;
|
|
1013
|
+
export type noUnrecognized<Obj extends object, Shape extends object> = {
|
|
1014
|
+
[k in keyof Obj]: k extends keyof Shape ? Obj[k] : never;
|
|
1015
|
+
};
|
|
1016
|
+
declare class ZodObject<T extends ZodRawShape, UnknownKeys extends UnknownKeysParam = UnknownKeysParam, Catchall extends ZodTypeAny = ZodTypeAny, Output = objectOutputType<T, Catchall, UnknownKeys>, Input = objectInputType<T, Catchall, UnknownKeys>> extends ZodType<Output, ZodObjectDef<T, UnknownKeys, Catchall>, Input> {
|
|
1017
|
+
private _cached;
|
|
1018
|
+
_getCached(): {
|
|
1019
|
+
shape: T;
|
|
1020
|
+
keys: string[];
|
|
1021
|
+
};
|
|
1022
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1023
|
+
get shape(): T;
|
|
1024
|
+
strict(message?: errorUtil.ErrMessage): ZodObject<T, "strict", Catchall>;
|
|
1025
|
+
strip(): ZodObject<T, "strip", Catchall>;
|
|
1026
|
+
passthrough(): ZodObject<T, "passthrough", Catchall>;
|
|
1027
|
+
/**
|
|
1028
|
+
* @deprecated In most cases, this is no longer needed - unknown properties are now silently stripped.
|
|
1029
|
+
* If you want to pass through unknown properties, use `.passthrough()` instead.
|
|
1030
|
+
*/
|
|
1031
|
+
nonstrict: () => ZodObject<T, "passthrough", Catchall>;
|
|
1032
|
+
extend<Augmentation extends ZodRawShape>(augmentation: Augmentation): ZodObject<objectUtil.extendShape<T, Augmentation>, UnknownKeys, Catchall>;
|
|
1033
|
+
/**
|
|
1034
|
+
* @deprecated Use `.extend` instead
|
|
1035
|
+
* */
|
|
1036
|
+
augment: <Augmentation extends ZodRawShape>(augmentation: Augmentation) => ZodObject<objectUtil.extendShape<T, Augmentation>, UnknownKeys, Catchall>;
|
|
1037
|
+
/**
|
|
1038
|
+
* Prior to zod@1.0.12 there was a bug in the
|
|
1039
|
+
* inferred type of merged objects. Please
|
|
1040
|
+
* upgrade if you are experiencing issues.
|
|
1041
|
+
*/
|
|
1042
|
+
merge<Incoming extends AnyZodObject, Augmentation extends Incoming["shape"]>(merging: Incoming): ZodObject<objectUtil.extendShape<T, Augmentation>, Incoming["_def"]["unknownKeys"], Incoming["_def"]["catchall"]>;
|
|
1043
|
+
setKey<Key extends string, Schema extends ZodTypeAny>(key: Key, schema: Schema): ZodObject<T & {
|
|
1044
|
+
[k in Key]: Schema;
|
|
1045
|
+
}, UnknownKeys, Catchall>;
|
|
1046
|
+
catchall<Index extends ZodTypeAny>(index: Index): ZodObject<T, UnknownKeys, Index>;
|
|
1047
|
+
pick<Mask extends util.Exactly<{
|
|
1048
|
+
[k in keyof T]?: true;
|
|
1049
|
+
}, Mask>>(mask: Mask): ZodObject<Pick<T, Extract<keyof T, keyof Mask>>, UnknownKeys, Catchall>;
|
|
1050
|
+
omit<Mask extends util.Exactly<{
|
|
1051
|
+
[k in keyof T]?: true;
|
|
1052
|
+
}, Mask>>(mask: Mask): ZodObject<Omit<T, keyof Mask>, UnknownKeys, Catchall>;
|
|
1053
|
+
/**
|
|
1054
|
+
* @deprecated
|
|
1055
|
+
*/
|
|
1056
|
+
deepPartial(): partialUtil.DeepPartial<this>;
|
|
1057
|
+
partial(): ZodObject<{
|
|
1058
|
+
[k in keyof T]: ZodOptional<T[k]>;
|
|
1059
|
+
}, UnknownKeys, Catchall>;
|
|
1060
|
+
partial<Mask extends util.Exactly<{
|
|
1061
|
+
[k in keyof T]?: true;
|
|
1062
|
+
}, Mask>>(mask: Mask): ZodObject<objectUtil.noNever<{
|
|
1063
|
+
[k in keyof T]: k extends keyof Mask ? ZodOptional<T[k]> : T[k];
|
|
1064
|
+
}>, UnknownKeys, Catchall>;
|
|
1065
|
+
required(): ZodObject<{
|
|
1066
|
+
[k in keyof T]: deoptional<T[k]>;
|
|
1067
|
+
}, UnknownKeys, Catchall>;
|
|
1068
|
+
required<Mask extends util.Exactly<{
|
|
1069
|
+
[k in keyof T]?: true;
|
|
1070
|
+
}, Mask>>(mask: Mask): ZodObject<objectUtil.noNever<{
|
|
1071
|
+
[k in keyof T]: k extends keyof Mask ? deoptional<T[k]> : T[k];
|
|
1072
|
+
}>, UnknownKeys, Catchall>;
|
|
1073
|
+
keyof(): ZodEnum<enumUtil.UnionToTupleString<keyof T>>;
|
|
1074
|
+
static create: <Shape extends ZodRawShape>(shape: Shape, params?: RawCreateParams) => ZodObject<Shape, "strip", ZodTypeAny, objectOutputType<Shape, ZodTypeAny, "strip">, objectInputType<Shape, ZodTypeAny, "strip">>;
|
|
1075
|
+
static strictCreate: <Shape extends ZodRawShape>(shape: Shape, params?: RawCreateParams) => ZodObject<Shape, "strict">;
|
|
1076
|
+
static lazycreate: <Shape extends ZodRawShape>(shape: () => Shape, params?: RawCreateParams) => ZodObject<Shape, "strip">;
|
|
1077
|
+
}
|
|
1078
|
+
export type AnyZodObject = ZodObject<any, any, any>;
|
|
1079
|
+
export type ZodUnionOptions = Readonly<[
|
|
1080
|
+
ZodTypeAny,
|
|
1081
|
+
...ZodTypeAny[]
|
|
1082
|
+
]>;
|
|
1083
|
+
export interface ZodUnionDef<T extends ZodUnionOptions = Readonly<[
|
|
1084
|
+
ZodTypeAny,
|
|
1085
|
+
ZodTypeAny,
|
|
1086
|
+
...ZodTypeAny[]
|
|
1087
|
+
]>> extends ZodTypeDef {
|
|
1088
|
+
options: T;
|
|
1089
|
+
typeName: ZodFirstPartyTypeKind.ZodUnion;
|
|
1090
|
+
}
|
|
1091
|
+
declare class ZodUnion<T extends ZodUnionOptions> extends ZodType<T[number]["_output"], ZodUnionDef<T>, T[number]["_input"]> {
|
|
1092
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1093
|
+
get options(): T;
|
|
1094
|
+
static create: <Options extends Readonly<[
|
|
1095
|
+
ZodTypeAny,
|
|
1096
|
+
ZodTypeAny,
|
|
1097
|
+
...ZodTypeAny[]
|
|
1098
|
+
]>>(types: Options, params?: RawCreateParams) => ZodUnion<Options>;
|
|
1099
|
+
}
|
|
1100
|
+
export type ZodDiscriminatedUnionOption<Discriminator extends string> = ZodObject<{
|
|
1101
|
+
[key in Discriminator]: ZodTypeAny;
|
|
1102
|
+
} & ZodRawShape, UnknownKeysParam, ZodTypeAny>;
|
|
1103
|
+
export interface ZodDiscriminatedUnionDef<Discriminator extends string, Options extends readonly ZodDiscriminatedUnionOption<string>[] = ZodDiscriminatedUnionOption<string>[]> extends ZodTypeDef {
|
|
1104
|
+
discriminator: Discriminator;
|
|
1105
|
+
options: Options;
|
|
1106
|
+
optionsMap: Map<Primitive, ZodDiscriminatedUnionOption<any>>;
|
|
1107
|
+
typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion;
|
|
1108
|
+
}
|
|
1109
|
+
declare class ZodDiscriminatedUnion<Discriminator extends string, Options extends readonly ZodDiscriminatedUnionOption<Discriminator>[]> extends ZodType<output<Options[number]>, ZodDiscriminatedUnionDef<Discriminator, Options>, input<Options[number]>> {
|
|
1110
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1111
|
+
get discriminator(): Discriminator;
|
|
1112
|
+
get options(): Options;
|
|
1113
|
+
get optionsMap(): Map<Primitive, ZodDiscriminatedUnionOption<any>>;
|
|
1114
|
+
/**
|
|
1115
|
+
* The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.
|
|
1116
|
+
* However, it only allows a union of objects, all of which need to share a discriminator property. This property must
|
|
1117
|
+
* have a different value for each object in the union.
|
|
1118
|
+
* @param discriminator the name of the discriminator property
|
|
1119
|
+
* @param types an array of object schemas
|
|
1120
|
+
* @param params
|
|
1121
|
+
*/
|
|
1122
|
+
static create<Discriminator extends string, Types extends readonly [
|
|
1123
|
+
ZodDiscriminatedUnionOption<Discriminator>,
|
|
1124
|
+
...ZodDiscriminatedUnionOption<Discriminator>[]
|
|
1125
|
+
]>(discriminator: Discriminator, options: Types, params?: RawCreateParams): ZodDiscriminatedUnion<Discriminator, Types>;
|
|
1126
|
+
}
|
|
1127
|
+
export interface ZodIntersectionDef<T extends ZodTypeAny = ZodTypeAny, U extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1128
|
+
left: T;
|
|
1129
|
+
right: U;
|
|
1130
|
+
typeName: ZodFirstPartyTypeKind.ZodIntersection;
|
|
1131
|
+
}
|
|
1132
|
+
declare class ZodIntersection<T extends ZodTypeAny, U extends ZodTypeAny> extends ZodType<T["_output"] & U["_output"], ZodIntersectionDef<T, U>, T["_input"] & U["_input"]> {
|
|
1133
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1134
|
+
static create: <TSchema extends ZodTypeAny, USchema extends ZodTypeAny>(left: TSchema, right: USchema, params?: RawCreateParams) => ZodIntersection<TSchema, USchema>;
|
|
1135
|
+
}
|
|
1136
|
+
export type ZodTupleItems = [
|
|
1137
|
+
ZodTypeAny,
|
|
1138
|
+
...ZodTypeAny[]
|
|
1139
|
+
];
|
|
1140
|
+
export type AssertArray<T> = T extends any[] ? T : never;
|
|
1141
|
+
export type OutputTypeOfTuple<T extends ZodTupleItems | [
|
|
1142
|
+
]> = AssertArray<{
|
|
1143
|
+
[k in keyof T]: T[k] extends ZodType<any, any, any> ? T[k]["_output"] : never;
|
|
1144
|
+
}>;
|
|
1145
|
+
export type OutputTypeOfTupleWithRest<T extends ZodTupleItems | [
|
|
1146
|
+
], Rest extends ZodTypeAny | null = null> = Rest extends ZodTypeAny ? [
|
|
1147
|
+
...OutputTypeOfTuple<T>,
|
|
1148
|
+
...Rest["_output"][]
|
|
1149
|
+
] : OutputTypeOfTuple<T>;
|
|
1150
|
+
export type InputTypeOfTuple<T extends ZodTupleItems | [
|
|
1151
|
+
]> = AssertArray<{
|
|
1152
|
+
[k in keyof T]: T[k] extends ZodType<any, any, any> ? T[k]["_input"] : never;
|
|
1153
|
+
}>;
|
|
1154
|
+
export type InputTypeOfTupleWithRest<T extends ZodTupleItems | [
|
|
1155
|
+
], Rest extends ZodTypeAny | null = null> = Rest extends ZodTypeAny ? [
|
|
1156
|
+
...InputTypeOfTuple<T>,
|
|
1157
|
+
...Rest["_input"][]
|
|
1158
|
+
] : InputTypeOfTuple<T>;
|
|
1159
|
+
export interface ZodTupleDef<T extends ZodTupleItems | [
|
|
1160
|
+
] = ZodTupleItems, Rest extends ZodTypeAny | null = null> extends ZodTypeDef {
|
|
1161
|
+
items: T;
|
|
1162
|
+
rest: Rest;
|
|
1163
|
+
typeName: ZodFirstPartyTypeKind.ZodTuple;
|
|
1164
|
+
}
|
|
1165
|
+
export type AnyZodTuple = ZodTuple<[
|
|
1166
|
+
ZodTypeAny,
|
|
1167
|
+
...ZodTypeAny[]
|
|
1168
|
+
] | [
|
|
1169
|
+
], ZodTypeAny | null>;
|
|
1170
|
+
declare class ZodTuple<T extends ZodTupleItems | [
|
|
1171
|
+
] = ZodTupleItems, Rest extends ZodTypeAny | null = null> extends ZodType<OutputTypeOfTupleWithRest<T, Rest>, ZodTupleDef<T, Rest>, InputTypeOfTupleWithRest<T, Rest>> {
|
|
1172
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1173
|
+
get items(): T;
|
|
1174
|
+
rest<RestSchema extends ZodTypeAny>(rest: RestSchema): ZodTuple<T, RestSchema>;
|
|
1175
|
+
static create: <Items extends [
|
|
1176
|
+
ZodTypeAny,
|
|
1177
|
+
...ZodTypeAny[]
|
|
1178
|
+
] | [
|
|
1179
|
+
]>(schemas: Items, params?: RawCreateParams) => ZodTuple<Items, null>;
|
|
1180
|
+
}
|
|
1181
|
+
export interface ZodRecordDef<Key extends KeySchema = ZodString, Value extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1182
|
+
valueType: Value;
|
|
1183
|
+
keyType: Key;
|
|
1184
|
+
typeName: ZodFirstPartyTypeKind.ZodRecord;
|
|
1185
|
+
}
|
|
1186
|
+
export type KeySchema = ZodType<string | number | symbol, any, any>;
|
|
1187
|
+
export type RecordType<K extends string | number | symbol, V> = [
|
|
1188
|
+
string
|
|
1189
|
+
] extends [
|
|
1190
|
+
K
|
|
1191
|
+
] ? Record<K, V> : [
|
|
1192
|
+
number
|
|
1193
|
+
] extends [
|
|
1194
|
+
K
|
|
1195
|
+
] ? Record<K, V> : [
|
|
1196
|
+
symbol
|
|
1197
|
+
] extends [
|
|
1198
|
+
K
|
|
1199
|
+
] ? Record<K, V> : [
|
|
1200
|
+
BRAND<string | number | symbol>
|
|
1201
|
+
] extends [
|
|
1202
|
+
K
|
|
1203
|
+
] ? Record<K, V> : Partial<Record<K, V>>;
|
|
1204
|
+
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"]>> {
|
|
1205
|
+
get keySchema(): Key;
|
|
1206
|
+
get valueSchema(): Value;
|
|
1207
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1208
|
+
get element(): Value;
|
|
1209
|
+
static create<Value extends ZodTypeAny>(valueType: Value, params?: RawCreateParams): ZodRecord<ZodString, Value>;
|
|
1210
|
+
static create<Keys extends KeySchema, Value extends ZodTypeAny>(keySchema: Keys, valueType: Value, params?: RawCreateParams): ZodRecord<Keys, Value>;
|
|
1211
|
+
}
|
|
1212
|
+
export interface ZodMapDef<Key extends ZodTypeAny = ZodTypeAny, Value extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1213
|
+
valueType: Value;
|
|
1214
|
+
keyType: Key;
|
|
1215
|
+
typeName: ZodFirstPartyTypeKind.ZodMap;
|
|
1216
|
+
}
|
|
1217
|
+
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"]>> {
|
|
1218
|
+
get keySchema(): Key;
|
|
1219
|
+
get valueSchema(): Value;
|
|
1220
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1221
|
+
static create: <KeySchema extends ZodTypeAny = ZodTypeAny, ValueSchema extends ZodTypeAny = ZodTypeAny>(keyType: KeySchema, valueType: ValueSchema, params?: RawCreateParams) => ZodMap<KeySchema, ValueSchema>;
|
|
1222
|
+
}
|
|
1223
|
+
export interface ZodSetDef<Value extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1224
|
+
valueType: Value;
|
|
1225
|
+
typeName: ZodFirstPartyTypeKind.ZodSet;
|
|
1226
|
+
minSize: {
|
|
1227
|
+
value: number;
|
|
1228
|
+
message?: string | undefined;
|
|
1229
|
+
} | null;
|
|
1230
|
+
maxSize: {
|
|
1231
|
+
value: number;
|
|
1232
|
+
message?: string | undefined;
|
|
1233
|
+
} | null;
|
|
1234
|
+
}
|
|
1235
|
+
declare class ZodSet<Value extends ZodTypeAny = ZodTypeAny> extends ZodType<Set<Value["_output"]>, ZodSetDef<Value>, Set<Value["_input"]>> {
|
|
1236
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1237
|
+
min(minSize: number, message?: errorUtil.ErrMessage): this;
|
|
1238
|
+
max(maxSize: number, message?: errorUtil.ErrMessage): this;
|
|
1239
|
+
size(size: number, message?: errorUtil.ErrMessage): this;
|
|
1240
|
+
nonempty(message?: errorUtil.ErrMessage): ZodSet<Value>;
|
|
1241
|
+
static create: <ValueSchema extends ZodTypeAny = ZodTypeAny>(valueType: ValueSchema, params?: RawCreateParams) => ZodSet<ValueSchema>;
|
|
1242
|
+
}
|
|
1243
|
+
export interface ZodFunctionDef<Args extends ZodTuple<any, any> = ZodTuple<any, any>, Returns extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1244
|
+
args: Args;
|
|
1245
|
+
returns: Returns;
|
|
1246
|
+
typeName: ZodFirstPartyTypeKind.ZodFunction;
|
|
1247
|
+
}
|
|
1248
|
+
export type OuterTypeOfFunction<Args extends ZodTuple<any, any>, Returns extends ZodTypeAny> = Args["_input"] extends Array<any> ? (...args: Args["_input"]) => Returns["_output"] : never;
|
|
1249
|
+
export type InnerTypeOfFunction<Args extends ZodTuple<any, any>, Returns extends ZodTypeAny> = Args["_output"] extends Array<any> ? (...args: Args["_output"]) => Returns["_input"] : never;
|
|
1250
|
+
declare class ZodFunction<Args extends ZodTuple<any, any>, Returns extends ZodTypeAny> extends ZodType<OuterTypeOfFunction<Args, Returns>, ZodFunctionDef<Args, Returns>, InnerTypeOfFunction<Args, Returns>> {
|
|
1251
|
+
_parse(input: ParseInput): ParseReturnType<any>;
|
|
1252
|
+
parameters(): Args;
|
|
1253
|
+
returnType(): Returns;
|
|
1254
|
+
args<Items extends Parameters<(typeof ZodTuple)["create"]>[0]>(...items: Items): ZodFunction<ZodTuple<Items, ZodUnknown>, Returns>;
|
|
1255
|
+
returns<NewReturnType extends ZodType<any, any, any>>(returnType: NewReturnType): ZodFunction<Args, NewReturnType>;
|
|
1256
|
+
implement<F extends InnerTypeOfFunction<Args, Returns>>(func: F): ReturnType<F> extends Returns["_output"] ? (...args: Args["_input"]) => ReturnType<F> : OuterTypeOfFunction<Args, Returns>;
|
|
1257
|
+
strictImplement(func: InnerTypeOfFunction<Args, Returns>): InnerTypeOfFunction<Args, Returns>;
|
|
1258
|
+
validate: <F extends InnerTypeOfFunction<Args, Returns>>(func: F) => ReturnType<F> extends Returns["_output"] ? (...args: Args["_input"]) => ReturnType<F> : OuterTypeOfFunction<Args, Returns>;
|
|
1259
|
+
static create(): ZodFunction<ZodTuple<[
|
|
1260
|
+
], ZodUnknown>, ZodUnknown>;
|
|
1261
|
+
static create<T extends AnyZodTuple = ZodTuple<[
|
|
1262
|
+
], ZodUnknown>>(args: T): ZodFunction<T, ZodUnknown>;
|
|
1263
|
+
static create<T extends AnyZodTuple, U extends ZodTypeAny>(args: T, returns: U): ZodFunction<T, U>;
|
|
1264
|
+
static create<T extends AnyZodTuple = ZodTuple<[
|
|
1265
|
+
], ZodUnknown>, U extends ZodTypeAny = ZodUnknown>(args: T, returns: U, params?: RawCreateParams): ZodFunction<T, U>;
|
|
1266
|
+
}
|
|
1267
|
+
export interface ZodLazyDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1268
|
+
getter: () => T;
|
|
1269
|
+
typeName: ZodFirstPartyTypeKind.ZodLazy;
|
|
1270
|
+
}
|
|
1271
|
+
declare class ZodLazy<T extends ZodTypeAny> extends ZodType<output<T>, ZodLazyDef<T>, input<T>> {
|
|
1272
|
+
get schema(): T;
|
|
1273
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1274
|
+
static create: <Inner extends ZodTypeAny>(getter: () => Inner, params?: RawCreateParams) => ZodLazy<Inner>;
|
|
1275
|
+
}
|
|
1276
|
+
export interface ZodLiteralDef<T = any> extends ZodTypeDef {
|
|
1277
|
+
value: T;
|
|
1278
|
+
typeName: ZodFirstPartyTypeKind.ZodLiteral;
|
|
1279
|
+
}
|
|
1280
|
+
declare class ZodLiteral<T> extends ZodType<T, ZodLiteralDef<T>, T> {
|
|
1281
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1282
|
+
get value(): T;
|
|
1283
|
+
static create: <Value extends Primitive>(value: Value, params?: RawCreateParams) => ZodLiteral<Value>;
|
|
1284
|
+
}
|
|
1285
|
+
export type ArrayKeys = keyof any[];
|
|
1286
|
+
export type Indices<T> = Exclude<keyof T, ArrayKeys>;
|
|
1287
|
+
export type EnumValues<T extends string = string> = readonly [
|
|
1288
|
+
T,
|
|
1289
|
+
...T[]
|
|
1290
|
+
];
|
|
1291
|
+
export type Values<T extends EnumValues> = {
|
|
1292
|
+
[k in T[number]]: k;
|
|
1293
|
+
};
|
|
1294
|
+
export interface ZodEnumDef<T extends EnumValues = EnumValues> extends ZodTypeDef {
|
|
1295
|
+
values: T;
|
|
1296
|
+
typeName: ZodFirstPartyTypeKind.ZodEnum;
|
|
1297
|
+
}
|
|
1298
|
+
export type Writeable<T> = {
|
|
1299
|
+
-readonly [P in keyof T]: T[P];
|
|
1300
|
+
};
|
|
1301
|
+
export type FilterEnum<Values, ToExclude> = Values extends [
|
|
1302
|
+
] ? [
|
|
1303
|
+
] : Values extends [
|
|
1304
|
+
infer Head,
|
|
1305
|
+
...infer Rest
|
|
1306
|
+
] ? Head extends ToExclude ? FilterEnum<Rest, ToExclude> : [
|
|
1307
|
+
Head,
|
|
1308
|
+
...FilterEnum<Rest, ToExclude>
|
|
1309
|
+
] : never;
|
|
1310
|
+
export type typecast<A, T> = A extends T ? A : never;
|
|
1311
|
+
declare function createZodEnum<U extends string, T extends Readonly<[
|
|
1312
|
+
U,
|
|
1313
|
+
...U[]
|
|
1314
|
+
]>>(values: T, params?: RawCreateParams): ZodEnum<Writeable<T>>;
|
|
1315
|
+
declare function createZodEnum<U extends string, T extends [
|
|
1316
|
+
U,
|
|
1317
|
+
...U[]
|
|
1318
|
+
]>(values: T, params?: RawCreateParams): ZodEnum<T>;
|
|
1319
|
+
declare class ZodEnum<T extends [
|
|
1320
|
+
string,
|
|
1321
|
+
...string[]
|
|
1322
|
+
]> extends ZodType<T[number], ZodEnumDef<T>, T[number]> {
|
|
1323
|
+
_cache: Set<T[number]> | undefined;
|
|
1324
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1325
|
+
get options(): T;
|
|
1326
|
+
get enum(): Values<T>;
|
|
1327
|
+
get Values(): Values<T>;
|
|
1328
|
+
get Enum(): Values<T>;
|
|
1329
|
+
extract<ToExtract extends readonly [
|
|
1330
|
+
T[number],
|
|
1331
|
+
...T[number][]
|
|
1332
|
+
]>(values: ToExtract, newDef?: RawCreateParams): ZodEnum<Writeable<ToExtract>>;
|
|
1333
|
+
exclude<ToExclude extends readonly [
|
|
1334
|
+
T[number],
|
|
1335
|
+
...T[number][]
|
|
1336
|
+
]>(values: ToExclude, newDef?: RawCreateParams): ZodEnum<typecast<Writeable<FilterEnum<T, ToExclude[number]>>, [
|
|
1337
|
+
string,
|
|
1338
|
+
...string[]
|
|
1339
|
+
]>>;
|
|
1340
|
+
static create: typeof createZodEnum;
|
|
1341
|
+
}
|
|
1342
|
+
export interface ZodNativeEnumDef<T extends EnumLike = EnumLike> extends ZodTypeDef {
|
|
1343
|
+
values: T;
|
|
1344
|
+
typeName: ZodFirstPartyTypeKind.ZodNativeEnum;
|
|
1345
|
+
}
|
|
1346
|
+
export type EnumLike = {
|
|
1347
|
+
[k: string]: string | number;
|
|
1348
|
+
[nu: number]: string;
|
|
1349
|
+
};
|
|
1350
|
+
declare class ZodNativeEnum<T extends EnumLike> extends ZodType<T[keyof T], ZodNativeEnumDef<T>, T[keyof T]> {
|
|
1351
|
+
_cache: Set<T[keyof T]> | undefined;
|
|
1352
|
+
_parse(input: ParseInput): ParseReturnType<T[keyof T]>;
|
|
1353
|
+
get enum(): T;
|
|
1354
|
+
static create: <Elements extends EnumLike>(values: Elements, params?: RawCreateParams) => ZodNativeEnum<Elements>;
|
|
1355
|
+
}
|
|
1356
|
+
export interface ZodPromiseDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1357
|
+
type: T;
|
|
1358
|
+
typeName: ZodFirstPartyTypeKind.ZodPromise;
|
|
1359
|
+
}
|
|
1360
|
+
declare class ZodPromise<T extends ZodTypeAny> extends ZodType<Promise<T["_output"]>, ZodPromiseDef<T>, Promise<T["_input"]>> {
|
|
1361
|
+
unwrap(): T;
|
|
1362
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1363
|
+
static create: <Inner extends ZodTypeAny>(schema: Inner, params?: RawCreateParams) => ZodPromise<Inner>;
|
|
1364
|
+
}
|
|
1365
|
+
export type Refinement<T> = (arg: T, ctx: RefinementCtx) => any;
|
|
1366
|
+
export type SuperRefinement<T> = (arg: T, ctx: RefinementCtx) => void | Promise<void>;
|
|
1367
|
+
export type RefinementEffect<T> = {
|
|
1368
|
+
type: "refinement";
|
|
1369
|
+
refinement: (arg: T, ctx: RefinementCtx) => any;
|
|
1370
|
+
};
|
|
1371
|
+
export type TransformEffect<T> = {
|
|
1372
|
+
type: "transform";
|
|
1373
|
+
transform: (arg: T, ctx: RefinementCtx) => any;
|
|
1374
|
+
};
|
|
1375
|
+
export type PreprocessEffect<T> = {
|
|
1376
|
+
type: "preprocess";
|
|
1377
|
+
transform: (arg: T, ctx: RefinementCtx) => any;
|
|
1378
|
+
};
|
|
1379
|
+
export type Effect<T> = RefinementEffect<T> | TransformEffect<T> | PreprocessEffect<T>;
|
|
1380
|
+
export interface ZodEffectsDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1381
|
+
schema: T;
|
|
1382
|
+
typeName: ZodFirstPartyTypeKind.ZodEffects;
|
|
1383
|
+
effect: Effect<any>;
|
|
1384
|
+
}
|
|
1385
|
+
declare class ZodEffects<T extends ZodTypeAny, Output = output<T>, Input = input<T>> extends ZodType<Output, ZodEffectsDef<T>, Input> {
|
|
1386
|
+
innerType(): T;
|
|
1387
|
+
sourceType(): T;
|
|
1388
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1389
|
+
static create: <I extends ZodTypeAny>(schema: I, effect: Effect<I["_output"]>, params?: RawCreateParams) => ZodEffects<I, I["_output"]>;
|
|
1390
|
+
static createWithPreprocess: <I extends ZodTypeAny>(preprocess: (arg: unknown, ctx: RefinementCtx) => unknown, schema: I, params?: RawCreateParams) => ZodEffects<I, I["_output"], unknown>;
|
|
1391
|
+
}
|
|
1392
|
+
export interface ZodOptionalDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1393
|
+
innerType: T;
|
|
1394
|
+
typeName: ZodFirstPartyTypeKind.ZodOptional;
|
|
1395
|
+
}
|
|
1396
|
+
export type ZodOptionalType<T extends ZodTypeAny> = ZodOptional<T>;
|
|
1397
|
+
declare class ZodOptional<T extends ZodTypeAny> extends ZodType<T["_output"] | undefined, ZodOptionalDef<T>, T["_input"] | undefined> {
|
|
1398
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1399
|
+
unwrap(): T;
|
|
1400
|
+
static create: <Inner extends ZodTypeAny>(type: Inner, params?: RawCreateParams) => ZodOptional<Inner>;
|
|
1401
|
+
}
|
|
1402
|
+
export interface ZodNullableDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1403
|
+
innerType: T;
|
|
1404
|
+
typeName: ZodFirstPartyTypeKind.ZodNullable;
|
|
1405
|
+
}
|
|
1406
|
+
export type ZodNullableType<T extends ZodTypeAny> = ZodNullable<T>;
|
|
1407
|
+
declare class ZodNullable<T extends ZodTypeAny> extends ZodType<T["_output"] | null, ZodNullableDef<T>, T["_input"] | null> {
|
|
1408
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1409
|
+
unwrap(): T;
|
|
1410
|
+
static create: <Inner extends ZodTypeAny>(type: Inner, params?: RawCreateParams) => ZodNullable<Inner>;
|
|
1411
|
+
}
|
|
1412
|
+
export interface ZodDefaultDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1413
|
+
innerType: T;
|
|
1414
|
+
defaultValue: () => util.noUndefined<T["_input"]>;
|
|
1415
|
+
typeName: ZodFirstPartyTypeKind.ZodDefault;
|
|
1416
|
+
}
|
|
1417
|
+
declare class ZodDefault<T extends ZodTypeAny> extends ZodType<util.noUndefined<T["_output"]>, ZodDefaultDef<T>, T["_input"] | undefined> {
|
|
1418
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1419
|
+
removeDefault(): T;
|
|
1420
|
+
static create: <Inner extends ZodTypeAny>(type: Inner, params: RawCreateParams & {
|
|
1421
|
+
default: Inner["_input"] | (() => util.noUndefined<Inner["_input"]>);
|
|
1422
|
+
}) => ZodDefault<Inner>;
|
|
1423
|
+
}
|
|
1424
|
+
export interface ZodCatchDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1425
|
+
innerType: T;
|
|
1426
|
+
catchValue: (ctx: {
|
|
1427
|
+
error: ZodError;
|
|
1428
|
+
input: unknown;
|
|
1429
|
+
}) => T["_input"];
|
|
1430
|
+
typeName: ZodFirstPartyTypeKind.ZodCatch;
|
|
1431
|
+
}
|
|
1432
|
+
declare class ZodCatch<T extends ZodTypeAny> extends ZodType<T["_output"], ZodCatchDef<T>, unknown> {
|
|
1433
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1434
|
+
removeCatch(): T;
|
|
1435
|
+
static create: <Inner extends ZodTypeAny>(type: Inner, params: RawCreateParams & {
|
|
1436
|
+
catch: Inner["_output"] | (() => Inner["_output"]);
|
|
1437
|
+
}) => ZodCatch<Inner>;
|
|
1438
|
+
}
|
|
1439
|
+
export interface ZodNaNDef extends ZodTypeDef {
|
|
1440
|
+
typeName: ZodFirstPartyTypeKind.ZodNaN;
|
|
1441
|
+
}
|
|
1442
|
+
declare class ZodNaN extends ZodType<number, ZodNaNDef, number> {
|
|
1443
|
+
_parse(input: ParseInput): ParseReturnType<any>;
|
|
1444
|
+
static create: (params?: RawCreateParams) => ZodNaN;
|
|
1445
|
+
}
|
|
1446
|
+
export interface ZodBrandedDef<T extends ZodTypeAny> extends ZodTypeDef {
|
|
1447
|
+
type: T;
|
|
1448
|
+
typeName: ZodFirstPartyTypeKind.ZodBranded;
|
|
1449
|
+
}
|
|
1450
|
+
declare const BRAND: unique symbol;
|
|
1451
|
+
export type BRAND<T extends string | number | symbol> = {
|
|
1452
|
+
[BRAND]: {
|
|
1453
|
+
[k in T]: true;
|
|
1454
|
+
};
|
|
1455
|
+
};
|
|
1456
|
+
declare class ZodBranded<T extends ZodTypeAny, B extends string | number | symbol> extends ZodType<T["_output"] & BRAND<B>, ZodBrandedDef<T>, T["_input"]> {
|
|
1457
|
+
_parse(input: ParseInput): ParseReturnType<any>;
|
|
1458
|
+
unwrap(): T;
|
|
1459
|
+
}
|
|
1460
|
+
export interface ZodPipelineDef<A extends ZodTypeAny, B extends ZodTypeAny> extends ZodTypeDef {
|
|
1461
|
+
in: A;
|
|
1462
|
+
out: B;
|
|
1463
|
+
typeName: ZodFirstPartyTypeKind.ZodPipeline;
|
|
1464
|
+
}
|
|
1465
|
+
declare class ZodPipeline<A extends ZodTypeAny, B extends ZodTypeAny> extends ZodType<B["_output"], ZodPipelineDef<A, B>, A["_input"]> {
|
|
1466
|
+
_parse(input: ParseInput): ParseReturnType<any>;
|
|
1467
|
+
static create<ASchema extends ZodTypeAny, BSchema extends ZodTypeAny>(a: ASchema, b: BSchema): ZodPipeline<ASchema, BSchema>;
|
|
1468
|
+
}
|
|
1469
|
+
export type BuiltIn = (((...args: any[]) => any) | (new (...args: any[]) => any)) | {
|
|
1470
|
+
readonly [Symbol.toStringTag]: string;
|
|
1471
|
+
} | Date | Error | Generator | Promise<unknown> | RegExp;
|
|
1472
|
+
export type MakeReadonly<T> = T extends Map<infer K, infer V> ? ReadonlyMap<K, V> : T extends Set<infer V> ? ReadonlySet<V> : T extends [
|
|
1473
|
+
infer Head,
|
|
1474
|
+
...infer Tail
|
|
1475
|
+
] ? readonly [
|
|
1476
|
+
Head,
|
|
1477
|
+
...Tail
|
|
1478
|
+
] : T extends Array<infer V> ? ReadonlyArray<V> : T extends BuiltIn ? T : Readonly<T>;
|
|
1479
|
+
export interface ZodReadonlyDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1480
|
+
innerType: T;
|
|
1481
|
+
typeName: ZodFirstPartyTypeKind.ZodReadonly;
|
|
1482
|
+
}
|
|
1483
|
+
declare class ZodReadonly<T extends ZodTypeAny> extends ZodType<MakeReadonly<T["_output"]>, ZodReadonlyDef<T>, MakeReadonly<T["_input"]>> {
|
|
1484
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1485
|
+
static create: <Inner extends ZodTypeAny>(type: Inner, params?: RawCreateParams) => ZodReadonly<Inner>;
|
|
1486
|
+
unwrap(): T;
|
|
1487
|
+
}
|
|
1488
|
+
export type CustomParams = CustomErrorParams & {
|
|
1489
|
+
fatal?: boolean;
|
|
1490
|
+
};
|
|
1491
|
+
declare function custom<T>(check?: (data: any) => any, _params?: string | CustomParams | ((input: any) => CustomParams),
|
|
1492
|
+
/**
|
|
1493
|
+
* @deprecated
|
|
1494
|
+
*
|
|
1495
|
+
* Pass `fatal` into the params object instead:
|
|
1496
|
+
*
|
|
1497
|
+
* ```ts
|
|
1498
|
+
* z.string().custom((val) => val.length > 5, { fatal: false })
|
|
1499
|
+
* ```
|
|
1500
|
+
*
|
|
1501
|
+
*/
|
|
1502
|
+
fatal?: boolean): ZodType<T, ZodTypeDef, T>;
|
|
1503
|
+
declare const late: {
|
|
1504
|
+
object: <Shape extends ZodRawShape>(shape: () => Shape, params?: RawCreateParams) => ZodObject<Shape, "strip">;
|
|
1505
|
+
};
|
|
1506
|
+
declare enum ZodFirstPartyTypeKind {
|
|
1507
|
+
ZodString = "ZodString",
|
|
1508
|
+
ZodNumber = "ZodNumber",
|
|
1509
|
+
ZodNaN = "ZodNaN",
|
|
1510
|
+
ZodBigInt = "ZodBigInt",
|
|
1511
|
+
ZodBoolean = "ZodBoolean",
|
|
1512
|
+
ZodDate = "ZodDate",
|
|
1513
|
+
ZodSymbol = "ZodSymbol",
|
|
1514
|
+
ZodUndefined = "ZodUndefined",
|
|
1515
|
+
ZodNull = "ZodNull",
|
|
1516
|
+
ZodAny = "ZodAny",
|
|
1517
|
+
ZodUnknown = "ZodUnknown",
|
|
1518
|
+
ZodNever = "ZodNever",
|
|
1519
|
+
ZodVoid = "ZodVoid",
|
|
1520
|
+
ZodArray = "ZodArray",
|
|
1521
|
+
ZodObject = "ZodObject",
|
|
1522
|
+
ZodUnion = "ZodUnion",
|
|
1523
|
+
ZodDiscriminatedUnion = "ZodDiscriminatedUnion",
|
|
1524
|
+
ZodIntersection = "ZodIntersection",
|
|
1525
|
+
ZodTuple = "ZodTuple",
|
|
1526
|
+
ZodRecord = "ZodRecord",
|
|
1527
|
+
ZodMap = "ZodMap",
|
|
1528
|
+
ZodSet = "ZodSet",
|
|
1529
|
+
ZodFunction = "ZodFunction",
|
|
1530
|
+
ZodLazy = "ZodLazy",
|
|
1531
|
+
ZodLiteral = "ZodLiteral",
|
|
1532
|
+
ZodEnum = "ZodEnum",
|
|
1533
|
+
ZodEffects = "ZodEffects",
|
|
1534
|
+
ZodNativeEnum = "ZodNativeEnum",
|
|
1535
|
+
ZodOptional = "ZodOptional",
|
|
1536
|
+
ZodNullable = "ZodNullable",
|
|
1537
|
+
ZodDefault = "ZodDefault",
|
|
1538
|
+
ZodCatch = "ZodCatch",
|
|
1539
|
+
ZodPromise = "ZodPromise",
|
|
1540
|
+
ZodBranded = "ZodBranded",
|
|
1541
|
+
ZodPipeline = "ZodPipeline",
|
|
1542
|
+
ZodReadonly = "ZodReadonly"
|
|
1543
|
+
}
|
|
1544
|
+
export 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> | ZodReadonly<any> | ZodSymbol;
|
|
1545
|
+
declare abstract class Class {
|
|
1546
|
+
constructor(..._: any[]);
|
|
1547
|
+
}
|
|
1548
|
+
declare const instanceOfType: <T extends typeof Class>(cls: T, params?: CustomParams) => ZodType<InstanceType<T>, ZodTypeDef, InstanceType<T>>;
|
|
1549
|
+
declare const stringType: (params?: RawCreateParams & {
|
|
1550
|
+
coerce?: true;
|
|
1551
|
+
}) => ZodString;
|
|
1552
|
+
declare const numberType: (params?: RawCreateParams & {
|
|
1553
|
+
coerce?: boolean;
|
|
1554
|
+
}) => ZodNumber;
|
|
1555
|
+
declare const nanType: (params?: RawCreateParams) => ZodNaN;
|
|
1556
|
+
declare const bigIntType: (params?: RawCreateParams & {
|
|
1557
|
+
coerce?: boolean;
|
|
1558
|
+
}) => ZodBigInt;
|
|
1559
|
+
declare const booleanType: (params?: RawCreateParams & {
|
|
1560
|
+
coerce?: boolean;
|
|
1561
|
+
}) => ZodBoolean;
|
|
1562
|
+
declare const dateType: (params?: RawCreateParams & {
|
|
1563
|
+
coerce?: boolean;
|
|
1564
|
+
}) => ZodDate;
|
|
1565
|
+
declare const symbolType: (params?: RawCreateParams) => ZodSymbol;
|
|
1566
|
+
declare const undefinedType: (params?: RawCreateParams) => ZodUndefined;
|
|
1567
|
+
declare const nullType: (params?: RawCreateParams) => ZodNull;
|
|
1568
|
+
declare const anyType: (params?: RawCreateParams) => ZodAny;
|
|
1569
|
+
declare const unknownType: (params?: RawCreateParams) => ZodUnknown;
|
|
1570
|
+
declare const neverType: (params?: RawCreateParams) => ZodNever;
|
|
1571
|
+
declare const voidType: (params?: RawCreateParams) => ZodVoid;
|
|
1572
|
+
declare const arrayType: <El extends ZodTypeAny>(schema: El, params?: RawCreateParams) => ZodArray<El>;
|
|
1573
|
+
declare const objectType: <Shape extends ZodRawShape>(shape: Shape, params?: RawCreateParams) => ZodObject<Shape, "strip", ZodTypeAny, objectOutputType<Shape, ZodTypeAny, "strip">, objectInputType<Shape, ZodTypeAny, "strip">>;
|
|
1574
|
+
declare const strictObjectType: <Shape extends ZodRawShape>(shape: Shape, params?: RawCreateParams) => ZodObject<Shape, "strict">;
|
|
1575
|
+
declare const unionType: <Options extends Readonly<[
|
|
1576
|
+
ZodTypeAny,
|
|
1577
|
+
ZodTypeAny,
|
|
1578
|
+
...ZodTypeAny[]
|
|
1579
|
+
]>>(types: Options, params?: RawCreateParams) => ZodUnion<Options>;
|
|
1580
|
+
declare const discriminatedUnionType: typeof ZodDiscriminatedUnion.create;
|
|
1581
|
+
declare const intersectionType: <TSchema extends ZodTypeAny, USchema extends ZodTypeAny>(left: TSchema, right: USchema, params?: RawCreateParams) => ZodIntersection<TSchema, USchema>;
|
|
1582
|
+
declare const tupleType: <Items extends [
|
|
1583
|
+
ZodTypeAny,
|
|
1584
|
+
...ZodTypeAny[]
|
|
1585
|
+
] | [
|
|
1586
|
+
]>(schemas: Items, params?: RawCreateParams) => ZodTuple<Items, null>;
|
|
1587
|
+
declare const recordType: typeof ZodRecord.create;
|
|
1588
|
+
declare const mapType: <KeySchema extends ZodTypeAny = ZodTypeAny, ValueSchema extends ZodTypeAny = ZodTypeAny>(keyType: KeySchema, valueType: ValueSchema, params?: RawCreateParams) => ZodMap<KeySchema, ValueSchema>;
|
|
1589
|
+
declare const setType: <ValueSchema extends ZodTypeAny = ZodTypeAny>(valueType: ValueSchema, params?: RawCreateParams) => ZodSet<ValueSchema>;
|
|
1590
|
+
declare const functionType: typeof ZodFunction.create;
|
|
1591
|
+
declare const lazyType: <Inner extends ZodTypeAny>(getter: () => Inner, params?: RawCreateParams) => ZodLazy<Inner>;
|
|
1592
|
+
declare const literalType: <Value extends Primitive>(value: Value, params?: RawCreateParams) => ZodLiteral<Value>;
|
|
1593
|
+
declare const enumType: typeof createZodEnum;
|
|
1594
|
+
declare const nativeEnumType: <Elements extends EnumLike>(values: Elements, params?: RawCreateParams) => ZodNativeEnum<Elements>;
|
|
1595
|
+
declare const promiseType: <Inner extends ZodTypeAny>(schema: Inner, params?: RawCreateParams) => ZodPromise<Inner>;
|
|
1596
|
+
declare const effectsType: <I extends ZodTypeAny>(schema: I, effect: Effect<I["_output"]>, params?: RawCreateParams) => ZodEffects<I, I["_output"]>;
|
|
1597
|
+
declare const optionalType: <Inner extends ZodTypeAny>(type: Inner, params?: RawCreateParams) => ZodOptional<Inner>;
|
|
1598
|
+
declare const nullableType: <Inner extends ZodTypeAny>(type: Inner, params?: RawCreateParams) => ZodNullable<Inner>;
|
|
1599
|
+
declare const preprocessType: <I extends ZodTypeAny>(preprocess: (arg: unknown, ctx: RefinementCtx) => unknown, schema: I, params?: RawCreateParams) => ZodEffects<I, I["_output"], unknown>;
|
|
1600
|
+
declare const pipelineType: typeof ZodPipeline.create;
|
|
1601
|
+
declare const ostring: () => ZodOptional<ZodString>;
|
|
1602
|
+
declare const onumber: () => ZodOptional<ZodNumber>;
|
|
1603
|
+
declare const oboolean: () => ZodOptional<ZodBoolean>;
|
|
1604
|
+
declare const coerce: {
|
|
1605
|
+
string: (typeof ZodString)["create"];
|
|
1606
|
+
number: (typeof ZodNumber)["create"];
|
|
1607
|
+
boolean: (typeof ZodBoolean)["create"];
|
|
1608
|
+
bigint: (typeof ZodBigInt)["create"];
|
|
1609
|
+
date: (typeof ZodDate)["create"];
|
|
1610
|
+
};
|
|
1611
|
+
declare const NEVER: never;
|
|
1612
|
+
declare const boxmanCronSchema: z.ZodObject<{
|
|
1613
|
+
slug: z.ZodString;
|
|
1614
|
+
schedule: z.ZodString;
|
|
1615
|
+
rpcEndpoint: z.ZodString;
|
|
1616
|
+
isEnabled: z.ZodDefault<z.ZodBoolean>;
|
|
1617
|
+
stopAt: z.ZodOptional<z.ZodString>;
|
|
1618
|
+
maxExecutions: z.ZodOptional<z.ZodNumber>;
|
|
1619
|
+
}, "strip", z.ZodTypeAny, {
|
|
1620
|
+
slug: string;
|
|
1621
|
+
schedule: string;
|
|
1622
|
+
rpcEndpoint: string;
|
|
1623
|
+
isEnabled: boolean;
|
|
1624
|
+
stopAt?: string | undefined;
|
|
1625
|
+
maxExecutions?: number | undefined;
|
|
1626
|
+
}, {
|
|
1627
|
+
slug: string;
|
|
1628
|
+
schedule: string;
|
|
1629
|
+
rpcEndpoint: string;
|
|
1630
|
+
isEnabled?: boolean | undefined;
|
|
1631
|
+
stopAt?: string | undefined;
|
|
1632
|
+
maxExecutions?: number | undefined;
|
|
1633
|
+
}>;
|
|
1634
|
+
export type BoxmanCron = z.infer<typeof boxmanCronSchema>;
|
|
1635
|
+
export type AppConfig = {
|
|
1636
|
+
crons: BoxmanCron[];
|
|
1637
|
+
};
|
|
20
1638
|
declare const AuthProvider: {
|
|
21
1639
|
readonly AC1: "AC1";
|
|
22
1640
|
readonly GITHUB_USER: "GITHUB_USER";
|
|
@@ -44,14 +1662,6 @@ export type SignInInput = {
|
|
|
44
1662
|
} | {
|
|
45
1663
|
redirectUri?: string;
|
|
46
1664
|
};
|
|
47
|
-
export type AppConfig = {
|
|
48
|
-
crons: {
|
|
49
|
-
slug: string;
|
|
50
|
-
schedule: string;
|
|
51
|
-
rpcEndpoint: string;
|
|
52
|
-
isEnabled: boolean;
|
|
53
|
-
}[];
|
|
54
|
-
};
|
|
55
1665
|
export type RequestContext = {
|
|
56
1666
|
requestId: string;
|
|
57
1667
|
channelId?: string;
|
|
@@ -1985,4 +3595,8 @@ export declare function getAuth(input?: {
|
|
|
1985
3595
|
required?: boolean;
|
|
1986
3596
|
}): Promise<AuthStatus>;
|
|
1987
3597
|
|
|
3598
|
+
declare namespace z {
|
|
3599
|
+
export { AnyZodObject, AnyZodTuple, ArrayCardinality, ArrayKeys, AssertArray, AsyncParseReturnType, BRAND, CatchallInput, CatchallOutput, CustomErrorParams, DIRTY, DenormalizedError, EMPTY_PATH, Effect, EnumLike, EnumValues, ErrorMapCtx, FilterEnum, INVALID, Indices, InnerTypeOfFunction, InputTypeOfTuple, InputTypeOfTupleWithRest, IpVersion, IssueData, KeySchema, NEVER, OK, ObjectPair, OuterTypeOfFunction, OutputTypeOfTuple, OutputTypeOfTupleWithRest, ParseContext, ParseInput, ParseParams, ParsePath, ParsePathComponent, ParseResult, ParseReturnType, ParseStatus, PassthroughType, PreprocessEffect, Primitive, ProcessedCreateParams, RawCreateParams, RecordType, Refinement, RefinementCtx, RefinementEffect, SafeParseError, SafeParseReturnType, SafeParseSuccess, Scalars, SomeZodObject, StringValidation, SuperRefinement, SyncParseReturnType, TransformEffect, TypeOf, TypeOf as infer, UnknownKeysParam, Values, Writeable, ZodAny, ZodAnyDef, ZodArray, ZodArrayDef, ZodBigInt, ZodBigIntCheck, ZodBigIntDef, ZodBoolean, ZodBooleanDef, ZodBranded, ZodBrandedDef, ZodCatch, ZodCatchDef, ZodCustomIssue, ZodDate, ZodDateCheck, ZodDateDef, ZodDefault, ZodDefaultDef, ZodDiscriminatedUnion, ZodDiscriminatedUnionDef, ZodDiscriminatedUnionOption, ZodEffects, ZodEffects as ZodTransformer, ZodEffectsDef, ZodEnum, ZodEnumDef, ZodError, ZodErrorMap, ZodFirstPartySchemaTypes, ZodFirstPartyTypeKind, ZodFormattedError, ZodFunction, ZodFunctionDef, ZodIntersection, ZodIntersectionDef, ZodInvalidArgumentsIssue, ZodInvalidDateIssue, ZodInvalidEnumValueIssue, ZodInvalidIntersectionTypesIssue, ZodInvalidLiteralIssue, ZodInvalidReturnTypeIssue, ZodInvalidStringIssue, ZodInvalidTypeIssue, ZodInvalidUnionDiscriminatorIssue, ZodInvalidUnionIssue, ZodIssue, ZodIssueBase, ZodIssueCode, ZodIssueOptionalMessage, ZodLazy, ZodLazyDef, ZodLiteral, ZodLiteralDef, ZodMap, ZodMapDef, ZodNaN, ZodNaNDef, ZodNativeEnum, ZodNativeEnumDef, ZodNever, ZodNeverDef, ZodNonEmptyArray, ZodNotFiniteIssue, ZodNotMultipleOfIssue, ZodNull, ZodNullDef, ZodNullable, ZodNullableDef, ZodNullableType, ZodNumber, ZodNumberCheck, ZodNumberDef, ZodObject, ZodObjectDef, ZodOptional, ZodOptionalDef, ZodOptionalType, ZodParsedType, ZodPipeline, ZodPipelineDef, ZodPromise, ZodPromiseDef, ZodRawShape, ZodReadonly, ZodReadonlyDef, ZodRecord, ZodRecordDef, ZodSet, ZodSetDef, ZodString, ZodStringCheck, ZodStringDef, ZodSymbol, ZodSymbolDef, ZodTooBigIssue, ZodTooSmallIssue, ZodTuple, ZodTupleDef, ZodTupleItems, ZodType, ZodType as Schema, ZodType as ZodSchema, ZodTypeAny, ZodTypeDef, ZodUndefined, ZodUndefinedDef, ZodUnion, ZodUnionDef, ZodUnionOptions, ZodUnknown, ZodUnknownDef, ZodUnrecognizedKeysIssue, ZodVoid, ZodVoidDef, addIssueToContext, anyType as any, arrayOutputType, arrayType as array, baseObjectInputType, baseObjectOutputType, bigIntType as bigint, booleanType as boolean, coerce, custom, dateType as date, datetimeRegex, deoptional, discriminatedUnionType as discriminatedUnion, effectsType as effect, effectsType as transformer, enumType as enum, errorMap as defaultErrorMap, functionType as function, getErrorMap, getParsedType, inferFlattenedErrors, inferFormattedError, input, instanceOfType as instanceof, intersectionType as intersection, isAborted, isAsync, isDirty, isValid, late, lazyType as lazy, literalType as literal, makeIssue, mapType as map, mergeTypes, nanType as nan, nativeEnumType as nativeEnum, neverType as never, noUnrecognized, nullType as null, nullableType as nullable, numberType as number, objectInputType, objectOutputType, objectType as object, objectUtil, oboolean, onumber, optionalType as optional, ostring, output, pipelineType as pipeline, preprocessType as preprocess, promiseType as promise, quotelessJson, recordType as record, setErrorMap, setType as set, strictObjectType as strictObject, stringType as string, symbolType as symbol, tupleType as tuple, typeToFlattenedError, typecast, undefinedType as undefined, unionType as union, unknownType as unknown, util, voidType as void };
|
|
3600
|
+
}
|
|
3601
|
+
|
|
1988
3602
|
export {};
|