@resultdev/sdk 0.1.0 → 0.3.0
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/CHANGELOG.md +54 -0
- package/README.md +76 -6
- package/THIRD-PARTY-NOTICES +209 -0
- package/dist/client-CJv_awPt.d.cts +1087 -0
- package/dist/client-DrsZ1qIm.d.ts +1087 -0
- package/dist/index.cjs +2791 -9267
- package/dist/index.d.cts +10 -7494
- package/dist/index.d.ts +10 -7494
- package/dist/index.js +2117 -1446
- package/dist/middleware-BJl9JRg3.d.ts +67 -0
- package/dist/middleware-C1Z6aMvn.d.cts +67 -0
- package/dist/ssr/middleware.cjs +179 -7176
- package/dist/ssr/middleware.d.cts +2 -1881
- package/dist/ssr/middleware.d.ts +2 -1881
- package/dist/ssr/middleware.js +179 -25
- package/dist/ssr.cjs +3154 -9588
- package/dist/ssr.d.cts +66 -7432
- package/dist/ssr.d.ts +66 -7432
- package/dist/ssr.js +2562 -1846
- package/dist/types-DSVtGaIA.d.cts +672 -0
- package/dist/types-DSVtGaIA.d.ts +672 -0
- package/package.json +43 -12
- package/dist/chunk-Y7VCTXPN.js +0 -7165
package/dist/ssr/middleware.d.ts
CHANGED
|
@@ -1,1881 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
declare namespace util {
|
|
4
|
-
type AssertEqual<T, U> = (<V>() => V extends T ? 1 : 2) extends <V>() => V extends U ? 1 : 2 ? true : false;
|
|
5
|
-
export type isAny<T> = 0 extends 1 & T ? true : false;
|
|
6
|
-
export const assertEqual: <A, B>(_: AssertEqual<A, B>) => void;
|
|
7
|
-
export function assertIs<T>(_arg: T): void;
|
|
8
|
-
export function assertNever(_x: never): never;
|
|
9
|
-
export type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
|
10
|
-
export type OmitKeys<T, K extends string> = Pick<T, Exclude<keyof T, K>>;
|
|
11
|
-
export type MakePartial<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
12
|
-
export type Exactly<T, X> = T & Record<Exclude<keyof X, keyof T>, never>;
|
|
13
|
-
export type InexactPartial<T> = {
|
|
14
|
-
[k in keyof T]?: T[k] | undefined;
|
|
15
|
-
};
|
|
16
|
-
export const arrayToEnum: <T extends string, U extends [
|
|
17
|
-
T,
|
|
18
|
-
...T[]
|
|
19
|
-
]>(items: U) => {
|
|
20
|
-
[k in U[number]]: k;
|
|
21
|
-
};
|
|
22
|
-
export const getValidEnumValues: (obj: any) => any[];
|
|
23
|
-
export const objectValues: (obj: any) => any[];
|
|
24
|
-
export const objectKeys: ObjectConstructor["keys"];
|
|
25
|
-
export const find: <T>(arr: T[], checker: (arg: T) => any) => T | undefined;
|
|
26
|
-
export type identity<T> = objectUtil.identity<T>;
|
|
27
|
-
export type flatten<T> = objectUtil.flatten<T>;
|
|
28
|
-
export type noUndefined<T> = T extends undefined ? never : T;
|
|
29
|
-
export const isInteger: NumberConstructor["isInteger"];
|
|
30
|
-
export function joinValues<T extends any[]>(array: T, separator?: string): string;
|
|
31
|
-
export const jsonStringifyReplacer: (_: string, value: any) => any;
|
|
32
|
-
export {};
|
|
33
|
-
}
|
|
34
|
-
declare namespace objectUtil {
|
|
35
|
-
export type MergeShapes<U, V> = keyof U & keyof V extends never ? U & V : {
|
|
36
|
-
[k in Exclude<keyof U, keyof V>]: U[k];
|
|
37
|
-
} & V;
|
|
38
|
-
type optionalKeys<T extends object> = {
|
|
39
|
-
[k in keyof T]: undefined extends T[k] ? k : never;
|
|
40
|
-
}[keyof T];
|
|
41
|
-
type requiredKeys<T extends object> = {
|
|
42
|
-
[k in keyof T]: undefined extends T[k] ? never : k;
|
|
43
|
-
}[keyof T];
|
|
44
|
-
export type addQuestionMarks<T extends object, _O = any> = {
|
|
45
|
-
[K in requiredKeys<T>]: T[K];
|
|
46
|
-
} & {
|
|
47
|
-
[K in optionalKeys<T>]?: T[K];
|
|
48
|
-
} & {
|
|
49
|
-
[k in keyof T]?: unknown;
|
|
50
|
-
};
|
|
51
|
-
export type identity<T> = T;
|
|
52
|
-
export type flatten<T> = identity<{
|
|
53
|
-
[k in keyof T]: T[k];
|
|
54
|
-
}>;
|
|
55
|
-
export type noNeverKeys<T> = {
|
|
56
|
-
[k in keyof T]: [
|
|
57
|
-
T[k]
|
|
58
|
-
] extends [
|
|
59
|
-
never
|
|
60
|
-
] ? never : k;
|
|
61
|
-
}[keyof T];
|
|
62
|
-
export type noNever<T> = identity<{
|
|
63
|
-
[k in noNeverKeys<T>]: k extends keyof T ? T[k] : never;
|
|
64
|
-
}>;
|
|
65
|
-
export const mergeShapes: <U, T>(first: U, second: T) => T & U;
|
|
66
|
-
export type extendShape<A extends object, B extends object> = keyof A & keyof B extends never ? A & B : {
|
|
67
|
-
[K in keyof A as K extends keyof B ? never : K]: A[K];
|
|
68
|
-
} & {
|
|
69
|
-
[K in keyof B]: B[K];
|
|
70
|
-
};
|
|
71
|
-
export {};
|
|
72
|
-
}
|
|
73
|
-
declare const ZodParsedType: {
|
|
74
|
-
string: "string";
|
|
75
|
-
nan: "nan";
|
|
76
|
-
number: "number";
|
|
77
|
-
integer: "integer";
|
|
78
|
-
float: "float";
|
|
79
|
-
boolean: "boolean";
|
|
80
|
-
date: "date";
|
|
81
|
-
bigint: "bigint";
|
|
82
|
-
symbol: "symbol";
|
|
83
|
-
function: "function";
|
|
84
|
-
undefined: "undefined";
|
|
85
|
-
null: "null";
|
|
86
|
-
array: "array";
|
|
87
|
-
object: "object";
|
|
88
|
-
unknown: "unknown";
|
|
89
|
-
promise: "promise";
|
|
90
|
-
void: "void";
|
|
91
|
-
never: "never";
|
|
92
|
-
map: "map";
|
|
93
|
-
set: "set";
|
|
94
|
-
};
|
|
95
|
-
type ZodParsedType = keyof typeof ZodParsedType;
|
|
96
|
-
declare const getParsedType: (data: any) => ZodParsedType;
|
|
97
|
-
type allKeys<T> = T extends any ? keyof T : never;
|
|
98
|
-
type inferFlattenedErrors<T extends ZodType<any, any, any>, U = string> = typeToFlattenedError<TypeOf<T>, U>;
|
|
99
|
-
type typeToFlattenedError<T, U = string> = {
|
|
100
|
-
formErrors: U[];
|
|
101
|
-
fieldErrors: {
|
|
102
|
-
[P in allKeys<T>]?: U[];
|
|
103
|
-
};
|
|
104
|
-
};
|
|
105
|
-
declare const ZodIssueCode: {
|
|
106
|
-
invalid_type: "invalid_type";
|
|
107
|
-
invalid_literal: "invalid_literal";
|
|
108
|
-
custom: "custom";
|
|
109
|
-
invalid_union: "invalid_union";
|
|
110
|
-
invalid_union_discriminator: "invalid_union_discriminator";
|
|
111
|
-
invalid_enum_value: "invalid_enum_value";
|
|
112
|
-
unrecognized_keys: "unrecognized_keys";
|
|
113
|
-
invalid_arguments: "invalid_arguments";
|
|
114
|
-
invalid_return_type: "invalid_return_type";
|
|
115
|
-
invalid_date: "invalid_date";
|
|
116
|
-
invalid_string: "invalid_string";
|
|
117
|
-
too_small: "too_small";
|
|
118
|
-
too_big: "too_big";
|
|
119
|
-
invalid_intersection_types: "invalid_intersection_types";
|
|
120
|
-
not_multiple_of: "not_multiple_of";
|
|
121
|
-
not_finite: "not_finite";
|
|
122
|
-
};
|
|
123
|
-
type ZodIssueCode = keyof typeof ZodIssueCode;
|
|
124
|
-
type ZodIssueBase = {
|
|
125
|
-
path: (string | number)[];
|
|
126
|
-
message?: string | undefined;
|
|
127
|
-
};
|
|
128
|
-
interface ZodInvalidTypeIssue extends ZodIssueBase {
|
|
129
|
-
code: typeof ZodIssueCode.invalid_type;
|
|
130
|
-
expected: ZodParsedType;
|
|
131
|
-
received: ZodParsedType;
|
|
132
|
-
}
|
|
133
|
-
interface ZodInvalidLiteralIssue extends ZodIssueBase {
|
|
134
|
-
code: typeof ZodIssueCode.invalid_literal;
|
|
135
|
-
expected: unknown;
|
|
136
|
-
received: unknown;
|
|
137
|
-
}
|
|
138
|
-
interface ZodUnrecognizedKeysIssue extends ZodIssueBase {
|
|
139
|
-
code: typeof ZodIssueCode.unrecognized_keys;
|
|
140
|
-
keys: string[];
|
|
141
|
-
}
|
|
142
|
-
interface ZodInvalidUnionIssue extends ZodIssueBase {
|
|
143
|
-
code: typeof ZodIssueCode.invalid_union;
|
|
144
|
-
unionErrors: ZodError[];
|
|
145
|
-
}
|
|
146
|
-
interface ZodInvalidUnionDiscriminatorIssue extends ZodIssueBase {
|
|
147
|
-
code: typeof ZodIssueCode.invalid_union_discriminator;
|
|
148
|
-
options: Primitive[];
|
|
149
|
-
}
|
|
150
|
-
interface ZodInvalidEnumValueIssue extends ZodIssueBase {
|
|
151
|
-
received: string | number;
|
|
152
|
-
code: typeof ZodIssueCode.invalid_enum_value;
|
|
153
|
-
options: (string | number)[];
|
|
154
|
-
}
|
|
155
|
-
interface ZodInvalidArgumentsIssue extends ZodIssueBase {
|
|
156
|
-
code: typeof ZodIssueCode.invalid_arguments;
|
|
157
|
-
argumentsError: ZodError;
|
|
158
|
-
}
|
|
159
|
-
interface ZodInvalidReturnTypeIssue extends ZodIssueBase {
|
|
160
|
-
code: typeof ZodIssueCode.invalid_return_type;
|
|
161
|
-
returnTypeError: ZodError;
|
|
162
|
-
}
|
|
163
|
-
interface ZodInvalidDateIssue extends ZodIssueBase {
|
|
164
|
-
code: typeof ZodIssueCode.invalid_date;
|
|
165
|
-
}
|
|
166
|
-
type StringValidation = "email" | "url" | "emoji" | "uuid" | "nanoid" | "regex" | "cuid" | "cuid2" | "ulid" | "datetime" | "date" | "time" | "duration" | "ip" | "cidr" | "base64" | "jwt" | "base64url" | {
|
|
167
|
-
includes: string;
|
|
168
|
-
position?: number | undefined;
|
|
169
|
-
} | {
|
|
170
|
-
startsWith: string;
|
|
171
|
-
} | {
|
|
172
|
-
endsWith: string;
|
|
173
|
-
};
|
|
174
|
-
interface ZodInvalidStringIssue extends ZodIssueBase {
|
|
175
|
-
code: typeof ZodIssueCode.invalid_string;
|
|
176
|
-
validation: StringValidation;
|
|
177
|
-
}
|
|
178
|
-
interface ZodTooSmallIssue extends ZodIssueBase {
|
|
179
|
-
code: typeof ZodIssueCode.too_small;
|
|
180
|
-
minimum: number | bigint;
|
|
181
|
-
inclusive: boolean;
|
|
182
|
-
exact?: boolean;
|
|
183
|
-
type: "array" | "string" | "number" | "set" | "date" | "bigint";
|
|
184
|
-
}
|
|
185
|
-
interface ZodTooBigIssue extends ZodIssueBase {
|
|
186
|
-
code: typeof ZodIssueCode.too_big;
|
|
187
|
-
maximum: number | bigint;
|
|
188
|
-
inclusive: boolean;
|
|
189
|
-
exact?: boolean;
|
|
190
|
-
type: "array" | "string" | "number" | "set" | "date" | "bigint";
|
|
191
|
-
}
|
|
192
|
-
interface ZodInvalidIntersectionTypesIssue extends ZodIssueBase {
|
|
193
|
-
code: typeof ZodIssueCode.invalid_intersection_types;
|
|
194
|
-
}
|
|
195
|
-
interface ZodNotMultipleOfIssue extends ZodIssueBase {
|
|
196
|
-
code: typeof ZodIssueCode.not_multiple_of;
|
|
197
|
-
multipleOf: number | bigint;
|
|
198
|
-
}
|
|
199
|
-
interface ZodNotFiniteIssue extends ZodIssueBase {
|
|
200
|
-
code: typeof ZodIssueCode.not_finite;
|
|
201
|
-
}
|
|
202
|
-
interface ZodCustomIssue extends ZodIssueBase {
|
|
203
|
-
code: typeof ZodIssueCode.custom;
|
|
204
|
-
params?: {
|
|
205
|
-
[k: string]: any;
|
|
206
|
-
};
|
|
207
|
-
}
|
|
208
|
-
type DenormalizedError = {
|
|
209
|
-
[k: string]: DenormalizedError | string[];
|
|
210
|
-
};
|
|
211
|
-
type ZodIssueOptionalMessage = ZodInvalidTypeIssue | ZodInvalidLiteralIssue | ZodUnrecognizedKeysIssue | ZodInvalidUnionIssue | ZodInvalidUnionDiscriminatorIssue | ZodInvalidEnumValueIssue | ZodInvalidArgumentsIssue | ZodInvalidReturnTypeIssue | ZodInvalidDateIssue | ZodInvalidStringIssue | ZodTooSmallIssue | ZodTooBigIssue | ZodInvalidIntersectionTypesIssue | ZodNotMultipleOfIssue | ZodNotFiniteIssue | ZodCustomIssue;
|
|
212
|
-
type ZodIssue = ZodIssueOptionalMessage & {
|
|
213
|
-
fatal?: boolean | undefined;
|
|
214
|
-
message: string;
|
|
215
|
-
};
|
|
216
|
-
declare const quotelessJson: (obj: any) => string;
|
|
217
|
-
type recursiveZodFormattedError<T> = T extends [
|
|
218
|
-
any,
|
|
219
|
-
...any[]
|
|
220
|
-
] ? {
|
|
221
|
-
[K in keyof T]?: ZodFormattedError<T[K]>;
|
|
222
|
-
} : T extends any[] ? {
|
|
223
|
-
[k: number]: ZodFormattedError<T[number]>;
|
|
224
|
-
} : T extends object ? {
|
|
225
|
-
[K in keyof T]?: ZodFormattedError<T[K]>;
|
|
226
|
-
} : unknown;
|
|
227
|
-
type ZodFormattedError<T, U = string> = {
|
|
228
|
-
_errors: U[];
|
|
229
|
-
} & recursiveZodFormattedError<NonNullable<T>>;
|
|
230
|
-
type inferFormattedError<T extends ZodType<any, any, any>, U = string> = ZodFormattedError<TypeOf<T>, U>;
|
|
231
|
-
declare class ZodError<T = any> extends Error {
|
|
232
|
-
issues: ZodIssue[];
|
|
233
|
-
get errors(): ZodIssue[];
|
|
234
|
-
constructor(issues: ZodIssue[]);
|
|
235
|
-
format(): ZodFormattedError<T>;
|
|
236
|
-
format<U>(mapper: (issue: ZodIssue) => U): ZodFormattedError<T, U>;
|
|
237
|
-
static create: (issues: ZodIssue[]) => ZodError<any>;
|
|
238
|
-
static assert(value: unknown): asserts value is ZodError;
|
|
239
|
-
toString(): string;
|
|
240
|
-
get message(): string;
|
|
241
|
-
get isEmpty(): boolean;
|
|
242
|
-
addIssue: (sub: ZodIssue) => void;
|
|
243
|
-
addIssues: (subs?: ZodIssue[]) => void;
|
|
244
|
-
flatten(): typeToFlattenedError<T>;
|
|
245
|
-
flatten<U>(mapper?: (issue: ZodIssue) => U): typeToFlattenedError<T, U>;
|
|
246
|
-
get formErrors(): typeToFlattenedError<T, string>;
|
|
247
|
-
}
|
|
248
|
-
type stripPath<T extends object> = T extends any ? util.OmitKeys<T, "path"> : never;
|
|
249
|
-
type IssueData = stripPath<ZodIssueOptionalMessage> & {
|
|
250
|
-
path?: (string | number)[];
|
|
251
|
-
fatal?: boolean | undefined;
|
|
252
|
-
};
|
|
253
|
-
type ErrorMapCtx = {
|
|
254
|
-
defaultError: string;
|
|
255
|
-
data: any;
|
|
256
|
-
};
|
|
257
|
-
type ZodErrorMap = (issue: ZodIssueOptionalMessage, _ctx: ErrorMapCtx) => {
|
|
258
|
-
message: string;
|
|
259
|
-
};
|
|
260
|
-
declare const errorMap: ZodErrorMap;
|
|
261
|
-
declare function setErrorMap(map: ZodErrorMap): void;
|
|
262
|
-
declare function getErrorMap(): ZodErrorMap;
|
|
263
|
-
declare const makeIssue: (params: {
|
|
264
|
-
data: any;
|
|
265
|
-
path: (string | number)[];
|
|
266
|
-
errorMaps: ZodErrorMap[];
|
|
267
|
-
issueData: IssueData;
|
|
268
|
-
}) => ZodIssue;
|
|
269
|
-
type ParseParams = {
|
|
270
|
-
path: (string | number)[];
|
|
271
|
-
errorMap: ZodErrorMap;
|
|
272
|
-
async: boolean;
|
|
273
|
-
};
|
|
274
|
-
type ParsePathComponent = string | number;
|
|
275
|
-
type ParsePath = ParsePathComponent[];
|
|
276
|
-
declare const EMPTY_PATH: ParsePath;
|
|
277
|
-
interface ParseContext {
|
|
278
|
-
readonly common: {
|
|
279
|
-
readonly issues: ZodIssue[];
|
|
280
|
-
readonly contextualErrorMap?: ZodErrorMap | undefined;
|
|
281
|
-
readonly async: boolean;
|
|
282
|
-
};
|
|
283
|
-
readonly path: ParsePath;
|
|
284
|
-
readonly schemaErrorMap?: ZodErrorMap | undefined;
|
|
285
|
-
readonly parent: ParseContext | null;
|
|
286
|
-
readonly data: any;
|
|
287
|
-
readonly parsedType: ZodParsedType;
|
|
288
|
-
}
|
|
289
|
-
type ParseInput = {
|
|
290
|
-
data: any;
|
|
291
|
-
path: (string | number)[];
|
|
292
|
-
parent: ParseContext;
|
|
293
|
-
};
|
|
294
|
-
declare function addIssueToContext(ctx: ParseContext, issueData: IssueData): void;
|
|
295
|
-
type ObjectPair = {
|
|
296
|
-
key: SyncParseReturnType<any>;
|
|
297
|
-
value: SyncParseReturnType<any>;
|
|
298
|
-
};
|
|
299
|
-
declare class ParseStatus {
|
|
300
|
-
value: "aborted" | "dirty" | "valid";
|
|
301
|
-
dirty(): void;
|
|
302
|
-
abort(): void;
|
|
303
|
-
static mergeArray(status: ParseStatus, results: SyncParseReturnType<any>[]): SyncParseReturnType;
|
|
304
|
-
static mergeObjectAsync(status: ParseStatus, pairs: {
|
|
305
|
-
key: ParseReturnType<any>;
|
|
306
|
-
value: ParseReturnType<any>;
|
|
307
|
-
}[]): Promise<SyncParseReturnType<any>>;
|
|
308
|
-
static mergeObjectSync(status: ParseStatus, pairs: {
|
|
309
|
-
key: SyncParseReturnType<any>;
|
|
310
|
-
value: SyncParseReturnType<any>;
|
|
311
|
-
alwaysSet?: boolean;
|
|
312
|
-
}[]): SyncParseReturnType;
|
|
313
|
-
}
|
|
314
|
-
interface ParseResult {
|
|
315
|
-
status: "aborted" | "dirty" | "valid";
|
|
316
|
-
data: any;
|
|
317
|
-
}
|
|
318
|
-
type INVALID = {
|
|
319
|
-
status: "aborted";
|
|
320
|
-
};
|
|
321
|
-
declare const INVALID: INVALID;
|
|
322
|
-
type DIRTY<T> = {
|
|
323
|
-
status: "dirty";
|
|
324
|
-
value: T;
|
|
325
|
-
};
|
|
326
|
-
declare const DIRTY: <T>(value: T) => DIRTY<T>;
|
|
327
|
-
type OK<T> = {
|
|
328
|
-
status: "valid";
|
|
329
|
-
value: T;
|
|
330
|
-
};
|
|
331
|
-
declare const OK: <T>(value: T) => OK<T>;
|
|
332
|
-
type SyncParseReturnType<T = any> = OK<T> | DIRTY<T> | INVALID;
|
|
333
|
-
type AsyncParseReturnType<T> = Promise<SyncParseReturnType<T>>;
|
|
334
|
-
type ParseReturnType<T> = SyncParseReturnType<T> | AsyncParseReturnType<T>;
|
|
335
|
-
declare const isAborted: (x: ParseReturnType<any>) => x is INVALID;
|
|
336
|
-
declare const isDirty: <T>(x: ParseReturnType<T>) => x is OK<T> | DIRTY<T>;
|
|
337
|
-
declare const isValid: <T>(x: ParseReturnType<T>) => x is OK<T>;
|
|
338
|
-
declare const isAsync: <T>(x: ParseReturnType<T>) => x is AsyncParseReturnType<T>;
|
|
339
|
-
declare namespace enumUtil {
|
|
340
|
-
type UnionToIntersectionFn<T> = (T extends unknown ? (k: () => T) => void : never) extends (k: infer Intersection) => void ? Intersection : never;
|
|
341
|
-
type GetUnionLast<T> = UnionToIntersectionFn<T> extends () => infer Last ? Last : never;
|
|
342
|
-
type UnionToTuple<T, Tuple extends unknown[] = [
|
|
343
|
-
]> = [
|
|
344
|
-
T
|
|
345
|
-
] extends [
|
|
346
|
-
never
|
|
347
|
-
] ? Tuple : UnionToTuple<Exclude<T, GetUnionLast<T>>, [
|
|
348
|
-
GetUnionLast<T>,
|
|
349
|
-
...Tuple
|
|
350
|
-
]>;
|
|
351
|
-
type CastToStringTuple<T> = T extends [
|
|
352
|
-
string,
|
|
353
|
-
...string[]
|
|
354
|
-
] ? T : never;
|
|
355
|
-
export type UnionToTupleString<T> = CastToStringTuple<UnionToTuple<T>>;
|
|
356
|
-
export {};
|
|
357
|
-
}
|
|
358
|
-
declare namespace errorUtil {
|
|
359
|
-
type ErrMessage = string | {
|
|
360
|
-
message?: string | undefined;
|
|
361
|
-
};
|
|
362
|
-
const errToObj: (message?: ErrMessage) => {
|
|
363
|
-
message?: string | undefined;
|
|
364
|
-
};
|
|
365
|
-
const toString: (message?: ErrMessage) => string | undefined;
|
|
366
|
-
}
|
|
367
|
-
declare namespace partialUtil {
|
|
368
|
-
type DeepPartial<T extends ZodTypeAny> = T extends ZodObject<ZodRawShape> ? ZodObject<{
|
|
369
|
-
[k in keyof T["shape"]]: ZodOptional<DeepPartial<T["shape"][k]>>;
|
|
370
|
-
}, 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> ? {
|
|
371
|
-
[k in keyof Items]: Items[k] extends ZodTypeAny ? DeepPartial<Items[k]> : never;
|
|
372
|
-
} extends infer PI ? PI extends ZodTupleItems ? ZodTuple<PI> : never : never : T;
|
|
373
|
-
}
|
|
374
|
-
type StandardSchemaV1<Input = unknown, Output = Input> = {
|
|
375
|
-
/**
|
|
376
|
-
* The Standard Schema properties.
|
|
377
|
-
*/
|
|
378
|
-
readonly "~standard": StandardSchemaV1.Props<Input, Output>;
|
|
379
|
-
};
|
|
380
|
-
declare namespace StandardSchemaV1 {
|
|
381
|
-
/**
|
|
382
|
-
* The Standard Schema properties interface.
|
|
383
|
-
*/
|
|
384
|
-
export interface Props<Input = unknown, Output = Input> {
|
|
385
|
-
/**
|
|
386
|
-
* The version number of the standard.
|
|
387
|
-
*/
|
|
388
|
-
readonly version: 1;
|
|
389
|
-
/**
|
|
390
|
-
* The vendor name of the schema library.
|
|
391
|
-
*/
|
|
392
|
-
readonly vendor: string;
|
|
393
|
-
/**
|
|
394
|
-
* Validates unknown input values.
|
|
395
|
-
*/
|
|
396
|
-
readonly validate: (value: unknown) => Result<Output> | Promise<Result<Output>>;
|
|
397
|
-
/**
|
|
398
|
-
* Inferred types associated with the schema.
|
|
399
|
-
*/
|
|
400
|
-
readonly types?: Types<Input, Output> | undefined;
|
|
401
|
-
}
|
|
402
|
-
/**
|
|
403
|
-
* The result interface of the validate function.
|
|
404
|
-
*/
|
|
405
|
-
export type Result<Output> = SuccessResult<Output> | FailureResult;
|
|
406
|
-
/**
|
|
407
|
-
* The result interface if validation succeeds.
|
|
408
|
-
*/
|
|
409
|
-
export interface SuccessResult<Output> {
|
|
410
|
-
/**
|
|
411
|
-
* The typed output value.
|
|
412
|
-
*/
|
|
413
|
-
readonly value: Output;
|
|
414
|
-
/**
|
|
415
|
-
* The non-existent issues.
|
|
416
|
-
*/
|
|
417
|
-
readonly issues?: undefined;
|
|
418
|
-
}
|
|
419
|
-
/**
|
|
420
|
-
* The result interface if validation fails.
|
|
421
|
-
*/
|
|
422
|
-
export interface FailureResult {
|
|
423
|
-
/**
|
|
424
|
-
* The issues of failed validation.
|
|
425
|
-
*/
|
|
426
|
-
readonly issues: ReadonlyArray<Issue>;
|
|
427
|
-
}
|
|
428
|
-
/**
|
|
429
|
-
* The issue interface of the failure output.
|
|
430
|
-
*/
|
|
431
|
-
export interface Issue {
|
|
432
|
-
/**
|
|
433
|
-
* The error message of the issue.
|
|
434
|
-
*/
|
|
435
|
-
readonly message: string;
|
|
436
|
-
/**
|
|
437
|
-
* The path of the issue, if any.
|
|
438
|
-
*/
|
|
439
|
-
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
|
440
|
-
}
|
|
441
|
-
/**
|
|
442
|
-
* The path segment interface of the issue.
|
|
443
|
-
*/
|
|
444
|
-
export interface PathSegment {
|
|
445
|
-
/**
|
|
446
|
-
* The key representing a path segment.
|
|
447
|
-
*/
|
|
448
|
-
readonly key: PropertyKey;
|
|
449
|
-
}
|
|
450
|
-
/**
|
|
451
|
-
* The Standard Schema types interface.
|
|
452
|
-
*/
|
|
453
|
-
export interface Types<Input = unknown, Output = Input> {
|
|
454
|
-
/**
|
|
455
|
-
* The input type of the schema.
|
|
456
|
-
*/
|
|
457
|
-
readonly input: Input;
|
|
458
|
-
/**
|
|
459
|
-
* The output type of the schema.
|
|
460
|
-
*/
|
|
461
|
-
readonly output: Output;
|
|
462
|
-
}
|
|
463
|
-
/**
|
|
464
|
-
* Infers the input type of a Standard Schema.
|
|
465
|
-
*/
|
|
466
|
-
export type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["input"];
|
|
467
|
-
/**
|
|
468
|
-
* Infers the output type of a Standard Schema.
|
|
469
|
-
*/
|
|
470
|
-
export type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["output"];
|
|
471
|
-
export {};
|
|
472
|
-
}
|
|
473
|
-
interface RefinementCtx {
|
|
474
|
-
addIssue: (arg: IssueData) => void;
|
|
475
|
-
path: (string | number)[];
|
|
476
|
-
}
|
|
477
|
-
type ZodRawShape = {
|
|
478
|
-
[k: string]: ZodTypeAny;
|
|
479
|
-
};
|
|
480
|
-
type ZodTypeAny = ZodType<any, any, any>;
|
|
481
|
-
type TypeOf<T extends ZodType<any, any, any>> = T["_output"];
|
|
482
|
-
type input<T extends ZodType<any, any, any>> = T["_input"];
|
|
483
|
-
type output<T extends ZodType<any, any, any>> = T["_output"];
|
|
484
|
-
type CustomErrorParams = Partial<util.Omit<ZodCustomIssue, "code">>;
|
|
485
|
-
interface ZodTypeDef {
|
|
486
|
-
errorMap?: ZodErrorMap | undefined;
|
|
487
|
-
description?: string | undefined;
|
|
488
|
-
}
|
|
489
|
-
type RawCreateParams = {
|
|
490
|
-
errorMap?: ZodErrorMap | undefined;
|
|
491
|
-
invalid_type_error?: string | undefined;
|
|
492
|
-
required_error?: string | undefined;
|
|
493
|
-
message?: string | undefined;
|
|
494
|
-
description?: string | undefined;
|
|
495
|
-
} | undefined;
|
|
496
|
-
type ProcessedCreateParams = {
|
|
497
|
-
errorMap?: ZodErrorMap | undefined;
|
|
498
|
-
description?: string | undefined;
|
|
499
|
-
};
|
|
500
|
-
type SafeParseSuccess<Output> = {
|
|
501
|
-
success: true;
|
|
502
|
-
data: Output;
|
|
503
|
-
error?: never;
|
|
504
|
-
};
|
|
505
|
-
type SafeParseError<Input> = {
|
|
506
|
-
success: false;
|
|
507
|
-
error: ZodError<Input>;
|
|
508
|
-
data?: never;
|
|
509
|
-
};
|
|
510
|
-
type SafeParseReturnType<Input, Output> = SafeParseSuccess<Output> | SafeParseError<Input>;
|
|
511
|
-
declare abstract class ZodType<Output = any, Def extends ZodTypeDef = ZodTypeDef, Input = Output> {
|
|
512
|
-
readonly _type: Output;
|
|
513
|
-
readonly _output: Output;
|
|
514
|
-
readonly _input: Input;
|
|
515
|
-
readonly _def: Def;
|
|
516
|
-
get description(): string | undefined;
|
|
517
|
-
"~standard": StandardSchemaV1.Props<Input, Output>;
|
|
518
|
-
abstract _parse(input: ParseInput): ParseReturnType<Output>;
|
|
519
|
-
_getType(input: ParseInput): string;
|
|
520
|
-
_getOrReturnCtx(input: ParseInput, ctx?: ParseContext | undefined): ParseContext;
|
|
521
|
-
_processInputParams(input: ParseInput): {
|
|
522
|
-
status: ParseStatus;
|
|
523
|
-
ctx: ParseContext;
|
|
524
|
-
};
|
|
525
|
-
_parseSync(input: ParseInput): SyncParseReturnType<Output>;
|
|
526
|
-
_parseAsync(input: ParseInput): AsyncParseReturnType<Output>;
|
|
527
|
-
parse(data: unknown, params?: util.InexactPartial<ParseParams>): Output;
|
|
528
|
-
safeParse(data: unknown, params?: util.InexactPartial<ParseParams>): SafeParseReturnType<Input, Output>;
|
|
529
|
-
"~validate"(data: unknown): StandardSchemaV1.Result<Output> | Promise<StandardSchemaV1.Result<Output>>;
|
|
530
|
-
parseAsync(data: unknown, params?: util.InexactPartial<ParseParams>): Promise<Output>;
|
|
531
|
-
safeParseAsync(data: unknown, params?: util.InexactPartial<ParseParams>): Promise<SafeParseReturnType<Input, Output>>;
|
|
532
|
-
/** Alias of safeParseAsync */
|
|
533
|
-
spa: (data: unknown, params?: util.InexactPartial<ParseParams>) => Promise<SafeParseReturnType<Input, Output>>;
|
|
534
|
-
refine<RefinedOutput extends Output>(check: (arg: Output) => arg is RefinedOutput, message?: string | CustomErrorParams | ((arg: Output) => CustomErrorParams)): ZodEffects<this, RefinedOutput, Input>;
|
|
535
|
-
refine(check: (arg: Output) => unknown | Promise<unknown>, message?: string | CustomErrorParams | ((arg: Output) => CustomErrorParams)): ZodEffects<this, Output, Input>;
|
|
536
|
-
refinement<RefinedOutput extends Output>(check: (arg: Output) => arg is RefinedOutput, refinementData: IssueData | ((arg: Output, ctx: RefinementCtx) => IssueData)): ZodEffects<this, RefinedOutput, Input>;
|
|
537
|
-
refinement(check: (arg: Output) => boolean, refinementData: IssueData | ((arg: Output, ctx: RefinementCtx) => IssueData)): ZodEffects<this, Output, Input>;
|
|
538
|
-
_refinement(refinement: RefinementEffect<Output>["refinement"]): ZodEffects<this, Output, Input>;
|
|
539
|
-
superRefine<RefinedOutput extends Output>(refinement: (arg: Output, ctx: RefinementCtx) => arg is RefinedOutput): ZodEffects<this, RefinedOutput, Input>;
|
|
540
|
-
superRefine(refinement: (arg: Output, ctx: RefinementCtx) => void): ZodEffects<this, Output, Input>;
|
|
541
|
-
superRefine(refinement: (arg: Output, ctx: RefinementCtx) => Promise<void>): ZodEffects<this, Output, Input>;
|
|
542
|
-
constructor(def: Def);
|
|
543
|
-
optional(): ZodOptional<this>;
|
|
544
|
-
nullable(): ZodNullable<this>;
|
|
545
|
-
nullish(): ZodOptional<ZodNullable<this>>;
|
|
546
|
-
array(): ZodArray<this>;
|
|
547
|
-
promise(): ZodPromise<this>;
|
|
548
|
-
or<T extends ZodTypeAny>(option: T): ZodUnion<[
|
|
549
|
-
this,
|
|
550
|
-
T
|
|
551
|
-
]>;
|
|
552
|
-
and<T extends ZodTypeAny>(incoming: T): ZodIntersection<this, T>;
|
|
553
|
-
transform<NewOut>(transform: (arg: Output, ctx: RefinementCtx) => NewOut | Promise<NewOut>): ZodEffects<this, NewOut>;
|
|
554
|
-
default(def: util.noUndefined<Input>): ZodDefault<this>;
|
|
555
|
-
default(def: () => util.noUndefined<Input>): ZodDefault<this>;
|
|
556
|
-
brand<B extends string | number | symbol>(brand?: B): ZodBranded<this, B>;
|
|
557
|
-
catch(def: Output): ZodCatch<this>;
|
|
558
|
-
catch(def: (ctx: {
|
|
559
|
-
error: ZodError;
|
|
560
|
-
input: Input;
|
|
561
|
-
}) => Output): ZodCatch<this>;
|
|
562
|
-
describe(description: string): this;
|
|
563
|
-
pipe<T extends ZodTypeAny>(target: T): ZodPipeline<this, T>;
|
|
564
|
-
readonly(): ZodReadonly<this>;
|
|
565
|
-
isOptional(): boolean;
|
|
566
|
-
isNullable(): boolean;
|
|
567
|
-
}
|
|
568
|
-
type IpVersion = "v4" | "v6";
|
|
569
|
-
type ZodStringCheck = {
|
|
570
|
-
kind: "min";
|
|
571
|
-
value: number;
|
|
572
|
-
message?: string | undefined;
|
|
573
|
-
} | {
|
|
574
|
-
kind: "max";
|
|
575
|
-
value: number;
|
|
576
|
-
message?: string | undefined;
|
|
577
|
-
} | {
|
|
578
|
-
kind: "length";
|
|
579
|
-
value: number;
|
|
580
|
-
message?: string | undefined;
|
|
581
|
-
} | {
|
|
582
|
-
kind: "email";
|
|
583
|
-
message?: string | undefined;
|
|
584
|
-
} | {
|
|
585
|
-
kind: "url";
|
|
586
|
-
message?: string | undefined;
|
|
587
|
-
} | {
|
|
588
|
-
kind: "emoji";
|
|
589
|
-
message?: string | undefined;
|
|
590
|
-
} | {
|
|
591
|
-
kind: "uuid";
|
|
592
|
-
message?: string | undefined;
|
|
593
|
-
} | {
|
|
594
|
-
kind: "nanoid";
|
|
595
|
-
message?: string | undefined;
|
|
596
|
-
} | {
|
|
597
|
-
kind: "cuid";
|
|
598
|
-
message?: string | undefined;
|
|
599
|
-
} | {
|
|
600
|
-
kind: "includes";
|
|
601
|
-
value: string;
|
|
602
|
-
position?: number | undefined;
|
|
603
|
-
message?: string | undefined;
|
|
604
|
-
} | {
|
|
605
|
-
kind: "cuid2";
|
|
606
|
-
message?: string | undefined;
|
|
607
|
-
} | {
|
|
608
|
-
kind: "ulid";
|
|
609
|
-
message?: string | undefined;
|
|
610
|
-
} | {
|
|
611
|
-
kind: "startsWith";
|
|
612
|
-
value: string;
|
|
613
|
-
message?: string | undefined;
|
|
614
|
-
} | {
|
|
615
|
-
kind: "endsWith";
|
|
616
|
-
value: string;
|
|
617
|
-
message?: string | undefined;
|
|
618
|
-
} | {
|
|
619
|
-
kind: "regex";
|
|
620
|
-
regex: RegExp;
|
|
621
|
-
message?: string | undefined;
|
|
622
|
-
} | {
|
|
623
|
-
kind: "trim";
|
|
624
|
-
message?: string | undefined;
|
|
625
|
-
} | {
|
|
626
|
-
kind: "toLowerCase";
|
|
627
|
-
message?: string | undefined;
|
|
628
|
-
} | {
|
|
629
|
-
kind: "toUpperCase";
|
|
630
|
-
message?: string | undefined;
|
|
631
|
-
} | {
|
|
632
|
-
kind: "jwt";
|
|
633
|
-
alg?: string;
|
|
634
|
-
message?: string | undefined;
|
|
635
|
-
} | {
|
|
636
|
-
kind: "datetime";
|
|
637
|
-
offset: boolean;
|
|
638
|
-
local: boolean;
|
|
639
|
-
precision: number | null;
|
|
640
|
-
message?: string | undefined;
|
|
641
|
-
} | {
|
|
642
|
-
kind: "date";
|
|
643
|
-
message?: string | undefined;
|
|
644
|
-
} | {
|
|
645
|
-
kind: "time";
|
|
646
|
-
precision: number | null;
|
|
647
|
-
message?: string | undefined;
|
|
648
|
-
} | {
|
|
649
|
-
kind: "duration";
|
|
650
|
-
message?: string | undefined;
|
|
651
|
-
} | {
|
|
652
|
-
kind: "ip";
|
|
653
|
-
version?: IpVersion | undefined;
|
|
654
|
-
message?: string | undefined;
|
|
655
|
-
} | {
|
|
656
|
-
kind: "cidr";
|
|
657
|
-
version?: IpVersion | undefined;
|
|
658
|
-
message?: string | undefined;
|
|
659
|
-
} | {
|
|
660
|
-
kind: "base64";
|
|
661
|
-
message?: string | undefined;
|
|
662
|
-
} | {
|
|
663
|
-
kind: "base64url";
|
|
664
|
-
message?: string | undefined;
|
|
665
|
-
};
|
|
666
|
-
interface ZodStringDef extends ZodTypeDef {
|
|
667
|
-
checks: ZodStringCheck[];
|
|
668
|
-
typeName: ZodFirstPartyTypeKind.ZodString;
|
|
669
|
-
coerce: boolean;
|
|
670
|
-
}
|
|
671
|
-
declare function datetimeRegex(args: {
|
|
672
|
-
precision?: number | null;
|
|
673
|
-
offset?: boolean;
|
|
674
|
-
local?: boolean;
|
|
675
|
-
}): RegExp;
|
|
676
|
-
declare class ZodString extends ZodType<string, ZodStringDef, string> {
|
|
677
|
-
_parse(input: ParseInput): ParseReturnType<string>;
|
|
678
|
-
protected _regex(regex: RegExp, validation: StringValidation, message?: errorUtil.ErrMessage): ZodEffects<this, string, string>;
|
|
679
|
-
_addCheck(check: ZodStringCheck): ZodString;
|
|
680
|
-
email(message?: errorUtil.ErrMessage): ZodString;
|
|
681
|
-
url(message?: errorUtil.ErrMessage): ZodString;
|
|
682
|
-
emoji(message?: errorUtil.ErrMessage): ZodString;
|
|
683
|
-
uuid(message?: errorUtil.ErrMessage): ZodString;
|
|
684
|
-
nanoid(message?: errorUtil.ErrMessage): ZodString;
|
|
685
|
-
cuid(message?: errorUtil.ErrMessage): ZodString;
|
|
686
|
-
cuid2(message?: errorUtil.ErrMessage): ZodString;
|
|
687
|
-
ulid(message?: errorUtil.ErrMessage): ZodString;
|
|
688
|
-
base64(message?: errorUtil.ErrMessage): ZodString;
|
|
689
|
-
base64url(message?: errorUtil.ErrMessage): ZodString;
|
|
690
|
-
jwt(options?: {
|
|
691
|
-
alg?: string;
|
|
692
|
-
message?: string | undefined;
|
|
693
|
-
}): ZodString;
|
|
694
|
-
ip(options?: string | {
|
|
695
|
-
version?: IpVersion;
|
|
696
|
-
message?: string | undefined;
|
|
697
|
-
}): ZodString;
|
|
698
|
-
cidr(options?: string | {
|
|
699
|
-
version?: IpVersion;
|
|
700
|
-
message?: string | undefined;
|
|
701
|
-
}): ZodString;
|
|
702
|
-
datetime(options?: string | {
|
|
703
|
-
message?: string | undefined;
|
|
704
|
-
precision?: number | null;
|
|
705
|
-
offset?: boolean;
|
|
706
|
-
local?: boolean;
|
|
707
|
-
}): ZodString;
|
|
708
|
-
date(message?: string): ZodString;
|
|
709
|
-
time(options?: string | {
|
|
710
|
-
message?: string | undefined;
|
|
711
|
-
precision?: number | null;
|
|
712
|
-
}): ZodString;
|
|
713
|
-
duration(message?: errorUtil.ErrMessage): ZodString;
|
|
714
|
-
regex(regex: RegExp, message?: errorUtil.ErrMessage): ZodString;
|
|
715
|
-
includes(value: string, options?: {
|
|
716
|
-
message?: string;
|
|
717
|
-
position?: number;
|
|
718
|
-
}): ZodString;
|
|
719
|
-
startsWith(value: string, message?: errorUtil.ErrMessage): ZodString;
|
|
720
|
-
endsWith(value: string, message?: errorUtil.ErrMessage): ZodString;
|
|
721
|
-
min(minLength: number, message?: errorUtil.ErrMessage): ZodString;
|
|
722
|
-
max(maxLength: number, message?: errorUtil.ErrMessage): ZodString;
|
|
723
|
-
length(len: number, message?: errorUtil.ErrMessage): ZodString;
|
|
724
|
-
/**
|
|
725
|
-
* Equivalent to `.min(1)`
|
|
726
|
-
*/
|
|
727
|
-
nonempty(message?: errorUtil.ErrMessage): ZodString;
|
|
728
|
-
trim(): ZodString;
|
|
729
|
-
toLowerCase(): ZodString;
|
|
730
|
-
toUpperCase(): ZodString;
|
|
731
|
-
get isDatetime(): boolean;
|
|
732
|
-
get isDate(): boolean;
|
|
733
|
-
get isTime(): boolean;
|
|
734
|
-
get isDuration(): boolean;
|
|
735
|
-
get isEmail(): boolean;
|
|
736
|
-
get isURL(): boolean;
|
|
737
|
-
get isEmoji(): boolean;
|
|
738
|
-
get isUUID(): boolean;
|
|
739
|
-
get isNANOID(): boolean;
|
|
740
|
-
get isCUID(): boolean;
|
|
741
|
-
get isCUID2(): boolean;
|
|
742
|
-
get isULID(): boolean;
|
|
743
|
-
get isIP(): boolean;
|
|
744
|
-
get isCIDR(): boolean;
|
|
745
|
-
get isBase64(): boolean;
|
|
746
|
-
get isBase64url(): boolean;
|
|
747
|
-
get minLength(): number | null;
|
|
748
|
-
get maxLength(): number | null;
|
|
749
|
-
static create: (params?: RawCreateParams & {
|
|
750
|
-
coerce?: true;
|
|
751
|
-
}) => ZodString;
|
|
752
|
-
}
|
|
753
|
-
type ZodNumberCheck = {
|
|
754
|
-
kind: "min";
|
|
755
|
-
value: number;
|
|
756
|
-
inclusive: boolean;
|
|
757
|
-
message?: string | undefined;
|
|
758
|
-
} | {
|
|
759
|
-
kind: "max";
|
|
760
|
-
value: number;
|
|
761
|
-
inclusive: boolean;
|
|
762
|
-
message?: string | undefined;
|
|
763
|
-
} | {
|
|
764
|
-
kind: "int";
|
|
765
|
-
message?: string | undefined;
|
|
766
|
-
} | {
|
|
767
|
-
kind: "multipleOf";
|
|
768
|
-
value: number;
|
|
769
|
-
message?: string | undefined;
|
|
770
|
-
} | {
|
|
771
|
-
kind: "finite";
|
|
772
|
-
message?: string | undefined;
|
|
773
|
-
};
|
|
774
|
-
interface ZodNumberDef extends ZodTypeDef {
|
|
775
|
-
checks: ZodNumberCheck[];
|
|
776
|
-
typeName: ZodFirstPartyTypeKind.ZodNumber;
|
|
777
|
-
coerce: boolean;
|
|
778
|
-
}
|
|
779
|
-
declare class ZodNumber extends ZodType<number, ZodNumberDef, number> {
|
|
780
|
-
_parse(input: ParseInput): ParseReturnType<number>;
|
|
781
|
-
static create: (params?: RawCreateParams & {
|
|
782
|
-
coerce?: boolean;
|
|
783
|
-
}) => ZodNumber;
|
|
784
|
-
gte(value: number, message?: errorUtil.ErrMessage): ZodNumber;
|
|
785
|
-
min: (value: number, message?: errorUtil.ErrMessage) => ZodNumber;
|
|
786
|
-
gt(value: number, message?: errorUtil.ErrMessage): ZodNumber;
|
|
787
|
-
lte(value: number, message?: errorUtil.ErrMessage): ZodNumber;
|
|
788
|
-
max: (value: number, message?: errorUtil.ErrMessage) => ZodNumber;
|
|
789
|
-
lt(value: number, message?: errorUtil.ErrMessage): ZodNumber;
|
|
790
|
-
protected setLimit(kind: "min" | "max", value: number, inclusive: boolean, message?: string): ZodNumber;
|
|
791
|
-
_addCheck(check: ZodNumberCheck): ZodNumber;
|
|
792
|
-
int(message?: errorUtil.ErrMessage): ZodNumber;
|
|
793
|
-
positive(message?: errorUtil.ErrMessage): ZodNumber;
|
|
794
|
-
negative(message?: errorUtil.ErrMessage): ZodNumber;
|
|
795
|
-
nonpositive(message?: errorUtil.ErrMessage): ZodNumber;
|
|
796
|
-
nonnegative(message?: errorUtil.ErrMessage): ZodNumber;
|
|
797
|
-
multipleOf(value: number, message?: errorUtil.ErrMessage): ZodNumber;
|
|
798
|
-
step: (value: number, message?: errorUtil.ErrMessage) => ZodNumber;
|
|
799
|
-
finite(message?: errorUtil.ErrMessage): ZodNumber;
|
|
800
|
-
safe(message?: errorUtil.ErrMessage): ZodNumber;
|
|
801
|
-
get minValue(): number | null;
|
|
802
|
-
get maxValue(): number | null;
|
|
803
|
-
get isInt(): boolean;
|
|
804
|
-
get isFinite(): boolean;
|
|
805
|
-
}
|
|
806
|
-
type ZodBigIntCheck = {
|
|
807
|
-
kind: "min";
|
|
808
|
-
value: bigint;
|
|
809
|
-
inclusive: boolean;
|
|
810
|
-
message?: string | undefined;
|
|
811
|
-
} | {
|
|
812
|
-
kind: "max";
|
|
813
|
-
value: bigint;
|
|
814
|
-
inclusive: boolean;
|
|
815
|
-
message?: string | undefined;
|
|
816
|
-
} | {
|
|
817
|
-
kind: "multipleOf";
|
|
818
|
-
value: bigint;
|
|
819
|
-
message?: string | undefined;
|
|
820
|
-
};
|
|
821
|
-
interface ZodBigIntDef extends ZodTypeDef {
|
|
822
|
-
checks: ZodBigIntCheck[];
|
|
823
|
-
typeName: ZodFirstPartyTypeKind.ZodBigInt;
|
|
824
|
-
coerce: boolean;
|
|
825
|
-
}
|
|
826
|
-
declare class ZodBigInt extends ZodType<bigint, ZodBigIntDef, bigint> {
|
|
827
|
-
_parse(input: ParseInput): ParseReturnType<bigint>;
|
|
828
|
-
_getInvalidInput(input: ParseInput): INVALID;
|
|
829
|
-
static create: (params?: RawCreateParams & {
|
|
830
|
-
coerce?: boolean;
|
|
831
|
-
}) => ZodBigInt;
|
|
832
|
-
gte(value: bigint, message?: errorUtil.ErrMessage): ZodBigInt;
|
|
833
|
-
min: (value: bigint, message?: errorUtil.ErrMessage) => ZodBigInt;
|
|
834
|
-
gt(value: bigint, message?: errorUtil.ErrMessage): ZodBigInt;
|
|
835
|
-
lte(value: bigint, message?: errorUtil.ErrMessage): ZodBigInt;
|
|
836
|
-
max: (value: bigint, message?: errorUtil.ErrMessage) => ZodBigInt;
|
|
837
|
-
lt(value: bigint, message?: errorUtil.ErrMessage): ZodBigInt;
|
|
838
|
-
protected setLimit(kind: "min" | "max", value: bigint, inclusive: boolean, message?: string): ZodBigInt;
|
|
839
|
-
_addCheck(check: ZodBigIntCheck): ZodBigInt;
|
|
840
|
-
positive(message?: errorUtil.ErrMessage): ZodBigInt;
|
|
841
|
-
negative(message?: errorUtil.ErrMessage): ZodBigInt;
|
|
842
|
-
nonpositive(message?: errorUtil.ErrMessage): ZodBigInt;
|
|
843
|
-
nonnegative(message?: errorUtil.ErrMessage): ZodBigInt;
|
|
844
|
-
multipleOf(value: bigint, message?: errorUtil.ErrMessage): ZodBigInt;
|
|
845
|
-
get minValue(): bigint | null;
|
|
846
|
-
get maxValue(): bigint | null;
|
|
847
|
-
}
|
|
848
|
-
interface ZodBooleanDef extends ZodTypeDef {
|
|
849
|
-
typeName: ZodFirstPartyTypeKind.ZodBoolean;
|
|
850
|
-
coerce: boolean;
|
|
851
|
-
}
|
|
852
|
-
declare class ZodBoolean extends ZodType<boolean, ZodBooleanDef, boolean> {
|
|
853
|
-
_parse(input: ParseInput): ParseReturnType<boolean>;
|
|
854
|
-
static create: (params?: RawCreateParams & {
|
|
855
|
-
coerce?: boolean;
|
|
856
|
-
}) => ZodBoolean;
|
|
857
|
-
}
|
|
858
|
-
type ZodDateCheck = {
|
|
859
|
-
kind: "min";
|
|
860
|
-
value: number;
|
|
861
|
-
message?: string | undefined;
|
|
862
|
-
} | {
|
|
863
|
-
kind: "max";
|
|
864
|
-
value: number;
|
|
865
|
-
message?: string | undefined;
|
|
866
|
-
};
|
|
867
|
-
interface ZodDateDef extends ZodTypeDef {
|
|
868
|
-
checks: ZodDateCheck[];
|
|
869
|
-
coerce: boolean;
|
|
870
|
-
typeName: ZodFirstPartyTypeKind.ZodDate;
|
|
871
|
-
}
|
|
872
|
-
declare class ZodDate extends ZodType<Date, ZodDateDef, Date> {
|
|
873
|
-
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
874
|
-
_addCheck(check: ZodDateCheck): ZodDate;
|
|
875
|
-
min(minDate: Date, message?: errorUtil.ErrMessage): ZodDate;
|
|
876
|
-
max(maxDate: Date, message?: errorUtil.ErrMessage): ZodDate;
|
|
877
|
-
get minDate(): Date | null;
|
|
878
|
-
get maxDate(): Date | null;
|
|
879
|
-
static create: (params?: RawCreateParams & {
|
|
880
|
-
coerce?: boolean;
|
|
881
|
-
}) => ZodDate;
|
|
882
|
-
}
|
|
883
|
-
interface ZodSymbolDef extends ZodTypeDef {
|
|
884
|
-
typeName: ZodFirstPartyTypeKind.ZodSymbol;
|
|
885
|
-
}
|
|
886
|
-
declare class ZodSymbol extends ZodType<symbol, ZodSymbolDef, symbol> {
|
|
887
|
-
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
888
|
-
static create: (params?: RawCreateParams) => ZodSymbol;
|
|
889
|
-
}
|
|
890
|
-
interface ZodUndefinedDef extends ZodTypeDef {
|
|
891
|
-
typeName: ZodFirstPartyTypeKind.ZodUndefined;
|
|
892
|
-
}
|
|
893
|
-
declare class ZodUndefined extends ZodType<undefined, ZodUndefinedDef, undefined> {
|
|
894
|
-
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
895
|
-
params?: RawCreateParams;
|
|
896
|
-
static create: (params?: RawCreateParams) => ZodUndefined;
|
|
897
|
-
}
|
|
898
|
-
interface ZodNullDef extends ZodTypeDef {
|
|
899
|
-
typeName: ZodFirstPartyTypeKind.ZodNull;
|
|
900
|
-
}
|
|
901
|
-
declare class ZodNull extends ZodType<null, ZodNullDef, null> {
|
|
902
|
-
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
903
|
-
static create: (params?: RawCreateParams) => ZodNull;
|
|
904
|
-
}
|
|
905
|
-
interface ZodAnyDef extends ZodTypeDef {
|
|
906
|
-
typeName: ZodFirstPartyTypeKind.ZodAny;
|
|
907
|
-
}
|
|
908
|
-
declare class ZodAny extends ZodType<any, ZodAnyDef, any> {
|
|
909
|
-
_any: true;
|
|
910
|
-
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
911
|
-
static create: (params?: RawCreateParams) => ZodAny;
|
|
912
|
-
}
|
|
913
|
-
interface ZodUnknownDef extends ZodTypeDef {
|
|
914
|
-
typeName: ZodFirstPartyTypeKind.ZodUnknown;
|
|
915
|
-
}
|
|
916
|
-
declare class ZodUnknown extends ZodType<unknown, ZodUnknownDef, unknown> {
|
|
917
|
-
_unknown: true;
|
|
918
|
-
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
919
|
-
static create: (params?: RawCreateParams) => ZodUnknown;
|
|
920
|
-
}
|
|
921
|
-
interface ZodNeverDef extends ZodTypeDef {
|
|
922
|
-
typeName: ZodFirstPartyTypeKind.ZodNever;
|
|
923
|
-
}
|
|
924
|
-
declare class ZodNever extends ZodType<never, ZodNeverDef, never> {
|
|
925
|
-
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
926
|
-
static create: (params?: RawCreateParams) => ZodNever;
|
|
927
|
-
}
|
|
928
|
-
interface ZodVoidDef extends ZodTypeDef {
|
|
929
|
-
typeName: ZodFirstPartyTypeKind.ZodVoid;
|
|
930
|
-
}
|
|
931
|
-
declare class ZodVoid extends ZodType<void, ZodVoidDef, void> {
|
|
932
|
-
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
933
|
-
static create: (params?: RawCreateParams) => ZodVoid;
|
|
934
|
-
}
|
|
935
|
-
interface ZodArrayDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
936
|
-
type: T;
|
|
937
|
-
typeName: ZodFirstPartyTypeKind.ZodArray;
|
|
938
|
-
exactLength: {
|
|
939
|
-
value: number;
|
|
940
|
-
message?: string | undefined;
|
|
941
|
-
} | null;
|
|
942
|
-
minLength: {
|
|
943
|
-
value: number;
|
|
944
|
-
message?: string | undefined;
|
|
945
|
-
} | null;
|
|
946
|
-
maxLength: {
|
|
947
|
-
value: number;
|
|
948
|
-
message?: string | undefined;
|
|
949
|
-
} | null;
|
|
950
|
-
}
|
|
951
|
-
type ArrayCardinality = "many" | "atleastone";
|
|
952
|
-
type arrayOutputType<T extends ZodTypeAny, Cardinality extends ArrayCardinality = "many"> = Cardinality extends "atleastone" ? [
|
|
953
|
-
T["_output"],
|
|
954
|
-
...T["_output"][]
|
|
955
|
-
] : T["_output"][];
|
|
956
|
-
declare class ZodArray<T extends ZodTypeAny, Cardinality extends ArrayCardinality = "many"> extends ZodType<arrayOutputType<T, Cardinality>, ZodArrayDef<T>, Cardinality extends "atleastone" ? [
|
|
957
|
-
T["_input"],
|
|
958
|
-
...T["_input"][]
|
|
959
|
-
] : T["_input"][]> {
|
|
960
|
-
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
961
|
-
get element(): T;
|
|
962
|
-
min(minLength: number, message?: errorUtil.ErrMessage): this;
|
|
963
|
-
max(maxLength: number, message?: errorUtil.ErrMessage): this;
|
|
964
|
-
length(len: number, message?: errorUtil.ErrMessage): this;
|
|
965
|
-
nonempty(message?: errorUtil.ErrMessage): ZodArray<T, "atleastone">;
|
|
966
|
-
static create: <El extends ZodTypeAny>(schema: El, params?: RawCreateParams) => ZodArray<El>;
|
|
967
|
-
}
|
|
968
|
-
type ZodNonEmptyArray<T extends ZodTypeAny> = ZodArray<T, "atleastone">;
|
|
969
|
-
type UnknownKeysParam = "passthrough" | "strict" | "strip";
|
|
970
|
-
interface ZodObjectDef<T extends ZodRawShape = ZodRawShape, UnknownKeys extends UnknownKeysParam = UnknownKeysParam, Catchall extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
971
|
-
typeName: ZodFirstPartyTypeKind.ZodObject;
|
|
972
|
-
shape: () => T;
|
|
973
|
-
catchall: Catchall;
|
|
974
|
-
unknownKeys: UnknownKeys;
|
|
975
|
-
}
|
|
976
|
-
type mergeTypes<A, B> = {
|
|
977
|
-
[k in keyof A | keyof B]: k extends keyof B ? B[k] : k extends keyof A ? A[k] : never;
|
|
978
|
-
};
|
|
979
|
-
type objectOutputType<Shape extends ZodRawShape, Catchall extends ZodTypeAny, UnknownKeys extends UnknownKeysParam = UnknownKeysParam> = objectUtil.flatten<objectUtil.addQuestionMarks<baseObjectOutputType<Shape>>> & CatchallOutput<Catchall> & PassthroughType<UnknownKeys>;
|
|
980
|
-
type baseObjectOutputType<Shape extends ZodRawShape> = {
|
|
981
|
-
[k in keyof Shape]: Shape[k]["_output"];
|
|
982
|
-
};
|
|
983
|
-
type objectInputType<Shape extends ZodRawShape, Catchall extends ZodTypeAny, UnknownKeys extends UnknownKeysParam = UnknownKeysParam> = objectUtil.flatten<baseObjectInputType<Shape>> & CatchallInput<Catchall> & PassthroughType<UnknownKeys>;
|
|
984
|
-
type baseObjectInputType<Shape extends ZodRawShape> = objectUtil.addQuestionMarks<{
|
|
985
|
-
[k in keyof Shape]: Shape[k]["_input"];
|
|
986
|
-
}>;
|
|
987
|
-
type CatchallOutput<T extends ZodType> = ZodType extends T ? unknown : {
|
|
988
|
-
[k: string]: T["_output"];
|
|
989
|
-
};
|
|
990
|
-
type CatchallInput<T extends ZodType> = ZodType extends T ? unknown : {
|
|
991
|
-
[k: string]: T["_input"];
|
|
992
|
-
};
|
|
993
|
-
type PassthroughType<T extends UnknownKeysParam> = T extends "passthrough" ? {
|
|
994
|
-
[k: string]: unknown;
|
|
995
|
-
} : unknown;
|
|
996
|
-
type deoptional<T extends ZodTypeAny> = T extends ZodOptional<infer U> ? deoptional<U> : T extends ZodNullable<infer U> ? ZodNullable<deoptional<U>> : T;
|
|
997
|
-
type SomeZodObject = ZodObject<ZodRawShape, UnknownKeysParam, ZodTypeAny>;
|
|
998
|
-
type noUnrecognized<Obj extends object, Shape extends object> = {
|
|
999
|
-
[k in keyof Obj]: k extends keyof Shape ? Obj[k] : never;
|
|
1000
|
-
};
|
|
1001
|
-
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> {
|
|
1002
|
-
private _cached;
|
|
1003
|
-
_getCached(): {
|
|
1004
|
-
shape: T;
|
|
1005
|
-
keys: string[];
|
|
1006
|
-
};
|
|
1007
|
-
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1008
|
-
get shape(): T;
|
|
1009
|
-
strict(message?: errorUtil.ErrMessage): ZodObject<T, "strict", Catchall>;
|
|
1010
|
-
strip(): ZodObject<T, "strip", Catchall>;
|
|
1011
|
-
passthrough(): ZodObject<T, "passthrough", Catchall>;
|
|
1012
|
-
/**
|
|
1013
|
-
* @deprecated In most cases, this is no longer needed - unknown properties are now silently stripped.
|
|
1014
|
-
* If you want to pass through unknown properties, use `.passthrough()` instead.
|
|
1015
|
-
*/
|
|
1016
|
-
nonstrict: () => ZodObject<T, "passthrough", Catchall>;
|
|
1017
|
-
extend<Augmentation extends ZodRawShape>(augmentation: Augmentation): ZodObject<objectUtil.extendShape<T, Augmentation>, UnknownKeys, Catchall>;
|
|
1018
|
-
/**
|
|
1019
|
-
* @deprecated Use `.extend` instead
|
|
1020
|
-
* */
|
|
1021
|
-
augment: <Augmentation extends ZodRawShape>(augmentation: Augmentation) => ZodObject<objectUtil.extendShape<T, Augmentation>, UnknownKeys, Catchall>;
|
|
1022
|
-
/**
|
|
1023
|
-
* Prior to zod@1.0.12 there was a bug in the
|
|
1024
|
-
* inferred type of merged objects. Please
|
|
1025
|
-
* upgrade if you are experiencing issues.
|
|
1026
|
-
*/
|
|
1027
|
-
merge<Incoming extends AnyZodObject, Augmentation extends Incoming["shape"]>(merging: Incoming): ZodObject<objectUtil.extendShape<T, Augmentation>, Incoming["_def"]["unknownKeys"], Incoming["_def"]["catchall"]>;
|
|
1028
|
-
setKey<Key extends string, Schema extends ZodTypeAny>(key: Key, schema: Schema): ZodObject<T & {
|
|
1029
|
-
[k in Key]: Schema;
|
|
1030
|
-
}, UnknownKeys, Catchall>;
|
|
1031
|
-
catchall<Index extends ZodTypeAny>(index: Index): ZodObject<T, UnknownKeys, Index>;
|
|
1032
|
-
pick<Mask extends util.Exactly<{
|
|
1033
|
-
[k in keyof T]?: true;
|
|
1034
|
-
}, Mask>>(mask: Mask): ZodObject<Pick<T, Extract<keyof T, keyof Mask>>, UnknownKeys, Catchall>;
|
|
1035
|
-
omit<Mask extends util.Exactly<{
|
|
1036
|
-
[k in keyof T]?: true;
|
|
1037
|
-
}, Mask>>(mask: Mask): ZodObject<Omit<T, keyof Mask>, UnknownKeys, Catchall>;
|
|
1038
|
-
/**
|
|
1039
|
-
* @deprecated
|
|
1040
|
-
*/
|
|
1041
|
-
deepPartial(): partialUtil.DeepPartial<this>;
|
|
1042
|
-
partial(): ZodObject<{
|
|
1043
|
-
[k in keyof T]: ZodOptional<T[k]>;
|
|
1044
|
-
}, UnknownKeys, Catchall>;
|
|
1045
|
-
partial<Mask extends util.Exactly<{
|
|
1046
|
-
[k in keyof T]?: true;
|
|
1047
|
-
}, Mask>>(mask: Mask): ZodObject<objectUtil.noNever<{
|
|
1048
|
-
[k in keyof T]: k extends keyof Mask ? ZodOptional<T[k]> : T[k];
|
|
1049
|
-
}>, UnknownKeys, Catchall>;
|
|
1050
|
-
required(): ZodObject<{
|
|
1051
|
-
[k in keyof T]: deoptional<T[k]>;
|
|
1052
|
-
}, UnknownKeys, Catchall>;
|
|
1053
|
-
required<Mask extends util.Exactly<{
|
|
1054
|
-
[k in keyof T]?: true;
|
|
1055
|
-
}, Mask>>(mask: Mask): ZodObject<objectUtil.noNever<{
|
|
1056
|
-
[k in keyof T]: k extends keyof Mask ? deoptional<T[k]> : T[k];
|
|
1057
|
-
}>, UnknownKeys, Catchall>;
|
|
1058
|
-
keyof(): ZodEnum<enumUtil.UnionToTupleString<keyof T>>;
|
|
1059
|
-
static create: <Shape extends ZodRawShape>(shape: Shape, params?: RawCreateParams) => ZodObject<Shape, "strip", ZodTypeAny, objectOutputType<Shape, ZodTypeAny, "strip">, objectInputType<Shape, ZodTypeAny, "strip">>;
|
|
1060
|
-
static strictCreate: <Shape extends ZodRawShape>(shape: Shape, params?: RawCreateParams) => ZodObject<Shape, "strict">;
|
|
1061
|
-
static lazycreate: <Shape extends ZodRawShape>(shape: () => Shape, params?: RawCreateParams) => ZodObject<Shape, "strip">;
|
|
1062
|
-
}
|
|
1063
|
-
type AnyZodObject = ZodObject<any, any, any>;
|
|
1064
|
-
type ZodUnionOptions = Readonly<[
|
|
1065
|
-
ZodTypeAny,
|
|
1066
|
-
...ZodTypeAny[]
|
|
1067
|
-
]>;
|
|
1068
|
-
interface ZodUnionDef<T extends ZodUnionOptions = Readonly<[
|
|
1069
|
-
ZodTypeAny,
|
|
1070
|
-
ZodTypeAny,
|
|
1071
|
-
...ZodTypeAny[]
|
|
1072
|
-
]>> extends ZodTypeDef {
|
|
1073
|
-
options: T;
|
|
1074
|
-
typeName: ZodFirstPartyTypeKind.ZodUnion;
|
|
1075
|
-
}
|
|
1076
|
-
declare class ZodUnion<T extends ZodUnionOptions> extends ZodType<T[number]["_output"], ZodUnionDef<T>, T[number]["_input"]> {
|
|
1077
|
-
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1078
|
-
get options(): T;
|
|
1079
|
-
static create: <Options extends Readonly<[
|
|
1080
|
-
ZodTypeAny,
|
|
1081
|
-
ZodTypeAny,
|
|
1082
|
-
...ZodTypeAny[]
|
|
1083
|
-
]>>(types: Options, params?: RawCreateParams) => ZodUnion<Options>;
|
|
1084
|
-
}
|
|
1085
|
-
type ZodDiscriminatedUnionOption<Discriminator extends string> = ZodObject<{
|
|
1086
|
-
[key in Discriminator]: ZodTypeAny;
|
|
1087
|
-
} & ZodRawShape, UnknownKeysParam, ZodTypeAny>;
|
|
1088
|
-
interface ZodDiscriminatedUnionDef<Discriminator extends string, Options extends readonly ZodDiscriminatedUnionOption<string>[] = ZodDiscriminatedUnionOption<string>[]> extends ZodTypeDef {
|
|
1089
|
-
discriminator: Discriminator;
|
|
1090
|
-
options: Options;
|
|
1091
|
-
optionsMap: Map<Primitive, ZodDiscriminatedUnionOption<any>>;
|
|
1092
|
-
typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion;
|
|
1093
|
-
}
|
|
1094
|
-
declare class ZodDiscriminatedUnion<Discriminator extends string, Options extends readonly ZodDiscriminatedUnionOption<Discriminator>[]> extends ZodType<output<Options[number]>, ZodDiscriminatedUnionDef<Discriminator, Options>, input<Options[number]>> {
|
|
1095
|
-
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1096
|
-
get discriminator(): Discriminator;
|
|
1097
|
-
get options(): Options;
|
|
1098
|
-
get optionsMap(): Map<Primitive, ZodDiscriminatedUnionOption<any>>;
|
|
1099
|
-
/**
|
|
1100
|
-
* The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.
|
|
1101
|
-
* However, it only allows a union of objects, all of which need to share a discriminator property. This property must
|
|
1102
|
-
* have a different value for each object in the union.
|
|
1103
|
-
* @param discriminator the name of the discriminator property
|
|
1104
|
-
* @param types an array of object schemas
|
|
1105
|
-
* @param params
|
|
1106
|
-
*/
|
|
1107
|
-
static create<Discriminator extends string, Types extends readonly [
|
|
1108
|
-
ZodDiscriminatedUnionOption<Discriminator>,
|
|
1109
|
-
...ZodDiscriminatedUnionOption<Discriminator>[]
|
|
1110
|
-
]>(discriminator: Discriminator, options: Types, params?: RawCreateParams): ZodDiscriminatedUnion<Discriminator, Types>;
|
|
1111
|
-
}
|
|
1112
|
-
interface ZodIntersectionDef<T extends ZodTypeAny = ZodTypeAny, U extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1113
|
-
left: T;
|
|
1114
|
-
right: U;
|
|
1115
|
-
typeName: ZodFirstPartyTypeKind.ZodIntersection;
|
|
1116
|
-
}
|
|
1117
|
-
declare class ZodIntersection<T extends ZodTypeAny, U extends ZodTypeAny> extends ZodType<T["_output"] & U["_output"], ZodIntersectionDef<T, U>, T["_input"] & U["_input"]> {
|
|
1118
|
-
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1119
|
-
static create: <TSchema extends ZodTypeAny, USchema extends ZodTypeAny>(left: TSchema, right: USchema, params?: RawCreateParams) => ZodIntersection<TSchema, USchema>;
|
|
1120
|
-
}
|
|
1121
|
-
type ZodTupleItems = [
|
|
1122
|
-
ZodTypeAny,
|
|
1123
|
-
...ZodTypeAny[]
|
|
1124
|
-
];
|
|
1125
|
-
type AssertArray<T> = T extends any[] ? T : never;
|
|
1126
|
-
type OutputTypeOfTuple<T extends ZodTupleItems | [
|
|
1127
|
-
]> = AssertArray<{
|
|
1128
|
-
[k in keyof T]: T[k] extends ZodType<any, any, any> ? T[k]["_output"] : never;
|
|
1129
|
-
}>;
|
|
1130
|
-
type OutputTypeOfTupleWithRest<T extends ZodTupleItems | [
|
|
1131
|
-
], Rest extends ZodTypeAny | null = null> = Rest extends ZodTypeAny ? [
|
|
1132
|
-
...OutputTypeOfTuple<T>,
|
|
1133
|
-
...Rest["_output"][]
|
|
1134
|
-
] : OutputTypeOfTuple<T>;
|
|
1135
|
-
type InputTypeOfTuple<T extends ZodTupleItems | [
|
|
1136
|
-
]> = AssertArray<{
|
|
1137
|
-
[k in keyof T]: T[k] extends ZodType<any, any, any> ? T[k]["_input"] : never;
|
|
1138
|
-
}>;
|
|
1139
|
-
type InputTypeOfTupleWithRest<T extends ZodTupleItems | [
|
|
1140
|
-
], Rest extends ZodTypeAny | null = null> = Rest extends ZodTypeAny ? [
|
|
1141
|
-
...InputTypeOfTuple<T>,
|
|
1142
|
-
...Rest["_input"][]
|
|
1143
|
-
] : InputTypeOfTuple<T>;
|
|
1144
|
-
interface ZodTupleDef<T extends ZodTupleItems | [
|
|
1145
|
-
] = ZodTupleItems, Rest extends ZodTypeAny | null = null> extends ZodTypeDef {
|
|
1146
|
-
items: T;
|
|
1147
|
-
rest: Rest;
|
|
1148
|
-
typeName: ZodFirstPartyTypeKind.ZodTuple;
|
|
1149
|
-
}
|
|
1150
|
-
type AnyZodTuple = ZodTuple<[
|
|
1151
|
-
ZodTypeAny,
|
|
1152
|
-
...ZodTypeAny[]
|
|
1153
|
-
] | [
|
|
1154
|
-
], ZodTypeAny | null>;
|
|
1155
|
-
declare class ZodTuple<T extends ZodTupleItems | [
|
|
1156
|
-
] = ZodTupleItems, Rest extends ZodTypeAny | null = null> extends ZodType<OutputTypeOfTupleWithRest<T, Rest>, ZodTupleDef<T, Rest>, InputTypeOfTupleWithRest<T, Rest>> {
|
|
1157
|
-
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1158
|
-
get items(): T;
|
|
1159
|
-
rest<RestSchema extends ZodTypeAny>(rest: RestSchema): ZodTuple<T, RestSchema>;
|
|
1160
|
-
static create: <Items extends [
|
|
1161
|
-
ZodTypeAny,
|
|
1162
|
-
...ZodTypeAny[]
|
|
1163
|
-
] | [
|
|
1164
|
-
]>(schemas: Items, params?: RawCreateParams) => ZodTuple<Items, null>;
|
|
1165
|
-
}
|
|
1166
|
-
interface ZodRecordDef<Key extends KeySchema = ZodString, Value extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1167
|
-
valueType: Value;
|
|
1168
|
-
keyType: Key;
|
|
1169
|
-
typeName: ZodFirstPartyTypeKind.ZodRecord;
|
|
1170
|
-
}
|
|
1171
|
-
type KeySchema = ZodType<string | number | symbol, any, any>;
|
|
1172
|
-
type RecordType<K extends string | number | symbol, V> = [
|
|
1173
|
-
string
|
|
1174
|
-
] extends [
|
|
1175
|
-
K
|
|
1176
|
-
] ? Record<K, V> : [
|
|
1177
|
-
number
|
|
1178
|
-
] extends [
|
|
1179
|
-
K
|
|
1180
|
-
] ? Record<K, V> : [
|
|
1181
|
-
symbol
|
|
1182
|
-
] extends [
|
|
1183
|
-
K
|
|
1184
|
-
] ? Record<K, V> : [
|
|
1185
|
-
BRAND<string | number | symbol>
|
|
1186
|
-
] extends [
|
|
1187
|
-
K
|
|
1188
|
-
] ? Record<K, V> : Partial<Record<K, V>>;
|
|
1189
|
-
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"]>> {
|
|
1190
|
-
get keySchema(): Key;
|
|
1191
|
-
get valueSchema(): Value;
|
|
1192
|
-
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1193
|
-
get element(): Value;
|
|
1194
|
-
static create<Value extends ZodTypeAny>(valueType: Value, params?: RawCreateParams): ZodRecord<ZodString, Value>;
|
|
1195
|
-
static create<Keys extends KeySchema, Value extends ZodTypeAny>(keySchema: Keys, valueType: Value, params?: RawCreateParams): ZodRecord<Keys, Value>;
|
|
1196
|
-
}
|
|
1197
|
-
interface ZodMapDef<Key extends ZodTypeAny = ZodTypeAny, Value extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1198
|
-
valueType: Value;
|
|
1199
|
-
keyType: Key;
|
|
1200
|
-
typeName: ZodFirstPartyTypeKind.ZodMap;
|
|
1201
|
-
}
|
|
1202
|
-
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"]>> {
|
|
1203
|
-
get keySchema(): Key;
|
|
1204
|
-
get valueSchema(): Value;
|
|
1205
|
-
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1206
|
-
static create: <KeySchema extends ZodTypeAny = ZodTypeAny, ValueSchema extends ZodTypeAny = ZodTypeAny>(keyType: KeySchema, valueType: ValueSchema, params?: RawCreateParams) => ZodMap<KeySchema, ValueSchema>;
|
|
1207
|
-
}
|
|
1208
|
-
interface ZodSetDef<Value extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1209
|
-
valueType: Value;
|
|
1210
|
-
typeName: ZodFirstPartyTypeKind.ZodSet;
|
|
1211
|
-
minSize: {
|
|
1212
|
-
value: number;
|
|
1213
|
-
message?: string | undefined;
|
|
1214
|
-
} | null;
|
|
1215
|
-
maxSize: {
|
|
1216
|
-
value: number;
|
|
1217
|
-
message?: string | undefined;
|
|
1218
|
-
} | null;
|
|
1219
|
-
}
|
|
1220
|
-
declare class ZodSet<Value extends ZodTypeAny = ZodTypeAny> extends ZodType<Set<Value["_output"]>, ZodSetDef<Value>, Set<Value["_input"]>> {
|
|
1221
|
-
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1222
|
-
min(minSize: number, message?: errorUtil.ErrMessage): this;
|
|
1223
|
-
max(maxSize: number, message?: errorUtil.ErrMessage): this;
|
|
1224
|
-
size(size: number, message?: errorUtil.ErrMessage): this;
|
|
1225
|
-
nonempty(message?: errorUtil.ErrMessage): ZodSet<Value>;
|
|
1226
|
-
static create: <ValueSchema extends ZodTypeAny = ZodTypeAny>(valueType: ValueSchema, params?: RawCreateParams) => ZodSet<ValueSchema>;
|
|
1227
|
-
}
|
|
1228
|
-
interface ZodFunctionDef<Args extends ZodTuple<any, any> = ZodTuple<any, any>, Returns extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1229
|
-
args: Args;
|
|
1230
|
-
returns: Returns;
|
|
1231
|
-
typeName: ZodFirstPartyTypeKind.ZodFunction;
|
|
1232
|
-
}
|
|
1233
|
-
type OuterTypeOfFunction<Args extends ZodTuple<any, any>, Returns extends ZodTypeAny> = Args["_input"] extends Array<any> ? (...args: Args["_input"]) => Returns["_output"] : never;
|
|
1234
|
-
type InnerTypeOfFunction<Args extends ZodTuple<any, any>, Returns extends ZodTypeAny> = Args["_output"] extends Array<any> ? (...args: Args["_output"]) => Returns["_input"] : never;
|
|
1235
|
-
declare class ZodFunction<Args extends ZodTuple<any, any>, Returns extends ZodTypeAny> extends ZodType<OuterTypeOfFunction<Args, Returns>, ZodFunctionDef<Args, Returns>, InnerTypeOfFunction<Args, Returns>> {
|
|
1236
|
-
_parse(input: ParseInput): ParseReturnType<any>;
|
|
1237
|
-
parameters(): Args;
|
|
1238
|
-
returnType(): Returns;
|
|
1239
|
-
args<Items extends Parameters<(typeof ZodTuple)["create"]>[0]>(...items: Items): ZodFunction<ZodTuple<Items, ZodUnknown>, Returns>;
|
|
1240
|
-
returns<NewReturnType extends ZodType<any, any, any>>(returnType: NewReturnType): ZodFunction<Args, NewReturnType>;
|
|
1241
|
-
implement<F extends InnerTypeOfFunction<Args, Returns>>(func: F): ReturnType<F> extends Returns["_output"] ? (...args: Args["_input"]) => ReturnType<F> : OuterTypeOfFunction<Args, Returns>;
|
|
1242
|
-
strictImplement(func: InnerTypeOfFunction<Args, Returns>): InnerTypeOfFunction<Args, Returns>;
|
|
1243
|
-
validate: <F extends InnerTypeOfFunction<Args, Returns>>(func: F) => ReturnType<F> extends Returns["_output"] ? (...args: Args["_input"]) => ReturnType<F> : OuterTypeOfFunction<Args, Returns>;
|
|
1244
|
-
static create(): ZodFunction<ZodTuple<[
|
|
1245
|
-
], ZodUnknown>, ZodUnknown>;
|
|
1246
|
-
static create<T extends AnyZodTuple = ZodTuple<[
|
|
1247
|
-
], ZodUnknown>>(args: T): ZodFunction<T, ZodUnknown>;
|
|
1248
|
-
static create<T extends AnyZodTuple, U extends ZodTypeAny>(args: T, returns: U): ZodFunction<T, U>;
|
|
1249
|
-
static create<T extends AnyZodTuple = ZodTuple<[
|
|
1250
|
-
], ZodUnknown>, U extends ZodTypeAny = ZodUnknown>(args: T, returns: U, params?: RawCreateParams): ZodFunction<T, U>;
|
|
1251
|
-
}
|
|
1252
|
-
interface ZodLazyDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1253
|
-
getter: () => T;
|
|
1254
|
-
typeName: ZodFirstPartyTypeKind.ZodLazy;
|
|
1255
|
-
}
|
|
1256
|
-
declare class ZodLazy<T extends ZodTypeAny> extends ZodType<output<T>, ZodLazyDef<T>, input<T>> {
|
|
1257
|
-
get schema(): T;
|
|
1258
|
-
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1259
|
-
static create: <Inner extends ZodTypeAny>(getter: () => Inner, params?: RawCreateParams) => ZodLazy<Inner>;
|
|
1260
|
-
}
|
|
1261
|
-
interface ZodLiteralDef<T = any> extends ZodTypeDef {
|
|
1262
|
-
value: T;
|
|
1263
|
-
typeName: ZodFirstPartyTypeKind.ZodLiteral;
|
|
1264
|
-
}
|
|
1265
|
-
declare class ZodLiteral<T> extends ZodType<T, ZodLiteralDef<T>, T> {
|
|
1266
|
-
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1267
|
-
get value(): T;
|
|
1268
|
-
static create: <Value extends Primitive>(value: Value, params?: RawCreateParams) => ZodLiteral<Value>;
|
|
1269
|
-
}
|
|
1270
|
-
type ArrayKeys = keyof any[];
|
|
1271
|
-
type Indices<T> = Exclude<keyof T, ArrayKeys>;
|
|
1272
|
-
type EnumValues<T extends string = string> = readonly [
|
|
1273
|
-
T,
|
|
1274
|
-
...T[]
|
|
1275
|
-
];
|
|
1276
|
-
type Values<T extends EnumValues> = {
|
|
1277
|
-
[k in T[number]]: k;
|
|
1278
|
-
};
|
|
1279
|
-
interface ZodEnumDef<T extends EnumValues = EnumValues> extends ZodTypeDef {
|
|
1280
|
-
values: T;
|
|
1281
|
-
typeName: ZodFirstPartyTypeKind.ZodEnum;
|
|
1282
|
-
}
|
|
1283
|
-
type Writeable<T> = {
|
|
1284
|
-
-readonly [P in keyof T]: T[P];
|
|
1285
|
-
};
|
|
1286
|
-
type FilterEnum<Values, ToExclude> = Values extends [
|
|
1287
|
-
] ? [
|
|
1288
|
-
] : Values extends [
|
|
1289
|
-
infer Head,
|
|
1290
|
-
...infer Rest
|
|
1291
|
-
] ? Head extends ToExclude ? FilterEnum<Rest, ToExclude> : [
|
|
1292
|
-
Head,
|
|
1293
|
-
...FilterEnum<Rest, ToExclude>
|
|
1294
|
-
] : never;
|
|
1295
|
-
type typecast<A, T> = A extends T ? A : never;
|
|
1296
|
-
declare function createZodEnum<U extends string, T extends Readonly<[
|
|
1297
|
-
U,
|
|
1298
|
-
...U[]
|
|
1299
|
-
]>>(values: T, params?: RawCreateParams): ZodEnum<Writeable<T>>;
|
|
1300
|
-
declare function createZodEnum<U extends string, T extends [
|
|
1301
|
-
U,
|
|
1302
|
-
...U[]
|
|
1303
|
-
]>(values: T, params?: RawCreateParams): ZodEnum<T>;
|
|
1304
|
-
declare class ZodEnum<T extends [
|
|
1305
|
-
string,
|
|
1306
|
-
...string[]
|
|
1307
|
-
]> extends ZodType<T[number], ZodEnumDef<T>, T[number]> {
|
|
1308
|
-
_cache: Set<T[number]> | undefined;
|
|
1309
|
-
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1310
|
-
get options(): T;
|
|
1311
|
-
get enum(): Values<T>;
|
|
1312
|
-
get Values(): Values<T>;
|
|
1313
|
-
get Enum(): Values<T>;
|
|
1314
|
-
extract<ToExtract extends readonly [
|
|
1315
|
-
T[number],
|
|
1316
|
-
...T[number][]
|
|
1317
|
-
]>(values: ToExtract, newDef?: RawCreateParams): ZodEnum<Writeable<ToExtract>>;
|
|
1318
|
-
exclude<ToExclude extends readonly [
|
|
1319
|
-
T[number],
|
|
1320
|
-
...T[number][]
|
|
1321
|
-
]>(values: ToExclude, newDef?: RawCreateParams): ZodEnum<typecast<Writeable<FilterEnum<T, ToExclude[number]>>, [
|
|
1322
|
-
string,
|
|
1323
|
-
...string[]
|
|
1324
|
-
]>>;
|
|
1325
|
-
static create: typeof createZodEnum;
|
|
1326
|
-
}
|
|
1327
|
-
interface ZodNativeEnumDef<T extends EnumLike = EnumLike> extends ZodTypeDef {
|
|
1328
|
-
values: T;
|
|
1329
|
-
typeName: ZodFirstPartyTypeKind.ZodNativeEnum;
|
|
1330
|
-
}
|
|
1331
|
-
type EnumLike = {
|
|
1332
|
-
[k: string]: string | number;
|
|
1333
|
-
[nu: number]: string;
|
|
1334
|
-
};
|
|
1335
|
-
declare class ZodNativeEnum<T extends EnumLike> extends ZodType<T[keyof T], ZodNativeEnumDef<T>, T[keyof T]> {
|
|
1336
|
-
_cache: Set<T[keyof T]> | undefined;
|
|
1337
|
-
_parse(input: ParseInput): ParseReturnType<T[keyof T]>;
|
|
1338
|
-
get enum(): T;
|
|
1339
|
-
static create: <Elements extends EnumLike>(values: Elements, params?: RawCreateParams) => ZodNativeEnum<Elements>;
|
|
1340
|
-
}
|
|
1341
|
-
interface ZodPromiseDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1342
|
-
type: T;
|
|
1343
|
-
typeName: ZodFirstPartyTypeKind.ZodPromise;
|
|
1344
|
-
}
|
|
1345
|
-
declare class ZodPromise<T extends ZodTypeAny> extends ZodType<Promise<T["_output"]>, ZodPromiseDef<T>, Promise<T["_input"]>> {
|
|
1346
|
-
unwrap(): T;
|
|
1347
|
-
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1348
|
-
static create: <Inner extends ZodTypeAny>(schema: Inner, params?: RawCreateParams) => ZodPromise<Inner>;
|
|
1349
|
-
}
|
|
1350
|
-
type Refinement<T> = (arg: T, ctx: RefinementCtx) => any;
|
|
1351
|
-
type SuperRefinement<T> = (arg: T, ctx: RefinementCtx) => void | Promise<void>;
|
|
1352
|
-
type RefinementEffect<T> = {
|
|
1353
|
-
type: "refinement";
|
|
1354
|
-
refinement: (arg: T, ctx: RefinementCtx) => any;
|
|
1355
|
-
};
|
|
1356
|
-
type TransformEffect<T> = {
|
|
1357
|
-
type: "transform";
|
|
1358
|
-
transform: (arg: T, ctx: RefinementCtx) => any;
|
|
1359
|
-
};
|
|
1360
|
-
type PreprocessEffect<T> = {
|
|
1361
|
-
type: "preprocess";
|
|
1362
|
-
transform: (arg: T, ctx: RefinementCtx) => any;
|
|
1363
|
-
};
|
|
1364
|
-
type Effect<T> = RefinementEffect<T> | TransformEffect<T> | PreprocessEffect<T>;
|
|
1365
|
-
interface ZodEffectsDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1366
|
-
schema: T;
|
|
1367
|
-
typeName: ZodFirstPartyTypeKind.ZodEffects;
|
|
1368
|
-
effect: Effect<any>;
|
|
1369
|
-
}
|
|
1370
|
-
declare class ZodEffects<T extends ZodTypeAny, Output = output<T>, Input = input<T>> extends ZodType<Output, ZodEffectsDef<T>, Input> {
|
|
1371
|
-
innerType(): T;
|
|
1372
|
-
sourceType(): T;
|
|
1373
|
-
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1374
|
-
static create: <I extends ZodTypeAny>(schema: I, effect: Effect<I["_output"]>, params?: RawCreateParams) => ZodEffects<I, I["_output"]>;
|
|
1375
|
-
static createWithPreprocess: <I extends ZodTypeAny>(preprocess: (arg: unknown, ctx: RefinementCtx) => unknown, schema: I, params?: RawCreateParams) => ZodEffects<I, I["_output"], unknown>;
|
|
1376
|
-
}
|
|
1377
|
-
interface ZodOptionalDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1378
|
-
innerType: T;
|
|
1379
|
-
typeName: ZodFirstPartyTypeKind.ZodOptional;
|
|
1380
|
-
}
|
|
1381
|
-
type ZodOptionalType<T extends ZodTypeAny> = ZodOptional<T>;
|
|
1382
|
-
declare class ZodOptional<T extends ZodTypeAny> extends ZodType<T["_output"] | undefined, ZodOptionalDef<T>, T["_input"] | undefined> {
|
|
1383
|
-
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1384
|
-
unwrap(): T;
|
|
1385
|
-
static create: <Inner extends ZodTypeAny>(type: Inner, params?: RawCreateParams) => ZodOptional<Inner>;
|
|
1386
|
-
}
|
|
1387
|
-
interface ZodNullableDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1388
|
-
innerType: T;
|
|
1389
|
-
typeName: ZodFirstPartyTypeKind.ZodNullable;
|
|
1390
|
-
}
|
|
1391
|
-
type ZodNullableType<T extends ZodTypeAny> = ZodNullable<T>;
|
|
1392
|
-
declare class ZodNullable<T extends ZodTypeAny> extends ZodType<T["_output"] | null, ZodNullableDef<T>, T["_input"] | null> {
|
|
1393
|
-
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1394
|
-
unwrap(): T;
|
|
1395
|
-
static create: <Inner extends ZodTypeAny>(type: Inner, params?: RawCreateParams) => ZodNullable<Inner>;
|
|
1396
|
-
}
|
|
1397
|
-
interface ZodDefaultDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1398
|
-
innerType: T;
|
|
1399
|
-
defaultValue: () => util.noUndefined<T["_input"]>;
|
|
1400
|
-
typeName: ZodFirstPartyTypeKind.ZodDefault;
|
|
1401
|
-
}
|
|
1402
|
-
declare class ZodDefault<T extends ZodTypeAny> extends ZodType<util.noUndefined<T["_output"]>, ZodDefaultDef<T>, T["_input"] | undefined> {
|
|
1403
|
-
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1404
|
-
removeDefault(): T;
|
|
1405
|
-
static create: <Inner extends ZodTypeAny>(type: Inner, params: RawCreateParams & {
|
|
1406
|
-
default: Inner["_input"] | (() => util.noUndefined<Inner["_input"]>);
|
|
1407
|
-
}) => ZodDefault<Inner>;
|
|
1408
|
-
}
|
|
1409
|
-
interface ZodCatchDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1410
|
-
innerType: T;
|
|
1411
|
-
catchValue: (ctx: {
|
|
1412
|
-
error: ZodError;
|
|
1413
|
-
input: unknown;
|
|
1414
|
-
}) => T["_input"];
|
|
1415
|
-
typeName: ZodFirstPartyTypeKind.ZodCatch;
|
|
1416
|
-
}
|
|
1417
|
-
declare class ZodCatch<T extends ZodTypeAny> extends ZodType<T["_output"], ZodCatchDef<T>, unknown> {
|
|
1418
|
-
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1419
|
-
removeCatch(): T;
|
|
1420
|
-
static create: <Inner extends ZodTypeAny>(type: Inner, params: RawCreateParams & {
|
|
1421
|
-
catch: Inner["_output"] | (() => Inner["_output"]);
|
|
1422
|
-
}) => ZodCatch<Inner>;
|
|
1423
|
-
}
|
|
1424
|
-
interface ZodNaNDef extends ZodTypeDef {
|
|
1425
|
-
typeName: ZodFirstPartyTypeKind.ZodNaN;
|
|
1426
|
-
}
|
|
1427
|
-
declare class ZodNaN extends ZodType<number, ZodNaNDef, number> {
|
|
1428
|
-
_parse(input: ParseInput): ParseReturnType<any>;
|
|
1429
|
-
static create: (params?: RawCreateParams) => ZodNaN;
|
|
1430
|
-
}
|
|
1431
|
-
interface ZodBrandedDef<T extends ZodTypeAny> extends ZodTypeDef {
|
|
1432
|
-
type: T;
|
|
1433
|
-
typeName: ZodFirstPartyTypeKind.ZodBranded;
|
|
1434
|
-
}
|
|
1435
|
-
declare const BRAND: unique symbol;
|
|
1436
|
-
type BRAND<T extends string | number | symbol> = {
|
|
1437
|
-
[BRAND]: {
|
|
1438
|
-
[k in T]: true;
|
|
1439
|
-
};
|
|
1440
|
-
};
|
|
1441
|
-
declare class ZodBranded<T extends ZodTypeAny, B extends string | number | symbol> extends ZodType<T["_output"] & BRAND<B>, ZodBrandedDef<T>, T["_input"]> {
|
|
1442
|
-
_parse(input: ParseInput): ParseReturnType<any>;
|
|
1443
|
-
unwrap(): T;
|
|
1444
|
-
}
|
|
1445
|
-
interface ZodPipelineDef<A extends ZodTypeAny, B extends ZodTypeAny> extends ZodTypeDef {
|
|
1446
|
-
in: A;
|
|
1447
|
-
out: B;
|
|
1448
|
-
typeName: ZodFirstPartyTypeKind.ZodPipeline;
|
|
1449
|
-
}
|
|
1450
|
-
declare class ZodPipeline<A extends ZodTypeAny, B extends ZodTypeAny> extends ZodType<B["_output"], ZodPipelineDef<A, B>, A["_input"]> {
|
|
1451
|
-
_parse(input: ParseInput): ParseReturnType<any>;
|
|
1452
|
-
static create<ASchema extends ZodTypeAny, BSchema extends ZodTypeAny>(a: ASchema, b: BSchema): ZodPipeline<ASchema, BSchema>;
|
|
1453
|
-
}
|
|
1454
|
-
type BuiltIn = (((...args: any[]) => any) | (new (...args: any[]) => any)) | {
|
|
1455
|
-
readonly [Symbol.toStringTag]: string;
|
|
1456
|
-
} | Date | Error | Generator | Promise<unknown> | RegExp;
|
|
1457
|
-
type MakeReadonly<T> = T extends Map<infer K, infer V> ? ReadonlyMap<K, V> : T extends Set<infer V> ? ReadonlySet<V> : T extends [
|
|
1458
|
-
infer Head,
|
|
1459
|
-
...infer Tail
|
|
1460
|
-
] ? readonly [
|
|
1461
|
-
Head,
|
|
1462
|
-
...Tail
|
|
1463
|
-
] : T extends Array<infer V> ? ReadonlyArray<V> : T extends BuiltIn ? T : Readonly<T>;
|
|
1464
|
-
interface ZodReadonlyDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1465
|
-
innerType: T;
|
|
1466
|
-
typeName: ZodFirstPartyTypeKind.ZodReadonly;
|
|
1467
|
-
}
|
|
1468
|
-
declare class ZodReadonly<T extends ZodTypeAny> extends ZodType<MakeReadonly<T["_output"]>, ZodReadonlyDef<T>, MakeReadonly<T["_input"]>> {
|
|
1469
|
-
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1470
|
-
static create: <Inner extends ZodTypeAny>(type: Inner, params?: RawCreateParams) => ZodReadonly<Inner>;
|
|
1471
|
-
unwrap(): T;
|
|
1472
|
-
}
|
|
1473
|
-
type CustomParams = CustomErrorParams & {
|
|
1474
|
-
fatal?: boolean;
|
|
1475
|
-
};
|
|
1476
|
-
declare function custom<T>(check?: (data: any) => any, _params?: string | CustomParams | ((input: any) => CustomParams),
|
|
1477
|
-
/**
|
|
1478
|
-
* @deprecated
|
|
1479
|
-
*
|
|
1480
|
-
* Pass `fatal` into the params object instead:
|
|
1481
|
-
*
|
|
1482
|
-
* ```ts
|
|
1483
|
-
* z.string().custom((val) => val.length > 5, { fatal: false })
|
|
1484
|
-
* ```
|
|
1485
|
-
*
|
|
1486
|
-
*/
|
|
1487
|
-
fatal?: boolean): ZodType<T, ZodTypeDef, T>;
|
|
1488
|
-
declare const late: {
|
|
1489
|
-
object: <Shape extends ZodRawShape>(shape: () => Shape, params?: RawCreateParams) => ZodObject<Shape, "strip">;
|
|
1490
|
-
};
|
|
1491
|
-
declare enum ZodFirstPartyTypeKind {
|
|
1492
|
-
ZodString = "ZodString",
|
|
1493
|
-
ZodNumber = "ZodNumber",
|
|
1494
|
-
ZodNaN = "ZodNaN",
|
|
1495
|
-
ZodBigInt = "ZodBigInt",
|
|
1496
|
-
ZodBoolean = "ZodBoolean",
|
|
1497
|
-
ZodDate = "ZodDate",
|
|
1498
|
-
ZodSymbol = "ZodSymbol",
|
|
1499
|
-
ZodUndefined = "ZodUndefined",
|
|
1500
|
-
ZodNull = "ZodNull",
|
|
1501
|
-
ZodAny = "ZodAny",
|
|
1502
|
-
ZodUnknown = "ZodUnknown",
|
|
1503
|
-
ZodNever = "ZodNever",
|
|
1504
|
-
ZodVoid = "ZodVoid",
|
|
1505
|
-
ZodArray = "ZodArray",
|
|
1506
|
-
ZodObject = "ZodObject",
|
|
1507
|
-
ZodUnion = "ZodUnion",
|
|
1508
|
-
ZodDiscriminatedUnion = "ZodDiscriminatedUnion",
|
|
1509
|
-
ZodIntersection = "ZodIntersection",
|
|
1510
|
-
ZodTuple = "ZodTuple",
|
|
1511
|
-
ZodRecord = "ZodRecord",
|
|
1512
|
-
ZodMap = "ZodMap",
|
|
1513
|
-
ZodSet = "ZodSet",
|
|
1514
|
-
ZodFunction = "ZodFunction",
|
|
1515
|
-
ZodLazy = "ZodLazy",
|
|
1516
|
-
ZodLiteral = "ZodLiteral",
|
|
1517
|
-
ZodEnum = "ZodEnum",
|
|
1518
|
-
ZodEffects = "ZodEffects",
|
|
1519
|
-
ZodNativeEnum = "ZodNativeEnum",
|
|
1520
|
-
ZodOptional = "ZodOptional",
|
|
1521
|
-
ZodNullable = "ZodNullable",
|
|
1522
|
-
ZodDefault = "ZodDefault",
|
|
1523
|
-
ZodCatch = "ZodCatch",
|
|
1524
|
-
ZodPromise = "ZodPromise",
|
|
1525
|
-
ZodBranded = "ZodBranded",
|
|
1526
|
-
ZodPipeline = "ZodPipeline",
|
|
1527
|
-
ZodReadonly = "ZodReadonly"
|
|
1528
|
-
}
|
|
1529
|
-
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;
|
|
1530
|
-
declare abstract class Class {
|
|
1531
|
-
constructor(..._: any[]);
|
|
1532
|
-
}
|
|
1533
|
-
declare const instanceOfType: <T extends typeof Class>(cls: T, params?: CustomParams) => ZodType<InstanceType<T>, ZodTypeDef, InstanceType<T>>;
|
|
1534
|
-
declare const stringType: (params?: RawCreateParams & {
|
|
1535
|
-
coerce?: true;
|
|
1536
|
-
}) => ZodString;
|
|
1537
|
-
declare const numberType: (params?: RawCreateParams & {
|
|
1538
|
-
coerce?: boolean;
|
|
1539
|
-
}) => ZodNumber;
|
|
1540
|
-
declare const nanType: (params?: RawCreateParams) => ZodNaN;
|
|
1541
|
-
declare const bigIntType: (params?: RawCreateParams & {
|
|
1542
|
-
coerce?: boolean;
|
|
1543
|
-
}) => ZodBigInt;
|
|
1544
|
-
declare const booleanType: (params?: RawCreateParams & {
|
|
1545
|
-
coerce?: boolean;
|
|
1546
|
-
}) => ZodBoolean;
|
|
1547
|
-
declare const dateType: (params?: RawCreateParams & {
|
|
1548
|
-
coerce?: boolean;
|
|
1549
|
-
}) => ZodDate;
|
|
1550
|
-
declare const symbolType: (params?: RawCreateParams) => ZodSymbol;
|
|
1551
|
-
declare const undefinedType: (params?: RawCreateParams) => ZodUndefined;
|
|
1552
|
-
declare const nullType: (params?: RawCreateParams) => ZodNull;
|
|
1553
|
-
declare const anyType: (params?: RawCreateParams) => ZodAny;
|
|
1554
|
-
declare const unknownType: (params?: RawCreateParams) => ZodUnknown;
|
|
1555
|
-
declare const neverType: (params?: RawCreateParams) => ZodNever;
|
|
1556
|
-
declare const voidType: (params?: RawCreateParams) => ZodVoid;
|
|
1557
|
-
declare const arrayType: <El extends ZodTypeAny>(schema: El, params?: RawCreateParams) => ZodArray<El>;
|
|
1558
|
-
declare const objectType: <Shape extends ZodRawShape>(shape: Shape, params?: RawCreateParams) => ZodObject<Shape, "strip", ZodTypeAny, objectOutputType<Shape, ZodTypeAny, "strip">, objectInputType<Shape, ZodTypeAny, "strip">>;
|
|
1559
|
-
declare const strictObjectType: <Shape extends ZodRawShape>(shape: Shape, params?: RawCreateParams) => ZodObject<Shape, "strict">;
|
|
1560
|
-
declare const unionType: <Options extends Readonly<[
|
|
1561
|
-
ZodTypeAny,
|
|
1562
|
-
ZodTypeAny,
|
|
1563
|
-
...ZodTypeAny[]
|
|
1564
|
-
]>>(types: Options, params?: RawCreateParams) => ZodUnion<Options>;
|
|
1565
|
-
declare const discriminatedUnionType: typeof ZodDiscriminatedUnion.create;
|
|
1566
|
-
declare const intersectionType: <TSchema extends ZodTypeAny, USchema extends ZodTypeAny>(left: TSchema, right: USchema, params?: RawCreateParams) => ZodIntersection<TSchema, USchema>;
|
|
1567
|
-
declare const tupleType: <Items extends [
|
|
1568
|
-
ZodTypeAny,
|
|
1569
|
-
...ZodTypeAny[]
|
|
1570
|
-
] | [
|
|
1571
|
-
]>(schemas: Items, params?: RawCreateParams) => ZodTuple<Items, null>;
|
|
1572
|
-
declare const recordType: typeof ZodRecord.create;
|
|
1573
|
-
declare const mapType: <KeySchema extends ZodTypeAny = ZodTypeAny, ValueSchema extends ZodTypeAny = ZodTypeAny>(keyType: KeySchema, valueType: ValueSchema, params?: RawCreateParams) => ZodMap<KeySchema, ValueSchema>;
|
|
1574
|
-
declare const setType: <ValueSchema extends ZodTypeAny = ZodTypeAny>(valueType: ValueSchema, params?: RawCreateParams) => ZodSet<ValueSchema>;
|
|
1575
|
-
declare const functionType: typeof ZodFunction.create;
|
|
1576
|
-
declare const lazyType: <Inner extends ZodTypeAny>(getter: () => Inner, params?: RawCreateParams) => ZodLazy<Inner>;
|
|
1577
|
-
declare const literalType: <Value extends Primitive>(value: Value, params?: RawCreateParams) => ZodLiteral<Value>;
|
|
1578
|
-
declare const enumType: typeof createZodEnum;
|
|
1579
|
-
declare const nativeEnumType: <Elements extends EnumLike>(values: Elements, params?: RawCreateParams) => ZodNativeEnum<Elements>;
|
|
1580
|
-
declare const promiseType: <Inner extends ZodTypeAny>(schema: Inner, params?: RawCreateParams) => ZodPromise<Inner>;
|
|
1581
|
-
declare const effectsType: <I extends ZodTypeAny>(schema: I, effect: Effect<I["_output"]>, params?: RawCreateParams) => ZodEffects<I, I["_output"]>;
|
|
1582
|
-
declare const optionalType: <Inner extends ZodTypeAny>(type: Inner, params?: RawCreateParams) => ZodOptional<Inner>;
|
|
1583
|
-
declare const nullableType: <Inner extends ZodTypeAny>(type: Inner, params?: RawCreateParams) => ZodNullable<Inner>;
|
|
1584
|
-
declare const preprocessType: <I extends ZodTypeAny>(preprocess: (arg: unknown, ctx: RefinementCtx) => unknown, schema: I, params?: RawCreateParams) => ZodEffects<I, I["_output"], unknown>;
|
|
1585
|
-
declare const pipelineType: typeof ZodPipeline.create;
|
|
1586
|
-
declare const ostring: () => ZodOptional<ZodString>;
|
|
1587
|
-
declare const onumber: () => ZodOptional<ZodNumber>;
|
|
1588
|
-
declare const oboolean: () => ZodOptional<ZodBoolean>;
|
|
1589
|
-
declare const coerce: {
|
|
1590
|
-
string: (typeof ZodString)["create"];
|
|
1591
|
-
number: (typeof ZodNumber)["create"];
|
|
1592
|
-
boolean: (typeof ZodBoolean)["create"];
|
|
1593
|
-
bigint: (typeof ZodBigInt)["create"];
|
|
1594
|
-
date: (typeof ZodDate)["create"];
|
|
1595
|
-
};
|
|
1596
|
-
declare const NEVER: never;
|
|
1597
|
-
declare const errorCodeSchema: z.ZodEnum<[
|
|
1598
|
-
"AUTH_INVALID_EMAIL",
|
|
1599
|
-
"AUTH_WEAK_PASSWORD",
|
|
1600
|
-
"AUTH_INVALID_CREDENTIALS",
|
|
1601
|
-
"AUTH_INVALID_API_KEY",
|
|
1602
|
-
"AUTH_EMAIL_EXISTS",
|
|
1603
|
-
"AUTH_USER_NOT_FOUND",
|
|
1604
|
-
"AUTH_OAUTH_CONFIG_ALREADY_EXISTS",
|
|
1605
|
-
"AUTH_OAUTH_CONFIG_ERROR",
|
|
1606
|
-
"AUTH_OAUTH_CONFIG_NOT_FOUND",
|
|
1607
|
-
"AUTH_UNSUPPORTED_PROVIDER",
|
|
1608
|
-
"AUTH_TOKEN_EXPIRED",
|
|
1609
|
-
"AUTH_UNAUTHORIZED",
|
|
1610
|
-
"AUTH_NEED_VERIFICATION",
|
|
1611
|
-
"AUTH_SIGNUP_DISABLED",
|
|
1612
|
-
"DATABASE_INVALID_PARAMETER",
|
|
1613
|
-
"DATABASE_VALIDATION_ERROR",
|
|
1614
|
-
"DATABASE_CONSTRAINT_VIOLATION",
|
|
1615
|
-
"DATABASE_NOT_FOUND",
|
|
1616
|
-
"DATABASE_DUPLICATE",
|
|
1617
|
-
"DATABASE_MIGRATION_ALREADY_EXISTS",
|
|
1618
|
-
"DATABASE_PERMISSION_DENIED",
|
|
1619
|
-
"DATABASE_INTERNAL_ERROR",
|
|
1620
|
-
"DATABASE_FORBIDDEN",
|
|
1621
|
-
"STORAGE_ALREADY_EXISTS",
|
|
1622
|
-
"STORAGE_INVALID_PARAMETER",
|
|
1623
|
-
"STORAGE_INVALID_FILE_TYPE",
|
|
1624
|
-
"STORAGE_INSUFFICIENT_QUOTA",
|
|
1625
|
-
"STORAGE_NOT_FOUND",
|
|
1626
|
-
"STORAGE_PERMISSION_DENIED",
|
|
1627
|
-
"S3_ACCESS_KEY_LIMIT_EXCEEDED",
|
|
1628
|
-
"S3_ACCESS_KEY_NOT_FOUND",
|
|
1629
|
-
"S3_PROTOCOL_UNAVAILABLE",
|
|
1630
|
-
"REALTIME_CHANNEL_NOT_FOUND",
|
|
1631
|
-
"REALTIME_CONNECTION_FAILED",
|
|
1632
|
-
"REALTIME_INVALID_CHANNEL_REQUEST",
|
|
1633
|
-
"REALTIME_INVALID_CHANNEL_PATTERN",
|
|
1634
|
-
"REALTIME_INVALID_EVENT",
|
|
1635
|
-
"REALTIME_NOT_SUBSCRIBED",
|
|
1636
|
-
"REALTIME_UNAUTHORIZED",
|
|
1637
|
-
"AI_INVALID_API_KEY",
|
|
1638
|
-
"AI_INVALID_MODEL",
|
|
1639
|
-
"AI_UPSTREAM_UNAVAILABLE",
|
|
1640
|
-
"ANALYTICS_NOT_CONNECTED",
|
|
1641
|
-
"ANALYTICS_UNAVAILABLE",
|
|
1642
|
-
"LOGS_AWS_NOT_CONFIGURED",
|
|
1643
|
-
"LOG_NOT_FOUND",
|
|
1644
|
-
"COMPUTE_CLOUD_UNAVAILABLE",
|
|
1645
|
-
"COMPUTE_NOT_CONFIGURED",
|
|
1646
|
-
"COMPUTE_PROVIDER_ERROR",
|
|
1647
|
-
"COMPUTE_SERVICE_NOT_FOUND",
|
|
1648
|
-
"COMPUTE_SERVICE_NOT_CONFIGURED",
|
|
1649
|
-
"COMPUTE_SERVICE_DEPLOY_FAILED",
|
|
1650
|
-
"COMPUTE_SERVICE_ALREADY_EXISTS",
|
|
1651
|
-
"COMPUTE_SERVICE_START_FAILED",
|
|
1652
|
-
"COMPUTE_SERVICE_STOP_FAILED",
|
|
1653
|
-
"COMPUTE_SERVICE_DELETE_FAILED",
|
|
1654
|
-
"COMPUTE_REGION_CHANGE_NOT_SUPPORTED",
|
|
1655
|
-
"COMPUTE_QUOTA_EXCEEDED",
|
|
1656
|
-
"BILLING_INSUFFICIENT_BALANCE",
|
|
1657
|
-
"EMAIL_SMTP_CONNECTION_FAILED",
|
|
1658
|
-
"EMAIL_SMTP_SEND_FAILED",
|
|
1659
|
-
"EMAIL_TEMPLATE_NOT_FOUND",
|
|
1660
|
-
"DEPLOYMENT_ALREADY_EXISTS",
|
|
1661
|
-
"DEPLOYMENT_INVALID_FILE",
|
|
1662
|
-
"DEPLOYMENT_NOT_FOUND",
|
|
1663
|
-
"DEPLOYMENT_UPLOAD_CANCELED",
|
|
1664
|
-
"DOMAIN_ALREADY_EXISTS",
|
|
1665
|
-
"DOMAIN_INVALID",
|
|
1666
|
-
"DOMAIN_NOT_FOUND",
|
|
1667
|
-
"ENVIRONMENT_VARIABLE_NOT_FOUND",
|
|
1668
|
-
"DOCS_NOT_FOUND",
|
|
1669
|
-
"FUNCTION_ALREADY_EXISTS",
|
|
1670
|
-
"FUNCTION_DEPLOYMENT_NOT_FOUND",
|
|
1671
|
-
"FUNCTION_NOT_FOUND",
|
|
1672
|
-
"SCHEDULE_INVALID_CRON",
|
|
1673
|
-
"SCHEDULE_NOT_FOUND",
|
|
1674
|
-
"PAYMENT_CHECKOUT_ALREADY_EXISTS",
|
|
1675
|
-
"PAYMENT_CONFIG_INVALID",
|
|
1676
|
-
"PAYMENT_CONFIG_NOT_FOUND",
|
|
1677
|
-
"PAYMENT_NOT_FOUND",
|
|
1678
|
-
"PAYMENT_METHOD_DECLINED",
|
|
1679
|
-
"PAYMENT_PRICE_NOT_FOUND",
|
|
1680
|
-
"PAYMENT_PRODUCT_NOT_FOUND",
|
|
1681
|
-
"SECRET_ALREADY_EXISTS",
|
|
1682
|
-
"SECRET_NOT_FOUND",
|
|
1683
|
-
"MISSING_FIELD",
|
|
1684
|
-
"ALREADY_EXISTS",
|
|
1685
|
-
"INVALID_INPUT",
|
|
1686
|
-
"NOT_FOUND",
|
|
1687
|
-
"UNKNOWN_ERROR",
|
|
1688
|
-
"INTERNAL_ERROR",
|
|
1689
|
-
"TOO_MANY_REQUESTS",
|
|
1690
|
-
"FORBIDDEN",
|
|
1691
|
-
"RATE_LIMITED",
|
|
1692
|
-
"NOT_IMPLEMENTED",
|
|
1693
|
-
"UPSTREAM_FAILURE"
|
|
1694
|
-
]>;
|
|
1695
|
-
type ErrorCode = z.infer<typeof errorCodeSchema>;
|
|
1696
|
-
type InsForgeErrorCode = ErrorCode | (string & {});
|
|
1697
|
-
interface InsForgeConfig {
|
|
1698
|
-
/**
|
|
1699
|
-
* The base URL of the InsForge backend API
|
|
1700
|
-
* @default "http://localhost:7130"
|
|
1701
|
-
*/
|
|
1702
|
-
baseUrl?: string;
|
|
1703
|
-
/**
|
|
1704
|
-
* Anonymous API key (optional)
|
|
1705
|
-
* Used for public/unauthenticated requests when no user token is set
|
|
1706
|
-
*/
|
|
1707
|
-
anonKey?: string;
|
|
1708
|
-
/**
|
|
1709
|
-
* Static access token (optional)
|
|
1710
|
-
* Seeds the client with a fixed bearer token used for all authenticated
|
|
1711
|
-
* requests — e.g. a user JWT inside an edge function, or a server-signed
|
|
1712
|
-
* JWT from an external auth provider. Disables automatic token refresh
|
|
1713
|
-
* and implies server mode unless `isServerMode` is set explicitly.
|
|
1714
|
-
*/
|
|
1715
|
-
accessToken?: string;
|
|
1716
|
-
/**
|
|
1717
|
-
* @deprecated Use `accessToken` instead. Same behavior; `accessToken`
|
|
1718
|
-
* takes precedence when both are provided.
|
|
1719
|
-
*/
|
|
1720
|
-
edgeFunctionToken?: string;
|
|
1721
|
-
/**
|
|
1722
|
-
* Direct URL to Deno Subhosting functions (optional)
|
|
1723
|
-
* When provided, SDK will try this URL first for function invocations.
|
|
1724
|
-
* Falls back to proxy URL if subhosting returns 404.
|
|
1725
|
-
* @example "https://{appKey}.functions.insforge.app"
|
|
1726
|
-
*/
|
|
1727
|
-
functionsUrl?: string;
|
|
1728
|
-
/**
|
|
1729
|
-
* Custom fetch implementation (useful for Node.js environments)
|
|
1730
|
-
*/
|
|
1731
|
-
fetch?: typeof fetch;
|
|
1732
|
-
/**
|
|
1733
|
-
* Enable server-side auth mode (SSR/Node runtime)
|
|
1734
|
-
* In this mode auth endpoints use `client_type=mobile` and refresh_token body flow.
|
|
1735
|
-
*
|
|
1736
|
-
* @deprecated Use `createServerClient()`, `createBrowserClient()`, and
|
|
1737
|
-
* `updateSession()` from `@resultdev/sdk/ssr` for SSR apps.
|
|
1738
|
-
* @default false
|
|
1739
|
-
*/
|
|
1740
|
-
isServerMode?: boolean;
|
|
1741
|
-
/**
|
|
1742
|
-
* Advanced auth module options.
|
|
1743
|
-
*/
|
|
1744
|
-
auth?: {
|
|
1745
|
-
/**
|
|
1746
|
-
* Detect and exchange OAuth callback parameters on browser client
|
|
1747
|
-
* initialization. SSR browser clients disable this so auth mutations can
|
|
1748
|
-
* stay server-owned.
|
|
1749
|
-
* @default true
|
|
1750
|
-
*/
|
|
1751
|
-
detectOAuthCallback?: boolean;
|
|
1752
|
-
};
|
|
1753
|
-
/**
|
|
1754
|
-
* Database module options.
|
|
1755
|
-
*/
|
|
1756
|
-
db?: {
|
|
1757
|
-
/**
|
|
1758
|
-
* Default Postgres schema for database queries. Maps to PostgREST's
|
|
1759
|
-
* `Accept-Profile`/`Content-Profile` headers. Override per-query with
|
|
1760
|
-
* `client.database.schema('other')`.
|
|
1761
|
-
* @default "public"
|
|
1762
|
-
*/
|
|
1763
|
-
schema?: string;
|
|
1764
|
-
};
|
|
1765
|
-
/**
|
|
1766
|
-
* Custom headers to include with every request
|
|
1767
|
-
*/
|
|
1768
|
-
headers?: Record<string, string>;
|
|
1769
|
-
/**
|
|
1770
|
-
* Enable debug logging for HTTP requests and responses.
|
|
1771
|
-
* When true, request/response details are logged to the console.
|
|
1772
|
-
* Can also be a custom log function for advanced use cases.
|
|
1773
|
-
* @default false
|
|
1774
|
-
*/
|
|
1775
|
-
debug?: boolean | ((message: string, ...args: any[]) => void);
|
|
1776
|
-
/**
|
|
1777
|
-
* Request timeout in milliseconds.
|
|
1778
|
-
* Requests that exceed this duration will be aborted.
|
|
1779
|
-
* Set to 0 to disable timeout.
|
|
1780
|
-
* @default 30000
|
|
1781
|
-
*/
|
|
1782
|
-
timeout?: number;
|
|
1783
|
-
/**
|
|
1784
|
-
* Maximum number of retry attempts for failed requests.
|
|
1785
|
-
* Retries are triggered on network errors and server errors (5xx).
|
|
1786
|
-
* Client errors (4xx) are never retried.
|
|
1787
|
-
* Set to 0 to disable retries.
|
|
1788
|
-
* @default 3
|
|
1789
|
-
*/
|
|
1790
|
-
retryCount?: number;
|
|
1791
|
-
/**
|
|
1792
|
-
* Initial delay in milliseconds before the first retry.
|
|
1793
|
-
* The delay doubles with each subsequent attempt (exponential backoff)
|
|
1794
|
-
* with ±15% jitter to prevent thundering herd.
|
|
1795
|
-
* @default 500
|
|
1796
|
-
*/
|
|
1797
|
-
retryDelay?: number;
|
|
1798
|
-
}
|
|
1799
|
-
interface ApiError {
|
|
1800
|
-
error: InsForgeErrorCode;
|
|
1801
|
-
message: string;
|
|
1802
|
-
statusCode: number;
|
|
1803
|
-
nextActions?: string;
|
|
1804
|
-
}
|
|
1805
|
-
declare class InsForgeError extends Error {
|
|
1806
|
-
statusCode: number;
|
|
1807
|
-
error: InsForgeErrorCode;
|
|
1808
|
-
nextActions?: string;
|
|
1809
|
-
constructor(message: string, statusCode: number, error: InsForgeErrorCode, nextActions?: string);
|
|
1810
|
-
static fromApiError(apiError: ApiError): InsForgeError;
|
|
1811
|
-
}
|
|
1812
|
-
export declare const DEFAULT_ACCESS_TOKEN_COOKIE = "insforge_access_token";
|
|
1813
|
-
export declare const DEFAULT_REFRESH_TOKEN_COOKIE = "insforge_refresh_token";
|
|
1814
|
-
export interface AuthCookieNames {
|
|
1815
|
-
accessToken?: string;
|
|
1816
|
-
refreshToken?: string;
|
|
1817
|
-
}
|
|
1818
|
-
export interface CookieOptions {
|
|
1819
|
-
domain?: string;
|
|
1820
|
-
path?: string;
|
|
1821
|
-
expires?: Date;
|
|
1822
|
-
maxAge?: number;
|
|
1823
|
-
httpOnly?: boolean;
|
|
1824
|
-
secure?: boolean;
|
|
1825
|
-
sameSite?: "lax" | "strict" | "none";
|
|
1826
|
-
}
|
|
1827
|
-
export interface AuthCookieOptions {
|
|
1828
|
-
accessToken?: CookieOptions;
|
|
1829
|
-
refreshToken?: CookieOptions;
|
|
1830
|
-
}
|
|
1831
|
-
type CookieStoreValue = string | {
|
|
1832
|
-
value?: string | null;
|
|
1833
|
-
} | undefined | null;
|
|
1834
|
-
export interface CookieReader {
|
|
1835
|
-
get(name: string): CookieStoreValue;
|
|
1836
|
-
}
|
|
1837
|
-
export interface CookieWriter {
|
|
1838
|
-
set?(name: string, value: string, options?: CookieOptions): unknown;
|
|
1839
|
-
set?(options: {
|
|
1840
|
-
name: string;
|
|
1841
|
-
value: string;
|
|
1842
|
-
} & CookieOptions): unknown;
|
|
1843
|
-
delete?(name: string): unknown;
|
|
1844
|
-
delete?(options: {
|
|
1845
|
-
name: string;
|
|
1846
|
-
} & CookieOptions): unknown;
|
|
1847
|
-
}
|
|
1848
|
-
interface CookieStore$1 extends CookieReader, CookieWriter {
|
|
1849
|
-
}
|
|
1850
|
-
export interface AuthCookieSettings {
|
|
1851
|
-
names?: AuthCookieNames;
|
|
1852
|
-
options?: AuthCookieOptions;
|
|
1853
|
-
}
|
|
1854
|
-
export declare function getAccessTokenCookieName(names?: AuthCookieNames): string;
|
|
1855
|
-
export declare function getRefreshTokenCookieName(names?: AuthCookieNames): string;
|
|
1856
|
-
export declare function setAuthCookies(cookies: CookieWriter | undefined, tokens: {
|
|
1857
|
-
accessToken: string;
|
|
1858
|
-
refreshToken?: string | null;
|
|
1859
|
-
}, settings?: AuthCookieSettings): void;
|
|
1860
|
-
export declare function clearAuthCookies(cookies: CookieWriter | undefined, settings?: AuthCookieSettings): void;
|
|
1861
|
-
export interface UpdateSessionOptions extends Omit<InsForgeConfig, "accessToken" | "edgeFunctionToken" | "isServerMode" | "auth">, AuthCookieSettings {
|
|
1862
|
-
requestCookies: CookieStore$1;
|
|
1863
|
-
responseCookies: CookieStore$1;
|
|
1864
|
-
refreshLeewaySeconds?: number;
|
|
1865
|
-
}
|
|
1866
|
-
export interface UpdateSessionResult {
|
|
1867
|
-
refreshed: boolean;
|
|
1868
|
-
accessToken: string | null;
|
|
1869
|
-
error: InsForgeError | null;
|
|
1870
|
-
}
|
|
1871
|
-
export declare function updateSession(options: UpdateSessionOptions): Promise<UpdateSessionResult>;
|
|
1872
|
-
|
|
1873
|
-
declare namespace z {
|
|
1874
|
-
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 };
|
|
1875
|
-
}
|
|
1876
|
-
|
|
1877
|
-
export {
|
|
1878
|
-
CookieStore$1 as CookieStore,
|
|
1879
|
-
};
|
|
1880
|
-
|
|
1881
|
-
export {};
|
|
1
|
+
export { b as AuthCookieNames, c as AuthCookieOptions, A as AuthCookieSettings, d as CookieOptions, e as CookieReader, C as CookieStore, a as CookieWriter, D as DEFAULT_ACCESS_TOKEN_COOKIE, f as DEFAULT_REFRESH_TOKEN_COOKIE, U as UpdateSessionOptions, g as UpdateSessionResult, i as clearAuthCookies, j as getAccessTokenCookieName, k as getRefreshTokenCookieName, s as setAuthCookies, u as updateSession } from '../middleware-BJl9JRg3.js';
|
|
2
|
+
import '../types-DSVtGaIA.js';
|