storybook 9.0.0-beta.6 → 9.0.0-beta.8
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/bin/index.cjs +44 -44
- package/dist/bin/index.js +44 -44
- package/dist/cli/bin/index.cjs +4184 -737
- package/dist/cli/bin/index.js +4198 -749
- package/dist/cli/index.cjs +25090 -21638
- package/dist/cli/index.d.ts +974 -1
- package/dist/cli/index.js +25330 -21876
- package/dist/common/index.cjs +4518 -4511
- package/dist/common/index.d.ts +7 -2
- package/dist/common/index.js +4528 -4521
- package/dist/core-server/index.cjs +3240 -3235
- package/dist/core-server/index.d.ts +22 -22
- package/dist/core-server/index.js +1288 -1283
- package/dist/core-server/presets/common-preset.cjs +1445 -1444
- package/dist/core-server/presets/common-preset.js +418 -417
- package/dist/manager/globals-runtime.js +8188 -8165
- package/dist/manager/runtime.js +1151 -1149
- package/dist/manager-api/index.cjs +1046 -1023
- package/dist/manager-api/index.d.ts +12 -1
- package/dist/manager-api/index.js +649 -626
- package/dist/preview/runtime.js +5389 -5388
- package/dist/preview-api/index.cjs +615 -614
- package/dist/preview-api/index.js +532 -531
- package/dist/server-errors.cjs +186 -171
- package/dist/server-errors.d.ts +11 -1
- package/dist/server-errors.js +167 -152
- package/dist/telemetry/index.cjs +4887 -1403
- package/dist/telemetry/index.d.ts +2 -1
- package/dist/telemetry/index.js +4923 -1437
- package/dist/test/index.d.ts +2 -6
- package/dist/test/index.js +2818 -2818
- package/dist/test/preview.cjs +648 -648
- package/dist/test/preview.js +837 -837
- package/dist/test/spy.cjs +112 -112
- package/dist/test/spy.d.ts +2 -6
- package/dist/test/spy.js +104 -104
- package/dist/types/index.cjs +4 -4
- package/dist/types/index.d.ts +2687 -2594
- package/package.json +3 -2
package/dist/cli/index.d.ts
CHANGED
|
@@ -210,4 +210,977 @@ declare function configureEslintPlugin({ eslintConfigFile, packageManager, isFla
|
|
|
210
210
|
}): Promise<void>;
|
|
211
211
|
declare const suggestESLintPlugin: () => Promise<boolean>;
|
|
212
212
|
|
|
213
|
-
|
|
213
|
+
type Primitive = string | number | symbol | bigint | boolean | null | undefined;
|
|
214
|
+
|
|
215
|
+
declare namespace util {
|
|
216
|
+
type AssertEqual<T, U> = (<V>() => V extends T ? 1 : 2) extends <V>() => V extends U ? 1 : 2 ? true : false;
|
|
217
|
+
export type isAny<T> = 0 extends 1 & T ? true : false;
|
|
218
|
+
export const assertEqual: <A, B>(val: AssertEqual<A, B>) => AssertEqual<A, B>;
|
|
219
|
+
export function assertIs<T>(_arg: T): void;
|
|
220
|
+
export function assertNever(_x: never): never;
|
|
221
|
+
export type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
|
222
|
+
export type OmitKeys<T, K extends string> = Pick<T, Exclude<keyof T, K>>;
|
|
223
|
+
export type MakePartial<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
224
|
+
export type Exactly<T, X> = T & Record<Exclude<keyof X, keyof T>, never>;
|
|
225
|
+
export const arrayToEnum: <T extends string, U extends [T, ...T[]]>(items: U) => { [k in U[number]]: k; };
|
|
226
|
+
export const getValidEnumValues: (obj: any) => any[];
|
|
227
|
+
export const objectValues: (obj: any) => any[];
|
|
228
|
+
export const objectKeys: ObjectConstructor["keys"];
|
|
229
|
+
export const find: <T>(arr: T[], checker: (arg: T) => any) => T | undefined;
|
|
230
|
+
export type identity<T> = objectUtil.identity<T>;
|
|
231
|
+
export type flatten<T> = objectUtil.flatten<T>;
|
|
232
|
+
export type noUndefined<T> = T extends undefined ? never : T;
|
|
233
|
+
export const isInteger: NumberConstructor["isInteger"];
|
|
234
|
+
export function joinValues<T extends any[]>(array: T, separator?: string): string;
|
|
235
|
+
export const jsonStringifyReplacer: (_: string, value: any) => any;
|
|
236
|
+
export { };
|
|
237
|
+
}
|
|
238
|
+
declare namespace objectUtil {
|
|
239
|
+
export type MergeShapes<U, V> = keyof U & keyof V extends never ? U & V : {
|
|
240
|
+
[k in Exclude<keyof U, keyof V>]: U[k];
|
|
241
|
+
} & V;
|
|
242
|
+
type optionalKeys<T extends object> = {
|
|
243
|
+
[k in keyof T]: undefined extends T[k] ? k : never;
|
|
244
|
+
}[keyof T];
|
|
245
|
+
type requiredKeys<T extends object> = {
|
|
246
|
+
[k in keyof T]: undefined extends T[k] ? never : k;
|
|
247
|
+
}[keyof T];
|
|
248
|
+
export type addQuestionMarks<T extends object, _O = any> = {
|
|
249
|
+
[K in requiredKeys<T>]: T[K];
|
|
250
|
+
} & {
|
|
251
|
+
[K in optionalKeys<T>]?: T[K];
|
|
252
|
+
} & {
|
|
253
|
+
[k in keyof T]?: unknown;
|
|
254
|
+
};
|
|
255
|
+
export type identity<T> = T;
|
|
256
|
+
export type flatten<T> = identity<{
|
|
257
|
+
[k in keyof T]: T[k];
|
|
258
|
+
}>;
|
|
259
|
+
export type noNeverKeys<T> = {
|
|
260
|
+
[k in keyof T]: [T[k]] extends [never] ? never : k;
|
|
261
|
+
}[keyof T];
|
|
262
|
+
export type noNever<T> = identity<{
|
|
263
|
+
[k in noNeverKeys<T>]: k extends keyof T ? T[k] : never;
|
|
264
|
+
}>;
|
|
265
|
+
export const mergeShapes: <U, T>(first: U, second: T) => T & U;
|
|
266
|
+
export type extendShape<A extends object, B extends object> = keyof A & keyof B extends never ? A & B : {
|
|
267
|
+
[K in keyof A as K extends keyof B ? never : K]: A[K];
|
|
268
|
+
} & {
|
|
269
|
+
[K in keyof B]: B[K];
|
|
270
|
+
};
|
|
271
|
+
export { };
|
|
272
|
+
}
|
|
273
|
+
declare const ZodParsedType: {
|
|
274
|
+
string: "string";
|
|
275
|
+
number: "number";
|
|
276
|
+
bigint: "bigint";
|
|
277
|
+
boolean: "boolean";
|
|
278
|
+
symbol: "symbol";
|
|
279
|
+
undefined: "undefined";
|
|
280
|
+
object: "object";
|
|
281
|
+
function: "function";
|
|
282
|
+
map: "map";
|
|
283
|
+
nan: "nan";
|
|
284
|
+
integer: "integer";
|
|
285
|
+
float: "float";
|
|
286
|
+
date: "date";
|
|
287
|
+
null: "null";
|
|
288
|
+
array: "array";
|
|
289
|
+
unknown: "unknown";
|
|
290
|
+
promise: "promise";
|
|
291
|
+
void: "void";
|
|
292
|
+
never: "never";
|
|
293
|
+
set: "set";
|
|
294
|
+
};
|
|
295
|
+
type ZodParsedType = keyof typeof ZodParsedType;
|
|
296
|
+
|
|
297
|
+
type allKeys<T> = T extends any ? keyof T : never;
|
|
298
|
+
type typeToFlattenedError<T, U = string> = {
|
|
299
|
+
formErrors: U[];
|
|
300
|
+
fieldErrors: {
|
|
301
|
+
[P in allKeys<T>]?: U[];
|
|
302
|
+
};
|
|
303
|
+
};
|
|
304
|
+
declare const ZodIssueCode: {
|
|
305
|
+
invalid_type: "invalid_type";
|
|
306
|
+
invalid_literal: "invalid_literal";
|
|
307
|
+
custom: "custom";
|
|
308
|
+
invalid_union: "invalid_union";
|
|
309
|
+
invalid_union_discriminator: "invalid_union_discriminator";
|
|
310
|
+
invalid_enum_value: "invalid_enum_value";
|
|
311
|
+
unrecognized_keys: "unrecognized_keys";
|
|
312
|
+
invalid_arguments: "invalid_arguments";
|
|
313
|
+
invalid_return_type: "invalid_return_type";
|
|
314
|
+
invalid_date: "invalid_date";
|
|
315
|
+
invalid_string: "invalid_string";
|
|
316
|
+
too_small: "too_small";
|
|
317
|
+
too_big: "too_big";
|
|
318
|
+
invalid_intersection_types: "invalid_intersection_types";
|
|
319
|
+
not_multiple_of: "not_multiple_of";
|
|
320
|
+
not_finite: "not_finite";
|
|
321
|
+
};
|
|
322
|
+
type ZodIssueCode = keyof typeof ZodIssueCode;
|
|
323
|
+
type ZodIssueBase = {
|
|
324
|
+
path: (string | number)[];
|
|
325
|
+
message?: string;
|
|
326
|
+
};
|
|
327
|
+
interface ZodInvalidTypeIssue extends ZodIssueBase {
|
|
328
|
+
code: typeof ZodIssueCode.invalid_type;
|
|
329
|
+
expected: ZodParsedType;
|
|
330
|
+
received: ZodParsedType;
|
|
331
|
+
}
|
|
332
|
+
interface ZodInvalidLiteralIssue extends ZodIssueBase {
|
|
333
|
+
code: typeof ZodIssueCode.invalid_literal;
|
|
334
|
+
expected: unknown;
|
|
335
|
+
received: unknown;
|
|
336
|
+
}
|
|
337
|
+
interface ZodUnrecognizedKeysIssue extends ZodIssueBase {
|
|
338
|
+
code: typeof ZodIssueCode.unrecognized_keys;
|
|
339
|
+
keys: string[];
|
|
340
|
+
}
|
|
341
|
+
interface ZodInvalidUnionIssue extends ZodIssueBase {
|
|
342
|
+
code: typeof ZodIssueCode.invalid_union;
|
|
343
|
+
unionErrors: ZodError[];
|
|
344
|
+
}
|
|
345
|
+
interface ZodInvalidUnionDiscriminatorIssue extends ZodIssueBase {
|
|
346
|
+
code: typeof ZodIssueCode.invalid_union_discriminator;
|
|
347
|
+
options: Primitive[];
|
|
348
|
+
}
|
|
349
|
+
interface ZodInvalidEnumValueIssue extends ZodIssueBase {
|
|
350
|
+
received: string | number;
|
|
351
|
+
code: typeof ZodIssueCode.invalid_enum_value;
|
|
352
|
+
options: (string | number)[];
|
|
353
|
+
}
|
|
354
|
+
interface ZodInvalidArgumentsIssue extends ZodIssueBase {
|
|
355
|
+
code: typeof ZodIssueCode.invalid_arguments;
|
|
356
|
+
argumentsError: ZodError;
|
|
357
|
+
}
|
|
358
|
+
interface ZodInvalidReturnTypeIssue extends ZodIssueBase {
|
|
359
|
+
code: typeof ZodIssueCode.invalid_return_type;
|
|
360
|
+
returnTypeError: ZodError;
|
|
361
|
+
}
|
|
362
|
+
interface ZodInvalidDateIssue extends ZodIssueBase {
|
|
363
|
+
code: typeof ZodIssueCode.invalid_date;
|
|
364
|
+
}
|
|
365
|
+
type StringValidation = "email" | "url" | "emoji" | "uuid" | "nanoid" | "regex" | "cuid" | "cuid2" | "ulid" | "datetime" | "date" | "time" | "duration" | "ip" | "cidr" | "base64" | "jwt" | "base64url" | {
|
|
366
|
+
includes: string;
|
|
367
|
+
position?: number;
|
|
368
|
+
} | {
|
|
369
|
+
startsWith: string;
|
|
370
|
+
} | {
|
|
371
|
+
endsWith: string;
|
|
372
|
+
};
|
|
373
|
+
interface ZodInvalidStringIssue extends ZodIssueBase {
|
|
374
|
+
code: typeof ZodIssueCode.invalid_string;
|
|
375
|
+
validation: StringValidation;
|
|
376
|
+
}
|
|
377
|
+
interface ZodTooSmallIssue extends ZodIssueBase {
|
|
378
|
+
code: typeof ZodIssueCode.too_small;
|
|
379
|
+
minimum: number | bigint;
|
|
380
|
+
inclusive: boolean;
|
|
381
|
+
exact?: boolean;
|
|
382
|
+
type: "array" | "string" | "number" | "set" | "date" | "bigint";
|
|
383
|
+
}
|
|
384
|
+
interface ZodTooBigIssue extends ZodIssueBase {
|
|
385
|
+
code: typeof ZodIssueCode.too_big;
|
|
386
|
+
maximum: number | bigint;
|
|
387
|
+
inclusive: boolean;
|
|
388
|
+
exact?: boolean;
|
|
389
|
+
type: "array" | "string" | "number" | "set" | "date" | "bigint";
|
|
390
|
+
}
|
|
391
|
+
interface ZodInvalidIntersectionTypesIssue extends ZodIssueBase {
|
|
392
|
+
code: typeof ZodIssueCode.invalid_intersection_types;
|
|
393
|
+
}
|
|
394
|
+
interface ZodNotMultipleOfIssue extends ZodIssueBase {
|
|
395
|
+
code: typeof ZodIssueCode.not_multiple_of;
|
|
396
|
+
multipleOf: number | bigint;
|
|
397
|
+
}
|
|
398
|
+
interface ZodNotFiniteIssue extends ZodIssueBase {
|
|
399
|
+
code: typeof ZodIssueCode.not_finite;
|
|
400
|
+
}
|
|
401
|
+
interface ZodCustomIssue extends ZodIssueBase {
|
|
402
|
+
code: typeof ZodIssueCode.custom;
|
|
403
|
+
params?: {
|
|
404
|
+
[k: string]: any;
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
type ZodIssueOptionalMessage = ZodInvalidTypeIssue | ZodInvalidLiteralIssue | ZodUnrecognizedKeysIssue | ZodInvalidUnionIssue | ZodInvalidUnionDiscriminatorIssue | ZodInvalidEnumValueIssue | ZodInvalidArgumentsIssue | ZodInvalidReturnTypeIssue | ZodInvalidDateIssue | ZodInvalidStringIssue | ZodTooSmallIssue | ZodTooBigIssue | ZodInvalidIntersectionTypesIssue | ZodNotMultipleOfIssue | ZodNotFiniteIssue | ZodCustomIssue;
|
|
408
|
+
type ZodIssue = ZodIssueOptionalMessage & {
|
|
409
|
+
fatal?: boolean;
|
|
410
|
+
message: string;
|
|
411
|
+
};
|
|
412
|
+
type recursiveZodFormattedError<T> = T extends [any, ...any[]] ? {
|
|
413
|
+
[K in keyof T]?: ZodFormattedError<T[K]>;
|
|
414
|
+
} : T extends any[] ? {
|
|
415
|
+
[k: number]: ZodFormattedError<T[number]>;
|
|
416
|
+
} : T extends object ? {
|
|
417
|
+
[K in keyof T]?: ZodFormattedError<T[K]>;
|
|
418
|
+
} : unknown;
|
|
419
|
+
type ZodFormattedError<T, U = string> = {
|
|
420
|
+
_errors: U[];
|
|
421
|
+
} & recursiveZodFormattedError<NonNullable<T>>;
|
|
422
|
+
declare class ZodError<T = any> extends Error {
|
|
423
|
+
issues: ZodIssue[];
|
|
424
|
+
get errors(): ZodIssue[];
|
|
425
|
+
constructor(issues: ZodIssue[]);
|
|
426
|
+
format(): ZodFormattedError<T>;
|
|
427
|
+
format<U>(mapper: (issue: ZodIssue) => U): ZodFormattedError<T, U>;
|
|
428
|
+
static create: (issues: ZodIssue[]) => ZodError<any>;
|
|
429
|
+
static assert(value: unknown): asserts value is ZodError;
|
|
430
|
+
toString(): string;
|
|
431
|
+
get message(): string;
|
|
432
|
+
get isEmpty(): boolean;
|
|
433
|
+
addIssue: (sub: ZodIssue) => void;
|
|
434
|
+
addIssues: (subs?: ZodIssue[]) => void;
|
|
435
|
+
flatten(): typeToFlattenedError<T>;
|
|
436
|
+
flatten<U>(mapper?: (issue: ZodIssue) => U): typeToFlattenedError<T, U>;
|
|
437
|
+
get formErrors(): typeToFlattenedError<T, string>;
|
|
438
|
+
}
|
|
439
|
+
type stripPath<T extends object> = T extends any ? util.OmitKeys<T, "path"> : never;
|
|
440
|
+
type IssueData = stripPath<ZodIssueOptionalMessage> & {
|
|
441
|
+
path?: (string | number)[];
|
|
442
|
+
fatal?: boolean;
|
|
443
|
+
};
|
|
444
|
+
type ErrorMapCtx = {
|
|
445
|
+
defaultError: string;
|
|
446
|
+
data: any;
|
|
447
|
+
};
|
|
448
|
+
type ZodErrorMap = (issue: ZodIssueOptionalMessage, _ctx: ErrorMapCtx) => {
|
|
449
|
+
message: string;
|
|
450
|
+
};
|
|
451
|
+
|
|
452
|
+
type ParseParams = {
|
|
453
|
+
path: (string | number)[];
|
|
454
|
+
errorMap: ZodErrorMap;
|
|
455
|
+
async: boolean;
|
|
456
|
+
};
|
|
457
|
+
type ParsePathComponent = string | number;
|
|
458
|
+
type ParsePath = ParsePathComponent[];
|
|
459
|
+
interface ParseContext {
|
|
460
|
+
readonly common: {
|
|
461
|
+
readonly issues: ZodIssue[];
|
|
462
|
+
readonly contextualErrorMap?: ZodErrorMap;
|
|
463
|
+
readonly async: boolean;
|
|
464
|
+
};
|
|
465
|
+
readonly path: ParsePath;
|
|
466
|
+
readonly schemaErrorMap?: ZodErrorMap;
|
|
467
|
+
readonly parent: ParseContext | null;
|
|
468
|
+
readonly data: any;
|
|
469
|
+
readonly parsedType: ZodParsedType;
|
|
470
|
+
}
|
|
471
|
+
type ParseInput = {
|
|
472
|
+
data: any;
|
|
473
|
+
path: (string | number)[];
|
|
474
|
+
parent: ParseContext;
|
|
475
|
+
};
|
|
476
|
+
declare class ParseStatus {
|
|
477
|
+
value: "aborted" | "dirty" | "valid";
|
|
478
|
+
dirty(): void;
|
|
479
|
+
abort(): void;
|
|
480
|
+
static mergeArray(status: ParseStatus, results: SyncParseReturnType<any>[]): SyncParseReturnType;
|
|
481
|
+
static mergeObjectAsync(status: ParseStatus, pairs: {
|
|
482
|
+
key: ParseReturnType<any>;
|
|
483
|
+
value: ParseReturnType<any>;
|
|
484
|
+
}[]): Promise<SyncParseReturnType<any>>;
|
|
485
|
+
static mergeObjectSync(status: ParseStatus, pairs: {
|
|
486
|
+
key: SyncParseReturnType<any>;
|
|
487
|
+
value: SyncParseReturnType<any>;
|
|
488
|
+
alwaysSet?: boolean;
|
|
489
|
+
}[]): SyncParseReturnType;
|
|
490
|
+
}
|
|
491
|
+
type INVALID = {
|
|
492
|
+
status: "aborted";
|
|
493
|
+
};
|
|
494
|
+
declare const INVALID: INVALID;
|
|
495
|
+
type DIRTY<T> = {
|
|
496
|
+
status: "dirty";
|
|
497
|
+
value: T;
|
|
498
|
+
};
|
|
499
|
+
declare const DIRTY: <T>(value: T) => DIRTY<T>;
|
|
500
|
+
type OK<T> = {
|
|
501
|
+
status: "valid";
|
|
502
|
+
value: T;
|
|
503
|
+
};
|
|
504
|
+
declare const OK: <T>(value: T) => OK<T>;
|
|
505
|
+
type SyncParseReturnType<T = any> = OK<T> | DIRTY<T> | INVALID;
|
|
506
|
+
type AsyncParseReturnType<T> = Promise<SyncParseReturnType<T>>;
|
|
507
|
+
type ParseReturnType<T> = SyncParseReturnType<T> | AsyncParseReturnType<T>;
|
|
508
|
+
|
|
509
|
+
declare namespace enumUtil {
|
|
510
|
+
type UnionToIntersectionFn<T> = (T extends unknown ? (k: () => T) => void : never) extends (k: infer Intersection) => void ? Intersection : never;
|
|
511
|
+
type GetUnionLast<T> = UnionToIntersectionFn<T> extends () => infer Last ? Last : never;
|
|
512
|
+
type UnionToTuple<T, Tuple extends unknown[] = []> = [T] extends [never] ? Tuple : UnionToTuple<Exclude<T, GetUnionLast<T>>, [GetUnionLast<T>, ...Tuple]>;
|
|
513
|
+
type CastToStringTuple<T> = T extends [string, ...string[]] ? T : never;
|
|
514
|
+
export type UnionToTupleString<T> = CastToStringTuple<UnionToTuple<T>>;
|
|
515
|
+
export { };
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
declare namespace errorUtil {
|
|
519
|
+
type ErrMessage = string | {
|
|
520
|
+
message?: string;
|
|
521
|
+
};
|
|
522
|
+
const errToObj: (message?: ErrMessage) => {
|
|
523
|
+
message?: string | undefined;
|
|
524
|
+
};
|
|
525
|
+
const toString: (message?: ErrMessage) => string | undefined;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
declare namespace partialUtil {
|
|
529
|
+
type DeepPartial<T extends ZodTypeAny> = T extends ZodObject<ZodRawShape> ? ZodObject<{
|
|
530
|
+
[k in keyof T["shape"]]: ZodOptional<DeepPartial<T["shape"][k]>>;
|
|
531
|
+
}, 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> ? {
|
|
532
|
+
[k in keyof Items]: Items[k] extends ZodTypeAny ? DeepPartial<Items[k]> : never;
|
|
533
|
+
} extends infer PI ? PI extends ZodTupleItems ? ZodTuple<PI> : never : never : T;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* The Standard Schema interface.
|
|
538
|
+
*/
|
|
539
|
+
type StandardSchemaV1<Input = unknown, Output = Input> = {
|
|
540
|
+
/**
|
|
541
|
+
* The Standard Schema properties.
|
|
542
|
+
*/
|
|
543
|
+
readonly "~standard": StandardSchemaV1.Props<Input, Output>;
|
|
544
|
+
};
|
|
545
|
+
declare namespace StandardSchemaV1 {
|
|
546
|
+
/**
|
|
547
|
+
* The Standard Schema properties interface.
|
|
548
|
+
*/
|
|
549
|
+
export interface Props<Input = unknown, Output = Input> {
|
|
550
|
+
/**
|
|
551
|
+
* The version number of the standard.
|
|
552
|
+
*/
|
|
553
|
+
readonly version: 1;
|
|
554
|
+
/**
|
|
555
|
+
* The vendor name of the schema library.
|
|
556
|
+
*/
|
|
557
|
+
readonly vendor: string;
|
|
558
|
+
/**
|
|
559
|
+
* Validates unknown input values.
|
|
560
|
+
*/
|
|
561
|
+
readonly validate: (value: unknown) => Result<Output> | Promise<Result<Output>>;
|
|
562
|
+
/**
|
|
563
|
+
* Inferred types associated with the schema.
|
|
564
|
+
*/
|
|
565
|
+
readonly types?: Types<Input, Output> | undefined;
|
|
566
|
+
}
|
|
567
|
+
/**
|
|
568
|
+
* The result interface of the validate function.
|
|
569
|
+
*/
|
|
570
|
+
export type Result<Output> = SuccessResult<Output> | FailureResult;
|
|
571
|
+
/**
|
|
572
|
+
* The result interface if validation succeeds.
|
|
573
|
+
*/
|
|
574
|
+
export interface SuccessResult<Output> {
|
|
575
|
+
/**
|
|
576
|
+
* The typed output value.
|
|
577
|
+
*/
|
|
578
|
+
readonly value: Output;
|
|
579
|
+
/**
|
|
580
|
+
* The non-existent issues.
|
|
581
|
+
*/
|
|
582
|
+
readonly issues?: undefined;
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* The result interface if validation fails.
|
|
586
|
+
*/
|
|
587
|
+
export interface FailureResult {
|
|
588
|
+
/**
|
|
589
|
+
* The issues of failed validation.
|
|
590
|
+
*/
|
|
591
|
+
readonly issues: ReadonlyArray<Issue>;
|
|
592
|
+
}
|
|
593
|
+
/**
|
|
594
|
+
* The issue interface of the failure output.
|
|
595
|
+
*/
|
|
596
|
+
export interface Issue {
|
|
597
|
+
/**
|
|
598
|
+
* The error message of the issue.
|
|
599
|
+
*/
|
|
600
|
+
readonly message: string;
|
|
601
|
+
/**
|
|
602
|
+
* The path of the issue, if any.
|
|
603
|
+
*/
|
|
604
|
+
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
|
605
|
+
}
|
|
606
|
+
/**
|
|
607
|
+
* The path segment interface of the issue.
|
|
608
|
+
*/
|
|
609
|
+
export interface PathSegment {
|
|
610
|
+
/**
|
|
611
|
+
* The key representing a path segment.
|
|
612
|
+
*/
|
|
613
|
+
readonly key: PropertyKey;
|
|
614
|
+
}
|
|
615
|
+
/**
|
|
616
|
+
* The Standard Schema types interface.
|
|
617
|
+
*/
|
|
618
|
+
export interface Types<Input = unknown, Output = Input> {
|
|
619
|
+
/**
|
|
620
|
+
* The input type of the schema.
|
|
621
|
+
*/
|
|
622
|
+
readonly input: Input;
|
|
623
|
+
/**
|
|
624
|
+
* The output type of the schema.
|
|
625
|
+
*/
|
|
626
|
+
readonly output: Output;
|
|
627
|
+
}
|
|
628
|
+
/**
|
|
629
|
+
* Infers the input type of a Standard Schema.
|
|
630
|
+
*/
|
|
631
|
+
export type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["input"];
|
|
632
|
+
/**
|
|
633
|
+
* Infers the output type of a Standard Schema.
|
|
634
|
+
*/
|
|
635
|
+
export type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["output"];
|
|
636
|
+
export { };
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
interface RefinementCtx {
|
|
640
|
+
addIssue: (arg: IssueData) => void;
|
|
641
|
+
path: (string | number)[];
|
|
642
|
+
}
|
|
643
|
+
type ZodRawShape = {
|
|
644
|
+
[k: string]: ZodTypeAny;
|
|
645
|
+
};
|
|
646
|
+
type ZodTypeAny = ZodType<any, any, any>;
|
|
647
|
+
type TypeOf<T extends ZodType<any, any, any>> = T["_output"];
|
|
648
|
+
type input<T extends ZodType<any, any, any>> = T["_input"];
|
|
649
|
+
type output<T extends ZodType<any, any, any>> = T["_output"];
|
|
650
|
+
|
|
651
|
+
type CustomErrorParams = Partial<util.Omit<ZodCustomIssue, "code">>;
|
|
652
|
+
interface ZodTypeDef {
|
|
653
|
+
errorMap?: ZodErrorMap;
|
|
654
|
+
description?: string;
|
|
655
|
+
}
|
|
656
|
+
type RawCreateParams = {
|
|
657
|
+
errorMap?: ZodErrorMap;
|
|
658
|
+
invalid_type_error?: string;
|
|
659
|
+
required_error?: string;
|
|
660
|
+
message?: string;
|
|
661
|
+
description?: string;
|
|
662
|
+
} | undefined;
|
|
663
|
+
type SafeParseSuccess<Output> = {
|
|
664
|
+
success: true;
|
|
665
|
+
data: Output;
|
|
666
|
+
error?: never;
|
|
667
|
+
};
|
|
668
|
+
type SafeParseError<Input> = {
|
|
669
|
+
success: false;
|
|
670
|
+
error: ZodError<Input>;
|
|
671
|
+
data?: never;
|
|
672
|
+
};
|
|
673
|
+
type SafeParseReturnType<Input, Output> = SafeParseSuccess<Output> | SafeParseError<Input>;
|
|
674
|
+
declare abstract class ZodType<Output = any, Def extends ZodTypeDef = ZodTypeDef, Input = Output> {
|
|
675
|
+
readonly _type: Output;
|
|
676
|
+
readonly _output: Output;
|
|
677
|
+
readonly _input: Input;
|
|
678
|
+
readonly _def: Def;
|
|
679
|
+
get description(): string | undefined;
|
|
680
|
+
"~standard": StandardSchemaV1.Props<Input, Output>;
|
|
681
|
+
abstract _parse(input: ParseInput): ParseReturnType<Output>;
|
|
682
|
+
_getType(input: ParseInput): string;
|
|
683
|
+
_getOrReturnCtx(input: ParseInput, ctx?: ParseContext | undefined): ParseContext;
|
|
684
|
+
_processInputParams(input: ParseInput): {
|
|
685
|
+
status: ParseStatus;
|
|
686
|
+
ctx: ParseContext;
|
|
687
|
+
};
|
|
688
|
+
_parseSync(input: ParseInput): SyncParseReturnType<Output>;
|
|
689
|
+
_parseAsync(input: ParseInput): AsyncParseReturnType<Output>;
|
|
690
|
+
parse(data: unknown, params?: Partial<ParseParams>): Output;
|
|
691
|
+
safeParse(data: unknown, params?: Partial<ParseParams>): SafeParseReturnType<Input, Output>;
|
|
692
|
+
"~validate"(data: unknown): StandardSchemaV1.Result<Output> | Promise<StandardSchemaV1.Result<Output>>;
|
|
693
|
+
parseAsync(data: unknown, params?: Partial<ParseParams>): Promise<Output>;
|
|
694
|
+
safeParseAsync(data: unknown, params?: Partial<ParseParams>): Promise<SafeParseReturnType<Input, Output>>;
|
|
695
|
+
/** Alias of safeParseAsync */
|
|
696
|
+
spa: (data: unknown, params?: Partial<ParseParams>) => Promise<SafeParseReturnType<Input, Output>>;
|
|
697
|
+
refine<RefinedOutput extends Output>(check: (arg: Output) => arg is RefinedOutput, message?: string | CustomErrorParams | ((arg: Output) => CustomErrorParams)): ZodEffects<this, RefinedOutput, Input>;
|
|
698
|
+
refine(check: (arg: Output) => unknown | Promise<unknown>, message?: string | CustomErrorParams | ((arg: Output) => CustomErrorParams)): ZodEffects<this, Output, Input>;
|
|
699
|
+
refinement<RefinedOutput extends Output>(check: (arg: Output) => arg is RefinedOutput, refinementData: IssueData | ((arg: Output, ctx: RefinementCtx) => IssueData)): ZodEffects<this, RefinedOutput, Input>;
|
|
700
|
+
refinement(check: (arg: Output) => boolean, refinementData: IssueData | ((arg: Output, ctx: RefinementCtx) => IssueData)): ZodEffects<this, Output, Input>;
|
|
701
|
+
_refinement(refinement: RefinementEffect<Output>["refinement"]): ZodEffects<this, Output, Input>;
|
|
702
|
+
superRefine<RefinedOutput extends Output>(refinement: (arg: Output, ctx: RefinementCtx) => arg is RefinedOutput): ZodEffects<this, RefinedOutput, Input>;
|
|
703
|
+
superRefine(refinement: (arg: Output, ctx: RefinementCtx) => void): ZodEffects<this, Output, Input>;
|
|
704
|
+
superRefine(refinement: (arg: Output, ctx: RefinementCtx) => Promise<void>): ZodEffects<this, Output, Input>;
|
|
705
|
+
constructor(def: Def);
|
|
706
|
+
optional(): ZodOptional<this>;
|
|
707
|
+
nullable(): ZodNullable<this>;
|
|
708
|
+
nullish(): ZodOptional<ZodNullable<this>>;
|
|
709
|
+
array(): ZodArray<this>;
|
|
710
|
+
promise(): ZodPromise<this>;
|
|
711
|
+
or<T extends ZodTypeAny>(option: T): ZodUnion<[this, T]>;
|
|
712
|
+
and<T extends ZodTypeAny>(incoming: T): ZodIntersection<this, T>;
|
|
713
|
+
transform<NewOut>(transform: (arg: Output, ctx: RefinementCtx) => NewOut | Promise<NewOut>): ZodEffects<this, NewOut>;
|
|
714
|
+
default(def: util.noUndefined<Input>): ZodDefault<this>;
|
|
715
|
+
default(def: () => util.noUndefined<Input>): ZodDefault<this>;
|
|
716
|
+
brand<B extends string | number | symbol>(brand?: B): ZodBranded<this, B>;
|
|
717
|
+
catch(def: Output): ZodCatch<this>;
|
|
718
|
+
catch(def: (ctx: {
|
|
719
|
+
error: ZodError;
|
|
720
|
+
input: Input;
|
|
721
|
+
}) => Output): ZodCatch<this>;
|
|
722
|
+
describe(description: string): this;
|
|
723
|
+
pipe<T extends ZodTypeAny>(target: T): ZodPipeline<this, T>;
|
|
724
|
+
readonly(): ZodReadonly<this>;
|
|
725
|
+
isOptional(): boolean;
|
|
726
|
+
isNullable(): boolean;
|
|
727
|
+
}
|
|
728
|
+
type ZodNumberCheck = {
|
|
729
|
+
kind: "min";
|
|
730
|
+
value: number;
|
|
731
|
+
inclusive: boolean;
|
|
732
|
+
message?: string;
|
|
733
|
+
} | {
|
|
734
|
+
kind: "max";
|
|
735
|
+
value: number;
|
|
736
|
+
inclusive: boolean;
|
|
737
|
+
message?: string;
|
|
738
|
+
} | {
|
|
739
|
+
kind: "int";
|
|
740
|
+
message?: string;
|
|
741
|
+
} | {
|
|
742
|
+
kind: "multipleOf";
|
|
743
|
+
value: number;
|
|
744
|
+
message?: string;
|
|
745
|
+
} | {
|
|
746
|
+
kind: "finite";
|
|
747
|
+
message?: string;
|
|
748
|
+
};
|
|
749
|
+
interface ZodNumberDef extends ZodTypeDef {
|
|
750
|
+
checks: ZodNumberCheck[];
|
|
751
|
+
typeName: ZodFirstPartyTypeKind.ZodNumber;
|
|
752
|
+
coerce: boolean;
|
|
753
|
+
}
|
|
754
|
+
declare class ZodNumber extends ZodType<number, ZodNumberDef, number> {
|
|
755
|
+
_parse(input: ParseInput): ParseReturnType<number>;
|
|
756
|
+
static create: (params?: RawCreateParams & {
|
|
757
|
+
coerce?: boolean;
|
|
758
|
+
}) => ZodNumber;
|
|
759
|
+
gte(value: number, message?: errorUtil.ErrMessage): ZodNumber;
|
|
760
|
+
min: (value: number, message?: errorUtil.ErrMessage) => ZodNumber;
|
|
761
|
+
gt(value: number, message?: errorUtil.ErrMessage): ZodNumber;
|
|
762
|
+
lte(value: number, message?: errorUtil.ErrMessage): ZodNumber;
|
|
763
|
+
max: (value: number, message?: errorUtil.ErrMessage) => ZodNumber;
|
|
764
|
+
lt(value: number, message?: errorUtil.ErrMessage): ZodNumber;
|
|
765
|
+
protected setLimit(kind: "min" | "max", value: number, inclusive: boolean, message?: string): ZodNumber;
|
|
766
|
+
_addCheck(check: ZodNumberCheck): ZodNumber;
|
|
767
|
+
int(message?: errorUtil.ErrMessage): ZodNumber;
|
|
768
|
+
positive(message?: errorUtil.ErrMessage): ZodNumber;
|
|
769
|
+
negative(message?: errorUtil.ErrMessage): ZodNumber;
|
|
770
|
+
nonpositive(message?: errorUtil.ErrMessage): ZodNumber;
|
|
771
|
+
nonnegative(message?: errorUtil.ErrMessage): ZodNumber;
|
|
772
|
+
multipleOf(value: number, message?: errorUtil.ErrMessage): ZodNumber;
|
|
773
|
+
step: (value: number, message?: errorUtil.ErrMessage) => ZodNumber;
|
|
774
|
+
finite(message?: errorUtil.ErrMessage): ZodNumber;
|
|
775
|
+
safe(message?: errorUtil.ErrMessage): ZodNumber;
|
|
776
|
+
get minValue(): number | null;
|
|
777
|
+
get maxValue(): number | null;
|
|
778
|
+
get isInt(): boolean;
|
|
779
|
+
get isFinite(): boolean;
|
|
780
|
+
}
|
|
781
|
+
interface ZodBooleanDef extends ZodTypeDef {
|
|
782
|
+
typeName: ZodFirstPartyTypeKind.ZodBoolean;
|
|
783
|
+
coerce: boolean;
|
|
784
|
+
}
|
|
785
|
+
declare class ZodBoolean extends ZodType<boolean, ZodBooleanDef, boolean> {
|
|
786
|
+
_parse(input: ParseInput): ParseReturnType<boolean>;
|
|
787
|
+
static create: (params?: RawCreateParams & {
|
|
788
|
+
coerce?: boolean;
|
|
789
|
+
}) => ZodBoolean;
|
|
790
|
+
}
|
|
791
|
+
interface ZodArrayDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
792
|
+
type: T;
|
|
793
|
+
typeName: ZodFirstPartyTypeKind.ZodArray;
|
|
794
|
+
exactLength: {
|
|
795
|
+
value: number;
|
|
796
|
+
message?: string;
|
|
797
|
+
} | null;
|
|
798
|
+
minLength: {
|
|
799
|
+
value: number;
|
|
800
|
+
message?: string;
|
|
801
|
+
} | null;
|
|
802
|
+
maxLength: {
|
|
803
|
+
value: number;
|
|
804
|
+
message?: string;
|
|
805
|
+
} | null;
|
|
806
|
+
}
|
|
807
|
+
type ArrayCardinality = "many" | "atleastone";
|
|
808
|
+
type arrayOutputType<T extends ZodTypeAny, Cardinality extends ArrayCardinality = "many"> = Cardinality extends "atleastone" ? [T["_output"], ...T["_output"][]] : T["_output"][];
|
|
809
|
+
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"][]> {
|
|
810
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
811
|
+
get element(): T;
|
|
812
|
+
min(minLength: number, message?: errorUtil.ErrMessage): this;
|
|
813
|
+
max(maxLength: number, message?: errorUtil.ErrMessage): this;
|
|
814
|
+
length(len: number, message?: errorUtil.ErrMessage): this;
|
|
815
|
+
nonempty(message?: errorUtil.ErrMessage): ZodArray<T, "atleastone">;
|
|
816
|
+
static create: <T_1 extends ZodTypeAny>(schema: T_1, params?: RawCreateParams) => ZodArray<T_1, "many">;
|
|
817
|
+
}
|
|
818
|
+
type UnknownKeysParam = "passthrough" | "strict" | "strip";
|
|
819
|
+
interface ZodObjectDef<T extends ZodRawShape = ZodRawShape, UnknownKeys extends UnknownKeysParam = UnknownKeysParam, Catchall extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
820
|
+
typeName: ZodFirstPartyTypeKind.ZodObject;
|
|
821
|
+
shape: () => T;
|
|
822
|
+
catchall: Catchall;
|
|
823
|
+
unknownKeys: UnknownKeys;
|
|
824
|
+
}
|
|
825
|
+
type objectOutputType<Shape extends ZodRawShape, Catchall extends ZodTypeAny, UnknownKeys extends UnknownKeysParam = UnknownKeysParam> = objectUtil.flatten<objectUtil.addQuestionMarks<baseObjectOutputType<Shape>>> & CatchallOutput<Catchall> & PassthroughType<UnknownKeys>;
|
|
826
|
+
type baseObjectOutputType<Shape extends ZodRawShape> = {
|
|
827
|
+
[k in keyof Shape]: Shape[k]["_output"];
|
|
828
|
+
};
|
|
829
|
+
type objectInputType<Shape extends ZodRawShape, Catchall extends ZodTypeAny, UnknownKeys extends UnknownKeysParam = UnknownKeysParam> = objectUtil.flatten<baseObjectInputType<Shape>> & CatchallInput<Catchall> & PassthroughType<UnknownKeys>;
|
|
830
|
+
type baseObjectInputType<Shape extends ZodRawShape> = objectUtil.addQuestionMarks<{
|
|
831
|
+
[k in keyof Shape]: Shape[k]["_input"];
|
|
832
|
+
}>;
|
|
833
|
+
type CatchallOutput<T extends ZodType> = ZodType extends T ? unknown : {
|
|
834
|
+
[k: string]: T["_output"];
|
|
835
|
+
};
|
|
836
|
+
type CatchallInput<T extends ZodType> = ZodType extends T ? unknown : {
|
|
837
|
+
[k: string]: T["_input"];
|
|
838
|
+
};
|
|
839
|
+
type PassthroughType<T extends UnknownKeysParam> = T extends "passthrough" ? {
|
|
840
|
+
[k: string]: unknown;
|
|
841
|
+
} : unknown;
|
|
842
|
+
type deoptional<T extends ZodTypeAny> = T extends ZodOptional<infer U> ? deoptional<U> : T extends ZodNullable<infer U> ? ZodNullable<deoptional<U>> : T;
|
|
843
|
+
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> {
|
|
844
|
+
private _cached;
|
|
845
|
+
_getCached(): {
|
|
846
|
+
shape: T;
|
|
847
|
+
keys: string[];
|
|
848
|
+
};
|
|
849
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
850
|
+
get shape(): T;
|
|
851
|
+
strict(message?: errorUtil.ErrMessage): ZodObject<T, "strict", Catchall>;
|
|
852
|
+
strip(): ZodObject<T, "strip", Catchall>;
|
|
853
|
+
passthrough(): ZodObject<T, "passthrough", Catchall>;
|
|
854
|
+
/**
|
|
855
|
+
* @deprecated In most cases, this is no longer needed - unknown properties are now silently stripped.
|
|
856
|
+
* If you want to pass through unknown properties, use `.passthrough()` instead.
|
|
857
|
+
*/
|
|
858
|
+
nonstrict: () => ZodObject<T, "passthrough", Catchall>;
|
|
859
|
+
extend<Augmentation extends ZodRawShape>(augmentation: Augmentation): ZodObject<objectUtil.extendShape<T, Augmentation>, UnknownKeys, Catchall>;
|
|
860
|
+
/**
|
|
861
|
+
* @deprecated Use `.extend` instead
|
|
862
|
+
* */
|
|
863
|
+
augment: <Augmentation extends ZodRawShape>(augmentation: Augmentation) => ZodObject<objectUtil.extendShape<T, Augmentation>, UnknownKeys, Catchall>;
|
|
864
|
+
/**
|
|
865
|
+
* Prior to zod@1.0.12 there was a bug in the
|
|
866
|
+
* inferred type of merged objects. Please
|
|
867
|
+
* upgrade if you are experiencing issues.
|
|
868
|
+
*/
|
|
869
|
+
merge<Incoming extends AnyZodObject, Augmentation extends Incoming["shape"]>(merging: Incoming): ZodObject<objectUtil.extendShape<T, Augmentation>, Incoming["_def"]["unknownKeys"], Incoming["_def"]["catchall"]>;
|
|
870
|
+
setKey<Key extends string, Schema extends ZodTypeAny>(key: Key, schema: Schema): ZodObject<T & {
|
|
871
|
+
[k in Key]: Schema;
|
|
872
|
+
}, UnknownKeys, Catchall>;
|
|
873
|
+
catchall<Index extends ZodTypeAny>(index: Index): ZodObject<T, UnknownKeys, Index>;
|
|
874
|
+
pick<Mask extends util.Exactly<{
|
|
875
|
+
[k in keyof T]?: true;
|
|
876
|
+
}, Mask>>(mask: Mask): ZodObject<Pick<T, Extract<keyof T, keyof Mask>>, UnknownKeys, Catchall>;
|
|
877
|
+
omit<Mask extends util.Exactly<{
|
|
878
|
+
[k in keyof T]?: true;
|
|
879
|
+
}, Mask>>(mask: Mask): ZodObject<Omit<T, keyof Mask>, UnknownKeys, Catchall>;
|
|
880
|
+
/**
|
|
881
|
+
* @deprecated
|
|
882
|
+
*/
|
|
883
|
+
deepPartial(): partialUtil.DeepPartial<this>;
|
|
884
|
+
partial(): ZodObject<{
|
|
885
|
+
[k in keyof T]: ZodOptional<T[k]>;
|
|
886
|
+
}, UnknownKeys, Catchall>;
|
|
887
|
+
partial<Mask extends util.Exactly<{
|
|
888
|
+
[k in keyof T]?: true;
|
|
889
|
+
}, Mask>>(mask: Mask): ZodObject<objectUtil.noNever<{
|
|
890
|
+
[k in keyof T]: k extends keyof Mask ? ZodOptional<T[k]> : T[k];
|
|
891
|
+
}>, UnknownKeys, Catchall>;
|
|
892
|
+
required(): ZodObject<{
|
|
893
|
+
[k in keyof T]: deoptional<T[k]>;
|
|
894
|
+
}, UnknownKeys, Catchall>;
|
|
895
|
+
required<Mask extends util.Exactly<{
|
|
896
|
+
[k in keyof T]?: true;
|
|
897
|
+
}, Mask>>(mask: Mask): ZodObject<objectUtil.noNever<{
|
|
898
|
+
[k in keyof T]: k extends keyof Mask ? deoptional<T[k]> : T[k];
|
|
899
|
+
}>, UnknownKeys, Catchall>;
|
|
900
|
+
keyof(): ZodEnum<enumUtil.UnionToTupleString<keyof T>>;
|
|
901
|
+
static create: <T_1 extends ZodRawShape>(shape: T_1, params?: RawCreateParams) => ZodObject<T_1, "strip", ZodTypeAny, objectUtil.addQuestionMarks<baseObjectOutputType<T_1>, any> extends infer T_2 ? { [k in keyof T_2]: objectUtil.addQuestionMarks<baseObjectOutputType<T_1>, any>[k]; } : never, baseObjectInputType<T_1> extends infer T_3 ? { [k_1 in keyof T_3]: baseObjectInputType<T_1>[k_1]; } : never>;
|
|
902
|
+
static strictCreate: <T_1 extends ZodRawShape>(shape: T_1, params?: RawCreateParams) => ZodObject<T_1, "strict", ZodTypeAny, objectUtil.addQuestionMarks<baseObjectOutputType<T_1>, any> extends infer T_2 ? { [k in keyof T_2]: objectUtil.addQuestionMarks<baseObjectOutputType<T_1>, any>[k]; } : never, baseObjectInputType<T_1> extends infer T_3 ? { [k_1 in keyof T_3]: baseObjectInputType<T_1>[k_1]; } : never>;
|
|
903
|
+
static lazycreate: <T_1 extends ZodRawShape>(shape: () => T_1, params?: RawCreateParams) => ZodObject<T_1, "strip", ZodTypeAny, objectUtil.addQuestionMarks<baseObjectOutputType<T_1>, any> extends infer T_2 ? { [k in keyof T_2]: objectUtil.addQuestionMarks<baseObjectOutputType<T_1>, any>[k]; } : never, baseObjectInputType<T_1> extends infer T_3 ? { [k_1 in keyof T_3]: baseObjectInputType<T_1>[k_1]; } : never>;
|
|
904
|
+
}
|
|
905
|
+
type AnyZodObject = ZodObject<any, any, any>;
|
|
906
|
+
type ZodUnionOptions = Readonly<[ZodTypeAny, ...ZodTypeAny[]]>;
|
|
907
|
+
interface ZodUnionDef<T extends ZodUnionOptions = Readonly<[
|
|
908
|
+
ZodTypeAny,
|
|
909
|
+
ZodTypeAny,
|
|
910
|
+
...ZodTypeAny[]
|
|
911
|
+
]>> extends ZodTypeDef {
|
|
912
|
+
options: T;
|
|
913
|
+
typeName: ZodFirstPartyTypeKind.ZodUnion;
|
|
914
|
+
}
|
|
915
|
+
declare class ZodUnion<T extends ZodUnionOptions> extends ZodType<T[number]["_output"], ZodUnionDef<T>, T[number]["_input"]> {
|
|
916
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
917
|
+
get options(): T;
|
|
918
|
+
static create: <T_1 extends readonly [ZodTypeAny, ZodTypeAny, ...ZodTypeAny[]]>(types: T_1, params?: RawCreateParams) => ZodUnion<T_1>;
|
|
919
|
+
}
|
|
920
|
+
interface ZodIntersectionDef<T extends ZodTypeAny = ZodTypeAny, U extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
921
|
+
left: T;
|
|
922
|
+
right: U;
|
|
923
|
+
typeName: ZodFirstPartyTypeKind.ZodIntersection;
|
|
924
|
+
}
|
|
925
|
+
declare class ZodIntersection<T extends ZodTypeAny, U extends ZodTypeAny> extends ZodType<T["_output"] & U["_output"], ZodIntersectionDef<T, U>, T["_input"] & U["_input"]> {
|
|
926
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
927
|
+
static create: <T_1 extends ZodTypeAny, U_1 extends ZodTypeAny>(left: T_1, right: U_1, params?: RawCreateParams) => ZodIntersection<T_1, U_1>;
|
|
928
|
+
}
|
|
929
|
+
type ZodTupleItems = [ZodTypeAny, ...ZodTypeAny[]];
|
|
930
|
+
type AssertArray<T> = T extends any[] ? T : never;
|
|
931
|
+
type OutputTypeOfTuple<T extends ZodTupleItems | []> = AssertArray<{
|
|
932
|
+
[k in keyof T]: T[k] extends ZodType<any, any, any> ? T[k]["_output"] : never;
|
|
933
|
+
}>;
|
|
934
|
+
type OutputTypeOfTupleWithRest<T extends ZodTupleItems | [], Rest extends ZodTypeAny | null = null> = Rest extends ZodTypeAny ? [...OutputTypeOfTuple<T>, ...Rest["_output"][]] : OutputTypeOfTuple<T>;
|
|
935
|
+
type InputTypeOfTuple<T extends ZodTupleItems | []> = AssertArray<{
|
|
936
|
+
[k in keyof T]: T[k] extends ZodType<any, any, any> ? T[k]["_input"] : never;
|
|
937
|
+
}>;
|
|
938
|
+
type InputTypeOfTupleWithRest<T extends ZodTupleItems | [], Rest extends ZodTypeAny | null = null> = Rest extends ZodTypeAny ? [...InputTypeOfTuple<T>, ...Rest["_input"][]] : InputTypeOfTuple<T>;
|
|
939
|
+
interface ZodTupleDef<T extends ZodTupleItems | [] = ZodTupleItems, Rest extends ZodTypeAny | null = null> extends ZodTypeDef {
|
|
940
|
+
items: T;
|
|
941
|
+
rest: Rest;
|
|
942
|
+
typeName: ZodFirstPartyTypeKind.ZodTuple;
|
|
943
|
+
}
|
|
944
|
+
declare class ZodTuple<T extends [ZodTypeAny, ...ZodTypeAny[]] | [] = [ZodTypeAny, ...ZodTypeAny[]], Rest extends ZodTypeAny | null = null> extends ZodType<OutputTypeOfTupleWithRest<T, Rest>, ZodTupleDef<T, Rest>, InputTypeOfTupleWithRest<T, Rest>> {
|
|
945
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
946
|
+
get items(): T;
|
|
947
|
+
rest<Rest extends ZodTypeAny>(rest: Rest): ZodTuple<T, Rest>;
|
|
948
|
+
static create: <T_1 extends [] | [ZodTypeAny, ...ZodTypeAny[]]>(schemas: T_1, params?: RawCreateParams) => ZodTuple<T_1, null>;
|
|
949
|
+
}
|
|
950
|
+
type EnumValues<T extends string = string> = readonly [T, ...T[]];
|
|
951
|
+
type Values<T extends EnumValues> = {
|
|
952
|
+
[k in T[number]]: k;
|
|
953
|
+
};
|
|
954
|
+
interface ZodEnumDef<T extends EnumValues = EnumValues> extends ZodTypeDef {
|
|
955
|
+
values: T;
|
|
956
|
+
typeName: ZodFirstPartyTypeKind.ZodEnum;
|
|
957
|
+
}
|
|
958
|
+
type Writeable<T> = {
|
|
959
|
+
-readonly [P in keyof T]: T[P];
|
|
960
|
+
};
|
|
961
|
+
type FilterEnum<Values, ToExclude> = Values extends [] ? [] : Values extends [infer Head, ...infer Rest] ? Head extends ToExclude ? FilterEnum<Rest, ToExclude> : [Head, ...FilterEnum<Rest, ToExclude>] : never;
|
|
962
|
+
type typecast<A, T> = A extends T ? A : never;
|
|
963
|
+
declare function createZodEnum<U extends string, T extends Readonly<[U, ...U[]]>>(values: T, params?: RawCreateParams): ZodEnum<Writeable<T>>;
|
|
964
|
+
declare function createZodEnum<U extends string, T extends [U, ...U[]]>(values: T, params?: RawCreateParams): ZodEnum<T>;
|
|
965
|
+
declare class ZodEnum<T extends [string, ...string[]]> extends ZodType<T[number], ZodEnumDef<T>, T[number]> {
|
|
966
|
+
#private;
|
|
967
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
968
|
+
get options(): T;
|
|
969
|
+
get enum(): Values<T>;
|
|
970
|
+
get Values(): Values<T>;
|
|
971
|
+
get Enum(): Values<T>;
|
|
972
|
+
extract<ToExtract extends readonly [T[number], ...T[number][]]>(values: ToExtract, newDef?: RawCreateParams): ZodEnum<Writeable<ToExtract>>;
|
|
973
|
+
exclude<ToExclude extends readonly [T[number], ...T[number][]]>(values: ToExclude, newDef?: RawCreateParams): ZodEnum<typecast<Writeable<FilterEnum<T, ToExclude[number]>>, [string, ...string[]]>>;
|
|
974
|
+
static create: typeof createZodEnum;
|
|
975
|
+
}
|
|
976
|
+
interface ZodPromiseDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
977
|
+
type: T;
|
|
978
|
+
typeName: ZodFirstPartyTypeKind.ZodPromise;
|
|
979
|
+
}
|
|
980
|
+
declare class ZodPromise<T extends ZodTypeAny> extends ZodType<Promise<T["_output"]>, ZodPromiseDef<T>, Promise<T["_input"]>> {
|
|
981
|
+
unwrap(): T;
|
|
982
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
983
|
+
static create: <T_1 extends ZodTypeAny>(schema: T_1, params?: RawCreateParams) => ZodPromise<T_1>;
|
|
984
|
+
}
|
|
985
|
+
type RefinementEffect<T> = {
|
|
986
|
+
type: "refinement";
|
|
987
|
+
refinement: (arg: T, ctx: RefinementCtx) => any;
|
|
988
|
+
};
|
|
989
|
+
type TransformEffect<T> = {
|
|
990
|
+
type: "transform";
|
|
991
|
+
transform: (arg: T, ctx: RefinementCtx) => any;
|
|
992
|
+
};
|
|
993
|
+
type PreprocessEffect<T> = {
|
|
994
|
+
type: "preprocess";
|
|
995
|
+
transform: (arg: T, ctx: RefinementCtx) => any;
|
|
996
|
+
};
|
|
997
|
+
type Effect<T> = RefinementEffect<T> | TransformEffect<T> | PreprocessEffect<T>;
|
|
998
|
+
interface ZodEffectsDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
999
|
+
schema: T;
|
|
1000
|
+
typeName: ZodFirstPartyTypeKind.ZodEffects;
|
|
1001
|
+
effect: Effect<any>;
|
|
1002
|
+
}
|
|
1003
|
+
declare class ZodEffects<T extends ZodTypeAny, Output = output<T>, Input = input<T>> extends ZodType<Output, ZodEffectsDef<T>, Input> {
|
|
1004
|
+
innerType(): T;
|
|
1005
|
+
sourceType(): T;
|
|
1006
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1007
|
+
static create: <I extends ZodTypeAny>(schema: I, effect: Effect<I["_output"]>, params?: RawCreateParams) => ZodEffects<I, I["_output"]>;
|
|
1008
|
+
static createWithPreprocess: <I extends ZodTypeAny>(preprocess: (arg: unknown, ctx: RefinementCtx) => unknown, schema: I, params?: RawCreateParams) => ZodEffects<I, I["_output"], unknown>;
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
interface ZodOptionalDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1012
|
+
innerType: T;
|
|
1013
|
+
typeName: ZodFirstPartyTypeKind.ZodOptional;
|
|
1014
|
+
}
|
|
1015
|
+
declare class ZodOptional<T extends ZodTypeAny> extends ZodType<T["_output"] | undefined, ZodOptionalDef<T>, T["_input"] | undefined> {
|
|
1016
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1017
|
+
unwrap(): T;
|
|
1018
|
+
static create: <T_1 extends ZodTypeAny>(type: T_1, params?: RawCreateParams) => ZodOptional<T_1>;
|
|
1019
|
+
}
|
|
1020
|
+
interface ZodNullableDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1021
|
+
innerType: T;
|
|
1022
|
+
typeName: ZodFirstPartyTypeKind.ZodNullable;
|
|
1023
|
+
}
|
|
1024
|
+
declare class ZodNullable<T extends ZodTypeAny> extends ZodType<T["_output"] | null, ZodNullableDef<T>, T["_input"] | null> {
|
|
1025
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1026
|
+
unwrap(): T;
|
|
1027
|
+
static create: <T_1 extends ZodTypeAny>(type: T_1, params?: RawCreateParams) => ZodNullable<T_1>;
|
|
1028
|
+
}
|
|
1029
|
+
interface ZodDefaultDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1030
|
+
innerType: T;
|
|
1031
|
+
defaultValue: () => util.noUndefined<T["_input"]>;
|
|
1032
|
+
typeName: ZodFirstPartyTypeKind.ZodDefault;
|
|
1033
|
+
}
|
|
1034
|
+
declare class ZodDefault<T extends ZodTypeAny> extends ZodType<util.noUndefined<T["_output"]>, ZodDefaultDef<T>, T["_input"] | undefined> {
|
|
1035
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1036
|
+
removeDefault(): T;
|
|
1037
|
+
static create: <T_1 extends ZodTypeAny>(type: T_1, params: {
|
|
1038
|
+
errorMap?: ZodErrorMap | undefined;
|
|
1039
|
+
invalid_type_error?: string | undefined;
|
|
1040
|
+
required_error?: string | undefined;
|
|
1041
|
+
message?: string | undefined;
|
|
1042
|
+
description?: string | undefined;
|
|
1043
|
+
} & {
|
|
1044
|
+
default: T_1["_input"] | (() => util.noUndefined<T_1["_input"]>);
|
|
1045
|
+
}) => ZodDefault<T_1>;
|
|
1046
|
+
}
|
|
1047
|
+
interface ZodCatchDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1048
|
+
innerType: T;
|
|
1049
|
+
catchValue: (ctx: {
|
|
1050
|
+
error: ZodError;
|
|
1051
|
+
input: unknown;
|
|
1052
|
+
}) => T["_input"];
|
|
1053
|
+
typeName: ZodFirstPartyTypeKind.ZodCatch;
|
|
1054
|
+
}
|
|
1055
|
+
declare class ZodCatch<T extends ZodTypeAny> extends ZodType<T["_output"], ZodCatchDef<T>, unknown> {
|
|
1056
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1057
|
+
removeCatch(): T;
|
|
1058
|
+
static create: <T_1 extends ZodTypeAny>(type: T_1, params: {
|
|
1059
|
+
errorMap?: ZodErrorMap | undefined;
|
|
1060
|
+
invalid_type_error?: string | undefined;
|
|
1061
|
+
required_error?: string | undefined;
|
|
1062
|
+
message?: string | undefined;
|
|
1063
|
+
description?: string | undefined;
|
|
1064
|
+
} & {
|
|
1065
|
+
catch: T_1["_output"] | (() => T_1["_output"]);
|
|
1066
|
+
}) => ZodCatch<T_1>;
|
|
1067
|
+
}
|
|
1068
|
+
interface ZodBrandedDef<T extends ZodTypeAny> extends ZodTypeDef {
|
|
1069
|
+
type: T;
|
|
1070
|
+
typeName: ZodFirstPartyTypeKind.ZodBranded;
|
|
1071
|
+
}
|
|
1072
|
+
declare const BRAND: unique symbol;
|
|
1073
|
+
type BRAND<T extends string | number | symbol> = {
|
|
1074
|
+
[BRAND]: {
|
|
1075
|
+
[k in T]: true;
|
|
1076
|
+
};
|
|
1077
|
+
};
|
|
1078
|
+
declare class ZodBranded<T extends ZodTypeAny, B extends string | number | symbol> extends ZodType<T["_output"] & BRAND<B>, ZodBrandedDef<T>, T["_input"]> {
|
|
1079
|
+
_parse(input: ParseInput): ParseReturnType<any>;
|
|
1080
|
+
unwrap(): T;
|
|
1081
|
+
}
|
|
1082
|
+
interface ZodPipelineDef<A extends ZodTypeAny, B extends ZodTypeAny> extends ZodTypeDef {
|
|
1083
|
+
in: A;
|
|
1084
|
+
out: B;
|
|
1085
|
+
typeName: ZodFirstPartyTypeKind.ZodPipeline;
|
|
1086
|
+
}
|
|
1087
|
+
declare class ZodPipeline<A extends ZodTypeAny, B extends ZodTypeAny> extends ZodType<B["_output"], ZodPipelineDef<A, B>, A["_input"]> {
|
|
1088
|
+
_parse(input: ParseInput): ParseReturnType<any>;
|
|
1089
|
+
static create<A extends ZodTypeAny, B extends ZodTypeAny>(a: A, b: B): ZodPipeline<A, B>;
|
|
1090
|
+
}
|
|
1091
|
+
type BuiltIn = (((...args: any[]) => any) | (new (...args: any[]) => any)) | {
|
|
1092
|
+
readonly [Symbol.toStringTag]: string;
|
|
1093
|
+
} | Date | Error | Generator | Promise<unknown> | RegExp;
|
|
1094
|
+
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>;
|
|
1095
|
+
interface ZodReadonlyDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1096
|
+
innerType: T;
|
|
1097
|
+
typeName: ZodFirstPartyTypeKind.ZodReadonly;
|
|
1098
|
+
}
|
|
1099
|
+
declare class ZodReadonly<T extends ZodTypeAny> extends ZodType<MakeReadonly<T["_output"]>, ZodReadonlyDef<T>, MakeReadonly<T["_input"]>> {
|
|
1100
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1101
|
+
static create: <T_1 extends ZodTypeAny>(type: T_1, params?: RawCreateParams) => ZodReadonly<T_1>;
|
|
1102
|
+
unwrap(): T;
|
|
1103
|
+
}
|
|
1104
|
+
declare enum ZodFirstPartyTypeKind {
|
|
1105
|
+
ZodString = "ZodString",
|
|
1106
|
+
ZodNumber = "ZodNumber",
|
|
1107
|
+
ZodNaN = "ZodNaN",
|
|
1108
|
+
ZodBigInt = "ZodBigInt",
|
|
1109
|
+
ZodBoolean = "ZodBoolean",
|
|
1110
|
+
ZodDate = "ZodDate",
|
|
1111
|
+
ZodSymbol = "ZodSymbol",
|
|
1112
|
+
ZodUndefined = "ZodUndefined",
|
|
1113
|
+
ZodNull = "ZodNull",
|
|
1114
|
+
ZodAny = "ZodAny",
|
|
1115
|
+
ZodUnknown = "ZodUnknown",
|
|
1116
|
+
ZodNever = "ZodNever",
|
|
1117
|
+
ZodVoid = "ZodVoid",
|
|
1118
|
+
ZodArray = "ZodArray",
|
|
1119
|
+
ZodObject = "ZodObject",
|
|
1120
|
+
ZodUnion = "ZodUnion",
|
|
1121
|
+
ZodDiscriminatedUnion = "ZodDiscriminatedUnion",
|
|
1122
|
+
ZodIntersection = "ZodIntersection",
|
|
1123
|
+
ZodTuple = "ZodTuple",
|
|
1124
|
+
ZodRecord = "ZodRecord",
|
|
1125
|
+
ZodMap = "ZodMap",
|
|
1126
|
+
ZodSet = "ZodSet",
|
|
1127
|
+
ZodFunction = "ZodFunction",
|
|
1128
|
+
ZodLazy = "ZodLazy",
|
|
1129
|
+
ZodLiteral = "ZodLiteral",
|
|
1130
|
+
ZodEnum = "ZodEnum",
|
|
1131
|
+
ZodEffects = "ZodEffects",
|
|
1132
|
+
ZodNativeEnum = "ZodNativeEnum",
|
|
1133
|
+
ZodOptional = "ZodOptional",
|
|
1134
|
+
ZodNullable = "ZodNullable",
|
|
1135
|
+
ZodDefault = "ZodDefault",
|
|
1136
|
+
ZodCatch = "ZodCatch",
|
|
1137
|
+
ZodPromise = "ZodPromise",
|
|
1138
|
+
ZodBranded = "ZodBranded",
|
|
1139
|
+
ZodPipeline = "ZodPipeline",
|
|
1140
|
+
ZodReadonly = "ZodReadonly"
|
|
1141
|
+
}
|
|
1142
|
+
|
|
1143
|
+
declare const userSettingSchema: ZodObject<{
|
|
1144
|
+
version: ZodNumber;
|
|
1145
|
+
userSince: ZodOptional<ZodNumber>;
|
|
1146
|
+
init: ZodOptional<ZodObject<{
|
|
1147
|
+
skipOnboarding: ZodOptional<ZodBoolean>;
|
|
1148
|
+
}, "strip", ZodTypeAny, {
|
|
1149
|
+
skipOnboarding?: boolean | undefined;
|
|
1150
|
+
}, {
|
|
1151
|
+
skipOnboarding?: boolean | undefined;
|
|
1152
|
+
}>>;
|
|
1153
|
+
}, "strip", ZodTypeAny, {
|
|
1154
|
+
version: number;
|
|
1155
|
+
userSince?: number | undefined;
|
|
1156
|
+
init?: {
|
|
1157
|
+
skipOnboarding?: boolean | undefined;
|
|
1158
|
+
} | undefined;
|
|
1159
|
+
}, {
|
|
1160
|
+
version: number;
|
|
1161
|
+
userSince?: number | undefined;
|
|
1162
|
+
init?: {
|
|
1163
|
+
skipOnboarding?: boolean | undefined;
|
|
1164
|
+
} | undefined;
|
|
1165
|
+
}>;
|
|
1166
|
+
declare function globalSettings(filePath?: string): Promise<Settings>;
|
|
1167
|
+
declare function _clearGlobalSettings(): void;
|
|
1168
|
+
/**
|
|
1169
|
+
* A class for reading and writing settings from a JSON file. Supports nested settings with dot
|
|
1170
|
+
* notation.
|
|
1171
|
+
*/
|
|
1172
|
+
declare class Settings {
|
|
1173
|
+
private filePath;
|
|
1174
|
+
value: TypeOf<typeof userSettingSchema>;
|
|
1175
|
+
/**
|
|
1176
|
+
* Create a new Settings instance
|
|
1177
|
+
*
|
|
1178
|
+
* @param filePath Path to the JSON settings file
|
|
1179
|
+
* @param value Loaded value of settings
|
|
1180
|
+
*/
|
|
1181
|
+
constructor(filePath: string, value: TypeOf<typeof userSettingSchema>);
|
|
1182
|
+
/** Save settings to the file */
|
|
1183
|
+
save(): Promise<void>;
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
export { ANGULAR_JSON_PATH, AngularJSON, type Builder, CommunityBuilder, CoreBuilder, CoreWebpackCompilers, type ExternalFramework, type NpmOptions, ProjectType, SUPPORTED_ESLINT_EXTENSIONS, SUPPORTED_RENDERERS, Settings, SupportedLanguage, type TemplateConfiguration, type TemplateMatcher, _clearGlobalSettings, addToDevDependenciesIfNotPresent, adjustTemplate, builderNameToCoreBuilder, cliStoriesTargetPath, coerceSemver, compilerNameToCoreCompiler, compoDocPreviewPrefix, configureEslintPlugin, configureFlatConfig, copyTemplate, copyTemplateFiles, detect, detectBuilder, detectFrameworkPreset, detectLanguage, detectPnp, externalFrameworks, extractEslintInfo, findEslintFile, frameworkToDefaultBuilder, getBabelDependencies, getRendererDir, getStorybookVersionSpecifier, getVersionSafe, globalSettings, hasStorybookDependencies, installableProjectTypes, isNxProject, isStorybookInstantiated, normalizeExtends, promptForCompoDocs, readFileAsJson, suggestESLintPlugin, supportedTemplates, unsupportedTemplate, writeFileAsJson };
|