@opentiny/genui-sdk-vue 1.0.0-beta.1 → 1.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2409 -42
- package/dist/index.js +75819 -77550
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { BubbleProps } from '@opentiny/tiny-robot';
|
|
2
2
|
import { BubbleRoleConfig } from '@opentiny/tiny-robot';
|
|
3
|
-
import { CardSchema } from '@opentiny/genui-sdk-core';
|
|
4
3
|
import { ChatMessage } from '@opentiny/tiny-robot-kit';
|
|
5
4
|
import { Component } from 'vue';
|
|
6
5
|
import { ComponentOptionsMixin } from 'vue';
|
|
@@ -9,50 +8,34 @@ import { ComputedRef } from 'vue';
|
|
|
9
8
|
import { Conversation } from '@opentiny/tiny-robot-kit';
|
|
10
9
|
import { ConversationState } from '@opentiny/tiny-robot-kit';
|
|
11
10
|
import { DefineComponent } from 'vue';
|
|
12
|
-
import { IGenPromptAction } from '@opentiny/genui-sdk-core';
|
|
13
|
-
import { IGenPromptComponent } from '@opentiny/genui-sdk-core';
|
|
14
|
-
import { IGenPromptExample } from '@opentiny/genui-sdk-core';
|
|
15
|
-
import { IGenPromptSnippet } from '@opentiny/genui-sdk-core';
|
|
16
|
-
import { INotificationPayload } from '@opentiny/genui-sdk-core';
|
|
17
11
|
import { MessageState } from '@opentiny/tiny-robot-kit';
|
|
18
12
|
import { PublicProps } from 'vue';
|
|
19
13
|
import { Reactive } from 'vue';
|
|
20
14
|
import { Ref } from 'vue';
|
|
21
|
-
import { RENDERER_SETTINGS_KEY } from '@opentiny/tiny-schema-renderer';
|
|
22
15
|
import { UnwrapNestedRefs } from 'vue';
|
|
23
16
|
import { UseMessageReturn as UseMessageReturn_2 } from '@opentiny/tiny-robot-kit';
|
|
24
17
|
import { VNode } from 'vue';
|
|
25
18
|
|
|
26
|
-
declare const __VLS_component: DefineComponent<
|
|
27
|
-
|
|
28
|
-
id: string;
|
|
29
|
-
}, {}, {}, {}, string, ComponentProvideOptions, false, {
|
|
30
|
-
providerRef: unknown;
|
|
31
|
-
}, any>;
|
|
32
|
-
|
|
33
|
-
declare const __VLS_component_2: DefineComponent<IChatProps, {
|
|
19
|
+
declare const __VLS_component: DefineComponent<IChatProps, {
|
|
20
|
+
setInputMessage: (message: string) => void;
|
|
34
21
|
handleNewConversation: () => void;
|
|
35
22
|
getConversation: () => UseConversationReturn;
|
|
36
23
|
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<IChatProps> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {
|
|
37
24
|
messagesContainer: HTMLDivElement;
|
|
38
25
|
}, HTMLDivElement>;
|
|
39
26
|
|
|
40
|
-
declare const
|
|
27
|
+
declare const __VLS_component_2: DefineComponent<IRendererProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<IRendererProps> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {
|
|
41
28
|
rendererInstance: any;
|
|
42
29
|
}, HTMLDivElement>;
|
|
43
30
|
|
|
44
|
-
declare
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
providerRef: unknown;
|
|
51
|
-
};
|
|
52
|
-
rootEl: any;
|
|
53
|
-
};
|
|
31
|
+
declare const __VLS_component_3: DefineComponent<ConfigProviderProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ConfigProviderProps> & Readonly<{}>, {
|
|
32
|
+
id: string;
|
|
33
|
+
locale: string;
|
|
34
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {
|
|
35
|
+
providerRef: unknown;
|
|
36
|
+
}, any>;
|
|
54
37
|
|
|
55
|
-
declare function
|
|
38
|
+
declare function __VLS_template(): {
|
|
56
39
|
attrs: Partial<{}>;
|
|
57
40
|
slots: {
|
|
58
41
|
empty?(_: {}): any;
|
|
@@ -63,7 +46,7 @@ declare function __VLS_template_2(): {
|
|
|
63
46
|
rootEl: HTMLDivElement;
|
|
64
47
|
};
|
|
65
48
|
|
|
66
|
-
declare function
|
|
49
|
+
declare function __VLS_template_2(): {
|
|
67
50
|
attrs: Partial<{}>;
|
|
68
51
|
slots: {
|
|
69
52
|
header?(_: {
|
|
@@ -83,6 +66,17 @@ declare function __VLS_template_3(): {
|
|
|
83
66
|
rootEl: HTMLDivElement;
|
|
84
67
|
};
|
|
85
68
|
|
|
69
|
+
declare function __VLS_template_3(): {
|
|
70
|
+
attrs: Partial<{}>;
|
|
71
|
+
slots: {
|
|
72
|
+
default?(_: {}): any;
|
|
73
|
+
};
|
|
74
|
+
refs: {
|
|
75
|
+
providerRef: unknown;
|
|
76
|
+
};
|
|
77
|
+
rootEl: any;
|
|
78
|
+
};
|
|
79
|
+
|
|
86
80
|
declare type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
87
81
|
|
|
88
82
|
declare type __VLS_TemplateResult_2 = ReturnType<typeof __VLS_template_2>;
|
|
@@ -107,8 +101,82 @@ declare type __VLS_WithTemplateSlots_3<T, S> = T & {
|
|
|
107
101
|
};
|
|
108
102
|
};
|
|
109
103
|
|
|
104
|
+
declare function addIssueToContext(ctx: ParseContext, issueData: IssueData): void;
|
|
105
|
+
|
|
106
|
+
declare type allKeys<T> = T extends any ? keyof T : never;
|
|
107
|
+
|
|
108
|
+
declare const anyType: (params?: RawCreateParams) => ZodAny;
|
|
109
|
+
|
|
110
|
+
declare type AnyZodObject = ZodObject<any, any, any>;
|
|
111
|
+
|
|
112
|
+
declare type AnyZodTuple = ZodTuple<[ZodTypeAny, ...ZodTypeAny[]] | [], ZodTypeAny | null>;
|
|
113
|
+
|
|
114
|
+
declare type ArrayCardinality = "many" | "atleastone";
|
|
115
|
+
|
|
116
|
+
declare type ArrayKeys = keyof any[];
|
|
117
|
+
|
|
118
|
+
declare type arrayOutputType<T extends ZodTypeAny, Cardinality extends ArrayCardinality = "many"> = Cardinality extends "atleastone" ? [T["_output"], ...T["_output"][]] : T["_output"][];
|
|
119
|
+
|
|
120
|
+
declare const arrayType: <El extends ZodTypeAny>(schema: El, params?: RawCreateParams) => ZodArray<El>;
|
|
121
|
+
|
|
122
|
+
declare type AssertArray<T> = T extends any[] ? T : never;
|
|
123
|
+
|
|
124
|
+
declare type AsyncParseReturnType<T> = Promise<SyncParseReturnType<T>>;
|
|
125
|
+
|
|
126
|
+
declare type baseObjectInputType<Shape extends ZodRawShape> = objectUtil.addQuestionMarks<{
|
|
127
|
+
[k in keyof Shape]: Shape[k]["_input"];
|
|
128
|
+
}>;
|
|
129
|
+
|
|
130
|
+
declare type baseObjectOutputType<Shape extends ZodRawShape> = {
|
|
131
|
+
[k in keyof Shape]: Shape[k]["_output"];
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
declare const bigIntType: (params?: RawCreateParams & {
|
|
135
|
+
coerce?: boolean;
|
|
136
|
+
}) => ZodBigInt;
|
|
137
|
+
|
|
138
|
+
declare const booleanType: (params?: RawCreateParams & {
|
|
139
|
+
coerce?: boolean;
|
|
140
|
+
}) => ZodBoolean;
|
|
141
|
+
|
|
142
|
+
declare const BRAND: unique symbol;
|
|
143
|
+
|
|
144
|
+
declare type BRAND<T extends string | number | symbol> = {
|
|
145
|
+
[BRAND]: {
|
|
146
|
+
[k in T]: true;
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
declare type BuiltIn = (((...args: any[]) => any) | (new (...args: any[]) => any)) | {
|
|
151
|
+
readonly [Symbol.toStringTag]: string;
|
|
152
|
+
} | Date | Error | Generator | Promise<unknown> | RegExp;
|
|
153
|
+
|
|
154
|
+
declare type CardSchema = z.infer<typeof cardSchema>;
|
|
155
|
+
|
|
156
|
+
declare const cardSchema: z.ZodType<RootNode, z.ZodTypeDef, RootNode>;
|
|
157
|
+
|
|
158
|
+
declare type CatchallInput<T extends ZodType> = ZodType extends T ? unknown : {
|
|
159
|
+
[k: string]: T["_input"];
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
declare type CatchallOutput<T extends ZodType> = ZodType extends T ? unknown : {
|
|
163
|
+
[k: string]: T["_output"];
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
declare abstract class Class {
|
|
167
|
+
constructor(..._: any[]);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
declare const coerce: {
|
|
171
|
+
string: (typeof ZodString)["create"];
|
|
172
|
+
number: (typeof ZodNumber)["create"];
|
|
173
|
+
boolean: (typeof ZodBoolean)["create"];
|
|
174
|
+
bigint: (typeof ZodBigInt)["create"];
|
|
175
|
+
date: (typeof ZodDate)["create"];
|
|
176
|
+
};
|
|
177
|
+
|
|
110
178
|
declare interface ConfigProviderProps {
|
|
111
|
-
theme:
|
|
179
|
+
theme: 'light' | 'dark' | 'lite' | 'auto';
|
|
112
180
|
id?: string;
|
|
113
181
|
locale?: string;
|
|
114
182
|
i18n?: I18nMessages;
|
|
@@ -116,8 +184,27 @@ declare interface ConfigProviderProps {
|
|
|
116
184
|
|
|
117
185
|
export declare function createI18n(options?: I18nOptions): I18nInstance;
|
|
118
186
|
|
|
187
|
+
declare function createZodEnum<U extends string, T extends Readonly<[U, ...U[]]>>(values: T, params?: RawCreateParams): ZodEnum<Writeable<T>>;
|
|
188
|
+
|
|
189
|
+
declare function createZodEnum<U extends string, T extends [U, ...U[]]>(values: T, params?: RawCreateParams): ZodEnum<T>;
|
|
190
|
+
|
|
191
|
+
declare function custom<T>(check?: (data: any) => any, _params?: string | CustomParams | ((input: any) => CustomParams),
|
|
192
|
+
/**
|
|
193
|
+
* @deprecated
|
|
194
|
+
*
|
|
195
|
+
* Pass `fatal` into the params object instead:
|
|
196
|
+
*
|
|
197
|
+
* ```ts
|
|
198
|
+
* z.string().custom((val) => val.length > 5, { fatal: false })
|
|
199
|
+
* ```
|
|
200
|
+
*
|
|
201
|
+
*/
|
|
202
|
+
fatal?: boolean): ZodType<T, ZodTypeDef, T>;
|
|
203
|
+
|
|
119
204
|
export declare const CUSTOM_CONTEXT: unique symbol;
|
|
120
205
|
|
|
206
|
+
declare type CustomErrorParams = Partial<util.Omit<ZodCustomIssue, "code">>;
|
|
207
|
+
|
|
121
208
|
/**
|
|
122
209
|
* 自定义请求函数类型
|
|
123
210
|
* @param url 请求地址
|
|
@@ -131,19 +218,105 @@ export declare type CustomFetch = (url: string, options: {
|
|
|
131
218
|
signal?: AbortSignal;
|
|
132
219
|
}) => Promise<Response> | Response;
|
|
133
220
|
|
|
221
|
+
declare type CustomParams = CustomErrorParams & {
|
|
222
|
+
fatal?: boolean;
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
declare function datetimeRegex(args: {
|
|
226
|
+
precision?: number | null;
|
|
227
|
+
offset?: boolean;
|
|
228
|
+
local?: boolean;
|
|
229
|
+
}): RegExp;
|
|
230
|
+
|
|
231
|
+
declare const dateType: (params?: RawCreateParams & {
|
|
232
|
+
coerce?: boolean;
|
|
233
|
+
}) => ZodDate;
|
|
234
|
+
|
|
134
235
|
export declare const DEFAULT_IMAGE_FEATURES: ImageFeatures;
|
|
135
236
|
|
|
237
|
+
declare type DenormalizedError = {
|
|
238
|
+
[k: string]: DenormalizedError | string[];
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
declare type deoptional<T extends ZodTypeAny> = T extends ZodOptional<infer U> ? deoptional<U> : T extends ZodNullable<infer U> ? ZodNullable<deoptional<U>> : T;
|
|
242
|
+
|
|
243
|
+
declare type DIRTY<T> = {
|
|
244
|
+
status: "dirty";
|
|
245
|
+
value: T;
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
declare const DIRTY: <T>(value: T) => DIRTY<T>;
|
|
249
|
+
|
|
250
|
+
declare const discriminatedUnionType: typeof ZodDiscriminatedUnion.create;
|
|
251
|
+
|
|
252
|
+
declare type Effect<T> = RefinementEffect<T> | TransformEffect<T> | PreprocessEffect<T>;
|
|
253
|
+
|
|
254
|
+
declare const effectsType: <I extends ZodTypeAny>(schema: I, effect: Effect<I["_output"]>, params?: RawCreateParams) => ZodEffects<I, I["_output"]>;
|
|
255
|
+
|
|
256
|
+
declare const EMPTY_PATH: ParsePath;
|
|
257
|
+
|
|
258
|
+
declare type EnumLike = {
|
|
259
|
+
[k: string]: string | number;
|
|
260
|
+
[nu: number]: string;
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
declare const enumType: typeof createZodEnum;
|
|
264
|
+
|
|
265
|
+
declare namespace enumUtil {
|
|
266
|
+
type UnionToIntersectionFn<T> = (T extends unknown ? (k: () => T) => void : never) extends (k: infer Intersection) => void ? Intersection : never;
|
|
267
|
+
type GetUnionLast<T> = UnionToIntersectionFn<T> extends () => infer Last ? Last : never;
|
|
268
|
+
type UnionToTuple<T, Tuple extends unknown[] = []> = [T] extends [never] ? Tuple : UnionToTuple<Exclude<T, GetUnionLast<T>>, [GetUnionLast<T>, ...Tuple]>;
|
|
269
|
+
type CastToStringTuple<T> = T extends [string, ...string[]] ? T : never;
|
|
270
|
+
type UnionToTupleString<T> = CastToStringTuple<UnionToTuple<T>>;
|
|
271
|
+
{};
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
declare type EnumValues<T extends string = string> = readonly [T, ...T[]];
|
|
275
|
+
|
|
276
|
+
declare const errorMap: ZodErrorMap;
|
|
277
|
+
|
|
278
|
+
declare type ErrorMapCtx = {
|
|
279
|
+
defaultError: string;
|
|
280
|
+
data: any;
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
declare type ErrorMessages<T extends JsonSchema7TypeUnion | {
|
|
284
|
+
format: string;
|
|
285
|
+
} | {
|
|
286
|
+
pattern: string;
|
|
287
|
+
}, OmitProperties extends string = ""> = Partial<Omit<{
|
|
288
|
+
[key in keyof T]: string;
|
|
289
|
+
}, OmitProperties | "type" | "errorMessages">>;
|
|
290
|
+
|
|
291
|
+
declare namespace errorUtil {
|
|
292
|
+
type ErrMessage = string | {
|
|
293
|
+
message?: string | undefined;
|
|
294
|
+
};
|
|
295
|
+
const errToObj: (message?: ErrMessage) => {
|
|
296
|
+
message?: string | undefined;
|
|
297
|
+
};
|
|
298
|
+
const toString: (message?: ErrMessage) => string | undefined;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
declare type FilterEnum<Values, ToExclude> = Values extends [] ? [] : Values extends [infer Head, ...infer Rest] ? Head extends ToExclude ? FilterEnum<Rest, ToExclude> : [Head, ...FilterEnum<Rest, ToExclude>] : never;
|
|
302
|
+
|
|
303
|
+
declare const functionType: typeof ZodFunction.create;
|
|
304
|
+
|
|
136
305
|
export declare const GENUI_CONFIG: unique symbol;
|
|
137
306
|
|
|
138
307
|
export declare const GENUI_I18N: unique symbol;
|
|
139
308
|
|
|
140
309
|
export declare const GENUI_RENDERER: unique symbol;
|
|
141
310
|
|
|
142
|
-
export declare const GenuiChat:
|
|
311
|
+
export declare const GenuiChat: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
312
|
+
|
|
313
|
+
export declare const GenuiConfigProvider: __VLS_WithTemplateSlots_3<typeof __VLS_component_3, __VLS_TemplateResult_3["slots"]>;
|
|
143
314
|
|
|
144
|
-
export declare const
|
|
315
|
+
export declare const GenuiRenderer: __VLS_WithTemplateSlots_2<typeof __VLS_component_2, __VLS_TemplateResult_2["slots"]>;
|
|
145
316
|
|
|
146
|
-
|
|
317
|
+
declare function getErrorMap(): ZodErrorMap;
|
|
318
|
+
|
|
319
|
+
declare const getParsedType: (data: any) => ZodParsedType;
|
|
147
320
|
|
|
148
321
|
export declare interface I18nInstance {
|
|
149
322
|
locale: Ref<string>;
|
|
@@ -182,6 +355,15 @@ export declare interface IChatConfig {
|
|
|
182
355
|
showThinkingResult?: boolean;
|
|
183
356
|
}
|
|
184
357
|
|
|
358
|
+
/**
|
|
359
|
+
* 单轮对话中的消息对象
|
|
360
|
+
*/
|
|
361
|
+
declare interface IChatMessage {
|
|
362
|
+
role: 'assistant';
|
|
363
|
+
content: string;
|
|
364
|
+
messages: IMessageItem_2[];
|
|
365
|
+
}
|
|
366
|
+
|
|
185
367
|
export declare interface IChatProps {
|
|
186
368
|
url?: string;
|
|
187
369
|
model?: string;
|
|
@@ -208,6 +390,66 @@ export declare interface ICustomComponentItem extends IGenPromptComponent {
|
|
|
208
390
|
ref: Component;
|
|
209
391
|
}
|
|
210
392
|
|
|
393
|
+
declare interface IFunctionInfo {
|
|
394
|
+
params: IFunctionParam[];
|
|
395
|
+
returns: Record<string, any>;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
declare interface IFunctionParam {
|
|
399
|
+
name: string;
|
|
400
|
+
type: string;
|
|
401
|
+
defaultValue: string;
|
|
402
|
+
description: II18nText;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
declare interface IGenPromptAction {
|
|
406
|
+
name: string;
|
|
407
|
+
description?: string;
|
|
408
|
+
parameters?: JsonSchema7Type;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
declare interface IGenPromptComponent {
|
|
412
|
+
component: string;
|
|
413
|
+
schema: IGenPromptComponentSchema;
|
|
414
|
+
name?: string;
|
|
415
|
+
description?: string;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
declare interface IGenPromptComponentEvent {
|
|
419
|
+
type: string;
|
|
420
|
+
functionInfo?: IFunctionInfo;
|
|
421
|
+
defaultValue?: string;
|
|
422
|
+
description: string;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
declare interface IGenPromptComponentProperty {
|
|
426
|
+
property: string;
|
|
427
|
+
description: string;
|
|
428
|
+
type: string;
|
|
429
|
+
required?: boolean;
|
|
430
|
+
defaultValue?: any;
|
|
431
|
+
properties?: IGenPromptComponentProperty[];
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
declare interface IGenPromptComponentSchema {
|
|
435
|
+
properties?: IGenPromptComponentProperty[];
|
|
436
|
+
events?: IGenPromptComponentEvent[];
|
|
437
|
+
slots?: Record<string, any>;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
declare interface IGenPromptExample {
|
|
441
|
+
name: string;
|
|
442
|
+
description?: string;
|
|
443
|
+
schema: CardSchema;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
declare type IGenPromptSnippet = NodeSchema;
|
|
447
|
+
|
|
448
|
+
declare interface II18nText {
|
|
449
|
+
zh_CN: string;
|
|
450
|
+
[key: string]: string;
|
|
451
|
+
}
|
|
452
|
+
|
|
211
453
|
export declare interface ImageFeatures {
|
|
212
454
|
enabled: boolean;
|
|
213
455
|
maxImageSize: number;
|
|
@@ -215,6 +457,11 @@ export declare interface ImageFeatures {
|
|
|
215
457
|
supportedFileTypes: string[];
|
|
216
458
|
}
|
|
217
459
|
|
|
460
|
+
declare interface IMarkdownMessageItem {
|
|
461
|
+
type: 'markdown';
|
|
462
|
+
content: string;
|
|
463
|
+
}
|
|
464
|
+
|
|
218
465
|
export declare interface IMessage {
|
|
219
466
|
role: 'user' | 'assistant';
|
|
220
467
|
content: string;
|
|
@@ -227,6 +474,19 @@ declare interface IMessageItem {
|
|
|
227
474
|
[customKey: string]: any;
|
|
228
475
|
}
|
|
229
476
|
|
|
477
|
+
/**
|
|
478
|
+
* 消息项类型
|
|
479
|
+
*/
|
|
480
|
+
declare type IMessageItem_2 = IMarkdownMessageItem | ISchemaCardMessageItem | IToolMessageItem;
|
|
481
|
+
|
|
482
|
+
declare type Indices<T> = Exclude<keyof T, ArrayKeys>;
|
|
483
|
+
|
|
484
|
+
declare type inferFlattenedErrors<T extends ZodType<any, any, any>, U = string> = typeToFlattenedError<TypeOf<T>, U>;
|
|
485
|
+
|
|
486
|
+
declare type inferFormattedError<T extends ZodType<any, any, any>, U = string> = ZodFormattedError<TypeOf<T>, U>;
|
|
487
|
+
|
|
488
|
+
declare type InnerTypeOfFunction<Args extends ZodTuple<any, any>, Returns extends ZodTypeAny> = Args["_output"] extends Array<any> ? (...args: Args["_output"]) => Returns["_input"] : never;
|
|
489
|
+
|
|
230
490
|
/**
|
|
231
491
|
* 通知事件发射器类型,专门用于处理 'notification' 事件
|
|
232
492
|
*/
|
|
@@ -237,6 +497,42 @@ export declare interface INotificationEventEmitter {
|
|
|
237
497
|
once(eventName: 'notification', callback: (payload: INotificationPayload) => void): void;
|
|
238
498
|
}
|
|
239
499
|
|
|
500
|
+
/**
|
|
501
|
+
* 流式通知事件负载,包含事件类型、增量数据和完整的消息对象
|
|
502
|
+
*/
|
|
503
|
+
declare type INotificationPayload = {
|
|
504
|
+
type: 'markdown' | 'schema-card' | 'done';
|
|
505
|
+
delta: IStreamDelta;
|
|
506
|
+
chatMessage: IChatMessage;
|
|
507
|
+
} | {
|
|
508
|
+
type: 'tool';
|
|
509
|
+
delta: IStreamDelta;
|
|
510
|
+
chatMessage: IChatMessage;
|
|
511
|
+
toolCallData: IMessageItem_2 & {
|
|
512
|
+
type: 'tool';
|
|
513
|
+
};
|
|
514
|
+
};
|
|
515
|
+
|
|
516
|
+
declare type input<T extends ZodType<any, any, any>> = T["_input"];
|
|
517
|
+
|
|
518
|
+
declare type InputTypeOfTuple<T extends ZodTupleItems | []> = AssertArray<{
|
|
519
|
+
[k in keyof T]: T[k] extends ZodType<any, any, any> ? T[k]["_input"] : never;
|
|
520
|
+
}>;
|
|
521
|
+
|
|
522
|
+
declare type InputTypeOfTupleWithRest<T extends ZodTupleItems | [], Rest extends ZodTypeAny | null = null> = Rest extends ZodTypeAny ? [...InputTypeOfTuple<T>, ...Rest["_input"][]] : InputTypeOfTuple<T>;
|
|
523
|
+
|
|
524
|
+
declare const instanceOfType: <T extends typeof Class>(cls: T, params?: CustomParams) => ZodType<InstanceType<T>, ZodTypeDef, InstanceType<T>>;
|
|
525
|
+
|
|
526
|
+
declare const intersectionType: <TSchema extends ZodTypeAny, USchema extends ZodTypeAny>(left: TSchema, right: USchema, params?: RawCreateParams) => ZodIntersection<TSchema, USchema>;
|
|
527
|
+
|
|
528
|
+
declare type INVALID = {
|
|
529
|
+
status: "aborted";
|
|
530
|
+
};
|
|
531
|
+
|
|
532
|
+
declare const INVALID: INVALID;
|
|
533
|
+
|
|
534
|
+
declare type IpVersion = "v4" | "v6";
|
|
535
|
+
|
|
240
536
|
export declare interface IRendererProps {
|
|
241
537
|
content: string | {
|
|
242
538
|
[prop: string]: any;
|
|
@@ -265,12 +561,281 @@ export declare interface IRolesConfig {
|
|
|
265
561
|
assistant: Partial<BubbleRoleConfig>;
|
|
266
562
|
}
|
|
267
563
|
|
|
564
|
+
declare const isAborted: (x: ParseReturnType<any>) => x is INVALID;
|
|
565
|
+
|
|
566
|
+
declare const isAsync: <T>(x: ParseReturnType<T>) => x is AsyncParseReturnType<T>;
|
|
567
|
+
|
|
568
|
+
declare interface ISchemaCardMessageItem {
|
|
569
|
+
type: 'schema-card';
|
|
570
|
+
content: string;
|
|
571
|
+
id?: string;
|
|
572
|
+
state?: Record<string, any>;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
declare const isDirty: <T>(x: ParseReturnType<T>) => x is OK<T> | DIRTY<T>;
|
|
576
|
+
|
|
577
|
+
declare type IssueData = stripPath<ZodIssueOptionalMessage> & {
|
|
578
|
+
path?: (string | number)[];
|
|
579
|
+
fatal?: boolean | undefined;
|
|
580
|
+
};
|
|
581
|
+
|
|
582
|
+
/**
|
|
583
|
+
* 流式响应的增量数据
|
|
584
|
+
*/
|
|
585
|
+
declare interface IStreamDelta {
|
|
586
|
+
content?: string;
|
|
587
|
+
tool_calls?: Array<{
|
|
588
|
+
id: string;
|
|
589
|
+
function: {
|
|
590
|
+
name: string;
|
|
591
|
+
arguments: string;
|
|
592
|
+
};
|
|
593
|
+
}>;
|
|
594
|
+
tool_calls_result?: Array<{
|
|
595
|
+
id: string;
|
|
596
|
+
function: {
|
|
597
|
+
arguments: any;
|
|
598
|
+
result: any;
|
|
599
|
+
};
|
|
600
|
+
}>;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
declare const isValid: <T>(x: ParseReturnType<T>) => x is OK<T>;
|
|
604
|
+
|
|
268
605
|
export declare interface IThinkComponentProps {
|
|
269
606
|
emitter: INotificationEventEmitter;
|
|
270
607
|
message: IMessage;
|
|
271
608
|
showThinkingResult: boolean;
|
|
272
609
|
}
|
|
273
610
|
|
|
611
|
+
declare interface IToolMessageItem {
|
|
612
|
+
type: 'tool';
|
|
613
|
+
name: string;
|
|
614
|
+
formatPretty?: boolean;
|
|
615
|
+
status: 'running' | 'success' | 'failed' | 'cancelled';
|
|
616
|
+
content: string;
|
|
617
|
+
id?: string;
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
declare type JSFunction = {
|
|
621
|
+
type: 'JSFunction';
|
|
622
|
+
value: string;
|
|
623
|
+
params?: string[];
|
|
624
|
+
};
|
|
625
|
+
|
|
626
|
+
declare type JsonSchema7AllOfType = {
|
|
627
|
+
allOf: JsonSchema7Type[];
|
|
628
|
+
unevaluatedProperties?: boolean;
|
|
629
|
+
};
|
|
630
|
+
|
|
631
|
+
declare type JsonSchema7AnyOfType = {
|
|
632
|
+
anyOf: JsonSchema7Type[];
|
|
633
|
+
};
|
|
634
|
+
|
|
635
|
+
declare type JsonSchema7AnyType = {
|
|
636
|
+
$ref?: string;
|
|
637
|
+
};
|
|
638
|
+
|
|
639
|
+
declare type JsonSchema7ArrayType = {
|
|
640
|
+
type: "array";
|
|
641
|
+
items?: JsonSchema7Type;
|
|
642
|
+
minItems?: number;
|
|
643
|
+
maxItems?: number;
|
|
644
|
+
errorMessages?: ErrorMessages<JsonSchema7ArrayType, "items">;
|
|
645
|
+
};
|
|
646
|
+
|
|
647
|
+
declare type JsonSchema7BigintType = {
|
|
648
|
+
type: "integer";
|
|
649
|
+
format: "int64";
|
|
650
|
+
minimum?: BigInt;
|
|
651
|
+
exclusiveMinimum?: BigInt;
|
|
652
|
+
maximum?: BigInt;
|
|
653
|
+
exclusiveMaximum?: BigInt;
|
|
654
|
+
multipleOf?: BigInt;
|
|
655
|
+
errorMessage?: ErrorMessages<JsonSchema7BigintType>;
|
|
656
|
+
};
|
|
657
|
+
|
|
658
|
+
declare type JsonSchema7BooleanType = {
|
|
659
|
+
type: "boolean";
|
|
660
|
+
};
|
|
661
|
+
|
|
662
|
+
declare type JsonSchema7DateType = {
|
|
663
|
+
type: "integer" | "string";
|
|
664
|
+
format: "unix-time" | "date-time" | "date";
|
|
665
|
+
minimum?: number;
|
|
666
|
+
maximum?: number;
|
|
667
|
+
errorMessage?: ErrorMessages<JsonSchema7NumberType>;
|
|
668
|
+
} | {
|
|
669
|
+
anyOf: JsonSchema7DateType[];
|
|
670
|
+
};
|
|
671
|
+
|
|
672
|
+
declare type JsonSchema7EnumType = {
|
|
673
|
+
type: "string";
|
|
674
|
+
enum: string[];
|
|
675
|
+
};
|
|
676
|
+
|
|
677
|
+
declare type JsonSchema7LiteralType = {
|
|
678
|
+
type: "string" | "number" | "integer" | "boolean";
|
|
679
|
+
const: string | number | boolean;
|
|
680
|
+
} | {
|
|
681
|
+
type: "object" | "array";
|
|
682
|
+
};
|
|
683
|
+
|
|
684
|
+
declare type JsonSchema7MapType = {
|
|
685
|
+
type: "array";
|
|
686
|
+
maxItems: 125;
|
|
687
|
+
items: {
|
|
688
|
+
type: "array";
|
|
689
|
+
items: [JsonSchema7Type, JsonSchema7Type];
|
|
690
|
+
minItems: 2;
|
|
691
|
+
maxItems: 2;
|
|
692
|
+
};
|
|
693
|
+
};
|
|
694
|
+
|
|
695
|
+
declare type JsonSchema7Meta = {
|
|
696
|
+
title?: string;
|
|
697
|
+
default?: any;
|
|
698
|
+
description?: string;
|
|
699
|
+
markdownDescription?: string;
|
|
700
|
+
};
|
|
701
|
+
|
|
702
|
+
declare type JsonSchema7NativeEnumType = {
|
|
703
|
+
type: "string" | "number" | ["string", "number"];
|
|
704
|
+
enum: (string | number)[];
|
|
705
|
+
};
|
|
706
|
+
|
|
707
|
+
declare type JsonSchema7NeverType = {
|
|
708
|
+
not: JsonSchema7AnyType;
|
|
709
|
+
};
|
|
710
|
+
|
|
711
|
+
declare type JsonSchema7NullableType = {
|
|
712
|
+
anyOf: [JsonSchema7Type, JsonSchema7NullType];
|
|
713
|
+
} | {
|
|
714
|
+
type: [string, "null"];
|
|
715
|
+
};
|
|
716
|
+
|
|
717
|
+
declare type JsonSchema7NullType = {
|
|
718
|
+
type: "null";
|
|
719
|
+
};
|
|
720
|
+
|
|
721
|
+
declare type JsonSchema7NumberType = {
|
|
722
|
+
type: "number" | "integer";
|
|
723
|
+
minimum?: number;
|
|
724
|
+
exclusiveMinimum?: number;
|
|
725
|
+
maximum?: number;
|
|
726
|
+
exclusiveMaximum?: number;
|
|
727
|
+
multipleOf?: number;
|
|
728
|
+
errorMessage?: ErrorMessages<JsonSchema7NumberType>;
|
|
729
|
+
};
|
|
730
|
+
|
|
731
|
+
declare type JsonSchema7ObjectType = {
|
|
732
|
+
type: "object";
|
|
733
|
+
properties: Record<string, JsonSchema7Type>;
|
|
734
|
+
additionalProperties?: boolean | JsonSchema7Type;
|
|
735
|
+
required?: string[];
|
|
736
|
+
};
|
|
737
|
+
|
|
738
|
+
declare type JsonSchema7Primitive = (typeof primitiveMappings)[keyof typeof primitiveMappings];
|
|
739
|
+
|
|
740
|
+
declare type JsonSchema7PrimitiveUnionType = {
|
|
741
|
+
type: JsonSchema7Primitive | JsonSchema7Primitive[];
|
|
742
|
+
} | {
|
|
743
|
+
type: JsonSchema7Primitive | JsonSchema7Primitive[];
|
|
744
|
+
enum: (string | number | bigint | boolean | null)[];
|
|
745
|
+
};
|
|
746
|
+
|
|
747
|
+
declare type JsonSchema7RecordPropertyNamesType = Omit<JsonSchema7StringType, "type"> | Omit<JsonSchema7EnumType, "type">;
|
|
748
|
+
|
|
749
|
+
declare type JsonSchema7RecordType = {
|
|
750
|
+
type: "object";
|
|
751
|
+
additionalProperties?: JsonSchema7Type | true;
|
|
752
|
+
propertyNames?: JsonSchema7RecordPropertyNamesType;
|
|
753
|
+
};
|
|
754
|
+
|
|
755
|
+
declare type JsonSchema7RefType = {
|
|
756
|
+
$ref: string;
|
|
757
|
+
};
|
|
758
|
+
|
|
759
|
+
declare type JsonSchema7SetType = {
|
|
760
|
+
type: "array";
|
|
761
|
+
uniqueItems: true;
|
|
762
|
+
items?: JsonSchema7Type;
|
|
763
|
+
minItems?: number;
|
|
764
|
+
maxItems?: number;
|
|
765
|
+
errorMessage?: ErrorMessages<JsonSchema7SetType>;
|
|
766
|
+
};
|
|
767
|
+
|
|
768
|
+
declare type JsonSchema7StringType = {
|
|
769
|
+
type: "string";
|
|
770
|
+
minLength?: number;
|
|
771
|
+
maxLength?: number;
|
|
772
|
+
format?: "email" | "idn-email" | "uri" | "uuid" | "date-time" | "ipv4" | "ipv6" | "date" | "time" | "duration";
|
|
773
|
+
pattern?: string;
|
|
774
|
+
allOf?: {
|
|
775
|
+
pattern: string;
|
|
776
|
+
errorMessage?: ErrorMessages<{
|
|
777
|
+
pattern: string;
|
|
778
|
+
}>;
|
|
779
|
+
}[];
|
|
780
|
+
anyOf?: {
|
|
781
|
+
format: string;
|
|
782
|
+
errorMessage?: ErrorMessages<{
|
|
783
|
+
format: string;
|
|
784
|
+
}>;
|
|
785
|
+
}[];
|
|
786
|
+
errorMessage?: ErrorMessages<JsonSchema7StringType>;
|
|
787
|
+
contentEncoding?: string;
|
|
788
|
+
};
|
|
789
|
+
|
|
790
|
+
declare type JsonSchema7TupleType = {
|
|
791
|
+
type: "array";
|
|
792
|
+
minItems: number;
|
|
793
|
+
items: JsonSchema7Type[];
|
|
794
|
+
} & ({
|
|
795
|
+
maxItems: number;
|
|
796
|
+
} | {
|
|
797
|
+
additionalItems?: JsonSchema7Type;
|
|
798
|
+
});
|
|
799
|
+
|
|
800
|
+
declare type JsonSchema7Type = JsonSchema7TypeUnion & JsonSchema7Meta;
|
|
801
|
+
|
|
802
|
+
declare type JsonSchema7TypeUnion = JsonSchema7StringType | JsonSchema7ArrayType | JsonSchema7NumberType | JsonSchema7BigintType | JsonSchema7BooleanType | JsonSchema7DateType | JsonSchema7EnumType | JsonSchema7LiteralType | JsonSchema7NativeEnumType | JsonSchema7NullType | JsonSchema7NumberType | JsonSchema7ObjectType | JsonSchema7RecordType | JsonSchema7TupleType | JsonSchema7UnionType | JsonSchema7UndefinedType | JsonSchema7RefType | JsonSchema7NeverType | JsonSchema7MapType | JsonSchema7AnyType | JsonSchema7NullableType | JsonSchema7AllOfType | JsonSchema7UnknownType | JsonSchema7SetType;
|
|
803
|
+
|
|
804
|
+
declare type JsonSchema7UndefinedType = {
|
|
805
|
+
not: JsonSchema7AnyType;
|
|
806
|
+
};
|
|
807
|
+
|
|
808
|
+
declare type JsonSchema7UnionType = JsonSchema7PrimitiveUnionType | JsonSchema7AnyOfType;
|
|
809
|
+
|
|
810
|
+
declare type JsonSchema7UnknownType = JsonSchema7AnyType;
|
|
811
|
+
|
|
812
|
+
declare type KeySchema = ZodType<string | number | symbol, any, any>;
|
|
813
|
+
|
|
814
|
+
declare const late: {
|
|
815
|
+
object: <Shape extends ZodRawShape>(shape: () => Shape, params?: RawCreateParams) => ZodObject<Shape, "strip">;
|
|
816
|
+
};
|
|
817
|
+
|
|
818
|
+
declare const lazyType: <Inner extends ZodTypeAny>(getter: () => Inner, params?: RawCreateParams) => ZodLazy<Inner>;
|
|
819
|
+
|
|
820
|
+
declare const literalType: <Value extends Primitive>(value: Value, params?: RawCreateParams) => ZodLiteral<Value>;
|
|
821
|
+
|
|
822
|
+
declare const makeIssue: (params: {
|
|
823
|
+
data: any;
|
|
824
|
+
path: (string | number)[];
|
|
825
|
+
errorMaps: ZodErrorMap[];
|
|
826
|
+
issueData: IssueData;
|
|
827
|
+
}) => ZodIssue;
|
|
828
|
+
|
|
829
|
+
declare type MakeReadonly<T> = T extends Map<infer K, infer V> ? ReadonlyMap<K, V> : T extends Set<infer V> ? ReadonlySet<V> : T extends [infer Head, ...infer Tail] ? readonly [Head, ...Tail] : T extends Array<infer V> ? ReadonlyArray<V> : T extends BuiltIn ? T : Readonly<T>;
|
|
830
|
+
|
|
831
|
+
declare const mapType: <KeySchema extends ZodTypeAny = ZodTypeAny, ValueSchema extends ZodTypeAny = ZodTypeAny>(keyType: KeySchema, valueType: ValueSchema, params?: RawCreateParams) => ZodMap<KeySchema, ValueSchema>;
|
|
832
|
+
|
|
833
|
+
declare type mergeTypes<A, B> = {
|
|
834
|
+
[k in keyof A | keyof B]: k extends keyof B ? B[k] : k extends keyof A ? A[k] : never;
|
|
835
|
+
};
|
|
836
|
+
|
|
837
|
+
declare type Methods = Record<string, JSFunction>;
|
|
838
|
+
|
|
274
839
|
export declare interface ModelCapability {
|
|
275
840
|
supportImage?: ImageFeatures;
|
|
276
841
|
supportFunctionCalling?: boolean;
|
|
@@ -288,18 +853,445 @@ export declare interface ModelInfo {
|
|
|
288
853
|
features?: ModelFeatures;
|
|
289
854
|
}
|
|
290
855
|
|
|
291
|
-
|
|
856
|
+
declare const nanType: (params?: RawCreateParams) => ZodNaN;
|
|
292
857
|
|
|
293
|
-
|
|
858
|
+
declare const nativeEnumType: <Elements extends EnumLike>(values: Elements, params?: RawCreateParams) => ZodNativeEnum<Elements>;
|
|
294
859
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
860
|
+
declare const NEVER: never;
|
|
861
|
+
|
|
862
|
+
declare const neverType: (params?: RawCreateParams) => ZodNever;
|
|
863
|
+
|
|
864
|
+
declare interface Node_2 {
|
|
865
|
+
id?: string;
|
|
866
|
+
componentName: string;
|
|
867
|
+
props?: Record<string, any> & {
|
|
868
|
+
columns?: {
|
|
869
|
+
slots?: Record<string, any>;
|
|
870
|
+
}[];
|
|
871
|
+
};
|
|
872
|
+
children?: Node_2[];
|
|
873
|
+
componentType?: 'Block' | 'PageStart' | 'PageSection';
|
|
874
|
+
slot?: string | Record<string, any>;
|
|
875
|
+
params?: string[];
|
|
876
|
+
loop?: Record<string, any>;
|
|
877
|
+
loopArgs?: string[];
|
|
878
|
+
condition?: boolean | Record<string, any>;
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
declare type NodeSchema = z.infer<typeof nodeSchema>;
|
|
882
|
+
|
|
883
|
+
declare const nodeSchema: z.ZodType<Node_2, z.ZodTypeDef, Node_2>;
|
|
884
|
+
|
|
885
|
+
declare type noUnrecognized<Obj extends object, Shape extends object> = {
|
|
886
|
+
[k in keyof Obj]: k extends keyof Shape ? Obj[k] : never;
|
|
887
|
+
};
|
|
888
|
+
|
|
889
|
+
declare const nullableType: <Inner extends ZodTypeAny>(type: Inner, params?: RawCreateParams) => ZodNullable<Inner>;
|
|
890
|
+
|
|
891
|
+
declare const nullType: (params?: RawCreateParams) => ZodNull;
|
|
892
|
+
|
|
893
|
+
declare const numberType: (params?: RawCreateParams & {
|
|
894
|
+
coerce?: boolean;
|
|
895
|
+
}) => ZodNumber;
|
|
896
|
+
|
|
897
|
+
declare type objectInputType<Shape extends ZodRawShape, Catchall extends ZodTypeAny, UnknownKeys extends UnknownKeysParam = UnknownKeysParam> = objectUtil.flatten<baseObjectInputType<Shape>> & CatchallInput<Catchall> & PassthroughType<UnknownKeys>;
|
|
898
|
+
|
|
899
|
+
declare type objectOutputType<Shape extends ZodRawShape, Catchall extends ZodTypeAny, UnknownKeys extends UnknownKeysParam = UnknownKeysParam> = objectUtil.flatten<objectUtil.addQuestionMarks<baseObjectOutputType<Shape>>> & CatchallOutput<Catchall> & PassthroughType<UnknownKeys>;
|
|
900
|
+
|
|
901
|
+
declare type ObjectPair = {
|
|
902
|
+
key: SyncParseReturnType<any>;
|
|
903
|
+
value: SyncParseReturnType<any>;
|
|
904
|
+
};
|
|
905
|
+
|
|
906
|
+
declare const objectType: <Shape extends ZodRawShape>(shape: Shape, params?: RawCreateParams) => ZodObject<Shape, "strip", ZodTypeAny, objectOutputType<Shape, ZodTypeAny, "strip">, objectInputType<Shape, ZodTypeAny, "strip">>;
|
|
907
|
+
|
|
908
|
+
declare namespace objectUtil {
|
|
909
|
+
type MergeShapes<U, V> = keyof U & keyof V extends never ? U & V : {
|
|
910
|
+
[k in Exclude<keyof U, keyof V>]: U[k];
|
|
911
|
+
} & V;
|
|
912
|
+
type optionalKeys<T extends object> = {
|
|
913
|
+
[k in keyof T]: undefined extends T[k] ? k : never;
|
|
914
|
+
}[keyof T];
|
|
915
|
+
type requiredKeys<T extends object> = {
|
|
916
|
+
[k in keyof T]: undefined extends T[k] ? never : k;
|
|
917
|
+
}[keyof T];
|
|
918
|
+
type addQuestionMarks<T extends object, _O = any> = {
|
|
919
|
+
[K in requiredKeys<T>]: T[K];
|
|
920
|
+
} & {
|
|
921
|
+
[K in optionalKeys<T>]?: T[K];
|
|
922
|
+
} & {
|
|
923
|
+
[k in keyof T]?: unknown;
|
|
924
|
+
};
|
|
925
|
+
type identity<T> = T;
|
|
926
|
+
type flatten<T> = identity<{
|
|
927
|
+
[k in keyof T]: T[k];
|
|
928
|
+
}>;
|
|
929
|
+
type noNeverKeys<T> = {
|
|
930
|
+
[k in keyof T]: [T[k]] extends [never] ? never : k;
|
|
931
|
+
}[keyof T];
|
|
932
|
+
type noNever<T> = identity<{
|
|
933
|
+
[k in noNeverKeys<T>]: k extends keyof T ? T[k] : never;
|
|
934
|
+
}>;
|
|
935
|
+
const mergeShapes: <U, T>(first: U, second: T) => T & U;
|
|
936
|
+
type extendShape<A extends object, B extends object> = keyof A & keyof B extends never ? A & B : {
|
|
937
|
+
[K in keyof A as K extends keyof B ? never : K]: A[K];
|
|
938
|
+
} & {
|
|
939
|
+
[K in keyof B]: B[K];
|
|
940
|
+
};
|
|
941
|
+
{};
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
declare const oboolean: () => ZodOptional<ZodBoolean>;
|
|
945
|
+
|
|
946
|
+
declare type OK<T> = {
|
|
947
|
+
status: "valid";
|
|
948
|
+
value: T;
|
|
949
|
+
};
|
|
950
|
+
|
|
951
|
+
declare const OK: <T>(value: T) => OK<T>;
|
|
952
|
+
|
|
953
|
+
declare const onumber: () => ZodOptional<ZodNumber>;
|
|
954
|
+
|
|
955
|
+
declare const optionalType: <Inner extends ZodTypeAny>(type: Inner, params?: RawCreateParams) => ZodOptional<Inner>;
|
|
956
|
+
|
|
957
|
+
declare const ostring: () => ZodOptional<ZodString>;
|
|
958
|
+
|
|
959
|
+
declare type OuterTypeOfFunction<Args extends ZodTuple<any, any>, Returns extends ZodTypeAny> = Args["_input"] extends Array<any> ? (...args: Args["_input"]) => Returns["_output"] : never;
|
|
960
|
+
|
|
961
|
+
declare type output<T extends ZodType<any, any, any>> = T["_output"];
|
|
962
|
+
|
|
963
|
+
declare type OutputTypeOfTuple<T extends ZodTupleItems | []> = AssertArray<{
|
|
964
|
+
[k in keyof T]: T[k] extends ZodType<any, any, any> ? T[k]["_output"] : never;
|
|
965
|
+
}>;
|
|
966
|
+
|
|
967
|
+
declare type OutputTypeOfTupleWithRest<T extends ZodTupleItems | [], Rest extends ZodTypeAny | null = null> = Rest extends ZodTypeAny ? [...OutputTypeOfTuple<T>, ...Rest["_output"][]] : OutputTypeOfTuple<T>;
|
|
968
|
+
|
|
969
|
+
declare interface ParseContext {
|
|
970
|
+
readonly common: {
|
|
971
|
+
readonly issues: ZodIssue[];
|
|
972
|
+
readonly contextualErrorMap?: ZodErrorMap | undefined;
|
|
973
|
+
readonly async: boolean;
|
|
974
|
+
};
|
|
975
|
+
readonly path: ParsePath;
|
|
976
|
+
readonly schemaErrorMap?: ZodErrorMap | undefined;
|
|
977
|
+
readonly parent: ParseContext | null;
|
|
978
|
+
readonly data: any;
|
|
979
|
+
readonly parsedType: ZodParsedType;
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
declare type ParseInput = {
|
|
983
|
+
data: any;
|
|
984
|
+
path: (string | number)[];
|
|
985
|
+
parent: ParseContext;
|
|
986
|
+
};
|
|
987
|
+
|
|
988
|
+
declare type ParseParams = {
|
|
989
|
+
path: (string | number)[];
|
|
990
|
+
errorMap: ZodErrorMap;
|
|
991
|
+
async: boolean;
|
|
992
|
+
};
|
|
993
|
+
|
|
994
|
+
declare type ParsePath = ParsePathComponent[];
|
|
995
|
+
|
|
996
|
+
declare type ParsePathComponent = string | number;
|
|
997
|
+
|
|
998
|
+
declare interface ParseResult {
|
|
999
|
+
status: "aborted" | "dirty" | "valid";
|
|
1000
|
+
data: any;
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
declare type ParseReturnType<T> = SyncParseReturnType<T> | AsyncParseReturnType<T>;
|
|
1004
|
+
|
|
1005
|
+
declare class ParseStatus {
|
|
1006
|
+
value: "aborted" | "dirty" | "valid";
|
|
1007
|
+
dirty(): void;
|
|
1008
|
+
abort(): void;
|
|
1009
|
+
static mergeArray(status: ParseStatus, results: SyncParseReturnType<any>[]): SyncParseReturnType;
|
|
1010
|
+
static mergeObjectAsync(status: ParseStatus, pairs: {
|
|
1011
|
+
key: ParseReturnType<any>;
|
|
1012
|
+
value: ParseReturnType<any>;
|
|
1013
|
+
}[]): Promise<SyncParseReturnType<any>>;
|
|
1014
|
+
static mergeObjectSync(status: ParseStatus, pairs: {
|
|
1015
|
+
key: SyncParseReturnType<any>;
|
|
1016
|
+
value: SyncParseReturnType<any>;
|
|
1017
|
+
alwaysSet?: boolean;
|
|
1018
|
+
}[]): SyncParseReturnType;
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
declare namespace partialUtil {
|
|
1022
|
+
type DeepPartial<T extends ZodTypeAny> = T extends ZodObject<ZodRawShape> ? ZodObject<{
|
|
1023
|
+
[k in keyof T["shape"]]: ZodOptional<DeepPartial<T["shape"][k]>>;
|
|
1024
|
+
}, 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> ? {
|
|
1025
|
+
[k in keyof Items]: Items[k] extends ZodTypeAny ? DeepPartial<Items[k]> : never;
|
|
1026
|
+
} extends infer PI ? PI extends ZodTupleItems ? ZodTuple<PI> : never : never : T;
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
declare type PassthroughType<T extends UnknownKeysParam> = T extends "passthrough" ? {
|
|
1030
|
+
[k: string]: unknown;
|
|
1031
|
+
} : unknown;
|
|
1032
|
+
|
|
1033
|
+
declare const pipelineType: typeof ZodPipeline.create;
|
|
1034
|
+
|
|
1035
|
+
declare type PreprocessEffect<T> = {
|
|
1036
|
+
type: "preprocess";
|
|
1037
|
+
transform: (arg: T, ctx: RefinementCtx) => any;
|
|
1038
|
+
};
|
|
1039
|
+
|
|
1040
|
+
declare const preprocessType: <I extends ZodTypeAny>(preprocess: (arg: unknown, ctx: RefinementCtx) => unknown, schema: I, params?: RawCreateParams) => ZodEffects<I, I["_output"], unknown>;
|
|
1041
|
+
|
|
1042
|
+
declare type Primitive = string | number | symbol | bigint | boolean | null | undefined;
|
|
1043
|
+
|
|
1044
|
+
declare const primitiveMappings: {
|
|
1045
|
+
readonly ZodString: "string";
|
|
1046
|
+
readonly ZodNumber: "number";
|
|
1047
|
+
readonly ZodBigInt: "integer";
|
|
1048
|
+
readonly ZodBoolean: "boolean";
|
|
1049
|
+
readonly ZodNull: "null";
|
|
1050
|
+
};
|
|
1051
|
+
|
|
1052
|
+
declare type ProcessedCreateParams = {
|
|
1053
|
+
errorMap?: ZodErrorMap | undefined;
|
|
1054
|
+
description?: string | undefined;
|
|
1055
|
+
};
|
|
1056
|
+
|
|
1057
|
+
declare const promiseType: <Inner extends ZodTypeAny>(schema: Inner, params?: RawCreateParams) => ZodPromise<Inner>;
|
|
1058
|
+
|
|
1059
|
+
declare const quotelessJson: (obj: any) => string;
|
|
1060
|
+
|
|
1061
|
+
declare type RawCreateParams = {
|
|
1062
|
+
errorMap?: ZodErrorMap | undefined;
|
|
1063
|
+
invalid_type_error?: string | undefined;
|
|
1064
|
+
required_error?: string | undefined;
|
|
1065
|
+
message?: string | undefined;
|
|
1066
|
+
description?: string | undefined;
|
|
1067
|
+
} | undefined;
|
|
1068
|
+
|
|
1069
|
+
declare type RecordType<K extends string | number | symbol, V> = [string] extends [K] ? Record<K, V> : [number] extends [K] ? Record<K, V> : [symbol] extends [K] ? Record<K, V> : [BRAND<string | number | symbol>] extends [K] ? Record<K, V> : Partial<Record<K, V>>;
|
|
1070
|
+
|
|
1071
|
+
declare const recordType: typeof ZodRecord.create;
|
|
1072
|
+
|
|
1073
|
+
declare type recursiveZodFormattedError<T> = T extends [any, ...any[]] ? {
|
|
1074
|
+
[K in keyof T]?: ZodFormattedError<T[K]>;
|
|
1075
|
+
} : T extends any[] ? {
|
|
1076
|
+
[k: number]: ZodFormattedError<T[number]>;
|
|
1077
|
+
} : T extends object ? {
|
|
1078
|
+
[K in keyof T]?: ZodFormattedError<T[K]>;
|
|
1079
|
+
} : unknown;
|
|
1080
|
+
|
|
1081
|
+
declare type Refinement<T> = (arg: T, ctx: RefinementCtx) => any;
|
|
1082
|
+
|
|
1083
|
+
declare interface RefinementCtx {
|
|
1084
|
+
addIssue: (arg: IssueData) => void;
|
|
1085
|
+
path: (string | number)[];
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
declare type RefinementEffect<T> = {
|
|
1089
|
+
type: "refinement";
|
|
1090
|
+
refinement: (arg: T, ctx: RefinementCtx) => any;
|
|
1091
|
+
};
|
|
1092
|
+
|
|
1093
|
+
export declare const RENDERER_SETTINGS_KEY: symbol;
|
|
1094
|
+
|
|
1095
|
+
export declare const requiredCompleteFieldSelectors: string[];
|
|
1096
|
+
|
|
1097
|
+
declare type RootNode = Omit<Node_2, 'id'> & {
|
|
1098
|
+
id?: string;
|
|
1099
|
+
css?: string;
|
|
1100
|
+
fileName?: string;
|
|
1101
|
+
methods?: Methods;
|
|
1102
|
+
state?: Record<string, unknown>;
|
|
1103
|
+
lifeCycles?: Record<string, unknown>;
|
|
1104
|
+
children?: Node_2[];
|
|
1105
|
+
dataSource?: any;
|
|
1106
|
+
bridge?: any;
|
|
1107
|
+
inputs?: any[];
|
|
1108
|
+
outputs?: any[];
|
|
1109
|
+
schema?: any;
|
|
1110
|
+
};
|
|
1111
|
+
|
|
1112
|
+
declare type SafeParseError<Input> = {
|
|
1113
|
+
success: false;
|
|
1114
|
+
error: ZodError<Input>;
|
|
1115
|
+
data?: never;
|
|
1116
|
+
};
|
|
1117
|
+
|
|
1118
|
+
declare type SafeParseReturnType<Input, Output> = SafeParseSuccess<Output> | SafeParseError<Input>;
|
|
1119
|
+
|
|
1120
|
+
declare type SafeParseSuccess<Output> = {
|
|
1121
|
+
success: true;
|
|
1122
|
+
data: Output;
|
|
1123
|
+
error?: never;
|
|
1124
|
+
};
|
|
1125
|
+
|
|
1126
|
+
declare type Scalars = Primitive | Primitive[];
|
|
1127
|
+
|
|
1128
|
+
declare function setErrorMap(map: ZodErrorMap): void;
|
|
1129
|
+
|
|
1130
|
+
declare const setType: <ValueSchema extends ZodTypeAny = ZodTypeAny>(valueType: ValueSchema, params?: RawCreateParams) => ZodSet<ValueSchema>;
|
|
1131
|
+
|
|
1132
|
+
declare type SomeZodObject = ZodObject<ZodRawShape, UnknownKeysParam, ZodTypeAny>;
|
|
1133
|
+
|
|
1134
|
+
/**
|
|
1135
|
+
* The Standard Schema interface.
|
|
1136
|
+
*/
|
|
1137
|
+
declare type StandardSchemaV1<Input = unknown, Output = Input> = {
|
|
1138
|
+
/**
|
|
1139
|
+
* The Standard Schema properties.
|
|
1140
|
+
*/
|
|
1141
|
+
readonly "~standard": StandardSchemaV1.Props<Input, Output>;
|
|
1142
|
+
};
|
|
1143
|
+
|
|
1144
|
+
declare namespace StandardSchemaV1 {
|
|
1145
|
+
/**
|
|
1146
|
+
* The Standard Schema properties interface.
|
|
1147
|
+
*/
|
|
1148
|
+
interface Props<Input = unknown, Output = Input> {
|
|
1149
|
+
/**
|
|
1150
|
+
* The version number of the standard.
|
|
1151
|
+
*/
|
|
1152
|
+
readonly version: 1;
|
|
1153
|
+
/**
|
|
1154
|
+
* The vendor name of the schema library.
|
|
1155
|
+
*/
|
|
1156
|
+
readonly vendor: string;
|
|
1157
|
+
/**
|
|
1158
|
+
* Validates unknown input values.
|
|
1159
|
+
*/
|
|
1160
|
+
readonly validate: (value: unknown) => Result<Output> | Promise<Result<Output>>;
|
|
1161
|
+
/**
|
|
1162
|
+
* Inferred types associated with the schema.
|
|
1163
|
+
*/
|
|
1164
|
+
readonly types?: Types<Input, Output> | undefined;
|
|
1165
|
+
}
|
|
1166
|
+
/**
|
|
1167
|
+
* The result interface of the validate function.
|
|
1168
|
+
*/
|
|
1169
|
+
type Result<Output> = SuccessResult<Output> | FailureResult;
|
|
1170
|
+
/**
|
|
1171
|
+
* The result interface if validation succeeds.
|
|
1172
|
+
*/
|
|
1173
|
+
interface SuccessResult<Output> {
|
|
1174
|
+
/**
|
|
1175
|
+
* The typed output value.
|
|
1176
|
+
*/
|
|
1177
|
+
readonly value: Output;
|
|
1178
|
+
/**
|
|
1179
|
+
* The non-existent issues.
|
|
1180
|
+
*/
|
|
1181
|
+
readonly issues?: undefined;
|
|
1182
|
+
}
|
|
1183
|
+
/**
|
|
1184
|
+
* The result interface if validation fails.
|
|
1185
|
+
*/
|
|
1186
|
+
interface FailureResult {
|
|
1187
|
+
/**
|
|
1188
|
+
* The issues of failed validation.
|
|
1189
|
+
*/
|
|
1190
|
+
readonly issues: ReadonlyArray<Issue>;
|
|
1191
|
+
}
|
|
1192
|
+
/**
|
|
1193
|
+
* The issue interface of the failure output.
|
|
1194
|
+
*/
|
|
1195
|
+
interface Issue {
|
|
1196
|
+
/**
|
|
1197
|
+
* The error message of the issue.
|
|
1198
|
+
*/
|
|
1199
|
+
readonly message: string;
|
|
1200
|
+
/**
|
|
1201
|
+
* The path of the issue, if any.
|
|
1202
|
+
*/
|
|
1203
|
+
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
|
1204
|
+
}
|
|
1205
|
+
/**
|
|
1206
|
+
* The path segment interface of the issue.
|
|
1207
|
+
*/
|
|
1208
|
+
interface PathSegment {
|
|
1209
|
+
/**
|
|
1210
|
+
* The key representing a path segment.
|
|
1211
|
+
*/
|
|
1212
|
+
readonly key: PropertyKey;
|
|
1213
|
+
}
|
|
1214
|
+
/**
|
|
1215
|
+
* The Standard Schema types interface.
|
|
1216
|
+
*/
|
|
1217
|
+
interface Types<Input = unknown, Output = Input> {
|
|
1218
|
+
/**
|
|
1219
|
+
* The input type of the schema.
|
|
1220
|
+
*/
|
|
1221
|
+
readonly input: Input;
|
|
1222
|
+
/**
|
|
1223
|
+
* The output type of the schema.
|
|
1224
|
+
*/
|
|
1225
|
+
readonly output: Output;
|
|
1226
|
+
}
|
|
1227
|
+
/**
|
|
1228
|
+
* Infers the input type of a Standard Schema.
|
|
1229
|
+
*/
|
|
1230
|
+
type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["input"];
|
|
1231
|
+
/**
|
|
1232
|
+
* Infers the output type of a Standard Schema.
|
|
1233
|
+
*/
|
|
1234
|
+
type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["output"];
|
|
1235
|
+
{};
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
declare const strictObjectType: <Shape extends ZodRawShape>(shape: Shape, params?: RawCreateParams) => ZodObject<Shape, "strict">;
|
|
1239
|
+
|
|
1240
|
+
declare const stringType: (params?: RawCreateParams & {
|
|
1241
|
+
coerce?: true;
|
|
1242
|
+
}) => ZodString;
|
|
1243
|
+
|
|
1244
|
+
declare type StringValidation = "email" | "url" | "emoji" | "uuid" | "nanoid" | "regex" | "cuid" | "cuid2" | "ulid" | "datetime" | "date" | "time" | "duration" | "ip" | "cidr" | "base64" | "jwt" | "base64url" | {
|
|
1245
|
+
includes: string;
|
|
1246
|
+
position?: number | undefined;
|
|
1247
|
+
} | {
|
|
1248
|
+
startsWith: string;
|
|
1249
|
+
} | {
|
|
1250
|
+
endsWith: string;
|
|
1251
|
+
};
|
|
1252
|
+
|
|
1253
|
+
declare type stripPath<T extends object> = T extends any ? util.OmitKeys<T, "path"> : never;
|
|
1254
|
+
|
|
1255
|
+
declare type SuperRefinement<T> = (arg: T, ctx: RefinementCtx) => void | Promise<void>;
|
|
1256
|
+
|
|
1257
|
+
declare const symbolType: (params?: RawCreateParams) => ZodSymbol;
|
|
1258
|
+
|
|
1259
|
+
declare type SyncParseReturnType<T = any> = OK<T> | DIRTY<T> | INVALID;
|
|
1260
|
+
|
|
1261
|
+
declare type TransformEffect<T> = {
|
|
1262
|
+
type: "transform";
|
|
1263
|
+
transform: (arg: T, ctx: RefinementCtx) => any;
|
|
1264
|
+
};
|
|
1265
|
+
|
|
1266
|
+
declare const tupleType: <Items extends [ZodTypeAny, ...ZodTypeAny[]] | []>(schemas: Items, params?: RawCreateParams) => ZodTuple<Items, null>;
|
|
1267
|
+
|
|
1268
|
+
declare type typecast<A, T> = A extends T ? A : never;
|
|
1269
|
+
|
|
1270
|
+
declare type TypeOf<T extends ZodType<any, any, any>> = T["_output"];
|
|
1271
|
+
|
|
1272
|
+
declare type typeToFlattenedError<T, U = string> = {
|
|
1273
|
+
formErrors: U[];
|
|
1274
|
+
fieldErrors: {
|
|
1275
|
+
[P in allKeys<T>]?: U[];
|
|
1276
|
+
};
|
|
1277
|
+
};
|
|
1278
|
+
|
|
1279
|
+
declare const undefinedType: (params?: RawCreateParams) => ZodUndefined;
|
|
1280
|
+
|
|
1281
|
+
declare const unionType: <Options extends Readonly<[ZodTypeAny, ZodTypeAny, ...ZodTypeAny[]]>>(types: Options, params?: RawCreateParams) => ZodUnion<Options>;
|
|
1282
|
+
|
|
1283
|
+
declare type UnknownKeysParam = "passthrough" | "strict" | "strip";
|
|
1284
|
+
|
|
1285
|
+
declare const unknownType: (params?: RawCreateParams) => ZodUnknown;
|
|
1286
|
+
|
|
1287
|
+
/**
|
|
1288
|
+
* useConversation返回值接口
|
|
1289
|
+
*/
|
|
1290
|
+
declare interface UseConversationReturn {
|
|
1291
|
+
/** 会话状态 */
|
|
1292
|
+
state: ConversationState;
|
|
1293
|
+
/** 消息管理 */
|
|
1294
|
+
messageManager: ComputedRef<UseMessageReturn>;
|
|
303
1295
|
/** 创建新会话 */
|
|
304
1296
|
createConversation: (title?: string, metadata?: Record<string, unknown>) => string;
|
|
305
1297
|
/** 切换会话 */
|
|
@@ -322,6 +1314,10 @@ declare interface UseConversationReturn {
|
|
|
322
1314
|
|
|
323
1315
|
export declare const useI18n: () => I18nInstance;
|
|
324
1316
|
|
|
1317
|
+
export declare const useMediaTheme: () => {
|
|
1318
|
+
theme: Readonly<Ref<"dark" | "light", "dark" | "light">>;
|
|
1319
|
+
};
|
|
1320
|
+
|
|
325
1321
|
/**
|
|
326
1322
|
* useMessage返回值接口
|
|
327
1323
|
*/
|
|
@@ -350,4 +1346,1375 @@ declare interface UseMessageReturn {
|
|
|
350
1346
|
retryRequest: (msgIndex: number) => Promise<void>;
|
|
351
1347
|
}
|
|
352
1348
|
|
|
1349
|
+
declare namespace util {
|
|
1350
|
+
type AssertEqual<T, U> = (<V>() => V extends T ? 1 : 2) extends <V>() => V extends U ? 1 : 2 ? true : false;
|
|
1351
|
+
type isAny<T> = 0 extends 1 & T ? true : false;
|
|
1352
|
+
const assertEqual: <A, B>(_: AssertEqual<A, B>) => void;
|
|
1353
|
+
function assertIs<T>(_arg: T): void;
|
|
1354
|
+
function assertNever(_x: never): never;
|
|
1355
|
+
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
|
1356
|
+
type OmitKeys<T, K extends string> = Pick<T, Exclude<keyof T, K>>;
|
|
1357
|
+
type MakePartial<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
1358
|
+
type Exactly<T, X> = T & Record<Exclude<keyof X, keyof T>, never>;
|
|
1359
|
+
type InexactPartial<T> = {
|
|
1360
|
+
[k in keyof T]?: T[k] | undefined;
|
|
1361
|
+
};
|
|
1362
|
+
const arrayToEnum: <T extends string, U extends [T, ...T[]]>(items: U) => { [k in U[number]]: k; };
|
|
1363
|
+
const getValidEnumValues: (obj: any) => any[];
|
|
1364
|
+
const objectValues: (obj: any) => any[];
|
|
1365
|
+
const objectKeys: ObjectConstructor["keys"];
|
|
1366
|
+
const find: <T>(arr: T[], checker: (arg: T) => any) => T | undefined;
|
|
1367
|
+
type identity<T> = objectUtil.identity<T>;
|
|
1368
|
+
type flatten<T> = objectUtil.flatten<T>;
|
|
1369
|
+
type noUndefined<T> = T extends undefined ? never : T;
|
|
1370
|
+
const isInteger: NumberConstructor["isInteger"];
|
|
1371
|
+
function joinValues<T extends any[]>(array: T, separator?: string): string;
|
|
1372
|
+
const jsonStringifyReplacer: (_: string, value: any) => any;
|
|
1373
|
+
{};
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1376
|
+
declare type Values<T extends EnumValues> = {
|
|
1377
|
+
[k in T[number]]: k;
|
|
1378
|
+
};
|
|
1379
|
+
|
|
1380
|
+
declare const voidType: (params?: RawCreateParams) => ZodVoid;
|
|
1381
|
+
|
|
1382
|
+
declare type Writeable<T> = {
|
|
1383
|
+
-readonly [P in keyof T]: T[P];
|
|
1384
|
+
};
|
|
1385
|
+
|
|
1386
|
+
declare namespace z {
|
|
1387
|
+
export {
|
|
1388
|
+
setErrorMap,
|
|
1389
|
+
getErrorMap,
|
|
1390
|
+
errorMap as defaultErrorMap,
|
|
1391
|
+
addIssueToContext,
|
|
1392
|
+
makeIssue,
|
|
1393
|
+
ParseParams,
|
|
1394
|
+
ParsePathComponent,
|
|
1395
|
+
ParsePath,
|
|
1396
|
+
EMPTY_PATH,
|
|
1397
|
+
ParseContext,
|
|
1398
|
+
ParseInput,
|
|
1399
|
+
ObjectPair,
|
|
1400
|
+
ParseStatus,
|
|
1401
|
+
ParseResult,
|
|
1402
|
+
INVALID,
|
|
1403
|
+
DIRTY,
|
|
1404
|
+
OK,
|
|
1405
|
+
SyncParseReturnType,
|
|
1406
|
+
AsyncParseReturnType,
|
|
1407
|
+
ParseReturnType,
|
|
1408
|
+
isAborted,
|
|
1409
|
+
isDirty,
|
|
1410
|
+
isValid,
|
|
1411
|
+
isAsync,
|
|
1412
|
+
Primitive,
|
|
1413
|
+
Scalars,
|
|
1414
|
+
util,
|
|
1415
|
+
objectUtil,
|
|
1416
|
+
ZodParsedType,
|
|
1417
|
+
getParsedType,
|
|
1418
|
+
datetimeRegex,
|
|
1419
|
+
custom,
|
|
1420
|
+
RefinementCtx,
|
|
1421
|
+
ZodRawShape,
|
|
1422
|
+
ZodTypeAny,
|
|
1423
|
+
TypeOf,
|
|
1424
|
+
input,
|
|
1425
|
+
output,
|
|
1426
|
+
TypeOf as infer,
|
|
1427
|
+
CustomErrorParams,
|
|
1428
|
+
ZodTypeDef,
|
|
1429
|
+
RawCreateParams,
|
|
1430
|
+
ProcessedCreateParams,
|
|
1431
|
+
SafeParseSuccess,
|
|
1432
|
+
SafeParseError,
|
|
1433
|
+
SafeParseReturnType,
|
|
1434
|
+
ZodType,
|
|
1435
|
+
IpVersion,
|
|
1436
|
+
ZodStringCheck,
|
|
1437
|
+
ZodStringDef,
|
|
1438
|
+
ZodString,
|
|
1439
|
+
ZodNumberCheck,
|
|
1440
|
+
ZodNumberDef,
|
|
1441
|
+
ZodNumber,
|
|
1442
|
+
ZodBigIntCheck,
|
|
1443
|
+
ZodBigIntDef,
|
|
1444
|
+
ZodBigInt,
|
|
1445
|
+
ZodBooleanDef,
|
|
1446
|
+
ZodBoolean,
|
|
1447
|
+
ZodDateCheck,
|
|
1448
|
+
ZodDateDef,
|
|
1449
|
+
ZodDate,
|
|
1450
|
+
ZodSymbolDef,
|
|
1451
|
+
ZodSymbol,
|
|
1452
|
+
ZodUndefinedDef,
|
|
1453
|
+
ZodUndefined,
|
|
1454
|
+
ZodNullDef,
|
|
1455
|
+
ZodNull,
|
|
1456
|
+
ZodAnyDef,
|
|
1457
|
+
ZodAny,
|
|
1458
|
+
ZodUnknownDef,
|
|
1459
|
+
ZodUnknown,
|
|
1460
|
+
ZodNeverDef,
|
|
1461
|
+
ZodNever,
|
|
1462
|
+
ZodVoidDef,
|
|
1463
|
+
ZodVoid,
|
|
1464
|
+
ZodArrayDef,
|
|
1465
|
+
ArrayCardinality,
|
|
1466
|
+
arrayOutputType,
|
|
1467
|
+
ZodArray,
|
|
1468
|
+
ZodNonEmptyArray,
|
|
1469
|
+
UnknownKeysParam,
|
|
1470
|
+
ZodObjectDef,
|
|
1471
|
+
mergeTypes,
|
|
1472
|
+
objectOutputType,
|
|
1473
|
+
baseObjectOutputType,
|
|
1474
|
+
objectInputType,
|
|
1475
|
+
baseObjectInputType,
|
|
1476
|
+
CatchallOutput,
|
|
1477
|
+
CatchallInput,
|
|
1478
|
+
PassthroughType,
|
|
1479
|
+
deoptional,
|
|
1480
|
+
SomeZodObject,
|
|
1481
|
+
noUnrecognized,
|
|
1482
|
+
ZodObject,
|
|
1483
|
+
AnyZodObject,
|
|
1484
|
+
ZodUnionOptions,
|
|
1485
|
+
ZodUnionDef,
|
|
1486
|
+
ZodUnion,
|
|
1487
|
+
ZodDiscriminatedUnionOption,
|
|
1488
|
+
ZodDiscriminatedUnionDef,
|
|
1489
|
+
ZodDiscriminatedUnion,
|
|
1490
|
+
ZodIntersectionDef,
|
|
1491
|
+
ZodIntersection,
|
|
1492
|
+
ZodTupleItems,
|
|
1493
|
+
AssertArray,
|
|
1494
|
+
OutputTypeOfTuple,
|
|
1495
|
+
OutputTypeOfTupleWithRest,
|
|
1496
|
+
InputTypeOfTuple,
|
|
1497
|
+
InputTypeOfTupleWithRest,
|
|
1498
|
+
ZodTupleDef,
|
|
1499
|
+
AnyZodTuple,
|
|
1500
|
+
ZodTuple,
|
|
1501
|
+
ZodRecordDef,
|
|
1502
|
+
KeySchema,
|
|
1503
|
+
RecordType,
|
|
1504
|
+
ZodRecord,
|
|
1505
|
+
ZodMapDef,
|
|
1506
|
+
ZodMap,
|
|
1507
|
+
ZodSetDef,
|
|
1508
|
+
ZodSet,
|
|
1509
|
+
ZodFunctionDef,
|
|
1510
|
+
OuterTypeOfFunction,
|
|
1511
|
+
InnerTypeOfFunction,
|
|
1512
|
+
ZodFunction,
|
|
1513
|
+
ZodLazyDef,
|
|
1514
|
+
ZodLazy,
|
|
1515
|
+
ZodLiteralDef,
|
|
1516
|
+
ZodLiteral,
|
|
1517
|
+
ArrayKeys,
|
|
1518
|
+
Indices,
|
|
1519
|
+
EnumValues,
|
|
1520
|
+
Values,
|
|
1521
|
+
ZodEnumDef,
|
|
1522
|
+
Writeable,
|
|
1523
|
+
FilterEnum,
|
|
1524
|
+
typecast,
|
|
1525
|
+
ZodEnum,
|
|
1526
|
+
ZodNativeEnumDef,
|
|
1527
|
+
EnumLike,
|
|
1528
|
+
ZodNativeEnum,
|
|
1529
|
+
ZodPromiseDef,
|
|
1530
|
+
ZodPromise,
|
|
1531
|
+
Refinement,
|
|
1532
|
+
SuperRefinement,
|
|
1533
|
+
RefinementEffect,
|
|
1534
|
+
TransformEffect,
|
|
1535
|
+
PreprocessEffect,
|
|
1536
|
+
Effect,
|
|
1537
|
+
ZodEffectsDef,
|
|
1538
|
+
ZodEffects,
|
|
1539
|
+
ZodEffects as ZodTransformer,
|
|
1540
|
+
ZodOptionalDef,
|
|
1541
|
+
ZodOptionalType,
|
|
1542
|
+
ZodOptional,
|
|
1543
|
+
ZodNullableDef,
|
|
1544
|
+
ZodNullableType,
|
|
1545
|
+
ZodNullable,
|
|
1546
|
+
ZodDefaultDef,
|
|
1547
|
+
ZodDefault,
|
|
1548
|
+
ZodCatchDef,
|
|
1549
|
+
ZodCatch,
|
|
1550
|
+
ZodNaNDef,
|
|
1551
|
+
ZodNaN,
|
|
1552
|
+
ZodBrandedDef,
|
|
1553
|
+
BRAND,
|
|
1554
|
+
ZodBranded,
|
|
1555
|
+
ZodPipelineDef,
|
|
1556
|
+
ZodPipeline,
|
|
1557
|
+
ZodReadonlyDef,
|
|
1558
|
+
ZodReadonly,
|
|
1559
|
+
ZodType as Schema,
|
|
1560
|
+
ZodType as ZodSchema,
|
|
1561
|
+
late,
|
|
1562
|
+
ZodFirstPartyTypeKind,
|
|
1563
|
+
ZodFirstPartySchemaTypes,
|
|
1564
|
+
coerce,
|
|
1565
|
+
anyType as any,
|
|
1566
|
+
arrayType as array,
|
|
1567
|
+
bigIntType as bigint,
|
|
1568
|
+
booleanType as boolean,
|
|
1569
|
+
dateType as date,
|
|
1570
|
+
discriminatedUnionType as discriminatedUnion,
|
|
1571
|
+
effectsType as effect,
|
|
1572
|
+
enumType as enum,
|
|
1573
|
+
functionType as function,
|
|
1574
|
+
instanceOfType as instanceof,
|
|
1575
|
+
intersectionType as intersection,
|
|
1576
|
+
lazyType as lazy,
|
|
1577
|
+
literalType as literal,
|
|
1578
|
+
mapType as map,
|
|
1579
|
+
nanType as nan,
|
|
1580
|
+
nativeEnumType as nativeEnum,
|
|
1581
|
+
neverType as never,
|
|
1582
|
+
nullType as null,
|
|
1583
|
+
nullableType as nullable,
|
|
1584
|
+
numberType as number,
|
|
1585
|
+
objectType as object,
|
|
1586
|
+
oboolean,
|
|
1587
|
+
onumber,
|
|
1588
|
+
optionalType as optional,
|
|
1589
|
+
ostring,
|
|
1590
|
+
pipelineType as pipeline,
|
|
1591
|
+
preprocessType as preprocess,
|
|
1592
|
+
promiseType as promise,
|
|
1593
|
+
recordType as record,
|
|
1594
|
+
setType as set,
|
|
1595
|
+
strictObjectType as strictObject,
|
|
1596
|
+
stringType as string,
|
|
1597
|
+
symbolType as symbol,
|
|
1598
|
+
effectsType as transformer,
|
|
1599
|
+
tupleType as tuple,
|
|
1600
|
+
undefinedType as undefined,
|
|
1601
|
+
unionType as union,
|
|
1602
|
+
unknownType as unknown,
|
|
1603
|
+
voidType as void,
|
|
1604
|
+
NEVER,
|
|
1605
|
+
inferFlattenedErrors,
|
|
1606
|
+
typeToFlattenedError,
|
|
1607
|
+
ZodIssueCode,
|
|
1608
|
+
ZodIssueBase,
|
|
1609
|
+
ZodInvalidTypeIssue,
|
|
1610
|
+
ZodInvalidLiteralIssue,
|
|
1611
|
+
ZodUnrecognizedKeysIssue,
|
|
1612
|
+
ZodInvalidUnionIssue,
|
|
1613
|
+
ZodInvalidUnionDiscriminatorIssue,
|
|
1614
|
+
ZodInvalidEnumValueIssue,
|
|
1615
|
+
ZodInvalidArgumentsIssue,
|
|
1616
|
+
ZodInvalidReturnTypeIssue,
|
|
1617
|
+
ZodInvalidDateIssue,
|
|
1618
|
+
StringValidation,
|
|
1619
|
+
ZodInvalidStringIssue,
|
|
1620
|
+
ZodTooSmallIssue,
|
|
1621
|
+
ZodTooBigIssue,
|
|
1622
|
+
ZodInvalidIntersectionTypesIssue,
|
|
1623
|
+
ZodNotMultipleOfIssue,
|
|
1624
|
+
ZodNotFiniteIssue,
|
|
1625
|
+
ZodCustomIssue,
|
|
1626
|
+
DenormalizedError,
|
|
1627
|
+
ZodIssueOptionalMessage,
|
|
1628
|
+
ZodIssue,
|
|
1629
|
+
quotelessJson,
|
|
1630
|
+
ZodFormattedError,
|
|
1631
|
+
inferFormattedError,
|
|
1632
|
+
ZodError,
|
|
1633
|
+
IssueData,
|
|
1634
|
+
ErrorMapCtx,
|
|
1635
|
+
ZodErrorMap
|
|
1636
|
+
}
|
|
1637
|
+
}
|
|
1638
|
+
|
|
1639
|
+
declare class ZodAny extends ZodType<any, ZodAnyDef, any> {
|
|
1640
|
+
_any: true;
|
|
1641
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1642
|
+
static create: (params?: RawCreateParams) => ZodAny;
|
|
1643
|
+
}
|
|
1644
|
+
|
|
1645
|
+
declare interface ZodAnyDef extends ZodTypeDef {
|
|
1646
|
+
typeName: ZodFirstPartyTypeKind.ZodAny;
|
|
1647
|
+
}
|
|
1648
|
+
|
|
1649
|
+
declare class ZodArray<T extends ZodTypeAny, Cardinality extends ArrayCardinality = "many"> extends ZodType<arrayOutputType<T, Cardinality>, ZodArrayDef<T>, Cardinality extends "atleastone" ? [T["_input"], ...T["_input"][]] : T["_input"][]> {
|
|
1650
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1651
|
+
get element(): T;
|
|
1652
|
+
min(minLength: number, message?: errorUtil.ErrMessage): this;
|
|
1653
|
+
max(maxLength: number, message?: errorUtil.ErrMessage): this;
|
|
1654
|
+
length(len: number, message?: errorUtil.ErrMessage): this;
|
|
1655
|
+
nonempty(message?: errorUtil.ErrMessage): ZodArray<T, "atleastone">;
|
|
1656
|
+
static create: <El extends ZodTypeAny>(schema: El, params?: RawCreateParams) => ZodArray<El>;
|
|
1657
|
+
}
|
|
1658
|
+
|
|
1659
|
+
declare interface ZodArrayDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1660
|
+
type: T;
|
|
1661
|
+
typeName: ZodFirstPartyTypeKind.ZodArray;
|
|
1662
|
+
exactLength: {
|
|
1663
|
+
value: number;
|
|
1664
|
+
message?: string | undefined;
|
|
1665
|
+
} | null;
|
|
1666
|
+
minLength: {
|
|
1667
|
+
value: number;
|
|
1668
|
+
message?: string | undefined;
|
|
1669
|
+
} | null;
|
|
1670
|
+
maxLength: {
|
|
1671
|
+
value: number;
|
|
1672
|
+
message?: string | undefined;
|
|
1673
|
+
} | null;
|
|
1674
|
+
}
|
|
1675
|
+
|
|
1676
|
+
declare class ZodBigInt extends ZodType<bigint, ZodBigIntDef, bigint> {
|
|
1677
|
+
_parse(input: ParseInput): ParseReturnType<bigint>;
|
|
1678
|
+
_getInvalidInput(input: ParseInput): INVALID;
|
|
1679
|
+
static create: (params?: RawCreateParams & {
|
|
1680
|
+
coerce?: boolean;
|
|
1681
|
+
}) => ZodBigInt;
|
|
1682
|
+
gte(value: bigint, message?: errorUtil.ErrMessage): ZodBigInt;
|
|
1683
|
+
min: (value: bigint, message?: errorUtil.ErrMessage) => ZodBigInt;
|
|
1684
|
+
gt(value: bigint, message?: errorUtil.ErrMessage): ZodBigInt;
|
|
1685
|
+
lte(value: bigint, message?: errorUtil.ErrMessage): ZodBigInt;
|
|
1686
|
+
max: (value: bigint, message?: errorUtil.ErrMessage) => ZodBigInt;
|
|
1687
|
+
lt(value: bigint, message?: errorUtil.ErrMessage): ZodBigInt;
|
|
1688
|
+
protected setLimit(kind: "min" | "max", value: bigint, inclusive: boolean, message?: string): ZodBigInt;
|
|
1689
|
+
_addCheck(check: ZodBigIntCheck): ZodBigInt;
|
|
1690
|
+
positive(message?: errorUtil.ErrMessage): ZodBigInt;
|
|
1691
|
+
negative(message?: errorUtil.ErrMessage): ZodBigInt;
|
|
1692
|
+
nonpositive(message?: errorUtil.ErrMessage): ZodBigInt;
|
|
1693
|
+
nonnegative(message?: errorUtil.ErrMessage): ZodBigInt;
|
|
1694
|
+
multipleOf(value: bigint, message?: errorUtil.ErrMessage): ZodBigInt;
|
|
1695
|
+
get minValue(): bigint | null;
|
|
1696
|
+
get maxValue(): bigint | null;
|
|
1697
|
+
}
|
|
1698
|
+
|
|
1699
|
+
declare type ZodBigIntCheck = {
|
|
1700
|
+
kind: "min";
|
|
1701
|
+
value: bigint;
|
|
1702
|
+
inclusive: boolean;
|
|
1703
|
+
message?: string | undefined;
|
|
1704
|
+
} | {
|
|
1705
|
+
kind: "max";
|
|
1706
|
+
value: bigint;
|
|
1707
|
+
inclusive: boolean;
|
|
1708
|
+
message?: string | undefined;
|
|
1709
|
+
} | {
|
|
1710
|
+
kind: "multipleOf";
|
|
1711
|
+
value: bigint;
|
|
1712
|
+
message?: string | undefined;
|
|
1713
|
+
};
|
|
1714
|
+
|
|
1715
|
+
declare interface ZodBigIntDef extends ZodTypeDef {
|
|
1716
|
+
checks: ZodBigIntCheck[];
|
|
1717
|
+
typeName: ZodFirstPartyTypeKind.ZodBigInt;
|
|
1718
|
+
coerce: boolean;
|
|
1719
|
+
}
|
|
1720
|
+
|
|
1721
|
+
declare class ZodBoolean extends ZodType<boolean, ZodBooleanDef, boolean> {
|
|
1722
|
+
_parse(input: ParseInput): ParseReturnType<boolean>;
|
|
1723
|
+
static create: (params?: RawCreateParams & {
|
|
1724
|
+
coerce?: boolean;
|
|
1725
|
+
}) => ZodBoolean;
|
|
1726
|
+
}
|
|
1727
|
+
|
|
1728
|
+
declare interface ZodBooleanDef extends ZodTypeDef {
|
|
1729
|
+
typeName: ZodFirstPartyTypeKind.ZodBoolean;
|
|
1730
|
+
coerce: boolean;
|
|
1731
|
+
}
|
|
1732
|
+
|
|
1733
|
+
declare class ZodBranded<T extends ZodTypeAny, B extends string | number | symbol> extends ZodType<T["_output"] & BRAND<B>, ZodBrandedDef<T>, T["_input"]> {
|
|
1734
|
+
_parse(input: ParseInput): ParseReturnType<any>;
|
|
1735
|
+
unwrap(): T;
|
|
1736
|
+
}
|
|
1737
|
+
|
|
1738
|
+
declare interface ZodBrandedDef<T extends ZodTypeAny> extends ZodTypeDef {
|
|
1739
|
+
type: T;
|
|
1740
|
+
typeName: ZodFirstPartyTypeKind.ZodBranded;
|
|
1741
|
+
}
|
|
1742
|
+
|
|
1743
|
+
declare class ZodCatch<T extends ZodTypeAny> extends ZodType<T["_output"], ZodCatchDef<T>, unknown> {
|
|
1744
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1745
|
+
removeCatch(): T;
|
|
1746
|
+
static create: <Inner extends ZodTypeAny>(type: Inner, params: RawCreateParams & {
|
|
1747
|
+
catch: Inner["_output"] | (() => Inner["_output"]);
|
|
1748
|
+
}) => ZodCatch<Inner>;
|
|
1749
|
+
}
|
|
1750
|
+
|
|
1751
|
+
declare interface ZodCatchDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1752
|
+
innerType: T;
|
|
1753
|
+
catchValue: (ctx: {
|
|
1754
|
+
error: ZodError;
|
|
1755
|
+
input: unknown;
|
|
1756
|
+
}) => T["_input"];
|
|
1757
|
+
typeName: ZodFirstPartyTypeKind.ZodCatch;
|
|
1758
|
+
}
|
|
1759
|
+
|
|
1760
|
+
declare interface ZodCustomIssue extends ZodIssueBase {
|
|
1761
|
+
code: typeof ZodIssueCode.custom;
|
|
1762
|
+
params?: {
|
|
1763
|
+
[k: string]: any;
|
|
1764
|
+
};
|
|
1765
|
+
}
|
|
1766
|
+
|
|
1767
|
+
declare class ZodDate extends ZodType<Date, ZodDateDef, Date> {
|
|
1768
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1769
|
+
_addCheck(check: ZodDateCheck): ZodDate;
|
|
1770
|
+
min(minDate: Date, message?: errorUtil.ErrMessage): ZodDate;
|
|
1771
|
+
max(maxDate: Date, message?: errorUtil.ErrMessage): ZodDate;
|
|
1772
|
+
get minDate(): Date | null;
|
|
1773
|
+
get maxDate(): Date | null;
|
|
1774
|
+
static create: (params?: RawCreateParams & {
|
|
1775
|
+
coerce?: boolean;
|
|
1776
|
+
}) => ZodDate;
|
|
1777
|
+
}
|
|
1778
|
+
|
|
1779
|
+
declare type ZodDateCheck = {
|
|
1780
|
+
kind: "min";
|
|
1781
|
+
value: number;
|
|
1782
|
+
message?: string | undefined;
|
|
1783
|
+
} | {
|
|
1784
|
+
kind: "max";
|
|
1785
|
+
value: number;
|
|
1786
|
+
message?: string | undefined;
|
|
1787
|
+
};
|
|
1788
|
+
|
|
1789
|
+
declare interface ZodDateDef extends ZodTypeDef {
|
|
1790
|
+
checks: ZodDateCheck[];
|
|
1791
|
+
coerce: boolean;
|
|
1792
|
+
typeName: ZodFirstPartyTypeKind.ZodDate;
|
|
1793
|
+
}
|
|
1794
|
+
|
|
1795
|
+
declare class ZodDefault<T extends ZodTypeAny> extends ZodType<util.noUndefined<T["_output"]>, ZodDefaultDef<T>, T["_input"] | undefined> {
|
|
1796
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1797
|
+
removeDefault(): T;
|
|
1798
|
+
static create: <Inner extends ZodTypeAny>(type: Inner, params: RawCreateParams & {
|
|
1799
|
+
default: Inner["_input"] | (() => util.noUndefined<Inner["_input"]>);
|
|
1800
|
+
}) => ZodDefault<Inner>;
|
|
1801
|
+
}
|
|
1802
|
+
|
|
1803
|
+
declare interface ZodDefaultDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1804
|
+
innerType: T;
|
|
1805
|
+
defaultValue: () => util.noUndefined<T["_input"]>;
|
|
1806
|
+
typeName: ZodFirstPartyTypeKind.ZodDefault;
|
|
1807
|
+
}
|
|
1808
|
+
|
|
1809
|
+
declare class ZodDiscriminatedUnion<Discriminator extends string, Options extends readonly ZodDiscriminatedUnionOption<Discriminator>[]> extends ZodType<output<Options[number]>, ZodDiscriminatedUnionDef<Discriminator, Options>, input<Options[number]>> {
|
|
1810
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1811
|
+
get discriminator(): Discriminator;
|
|
1812
|
+
get options(): Options;
|
|
1813
|
+
get optionsMap(): Map<Primitive, ZodDiscriminatedUnionOption<any>>;
|
|
1814
|
+
/**
|
|
1815
|
+
* The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.
|
|
1816
|
+
* However, it only allows a union of objects, all of which need to share a discriminator property. This property must
|
|
1817
|
+
* have a different value for each object in the union.
|
|
1818
|
+
* @param discriminator the name of the discriminator property
|
|
1819
|
+
* @param types an array of object schemas
|
|
1820
|
+
* @param params
|
|
1821
|
+
*/
|
|
1822
|
+
static create<Discriminator extends string, Types extends readonly [
|
|
1823
|
+
ZodDiscriminatedUnionOption<Discriminator>,
|
|
1824
|
+
...ZodDiscriminatedUnionOption<Discriminator>[]
|
|
1825
|
+
]>(discriminator: Discriminator, options: Types, params?: RawCreateParams): ZodDiscriminatedUnion<Discriminator, Types>;
|
|
1826
|
+
}
|
|
1827
|
+
|
|
1828
|
+
declare interface ZodDiscriminatedUnionDef<Discriminator extends string, Options extends readonly ZodDiscriminatedUnionOption<string>[] = ZodDiscriminatedUnionOption<string>[]> extends ZodTypeDef {
|
|
1829
|
+
discriminator: Discriminator;
|
|
1830
|
+
options: Options;
|
|
1831
|
+
optionsMap: Map<Primitive, ZodDiscriminatedUnionOption<any>>;
|
|
1832
|
+
typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion;
|
|
1833
|
+
}
|
|
1834
|
+
|
|
1835
|
+
declare type ZodDiscriminatedUnionOption<Discriminator extends string> = ZodObject<{
|
|
1836
|
+
[key in Discriminator]: ZodTypeAny;
|
|
1837
|
+
} & ZodRawShape, UnknownKeysParam, ZodTypeAny>;
|
|
1838
|
+
|
|
1839
|
+
declare class ZodEffects<T extends ZodTypeAny, Output = output<T>, Input = input<T>> extends ZodType<Output, ZodEffectsDef<T>, Input> {
|
|
1840
|
+
innerType(): T;
|
|
1841
|
+
sourceType(): T;
|
|
1842
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1843
|
+
static create: <I extends ZodTypeAny>(schema: I, effect: Effect<I["_output"]>, params?: RawCreateParams) => ZodEffects<I, I["_output"]>;
|
|
1844
|
+
static createWithPreprocess: <I extends ZodTypeAny>(preprocess: (arg: unknown, ctx: RefinementCtx) => unknown, schema: I, params?: RawCreateParams) => ZodEffects<I, I["_output"], unknown>;
|
|
1845
|
+
}
|
|
1846
|
+
|
|
1847
|
+
declare interface ZodEffectsDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1848
|
+
schema: T;
|
|
1849
|
+
typeName: ZodFirstPartyTypeKind.ZodEffects;
|
|
1850
|
+
effect: Effect<any>;
|
|
1851
|
+
}
|
|
1852
|
+
|
|
1853
|
+
declare class ZodEnum<T extends [string, ...string[]]> extends ZodType<T[number], ZodEnumDef<T>, T[number]> {
|
|
1854
|
+
_cache: Set<T[number]> | undefined;
|
|
1855
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1856
|
+
get options(): T;
|
|
1857
|
+
get enum(): Values<T>;
|
|
1858
|
+
get Values(): Values<T>;
|
|
1859
|
+
get Enum(): Values<T>;
|
|
1860
|
+
extract<ToExtract extends readonly [T[number], ...T[number][]]>(values: ToExtract, newDef?: RawCreateParams): ZodEnum<Writeable<ToExtract>>;
|
|
1861
|
+
exclude<ToExclude extends readonly [T[number], ...T[number][]]>(values: ToExclude, newDef?: RawCreateParams): ZodEnum<typecast<Writeable<FilterEnum<T, ToExclude[number]>>, [string, ...string[]]>>;
|
|
1862
|
+
static create: typeof createZodEnum;
|
|
1863
|
+
}
|
|
1864
|
+
|
|
1865
|
+
declare interface ZodEnumDef<T extends EnumValues = EnumValues> extends ZodTypeDef {
|
|
1866
|
+
values: T;
|
|
1867
|
+
typeName: ZodFirstPartyTypeKind.ZodEnum;
|
|
1868
|
+
}
|
|
1869
|
+
|
|
1870
|
+
declare class ZodError<T = any> extends Error {
|
|
1871
|
+
issues: ZodIssue[];
|
|
1872
|
+
get errors(): ZodIssue[];
|
|
1873
|
+
constructor(issues: ZodIssue[]);
|
|
1874
|
+
format(): ZodFormattedError<T>;
|
|
1875
|
+
format<U>(mapper: (issue: ZodIssue) => U): ZodFormattedError<T, U>;
|
|
1876
|
+
static create: (issues: ZodIssue[]) => ZodError<any>;
|
|
1877
|
+
static assert(value: unknown): asserts value is ZodError;
|
|
1878
|
+
toString(): string;
|
|
1879
|
+
get message(): string;
|
|
1880
|
+
get isEmpty(): boolean;
|
|
1881
|
+
addIssue: (sub: ZodIssue) => void;
|
|
1882
|
+
addIssues: (subs?: ZodIssue[]) => void;
|
|
1883
|
+
flatten(): typeToFlattenedError<T>;
|
|
1884
|
+
flatten<U>(mapper?: (issue: ZodIssue) => U): typeToFlattenedError<T, U>;
|
|
1885
|
+
get formErrors(): typeToFlattenedError<T, string>;
|
|
1886
|
+
}
|
|
1887
|
+
|
|
1888
|
+
declare type ZodErrorMap = (issue: ZodIssueOptionalMessage, _ctx: ErrorMapCtx) => {
|
|
1889
|
+
message: string;
|
|
1890
|
+
};
|
|
1891
|
+
|
|
1892
|
+
declare type ZodFirstPartySchemaTypes = ZodString | ZodNumber | ZodNaN | ZodBigInt | ZodBoolean | ZodDate | ZodUndefined | ZodNull | ZodAny | ZodUnknown | ZodNever | ZodVoid | ZodArray<any, any> | ZodObject<any, any, any> | ZodUnion<any> | ZodDiscriminatedUnion<any, any> | ZodIntersection<any, any> | ZodTuple<any, any> | ZodRecord<any, any> | ZodMap<any> | ZodSet<any> | ZodFunction<any, any> | ZodLazy<any> | ZodLiteral<any> | ZodEnum<any> | ZodEffects<any, any, any> | ZodNativeEnum<any> | ZodOptional<any> | ZodNullable<any> | ZodDefault<any> | ZodCatch<any> | ZodPromise<any> | ZodBranded<any, any> | ZodPipeline<any, any> | ZodReadonly<any> | ZodSymbol;
|
|
1893
|
+
|
|
1894
|
+
declare enum ZodFirstPartyTypeKind {
|
|
1895
|
+
ZodString = "ZodString",
|
|
1896
|
+
ZodNumber = "ZodNumber",
|
|
1897
|
+
ZodNaN = "ZodNaN",
|
|
1898
|
+
ZodBigInt = "ZodBigInt",
|
|
1899
|
+
ZodBoolean = "ZodBoolean",
|
|
1900
|
+
ZodDate = "ZodDate",
|
|
1901
|
+
ZodSymbol = "ZodSymbol",
|
|
1902
|
+
ZodUndefined = "ZodUndefined",
|
|
1903
|
+
ZodNull = "ZodNull",
|
|
1904
|
+
ZodAny = "ZodAny",
|
|
1905
|
+
ZodUnknown = "ZodUnknown",
|
|
1906
|
+
ZodNever = "ZodNever",
|
|
1907
|
+
ZodVoid = "ZodVoid",
|
|
1908
|
+
ZodArray = "ZodArray",
|
|
1909
|
+
ZodObject = "ZodObject",
|
|
1910
|
+
ZodUnion = "ZodUnion",
|
|
1911
|
+
ZodDiscriminatedUnion = "ZodDiscriminatedUnion",
|
|
1912
|
+
ZodIntersection = "ZodIntersection",
|
|
1913
|
+
ZodTuple = "ZodTuple",
|
|
1914
|
+
ZodRecord = "ZodRecord",
|
|
1915
|
+
ZodMap = "ZodMap",
|
|
1916
|
+
ZodSet = "ZodSet",
|
|
1917
|
+
ZodFunction = "ZodFunction",
|
|
1918
|
+
ZodLazy = "ZodLazy",
|
|
1919
|
+
ZodLiteral = "ZodLiteral",
|
|
1920
|
+
ZodEnum = "ZodEnum",
|
|
1921
|
+
ZodEffects = "ZodEffects",
|
|
1922
|
+
ZodNativeEnum = "ZodNativeEnum",
|
|
1923
|
+
ZodOptional = "ZodOptional",
|
|
1924
|
+
ZodNullable = "ZodNullable",
|
|
1925
|
+
ZodDefault = "ZodDefault",
|
|
1926
|
+
ZodCatch = "ZodCatch",
|
|
1927
|
+
ZodPromise = "ZodPromise",
|
|
1928
|
+
ZodBranded = "ZodBranded",
|
|
1929
|
+
ZodPipeline = "ZodPipeline",
|
|
1930
|
+
ZodReadonly = "ZodReadonly"
|
|
1931
|
+
}
|
|
1932
|
+
|
|
1933
|
+
declare type ZodFormattedError<T, U = string> = {
|
|
1934
|
+
_errors: U[];
|
|
1935
|
+
} & recursiveZodFormattedError<NonNullable<T>>;
|
|
1936
|
+
|
|
1937
|
+
declare class ZodFunction<Args extends ZodTuple<any, any>, Returns extends ZodTypeAny> extends ZodType<OuterTypeOfFunction<Args, Returns>, ZodFunctionDef<Args, Returns>, InnerTypeOfFunction<Args, Returns>> {
|
|
1938
|
+
_parse(input: ParseInput): ParseReturnType<any>;
|
|
1939
|
+
parameters(): Args;
|
|
1940
|
+
returnType(): Returns;
|
|
1941
|
+
args<Items extends Parameters<(typeof ZodTuple)["create"]>[0]>(...items: Items): ZodFunction<ZodTuple<Items, ZodUnknown>, Returns>;
|
|
1942
|
+
returns<NewReturnType extends ZodType<any, any, any>>(returnType: NewReturnType): ZodFunction<Args, NewReturnType>;
|
|
1943
|
+
implement<F extends InnerTypeOfFunction<Args, Returns>>(func: F): ReturnType<F> extends Returns["_output"] ? (...args: Args["_input"]) => ReturnType<F> : OuterTypeOfFunction<Args, Returns>;
|
|
1944
|
+
strictImplement(func: InnerTypeOfFunction<Args, Returns>): InnerTypeOfFunction<Args, Returns>;
|
|
1945
|
+
validate: <F extends InnerTypeOfFunction<Args, Returns>>(func: F) => ReturnType<F> extends Returns["_output"] ? (...args: Args["_input"]) => ReturnType<F> : OuterTypeOfFunction<Args, Returns>;
|
|
1946
|
+
static create(): ZodFunction<ZodTuple<[], ZodUnknown>, ZodUnknown>;
|
|
1947
|
+
static create<T extends AnyZodTuple = ZodTuple<[], ZodUnknown>>(args: T): ZodFunction<T, ZodUnknown>;
|
|
1948
|
+
static create<T extends AnyZodTuple, U extends ZodTypeAny>(args: T, returns: U): ZodFunction<T, U>;
|
|
1949
|
+
static create<T extends AnyZodTuple = ZodTuple<[], ZodUnknown>, U extends ZodTypeAny = ZodUnknown>(args: T, returns: U, params?: RawCreateParams): ZodFunction<T, U>;
|
|
1950
|
+
}
|
|
1951
|
+
|
|
1952
|
+
declare interface ZodFunctionDef<Args extends ZodTuple<any, any> = ZodTuple<any, any>, Returns extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1953
|
+
args: Args;
|
|
1954
|
+
returns: Returns;
|
|
1955
|
+
typeName: ZodFirstPartyTypeKind.ZodFunction;
|
|
1956
|
+
}
|
|
1957
|
+
|
|
1958
|
+
declare class ZodIntersection<T extends ZodTypeAny, U extends ZodTypeAny> extends ZodType<T["_output"] & U["_output"], ZodIntersectionDef<T, U>, T["_input"] & U["_input"]> {
|
|
1959
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1960
|
+
static create: <TSchema extends ZodTypeAny, USchema extends ZodTypeAny>(left: TSchema, right: USchema, params?: RawCreateParams) => ZodIntersection<TSchema, USchema>;
|
|
1961
|
+
}
|
|
1962
|
+
|
|
1963
|
+
declare interface ZodIntersectionDef<T extends ZodTypeAny = ZodTypeAny, U extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1964
|
+
left: T;
|
|
1965
|
+
right: U;
|
|
1966
|
+
typeName: ZodFirstPartyTypeKind.ZodIntersection;
|
|
1967
|
+
}
|
|
1968
|
+
|
|
1969
|
+
declare interface ZodInvalidArgumentsIssue extends ZodIssueBase {
|
|
1970
|
+
code: typeof ZodIssueCode.invalid_arguments;
|
|
1971
|
+
argumentsError: ZodError;
|
|
1972
|
+
}
|
|
1973
|
+
|
|
1974
|
+
declare interface ZodInvalidDateIssue extends ZodIssueBase {
|
|
1975
|
+
code: typeof ZodIssueCode.invalid_date;
|
|
1976
|
+
}
|
|
1977
|
+
|
|
1978
|
+
declare interface ZodInvalidEnumValueIssue extends ZodIssueBase {
|
|
1979
|
+
received: string | number;
|
|
1980
|
+
code: typeof ZodIssueCode.invalid_enum_value;
|
|
1981
|
+
options: (string | number)[];
|
|
1982
|
+
}
|
|
1983
|
+
|
|
1984
|
+
declare interface ZodInvalidIntersectionTypesIssue extends ZodIssueBase {
|
|
1985
|
+
code: typeof ZodIssueCode.invalid_intersection_types;
|
|
1986
|
+
}
|
|
1987
|
+
|
|
1988
|
+
declare interface ZodInvalidLiteralIssue extends ZodIssueBase {
|
|
1989
|
+
code: typeof ZodIssueCode.invalid_literal;
|
|
1990
|
+
expected: unknown;
|
|
1991
|
+
received: unknown;
|
|
1992
|
+
}
|
|
1993
|
+
|
|
1994
|
+
declare interface ZodInvalidReturnTypeIssue extends ZodIssueBase {
|
|
1995
|
+
code: typeof ZodIssueCode.invalid_return_type;
|
|
1996
|
+
returnTypeError: ZodError;
|
|
1997
|
+
}
|
|
1998
|
+
|
|
1999
|
+
declare interface ZodInvalidStringIssue extends ZodIssueBase {
|
|
2000
|
+
code: typeof ZodIssueCode.invalid_string;
|
|
2001
|
+
validation: StringValidation;
|
|
2002
|
+
}
|
|
2003
|
+
|
|
2004
|
+
declare interface ZodInvalidTypeIssue extends ZodIssueBase {
|
|
2005
|
+
code: typeof ZodIssueCode.invalid_type;
|
|
2006
|
+
expected: ZodParsedType;
|
|
2007
|
+
received: ZodParsedType;
|
|
2008
|
+
}
|
|
2009
|
+
|
|
2010
|
+
declare interface ZodInvalidUnionDiscriminatorIssue extends ZodIssueBase {
|
|
2011
|
+
code: typeof ZodIssueCode.invalid_union_discriminator;
|
|
2012
|
+
options: Primitive[];
|
|
2013
|
+
}
|
|
2014
|
+
|
|
2015
|
+
declare interface ZodInvalidUnionIssue extends ZodIssueBase {
|
|
2016
|
+
code: typeof ZodIssueCode.invalid_union;
|
|
2017
|
+
unionErrors: ZodError[];
|
|
2018
|
+
}
|
|
2019
|
+
|
|
2020
|
+
declare type ZodIssue = ZodIssueOptionalMessage & {
|
|
2021
|
+
fatal?: boolean | undefined;
|
|
2022
|
+
message: string;
|
|
2023
|
+
};
|
|
2024
|
+
|
|
2025
|
+
declare type ZodIssueBase = {
|
|
2026
|
+
path: (string | number)[];
|
|
2027
|
+
message?: string | undefined;
|
|
2028
|
+
};
|
|
2029
|
+
|
|
2030
|
+
declare const ZodIssueCode: {
|
|
2031
|
+
invalid_type: "invalid_type";
|
|
2032
|
+
invalid_literal: "invalid_literal";
|
|
2033
|
+
custom: "custom";
|
|
2034
|
+
invalid_union: "invalid_union";
|
|
2035
|
+
invalid_union_discriminator: "invalid_union_discriminator";
|
|
2036
|
+
invalid_enum_value: "invalid_enum_value";
|
|
2037
|
+
unrecognized_keys: "unrecognized_keys";
|
|
2038
|
+
invalid_arguments: "invalid_arguments";
|
|
2039
|
+
invalid_return_type: "invalid_return_type";
|
|
2040
|
+
invalid_date: "invalid_date";
|
|
2041
|
+
invalid_string: "invalid_string";
|
|
2042
|
+
too_small: "too_small";
|
|
2043
|
+
too_big: "too_big";
|
|
2044
|
+
invalid_intersection_types: "invalid_intersection_types";
|
|
2045
|
+
not_multiple_of: "not_multiple_of";
|
|
2046
|
+
not_finite: "not_finite";
|
|
2047
|
+
};
|
|
2048
|
+
|
|
2049
|
+
declare type ZodIssueCode = keyof typeof ZodIssueCode;
|
|
2050
|
+
|
|
2051
|
+
declare type ZodIssueOptionalMessage = ZodInvalidTypeIssue | ZodInvalidLiteralIssue | ZodUnrecognizedKeysIssue | ZodInvalidUnionIssue | ZodInvalidUnionDiscriminatorIssue | ZodInvalidEnumValueIssue | ZodInvalidArgumentsIssue | ZodInvalidReturnTypeIssue | ZodInvalidDateIssue | ZodInvalidStringIssue | ZodTooSmallIssue | ZodTooBigIssue | ZodInvalidIntersectionTypesIssue | ZodNotMultipleOfIssue | ZodNotFiniteIssue | ZodCustomIssue;
|
|
2052
|
+
|
|
2053
|
+
declare class ZodLazy<T extends ZodTypeAny> extends ZodType<output<T>, ZodLazyDef<T>, input<T>> {
|
|
2054
|
+
get schema(): T;
|
|
2055
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
2056
|
+
static create: <Inner extends ZodTypeAny>(getter: () => Inner, params?: RawCreateParams) => ZodLazy<Inner>;
|
|
2057
|
+
}
|
|
2058
|
+
|
|
2059
|
+
declare interface ZodLazyDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
2060
|
+
getter: () => T;
|
|
2061
|
+
typeName: ZodFirstPartyTypeKind.ZodLazy;
|
|
2062
|
+
}
|
|
2063
|
+
|
|
2064
|
+
declare class ZodLiteral<T> extends ZodType<T, ZodLiteralDef<T>, T> {
|
|
2065
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
2066
|
+
get value(): T;
|
|
2067
|
+
static create: <Value extends Primitive>(value: Value, params?: RawCreateParams) => ZodLiteral<Value>;
|
|
2068
|
+
}
|
|
2069
|
+
|
|
2070
|
+
declare interface ZodLiteralDef<T = any> extends ZodTypeDef {
|
|
2071
|
+
value: T;
|
|
2072
|
+
typeName: ZodFirstPartyTypeKind.ZodLiteral;
|
|
2073
|
+
}
|
|
2074
|
+
|
|
2075
|
+
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"]>> {
|
|
2076
|
+
get keySchema(): Key;
|
|
2077
|
+
get valueSchema(): Value;
|
|
2078
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
2079
|
+
static create: <KeySchema extends ZodTypeAny = ZodTypeAny, ValueSchema extends ZodTypeAny = ZodTypeAny>(keyType: KeySchema, valueType: ValueSchema, params?: RawCreateParams) => ZodMap<KeySchema, ValueSchema>;
|
|
2080
|
+
}
|
|
2081
|
+
|
|
2082
|
+
declare interface ZodMapDef<Key extends ZodTypeAny = ZodTypeAny, Value extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
2083
|
+
valueType: Value;
|
|
2084
|
+
keyType: Key;
|
|
2085
|
+
typeName: ZodFirstPartyTypeKind.ZodMap;
|
|
2086
|
+
}
|
|
2087
|
+
|
|
2088
|
+
declare class ZodNaN extends ZodType<number, ZodNaNDef, number> {
|
|
2089
|
+
_parse(input: ParseInput): ParseReturnType<any>;
|
|
2090
|
+
static create: (params?: RawCreateParams) => ZodNaN;
|
|
2091
|
+
}
|
|
2092
|
+
|
|
2093
|
+
declare interface ZodNaNDef extends ZodTypeDef {
|
|
2094
|
+
typeName: ZodFirstPartyTypeKind.ZodNaN;
|
|
2095
|
+
}
|
|
2096
|
+
|
|
2097
|
+
declare class ZodNativeEnum<T extends EnumLike> extends ZodType<T[keyof T], ZodNativeEnumDef<T>, T[keyof T]> {
|
|
2098
|
+
_cache: Set<T[keyof T]> | undefined;
|
|
2099
|
+
_parse(input: ParseInput): ParseReturnType<T[keyof T]>;
|
|
2100
|
+
get enum(): T;
|
|
2101
|
+
static create: <Elements extends EnumLike>(values: Elements, params?: RawCreateParams) => ZodNativeEnum<Elements>;
|
|
2102
|
+
}
|
|
2103
|
+
|
|
2104
|
+
declare interface ZodNativeEnumDef<T extends EnumLike = EnumLike> extends ZodTypeDef {
|
|
2105
|
+
values: T;
|
|
2106
|
+
typeName: ZodFirstPartyTypeKind.ZodNativeEnum;
|
|
2107
|
+
}
|
|
2108
|
+
|
|
2109
|
+
declare class ZodNever extends ZodType<never, ZodNeverDef, never> {
|
|
2110
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
2111
|
+
static create: (params?: RawCreateParams) => ZodNever;
|
|
2112
|
+
}
|
|
2113
|
+
|
|
2114
|
+
declare interface ZodNeverDef extends ZodTypeDef {
|
|
2115
|
+
typeName: ZodFirstPartyTypeKind.ZodNever;
|
|
2116
|
+
}
|
|
2117
|
+
|
|
2118
|
+
declare type ZodNonEmptyArray<T extends ZodTypeAny> = ZodArray<T, "atleastone">;
|
|
2119
|
+
|
|
2120
|
+
declare interface ZodNotFiniteIssue extends ZodIssueBase {
|
|
2121
|
+
code: typeof ZodIssueCode.not_finite;
|
|
2122
|
+
}
|
|
2123
|
+
|
|
2124
|
+
declare interface ZodNotMultipleOfIssue extends ZodIssueBase {
|
|
2125
|
+
code: typeof ZodIssueCode.not_multiple_of;
|
|
2126
|
+
multipleOf: number | bigint;
|
|
2127
|
+
}
|
|
2128
|
+
|
|
2129
|
+
declare class ZodNull extends ZodType<null, ZodNullDef, null> {
|
|
2130
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
2131
|
+
static create: (params?: RawCreateParams) => ZodNull;
|
|
2132
|
+
}
|
|
2133
|
+
|
|
2134
|
+
declare class ZodNullable<T extends ZodTypeAny> extends ZodType<T["_output"] | null, ZodNullableDef<T>, T["_input"] | null> {
|
|
2135
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
2136
|
+
unwrap(): T;
|
|
2137
|
+
static create: <Inner extends ZodTypeAny>(type: Inner, params?: RawCreateParams) => ZodNullable<Inner>;
|
|
2138
|
+
}
|
|
2139
|
+
|
|
2140
|
+
declare interface ZodNullableDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
2141
|
+
innerType: T;
|
|
2142
|
+
typeName: ZodFirstPartyTypeKind.ZodNullable;
|
|
2143
|
+
}
|
|
2144
|
+
|
|
2145
|
+
declare type ZodNullableType<T extends ZodTypeAny> = ZodNullable<T>;
|
|
2146
|
+
|
|
2147
|
+
declare interface ZodNullDef extends ZodTypeDef {
|
|
2148
|
+
typeName: ZodFirstPartyTypeKind.ZodNull;
|
|
2149
|
+
}
|
|
2150
|
+
|
|
2151
|
+
declare class ZodNumber extends ZodType<number, ZodNumberDef, number> {
|
|
2152
|
+
_parse(input: ParseInput): ParseReturnType<number>;
|
|
2153
|
+
static create: (params?: RawCreateParams & {
|
|
2154
|
+
coerce?: boolean;
|
|
2155
|
+
}) => ZodNumber;
|
|
2156
|
+
gte(value: number, message?: errorUtil.ErrMessage): ZodNumber;
|
|
2157
|
+
min: (value: number, message?: errorUtil.ErrMessage) => ZodNumber;
|
|
2158
|
+
gt(value: number, message?: errorUtil.ErrMessage): ZodNumber;
|
|
2159
|
+
lte(value: number, message?: errorUtil.ErrMessage): ZodNumber;
|
|
2160
|
+
max: (value: number, message?: errorUtil.ErrMessage) => ZodNumber;
|
|
2161
|
+
lt(value: number, message?: errorUtil.ErrMessage): ZodNumber;
|
|
2162
|
+
protected setLimit(kind: "min" | "max", value: number, inclusive: boolean, message?: string): ZodNumber;
|
|
2163
|
+
_addCheck(check: ZodNumberCheck): ZodNumber;
|
|
2164
|
+
int(message?: errorUtil.ErrMessage): ZodNumber;
|
|
2165
|
+
positive(message?: errorUtil.ErrMessage): ZodNumber;
|
|
2166
|
+
negative(message?: errorUtil.ErrMessage): ZodNumber;
|
|
2167
|
+
nonpositive(message?: errorUtil.ErrMessage): ZodNumber;
|
|
2168
|
+
nonnegative(message?: errorUtil.ErrMessage): ZodNumber;
|
|
2169
|
+
multipleOf(value: number, message?: errorUtil.ErrMessage): ZodNumber;
|
|
2170
|
+
step: (value: number, message?: errorUtil.ErrMessage) => ZodNumber;
|
|
2171
|
+
finite(message?: errorUtil.ErrMessage): ZodNumber;
|
|
2172
|
+
safe(message?: errorUtil.ErrMessage): ZodNumber;
|
|
2173
|
+
get minValue(): number | null;
|
|
2174
|
+
get maxValue(): number | null;
|
|
2175
|
+
get isInt(): boolean;
|
|
2176
|
+
get isFinite(): boolean;
|
|
2177
|
+
}
|
|
2178
|
+
|
|
2179
|
+
declare type ZodNumberCheck = {
|
|
2180
|
+
kind: "min";
|
|
2181
|
+
value: number;
|
|
2182
|
+
inclusive: boolean;
|
|
2183
|
+
message?: string | undefined;
|
|
2184
|
+
} | {
|
|
2185
|
+
kind: "max";
|
|
2186
|
+
value: number;
|
|
2187
|
+
inclusive: boolean;
|
|
2188
|
+
message?: string | undefined;
|
|
2189
|
+
} | {
|
|
2190
|
+
kind: "int";
|
|
2191
|
+
message?: string | undefined;
|
|
2192
|
+
} | {
|
|
2193
|
+
kind: "multipleOf";
|
|
2194
|
+
value: number;
|
|
2195
|
+
message?: string | undefined;
|
|
2196
|
+
} | {
|
|
2197
|
+
kind: "finite";
|
|
2198
|
+
message?: string | undefined;
|
|
2199
|
+
};
|
|
2200
|
+
|
|
2201
|
+
declare interface ZodNumberDef extends ZodTypeDef {
|
|
2202
|
+
checks: ZodNumberCheck[];
|
|
2203
|
+
typeName: ZodFirstPartyTypeKind.ZodNumber;
|
|
2204
|
+
coerce: boolean;
|
|
2205
|
+
}
|
|
2206
|
+
|
|
2207
|
+
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> {
|
|
2208
|
+
private _cached;
|
|
2209
|
+
_getCached(): {
|
|
2210
|
+
shape: T;
|
|
2211
|
+
keys: string[];
|
|
2212
|
+
};
|
|
2213
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
2214
|
+
get shape(): T;
|
|
2215
|
+
strict(message?: errorUtil.ErrMessage): ZodObject<T, "strict", Catchall>;
|
|
2216
|
+
strip(): ZodObject<T, "strip", Catchall>;
|
|
2217
|
+
passthrough(): ZodObject<T, "passthrough", Catchall>;
|
|
2218
|
+
/**
|
|
2219
|
+
* @deprecated In most cases, this is no longer needed - unknown properties are now silently stripped.
|
|
2220
|
+
* If you want to pass through unknown properties, use `.passthrough()` instead.
|
|
2221
|
+
*/
|
|
2222
|
+
nonstrict: () => ZodObject<T, "passthrough", Catchall>;
|
|
2223
|
+
extend<Augmentation extends ZodRawShape>(augmentation: Augmentation): ZodObject<objectUtil.extendShape<T, Augmentation>, UnknownKeys, Catchall>;
|
|
2224
|
+
/**
|
|
2225
|
+
* @deprecated Use `.extend` instead
|
|
2226
|
+
* */
|
|
2227
|
+
augment: <Augmentation extends ZodRawShape>(augmentation: Augmentation) => ZodObject<objectUtil.extendShape<T, Augmentation>, UnknownKeys, Catchall>;
|
|
2228
|
+
/**
|
|
2229
|
+
* Prior to zod@1.0.12 there was a bug in the
|
|
2230
|
+
* inferred type of merged objects. Please
|
|
2231
|
+
* upgrade if you are experiencing issues.
|
|
2232
|
+
*/
|
|
2233
|
+
merge<Incoming extends AnyZodObject, Augmentation extends Incoming["shape"]>(merging: Incoming): ZodObject<objectUtil.extendShape<T, Augmentation>, Incoming["_def"]["unknownKeys"], Incoming["_def"]["catchall"]>;
|
|
2234
|
+
setKey<Key extends string, Schema extends ZodTypeAny>(key: Key, schema: Schema): ZodObject<T & {
|
|
2235
|
+
[k in Key]: Schema;
|
|
2236
|
+
}, UnknownKeys, Catchall>;
|
|
2237
|
+
catchall<Index extends ZodTypeAny>(index: Index): ZodObject<T, UnknownKeys, Index>;
|
|
2238
|
+
pick<Mask extends util.Exactly<{
|
|
2239
|
+
[k in keyof T]?: true;
|
|
2240
|
+
}, Mask>>(mask: Mask): ZodObject<Pick<T, Extract<keyof T, keyof Mask>>, UnknownKeys, Catchall>;
|
|
2241
|
+
omit<Mask extends util.Exactly<{
|
|
2242
|
+
[k in keyof T]?: true;
|
|
2243
|
+
}, Mask>>(mask: Mask): ZodObject<Omit<T, keyof Mask>, UnknownKeys, Catchall>;
|
|
2244
|
+
/**
|
|
2245
|
+
* @deprecated
|
|
2246
|
+
*/
|
|
2247
|
+
deepPartial(): partialUtil.DeepPartial<this>;
|
|
2248
|
+
partial(): ZodObject<{
|
|
2249
|
+
[k in keyof T]: ZodOptional<T[k]>;
|
|
2250
|
+
}, UnknownKeys, Catchall>;
|
|
2251
|
+
partial<Mask extends util.Exactly<{
|
|
2252
|
+
[k in keyof T]?: true;
|
|
2253
|
+
}, Mask>>(mask: Mask): ZodObject<objectUtil.noNever<{
|
|
2254
|
+
[k in keyof T]: k extends keyof Mask ? ZodOptional<T[k]> : T[k];
|
|
2255
|
+
}>, UnknownKeys, Catchall>;
|
|
2256
|
+
required(): ZodObject<{
|
|
2257
|
+
[k in keyof T]: deoptional<T[k]>;
|
|
2258
|
+
}, UnknownKeys, Catchall>;
|
|
2259
|
+
required<Mask extends util.Exactly<{
|
|
2260
|
+
[k in keyof T]?: true;
|
|
2261
|
+
}, Mask>>(mask: Mask): ZodObject<objectUtil.noNever<{
|
|
2262
|
+
[k in keyof T]: k extends keyof Mask ? deoptional<T[k]> : T[k];
|
|
2263
|
+
}>, UnknownKeys, Catchall>;
|
|
2264
|
+
keyof(): ZodEnum<enumUtil.UnionToTupleString<keyof T>>;
|
|
2265
|
+
static create: <Shape extends ZodRawShape>(shape: Shape, params?: RawCreateParams) => ZodObject<Shape, "strip", ZodTypeAny, objectOutputType<Shape, ZodTypeAny, "strip">, objectInputType<Shape, ZodTypeAny, "strip">>;
|
|
2266
|
+
static strictCreate: <Shape extends ZodRawShape>(shape: Shape, params?: RawCreateParams) => ZodObject<Shape, "strict">;
|
|
2267
|
+
static lazycreate: <Shape extends ZodRawShape>(shape: () => Shape, params?: RawCreateParams) => ZodObject<Shape, "strip">;
|
|
2268
|
+
}
|
|
2269
|
+
|
|
2270
|
+
declare interface ZodObjectDef<T extends ZodRawShape = ZodRawShape, UnknownKeys extends UnknownKeysParam = UnknownKeysParam, Catchall extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
2271
|
+
typeName: ZodFirstPartyTypeKind.ZodObject;
|
|
2272
|
+
shape: () => T;
|
|
2273
|
+
catchall: Catchall;
|
|
2274
|
+
unknownKeys: UnknownKeys;
|
|
2275
|
+
}
|
|
2276
|
+
|
|
2277
|
+
declare class ZodOptional<T extends ZodTypeAny> extends ZodType<T["_output"] | undefined, ZodOptionalDef<T>, T["_input"] | undefined> {
|
|
2278
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
2279
|
+
unwrap(): T;
|
|
2280
|
+
static create: <Inner extends ZodTypeAny>(type: Inner, params?: RawCreateParams) => ZodOptional<Inner>;
|
|
2281
|
+
}
|
|
2282
|
+
|
|
2283
|
+
declare interface ZodOptionalDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
2284
|
+
innerType: T;
|
|
2285
|
+
typeName: ZodFirstPartyTypeKind.ZodOptional;
|
|
2286
|
+
}
|
|
2287
|
+
|
|
2288
|
+
declare type ZodOptionalType<T extends ZodTypeAny> = ZodOptional<T>;
|
|
2289
|
+
|
|
2290
|
+
declare const ZodParsedType: {
|
|
2291
|
+
string: "string";
|
|
2292
|
+
nan: "nan";
|
|
2293
|
+
number: "number";
|
|
2294
|
+
integer: "integer";
|
|
2295
|
+
float: "float";
|
|
2296
|
+
boolean: "boolean";
|
|
2297
|
+
date: "date";
|
|
2298
|
+
bigint: "bigint";
|
|
2299
|
+
symbol: "symbol";
|
|
2300
|
+
function: "function";
|
|
2301
|
+
undefined: "undefined";
|
|
2302
|
+
null: "null";
|
|
2303
|
+
array: "array";
|
|
2304
|
+
object: "object";
|
|
2305
|
+
unknown: "unknown";
|
|
2306
|
+
promise: "promise";
|
|
2307
|
+
void: "void";
|
|
2308
|
+
never: "never";
|
|
2309
|
+
map: "map";
|
|
2310
|
+
set: "set";
|
|
2311
|
+
};
|
|
2312
|
+
|
|
2313
|
+
declare type ZodParsedType = keyof typeof ZodParsedType;
|
|
2314
|
+
|
|
2315
|
+
declare class ZodPipeline<A extends ZodTypeAny, B extends ZodTypeAny> extends ZodType<B["_output"], ZodPipelineDef<A, B>, A["_input"]> {
|
|
2316
|
+
_parse(input: ParseInput): ParseReturnType<any>;
|
|
2317
|
+
static create<ASchema extends ZodTypeAny, BSchema extends ZodTypeAny>(a: ASchema, b: BSchema): ZodPipeline<ASchema, BSchema>;
|
|
2318
|
+
}
|
|
2319
|
+
|
|
2320
|
+
declare interface ZodPipelineDef<A extends ZodTypeAny, B extends ZodTypeAny> extends ZodTypeDef {
|
|
2321
|
+
in: A;
|
|
2322
|
+
out: B;
|
|
2323
|
+
typeName: ZodFirstPartyTypeKind.ZodPipeline;
|
|
2324
|
+
}
|
|
2325
|
+
|
|
2326
|
+
declare class ZodPromise<T extends ZodTypeAny> extends ZodType<Promise<T["_output"]>, ZodPromiseDef<T>, Promise<T["_input"]>> {
|
|
2327
|
+
unwrap(): T;
|
|
2328
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
2329
|
+
static create: <Inner extends ZodTypeAny>(schema: Inner, params?: RawCreateParams) => ZodPromise<Inner>;
|
|
2330
|
+
}
|
|
2331
|
+
|
|
2332
|
+
declare interface ZodPromiseDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
2333
|
+
type: T;
|
|
2334
|
+
typeName: ZodFirstPartyTypeKind.ZodPromise;
|
|
2335
|
+
}
|
|
2336
|
+
|
|
2337
|
+
declare type ZodRawShape = {
|
|
2338
|
+
[k: string]: ZodTypeAny;
|
|
2339
|
+
};
|
|
2340
|
+
|
|
2341
|
+
declare class ZodReadonly<T extends ZodTypeAny> extends ZodType<MakeReadonly<T["_output"]>, ZodReadonlyDef<T>, MakeReadonly<T["_input"]>> {
|
|
2342
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
2343
|
+
static create: <Inner extends ZodTypeAny>(type: Inner, params?: RawCreateParams) => ZodReadonly<Inner>;
|
|
2344
|
+
unwrap(): T;
|
|
2345
|
+
}
|
|
2346
|
+
|
|
2347
|
+
declare interface ZodReadonlyDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
2348
|
+
innerType: T;
|
|
2349
|
+
typeName: ZodFirstPartyTypeKind.ZodReadonly;
|
|
2350
|
+
}
|
|
2351
|
+
|
|
2352
|
+
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"]>> {
|
|
2353
|
+
get keySchema(): Key;
|
|
2354
|
+
get valueSchema(): Value;
|
|
2355
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
2356
|
+
get element(): Value;
|
|
2357
|
+
static create<Value extends ZodTypeAny>(valueType: Value, params?: RawCreateParams): ZodRecord<ZodString, Value>;
|
|
2358
|
+
static create<Keys extends KeySchema, Value extends ZodTypeAny>(keySchema: Keys, valueType: Value, params?: RawCreateParams): ZodRecord<Keys, Value>;
|
|
2359
|
+
}
|
|
2360
|
+
|
|
2361
|
+
declare interface ZodRecordDef<Key extends KeySchema = ZodString, Value extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
2362
|
+
valueType: Value;
|
|
2363
|
+
keyType: Key;
|
|
2364
|
+
typeName: ZodFirstPartyTypeKind.ZodRecord;
|
|
2365
|
+
}
|
|
2366
|
+
|
|
2367
|
+
declare class ZodSet<Value extends ZodTypeAny = ZodTypeAny> extends ZodType<Set<Value["_output"]>, ZodSetDef<Value>, Set<Value["_input"]>> {
|
|
2368
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
2369
|
+
min(minSize: number, message?: errorUtil.ErrMessage): this;
|
|
2370
|
+
max(maxSize: number, message?: errorUtil.ErrMessage): this;
|
|
2371
|
+
size(size: number, message?: errorUtil.ErrMessage): this;
|
|
2372
|
+
nonempty(message?: errorUtil.ErrMessage): ZodSet<Value>;
|
|
2373
|
+
static create: <ValueSchema extends ZodTypeAny = ZodTypeAny>(valueType: ValueSchema, params?: RawCreateParams) => ZodSet<ValueSchema>;
|
|
2374
|
+
}
|
|
2375
|
+
|
|
2376
|
+
declare interface ZodSetDef<Value extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
2377
|
+
valueType: Value;
|
|
2378
|
+
typeName: ZodFirstPartyTypeKind.ZodSet;
|
|
2379
|
+
minSize: {
|
|
2380
|
+
value: number;
|
|
2381
|
+
message?: string | undefined;
|
|
2382
|
+
} | null;
|
|
2383
|
+
maxSize: {
|
|
2384
|
+
value: number;
|
|
2385
|
+
message?: string | undefined;
|
|
2386
|
+
} | null;
|
|
2387
|
+
}
|
|
2388
|
+
|
|
2389
|
+
declare class ZodString extends ZodType<string, ZodStringDef, string> {
|
|
2390
|
+
_parse(input: ParseInput): ParseReturnType<string>;
|
|
2391
|
+
protected _regex(regex: RegExp, validation: StringValidation, message?: errorUtil.ErrMessage): ZodEffects<this, string, string>;
|
|
2392
|
+
_addCheck(check: ZodStringCheck): ZodString;
|
|
2393
|
+
email(message?: errorUtil.ErrMessage): ZodString;
|
|
2394
|
+
url(message?: errorUtil.ErrMessage): ZodString;
|
|
2395
|
+
emoji(message?: errorUtil.ErrMessage): ZodString;
|
|
2396
|
+
uuid(message?: errorUtil.ErrMessage): ZodString;
|
|
2397
|
+
nanoid(message?: errorUtil.ErrMessage): ZodString;
|
|
2398
|
+
cuid(message?: errorUtil.ErrMessage): ZodString;
|
|
2399
|
+
cuid2(message?: errorUtil.ErrMessage): ZodString;
|
|
2400
|
+
ulid(message?: errorUtil.ErrMessage): ZodString;
|
|
2401
|
+
base64(message?: errorUtil.ErrMessage): ZodString;
|
|
2402
|
+
base64url(message?: errorUtil.ErrMessage): ZodString;
|
|
2403
|
+
jwt(options?: {
|
|
2404
|
+
alg?: string;
|
|
2405
|
+
message?: string | undefined;
|
|
2406
|
+
}): ZodString;
|
|
2407
|
+
ip(options?: string | {
|
|
2408
|
+
version?: IpVersion;
|
|
2409
|
+
message?: string | undefined;
|
|
2410
|
+
}): ZodString;
|
|
2411
|
+
cidr(options?: string | {
|
|
2412
|
+
version?: IpVersion;
|
|
2413
|
+
message?: string | undefined;
|
|
2414
|
+
}): ZodString;
|
|
2415
|
+
datetime(options?: string | {
|
|
2416
|
+
message?: string | undefined;
|
|
2417
|
+
precision?: number | null;
|
|
2418
|
+
offset?: boolean;
|
|
2419
|
+
local?: boolean;
|
|
2420
|
+
}): ZodString;
|
|
2421
|
+
date(message?: string): ZodString;
|
|
2422
|
+
time(options?: string | {
|
|
2423
|
+
message?: string | undefined;
|
|
2424
|
+
precision?: number | null;
|
|
2425
|
+
}): ZodString;
|
|
2426
|
+
duration(message?: errorUtil.ErrMessage): ZodString;
|
|
2427
|
+
regex(regex: RegExp, message?: errorUtil.ErrMessage): ZodString;
|
|
2428
|
+
includes(value: string, options?: {
|
|
2429
|
+
message?: string;
|
|
2430
|
+
position?: number;
|
|
2431
|
+
}): ZodString;
|
|
2432
|
+
startsWith(value: string, message?: errorUtil.ErrMessage): ZodString;
|
|
2433
|
+
endsWith(value: string, message?: errorUtil.ErrMessage): ZodString;
|
|
2434
|
+
min(minLength: number, message?: errorUtil.ErrMessage): ZodString;
|
|
2435
|
+
max(maxLength: number, message?: errorUtil.ErrMessage): ZodString;
|
|
2436
|
+
length(len: number, message?: errorUtil.ErrMessage): ZodString;
|
|
2437
|
+
/**
|
|
2438
|
+
* Equivalent to `.min(1)`
|
|
2439
|
+
*/
|
|
2440
|
+
nonempty(message?: errorUtil.ErrMessage): ZodString;
|
|
2441
|
+
trim(): ZodString;
|
|
2442
|
+
toLowerCase(): ZodString;
|
|
2443
|
+
toUpperCase(): ZodString;
|
|
2444
|
+
get isDatetime(): boolean;
|
|
2445
|
+
get isDate(): boolean;
|
|
2446
|
+
get isTime(): boolean;
|
|
2447
|
+
get isDuration(): boolean;
|
|
2448
|
+
get isEmail(): boolean;
|
|
2449
|
+
get isURL(): boolean;
|
|
2450
|
+
get isEmoji(): boolean;
|
|
2451
|
+
get isUUID(): boolean;
|
|
2452
|
+
get isNANOID(): boolean;
|
|
2453
|
+
get isCUID(): boolean;
|
|
2454
|
+
get isCUID2(): boolean;
|
|
2455
|
+
get isULID(): boolean;
|
|
2456
|
+
get isIP(): boolean;
|
|
2457
|
+
get isCIDR(): boolean;
|
|
2458
|
+
get isBase64(): boolean;
|
|
2459
|
+
get isBase64url(): boolean;
|
|
2460
|
+
get minLength(): number | null;
|
|
2461
|
+
get maxLength(): number | null;
|
|
2462
|
+
static create: (params?: RawCreateParams & {
|
|
2463
|
+
coerce?: true;
|
|
2464
|
+
}) => ZodString;
|
|
2465
|
+
}
|
|
2466
|
+
|
|
2467
|
+
declare type ZodStringCheck = {
|
|
2468
|
+
kind: "min";
|
|
2469
|
+
value: number;
|
|
2470
|
+
message?: string | undefined;
|
|
2471
|
+
} | {
|
|
2472
|
+
kind: "max";
|
|
2473
|
+
value: number;
|
|
2474
|
+
message?: string | undefined;
|
|
2475
|
+
} | {
|
|
2476
|
+
kind: "length";
|
|
2477
|
+
value: number;
|
|
2478
|
+
message?: string | undefined;
|
|
2479
|
+
} | {
|
|
2480
|
+
kind: "email";
|
|
2481
|
+
message?: string | undefined;
|
|
2482
|
+
} | {
|
|
2483
|
+
kind: "url";
|
|
2484
|
+
message?: string | undefined;
|
|
2485
|
+
} | {
|
|
2486
|
+
kind: "emoji";
|
|
2487
|
+
message?: string | undefined;
|
|
2488
|
+
} | {
|
|
2489
|
+
kind: "uuid";
|
|
2490
|
+
message?: string | undefined;
|
|
2491
|
+
} | {
|
|
2492
|
+
kind: "nanoid";
|
|
2493
|
+
message?: string | undefined;
|
|
2494
|
+
} | {
|
|
2495
|
+
kind: "cuid";
|
|
2496
|
+
message?: string | undefined;
|
|
2497
|
+
} | {
|
|
2498
|
+
kind: "includes";
|
|
2499
|
+
value: string;
|
|
2500
|
+
position?: number | undefined;
|
|
2501
|
+
message?: string | undefined;
|
|
2502
|
+
} | {
|
|
2503
|
+
kind: "cuid2";
|
|
2504
|
+
message?: string | undefined;
|
|
2505
|
+
} | {
|
|
2506
|
+
kind: "ulid";
|
|
2507
|
+
message?: string | undefined;
|
|
2508
|
+
} | {
|
|
2509
|
+
kind: "startsWith";
|
|
2510
|
+
value: string;
|
|
2511
|
+
message?: string | undefined;
|
|
2512
|
+
} | {
|
|
2513
|
+
kind: "endsWith";
|
|
2514
|
+
value: string;
|
|
2515
|
+
message?: string | undefined;
|
|
2516
|
+
} | {
|
|
2517
|
+
kind: "regex";
|
|
2518
|
+
regex: RegExp;
|
|
2519
|
+
message?: string | undefined;
|
|
2520
|
+
} | {
|
|
2521
|
+
kind: "trim";
|
|
2522
|
+
message?: string | undefined;
|
|
2523
|
+
} | {
|
|
2524
|
+
kind: "toLowerCase";
|
|
2525
|
+
message?: string | undefined;
|
|
2526
|
+
} | {
|
|
2527
|
+
kind: "toUpperCase";
|
|
2528
|
+
message?: string | undefined;
|
|
2529
|
+
} | {
|
|
2530
|
+
kind: "jwt";
|
|
2531
|
+
alg?: string;
|
|
2532
|
+
message?: string | undefined;
|
|
2533
|
+
} | {
|
|
2534
|
+
kind: "datetime";
|
|
2535
|
+
offset: boolean;
|
|
2536
|
+
local: boolean;
|
|
2537
|
+
precision: number | null;
|
|
2538
|
+
message?: string | undefined;
|
|
2539
|
+
} | {
|
|
2540
|
+
kind: "date";
|
|
2541
|
+
message?: string | undefined;
|
|
2542
|
+
} | {
|
|
2543
|
+
kind: "time";
|
|
2544
|
+
precision: number | null;
|
|
2545
|
+
message?: string | undefined;
|
|
2546
|
+
} | {
|
|
2547
|
+
kind: "duration";
|
|
2548
|
+
message?: string | undefined;
|
|
2549
|
+
} | {
|
|
2550
|
+
kind: "ip";
|
|
2551
|
+
version?: IpVersion | undefined;
|
|
2552
|
+
message?: string | undefined;
|
|
2553
|
+
} | {
|
|
2554
|
+
kind: "cidr";
|
|
2555
|
+
version?: IpVersion | undefined;
|
|
2556
|
+
message?: string | undefined;
|
|
2557
|
+
} | {
|
|
2558
|
+
kind: "base64";
|
|
2559
|
+
message?: string | undefined;
|
|
2560
|
+
} | {
|
|
2561
|
+
kind: "base64url";
|
|
2562
|
+
message?: string | undefined;
|
|
2563
|
+
};
|
|
2564
|
+
|
|
2565
|
+
declare interface ZodStringDef extends ZodTypeDef {
|
|
2566
|
+
checks: ZodStringCheck[];
|
|
2567
|
+
typeName: ZodFirstPartyTypeKind.ZodString;
|
|
2568
|
+
coerce: boolean;
|
|
2569
|
+
}
|
|
2570
|
+
|
|
2571
|
+
declare class ZodSymbol extends ZodType<symbol, ZodSymbolDef, symbol> {
|
|
2572
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
2573
|
+
static create: (params?: RawCreateParams) => ZodSymbol;
|
|
2574
|
+
}
|
|
2575
|
+
|
|
2576
|
+
declare interface ZodSymbolDef extends ZodTypeDef {
|
|
2577
|
+
typeName: ZodFirstPartyTypeKind.ZodSymbol;
|
|
2578
|
+
}
|
|
2579
|
+
|
|
2580
|
+
declare interface ZodTooBigIssue extends ZodIssueBase {
|
|
2581
|
+
code: typeof ZodIssueCode.too_big;
|
|
2582
|
+
maximum: number | bigint;
|
|
2583
|
+
inclusive: boolean;
|
|
2584
|
+
exact?: boolean;
|
|
2585
|
+
type: "array" | "string" | "number" | "set" | "date" | "bigint";
|
|
2586
|
+
}
|
|
2587
|
+
|
|
2588
|
+
declare interface ZodTooSmallIssue extends ZodIssueBase {
|
|
2589
|
+
code: typeof ZodIssueCode.too_small;
|
|
2590
|
+
minimum: number | bigint;
|
|
2591
|
+
inclusive: boolean;
|
|
2592
|
+
exact?: boolean;
|
|
2593
|
+
type: "array" | "string" | "number" | "set" | "date" | "bigint";
|
|
2594
|
+
}
|
|
2595
|
+
|
|
2596
|
+
declare class ZodTuple<T extends ZodTupleItems | [] = ZodTupleItems, Rest extends ZodTypeAny | null = null> extends ZodType<OutputTypeOfTupleWithRest<T, Rest>, ZodTupleDef<T, Rest>, InputTypeOfTupleWithRest<T, Rest>> {
|
|
2597
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
2598
|
+
get items(): T;
|
|
2599
|
+
rest<RestSchema extends ZodTypeAny>(rest: RestSchema): ZodTuple<T, RestSchema>;
|
|
2600
|
+
static create: <Items extends [ZodTypeAny, ...ZodTypeAny[]] | []>(schemas: Items, params?: RawCreateParams) => ZodTuple<Items, null>;
|
|
2601
|
+
}
|
|
2602
|
+
|
|
2603
|
+
declare interface ZodTupleDef<T extends ZodTupleItems | [] = ZodTupleItems, Rest extends ZodTypeAny | null = null> extends ZodTypeDef {
|
|
2604
|
+
items: T;
|
|
2605
|
+
rest: Rest;
|
|
2606
|
+
typeName: ZodFirstPartyTypeKind.ZodTuple;
|
|
2607
|
+
}
|
|
2608
|
+
|
|
2609
|
+
declare type ZodTupleItems = [ZodTypeAny, ...ZodTypeAny[]];
|
|
2610
|
+
|
|
2611
|
+
declare abstract class ZodType<Output = any, Def extends ZodTypeDef = ZodTypeDef, Input = Output> {
|
|
2612
|
+
readonly _type: Output;
|
|
2613
|
+
readonly _output: Output;
|
|
2614
|
+
readonly _input: Input;
|
|
2615
|
+
readonly _def: Def;
|
|
2616
|
+
get description(): string | undefined;
|
|
2617
|
+
"~standard": StandardSchemaV1.Props<Input, Output>;
|
|
2618
|
+
abstract _parse(input: ParseInput): ParseReturnType<Output>;
|
|
2619
|
+
_getType(input: ParseInput): string;
|
|
2620
|
+
_getOrReturnCtx(input: ParseInput, ctx?: ParseContext | undefined): ParseContext;
|
|
2621
|
+
_processInputParams(input: ParseInput): {
|
|
2622
|
+
status: ParseStatus;
|
|
2623
|
+
ctx: ParseContext;
|
|
2624
|
+
};
|
|
2625
|
+
_parseSync(input: ParseInput): SyncParseReturnType<Output>;
|
|
2626
|
+
_parseAsync(input: ParseInput): AsyncParseReturnType<Output>;
|
|
2627
|
+
parse(data: unknown, params?: util.InexactPartial<ParseParams>): Output;
|
|
2628
|
+
safeParse(data: unknown, params?: util.InexactPartial<ParseParams>): SafeParseReturnType<Input, Output>;
|
|
2629
|
+
"~validate"(data: unknown): StandardSchemaV1.Result<Output> | Promise<StandardSchemaV1.Result<Output>>;
|
|
2630
|
+
parseAsync(data: unknown, params?: util.InexactPartial<ParseParams>): Promise<Output>;
|
|
2631
|
+
safeParseAsync(data: unknown, params?: util.InexactPartial<ParseParams>): Promise<SafeParseReturnType<Input, Output>>;
|
|
2632
|
+
/** Alias of safeParseAsync */
|
|
2633
|
+
spa: (data: unknown, params?: util.InexactPartial<ParseParams>) => Promise<SafeParseReturnType<Input, Output>>;
|
|
2634
|
+
refine<RefinedOutput extends Output>(check: (arg: Output) => arg is RefinedOutput, message?: string | CustomErrorParams | ((arg: Output) => CustomErrorParams)): ZodEffects<this, RefinedOutput, Input>;
|
|
2635
|
+
refine(check: (arg: Output) => unknown | Promise<unknown>, message?: string | CustomErrorParams | ((arg: Output) => CustomErrorParams)): ZodEffects<this, Output, Input>;
|
|
2636
|
+
refinement<RefinedOutput extends Output>(check: (arg: Output) => arg is RefinedOutput, refinementData: IssueData | ((arg: Output, ctx: RefinementCtx) => IssueData)): ZodEffects<this, RefinedOutput, Input>;
|
|
2637
|
+
refinement(check: (arg: Output) => boolean, refinementData: IssueData | ((arg: Output, ctx: RefinementCtx) => IssueData)): ZodEffects<this, Output, Input>;
|
|
2638
|
+
_refinement(refinement: RefinementEffect<Output>["refinement"]): ZodEffects<this, Output, Input>;
|
|
2639
|
+
superRefine<RefinedOutput extends Output>(refinement: (arg: Output, ctx: RefinementCtx) => arg is RefinedOutput): ZodEffects<this, RefinedOutput, Input>;
|
|
2640
|
+
superRefine(refinement: (arg: Output, ctx: RefinementCtx) => void): ZodEffects<this, Output, Input>;
|
|
2641
|
+
superRefine(refinement: (arg: Output, ctx: RefinementCtx) => Promise<void>): ZodEffects<this, Output, Input>;
|
|
2642
|
+
constructor(def: Def);
|
|
2643
|
+
optional(): ZodOptional<this>;
|
|
2644
|
+
nullable(): ZodNullable<this>;
|
|
2645
|
+
nullish(): ZodOptional<ZodNullable<this>>;
|
|
2646
|
+
array(): ZodArray<this>;
|
|
2647
|
+
promise(): ZodPromise<this>;
|
|
2648
|
+
or<T extends ZodTypeAny>(option: T): ZodUnion<[this, T]>;
|
|
2649
|
+
and<T extends ZodTypeAny>(incoming: T): ZodIntersection<this, T>;
|
|
2650
|
+
transform<NewOut>(transform: (arg: Output, ctx: RefinementCtx) => NewOut | Promise<NewOut>): ZodEffects<this, NewOut>;
|
|
2651
|
+
default(def: util.noUndefined<Input>): ZodDefault<this>;
|
|
2652
|
+
default(def: () => util.noUndefined<Input>): ZodDefault<this>;
|
|
2653
|
+
brand<B extends string | number | symbol>(brand?: B): ZodBranded<this, B>;
|
|
2654
|
+
catch(def: Output): ZodCatch<this>;
|
|
2655
|
+
catch(def: (ctx: {
|
|
2656
|
+
error: ZodError;
|
|
2657
|
+
input: Input;
|
|
2658
|
+
}) => Output): ZodCatch<this>;
|
|
2659
|
+
describe(description: string): this;
|
|
2660
|
+
pipe<T extends ZodTypeAny>(target: T): ZodPipeline<this, T>;
|
|
2661
|
+
readonly(): ZodReadonly<this>;
|
|
2662
|
+
isOptional(): boolean;
|
|
2663
|
+
isNullable(): boolean;
|
|
2664
|
+
}
|
|
2665
|
+
|
|
2666
|
+
declare type ZodTypeAny = ZodType<any, any, any>;
|
|
2667
|
+
|
|
2668
|
+
declare interface ZodTypeDef {
|
|
2669
|
+
errorMap?: ZodErrorMap | undefined;
|
|
2670
|
+
description?: string | undefined;
|
|
2671
|
+
}
|
|
2672
|
+
|
|
2673
|
+
declare class ZodUndefined extends ZodType<undefined, ZodUndefinedDef, undefined> {
|
|
2674
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
2675
|
+
params?: RawCreateParams;
|
|
2676
|
+
static create: (params?: RawCreateParams) => ZodUndefined;
|
|
2677
|
+
}
|
|
2678
|
+
|
|
2679
|
+
declare interface ZodUndefinedDef extends ZodTypeDef {
|
|
2680
|
+
typeName: ZodFirstPartyTypeKind.ZodUndefined;
|
|
2681
|
+
}
|
|
2682
|
+
|
|
2683
|
+
declare class ZodUnion<T extends ZodUnionOptions> extends ZodType<T[number]["_output"], ZodUnionDef<T>, T[number]["_input"]> {
|
|
2684
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
2685
|
+
get options(): T;
|
|
2686
|
+
static create: <Options extends Readonly<[ZodTypeAny, ZodTypeAny, ...ZodTypeAny[]]>>(types: Options, params?: RawCreateParams) => ZodUnion<Options>;
|
|
2687
|
+
}
|
|
2688
|
+
|
|
2689
|
+
declare interface ZodUnionDef<T extends ZodUnionOptions = Readonly<[ZodTypeAny, ZodTypeAny, ...ZodTypeAny[]]>> extends ZodTypeDef {
|
|
2690
|
+
options: T;
|
|
2691
|
+
typeName: ZodFirstPartyTypeKind.ZodUnion;
|
|
2692
|
+
}
|
|
2693
|
+
|
|
2694
|
+
declare type ZodUnionOptions = Readonly<[ZodTypeAny, ...ZodTypeAny[]]>;
|
|
2695
|
+
|
|
2696
|
+
declare class ZodUnknown extends ZodType<unknown, ZodUnknownDef, unknown> {
|
|
2697
|
+
_unknown: true;
|
|
2698
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
2699
|
+
static create: (params?: RawCreateParams) => ZodUnknown;
|
|
2700
|
+
}
|
|
2701
|
+
|
|
2702
|
+
declare interface ZodUnknownDef extends ZodTypeDef {
|
|
2703
|
+
typeName: ZodFirstPartyTypeKind.ZodUnknown;
|
|
2704
|
+
}
|
|
2705
|
+
|
|
2706
|
+
declare interface ZodUnrecognizedKeysIssue extends ZodIssueBase {
|
|
2707
|
+
code: typeof ZodIssueCode.unrecognized_keys;
|
|
2708
|
+
keys: string[];
|
|
2709
|
+
}
|
|
2710
|
+
|
|
2711
|
+
declare class ZodVoid extends ZodType<void, ZodVoidDef, void> {
|
|
2712
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
2713
|
+
static create: (params?: RawCreateParams) => ZodVoid;
|
|
2714
|
+
}
|
|
2715
|
+
|
|
2716
|
+
declare interface ZodVoidDef extends ZodTypeDef {
|
|
2717
|
+
typeName: ZodFirstPartyTypeKind.ZodVoid;
|
|
2718
|
+
}
|
|
2719
|
+
|
|
353
2720
|
export { }
|