zod 4.0.0-beta.20250417T034645 → 4.0.0-beta.20250418T073619
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 +3 -3
- package/dist/commonjs/schemas.js +20 -20
- package/dist/esm/schemas.d.ts +3 -3
- package/dist/esm/schemas.js +20 -20
- package/package.json +2 -2
- package/src/schemas.ts +26 -24
|
@@ -245,7 +245,7 @@ export interface _ZodNumber<Input = unknown> extends ZodType {
|
|
|
245
245
|
/** Identical to .max() */
|
|
246
246
|
lte(value: number, params?: string | core.$ZodCheckLessThanParams): this;
|
|
247
247
|
max(value: number, params?: string | core.$ZodCheckLessThanParams): this;
|
|
248
|
-
/**
|
|
248
|
+
/** Consider `z.int()` instead. This API is considered *legacy*; it will never be removed but a better alternative exists. */
|
|
249
249
|
int(params?: string | core.$ZodCheckNumberFormatParams): this;
|
|
250
250
|
/** @deprecated This is now identical to `.int()` instead. Only numbers in the safe integer range are accepted. */
|
|
251
251
|
safe(params?: string | core.$ZodCheckNumberFormatParams): this;
|
|
@@ -256,11 +256,11 @@ export interface _ZodNumber<Input = unknown> extends ZodType {
|
|
|
256
256
|
multipleOf(value: number, params?: string | core.$ZodCheckMultipleOfParams): this;
|
|
257
257
|
/** @deprecated Use `.multipleOf()` instead. */
|
|
258
258
|
step(value: number, params?: string | core.$ZodCheckMultipleOfParams): this;
|
|
259
|
-
/** @deprecated In v4 and later, z.number() does not allow infinite values. This is a no-op. */
|
|
259
|
+
/** @deprecated In v4 and later, z.number() does not allow infinite values by default. This is a no-op. */
|
|
260
260
|
finite(params?: any): this;
|
|
261
261
|
minValue: number | null;
|
|
262
262
|
maxValue: number | null;
|
|
263
|
-
/** @deprecated Check `format` property instead. */
|
|
263
|
+
/** @deprecated Check the `format` property instead. */
|
|
264
264
|
isInt: boolean;
|
|
265
265
|
/** @deprecated Number schemas no longer accept infinite values, so this always returns `true`. */
|
|
266
266
|
isFinite: boolean;
|
package/dist/commonjs/schemas.js
CHANGED
|
@@ -129,7 +129,7 @@ exports.ZodType = core.$constructor("ZodType", (inst, def) => {
|
|
|
129
129
|
...def,
|
|
130
130
|
checks: [
|
|
131
131
|
...(def.checks ?? []),
|
|
132
|
-
...checks.map((ch) =>
|
|
132
|
+
...checks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch),
|
|
133
133
|
],
|
|
134
134
|
});
|
|
135
135
|
};
|
|
@@ -258,7 +258,7 @@ exports.ZodStringFormat = core.$constructor("ZodStringFormat", (inst, def) => {
|
|
|
258
258
|
exports.ZodEmail = core.$constructor("ZodEmail", (inst, def) => {
|
|
259
259
|
// ZodStringFormat.init(inst, def);
|
|
260
260
|
core.$ZodEmail.init(inst, def);
|
|
261
|
-
exports.
|
|
261
|
+
exports.ZodStringFormat.init(inst, def);
|
|
262
262
|
});
|
|
263
263
|
function email(params) {
|
|
264
264
|
return core._email(exports.ZodEmail, params);
|
|
@@ -266,7 +266,7 @@ function email(params) {
|
|
|
266
266
|
exports.ZodGUID = core.$constructor("ZodGUID", (inst, def) => {
|
|
267
267
|
// ZodStringFormat.init(inst, def);
|
|
268
268
|
core.$ZodGUID.init(inst, def);
|
|
269
|
-
exports.
|
|
269
|
+
exports.ZodStringFormat.init(inst, def);
|
|
270
270
|
});
|
|
271
271
|
function guid(params) {
|
|
272
272
|
return core._guid(exports.ZodGUID, params);
|
|
@@ -274,7 +274,7 @@ function guid(params) {
|
|
|
274
274
|
exports.ZodUUID = core.$constructor("ZodUUID", (inst, def) => {
|
|
275
275
|
// ZodStringFormat.init(inst, def);
|
|
276
276
|
core.$ZodUUID.init(inst, def);
|
|
277
|
-
exports.
|
|
277
|
+
exports.ZodStringFormat.init(inst, def);
|
|
278
278
|
});
|
|
279
279
|
function uuid(params) {
|
|
280
280
|
return core._uuid(exports.ZodUUID, params);
|
|
@@ -293,7 +293,7 @@ function uuidv7(params) {
|
|
|
293
293
|
exports.ZodURL = core.$constructor("ZodURL", (inst, def) => {
|
|
294
294
|
// ZodStringFormat.init(inst, def);
|
|
295
295
|
core.$ZodURL.init(inst, def);
|
|
296
|
-
exports.
|
|
296
|
+
exports.ZodStringFormat.init(inst, def);
|
|
297
297
|
});
|
|
298
298
|
function url(params) {
|
|
299
299
|
return core._url(exports.ZodURL, params);
|
|
@@ -301,7 +301,7 @@ function url(params) {
|
|
|
301
301
|
exports.ZodEmoji = core.$constructor("ZodEmoji", (inst, def) => {
|
|
302
302
|
// ZodStringFormat.init(inst, def);
|
|
303
303
|
core.$ZodEmoji.init(inst, def);
|
|
304
|
-
exports.
|
|
304
|
+
exports.ZodStringFormat.init(inst, def);
|
|
305
305
|
});
|
|
306
306
|
function emoji(params) {
|
|
307
307
|
return core._emoji(exports.ZodEmoji, params);
|
|
@@ -309,7 +309,7 @@ function emoji(params) {
|
|
|
309
309
|
exports.ZodNanoID = core.$constructor("ZodNanoID", (inst, def) => {
|
|
310
310
|
// ZodStringFormat.init(inst, def);
|
|
311
311
|
core.$ZodNanoID.init(inst, def);
|
|
312
|
-
exports.
|
|
312
|
+
exports.ZodStringFormat.init(inst, def);
|
|
313
313
|
});
|
|
314
314
|
function nanoid(params) {
|
|
315
315
|
return core._nanoid(exports.ZodNanoID, params);
|
|
@@ -317,7 +317,7 @@ function nanoid(params) {
|
|
|
317
317
|
exports.ZodCUID = core.$constructor("ZodCUID", (inst, def) => {
|
|
318
318
|
// ZodStringFormat.init(inst, def);
|
|
319
319
|
core.$ZodCUID.init(inst, def);
|
|
320
|
-
exports.
|
|
320
|
+
exports.ZodStringFormat.init(inst, def);
|
|
321
321
|
});
|
|
322
322
|
function cuid(params) {
|
|
323
323
|
return core._cuid(exports.ZodCUID, params);
|
|
@@ -325,7 +325,7 @@ function cuid(params) {
|
|
|
325
325
|
exports.ZodCUID2 = core.$constructor("ZodCUID2", (inst, def) => {
|
|
326
326
|
// ZodStringFormat.init(inst, def);
|
|
327
327
|
core.$ZodCUID2.init(inst, def);
|
|
328
|
-
exports.
|
|
328
|
+
exports.ZodStringFormat.init(inst, def);
|
|
329
329
|
});
|
|
330
330
|
function cuid2(params) {
|
|
331
331
|
return core._cuid2(exports.ZodCUID2, params);
|
|
@@ -333,7 +333,7 @@ function cuid2(params) {
|
|
|
333
333
|
exports.ZodULID = core.$constructor("ZodULID", (inst, def) => {
|
|
334
334
|
// ZodStringFormat.init(inst, def);
|
|
335
335
|
core.$ZodULID.init(inst, def);
|
|
336
|
-
exports.
|
|
336
|
+
exports.ZodStringFormat.init(inst, def);
|
|
337
337
|
});
|
|
338
338
|
function ulid(params) {
|
|
339
339
|
return core._ulid(exports.ZodULID, params);
|
|
@@ -341,7 +341,7 @@ function ulid(params) {
|
|
|
341
341
|
exports.ZodXID = core.$constructor("ZodXID", (inst, def) => {
|
|
342
342
|
// ZodStringFormat.init(inst, def);
|
|
343
343
|
core.$ZodXID.init(inst, def);
|
|
344
|
-
exports.
|
|
344
|
+
exports.ZodStringFormat.init(inst, def);
|
|
345
345
|
});
|
|
346
346
|
function xid(params) {
|
|
347
347
|
return core._xid(exports.ZodXID, params);
|
|
@@ -349,7 +349,7 @@ function xid(params) {
|
|
|
349
349
|
exports.ZodKSUID = core.$constructor("ZodKSUID", (inst, def) => {
|
|
350
350
|
// ZodStringFormat.init(inst, def);
|
|
351
351
|
core.$ZodKSUID.init(inst, def);
|
|
352
|
-
exports.
|
|
352
|
+
exports.ZodStringFormat.init(inst, def);
|
|
353
353
|
});
|
|
354
354
|
function ksuid(params) {
|
|
355
355
|
return core._ksuid(exports.ZodKSUID, params);
|
|
@@ -357,7 +357,7 @@ function ksuid(params) {
|
|
|
357
357
|
exports.ZodIPv4 = core.$constructor("ZodIPv4", (inst, def) => {
|
|
358
358
|
// ZodStringFormat.init(inst, def);
|
|
359
359
|
core.$ZodIPv4.init(inst, def);
|
|
360
|
-
exports.
|
|
360
|
+
exports.ZodStringFormat.init(inst, def);
|
|
361
361
|
});
|
|
362
362
|
function ipv4(params) {
|
|
363
363
|
return core._ipv4(exports.ZodIPv4, params);
|
|
@@ -365,21 +365,21 @@ function ipv4(params) {
|
|
|
365
365
|
exports.ZodIPv6 = core.$constructor("ZodIPv6", (inst, def) => {
|
|
366
366
|
// ZodStringFormat.init(inst, def);
|
|
367
367
|
core.$ZodIPv6.init(inst, def);
|
|
368
|
-
exports.
|
|
368
|
+
exports.ZodStringFormat.init(inst, def);
|
|
369
369
|
});
|
|
370
370
|
function ipv6(params) {
|
|
371
371
|
return core._ipv6(exports.ZodIPv6, params);
|
|
372
372
|
}
|
|
373
373
|
exports.ZodCIDRv4 = core.$constructor("ZodCIDRv4", (inst, def) => {
|
|
374
374
|
core.$ZodCIDRv4.init(inst, def);
|
|
375
|
-
exports.
|
|
375
|
+
exports.ZodStringFormat.init(inst, def);
|
|
376
376
|
});
|
|
377
377
|
function cidrv4(params) {
|
|
378
378
|
return core._cidrv4(exports.ZodCIDRv4, params);
|
|
379
379
|
}
|
|
380
380
|
exports.ZodCIDRv6 = core.$constructor("ZodCIDRv6", (inst, def) => {
|
|
381
381
|
core.$ZodCIDRv6.init(inst, def);
|
|
382
|
-
exports.
|
|
382
|
+
exports.ZodStringFormat.init(inst, def);
|
|
383
383
|
});
|
|
384
384
|
function cidrv6(params) {
|
|
385
385
|
return core._cidrv6(exports.ZodCIDRv6, params);
|
|
@@ -387,7 +387,7 @@ function cidrv6(params) {
|
|
|
387
387
|
exports.ZodBase64 = core.$constructor("ZodBase64", (inst, def) => {
|
|
388
388
|
// ZodStringFormat.init(inst, def);
|
|
389
389
|
core.$ZodBase64.init(inst, def);
|
|
390
|
-
exports.
|
|
390
|
+
exports.ZodStringFormat.init(inst, def);
|
|
391
391
|
});
|
|
392
392
|
function base64(params) {
|
|
393
393
|
return core._base64(exports.ZodBase64, params);
|
|
@@ -395,7 +395,7 @@ function base64(params) {
|
|
|
395
395
|
exports.ZodBase64URL = core.$constructor("ZodBase64URL", (inst, def) => {
|
|
396
396
|
// ZodStringFormat.init(inst, def);
|
|
397
397
|
core.$ZodBase64URL.init(inst, def);
|
|
398
|
-
exports.
|
|
398
|
+
exports.ZodStringFormat.init(inst, def);
|
|
399
399
|
});
|
|
400
400
|
function base64url(params) {
|
|
401
401
|
return core._base64url(exports.ZodBase64URL, params);
|
|
@@ -403,7 +403,7 @@ function base64url(params) {
|
|
|
403
403
|
exports.ZodE164 = core.$constructor("ZodE164", (inst, def) => {
|
|
404
404
|
// ZodStringFormat.init(inst, def);
|
|
405
405
|
core.$ZodE164.init(inst, def);
|
|
406
|
-
exports.
|
|
406
|
+
exports.ZodStringFormat.init(inst, def);
|
|
407
407
|
});
|
|
408
408
|
function e164(params) {
|
|
409
409
|
return core._e164(exports.ZodE164, params);
|
|
@@ -411,7 +411,7 @@ function e164(params) {
|
|
|
411
411
|
exports.ZodJWT = core.$constructor("ZodJWT", (inst, def) => {
|
|
412
412
|
// ZodStringFormat.init(inst, def);
|
|
413
413
|
core.$ZodJWT.init(inst, def);
|
|
414
|
-
exports.
|
|
414
|
+
exports.ZodStringFormat.init(inst, def);
|
|
415
415
|
});
|
|
416
416
|
function jwt(params) {
|
|
417
417
|
return core._jwt(exports.ZodJWT, params);
|
package/dist/esm/schemas.d.ts
CHANGED
|
@@ -245,7 +245,7 @@ export interface _ZodNumber<Input = unknown> extends ZodType {
|
|
|
245
245
|
/** Identical to .max() */
|
|
246
246
|
lte(value: number, params?: string | core.$ZodCheckLessThanParams): this;
|
|
247
247
|
max(value: number, params?: string | core.$ZodCheckLessThanParams): this;
|
|
248
|
-
/**
|
|
248
|
+
/** Consider `z.int()` instead. This API is considered *legacy*; it will never be removed but a better alternative exists. */
|
|
249
249
|
int(params?: string | core.$ZodCheckNumberFormatParams): this;
|
|
250
250
|
/** @deprecated This is now identical to `.int()` instead. Only numbers in the safe integer range are accepted. */
|
|
251
251
|
safe(params?: string | core.$ZodCheckNumberFormatParams): this;
|
|
@@ -256,11 +256,11 @@ export interface _ZodNumber<Input = unknown> extends ZodType {
|
|
|
256
256
|
multipleOf(value: number, params?: string | core.$ZodCheckMultipleOfParams): this;
|
|
257
257
|
/** @deprecated Use `.multipleOf()` instead. */
|
|
258
258
|
step(value: number, params?: string | core.$ZodCheckMultipleOfParams): this;
|
|
259
|
-
/** @deprecated In v4 and later, z.number() does not allow infinite values. This is a no-op. */
|
|
259
|
+
/** @deprecated In v4 and later, z.number() does not allow infinite values by default. This is a no-op. */
|
|
260
260
|
finite(params?: any): this;
|
|
261
261
|
minValue: number | null;
|
|
262
262
|
maxValue: number | null;
|
|
263
|
-
/** @deprecated Check `format` property instead. */
|
|
263
|
+
/** @deprecated Check the `format` property instead. */
|
|
264
264
|
isInt: boolean;
|
|
265
265
|
/** @deprecated Number schemas no longer accept infinite values, so this always returns `true`. */
|
|
266
266
|
isFinite: boolean;
|
package/dist/esm/schemas.js
CHANGED
|
@@ -15,7 +15,7 @@ export const ZodType = /*@__PURE__*/ core.$constructor("ZodType", (inst, def) =>
|
|
|
15
15
|
...def,
|
|
16
16
|
checks: [
|
|
17
17
|
...(def.checks ?? []),
|
|
18
|
-
...checks.map((ch) =>
|
|
18
|
+
...checks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch),
|
|
19
19
|
],
|
|
20
20
|
});
|
|
21
21
|
};
|
|
@@ -144,7 +144,7 @@ export const ZodStringFormat = /*@__PURE__*/ core.$constructor("ZodStringFormat"
|
|
|
144
144
|
export const ZodEmail = /*@__PURE__*/ core.$constructor("ZodEmail", (inst, def) => {
|
|
145
145
|
// ZodStringFormat.init(inst, def);
|
|
146
146
|
core.$ZodEmail.init(inst, def);
|
|
147
|
-
|
|
147
|
+
ZodStringFormat.init(inst, def);
|
|
148
148
|
});
|
|
149
149
|
export function email(params) {
|
|
150
150
|
return core._email(ZodEmail, params);
|
|
@@ -152,7 +152,7 @@ export function email(params) {
|
|
|
152
152
|
export const ZodGUID = /*@__PURE__*/ core.$constructor("ZodGUID", (inst, def) => {
|
|
153
153
|
// ZodStringFormat.init(inst, def);
|
|
154
154
|
core.$ZodGUID.init(inst, def);
|
|
155
|
-
|
|
155
|
+
ZodStringFormat.init(inst, def);
|
|
156
156
|
});
|
|
157
157
|
export function guid(params) {
|
|
158
158
|
return core._guid(ZodGUID, params);
|
|
@@ -160,7 +160,7 @@ export function guid(params) {
|
|
|
160
160
|
export const ZodUUID = /*@__PURE__*/ core.$constructor("ZodUUID", (inst, def) => {
|
|
161
161
|
// ZodStringFormat.init(inst, def);
|
|
162
162
|
core.$ZodUUID.init(inst, def);
|
|
163
|
-
|
|
163
|
+
ZodStringFormat.init(inst, def);
|
|
164
164
|
});
|
|
165
165
|
export function uuid(params) {
|
|
166
166
|
return core._uuid(ZodUUID, params);
|
|
@@ -179,7 +179,7 @@ export function uuidv7(params) {
|
|
|
179
179
|
export const ZodURL = /*@__PURE__*/ core.$constructor("ZodURL", (inst, def) => {
|
|
180
180
|
// ZodStringFormat.init(inst, def);
|
|
181
181
|
core.$ZodURL.init(inst, def);
|
|
182
|
-
|
|
182
|
+
ZodStringFormat.init(inst, def);
|
|
183
183
|
});
|
|
184
184
|
export function url(params) {
|
|
185
185
|
return core._url(ZodURL, params);
|
|
@@ -187,7 +187,7 @@ export function url(params) {
|
|
|
187
187
|
export const ZodEmoji = /*@__PURE__*/ core.$constructor("ZodEmoji", (inst, def) => {
|
|
188
188
|
// ZodStringFormat.init(inst, def);
|
|
189
189
|
core.$ZodEmoji.init(inst, def);
|
|
190
|
-
|
|
190
|
+
ZodStringFormat.init(inst, def);
|
|
191
191
|
});
|
|
192
192
|
export function emoji(params) {
|
|
193
193
|
return core._emoji(ZodEmoji, params);
|
|
@@ -195,7 +195,7 @@ export function emoji(params) {
|
|
|
195
195
|
export const ZodNanoID = /*@__PURE__*/ core.$constructor("ZodNanoID", (inst, def) => {
|
|
196
196
|
// ZodStringFormat.init(inst, def);
|
|
197
197
|
core.$ZodNanoID.init(inst, def);
|
|
198
|
-
|
|
198
|
+
ZodStringFormat.init(inst, def);
|
|
199
199
|
});
|
|
200
200
|
export function nanoid(params) {
|
|
201
201
|
return core._nanoid(ZodNanoID, params);
|
|
@@ -203,7 +203,7 @@ export function nanoid(params) {
|
|
|
203
203
|
export const ZodCUID = /*@__PURE__*/ core.$constructor("ZodCUID", (inst, def) => {
|
|
204
204
|
// ZodStringFormat.init(inst, def);
|
|
205
205
|
core.$ZodCUID.init(inst, def);
|
|
206
|
-
|
|
206
|
+
ZodStringFormat.init(inst, def);
|
|
207
207
|
});
|
|
208
208
|
export function cuid(params) {
|
|
209
209
|
return core._cuid(ZodCUID, params);
|
|
@@ -211,7 +211,7 @@ export function cuid(params) {
|
|
|
211
211
|
export const ZodCUID2 = /*@__PURE__*/ core.$constructor("ZodCUID2", (inst, def) => {
|
|
212
212
|
// ZodStringFormat.init(inst, def);
|
|
213
213
|
core.$ZodCUID2.init(inst, def);
|
|
214
|
-
|
|
214
|
+
ZodStringFormat.init(inst, def);
|
|
215
215
|
});
|
|
216
216
|
export function cuid2(params) {
|
|
217
217
|
return core._cuid2(ZodCUID2, params);
|
|
@@ -219,7 +219,7 @@ export function cuid2(params) {
|
|
|
219
219
|
export const ZodULID = /*@__PURE__*/ core.$constructor("ZodULID", (inst, def) => {
|
|
220
220
|
// ZodStringFormat.init(inst, def);
|
|
221
221
|
core.$ZodULID.init(inst, def);
|
|
222
|
-
|
|
222
|
+
ZodStringFormat.init(inst, def);
|
|
223
223
|
});
|
|
224
224
|
export function ulid(params) {
|
|
225
225
|
return core._ulid(ZodULID, params);
|
|
@@ -227,7 +227,7 @@ export function ulid(params) {
|
|
|
227
227
|
export const ZodXID = /*@__PURE__*/ core.$constructor("ZodXID", (inst, def) => {
|
|
228
228
|
// ZodStringFormat.init(inst, def);
|
|
229
229
|
core.$ZodXID.init(inst, def);
|
|
230
|
-
|
|
230
|
+
ZodStringFormat.init(inst, def);
|
|
231
231
|
});
|
|
232
232
|
export function xid(params) {
|
|
233
233
|
return core._xid(ZodXID, params);
|
|
@@ -235,7 +235,7 @@ export function xid(params) {
|
|
|
235
235
|
export const ZodKSUID = /*@__PURE__*/ core.$constructor("ZodKSUID", (inst, def) => {
|
|
236
236
|
// ZodStringFormat.init(inst, def);
|
|
237
237
|
core.$ZodKSUID.init(inst, def);
|
|
238
|
-
|
|
238
|
+
ZodStringFormat.init(inst, def);
|
|
239
239
|
});
|
|
240
240
|
export function ksuid(params) {
|
|
241
241
|
return core._ksuid(ZodKSUID, params);
|
|
@@ -243,7 +243,7 @@ export function ksuid(params) {
|
|
|
243
243
|
export const ZodIPv4 = /*@__PURE__*/ core.$constructor("ZodIPv4", (inst, def) => {
|
|
244
244
|
// ZodStringFormat.init(inst, def);
|
|
245
245
|
core.$ZodIPv4.init(inst, def);
|
|
246
|
-
|
|
246
|
+
ZodStringFormat.init(inst, def);
|
|
247
247
|
});
|
|
248
248
|
export function ipv4(params) {
|
|
249
249
|
return core._ipv4(ZodIPv4, params);
|
|
@@ -251,21 +251,21 @@ export function ipv4(params) {
|
|
|
251
251
|
export const ZodIPv6 = /*@__PURE__*/ core.$constructor("ZodIPv6", (inst, def) => {
|
|
252
252
|
// ZodStringFormat.init(inst, def);
|
|
253
253
|
core.$ZodIPv6.init(inst, def);
|
|
254
|
-
|
|
254
|
+
ZodStringFormat.init(inst, def);
|
|
255
255
|
});
|
|
256
256
|
export function ipv6(params) {
|
|
257
257
|
return core._ipv6(ZodIPv6, params);
|
|
258
258
|
}
|
|
259
259
|
export const ZodCIDRv4 = /*@__PURE__*/ core.$constructor("ZodCIDRv4", (inst, def) => {
|
|
260
260
|
core.$ZodCIDRv4.init(inst, def);
|
|
261
|
-
|
|
261
|
+
ZodStringFormat.init(inst, def);
|
|
262
262
|
});
|
|
263
263
|
export function cidrv4(params) {
|
|
264
264
|
return core._cidrv4(ZodCIDRv4, params);
|
|
265
265
|
}
|
|
266
266
|
export const ZodCIDRv6 = /*@__PURE__*/ core.$constructor("ZodCIDRv6", (inst, def) => {
|
|
267
267
|
core.$ZodCIDRv6.init(inst, def);
|
|
268
|
-
|
|
268
|
+
ZodStringFormat.init(inst, def);
|
|
269
269
|
});
|
|
270
270
|
export function cidrv6(params) {
|
|
271
271
|
return core._cidrv6(ZodCIDRv6, params);
|
|
@@ -273,7 +273,7 @@ export function cidrv6(params) {
|
|
|
273
273
|
export const ZodBase64 = /*@__PURE__*/ core.$constructor("ZodBase64", (inst, def) => {
|
|
274
274
|
// ZodStringFormat.init(inst, def);
|
|
275
275
|
core.$ZodBase64.init(inst, def);
|
|
276
|
-
|
|
276
|
+
ZodStringFormat.init(inst, def);
|
|
277
277
|
});
|
|
278
278
|
export function base64(params) {
|
|
279
279
|
return core._base64(ZodBase64, params);
|
|
@@ -281,7 +281,7 @@ export function base64(params) {
|
|
|
281
281
|
export const ZodBase64URL = /*@__PURE__*/ core.$constructor("ZodBase64URL", (inst, def) => {
|
|
282
282
|
// ZodStringFormat.init(inst, def);
|
|
283
283
|
core.$ZodBase64URL.init(inst, def);
|
|
284
|
-
|
|
284
|
+
ZodStringFormat.init(inst, def);
|
|
285
285
|
});
|
|
286
286
|
export function base64url(params) {
|
|
287
287
|
return core._base64url(ZodBase64URL, params);
|
|
@@ -289,7 +289,7 @@ export function base64url(params) {
|
|
|
289
289
|
export const ZodE164 = /*@__PURE__*/ core.$constructor("ZodE164", (inst, def) => {
|
|
290
290
|
// ZodStringFormat.init(inst, def);
|
|
291
291
|
core.$ZodE164.init(inst, def);
|
|
292
|
-
|
|
292
|
+
ZodStringFormat.init(inst, def);
|
|
293
293
|
});
|
|
294
294
|
export function e164(params) {
|
|
295
295
|
return core._e164(ZodE164, params);
|
|
@@ -297,7 +297,7 @@ export function e164(params) {
|
|
|
297
297
|
export const ZodJWT = /*@__PURE__*/ core.$constructor("ZodJWT", (inst, def) => {
|
|
298
298
|
// ZodStringFormat.init(inst, def);
|
|
299
299
|
core.$ZodJWT.init(inst, def);
|
|
300
|
-
|
|
300
|
+
ZodStringFormat.init(inst, def);
|
|
301
301
|
});
|
|
302
302
|
export function jwt(params) {
|
|
303
303
|
return core._jwt(ZodJWT, 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.20250418T073619",
|
|
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.7.1"
|
|
74
74
|
},
|
|
75
75
|
"scripts": {
|
|
76
76
|
"clean": "rm -rf dist",
|
package/src/schemas.ts
CHANGED
|
@@ -107,7 +107,9 @@ export const ZodType: core.$constructor<ZodType> = /*@__PURE__*/ core.$construct
|
|
|
107
107
|
...def,
|
|
108
108
|
checks: [
|
|
109
109
|
...(def.checks ?? []),
|
|
110
|
-
...checks.map((ch) =>
|
|
110
|
+
...checks.map((ch) =>
|
|
111
|
+
typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch
|
|
112
|
+
),
|
|
111
113
|
],
|
|
112
114
|
});
|
|
113
115
|
};
|
|
@@ -364,7 +366,7 @@ export interface ZodEmail extends ZodStringFormat<"email"> {
|
|
|
364
366
|
export const ZodEmail: core.$constructor<ZodEmail> = /*@__PURE__*/ core.$constructor("ZodEmail", (inst, def) => {
|
|
365
367
|
// ZodStringFormat.init(inst, def);
|
|
366
368
|
core.$ZodEmail.init(inst, def);
|
|
367
|
-
|
|
369
|
+
ZodStringFormat.init(inst, def);
|
|
368
370
|
});
|
|
369
371
|
|
|
370
372
|
export function email(params?: string | core.$ZodEmailParams): ZodEmail {
|
|
@@ -378,7 +380,7 @@ export interface ZodGUID extends ZodStringFormat<"guid"> {
|
|
|
378
380
|
export const ZodGUID: core.$constructor<ZodGUID> = /*@__PURE__*/ core.$constructor("ZodGUID", (inst, def) => {
|
|
379
381
|
// ZodStringFormat.init(inst, def);
|
|
380
382
|
core.$ZodGUID.init(inst, def);
|
|
381
|
-
|
|
383
|
+
ZodStringFormat.init(inst, def);
|
|
382
384
|
});
|
|
383
385
|
|
|
384
386
|
export function guid(params?: string | core.$ZodGUIDParams): ZodGUID {
|
|
@@ -392,7 +394,7 @@ export interface ZodUUID extends ZodStringFormat<"uuid"> {
|
|
|
392
394
|
export const ZodUUID: core.$constructor<ZodUUID> = /*@__PURE__*/ core.$constructor("ZodUUID", (inst, def) => {
|
|
393
395
|
// ZodStringFormat.init(inst, def);
|
|
394
396
|
core.$ZodUUID.init(inst, def);
|
|
395
|
-
|
|
397
|
+
ZodStringFormat.init(inst, def);
|
|
396
398
|
});
|
|
397
399
|
|
|
398
400
|
export function uuid(params?: string | core.$ZodUUIDParams): ZodUUID {
|
|
@@ -422,7 +424,7 @@ export interface ZodURL extends ZodStringFormat<"url"> {
|
|
|
422
424
|
export const ZodURL: core.$constructor<ZodURL> = /*@__PURE__*/ core.$constructor("ZodURL", (inst, def) => {
|
|
423
425
|
// ZodStringFormat.init(inst, def);
|
|
424
426
|
core.$ZodURL.init(inst, def);
|
|
425
|
-
|
|
427
|
+
ZodStringFormat.init(inst, def);
|
|
426
428
|
});
|
|
427
429
|
|
|
428
430
|
export function url(params?: string | core.$ZodURLParams): ZodURL {
|
|
@@ -436,7 +438,7 @@ export interface ZodEmoji extends ZodStringFormat<"emoji"> {
|
|
|
436
438
|
export const ZodEmoji: core.$constructor<ZodEmoji> = /*@__PURE__*/ core.$constructor("ZodEmoji", (inst, def) => {
|
|
437
439
|
// ZodStringFormat.init(inst, def);
|
|
438
440
|
core.$ZodEmoji.init(inst, def);
|
|
439
|
-
|
|
441
|
+
ZodStringFormat.init(inst, def);
|
|
440
442
|
});
|
|
441
443
|
|
|
442
444
|
export function emoji(params?: string | core.$ZodEmojiParams): ZodEmoji {
|
|
@@ -450,7 +452,7 @@ export interface ZodNanoID extends ZodStringFormat<"nanoid"> {
|
|
|
450
452
|
export const ZodNanoID: core.$constructor<ZodNanoID> = /*@__PURE__*/ core.$constructor("ZodNanoID", (inst, def) => {
|
|
451
453
|
// ZodStringFormat.init(inst, def);
|
|
452
454
|
core.$ZodNanoID.init(inst, def);
|
|
453
|
-
|
|
455
|
+
ZodStringFormat.init(inst, def);
|
|
454
456
|
});
|
|
455
457
|
|
|
456
458
|
export function nanoid(params?: string | core.$ZodNanoIDParams): ZodNanoID {
|
|
@@ -464,7 +466,7 @@ export interface ZodCUID extends ZodStringFormat<"cuid"> {
|
|
|
464
466
|
export const ZodCUID: core.$constructor<ZodCUID> = /*@__PURE__*/ core.$constructor("ZodCUID", (inst, def) => {
|
|
465
467
|
// ZodStringFormat.init(inst, def);
|
|
466
468
|
core.$ZodCUID.init(inst, def);
|
|
467
|
-
|
|
469
|
+
ZodStringFormat.init(inst, def);
|
|
468
470
|
});
|
|
469
471
|
|
|
470
472
|
export function cuid(params?: string | core.$ZodCUIDParams): ZodCUID {
|
|
@@ -478,7 +480,7 @@ export interface ZodCUID2 extends ZodStringFormat<"cuid2"> {
|
|
|
478
480
|
export const ZodCUID2: core.$constructor<ZodCUID2> = /*@__PURE__*/ core.$constructor("ZodCUID2", (inst, def) => {
|
|
479
481
|
// ZodStringFormat.init(inst, def);
|
|
480
482
|
core.$ZodCUID2.init(inst, def);
|
|
481
|
-
|
|
483
|
+
ZodStringFormat.init(inst, def);
|
|
482
484
|
});
|
|
483
485
|
|
|
484
486
|
export function cuid2(params?: string | core.$ZodCUID2Params): ZodCUID2 {
|
|
@@ -492,7 +494,7 @@ export interface ZodULID extends ZodStringFormat<"ulid"> {
|
|
|
492
494
|
export const ZodULID: core.$constructor<ZodULID> = /*@__PURE__*/ core.$constructor("ZodULID", (inst, def) => {
|
|
493
495
|
// ZodStringFormat.init(inst, def);
|
|
494
496
|
core.$ZodULID.init(inst, def);
|
|
495
|
-
|
|
497
|
+
ZodStringFormat.init(inst, def);
|
|
496
498
|
});
|
|
497
499
|
|
|
498
500
|
export function ulid(params?: string | core.$ZodULIDParams): ZodULID {
|
|
@@ -506,7 +508,7 @@ export interface ZodXID extends ZodStringFormat<"xid"> {
|
|
|
506
508
|
export const ZodXID: core.$constructor<ZodXID> = /*@__PURE__*/ core.$constructor("ZodXID", (inst, def) => {
|
|
507
509
|
// ZodStringFormat.init(inst, def);
|
|
508
510
|
core.$ZodXID.init(inst, def);
|
|
509
|
-
|
|
511
|
+
ZodStringFormat.init(inst, def);
|
|
510
512
|
});
|
|
511
513
|
|
|
512
514
|
export function xid(params?: string | core.$ZodXIDParams): ZodXID {
|
|
@@ -520,7 +522,7 @@ export interface ZodKSUID extends ZodStringFormat<"ksuid"> {
|
|
|
520
522
|
export const ZodKSUID: core.$constructor<ZodKSUID> = /*@__PURE__*/ core.$constructor("ZodKSUID", (inst, def) => {
|
|
521
523
|
// ZodStringFormat.init(inst, def);
|
|
522
524
|
core.$ZodKSUID.init(inst, def);
|
|
523
|
-
|
|
525
|
+
ZodStringFormat.init(inst, def);
|
|
524
526
|
});
|
|
525
527
|
|
|
526
528
|
export function ksuid(params?: string | core.$ZodKSUIDParams): ZodKSUID {
|
|
@@ -534,7 +536,7 @@ export function ksuid(params?: string | core.$ZodKSUIDParams): ZodKSUID {
|
|
|
534
536
|
// export const ZodIP: core.$constructor<ZodIP> = /*@__PURE__*/ core.$constructor("ZodIP", (inst, def) => {
|
|
535
537
|
// // ZodStringFormat.init(inst, def);
|
|
536
538
|
// core.$ZodIP.init(inst, def);
|
|
537
|
-
//
|
|
539
|
+
// ZodStringFormat.init(inst, def);
|
|
538
540
|
// });
|
|
539
541
|
|
|
540
542
|
// export function ip(params?: string | core.$ZodIPParams): ZodIP {
|
|
@@ -548,7 +550,7 @@ export interface ZodIPv4 extends ZodStringFormat<"ipv4"> {
|
|
|
548
550
|
export const ZodIPv4: core.$constructor<ZodIPv4> = /*@__PURE__*/ core.$constructor("ZodIPv4", (inst, def) => {
|
|
549
551
|
// ZodStringFormat.init(inst, def);
|
|
550
552
|
core.$ZodIPv4.init(inst, def);
|
|
551
|
-
|
|
553
|
+
ZodStringFormat.init(inst, def);
|
|
552
554
|
});
|
|
553
555
|
|
|
554
556
|
export function ipv4(params?: string | core.$ZodIPv4Params): ZodIPv4 {
|
|
@@ -562,7 +564,7 @@ export interface ZodIPv6 extends ZodStringFormat<"ipv6"> {
|
|
|
562
564
|
export const ZodIPv6: core.$constructor<ZodIPv6> = /*@__PURE__*/ core.$constructor("ZodIPv6", (inst, def) => {
|
|
563
565
|
// ZodStringFormat.init(inst, def);
|
|
564
566
|
core.$ZodIPv6.init(inst, def);
|
|
565
|
-
|
|
567
|
+
ZodStringFormat.init(inst, def);
|
|
566
568
|
});
|
|
567
569
|
export function ipv6(params?: string | core.$ZodIPv6Params): ZodIPv6 {
|
|
568
570
|
return core._ipv6(ZodIPv6, params);
|
|
@@ -574,7 +576,7 @@ export interface ZodCIDRv4 extends ZodStringFormat<"cidrv4"> {
|
|
|
574
576
|
}
|
|
575
577
|
export const ZodCIDRv4: core.$constructor<ZodCIDRv4> = /*@__PURE__*/ core.$constructor("ZodCIDRv4", (inst, def) => {
|
|
576
578
|
core.$ZodCIDRv4.init(inst, def);
|
|
577
|
-
|
|
579
|
+
ZodStringFormat.init(inst, def);
|
|
578
580
|
});
|
|
579
581
|
|
|
580
582
|
export function cidrv4(params?: string | core.$ZodCIDRv4Params): ZodCIDRv4 {
|
|
@@ -587,7 +589,7 @@ export interface ZodCIDRv6 extends ZodStringFormat<"cidrv6"> {
|
|
|
587
589
|
}
|
|
588
590
|
export const ZodCIDRv6: core.$constructor<ZodCIDRv6> = /*@__PURE__*/ core.$constructor("ZodCIDRv6", (inst, def) => {
|
|
589
591
|
core.$ZodCIDRv6.init(inst, def);
|
|
590
|
-
|
|
592
|
+
ZodStringFormat.init(inst, def);
|
|
591
593
|
});
|
|
592
594
|
|
|
593
595
|
export function cidrv6(params?: string | core.$ZodCIDRv6Params): ZodCIDRv6 {
|
|
@@ -601,7 +603,7 @@ export interface ZodBase64 extends ZodStringFormat<"base64"> {
|
|
|
601
603
|
export const ZodBase64: core.$constructor<ZodBase64> = /*@__PURE__*/ core.$constructor("ZodBase64", (inst, def) => {
|
|
602
604
|
// ZodStringFormat.init(inst, def);
|
|
603
605
|
core.$ZodBase64.init(inst, def);
|
|
604
|
-
|
|
606
|
+
ZodStringFormat.init(inst, def);
|
|
605
607
|
});
|
|
606
608
|
export function base64(params?: string | core.$ZodBase64Params): ZodBase64 {
|
|
607
609
|
return core._base64(ZodBase64, params);
|
|
@@ -616,7 +618,7 @@ export const ZodBase64URL: core.$constructor<ZodBase64URL> = /*@__PURE__*/ core.
|
|
|
616
618
|
(inst, def) => {
|
|
617
619
|
// ZodStringFormat.init(inst, def);
|
|
618
620
|
core.$ZodBase64URL.init(inst, def);
|
|
619
|
-
|
|
621
|
+
ZodStringFormat.init(inst, def);
|
|
620
622
|
}
|
|
621
623
|
);
|
|
622
624
|
export function base64url(params?: string | core.$ZodBase64URLParams): ZodBase64URL {
|
|
@@ -630,7 +632,7 @@ export interface ZodE164 extends ZodStringFormat<"e164"> {
|
|
|
630
632
|
export const ZodE164: core.$constructor<ZodE164> = /*@__PURE__*/ core.$constructor("ZodE164", (inst, def) => {
|
|
631
633
|
// ZodStringFormat.init(inst, def);
|
|
632
634
|
core.$ZodE164.init(inst, def);
|
|
633
|
-
|
|
635
|
+
ZodStringFormat.init(inst, def);
|
|
634
636
|
});
|
|
635
637
|
|
|
636
638
|
export function e164(params?: string | core.$ZodE164Params): ZodE164 {
|
|
@@ -644,7 +646,7 @@ export interface ZodJWT extends ZodStringFormat<"jwt"> {
|
|
|
644
646
|
export const ZodJWT: core.$constructor<ZodJWT> = /*@__PURE__*/ core.$constructor("ZodJWT", (inst, def) => {
|
|
645
647
|
// ZodStringFormat.init(inst, def);
|
|
646
648
|
core.$ZodJWT.init(inst, def);
|
|
647
|
-
|
|
649
|
+
ZodStringFormat.init(inst, def);
|
|
648
650
|
});
|
|
649
651
|
|
|
650
652
|
export function jwt(params?: string | core.$ZodJWTParams): ZodJWT {
|
|
@@ -663,7 +665,7 @@ export interface _ZodNumber<Input = unknown> extends ZodType {
|
|
|
663
665
|
/** Identical to .max() */
|
|
664
666
|
lte(value: number, params?: string | core.$ZodCheckLessThanParams): this;
|
|
665
667
|
max(value: number, params?: string | core.$ZodCheckLessThanParams): this;
|
|
666
|
-
/**
|
|
668
|
+
/** Consider `z.int()` instead. This API is considered *legacy*; it will never be removed but a better alternative exists. */
|
|
667
669
|
int(params?: string | core.$ZodCheckNumberFormatParams): this;
|
|
668
670
|
/** @deprecated This is now identical to `.int()` instead. Only numbers in the safe integer range are accepted. */
|
|
669
671
|
safe(params?: string | core.$ZodCheckNumberFormatParams): this;
|
|
@@ -675,12 +677,12 @@ export interface _ZodNumber<Input = unknown> extends ZodType {
|
|
|
675
677
|
/** @deprecated Use `.multipleOf()` instead. */
|
|
676
678
|
step(value: number, params?: string | core.$ZodCheckMultipleOfParams): this;
|
|
677
679
|
|
|
678
|
-
/** @deprecated In v4 and later, z.number() does not allow infinite values. This is a no-op. */
|
|
680
|
+
/** @deprecated In v4 and later, z.number() does not allow infinite values by default. This is a no-op. */
|
|
679
681
|
finite(params?: any): this;
|
|
680
682
|
|
|
681
683
|
minValue: number | null;
|
|
682
684
|
maxValue: number | null;
|
|
683
|
-
/** @deprecated Check `format` property instead. */
|
|
685
|
+
/** @deprecated Check the `format` property instead. */
|
|
684
686
|
isInt: boolean;
|
|
685
687
|
/** @deprecated Number schemas no longer accept infinite values, so this always returns `true`. */
|
|
686
688
|
isFinite: boolean;
|