zod 3.26.0-canary.20250702T074442 → 3.26.0-canary.20250703T011142
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/package.json +18 -18
- package/v4/core/errors.d.cts +4 -0
- package/v4/core/errors.d.ts +4 -0
- package/v4/core/schemas.cjs +3 -0
- package/v4/core/schemas.js +3 -0
- package/v4/core/util.cjs +2 -0
- package/v4/core/util.js +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zod",
|
|
3
|
-
"version": "3.26.0-canary.
|
|
3
|
+
"version": "3.26.0-canary.20250703T011142",
|
|
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",
|
|
@@ -29,14 +29,14 @@
|
|
|
29
29
|
"zshy": {
|
|
30
30
|
"exports": {
|
|
31
31
|
"./package.json": "./package.json",
|
|
32
|
-
".": "./index.ts",
|
|
33
|
-
"./v3": "./v3/index.ts",
|
|
34
|
-
"./v4": "./v4/index.ts",
|
|
35
|
-
"./v4-mini": "./v4-mini/index.ts",
|
|
36
|
-
"./v4/mini": "./v4/mini/index.ts",
|
|
37
|
-
"./v4/core": "./v4/core/index.ts",
|
|
38
|
-
"./v4/locales": "./v4/locales/index.ts",
|
|
39
|
-
"./v4/locales/*": "./v4/locales/*"
|
|
32
|
+
".": "./src/index.ts",
|
|
33
|
+
"./v3": "./src/v3/index.ts",
|
|
34
|
+
"./v4": "./src/v4/index.ts",
|
|
35
|
+
"./v4-mini": "./src/v4-mini/index.ts",
|
|
36
|
+
"./v4/mini": "./src/v4/mini/index.ts",
|
|
37
|
+
"./v4/core": "./src/v4/core/index.ts",
|
|
38
|
+
"./v4/locales": "./src/v4/locales/index.ts",
|
|
39
|
+
"./v4/locales/*": "./src/v4/locales/*"
|
|
40
40
|
},
|
|
41
41
|
"sourceDialects": [
|
|
42
42
|
"@zod/source"
|
|
@@ -45,49 +45,49 @@
|
|
|
45
45
|
"exports": {
|
|
46
46
|
"./package.json": "./package.json",
|
|
47
47
|
".": {
|
|
48
|
-
"@zod/source": "./index.ts",
|
|
48
|
+
"@zod/source": "./src/index.ts",
|
|
49
49
|
"types": "./index.d.cts",
|
|
50
50
|
"import": "./index.js",
|
|
51
51
|
"require": "./index.cjs"
|
|
52
52
|
},
|
|
53
53
|
"./v3": {
|
|
54
|
-
"@zod/source": "./v3/index.ts",
|
|
54
|
+
"@zod/source": "./src/v3/index.ts",
|
|
55
55
|
"types": "./v3/index.d.cts",
|
|
56
56
|
"import": "./v3/index.js",
|
|
57
57
|
"require": "./v3/index.cjs"
|
|
58
58
|
},
|
|
59
59
|
"./v4": {
|
|
60
|
-
"@zod/source": "./v4/index.ts",
|
|
60
|
+
"@zod/source": "./src/v4/index.ts",
|
|
61
61
|
"types": "./v4/index.d.cts",
|
|
62
62
|
"import": "./v4/index.js",
|
|
63
63
|
"require": "./v4/index.cjs"
|
|
64
64
|
},
|
|
65
65
|
"./v4-mini": {
|
|
66
|
-
"@zod/source": "./v4-mini/index.ts",
|
|
66
|
+
"@zod/source": "./src/v4-mini/index.ts",
|
|
67
67
|
"types": "./v4-mini/index.d.cts",
|
|
68
68
|
"import": "./v4-mini/index.js",
|
|
69
69
|
"require": "./v4-mini/index.cjs"
|
|
70
70
|
},
|
|
71
71
|
"./v4/mini": {
|
|
72
|
-
"@zod/source": "./v4/mini/index.ts",
|
|
72
|
+
"@zod/source": "./src/v4/mini/index.ts",
|
|
73
73
|
"types": "./v4/mini/index.d.cts",
|
|
74
74
|
"import": "./v4/mini/index.js",
|
|
75
75
|
"require": "./v4/mini/index.cjs"
|
|
76
76
|
},
|
|
77
77
|
"./v4/core": {
|
|
78
|
-
"@zod/source": "./v4/core/index.ts",
|
|
78
|
+
"@zod/source": "./src/v4/core/index.ts",
|
|
79
79
|
"types": "./v4/core/index.d.cts",
|
|
80
80
|
"import": "./v4/core/index.js",
|
|
81
81
|
"require": "./v4/core/index.cjs"
|
|
82
82
|
},
|
|
83
83
|
"./v4/locales": {
|
|
84
|
-
"@zod/source": "./v4/locales/index.ts",
|
|
84
|
+
"@zod/source": "./src/v4/locales/index.ts",
|
|
85
85
|
"types": "./v4/locales/index.d.cts",
|
|
86
86
|
"import": "./v4/locales/index.js",
|
|
87
87
|
"require": "./v4/locales/index.cjs"
|
|
88
88
|
},
|
|
89
89
|
"./v4/locales/*": {
|
|
90
|
-
"@zod/source": "./v4/locales/*",
|
|
90
|
+
"@zod/source": "./src/v4/locales/*",
|
|
91
91
|
"types": "./v4/locales/*",
|
|
92
92
|
"import": "./v4/locales/*",
|
|
93
93
|
"require": "./v4/locales/*"
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
},
|
|
108
108
|
"scripts": {
|
|
109
109
|
"clean": "rm -rf dist && git clean -qxdf . -e node_modules",
|
|
110
|
-
"build": "pnpm clean && zshy",
|
|
110
|
+
"build": "pnpm clean && zshy --project tsconfig.build.json",
|
|
111
111
|
"postbuild": "pnpm biome check --write .",
|
|
112
112
|
"test:watch": "pnpm vitest",
|
|
113
113
|
"test": "pnpm vitest run",
|
package/v4/core/errors.d.cts
CHANGED
|
@@ -18,13 +18,17 @@ export interface $ZodIssueTooBig<Input = unknown> extends $ZodIssueBase {
|
|
|
18
18
|
readonly origin: "number" | "int" | "bigint" | "date" | "string" | "array" | "set" | "file" | (string & {});
|
|
19
19
|
readonly maximum: number | bigint;
|
|
20
20
|
readonly inclusive?: boolean;
|
|
21
|
+
readonly exact?: boolean;
|
|
21
22
|
readonly input: Input;
|
|
22
23
|
}
|
|
23
24
|
export interface $ZodIssueTooSmall<Input = unknown> extends $ZodIssueBase {
|
|
24
25
|
readonly code: "too_small";
|
|
25
26
|
readonly origin: "number" | "int" | "bigint" | "date" | "string" | "array" | "set" | "file" | (string & {});
|
|
26
27
|
readonly minimum: number | bigint;
|
|
28
|
+
/** True if the allowable range includes the minimum */
|
|
27
29
|
readonly inclusive?: boolean;
|
|
30
|
+
/** True if the allowed value is fixed (e.g.` z.length(5)`), not a range (`z.minLength(5)`) */
|
|
31
|
+
readonly exact?: boolean;
|
|
28
32
|
readonly input: Input;
|
|
29
33
|
}
|
|
30
34
|
export interface $ZodIssueInvalidStringFormat extends $ZodIssueBase {
|
package/v4/core/errors.d.ts
CHANGED
|
@@ -18,13 +18,17 @@ export interface $ZodIssueTooBig<Input = unknown> extends $ZodIssueBase {
|
|
|
18
18
|
readonly origin: "number" | "int" | "bigint" | "date" | "string" | "array" | "set" | "file" | (string & {});
|
|
19
19
|
readonly maximum: number | bigint;
|
|
20
20
|
readonly inclusive?: boolean;
|
|
21
|
+
readonly exact?: boolean;
|
|
21
22
|
readonly input: Input;
|
|
22
23
|
}
|
|
23
24
|
export interface $ZodIssueTooSmall<Input = unknown> extends $ZodIssueBase {
|
|
24
25
|
readonly code: "too_small";
|
|
25
26
|
readonly origin: "number" | "int" | "bigint" | "date" | "string" | "array" | "set" | "file" | (string & {});
|
|
26
27
|
readonly minimum: number | bigint;
|
|
28
|
+
/** True if the allowable range includes the minimum */
|
|
27
29
|
readonly inclusive?: boolean;
|
|
30
|
+
/** True if the allowed value is fixed (e.g.` z.length(5)`), not a range (`z.minLength(5)`) */
|
|
31
|
+
readonly exact?: boolean;
|
|
28
32
|
readonly input: Input;
|
|
29
33
|
}
|
|
30
34
|
export interface $ZodIssueInvalidStringFormat extends $ZodIssueBase {
|
package/v4/core/schemas.cjs
CHANGED
|
@@ -1447,6 +1447,9 @@ exports.$ZodOptional = core.$constructor("$ZodOptional", (inst, def) => {
|
|
|
1447
1447
|
return pattern ? new RegExp(`^(${util.cleanRegex(pattern.source)})?$`) : undefined;
|
|
1448
1448
|
});
|
|
1449
1449
|
inst._zod.parse = (payload, ctx) => {
|
|
1450
|
+
if (def.innerType._zod.optin === "optional") {
|
|
1451
|
+
return def.innerType._zod.run(payload, ctx);
|
|
1452
|
+
}
|
|
1450
1453
|
if (payload.value === undefined) {
|
|
1451
1454
|
return payload;
|
|
1452
1455
|
}
|
package/v4/core/schemas.js
CHANGED
|
@@ -1416,6 +1416,9 @@ export const $ZodOptional = /*@__PURE__*/ core.$constructor("$ZodOptional", (ins
|
|
|
1416
1416
|
return pattern ? new RegExp(`^(${util.cleanRegex(pattern.source)})?$`) : undefined;
|
|
1417
1417
|
});
|
|
1418
1418
|
inst._zod.parse = (payload, ctx) => {
|
|
1419
|
+
if (def.innerType._zod.optin === "optional") {
|
|
1420
|
+
return def.innerType._zod.run(payload, ctx);
|
|
1421
|
+
}
|
|
1419
1422
|
if (payload.value === undefined) {
|
|
1420
1423
|
return payload;
|
|
1421
1424
|
}
|
package/v4/core/util.cjs
CHANGED
|
@@ -397,6 +397,7 @@ function partial(Class, schema, mask) {
|
|
|
397
397
|
}
|
|
398
398
|
if (!mask[key])
|
|
399
399
|
continue;
|
|
400
|
+
// if (oldShape[key]!._zod.optin === "optional") continue;
|
|
400
401
|
shape[key] = Class
|
|
401
402
|
? new Class({
|
|
402
403
|
type: "optional",
|
|
@@ -407,6 +408,7 @@ function partial(Class, schema, mask) {
|
|
|
407
408
|
}
|
|
408
409
|
else {
|
|
409
410
|
for (const key in oldShape) {
|
|
411
|
+
// if (oldShape[key]!._zod.optin === "optional") continue;
|
|
410
412
|
shape[key] = Class
|
|
411
413
|
? new Class({
|
|
412
414
|
type: "optional",
|
package/v4/core/util.js
CHANGED
|
@@ -352,6 +352,7 @@ export function partial(Class, schema, mask) {
|
|
|
352
352
|
}
|
|
353
353
|
if (!mask[key])
|
|
354
354
|
continue;
|
|
355
|
+
// if (oldShape[key]!._zod.optin === "optional") continue;
|
|
355
356
|
shape[key] = Class
|
|
356
357
|
? new Class({
|
|
357
358
|
type: "optional",
|
|
@@ -362,6 +363,7 @@ export function partial(Class, schema, mask) {
|
|
|
362
363
|
}
|
|
363
364
|
else {
|
|
364
365
|
for (const key in oldShape) {
|
|
366
|
+
// if (oldShape[key]!._zod.optin === "optional") continue;
|
|
365
367
|
shape[key] = Class
|
|
366
368
|
? new Class({
|
|
367
369
|
type: "optional",
|