zod 3.25.24-beta.1 → 3.25.24
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/cjs/v4/classic/schemas.js +1 -1
- package/dist/cjs/v4/core/checks.js +1 -1
- package/dist/cjs/v4/core/core.js +9 -14
- package/dist/cjs/v4/core/errors.js +0 -16
- package/dist/esm/v4/classic/schemas.js +1 -1
- package/dist/esm/v4/core/checks.js +1 -1
- package/dist/esm/v4/core/core.js +9 -14
- package/dist/esm/v4/core/errors.js +0 -16
- package/package.json +1 -1
|
@@ -115,7 +115,7 @@ exports.coerce = __importStar(require("./coerce.js"));
|
|
|
115
115
|
exports.ZodType = core.$constructor("ZodType", (inst, def) => {
|
|
116
116
|
core.$ZodType.init(inst, def);
|
|
117
117
|
inst.def = def;
|
|
118
|
-
inst
|
|
118
|
+
Object.defineProperty(inst, "_def", { value: def });
|
|
119
119
|
// base methods
|
|
120
120
|
inst.check = (...checks) => {
|
|
121
121
|
return inst.clone({
|
|
@@ -163,7 +163,7 @@ exports.$ZodCheckNumberFormat = core.$constructor("$ZodCheckNumberFormat", (inst
|
|
|
163
163
|
input,
|
|
164
164
|
code: "too_big",
|
|
165
165
|
maximum: Number.MAX_SAFE_INTEGER,
|
|
166
|
-
note: "Integers must be within the
|
|
166
|
+
note: "Integers must be within the safe integer range.",
|
|
167
167
|
inst,
|
|
168
168
|
origin,
|
|
169
169
|
continue: !def.abort,
|
package/dist/cjs/v4/core/core.js
CHANGED
|
@@ -10,9 +10,7 @@ function $constructor(name, initializer, params) {
|
|
|
10
10
|
value: inst._zod ?? {},
|
|
11
11
|
enumerable: false,
|
|
12
12
|
});
|
|
13
|
-
// inst._zod ??= {} as any;a
|
|
14
13
|
(_a = inst._zod).traits ?? (_a.traits = new Set());
|
|
15
|
-
// const seen = inst._zod.traits.has(name);
|
|
16
14
|
inst._zod.traits.add(name);
|
|
17
15
|
initializer(inst, def);
|
|
18
16
|
// support prototype modifications
|
|
@@ -22,23 +20,20 @@ function $constructor(name, initializer, params) {
|
|
|
22
20
|
inst._zod.constr = _;
|
|
23
21
|
inst._zod.def = def;
|
|
24
22
|
}
|
|
25
|
-
|
|
26
|
-
var _a;
|
|
27
|
-
init(instance, def);
|
|
28
|
-
(_a = instance._zod).deferred ?? (_a.deferred = []);
|
|
29
|
-
for (const fn of instance._zod.deferred) {
|
|
30
|
-
fn();
|
|
31
|
-
}
|
|
32
|
-
return instance;
|
|
33
|
-
}
|
|
23
|
+
// doesn't work if Parent has a constructor with arguments
|
|
34
24
|
const Parent = params?.Parent ?? Object;
|
|
35
25
|
class Definition extends Parent {
|
|
36
26
|
}
|
|
27
|
+
Object.defineProperty(Definition, "name", { value: name });
|
|
37
28
|
function _(def) {
|
|
38
|
-
|
|
39
|
-
|
|
29
|
+
var _a;
|
|
30
|
+
const inst = params?.Parent ? new Definition() : this;
|
|
31
|
+
init(inst, def);
|
|
32
|
+
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
33
|
+
for (const fn of inst._zod.deferred) {
|
|
34
|
+
fn();
|
|
40
35
|
}
|
|
41
|
-
return
|
|
36
|
+
return inst;
|
|
42
37
|
}
|
|
43
38
|
Object.defineProperty(_, "init", { value: init });
|
|
44
39
|
Object.defineProperty(_, Symbol.hasInstance, {
|
|
@@ -41,7 +41,6 @@ const initializer = (inst, def) => {
|
|
|
41
41
|
value: def,
|
|
42
42
|
enumerable: false,
|
|
43
43
|
});
|
|
44
|
-
// inst.message = JSON.stringify(def, util.jsonStringifyReplacer, 2);
|
|
45
44
|
Object.defineProperty(inst, "message", {
|
|
46
45
|
get() {
|
|
47
46
|
return JSON.stringify(def, util.jsonStringifyReplacer, 2);
|
|
@@ -49,21 +48,6 @@ const initializer = (inst, def) => {
|
|
|
49
48
|
enumerable: true,
|
|
50
49
|
// configurable: false,
|
|
51
50
|
});
|
|
52
|
-
// inst.toString = () => inst.message;
|
|
53
|
-
// inst.message = `Invalid input`;
|
|
54
|
-
// Object.defineProperty(inst, "message", {
|
|
55
|
-
// get() {
|
|
56
|
-
// return (
|
|
57
|
-
// "\n" +
|
|
58
|
-
// inst.issues
|
|
59
|
-
// .map((iss) => {
|
|
60
|
-
// return `✖ ${iss.message}${iss.path.length ? ` [${iss.path.join(".")}]` : ""}`;
|
|
61
|
-
// })
|
|
62
|
-
// .join("\n")
|
|
63
|
-
// );
|
|
64
|
-
// },
|
|
65
|
-
// enumerable: false,
|
|
66
|
-
// });
|
|
67
51
|
};
|
|
68
52
|
exports.$ZodError = (0, core_js_1.$constructor)("$ZodError", initializer);
|
|
69
53
|
exports.$ZodRealError = (0, core_js_1.$constructor)("$ZodError", initializer, { Parent: Error });
|
|
@@ -8,7 +8,7 @@ export * as coerce from "./coerce.js";
|
|
|
8
8
|
export const ZodType = /*@__PURE__*/ core.$constructor("ZodType", (inst, def) => {
|
|
9
9
|
core.$ZodType.init(inst, def);
|
|
10
10
|
inst.def = def;
|
|
11
|
-
inst
|
|
11
|
+
Object.defineProperty(inst, "_def", { value: def });
|
|
12
12
|
// base methods
|
|
13
13
|
inst.check = (...checks) => {
|
|
14
14
|
return inst.clone({
|
|
@@ -137,7 +137,7 @@ export const $ZodCheckNumberFormat = /*@__PURE__*/ core.$constructor("$ZodCheckN
|
|
|
137
137
|
input,
|
|
138
138
|
code: "too_big",
|
|
139
139
|
maximum: Number.MAX_SAFE_INTEGER,
|
|
140
|
-
note: "Integers must be within the
|
|
140
|
+
note: "Integers must be within the safe integer range.",
|
|
141
141
|
inst,
|
|
142
142
|
origin,
|
|
143
143
|
continue: !def.abort,
|
package/dist/esm/v4/core/core.js
CHANGED
|
@@ -5,9 +5,7 @@ export /*@__NO_SIDE_EFFECTS__*/ function $constructor(name, initializer, params)
|
|
|
5
5
|
value: inst._zod ?? {},
|
|
6
6
|
enumerable: false,
|
|
7
7
|
});
|
|
8
|
-
// inst._zod ??= {} as any;a
|
|
9
8
|
(_a = inst._zod).traits ?? (_a.traits = new Set());
|
|
10
|
-
// const seen = inst._zod.traits.has(name);
|
|
11
9
|
inst._zod.traits.add(name);
|
|
12
10
|
initializer(inst, def);
|
|
13
11
|
// support prototype modifications
|
|
@@ -17,23 +15,20 @@ export /*@__NO_SIDE_EFFECTS__*/ function $constructor(name, initializer, params)
|
|
|
17
15
|
inst._zod.constr = _;
|
|
18
16
|
inst._zod.def = def;
|
|
19
17
|
}
|
|
20
|
-
|
|
21
|
-
var _a;
|
|
22
|
-
init(instance, def);
|
|
23
|
-
(_a = instance._zod).deferred ?? (_a.deferred = []);
|
|
24
|
-
for (const fn of instance._zod.deferred) {
|
|
25
|
-
fn();
|
|
26
|
-
}
|
|
27
|
-
return instance;
|
|
28
|
-
}
|
|
18
|
+
// doesn't work if Parent has a constructor with arguments
|
|
29
19
|
const Parent = params?.Parent ?? Object;
|
|
30
20
|
class Definition extends Parent {
|
|
31
21
|
}
|
|
22
|
+
Object.defineProperty(Definition, "name", { value: name });
|
|
32
23
|
function _(def) {
|
|
33
|
-
|
|
34
|
-
|
|
24
|
+
var _a;
|
|
25
|
+
const inst = params?.Parent ? new Definition() : this;
|
|
26
|
+
init(inst, def);
|
|
27
|
+
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
28
|
+
for (const fn of inst._zod.deferred) {
|
|
29
|
+
fn();
|
|
35
30
|
}
|
|
36
|
-
return
|
|
31
|
+
return inst;
|
|
37
32
|
}
|
|
38
33
|
Object.defineProperty(_, "init", { value: init });
|
|
39
34
|
Object.defineProperty(_, Symbol.hasInstance, {
|
|
@@ -10,7 +10,6 @@ const initializer = (inst, def) => {
|
|
|
10
10
|
value: def,
|
|
11
11
|
enumerable: false,
|
|
12
12
|
});
|
|
13
|
-
// inst.message = JSON.stringify(def, util.jsonStringifyReplacer, 2);
|
|
14
13
|
Object.defineProperty(inst, "message", {
|
|
15
14
|
get() {
|
|
16
15
|
return JSON.stringify(def, util.jsonStringifyReplacer, 2);
|
|
@@ -18,21 +17,6 @@ const initializer = (inst, def) => {
|
|
|
18
17
|
enumerable: true,
|
|
19
18
|
// configurable: false,
|
|
20
19
|
});
|
|
21
|
-
// inst.toString = () => inst.message;
|
|
22
|
-
// inst.message = `Invalid input`;
|
|
23
|
-
// Object.defineProperty(inst, "message", {
|
|
24
|
-
// get() {
|
|
25
|
-
// return (
|
|
26
|
-
// "\n" +
|
|
27
|
-
// inst.issues
|
|
28
|
-
// .map((iss) => {
|
|
29
|
-
// return `✖ ${iss.message}${iss.path.length ? ` [${iss.path.join(".")}]` : ""}`;
|
|
30
|
-
// })
|
|
31
|
-
// .join("\n")
|
|
32
|
-
// );
|
|
33
|
-
// },
|
|
34
|
-
// enumerable: false,
|
|
35
|
-
// });
|
|
36
20
|
};
|
|
37
21
|
export const $ZodError = $constructor("$ZodError", initializer);
|
|
38
22
|
export const $ZodRealError = $constructor("$ZodError", initializer, { Parent: Error });
|
package/package.json
CHANGED