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