zod 4.0.0-beta.20250424T163858 → 4.0.0-beta.20250503T014749
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/commonjs/schemas.d.ts +29 -24
- package/dist/commonjs/schemas.js +25 -29
- package/dist/esm/schemas.d.ts +29 -24
- package/dist/esm/schemas.js +23 -27
- package/package.json +2 -2
- package/src/schemas.ts +64 -61
|
@@ -57,6 +57,26 @@ export interface _ZodString<Input = unknown> extends ZodType {
|
|
|
57
57
|
format: string | null;
|
|
58
58
|
minLength: number | null;
|
|
59
59
|
maxLength: number | null;
|
|
60
|
+
regex(regex: RegExp, params?: string | core.$ZodCheckRegexParams): this;
|
|
61
|
+
includes(value: string, params?: {
|
|
62
|
+
message?: string;
|
|
63
|
+
position?: number;
|
|
64
|
+
}): this;
|
|
65
|
+
startsWith(value: string, params?: string | core.$ZodCheckStartsWithParams): this;
|
|
66
|
+
endsWith(value: string, params?: string | core.$ZodCheckEndsWithParams): this;
|
|
67
|
+
min(minLength: number, params?: string | core.$ZodCheckMinLengthParams): this;
|
|
68
|
+
max(maxLength: number, params?: string | core.$ZodCheckMaxLengthParams): this;
|
|
69
|
+
length(len: number, params?: string | core.$ZodCheckLengthEqualsParams): this;
|
|
70
|
+
nonempty(params?: string | core.$ZodCheckMinLengthParams): this;
|
|
71
|
+
lowercase(params?: string | core.$ZodCheckLowerCaseParams): this;
|
|
72
|
+
uppercase(params?: string | core.$ZodCheckUpperCaseParams): this;
|
|
73
|
+
trim(): this;
|
|
74
|
+
normalize(form?: "NFC" | "NFD" | "NFKC" | "NFKD" | (string & {})): this;
|
|
75
|
+
toLowerCase(): this;
|
|
76
|
+
toUpperCase(): this;
|
|
77
|
+
}
|
|
78
|
+
export declare const _ZodString: core.$constructor<_ZodString>;
|
|
79
|
+
export interface ZodString extends _ZodString<string> {
|
|
60
80
|
/** @deprecated Use `z.email()` instead. */
|
|
61
81
|
email(params?: string | core.$ZodCheckEmailParams): this;
|
|
62
82
|
/** @deprecated Use `z.url()` instead. */
|
|
@@ -111,29 +131,10 @@ export interface _ZodString<Input = unknown> extends ZodType {
|
|
|
111
131
|
time(params?: string | core.$ZodCheckISOTimeParams): this;
|
|
112
132
|
/** @deprecated Use `z.iso.duration()` instead. */
|
|
113
133
|
duration(params?: string | core.$ZodCheckISODurationParams): this;
|
|
114
|
-
regex(regex: RegExp, params?: string | core.$ZodCheckRegexParams): this;
|
|
115
|
-
includes(value: string, params?: {
|
|
116
|
-
message?: string;
|
|
117
|
-
position?: number;
|
|
118
|
-
}): this;
|
|
119
|
-
startsWith(value: string, params?: string | core.$ZodCheckStartsWithParams): this;
|
|
120
|
-
endsWith(value: string, params?: string | core.$ZodCheckEndsWithParams): this;
|
|
121
|
-
min(minLength: number, params?: string | core.$ZodCheckMinLengthParams): this;
|
|
122
|
-
max(maxLength: number, params?: string | core.$ZodCheckMaxLengthParams): this;
|
|
123
|
-
length(len: number, params?: string | core.$ZodCheckLengthEqualsParams): this;
|
|
124
|
-
nonempty(params?: string | core.$ZodCheckMinLengthParams): this;
|
|
125
|
-
lowercase(params?: string | core.$ZodCheckLowerCaseParams): this;
|
|
126
|
-
uppercase(params?: string | core.$ZodCheckUpperCaseParams): this;
|
|
127
|
-
trim(): this;
|
|
128
|
-
normalize(form?: "NFC" | "NFD" | "NFKC" | "NFKD" | (string & {})): this;
|
|
129
|
-
toLowerCase(): this;
|
|
130
|
-
toUpperCase(): this;
|
|
131
|
-
}
|
|
132
|
-
export interface ZodString extends _ZodString<string> {
|
|
133
134
|
}
|
|
134
135
|
export declare const ZodString: core.$constructor<ZodString>;
|
|
135
136
|
export declare function string(params?: string | core.$ZodStringParams): ZodString;
|
|
136
|
-
export interface ZodStringFormat<Format extends core.$ZodStringFormats = core.$ZodStringFormats> extends
|
|
137
|
+
export interface ZodStringFormat<Format extends core.$ZodStringFormats = core.$ZodStringFormats> extends _ZodString {
|
|
137
138
|
_zod: core.$ZodStringFormatInternals<Format>;
|
|
138
139
|
}
|
|
139
140
|
export declare const ZodStringFormat: core.$constructor<ZodStringFormat>;
|
|
@@ -247,7 +248,7 @@ export interface _ZodNumber<Input = unknown> extends ZodType {
|
|
|
247
248
|
max(value: number, params?: string | core.$ZodCheckLessThanParams): this;
|
|
248
249
|
/** Consider `z.int()` instead. This API is considered *legacy*; it will never be removed but a better alternative exists. */
|
|
249
250
|
int(params?: string | core.$ZodCheckNumberFormatParams): this;
|
|
250
|
-
/** @deprecated This is now identical to `.int()
|
|
251
|
+
/** @deprecated This is now identical to `.int()`. Only numbers in the safe integer range are accepted. */
|
|
251
252
|
safe(params?: string | core.$ZodCheckNumberFormatParams): this;
|
|
252
253
|
positive(params?: string | core.$ZodCheckGreaterThanParams): this;
|
|
253
254
|
nonnegative(params?: string | core.$ZodCheckGreaterThanParams): this;
|
|
@@ -415,6 +416,7 @@ export interface ZodInterface<out Shape extends core.$ZodLooseShape = core.$ZodL
|
|
|
415
416
|
defaulted: Params["defaulted"];
|
|
416
417
|
extra: Record<string, T["_zod"]["output"]>;
|
|
417
418
|
}>;
|
|
419
|
+
/** Consider `z.strictObject({ ...A.shape })` instead. */
|
|
418
420
|
strict(): ZodInterface<Shape, {
|
|
419
421
|
optional: Params["optional"];
|
|
420
422
|
defaulted: Params["defaulted"];
|
|
@@ -425,6 +427,7 @@ export interface ZodInterface<out Shape extends core.$ZodLooseShape = core.$ZodL
|
|
|
425
427
|
defaulted: Params["defaulted"];
|
|
426
428
|
extra: Record<string, unknown>;
|
|
427
429
|
}>;
|
|
430
|
+
/** Use `z.looseObject({ ...A.shape })` instead. */
|
|
428
431
|
strip(): ZodInterface<Shape, {
|
|
429
432
|
optional: Params["optional"];
|
|
430
433
|
defaulted: Params["defaulted"];
|
|
@@ -458,17 +461,19 @@ export interface ZodObject<out Shape extends core.$ZodShape = core.$ZodShape, Ex
|
|
|
458
461
|
_zod: core.$ZodObjectInternals<Shape, Extra>;
|
|
459
462
|
shape: Shape;
|
|
460
463
|
keyof(): ZodEnum<util.ToEnum<keyof Shape & string>>;
|
|
464
|
+
/** Define a schema to validate all unrecognized keys. This overrides the existing strict/loose behavior. */
|
|
461
465
|
catchall<T extends core.$ZodType>(schema: T): ZodObject<Shape, Record<string, T["_zod"]["output"]>>;
|
|
462
466
|
/** @deprecated Use `z.looseObject()` or `.loose()` instead. */
|
|
463
467
|
passthrough(): ZodObject<Shape, Record<string, unknown>>;
|
|
468
|
+
/** Consider `z.looseObject(A.shape)` instead */
|
|
464
469
|
loose(): ZodObject<Shape, Record<string, unknown>>;
|
|
465
|
-
/**
|
|
470
|
+
/** Consider `z.strictObject(A.shape)` instead */
|
|
466
471
|
strict(): ZodObject<Shape, {}>;
|
|
467
|
-
/**
|
|
472
|
+
/** This is the default behavior. This method call is likely unnecessary. */
|
|
468
473
|
strip(): ZodObject<Shape, {}>;
|
|
469
474
|
extend<const U extends ZodObject>(schema: U): ZodObject<util.Extend<Shape, U["_zod"]["def"]["shape"]>, Extra>;
|
|
470
475
|
extend<U extends core.$ZodShape>(shape: U): ZodObject<util.Extend<Shape, U>, Extra>;
|
|
471
|
-
/** @deprecated Use `A.extend(B)` */
|
|
476
|
+
/** @deprecated Use `A.extend(B.shape)` */
|
|
472
477
|
merge<U extends ZodObject<any, any>>(other: U): ZodObject<util.Flatten<util.Extend<Shape, U["_zod"]["def"]["shape"]>>, Extra>;
|
|
473
478
|
pick<M extends util.Exactly<util.Mask<string & keyof Shape>, M>>(mask: M): ZodObject<util.Flatten<Pick<Shape, Extract<keyof Shape, keyof M>>>, Extra>;
|
|
474
479
|
omit<M extends util.Exactly<util.Mask<string & keyof Shape>, M>>(mask: M): ZodObject<util.Flatten<Omit<Shape, Extract<keyof Shape, keyof M>>>, Extra>;
|
package/dist/commonjs/schemas.js
CHANGED
|
@@ -23,8 +23,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
27
|
-
exports.stringbool = exports.ZodCustom = exports.ZodPromise = exports.ZodLazy = exports.ZodTemplateLiteral = exports.ZodReadonly = exports.ZodPipe = exports.ZodNaN = exports.ZodCatch = exports.ZodSuccess = exports.ZodNonOptional = exports.ZodDefault = exports.ZodNullable = exports.ZodOptional = exports.ZodTransform = exports.ZodFile = void 0;
|
|
26
|
+
exports.ZodEnum = exports.ZodSet = exports.ZodMap = exports.ZodRecord = exports.ZodTuple = exports.ZodIntersection = exports.ZodDiscriminatedUnion = exports.ZodUnion = exports.ZodObject = exports.ZodInterface = exports.ZodObjectLike = exports.ZodArray = exports.ZodDate = exports.ZodVoid = exports.ZodNever = exports.ZodUnknown = exports.ZodAny = exports.ZodNull = exports.ZodUndefined = exports.ZodSymbol = exports.ZodBigIntFormat = exports.ZodBigInt = exports.ZodBoolean = exports.ZodNumberFormat = exports.ZodNumber = exports.ZodJWT = exports.ZodE164 = exports.ZodBase64URL = exports.ZodBase64 = exports.ZodCIDRv6 = exports.ZodCIDRv4 = exports.ZodIPv6 = exports.ZodIPv4 = exports.ZodKSUID = exports.ZodXID = exports.ZodULID = exports.ZodCUID2 = exports.ZodCUID = exports.ZodNanoID = exports.ZodEmoji = exports.ZodURL = exports.ZodUUID = exports.ZodGUID = exports.ZodEmail = exports.ZodStringFormat = exports.ZodString = exports._ZodString = exports.ZodType = exports.coerce = exports.iso = void 0;
|
|
27
|
+
exports.stringbool = exports.ZodCustom = exports.ZodPromise = exports.ZodLazy = exports.ZodTemplateLiteral = exports.ZodReadonly = exports.ZodPipe = exports.ZodNaN = exports.ZodCatch = exports.ZodSuccess = exports.ZodNonOptional = exports.ZodDefault = exports.ZodNullable = exports.ZodOptional = exports.ZodTransform = exports.ZodFile = exports.ZodLiteral = void 0;
|
|
28
28
|
exports.string = string;
|
|
29
29
|
exports.email = email;
|
|
30
30
|
exports.guid = guid;
|
|
@@ -190,12 +190,32 @@ exports.ZodType = core.$constructor("ZodType", (inst, def) => {
|
|
|
190
190
|
inst.isNullable = () => inst.safeParse(null).success;
|
|
191
191
|
return inst;
|
|
192
192
|
});
|
|
193
|
-
exports.
|
|
193
|
+
exports._ZodString = core.$constructor("_ZodString", (inst, def) => {
|
|
194
194
|
core.$ZodString.init(inst, def);
|
|
195
195
|
exports.ZodType.init(inst, def);
|
|
196
196
|
inst.format = inst._zod.computed.format ?? null;
|
|
197
197
|
inst.minLength = inst._zod.computed.minimum ?? null;
|
|
198
198
|
inst.maxLength = inst._zod.computed.maximum ?? null;
|
|
199
|
+
// validations
|
|
200
|
+
inst.regex = (...args) => inst.check(checks.regex(...args));
|
|
201
|
+
inst.includes = (...args) => inst.check(checks.includes(...args));
|
|
202
|
+
inst.startsWith = (params) => inst.check(checks.startsWith(params));
|
|
203
|
+
inst.endsWith = (params) => inst.check(checks.endsWith(params));
|
|
204
|
+
inst.min = (...args) => inst.check(checks.minLength(...args));
|
|
205
|
+
inst.max = (...args) => inst.check(checks.maxLength(...args));
|
|
206
|
+
inst.length = (...args) => inst.check(checks.length(...args));
|
|
207
|
+
inst.nonempty = (...args) => inst.check(checks.minLength(1, ...args));
|
|
208
|
+
inst.lowercase = (params) => inst.check(checks.lowercase(params));
|
|
209
|
+
inst.uppercase = (params) => inst.check(checks.uppercase(params));
|
|
210
|
+
// transforms
|
|
211
|
+
inst.trim = () => inst.check(checks.trim());
|
|
212
|
+
inst.normalize = (...args) => inst.check(checks.normalize(...args));
|
|
213
|
+
inst.toLowerCase = () => inst.check(checks.toLowerCase());
|
|
214
|
+
inst.toUpperCase = () => inst.check(checks.toUpperCase());
|
|
215
|
+
});
|
|
216
|
+
exports.ZodString = core.$constructor("ZodString", (inst, def) => {
|
|
217
|
+
core.$ZodString.init(inst, def);
|
|
218
|
+
exports._ZodString.init(inst, def);
|
|
199
219
|
inst.email = (params) => inst.check(core._email(exports.ZodEmail, params));
|
|
200
220
|
inst.url = (params) => inst.check(core._url(exports.ZodURL, params));
|
|
201
221
|
inst.jwt = (params) => inst.check(core._jwt(exports.ZodJWT, params));
|
|
@@ -212,16 +232,8 @@ exports.ZodString = core.$constructor("ZodString", (inst, def) => {
|
|
|
212
232
|
inst.ulid = (params) => inst.check(core._ulid(exports.ZodULID, params));
|
|
213
233
|
inst.base64 = (params) => inst.check(core._base64(exports.ZodBase64, params));
|
|
214
234
|
inst.base64url = (params) => inst.check(core._base64url(exports.ZodBase64URL, params));
|
|
215
|
-
// inst.jsonString = (params) => inst.check(core._jsonString(Zodinst,params));
|
|
216
|
-
// inst.json = (params) => inst.check(core._jsonString(Zodinst,params));
|
|
217
235
|
inst.xid = (params) => inst.check(core._xid(exports.ZodXID, params));
|
|
218
236
|
inst.ksuid = (params) => inst.check(core._ksuid(exports.ZodKSUID, params));
|
|
219
|
-
// inst.ip = (params) => {
|
|
220
|
-
// const version = (params ?? {} as any)?.version;
|
|
221
|
-
// if (version === "v4") return inst.check(core._ipv4(ZodIPv4, params));
|
|
222
|
-
// if (version === "v6") return inst.check(core._ipv6(ZodIPv6, params as any));
|
|
223
|
-
// return union([inst.ipv4(params), inst.ipv6(params as any)]);
|
|
224
|
-
// };
|
|
225
237
|
inst.ipv4 = (params) => inst.check(core._ipv4(exports.ZodIPv4, params));
|
|
226
238
|
inst.ipv6 = (params) => inst.check(core._ipv6(exports.ZodIPv6, params));
|
|
227
239
|
inst.cidrv4 = (params) => inst.check(core._cidrv4(exports.ZodCIDRv4, params));
|
|
@@ -232,29 +244,13 @@ exports.ZodString = core.$constructor("ZodString", (inst, def) => {
|
|
|
232
244
|
inst.date = (params) => inst.check(iso.date(params));
|
|
233
245
|
inst.time = (params) => inst.check(iso.time(params));
|
|
234
246
|
inst.duration = (params) => inst.check(iso.duration(params));
|
|
235
|
-
// validations
|
|
236
|
-
inst.regex = (...args) => inst.check(checks.regex(...args));
|
|
237
|
-
inst.includes = (...args) => inst.check(checks.includes(...args));
|
|
238
|
-
inst.startsWith = (params) => inst.check(checks.startsWith(params));
|
|
239
|
-
inst.endsWith = (params) => inst.check(checks.endsWith(params));
|
|
240
|
-
inst.min = (...args) => inst.check(checks.minLength(...args));
|
|
241
|
-
inst.max = (...args) => inst.check(checks.maxLength(...args));
|
|
242
|
-
inst.length = (...args) => inst.check(checks.length(...args));
|
|
243
|
-
inst.nonempty = (...args) => inst.check(checks.minLength(1, ...args));
|
|
244
|
-
inst.lowercase = (params) => inst.check(checks.lowercase(params));
|
|
245
|
-
inst.uppercase = (params) => inst.check(checks.uppercase(params));
|
|
246
|
-
// transforms
|
|
247
|
-
inst.trim = () => inst.check(checks.trim());
|
|
248
|
-
inst.normalize = (...args) => inst.check(checks.normalize(...args));
|
|
249
|
-
inst.toLowerCase = () => inst.check(checks.toLowerCase());
|
|
250
|
-
inst.toUpperCase = () => inst.check(checks.toUpperCase());
|
|
251
247
|
});
|
|
252
248
|
function string(params) {
|
|
253
249
|
return core._string(exports.ZodString, params);
|
|
254
250
|
}
|
|
255
251
|
exports.ZodStringFormat = core.$constructor("ZodStringFormat", (inst, def) => {
|
|
256
252
|
core.$ZodStringFormat.init(inst, def);
|
|
257
|
-
exports.
|
|
253
|
+
exports._ZodString.init(inst, def);
|
|
258
254
|
});
|
|
259
255
|
exports.ZodEmail = core.$constructor("ZodEmail", (inst, def) => {
|
|
260
256
|
// ZodStringFormat.init(inst, def);
|
|
@@ -448,7 +444,7 @@ function number(params) {
|
|
|
448
444
|
}
|
|
449
445
|
exports.ZodNumberFormat = core.$constructor("ZodNumberFormat", (inst, def) => {
|
|
450
446
|
core.$ZodNumberFormat.init(inst, def);
|
|
451
|
-
exports.
|
|
447
|
+
exports.ZodNumber.init(inst, def);
|
|
452
448
|
});
|
|
453
449
|
function int(params) {
|
|
454
450
|
return core._int(exports.ZodNumberFormat, params);
|
package/dist/esm/schemas.d.ts
CHANGED
|
@@ -57,6 +57,26 @@ export interface _ZodString<Input = unknown> extends ZodType {
|
|
|
57
57
|
format: string | null;
|
|
58
58
|
minLength: number | null;
|
|
59
59
|
maxLength: number | null;
|
|
60
|
+
regex(regex: RegExp, params?: string | core.$ZodCheckRegexParams): this;
|
|
61
|
+
includes(value: string, params?: {
|
|
62
|
+
message?: string;
|
|
63
|
+
position?: number;
|
|
64
|
+
}): this;
|
|
65
|
+
startsWith(value: string, params?: string | core.$ZodCheckStartsWithParams): this;
|
|
66
|
+
endsWith(value: string, params?: string | core.$ZodCheckEndsWithParams): this;
|
|
67
|
+
min(minLength: number, params?: string | core.$ZodCheckMinLengthParams): this;
|
|
68
|
+
max(maxLength: number, params?: string | core.$ZodCheckMaxLengthParams): this;
|
|
69
|
+
length(len: number, params?: string | core.$ZodCheckLengthEqualsParams): this;
|
|
70
|
+
nonempty(params?: string | core.$ZodCheckMinLengthParams): this;
|
|
71
|
+
lowercase(params?: string | core.$ZodCheckLowerCaseParams): this;
|
|
72
|
+
uppercase(params?: string | core.$ZodCheckUpperCaseParams): this;
|
|
73
|
+
trim(): this;
|
|
74
|
+
normalize(form?: "NFC" | "NFD" | "NFKC" | "NFKD" | (string & {})): this;
|
|
75
|
+
toLowerCase(): this;
|
|
76
|
+
toUpperCase(): this;
|
|
77
|
+
}
|
|
78
|
+
export declare const _ZodString: core.$constructor<_ZodString>;
|
|
79
|
+
export interface ZodString extends _ZodString<string> {
|
|
60
80
|
/** @deprecated Use `z.email()` instead. */
|
|
61
81
|
email(params?: string | core.$ZodCheckEmailParams): this;
|
|
62
82
|
/** @deprecated Use `z.url()` instead. */
|
|
@@ -111,29 +131,10 @@ export interface _ZodString<Input = unknown> extends ZodType {
|
|
|
111
131
|
time(params?: string | core.$ZodCheckISOTimeParams): this;
|
|
112
132
|
/** @deprecated Use `z.iso.duration()` instead. */
|
|
113
133
|
duration(params?: string | core.$ZodCheckISODurationParams): this;
|
|
114
|
-
regex(regex: RegExp, params?: string | core.$ZodCheckRegexParams): this;
|
|
115
|
-
includes(value: string, params?: {
|
|
116
|
-
message?: string;
|
|
117
|
-
position?: number;
|
|
118
|
-
}): this;
|
|
119
|
-
startsWith(value: string, params?: string | core.$ZodCheckStartsWithParams): this;
|
|
120
|
-
endsWith(value: string, params?: string | core.$ZodCheckEndsWithParams): this;
|
|
121
|
-
min(minLength: number, params?: string | core.$ZodCheckMinLengthParams): this;
|
|
122
|
-
max(maxLength: number, params?: string | core.$ZodCheckMaxLengthParams): this;
|
|
123
|
-
length(len: number, params?: string | core.$ZodCheckLengthEqualsParams): this;
|
|
124
|
-
nonempty(params?: string | core.$ZodCheckMinLengthParams): this;
|
|
125
|
-
lowercase(params?: string | core.$ZodCheckLowerCaseParams): this;
|
|
126
|
-
uppercase(params?: string | core.$ZodCheckUpperCaseParams): this;
|
|
127
|
-
trim(): this;
|
|
128
|
-
normalize(form?: "NFC" | "NFD" | "NFKC" | "NFKD" | (string & {})): this;
|
|
129
|
-
toLowerCase(): this;
|
|
130
|
-
toUpperCase(): this;
|
|
131
|
-
}
|
|
132
|
-
export interface ZodString extends _ZodString<string> {
|
|
133
134
|
}
|
|
134
135
|
export declare const ZodString: core.$constructor<ZodString>;
|
|
135
136
|
export declare function string(params?: string | core.$ZodStringParams): ZodString;
|
|
136
|
-
export interface ZodStringFormat<Format extends core.$ZodStringFormats = core.$ZodStringFormats> extends
|
|
137
|
+
export interface ZodStringFormat<Format extends core.$ZodStringFormats = core.$ZodStringFormats> extends _ZodString {
|
|
137
138
|
_zod: core.$ZodStringFormatInternals<Format>;
|
|
138
139
|
}
|
|
139
140
|
export declare const ZodStringFormat: core.$constructor<ZodStringFormat>;
|
|
@@ -247,7 +248,7 @@ export interface _ZodNumber<Input = unknown> extends ZodType {
|
|
|
247
248
|
max(value: number, params?: string | core.$ZodCheckLessThanParams): this;
|
|
248
249
|
/** Consider `z.int()` instead. This API is considered *legacy*; it will never be removed but a better alternative exists. */
|
|
249
250
|
int(params?: string | core.$ZodCheckNumberFormatParams): this;
|
|
250
|
-
/** @deprecated This is now identical to `.int()
|
|
251
|
+
/** @deprecated This is now identical to `.int()`. Only numbers in the safe integer range are accepted. */
|
|
251
252
|
safe(params?: string | core.$ZodCheckNumberFormatParams): this;
|
|
252
253
|
positive(params?: string | core.$ZodCheckGreaterThanParams): this;
|
|
253
254
|
nonnegative(params?: string | core.$ZodCheckGreaterThanParams): this;
|
|
@@ -415,6 +416,7 @@ export interface ZodInterface<out Shape extends core.$ZodLooseShape = core.$ZodL
|
|
|
415
416
|
defaulted: Params["defaulted"];
|
|
416
417
|
extra: Record<string, T["_zod"]["output"]>;
|
|
417
418
|
}>;
|
|
419
|
+
/** Consider `z.strictObject({ ...A.shape })` instead. */
|
|
418
420
|
strict(): ZodInterface<Shape, {
|
|
419
421
|
optional: Params["optional"];
|
|
420
422
|
defaulted: Params["defaulted"];
|
|
@@ -425,6 +427,7 @@ export interface ZodInterface<out Shape extends core.$ZodLooseShape = core.$ZodL
|
|
|
425
427
|
defaulted: Params["defaulted"];
|
|
426
428
|
extra: Record<string, unknown>;
|
|
427
429
|
}>;
|
|
430
|
+
/** Use `z.looseObject({ ...A.shape })` instead. */
|
|
428
431
|
strip(): ZodInterface<Shape, {
|
|
429
432
|
optional: Params["optional"];
|
|
430
433
|
defaulted: Params["defaulted"];
|
|
@@ -458,17 +461,19 @@ export interface ZodObject<out Shape extends core.$ZodShape = core.$ZodShape, Ex
|
|
|
458
461
|
_zod: core.$ZodObjectInternals<Shape, Extra>;
|
|
459
462
|
shape: Shape;
|
|
460
463
|
keyof(): ZodEnum<util.ToEnum<keyof Shape & string>>;
|
|
464
|
+
/** Define a schema to validate all unrecognized keys. This overrides the existing strict/loose behavior. */
|
|
461
465
|
catchall<T extends core.$ZodType>(schema: T): ZodObject<Shape, Record<string, T["_zod"]["output"]>>;
|
|
462
466
|
/** @deprecated Use `z.looseObject()` or `.loose()` instead. */
|
|
463
467
|
passthrough(): ZodObject<Shape, Record<string, unknown>>;
|
|
468
|
+
/** Consider `z.looseObject(A.shape)` instead */
|
|
464
469
|
loose(): ZodObject<Shape, Record<string, unknown>>;
|
|
465
|
-
/**
|
|
470
|
+
/** Consider `z.strictObject(A.shape)` instead */
|
|
466
471
|
strict(): ZodObject<Shape, {}>;
|
|
467
|
-
/**
|
|
472
|
+
/** This is the default behavior. This method call is likely unnecessary. */
|
|
468
473
|
strip(): ZodObject<Shape, {}>;
|
|
469
474
|
extend<const U extends ZodObject>(schema: U): ZodObject<util.Extend<Shape, U["_zod"]["def"]["shape"]>, Extra>;
|
|
470
475
|
extend<U extends core.$ZodShape>(shape: U): ZodObject<util.Extend<Shape, U>, Extra>;
|
|
471
|
-
/** @deprecated Use `A.extend(B)` */
|
|
476
|
+
/** @deprecated Use `A.extend(B.shape)` */
|
|
472
477
|
merge<U extends ZodObject<any, any>>(other: U): ZodObject<util.Flatten<util.Extend<Shape, U["_zod"]["def"]["shape"]>>, Extra>;
|
|
473
478
|
pick<M extends util.Exactly<util.Mask<string & keyof Shape>, M>>(mask: M): ZodObject<util.Flatten<Pick<Shape, Extract<keyof Shape, keyof M>>>, Extra>;
|
|
474
479
|
omit<M extends util.Exactly<util.Mask<string & keyof Shape>, M>>(mask: M): ZodObject<util.Flatten<Omit<Shape, Extract<keyof Shape, keyof M>>>, Extra>;
|
package/dist/esm/schemas.js
CHANGED
|
@@ -75,12 +75,32 @@ export const ZodType = /*@__PURE__*/ core.$constructor("ZodType", (inst, def) =>
|
|
|
75
75
|
inst.isNullable = () => inst.safeParse(null).success;
|
|
76
76
|
return inst;
|
|
77
77
|
});
|
|
78
|
-
export const
|
|
78
|
+
export const _ZodString = /*@__PURE__*/ core.$constructor("_ZodString", (inst, def) => {
|
|
79
79
|
core.$ZodString.init(inst, def);
|
|
80
80
|
ZodType.init(inst, def);
|
|
81
81
|
inst.format = inst._zod.computed.format ?? null;
|
|
82
82
|
inst.minLength = inst._zod.computed.minimum ?? null;
|
|
83
83
|
inst.maxLength = inst._zod.computed.maximum ?? null;
|
|
84
|
+
// validations
|
|
85
|
+
inst.regex = (...args) => inst.check(checks.regex(...args));
|
|
86
|
+
inst.includes = (...args) => inst.check(checks.includes(...args));
|
|
87
|
+
inst.startsWith = (params) => inst.check(checks.startsWith(params));
|
|
88
|
+
inst.endsWith = (params) => inst.check(checks.endsWith(params));
|
|
89
|
+
inst.min = (...args) => inst.check(checks.minLength(...args));
|
|
90
|
+
inst.max = (...args) => inst.check(checks.maxLength(...args));
|
|
91
|
+
inst.length = (...args) => inst.check(checks.length(...args));
|
|
92
|
+
inst.nonempty = (...args) => inst.check(checks.minLength(1, ...args));
|
|
93
|
+
inst.lowercase = (params) => inst.check(checks.lowercase(params));
|
|
94
|
+
inst.uppercase = (params) => inst.check(checks.uppercase(params));
|
|
95
|
+
// transforms
|
|
96
|
+
inst.trim = () => inst.check(checks.trim());
|
|
97
|
+
inst.normalize = (...args) => inst.check(checks.normalize(...args));
|
|
98
|
+
inst.toLowerCase = () => inst.check(checks.toLowerCase());
|
|
99
|
+
inst.toUpperCase = () => inst.check(checks.toUpperCase());
|
|
100
|
+
});
|
|
101
|
+
export const ZodString = /*@__PURE__*/ core.$constructor("ZodString", (inst, def) => {
|
|
102
|
+
core.$ZodString.init(inst, def);
|
|
103
|
+
_ZodString.init(inst, def);
|
|
84
104
|
inst.email = (params) => inst.check(core._email(ZodEmail, params));
|
|
85
105
|
inst.url = (params) => inst.check(core._url(ZodURL, params));
|
|
86
106
|
inst.jwt = (params) => inst.check(core._jwt(ZodJWT, params));
|
|
@@ -97,16 +117,8 @@ export const ZodString = /*@__PURE__*/ core.$constructor("ZodString", (inst, def
|
|
|
97
117
|
inst.ulid = (params) => inst.check(core._ulid(ZodULID, params));
|
|
98
118
|
inst.base64 = (params) => inst.check(core._base64(ZodBase64, params));
|
|
99
119
|
inst.base64url = (params) => inst.check(core._base64url(ZodBase64URL, params));
|
|
100
|
-
// inst.jsonString = (params) => inst.check(core._jsonString(Zodinst,params));
|
|
101
|
-
// inst.json = (params) => inst.check(core._jsonString(Zodinst,params));
|
|
102
120
|
inst.xid = (params) => inst.check(core._xid(ZodXID, params));
|
|
103
121
|
inst.ksuid = (params) => inst.check(core._ksuid(ZodKSUID, params));
|
|
104
|
-
// inst.ip = (params) => {
|
|
105
|
-
// const version = (params ?? {} as any)?.version;
|
|
106
|
-
// if (version === "v4") return inst.check(core._ipv4(ZodIPv4, params));
|
|
107
|
-
// if (version === "v6") return inst.check(core._ipv6(ZodIPv6, params as any));
|
|
108
|
-
// return union([inst.ipv4(params), inst.ipv6(params as any)]);
|
|
109
|
-
// };
|
|
110
122
|
inst.ipv4 = (params) => inst.check(core._ipv4(ZodIPv4, params));
|
|
111
123
|
inst.ipv6 = (params) => inst.check(core._ipv6(ZodIPv6, params));
|
|
112
124
|
inst.cidrv4 = (params) => inst.check(core._cidrv4(ZodCIDRv4, params));
|
|
@@ -117,29 +129,13 @@ export const ZodString = /*@__PURE__*/ core.$constructor("ZodString", (inst, def
|
|
|
117
129
|
inst.date = (params) => inst.check(iso.date(params));
|
|
118
130
|
inst.time = (params) => inst.check(iso.time(params));
|
|
119
131
|
inst.duration = (params) => inst.check(iso.duration(params));
|
|
120
|
-
// validations
|
|
121
|
-
inst.regex = (...args) => inst.check(checks.regex(...args));
|
|
122
|
-
inst.includes = (...args) => inst.check(checks.includes(...args));
|
|
123
|
-
inst.startsWith = (params) => inst.check(checks.startsWith(params));
|
|
124
|
-
inst.endsWith = (params) => inst.check(checks.endsWith(params));
|
|
125
|
-
inst.min = (...args) => inst.check(checks.minLength(...args));
|
|
126
|
-
inst.max = (...args) => inst.check(checks.maxLength(...args));
|
|
127
|
-
inst.length = (...args) => inst.check(checks.length(...args));
|
|
128
|
-
inst.nonempty = (...args) => inst.check(checks.minLength(1, ...args));
|
|
129
|
-
inst.lowercase = (params) => inst.check(checks.lowercase(params));
|
|
130
|
-
inst.uppercase = (params) => inst.check(checks.uppercase(params));
|
|
131
|
-
// transforms
|
|
132
|
-
inst.trim = () => inst.check(checks.trim());
|
|
133
|
-
inst.normalize = (...args) => inst.check(checks.normalize(...args));
|
|
134
|
-
inst.toLowerCase = () => inst.check(checks.toLowerCase());
|
|
135
|
-
inst.toUpperCase = () => inst.check(checks.toUpperCase());
|
|
136
132
|
});
|
|
137
133
|
export function string(params) {
|
|
138
134
|
return core._string(ZodString, params);
|
|
139
135
|
}
|
|
140
136
|
export const ZodStringFormat = /*@__PURE__*/ core.$constructor("ZodStringFormat", (inst, def) => {
|
|
141
137
|
core.$ZodStringFormat.init(inst, def);
|
|
142
|
-
|
|
138
|
+
_ZodString.init(inst, def);
|
|
143
139
|
});
|
|
144
140
|
export const ZodEmail = /*@__PURE__*/ core.$constructor("ZodEmail", (inst, def) => {
|
|
145
141
|
// ZodStringFormat.init(inst, def);
|
|
@@ -333,7 +329,7 @@ export function number(params) {
|
|
|
333
329
|
}
|
|
334
330
|
export const ZodNumberFormat = /*@__PURE__*/ core.$constructor("ZodNumberFormat", (inst, def) => {
|
|
335
331
|
core.$ZodNumberFormat.init(inst, def);
|
|
336
|
-
|
|
332
|
+
ZodNumber.init(inst, def);
|
|
337
333
|
});
|
|
338
334
|
export function int(params) {
|
|
339
335
|
return core._int(ZodNumberFormat, params);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zod",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.20250503T014749",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "Colin McDonnell <zod@colinhacks.com>",
|
|
6
6
|
"description": "TypeScript-first schema declaration and validation library with static type inference",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
}
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@zod/core": "0.
|
|
73
|
+
"@zod/core": "0.10.1"
|
|
74
74
|
},
|
|
75
75
|
"scripts": {
|
|
76
76
|
"clean": "rm -rf dist",
|
package/src/schemas.ts
CHANGED
|
@@ -182,6 +182,56 @@ export interface _ZodString<Input = unknown> extends ZodType {
|
|
|
182
182
|
minLength: number | null;
|
|
183
183
|
maxLength: number | null;
|
|
184
184
|
|
|
185
|
+
// /** @deprecated Use `z.jsonString()` instead. */
|
|
186
|
+
// json(params?: string | core.$ZodCheckJSONStringParams): this;
|
|
187
|
+
|
|
188
|
+
// miscellaneous checks
|
|
189
|
+
regex(regex: RegExp, params?: string | core.$ZodCheckRegexParams): this;
|
|
190
|
+
includes(value: string, params?: { message?: string; position?: number }): this;
|
|
191
|
+
startsWith(value: string, params?: string | core.$ZodCheckStartsWithParams): this;
|
|
192
|
+
endsWith(value: string, params?: string | core.$ZodCheckEndsWithParams): this;
|
|
193
|
+
min(minLength: number, params?: string | core.$ZodCheckMinLengthParams): this;
|
|
194
|
+
max(maxLength: number, params?: string | core.$ZodCheckMaxLengthParams): this;
|
|
195
|
+
length(len: number, params?: string | core.$ZodCheckLengthEqualsParams): this;
|
|
196
|
+
nonempty(params?: string | core.$ZodCheckMinLengthParams): this;
|
|
197
|
+
lowercase(params?: string | core.$ZodCheckLowerCaseParams): this;
|
|
198
|
+
uppercase(params?: string | core.$ZodCheckUpperCaseParams): this;
|
|
199
|
+
|
|
200
|
+
// transforms
|
|
201
|
+
trim(): this;
|
|
202
|
+
normalize(form?: "NFC" | "NFD" | "NFKC" | "NFKD" | (string & {})): this;
|
|
203
|
+
toLowerCase(): this;
|
|
204
|
+
toUpperCase(): this;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export const _ZodString: core.$constructor<_ZodString> = /*@__PURE__*/ core.$constructor("_ZodString", (inst, def) => {
|
|
208
|
+
core.$ZodString.init(inst, def);
|
|
209
|
+
ZodType.init(inst, def);
|
|
210
|
+
|
|
211
|
+
inst.format = inst._zod.computed.format ?? null;
|
|
212
|
+
inst.minLength = inst._zod.computed.minimum ?? null;
|
|
213
|
+
inst.maxLength = inst._zod.computed.maximum ?? null;
|
|
214
|
+
|
|
215
|
+
// validations
|
|
216
|
+
inst.regex = (...args) => inst.check(checks.regex(...args));
|
|
217
|
+
inst.includes = (...args) => inst.check(checks.includes(...args));
|
|
218
|
+
inst.startsWith = (params) => inst.check(checks.startsWith(params));
|
|
219
|
+
inst.endsWith = (params) => inst.check(checks.endsWith(params));
|
|
220
|
+
inst.min = (...args) => inst.check(checks.minLength(...args));
|
|
221
|
+
inst.max = (...args) => inst.check(checks.maxLength(...args));
|
|
222
|
+
inst.length = (...args) => inst.check(checks.length(...args));
|
|
223
|
+
inst.nonempty = (...args) => inst.check(checks.minLength(1, ...args));
|
|
224
|
+
inst.lowercase = (params) => inst.check(checks.lowercase(params));
|
|
225
|
+
inst.uppercase = (params) => inst.check(checks.uppercase(params));
|
|
226
|
+
|
|
227
|
+
// transforms
|
|
228
|
+
inst.trim = () => inst.check(checks.trim());
|
|
229
|
+
inst.normalize = (...args) => inst.check(checks.normalize(...args));
|
|
230
|
+
inst.toLowerCase = () => inst.check(checks.toLowerCase());
|
|
231
|
+
inst.toUpperCase = () => inst.check(checks.toUpperCase());
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
export interface ZodString extends _ZodString<string> {
|
|
185
235
|
// string format checks
|
|
186
236
|
// email(): ZodString;
|
|
187
237
|
// email(params?: string): ZodString;
|
|
@@ -254,37 +304,11 @@ export interface _ZodString<Input = unknown> extends ZodType {
|
|
|
254
304
|
): this;
|
|
255
305
|
/** @deprecated Use `z.iso.duration()` instead. */
|
|
256
306
|
duration(params?: string | core.$ZodCheckISODurationParams): this;
|
|
257
|
-
|
|
258
|
-
// /** @deprecated Use `z.jsonString()` instead. */
|
|
259
|
-
// json(params?: string | core.$ZodCheckJSONStringParams): this;
|
|
260
|
-
|
|
261
|
-
// miscellaneous checks
|
|
262
|
-
regex(regex: RegExp, params?: string | core.$ZodCheckRegexParams): this;
|
|
263
|
-
includes(value: string, params?: { message?: string; position?: number }): this;
|
|
264
|
-
startsWith(value: string, params?: string | core.$ZodCheckStartsWithParams): this;
|
|
265
|
-
endsWith(value: string, params?: string | core.$ZodCheckEndsWithParams): this;
|
|
266
|
-
min(minLength: number, params?: string | core.$ZodCheckMinLengthParams): this;
|
|
267
|
-
max(maxLength: number, params?: string | core.$ZodCheckMaxLengthParams): this;
|
|
268
|
-
length(len: number, params?: string | core.$ZodCheckLengthEqualsParams): this;
|
|
269
|
-
nonempty(params?: string | core.$ZodCheckMinLengthParams): this;
|
|
270
|
-
lowercase(params?: string | core.$ZodCheckLowerCaseParams): this;
|
|
271
|
-
uppercase(params?: string | core.$ZodCheckUpperCaseParams): this;
|
|
272
|
-
|
|
273
|
-
// transforms
|
|
274
|
-
trim(): this;
|
|
275
|
-
normalize(form?: "NFC" | "NFD" | "NFKC" | "NFKD" | (string & {})): this;
|
|
276
|
-
toLowerCase(): this;
|
|
277
|
-
toUpperCase(): this;
|
|
278
307
|
}
|
|
279
308
|
|
|
280
|
-
export interface ZodString extends _ZodString<string> {}
|
|
281
309
|
export const ZodString: core.$constructor<ZodString> = /*@__PURE__*/ core.$constructor("ZodString", (inst, def) => {
|
|
282
310
|
core.$ZodString.init(inst, def);
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
inst.format = inst._zod.computed.format ?? null;
|
|
286
|
-
inst.minLength = inst._zod.computed.minimum ?? null;
|
|
287
|
-
inst.maxLength = inst._zod.computed.maximum ?? null;
|
|
311
|
+
_ZodString.init(inst, def);
|
|
288
312
|
|
|
289
313
|
inst.email = (params) => inst.check(core._email(ZodEmail, params));
|
|
290
314
|
inst.url = (params) => inst.check(core._url(ZodURL, params));
|
|
@@ -302,16 +326,8 @@ export const ZodString: core.$constructor<ZodString> = /*@__PURE__*/ core.$const
|
|
|
302
326
|
inst.ulid = (params) => inst.check(core._ulid(ZodULID, params));
|
|
303
327
|
inst.base64 = (params) => inst.check(core._base64(ZodBase64, params));
|
|
304
328
|
inst.base64url = (params) => inst.check(core._base64url(ZodBase64URL, params));
|
|
305
|
-
// inst.jsonString = (params) => inst.check(core._jsonString(Zodinst,params));
|
|
306
|
-
// inst.json = (params) => inst.check(core._jsonString(Zodinst,params));
|
|
307
329
|
inst.xid = (params) => inst.check(core._xid(ZodXID, params));
|
|
308
330
|
inst.ksuid = (params) => inst.check(core._ksuid(ZodKSUID, params));
|
|
309
|
-
// inst.ip = (params) => {
|
|
310
|
-
// const version = (params ?? {} as any)?.version;
|
|
311
|
-
// if (version === "v4") return inst.check(core._ipv4(ZodIPv4, params));
|
|
312
|
-
// if (version === "v6") return inst.check(core._ipv6(ZodIPv6, params as any));
|
|
313
|
-
// return union([inst.ipv4(params), inst.ipv6(params as any)]);
|
|
314
|
-
// };
|
|
315
331
|
inst.ipv4 = (params) => inst.check(core._ipv4(ZodIPv4, params));
|
|
316
332
|
inst.ipv6 = (params) => inst.check(core._ipv6(ZodIPv6, params));
|
|
317
333
|
inst.cidrv4 = (params) => inst.check(core._cidrv4(ZodCIDRv4, params));
|
|
@@ -323,24 +339,6 @@ export const ZodString: core.$constructor<ZodString> = /*@__PURE__*/ core.$const
|
|
|
323
339
|
inst.date = (params) => inst.check(iso.date(params as any));
|
|
324
340
|
inst.time = (params) => inst.check(iso.time(params as any));
|
|
325
341
|
inst.duration = (params) => inst.check(iso.duration(params as any));
|
|
326
|
-
|
|
327
|
-
// validations
|
|
328
|
-
inst.regex = (...args) => inst.check(checks.regex(...args));
|
|
329
|
-
inst.includes = (...args) => inst.check(checks.includes(...args));
|
|
330
|
-
inst.startsWith = (params) => inst.check(checks.startsWith(params));
|
|
331
|
-
inst.endsWith = (params) => inst.check(checks.endsWith(params));
|
|
332
|
-
inst.min = (...args) => inst.check(checks.minLength(...args));
|
|
333
|
-
inst.max = (...args) => inst.check(checks.maxLength(...args));
|
|
334
|
-
inst.length = (...args) => inst.check(checks.length(...args));
|
|
335
|
-
inst.nonempty = (...args) => inst.check(checks.minLength(1, ...args));
|
|
336
|
-
inst.lowercase = (params) => inst.check(checks.lowercase(params));
|
|
337
|
-
inst.uppercase = (params) => inst.check(checks.uppercase(params));
|
|
338
|
-
|
|
339
|
-
// transforms
|
|
340
|
-
inst.trim = () => inst.check(checks.trim());
|
|
341
|
-
inst.normalize = (...args) => inst.check(checks.normalize(...args));
|
|
342
|
-
inst.toLowerCase = () => inst.check(checks.toLowerCase());
|
|
343
|
-
inst.toUpperCase = () => inst.check(checks.toUpperCase());
|
|
344
342
|
});
|
|
345
343
|
|
|
346
344
|
export function string(params?: string | core.$ZodStringParams): ZodString {
|
|
@@ -348,14 +346,14 @@ export function string(params?: string | core.$ZodStringParams): ZodString {
|
|
|
348
346
|
}
|
|
349
347
|
|
|
350
348
|
// ZodStringFormat
|
|
351
|
-
export interface ZodStringFormat<Format extends core.$ZodStringFormats = core.$ZodStringFormats> extends
|
|
349
|
+
export interface ZodStringFormat<Format extends core.$ZodStringFormats = core.$ZodStringFormats> extends _ZodString {
|
|
352
350
|
_zod: core.$ZodStringFormatInternals<Format>;
|
|
353
351
|
}
|
|
354
352
|
export const ZodStringFormat: core.$constructor<ZodStringFormat> = /*@__PURE__*/ core.$constructor(
|
|
355
353
|
"ZodStringFormat",
|
|
356
354
|
(inst, def) => {
|
|
357
355
|
core.$ZodStringFormat.init(inst, def);
|
|
358
|
-
|
|
356
|
+
_ZodString.init(inst, def);
|
|
359
357
|
}
|
|
360
358
|
);
|
|
361
359
|
|
|
@@ -667,7 +665,7 @@ export interface _ZodNumber<Input = unknown> extends ZodType {
|
|
|
667
665
|
max(value: number, params?: string | core.$ZodCheckLessThanParams): this;
|
|
668
666
|
/** Consider `z.int()` instead. This API is considered *legacy*; it will never be removed but a better alternative exists. */
|
|
669
667
|
int(params?: string | core.$ZodCheckNumberFormatParams): this;
|
|
670
|
-
/** @deprecated This is now identical to `.int()
|
|
668
|
+
/** @deprecated This is now identical to `.int()`. Only numbers in the safe integer range are accepted. */
|
|
671
669
|
safe(params?: string | core.$ZodCheckNumberFormatParams): this;
|
|
672
670
|
positive(params?: string | core.$ZodCheckGreaterThanParams): this;
|
|
673
671
|
nonnegative(params?: string | core.$ZodCheckGreaterThanParams): this;
|
|
@@ -733,7 +731,7 @@ export const ZodNumberFormat: core.$constructor<ZodNumberFormat> = /*@__PURE__*/
|
|
|
733
731
|
"ZodNumberFormat",
|
|
734
732
|
(inst, def) => {
|
|
735
733
|
core.$ZodNumberFormat.init(inst, def);
|
|
736
|
-
|
|
734
|
+
ZodNumber.init(inst, def);
|
|
737
735
|
}
|
|
738
736
|
);
|
|
739
737
|
|
|
@@ -1091,6 +1089,7 @@ export interface ZodInterface<
|
|
|
1091
1089
|
extra: Record<string, T["_zod"]["output"]>;
|
|
1092
1090
|
}
|
|
1093
1091
|
>;
|
|
1092
|
+
/** Consider `z.strictObject({ ...A.shape })` instead. */
|
|
1094
1093
|
strict(): ZodInterface<
|
|
1095
1094
|
Shape,
|
|
1096
1095
|
{
|
|
@@ -1099,6 +1098,7 @@ export interface ZodInterface<
|
|
|
1099
1098
|
extra: {};
|
|
1100
1099
|
}
|
|
1101
1100
|
>;
|
|
1101
|
+
|
|
1102
1102
|
loose(): ZodInterface<
|
|
1103
1103
|
Shape,
|
|
1104
1104
|
{
|
|
@@ -1107,6 +1107,8 @@ export interface ZodInterface<
|
|
|
1107
1107
|
extra: Record<string, unknown>;
|
|
1108
1108
|
}
|
|
1109
1109
|
>;
|
|
1110
|
+
|
|
1111
|
+
/** Use `z.looseObject({ ...A.shape })` instead. */
|
|
1110
1112
|
strip(): ZodInterface<
|
|
1111
1113
|
Shape,
|
|
1112
1114
|
{
|
|
@@ -1259,17 +1261,18 @@ export interface ZodObject<
|
|
|
1259
1261
|
shape: Shape;
|
|
1260
1262
|
|
|
1261
1263
|
keyof(): ZodEnum<util.ToEnum<keyof Shape & string>>;
|
|
1264
|
+
/** Define a schema to validate all unrecognized keys. This overrides the existing strict/loose behavior. */
|
|
1262
1265
|
catchall<T extends core.$ZodType>(schema: T): ZodObject<Shape, Record<string, T["_zod"]["output"]>>;
|
|
1263
1266
|
|
|
1264
1267
|
/** @deprecated Use `z.looseObject()` or `.loose()` instead. */
|
|
1265
1268
|
passthrough(): ZodObject<Shape, Record<string, unknown>>;
|
|
1266
|
-
|
|
1269
|
+
/** Consider `z.looseObject(A.shape)` instead */
|
|
1267
1270
|
loose(): ZodObject<Shape, Record<string, unknown>>;
|
|
1268
1271
|
|
|
1269
|
-
/**
|
|
1272
|
+
/** Consider `z.strictObject(A.shape)` instead */
|
|
1270
1273
|
strict(): ZodObject<Shape, {}>;
|
|
1271
1274
|
|
|
1272
|
-
/**
|
|
1275
|
+
/** This is the default behavior. This method call is likely unnecessary. */
|
|
1273
1276
|
strip(): ZodObject<Shape, {}>;
|
|
1274
1277
|
|
|
1275
1278
|
extend<const U extends ZodObject>(schema: U): ZodObject<util.Extend<Shape, U["_zod"]["def"]["shape"]>, Extra>;
|
|
@@ -1281,7 +1284,7 @@ export interface ZodObject<
|
|
|
1281
1284
|
>;
|
|
1282
1285
|
|
|
1283
1286
|
// merge
|
|
1284
|
-
/** @deprecated Use `A.extend(B)` */
|
|
1287
|
+
/** @deprecated Use `A.extend(B.shape)` */
|
|
1285
1288
|
merge<U extends ZodObject<any, any>>(
|
|
1286
1289
|
other: U
|
|
1287
1290
|
): ZodObject<util.Flatten<util.Extend<Shape, U["_zod"]["def"]["shape"]>>, Extra>;
|