@milaboratories/graph-maker 1.1.140 → 1.1.141
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/GraphMaker/index.vue.js +24 -23
- package/dist/GraphMaker/index.vue.js.map +1 -1
- package/dist/GraphMaker/store.js +9 -9
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.d.ts.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.js +54 -52
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.js.map +1 -1
- package/dist/GraphMaker/utils/loadDefaultSources.js +4 -3
- package/dist/GraphMaker/utils/loadDefaultSources.js.map +1 -1
- package/dist/_virtual/_commonjsHelpers.js +3 -5
- package/dist/_virtual/_commonjsHelpers.js.map +1 -1
- package/dist/node_modules/@milaboratories/pf-plots/dist/_virtual/_commonjsHelpers.js +9 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/_virtual/_commonjsHelpers.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/_virtual/canonicalize.js +8 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/_virtual/canonicalize.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/_virtual/lodash.js +8 -0
- package/dist/{_virtual → node_modules/@milaboratories/pf-plots/dist/_virtual}/lodash.js.map +1 -1
- package/dist/{_virtual/lodash.js → node_modules/@milaboratories/pf-plots/dist/_virtual/lodash2.js} +1 -1
- package/dist/node_modules/@milaboratories/pf-plots/dist/_virtual/lodash2.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/_virtual/stringify.js +3 -0
- package/dist/{_virtual → node_modules/@milaboratories/pf-plots/dist/_virtual}/stringify.js.map +1 -1
- package/dist/{_virtual/stringify.js → node_modules/@milaboratories/pf-plots/dist/_virtual/stringify2.js} +1 -1
- package/dist/node_modules/@milaboratories/pf-plots/dist/_virtual/stringify2.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/constants.js +15 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/constants.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/ComponentController.js +198 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/ComponentController.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/ControllerBase.js +342 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/ControllerBase.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/bubble.js +278 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/bubble.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/dendro.js +453 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/dendro.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/discrete.js +203 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/discrete.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/heatmap.js +432 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/heatmap.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/histogram.js +170 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/histogram.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/scatterplot-umap.js +315 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/scatterplot-umap.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/scatterplot.js +323 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/scatterplot.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/demoStore.js +11 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/demoStore.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/index.js +36 -3426
- package/dist/node_modules/@milaboratories/pf-plots/dist/index.js.map +1 -1
- package/dist/node_modules/@milaboratories/{pl-error-like → pf-plots/dist/node_modules/@milaboratories/pl-error-like}/dist/index.js +1 -1
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-error-like/dist/index.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/index.js +979 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/index.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/dist/index.js +1599 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/dist/index.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/canonicalize/lib/canonicalize.js +19 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/canonicalize/lib/canonicalize.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/json-stringify-safe/stringify.js +26 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/json-stringify-safe/stringify.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/lodash/lodash.js +3678 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/lodash/lodash.js.map +1 -0
- package/dist/node_modules/{zod → @milaboratories/pf-plots/dist/node_modules/zod}/lib/index.js +1141 -1141
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/zod/lib/index.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/pframe/ColumnsProvider.js +247 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/pframe/ColumnsProvider.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/spec.js +62 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/spec.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/utils.js +286 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/utils.js.map +1 -0
- package/package.json +2 -2
- package/dist/node_modules/@milaboratories/pl-error-like/dist/index.js.map +0 -1
- package/dist/node_modules/@milaboratories/pl-model-common/dist/index.js +0 -584
- package/dist/node_modules/@milaboratories/pl-model-common/dist/index.js.map +0 -1
- package/dist/node_modules/@platforma-sdk/model/dist/index.js +0 -1559
- package/dist/node_modules/@platforma-sdk/model/dist/index.js.map +0 -1
- package/dist/node_modules/json-stringify-safe/stringify.js +0 -20
- package/dist/node_modules/json-stringify-safe/stringify.js.map +0 -1
- package/dist/node_modules/lodash/lodash.js +0 -3678
- package/dist/node_modules/lodash/lodash.js.map +0 -1
- package/dist/node_modules/zod/lib/index.js.map +0 -1
package/dist/node_modules/{zod → @milaboratories/pf-plots/dist/node_modules/zod}/lib/index.js
RENAMED
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
var
|
|
2
|
-
(function(
|
|
3
|
-
|
|
1
|
+
var _;
|
|
2
|
+
(function(a) {
|
|
3
|
+
a.assertEqual = (n) => n;
|
|
4
4
|
function e(n) {
|
|
5
5
|
}
|
|
6
|
-
|
|
6
|
+
a.assertIs = e;
|
|
7
7
|
function t(n) {
|
|
8
8
|
throw new Error();
|
|
9
9
|
}
|
|
10
|
-
|
|
11
|
-
const
|
|
10
|
+
a.assertNever = t, a.arrayToEnum = (n) => {
|
|
11
|
+
const o = {};
|
|
12
12
|
for (const i of n)
|
|
13
|
-
|
|
14
|
-
return
|
|
15
|
-
},
|
|
16
|
-
const
|
|
17
|
-
for (const
|
|
18
|
-
i[
|
|
19
|
-
return
|
|
20
|
-
},
|
|
21
|
-
return n[
|
|
22
|
-
}),
|
|
23
|
-
const
|
|
13
|
+
o[i] = i;
|
|
14
|
+
return o;
|
|
15
|
+
}, a.getValidEnumValues = (n) => {
|
|
16
|
+
const o = a.objectKeys(n).filter((r) => typeof n[n[r]] != "number"), i = {};
|
|
17
|
+
for (const r of o)
|
|
18
|
+
i[r] = n[r];
|
|
19
|
+
return a.objectValues(i);
|
|
20
|
+
}, a.objectValues = (n) => a.objectKeys(n).map(function(o) {
|
|
21
|
+
return n[o];
|
|
22
|
+
}), a.objectKeys = typeof Object.keys == "function" ? (n) => Object.keys(n) : (n) => {
|
|
23
|
+
const o = [];
|
|
24
24
|
for (const i in n)
|
|
25
|
-
Object.prototype.hasOwnProperty.call(n, i) &&
|
|
26
|
-
return
|
|
27
|
-
},
|
|
25
|
+
Object.prototype.hasOwnProperty.call(n, i) && o.push(i);
|
|
26
|
+
return o;
|
|
27
|
+
}, a.find = (n, o) => {
|
|
28
28
|
for (const i of n)
|
|
29
|
-
if (
|
|
29
|
+
if (o(i))
|
|
30
30
|
return i;
|
|
31
|
-
},
|
|
32
|
-
function s(n,
|
|
33
|
-
return n.map((i) => typeof i == "string" ? `'${i}'` : i).join(
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
})(
|
|
37
|
-
var
|
|
38
|
-
(function(
|
|
39
|
-
|
|
31
|
+
}, a.isInteger = typeof Number.isInteger == "function" ? (n) => Number.isInteger(n) : (n) => typeof n == "number" && isFinite(n) && Math.floor(n) === n;
|
|
32
|
+
function s(n, o = " | ") {
|
|
33
|
+
return n.map((i) => typeof i == "string" ? `'${i}'` : i).join(o);
|
|
34
|
+
}
|
|
35
|
+
a.joinValues = s, a.jsonStringifyReplacer = (n, o) => typeof o == "bigint" ? o.toString() : o;
|
|
36
|
+
})(_ || (_ = {}));
|
|
37
|
+
var ke;
|
|
38
|
+
(function(a) {
|
|
39
|
+
a.mergeShapes = (e, t) => ({
|
|
40
40
|
...e,
|
|
41
41
|
...t
|
|
42
42
|
// second overwrites first
|
|
43
43
|
});
|
|
44
|
-
})(
|
|
45
|
-
const
|
|
44
|
+
})(ke || (ke = {}));
|
|
45
|
+
const l = _.arrayToEnum([
|
|
46
46
|
"string",
|
|
47
47
|
"nan",
|
|
48
48
|
"number",
|
|
@@ -63,28 +63,28 @@ const f = g.arrayToEnum([
|
|
|
63
63
|
"never",
|
|
64
64
|
"map",
|
|
65
65
|
"set"
|
|
66
|
-
]),
|
|
67
|
-
switch (typeof
|
|
66
|
+
]), P = (a) => {
|
|
67
|
+
switch (typeof a) {
|
|
68
68
|
case "undefined":
|
|
69
|
-
return
|
|
69
|
+
return l.undefined;
|
|
70
70
|
case "string":
|
|
71
|
-
return
|
|
71
|
+
return l.string;
|
|
72
72
|
case "number":
|
|
73
|
-
return isNaN(
|
|
73
|
+
return isNaN(a) ? l.nan : l.number;
|
|
74
74
|
case "boolean":
|
|
75
|
-
return
|
|
75
|
+
return l.boolean;
|
|
76
76
|
case "function":
|
|
77
|
-
return
|
|
77
|
+
return l.function;
|
|
78
78
|
case "bigint":
|
|
79
|
-
return
|
|
79
|
+
return l.bigint;
|
|
80
80
|
case "symbol":
|
|
81
|
-
return
|
|
81
|
+
return l.symbol;
|
|
82
82
|
case "object":
|
|
83
|
-
return Array.isArray(
|
|
83
|
+
return Array.isArray(a) ? l.array : a === null ? l.null : a.then && typeof a.then == "function" && a.catch && typeof a.catch == "function" ? l.promise : typeof Map < "u" && a instanceof Map ? l.map : typeof Set < "u" && a instanceof Set ? l.set : typeof Date < "u" && a instanceof Date ? l.date : l.object;
|
|
84
84
|
default:
|
|
85
|
-
return
|
|
85
|
+
return l.unknown;
|
|
86
86
|
}
|
|
87
|
-
}, d =
|
|
87
|
+
}, d = _.arrayToEnum([
|
|
88
88
|
"invalid_type",
|
|
89
89
|
"invalid_literal",
|
|
90
90
|
"custom",
|
|
@@ -101,7 +101,7 @@ const f = g.arrayToEnum([
|
|
|
101
101
|
"invalid_intersection_types",
|
|
102
102
|
"not_multiple_of",
|
|
103
103
|
"not_finite"
|
|
104
|
-
]),
|
|
104
|
+
]), Me = (a) => JSON.stringify(a, null, 2).replace(/"([^"]+)":/g, "$1:");
|
|
105
105
|
class w extends Error {
|
|
106
106
|
constructor(e) {
|
|
107
107
|
super(), this.issues = [], this.addIssue = (s) => {
|
|
@@ -116,10 +116,10 @@ class w extends Error {
|
|
|
116
116
|
return this.issues;
|
|
117
117
|
}
|
|
118
118
|
format(e) {
|
|
119
|
-
const t = e || function(
|
|
120
|
-
return
|
|
121
|
-
}, s = { _errors: [] }, n = (
|
|
122
|
-
for (const i of
|
|
119
|
+
const t = e || function(o) {
|
|
120
|
+
return o.message;
|
|
121
|
+
}, s = { _errors: [] }, n = (o) => {
|
|
122
|
+
for (const i of o.issues)
|
|
123
123
|
if (i.code === "invalid_union")
|
|
124
124
|
i.unionErrors.map(n);
|
|
125
125
|
else if (i.code === "invalid_return_type")
|
|
@@ -129,10 +129,10 @@ class w extends Error {
|
|
|
129
129
|
else if (i.path.length === 0)
|
|
130
130
|
s._errors.push(t(i));
|
|
131
131
|
else {
|
|
132
|
-
let
|
|
133
|
-
for (;
|
|
134
|
-
const
|
|
135
|
-
|
|
132
|
+
let r = s, u = 0;
|
|
133
|
+
for (; u < i.path.length; ) {
|
|
134
|
+
const h = i.path[u];
|
|
135
|
+
u === i.path.length - 1 ? (r[h] = r[h] || { _errors: [] }, r[h]._errors.push(t(i))) : r[h] = r[h] || { _errors: [] }, r = r[h], u++;
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
};
|
|
@@ -146,7 +146,7 @@ class w extends Error {
|
|
|
146
146
|
return this.message;
|
|
147
147
|
}
|
|
148
148
|
get message() {
|
|
149
|
-
return JSON.stringify(this.issues,
|
|
149
|
+
return JSON.stringify(this.issues, _.jsonStringifyReplacer, 2);
|
|
150
150
|
}
|
|
151
151
|
get isEmpty() {
|
|
152
152
|
return this.issues.length === 0;
|
|
@@ -161,27 +161,27 @@ class w extends Error {
|
|
|
161
161
|
return this.flatten();
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
|
-
w.create = (
|
|
165
|
-
const
|
|
164
|
+
w.create = (a) => new w(a);
|
|
165
|
+
const K = (a, e) => {
|
|
166
166
|
let t;
|
|
167
|
-
switch (
|
|
167
|
+
switch (a.code) {
|
|
168
168
|
case d.invalid_type:
|
|
169
|
-
|
|
169
|
+
a.received === l.undefined ? t = "Required" : t = `Expected ${a.expected}, received ${a.received}`;
|
|
170
170
|
break;
|
|
171
171
|
case d.invalid_literal:
|
|
172
|
-
t = `Invalid literal value, expected ${JSON.stringify(
|
|
172
|
+
t = `Invalid literal value, expected ${JSON.stringify(a.expected, _.jsonStringifyReplacer)}`;
|
|
173
173
|
break;
|
|
174
174
|
case d.unrecognized_keys:
|
|
175
|
-
t = `Unrecognized key(s) in object: ${
|
|
175
|
+
t = `Unrecognized key(s) in object: ${_.joinValues(a.keys, ", ")}`;
|
|
176
176
|
break;
|
|
177
177
|
case d.invalid_union:
|
|
178
178
|
t = "Invalid input";
|
|
179
179
|
break;
|
|
180
180
|
case d.invalid_union_discriminator:
|
|
181
|
-
t = `Invalid discriminator value. Expected ${
|
|
181
|
+
t = `Invalid discriminator value. Expected ${_.joinValues(a.options)}`;
|
|
182
182
|
break;
|
|
183
183
|
case d.invalid_enum_value:
|
|
184
|
-
t = `Invalid enum value. Expected ${
|
|
184
|
+
t = `Invalid enum value. Expected ${_.joinValues(a.options)}, received '${a.received}'`;
|
|
185
185
|
break;
|
|
186
186
|
case d.invalid_arguments:
|
|
187
187
|
t = "Invalid function arguments";
|
|
@@ -193,13 +193,13 @@ const W = (r, e) => {
|
|
|
193
193
|
t = "Invalid date";
|
|
194
194
|
break;
|
|
195
195
|
case d.invalid_string:
|
|
196
|
-
typeof
|
|
196
|
+
typeof a.validation == "object" ? "includes" in a.validation ? (t = `Invalid input: must include "${a.validation.includes}"`, typeof a.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${a.validation.position}`)) : "startsWith" in a.validation ? t = `Invalid input: must start with "${a.validation.startsWith}"` : "endsWith" in a.validation ? t = `Invalid input: must end with "${a.validation.endsWith}"` : _.assertNever(a.validation) : a.validation !== "regex" ? t = `Invalid ${a.validation}` : t = "Invalid";
|
|
197
197
|
break;
|
|
198
198
|
case d.too_small:
|
|
199
|
-
|
|
199
|
+
a.type === "array" ? t = `Array must contain ${a.exact ? "exactly" : a.inclusive ? "at least" : "more than"} ${a.minimum} element(s)` : a.type === "string" ? t = `String must contain ${a.exact ? "exactly" : a.inclusive ? "at least" : "over"} ${a.minimum} character(s)` : a.type === "number" ? t = `Number must be ${a.exact ? "exactly equal to " : a.inclusive ? "greater than or equal to " : "greater than "}${a.minimum}` : a.type === "date" ? t = `Date must be ${a.exact ? "exactly equal to " : a.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(a.minimum))}` : t = "Invalid input";
|
|
200
200
|
break;
|
|
201
201
|
case d.too_big:
|
|
202
|
-
|
|
202
|
+
a.type === "array" ? t = `Array must contain ${a.exact ? "exactly" : a.inclusive ? "at most" : "less than"} ${a.maximum} element(s)` : a.type === "string" ? t = `String must contain ${a.exact ? "exactly" : a.inclusive ? "at most" : "under"} ${a.maximum} character(s)` : a.type === "number" ? t = `Number must be ${a.exact ? "exactly" : a.inclusive ? "less than or equal to" : "less than"} ${a.maximum}` : a.type === "bigint" ? t = `BigInt must be ${a.exact ? "exactly" : a.inclusive ? "less than or equal to" : "less than"} ${a.maximum}` : a.type === "date" ? t = `Date must be ${a.exact ? "exactly" : a.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(a.maximum))}` : t = "Invalid input";
|
|
203
203
|
break;
|
|
204
204
|
case d.custom:
|
|
205
205
|
t = "Invalid input";
|
|
@@ -208,60 +208,60 @@ const W = (r, e) => {
|
|
|
208
208
|
t = "Intersection results could not be merged";
|
|
209
209
|
break;
|
|
210
210
|
case d.not_multiple_of:
|
|
211
|
-
t = `Number must be a multiple of ${
|
|
211
|
+
t = `Number must be a multiple of ${a.multipleOf}`;
|
|
212
212
|
break;
|
|
213
213
|
case d.not_finite:
|
|
214
214
|
t = "Number must be finite";
|
|
215
215
|
break;
|
|
216
216
|
default:
|
|
217
|
-
t = e.defaultError,
|
|
217
|
+
t = e.defaultError, _.assertNever(a);
|
|
218
218
|
}
|
|
219
219
|
return { message: t };
|
|
220
220
|
};
|
|
221
|
-
let Ne =
|
|
222
|
-
function De(
|
|
223
|
-
Ne =
|
|
221
|
+
let Ne = K;
|
|
222
|
+
function De(a) {
|
|
223
|
+
Ne = a;
|
|
224
224
|
}
|
|
225
225
|
function ue() {
|
|
226
226
|
return Ne;
|
|
227
227
|
}
|
|
228
|
-
const
|
|
229
|
-
const { data: e, path: t, errorMaps: s, issueData: n } =
|
|
228
|
+
const ce = (a) => {
|
|
229
|
+
const { data: e, path: t, errorMaps: s, issueData: n } = a, o = [...t, ...n.path || []], i = {
|
|
230
230
|
...n,
|
|
231
|
-
path:
|
|
231
|
+
path: o
|
|
232
232
|
};
|
|
233
233
|
if (n.message !== void 0)
|
|
234
234
|
return {
|
|
235
235
|
...n,
|
|
236
|
-
path:
|
|
236
|
+
path: o,
|
|
237
237
|
message: n.message
|
|
238
238
|
};
|
|
239
|
-
let
|
|
240
|
-
const
|
|
241
|
-
for (const
|
|
242
|
-
|
|
239
|
+
let r = "";
|
|
240
|
+
const u = s.filter((h) => !!h).slice().reverse();
|
|
241
|
+
for (const h of u)
|
|
242
|
+
r = h(i, { data: e, defaultError: r }).message;
|
|
243
243
|
return {
|
|
244
244
|
...n,
|
|
245
|
-
path:
|
|
246
|
-
message:
|
|
245
|
+
path: o,
|
|
246
|
+
message: r
|
|
247
247
|
};
|
|
248
248
|
}, Le = [];
|
|
249
|
-
function
|
|
250
|
-
const t = ue(), s =
|
|
249
|
+
function c(a, e) {
|
|
250
|
+
const t = ue(), s = ce({
|
|
251
251
|
issueData: e,
|
|
252
|
-
data:
|
|
253
|
-
path:
|
|
252
|
+
data: a.data,
|
|
253
|
+
path: a.path,
|
|
254
254
|
errorMaps: [
|
|
255
|
-
|
|
256
|
-
|
|
255
|
+
a.common.contextualErrorMap,
|
|
256
|
+
a.schemaErrorMap,
|
|
257
257
|
t,
|
|
258
|
-
t ===
|
|
258
|
+
t === K ? void 0 : K
|
|
259
259
|
// then global default map
|
|
260
260
|
].filter((n) => !!n)
|
|
261
261
|
});
|
|
262
|
-
|
|
262
|
+
a.common.issues.push(s);
|
|
263
263
|
}
|
|
264
|
-
class
|
|
264
|
+
class b {
|
|
265
265
|
constructor() {
|
|
266
266
|
this.value = "valid";
|
|
267
267
|
}
|
|
@@ -275,7 +275,7 @@ class k {
|
|
|
275
275
|
const s = [];
|
|
276
276
|
for (const n of t) {
|
|
277
277
|
if (n.status === "aborted")
|
|
278
|
-
return
|
|
278
|
+
return f;
|
|
279
279
|
n.status === "dirty" && e.dirty(), s.push(n.value);
|
|
280
280
|
}
|
|
281
281
|
return { status: e.value, value: s };
|
|
@@ -283,42 +283,42 @@ class k {
|
|
|
283
283
|
static async mergeObjectAsync(e, t) {
|
|
284
284
|
const s = [];
|
|
285
285
|
for (const n of t) {
|
|
286
|
-
const
|
|
286
|
+
const o = await n.key, i = await n.value;
|
|
287
287
|
s.push({
|
|
288
|
-
key:
|
|
288
|
+
key: o,
|
|
289
289
|
value: i
|
|
290
290
|
});
|
|
291
291
|
}
|
|
292
|
-
return
|
|
292
|
+
return b.mergeObjectSync(e, s);
|
|
293
293
|
}
|
|
294
294
|
static mergeObjectSync(e, t) {
|
|
295
295
|
const s = {};
|
|
296
296
|
for (const n of t) {
|
|
297
|
-
const { key:
|
|
298
|
-
if (
|
|
299
|
-
return
|
|
300
|
-
|
|
297
|
+
const { key: o, value: i } = n;
|
|
298
|
+
if (o.status === "aborted" || i.status === "aborted")
|
|
299
|
+
return f;
|
|
300
|
+
o.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), o.value !== "__proto__" && (typeof i.value < "u" || n.alwaysSet) && (s[o.value] = i.value);
|
|
301
301
|
}
|
|
302
302
|
return { status: e.value, value: s };
|
|
303
303
|
}
|
|
304
304
|
}
|
|
305
|
-
const
|
|
305
|
+
const f = Object.freeze({
|
|
306
306
|
status: "aborted"
|
|
307
|
-
}),
|
|
308
|
-
function
|
|
309
|
-
if (typeof e == "function" ?
|
|
310
|
-
return e.get(
|
|
307
|
+
}), le = (a) => ({ status: "dirty", value: a }), x = (a) => ({ status: "valid", value: a }), be = (a) => a.status === "aborted", xe = (a) => a.status === "dirty", Y = (a) => a.status === "valid", J = (a) => typeof Promise < "u" && a instanceof Promise;
|
|
308
|
+
function he(a, e, t, s) {
|
|
309
|
+
if (typeof e == "function" ? a !== e || !0 : !e.has(a)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
310
|
+
return e.get(a);
|
|
311
311
|
}
|
|
312
|
-
function
|
|
313
|
-
if (typeof e == "function" ?
|
|
314
|
-
return e.set(
|
|
312
|
+
function Ce(a, e, t, s, n) {
|
|
313
|
+
if (typeof e == "function" ? a !== e || !0 : !e.has(a)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
314
|
+
return e.set(a, t), t;
|
|
315
315
|
}
|
|
316
|
-
var
|
|
317
|
-
(function(
|
|
318
|
-
|
|
319
|
-
})(
|
|
320
|
-
var
|
|
321
|
-
class
|
|
316
|
+
var p;
|
|
317
|
+
(function(a) {
|
|
318
|
+
a.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, a.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
|
|
319
|
+
})(p || (p = {}));
|
|
320
|
+
var W, q;
|
|
321
|
+
class C {
|
|
322
322
|
constructor(e, t, s, n) {
|
|
323
323
|
this._cachedPath = [], this.parent = e, this.data = t, this._path = s, this._key = n;
|
|
324
324
|
}
|
|
@@ -326,34 +326,34 @@ class O {
|
|
|
326
326
|
return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
|
-
const
|
|
330
|
-
if (
|
|
329
|
+
const Te = (a, e) => {
|
|
330
|
+
if (Y(e))
|
|
331
331
|
return { success: !0, data: e.value };
|
|
332
|
-
if (!
|
|
332
|
+
if (!a.common.issues.length)
|
|
333
333
|
throw new Error("Validation failed but no issues detected.");
|
|
334
334
|
return {
|
|
335
335
|
success: !1,
|
|
336
336
|
get error() {
|
|
337
337
|
if (this._error)
|
|
338
338
|
return this._error;
|
|
339
|
-
const t = new w(
|
|
339
|
+
const t = new w(a.common.issues);
|
|
340
340
|
return this._error = t, this._error;
|
|
341
341
|
}
|
|
342
342
|
};
|
|
343
343
|
};
|
|
344
|
-
function
|
|
345
|
-
if (!
|
|
344
|
+
function y(a) {
|
|
345
|
+
if (!a)
|
|
346
346
|
return {};
|
|
347
|
-
const { errorMap: e, invalid_type_error: t, required_error: s, description: n } =
|
|
347
|
+
const { errorMap: e, invalid_type_error: t, required_error: s, description: n } = a;
|
|
348
348
|
if (e && (t || s))
|
|
349
349
|
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
350
|
-
return e ? { errorMap: e, description: n } : { errorMap: (
|
|
351
|
-
var
|
|
352
|
-
const { message:
|
|
353
|
-
return
|
|
350
|
+
return e ? { errorMap: e, description: n } : { errorMap: (o, i) => {
|
|
351
|
+
var r, u;
|
|
352
|
+
const { message: h } = a;
|
|
353
|
+
return o.code === "invalid_enum_value" ? { message: h ?? i.defaultError } : typeof i.data > "u" ? { message: (r = h ?? s) !== null && r !== void 0 ? r : i.defaultError } : o.code !== "invalid_type" ? { message: i.defaultError } : { message: (u = h ?? t) !== null && u !== void 0 ? u : i.defaultError };
|
|
354
354
|
}, description: n };
|
|
355
355
|
}
|
|
356
|
-
class
|
|
356
|
+
class v {
|
|
357
357
|
constructor(e) {
|
|
358
358
|
this.spa = this.safeParseAsync, this._def = e, this.parse = this.parse.bind(this), this.safeParse = this.safeParse.bind(this), this.parseAsync = this.parseAsync.bind(this), this.safeParseAsync = this.safeParseAsync.bind(this), this.spa = this.spa.bind(this), this.refine = this.refine.bind(this), this.refinement = this.refinement.bind(this), this.superRefine = this.superRefine.bind(this), this.optional = this.optional.bind(this), this.nullable = this.nullable.bind(this), this.nullish = this.nullish.bind(this), this.array = this.array.bind(this), this.promise = this.promise.bind(this), this.or = this.or.bind(this), this.and = this.and.bind(this), this.transform = this.transform.bind(this), this.brand = this.brand.bind(this), this.default = this.default.bind(this), this.catch = this.catch.bind(this), this.describe = this.describe.bind(this), this.pipe = this.pipe.bind(this), this.readonly = this.readonly.bind(this), this.isNullable = this.isNullable.bind(this), this.isOptional = this.isOptional.bind(this);
|
|
359
359
|
}
|
|
@@ -361,13 +361,13 @@ class _ {
|
|
|
361
361
|
return this._def.description;
|
|
362
362
|
}
|
|
363
363
|
_getType(e) {
|
|
364
|
-
return
|
|
364
|
+
return P(e.data);
|
|
365
365
|
}
|
|
366
366
|
_getOrReturnCtx(e, t) {
|
|
367
367
|
return t || {
|
|
368
368
|
common: e.parent.common,
|
|
369
369
|
data: e.data,
|
|
370
|
-
parsedType:
|
|
370
|
+
parsedType: P(e.data),
|
|
371
371
|
schemaErrorMap: this._def.errorMap,
|
|
372
372
|
path: e.path,
|
|
373
373
|
parent: e.parent
|
|
@@ -375,11 +375,11 @@ class _ {
|
|
|
375
375
|
}
|
|
376
376
|
_processInputParams(e) {
|
|
377
377
|
return {
|
|
378
|
-
status: new
|
|
378
|
+
status: new b(),
|
|
379
379
|
ctx: {
|
|
380
380
|
common: e.parent.common,
|
|
381
381
|
data: e.data,
|
|
382
|
-
parsedType:
|
|
382
|
+
parsedType: P(e.data),
|
|
383
383
|
schemaErrorMap: this._def.errorMap,
|
|
384
384
|
path: e.path,
|
|
385
385
|
parent: e.parent
|
|
@@ -388,7 +388,7 @@ class _ {
|
|
|
388
388
|
}
|
|
389
389
|
_parseSync(e) {
|
|
390
390
|
const t = this._parse(e);
|
|
391
|
-
if (
|
|
391
|
+
if (J(t))
|
|
392
392
|
throw new Error("Synchronous parse encountered promise.");
|
|
393
393
|
return t;
|
|
394
394
|
}
|
|
@@ -414,9 +414,9 @@ class _ {
|
|
|
414
414
|
schemaErrorMap: this._def.errorMap,
|
|
415
415
|
parent: null,
|
|
416
416
|
data: e,
|
|
417
|
-
parsedType:
|
|
418
|
-
},
|
|
419
|
-
return
|
|
417
|
+
parsedType: P(e)
|
|
418
|
+
}, o = this._parseSync({ data: e, path: n.path, parent: n });
|
|
419
|
+
return Te(n, o);
|
|
420
420
|
}
|
|
421
421
|
async parseAsync(e, t) {
|
|
422
422
|
const s = await this.safeParseAsync(e, t);
|
|
@@ -435,27 +435,27 @@ class _ {
|
|
|
435
435
|
schemaErrorMap: this._def.errorMap,
|
|
436
436
|
parent: null,
|
|
437
437
|
data: e,
|
|
438
|
-
parsedType:
|
|
439
|
-
}, n = this._parse({ data: e, path: s.path, parent: s }),
|
|
440
|
-
return
|
|
438
|
+
parsedType: P(e)
|
|
439
|
+
}, n = this._parse({ data: e, path: s.path, parent: s }), o = await (J(n) ? n : Promise.resolve(n));
|
|
440
|
+
return Te(s, o);
|
|
441
441
|
}
|
|
442
442
|
refine(e, t) {
|
|
443
443
|
const s = (n) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(n) : t;
|
|
444
|
-
return this._refinement((n,
|
|
445
|
-
const i = e(n),
|
|
444
|
+
return this._refinement((n, o) => {
|
|
445
|
+
const i = e(n), r = () => o.addIssue({
|
|
446
446
|
code: d.custom,
|
|
447
447
|
...s(n)
|
|
448
448
|
});
|
|
449
|
-
return typeof Promise < "u" && i instanceof Promise ? i.then((
|
|
449
|
+
return typeof Promise < "u" && i instanceof Promise ? i.then((u) => u ? !0 : (r(), !1)) : i ? !0 : (r(), !1);
|
|
450
450
|
});
|
|
451
451
|
}
|
|
452
452
|
refinement(e, t) {
|
|
453
453
|
return this._refinement((s, n) => e(s) ? !0 : (n.addIssue(typeof t == "function" ? t(s, n) : t), !1));
|
|
454
454
|
}
|
|
455
455
|
_refinement(e) {
|
|
456
|
-
return new
|
|
456
|
+
return new O({
|
|
457
457
|
schema: this,
|
|
458
|
-
typeName:
|
|
458
|
+
typeName: m.ZodEffects,
|
|
459
459
|
effect: { type: "refinement", refinement: e }
|
|
460
460
|
});
|
|
461
461
|
}
|
|
@@ -466,54 +466,54 @@ class _ {
|
|
|
466
466
|
return N.create(this, this._def);
|
|
467
467
|
}
|
|
468
468
|
nullable() {
|
|
469
|
-
return
|
|
469
|
+
return M.create(this, this._def);
|
|
470
470
|
}
|
|
471
471
|
nullish() {
|
|
472
472
|
return this.nullable().optional();
|
|
473
473
|
}
|
|
474
474
|
array() {
|
|
475
|
-
return
|
|
475
|
+
return T.create(this, this._def);
|
|
476
476
|
}
|
|
477
477
|
promise() {
|
|
478
|
-
return
|
|
478
|
+
return F.create(this, this._def);
|
|
479
479
|
}
|
|
480
480
|
or(e) {
|
|
481
|
-
return
|
|
481
|
+
return Q.create([this, e], this._def);
|
|
482
482
|
}
|
|
483
483
|
and(e) {
|
|
484
|
-
return
|
|
484
|
+
return ee.create(this, e, this._def);
|
|
485
485
|
}
|
|
486
486
|
transform(e) {
|
|
487
|
-
return new
|
|
488
|
-
...
|
|
487
|
+
return new O({
|
|
488
|
+
...y(this._def),
|
|
489
489
|
schema: this,
|
|
490
|
-
typeName:
|
|
490
|
+
typeName: m.ZodEffects,
|
|
491
491
|
effect: { type: "transform", transform: e }
|
|
492
492
|
});
|
|
493
493
|
}
|
|
494
494
|
default(e) {
|
|
495
495
|
const t = typeof e == "function" ? e : () => e;
|
|
496
496
|
return new ie({
|
|
497
|
-
...
|
|
497
|
+
...y(this._def),
|
|
498
498
|
innerType: this,
|
|
499
499
|
defaultValue: t,
|
|
500
|
-
typeName:
|
|
500
|
+
typeName: m.ZodDefault
|
|
501
501
|
});
|
|
502
502
|
}
|
|
503
503
|
brand() {
|
|
504
|
-
return new
|
|
505
|
-
typeName:
|
|
504
|
+
return new Ze({
|
|
505
|
+
typeName: m.ZodBranded,
|
|
506
506
|
type: this,
|
|
507
|
-
...
|
|
507
|
+
...y(this._def)
|
|
508
508
|
});
|
|
509
509
|
}
|
|
510
510
|
catch(e) {
|
|
511
511
|
const t = typeof e == "function" ? e : () => e;
|
|
512
|
-
return new
|
|
513
|
-
...
|
|
512
|
+
return new re({
|
|
513
|
+
...y(this._def),
|
|
514
514
|
innerType: this,
|
|
515
515
|
catchValue: t,
|
|
516
|
-
typeName:
|
|
516
|
+
typeName: m.ZodCatch
|
|
517
517
|
});
|
|
518
518
|
}
|
|
519
519
|
describe(e) {
|
|
@@ -524,10 +524,10 @@ class _ {
|
|
|
524
524
|
});
|
|
525
525
|
}
|
|
526
526
|
pipe(e) {
|
|
527
|
-
return
|
|
527
|
+
return de.create(this, e);
|
|
528
528
|
}
|
|
529
529
|
readonly() {
|
|
530
|
-
return
|
|
530
|
+
return oe.create(this);
|
|
531
531
|
}
|
|
532
532
|
isOptional() {
|
|
533
533
|
return this.safeParse(void 0).success;
|
|
@@ -536,172 +536,172 @@ class _ {
|
|
|
536
536
|
return this.safeParse(null).success;
|
|
537
537
|
}
|
|
538
538
|
}
|
|
539
|
-
const
|
|
539
|
+
const Ve = /^c[^\s-]{8,}$/i, ze = /^[0-9a-z]+$/, Ue = /^[0-9A-HJKMNP-TV-Z]{26}$/, Ke = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, Be = /^[a-z0-9_-]{21}$/i, Fe = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, We = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, qe = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
540
540
|
let ge;
|
|
541
|
-
const
|
|
542
|
-
function
|
|
541
|
+
const Ye = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, Je = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/, He = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Se = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", Ge = new RegExp(`^${Se}$`);
|
|
542
|
+
function Ee(a) {
|
|
543
543
|
let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
|
|
544
|
-
return
|
|
544
|
+
return a.precision ? e = `${e}\\.\\d{${a.precision}}` : a.precision == null && (e = `${e}(\\.\\d+)?`), e;
|
|
545
545
|
}
|
|
546
|
-
function
|
|
547
|
-
return new RegExp(`^${
|
|
546
|
+
function Xe(a) {
|
|
547
|
+
return new RegExp(`^${Ee(a)}$`);
|
|
548
548
|
}
|
|
549
|
-
function
|
|
550
|
-
let e = `${
|
|
549
|
+
function je(a) {
|
|
550
|
+
let e = `${Se}T${Ee(a)}`;
|
|
551
551
|
const t = [];
|
|
552
|
-
return t.push(
|
|
552
|
+
return t.push(a.local ? "Z?" : "Z"), a.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
|
|
553
553
|
}
|
|
554
|
-
function
|
|
555
|
-
return !!((e === "v4" || !e) &&
|
|
554
|
+
function Qe(a, e) {
|
|
555
|
+
return !!((e === "v4" || !e) && Ye.test(a) || (e === "v6" || !e) && Je.test(a));
|
|
556
556
|
}
|
|
557
|
-
class Z extends
|
|
557
|
+
class Z extends v {
|
|
558
558
|
_parse(e) {
|
|
559
|
-
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !==
|
|
560
|
-
const
|
|
561
|
-
return
|
|
559
|
+
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== l.string) {
|
|
560
|
+
const n = this._getOrReturnCtx(e);
|
|
561
|
+
return c(n, {
|
|
562
562
|
code: d.invalid_type,
|
|
563
|
-
expected:
|
|
564
|
-
received:
|
|
565
|
-
}),
|
|
563
|
+
expected: l.string,
|
|
564
|
+
received: n.parsedType
|
|
565
|
+
}), f;
|
|
566
566
|
}
|
|
567
|
-
const
|
|
568
|
-
let
|
|
569
|
-
for (const
|
|
570
|
-
if (
|
|
571
|
-
e.data.length <
|
|
567
|
+
const t = new b();
|
|
568
|
+
let s;
|
|
569
|
+
for (const n of this._def.checks)
|
|
570
|
+
if (n.kind === "min")
|
|
571
|
+
e.data.length < n.value && (s = this._getOrReturnCtx(e, s), c(s, {
|
|
572
572
|
code: d.too_small,
|
|
573
|
-
minimum:
|
|
573
|
+
minimum: n.value,
|
|
574
574
|
type: "string",
|
|
575
575
|
inclusive: !0,
|
|
576
576
|
exact: !1,
|
|
577
|
-
message:
|
|
578
|
-
}),
|
|
579
|
-
else if (
|
|
580
|
-
e.data.length >
|
|
577
|
+
message: n.message
|
|
578
|
+
}), t.dirty());
|
|
579
|
+
else if (n.kind === "max")
|
|
580
|
+
e.data.length > n.value && (s = this._getOrReturnCtx(e, s), c(s, {
|
|
581
581
|
code: d.too_big,
|
|
582
|
-
maximum:
|
|
582
|
+
maximum: n.value,
|
|
583
583
|
type: "string",
|
|
584
584
|
inclusive: !0,
|
|
585
585
|
exact: !1,
|
|
586
|
-
message:
|
|
587
|
-
}),
|
|
588
|
-
else if (
|
|
589
|
-
const
|
|
590
|
-
(
|
|
586
|
+
message: n.message
|
|
587
|
+
}), t.dirty());
|
|
588
|
+
else if (n.kind === "length") {
|
|
589
|
+
const o = e.data.length > n.value, i = e.data.length < n.value;
|
|
590
|
+
(o || i) && (s = this._getOrReturnCtx(e, s), o ? c(s, {
|
|
591
591
|
code: d.too_big,
|
|
592
|
-
maximum:
|
|
592
|
+
maximum: n.value,
|
|
593
593
|
type: "string",
|
|
594
594
|
inclusive: !0,
|
|
595
595
|
exact: !0,
|
|
596
|
-
message:
|
|
597
|
-
}) :
|
|
596
|
+
message: n.message
|
|
597
|
+
}) : i && c(s, {
|
|
598
598
|
code: d.too_small,
|
|
599
|
-
minimum:
|
|
599
|
+
minimum: n.value,
|
|
600
600
|
type: "string",
|
|
601
601
|
inclusive: !0,
|
|
602
602
|
exact: !0,
|
|
603
|
-
message:
|
|
604
|
-
}),
|
|
605
|
-
} else if (
|
|
606
|
-
|
|
603
|
+
message: n.message
|
|
604
|
+
}), t.dirty());
|
|
605
|
+
} else if (n.kind === "email")
|
|
606
|
+
We.test(e.data) || (s = this._getOrReturnCtx(e, s), c(s, {
|
|
607
607
|
validation: "email",
|
|
608
608
|
code: d.invalid_string,
|
|
609
|
-
message:
|
|
610
|
-
}),
|
|
611
|
-
else if (
|
|
612
|
-
ge || (ge = new RegExp(
|
|
609
|
+
message: n.message
|
|
610
|
+
}), t.dirty());
|
|
611
|
+
else if (n.kind === "emoji")
|
|
612
|
+
ge || (ge = new RegExp(qe, "u")), ge.test(e.data) || (s = this._getOrReturnCtx(e, s), c(s, {
|
|
613
613
|
validation: "emoji",
|
|
614
614
|
code: d.invalid_string,
|
|
615
|
-
message:
|
|
616
|
-
}),
|
|
617
|
-
else if (
|
|
618
|
-
|
|
615
|
+
message: n.message
|
|
616
|
+
}), t.dirty());
|
|
617
|
+
else if (n.kind === "uuid")
|
|
618
|
+
Ke.test(e.data) || (s = this._getOrReturnCtx(e, s), c(s, {
|
|
619
619
|
validation: "uuid",
|
|
620
620
|
code: d.invalid_string,
|
|
621
|
-
message:
|
|
622
|
-
}),
|
|
623
|
-
else if (
|
|
624
|
-
|
|
621
|
+
message: n.message
|
|
622
|
+
}), t.dirty());
|
|
623
|
+
else if (n.kind === "nanoid")
|
|
624
|
+
Be.test(e.data) || (s = this._getOrReturnCtx(e, s), c(s, {
|
|
625
625
|
validation: "nanoid",
|
|
626
626
|
code: d.invalid_string,
|
|
627
|
-
message:
|
|
628
|
-
}),
|
|
629
|
-
else if (
|
|
630
|
-
|
|
627
|
+
message: n.message
|
|
628
|
+
}), t.dirty());
|
|
629
|
+
else if (n.kind === "cuid")
|
|
630
|
+
Ve.test(e.data) || (s = this._getOrReturnCtx(e, s), c(s, {
|
|
631
631
|
validation: "cuid",
|
|
632
632
|
code: d.invalid_string,
|
|
633
|
-
message:
|
|
634
|
-
}),
|
|
635
|
-
else if (
|
|
636
|
-
|
|
633
|
+
message: n.message
|
|
634
|
+
}), t.dirty());
|
|
635
|
+
else if (n.kind === "cuid2")
|
|
636
|
+
ze.test(e.data) || (s = this._getOrReturnCtx(e, s), c(s, {
|
|
637
637
|
validation: "cuid2",
|
|
638
638
|
code: d.invalid_string,
|
|
639
|
-
message:
|
|
640
|
-
}),
|
|
641
|
-
else if (
|
|
642
|
-
|
|
639
|
+
message: n.message
|
|
640
|
+
}), t.dirty());
|
|
641
|
+
else if (n.kind === "ulid")
|
|
642
|
+
Ue.test(e.data) || (s = this._getOrReturnCtx(e, s), c(s, {
|
|
643
643
|
validation: "ulid",
|
|
644
644
|
code: d.invalid_string,
|
|
645
|
-
message:
|
|
646
|
-
}),
|
|
647
|
-
else if (
|
|
645
|
+
message: n.message
|
|
646
|
+
}), t.dirty());
|
|
647
|
+
else if (n.kind === "url")
|
|
648
648
|
try {
|
|
649
649
|
new URL(e.data);
|
|
650
650
|
} catch {
|
|
651
|
-
|
|
651
|
+
s = this._getOrReturnCtx(e, s), c(s, {
|
|
652
652
|
validation: "url",
|
|
653
653
|
code: d.invalid_string,
|
|
654
|
-
message:
|
|
655
|
-
}),
|
|
654
|
+
message: n.message
|
|
655
|
+
}), t.dirty();
|
|
656
656
|
}
|
|
657
|
-
else
|
|
657
|
+
else n.kind === "regex" ? (n.regex.lastIndex = 0, n.regex.test(e.data) || (s = this._getOrReturnCtx(e, s), c(s, {
|
|
658
658
|
validation: "regex",
|
|
659
659
|
code: d.invalid_string,
|
|
660
|
-
message:
|
|
661
|
-
}),
|
|
660
|
+
message: n.message
|
|
661
|
+
}), t.dirty())) : n.kind === "trim" ? e.data = e.data.trim() : n.kind === "includes" ? e.data.includes(n.value, n.position) || (s = this._getOrReturnCtx(e, s), c(s, {
|
|
662
662
|
code: d.invalid_string,
|
|
663
|
-
validation: { includes:
|
|
664
|
-
message:
|
|
665
|
-
}),
|
|
663
|
+
validation: { includes: n.value, position: n.position },
|
|
664
|
+
message: n.message
|
|
665
|
+
}), t.dirty()) : n.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : n.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : n.kind === "startsWith" ? e.data.startsWith(n.value) || (s = this._getOrReturnCtx(e, s), c(s, {
|
|
666
666
|
code: d.invalid_string,
|
|
667
|
-
validation: { startsWith:
|
|
668
|
-
message:
|
|
669
|
-
}),
|
|
667
|
+
validation: { startsWith: n.value },
|
|
668
|
+
message: n.message
|
|
669
|
+
}), t.dirty()) : n.kind === "endsWith" ? e.data.endsWith(n.value) || (s = this._getOrReturnCtx(e, s), c(s, {
|
|
670
670
|
code: d.invalid_string,
|
|
671
|
-
validation: { endsWith:
|
|
672
|
-
message:
|
|
673
|
-
}),
|
|
671
|
+
validation: { endsWith: n.value },
|
|
672
|
+
message: n.message
|
|
673
|
+
}), t.dirty()) : n.kind === "datetime" ? je(n).test(e.data) || (s = this._getOrReturnCtx(e, s), c(s, {
|
|
674
674
|
code: d.invalid_string,
|
|
675
675
|
validation: "datetime",
|
|
676
|
-
message:
|
|
677
|
-
}),
|
|
676
|
+
message: n.message
|
|
677
|
+
}), t.dirty()) : n.kind === "date" ? Ge.test(e.data) || (s = this._getOrReturnCtx(e, s), c(s, {
|
|
678
678
|
code: d.invalid_string,
|
|
679
679
|
validation: "date",
|
|
680
|
-
message:
|
|
681
|
-
}),
|
|
680
|
+
message: n.message
|
|
681
|
+
}), t.dirty()) : n.kind === "time" ? Xe(n).test(e.data) || (s = this._getOrReturnCtx(e, s), c(s, {
|
|
682
682
|
code: d.invalid_string,
|
|
683
683
|
validation: "time",
|
|
684
|
-
message:
|
|
685
|
-
}),
|
|
684
|
+
message: n.message
|
|
685
|
+
}), t.dirty()) : n.kind === "duration" ? Fe.test(e.data) || (s = this._getOrReturnCtx(e, s), c(s, {
|
|
686
686
|
validation: "duration",
|
|
687
687
|
code: d.invalid_string,
|
|
688
|
-
message:
|
|
689
|
-
}),
|
|
688
|
+
message: n.message
|
|
689
|
+
}), t.dirty()) : n.kind === "ip" ? Qe(e.data, n.version) || (s = this._getOrReturnCtx(e, s), c(s, {
|
|
690
690
|
validation: "ip",
|
|
691
691
|
code: d.invalid_string,
|
|
692
|
-
message:
|
|
693
|
-
}),
|
|
692
|
+
message: n.message
|
|
693
|
+
}), t.dirty()) : n.kind === "base64" ? He.test(e.data) || (s = this._getOrReturnCtx(e, s), c(s, {
|
|
694
694
|
validation: "base64",
|
|
695
695
|
code: d.invalid_string,
|
|
696
|
-
message:
|
|
697
|
-
}),
|
|
698
|
-
return { status:
|
|
696
|
+
message: n.message
|
|
697
|
+
}), t.dirty()) : _.assertNever(n);
|
|
698
|
+
return { status: t.value, value: e.data };
|
|
699
699
|
}
|
|
700
700
|
_regex(e, t, s) {
|
|
701
701
|
return this.refinement((n) => e.test(n), {
|
|
702
702
|
validation: t,
|
|
703
703
|
code: d.invalid_string,
|
|
704
|
-
...
|
|
704
|
+
...p.errToObj(s)
|
|
705
705
|
});
|
|
706
706
|
}
|
|
707
707
|
_addCheck(e) {
|
|
@@ -711,34 +711,34 @@ class Z extends _ {
|
|
|
711
711
|
});
|
|
712
712
|
}
|
|
713
713
|
email(e) {
|
|
714
|
-
return this._addCheck({ kind: "email", ...
|
|
714
|
+
return this._addCheck({ kind: "email", ...p.errToObj(e) });
|
|
715
715
|
}
|
|
716
716
|
url(e) {
|
|
717
|
-
return this._addCheck({ kind: "url", ...
|
|
717
|
+
return this._addCheck({ kind: "url", ...p.errToObj(e) });
|
|
718
718
|
}
|
|
719
719
|
emoji(e) {
|
|
720
|
-
return this._addCheck({ kind: "emoji", ...
|
|
720
|
+
return this._addCheck({ kind: "emoji", ...p.errToObj(e) });
|
|
721
721
|
}
|
|
722
722
|
uuid(e) {
|
|
723
|
-
return this._addCheck({ kind: "uuid", ...
|
|
723
|
+
return this._addCheck({ kind: "uuid", ...p.errToObj(e) });
|
|
724
724
|
}
|
|
725
725
|
nanoid(e) {
|
|
726
|
-
return this._addCheck({ kind: "nanoid", ...
|
|
726
|
+
return this._addCheck({ kind: "nanoid", ...p.errToObj(e) });
|
|
727
727
|
}
|
|
728
728
|
cuid(e) {
|
|
729
|
-
return this._addCheck({ kind: "cuid", ...
|
|
729
|
+
return this._addCheck({ kind: "cuid", ...p.errToObj(e) });
|
|
730
730
|
}
|
|
731
731
|
cuid2(e) {
|
|
732
|
-
return this._addCheck({ kind: "cuid2", ...
|
|
732
|
+
return this._addCheck({ kind: "cuid2", ...p.errToObj(e) });
|
|
733
733
|
}
|
|
734
734
|
ulid(e) {
|
|
735
|
-
return this._addCheck({ kind: "ulid", ...
|
|
735
|
+
return this._addCheck({ kind: "ulid", ...p.errToObj(e) });
|
|
736
736
|
}
|
|
737
737
|
base64(e) {
|
|
738
|
-
return this._addCheck({ kind: "base64", ...
|
|
738
|
+
return this._addCheck({ kind: "base64", ...p.errToObj(e) });
|
|
739
739
|
}
|
|
740
740
|
ip(e) {
|
|
741
|
-
return this._addCheck({ kind: "ip", ...
|
|
741
|
+
return this._addCheck({ kind: "ip", ...p.errToObj(e) });
|
|
742
742
|
}
|
|
743
743
|
datetime(e) {
|
|
744
744
|
var t, s;
|
|
@@ -753,7 +753,7 @@ class Z extends _ {
|
|
|
753
753
|
precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
|
|
754
754
|
offset: (t = e == null ? void 0 : e.offset) !== null && t !== void 0 ? t : !1,
|
|
755
755
|
local: (s = e == null ? void 0 : e.local) !== null && s !== void 0 ? s : !1,
|
|
756
|
-
...
|
|
756
|
+
...p.errToObj(e == null ? void 0 : e.message)
|
|
757
757
|
});
|
|
758
758
|
}
|
|
759
759
|
date(e) {
|
|
@@ -767,17 +767,17 @@ class Z extends _ {
|
|
|
767
767
|
}) : this._addCheck({
|
|
768
768
|
kind: "time",
|
|
769
769
|
precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
|
|
770
|
-
...
|
|
770
|
+
...p.errToObj(e == null ? void 0 : e.message)
|
|
771
771
|
});
|
|
772
772
|
}
|
|
773
773
|
duration(e) {
|
|
774
|
-
return this._addCheck({ kind: "duration", ...
|
|
774
|
+
return this._addCheck({ kind: "duration", ...p.errToObj(e) });
|
|
775
775
|
}
|
|
776
776
|
regex(e, t) {
|
|
777
777
|
return this._addCheck({
|
|
778
778
|
kind: "regex",
|
|
779
779
|
regex: e,
|
|
780
|
-
...
|
|
780
|
+
...p.errToObj(t)
|
|
781
781
|
});
|
|
782
782
|
}
|
|
783
783
|
includes(e, t) {
|
|
@@ -785,42 +785,42 @@ class Z extends _ {
|
|
|
785
785
|
kind: "includes",
|
|
786
786
|
value: e,
|
|
787
787
|
position: t == null ? void 0 : t.position,
|
|
788
|
-
...
|
|
788
|
+
...p.errToObj(t == null ? void 0 : t.message)
|
|
789
789
|
});
|
|
790
790
|
}
|
|
791
791
|
startsWith(e, t) {
|
|
792
792
|
return this._addCheck({
|
|
793
793
|
kind: "startsWith",
|
|
794
794
|
value: e,
|
|
795
|
-
...
|
|
795
|
+
...p.errToObj(t)
|
|
796
796
|
});
|
|
797
797
|
}
|
|
798
798
|
endsWith(e, t) {
|
|
799
799
|
return this._addCheck({
|
|
800
800
|
kind: "endsWith",
|
|
801
801
|
value: e,
|
|
802
|
-
...
|
|
802
|
+
...p.errToObj(t)
|
|
803
803
|
});
|
|
804
804
|
}
|
|
805
805
|
min(e, t) {
|
|
806
806
|
return this._addCheck({
|
|
807
807
|
kind: "min",
|
|
808
808
|
value: e,
|
|
809
|
-
...
|
|
809
|
+
...p.errToObj(t)
|
|
810
810
|
});
|
|
811
811
|
}
|
|
812
812
|
max(e, t) {
|
|
813
813
|
return this._addCheck({
|
|
814
814
|
kind: "max",
|
|
815
815
|
value: e,
|
|
816
|
-
...
|
|
816
|
+
...p.errToObj(t)
|
|
817
817
|
});
|
|
818
818
|
}
|
|
819
819
|
length(e, t) {
|
|
820
820
|
return this._addCheck({
|
|
821
821
|
kind: "length",
|
|
822
822
|
value: e,
|
|
823
|
-
...
|
|
823
|
+
...p.errToObj(t)
|
|
824
824
|
});
|
|
825
825
|
}
|
|
826
826
|
/**
|
|
@@ -828,7 +828,7 @@ class Z extends _ {
|
|
|
828
828
|
* @see {@link ZodString.min}
|
|
829
829
|
*/
|
|
830
830
|
nonempty(e) {
|
|
831
|
-
return this.min(1,
|
|
831
|
+
return this.min(1, p.errToObj(e));
|
|
832
832
|
}
|
|
833
833
|
trim() {
|
|
834
834
|
return new Z({
|
|
@@ -903,78 +903,78 @@ class Z extends _ {
|
|
|
903
903
|
return e;
|
|
904
904
|
}
|
|
905
905
|
}
|
|
906
|
-
Z.create = (
|
|
906
|
+
Z.create = (a) => {
|
|
907
907
|
var e;
|
|
908
908
|
return new Z({
|
|
909
909
|
checks: [],
|
|
910
|
-
typeName:
|
|
911
|
-
coerce: (e =
|
|
912
|
-
...
|
|
910
|
+
typeName: m.ZodString,
|
|
911
|
+
coerce: (e = a == null ? void 0 : a.coerce) !== null && e !== void 0 ? e : !1,
|
|
912
|
+
...y(a)
|
|
913
913
|
});
|
|
914
914
|
};
|
|
915
|
-
function
|
|
916
|
-
const t = (
|
|
917
|
-
return
|
|
915
|
+
function et(a, e) {
|
|
916
|
+
const t = (a.toString().split(".")[1] || "").length, s = (e.toString().split(".")[1] || "").length, n = t > s ? t : s, o = parseInt(a.toFixed(n).replace(".", "")), i = parseInt(e.toFixed(n).replace(".", ""));
|
|
917
|
+
return o % i / Math.pow(10, n);
|
|
918
918
|
}
|
|
919
|
-
class
|
|
919
|
+
class R extends v {
|
|
920
920
|
constructor() {
|
|
921
921
|
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
922
922
|
}
|
|
923
923
|
_parse(e) {
|
|
924
|
-
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !==
|
|
925
|
-
const
|
|
926
|
-
return
|
|
924
|
+
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== l.number) {
|
|
925
|
+
const n = this._getOrReturnCtx(e);
|
|
926
|
+
return c(n, {
|
|
927
927
|
code: d.invalid_type,
|
|
928
|
-
expected:
|
|
929
|
-
received:
|
|
930
|
-
}),
|
|
928
|
+
expected: l.number,
|
|
929
|
+
received: n.parsedType
|
|
930
|
+
}), f;
|
|
931
931
|
}
|
|
932
|
-
let
|
|
933
|
-
const
|
|
934
|
-
for (const
|
|
935
|
-
|
|
932
|
+
let t;
|
|
933
|
+
const s = new b();
|
|
934
|
+
for (const n of this._def.checks)
|
|
935
|
+
n.kind === "int" ? _.isInteger(e.data) || (t = this._getOrReturnCtx(e, t), c(t, {
|
|
936
936
|
code: d.invalid_type,
|
|
937
937
|
expected: "integer",
|
|
938
938
|
received: "float",
|
|
939
|
-
message:
|
|
940
|
-
}),
|
|
939
|
+
message: n.message
|
|
940
|
+
}), s.dirty()) : n.kind === "min" ? (n.inclusive ? e.data < n.value : e.data <= n.value) && (t = this._getOrReturnCtx(e, t), c(t, {
|
|
941
941
|
code: d.too_small,
|
|
942
|
-
minimum:
|
|
942
|
+
minimum: n.value,
|
|
943
943
|
type: "number",
|
|
944
|
-
inclusive:
|
|
944
|
+
inclusive: n.inclusive,
|
|
945
945
|
exact: !1,
|
|
946
|
-
message:
|
|
947
|
-
}),
|
|
946
|
+
message: n.message
|
|
947
|
+
}), s.dirty()) : n.kind === "max" ? (n.inclusive ? e.data > n.value : e.data >= n.value) && (t = this._getOrReturnCtx(e, t), c(t, {
|
|
948
948
|
code: d.too_big,
|
|
949
|
-
maximum:
|
|
949
|
+
maximum: n.value,
|
|
950
950
|
type: "number",
|
|
951
|
-
inclusive:
|
|
951
|
+
inclusive: n.inclusive,
|
|
952
952
|
exact: !1,
|
|
953
|
-
message:
|
|
954
|
-
}),
|
|
953
|
+
message: n.message
|
|
954
|
+
}), s.dirty()) : n.kind === "multipleOf" ? et(e.data, n.value) !== 0 && (t = this._getOrReturnCtx(e, t), c(t, {
|
|
955
955
|
code: d.not_multiple_of,
|
|
956
|
-
multipleOf:
|
|
957
|
-
message:
|
|
958
|
-
}),
|
|
956
|
+
multipleOf: n.value,
|
|
957
|
+
message: n.message
|
|
958
|
+
}), s.dirty()) : n.kind === "finite" ? Number.isFinite(e.data) || (t = this._getOrReturnCtx(e, t), c(t, {
|
|
959
959
|
code: d.not_finite,
|
|
960
|
-
message:
|
|
961
|
-
}),
|
|
962
|
-
return { status:
|
|
960
|
+
message: n.message
|
|
961
|
+
}), s.dirty()) : _.assertNever(n);
|
|
962
|
+
return { status: s.value, value: e.data };
|
|
963
963
|
}
|
|
964
964
|
gte(e, t) {
|
|
965
|
-
return this.setLimit("min", e, !0,
|
|
965
|
+
return this.setLimit("min", e, !0, p.toString(t));
|
|
966
966
|
}
|
|
967
967
|
gt(e, t) {
|
|
968
|
-
return this.setLimit("min", e, !1,
|
|
968
|
+
return this.setLimit("min", e, !1, p.toString(t));
|
|
969
969
|
}
|
|
970
970
|
lte(e, t) {
|
|
971
|
-
return this.setLimit("max", e, !0,
|
|
971
|
+
return this.setLimit("max", e, !0, p.toString(t));
|
|
972
972
|
}
|
|
973
973
|
lt(e, t) {
|
|
974
|
-
return this.setLimit("max", e, !1,
|
|
974
|
+
return this.setLimit("max", e, !1, p.toString(t));
|
|
975
975
|
}
|
|
976
976
|
setLimit(e, t, s, n) {
|
|
977
|
-
return new
|
|
977
|
+
return new R({
|
|
978
978
|
...this._def,
|
|
979
979
|
checks: [
|
|
980
980
|
...this._def.checks,
|
|
@@ -982,13 +982,13 @@ class A extends _ {
|
|
|
982
982
|
kind: e,
|
|
983
983
|
value: t,
|
|
984
984
|
inclusive: s,
|
|
985
|
-
message:
|
|
985
|
+
message: p.toString(n)
|
|
986
986
|
}
|
|
987
987
|
]
|
|
988
988
|
});
|
|
989
989
|
}
|
|
990
990
|
_addCheck(e) {
|
|
991
|
-
return new
|
|
991
|
+
return new R({
|
|
992
992
|
...this._def,
|
|
993
993
|
checks: [...this._def.checks, e]
|
|
994
994
|
});
|
|
@@ -996,7 +996,7 @@ class A extends _ {
|
|
|
996
996
|
int(e) {
|
|
997
997
|
return this._addCheck({
|
|
998
998
|
kind: "int",
|
|
999
|
-
message:
|
|
999
|
+
message: p.toString(e)
|
|
1000
1000
|
});
|
|
1001
1001
|
}
|
|
1002
1002
|
positive(e) {
|
|
@@ -1004,7 +1004,7 @@ class A extends _ {
|
|
|
1004
1004
|
kind: "min",
|
|
1005
1005
|
value: 0,
|
|
1006
1006
|
inclusive: !1,
|
|
1007
|
-
message:
|
|
1007
|
+
message: p.toString(e)
|
|
1008
1008
|
});
|
|
1009
1009
|
}
|
|
1010
1010
|
negative(e) {
|
|
@@ -1012,7 +1012,7 @@ class A extends _ {
|
|
|
1012
1012
|
kind: "max",
|
|
1013
1013
|
value: 0,
|
|
1014
1014
|
inclusive: !1,
|
|
1015
|
-
message:
|
|
1015
|
+
message: p.toString(e)
|
|
1016
1016
|
});
|
|
1017
1017
|
}
|
|
1018
1018
|
nonpositive(e) {
|
|
@@ -1020,7 +1020,7 @@ class A extends _ {
|
|
|
1020
1020
|
kind: "max",
|
|
1021
1021
|
value: 0,
|
|
1022
1022
|
inclusive: !0,
|
|
1023
|
-
message:
|
|
1023
|
+
message: p.toString(e)
|
|
1024
1024
|
});
|
|
1025
1025
|
}
|
|
1026
1026
|
nonnegative(e) {
|
|
@@ -1028,20 +1028,20 @@ class A extends _ {
|
|
|
1028
1028
|
kind: "min",
|
|
1029
1029
|
value: 0,
|
|
1030
1030
|
inclusive: !0,
|
|
1031
|
-
message:
|
|
1031
|
+
message: p.toString(e)
|
|
1032
1032
|
});
|
|
1033
1033
|
}
|
|
1034
1034
|
multipleOf(e, t) {
|
|
1035
1035
|
return this._addCheck({
|
|
1036
1036
|
kind: "multipleOf",
|
|
1037
1037
|
value: e,
|
|
1038
|
-
message:
|
|
1038
|
+
message: p.toString(t)
|
|
1039
1039
|
});
|
|
1040
1040
|
}
|
|
1041
1041
|
finite(e) {
|
|
1042
1042
|
return this._addCheck({
|
|
1043
1043
|
kind: "finite",
|
|
1044
|
-
message:
|
|
1044
|
+
message: p.toString(e)
|
|
1045
1045
|
});
|
|
1046
1046
|
}
|
|
1047
1047
|
safe(e) {
|
|
@@ -1049,12 +1049,12 @@ class A extends _ {
|
|
|
1049
1049
|
kind: "min",
|
|
1050
1050
|
inclusive: !0,
|
|
1051
1051
|
value: Number.MIN_SAFE_INTEGER,
|
|
1052
|
-
message:
|
|
1052
|
+
message: p.toString(e)
|
|
1053
1053
|
})._addCheck({
|
|
1054
1054
|
kind: "max",
|
|
1055
1055
|
inclusive: !0,
|
|
1056
1056
|
value: Number.MAX_SAFE_INTEGER,
|
|
1057
|
-
message:
|
|
1057
|
+
message: p.toString(e)
|
|
1058
1058
|
});
|
|
1059
1059
|
}
|
|
1060
1060
|
get minValue() {
|
|
@@ -1070,7 +1070,7 @@ class A extends _ {
|
|
|
1070
1070
|
return e;
|
|
1071
1071
|
}
|
|
1072
1072
|
get isInt() {
|
|
1073
|
-
return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" &&
|
|
1073
|
+
return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && _.isInteger(e.value));
|
|
1074
1074
|
}
|
|
1075
1075
|
get isFinite() {
|
|
1076
1076
|
let e = null, t = null;
|
|
@@ -1082,61 +1082,61 @@ class A extends _ {
|
|
|
1082
1082
|
return Number.isFinite(t) && Number.isFinite(e);
|
|
1083
1083
|
}
|
|
1084
1084
|
}
|
|
1085
|
-
|
|
1085
|
+
R.create = (a) => new R({
|
|
1086
1086
|
checks: [],
|
|
1087
|
-
typeName:
|
|
1088
|
-
coerce: (
|
|
1089
|
-
...
|
|
1087
|
+
typeName: m.ZodNumber,
|
|
1088
|
+
coerce: (a == null ? void 0 : a.coerce) || !1,
|
|
1089
|
+
...y(a)
|
|
1090
1090
|
});
|
|
1091
|
-
class
|
|
1091
|
+
class A extends v {
|
|
1092
1092
|
constructor() {
|
|
1093
1093
|
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
1094
1094
|
}
|
|
1095
1095
|
_parse(e) {
|
|
1096
|
-
if (this._def.coerce && (e.data = BigInt(e.data)), this._getType(e) !==
|
|
1097
|
-
const
|
|
1098
|
-
return
|
|
1096
|
+
if (this._def.coerce && (e.data = BigInt(e.data)), this._getType(e) !== l.bigint) {
|
|
1097
|
+
const n = this._getOrReturnCtx(e);
|
|
1098
|
+
return c(n, {
|
|
1099
1099
|
code: d.invalid_type,
|
|
1100
|
-
expected:
|
|
1101
|
-
received:
|
|
1102
|
-
}),
|
|
1100
|
+
expected: l.bigint,
|
|
1101
|
+
received: n.parsedType
|
|
1102
|
+
}), f;
|
|
1103
1103
|
}
|
|
1104
|
-
let
|
|
1105
|
-
const
|
|
1106
|
-
for (const
|
|
1107
|
-
|
|
1104
|
+
let t;
|
|
1105
|
+
const s = new b();
|
|
1106
|
+
for (const n of this._def.checks)
|
|
1107
|
+
n.kind === "min" ? (n.inclusive ? e.data < n.value : e.data <= n.value) && (t = this._getOrReturnCtx(e, t), c(t, {
|
|
1108
1108
|
code: d.too_small,
|
|
1109
1109
|
type: "bigint",
|
|
1110
|
-
minimum:
|
|
1111
|
-
inclusive:
|
|
1112
|
-
message:
|
|
1113
|
-
}),
|
|
1110
|
+
minimum: n.value,
|
|
1111
|
+
inclusive: n.inclusive,
|
|
1112
|
+
message: n.message
|
|
1113
|
+
}), s.dirty()) : n.kind === "max" ? (n.inclusive ? e.data > n.value : e.data >= n.value) && (t = this._getOrReturnCtx(e, t), c(t, {
|
|
1114
1114
|
code: d.too_big,
|
|
1115
1115
|
type: "bigint",
|
|
1116
|
-
maximum:
|
|
1117
|
-
inclusive:
|
|
1118
|
-
message:
|
|
1119
|
-
}),
|
|
1116
|
+
maximum: n.value,
|
|
1117
|
+
inclusive: n.inclusive,
|
|
1118
|
+
message: n.message
|
|
1119
|
+
}), s.dirty()) : n.kind === "multipleOf" ? e.data % n.value !== BigInt(0) && (t = this._getOrReturnCtx(e, t), c(t, {
|
|
1120
1120
|
code: d.not_multiple_of,
|
|
1121
|
-
multipleOf:
|
|
1122
|
-
message:
|
|
1123
|
-
}),
|
|
1124
|
-
return { status:
|
|
1121
|
+
multipleOf: n.value,
|
|
1122
|
+
message: n.message
|
|
1123
|
+
}), s.dirty()) : _.assertNever(n);
|
|
1124
|
+
return { status: s.value, value: e.data };
|
|
1125
1125
|
}
|
|
1126
1126
|
gte(e, t) {
|
|
1127
|
-
return this.setLimit("min", e, !0,
|
|
1127
|
+
return this.setLimit("min", e, !0, p.toString(t));
|
|
1128
1128
|
}
|
|
1129
1129
|
gt(e, t) {
|
|
1130
|
-
return this.setLimit("min", e, !1,
|
|
1130
|
+
return this.setLimit("min", e, !1, p.toString(t));
|
|
1131
1131
|
}
|
|
1132
1132
|
lte(e, t) {
|
|
1133
|
-
return this.setLimit("max", e, !0,
|
|
1133
|
+
return this.setLimit("max", e, !0, p.toString(t));
|
|
1134
1134
|
}
|
|
1135
1135
|
lt(e, t) {
|
|
1136
|
-
return this.setLimit("max", e, !1,
|
|
1136
|
+
return this.setLimit("max", e, !1, p.toString(t));
|
|
1137
1137
|
}
|
|
1138
1138
|
setLimit(e, t, s, n) {
|
|
1139
|
-
return new
|
|
1139
|
+
return new A({
|
|
1140
1140
|
...this._def,
|
|
1141
1141
|
checks: [
|
|
1142
1142
|
...this._def.checks,
|
|
@@ -1144,13 +1144,13 @@ class M extends _ {
|
|
|
1144
1144
|
kind: e,
|
|
1145
1145
|
value: t,
|
|
1146
1146
|
inclusive: s,
|
|
1147
|
-
message:
|
|
1147
|
+
message: p.toString(n)
|
|
1148
1148
|
}
|
|
1149
1149
|
]
|
|
1150
1150
|
});
|
|
1151
1151
|
}
|
|
1152
1152
|
_addCheck(e) {
|
|
1153
|
-
return new
|
|
1153
|
+
return new A({
|
|
1154
1154
|
...this._def,
|
|
1155
1155
|
checks: [...this._def.checks, e]
|
|
1156
1156
|
});
|
|
@@ -1160,7 +1160,7 @@ class M extends _ {
|
|
|
1160
1160
|
kind: "min",
|
|
1161
1161
|
value: BigInt(0),
|
|
1162
1162
|
inclusive: !1,
|
|
1163
|
-
message:
|
|
1163
|
+
message: p.toString(e)
|
|
1164
1164
|
});
|
|
1165
1165
|
}
|
|
1166
1166
|
negative(e) {
|
|
@@ -1168,7 +1168,7 @@ class M extends _ {
|
|
|
1168
1168
|
kind: "max",
|
|
1169
1169
|
value: BigInt(0),
|
|
1170
1170
|
inclusive: !1,
|
|
1171
|
-
message:
|
|
1171
|
+
message: p.toString(e)
|
|
1172
1172
|
});
|
|
1173
1173
|
}
|
|
1174
1174
|
nonpositive(e) {
|
|
@@ -1176,7 +1176,7 @@ class M extends _ {
|
|
|
1176
1176
|
kind: "max",
|
|
1177
1177
|
value: BigInt(0),
|
|
1178
1178
|
inclusive: !0,
|
|
1179
|
-
message:
|
|
1179
|
+
message: p.toString(e)
|
|
1180
1180
|
});
|
|
1181
1181
|
}
|
|
1182
1182
|
nonnegative(e) {
|
|
@@ -1184,14 +1184,14 @@ class M extends _ {
|
|
|
1184
1184
|
kind: "min",
|
|
1185
1185
|
value: BigInt(0),
|
|
1186
1186
|
inclusive: !0,
|
|
1187
|
-
message:
|
|
1187
|
+
message: p.toString(e)
|
|
1188
1188
|
});
|
|
1189
1189
|
}
|
|
1190
1190
|
multipleOf(e, t) {
|
|
1191
1191
|
return this._addCheck({
|
|
1192
1192
|
kind: "multipleOf",
|
|
1193
1193
|
value: e,
|
|
1194
|
-
message:
|
|
1194
|
+
message: p.toString(t)
|
|
1195
1195
|
});
|
|
1196
1196
|
}
|
|
1197
1197
|
get minValue() {
|
|
@@ -1207,74 +1207,74 @@ class M extends _ {
|
|
|
1207
1207
|
return e;
|
|
1208
1208
|
}
|
|
1209
1209
|
}
|
|
1210
|
-
|
|
1210
|
+
A.create = (a) => {
|
|
1211
1211
|
var e;
|
|
1212
|
-
return new
|
|
1212
|
+
return new A({
|
|
1213
1213
|
checks: [],
|
|
1214
|
-
typeName:
|
|
1215
|
-
coerce: (e =
|
|
1216
|
-
...
|
|
1214
|
+
typeName: m.ZodBigInt,
|
|
1215
|
+
coerce: (e = a == null ? void 0 : a.coerce) !== null && e !== void 0 ? e : !1,
|
|
1216
|
+
...y(a)
|
|
1217
1217
|
});
|
|
1218
1218
|
};
|
|
1219
|
-
class
|
|
1219
|
+
class H extends v {
|
|
1220
1220
|
_parse(e) {
|
|
1221
|
-
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !==
|
|
1222
|
-
const
|
|
1223
|
-
return
|
|
1221
|
+
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== l.boolean) {
|
|
1222
|
+
const t = this._getOrReturnCtx(e);
|
|
1223
|
+
return c(t, {
|
|
1224
1224
|
code: d.invalid_type,
|
|
1225
|
-
expected:
|
|
1226
|
-
received:
|
|
1227
|
-
}),
|
|
1225
|
+
expected: l.boolean,
|
|
1226
|
+
received: t.parsedType
|
|
1227
|
+
}), f;
|
|
1228
1228
|
}
|
|
1229
|
-
return
|
|
1229
|
+
return x(e.data);
|
|
1230
1230
|
}
|
|
1231
1231
|
}
|
|
1232
|
-
|
|
1233
|
-
typeName:
|
|
1234
|
-
coerce: (
|
|
1235
|
-
...
|
|
1232
|
+
H.create = (a) => new H({
|
|
1233
|
+
typeName: m.ZodBoolean,
|
|
1234
|
+
coerce: (a == null ? void 0 : a.coerce) || !1,
|
|
1235
|
+
...y(a)
|
|
1236
1236
|
});
|
|
1237
|
-
class
|
|
1237
|
+
class L extends v {
|
|
1238
1238
|
_parse(e) {
|
|
1239
|
-
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !==
|
|
1240
|
-
const
|
|
1241
|
-
return
|
|
1239
|
+
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== l.date) {
|
|
1240
|
+
const n = this._getOrReturnCtx(e);
|
|
1241
|
+
return c(n, {
|
|
1242
1242
|
code: d.invalid_type,
|
|
1243
|
-
expected:
|
|
1244
|
-
received:
|
|
1245
|
-
}),
|
|
1243
|
+
expected: l.date,
|
|
1244
|
+
received: n.parsedType
|
|
1245
|
+
}), f;
|
|
1246
1246
|
}
|
|
1247
1247
|
if (isNaN(e.data.getTime())) {
|
|
1248
|
-
const
|
|
1249
|
-
return
|
|
1248
|
+
const n = this._getOrReturnCtx(e);
|
|
1249
|
+
return c(n, {
|
|
1250
1250
|
code: d.invalid_date
|
|
1251
|
-
}),
|
|
1251
|
+
}), f;
|
|
1252
1252
|
}
|
|
1253
|
-
const
|
|
1254
|
-
let
|
|
1255
|
-
for (const
|
|
1256
|
-
|
|
1253
|
+
const t = new b();
|
|
1254
|
+
let s;
|
|
1255
|
+
for (const n of this._def.checks)
|
|
1256
|
+
n.kind === "min" ? e.data.getTime() < n.value && (s = this._getOrReturnCtx(e, s), c(s, {
|
|
1257
1257
|
code: d.too_small,
|
|
1258
|
-
message:
|
|
1258
|
+
message: n.message,
|
|
1259
1259
|
inclusive: !0,
|
|
1260
1260
|
exact: !1,
|
|
1261
|
-
minimum:
|
|
1261
|
+
minimum: n.value,
|
|
1262
1262
|
type: "date"
|
|
1263
|
-
}),
|
|
1263
|
+
}), t.dirty()) : n.kind === "max" ? e.data.getTime() > n.value && (s = this._getOrReturnCtx(e, s), c(s, {
|
|
1264
1264
|
code: d.too_big,
|
|
1265
|
-
message:
|
|
1265
|
+
message: n.message,
|
|
1266
1266
|
inclusive: !0,
|
|
1267
1267
|
exact: !1,
|
|
1268
|
-
maximum:
|
|
1268
|
+
maximum: n.value,
|
|
1269
1269
|
type: "date"
|
|
1270
|
-
}),
|
|
1270
|
+
}), t.dirty()) : _.assertNever(n);
|
|
1271
1271
|
return {
|
|
1272
|
-
status:
|
|
1272
|
+
status: t.value,
|
|
1273
1273
|
value: new Date(e.data.getTime())
|
|
1274
1274
|
};
|
|
1275
1275
|
}
|
|
1276
1276
|
_addCheck(e) {
|
|
1277
|
-
return new
|
|
1277
|
+
return new L({
|
|
1278
1278
|
...this._def,
|
|
1279
1279
|
checks: [...this._def.checks, e]
|
|
1280
1280
|
});
|
|
@@ -1283,14 +1283,14 @@ class D extends _ {
|
|
|
1283
1283
|
return this._addCheck({
|
|
1284
1284
|
kind: "min",
|
|
1285
1285
|
value: e.getTime(),
|
|
1286
|
-
message:
|
|
1286
|
+
message: p.toString(t)
|
|
1287
1287
|
});
|
|
1288
1288
|
}
|
|
1289
1289
|
max(e, t) {
|
|
1290
1290
|
return this._addCheck({
|
|
1291
1291
|
kind: "max",
|
|
1292
1292
|
value: e.getTime(),
|
|
1293
|
-
message:
|
|
1293
|
+
message: p.toString(t)
|
|
1294
1294
|
});
|
|
1295
1295
|
}
|
|
1296
1296
|
get minDate() {
|
|
@@ -1306,132 +1306,132 @@ class D extends _ {
|
|
|
1306
1306
|
return e != null ? new Date(e) : null;
|
|
1307
1307
|
}
|
|
1308
1308
|
}
|
|
1309
|
-
|
|
1309
|
+
L.create = (a) => new L({
|
|
1310
1310
|
checks: [],
|
|
1311
|
-
coerce: (
|
|
1312
|
-
typeName:
|
|
1313
|
-
...
|
|
1311
|
+
coerce: (a == null ? void 0 : a.coerce) || !1,
|
|
1312
|
+
typeName: m.ZodDate,
|
|
1313
|
+
...y(a)
|
|
1314
1314
|
});
|
|
1315
|
-
class
|
|
1315
|
+
class pe extends v {
|
|
1316
1316
|
_parse(e) {
|
|
1317
|
-
if (this._getType(e) !==
|
|
1318
|
-
const
|
|
1319
|
-
return
|
|
1317
|
+
if (this._getType(e) !== l.symbol) {
|
|
1318
|
+
const t = this._getOrReturnCtx(e);
|
|
1319
|
+
return c(t, {
|
|
1320
1320
|
code: d.invalid_type,
|
|
1321
|
-
expected:
|
|
1322
|
-
received:
|
|
1323
|
-
}),
|
|
1321
|
+
expected: l.symbol,
|
|
1322
|
+
received: t.parsedType
|
|
1323
|
+
}), f;
|
|
1324
1324
|
}
|
|
1325
|
-
return
|
|
1325
|
+
return x(e.data);
|
|
1326
1326
|
}
|
|
1327
1327
|
}
|
|
1328
|
-
|
|
1329
|
-
typeName:
|
|
1330
|
-
...
|
|
1328
|
+
pe.create = (a) => new pe({
|
|
1329
|
+
typeName: m.ZodSymbol,
|
|
1330
|
+
...y(a)
|
|
1331
1331
|
});
|
|
1332
|
-
class
|
|
1332
|
+
class G extends v {
|
|
1333
1333
|
_parse(e) {
|
|
1334
|
-
if (this._getType(e) !==
|
|
1335
|
-
const
|
|
1336
|
-
return
|
|
1334
|
+
if (this._getType(e) !== l.undefined) {
|
|
1335
|
+
const t = this._getOrReturnCtx(e);
|
|
1336
|
+
return c(t, {
|
|
1337
1337
|
code: d.invalid_type,
|
|
1338
|
-
expected:
|
|
1339
|
-
received:
|
|
1340
|
-
}),
|
|
1338
|
+
expected: l.undefined,
|
|
1339
|
+
received: t.parsedType
|
|
1340
|
+
}), f;
|
|
1341
1341
|
}
|
|
1342
|
-
return
|
|
1342
|
+
return x(e.data);
|
|
1343
1343
|
}
|
|
1344
1344
|
}
|
|
1345
|
-
|
|
1346
|
-
typeName:
|
|
1347
|
-
...
|
|
1345
|
+
G.create = (a) => new G({
|
|
1346
|
+
typeName: m.ZodUndefined,
|
|
1347
|
+
...y(a)
|
|
1348
1348
|
});
|
|
1349
|
-
class
|
|
1349
|
+
class X extends v {
|
|
1350
1350
|
_parse(e) {
|
|
1351
|
-
if (this._getType(e) !==
|
|
1352
|
-
const
|
|
1353
|
-
return
|
|
1351
|
+
if (this._getType(e) !== l.null) {
|
|
1352
|
+
const t = this._getOrReturnCtx(e);
|
|
1353
|
+
return c(t, {
|
|
1354
1354
|
code: d.invalid_type,
|
|
1355
|
-
expected:
|
|
1356
|
-
received:
|
|
1357
|
-
}),
|
|
1355
|
+
expected: l.null,
|
|
1356
|
+
received: t.parsedType
|
|
1357
|
+
}), f;
|
|
1358
1358
|
}
|
|
1359
|
-
return
|
|
1359
|
+
return x(e.data);
|
|
1360
1360
|
}
|
|
1361
1361
|
}
|
|
1362
|
-
|
|
1363
|
-
typeName:
|
|
1364
|
-
...
|
|
1362
|
+
X.create = (a) => new X({
|
|
1363
|
+
typeName: m.ZodNull,
|
|
1364
|
+
...y(a)
|
|
1365
1365
|
});
|
|
1366
|
-
class
|
|
1366
|
+
class B extends v {
|
|
1367
1367
|
constructor() {
|
|
1368
1368
|
super(...arguments), this._any = !0;
|
|
1369
1369
|
}
|
|
1370
1370
|
_parse(e) {
|
|
1371
|
-
return
|
|
1371
|
+
return x(e.data);
|
|
1372
1372
|
}
|
|
1373
1373
|
}
|
|
1374
|
-
|
|
1375
|
-
typeName:
|
|
1376
|
-
...
|
|
1374
|
+
B.create = (a) => new B({
|
|
1375
|
+
typeName: m.ZodAny,
|
|
1376
|
+
...y(a)
|
|
1377
1377
|
});
|
|
1378
|
-
class
|
|
1378
|
+
class D extends v {
|
|
1379
1379
|
constructor() {
|
|
1380
1380
|
super(...arguments), this._unknown = !0;
|
|
1381
1381
|
}
|
|
1382
1382
|
_parse(e) {
|
|
1383
|
-
return
|
|
1383
|
+
return x(e.data);
|
|
1384
1384
|
}
|
|
1385
1385
|
}
|
|
1386
|
-
|
|
1387
|
-
typeName:
|
|
1388
|
-
...
|
|
1386
|
+
D.create = (a) => new D({
|
|
1387
|
+
typeName: m.ZodUnknown,
|
|
1388
|
+
...y(a)
|
|
1389
1389
|
});
|
|
1390
|
-
class
|
|
1390
|
+
class E extends v {
|
|
1391
1391
|
_parse(e) {
|
|
1392
1392
|
const t = this._getOrReturnCtx(e);
|
|
1393
|
-
return
|
|
1393
|
+
return c(t, {
|
|
1394
1394
|
code: d.invalid_type,
|
|
1395
|
-
expected:
|
|
1395
|
+
expected: l.never,
|
|
1396
1396
|
received: t.parsedType
|
|
1397
|
-
}),
|
|
1397
|
+
}), f;
|
|
1398
1398
|
}
|
|
1399
1399
|
}
|
|
1400
|
-
|
|
1401
|
-
typeName:
|
|
1402
|
-
...
|
|
1400
|
+
E.create = (a) => new E({
|
|
1401
|
+
typeName: m.ZodNever,
|
|
1402
|
+
...y(a)
|
|
1403
1403
|
});
|
|
1404
|
-
class
|
|
1404
|
+
class me extends v {
|
|
1405
1405
|
_parse(e) {
|
|
1406
|
-
if (this._getType(e) !==
|
|
1407
|
-
const
|
|
1408
|
-
return
|
|
1406
|
+
if (this._getType(e) !== l.undefined) {
|
|
1407
|
+
const t = this._getOrReturnCtx(e);
|
|
1408
|
+
return c(t, {
|
|
1409
1409
|
code: d.invalid_type,
|
|
1410
|
-
expected:
|
|
1411
|
-
received:
|
|
1412
|
-
}),
|
|
1410
|
+
expected: l.void,
|
|
1411
|
+
received: t.parsedType
|
|
1412
|
+
}), f;
|
|
1413
1413
|
}
|
|
1414
|
-
return
|
|
1414
|
+
return x(e.data);
|
|
1415
1415
|
}
|
|
1416
1416
|
}
|
|
1417
|
-
|
|
1418
|
-
typeName:
|
|
1419
|
-
...
|
|
1417
|
+
me.create = (a) => new me({
|
|
1418
|
+
typeName: m.ZodVoid,
|
|
1419
|
+
...y(a)
|
|
1420
1420
|
});
|
|
1421
|
-
class
|
|
1421
|
+
class T extends v {
|
|
1422
1422
|
_parse(e) {
|
|
1423
1423
|
const { ctx: t, status: s } = this._processInputParams(e), n = this._def;
|
|
1424
|
-
if (t.parsedType !==
|
|
1425
|
-
return
|
|
1424
|
+
if (t.parsedType !== l.array)
|
|
1425
|
+
return c(t, {
|
|
1426
1426
|
code: d.invalid_type,
|
|
1427
|
-
expected:
|
|
1427
|
+
expected: l.array,
|
|
1428
1428
|
received: t.parsedType
|
|
1429
|
-
}),
|
|
1429
|
+
}), f;
|
|
1430
1430
|
if (n.exactLength !== null) {
|
|
1431
|
-
const i = t.data.length > n.exactLength.value,
|
|
1432
|
-
(i ||
|
|
1431
|
+
const i = t.data.length > n.exactLength.value, r = t.data.length < n.exactLength.value;
|
|
1432
|
+
(i || r) && (c(t, {
|
|
1433
1433
|
code: i ? d.too_big : d.too_small,
|
|
1434
|
-
minimum:
|
|
1434
|
+
minimum: r ? n.exactLength.value : void 0,
|
|
1435
1435
|
maximum: i ? n.exactLength.value : void 0,
|
|
1436
1436
|
type: "array",
|
|
1437
1437
|
inclusive: !0,
|
|
@@ -1439,14 +1439,14 @@ class S extends _ {
|
|
|
1439
1439
|
message: n.exactLength.message
|
|
1440
1440
|
}), s.dirty());
|
|
1441
1441
|
}
|
|
1442
|
-
if (n.minLength !== null && t.data.length < n.minLength.value && (
|
|
1442
|
+
if (n.minLength !== null && t.data.length < n.minLength.value && (c(t, {
|
|
1443
1443
|
code: d.too_small,
|
|
1444
1444
|
minimum: n.minLength.value,
|
|
1445
1445
|
type: "array",
|
|
1446
1446
|
inclusive: !0,
|
|
1447
1447
|
exact: !1,
|
|
1448
1448
|
message: n.minLength.message
|
|
1449
|
-
}), s.dirty()), n.maxLength !== null && t.data.length > n.maxLength.value && (
|
|
1449
|
+
}), s.dirty()), n.maxLength !== null && t.data.length > n.maxLength.value && (c(t, {
|
|
1450
1450
|
code: d.too_big,
|
|
1451
1451
|
maximum: n.maxLength.value,
|
|
1452
1452
|
type: "array",
|
|
@@ -1454,160 +1454,160 @@ class S extends _ {
|
|
|
1454
1454
|
exact: !1,
|
|
1455
1455
|
message: n.maxLength.message
|
|
1456
1456
|
}), s.dirty()), t.common.async)
|
|
1457
|
-
return Promise.all([...t.data].map((i,
|
|
1458
|
-
const
|
|
1459
|
-
return
|
|
1457
|
+
return Promise.all([...t.data].map((i, r) => n.type._parseAsync(new C(t, i, t.path, r)))).then((i) => b.mergeArray(s, i));
|
|
1458
|
+
const o = [...t.data].map((i, r) => n.type._parseSync(new C(t, i, t.path, r)));
|
|
1459
|
+
return b.mergeArray(s, o);
|
|
1460
1460
|
}
|
|
1461
1461
|
get element() {
|
|
1462
1462
|
return this._def.type;
|
|
1463
1463
|
}
|
|
1464
1464
|
min(e, t) {
|
|
1465
|
-
return new
|
|
1465
|
+
return new T({
|
|
1466
1466
|
...this._def,
|
|
1467
|
-
minLength: { value: e, message:
|
|
1467
|
+
minLength: { value: e, message: p.toString(t) }
|
|
1468
1468
|
});
|
|
1469
1469
|
}
|
|
1470
1470
|
max(e, t) {
|
|
1471
|
-
return new
|
|
1471
|
+
return new T({
|
|
1472
1472
|
...this._def,
|
|
1473
|
-
maxLength: { value: e, message:
|
|
1473
|
+
maxLength: { value: e, message: p.toString(t) }
|
|
1474
1474
|
});
|
|
1475
1475
|
}
|
|
1476
1476
|
length(e, t) {
|
|
1477
|
-
return new
|
|
1477
|
+
return new T({
|
|
1478
1478
|
...this._def,
|
|
1479
|
-
exactLength: { value: e, message:
|
|
1479
|
+
exactLength: { value: e, message: p.toString(t) }
|
|
1480
1480
|
});
|
|
1481
1481
|
}
|
|
1482
1482
|
nonempty(e) {
|
|
1483
1483
|
return this.min(1, e);
|
|
1484
1484
|
}
|
|
1485
1485
|
}
|
|
1486
|
-
|
|
1487
|
-
type:
|
|
1486
|
+
T.create = (a, e) => new T({
|
|
1487
|
+
type: a,
|
|
1488
1488
|
minLength: null,
|
|
1489
1489
|
maxLength: null,
|
|
1490
1490
|
exactLength: null,
|
|
1491
|
-
typeName:
|
|
1492
|
-
...
|
|
1491
|
+
typeName: m.ZodArray,
|
|
1492
|
+
...y(e)
|
|
1493
1493
|
});
|
|
1494
|
-
function z(
|
|
1495
|
-
if (
|
|
1494
|
+
function z(a) {
|
|
1495
|
+
if (a instanceof k) {
|
|
1496
1496
|
const e = {};
|
|
1497
|
-
for (const t in
|
|
1498
|
-
const s =
|
|
1497
|
+
for (const t in a.shape) {
|
|
1498
|
+
const s = a.shape[t];
|
|
1499
1499
|
e[t] = N.create(z(s));
|
|
1500
1500
|
}
|
|
1501
|
-
return new
|
|
1502
|
-
...
|
|
1501
|
+
return new k({
|
|
1502
|
+
...a._def,
|
|
1503
1503
|
shape: () => e
|
|
1504
1504
|
});
|
|
1505
|
-
} else return
|
|
1506
|
-
...
|
|
1507
|
-
type: z(
|
|
1508
|
-
}) :
|
|
1505
|
+
} else return a instanceof T ? new T({
|
|
1506
|
+
...a._def,
|
|
1507
|
+
type: z(a.element)
|
|
1508
|
+
}) : a instanceof N ? N.create(z(a.unwrap())) : a instanceof M ? M.create(z(a.unwrap())) : a instanceof S ? S.create(a.items.map((e) => z(e))) : a;
|
|
1509
1509
|
}
|
|
1510
|
-
class
|
|
1510
|
+
class k extends v {
|
|
1511
1511
|
constructor() {
|
|
1512
1512
|
super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
|
|
1513
1513
|
}
|
|
1514
1514
|
_getCached() {
|
|
1515
1515
|
if (this._cached !== null)
|
|
1516
1516
|
return this._cached;
|
|
1517
|
-
const e = this._def.shape(), t =
|
|
1517
|
+
const e = this._def.shape(), t = _.objectKeys(e);
|
|
1518
1518
|
return this._cached = { shape: e, keys: t };
|
|
1519
1519
|
}
|
|
1520
1520
|
_parse(e) {
|
|
1521
|
-
if (this._getType(e) !==
|
|
1522
|
-
const
|
|
1523
|
-
return u
|
|
1521
|
+
if (this._getType(e) !== l.object) {
|
|
1522
|
+
const u = this._getOrReturnCtx(e);
|
|
1523
|
+
return c(u, {
|
|
1524
1524
|
code: d.invalid_type,
|
|
1525
|
-
expected:
|
|
1526
|
-
received:
|
|
1527
|
-
}),
|
|
1525
|
+
expected: l.object,
|
|
1526
|
+
received: u.parsedType
|
|
1527
|
+
}), f;
|
|
1528
1528
|
}
|
|
1529
|
-
const { status:
|
|
1530
|
-
if (!(this._def.catchall instanceof
|
|
1531
|
-
for (const
|
|
1532
|
-
|
|
1533
|
-
const
|
|
1534
|
-
for (const
|
|
1535
|
-
const
|
|
1536
|
-
|
|
1537
|
-
key: { status: "valid", value:
|
|
1538
|
-
value:
|
|
1539
|
-
alwaysSet:
|
|
1529
|
+
const { status: t, ctx: s } = this._processInputParams(e), { shape: n, keys: o } = this._getCached(), i = [];
|
|
1530
|
+
if (!(this._def.catchall instanceof E && this._def.unknownKeys === "strip"))
|
|
1531
|
+
for (const u in s.data)
|
|
1532
|
+
o.includes(u) || i.push(u);
|
|
1533
|
+
const r = [];
|
|
1534
|
+
for (const u of o) {
|
|
1535
|
+
const h = n[u], g = s.data[u];
|
|
1536
|
+
r.push({
|
|
1537
|
+
key: { status: "valid", value: u },
|
|
1538
|
+
value: h._parse(new C(s, g, s.path, u)),
|
|
1539
|
+
alwaysSet: u in s.data
|
|
1540
1540
|
});
|
|
1541
1541
|
}
|
|
1542
|
-
if (this._def.catchall instanceof
|
|
1543
|
-
const
|
|
1544
|
-
if (
|
|
1545
|
-
for (const
|
|
1546
|
-
|
|
1547
|
-
key: { status: "valid", value:
|
|
1548
|
-
value: { status: "valid", value:
|
|
1542
|
+
if (this._def.catchall instanceof E) {
|
|
1543
|
+
const u = this._def.unknownKeys;
|
|
1544
|
+
if (u === "passthrough")
|
|
1545
|
+
for (const h of i)
|
|
1546
|
+
r.push({
|
|
1547
|
+
key: { status: "valid", value: h },
|
|
1548
|
+
value: { status: "valid", value: s.data[h] }
|
|
1549
1549
|
});
|
|
1550
|
-
else if (
|
|
1551
|
-
|
|
1550
|
+
else if (u === "strict")
|
|
1551
|
+
i.length > 0 && (c(s, {
|
|
1552
1552
|
code: d.unrecognized_keys,
|
|
1553
|
-
keys:
|
|
1554
|
-
}),
|
|
1555
|
-
else if (
|
|
1553
|
+
keys: i
|
|
1554
|
+
}), t.dirty());
|
|
1555
|
+
else if (u !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
1556
1556
|
} else {
|
|
1557
|
-
const
|
|
1558
|
-
for (const
|
|
1559
|
-
const
|
|
1560
|
-
|
|
1561
|
-
key: { status: "valid", value:
|
|
1562
|
-
value:
|
|
1563
|
-
new
|
|
1557
|
+
const u = this._def.catchall;
|
|
1558
|
+
for (const h of i) {
|
|
1559
|
+
const g = s.data[h];
|
|
1560
|
+
r.push({
|
|
1561
|
+
key: { status: "valid", value: h },
|
|
1562
|
+
value: u._parse(
|
|
1563
|
+
new C(s, g, s.path, h)
|
|
1564
1564
|
//, ctx.child(key), value, getParsedType(value)
|
|
1565
1565
|
),
|
|
1566
|
-
alwaysSet:
|
|
1566
|
+
alwaysSet: h in s.data
|
|
1567
1567
|
});
|
|
1568
1568
|
}
|
|
1569
1569
|
}
|
|
1570
|
-
return
|
|
1571
|
-
const
|
|
1572
|
-
for (const
|
|
1573
|
-
const
|
|
1574
|
-
|
|
1575
|
-
key:
|
|
1576
|
-
value:
|
|
1577
|
-
alwaysSet:
|
|
1570
|
+
return s.common.async ? Promise.resolve().then(async () => {
|
|
1571
|
+
const u = [];
|
|
1572
|
+
for (const h of r) {
|
|
1573
|
+
const g = await h.key, j = await h.value;
|
|
1574
|
+
u.push({
|
|
1575
|
+
key: g,
|
|
1576
|
+
value: j,
|
|
1577
|
+
alwaysSet: h.alwaysSet
|
|
1578
1578
|
});
|
|
1579
1579
|
}
|
|
1580
|
-
return
|
|
1581
|
-
}).then((
|
|
1580
|
+
return u;
|
|
1581
|
+
}).then((u) => b.mergeObjectSync(t, u)) : b.mergeObjectSync(t, r);
|
|
1582
1582
|
}
|
|
1583
1583
|
get shape() {
|
|
1584
1584
|
return this._def.shape();
|
|
1585
1585
|
}
|
|
1586
1586
|
strict(e) {
|
|
1587
|
-
return
|
|
1587
|
+
return p.errToObj, new k({
|
|
1588
1588
|
...this._def,
|
|
1589
1589
|
unknownKeys: "strict",
|
|
1590
1590
|
...e !== void 0 ? {
|
|
1591
1591
|
errorMap: (t, s) => {
|
|
1592
|
-
var n,
|
|
1593
|
-
const
|
|
1592
|
+
var n, o, i, r;
|
|
1593
|
+
const u = (i = (o = (n = this._def).errorMap) === null || o === void 0 ? void 0 : o.call(n, t, s).message) !== null && i !== void 0 ? i : s.defaultError;
|
|
1594
1594
|
return t.code === "unrecognized_keys" ? {
|
|
1595
|
-
message: (
|
|
1595
|
+
message: (r = p.errToObj(e).message) !== null && r !== void 0 ? r : u
|
|
1596
1596
|
} : {
|
|
1597
|
-
message:
|
|
1597
|
+
message: u
|
|
1598
1598
|
};
|
|
1599
1599
|
}
|
|
1600
1600
|
} : {}
|
|
1601
1601
|
});
|
|
1602
1602
|
}
|
|
1603
1603
|
strip() {
|
|
1604
|
-
return new
|
|
1604
|
+
return new k({
|
|
1605
1605
|
...this._def,
|
|
1606
1606
|
unknownKeys: "strip"
|
|
1607
1607
|
});
|
|
1608
1608
|
}
|
|
1609
1609
|
passthrough() {
|
|
1610
|
-
return new
|
|
1610
|
+
return new k({
|
|
1611
1611
|
...this._def,
|
|
1612
1612
|
unknownKeys: "passthrough"
|
|
1613
1613
|
});
|
|
@@ -1630,7 +1630,7 @@ class x extends _ {
|
|
|
1630
1630
|
// }) as any;
|
|
1631
1631
|
// };
|
|
1632
1632
|
extend(e) {
|
|
1633
|
-
return new
|
|
1633
|
+
return new k({
|
|
1634
1634
|
...this._def,
|
|
1635
1635
|
shape: () => ({
|
|
1636
1636
|
...this._def.shape(),
|
|
@@ -1644,14 +1644,14 @@ class x extends _ {
|
|
|
1644
1644
|
* upgrade if you are experiencing issues.
|
|
1645
1645
|
*/
|
|
1646
1646
|
merge(e) {
|
|
1647
|
-
return new
|
|
1647
|
+
return new k({
|
|
1648
1648
|
unknownKeys: e._def.unknownKeys,
|
|
1649
1649
|
catchall: e._def.catchall,
|
|
1650
1650
|
shape: () => ({
|
|
1651
1651
|
...this._def.shape(),
|
|
1652
1652
|
...e._def.shape()
|
|
1653
1653
|
}),
|
|
1654
|
-
typeName:
|
|
1654
|
+
typeName: m.ZodObject
|
|
1655
1655
|
});
|
|
1656
1656
|
}
|
|
1657
1657
|
// merge<
|
|
@@ -1714,25 +1714,25 @@ class x extends _ {
|
|
|
1714
1714
|
// return merged;
|
|
1715
1715
|
// }
|
|
1716
1716
|
catchall(e) {
|
|
1717
|
-
return new
|
|
1717
|
+
return new k({
|
|
1718
1718
|
...this._def,
|
|
1719
1719
|
catchall: e
|
|
1720
1720
|
});
|
|
1721
1721
|
}
|
|
1722
1722
|
pick(e) {
|
|
1723
1723
|
const t = {};
|
|
1724
|
-
return
|
|
1724
|
+
return _.objectKeys(e).forEach((s) => {
|
|
1725
1725
|
e[s] && this.shape[s] && (t[s] = this.shape[s]);
|
|
1726
|
-
}), new
|
|
1726
|
+
}), new k({
|
|
1727
1727
|
...this._def,
|
|
1728
1728
|
shape: () => t
|
|
1729
1729
|
});
|
|
1730
1730
|
}
|
|
1731
1731
|
omit(e) {
|
|
1732
1732
|
const t = {};
|
|
1733
|
-
return
|
|
1733
|
+
return _.objectKeys(this.shape).forEach((s) => {
|
|
1734
1734
|
e[s] || (t[s] = this.shape[s]);
|
|
1735
|
-
}), new
|
|
1735
|
+
}), new k({
|
|
1736
1736
|
...this._def,
|
|
1737
1737
|
shape: () => t
|
|
1738
1738
|
});
|
|
@@ -1745,73 +1745,73 @@ class x extends _ {
|
|
|
1745
1745
|
}
|
|
1746
1746
|
partial(e) {
|
|
1747
1747
|
const t = {};
|
|
1748
|
-
return
|
|
1748
|
+
return _.objectKeys(this.shape).forEach((s) => {
|
|
1749
1749
|
const n = this.shape[s];
|
|
1750
1750
|
e && !e[s] ? t[s] = n : t[s] = n.optional();
|
|
1751
|
-
}), new
|
|
1751
|
+
}), new k({
|
|
1752
1752
|
...this._def,
|
|
1753
1753
|
shape: () => t
|
|
1754
1754
|
});
|
|
1755
1755
|
}
|
|
1756
1756
|
required(e) {
|
|
1757
1757
|
const t = {};
|
|
1758
|
-
return
|
|
1758
|
+
return _.objectKeys(this.shape).forEach((s) => {
|
|
1759
1759
|
if (e && !e[s])
|
|
1760
1760
|
t[s] = this.shape[s];
|
|
1761
1761
|
else {
|
|
1762
|
-
let
|
|
1763
|
-
for (;
|
|
1764
|
-
|
|
1765
|
-
t[s] =
|
|
1762
|
+
let n = this.shape[s];
|
|
1763
|
+
for (; n instanceof N; )
|
|
1764
|
+
n = n._def.innerType;
|
|
1765
|
+
t[s] = n;
|
|
1766
1766
|
}
|
|
1767
|
-
}), new
|
|
1767
|
+
}), new k({
|
|
1768
1768
|
...this._def,
|
|
1769
1769
|
shape: () => t
|
|
1770
1770
|
});
|
|
1771
1771
|
}
|
|
1772
1772
|
keyof() {
|
|
1773
|
-
return
|
|
1773
|
+
return Ie(_.objectKeys(this.shape));
|
|
1774
1774
|
}
|
|
1775
1775
|
}
|
|
1776
|
-
|
|
1777
|
-
shape: () =>
|
|
1776
|
+
k.create = (a, e) => new k({
|
|
1777
|
+
shape: () => a,
|
|
1778
1778
|
unknownKeys: "strip",
|
|
1779
|
-
catchall:
|
|
1780
|
-
typeName:
|
|
1781
|
-
...
|
|
1779
|
+
catchall: E.create(),
|
|
1780
|
+
typeName: m.ZodObject,
|
|
1781
|
+
...y(e)
|
|
1782
1782
|
});
|
|
1783
|
-
|
|
1784
|
-
shape: () =>
|
|
1783
|
+
k.strictCreate = (a, e) => new k({
|
|
1784
|
+
shape: () => a,
|
|
1785
1785
|
unknownKeys: "strict",
|
|
1786
|
-
catchall:
|
|
1787
|
-
typeName:
|
|
1788
|
-
...
|
|
1786
|
+
catchall: E.create(),
|
|
1787
|
+
typeName: m.ZodObject,
|
|
1788
|
+
...y(e)
|
|
1789
1789
|
});
|
|
1790
|
-
|
|
1791
|
-
shape:
|
|
1790
|
+
k.lazycreate = (a, e) => new k({
|
|
1791
|
+
shape: a,
|
|
1792
1792
|
unknownKeys: "strip",
|
|
1793
|
-
catchall:
|
|
1794
|
-
typeName:
|
|
1795
|
-
...
|
|
1793
|
+
catchall: E.create(),
|
|
1794
|
+
typeName: m.ZodObject,
|
|
1795
|
+
...y(e)
|
|
1796
1796
|
});
|
|
1797
|
-
class
|
|
1797
|
+
class Q extends v {
|
|
1798
1798
|
_parse(e) {
|
|
1799
1799
|
const { ctx: t } = this._processInputParams(e), s = this._def.options;
|
|
1800
|
-
function n(
|
|
1801
|
-
for (const
|
|
1802
|
-
if (
|
|
1803
|
-
return
|
|
1804
|
-
for (const
|
|
1805
|
-
if (
|
|
1806
|
-
return t.common.issues.push(...
|
|
1807
|
-
const i =
|
|
1808
|
-
return
|
|
1800
|
+
function n(o) {
|
|
1801
|
+
for (const r of o)
|
|
1802
|
+
if (r.result.status === "valid")
|
|
1803
|
+
return r.result;
|
|
1804
|
+
for (const r of o)
|
|
1805
|
+
if (r.result.status === "dirty")
|
|
1806
|
+
return t.common.issues.push(...r.ctx.common.issues), r.result;
|
|
1807
|
+
const i = o.map((r) => new w(r.ctx.common.issues));
|
|
1808
|
+
return c(t, {
|
|
1809
1809
|
code: d.invalid_union,
|
|
1810
1810
|
unionErrors: i
|
|
1811
|
-
}),
|
|
1811
|
+
}), f;
|
|
1812
1812
|
}
|
|
1813
1813
|
if (t.common.async)
|
|
1814
|
-
return Promise.all(s.map(async (
|
|
1814
|
+
return Promise.all(s.map(async (o) => {
|
|
1815
1815
|
const i = {
|
|
1816
1816
|
...t,
|
|
1817
1817
|
common: {
|
|
@@ -1821,7 +1821,7 @@ class ee extends _ {
|
|
|
1821
1821
|
parent: null
|
|
1822
1822
|
};
|
|
1823
1823
|
return {
|
|
1824
|
-
result: await
|
|
1824
|
+
result: await o._parseAsync({
|
|
1825
1825
|
data: t.data,
|
|
1826
1826
|
path: t.path,
|
|
1827
1827
|
parent: i
|
|
@@ -1830,67 +1830,67 @@ class ee extends _ {
|
|
|
1830
1830
|
};
|
|
1831
1831
|
})).then(n);
|
|
1832
1832
|
{
|
|
1833
|
-
let
|
|
1833
|
+
let o;
|
|
1834
1834
|
const i = [];
|
|
1835
|
-
for (const
|
|
1836
|
-
const
|
|
1835
|
+
for (const u of s) {
|
|
1836
|
+
const h = {
|
|
1837
1837
|
...t,
|
|
1838
1838
|
common: {
|
|
1839
1839
|
...t.common,
|
|
1840
1840
|
issues: []
|
|
1841
1841
|
},
|
|
1842
1842
|
parent: null
|
|
1843
|
-
},
|
|
1843
|
+
}, g = u._parseSync({
|
|
1844
1844
|
data: t.data,
|
|
1845
1845
|
path: t.path,
|
|
1846
|
-
parent:
|
|
1846
|
+
parent: h
|
|
1847
1847
|
});
|
|
1848
|
-
if (
|
|
1849
|
-
return
|
|
1850
|
-
|
|
1848
|
+
if (g.status === "valid")
|
|
1849
|
+
return g;
|
|
1850
|
+
g.status === "dirty" && !o && (o = { result: g, ctx: h }), h.common.issues.length && i.push(h.common.issues);
|
|
1851
1851
|
}
|
|
1852
|
-
if (
|
|
1853
|
-
return t.common.issues.push(...
|
|
1854
|
-
const
|
|
1855
|
-
return
|
|
1852
|
+
if (o)
|
|
1853
|
+
return t.common.issues.push(...o.ctx.common.issues), o.result;
|
|
1854
|
+
const r = i.map((u) => new w(u));
|
|
1855
|
+
return c(t, {
|
|
1856
1856
|
code: d.invalid_union,
|
|
1857
|
-
unionErrors:
|
|
1858
|
-
}),
|
|
1857
|
+
unionErrors: r
|
|
1858
|
+
}), f;
|
|
1859
1859
|
}
|
|
1860
1860
|
}
|
|
1861
1861
|
get options() {
|
|
1862
1862
|
return this._def.options;
|
|
1863
1863
|
}
|
|
1864
1864
|
}
|
|
1865
|
-
|
|
1866
|
-
options:
|
|
1867
|
-
typeName:
|
|
1868
|
-
...
|
|
1865
|
+
Q.create = (a, e) => new Q({
|
|
1866
|
+
options: a,
|
|
1867
|
+
typeName: m.ZodUnion,
|
|
1868
|
+
...y(e)
|
|
1869
1869
|
});
|
|
1870
|
-
const
|
|
1871
|
-
class ve extends
|
|
1870
|
+
const I = (a) => a instanceof ae ? I(a.schema) : a instanceof O ? I(a.innerType()) : a instanceof se ? [a.value] : a instanceof $ ? a.options : a instanceof ne ? _.objectValues(a.enum) : a instanceof ie ? I(a._def.innerType) : a instanceof G ? [void 0] : a instanceof X ? [null] : a instanceof N ? [void 0, ...I(a.unwrap())] : a instanceof M ? [null, ...I(a.unwrap())] : a instanceof Ze || a instanceof oe ? I(a.unwrap()) : a instanceof re ? I(a._def.innerType) : [];
|
|
1871
|
+
class ve extends v {
|
|
1872
1872
|
_parse(e) {
|
|
1873
1873
|
const { ctx: t } = this._processInputParams(e);
|
|
1874
|
-
if (t.parsedType !==
|
|
1875
|
-
return
|
|
1874
|
+
if (t.parsedType !== l.object)
|
|
1875
|
+
return c(t, {
|
|
1876
1876
|
code: d.invalid_type,
|
|
1877
|
-
expected:
|
|
1877
|
+
expected: l.object,
|
|
1878
1878
|
received: t.parsedType
|
|
1879
|
-
}),
|
|
1880
|
-
const s = this.discriminator, n = t.data[s],
|
|
1881
|
-
return
|
|
1879
|
+
}), f;
|
|
1880
|
+
const s = this.discriminator, n = t.data[s], o = this.optionsMap.get(n);
|
|
1881
|
+
return o ? t.common.async ? o._parseAsync({
|
|
1882
1882
|
data: t.data,
|
|
1883
1883
|
path: t.path,
|
|
1884
1884
|
parent: t
|
|
1885
|
-
}) :
|
|
1885
|
+
}) : o._parseSync({
|
|
1886
1886
|
data: t.data,
|
|
1887
1887
|
path: t.path,
|
|
1888
1888
|
parent: t
|
|
1889
|
-
}) : (
|
|
1889
|
+
}) : (c(t, {
|
|
1890
1890
|
code: d.invalid_union_discriminator,
|
|
1891
1891
|
options: Array.from(this.optionsMap.keys()),
|
|
1892
1892
|
path: [s]
|
|
1893
|
-
}),
|
|
1893
|
+
}), f);
|
|
1894
1894
|
}
|
|
1895
1895
|
get discriminator() {
|
|
1896
1896
|
return this._def.discriminator;
|
|
@@ -1911,60 +1911,60 @@ class ve extends _ {
|
|
|
1911
1911
|
*/
|
|
1912
1912
|
static create(e, t, s) {
|
|
1913
1913
|
const n = /* @__PURE__ */ new Map();
|
|
1914
|
-
for (const
|
|
1915
|
-
const i =
|
|
1914
|
+
for (const o of t) {
|
|
1915
|
+
const i = I(o.shape[e]);
|
|
1916
1916
|
if (!i.length)
|
|
1917
1917
|
throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
|
|
1918
|
-
for (const
|
|
1919
|
-
if (n.has(
|
|
1920
|
-
throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(
|
|
1921
|
-
n.set(
|
|
1918
|
+
for (const r of i) {
|
|
1919
|
+
if (n.has(r))
|
|
1920
|
+
throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(r)}`);
|
|
1921
|
+
n.set(r, o);
|
|
1922
1922
|
}
|
|
1923
1923
|
}
|
|
1924
1924
|
return new ve({
|
|
1925
|
-
typeName:
|
|
1925
|
+
typeName: m.ZodDiscriminatedUnion,
|
|
1926
1926
|
discriminator: e,
|
|
1927
1927
|
options: t,
|
|
1928
1928
|
optionsMap: n,
|
|
1929
|
-
...
|
|
1929
|
+
...y(s)
|
|
1930
1930
|
});
|
|
1931
1931
|
}
|
|
1932
1932
|
}
|
|
1933
|
-
function we(
|
|
1934
|
-
const t =
|
|
1935
|
-
if (
|
|
1936
|
-
return { valid: !0, data:
|
|
1937
|
-
if (t ===
|
|
1938
|
-
const n =
|
|
1939
|
-
for (const
|
|
1940
|
-
const
|
|
1941
|
-
if (!
|
|
1933
|
+
function we(a, e) {
|
|
1934
|
+
const t = P(a), s = P(e);
|
|
1935
|
+
if (a === e)
|
|
1936
|
+
return { valid: !0, data: a };
|
|
1937
|
+
if (t === l.object && s === l.object) {
|
|
1938
|
+
const n = _.objectKeys(e), o = _.objectKeys(a).filter((r) => n.indexOf(r) !== -1), i = { ...a, ...e };
|
|
1939
|
+
for (const r of o) {
|
|
1940
|
+
const u = we(a[r], e[r]);
|
|
1941
|
+
if (!u.valid)
|
|
1942
1942
|
return { valid: !1 };
|
|
1943
|
-
i[
|
|
1943
|
+
i[r] = u.data;
|
|
1944
1944
|
}
|
|
1945
1945
|
return { valid: !0, data: i };
|
|
1946
|
-
} else if (t ===
|
|
1947
|
-
if (
|
|
1946
|
+
} else if (t === l.array && s === l.array) {
|
|
1947
|
+
if (a.length !== e.length)
|
|
1948
1948
|
return { valid: !1 };
|
|
1949
1949
|
const n = [];
|
|
1950
|
-
for (let
|
|
1951
|
-
const i =
|
|
1952
|
-
if (!
|
|
1950
|
+
for (let o = 0; o < a.length; o++) {
|
|
1951
|
+
const i = a[o], r = e[o], u = we(i, r);
|
|
1952
|
+
if (!u.valid)
|
|
1953
1953
|
return { valid: !1 };
|
|
1954
|
-
n.push(
|
|
1954
|
+
n.push(u.data);
|
|
1955
1955
|
}
|
|
1956
1956
|
return { valid: !0, data: n };
|
|
1957
|
-
} else return t ===
|
|
1957
|
+
} else return t === l.date && s === l.date && +a == +e ? { valid: !0, data: a } : { valid: !1 };
|
|
1958
1958
|
}
|
|
1959
|
-
class
|
|
1959
|
+
class ee extends v {
|
|
1960
1960
|
_parse(e) {
|
|
1961
|
-
const { status: t, ctx: s } = this._processInputParams(e), n = (
|
|
1962
|
-
if (
|
|
1963
|
-
return
|
|
1964
|
-
const
|
|
1965
|
-
return
|
|
1961
|
+
const { status: t, ctx: s } = this._processInputParams(e), n = (o, i) => {
|
|
1962
|
+
if (be(o) || be(i))
|
|
1963
|
+
return f;
|
|
1964
|
+
const r = we(o.value, i.value);
|
|
1965
|
+
return r.valid ? ((xe(o) || xe(i)) && t.dirty(), { status: t.value, value: r.data }) : (c(s, {
|
|
1966
1966
|
code: d.invalid_intersection_types
|
|
1967
|
-
}),
|
|
1967
|
+
}), f);
|
|
1968
1968
|
};
|
|
1969
1969
|
return s.common.async ? Promise.all([
|
|
1970
1970
|
this._def.left._parseAsync({
|
|
@@ -1977,7 +1977,7 @@ class te extends _ {
|
|
|
1977
1977
|
path: s.path,
|
|
1978
1978
|
parent: s
|
|
1979
1979
|
})
|
|
1980
|
-
]).then(([
|
|
1980
|
+
]).then(([o, i]) => n(o, i)) : n(this._def.left._parseSync({
|
|
1981
1981
|
data: s.data,
|
|
1982
1982
|
path: s.path,
|
|
1983
1983
|
parent: s
|
|
@@ -1988,63 +1988,63 @@ class te extends _ {
|
|
|
1988
1988
|
}));
|
|
1989
1989
|
}
|
|
1990
1990
|
}
|
|
1991
|
-
|
|
1992
|
-
left:
|
|
1991
|
+
ee.create = (a, e, t) => new ee({
|
|
1992
|
+
left: a,
|
|
1993
1993
|
right: e,
|
|
1994
|
-
typeName:
|
|
1995
|
-
...
|
|
1994
|
+
typeName: m.ZodIntersection,
|
|
1995
|
+
...y(t)
|
|
1996
1996
|
});
|
|
1997
|
-
class
|
|
1997
|
+
class S extends v {
|
|
1998
1998
|
_parse(e) {
|
|
1999
1999
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2000
|
-
if (s.parsedType !==
|
|
2001
|
-
return
|
|
2000
|
+
if (s.parsedType !== l.array)
|
|
2001
|
+
return c(s, {
|
|
2002
2002
|
code: d.invalid_type,
|
|
2003
|
-
expected:
|
|
2003
|
+
expected: l.array,
|
|
2004
2004
|
received: s.parsedType
|
|
2005
|
-
}),
|
|
2005
|
+
}), f;
|
|
2006
2006
|
if (s.data.length < this._def.items.length)
|
|
2007
|
-
return
|
|
2007
|
+
return c(s, {
|
|
2008
2008
|
code: d.too_small,
|
|
2009
2009
|
minimum: this._def.items.length,
|
|
2010
2010
|
inclusive: !0,
|
|
2011
2011
|
exact: !1,
|
|
2012
2012
|
type: "array"
|
|
2013
|
-
}),
|
|
2014
|
-
!this._def.rest && s.data.length > this._def.items.length && (
|
|
2013
|
+
}), f;
|
|
2014
|
+
!this._def.rest && s.data.length > this._def.items.length && (c(s, {
|
|
2015
2015
|
code: d.too_big,
|
|
2016
2016
|
maximum: this._def.items.length,
|
|
2017
2017
|
inclusive: !0,
|
|
2018
2018
|
exact: !1,
|
|
2019
2019
|
type: "array"
|
|
2020
2020
|
}), t.dirty());
|
|
2021
|
-
const
|
|
2022
|
-
const
|
|
2023
|
-
return
|
|
2024
|
-
}).filter((
|
|
2025
|
-
return s.common.async ? Promise.all(
|
|
2021
|
+
const n = [...s.data].map((o, i) => {
|
|
2022
|
+
const r = this._def.items[i] || this._def.rest;
|
|
2023
|
+
return r ? r._parse(new C(s, o, s.path, i)) : null;
|
|
2024
|
+
}).filter((o) => !!o);
|
|
2025
|
+
return s.common.async ? Promise.all(n).then((o) => b.mergeArray(t, o)) : b.mergeArray(t, n);
|
|
2026
2026
|
}
|
|
2027
2027
|
get items() {
|
|
2028
2028
|
return this._def.items;
|
|
2029
2029
|
}
|
|
2030
2030
|
rest(e) {
|
|
2031
|
-
return new
|
|
2031
|
+
return new S({
|
|
2032
2032
|
...this._def,
|
|
2033
2033
|
rest: e
|
|
2034
2034
|
});
|
|
2035
2035
|
}
|
|
2036
2036
|
}
|
|
2037
|
-
|
|
2038
|
-
if (!Array.isArray(
|
|
2037
|
+
S.create = (a, e) => {
|
|
2038
|
+
if (!Array.isArray(a))
|
|
2039
2039
|
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
2040
|
-
return new
|
|
2041
|
-
items:
|
|
2042
|
-
typeName:
|
|
2040
|
+
return new S({
|
|
2041
|
+
items: a,
|
|
2042
|
+
typeName: m.ZodTuple,
|
|
2043
2043
|
rest: null,
|
|
2044
|
-
...
|
|
2044
|
+
...y(e)
|
|
2045
2045
|
});
|
|
2046
2046
|
};
|
|
2047
|
-
class
|
|
2047
|
+
class te extends v {
|
|
2048
2048
|
get keySchema() {
|
|
2049
2049
|
return this._def.keyType;
|
|
2050
2050
|
}
|
|
@@ -2053,39 +2053,39 @@ class re extends _ {
|
|
|
2053
2053
|
}
|
|
2054
2054
|
_parse(e) {
|
|
2055
2055
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2056
|
-
if (s.parsedType !==
|
|
2057
|
-
return
|
|
2056
|
+
if (s.parsedType !== l.object)
|
|
2057
|
+
return c(s, {
|
|
2058
2058
|
code: d.invalid_type,
|
|
2059
|
-
expected:
|
|
2059
|
+
expected: l.object,
|
|
2060
2060
|
received: s.parsedType
|
|
2061
|
-
}),
|
|
2062
|
-
const n = [],
|
|
2063
|
-
for (const
|
|
2061
|
+
}), f;
|
|
2062
|
+
const n = [], o = this._def.keyType, i = this._def.valueType;
|
|
2063
|
+
for (const r in s.data)
|
|
2064
2064
|
n.push({
|
|
2065
|
-
key:
|
|
2066
|
-
value: i._parse(new
|
|
2067
|
-
alwaysSet:
|
|
2065
|
+
key: o._parse(new C(s, r, s.path, r)),
|
|
2066
|
+
value: i._parse(new C(s, s.data[r], s.path, r)),
|
|
2067
|
+
alwaysSet: r in s.data
|
|
2068
2068
|
});
|
|
2069
|
-
return s.common.async ?
|
|
2069
|
+
return s.common.async ? b.mergeObjectAsync(t, n) : b.mergeObjectSync(t, n);
|
|
2070
2070
|
}
|
|
2071
2071
|
get element() {
|
|
2072
2072
|
return this._def.valueType;
|
|
2073
2073
|
}
|
|
2074
2074
|
static create(e, t, s) {
|
|
2075
|
-
return t instanceof
|
|
2075
|
+
return t instanceof v ? new te({
|
|
2076
2076
|
keyType: e,
|
|
2077
2077
|
valueType: t,
|
|
2078
|
-
typeName:
|
|
2079
|
-
...
|
|
2080
|
-
}) : new
|
|
2078
|
+
typeName: m.ZodRecord,
|
|
2079
|
+
...y(s)
|
|
2080
|
+
}) : new te({
|
|
2081
2081
|
keyType: Z.create(),
|
|
2082
2082
|
valueType: e,
|
|
2083
|
-
typeName:
|
|
2084
|
-
...
|
|
2083
|
+
typeName: m.ZodRecord,
|
|
2084
|
+
...y(t)
|
|
2085
2085
|
});
|
|
2086
2086
|
}
|
|
2087
2087
|
}
|
|
2088
|
-
class
|
|
2088
|
+
class fe extends v {
|
|
2089
2089
|
get keySchema() {
|
|
2090
2090
|
return this._def.keyType;
|
|
2091
2091
|
}
|
|
@@ -2094,63 +2094,63 @@ class me extends _ {
|
|
|
2094
2094
|
}
|
|
2095
2095
|
_parse(e) {
|
|
2096
2096
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2097
|
-
if (s.parsedType !==
|
|
2098
|
-
return
|
|
2097
|
+
if (s.parsedType !== l.map)
|
|
2098
|
+
return c(s, {
|
|
2099
2099
|
code: d.invalid_type,
|
|
2100
|
-
expected:
|
|
2100
|
+
expected: l.map,
|
|
2101
2101
|
received: s.parsedType
|
|
2102
|
-
}),
|
|
2103
|
-
const n = this._def.keyType,
|
|
2104
|
-
key: n._parse(new
|
|
2105
|
-
value:
|
|
2102
|
+
}), f;
|
|
2103
|
+
const n = this._def.keyType, o = this._def.valueType, i = [...s.data.entries()].map(([r, u], h) => ({
|
|
2104
|
+
key: n._parse(new C(s, r, s.path, [h, "key"])),
|
|
2105
|
+
value: o._parse(new C(s, u, s.path, [h, "value"]))
|
|
2106
2106
|
}));
|
|
2107
2107
|
if (s.common.async) {
|
|
2108
|
-
const
|
|
2108
|
+
const r = /* @__PURE__ */ new Map();
|
|
2109
2109
|
return Promise.resolve().then(async () => {
|
|
2110
|
-
for (const
|
|
2111
|
-
const
|
|
2112
|
-
if (
|
|
2113
|
-
return
|
|
2114
|
-
(
|
|
2110
|
+
for (const u of i) {
|
|
2111
|
+
const h = await u.key, g = await u.value;
|
|
2112
|
+
if (h.status === "aborted" || g.status === "aborted")
|
|
2113
|
+
return f;
|
|
2114
|
+
(h.status === "dirty" || g.status === "dirty") && t.dirty(), r.set(h.value, g.value);
|
|
2115
2115
|
}
|
|
2116
|
-
return { status: t.value, value:
|
|
2116
|
+
return { status: t.value, value: r };
|
|
2117
2117
|
});
|
|
2118
2118
|
} else {
|
|
2119
|
-
const
|
|
2120
|
-
for (const
|
|
2121
|
-
const
|
|
2122
|
-
if (
|
|
2123
|
-
return
|
|
2124
|
-
(
|
|
2119
|
+
const r = /* @__PURE__ */ new Map();
|
|
2120
|
+
for (const u of i) {
|
|
2121
|
+
const h = u.key, g = u.value;
|
|
2122
|
+
if (h.status === "aborted" || g.status === "aborted")
|
|
2123
|
+
return f;
|
|
2124
|
+
(h.status === "dirty" || g.status === "dirty") && t.dirty(), r.set(h.value, g.value);
|
|
2125
2125
|
}
|
|
2126
|
-
return { status: t.value, value:
|
|
2126
|
+
return { status: t.value, value: r };
|
|
2127
2127
|
}
|
|
2128
2128
|
}
|
|
2129
2129
|
}
|
|
2130
|
-
|
|
2130
|
+
fe.create = (a, e, t) => new fe({
|
|
2131
2131
|
valueType: e,
|
|
2132
|
-
keyType:
|
|
2133
|
-
typeName:
|
|
2134
|
-
...
|
|
2132
|
+
keyType: a,
|
|
2133
|
+
typeName: m.ZodMap,
|
|
2134
|
+
...y(t)
|
|
2135
2135
|
});
|
|
2136
|
-
class
|
|
2136
|
+
class V extends v {
|
|
2137
2137
|
_parse(e) {
|
|
2138
2138
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2139
|
-
if (s.parsedType !==
|
|
2140
|
-
return
|
|
2139
|
+
if (s.parsedType !== l.set)
|
|
2140
|
+
return c(s, {
|
|
2141
2141
|
code: d.invalid_type,
|
|
2142
|
-
expected:
|
|
2142
|
+
expected: l.set,
|
|
2143
2143
|
received: s.parsedType
|
|
2144
|
-
}),
|
|
2144
|
+
}), f;
|
|
2145
2145
|
const n = this._def;
|
|
2146
|
-
n.minSize !== null && s.data.size < n.minSize.value && (
|
|
2146
|
+
n.minSize !== null && s.data.size < n.minSize.value && (c(s, {
|
|
2147
2147
|
code: d.too_small,
|
|
2148
2148
|
minimum: n.minSize.value,
|
|
2149
2149
|
type: "set",
|
|
2150
2150
|
inclusive: !0,
|
|
2151
2151
|
exact: !1,
|
|
2152
2152
|
message: n.minSize.message
|
|
2153
|
-
}), t.dirty()), n.maxSize !== null && s.data.size > n.maxSize.value && (
|
|
2153
|
+
}), t.dirty()), n.maxSize !== null && s.data.size > n.maxSize.value && (c(s, {
|
|
2154
2154
|
code: d.too_big,
|
|
2155
2155
|
maximum: n.maxSize.value,
|
|
2156
2156
|
type: "set",
|
|
@@ -2158,29 +2158,29 @@ class L extends _ {
|
|
|
2158
2158
|
exact: !1,
|
|
2159
2159
|
message: n.maxSize.message
|
|
2160
2160
|
}), t.dirty());
|
|
2161
|
-
const
|
|
2162
|
-
function i(
|
|
2163
|
-
const
|
|
2164
|
-
for (const
|
|
2165
|
-
if (
|
|
2166
|
-
return
|
|
2167
|
-
|
|
2161
|
+
const o = this._def.valueType;
|
|
2162
|
+
function i(u) {
|
|
2163
|
+
const h = /* @__PURE__ */ new Set();
|
|
2164
|
+
for (const g of u) {
|
|
2165
|
+
if (g.status === "aborted")
|
|
2166
|
+
return f;
|
|
2167
|
+
g.status === "dirty" && t.dirty(), h.add(g.value);
|
|
2168
2168
|
}
|
|
2169
|
-
return { status: t.value, value:
|
|
2169
|
+
return { status: t.value, value: h };
|
|
2170
2170
|
}
|
|
2171
|
-
const
|
|
2172
|
-
return s.common.async ? Promise.all(
|
|
2171
|
+
const r = [...s.data.values()].map((u, h) => o._parse(new C(s, u, s.path, h)));
|
|
2172
|
+
return s.common.async ? Promise.all(r).then((u) => i(u)) : i(r);
|
|
2173
2173
|
}
|
|
2174
2174
|
min(e, t) {
|
|
2175
|
-
return new
|
|
2175
|
+
return new V({
|
|
2176
2176
|
...this._def,
|
|
2177
|
-
minSize: { value: e, message:
|
|
2177
|
+
minSize: { value: e, message: p.toString(t) }
|
|
2178
2178
|
});
|
|
2179
2179
|
}
|
|
2180
2180
|
max(e, t) {
|
|
2181
|
-
return new
|
|
2181
|
+
return new V({
|
|
2182
2182
|
...this._def,
|
|
2183
|
-
maxSize: { value: e, message:
|
|
2183
|
+
maxSize: { value: e, message: p.toString(t) }
|
|
2184
2184
|
});
|
|
2185
2185
|
}
|
|
2186
2186
|
size(e, t) {
|
|
@@ -2190,78 +2190,78 @@ class L extends _ {
|
|
|
2190
2190
|
return this.min(1, e);
|
|
2191
2191
|
}
|
|
2192
2192
|
}
|
|
2193
|
-
|
|
2194
|
-
valueType:
|
|
2193
|
+
V.create = (a, e) => new V({
|
|
2194
|
+
valueType: a,
|
|
2195
2195
|
minSize: null,
|
|
2196
2196
|
maxSize: null,
|
|
2197
|
-
typeName:
|
|
2198
|
-
...
|
|
2197
|
+
typeName: m.ZodSet,
|
|
2198
|
+
...y(e)
|
|
2199
2199
|
});
|
|
2200
|
-
class
|
|
2200
|
+
class U extends v {
|
|
2201
2201
|
constructor() {
|
|
2202
2202
|
super(...arguments), this.validate = this.implement;
|
|
2203
2203
|
}
|
|
2204
2204
|
_parse(e) {
|
|
2205
2205
|
const { ctx: t } = this._processInputParams(e);
|
|
2206
|
-
if (t.parsedType !==
|
|
2207
|
-
return
|
|
2206
|
+
if (t.parsedType !== l.function)
|
|
2207
|
+
return c(t, {
|
|
2208
2208
|
code: d.invalid_type,
|
|
2209
|
-
expected:
|
|
2209
|
+
expected: l.function,
|
|
2210
2210
|
received: t.parsedType
|
|
2211
|
-
}),
|
|
2212
|
-
function s(
|
|
2213
|
-
return
|
|
2214
|
-
data:
|
|
2211
|
+
}), f;
|
|
2212
|
+
function s(r, u) {
|
|
2213
|
+
return ce({
|
|
2214
|
+
data: r,
|
|
2215
2215
|
path: t.path,
|
|
2216
2216
|
errorMaps: [
|
|
2217
2217
|
t.common.contextualErrorMap,
|
|
2218
2218
|
t.schemaErrorMap,
|
|
2219
2219
|
ue(),
|
|
2220
|
-
|
|
2221
|
-
].filter((
|
|
2220
|
+
K
|
|
2221
|
+
].filter((h) => !!h),
|
|
2222
2222
|
issueData: {
|
|
2223
2223
|
code: d.invalid_arguments,
|
|
2224
|
-
argumentsError:
|
|
2224
|
+
argumentsError: u
|
|
2225
2225
|
}
|
|
2226
2226
|
});
|
|
2227
2227
|
}
|
|
2228
|
-
function n(
|
|
2229
|
-
return
|
|
2230
|
-
data:
|
|
2228
|
+
function n(r, u) {
|
|
2229
|
+
return ce({
|
|
2230
|
+
data: r,
|
|
2231
2231
|
path: t.path,
|
|
2232
2232
|
errorMaps: [
|
|
2233
2233
|
t.common.contextualErrorMap,
|
|
2234
2234
|
t.schemaErrorMap,
|
|
2235
2235
|
ue(),
|
|
2236
|
-
|
|
2237
|
-
].filter((
|
|
2236
|
+
K
|
|
2237
|
+
].filter((h) => !!h),
|
|
2238
2238
|
issueData: {
|
|
2239
2239
|
code: d.invalid_return_type,
|
|
2240
|
-
returnTypeError:
|
|
2240
|
+
returnTypeError: u
|
|
2241
2241
|
}
|
|
2242
2242
|
});
|
|
2243
2243
|
}
|
|
2244
|
-
const
|
|
2245
|
-
if (this._def.returns instanceof
|
|
2246
|
-
const
|
|
2247
|
-
return
|
|
2248
|
-
const
|
|
2249
|
-
throw
|
|
2250
|
-
}),
|
|
2251
|
-
return await
|
|
2252
|
-
throw
|
|
2244
|
+
const o = { errorMap: t.common.contextualErrorMap }, i = t.data;
|
|
2245
|
+
if (this._def.returns instanceof F) {
|
|
2246
|
+
const r = this;
|
|
2247
|
+
return x(async function(...u) {
|
|
2248
|
+
const h = new w([]), g = await r._def.args.parseAsync(u, o).catch((_e) => {
|
|
2249
|
+
throw h.addIssue(s(u, _e)), h;
|
|
2250
|
+
}), j = await Reflect.apply(i, this, g);
|
|
2251
|
+
return await r._def.returns._def.type.parseAsync(j, o).catch((_e) => {
|
|
2252
|
+
throw h.addIssue(n(j, _e)), h;
|
|
2253
2253
|
});
|
|
2254
2254
|
});
|
|
2255
2255
|
} else {
|
|
2256
|
-
const
|
|
2257
|
-
return
|
|
2258
|
-
const
|
|
2259
|
-
if (!
|
|
2260
|
-
throw new w([s(
|
|
2261
|
-
const
|
|
2262
|
-
if (!
|
|
2263
|
-
throw new w([n(
|
|
2264
|
-
return
|
|
2256
|
+
const r = this;
|
|
2257
|
+
return x(function(...u) {
|
|
2258
|
+
const h = r._def.args.safeParse(u, o);
|
|
2259
|
+
if (!h.success)
|
|
2260
|
+
throw new w([s(u, h.error)]);
|
|
2261
|
+
const g = Reflect.apply(i, this, h.data), j = r._def.returns.safeParse(g, o);
|
|
2262
|
+
if (!j.success)
|
|
2263
|
+
throw new w([n(g, j.error)]);
|
|
2264
|
+
return j.data;
|
|
2265
2265
|
});
|
|
2266
2266
|
}
|
|
2267
2267
|
}
|
|
@@ -2272,13 +2272,13 @@ class B extends _ {
|
|
|
2272
2272
|
return this._def.returns;
|
|
2273
2273
|
}
|
|
2274
2274
|
args(...e) {
|
|
2275
|
-
return new
|
|
2275
|
+
return new U({
|
|
2276
2276
|
...this._def,
|
|
2277
|
-
args:
|
|
2277
|
+
args: S.create(e).rest(D.create())
|
|
2278
2278
|
});
|
|
2279
2279
|
}
|
|
2280
2280
|
returns(e) {
|
|
2281
|
-
return new
|
|
2281
|
+
return new U({
|
|
2282
2282
|
...this._def,
|
|
2283
2283
|
returns: e
|
|
2284
2284
|
});
|
|
@@ -2290,15 +2290,15 @@ class B extends _ {
|
|
|
2290
2290
|
return this.parse(e);
|
|
2291
2291
|
}
|
|
2292
2292
|
static create(e, t, s) {
|
|
2293
|
-
return new
|
|
2294
|
-
args: e ||
|
|
2295
|
-
returns: t ||
|
|
2296
|
-
typeName:
|
|
2297
|
-
...
|
|
2293
|
+
return new U({
|
|
2294
|
+
args: e || S.create([]).rest(D.create()),
|
|
2295
|
+
returns: t || D.create(),
|
|
2296
|
+
typeName: m.ZodFunction,
|
|
2297
|
+
...y(s)
|
|
2298
2298
|
});
|
|
2299
2299
|
}
|
|
2300
2300
|
}
|
|
2301
|
-
class
|
|
2301
|
+
class ae extends v {
|
|
2302
2302
|
get schema() {
|
|
2303
2303
|
return this._def.getter();
|
|
2304
2304
|
}
|
|
@@ -2307,20 +2307,20 @@ class se extends _ {
|
|
|
2307
2307
|
return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
|
|
2308
2308
|
}
|
|
2309
2309
|
}
|
|
2310
|
-
|
|
2311
|
-
getter:
|
|
2312
|
-
typeName:
|
|
2313
|
-
...
|
|
2310
|
+
ae.create = (a, e) => new ae({
|
|
2311
|
+
getter: a,
|
|
2312
|
+
typeName: m.ZodLazy,
|
|
2313
|
+
...y(e)
|
|
2314
2314
|
});
|
|
2315
|
-
class
|
|
2315
|
+
class se extends v {
|
|
2316
2316
|
_parse(e) {
|
|
2317
2317
|
if (e.data !== this._def.value) {
|
|
2318
2318
|
const t = this._getOrReturnCtx(e);
|
|
2319
|
-
return
|
|
2319
|
+
return c(t, {
|
|
2320
2320
|
received: t.data,
|
|
2321
2321
|
code: d.invalid_literal,
|
|
2322
2322
|
expected: this._def.value
|
|
2323
|
-
}),
|
|
2323
|
+
}), f;
|
|
2324
2324
|
}
|
|
2325
2325
|
return { status: "valid", value: e.data };
|
|
2326
2326
|
}
|
|
@@ -2328,40 +2328,40 @@ class ne extends _ {
|
|
|
2328
2328
|
return this._def.value;
|
|
2329
2329
|
}
|
|
2330
2330
|
}
|
|
2331
|
-
|
|
2332
|
-
value:
|
|
2333
|
-
typeName:
|
|
2334
|
-
...
|
|
2331
|
+
se.create = (a, e) => new se({
|
|
2332
|
+
value: a,
|
|
2333
|
+
typeName: m.ZodLiteral,
|
|
2334
|
+
...y(e)
|
|
2335
2335
|
});
|
|
2336
|
-
function
|
|
2336
|
+
function Ie(a, e) {
|
|
2337
2337
|
return new $({
|
|
2338
|
-
values:
|
|
2339
|
-
typeName:
|
|
2340
|
-
...
|
|
2338
|
+
values: a,
|
|
2339
|
+
typeName: m.ZodEnum,
|
|
2340
|
+
...y(e)
|
|
2341
2341
|
});
|
|
2342
2342
|
}
|
|
2343
|
-
class $ extends
|
|
2343
|
+
class $ extends v {
|
|
2344
2344
|
constructor() {
|
|
2345
|
-
super(...arguments),
|
|
2345
|
+
super(...arguments), W.set(this, void 0);
|
|
2346
2346
|
}
|
|
2347
2347
|
_parse(e) {
|
|
2348
2348
|
if (typeof e.data != "string") {
|
|
2349
2349
|
const t = this._getOrReturnCtx(e), s = this._def.values;
|
|
2350
|
-
return
|
|
2351
|
-
expected:
|
|
2350
|
+
return c(t, {
|
|
2351
|
+
expected: _.joinValues(s),
|
|
2352
2352
|
received: t.parsedType,
|
|
2353
2353
|
code: d.invalid_type
|
|
2354
|
-
}),
|
|
2354
|
+
}), f;
|
|
2355
2355
|
}
|
|
2356
|
-
if (
|
|
2356
|
+
if (he(this, W) || Ce(this, W, new Set(this._def.values)), !he(this, W).has(e.data)) {
|
|
2357
2357
|
const t = this._getOrReturnCtx(e), s = this._def.values;
|
|
2358
|
-
return
|
|
2358
|
+
return c(t, {
|
|
2359
2359
|
received: t.data,
|
|
2360
2360
|
code: d.invalid_enum_value,
|
|
2361
2361
|
options: s
|
|
2362
|
-
}),
|
|
2362
|
+
}), f;
|
|
2363
2363
|
}
|
|
2364
|
-
return
|
|
2364
|
+
return x(e.data);
|
|
2365
2365
|
}
|
|
2366
2366
|
get options() {
|
|
2367
2367
|
return this._def.values;
|
|
@@ -2397,124 +2397,124 @@ class $ extends _ {
|
|
|
2397
2397
|
});
|
|
2398
2398
|
}
|
|
2399
2399
|
}
|
|
2400
|
-
|
|
2401
|
-
$.create =
|
|
2402
|
-
class
|
|
2400
|
+
W = /* @__PURE__ */ new WeakMap();
|
|
2401
|
+
$.create = Ie;
|
|
2402
|
+
class ne extends v {
|
|
2403
2403
|
constructor() {
|
|
2404
|
-
super(...arguments),
|
|
2404
|
+
super(...arguments), q.set(this, void 0);
|
|
2405
2405
|
}
|
|
2406
2406
|
_parse(e) {
|
|
2407
|
-
const t =
|
|
2408
|
-
if (s.parsedType !==
|
|
2409
|
-
const n =
|
|
2410
|
-
return
|
|
2411
|
-
expected:
|
|
2407
|
+
const t = _.getValidEnumValues(this._def.values), s = this._getOrReturnCtx(e);
|
|
2408
|
+
if (s.parsedType !== l.string && s.parsedType !== l.number) {
|
|
2409
|
+
const n = _.objectValues(t);
|
|
2410
|
+
return c(s, {
|
|
2411
|
+
expected: _.joinValues(n),
|
|
2412
2412
|
received: s.parsedType,
|
|
2413
2413
|
code: d.invalid_type
|
|
2414
|
-
}),
|
|
2414
|
+
}), f;
|
|
2415
2415
|
}
|
|
2416
|
-
if (
|
|
2417
|
-
const n =
|
|
2418
|
-
return
|
|
2416
|
+
if (he(this, q) || Ce(this, q, new Set(_.getValidEnumValues(this._def.values))), !he(this, q).has(e.data)) {
|
|
2417
|
+
const n = _.objectValues(t);
|
|
2418
|
+
return c(s, {
|
|
2419
2419
|
received: s.data,
|
|
2420
2420
|
code: d.invalid_enum_value,
|
|
2421
2421
|
options: n
|
|
2422
|
-
}),
|
|
2422
|
+
}), f;
|
|
2423
2423
|
}
|
|
2424
|
-
return
|
|
2424
|
+
return x(e.data);
|
|
2425
2425
|
}
|
|
2426
2426
|
get enum() {
|
|
2427
2427
|
return this._def.values;
|
|
2428
2428
|
}
|
|
2429
2429
|
}
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
values:
|
|
2433
|
-
typeName:
|
|
2434
|
-
...
|
|
2430
|
+
q = /* @__PURE__ */ new WeakMap();
|
|
2431
|
+
ne.create = (a, e) => new ne({
|
|
2432
|
+
values: a,
|
|
2433
|
+
typeName: m.ZodNativeEnum,
|
|
2434
|
+
...y(e)
|
|
2435
2435
|
});
|
|
2436
|
-
class
|
|
2436
|
+
class F extends v {
|
|
2437
2437
|
unwrap() {
|
|
2438
2438
|
return this._def.type;
|
|
2439
2439
|
}
|
|
2440
2440
|
_parse(e) {
|
|
2441
2441
|
const { ctx: t } = this._processInputParams(e);
|
|
2442
|
-
if (t.parsedType !==
|
|
2443
|
-
return
|
|
2442
|
+
if (t.parsedType !== l.promise && t.common.async === !1)
|
|
2443
|
+
return c(t, {
|
|
2444
2444
|
code: d.invalid_type,
|
|
2445
|
-
expected:
|
|
2445
|
+
expected: l.promise,
|
|
2446
2446
|
received: t.parsedType
|
|
2447
|
-
}),
|
|
2448
|
-
const s = t.parsedType ===
|
|
2449
|
-
return
|
|
2447
|
+
}), f;
|
|
2448
|
+
const s = t.parsedType === l.promise ? t.data : Promise.resolve(t.data);
|
|
2449
|
+
return x(s.then((n) => this._def.type.parseAsync(n, {
|
|
2450
2450
|
path: t.path,
|
|
2451
2451
|
errorMap: t.common.contextualErrorMap
|
|
2452
2452
|
})));
|
|
2453
2453
|
}
|
|
2454
2454
|
}
|
|
2455
|
-
|
|
2456
|
-
type:
|
|
2457
|
-
typeName:
|
|
2458
|
-
...
|
|
2455
|
+
F.create = (a, e) => new F({
|
|
2456
|
+
type: a,
|
|
2457
|
+
typeName: m.ZodPromise,
|
|
2458
|
+
...y(e)
|
|
2459
2459
|
});
|
|
2460
|
-
class
|
|
2460
|
+
class O extends v {
|
|
2461
2461
|
innerType() {
|
|
2462
2462
|
return this._def.schema;
|
|
2463
2463
|
}
|
|
2464
2464
|
sourceType() {
|
|
2465
|
-
return this._def.schema._def.typeName ===
|
|
2465
|
+
return this._def.schema._def.typeName === m.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
|
|
2466
2466
|
}
|
|
2467
2467
|
_parse(e) {
|
|
2468
|
-
const { status: t, ctx: s } = this._processInputParams(e), n = this._def.effect || null,
|
|
2468
|
+
const { status: t, ctx: s } = this._processInputParams(e), n = this._def.effect || null, o = {
|
|
2469
2469
|
addIssue: (i) => {
|
|
2470
|
-
|
|
2470
|
+
c(s, i), i.fatal ? t.abort() : t.dirty();
|
|
2471
2471
|
},
|
|
2472
2472
|
get path() {
|
|
2473
2473
|
return s.path;
|
|
2474
2474
|
}
|
|
2475
2475
|
};
|
|
2476
|
-
if (
|
|
2477
|
-
const i = n.transform(s.data,
|
|
2476
|
+
if (o.addIssue = o.addIssue.bind(o), n.type === "preprocess") {
|
|
2477
|
+
const i = n.transform(s.data, o);
|
|
2478
2478
|
if (s.common.async)
|
|
2479
|
-
return Promise.resolve(i).then(async (
|
|
2479
|
+
return Promise.resolve(i).then(async (r) => {
|
|
2480
2480
|
if (t.value === "aborted")
|
|
2481
|
-
return
|
|
2482
|
-
const
|
|
2483
|
-
data:
|
|
2481
|
+
return f;
|
|
2482
|
+
const u = await this._def.schema._parseAsync({
|
|
2483
|
+
data: r,
|
|
2484
2484
|
path: s.path,
|
|
2485
2485
|
parent: s
|
|
2486
2486
|
});
|
|
2487
|
-
return
|
|
2487
|
+
return u.status === "aborted" ? f : u.status === "dirty" || t.value === "dirty" ? le(u.value) : u;
|
|
2488
2488
|
});
|
|
2489
2489
|
{
|
|
2490
2490
|
if (t.value === "aborted")
|
|
2491
|
-
return
|
|
2492
|
-
const
|
|
2491
|
+
return f;
|
|
2492
|
+
const r = this._def.schema._parseSync({
|
|
2493
2493
|
data: i,
|
|
2494
2494
|
path: s.path,
|
|
2495
2495
|
parent: s
|
|
2496
2496
|
});
|
|
2497
|
-
return
|
|
2497
|
+
return r.status === "aborted" ? f : r.status === "dirty" || t.value === "dirty" ? le(r.value) : r;
|
|
2498
2498
|
}
|
|
2499
2499
|
}
|
|
2500
2500
|
if (n.type === "refinement") {
|
|
2501
|
-
const i = (
|
|
2502
|
-
const
|
|
2501
|
+
const i = (r) => {
|
|
2502
|
+
const u = n.refinement(r, o);
|
|
2503
2503
|
if (s.common.async)
|
|
2504
|
-
return Promise.resolve(
|
|
2505
|
-
if (
|
|
2504
|
+
return Promise.resolve(u);
|
|
2505
|
+
if (u instanceof Promise)
|
|
2506
2506
|
throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2507
|
-
return
|
|
2507
|
+
return r;
|
|
2508
2508
|
};
|
|
2509
2509
|
if (s.common.async === !1) {
|
|
2510
|
-
const
|
|
2510
|
+
const r = this._def.schema._parseSync({
|
|
2511
2511
|
data: s.data,
|
|
2512
2512
|
path: s.path,
|
|
2513
2513
|
parent: s
|
|
2514
2514
|
});
|
|
2515
|
-
return
|
|
2515
|
+
return r.status === "aborted" ? f : (r.status === "dirty" && t.dirty(), i(r.value), { status: t.value, value: r.value });
|
|
2516
2516
|
} else
|
|
2517
|
-
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((
|
|
2517
|
+
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((r) => r.status === "aborted" ? f : (r.status === "dirty" && t.dirty(), i(r.value).then(() => ({ status: t.value, value: r.value }))));
|
|
2518
2518
|
}
|
|
2519
2519
|
if (n.type === "transform")
|
|
2520
2520
|
if (s.common.async === !1) {
|
|
@@ -2523,60 +2523,60 @@ class C extends _ {
|
|
|
2523
2523
|
path: s.path,
|
|
2524
2524
|
parent: s
|
|
2525
2525
|
});
|
|
2526
|
-
if (!
|
|
2526
|
+
if (!Y(i))
|
|
2527
2527
|
return i;
|
|
2528
|
-
const
|
|
2529
|
-
if (
|
|
2528
|
+
const r = n.transform(i.value, o);
|
|
2529
|
+
if (r instanceof Promise)
|
|
2530
2530
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2531
|
-
return { status: t.value, value:
|
|
2531
|
+
return { status: t.value, value: r };
|
|
2532
2532
|
} else
|
|
2533
|
-
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((i) =>
|
|
2534
|
-
|
|
2533
|
+
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((i) => Y(i) ? Promise.resolve(n.transform(i.value, o)).then((r) => ({ status: t.value, value: r })) : i);
|
|
2534
|
+
_.assertNever(n);
|
|
2535
2535
|
}
|
|
2536
2536
|
}
|
|
2537
|
-
|
|
2538
|
-
schema:
|
|
2539
|
-
typeName:
|
|
2537
|
+
O.create = (a, e, t) => new O({
|
|
2538
|
+
schema: a,
|
|
2539
|
+
typeName: m.ZodEffects,
|
|
2540
2540
|
effect: e,
|
|
2541
|
-
...
|
|
2541
|
+
...y(t)
|
|
2542
2542
|
});
|
|
2543
|
-
|
|
2543
|
+
O.createWithPreprocess = (a, e, t) => new O({
|
|
2544
2544
|
schema: e,
|
|
2545
|
-
effect: { type: "preprocess", transform:
|
|
2546
|
-
typeName:
|
|
2547
|
-
...
|
|
2545
|
+
effect: { type: "preprocess", transform: a },
|
|
2546
|
+
typeName: m.ZodEffects,
|
|
2547
|
+
...y(t)
|
|
2548
2548
|
});
|
|
2549
|
-
class N extends
|
|
2549
|
+
class N extends v {
|
|
2550
2550
|
_parse(e) {
|
|
2551
|
-
return this._getType(e) ===
|
|
2551
|
+
return this._getType(e) === l.undefined ? x(void 0) : this._def.innerType._parse(e);
|
|
2552
2552
|
}
|
|
2553
2553
|
unwrap() {
|
|
2554
2554
|
return this._def.innerType;
|
|
2555
2555
|
}
|
|
2556
2556
|
}
|
|
2557
|
-
N.create = (
|
|
2558
|
-
innerType:
|
|
2559
|
-
typeName:
|
|
2560
|
-
...
|
|
2557
|
+
N.create = (a, e) => new N({
|
|
2558
|
+
innerType: a,
|
|
2559
|
+
typeName: m.ZodOptional,
|
|
2560
|
+
...y(e)
|
|
2561
2561
|
});
|
|
2562
|
-
class
|
|
2562
|
+
class M extends v {
|
|
2563
2563
|
_parse(e) {
|
|
2564
|
-
return this._getType(e) ===
|
|
2564
|
+
return this._getType(e) === l.null ? x(null) : this._def.innerType._parse(e);
|
|
2565
2565
|
}
|
|
2566
2566
|
unwrap() {
|
|
2567
2567
|
return this._def.innerType;
|
|
2568
2568
|
}
|
|
2569
2569
|
}
|
|
2570
|
-
|
|
2571
|
-
innerType:
|
|
2572
|
-
typeName:
|
|
2573
|
-
...
|
|
2570
|
+
M.create = (a, e) => new M({
|
|
2571
|
+
innerType: a,
|
|
2572
|
+
typeName: m.ZodNullable,
|
|
2573
|
+
...y(e)
|
|
2574
2574
|
});
|
|
2575
|
-
class ie extends
|
|
2575
|
+
class ie extends v {
|
|
2576
2576
|
_parse(e) {
|
|
2577
2577
|
const { ctx: t } = this._processInputParams(e);
|
|
2578
2578
|
let s = t.data;
|
|
2579
|
-
return t.parsedType ===
|
|
2579
|
+
return t.parsedType === l.undefined && (s = this._def.defaultValue()), this._def.innerType._parse({
|
|
2580
2580
|
data: s,
|
|
2581
2581
|
path: t.path,
|
|
2582
2582
|
parent: t
|
|
@@ -2586,13 +2586,13 @@ class ie extends _ {
|
|
|
2586
2586
|
return this._def.innerType;
|
|
2587
2587
|
}
|
|
2588
2588
|
}
|
|
2589
|
-
ie.create = (
|
|
2590
|
-
innerType:
|
|
2591
|
-
typeName:
|
|
2589
|
+
ie.create = (a, e) => new ie({
|
|
2590
|
+
innerType: a,
|
|
2591
|
+
typeName: m.ZodDefault,
|
|
2592
2592
|
defaultValue: typeof e.default == "function" ? e.default : () => e.default,
|
|
2593
|
-
...
|
|
2593
|
+
...y(e)
|
|
2594
2594
|
});
|
|
2595
|
-
class
|
|
2595
|
+
class re extends v {
|
|
2596
2596
|
_parse(e) {
|
|
2597
2597
|
const { ctx: t } = this._processInputParams(e), s = {
|
|
2598
2598
|
...t,
|
|
@@ -2607,9 +2607,9 @@ class oe extends _ {
|
|
|
2607
2607
|
...s
|
|
2608
2608
|
}
|
|
2609
2609
|
});
|
|
2610
|
-
return
|
|
2610
|
+
return J(n) ? n.then((o) => ({
|
|
2611
2611
|
status: "valid",
|
|
2612
|
-
value:
|
|
2612
|
+
value: o.status === "valid" ? o.value : this._def.catchValue({
|
|
2613
2613
|
get error() {
|
|
2614
2614
|
return new w(s.common.issues);
|
|
2615
2615
|
},
|
|
@@ -2629,31 +2629,31 @@ class oe extends _ {
|
|
|
2629
2629
|
return this._def.innerType;
|
|
2630
2630
|
}
|
|
2631
2631
|
}
|
|
2632
|
-
|
|
2633
|
-
innerType:
|
|
2634
|
-
typeName:
|
|
2632
|
+
re.create = (a, e) => new re({
|
|
2633
|
+
innerType: a,
|
|
2634
|
+
typeName: m.ZodCatch,
|
|
2635
2635
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
|
|
2636
|
-
...
|
|
2636
|
+
...y(e)
|
|
2637
2637
|
});
|
|
2638
|
-
class ye extends
|
|
2638
|
+
class ye extends v {
|
|
2639
2639
|
_parse(e) {
|
|
2640
|
-
if (this._getType(e) !==
|
|
2641
|
-
const
|
|
2642
|
-
return
|
|
2640
|
+
if (this._getType(e) !== l.nan) {
|
|
2641
|
+
const t = this._getOrReturnCtx(e);
|
|
2642
|
+
return c(t, {
|
|
2643
2643
|
code: d.invalid_type,
|
|
2644
|
-
expected:
|
|
2645
|
-
received:
|
|
2646
|
-
}),
|
|
2644
|
+
expected: l.nan,
|
|
2645
|
+
received: t.parsedType
|
|
2646
|
+
}), f;
|
|
2647
2647
|
}
|
|
2648
2648
|
return { status: "valid", value: e.data };
|
|
2649
2649
|
}
|
|
2650
2650
|
}
|
|
2651
|
-
ye.create = (
|
|
2652
|
-
typeName:
|
|
2653
|
-
...
|
|
2651
|
+
ye.create = (a) => new ye({
|
|
2652
|
+
typeName: m.ZodNaN,
|
|
2653
|
+
...y(a)
|
|
2654
2654
|
});
|
|
2655
|
-
const
|
|
2656
|
-
class
|
|
2655
|
+
const tt = Symbol("zod_brand");
|
|
2656
|
+
class Ze extends v {
|
|
2657
2657
|
_parse(e) {
|
|
2658
2658
|
const { ctx: t } = this._processInputParams(e), s = t.data;
|
|
2659
2659
|
return this._def.type._parse({
|
|
@@ -2666,18 +2666,18 @@ class Te extends _ {
|
|
|
2666
2666
|
return this._def.type;
|
|
2667
2667
|
}
|
|
2668
2668
|
}
|
|
2669
|
-
class
|
|
2669
|
+
class de extends v {
|
|
2670
2670
|
_parse(e) {
|
|
2671
2671
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2672
2672
|
if (s.common.async)
|
|
2673
2673
|
return (async () => {
|
|
2674
|
-
const
|
|
2674
|
+
const n = await this._def.in._parseAsync({
|
|
2675
2675
|
data: s.data,
|
|
2676
2676
|
path: s.path,
|
|
2677
2677
|
parent: s
|
|
2678
2678
|
});
|
|
2679
|
-
return
|
|
2680
|
-
data:
|
|
2679
|
+
return n.status === "aborted" ? f : n.status === "dirty" ? (t.dirty(), le(n.value)) : this._def.out._parseAsync({
|
|
2680
|
+
data: n.value,
|
|
2681
2681
|
path: s.path,
|
|
2682
2682
|
parent: s
|
|
2683
2683
|
});
|
|
@@ -2688,7 +2688,7 @@ class ce extends _ {
|
|
|
2688
2688
|
path: s.path,
|
|
2689
2689
|
parent: s
|
|
2690
2690
|
});
|
|
2691
|
-
return n.status === "aborted" ?
|
|
2691
|
+
return n.status === "aborted" ? f : n.status === "dirty" ? (t.dirty(), {
|
|
2692
2692
|
status: "dirty",
|
|
2693
2693
|
value: n.value
|
|
2694
2694
|
}) : this._def.out._parseSync({
|
|
@@ -2699,279 +2699,279 @@ class ce extends _ {
|
|
|
2699
2699
|
}
|
|
2700
2700
|
}
|
|
2701
2701
|
static create(e, t) {
|
|
2702
|
-
return new
|
|
2702
|
+
return new de({
|
|
2703
2703
|
in: e,
|
|
2704
2704
|
out: t,
|
|
2705
|
-
typeName:
|
|
2705
|
+
typeName: m.ZodPipeline
|
|
2706
2706
|
});
|
|
2707
2707
|
}
|
|
2708
2708
|
}
|
|
2709
|
-
class
|
|
2709
|
+
class oe extends v {
|
|
2710
2710
|
_parse(e) {
|
|
2711
|
-
const t = this._def.innerType._parse(e), s = (n) => (
|
|
2712
|
-
return
|
|
2711
|
+
const t = this._def.innerType._parse(e), s = (n) => (Y(n) && (n.value = Object.freeze(n.value)), n);
|
|
2712
|
+
return J(t) ? t.then((n) => s(n)) : s(t);
|
|
2713
2713
|
}
|
|
2714
2714
|
unwrap() {
|
|
2715
2715
|
return this._def.innerType;
|
|
2716
2716
|
}
|
|
2717
2717
|
}
|
|
2718
|
-
|
|
2719
|
-
innerType:
|
|
2720
|
-
typeName:
|
|
2721
|
-
...
|
|
2718
|
+
oe.create = (a, e) => new oe({
|
|
2719
|
+
innerType: a,
|
|
2720
|
+
typeName: m.ZodReadonly,
|
|
2721
|
+
...y(e)
|
|
2722
2722
|
});
|
|
2723
|
-
function
|
|
2724
|
-
return
|
|
2725
|
-
var
|
|
2726
|
-
if (!
|
|
2727
|
-
const
|
|
2728
|
-
n.addIssue({ code: "custom", ...
|
|
2723
|
+
function Pe(a, e = {}, t) {
|
|
2724
|
+
return a ? B.create().superRefine((s, n) => {
|
|
2725
|
+
var o, i;
|
|
2726
|
+
if (!a(s)) {
|
|
2727
|
+
const r = typeof e == "function" ? e(s) : typeof e == "string" ? { message: e } : e, u = (i = (o = r.fatal) !== null && o !== void 0 ? o : t) !== null && i !== void 0 ? i : !0, h = typeof r == "string" ? { message: r } : r;
|
|
2728
|
+
n.addIssue({ code: "custom", ...h, fatal: u });
|
|
2729
2729
|
}
|
|
2730
|
-
}) :
|
|
2730
|
+
}) : B.create();
|
|
2731
2731
|
}
|
|
2732
|
-
const
|
|
2733
|
-
object:
|
|
2732
|
+
const at = {
|
|
2733
|
+
object: k.lazycreate
|
|
2734
2734
|
};
|
|
2735
|
-
var
|
|
2736
|
-
(function(
|
|
2737
|
-
|
|
2738
|
-
})(
|
|
2739
|
-
const
|
|
2740
|
-
message: `Input not instance of ${
|
|
2741
|
-
}) =>
|
|
2742
|
-
string: (
|
|
2743
|
-
number: (
|
|
2744
|
-
boolean: (
|
|
2745
|
-
...
|
|
2735
|
+
var m;
|
|
2736
|
+
(function(a) {
|
|
2737
|
+
a.ZodString = "ZodString", a.ZodNumber = "ZodNumber", a.ZodNaN = "ZodNaN", a.ZodBigInt = "ZodBigInt", a.ZodBoolean = "ZodBoolean", a.ZodDate = "ZodDate", a.ZodSymbol = "ZodSymbol", a.ZodUndefined = "ZodUndefined", a.ZodNull = "ZodNull", a.ZodAny = "ZodAny", a.ZodUnknown = "ZodUnknown", a.ZodNever = "ZodNever", a.ZodVoid = "ZodVoid", a.ZodArray = "ZodArray", a.ZodObject = "ZodObject", a.ZodUnion = "ZodUnion", a.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", a.ZodIntersection = "ZodIntersection", a.ZodTuple = "ZodTuple", a.ZodRecord = "ZodRecord", a.ZodMap = "ZodMap", a.ZodSet = "ZodSet", a.ZodFunction = "ZodFunction", a.ZodLazy = "ZodLazy", a.ZodLiteral = "ZodLiteral", a.ZodEnum = "ZodEnum", a.ZodEffects = "ZodEffects", a.ZodNativeEnum = "ZodNativeEnum", a.ZodOptional = "ZodOptional", a.ZodNullable = "ZodNullable", a.ZodDefault = "ZodDefault", a.ZodCatch = "ZodCatch", a.ZodPromise = "ZodPromise", a.ZodBranded = "ZodBranded", a.ZodPipeline = "ZodPipeline", a.ZodReadonly = "ZodReadonly";
|
|
2738
|
+
})(m || (m = {}));
|
|
2739
|
+
const st = (a, e = {
|
|
2740
|
+
message: `Input not instance of ${a.name}`
|
|
2741
|
+
}) => Pe((t) => t instanceof a, e), Re = Z.create, Ae = R.create, nt = ye.create, it = A.create, $e = H.create, rt = L.create, ot = pe.create, dt = G.create, ut = X.create, ct = B.create, lt = D.create, ht = E.create, pt = me.create, mt = T.create, ft = k.create, yt = k.strictCreate, vt = Q.create, _t = ve.create, gt = ee.create, kt = S.create, bt = te.create, xt = fe.create, wt = V.create, Zt = U.create, Tt = ae.create, Ot = se.create, Nt = $.create, Ct = ne.create, St = F.create, Oe = O.create, Et = N.create, jt = M.create, It = O.createWithPreprocess, Pt = de.create, Rt = () => Re().optional(), At = () => Ae().optional(), $t = () => $e().optional(), Mt = {
|
|
2742
|
+
string: (a) => Z.create({ ...a, coerce: !0 }),
|
|
2743
|
+
number: (a) => R.create({ ...a, coerce: !0 }),
|
|
2744
|
+
boolean: (a) => H.create({
|
|
2745
|
+
...a,
|
|
2746
2746
|
coerce: !0
|
|
2747
2747
|
}),
|
|
2748
|
-
bigint: (
|
|
2749
|
-
date: (
|
|
2750
|
-
}, Dt =
|
|
2748
|
+
bigint: (a) => A.create({ ...a, coerce: !0 }),
|
|
2749
|
+
date: (a) => L.create({ ...a, coerce: !0 })
|
|
2750
|
+
}, Dt = f;
|
|
2751
2751
|
var Lt = /* @__PURE__ */ Object.freeze({
|
|
2752
2752
|
__proto__: null,
|
|
2753
|
-
defaultErrorMap:
|
|
2753
|
+
defaultErrorMap: K,
|
|
2754
2754
|
setErrorMap: De,
|
|
2755
2755
|
getErrorMap: ue,
|
|
2756
|
-
makeIssue:
|
|
2756
|
+
makeIssue: ce,
|
|
2757
2757
|
EMPTY_PATH: Le,
|
|
2758
|
-
addIssueToContext:
|
|
2759
|
-
ParseStatus:
|
|
2760
|
-
INVALID:
|
|
2761
|
-
DIRTY:
|
|
2762
|
-
OK:
|
|
2763
|
-
isAborted:
|
|
2764
|
-
isDirty:
|
|
2765
|
-
isValid:
|
|
2766
|
-
isAsync:
|
|
2758
|
+
addIssueToContext: c,
|
|
2759
|
+
ParseStatus: b,
|
|
2760
|
+
INVALID: f,
|
|
2761
|
+
DIRTY: le,
|
|
2762
|
+
OK: x,
|
|
2763
|
+
isAborted: be,
|
|
2764
|
+
isDirty: xe,
|
|
2765
|
+
isValid: Y,
|
|
2766
|
+
isAsync: J,
|
|
2767
2767
|
get util() {
|
|
2768
|
-
return
|
|
2768
|
+
return _;
|
|
2769
2769
|
},
|
|
2770
2770
|
get objectUtil() {
|
|
2771
|
-
return
|
|
2771
|
+
return ke;
|
|
2772
2772
|
},
|
|
2773
|
-
ZodParsedType:
|
|
2774
|
-
getParsedType:
|
|
2775
|
-
ZodType:
|
|
2776
|
-
datetimeRegex:
|
|
2773
|
+
ZodParsedType: l,
|
|
2774
|
+
getParsedType: P,
|
|
2775
|
+
ZodType: v,
|
|
2776
|
+
datetimeRegex: je,
|
|
2777
2777
|
ZodString: Z,
|
|
2778
|
-
ZodNumber:
|
|
2779
|
-
ZodBigInt:
|
|
2780
|
-
ZodBoolean:
|
|
2781
|
-
ZodDate:
|
|
2782
|
-
ZodSymbol:
|
|
2783
|
-
ZodUndefined:
|
|
2784
|
-
ZodNull:
|
|
2785
|
-
ZodAny:
|
|
2786
|
-
ZodUnknown:
|
|
2787
|
-
ZodNever:
|
|
2788
|
-
ZodVoid:
|
|
2789
|
-
ZodArray:
|
|
2790
|
-
ZodObject:
|
|
2791
|
-
ZodUnion:
|
|
2778
|
+
ZodNumber: R,
|
|
2779
|
+
ZodBigInt: A,
|
|
2780
|
+
ZodBoolean: H,
|
|
2781
|
+
ZodDate: L,
|
|
2782
|
+
ZodSymbol: pe,
|
|
2783
|
+
ZodUndefined: G,
|
|
2784
|
+
ZodNull: X,
|
|
2785
|
+
ZodAny: B,
|
|
2786
|
+
ZodUnknown: D,
|
|
2787
|
+
ZodNever: E,
|
|
2788
|
+
ZodVoid: me,
|
|
2789
|
+
ZodArray: T,
|
|
2790
|
+
ZodObject: k,
|
|
2791
|
+
ZodUnion: Q,
|
|
2792
2792
|
ZodDiscriminatedUnion: ve,
|
|
2793
|
-
ZodIntersection:
|
|
2794
|
-
ZodTuple:
|
|
2795
|
-
ZodRecord:
|
|
2796
|
-
ZodMap:
|
|
2797
|
-
ZodSet:
|
|
2798
|
-
ZodFunction:
|
|
2799
|
-
ZodLazy:
|
|
2800
|
-
ZodLiteral:
|
|
2793
|
+
ZodIntersection: ee,
|
|
2794
|
+
ZodTuple: S,
|
|
2795
|
+
ZodRecord: te,
|
|
2796
|
+
ZodMap: fe,
|
|
2797
|
+
ZodSet: V,
|
|
2798
|
+
ZodFunction: U,
|
|
2799
|
+
ZodLazy: ae,
|
|
2800
|
+
ZodLiteral: se,
|
|
2801
2801
|
ZodEnum: $,
|
|
2802
|
-
ZodNativeEnum:
|
|
2803
|
-
ZodPromise:
|
|
2804
|
-
ZodEffects:
|
|
2805
|
-
ZodTransformer:
|
|
2802
|
+
ZodNativeEnum: ne,
|
|
2803
|
+
ZodPromise: F,
|
|
2804
|
+
ZodEffects: O,
|
|
2805
|
+
ZodTransformer: O,
|
|
2806
2806
|
ZodOptional: N,
|
|
2807
|
-
ZodNullable:
|
|
2807
|
+
ZodNullable: M,
|
|
2808
2808
|
ZodDefault: ie,
|
|
2809
|
-
ZodCatch:
|
|
2809
|
+
ZodCatch: re,
|
|
2810
2810
|
ZodNaN: ye,
|
|
2811
|
-
BRAND:
|
|
2812
|
-
ZodBranded:
|
|
2813
|
-
ZodPipeline:
|
|
2814
|
-
ZodReadonly:
|
|
2815
|
-
custom:
|
|
2816
|
-
Schema:
|
|
2817
|
-
ZodSchema:
|
|
2818
|
-
late:
|
|
2811
|
+
BRAND: tt,
|
|
2812
|
+
ZodBranded: Ze,
|
|
2813
|
+
ZodPipeline: de,
|
|
2814
|
+
ZodReadonly: oe,
|
|
2815
|
+
custom: Pe,
|
|
2816
|
+
Schema: v,
|
|
2817
|
+
ZodSchema: v,
|
|
2818
|
+
late: at,
|
|
2819
2819
|
get ZodFirstPartyTypeKind() {
|
|
2820
|
-
return
|
|
2820
|
+
return m;
|
|
2821
2821
|
},
|
|
2822
|
-
coerce:
|
|
2823
|
-
any:
|
|
2822
|
+
coerce: Mt,
|
|
2823
|
+
any: ct,
|
|
2824
2824
|
array: mt,
|
|
2825
2825
|
bigint: it,
|
|
2826
|
-
boolean:
|
|
2827
|
-
date:
|
|
2828
|
-
discriminatedUnion:
|
|
2829
|
-
effect:
|
|
2826
|
+
boolean: $e,
|
|
2827
|
+
date: rt,
|
|
2828
|
+
discriminatedUnion: _t,
|
|
2829
|
+
effect: Oe,
|
|
2830
2830
|
enum: Nt,
|
|
2831
2831
|
function: Zt,
|
|
2832
|
-
instanceof:
|
|
2833
|
-
intersection:
|
|
2834
|
-
lazy:
|
|
2835
|
-
literal:
|
|
2836
|
-
map:
|
|
2837
|
-
nan:
|
|
2838
|
-
nativeEnum:
|
|
2832
|
+
instanceof: st,
|
|
2833
|
+
intersection: gt,
|
|
2834
|
+
lazy: Tt,
|
|
2835
|
+
literal: Ot,
|
|
2836
|
+
map: xt,
|
|
2837
|
+
nan: nt,
|
|
2838
|
+
nativeEnum: Ct,
|
|
2839
2839
|
never: ht,
|
|
2840
2840
|
null: ut,
|
|
2841
|
-
nullable:
|
|
2842
|
-
number:
|
|
2843
|
-
object:
|
|
2844
|
-
oboolean:
|
|
2845
|
-
onumber:
|
|
2846
|
-
optional:
|
|
2847
|
-
ostring:
|
|
2848
|
-
pipeline:
|
|
2849
|
-
preprocess:
|
|
2850
|
-
promise:
|
|
2841
|
+
nullable: jt,
|
|
2842
|
+
number: Ae,
|
|
2843
|
+
object: ft,
|
|
2844
|
+
oboolean: $t,
|
|
2845
|
+
onumber: At,
|
|
2846
|
+
optional: Et,
|
|
2847
|
+
ostring: Rt,
|
|
2848
|
+
pipeline: Pt,
|
|
2849
|
+
preprocess: It,
|
|
2850
|
+
promise: St,
|
|
2851
2851
|
record: bt,
|
|
2852
|
-
set:
|
|
2853
|
-
strictObject:
|
|
2854
|
-
string:
|
|
2855
|
-
symbol:
|
|
2856
|
-
transformer:
|
|
2852
|
+
set: wt,
|
|
2853
|
+
strictObject: yt,
|
|
2854
|
+
string: Re,
|
|
2855
|
+
symbol: ot,
|
|
2856
|
+
transformer: Oe,
|
|
2857
2857
|
tuple: kt,
|
|
2858
|
-
undefined:
|
|
2859
|
-
union:
|
|
2860
|
-
unknown:
|
|
2858
|
+
undefined: dt,
|
|
2859
|
+
union: vt,
|
|
2860
|
+
unknown: lt,
|
|
2861
2861
|
void: pt,
|
|
2862
2862
|
NEVER: Dt,
|
|
2863
2863
|
ZodIssueCode: d,
|
|
2864
|
-
quotelessJson:
|
|
2864
|
+
quotelessJson: Me,
|
|
2865
2865
|
ZodError: w
|
|
2866
2866
|
});
|
|
2867
2867
|
export {
|
|
2868
|
-
|
|
2869
|
-
|
|
2868
|
+
tt as BRAND,
|
|
2869
|
+
le as DIRTY,
|
|
2870
2870
|
Le as EMPTY_PATH,
|
|
2871
|
-
|
|
2871
|
+
f as INVALID,
|
|
2872
2872
|
Dt as NEVER,
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2873
|
+
x as OK,
|
|
2874
|
+
b as ParseStatus,
|
|
2875
|
+
v as Schema,
|
|
2876
|
+
B as ZodAny,
|
|
2877
|
+
T as ZodArray,
|
|
2878
|
+
A as ZodBigInt,
|
|
2879
|
+
H as ZodBoolean,
|
|
2880
|
+
Ze as ZodBranded,
|
|
2881
|
+
re as ZodCatch,
|
|
2882
|
+
L as ZodDate,
|
|
2883
2883
|
ie as ZodDefault,
|
|
2884
2884
|
ve as ZodDiscriminatedUnion,
|
|
2885
|
-
|
|
2885
|
+
O as ZodEffects,
|
|
2886
2886
|
$ as ZodEnum,
|
|
2887
2887
|
w as ZodError,
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2888
|
+
m as ZodFirstPartyTypeKind,
|
|
2889
|
+
U as ZodFunction,
|
|
2890
|
+
ee as ZodIntersection,
|
|
2891
2891
|
d as ZodIssueCode,
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2892
|
+
ae as ZodLazy,
|
|
2893
|
+
se as ZodLiteral,
|
|
2894
|
+
fe as ZodMap,
|
|
2895
2895
|
ye as ZodNaN,
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2896
|
+
ne as ZodNativeEnum,
|
|
2897
|
+
E as ZodNever,
|
|
2898
|
+
X as ZodNull,
|
|
2899
|
+
M as ZodNullable,
|
|
2900
|
+
R as ZodNumber,
|
|
2901
|
+
k as ZodObject,
|
|
2902
2902
|
N as ZodOptional,
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2903
|
+
l as ZodParsedType,
|
|
2904
|
+
de as ZodPipeline,
|
|
2905
|
+
F as ZodPromise,
|
|
2906
|
+
oe as ZodReadonly,
|
|
2907
|
+
te as ZodRecord,
|
|
2908
|
+
v as ZodSchema,
|
|
2909
|
+
V as ZodSet,
|
|
2910
2910
|
Z as ZodString,
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2911
|
+
pe as ZodSymbol,
|
|
2912
|
+
O as ZodTransformer,
|
|
2913
|
+
S as ZodTuple,
|
|
2914
|
+
v as ZodType,
|
|
2915
|
+
G as ZodUndefined,
|
|
2916
|
+
Q as ZodUnion,
|
|
2917
|
+
D as ZodUnknown,
|
|
2918
|
+
me as ZodVoid,
|
|
2919
|
+
c as addIssueToContext,
|
|
2920
|
+
ct as any,
|
|
2921
2921
|
mt as array,
|
|
2922
2922
|
it as bigint,
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2923
|
+
$e as boolean,
|
|
2924
|
+
Mt as coerce,
|
|
2925
|
+
Pe as custom,
|
|
2926
|
+
rt as date,
|
|
2927
|
+
je as datetimeRegex,
|
|
2928
2928
|
Lt as default,
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2929
|
+
K as defaultErrorMap,
|
|
2930
|
+
_t as discriminatedUnion,
|
|
2931
|
+
Oe as effect,
|
|
2932
2932
|
Nt as enum,
|
|
2933
2933
|
Zt as function,
|
|
2934
2934
|
ue as getErrorMap,
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2935
|
+
P as getParsedType,
|
|
2936
|
+
st as instanceof,
|
|
2937
|
+
gt as intersection,
|
|
2938
|
+
be as isAborted,
|
|
2939
|
+
J as isAsync,
|
|
2940
|
+
xe as isDirty,
|
|
2941
|
+
Y as isValid,
|
|
2942
|
+
at as late,
|
|
2943
|
+
Tt as lazy,
|
|
2944
|
+
Ot as literal,
|
|
2945
|
+
ce as makeIssue,
|
|
2946
|
+
xt as map,
|
|
2947
|
+
nt as nan,
|
|
2948
|
+
Ct as nativeEnum,
|
|
2949
2949
|
ht as never,
|
|
2950
2950
|
ut as null,
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2951
|
+
jt as nullable,
|
|
2952
|
+
Ae as number,
|
|
2953
|
+
ft as object,
|
|
2954
|
+
ke as objectUtil,
|
|
2955
|
+
$t as oboolean,
|
|
2956
|
+
At as onumber,
|
|
2957
|
+
Et as optional,
|
|
2958
|
+
Rt as ostring,
|
|
2959
|
+
Pt as pipeline,
|
|
2960
|
+
It as preprocess,
|
|
2961
|
+
St as promise,
|
|
2962
|
+
Me as quotelessJson,
|
|
2963
2963
|
bt as record,
|
|
2964
|
-
|
|
2964
|
+
wt as set,
|
|
2965
2965
|
De as setErrorMap,
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2966
|
+
yt as strictObject,
|
|
2967
|
+
Re as string,
|
|
2968
|
+
ot as symbol,
|
|
2969
|
+
Oe as transformer,
|
|
2970
2970
|
kt as tuple,
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2971
|
+
dt as undefined,
|
|
2972
|
+
vt as union,
|
|
2973
|
+
lt as unknown,
|
|
2974
|
+
_ as util,
|
|
2975
2975
|
pt as void,
|
|
2976
2976
|
Lt as z
|
|
2977
2977
|
};
|