react-luminus-components 1.1.28 → 1.2.1
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/.vite/manifest.json +43 -43
- package/dist/{DataKey-CuZpR5t0.cjs → DataKey-CLYT9XGM.cjs} +1 -1
- package/dist/{DataKey-C3jtX0q4.js → DataKey-CPc1_-be.js} +1 -1
- package/dist/{SimpleTooltip-BMSn8Fqk.js → SimpleTooltip-EPgkOstR.js} +1 -1
- package/dist/{SimpleTooltip-XmxUVlDH.cjs → SimpleTooltip-rgKvGQAh.cjs} +1 -1
- package/dist/{Typography-CHpY2hUz.cjs → Typography-C9GM_GzV.cjs} +1 -1
- package/dist/{Typography-DUoLZCdX.js → Typography-PSv7V5A1.js} +9 -9
- package/dist/{UserAvatarToggle-I_MgjXhA.js → UserAvatarToggle-CIQXhmcN.js} +67 -63
- package/dist/{UserAvatarToggle-DP4YFoNZ.cjs → UserAvatarToggle-DmBqBnvE.cjs} +41 -41
- package/dist/components/Buttons/ContextButton/ContextButton.d.ts +1 -1
- package/dist/components/Dropdown/comps/SimpleToggle/SimpleToggle.d.ts +1 -1
- package/dist/components/Form/CheckInput/CheckInput.d.ts +2 -10
- package/dist/components/Form/DropdownPicker/DropdownPicker.d.ts +2 -17
- package/dist/components/Form/SelectInput/SelectInput.d.ts +2 -17
- package/dist/components/Form/TextInput/TextInput.d.ts +2 -16
- package/dist/components/HookForm/CheckInput/HookFormCheckInput.d.ts +2 -2
- package/dist/components/HookForm/DropdownPicker/HookFormDropdownPicker.d.ts +2 -10
- package/dist/components/HookForm/FileInput/HookFormFileInput.d.ts +2 -13
- package/dist/components/HookForm/RadioInput/HookFormRadioInput.d.ts +2 -2
- package/dist/components/HookForm/SelectInput/HookFormSelectInput.d.ts +2 -2
- package/dist/components/HookForm/TextAreaInput/HookFormTextAreaInput.d.ts +2 -2
- package/dist/components/HookForm/TextInput/HookFormTextInput.d.ts +2 -2
- package/dist/components/InputContainers/FloatingLabelInput/FloatingLabelInput.d.ts +4 -0
- package/dist/components/InputContainers/RowLabelInput/RowLabelInput.d.ts +4 -0
- package/dist/components/InputContainers/index.d.ts +2 -0
- package/dist/components/common/Card/Card.d.ts +28 -0
- package/dist/components/common/InvalidFeedback/InvalidFeedback.d.ts +1 -2
- package/dist/components/common/PhotoLibrary/PhotoLibrary.d.ts +10 -0
- package/dist/components/common/PhotoLightbox/PhotoLightbox.d.ts +13 -0
- package/dist/components/common/index.d.ts +3 -1
- package/dist/contexts.cjs.js +1 -1
- package/dist/contexts.es.js +4 -4
- package/dist/hooks/useZodSchemaTypes/useZodSchemaTypes.d.ts +6 -2
- package/dist/hooks.cjs.js +1 -1
- package/dist/hooks.es.js +652 -652
- package/dist/layout.cjs.js +1 -1
- package/dist/layout.es.js +3 -3
- package/dist/main.cjs.js +1 -1
- package/dist/main.d.ts +5 -2
- package/dist/main.es.js +2109 -1952
- package/dist/models/index.d.ts +26 -7
- package/dist/models/prop-types/FormInputProps/FormCheckInputProps.d.ts +6 -0
- package/dist/models/prop-types/FormInputProps/FormFileInputProps.d.ts +11 -0
- package/dist/models/prop-types/FormInputProps/FormRadioInputProps.d.ts +6 -0
- package/dist/models/prop-types/FormInputProps/FormSelectInputProps.d.ts +6 -0
- package/dist/models/prop-types/FormInputProps/FormTextAreaInputProps.d.ts +6 -0
- package/dist/models/prop-types/FormInputProps/FormTextInputProps.d.ts +6 -0
- package/dist/models/prop-types/HookFormInputProps/HookFormCheckInputProps.d.ts +4 -0
- package/dist/models/prop-types/HookFormInputProps/HookFormDropdownPickerProps.d.ts +4 -0
- package/dist/models/prop-types/HookFormInputProps/HookFormFileInputProps.d.ts +4 -0
- package/dist/models/prop-types/HookFormInputProps/HookFormInputBaseProps.d.ts +7 -0
- package/dist/models/prop-types/HookFormInputProps/HookFormRadioInputProps.d.ts +4 -0
- package/dist/models/prop-types/HookFormInputProps/HookFormSelectInputProps.d.ts +4 -0
- package/dist/models/prop-types/HookFormInputProps/HookFormTextAreaInputProps.d.ts +4 -0
- package/dist/models/prop-types/HookFormInputProps/HookFormTextInputProps.d.ts +4 -0
- package/dist/models/prop-types/InputContainerProps.d.ts +23 -0
- package/dist/models/prop-types/InputProps/CheckInputProps.d.ts +5 -0
- package/dist/models/prop-types/InputProps/DropdownPickerProps.d.ts +14 -0
- package/dist/models/prop-types/InputProps/FileInputProps.d.ts +6 -0
- package/dist/models/prop-types/InputProps/InputBaseProps.d.ts +15 -0
- package/dist/models/prop-types/InputProps/RadioInputProps.d.ts +6 -0
- package/dist/models/prop-types/InputProps/SelectInputProps.d.ts +8 -0
- package/dist/models/prop-types/InputProps/TextAreaInputProps.d.ts +6 -0
- package/dist/models/prop-types/InputProps/TextInputProps.d.ts +6 -0
- package/dist/models/types/PhotoAction.d.ts +9 -0
- package/dist/models/types/PhotoLibraryItemModel.d.ts +7 -0
- package/dist/style.css +1 -1
- package/dist/{useConfirm-BGatkLkP.js → useConfirm-C_gZ96ka.js} +1 -1
- package/dist/{useConfirm-D677YHtT.cjs → useConfirm-CrF2KHR-.cjs} +1 -1
- package/package.json +1 -1
- package/dist/components/common/InputContainer/InputContainer.d.ts +0 -10
- package/dist/models/prop-types/HookFormCheckInputProps.d.ts +0 -10
- package/dist/models/prop-types/HookFormDropdownPickerProps.d.ts +0 -13
- package/dist/models/prop-types/HookFormRadioInputProps.d.ts +0 -10
- package/dist/models/prop-types/HookFormSelectInputProps.d.ts +0 -16
- package/dist/models/prop-types/HookFormTextAreaInputProps.d.ts +0 -13
- package/dist/models/prop-types/HookFormTextInputProps.d.ts +0 -14
- /package/dist/models/prop-types/{HookFormInputProps.d.ts → HookFormInputProps/HookFormInputProps.d.ts} +0 -0
package/dist/hooks.es.js
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
import { L as Ve } from "./UserAvatarToggle-
|
|
2
|
-
import { d as
|
|
3
|
-
import { u as Ft, a as er } from "./useConfirm-
|
|
1
|
+
import { L as Ve } from "./UserAvatarToggle-CIQXhmcN.js";
|
|
2
|
+
import { d as Gt, u as Ht, b as Xt, a as Qt } from "./UserAvatarToggle-CIQXhmcN.js";
|
|
3
|
+
import { u as Ft, a as er } from "./useConfirm-C_gZ96ka.js";
|
|
4
4
|
import { useContext as $e } from "react";
|
|
5
5
|
import { f as Le } from "./textUtils-BLtD0zaS.js";
|
|
6
6
|
import { isISODate as De } from "./utils.es.js";
|
|
7
7
|
import { u as rr } from "./useClickOutside-BjJyGTec.js";
|
|
8
|
-
var
|
|
8
|
+
var x;
|
|
9
9
|
(function(r) {
|
|
10
|
-
r.assertEqual = (
|
|
11
|
-
function e(
|
|
10
|
+
r.assertEqual = (s) => s;
|
|
11
|
+
function e(s) {
|
|
12
12
|
}
|
|
13
13
|
r.assertIs = e;
|
|
14
|
-
function t(
|
|
14
|
+
function t(s) {
|
|
15
15
|
throw new Error();
|
|
16
16
|
}
|
|
17
|
-
r.assertNever = t, r.arrayToEnum = (
|
|
17
|
+
r.assertNever = t, r.arrayToEnum = (s) => {
|
|
18
18
|
const a = {};
|
|
19
|
-
for (const i of
|
|
19
|
+
for (const i of s)
|
|
20
20
|
a[i] = i;
|
|
21
21
|
return a;
|
|
22
|
-
}, r.getValidEnumValues = (
|
|
23
|
-
const a = r.objectKeys(
|
|
22
|
+
}, r.getValidEnumValues = (s) => {
|
|
23
|
+
const a = r.objectKeys(s).filter((o) => typeof s[s[o]] != "number"), i = {};
|
|
24
24
|
for (const o of a)
|
|
25
|
-
i[o] =
|
|
25
|
+
i[o] = s[o];
|
|
26
26
|
return r.objectValues(i);
|
|
27
|
-
}, r.objectValues = (
|
|
28
|
-
return
|
|
29
|
-
}), r.objectKeys = typeof Object.keys == "function" ? (
|
|
27
|
+
}, r.objectValues = (s) => r.objectKeys(s).map(function(a) {
|
|
28
|
+
return s[a];
|
|
29
|
+
}), r.objectKeys = typeof Object.keys == "function" ? (s) => Object.keys(s) : (s) => {
|
|
30
30
|
const a = [];
|
|
31
|
-
for (const i in
|
|
32
|
-
Object.prototype.hasOwnProperty.call(
|
|
31
|
+
for (const i in s)
|
|
32
|
+
Object.prototype.hasOwnProperty.call(s, i) && a.push(i);
|
|
33
33
|
return a;
|
|
34
|
-
}, r.find = (
|
|
35
|
-
for (const i of
|
|
34
|
+
}, r.find = (s, a) => {
|
|
35
|
+
for (const i of s)
|
|
36
36
|
if (a(i))
|
|
37
37
|
return i;
|
|
38
|
-
}, r.isInteger = typeof Number.isInteger == "function" ? (
|
|
39
|
-
function s
|
|
40
|
-
return
|
|
38
|
+
}, r.isInteger = typeof Number.isInteger == "function" ? (s) => Number.isInteger(s) : (s) => typeof s == "number" && isFinite(s) && Math.floor(s) === s;
|
|
39
|
+
function n(s, a = " | ") {
|
|
40
|
+
return s.map((i) => typeof i == "string" ? `'${i}'` : i).join(a);
|
|
41
41
|
}
|
|
42
|
-
r.joinValues =
|
|
43
|
-
})(
|
|
42
|
+
r.joinValues = n, r.jsonStringifyReplacer = (s, a) => typeof a == "bigint" ? a.toString() : a;
|
|
43
|
+
})(x || (x = {}));
|
|
44
44
|
var be;
|
|
45
45
|
(function(r) {
|
|
46
46
|
r.mergeShapes = (e, t) => ({
|
|
@@ -49,7 +49,7 @@ var be;
|
|
|
49
49
|
// second overwrites first
|
|
50
50
|
});
|
|
51
51
|
})(be || (be = {}));
|
|
52
|
-
const u =
|
|
52
|
+
const u = x.arrayToEnum([
|
|
53
53
|
"string",
|
|
54
54
|
"nan",
|
|
55
55
|
"number",
|
|
@@ -91,7 +91,7 @@ const u = g.arrayToEnum([
|
|
|
91
91
|
default:
|
|
92
92
|
return u.unknown;
|
|
93
93
|
}
|
|
94
|
-
}, c =
|
|
94
|
+
}, c = x.arrayToEnum([
|
|
95
95
|
"invalid_type",
|
|
96
96
|
"invalid_literal",
|
|
97
97
|
"custom",
|
|
@@ -109,12 +109,12 @@ const u = g.arrayToEnum([
|
|
|
109
109
|
"not_multiple_of",
|
|
110
110
|
"not_finite"
|
|
111
111
|
]), Ue = (r) => JSON.stringify(r, null, 2).replace(/"([^"]+)":/g, "$1:");
|
|
112
|
-
class
|
|
112
|
+
class I extends Error {
|
|
113
113
|
constructor(e) {
|
|
114
|
-
super(), this.issues = [], this.addIssue = (
|
|
115
|
-
this.issues = [...this.issues,
|
|
116
|
-
}, this.addIssues = (
|
|
117
|
-
this.issues = [...this.issues, ...
|
|
114
|
+
super(), this.issues = [], this.addIssue = (n) => {
|
|
115
|
+
this.issues = [...this.issues, n];
|
|
116
|
+
}, this.addIssues = (n = []) => {
|
|
117
|
+
this.issues = [...this.issues, ...n];
|
|
118
118
|
};
|
|
119
119
|
const t = new.target.prototype;
|
|
120
120
|
Object.setPrototypeOf ? Object.setPrototypeOf(this, t) : this.__proto__ = t, this.name = "ZodError", this.issues = e;
|
|
@@ -125,66 +125,66 @@ class E extends Error {
|
|
|
125
125
|
format(e) {
|
|
126
126
|
const t = e || function(a) {
|
|
127
127
|
return a.message;
|
|
128
|
-
},
|
|
128
|
+
}, n = { _errors: [] }, s = (a) => {
|
|
129
129
|
for (const i of a.issues)
|
|
130
130
|
if (i.code === "invalid_union")
|
|
131
|
-
i.unionErrors.map(
|
|
131
|
+
i.unionErrors.map(s);
|
|
132
132
|
else if (i.code === "invalid_return_type")
|
|
133
|
-
|
|
133
|
+
s(i.returnTypeError);
|
|
134
134
|
else if (i.code === "invalid_arguments")
|
|
135
|
-
|
|
135
|
+
s(i.argumentsError);
|
|
136
136
|
else if (i.path.length === 0)
|
|
137
|
-
|
|
137
|
+
n._errors.push(t(i));
|
|
138
138
|
else {
|
|
139
|
-
let o =
|
|
139
|
+
let o = n, f = 0;
|
|
140
140
|
for (; f < i.path.length; ) {
|
|
141
141
|
const d = i.path[f];
|
|
142
142
|
f === i.path.length - 1 ? (o[d] = o[d] || { _errors: [] }, o[d]._errors.push(t(i))) : o[d] = o[d] || { _errors: [] }, o = o[d], f++;
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
};
|
|
146
|
-
return
|
|
146
|
+
return s(this), n;
|
|
147
147
|
}
|
|
148
148
|
toString() {
|
|
149
149
|
return this.message;
|
|
150
150
|
}
|
|
151
151
|
get message() {
|
|
152
|
-
return JSON.stringify(this.issues,
|
|
152
|
+
return JSON.stringify(this.issues, x.jsonStringifyReplacer, 2);
|
|
153
153
|
}
|
|
154
154
|
get isEmpty() {
|
|
155
155
|
return this.issues.length === 0;
|
|
156
156
|
}
|
|
157
157
|
flatten(e = (t) => t.message) {
|
|
158
|
-
const t = {},
|
|
159
|
-
for (const
|
|
160
|
-
|
|
161
|
-
return { formErrors:
|
|
158
|
+
const t = {}, n = [];
|
|
159
|
+
for (const s of this.issues)
|
|
160
|
+
s.path.length > 0 ? (t[s.path[0]] = t[s.path[0]] || [], t[s.path[0]].push(e(s))) : n.push(e(s));
|
|
161
|
+
return { formErrors: n, fieldErrors: t };
|
|
162
162
|
}
|
|
163
163
|
get formErrors() {
|
|
164
164
|
return this.flatten();
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
|
-
|
|
168
|
-
const
|
|
167
|
+
I.create = (r) => new I(r);
|
|
168
|
+
const H = (r, e) => {
|
|
169
169
|
let t;
|
|
170
170
|
switch (r.code) {
|
|
171
171
|
case c.invalid_type:
|
|
172
172
|
r.received === u.undefined ? t = "Required" : t = `Expected ${r.expected}, received ${r.received}`;
|
|
173
173
|
break;
|
|
174
174
|
case c.invalid_literal:
|
|
175
|
-
t = `Invalid literal value, expected ${JSON.stringify(r.expected,
|
|
175
|
+
t = `Invalid literal value, expected ${JSON.stringify(r.expected, x.jsonStringifyReplacer)}`;
|
|
176
176
|
break;
|
|
177
177
|
case c.unrecognized_keys:
|
|
178
|
-
t = `Unrecognized key(s) in object: ${
|
|
178
|
+
t = `Unrecognized key(s) in object: ${x.joinValues(r.keys, ", ")}`;
|
|
179
179
|
break;
|
|
180
180
|
case c.invalid_union:
|
|
181
181
|
t = "Invalid input";
|
|
182
182
|
break;
|
|
183
183
|
case c.invalid_union_discriminator:
|
|
184
|
-
t = `Invalid discriminator value. Expected ${
|
|
184
|
+
t = `Invalid discriminator value. Expected ${x.joinValues(r.options)}`;
|
|
185
185
|
break;
|
|
186
186
|
case c.invalid_enum_value:
|
|
187
|
-
t = `Invalid enum value. Expected ${
|
|
187
|
+
t = `Invalid enum value. Expected ${x.joinValues(r.options)}, received '${r.received}'`;
|
|
188
188
|
break;
|
|
189
189
|
case c.invalid_arguments:
|
|
190
190
|
t = "Invalid function arguments";
|
|
@@ -196,7 +196,7 @@ const G = (r, e) => {
|
|
|
196
196
|
t = "Invalid date";
|
|
197
197
|
break;
|
|
198
198
|
case c.invalid_string:
|
|
199
|
-
typeof r.validation == "object" ? "includes" in r.validation ? (t = `Invalid input: must include "${r.validation.includes}"`, typeof r.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${r.validation.position}`)) : "startsWith" in r.validation ? t = `Invalid input: must start with "${r.validation.startsWith}"` : "endsWith" in r.validation ? t = `Invalid input: must end with "${r.validation.endsWith}"` :
|
|
199
|
+
typeof r.validation == "object" ? "includes" in r.validation ? (t = `Invalid input: must include "${r.validation.includes}"`, typeof r.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${r.validation.position}`)) : "startsWith" in r.validation ? t = `Invalid input: must start with "${r.validation.startsWith}"` : "endsWith" in r.validation ? t = `Invalid input: must end with "${r.validation.endsWith}"` : x.assertNever(r.validation) : r.validation !== "regex" ? t = `Invalid ${r.validation}` : t = "Invalid";
|
|
200
200
|
break;
|
|
201
201
|
case c.too_small:
|
|
202
202
|
r.type === "array" ? t = `Array must contain ${r.exact ? "exactly" : r.inclusive ? "at least" : "more than"} ${r.minimum} element(s)` : r.type === "string" ? t = `String must contain ${r.exact ? "exactly" : r.inclusive ? "at least" : "over"} ${r.minimum} character(s)` : r.type === "number" ? t = `Number must be ${r.exact ? "exactly equal to " : r.inclusive ? "greater than or equal to " : "greater than "}${r.minimum}` : r.type === "date" ? t = `Date must be ${r.exact ? "exactly equal to " : r.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(r.minimum))}` : t = "Invalid input";
|
|
@@ -217,30 +217,30 @@ const G = (r, e) => {
|
|
|
217
217
|
t = "Number must be finite";
|
|
218
218
|
break;
|
|
219
219
|
default:
|
|
220
|
-
t = e.defaultError,
|
|
220
|
+
t = e.defaultError, x.assertNever(r);
|
|
221
221
|
}
|
|
222
222
|
return { message: t };
|
|
223
223
|
};
|
|
224
|
-
let
|
|
224
|
+
let Ce = H;
|
|
225
225
|
function Be(r) {
|
|
226
|
-
|
|
226
|
+
Ce = r;
|
|
227
227
|
}
|
|
228
228
|
function ue() {
|
|
229
|
-
return
|
|
229
|
+
return Ce;
|
|
230
230
|
}
|
|
231
231
|
const le = (r) => {
|
|
232
|
-
const { data: e, path: t, errorMaps:
|
|
233
|
-
...
|
|
232
|
+
const { data: e, path: t, errorMaps: n, issueData: s } = r, a = [...t, ...s.path || []], i = {
|
|
233
|
+
...s,
|
|
234
234
|
path: a
|
|
235
235
|
};
|
|
236
236
|
let o = "";
|
|
237
|
-
const f =
|
|
237
|
+
const f = n.filter((d) => !!d).slice().reverse();
|
|
238
238
|
for (const d of f)
|
|
239
239
|
o = d(i, { data: e, defaultError: o }).message;
|
|
240
240
|
return {
|
|
241
|
-
...
|
|
241
|
+
...s,
|
|
242
242
|
path: a,
|
|
243
|
-
message:
|
|
243
|
+
message: s.message || o
|
|
244
244
|
};
|
|
245
245
|
}, qe = [];
|
|
246
246
|
function l(r, e) {
|
|
@@ -252,9 +252,9 @@ function l(r, e) {
|
|
|
252
252
|
r.common.contextualErrorMap,
|
|
253
253
|
r.schemaErrorMap,
|
|
254
254
|
ue(),
|
|
255
|
-
|
|
255
|
+
H
|
|
256
256
|
// then global default map
|
|
257
|
-
].filter((
|
|
257
|
+
].filter((n) => !!n)
|
|
258
258
|
});
|
|
259
259
|
r.common.issues.push(t);
|
|
260
260
|
}
|
|
@@ -269,44 +269,44 @@ class Z {
|
|
|
269
269
|
this.value !== "aborted" && (this.value = "aborted");
|
|
270
270
|
}
|
|
271
271
|
static mergeArray(e, t) {
|
|
272
|
-
const
|
|
273
|
-
for (const
|
|
274
|
-
if (
|
|
275
|
-
return
|
|
276
|
-
|
|
272
|
+
const n = [];
|
|
273
|
+
for (const s of t) {
|
|
274
|
+
if (s.status === "aborted")
|
|
275
|
+
return p;
|
|
276
|
+
s.status === "dirty" && e.dirty(), n.push(s.value);
|
|
277
277
|
}
|
|
278
|
-
return { status: e.value, value:
|
|
278
|
+
return { status: e.value, value: n };
|
|
279
279
|
}
|
|
280
280
|
static async mergeObjectAsync(e, t) {
|
|
281
|
-
const
|
|
282
|
-
for (const
|
|
283
|
-
|
|
284
|
-
key: await
|
|
285
|
-
value: await
|
|
281
|
+
const n = [];
|
|
282
|
+
for (const s of t)
|
|
283
|
+
n.push({
|
|
284
|
+
key: await s.key,
|
|
285
|
+
value: await s.value
|
|
286
286
|
});
|
|
287
|
-
return Z.mergeObjectSync(e,
|
|
287
|
+
return Z.mergeObjectSync(e, n);
|
|
288
288
|
}
|
|
289
289
|
static mergeObjectSync(e, t) {
|
|
290
|
-
const
|
|
291
|
-
for (const
|
|
292
|
-
const { key: a, value: i } =
|
|
290
|
+
const n = {};
|
|
291
|
+
for (const s of t) {
|
|
292
|
+
const { key: a, value: i } = s;
|
|
293
293
|
if (a.status === "aborted" || i.status === "aborted")
|
|
294
|
-
return
|
|
295
|
-
a.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof i.value < "u" ||
|
|
294
|
+
return p;
|
|
295
|
+
a.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof i.value < "u" || s.alwaysSet) && (n[a.value] = i.value);
|
|
296
296
|
}
|
|
297
|
-
return { status: e.value, value:
|
|
297
|
+
return { status: e.value, value: n };
|
|
298
298
|
}
|
|
299
299
|
}
|
|
300
|
-
const
|
|
300
|
+
const p = Object.freeze({
|
|
301
301
|
status: "aborted"
|
|
302
|
-
}),
|
|
302
|
+
}), Oe = (r) => ({ status: "dirty", value: r }), S = (r) => ({ status: "valid", value: r }), ke = (r) => r.status === "aborted", we = (r) => r.status === "dirty", X = (r) => r.status === "valid", fe = (r) => typeof Promise < "u" && r instanceof Promise;
|
|
303
303
|
var h;
|
|
304
304
|
(function(r) {
|
|
305
305
|
r.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, r.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
|
|
306
306
|
})(h || (h = {}));
|
|
307
307
|
class j {
|
|
308
|
-
constructor(e, t,
|
|
309
|
-
this._cachedPath = [], this.parent = e, this.data = t, this._path =
|
|
308
|
+
constructor(e, t, n, s) {
|
|
309
|
+
this._cachedPath = [], this.parent = e, this.data = t, this._path = n, this._key = s;
|
|
310
310
|
}
|
|
311
311
|
get path() {
|
|
312
312
|
return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
|
|
@@ -322,7 +322,7 @@ const Se = (r, e) => {
|
|
|
322
322
|
get error() {
|
|
323
323
|
if (this._error)
|
|
324
324
|
return this._error;
|
|
325
|
-
const t = new
|
|
325
|
+
const t = new I(r.common.issues);
|
|
326
326
|
return this._error = t, this._error;
|
|
327
327
|
}
|
|
328
328
|
};
|
|
@@ -330,12 +330,12 @@ const Se = (r, e) => {
|
|
|
330
330
|
function y(r) {
|
|
331
331
|
if (!r)
|
|
332
332
|
return {};
|
|
333
|
-
const { errorMap: e, invalid_type_error: t, required_error:
|
|
334
|
-
if (e && (t ||
|
|
333
|
+
const { errorMap: e, invalid_type_error: t, required_error: n, description: s } = r;
|
|
334
|
+
if (e && (t || n))
|
|
335
335
|
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
336
|
-
return e ? { errorMap: e, description:
|
|
336
|
+
return e ? { errorMap: e, description: s } : { errorMap: (i, o) => i.code !== "invalid_type" ? { message: o.defaultError } : typeof o.data > "u" ? { message: n ?? o.defaultError } : { message: t ?? o.defaultError }, description: s };
|
|
337
337
|
}
|
|
338
|
-
class
|
|
338
|
+
class _ {
|
|
339
339
|
constructor(e) {
|
|
340
340
|
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);
|
|
341
341
|
}
|
|
@@ -379,17 +379,17 @@ class v {
|
|
|
379
379
|
return Promise.resolve(t);
|
|
380
380
|
}
|
|
381
381
|
parse(e, t) {
|
|
382
|
-
const
|
|
383
|
-
if (
|
|
384
|
-
return
|
|
385
|
-
throw
|
|
382
|
+
const n = this.safeParse(e, t);
|
|
383
|
+
if (n.success)
|
|
384
|
+
return n.data;
|
|
385
|
+
throw n.error;
|
|
386
386
|
}
|
|
387
387
|
safeParse(e, t) {
|
|
388
|
-
var
|
|
389
|
-
const
|
|
388
|
+
var n;
|
|
389
|
+
const s = {
|
|
390
390
|
common: {
|
|
391
391
|
issues: [],
|
|
392
|
-
async: (
|
|
392
|
+
async: (n = t == null ? void 0 : t.async) !== null && n !== void 0 ? n : !1,
|
|
393
393
|
contextualErrorMap: t == null ? void 0 : t.errorMap
|
|
394
394
|
},
|
|
395
395
|
path: (t == null ? void 0 : t.path) || [],
|
|
@@ -397,17 +397,17 @@ class v {
|
|
|
397
397
|
parent: null,
|
|
398
398
|
data: e,
|
|
399
399
|
parsedType: P(e)
|
|
400
|
-
}, a = this._parseSync({ data: e, path:
|
|
401
|
-
return Se(
|
|
400
|
+
}, a = this._parseSync({ data: e, path: s.path, parent: s });
|
|
401
|
+
return Se(s, a);
|
|
402
402
|
}
|
|
403
403
|
async parseAsync(e, t) {
|
|
404
|
-
const
|
|
405
|
-
if (
|
|
406
|
-
return
|
|
407
|
-
throw
|
|
404
|
+
const n = await this.safeParseAsync(e, t);
|
|
405
|
+
if (n.success)
|
|
406
|
+
return n.data;
|
|
407
|
+
throw n.error;
|
|
408
408
|
}
|
|
409
409
|
async safeParseAsync(e, t) {
|
|
410
|
-
const
|
|
410
|
+
const n = {
|
|
411
411
|
common: {
|
|
412
412
|
issues: [],
|
|
413
413
|
contextualErrorMap: t == null ? void 0 : t.errorMap,
|
|
@@ -418,26 +418,26 @@ class v {
|
|
|
418
418
|
parent: null,
|
|
419
419
|
data: e,
|
|
420
420
|
parsedType: P(e)
|
|
421
|
-
},
|
|
422
|
-
return Se(
|
|
421
|
+
}, s = this._parse({ data: e, path: n.path, parent: n }), a = await (fe(s) ? s : Promise.resolve(s));
|
|
422
|
+
return Se(n, a);
|
|
423
423
|
}
|
|
424
424
|
refine(e, t) {
|
|
425
|
-
const
|
|
426
|
-
return this._refinement((
|
|
427
|
-
const i = e(
|
|
425
|
+
const n = (s) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(s) : t;
|
|
426
|
+
return this._refinement((s, a) => {
|
|
427
|
+
const i = e(s), o = () => a.addIssue({
|
|
428
428
|
code: c.custom,
|
|
429
|
-
...s
|
|
429
|
+
...n(s)
|
|
430
430
|
});
|
|
431
431
|
return typeof Promise < "u" && i instanceof Promise ? i.then((f) => f ? !0 : (o(), !1)) : i ? !0 : (o(), !1);
|
|
432
432
|
});
|
|
433
433
|
}
|
|
434
434
|
refinement(e, t) {
|
|
435
|
-
return this._refinement((
|
|
435
|
+
return this._refinement((n, s) => e(n) ? !0 : (s.addIssue(typeof t == "function" ? t(n, s) : t), !1));
|
|
436
436
|
}
|
|
437
437
|
_refinement(e) {
|
|
438
438
|
return new R({
|
|
439
439
|
schema: this,
|
|
440
|
-
typeName:
|
|
440
|
+
typeName: m.ZodEffects,
|
|
441
441
|
effect: { type: "refinement", refinement: e }
|
|
442
442
|
});
|
|
443
443
|
}
|
|
@@ -454,10 +454,10 @@ class v {
|
|
|
454
454
|
return this.nullable().optional();
|
|
455
455
|
}
|
|
456
456
|
array() {
|
|
457
|
-
return
|
|
457
|
+
return E.create(this, this._def);
|
|
458
458
|
}
|
|
459
459
|
promise() {
|
|
460
|
-
return
|
|
460
|
+
return G.create(this, this._def);
|
|
461
461
|
}
|
|
462
462
|
or(e) {
|
|
463
463
|
return ee.create([this, e], this._def);
|
|
@@ -469,7 +469,7 @@ class v {
|
|
|
469
469
|
return new R({
|
|
470
470
|
...y(this._def),
|
|
471
471
|
schema: this,
|
|
472
|
-
typeName:
|
|
472
|
+
typeName: m.ZodEffects,
|
|
473
473
|
effect: { type: "transform", transform: e }
|
|
474
474
|
});
|
|
475
475
|
}
|
|
@@ -479,12 +479,12 @@ class v {
|
|
|
479
479
|
...y(this._def),
|
|
480
480
|
innerType: this,
|
|
481
481
|
defaultValue: t,
|
|
482
|
-
typeName:
|
|
482
|
+
typeName: m.ZodDefault
|
|
483
483
|
});
|
|
484
484
|
}
|
|
485
485
|
brand() {
|
|
486
|
-
return new
|
|
487
|
-
typeName:
|
|
486
|
+
return new Ee({
|
|
487
|
+
typeName: m.ZodBranded,
|
|
488
488
|
type: this,
|
|
489
489
|
...y(this._def)
|
|
490
490
|
});
|
|
@@ -495,7 +495,7 @@ class v {
|
|
|
495
495
|
...y(this._def),
|
|
496
496
|
innerType: this,
|
|
497
497
|
catchValue: t,
|
|
498
|
-
typeName:
|
|
498
|
+
typeName: m.ZodCatch
|
|
499
499
|
});
|
|
500
500
|
}
|
|
501
501
|
describe(e) {
|
|
@@ -509,7 +509,7 @@ class v {
|
|
|
509
509
|
return oe.create(this, e);
|
|
510
510
|
}
|
|
511
511
|
readonly() {
|
|
512
|
-
return
|
|
512
|
+
return ve.create(this);
|
|
513
513
|
}
|
|
514
514
|
isOptional() {
|
|
515
515
|
return this.safeParse(void 0).success;
|
|
@@ -518,13 +518,13 @@ class v {
|
|
|
518
518
|
return this.safeParse(null).success;
|
|
519
519
|
}
|
|
520
520
|
}
|
|
521
|
-
const We = /^c[^\s-]{8,}$/i,
|
|
521
|
+
const We = /^c[^\s-]{8,}$/i, Ye = /^[a-z][a-z0-9]*$/, Je = /^[0-9A-HJKMNP-TV-Z]{26}$/, Ge = /^[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, He = /^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Xe = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
522
522
|
let xe;
|
|
523
523
|
const Qe = /^(((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}))$/, Ke = /^(([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})))$/, Fe = (r) => r.precision ? r.offset ? new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${r.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`) : new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${r.precision}}Z$`) : r.precision === 0 ? r.offset ? new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$") : new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$") : r.offset ? new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$") : new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");
|
|
524
524
|
function et(r, e) {
|
|
525
525
|
return !!((e === "v4" || !e) && Qe.test(r) || (e === "v6" || !e) && Ke.test(r));
|
|
526
526
|
}
|
|
527
|
-
class
|
|
527
|
+
class O extends _ {
|
|
528
528
|
_parse(e) {
|
|
529
529
|
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== u.string) {
|
|
530
530
|
const a = this._getOrReturnCtx(e);
|
|
@@ -536,129 +536,129 @@ class N extends v {
|
|
|
536
536
|
received: a.parsedType
|
|
537
537
|
}
|
|
538
538
|
//
|
|
539
|
-
),
|
|
539
|
+
), p;
|
|
540
540
|
}
|
|
541
|
-
const
|
|
542
|
-
let
|
|
541
|
+
const n = new Z();
|
|
542
|
+
let s;
|
|
543
543
|
for (const a of this._def.checks)
|
|
544
544
|
if (a.kind === "min")
|
|
545
|
-
e.data.length < a.value && (
|
|
545
|
+
e.data.length < a.value && (s = this._getOrReturnCtx(e, s), l(s, {
|
|
546
546
|
code: c.too_small,
|
|
547
547
|
minimum: a.value,
|
|
548
548
|
type: "string",
|
|
549
549
|
inclusive: !0,
|
|
550
550
|
exact: !1,
|
|
551
551
|
message: a.message
|
|
552
|
-
}),
|
|
552
|
+
}), n.dirty());
|
|
553
553
|
else if (a.kind === "max")
|
|
554
|
-
e.data.length > a.value && (
|
|
554
|
+
e.data.length > a.value && (s = this._getOrReturnCtx(e, s), l(s, {
|
|
555
555
|
code: c.too_big,
|
|
556
556
|
maximum: a.value,
|
|
557
557
|
type: "string",
|
|
558
558
|
inclusive: !0,
|
|
559
559
|
exact: !1,
|
|
560
560
|
message: a.message
|
|
561
|
-
}),
|
|
561
|
+
}), n.dirty());
|
|
562
562
|
else if (a.kind === "length") {
|
|
563
563
|
const i = e.data.length > a.value, o = e.data.length < a.value;
|
|
564
|
-
(i || o) && (
|
|
564
|
+
(i || o) && (s = this._getOrReturnCtx(e, s), i ? l(s, {
|
|
565
565
|
code: c.too_big,
|
|
566
566
|
maximum: a.value,
|
|
567
567
|
type: "string",
|
|
568
568
|
inclusive: !0,
|
|
569
569
|
exact: !0,
|
|
570
570
|
message: a.message
|
|
571
|
-
}) : o && l(
|
|
571
|
+
}) : o && l(s, {
|
|
572
572
|
code: c.too_small,
|
|
573
573
|
minimum: a.value,
|
|
574
574
|
type: "string",
|
|
575
575
|
inclusive: !0,
|
|
576
576
|
exact: !0,
|
|
577
577
|
message: a.message
|
|
578
|
-
}),
|
|
578
|
+
}), n.dirty());
|
|
579
579
|
} else if (a.kind === "email")
|
|
580
|
-
|
|
580
|
+
He.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
581
581
|
validation: "email",
|
|
582
582
|
code: c.invalid_string,
|
|
583
583
|
message: a.message
|
|
584
|
-
}),
|
|
584
|
+
}), n.dirty());
|
|
585
585
|
else if (a.kind === "emoji")
|
|
586
|
-
xe || (xe = new RegExp(Xe, "u")), xe.test(e.data) || (
|
|
586
|
+
xe || (xe = new RegExp(Xe, "u")), xe.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
587
587
|
validation: "emoji",
|
|
588
588
|
code: c.invalid_string,
|
|
589
589
|
message: a.message
|
|
590
|
-
}),
|
|
590
|
+
}), n.dirty());
|
|
591
591
|
else if (a.kind === "uuid")
|
|
592
|
-
|
|
592
|
+
Ge.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
593
593
|
validation: "uuid",
|
|
594
594
|
code: c.invalid_string,
|
|
595
595
|
message: a.message
|
|
596
|
-
}),
|
|
596
|
+
}), n.dirty());
|
|
597
597
|
else if (a.kind === "cuid")
|
|
598
|
-
We.test(e.data) || (
|
|
598
|
+
We.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
599
599
|
validation: "cuid",
|
|
600
600
|
code: c.invalid_string,
|
|
601
601
|
message: a.message
|
|
602
|
-
}),
|
|
602
|
+
}), n.dirty());
|
|
603
603
|
else if (a.kind === "cuid2")
|
|
604
|
-
|
|
604
|
+
Ye.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
605
605
|
validation: "cuid2",
|
|
606
606
|
code: c.invalid_string,
|
|
607
607
|
message: a.message
|
|
608
|
-
}),
|
|
608
|
+
}), n.dirty());
|
|
609
609
|
else if (a.kind === "ulid")
|
|
610
|
-
|
|
610
|
+
Je.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
611
611
|
validation: "ulid",
|
|
612
612
|
code: c.invalid_string,
|
|
613
613
|
message: a.message
|
|
614
|
-
}),
|
|
614
|
+
}), n.dirty());
|
|
615
615
|
else if (a.kind === "url")
|
|
616
616
|
try {
|
|
617
617
|
new URL(e.data);
|
|
618
618
|
} catch {
|
|
619
|
-
|
|
619
|
+
s = this._getOrReturnCtx(e, s), l(s, {
|
|
620
620
|
validation: "url",
|
|
621
621
|
code: c.invalid_string,
|
|
622
622
|
message: a.message
|
|
623
|
-
}),
|
|
623
|
+
}), n.dirty();
|
|
624
624
|
}
|
|
625
625
|
else
|
|
626
|
-
a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (
|
|
626
|
+
a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
627
627
|
validation: "regex",
|
|
628
628
|
code: c.invalid_string,
|
|
629
629
|
message: a.message
|
|
630
|
-
}),
|
|
630
|
+
}), n.dirty())) : a.kind === "trim" ? e.data = e.data.trim() : a.kind === "includes" ? e.data.includes(a.value, a.position) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
631
631
|
code: c.invalid_string,
|
|
632
632
|
validation: { includes: a.value, position: a.position },
|
|
633
633
|
message: a.message
|
|
634
|
-
}),
|
|
634
|
+
}), n.dirty()) : a.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : a.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : a.kind === "startsWith" ? e.data.startsWith(a.value) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
635
635
|
code: c.invalid_string,
|
|
636
636
|
validation: { startsWith: a.value },
|
|
637
637
|
message: a.message
|
|
638
|
-
}),
|
|
638
|
+
}), n.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
639
639
|
code: c.invalid_string,
|
|
640
640
|
validation: { endsWith: a.value },
|
|
641
641
|
message: a.message
|
|
642
|
-
}),
|
|
642
|
+
}), n.dirty()) : a.kind === "datetime" ? Fe(a).test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
643
643
|
code: c.invalid_string,
|
|
644
644
|
validation: "datetime",
|
|
645
645
|
message: a.message
|
|
646
|
-
}),
|
|
646
|
+
}), n.dirty()) : a.kind === "ip" ? et(e.data, a.version) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
647
647
|
validation: "ip",
|
|
648
648
|
code: c.invalid_string,
|
|
649
649
|
message: a.message
|
|
650
|
-
}),
|
|
651
|
-
return { status:
|
|
650
|
+
}), n.dirty()) : x.assertNever(a);
|
|
651
|
+
return { status: n.value, value: e.data };
|
|
652
652
|
}
|
|
653
|
-
_regex(e, t,
|
|
654
|
-
return this.refinement((
|
|
653
|
+
_regex(e, t, n) {
|
|
654
|
+
return this.refinement((s) => e.test(s), {
|
|
655
655
|
validation: t,
|
|
656
656
|
code: c.invalid_string,
|
|
657
|
-
...h.errToObj(
|
|
657
|
+
...h.errToObj(n)
|
|
658
658
|
});
|
|
659
659
|
}
|
|
660
660
|
_addCheck(e) {
|
|
661
|
-
return new
|
|
661
|
+
return new O({
|
|
662
662
|
...this._def,
|
|
663
663
|
checks: [...this._def.checks, e]
|
|
664
664
|
});
|
|
@@ -759,19 +759,19 @@ class N extends v {
|
|
|
759
759
|
return this.min(1, h.errToObj(e));
|
|
760
760
|
}
|
|
761
761
|
trim() {
|
|
762
|
-
return new
|
|
762
|
+
return new O({
|
|
763
763
|
...this._def,
|
|
764
764
|
checks: [...this._def.checks, { kind: "trim" }]
|
|
765
765
|
});
|
|
766
766
|
}
|
|
767
767
|
toLowerCase() {
|
|
768
|
-
return new
|
|
768
|
+
return new O({
|
|
769
769
|
...this._def,
|
|
770
770
|
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
771
771
|
});
|
|
772
772
|
}
|
|
773
773
|
toUpperCase() {
|
|
774
|
-
return new
|
|
774
|
+
return new O({
|
|
775
775
|
...this._def,
|
|
776
776
|
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
777
777
|
});
|
|
@@ -816,20 +816,20 @@ class N extends v {
|
|
|
816
816
|
return e;
|
|
817
817
|
}
|
|
818
818
|
}
|
|
819
|
-
|
|
819
|
+
O.create = (r) => {
|
|
820
820
|
var e;
|
|
821
|
-
return new
|
|
821
|
+
return new O({
|
|
822
822
|
checks: [],
|
|
823
|
-
typeName:
|
|
823
|
+
typeName: m.ZodString,
|
|
824
824
|
coerce: (e = r == null ? void 0 : r.coerce) !== null && e !== void 0 ? e : !1,
|
|
825
825
|
...y(r)
|
|
826
826
|
});
|
|
827
827
|
};
|
|
828
828
|
function tt(r, e) {
|
|
829
|
-
const t = (r.toString().split(".")[1] || "").length,
|
|
830
|
-
return a % i / Math.pow(10,
|
|
829
|
+
const t = (r.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, s = t > n ? t : n, a = parseInt(r.toFixed(s).replace(".", "")), i = parseInt(e.toFixed(s).replace(".", ""));
|
|
830
|
+
return a % i / Math.pow(10, s);
|
|
831
831
|
}
|
|
832
|
-
class V extends
|
|
832
|
+
class V extends _ {
|
|
833
833
|
constructor() {
|
|
834
834
|
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
835
835
|
}
|
|
@@ -840,39 +840,39 @@ class V extends v {
|
|
|
840
840
|
code: c.invalid_type,
|
|
841
841
|
expected: u.number,
|
|
842
842
|
received: a.parsedType
|
|
843
|
-
}),
|
|
843
|
+
}), p;
|
|
844
844
|
}
|
|
845
|
-
let
|
|
846
|
-
const
|
|
845
|
+
let n;
|
|
846
|
+
const s = new Z();
|
|
847
847
|
for (const a of this._def.checks)
|
|
848
|
-
a.kind === "int" ?
|
|
848
|
+
a.kind === "int" ? x.isInteger(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
849
849
|
code: c.invalid_type,
|
|
850
850
|
expected: "integer",
|
|
851
851
|
received: "float",
|
|
852
852
|
message: a.message
|
|
853
|
-
}),
|
|
853
|
+
}), s.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
854
854
|
code: c.too_small,
|
|
855
855
|
minimum: a.value,
|
|
856
856
|
type: "number",
|
|
857
857
|
inclusive: a.inclusive,
|
|
858
858
|
exact: !1,
|
|
859
859
|
message: a.message
|
|
860
|
-
}),
|
|
860
|
+
}), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
861
861
|
code: c.too_big,
|
|
862
862
|
maximum: a.value,
|
|
863
863
|
type: "number",
|
|
864
864
|
inclusive: a.inclusive,
|
|
865
865
|
exact: !1,
|
|
866
866
|
message: a.message
|
|
867
|
-
}),
|
|
867
|
+
}), s.dirty()) : a.kind === "multipleOf" ? tt(e.data, a.value) !== 0 && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
868
868
|
code: c.not_multiple_of,
|
|
869
869
|
multipleOf: a.value,
|
|
870
870
|
message: a.message
|
|
871
|
-
}),
|
|
871
|
+
}), s.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
872
872
|
code: c.not_finite,
|
|
873
873
|
message: a.message
|
|
874
|
-
}),
|
|
875
|
-
return { status:
|
|
874
|
+
}), s.dirty()) : x.assertNever(a);
|
|
875
|
+
return { status: s.value, value: e.data };
|
|
876
876
|
}
|
|
877
877
|
gte(e, t) {
|
|
878
878
|
return this.setLimit("min", e, !0, h.toString(t));
|
|
@@ -886,7 +886,7 @@ class V extends v {
|
|
|
886
886
|
lt(e, t) {
|
|
887
887
|
return this.setLimit("max", e, !1, h.toString(t));
|
|
888
888
|
}
|
|
889
|
-
setLimit(e, t,
|
|
889
|
+
setLimit(e, t, n, s) {
|
|
890
890
|
return new V({
|
|
891
891
|
...this._def,
|
|
892
892
|
checks: [
|
|
@@ -894,8 +894,8 @@ class V extends v {
|
|
|
894
894
|
{
|
|
895
895
|
kind: e,
|
|
896
896
|
value: t,
|
|
897
|
-
inclusive:
|
|
898
|
-
message: h.toString(
|
|
897
|
+
inclusive: n,
|
|
898
|
+
message: h.toString(s)
|
|
899
899
|
}
|
|
900
900
|
]
|
|
901
901
|
});
|
|
@@ -983,25 +983,25 @@ class V extends v {
|
|
|
983
983
|
return e;
|
|
984
984
|
}
|
|
985
985
|
get isInt() {
|
|
986
|
-
return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" &&
|
|
986
|
+
return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && x.isInteger(e.value));
|
|
987
987
|
}
|
|
988
988
|
get isFinite() {
|
|
989
989
|
let e = null, t = null;
|
|
990
|
-
for (const
|
|
991
|
-
if (
|
|
990
|
+
for (const n of this._def.checks) {
|
|
991
|
+
if (n.kind === "finite" || n.kind === "int" || n.kind === "multipleOf")
|
|
992
992
|
return !0;
|
|
993
|
-
|
|
993
|
+
n.kind === "min" ? (t === null || n.value > t) && (t = n.value) : n.kind === "max" && (e === null || n.value < e) && (e = n.value);
|
|
994
994
|
}
|
|
995
995
|
return Number.isFinite(t) && Number.isFinite(e);
|
|
996
996
|
}
|
|
997
997
|
}
|
|
998
998
|
V.create = (r) => new V({
|
|
999
999
|
checks: [],
|
|
1000
|
-
typeName:
|
|
1000
|
+
typeName: m.ZodNumber,
|
|
1001
1001
|
coerce: (r == null ? void 0 : r.coerce) || !1,
|
|
1002
1002
|
...y(r)
|
|
1003
1003
|
});
|
|
1004
|
-
class $ extends
|
|
1004
|
+
class $ extends _ {
|
|
1005
1005
|
constructor() {
|
|
1006
1006
|
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
1007
1007
|
}
|
|
@@ -1012,29 +1012,29 @@ class $ extends v {
|
|
|
1012
1012
|
code: c.invalid_type,
|
|
1013
1013
|
expected: u.bigint,
|
|
1014
1014
|
received: a.parsedType
|
|
1015
|
-
}),
|
|
1015
|
+
}), p;
|
|
1016
1016
|
}
|
|
1017
|
-
let
|
|
1018
|
-
const
|
|
1017
|
+
let n;
|
|
1018
|
+
const s = new Z();
|
|
1019
1019
|
for (const a of this._def.checks)
|
|
1020
|
-
a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (
|
|
1020
|
+
a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
1021
1021
|
code: c.too_small,
|
|
1022
1022
|
type: "bigint",
|
|
1023
1023
|
minimum: a.value,
|
|
1024
1024
|
inclusive: a.inclusive,
|
|
1025
1025
|
message: a.message
|
|
1026
|
-
}),
|
|
1026
|
+
}), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
1027
1027
|
code: c.too_big,
|
|
1028
1028
|
type: "bigint",
|
|
1029
1029
|
maximum: a.value,
|
|
1030
1030
|
inclusive: a.inclusive,
|
|
1031
1031
|
message: a.message
|
|
1032
|
-
}),
|
|
1032
|
+
}), s.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
1033
1033
|
code: c.not_multiple_of,
|
|
1034
1034
|
multipleOf: a.value,
|
|
1035
1035
|
message: a.message
|
|
1036
|
-
}),
|
|
1037
|
-
return { status:
|
|
1036
|
+
}), s.dirty()) : x.assertNever(a);
|
|
1037
|
+
return { status: s.value, value: e.data };
|
|
1038
1038
|
}
|
|
1039
1039
|
gte(e, t) {
|
|
1040
1040
|
return this.setLimit("min", e, !0, h.toString(t));
|
|
@@ -1048,7 +1048,7 @@ class $ extends v {
|
|
|
1048
1048
|
lt(e, t) {
|
|
1049
1049
|
return this.setLimit("max", e, !1, h.toString(t));
|
|
1050
1050
|
}
|
|
1051
|
-
setLimit(e, t,
|
|
1051
|
+
setLimit(e, t, n, s) {
|
|
1052
1052
|
return new $({
|
|
1053
1053
|
...this._def,
|
|
1054
1054
|
checks: [
|
|
@@ -1056,8 +1056,8 @@ class $ extends v {
|
|
|
1056
1056
|
{
|
|
1057
1057
|
kind: e,
|
|
1058
1058
|
value: t,
|
|
1059
|
-
inclusive:
|
|
1060
|
-
message: h.toString(
|
|
1059
|
+
inclusive: n,
|
|
1060
|
+
message: h.toString(s)
|
|
1061
1061
|
}
|
|
1062
1062
|
]
|
|
1063
1063
|
});
|
|
@@ -1124,30 +1124,30 @@ $.create = (r) => {
|
|
|
1124
1124
|
var e;
|
|
1125
1125
|
return new $({
|
|
1126
1126
|
checks: [],
|
|
1127
|
-
typeName:
|
|
1127
|
+
typeName: m.ZodBigInt,
|
|
1128
1128
|
coerce: (e = r == null ? void 0 : r.coerce) !== null && e !== void 0 ? e : !1,
|
|
1129
1129
|
...y(r)
|
|
1130
1130
|
});
|
|
1131
1131
|
};
|
|
1132
|
-
class Q extends
|
|
1132
|
+
class Q extends _ {
|
|
1133
1133
|
_parse(e) {
|
|
1134
1134
|
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== u.boolean) {
|
|
1135
|
-
const
|
|
1136
|
-
return l(
|
|
1135
|
+
const n = this._getOrReturnCtx(e);
|
|
1136
|
+
return l(n, {
|
|
1137
1137
|
code: c.invalid_type,
|
|
1138
1138
|
expected: u.boolean,
|
|
1139
|
-
received:
|
|
1140
|
-
}),
|
|
1139
|
+
received: n.parsedType
|
|
1140
|
+
}), p;
|
|
1141
1141
|
}
|
|
1142
1142
|
return S(e.data);
|
|
1143
1143
|
}
|
|
1144
1144
|
}
|
|
1145
1145
|
Q.create = (r) => new Q({
|
|
1146
|
-
typeName:
|
|
1146
|
+
typeName: m.ZodBoolean,
|
|
1147
1147
|
coerce: (r == null ? void 0 : r.coerce) || !1,
|
|
1148
1148
|
...y(r)
|
|
1149
1149
|
});
|
|
1150
|
-
class U extends
|
|
1150
|
+
class U extends _ {
|
|
1151
1151
|
_parse(e) {
|
|
1152
1152
|
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== u.date) {
|
|
1153
1153
|
const a = this._getOrReturnCtx(e);
|
|
@@ -1155,34 +1155,34 @@ class U extends v {
|
|
|
1155
1155
|
code: c.invalid_type,
|
|
1156
1156
|
expected: u.date,
|
|
1157
1157
|
received: a.parsedType
|
|
1158
|
-
}),
|
|
1158
|
+
}), p;
|
|
1159
1159
|
}
|
|
1160
1160
|
if (isNaN(e.data.getTime())) {
|
|
1161
1161
|
const a = this._getOrReturnCtx(e);
|
|
1162
1162
|
return l(a, {
|
|
1163
1163
|
code: c.invalid_date
|
|
1164
|
-
}),
|
|
1164
|
+
}), p;
|
|
1165
1165
|
}
|
|
1166
|
-
const
|
|
1167
|
-
let
|
|
1166
|
+
const n = new Z();
|
|
1167
|
+
let s;
|
|
1168
1168
|
for (const a of this._def.checks)
|
|
1169
|
-
a.kind === "min" ? e.data.getTime() < a.value && (
|
|
1169
|
+
a.kind === "min" ? e.data.getTime() < a.value && (s = this._getOrReturnCtx(e, s), l(s, {
|
|
1170
1170
|
code: c.too_small,
|
|
1171
1171
|
message: a.message,
|
|
1172
1172
|
inclusive: !0,
|
|
1173
1173
|
exact: !1,
|
|
1174
1174
|
minimum: a.value,
|
|
1175
1175
|
type: "date"
|
|
1176
|
-
}),
|
|
1176
|
+
}), n.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (s = this._getOrReturnCtx(e, s), l(s, {
|
|
1177
1177
|
code: c.too_big,
|
|
1178
1178
|
message: a.message,
|
|
1179
1179
|
inclusive: !0,
|
|
1180
1180
|
exact: !1,
|
|
1181
1181
|
maximum: a.value,
|
|
1182
1182
|
type: "date"
|
|
1183
|
-
}),
|
|
1183
|
+
}), n.dirty()) : x.assertNever(a);
|
|
1184
1184
|
return {
|
|
1185
|
-
status:
|
|
1185
|
+
status: n.value,
|
|
1186
1186
|
value: new Date(e.data.getTime())
|
|
1187
1187
|
};
|
|
1188
1188
|
}
|
|
@@ -1222,61 +1222,61 @@ class U extends v {
|
|
|
1222
1222
|
U.create = (r) => new U({
|
|
1223
1223
|
checks: [],
|
|
1224
1224
|
coerce: (r == null ? void 0 : r.coerce) || !1,
|
|
1225
|
-
typeName:
|
|
1225
|
+
typeName: m.ZodDate,
|
|
1226
1226
|
...y(r)
|
|
1227
1227
|
});
|
|
1228
|
-
class he extends
|
|
1228
|
+
class he extends _ {
|
|
1229
1229
|
_parse(e) {
|
|
1230
1230
|
if (this._getType(e) !== u.symbol) {
|
|
1231
|
-
const
|
|
1232
|
-
return l(
|
|
1231
|
+
const n = this._getOrReturnCtx(e);
|
|
1232
|
+
return l(n, {
|
|
1233
1233
|
code: c.invalid_type,
|
|
1234
1234
|
expected: u.symbol,
|
|
1235
|
-
received:
|
|
1236
|
-
}),
|
|
1235
|
+
received: n.parsedType
|
|
1236
|
+
}), p;
|
|
1237
1237
|
}
|
|
1238
1238
|
return S(e.data);
|
|
1239
1239
|
}
|
|
1240
1240
|
}
|
|
1241
1241
|
he.create = (r) => new he({
|
|
1242
|
-
typeName:
|
|
1242
|
+
typeName: m.ZodSymbol,
|
|
1243
1243
|
...y(r)
|
|
1244
1244
|
});
|
|
1245
|
-
class K extends
|
|
1245
|
+
class K extends _ {
|
|
1246
1246
|
_parse(e) {
|
|
1247
1247
|
if (this._getType(e) !== u.undefined) {
|
|
1248
|
-
const
|
|
1249
|
-
return l(
|
|
1248
|
+
const n = this._getOrReturnCtx(e);
|
|
1249
|
+
return l(n, {
|
|
1250
1250
|
code: c.invalid_type,
|
|
1251
1251
|
expected: u.undefined,
|
|
1252
|
-
received:
|
|
1253
|
-
}),
|
|
1252
|
+
received: n.parsedType
|
|
1253
|
+
}), p;
|
|
1254
1254
|
}
|
|
1255
1255
|
return S(e.data);
|
|
1256
1256
|
}
|
|
1257
1257
|
}
|
|
1258
1258
|
K.create = (r) => new K({
|
|
1259
|
-
typeName:
|
|
1259
|
+
typeName: m.ZodUndefined,
|
|
1260
1260
|
...y(r)
|
|
1261
1261
|
});
|
|
1262
|
-
class F extends
|
|
1262
|
+
class F extends _ {
|
|
1263
1263
|
_parse(e) {
|
|
1264
1264
|
if (this._getType(e) !== u.null) {
|
|
1265
|
-
const
|
|
1266
|
-
return l(
|
|
1265
|
+
const n = this._getOrReturnCtx(e);
|
|
1266
|
+
return l(n, {
|
|
1267
1267
|
code: c.invalid_type,
|
|
1268
1268
|
expected: u.null,
|
|
1269
|
-
received:
|
|
1270
|
-
}),
|
|
1269
|
+
received: n.parsedType
|
|
1270
|
+
}), p;
|
|
1271
1271
|
}
|
|
1272
1272
|
return S(e.data);
|
|
1273
1273
|
}
|
|
1274
1274
|
}
|
|
1275
1275
|
F.create = (r) => new F({
|
|
1276
|
-
typeName:
|
|
1276
|
+
typeName: m.ZodNull,
|
|
1277
1277
|
...y(r)
|
|
1278
1278
|
});
|
|
1279
|
-
class
|
|
1279
|
+
class J extends _ {
|
|
1280
1280
|
constructor() {
|
|
1281
1281
|
super(...arguments), this._any = !0;
|
|
1282
1282
|
}
|
|
@@ -1284,11 +1284,11 @@ class Y extends v {
|
|
|
1284
1284
|
return S(e.data);
|
|
1285
1285
|
}
|
|
1286
1286
|
}
|
|
1287
|
-
|
|
1288
|
-
typeName:
|
|
1287
|
+
J.create = (r) => new J({
|
|
1288
|
+
typeName: m.ZodAny,
|
|
1289
1289
|
...y(r)
|
|
1290
1290
|
});
|
|
1291
|
-
class D extends
|
|
1291
|
+
class D extends _ {
|
|
1292
1292
|
constructor() {
|
|
1293
1293
|
super(...arguments), this._unknown = !0;
|
|
1294
1294
|
}
|
|
@@ -1297,97 +1297,97 @@ class D extends v {
|
|
|
1297
1297
|
}
|
|
1298
1298
|
}
|
|
1299
1299
|
D.create = (r) => new D({
|
|
1300
|
-
typeName:
|
|
1300
|
+
typeName: m.ZodUnknown,
|
|
1301
1301
|
...y(r)
|
|
1302
1302
|
});
|
|
1303
|
-
class z extends
|
|
1303
|
+
class z extends _ {
|
|
1304
1304
|
_parse(e) {
|
|
1305
1305
|
const t = this._getOrReturnCtx(e);
|
|
1306
1306
|
return l(t, {
|
|
1307
1307
|
code: c.invalid_type,
|
|
1308
1308
|
expected: u.never,
|
|
1309
1309
|
received: t.parsedType
|
|
1310
|
-
}),
|
|
1310
|
+
}), p;
|
|
1311
1311
|
}
|
|
1312
1312
|
}
|
|
1313
1313
|
z.create = (r) => new z({
|
|
1314
|
-
typeName:
|
|
1314
|
+
typeName: m.ZodNever,
|
|
1315
1315
|
...y(r)
|
|
1316
1316
|
});
|
|
1317
|
-
class
|
|
1317
|
+
class me extends _ {
|
|
1318
1318
|
_parse(e) {
|
|
1319
1319
|
if (this._getType(e) !== u.undefined) {
|
|
1320
|
-
const
|
|
1321
|
-
return l(
|
|
1320
|
+
const n = this._getOrReturnCtx(e);
|
|
1321
|
+
return l(n, {
|
|
1322
1322
|
code: c.invalid_type,
|
|
1323
1323
|
expected: u.void,
|
|
1324
|
-
received:
|
|
1325
|
-
}),
|
|
1324
|
+
received: n.parsedType
|
|
1325
|
+
}), p;
|
|
1326
1326
|
}
|
|
1327
1327
|
return S(e.data);
|
|
1328
1328
|
}
|
|
1329
1329
|
}
|
|
1330
|
-
|
|
1331
|
-
typeName:
|
|
1330
|
+
me.create = (r) => new me({
|
|
1331
|
+
typeName: m.ZodVoid,
|
|
1332
1332
|
...y(r)
|
|
1333
1333
|
});
|
|
1334
|
-
class
|
|
1334
|
+
class E extends _ {
|
|
1335
1335
|
_parse(e) {
|
|
1336
|
-
const { ctx: t, status:
|
|
1336
|
+
const { ctx: t, status: n } = this._processInputParams(e), s = this._def;
|
|
1337
1337
|
if (t.parsedType !== u.array)
|
|
1338
1338
|
return l(t, {
|
|
1339
1339
|
code: c.invalid_type,
|
|
1340
1340
|
expected: u.array,
|
|
1341
1341
|
received: t.parsedType
|
|
1342
|
-
}),
|
|
1343
|
-
if (
|
|
1344
|
-
const i = t.data.length >
|
|
1342
|
+
}), p;
|
|
1343
|
+
if (s.exactLength !== null) {
|
|
1344
|
+
const i = t.data.length > s.exactLength.value, o = t.data.length < s.exactLength.value;
|
|
1345
1345
|
(i || o) && (l(t, {
|
|
1346
1346
|
code: i ? c.too_big : c.too_small,
|
|
1347
|
-
minimum: o ?
|
|
1348
|
-
maximum: i ?
|
|
1347
|
+
minimum: o ? s.exactLength.value : void 0,
|
|
1348
|
+
maximum: i ? s.exactLength.value : void 0,
|
|
1349
1349
|
type: "array",
|
|
1350
1350
|
inclusive: !0,
|
|
1351
1351
|
exact: !0,
|
|
1352
|
-
message:
|
|
1353
|
-
}),
|
|
1352
|
+
message: s.exactLength.message
|
|
1353
|
+
}), n.dirty());
|
|
1354
1354
|
}
|
|
1355
|
-
if (
|
|
1355
|
+
if (s.minLength !== null && t.data.length < s.minLength.value && (l(t, {
|
|
1356
1356
|
code: c.too_small,
|
|
1357
|
-
minimum:
|
|
1357
|
+
minimum: s.minLength.value,
|
|
1358
1358
|
type: "array",
|
|
1359
1359
|
inclusive: !0,
|
|
1360
1360
|
exact: !1,
|
|
1361
|
-
message:
|
|
1362
|
-
}),
|
|
1361
|
+
message: s.minLength.message
|
|
1362
|
+
}), n.dirty()), s.maxLength !== null && t.data.length > s.maxLength.value && (l(t, {
|
|
1363
1363
|
code: c.too_big,
|
|
1364
|
-
maximum:
|
|
1364
|
+
maximum: s.maxLength.value,
|
|
1365
1365
|
type: "array",
|
|
1366
1366
|
inclusive: !0,
|
|
1367
1367
|
exact: !1,
|
|
1368
|
-
message:
|
|
1369
|
-
}),
|
|
1370
|
-
return Promise.all([...t.data].map((i, o) =>
|
|
1371
|
-
const a = [...t.data].map((i, o) =>
|
|
1372
|
-
return Z.mergeArray(
|
|
1368
|
+
message: s.maxLength.message
|
|
1369
|
+
}), n.dirty()), t.common.async)
|
|
1370
|
+
return Promise.all([...t.data].map((i, o) => s.type._parseAsync(new j(t, i, t.path, o)))).then((i) => Z.mergeArray(n, i));
|
|
1371
|
+
const a = [...t.data].map((i, o) => s.type._parseSync(new j(t, i, t.path, o)));
|
|
1372
|
+
return Z.mergeArray(n, a);
|
|
1373
1373
|
}
|
|
1374
1374
|
get element() {
|
|
1375
1375
|
return this._def.type;
|
|
1376
1376
|
}
|
|
1377
1377
|
min(e, t) {
|
|
1378
|
-
return new
|
|
1378
|
+
return new E({
|
|
1379
1379
|
...this._def,
|
|
1380
1380
|
minLength: { value: e, message: h.toString(t) }
|
|
1381
1381
|
});
|
|
1382
1382
|
}
|
|
1383
1383
|
max(e, t) {
|
|
1384
|
-
return new
|
|
1384
|
+
return new E({
|
|
1385
1385
|
...this._def,
|
|
1386
1386
|
maxLength: { value: e, message: h.toString(t) }
|
|
1387
1387
|
});
|
|
1388
1388
|
}
|
|
1389
1389
|
length(e, t) {
|
|
1390
|
-
return new
|
|
1390
|
+
return new E({
|
|
1391
1391
|
...this._def,
|
|
1392
1392
|
exactLength: { value: e, message: h.toString(t) }
|
|
1393
1393
|
});
|
|
@@ -1396,39 +1396,39 @@ class I extends v {
|
|
|
1396
1396
|
return this.min(1, e);
|
|
1397
1397
|
}
|
|
1398
1398
|
}
|
|
1399
|
-
|
|
1399
|
+
E.create = (r, e) => new E({
|
|
1400
1400
|
type: r,
|
|
1401
1401
|
minLength: null,
|
|
1402
1402
|
maxLength: null,
|
|
1403
1403
|
exactLength: null,
|
|
1404
|
-
typeName:
|
|
1404
|
+
typeName: m.ZodArray,
|
|
1405
1405
|
...y(e)
|
|
1406
1406
|
});
|
|
1407
1407
|
function W(r) {
|
|
1408
1408
|
if (r instanceof b) {
|
|
1409
1409
|
const e = {};
|
|
1410
1410
|
for (const t in r.shape) {
|
|
1411
|
-
const
|
|
1412
|
-
e[t] = M.create(W(
|
|
1411
|
+
const n = r.shape[t];
|
|
1412
|
+
e[t] = M.create(W(n));
|
|
1413
1413
|
}
|
|
1414
1414
|
return new b({
|
|
1415
1415
|
...r._def,
|
|
1416
1416
|
shape: () => e
|
|
1417
1417
|
});
|
|
1418
1418
|
} else
|
|
1419
|
-
return r instanceof
|
|
1419
|
+
return r instanceof E ? new E({
|
|
1420
1420
|
...r._def,
|
|
1421
1421
|
type: W(r.element)
|
|
1422
1422
|
}) : r instanceof M ? M.create(W(r.unwrap())) : r instanceof q ? q.create(W(r.unwrap())) : r instanceof A ? A.create(r.items.map((e) => W(e))) : r;
|
|
1423
1423
|
}
|
|
1424
|
-
class b extends
|
|
1424
|
+
class b extends _ {
|
|
1425
1425
|
constructor() {
|
|
1426
1426
|
super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
|
|
1427
1427
|
}
|
|
1428
1428
|
_getCached() {
|
|
1429
1429
|
if (this._cached !== null)
|
|
1430
1430
|
return this._cached;
|
|
1431
|
-
const e = this._def.shape(), t =
|
|
1431
|
+
const e = this._def.shape(), t = x.objectKeys(e);
|
|
1432
1432
|
return this._cached = { shape: e, keys: t };
|
|
1433
1433
|
}
|
|
1434
1434
|
_parse(e) {
|
|
@@ -1438,62 +1438,62 @@ class b extends v {
|
|
|
1438
1438
|
code: c.invalid_type,
|
|
1439
1439
|
expected: u.object,
|
|
1440
1440
|
received: d.parsedType
|
|
1441
|
-
}),
|
|
1441
|
+
}), p;
|
|
1442
1442
|
}
|
|
1443
|
-
const { status:
|
|
1443
|
+
const { status: n, ctx: s } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), o = [];
|
|
1444
1444
|
if (!(this._def.catchall instanceof z && this._def.unknownKeys === "strip"))
|
|
1445
|
-
for (const d in
|
|
1445
|
+
for (const d in s.data)
|
|
1446
1446
|
i.includes(d) || o.push(d);
|
|
1447
1447
|
const f = [];
|
|
1448
1448
|
for (const d of i) {
|
|
1449
|
-
const
|
|
1449
|
+
const v = a[d], C = s.data[d];
|
|
1450
1450
|
f.push({
|
|
1451
1451
|
key: { status: "valid", value: d },
|
|
1452
|
-
value:
|
|
1453
|
-
alwaysSet: d in
|
|
1452
|
+
value: v._parse(new j(s, C, s.path, d)),
|
|
1453
|
+
alwaysSet: d in s.data
|
|
1454
1454
|
});
|
|
1455
1455
|
}
|
|
1456
1456
|
if (this._def.catchall instanceof z) {
|
|
1457
1457
|
const d = this._def.unknownKeys;
|
|
1458
1458
|
if (d === "passthrough")
|
|
1459
|
-
for (const
|
|
1459
|
+
for (const v of o)
|
|
1460
1460
|
f.push({
|
|
1461
|
-
key: { status: "valid", value:
|
|
1462
|
-
value: { status: "valid", value:
|
|
1461
|
+
key: { status: "valid", value: v },
|
|
1462
|
+
value: { status: "valid", value: s.data[v] }
|
|
1463
1463
|
});
|
|
1464
1464
|
else if (d === "strict")
|
|
1465
|
-
o.length > 0 && (l(
|
|
1465
|
+
o.length > 0 && (l(s, {
|
|
1466
1466
|
code: c.unrecognized_keys,
|
|
1467
1467
|
keys: o
|
|
1468
|
-
}),
|
|
1468
|
+
}), n.dirty());
|
|
1469
1469
|
else if (d !== "strip")
|
|
1470
1470
|
throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
1471
1471
|
} else {
|
|
1472
1472
|
const d = this._def.catchall;
|
|
1473
|
-
for (const
|
|
1474
|
-
const
|
|
1473
|
+
for (const v of o) {
|
|
1474
|
+
const C = s.data[v];
|
|
1475
1475
|
f.push({
|
|
1476
|
-
key: { status: "valid", value:
|
|
1476
|
+
key: { status: "valid", value: v },
|
|
1477
1477
|
value: d._parse(
|
|
1478
|
-
new j(
|
|
1478
|
+
new j(s, C, s.path, v)
|
|
1479
1479
|
//, ctx.child(key), value, getParsedType(value)
|
|
1480
1480
|
),
|
|
1481
|
-
alwaysSet:
|
|
1481
|
+
alwaysSet: v in s.data
|
|
1482
1482
|
});
|
|
1483
1483
|
}
|
|
1484
1484
|
}
|
|
1485
|
-
return
|
|
1485
|
+
return s.common.async ? Promise.resolve().then(async () => {
|
|
1486
1486
|
const d = [];
|
|
1487
|
-
for (const
|
|
1488
|
-
const
|
|
1487
|
+
for (const v of f) {
|
|
1488
|
+
const C = await v.key;
|
|
1489
1489
|
d.push({
|
|
1490
|
-
key:
|
|
1491
|
-
value: await
|
|
1492
|
-
alwaysSet:
|
|
1490
|
+
key: C,
|
|
1491
|
+
value: await v.value,
|
|
1492
|
+
alwaysSet: v.alwaysSet
|
|
1493
1493
|
});
|
|
1494
1494
|
}
|
|
1495
1495
|
return d;
|
|
1496
|
-
}).then((d) => Z.mergeObjectSync(
|
|
1496
|
+
}).then((d) => Z.mergeObjectSync(n, d)) : Z.mergeObjectSync(n, f);
|
|
1497
1497
|
}
|
|
1498
1498
|
get shape() {
|
|
1499
1499
|
return this._def.shape();
|
|
@@ -1503,9 +1503,9 @@ class b extends v {
|
|
|
1503
1503
|
...this._def,
|
|
1504
1504
|
unknownKeys: "strict",
|
|
1505
1505
|
...e !== void 0 ? {
|
|
1506
|
-
errorMap: (t,
|
|
1507
|
-
var
|
|
1508
|
-
const f = (i = (a = (
|
|
1506
|
+
errorMap: (t, n) => {
|
|
1507
|
+
var s, a, i, o;
|
|
1508
|
+
const f = (i = (a = (s = this._def).errorMap) === null || a === void 0 ? void 0 : a.call(s, t, n).message) !== null && i !== void 0 ? i : n.defaultError;
|
|
1509
1509
|
return t.code === "unrecognized_keys" ? {
|
|
1510
1510
|
message: (o = h.errToObj(e).message) !== null && o !== void 0 ? o : f
|
|
1511
1511
|
} : {
|
|
@@ -1566,7 +1566,7 @@ class b extends v {
|
|
|
1566
1566
|
...this._def.shape(),
|
|
1567
1567
|
...e._def.shape()
|
|
1568
1568
|
}),
|
|
1569
|
-
typeName:
|
|
1569
|
+
typeName: m.ZodObject
|
|
1570
1570
|
});
|
|
1571
1571
|
}
|
|
1572
1572
|
// merge<
|
|
@@ -1636,8 +1636,8 @@ class b extends v {
|
|
|
1636
1636
|
}
|
|
1637
1637
|
pick(e) {
|
|
1638
1638
|
const t = {};
|
|
1639
|
-
return
|
|
1640
|
-
e[
|
|
1639
|
+
return x.objectKeys(e).forEach((n) => {
|
|
1640
|
+
e[n] && this.shape[n] && (t[n] = this.shape[n]);
|
|
1641
1641
|
}), new b({
|
|
1642
1642
|
...this._def,
|
|
1643
1643
|
shape: () => t
|
|
@@ -1645,8 +1645,8 @@ class b extends v {
|
|
|
1645
1645
|
}
|
|
1646
1646
|
omit(e) {
|
|
1647
1647
|
const t = {};
|
|
1648
|
-
return
|
|
1649
|
-
e[
|
|
1648
|
+
return x.objectKeys(this.shape).forEach((n) => {
|
|
1649
|
+
e[n] || (t[n] = this.shape[n]);
|
|
1650
1650
|
}), new b({
|
|
1651
1651
|
...this._def,
|
|
1652
1652
|
shape: () => t
|
|
@@ -1660,9 +1660,9 @@ class b extends v {
|
|
|
1660
1660
|
}
|
|
1661
1661
|
partial(e) {
|
|
1662
1662
|
const t = {};
|
|
1663
|
-
return
|
|
1664
|
-
const
|
|
1665
|
-
e && !e[
|
|
1663
|
+
return x.objectKeys(this.shape).forEach((n) => {
|
|
1664
|
+
const s = this.shape[n];
|
|
1665
|
+
e && !e[n] ? t[n] = s : t[n] = s.optional();
|
|
1666
1666
|
}), new b({
|
|
1667
1667
|
...this._def,
|
|
1668
1668
|
shape: () => t
|
|
@@ -1670,14 +1670,14 @@ class b extends v {
|
|
|
1670
1670
|
}
|
|
1671
1671
|
required(e) {
|
|
1672
1672
|
const t = {};
|
|
1673
|
-
return
|
|
1674
|
-
if (e && !e[
|
|
1675
|
-
t[
|
|
1673
|
+
return x.objectKeys(this.shape).forEach((n) => {
|
|
1674
|
+
if (e && !e[n])
|
|
1675
|
+
t[n] = this.shape[n];
|
|
1676
1676
|
else {
|
|
1677
|
-
let a = this.shape[
|
|
1677
|
+
let a = this.shape[n];
|
|
1678
1678
|
for (; a instanceof M; )
|
|
1679
1679
|
a = a._def.innerType;
|
|
1680
|
-
t[
|
|
1680
|
+
t[n] = a;
|
|
1681
1681
|
}
|
|
1682
1682
|
}), new b({
|
|
1683
1683
|
...this._def,
|
|
@@ -1685,48 +1685,48 @@ class b extends v {
|
|
|
1685
1685
|
});
|
|
1686
1686
|
}
|
|
1687
1687
|
keyof() {
|
|
1688
|
-
return
|
|
1688
|
+
return Ie(x.objectKeys(this.shape));
|
|
1689
1689
|
}
|
|
1690
1690
|
}
|
|
1691
1691
|
b.create = (r, e) => new b({
|
|
1692
1692
|
shape: () => r,
|
|
1693
1693
|
unknownKeys: "strip",
|
|
1694
1694
|
catchall: z.create(),
|
|
1695
|
-
typeName:
|
|
1695
|
+
typeName: m.ZodObject,
|
|
1696
1696
|
...y(e)
|
|
1697
1697
|
});
|
|
1698
1698
|
b.strictCreate = (r, e) => new b({
|
|
1699
1699
|
shape: () => r,
|
|
1700
1700
|
unknownKeys: "strict",
|
|
1701
1701
|
catchall: z.create(),
|
|
1702
|
-
typeName:
|
|
1702
|
+
typeName: m.ZodObject,
|
|
1703
1703
|
...y(e)
|
|
1704
1704
|
});
|
|
1705
1705
|
b.lazycreate = (r, e) => new b({
|
|
1706
1706
|
shape: r,
|
|
1707
1707
|
unknownKeys: "strip",
|
|
1708
1708
|
catchall: z.create(),
|
|
1709
|
-
typeName:
|
|
1709
|
+
typeName: m.ZodObject,
|
|
1710
1710
|
...y(e)
|
|
1711
1711
|
});
|
|
1712
|
-
class ee extends
|
|
1712
|
+
class ee extends _ {
|
|
1713
1713
|
_parse(e) {
|
|
1714
|
-
const { ctx: t } = this._processInputParams(e),
|
|
1715
|
-
function
|
|
1714
|
+
const { ctx: t } = this._processInputParams(e), n = this._def.options;
|
|
1715
|
+
function s(a) {
|
|
1716
1716
|
for (const o of a)
|
|
1717
1717
|
if (o.result.status === "valid")
|
|
1718
1718
|
return o.result;
|
|
1719
1719
|
for (const o of a)
|
|
1720
1720
|
if (o.result.status === "dirty")
|
|
1721
1721
|
return t.common.issues.push(...o.ctx.common.issues), o.result;
|
|
1722
|
-
const i = a.map((o) => new
|
|
1722
|
+
const i = a.map((o) => new I(o.ctx.common.issues));
|
|
1723
1723
|
return l(t, {
|
|
1724
1724
|
code: c.invalid_union,
|
|
1725
1725
|
unionErrors: i
|
|
1726
|
-
}),
|
|
1726
|
+
}), p;
|
|
1727
1727
|
}
|
|
1728
1728
|
if (t.common.async)
|
|
1729
|
-
return Promise.all(
|
|
1729
|
+
return Promise.all(n.map(async (a) => {
|
|
1730
1730
|
const i = {
|
|
1731
1731
|
...t,
|
|
1732
1732
|
common: {
|
|
@@ -1743,11 +1743,11 @@ class ee extends v {
|
|
|
1743
1743
|
}),
|
|
1744
1744
|
ctx: i
|
|
1745
1745
|
};
|
|
1746
|
-
})).then(
|
|
1746
|
+
})).then(s);
|
|
1747
1747
|
{
|
|
1748
1748
|
let a;
|
|
1749
1749
|
const i = [];
|
|
1750
|
-
for (const f of
|
|
1750
|
+
for (const f of n) {
|
|
1751
1751
|
const d = {
|
|
1752
1752
|
...t,
|
|
1753
1753
|
common: {
|
|
@@ -1755,22 +1755,22 @@ class ee extends v {
|
|
|
1755
1755
|
issues: []
|
|
1756
1756
|
},
|
|
1757
1757
|
parent: null
|
|
1758
|
-
},
|
|
1758
|
+
}, v = f._parseSync({
|
|
1759
1759
|
data: t.data,
|
|
1760
1760
|
path: t.path,
|
|
1761
1761
|
parent: d
|
|
1762
1762
|
});
|
|
1763
|
-
if (
|
|
1764
|
-
return
|
|
1765
|
-
|
|
1763
|
+
if (v.status === "valid")
|
|
1764
|
+
return v;
|
|
1765
|
+
v.status === "dirty" && !a && (a = { result: v, ctx: d }), d.common.issues.length && i.push(d.common.issues);
|
|
1766
1766
|
}
|
|
1767
1767
|
if (a)
|
|
1768
1768
|
return t.common.issues.push(...a.ctx.common.issues), a.result;
|
|
1769
|
-
const o = i.map((f) => new
|
|
1769
|
+
const o = i.map((f) => new I(f));
|
|
1770
1770
|
return l(t, {
|
|
1771
1771
|
code: c.invalid_union,
|
|
1772
1772
|
unionErrors: o
|
|
1773
|
-
}),
|
|
1773
|
+
}), p;
|
|
1774
1774
|
}
|
|
1775
1775
|
}
|
|
1776
1776
|
get options() {
|
|
@@ -1779,11 +1779,11 @@ class ee extends v {
|
|
|
1779
1779
|
}
|
|
1780
1780
|
ee.create = (r, e) => new ee({
|
|
1781
1781
|
options: r,
|
|
1782
|
-
typeName:
|
|
1782
|
+
typeName: m.ZodUnion,
|
|
1783
1783
|
...y(e)
|
|
1784
1784
|
});
|
|
1785
|
-
const de = (r) => r instanceof
|
|
1786
|
-
class ge extends
|
|
1785
|
+
const de = (r) => r instanceof ne ? de(r.schema) : r instanceof R ? de(r.innerType()) : r instanceof se ? [r.value] : r instanceof L ? r.options : r instanceof ae ? Object.keys(r.enum) : r instanceof ie ? de(r._def.innerType) : r instanceof K ? [void 0] : r instanceof F ? [null] : null;
|
|
1786
|
+
class ge extends _ {
|
|
1787
1787
|
_parse(e) {
|
|
1788
1788
|
const { ctx: t } = this._processInputParams(e);
|
|
1789
1789
|
if (t.parsedType !== u.object)
|
|
@@ -1791,8 +1791,8 @@ class ge extends v {
|
|
|
1791
1791
|
code: c.invalid_type,
|
|
1792
1792
|
expected: u.object,
|
|
1793
1793
|
received: t.parsedType
|
|
1794
|
-
}),
|
|
1795
|
-
const
|
|
1794
|
+
}), p;
|
|
1795
|
+
const n = this.discriminator, s = t.data[n], a = this.optionsMap.get(s);
|
|
1796
1796
|
return a ? t.common.async ? a._parseAsync({
|
|
1797
1797
|
data: t.data,
|
|
1798
1798
|
path: t.path,
|
|
@@ -1804,8 +1804,8 @@ class ge extends v {
|
|
|
1804
1804
|
}) : (l(t, {
|
|
1805
1805
|
code: c.invalid_union_discriminator,
|
|
1806
1806
|
options: Array.from(this.optionsMap.keys()),
|
|
1807
|
-
path: [
|
|
1808
|
-
}),
|
|
1807
|
+
path: [n]
|
|
1808
|
+
}), p);
|
|
1809
1809
|
}
|
|
1810
1810
|
get discriminator() {
|
|
1811
1811
|
return this._def.discriminator;
|
|
@@ -1824,33 +1824,33 @@ class ge extends v {
|
|
|
1824
1824
|
* @param types an array of object schemas
|
|
1825
1825
|
* @param params
|
|
1826
1826
|
*/
|
|
1827
|
-
static create(e, t,
|
|
1828
|
-
const
|
|
1827
|
+
static create(e, t, n) {
|
|
1828
|
+
const s = /* @__PURE__ */ new Map();
|
|
1829
1829
|
for (const a of t) {
|
|
1830
1830
|
const i = de(a.shape[e]);
|
|
1831
1831
|
if (!i)
|
|
1832
1832
|
throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
|
|
1833
1833
|
for (const o of i) {
|
|
1834
|
-
if (
|
|
1834
|
+
if (s.has(o))
|
|
1835
1835
|
throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);
|
|
1836
|
-
|
|
1836
|
+
s.set(o, a);
|
|
1837
1837
|
}
|
|
1838
1838
|
}
|
|
1839
1839
|
return new ge({
|
|
1840
|
-
typeName:
|
|
1840
|
+
typeName: m.ZodDiscriminatedUnion,
|
|
1841
1841
|
discriminator: e,
|
|
1842
1842
|
options: t,
|
|
1843
|
-
optionsMap:
|
|
1844
|
-
...y(
|
|
1843
|
+
optionsMap: s,
|
|
1844
|
+
...y(n)
|
|
1845
1845
|
});
|
|
1846
1846
|
}
|
|
1847
1847
|
}
|
|
1848
1848
|
function Te(r, e) {
|
|
1849
|
-
const t = P(r),
|
|
1849
|
+
const t = P(r), n = P(e);
|
|
1850
1850
|
if (r === e)
|
|
1851
1851
|
return { valid: !0, data: r };
|
|
1852
|
-
if (t === u.object &&
|
|
1853
|
-
const
|
|
1852
|
+
if (t === u.object && n === u.object) {
|
|
1853
|
+
const s = x.objectKeys(e), a = x.objectKeys(r).filter((o) => s.indexOf(o) !== -1), i = { ...r, ...e };
|
|
1854
1854
|
for (const o of a) {
|
|
1855
1855
|
const f = Te(r[o], e[o]);
|
|
1856
1856
|
if (!f.valid)
|
|
@@ -1858,87 +1858,87 @@ function Te(r, e) {
|
|
|
1858
1858
|
i[o] = f.data;
|
|
1859
1859
|
}
|
|
1860
1860
|
return { valid: !0, data: i };
|
|
1861
|
-
} else if (t === u.array &&
|
|
1861
|
+
} else if (t === u.array && n === u.array) {
|
|
1862
1862
|
if (r.length !== e.length)
|
|
1863
1863
|
return { valid: !1 };
|
|
1864
|
-
const
|
|
1864
|
+
const s = [];
|
|
1865
1865
|
for (let a = 0; a < r.length; a++) {
|
|
1866
1866
|
const i = r[a], o = e[a], f = Te(i, o);
|
|
1867
1867
|
if (!f.valid)
|
|
1868
1868
|
return { valid: !1 };
|
|
1869
|
-
|
|
1869
|
+
s.push(f.data);
|
|
1870
1870
|
}
|
|
1871
|
-
return { valid: !0, data:
|
|
1871
|
+
return { valid: !0, data: s };
|
|
1872
1872
|
} else
|
|
1873
|
-
return t === u.date &&
|
|
1873
|
+
return t === u.date && n === u.date && +r == +e ? { valid: !0, data: r } : { valid: !1 };
|
|
1874
1874
|
}
|
|
1875
|
-
class te extends
|
|
1875
|
+
class te extends _ {
|
|
1876
1876
|
_parse(e) {
|
|
1877
|
-
const { status: t, ctx:
|
|
1877
|
+
const { status: t, ctx: n } = this._processInputParams(e), s = (a, i) => {
|
|
1878
1878
|
if (ke(a) || ke(i))
|
|
1879
|
-
return
|
|
1879
|
+
return p;
|
|
1880
1880
|
const o = Te(a.value, i.value);
|
|
1881
|
-
return o.valid ? ((we(a) || we(i)) && t.dirty(), { status: t.value, value: o.data }) : (l(
|
|
1881
|
+
return o.valid ? ((we(a) || we(i)) && t.dirty(), { status: t.value, value: o.data }) : (l(n, {
|
|
1882
1882
|
code: c.invalid_intersection_types
|
|
1883
|
-
}),
|
|
1883
|
+
}), p);
|
|
1884
1884
|
};
|
|
1885
|
-
return
|
|
1885
|
+
return n.common.async ? Promise.all([
|
|
1886
1886
|
this._def.left._parseAsync({
|
|
1887
|
-
data:
|
|
1888
|
-
path:
|
|
1889
|
-
parent:
|
|
1887
|
+
data: n.data,
|
|
1888
|
+
path: n.path,
|
|
1889
|
+
parent: n
|
|
1890
1890
|
}),
|
|
1891
1891
|
this._def.right._parseAsync({
|
|
1892
|
-
data:
|
|
1893
|
-
path:
|
|
1894
|
-
parent:
|
|
1892
|
+
data: n.data,
|
|
1893
|
+
path: n.path,
|
|
1894
|
+
parent: n
|
|
1895
1895
|
})
|
|
1896
|
-
]).then(([a, i]) =>
|
|
1897
|
-
data:
|
|
1898
|
-
path:
|
|
1899
|
-
parent:
|
|
1896
|
+
]).then(([a, i]) => s(a, i)) : s(this._def.left._parseSync({
|
|
1897
|
+
data: n.data,
|
|
1898
|
+
path: n.path,
|
|
1899
|
+
parent: n
|
|
1900
1900
|
}), this._def.right._parseSync({
|
|
1901
|
-
data:
|
|
1902
|
-
path:
|
|
1903
|
-
parent:
|
|
1901
|
+
data: n.data,
|
|
1902
|
+
path: n.path,
|
|
1903
|
+
parent: n
|
|
1904
1904
|
}));
|
|
1905
1905
|
}
|
|
1906
1906
|
}
|
|
1907
1907
|
te.create = (r, e, t) => new te({
|
|
1908
1908
|
left: r,
|
|
1909
1909
|
right: e,
|
|
1910
|
-
typeName:
|
|
1910
|
+
typeName: m.ZodIntersection,
|
|
1911
1911
|
...y(t)
|
|
1912
1912
|
});
|
|
1913
|
-
class A extends
|
|
1913
|
+
class A extends _ {
|
|
1914
1914
|
_parse(e) {
|
|
1915
|
-
const { status: t, ctx:
|
|
1916
|
-
if (
|
|
1917
|
-
return l(
|
|
1915
|
+
const { status: t, ctx: n } = this._processInputParams(e);
|
|
1916
|
+
if (n.parsedType !== u.array)
|
|
1917
|
+
return l(n, {
|
|
1918
1918
|
code: c.invalid_type,
|
|
1919
1919
|
expected: u.array,
|
|
1920
|
-
received:
|
|
1921
|
-
}),
|
|
1922
|
-
if (
|
|
1923
|
-
return l(
|
|
1920
|
+
received: n.parsedType
|
|
1921
|
+
}), p;
|
|
1922
|
+
if (n.data.length < this._def.items.length)
|
|
1923
|
+
return l(n, {
|
|
1924
1924
|
code: c.too_small,
|
|
1925
1925
|
minimum: this._def.items.length,
|
|
1926
1926
|
inclusive: !0,
|
|
1927
1927
|
exact: !1,
|
|
1928
1928
|
type: "array"
|
|
1929
|
-
}),
|
|
1930
|
-
!this._def.rest &&
|
|
1929
|
+
}), p;
|
|
1930
|
+
!this._def.rest && n.data.length > this._def.items.length && (l(n, {
|
|
1931
1931
|
code: c.too_big,
|
|
1932
1932
|
maximum: this._def.items.length,
|
|
1933
1933
|
inclusive: !0,
|
|
1934
1934
|
exact: !1,
|
|
1935
1935
|
type: "array"
|
|
1936
1936
|
}), t.dirty());
|
|
1937
|
-
const a = [...
|
|
1937
|
+
const a = [...n.data].map((i, o) => {
|
|
1938
1938
|
const f = this._def.items[o] || this._def.rest;
|
|
1939
|
-
return f ? f._parse(new j(
|
|
1939
|
+
return f ? f._parse(new j(n, i, n.path, o)) : null;
|
|
1940
1940
|
}).filter((i) => !!i);
|
|
1941
|
-
return
|
|
1941
|
+
return n.common.async ? Promise.all(a).then((i) => Z.mergeArray(t, i)) : Z.mergeArray(t, a);
|
|
1942
1942
|
}
|
|
1943
1943
|
get items() {
|
|
1944
1944
|
return this._def.items;
|
|
@@ -1955,12 +1955,12 @@ A.create = (r, e) => {
|
|
|
1955
1955
|
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
1956
1956
|
return new A({
|
|
1957
1957
|
items: r,
|
|
1958
|
-
typeName:
|
|
1958
|
+
typeName: m.ZodTuple,
|
|
1959
1959
|
rest: null,
|
|
1960
1960
|
...y(e)
|
|
1961
1961
|
});
|
|
1962
1962
|
};
|
|
1963
|
-
class re extends
|
|
1963
|
+
class re extends _ {
|
|
1964
1964
|
get keySchema() {
|
|
1965
1965
|
return this._def.keyType;
|
|
1966
1966
|
}
|
|
@@ -1968,39 +1968,39 @@ class re extends v {
|
|
|
1968
1968
|
return this._def.valueType;
|
|
1969
1969
|
}
|
|
1970
1970
|
_parse(e) {
|
|
1971
|
-
const { status: t, ctx:
|
|
1972
|
-
if (
|
|
1973
|
-
return l(
|
|
1971
|
+
const { status: t, ctx: n } = this._processInputParams(e);
|
|
1972
|
+
if (n.parsedType !== u.object)
|
|
1973
|
+
return l(n, {
|
|
1974
1974
|
code: c.invalid_type,
|
|
1975
1975
|
expected: u.object,
|
|
1976
|
-
received:
|
|
1977
|
-
}),
|
|
1978
|
-
const
|
|
1979
|
-
for (const o in
|
|
1980
|
-
|
|
1981
|
-
key: a._parse(new j(
|
|
1982
|
-
value: i._parse(new j(
|
|
1976
|
+
received: n.parsedType
|
|
1977
|
+
}), p;
|
|
1978
|
+
const s = [], a = this._def.keyType, i = this._def.valueType;
|
|
1979
|
+
for (const o in n.data)
|
|
1980
|
+
s.push({
|
|
1981
|
+
key: a._parse(new j(n, o, n.path, o)),
|
|
1982
|
+
value: i._parse(new j(n, n.data[o], n.path, o))
|
|
1983
1983
|
});
|
|
1984
|
-
return
|
|
1984
|
+
return n.common.async ? Z.mergeObjectAsync(t, s) : Z.mergeObjectSync(t, s);
|
|
1985
1985
|
}
|
|
1986
1986
|
get element() {
|
|
1987
1987
|
return this._def.valueType;
|
|
1988
1988
|
}
|
|
1989
|
-
static create(e, t,
|
|
1990
|
-
return t instanceof
|
|
1989
|
+
static create(e, t, n) {
|
|
1990
|
+
return t instanceof _ ? new re({
|
|
1991
1991
|
keyType: e,
|
|
1992
1992
|
valueType: t,
|
|
1993
|
-
typeName:
|
|
1994
|
-
...y(
|
|
1993
|
+
typeName: m.ZodRecord,
|
|
1994
|
+
...y(n)
|
|
1995
1995
|
}) : new re({
|
|
1996
|
-
keyType:
|
|
1996
|
+
keyType: O.create(),
|
|
1997
1997
|
valueType: e,
|
|
1998
|
-
typeName:
|
|
1998
|
+
typeName: m.ZodRecord,
|
|
1999
1999
|
...y(t)
|
|
2000
2000
|
});
|
|
2001
2001
|
}
|
|
2002
2002
|
}
|
|
2003
|
-
class
|
|
2003
|
+
class pe extends _ {
|
|
2004
2004
|
get keySchema() {
|
|
2005
2005
|
return this._def.keyType;
|
|
2006
2006
|
}
|
|
@@ -2008,83 +2008,83 @@ class me extends v {
|
|
|
2008
2008
|
return this._def.valueType;
|
|
2009
2009
|
}
|
|
2010
2010
|
_parse(e) {
|
|
2011
|
-
const { status: t, ctx:
|
|
2012
|
-
if (
|
|
2013
|
-
return l(
|
|
2011
|
+
const { status: t, ctx: n } = this._processInputParams(e);
|
|
2012
|
+
if (n.parsedType !== u.map)
|
|
2013
|
+
return l(n, {
|
|
2014
2014
|
code: c.invalid_type,
|
|
2015
2015
|
expected: u.map,
|
|
2016
|
-
received:
|
|
2017
|
-
}),
|
|
2018
|
-
const
|
|
2019
|
-
key:
|
|
2020
|
-
value: a._parse(new j(
|
|
2016
|
+
received: n.parsedType
|
|
2017
|
+
}), p;
|
|
2018
|
+
const s = this._def.keyType, a = this._def.valueType, i = [...n.data.entries()].map(([o, f], d) => ({
|
|
2019
|
+
key: s._parse(new j(n, o, n.path, [d, "key"])),
|
|
2020
|
+
value: a._parse(new j(n, f, n.path, [d, "value"]))
|
|
2021
2021
|
}));
|
|
2022
|
-
if (
|
|
2022
|
+
if (n.common.async) {
|
|
2023
2023
|
const o = /* @__PURE__ */ new Map();
|
|
2024
2024
|
return Promise.resolve().then(async () => {
|
|
2025
2025
|
for (const f of i) {
|
|
2026
|
-
const d = await f.key,
|
|
2027
|
-
if (d.status === "aborted" ||
|
|
2028
|
-
return
|
|
2029
|
-
(d.status === "dirty" ||
|
|
2026
|
+
const d = await f.key, v = await f.value;
|
|
2027
|
+
if (d.status === "aborted" || v.status === "aborted")
|
|
2028
|
+
return p;
|
|
2029
|
+
(d.status === "dirty" || v.status === "dirty") && t.dirty(), o.set(d.value, v.value);
|
|
2030
2030
|
}
|
|
2031
2031
|
return { status: t.value, value: o };
|
|
2032
2032
|
});
|
|
2033
2033
|
} else {
|
|
2034
2034
|
const o = /* @__PURE__ */ new Map();
|
|
2035
2035
|
for (const f of i) {
|
|
2036
|
-
const d = f.key,
|
|
2037
|
-
if (d.status === "aborted" ||
|
|
2038
|
-
return
|
|
2039
|
-
(d.status === "dirty" ||
|
|
2036
|
+
const d = f.key, v = f.value;
|
|
2037
|
+
if (d.status === "aborted" || v.status === "aborted")
|
|
2038
|
+
return p;
|
|
2039
|
+
(d.status === "dirty" || v.status === "dirty") && t.dirty(), o.set(d.value, v.value);
|
|
2040
2040
|
}
|
|
2041
2041
|
return { status: t.value, value: o };
|
|
2042
2042
|
}
|
|
2043
2043
|
}
|
|
2044
2044
|
}
|
|
2045
|
-
|
|
2045
|
+
pe.create = (r, e, t) => new pe({
|
|
2046
2046
|
valueType: e,
|
|
2047
2047
|
keyType: r,
|
|
2048
|
-
typeName:
|
|
2048
|
+
typeName: m.ZodMap,
|
|
2049
2049
|
...y(t)
|
|
2050
2050
|
});
|
|
2051
|
-
class B extends
|
|
2051
|
+
class B extends _ {
|
|
2052
2052
|
_parse(e) {
|
|
2053
|
-
const { status: t, ctx:
|
|
2054
|
-
if (
|
|
2055
|
-
return l(
|
|
2053
|
+
const { status: t, ctx: n } = this._processInputParams(e);
|
|
2054
|
+
if (n.parsedType !== u.set)
|
|
2055
|
+
return l(n, {
|
|
2056
2056
|
code: c.invalid_type,
|
|
2057
2057
|
expected: u.set,
|
|
2058
|
-
received:
|
|
2059
|
-
}),
|
|
2060
|
-
const
|
|
2061
|
-
|
|
2058
|
+
received: n.parsedType
|
|
2059
|
+
}), p;
|
|
2060
|
+
const s = this._def;
|
|
2061
|
+
s.minSize !== null && n.data.size < s.minSize.value && (l(n, {
|
|
2062
2062
|
code: c.too_small,
|
|
2063
|
-
minimum:
|
|
2063
|
+
minimum: s.minSize.value,
|
|
2064
2064
|
type: "set",
|
|
2065
2065
|
inclusive: !0,
|
|
2066
2066
|
exact: !1,
|
|
2067
|
-
message:
|
|
2068
|
-
}), t.dirty()),
|
|
2067
|
+
message: s.minSize.message
|
|
2068
|
+
}), t.dirty()), s.maxSize !== null && n.data.size > s.maxSize.value && (l(n, {
|
|
2069
2069
|
code: c.too_big,
|
|
2070
|
-
maximum:
|
|
2070
|
+
maximum: s.maxSize.value,
|
|
2071
2071
|
type: "set",
|
|
2072
2072
|
inclusive: !0,
|
|
2073
2073
|
exact: !1,
|
|
2074
|
-
message:
|
|
2074
|
+
message: s.maxSize.message
|
|
2075
2075
|
}), t.dirty());
|
|
2076
2076
|
const a = this._def.valueType;
|
|
2077
2077
|
function i(f) {
|
|
2078
2078
|
const d = /* @__PURE__ */ new Set();
|
|
2079
|
-
for (const
|
|
2080
|
-
if (
|
|
2081
|
-
return
|
|
2082
|
-
|
|
2079
|
+
for (const v of f) {
|
|
2080
|
+
if (v.status === "aborted")
|
|
2081
|
+
return p;
|
|
2082
|
+
v.status === "dirty" && t.dirty(), d.add(v.value);
|
|
2083
2083
|
}
|
|
2084
2084
|
return { status: t.value, value: d };
|
|
2085
2085
|
}
|
|
2086
|
-
const o = [...
|
|
2087
|
-
return
|
|
2086
|
+
const o = [...n.data.values()].map((f, d) => a._parse(new j(n, f, n.path, d)));
|
|
2087
|
+
return n.common.async ? Promise.all(o).then((f) => i(f)) : i(o);
|
|
2088
2088
|
}
|
|
2089
2089
|
min(e, t) {
|
|
2090
2090
|
return new B({
|
|
@@ -2109,10 +2109,10 @@ B.create = (r, e) => new B({
|
|
|
2109
2109
|
valueType: r,
|
|
2110
2110
|
minSize: null,
|
|
2111
2111
|
maxSize: null,
|
|
2112
|
-
typeName:
|
|
2112
|
+
typeName: m.ZodSet,
|
|
2113
2113
|
...y(e)
|
|
2114
2114
|
});
|
|
2115
|
-
class
|
|
2115
|
+
class Y extends _ {
|
|
2116
2116
|
constructor() {
|
|
2117
2117
|
super(...arguments), this.validate = this.implement;
|
|
2118
2118
|
}
|
|
@@ -2123,8 +2123,8 @@ class J extends v {
|
|
|
2123
2123
|
code: c.invalid_type,
|
|
2124
2124
|
expected: u.function,
|
|
2125
2125
|
received: t.parsedType
|
|
2126
|
-
}),
|
|
2127
|
-
function
|
|
2126
|
+
}), p;
|
|
2127
|
+
function n(o, f) {
|
|
2128
2128
|
return le({
|
|
2129
2129
|
data: o,
|
|
2130
2130
|
path: t.path,
|
|
@@ -2132,7 +2132,7 @@ class J extends v {
|
|
|
2132
2132
|
t.common.contextualErrorMap,
|
|
2133
2133
|
t.schemaErrorMap,
|
|
2134
2134
|
ue(),
|
|
2135
|
-
|
|
2135
|
+
H
|
|
2136
2136
|
].filter((d) => !!d),
|
|
2137
2137
|
issueData: {
|
|
2138
2138
|
code: c.invalid_arguments,
|
|
@@ -2140,7 +2140,7 @@ class J extends v {
|
|
|
2140
2140
|
}
|
|
2141
2141
|
});
|
|
2142
2142
|
}
|
|
2143
|
-
function
|
|
2143
|
+
function s(o, f) {
|
|
2144
2144
|
return le({
|
|
2145
2145
|
data: o,
|
|
2146
2146
|
path: t.path,
|
|
@@ -2148,7 +2148,7 @@ class J extends v {
|
|
|
2148
2148
|
t.common.contextualErrorMap,
|
|
2149
2149
|
t.schemaErrorMap,
|
|
2150
2150
|
ue(),
|
|
2151
|
-
|
|
2151
|
+
H
|
|
2152
2152
|
].filter((d) => !!d),
|
|
2153
2153
|
issueData: {
|
|
2154
2154
|
code: c.invalid_return_type,
|
|
@@ -2157,14 +2157,14 @@ class J extends v {
|
|
|
2157
2157
|
});
|
|
2158
2158
|
}
|
|
2159
2159
|
const a = { errorMap: t.common.contextualErrorMap }, i = t.data;
|
|
2160
|
-
if (this._def.returns instanceof
|
|
2160
|
+
if (this._def.returns instanceof G) {
|
|
2161
2161
|
const o = this;
|
|
2162
2162
|
return S(async function(...f) {
|
|
2163
|
-
const d = new
|
|
2164
|
-
throw d.addIssue(
|
|
2165
|
-
}),
|
|
2166
|
-
return await o._def.returns._def.type.parseAsync(
|
|
2167
|
-
throw d.addIssue(
|
|
2163
|
+
const d = new I([]), v = await o._def.args.parseAsync(f, a).catch((ce) => {
|
|
2164
|
+
throw d.addIssue(n(f, ce)), d;
|
|
2165
|
+
}), C = await Reflect.apply(i, this, v);
|
|
2166
|
+
return await o._def.returns._def.type.parseAsync(C, a).catch((ce) => {
|
|
2167
|
+
throw d.addIssue(s(C, ce)), d;
|
|
2168
2168
|
});
|
|
2169
2169
|
});
|
|
2170
2170
|
} else {
|
|
@@ -2172,11 +2172,11 @@ class J extends v {
|
|
|
2172
2172
|
return S(function(...f) {
|
|
2173
2173
|
const d = o._def.args.safeParse(f, a);
|
|
2174
2174
|
if (!d.success)
|
|
2175
|
-
throw new
|
|
2176
|
-
const
|
|
2177
|
-
if (!
|
|
2178
|
-
throw new
|
|
2179
|
-
return
|
|
2175
|
+
throw new I([n(f, d.error)]);
|
|
2176
|
+
const v = Reflect.apply(i, this, d.data), C = o._def.returns.safeParse(v, a);
|
|
2177
|
+
if (!C.success)
|
|
2178
|
+
throw new I([s(v, C.error)]);
|
|
2179
|
+
return C.data;
|
|
2180
2180
|
});
|
|
2181
2181
|
}
|
|
2182
2182
|
}
|
|
@@ -2187,13 +2187,13 @@ class J extends v {
|
|
|
2187
2187
|
return this._def.returns;
|
|
2188
2188
|
}
|
|
2189
2189
|
args(...e) {
|
|
2190
|
-
return new
|
|
2190
|
+
return new Y({
|
|
2191
2191
|
...this._def,
|
|
2192
2192
|
args: A.create(e).rest(D.create())
|
|
2193
2193
|
});
|
|
2194
2194
|
}
|
|
2195
2195
|
returns(e) {
|
|
2196
|
-
return new
|
|
2196
|
+
return new Y({
|
|
2197
2197
|
...this._def,
|
|
2198
2198
|
returns: e
|
|
2199
2199
|
});
|
|
@@ -2204,16 +2204,16 @@ class J extends v {
|
|
|
2204
2204
|
strictImplement(e) {
|
|
2205
2205
|
return this.parse(e);
|
|
2206
2206
|
}
|
|
2207
|
-
static create(e, t,
|
|
2208
|
-
return new
|
|
2207
|
+
static create(e, t, n) {
|
|
2208
|
+
return new Y({
|
|
2209
2209
|
args: e || A.create([]).rest(D.create()),
|
|
2210
2210
|
returns: t || D.create(),
|
|
2211
|
-
typeName:
|
|
2212
|
-
...y(
|
|
2211
|
+
typeName: m.ZodFunction,
|
|
2212
|
+
...y(n)
|
|
2213
2213
|
});
|
|
2214
2214
|
}
|
|
2215
2215
|
}
|
|
2216
|
-
class
|
|
2216
|
+
class ne extends _ {
|
|
2217
2217
|
get schema() {
|
|
2218
2218
|
return this._def.getter();
|
|
2219
2219
|
}
|
|
@@ -2222,12 +2222,12 @@ class se extends v {
|
|
|
2222
2222
|
return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
|
|
2223
2223
|
}
|
|
2224
2224
|
}
|
|
2225
|
-
|
|
2225
|
+
ne.create = (r, e) => new ne({
|
|
2226
2226
|
getter: r,
|
|
2227
|
-
typeName:
|
|
2227
|
+
typeName: m.ZodLazy,
|
|
2228
2228
|
...y(e)
|
|
2229
2229
|
});
|
|
2230
|
-
class
|
|
2230
|
+
class se extends _ {
|
|
2231
2231
|
_parse(e) {
|
|
2232
2232
|
if (e.data !== this._def.value) {
|
|
2233
2233
|
const t = this._getOrReturnCtx(e);
|
|
@@ -2235,7 +2235,7 @@ class ne extends v {
|
|
|
2235
2235
|
received: t.data,
|
|
2236
2236
|
code: c.invalid_literal,
|
|
2237
2237
|
expected: this._def.value
|
|
2238
|
-
}),
|
|
2238
|
+
}), p;
|
|
2239
2239
|
}
|
|
2240
2240
|
return { status: "valid", value: e.data };
|
|
2241
2241
|
}
|
|
@@ -2243,35 +2243,35 @@ class ne extends v {
|
|
|
2243
2243
|
return this._def.value;
|
|
2244
2244
|
}
|
|
2245
2245
|
}
|
|
2246
|
-
|
|
2246
|
+
se.create = (r, e) => new se({
|
|
2247
2247
|
value: r,
|
|
2248
|
-
typeName:
|
|
2248
|
+
typeName: m.ZodLiteral,
|
|
2249
2249
|
...y(e)
|
|
2250
2250
|
});
|
|
2251
|
-
function
|
|
2251
|
+
function Ie(r, e) {
|
|
2252
2252
|
return new L({
|
|
2253
2253
|
values: r,
|
|
2254
|
-
typeName:
|
|
2254
|
+
typeName: m.ZodEnum,
|
|
2255
2255
|
...y(e)
|
|
2256
2256
|
});
|
|
2257
2257
|
}
|
|
2258
|
-
class L extends
|
|
2258
|
+
class L extends _ {
|
|
2259
2259
|
_parse(e) {
|
|
2260
2260
|
if (typeof e.data != "string") {
|
|
2261
|
-
const t = this._getOrReturnCtx(e),
|
|
2261
|
+
const t = this._getOrReturnCtx(e), n = this._def.values;
|
|
2262
2262
|
return l(t, {
|
|
2263
|
-
expected:
|
|
2263
|
+
expected: x.joinValues(n),
|
|
2264
2264
|
received: t.parsedType,
|
|
2265
2265
|
code: c.invalid_type
|
|
2266
|
-
}),
|
|
2266
|
+
}), p;
|
|
2267
2267
|
}
|
|
2268
2268
|
if (this._def.values.indexOf(e.data) === -1) {
|
|
2269
|
-
const t = this._getOrReturnCtx(e),
|
|
2269
|
+
const t = this._getOrReturnCtx(e), n = this._def.values;
|
|
2270
2270
|
return l(t, {
|
|
2271
2271
|
received: t.data,
|
|
2272
2272
|
code: c.invalid_enum_value,
|
|
2273
|
-
options:
|
|
2274
|
-
}),
|
|
2273
|
+
options: n
|
|
2274
|
+
}), p;
|
|
2275
2275
|
}
|
|
2276
2276
|
return S(e.data);
|
|
2277
2277
|
}
|
|
@@ -2303,25 +2303,25 @@ class L extends v {
|
|
|
2303
2303
|
return L.create(this.options.filter((t) => !e.includes(t)));
|
|
2304
2304
|
}
|
|
2305
2305
|
}
|
|
2306
|
-
L.create =
|
|
2307
|
-
class ae extends
|
|
2306
|
+
L.create = Ie;
|
|
2307
|
+
class ae extends _ {
|
|
2308
2308
|
_parse(e) {
|
|
2309
|
-
const t =
|
|
2310
|
-
if (
|
|
2311
|
-
const
|
|
2312
|
-
return l(
|
|
2313
|
-
expected:
|
|
2314
|
-
received:
|
|
2309
|
+
const t = x.getValidEnumValues(this._def.values), n = this._getOrReturnCtx(e);
|
|
2310
|
+
if (n.parsedType !== u.string && n.parsedType !== u.number) {
|
|
2311
|
+
const s = x.objectValues(t);
|
|
2312
|
+
return l(n, {
|
|
2313
|
+
expected: x.joinValues(s),
|
|
2314
|
+
received: n.parsedType,
|
|
2315
2315
|
code: c.invalid_type
|
|
2316
|
-
}),
|
|
2316
|
+
}), p;
|
|
2317
2317
|
}
|
|
2318
2318
|
if (t.indexOf(e.data) === -1) {
|
|
2319
|
-
const
|
|
2320
|
-
return l(
|
|
2321
|
-
received:
|
|
2319
|
+
const s = x.objectValues(t);
|
|
2320
|
+
return l(n, {
|
|
2321
|
+
received: n.data,
|
|
2322
2322
|
code: c.invalid_enum_value,
|
|
2323
|
-
options:
|
|
2324
|
-
}),
|
|
2323
|
+
options: s
|
|
2324
|
+
}), p;
|
|
2325
2325
|
}
|
|
2326
2326
|
return S(e.data);
|
|
2327
2327
|
}
|
|
@@ -2331,10 +2331,10 @@ class ae extends v {
|
|
|
2331
2331
|
}
|
|
2332
2332
|
ae.create = (r, e) => new ae({
|
|
2333
2333
|
values: r,
|
|
2334
|
-
typeName:
|
|
2334
|
+
typeName: m.ZodNativeEnum,
|
|
2335
2335
|
...y(e)
|
|
2336
2336
|
});
|
|
2337
|
-
class
|
|
2337
|
+
class G extends _ {
|
|
2338
2338
|
unwrap() {
|
|
2339
2339
|
return this._def.type;
|
|
2340
2340
|
}
|
|
@@ -2345,100 +2345,100 @@ class H extends v {
|
|
|
2345
2345
|
code: c.invalid_type,
|
|
2346
2346
|
expected: u.promise,
|
|
2347
2347
|
received: t.parsedType
|
|
2348
|
-
}),
|
|
2349
|
-
const
|
|
2350
|
-
return S(
|
|
2348
|
+
}), p;
|
|
2349
|
+
const n = t.parsedType === u.promise ? t.data : Promise.resolve(t.data);
|
|
2350
|
+
return S(n.then((s) => this._def.type.parseAsync(s, {
|
|
2351
2351
|
path: t.path,
|
|
2352
2352
|
errorMap: t.common.contextualErrorMap
|
|
2353
2353
|
})));
|
|
2354
2354
|
}
|
|
2355
2355
|
}
|
|
2356
|
-
|
|
2356
|
+
G.create = (r, e) => new G({
|
|
2357
2357
|
type: r,
|
|
2358
|
-
typeName:
|
|
2358
|
+
typeName: m.ZodPromise,
|
|
2359
2359
|
...y(e)
|
|
2360
2360
|
});
|
|
2361
|
-
class R extends
|
|
2361
|
+
class R extends _ {
|
|
2362
2362
|
innerType() {
|
|
2363
2363
|
return this._def.schema;
|
|
2364
2364
|
}
|
|
2365
2365
|
sourceType() {
|
|
2366
|
-
return this._def.schema._def.typeName ===
|
|
2366
|
+
return this._def.schema._def.typeName === m.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
|
|
2367
2367
|
}
|
|
2368
2368
|
_parse(e) {
|
|
2369
|
-
const { status: t, ctx:
|
|
2369
|
+
const { status: t, ctx: n } = this._processInputParams(e), s = this._def.effect || null, a = {
|
|
2370
2370
|
addIssue: (i) => {
|
|
2371
|
-
l(
|
|
2371
|
+
l(n, i), i.fatal ? t.abort() : t.dirty();
|
|
2372
2372
|
},
|
|
2373
2373
|
get path() {
|
|
2374
|
-
return
|
|
2374
|
+
return n.path;
|
|
2375
2375
|
}
|
|
2376
2376
|
};
|
|
2377
|
-
if (a.addIssue = a.addIssue.bind(a),
|
|
2378
|
-
const i =
|
|
2379
|
-
return
|
|
2377
|
+
if (a.addIssue = a.addIssue.bind(a), s.type === "preprocess") {
|
|
2378
|
+
const i = s.transform(n.data, a);
|
|
2379
|
+
return n.common.issues.length ? {
|
|
2380
2380
|
status: "dirty",
|
|
2381
|
-
value:
|
|
2382
|
-
} :
|
|
2381
|
+
value: n.data
|
|
2382
|
+
} : n.common.async ? Promise.resolve(i).then((o) => this._def.schema._parseAsync({
|
|
2383
2383
|
data: o,
|
|
2384
|
-
path:
|
|
2385
|
-
parent:
|
|
2384
|
+
path: n.path,
|
|
2385
|
+
parent: n
|
|
2386
2386
|
})) : this._def.schema._parseSync({
|
|
2387
2387
|
data: i,
|
|
2388
|
-
path:
|
|
2389
|
-
parent:
|
|
2388
|
+
path: n.path,
|
|
2389
|
+
parent: n
|
|
2390
2390
|
});
|
|
2391
2391
|
}
|
|
2392
|
-
if (
|
|
2392
|
+
if (s.type === "refinement") {
|
|
2393
2393
|
const i = (o) => {
|
|
2394
|
-
const f =
|
|
2395
|
-
if (
|
|
2394
|
+
const f = s.refinement(o, a);
|
|
2395
|
+
if (n.common.async)
|
|
2396
2396
|
return Promise.resolve(f);
|
|
2397
2397
|
if (f instanceof Promise)
|
|
2398
2398
|
throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2399
2399
|
return o;
|
|
2400
2400
|
};
|
|
2401
|
-
if (
|
|
2401
|
+
if (n.common.async === !1) {
|
|
2402
2402
|
const o = this._def.schema._parseSync({
|
|
2403
|
-
data:
|
|
2404
|
-
path:
|
|
2405
|
-
parent:
|
|
2403
|
+
data: n.data,
|
|
2404
|
+
path: n.path,
|
|
2405
|
+
parent: n
|
|
2406
2406
|
});
|
|
2407
|
-
return o.status === "aborted" ?
|
|
2407
|
+
return o.status === "aborted" ? p : (o.status === "dirty" && t.dirty(), i(o.value), { status: t.value, value: o.value });
|
|
2408
2408
|
} else
|
|
2409
|
-
return this._def.schema._parseAsync({ data:
|
|
2409
|
+
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((o) => o.status === "aborted" ? p : (o.status === "dirty" && t.dirty(), i(o.value).then(() => ({ status: t.value, value: o.value }))));
|
|
2410
2410
|
}
|
|
2411
|
-
if (
|
|
2412
|
-
if (
|
|
2411
|
+
if (s.type === "transform")
|
|
2412
|
+
if (n.common.async === !1) {
|
|
2413
2413
|
const i = this._def.schema._parseSync({
|
|
2414
|
-
data:
|
|
2415
|
-
path:
|
|
2416
|
-
parent:
|
|
2414
|
+
data: n.data,
|
|
2415
|
+
path: n.path,
|
|
2416
|
+
parent: n
|
|
2417
2417
|
});
|
|
2418
2418
|
if (!X(i))
|
|
2419
2419
|
return i;
|
|
2420
|
-
const o =
|
|
2420
|
+
const o = s.transform(i.value, a);
|
|
2421
2421
|
if (o instanceof Promise)
|
|
2422
2422
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2423
2423
|
return { status: t.value, value: o };
|
|
2424
2424
|
} else
|
|
2425
|
-
return this._def.schema._parseAsync({ data:
|
|
2426
|
-
|
|
2425
|
+
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((i) => X(i) ? Promise.resolve(s.transform(i.value, a)).then((o) => ({ status: t.value, value: o })) : i);
|
|
2426
|
+
x.assertNever(s);
|
|
2427
2427
|
}
|
|
2428
2428
|
}
|
|
2429
2429
|
R.create = (r, e, t) => new R({
|
|
2430
2430
|
schema: r,
|
|
2431
|
-
typeName:
|
|
2431
|
+
typeName: m.ZodEffects,
|
|
2432
2432
|
effect: e,
|
|
2433
2433
|
...y(t)
|
|
2434
2434
|
});
|
|
2435
2435
|
R.createWithPreprocess = (r, e, t) => new R({
|
|
2436
2436
|
schema: e,
|
|
2437
2437
|
effect: { type: "preprocess", transform: r },
|
|
2438
|
-
typeName:
|
|
2438
|
+
typeName: m.ZodEffects,
|
|
2439
2439
|
...y(t)
|
|
2440
2440
|
});
|
|
2441
|
-
class M extends
|
|
2441
|
+
class M extends _ {
|
|
2442
2442
|
_parse(e) {
|
|
2443
2443
|
return this._getType(e) === u.undefined ? S(void 0) : this._def.innerType._parse(e);
|
|
2444
2444
|
}
|
|
@@ -2448,10 +2448,10 @@ class M extends v {
|
|
|
2448
2448
|
}
|
|
2449
2449
|
M.create = (r, e) => new M({
|
|
2450
2450
|
innerType: r,
|
|
2451
|
-
typeName:
|
|
2451
|
+
typeName: m.ZodOptional,
|
|
2452
2452
|
...y(e)
|
|
2453
2453
|
});
|
|
2454
|
-
class q extends
|
|
2454
|
+
class q extends _ {
|
|
2455
2455
|
_parse(e) {
|
|
2456
2456
|
return this._getType(e) === u.null ? S(null) : this._def.innerType._parse(e);
|
|
2457
2457
|
}
|
|
@@ -2461,15 +2461,15 @@ class q extends v {
|
|
|
2461
2461
|
}
|
|
2462
2462
|
q.create = (r, e) => new q({
|
|
2463
2463
|
innerType: r,
|
|
2464
|
-
typeName:
|
|
2464
|
+
typeName: m.ZodNullable,
|
|
2465
2465
|
...y(e)
|
|
2466
2466
|
});
|
|
2467
|
-
class ie extends
|
|
2467
|
+
class ie extends _ {
|
|
2468
2468
|
_parse(e) {
|
|
2469
2469
|
const { ctx: t } = this._processInputParams(e);
|
|
2470
|
-
let
|
|
2471
|
-
return t.parsedType === u.undefined && (
|
|
2472
|
-
data:
|
|
2470
|
+
let n = t.data;
|
|
2471
|
+
return t.parsedType === u.undefined && (n = this._def.defaultValue()), this._def.innerType._parse({
|
|
2472
|
+
data: n,
|
|
2473
2473
|
path: t.path,
|
|
2474
2474
|
parent: t
|
|
2475
2475
|
});
|
|
@@ -2480,40 +2480,40 @@ class ie extends v {
|
|
|
2480
2480
|
}
|
|
2481
2481
|
ie.create = (r, e) => new ie({
|
|
2482
2482
|
innerType: r,
|
|
2483
|
-
typeName:
|
|
2483
|
+
typeName: m.ZodDefault,
|
|
2484
2484
|
defaultValue: typeof e.default == "function" ? e.default : () => e.default,
|
|
2485
2485
|
...y(e)
|
|
2486
2486
|
});
|
|
2487
|
-
class ye extends
|
|
2487
|
+
class ye extends _ {
|
|
2488
2488
|
_parse(e) {
|
|
2489
|
-
const { ctx: t } = this._processInputParams(e),
|
|
2489
|
+
const { ctx: t } = this._processInputParams(e), n = {
|
|
2490
2490
|
...t,
|
|
2491
2491
|
common: {
|
|
2492
2492
|
...t.common,
|
|
2493
2493
|
issues: []
|
|
2494
2494
|
}
|
|
2495
|
-
},
|
|
2496
|
-
data:
|
|
2497
|
-
path:
|
|
2495
|
+
}, s = this._def.innerType._parse({
|
|
2496
|
+
data: n.data,
|
|
2497
|
+
path: n.path,
|
|
2498
2498
|
parent: {
|
|
2499
|
-
...
|
|
2499
|
+
...n
|
|
2500
2500
|
}
|
|
2501
2501
|
});
|
|
2502
|
-
return fe(
|
|
2502
|
+
return fe(s) ? s.then((a) => ({
|
|
2503
2503
|
status: "valid",
|
|
2504
2504
|
value: a.status === "valid" ? a.value : this._def.catchValue({
|
|
2505
2505
|
get error() {
|
|
2506
|
-
return new
|
|
2506
|
+
return new I(n.common.issues);
|
|
2507
2507
|
},
|
|
2508
|
-
input:
|
|
2508
|
+
input: n.data
|
|
2509
2509
|
})
|
|
2510
2510
|
})) : {
|
|
2511
2511
|
status: "valid",
|
|
2512
|
-
value:
|
|
2512
|
+
value: s.status === "valid" ? s.value : this._def.catchValue({
|
|
2513
2513
|
get error() {
|
|
2514
|
-
return new
|
|
2514
|
+
return new I(n.common.issues);
|
|
2515
2515
|
},
|
|
2516
|
-
input:
|
|
2516
|
+
input: n.data
|
|
2517
2517
|
})
|
|
2518
2518
|
};
|
|
2519
2519
|
}
|
|
@@ -2523,33 +2523,33 @@ class ye extends v {
|
|
|
2523
2523
|
}
|
|
2524
2524
|
ye.create = (r, e) => new ye({
|
|
2525
2525
|
innerType: r,
|
|
2526
|
-
typeName:
|
|
2526
|
+
typeName: m.ZodCatch,
|
|
2527
2527
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
|
|
2528
2528
|
...y(e)
|
|
2529
2529
|
});
|
|
2530
|
-
class
|
|
2530
|
+
class _e extends _ {
|
|
2531
2531
|
_parse(e) {
|
|
2532
2532
|
if (this._getType(e) !== u.nan) {
|
|
2533
|
-
const
|
|
2534
|
-
return l(
|
|
2533
|
+
const n = this._getOrReturnCtx(e);
|
|
2534
|
+
return l(n, {
|
|
2535
2535
|
code: c.invalid_type,
|
|
2536
2536
|
expected: u.nan,
|
|
2537
|
-
received:
|
|
2538
|
-
}),
|
|
2537
|
+
received: n.parsedType
|
|
2538
|
+
}), p;
|
|
2539
2539
|
}
|
|
2540
2540
|
return { status: "valid", value: e.data };
|
|
2541
2541
|
}
|
|
2542
2542
|
}
|
|
2543
|
-
|
|
2544
|
-
typeName:
|
|
2543
|
+
_e.create = (r) => new _e({
|
|
2544
|
+
typeName: m.ZodNaN,
|
|
2545
2545
|
...y(r)
|
|
2546
2546
|
});
|
|
2547
2547
|
const rt = Symbol("zod_brand");
|
|
2548
|
-
class
|
|
2548
|
+
class Ee extends _ {
|
|
2549
2549
|
_parse(e) {
|
|
2550
|
-
const { ctx: t } = this._processInputParams(e),
|
|
2550
|
+
const { ctx: t } = this._processInputParams(e), n = t.data;
|
|
2551
2551
|
return this._def.type._parse({
|
|
2552
|
-
data:
|
|
2552
|
+
data: n,
|
|
2553
2553
|
path: t.path,
|
|
2554
2554
|
parent: t
|
|
2555
2555
|
});
|
|
@@ -2558,35 +2558,35 @@ class Ie extends v {
|
|
|
2558
2558
|
return this._def.type;
|
|
2559
2559
|
}
|
|
2560
2560
|
}
|
|
2561
|
-
class oe extends
|
|
2561
|
+
class oe extends _ {
|
|
2562
2562
|
_parse(e) {
|
|
2563
|
-
const { status: t, ctx:
|
|
2564
|
-
if (
|
|
2563
|
+
const { status: t, ctx: n } = this._processInputParams(e);
|
|
2564
|
+
if (n.common.async)
|
|
2565
2565
|
return (async () => {
|
|
2566
2566
|
const a = await this._def.in._parseAsync({
|
|
2567
|
-
data:
|
|
2568
|
-
path:
|
|
2569
|
-
parent:
|
|
2567
|
+
data: n.data,
|
|
2568
|
+
path: n.path,
|
|
2569
|
+
parent: n
|
|
2570
2570
|
});
|
|
2571
|
-
return a.status === "aborted" ?
|
|
2571
|
+
return a.status === "aborted" ? p : a.status === "dirty" ? (t.dirty(), Oe(a.value)) : this._def.out._parseAsync({
|
|
2572
2572
|
data: a.value,
|
|
2573
|
-
path:
|
|
2574
|
-
parent:
|
|
2573
|
+
path: n.path,
|
|
2574
|
+
parent: n
|
|
2575
2575
|
});
|
|
2576
2576
|
})();
|
|
2577
2577
|
{
|
|
2578
|
-
const
|
|
2579
|
-
data:
|
|
2580
|
-
path:
|
|
2581
|
-
parent:
|
|
2578
|
+
const s = this._def.in._parseSync({
|
|
2579
|
+
data: n.data,
|
|
2580
|
+
path: n.path,
|
|
2581
|
+
parent: n
|
|
2582
2582
|
});
|
|
2583
|
-
return
|
|
2583
|
+
return s.status === "aborted" ? p : s.status === "dirty" ? (t.dirty(), {
|
|
2584
2584
|
status: "dirty",
|
|
2585
|
-
value:
|
|
2585
|
+
value: s.value
|
|
2586
2586
|
}) : this._def.out._parseSync({
|
|
2587
|
-
data:
|
|
2588
|
-
path:
|
|
2589
|
-
parent:
|
|
2587
|
+
data: s.value,
|
|
2588
|
+
path: n.path,
|
|
2589
|
+
parent: n
|
|
2590
2590
|
});
|
|
2591
2591
|
}
|
|
2592
2592
|
}
|
|
@@ -2594,38 +2594,38 @@ class oe extends v {
|
|
|
2594
2594
|
return new oe({
|
|
2595
2595
|
in: e,
|
|
2596
2596
|
out: t,
|
|
2597
|
-
typeName:
|
|
2597
|
+
typeName: m.ZodPipeline
|
|
2598
2598
|
});
|
|
2599
2599
|
}
|
|
2600
2600
|
}
|
|
2601
|
-
class
|
|
2601
|
+
class ve extends _ {
|
|
2602
2602
|
_parse(e) {
|
|
2603
2603
|
const t = this._def.innerType._parse(e);
|
|
2604
2604
|
return X(t) && (t.value = Object.freeze(t.value)), t;
|
|
2605
2605
|
}
|
|
2606
2606
|
}
|
|
2607
|
-
|
|
2607
|
+
ve.create = (r, e) => new ve({
|
|
2608
2608
|
innerType: r,
|
|
2609
|
-
typeName:
|
|
2609
|
+
typeName: m.ZodReadonly,
|
|
2610
2610
|
...y(e)
|
|
2611
2611
|
});
|
|
2612
|
-
const Re = (r, e = {}, t) => r ?
|
|
2612
|
+
const Re = (r, e = {}, t) => r ? J.create().superRefine((n, s) => {
|
|
2613
2613
|
var a, i;
|
|
2614
|
-
if (!r(
|
|
2615
|
-
const o = typeof e == "function" ? e(
|
|
2616
|
-
|
|
2614
|
+
if (!r(n)) {
|
|
2615
|
+
const o = typeof e == "function" ? e(n) : typeof e == "string" ? { message: e } : e, f = (i = (a = o.fatal) !== null && a !== void 0 ? a : t) !== null && i !== void 0 ? i : !0, d = typeof o == "string" ? { message: o } : o;
|
|
2616
|
+
s.addIssue({ code: "custom", ...d, fatal: f });
|
|
2617
2617
|
}
|
|
2618
|
-
}) :
|
|
2618
|
+
}) : J.create(), nt = {
|
|
2619
2619
|
object: b.lazycreate
|
|
2620
2620
|
};
|
|
2621
|
-
var
|
|
2621
|
+
var m;
|
|
2622
2622
|
(function(r) {
|
|
2623
2623
|
r.ZodString = "ZodString", r.ZodNumber = "ZodNumber", r.ZodNaN = "ZodNaN", r.ZodBigInt = "ZodBigInt", r.ZodBoolean = "ZodBoolean", r.ZodDate = "ZodDate", r.ZodSymbol = "ZodSymbol", r.ZodUndefined = "ZodUndefined", r.ZodNull = "ZodNull", r.ZodAny = "ZodAny", r.ZodUnknown = "ZodUnknown", r.ZodNever = "ZodNever", r.ZodVoid = "ZodVoid", r.ZodArray = "ZodArray", r.ZodObject = "ZodObject", r.ZodUnion = "ZodUnion", r.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", r.ZodIntersection = "ZodIntersection", r.ZodTuple = "ZodTuple", r.ZodRecord = "ZodRecord", r.ZodMap = "ZodMap", r.ZodSet = "ZodSet", r.ZodFunction = "ZodFunction", r.ZodLazy = "ZodLazy", r.ZodLiteral = "ZodLiteral", r.ZodEnum = "ZodEnum", r.ZodEffects = "ZodEffects", r.ZodNativeEnum = "ZodNativeEnum", r.ZodOptional = "ZodOptional", r.ZodNullable = "ZodNullable", r.ZodDefault = "ZodDefault", r.ZodCatch = "ZodCatch", r.ZodPromise = "ZodPromise", r.ZodBranded = "ZodBranded", r.ZodPipeline = "ZodPipeline", r.ZodReadonly = "ZodReadonly";
|
|
2624
|
-
})(
|
|
2625
|
-
const
|
|
2624
|
+
})(m || (m = {}));
|
|
2625
|
+
const st = (r, e = {
|
|
2626
2626
|
message: `Input not instance of ${r.name}`
|
|
2627
|
-
}) => Re((t) => t instanceof r, e), je =
|
|
2628
|
-
string: (r) =>
|
|
2627
|
+
}) => Re((t) => t instanceof r, e), je = O.create, Ae = V.create, at = _e.create, it = $.create, Me = Q.create, ot = U.create, ct = he.create, dt = K.create, ut = F.create, lt = J.create, ft = D.create, ht = z.create, mt = me.create, pt = E.create, yt = b.create, _t = b.strictCreate, vt = ee.create, gt = ge.create, xt = te.create, bt = A.create, kt = re.create, wt = pe.create, Tt = B.create, Zt = Y.create, St = ne.create, Nt = se.create, Ct = L.create, Ot = ae.create, It = G.create, Ne = R.create, Et = M.create, Rt = q.create, jt = R.createWithPreprocess, At = oe.create, Mt = () => je().optional(), zt = () => Ae().optional(), Pt = () => Me().optional(), Vt = {
|
|
2628
|
+
string: (r) => O.create({ ...r, coerce: !0 }),
|
|
2629
2629
|
number: (r) => V.create({ ...r, coerce: !0 }),
|
|
2630
2630
|
boolean: (r) => Q.create({
|
|
2631
2631
|
...r,
|
|
@@ -2633,33 +2633,33 @@ const nt = (r, e = {
|
|
|
2633
2633
|
}),
|
|
2634
2634
|
bigint: (r) => $.create({ ...r, coerce: !0 }),
|
|
2635
2635
|
date: (r) => U.create({ ...r, coerce: !0 })
|
|
2636
|
-
}, $t =
|
|
2637
|
-
var
|
|
2636
|
+
}, $t = p;
|
|
2637
|
+
var N = /* @__PURE__ */ Object.freeze({
|
|
2638
2638
|
__proto__: null,
|
|
2639
|
-
defaultErrorMap:
|
|
2639
|
+
defaultErrorMap: H,
|
|
2640
2640
|
setErrorMap: Be,
|
|
2641
2641
|
getErrorMap: ue,
|
|
2642
2642
|
makeIssue: le,
|
|
2643
2643
|
EMPTY_PATH: qe,
|
|
2644
2644
|
addIssueToContext: l,
|
|
2645
2645
|
ParseStatus: Z,
|
|
2646
|
-
INVALID:
|
|
2647
|
-
DIRTY:
|
|
2646
|
+
INVALID: p,
|
|
2647
|
+
DIRTY: Oe,
|
|
2648
2648
|
OK: S,
|
|
2649
2649
|
isAborted: ke,
|
|
2650
2650
|
isDirty: we,
|
|
2651
2651
|
isValid: X,
|
|
2652
2652
|
isAsync: fe,
|
|
2653
2653
|
get util() {
|
|
2654
|
-
return
|
|
2654
|
+
return x;
|
|
2655
2655
|
},
|
|
2656
2656
|
get objectUtil() {
|
|
2657
2657
|
return be;
|
|
2658
2658
|
},
|
|
2659
2659
|
ZodParsedType: u,
|
|
2660
2660
|
getParsedType: P,
|
|
2661
|
-
ZodType:
|
|
2662
|
-
ZodString:
|
|
2661
|
+
ZodType: _,
|
|
2662
|
+
ZodString: O,
|
|
2663
2663
|
ZodNumber: V,
|
|
2664
2664
|
ZodBigInt: $,
|
|
2665
2665
|
ZodBoolean: Q,
|
|
@@ -2667,60 +2667,60 @@ var C = /* @__PURE__ */ Object.freeze({
|
|
|
2667
2667
|
ZodSymbol: he,
|
|
2668
2668
|
ZodUndefined: K,
|
|
2669
2669
|
ZodNull: F,
|
|
2670
|
-
ZodAny:
|
|
2670
|
+
ZodAny: J,
|
|
2671
2671
|
ZodUnknown: D,
|
|
2672
2672
|
ZodNever: z,
|
|
2673
|
-
ZodVoid:
|
|
2674
|
-
ZodArray:
|
|
2673
|
+
ZodVoid: me,
|
|
2674
|
+
ZodArray: E,
|
|
2675
2675
|
ZodObject: b,
|
|
2676
2676
|
ZodUnion: ee,
|
|
2677
2677
|
ZodDiscriminatedUnion: ge,
|
|
2678
2678
|
ZodIntersection: te,
|
|
2679
2679
|
ZodTuple: A,
|
|
2680
2680
|
ZodRecord: re,
|
|
2681
|
-
ZodMap:
|
|
2681
|
+
ZodMap: pe,
|
|
2682
2682
|
ZodSet: B,
|
|
2683
|
-
ZodFunction:
|
|
2684
|
-
ZodLazy:
|
|
2685
|
-
ZodLiteral:
|
|
2683
|
+
ZodFunction: Y,
|
|
2684
|
+
ZodLazy: ne,
|
|
2685
|
+
ZodLiteral: se,
|
|
2686
2686
|
ZodEnum: L,
|
|
2687
2687
|
ZodNativeEnum: ae,
|
|
2688
|
-
ZodPromise:
|
|
2688
|
+
ZodPromise: G,
|
|
2689
2689
|
ZodEffects: R,
|
|
2690
2690
|
ZodTransformer: R,
|
|
2691
2691
|
ZodOptional: M,
|
|
2692
2692
|
ZodNullable: q,
|
|
2693
2693
|
ZodDefault: ie,
|
|
2694
2694
|
ZodCatch: ye,
|
|
2695
|
-
ZodNaN:
|
|
2695
|
+
ZodNaN: _e,
|
|
2696
2696
|
BRAND: rt,
|
|
2697
|
-
ZodBranded:
|
|
2697
|
+
ZodBranded: Ee,
|
|
2698
2698
|
ZodPipeline: oe,
|
|
2699
|
-
ZodReadonly:
|
|
2699
|
+
ZodReadonly: ve,
|
|
2700
2700
|
custom: Re,
|
|
2701
|
-
Schema:
|
|
2702
|
-
ZodSchema:
|
|
2703
|
-
late:
|
|
2701
|
+
Schema: _,
|
|
2702
|
+
ZodSchema: _,
|
|
2703
|
+
late: nt,
|
|
2704
2704
|
get ZodFirstPartyTypeKind() {
|
|
2705
|
-
return
|
|
2705
|
+
return m;
|
|
2706
2706
|
},
|
|
2707
2707
|
coerce: Vt,
|
|
2708
2708
|
any: lt,
|
|
2709
|
-
array:
|
|
2709
|
+
array: pt,
|
|
2710
2710
|
bigint: it,
|
|
2711
2711
|
boolean: Me,
|
|
2712
2712
|
date: ot,
|
|
2713
2713
|
discriminatedUnion: gt,
|
|
2714
|
-
effect:
|
|
2715
|
-
enum:
|
|
2714
|
+
effect: Ne,
|
|
2715
|
+
enum: Ct,
|
|
2716
2716
|
function: Zt,
|
|
2717
|
-
instanceof:
|
|
2717
|
+
instanceof: st,
|
|
2718
2718
|
intersection: xt,
|
|
2719
2719
|
lazy: St,
|
|
2720
|
-
literal:
|
|
2720
|
+
literal: Nt,
|
|
2721
2721
|
map: wt,
|
|
2722
2722
|
nan: at,
|
|
2723
|
-
nativeEnum:
|
|
2723
|
+
nativeEnum: Ot,
|
|
2724
2724
|
never: ht,
|
|
2725
2725
|
null: ut,
|
|
2726
2726
|
nullable: Rt,
|
|
@@ -2728,55 +2728,55 @@ var C = /* @__PURE__ */ Object.freeze({
|
|
|
2728
2728
|
object: yt,
|
|
2729
2729
|
oboolean: Pt,
|
|
2730
2730
|
onumber: zt,
|
|
2731
|
-
optional:
|
|
2731
|
+
optional: Et,
|
|
2732
2732
|
ostring: Mt,
|
|
2733
2733
|
pipeline: At,
|
|
2734
2734
|
preprocess: jt,
|
|
2735
|
-
promise:
|
|
2735
|
+
promise: It,
|
|
2736
2736
|
record: kt,
|
|
2737
2737
|
set: Tt,
|
|
2738
|
-
strictObject:
|
|
2738
|
+
strictObject: _t,
|
|
2739
2739
|
string: je,
|
|
2740
2740
|
symbol: ct,
|
|
2741
|
-
transformer:
|
|
2741
|
+
transformer: Ne,
|
|
2742
2742
|
tuple: bt,
|
|
2743
2743
|
undefined: dt,
|
|
2744
|
-
union:
|
|
2744
|
+
union: vt,
|
|
2745
2745
|
unknown: ft,
|
|
2746
|
-
void:
|
|
2746
|
+
void: mt,
|
|
2747
2747
|
NEVER: $t,
|
|
2748
2748
|
ZodIssueCode: c,
|
|
2749
2749
|
quotelessJson: Ue,
|
|
2750
|
-
ZodError:
|
|
2750
|
+
ZodError: I
|
|
2751
2751
|
});
|
|
2752
2752
|
const Wt = () => {
|
|
2753
|
-
const { formValidationTexts: r } = $e(Ve), e = (
|
|
2753
|
+
const { formValidationTexts: r } = $e(Ve), e = (g) => (g != null && g.useCoerce ? N.coerce : N).string({
|
|
2754
2754
|
invalid_type_error: r.required
|
|
2755
|
-
}).transform((w) => w ?? null), t = (
|
|
2755
|
+
}).transform((w) => w ?? null), t = (g) => e(g).nullable().optional().transform((k) => k ?? null), n = (g) => (g != null && g.useCoerce ? N.coerce : N).number({
|
|
2756
2756
|
invalid_type_error: r.required
|
|
2757
|
-
}).transform((w) => w ?? null),
|
|
2757
|
+
}).min((g == null ? void 0 : g.min) ?? Number.NEGATIVE_INFINITY).max((g == null ? void 0 : g.max) ?? Number.POSITIVE_INFINITY).transform((w) => w ?? null), s = (g) => n(g).nullable().optional().transform((k) => k ?? null), a = (g) => (g != null && g.useCoerce ? N.coerce : N).boolean({
|
|
2758
2758
|
invalid_type_error: r.required
|
|
2759
|
-
}).transform((k) => k ?? null), i = (
|
|
2759
|
+
}).transform((k) => k ?? null), i = (g) => (g != null && g.useCoerce ? N.coerce : N).string({ invalid_type_error: r.required }).refine(De, { message: r.invalidDate }).transform((w) => w ?? null), o = (g) => i(g).nullable().transform((k) => k ?? null), f = (g, k) => N.enum(g, { invalid_type_error: r.required }).transform((Ze) => Ze ?? null);
|
|
2760
2760
|
return {
|
|
2761
2761
|
zString: t,
|
|
2762
2762
|
zStringRequired: e,
|
|
2763
|
-
zNumber:
|
|
2764
|
-
zNumberRequired:
|
|
2763
|
+
zNumber: s,
|
|
2764
|
+
zNumberRequired: n,
|
|
2765
2765
|
zBool: a,
|
|
2766
2766
|
zDate: o,
|
|
2767
2767
|
zDateRequired: i,
|
|
2768
|
-
zEnum: (
|
|
2768
|
+
zEnum: (g, k) => f(g).nullable().transform((w) => w ?? null),
|
|
2769
2769
|
zEnumRequired: f,
|
|
2770
|
-
zObjectIdInt: (
|
|
2771
|
-
zObjectIdIntRequired: (
|
|
2772
|
-
zObjectIdStr: (
|
|
2773
|
-
zObjectIdStrRequired: (
|
|
2774
|
-
zFile: ({ required:
|
|
2770
|
+
zObjectIdInt: (g) => N.object({ id: s({ useCoerce: !0 }) }).nullable().transform((w) => w ?? null),
|
|
2771
|
+
zObjectIdIntRequired: (g) => N.object({ id: n() }).transform((w) => w ?? null),
|
|
2772
|
+
zObjectIdStr: (g) => N.object({ id: t({ useCoerce: !0 }) }).nullable().transform((w) => w ?? null),
|
|
2773
|
+
zObjectIdStrRequired: (g) => N.object({ id: e() }).transform((w) => w ?? null),
|
|
2774
|
+
zFile: ({ required: g, multiple: k, maxFileSize: w }) => N.any().transform((T) => Array.from(T ?? [])).refine((T) => !g || (T == null ? void 0 : T.length) > 0, "File is required.").refine((T) => k || (T == null ? void 0 : T.length) <= 1, "Multiple files not allowed.").refine((T) => T.every((Pe) => Pe.size <= w), `Maximum file size is ${Le(w)}.`).transform((T) => (k ? T : T == null ? void 0 : T[0]) ?? null)
|
|
2775
2775
|
};
|
|
2776
2776
|
};
|
|
2777
2777
|
export {
|
|
2778
|
-
|
|
2779
|
-
|
|
2778
|
+
Gt as cancelToken,
|
|
2779
|
+
Ht as useAuth,
|
|
2780
2780
|
Xt as useAxios,
|
|
2781
2781
|
rr as useClickOutside,
|
|
2782
2782
|
Ft as useConfirm,
|