react-luminus-components 1.2.1 → 1.2.2
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 +41 -41
- package/dist/{DataKey-CLYT9XGM.cjs → DataKey-CBMsR50b.cjs} +1 -1
- package/dist/{DataKey-CPc1_-be.js → DataKey-CBV-NBJf.js} +1 -1
- package/dist/{SimpleTooltip-rgKvGQAh.cjs → SimpleTooltip-D6DtiDiF.cjs} +1 -1
- package/dist/{SimpleTooltip-EPgkOstR.js → SimpleTooltip-DxazAlXp.js} +1 -1
- package/dist/{Typography-PSv7V5A1.js → Typography-CHfAgqP5.js} +1 -1
- package/dist/{Typography-C9GM_GzV.cjs → Typography-ni7LYA_5.cjs} +1 -1
- package/dist/{UserAvatarToggle-CIQXhmcN.js → UserAvatarToggle-B-BYsINz.js} +1798 -1787
- package/dist/UserAvatarToggle-cPWBMa9z.cjs +253 -0
- package/dist/components/Tabs/Tabs.d.ts +2 -2
- package/dist/components/common/PhotoLightbox/PhotoLightbox.d.ts +1 -1
- package/dist/contexts.cjs.js +1 -1
- package/dist/contexts.es.js +171 -173
- package/dist/hooks.cjs.js +1 -1
- package/dist/hooks.es.js +783 -655
- package/dist/layout.cjs.js +1 -1
- package/dist/layout.es.js +3 -3
- package/dist/main.cjs.js +1 -1
- package/dist/main.es.js +1626 -1621
- package/dist/style.css +1 -1
- package/dist/{useConfirm-CrF2KHR-.cjs → useConfirm-BC-OkqG0.cjs} +1 -1
- package/dist/{useConfirm-C_gZ96ka.js → useConfirm-CkSyQrSF.js} +1 -1
- package/dist/utils.cjs.js +1 -1
- package/dist/utils.es.js +7 -7
- package/package.json +1 -1
- package/dist/UserAvatarToggle-DmBqBnvE.cjs +0 -250
package/dist/hooks.es.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { L as
|
|
2
|
-
import { d as
|
|
3
|
-
import { u as
|
|
4
|
-
import { useContext as
|
|
5
|
-
import { f as
|
|
6
|
-
import { isISODate as
|
|
7
|
-
import { u as
|
|
1
|
+
import { L as We } from "./UserAvatarToggle-B-BYsINz.js";
|
|
2
|
+
import { d as ar, u as ir, b as or, a as dr } from "./UserAvatarToggle-B-BYsINz.js";
|
|
3
|
+
import { u as ur, a as lr } from "./useConfirm-CkSyQrSF.js";
|
|
4
|
+
import { useContext as Ye } from "react";
|
|
5
|
+
import { f as Je } from "./textUtils-BLtD0zaS.js";
|
|
6
|
+
import { isISODate as He } from "./utils.es.js";
|
|
7
|
+
import { u as hr } from "./useClickOutside-BjJyGTec.js";
|
|
8
8
|
var x;
|
|
9
9
|
(function(r) {
|
|
10
10
|
r.assertEqual = (s) => s;
|
|
@@ -41,15 +41,15 @@ var x;
|
|
|
41
41
|
}
|
|
42
42
|
r.joinValues = n, r.jsonStringifyReplacer = (s, a) => typeof a == "bigint" ? a.toString() : a;
|
|
43
43
|
})(x || (x = {}));
|
|
44
|
-
var
|
|
44
|
+
var Se;
|
|
45
45
|
(function(r) {
|
|
46
46
|
r.mergeShapes = (e, t) => ({
|
|
47
47
|
...e,
|
|
48
48
|
...t
|
|
49
49
|
// second overwrites first
|
|
50
50
|
});
|
|
51
|
-
})(
|
|
52
|
-
const
|
|
51
|
+
})(Se || (Se = {}));
|
|
52
|
+
const f = x.arrayToEnum([
|
|
53
53
|
"string",
|
|
54
54
|
"nan",
|
|
55
55
|
"number",
|
|
@@ -73,25 +73,25 @@ const u = x.arrayToEnum([
|
|
|
73
73
|
]), P = (r) => {
|
|
74
74
|
switch (typeof r) {
|
|
75
75
|
case "undefined":
|
|
76
|
-
return
|
|
76
|
+
return f.undefined;
|
|
77
77
|
case "string":
|
|
78
|
-
return
|
|
78
|
+
return f.string;
|
|
79
79
|
case "number":
|
|
80
|
-
return isNaN(r) ?
|
|
80
|
+
return isNaN(r) ? f.nan : f.number;
|
|
81
81
|
case "boolean":
|
|
82
|
-
return
|
|
82
|
+
return f.boolean;
|
|
83
83
|
case "function":
|
|
84
|
-
return
|
|
84
|
+
return f.function;
|
|
85
85
|
case "bigint":
|
|
86
|
-
return
|
|
86
|
+
return f.bigint;
|
|
87
87
|
case "symbol":
|
|
88
|
-
return
|
|
88
|
+
return f.symbol;
|
|
89
89
|
case "object":
|
|
90
|
-
return Array.isArray(r) ?
|
|
90
|
+
return Array.isArray(r) ? f.array : r === null ? f.null : r.then && typeof r.then == "function" && r.catch && typeof r.catch == "function" ? f.promise : typeof Map < "u" && r instanceof Map ? f.map : typeof Set < "u" && r instanceof Set ? f.set : typeof Date < "u" && r instanceof Date ? f.date : f.object;
|
|
91
91
|
default:
|
|
92
|
-
return
|
|
92
|
+
return f.unknown;
|
|
93
93
|
}
|
|
94
|
-
},
|
|
94
|
+
}, d = x.arrayToEnum([
|
|
95
95
|
"invalid_type",
|
|
96
96
|
"invalid_literal",
|
|
97
97
|
"custom",
|
|
@@ -108,8 +108,8 @@ const u = x.arrayToEnum([
|
|
|
108
108
|
"invalid_intersection_types",
|
|
109
109
|
"not_multiple_of",
|
|
110
110
|
"not_finite"
|
|
111
|
-
]),
|
|
112
|
-
class
|
|
111
|
+
]), Ge = (r) => JSON.stringify(r, null, 2).replace(/"([^"]+)":/g, "$1:");
|
|
112
|
+
class O extends Error {
|
|
113
113
|
constructor(e) {
|
|
114
114
|
super(), this.issues = [], this.addIssue = (n) => {
|
|
115
115
|
this.issues = [...this.issues, n];
|
|
@@ -136,15 +136,19 @@ class I extends Error {
|
|
|
136
136
|
else if (i.path.length === 0)
|
|
137
137
|
n._errors.push(t(i));
|
|
138
138
|
else {
|
|
139
|
-
let o = n,
|
|
140
|
-
for (;
|
|
141
|
-
const
|
|
142
|
-
|
|
139
|
+
let o = n, u = 0;
|
|
140
|
+
for (; u < i.path.length; ) {
|
|
141
|
+
const c = i.path[u];
|
|
142
|
+
u === i.path.length - 1 ? (o[c] = o[c] || { _errors: [] }, o[c]._errors.push(t(i))) : o[c] = o[c] || { _errors: [] }, o = o[c], u++;
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
};
|
|
146
146
|
return s(this), n;
|
|
147
147
|
}
|
|
148
|
+
static assert(e) {
|
|
149
|
+
if (!(e instanceof O))
|
|
150
|
+
throw new Error(`Not a ZodError: ${e}`);
|
|
151
|
+
}
|
|
148
152
|
toString() {
|
|
149
153
|
return this.message;
|
|
150
154
|
}
|
|
@@ -164,56 +168,56 @@ class I extends Error {
|
|
|
164
168
|
return this.flatten();
|
|
165
169
|
}
|
|
166
170
|
}
|
|
167
|
-
|
|
168
|
-
const
|
|
171
|
+
O.create = (r) => new O(r);
|
|
172
|
+
const G = (r, e) => {
|
|
169
173
|
let t;
|
|
170
174
|
switch (r.code) {
|
|
171
|
-
case
|
|
172
|
-
r.received ===
|
|
175
|
+
case d.invalid_type:
|
|
176
|
+
r.received === f.undefined ? t = "Required" : t = `Expected ${r.expected}, received ${r.received}`;
|
|
173
177
|
break;
|
|
174
|
-
case
|
|
178
|
+
case d.invalid_literal:
|
|
175
179
|
t = `Invalid literal value, expected ${JSON.stringify(r.expected, x.jsonStringifyReplacer)}`;
|
|
176
180
|
break;
|
|
177
|
-
case
|
|
181
|
+
case d.unrecognized_keys:
|
|
178
182
|
t = `Unrecognized key(s) in object: ${x.joinValues(r.keys, ", ")}`;
|
|
179
183
|
break;
|
|
180
|
-
case
|
|
184
|
+
case d.invalid_union:
|
|
181
185
|
t = "Invalid input";
|
|
182
186
|
break;
|
|
183
|
-
case
|
|
187
|
+
case d.invalid_union_discriminator:
|
|
184
188
|
t = `Invalid discriminator value. Expected ${x.joinValues(r.options)}`;
|
|
185
189
|
break;
|
|
186
|
-
case
|
|
190
|
+
case d.invalid_enum_value:
|
|
187
191
|
t = `Invalid enum value. Expected ${x.joinValues(r.options)}, received '${r.received}'`;
|
|
188
192
|
break;
|
|
189
|
-
case
|
|
193
|
+
case d.invalid_arguments:
|
|
190
194
|
t = "Invalid function arguments";
|
|
191
195
|
break;
|
|
192
|
-
case
|
|
196
|
+
case d.invalid_return_type:
|
|
193
197
|
t = "Invalid function return type";
|
|
194
198
|
break;
|
|
195
|
-
case
|
|
199
|
+
case d.invalid_date:
|
|
196
200
|
t = "Invalid date";
|
|
197
201
|
break;
|
|
198
|
-
case
|
|
202
|
+
case d.invalid_string:
|
|
199
203
|
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
204
|
break;
|
|
201
|
-
case
|
|
205
|
+
case d.too_small:
|
|
202
206
|
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";
|
|
203
207
|
break;
|
|
204
|
-
case
|
|
208
|
+
case d.too_big:
|
|
205
209
|
r.type === "array" ? t = `Array must contain ${r.exact ? "exactly" : r.inclusive ? "at most" : "less than"} ${r.maximum} element(s)` : r.type === "string" ? t = `String must contain ${r.exact ? "exactly" : r.inclusive ? "at most" : "under"} ${r.maximum} character(s)` : r.type === "number" ? t = `Number must be ${r.exact ? "exactly" : r.inclusive ? "less than or equal to" : "less than"} ${r.maximum}` : r.type === "bigint" ? t = `BigInt must be ${r.exact ? "exactly" : r.inclusive ? "less than or equal to" : "less than"} ${r.maximum}` : r.type === "date" ? t = `Date must be ${r.exact ? "exactly" : r.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(r.maximum))}` : t = "Invalid input";
|
|
206
210
|
break;
|
|
207
|
-
case
|
|
211
|
+
case d.custom:
|
|
208
212
|
t = "Invalid input";
|
|
209
213
|
break;
|
|
210
|
-
case
|
|
214
|
+
case d.invalid_intersection_types:
|
|
211
215
|
t = "Intersection results could not be merged";
|
|
212
216
|
break;
|
|
213
|
-
case
|
|
217
|
+
case d.not_multiple_of:
|
|
214
218
|
t = `Number must be a multiple of ${r.multipleOf}`;
|
|
215
219
|
break;
|
|
216
|
-
case
|
|
220
|
+
case d.not_finite:
|
|
217
221
|
t = "Number must be finite";
|
|
218
222
|
break;
|
|
219
223
|
default:
|
|
@@ -221,42 +225,48 @@ const H = (r, e) => {
|
|
|
221
225
|
}
|
|
222
226
|
return { message: t };
|
|
223
227
|
};
|
|
224
|
-
let
|
|
225
|
-
function
|
|
226
|
-
|
|
228
|
+
let Ae = G;
|
|
229
|
+
function Xe(r) {
|
|
230
|
+
Ae = r;
|
|
227
231
|
}
|
|
228
|
-
function
|
|
229
|
-
return
|
|
232
|
+
function ye() {
|
|
233
|
+
return Ae;
|
|
230
234
|
}
|
|
231
|
-
const
|
|
235
|
+
const _e = (r) => {
|
|
232
236
|
const { data: e, path: t, errorMaps: n, issueData: s } = r, a = [...t, ...s.path || []], i = {
|
|
233
237
|
...s,
|
|
234
238
|
path: a
|
|
235
239
|
};
|
|
240
|
+
if (s.message !== void 0)
|
|
241
|
+
return {
|
|
242
|
+
...s,
|
|
243
|
+
path: a,
|
|
244
|
+
message: s.message
|
|
245
|
+
};
|
|
236
246
|
let o = "";
|
|
237
|
-
const
|
|
238
|
-
for (const
|
|
239
|
-
o =
|
|
247
|
+
const u = n.filter((c) => !!c).slice().reverse();
|
|
248
|
+
for (const c of u)
|
|
249
|
+
o = c(i, { data: e, defaultError: o }).message;
|
|
240
250
|
return {
|
|
241
251
|
...s,
|
|
242
252
|
path: a,
|
|
243
|
-
message:
|
|
253
|
+
message: o
|
|
244
254
|
};
|
|
245
|
-
},
|
|
255
|
+
}, Qe = [];
|
|
246
256
|
function l(r, e) {
|
|
247
|
-
const t =
|
|
257
|
+
const t = ye(), n = _e({
|
|
248
258
|
issueData: e,
|
|
249
259
|
data: r.data,
|
|
250
260
|
path: r.path,
|
|
251
261
|
errorMaps: [
|
|
252
262
|
r.common.contextualErrorMap,
|
|
253
263
|
r.schemaErrorMap,
|
|
254
|
-
|
|
255
|
-
|
|
264
|
+
t,
|
|
265
|
+
t === G ? void 0 : G
|
|
256
266
|
// then global default map
|
|
257
|
-
].filter((
|
|
267
|
+
].filter((s) => !!s)
|
|
258
268
|
});
|
|
259
|
-
r.common.issues.push(
|
|
269
|
+
r.common.issues.push(n);
|
|
260
270
|
}
|
|
261
271
|
class Z {
|
|
262
272
|
constructor() {
|
|
@@ -279,11 +289,13 @@ class Z {
|
|
|
279
289
|
}
|
|
280
290
|
static async mergeObjectAsync(e, t) {
|
|
281
291
|
const n = [];
|
|
282
|
-
for (const s of t)
|
|
292
|
+
for (const s of t) {
|
|
293
|
+
const a = await s.key, i = await s.value;
|
|
283
294
|
n.push({
|
|
284
|
-
key:
|
|
285
|
-
value:
|
|
295
|
+
key: a,
|
|
296
|
+
value: i
|
|
286
297
|
});
|
|
298
|
+
}
|
|
287
299
|
return Z.mergeObjectSync(e, n);
|
|
288
300
|
}
|
|
289
301
|
static mergeObjectSync(e, t) {
|
|
@@ -299,12 +311,23 @@ class Z {
|
|
|
299
311
|
}
|
|
300
312
|
const p = Object.freeze({
|
|
301
313
|
status: "aborted"
|
|
302
|
-
}),
|
|
314
|
+
}), J = (r) => ({ status: "dirty", value: r }), S = (r) => ({ status: "valid", value: r }), Ce = (r) => r.status === "aborted", Ne = (r) => r.status === "dirty", ee = (r) => r.status === "valid", te = (r) => typeof Promise < "u" && r instanceof Promise;
|
|
315
|
+
function ve(r, e, t, n) {
|
|
316
|
+
if (typeof e == "function" ? r !== e || !n : !e.has(r))
|
|
317
|
+
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
318
|
+
return e.get(r);
|
|
319
|
+
}
|
|
320
|
+
function Me(r, e, t, n, s) {
|
|
321
|
+
if (typeof e == "function" ? r !== e || !s : !e.has(r))
|
|
322
|
+
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
323
|
+
return e.set(r, t), t;
|
|
324
|
+
}
|
|
303
325
|
var h;
|
|
304
326
|
(function(r) {
|
|
305
327
|
r.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, r.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
|
|
306
328
|
})(h || (h = {}));
|
|
307
|
-
|
|
329
|
+
var K, F;
|
|
330
|
+
class A {
|
|
308
331
|
constructor(e, t, n, s) {
|
|
309
332
|
this._cachedPath = [], this.parent = e, this.data = t, this._path = n, this._key = s;
|
|
310
333
|
}
|
|
@@ -312,8 +335,8 @@ class j {
|
|
|
312
335
|
return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
|
|
313
336
|
}
|
|
314
337
|
}
|
|
315
|
-
const
|
|
316
|
-
if (
|
|
338
|
+
const Re = (r, e) => {
|
|
339
|
+
if (ee(e))
|
|
317
340
|
return { success: !0, data: e.value };
|
|
318
341
|
if (!r.common.issues.length)
|
|
319
342
|
throw new Error("Validation failed but no issues detected.");
|
|
@@ -322,20 +345,24 @@ const Se = (r, e) => {
|
|
|
322
345
|
get error() {
|
|
323
346
|
if (this._error)
|
|
324
347
|
return this._error;
|
|
325
|
-
const t = new
|
|
348
|
+
const t = new O(r.common.issues);
|
|
326
349
|
return this._error = t, this._error;
|
|
327
350
|
}
|
|
328
351
|
};
|
|
329
352
|
};
|
|
330
|
-
function
|
|
353
|
+
function _(r) {
|
|
331
354
|
if (!r)
|
|
332
355
|
return {};
|
|
333
356
|
const { errorMap: e, invalid_type_error: t, required_error: n, description: s } = r;
|
|
334
357
|
if (e && (t || n))
|
|
335
358
|
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
336
|
-
return e ? { errorMap: e, description: s } : { errorMap: (i, o) =>
|
|
359
|
+
return e ? { errorMap: e, description: s } : { errorMap: (i, o) => {
|
|
360
|
+
var u, c;
|
|
361
|
+
const { message: y } = r;
|
|
362
|
+
return i.code === "invalid_enum_value" ? { message: y ?? o.defaultError } : typeof o.data > "u" ? { message: (u = y ?? n) !== null && u !== void 0 ? u : o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: (c = y ?? t) !== null && c !== void 0 ? c : o.defaultError };
|
|
363
|
+
}, description: s };
|
|
337
364
|
}
|
|
338
|
-
class
|
|
365
|
+
class v {
|
|
339
366
|
constructor(e) {
|
|
340
367
|
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
368
|
}
|
|
@@ -370,7 +397,7 @@ class _ {
|
|
|
370
397
|
}
|
|
371
398
|
_parseSync(e) {
|
|
372
399
|
const t = this._parse(e);
|
|
373
|
-
if (
|
|
400
|
+
if (te(t))
|
|
374
401
|
throw new Error("Synchronous parse encountered promise.");
|
|
375
402
|
return t;
|
|
376
403
|
}
|
|
@@ -398,7 +425,7 @@ class _ {
|
|
|
398
425
|
data: e,
|
|
399
426
|
parsedType: P(e)
|
|
400
427
|
}, a = this._parseSync({ data: e, path: s.path, parent: s });
|
|
401
|
-
return
|
|
428
|
+
return Re(s, a);
|
|
402
429
|
}
|
|
403
430
|
async parseAsync(e, t) {
|
|
404
431
|
const n = await this.safeParseAsync(e, t);
|
|
@@ -418,17 +445,17 @@ class _ {
|
|
|
418
445
|
parent: null,
|
|
419
446
|
data: e,
|
|
420
447
|
parsedType: P(e)
|
|
421
|
-
}, s = this._parse({ data: e, path: n.path, parent: n }), a = await (
|
|
422
|
-
return
|
|
448
|
+
}, s = this._parse({ data: e, path: n.path, parent: n }), a = await (te(s) ? s : Promise.resolve(s));
|
|
449
|
+
return Re(n, a);
|
|
423
450
|
}
|
|
424
451
|
refine(e, t) {
|
|
425
452
|
const n = (s) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(s) : t;
|
|
426
453
|
return this._refinement((s, a) => {
|
|
427
454
|
const i = e(s), o = () => a.addIssue({
|
|
428
|
-
code:
|
|
455
|
+
code: d.custom,
|
|
429
456
|
...n(s)
|
|
430
457
|
});
|
|
431
|
-
return typeof Promise < "u" && i instanceof Promise ? i.then((
|
|
458
|
+
return typeof Promise < "u" && i instanceof Promise ? i.then((u) => u ? !0 : (o(), !1)) : i ? !0 : (o(), !1);
|
|
432
459
|
});
|
|
433
460
|
}
|
|
434
461
|
refinement(e, t) {
|
|
@@ -445,29 +472,29 @@ class _ {
|
|
|
445
472
|
return this._refinement(e);
|
|
446
473
|
}
|
|
447
474
|
optional() {
|
|
448
|
-
return
|
|
475
|
+
return j.create(this, this._def);
|
|
449
476
|
}
|
|
450
477
|
nullable() {
|
|
451
|
-
return
|
|
478
|
+
return U.create(this, this._def);
|
|
452
479
|
}
|
|
453
480
|
nullish() {
|
|
454
481
|
return this.nullable().optional();
|
|
455
482
|
}
|
|
456
483
|
array() {
|
|
457
|
-
return
|
|
484
|
+
return I.create(this, this._def);
|
|
458
485
|
}
|
|
459
486
|
promise() {
|
|
460
|
-
return
|
|
487
|
+
return Q.create(this, this._def);
|
|
461
488
|
}
|
|
462
489
|
or(e) {
|
|
463
|
-
return
|
|
490
|
+
return ae.create([this, e], this._def);
|
|
464
491
|
}
|
|
465
492
|
and(e) {
|
|
466
|
-
return
|
|
493
|
+
return ie.create(this, e, this._def);
|
|
467
494
|
}
|
|
468
495
|
transform(e) {
|
|
469
496
|
return new R({
|
|
470
|
-
...
|
|
497
|
+
..._(this._def),
|
|
471
498
|
schema: this,
|
|
472
499
|
typeName: m.ZodEffects,
|
|
473
500
|
effect: { type: "transform", transform: e }
|
|
@@ -475,8 +502,8 @@ class _ {
|
|
|
475
502
|
}
|
|
476
503
|
default(e) {
|
|
477
504
|
const t = typeof e == "function" ? e : () => e;
|
|
478
|
-
return new
|
|
479
|
-
...
|
|
505
|
+
return new le({
|
|
506
|
+
..._(this._def),
|
|
480
507
|
innerType: this,
|
|
481
508
|
defaultValue: t,
|
|
482
509
|
typeName: m.ZodDefault
|
|
@@ -486,13 +513,13 @@ class _ {
|
|
|
486
513
|
return new Ee({
|
|
487
514
|
typeName: m.ZodBranded,
|
|
488
515
|
type: this,
|
|
489
|
-
...
|
|
516
|
+
..._(this._def)
|
|
490
517
|
});
|
|
491
518
|
}
|
|
492
519
|
catch(e) {
|
|
493
520
|
const t = typeof e == "function" ? e : () => e;
|
|
494
|
-
return new
|
|
495
|
-
...
|
|
521
|
+
return new fe({
|
|
522
|
+
..._(this._def),
|
|
496
523
|
innerType: this,
|
|
497
524
|
catchValue: t,
|
|
498
525
|
typeName: m.ZodCatch
|
|
@@ -506,10 +533,10 @@ class _ {
|
|
|
506
533
|
});
|
|
507
534
|
}
|
|
508
535
|
pipe(e) {
|
|
509
|
-
return
|
|
536
|
+
return me.create(this, e);
|
|
510
537
|
}
|
|
511
538
|
readonly() {
|
|
512
|
-
return
|
|
539
|
+
return he.create(this);
|
|
513
540
|
}
|
|
514
541
|
isOptional() {
|
|
515
542
|
return this.safeParse(void 0).success;
|
|
@@ -518,32 +545,40 @@ class _ {
|
|
|
518
545
|
return this.safeParse(null).success;
|
|
519
546
|
}
|
|
520
547
|
}
|
|
521
|
-
const
|
|
522
|
-
let
|
|
523
|
-
const
|
|
524
|
-
function
|
|
525
|
-
|
|
548
|
+
const Ke = /^c[^\s-]{8,}$/i, Fe = /^[0-9a-z]+$/, et = /^[0-9A-HJKMNP-TV-Z]{26}$/, tt = /^[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, rt = /^[a-z0-9_-]{21}$/i, nt = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, st = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, at = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
549
|
+
let Ze;
|
|
550
|
+
const it = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, ot = /^(([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})))$/, dt = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, $e = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", ct = new RegExp(`^${$e}$`);
|
|
551
|
+
function ze(r) {
|
|
552
|
+
let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
|
|
553
|
+
return r.precision ? e = `${e}\\.\\d{${r.precision}}` : r.precision == null && (e = `${e}(\\.\\d+)?`), e;
|
|
554
|
+
}
|
|
555
|
+
function ut(r) {
|
|
556
|
+
return new RegExp(`^${ze(r)}$`);
|
|
557
|
+
}
|
|
558
|
+
function Pe(r) {
|
|
559
|
+
let e = `${$e}T${ze(r)}`;
|
|
560
|
+
const t = [];
|
|
561
|
+
return t.push(r.local ? "Z?" : "Z"), r.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
|
|
562
|
+
}
|
|
563
|
+
function lt(r, e) {
|
|
564
|
+
return !!((e === "v4" || !e) && it.test(r) || (e === "v6" || !e) && ot.test(r));
|
|
526
565
|
}
|
|
527
|
-
class
|
|
566
|
+
class E extends v {
|
|
528
567
|
_parse(e) {
|
|
529
|
-
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !==
|
|
568
|
+
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== f.string) {
|
|
530
569
|
const a = this._getOrReturnCtx(e);
|
|
531
|
-
return l(
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
received: a.parsedType
|
|
537
|
-
}
|
|
538
|
-
//
|
|
539
|
-
), p;
|
|
570
|
+
return l(a, {
|
|
571
|
+
code: d.invalid_type,
|
|
572
|
+
expected: f.string,
|
|
573
|
+
received: a.parsedType
|
|
574
|
+
}), p;
|
|
540
575
|
}
|
|
541
576
|
const n = new Z();
|
|
542
577
|
let s;
|
|
543
578
|
for (const a of this._def.checks)
|
|
544
579
|
if (a.kind === "min")
|
|
545
580
|
e.data.length < a.value && (s = this._getOrReturnCtx(e, s), l(s, {
|
|
546
|
-
code:
|
|
581
|
+
code: d.too_small,
|
|
547
582
|
minimum: a.value,
|
|
548
583
|
type: "string",
|
|
549
584
|
inclusive: !0,
|
|
@@ -552,7 +587,7 @@ class O extends _ {
|
|
|
552
587
|
}), n.dirty());
|
|
553
588
|
else if (a.kind === "max")
|
|
554
589
|
e.data.length > a.value && (s = this._getOrReturnCtx(e, s), l(s, {
|
|
555
|
-
code:
|
|
590
|
+
code: d.too_big,
|
|
556
591
|
maximum: a.value,
|
|
557
592
|
type: "string",
|
|
558
593
|
inclusive: !0,
|
|
@@ -562,14 +597,14 @@ class O extends _ {
|
|
|
562
597
|
else if (a.kind === "length") {
|
|
563
598
|
const i = e.data.length > a.value, o = e.data.length < a.value;
|
|
564
599
|
(i || o) && (s = this._getOrReturnCtx(e, s), i ? l(s, {
|
|
565
|
-
code:
|
|
600
|
+
code: d.too_big,
|
|
566
601
|
maximum: a.value,
|
|
567
602
|
type: "string",
|
|
568
603
|
inclusive: !0,
|
|
569
604
|
exact: !0,
|
|
570
605
|
message: a.message
|
|
571
606
|
}) : o && l(s, {
|
|
572
|
-
code:
|
|
607
|
+
code: d.too_small,
|
|
573
608
|
minimum: a.value,
|
|
574
609
|
type: "string",
|
|
575
610
|
inclusive: !0,
|
|
@@ -577,39 +612,45 @@ class O extends _ {
|
|
|
577
612
|
message: a.message
|
|
578
613
|
}), n.dirty());
|
|
579
614
|
} else if (a.kind === "email")
|
|
580
|
-
|
|
615
|
+
st.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
581
616
|
validation: "email",
|
|
582
|
-
code:
|
|
617
|
+
code: d.invalid_string,
|
|
583
618
|
message: a.message
|
|
584
619
|
}), n.dirty());
|
|
585
620
|
else if (a.kind === "emoji")
|
|
586
|
-
|
|
621
|
+
Ze || (Ze = new RegExp(at, "u")), Ze.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
587
622
|
validation: "emoji",
|
|
588
|
-
code:
|
|
623
|
+
code: d.invalid_string,
|
|
589
624
|
message: a.message
|
|
590
625
|
}), n.dirty());
|
|
591
626
|
else if (a.kind === "uuid")
|
|
592
|
-
|
|
627
|
+
tt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
593
628
|
validation: "uuid",
|
|
594
|
-
code:
|
|
629
|
+
code: d.invalid_string,
|
|
630
|
+
message: a.message
|
|
631
|
+
}), n.dirty());
|
|
632
|
+
else if (a.kind === "nanoid")
|
|
633
|
+
rt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
634
|
+
validation: "nanoid",
|
|
635
|
+
code: d.invalid_string,
|
|
595
636
|
message: a.message
|
|
596
637
|
}), n.dirty());
|
|
597
638
|
else if (a.kind === "cuid")
|
|
598
|
-
|
|
639
|
+
Ke.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
599
640
|
validation: "cuid",
|
|
600
|
-
code:
|
|
641
|
+
code: d.invalid_string,
|
|
601
642
|
message: a.message
|
|
602
643
|
}), n.dirty());
|
|
603
644
|
else if (a.kind === "cuid2")
|
|
604
|
-
|
|
645
|
+
Fe.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
605
646
|
validation: "cuid2",
|
|
606
|
-
code:
|
|
647
|
+
code: d.invalid_string,
|
|
607
648
|
message: a.message
|
|
608
649
|
}), n.dirty());
|
|
609
650
|
else if (a.kind === "ulid")
|
|
610
|
-
|
|
651
|
+
et.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
611
652
|
validation: "ulid",
|
|
612
|
-
code:
|
|
653
|
+
code: d.invalid_string,
|
|
613
654
|
message: a.message
|
|
614
655
|
}), n.dirty());
|
|
615
656
|
else if (a.kind === "url")
|
|
@@ -618,34 +659,50 @@ class O extends _ {
|
|
|
618
659
|
} catch {
|
|
619
660
|
s = this._getOrReturnCtx(e, s), l(s, {
|
|
620
661
|
validation: "url",
|
|
621
|
-
code:
|
|
662
|
+
code: d.invalid_string,
|
|
622
663
|
message: a.message
|
|
623
664
|
}), n.dirty();
|
|
624
665
|
}
|
|
625
666
|
else
|
|
626
667
|
a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
627
668
|
validation: "regex",
|
|
628
|
-
code:
|
|
669
|
+
code: d.invalid_string,
|
|
629
670
|
message: a.message
|
|
630
671
|
}), 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
|
-
code:
|
|
672
|
+
code: d.invalid_string,
|
|
632
673
|
validation: { includes: a.value, position: a.position },
|
|
633
674
|
message: a.message
|
|
634
675
|
}), 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
|
-
code:
|
|
676
|
+
code: d.invalid_string,
|
|
636
677
|
validation: { startsWith: a.value },
|
|
637
678
|
message: a.message
|
|
638
679
|
}), n.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
639
|
-
code:
|
|
680
|
+
code: d.invalid_string,
|
|
640
681
|
validation: { endsWith: a.value },
|
|
641
682
|
message: a.message
|
|
642
|
-
}), n.dirty()) : a.kind === "datetime" ?
|
|
643
|
-
code:
|
|
683
|
+
}), n.dirty()) : a.kind === "datetime" ? Pe(a).test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
684
|
+
code: d.invalid_string,
|
|
644
685
|
validation: "datetime",
|
|
645
686
|
message: a.message
|
|
646
|
-
}), n.dirty()) : a.kind === "
|
|
687
|
+
}), n.dirty()) : a.kind === "date" ? ct.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
688
|
+
code: d.invalid_string,
|
|
689
|
+
validation: "date",
|
|
690
|
+
message: a.message
|
|
691
|
+
}), n.dirty()) : a.kind === "time" ? ut(a).test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
692
|
+
code: d.invalid_string,
|
|
693
|
+
validation: "time",
|
|
694
|
+
message: a.message
|
|
695
|
+
}), n.dirty()) : a.kind === "duration" ? nt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
696
|
+
validation: "duration",
|
|
697
|
+
code: d.invalid_string,
|
|
698
|
+
message: a.message
|
|
699
|
+
}), n.dirty()) : a.kind === "ip" ? lt(e.data, a.version) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
647
700
|
validation: "ip",
|
|
648
|
-
code:
|
|
701
|
+
code: d.invalid_string,
|
|
702
|
+
message: a.message
|
|
703
|
+
}), n.dirty()) : a.kind === "base64" ? dt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
704
|
+
validation: "base64",
|
|
705
|
+
code: d.invalid_string,
|
|
649
706
|
message: a.message
|
|
650
707
|
}), n.dirty()) : x.assertNever(a);
|
|
651
708
|
return { status: n.value, value: e.data };
|
|
@@ -653,12 +710,12 @@ class O extends _ {
|
|
|
653
710
|
_regex(e, t, n) {
|
|
654
711
|
return this.refinement((s) => e.test(s), {
|
|
655
712
|
validation: t,
|
|
656
|
-
code:
|
|
713
|
+
code: d.invalid_string,
|
|
657
714
|
...h.errToObj(n)
|
|
658
715
|
});
|
|
659
716
|
}
|
|
660
717
|
_addCheck(e) {
|
|
661
|
-
return new
|
|
718
|
+
return new E({
|
|
662
719
|
...this._def,
|
|
663
720
|
checks: [...this._def.checks, e]
|
|
664
721
|
});
|
|
@@ -675,6 +732,9 @@ class O extends _ {
|
|
|
675
732
|
uuid(e) {
|
|
676
733
|
return this._addCheck({ kind: "uuid", ...h.errToObj(e) });
|
|
677
734
|
}
|
|
735
|
+
nanoid(e) {
|
|
736
|
+
return this._addCheck({ kind: "nanoid", ...h.errToObj(e) });
|
|
737
|
+
}
|
|
678
738
|
cuid(e) {
|
|
679
739
|
return this._addCheck({ kind: "cuid", ...h.errToObj(e) });
|
|
680
740
|
}
|
|
@@ -684,23 +744,45 @@ class O extends _ {
|
|
|
684
744
|
ulid(e) {
|
|
685
745
|
return this._addCheck({ kind: "ulid", ...h.errToObj(e) });
|
|
686
746
|
}
|
|
747
|
+
base64(e) {
|
|
748
|
+
return this._addCheck({ kind: "base64", ...h.errToObj(e) });
|
|
749
|
+
}
|
|
687
750
|
ip(e) {
|
|
688
751
|
return this._addCheck({ kind: "ip", ...h.errToObj(e) });
|
|
689
752
|
}
|
|
690
753
|
datetime(e) {
|
|
691
|
-
var t;
|
|
754
|
+
var t, n;
|
|
692
755
|
return typeof e == "string" ? this._addCheck({
|
|
693
756
|
kind: "datetime",
|
|
694
757
|
precision: null,
|
|
695
758
|
offset: !1,
|
|
759
|
+
local: !1,
|
|
696
760
|
message: e
|
|
697
761
|
}) : this._addCheck({
|
|
698
762
|
kind: "datetime",
|
|
699
763
|
precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
|
|
700
764
|
offset: (t = e == null ? void 0 : e.offset) !== null && t !== void 0 ? t : !1,
|
|
765
|
+
local: (n = e == null ? void 0 : e.local) !== null && n !== void 0 ? n : !1,
|
|
701
766
|
...h.errToObj(e == null ? void 0 : e.message)
|
|
702
767
|
});
|
|
703
768
|
}
|
|
769
|
+
date(e) {
|
|
770
|
+
return this._addCheck({ kind: "date", message: e });
|
|
771
|
+
}
|
|
772
|
+
time(e) {
|
|
773
|
+
return typeof e == "string" ? this._addCheck({
|
|
774
|
+
kind: "time",
|
|
775
|
+
precision: null,
|
|
776
|
+
message: e
|
|
777
|
+
}) : this._addCheck({
|
|
778
|
+
kind: "time",
|
|
779
|
+
precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
|
|
780
|
+
...h.errToObj(e == null ? void 0 : e.message)
|
|
781
|
+
});
|
|
782
|
+
}
|
|
783
|
+
duration(e) {
|
|
784
|
+
return this._addCheck({ kind: "duration", ...h.errToObj(e) });
|
|
785
|
+
}
|
|
704
786
|
regex(e, t) {
|
|
705
787
|
return this._addCheck({
|
|
706
788
|
kind: "regex",
|
|
@@ -759,19 +841,19 @@ class O extends _ {
|
|
|
759
841
|
return this.min(1, h.errToObj(e));
|
|
760
842
|
}
|
|
761
843
|
trim() {
|
|
762
|
-
return new
|
|
844
|
+
return new E({
|
|
763
845
|
...this._def,
|
|
764
846
|
checks: [...this._def.checks, { kind: "trim" }]
|
|
765
847
|
});
|
|
766
848
|
}
|
|
767
849
|
toLowerCase() {
|
|
768
|
-
return new
|
|
850
|
+
return new E({
|
|
769
851
|
...this._def,
|
|
770
852
|
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
771
853
|
});
|
|
772
854
|
}
|
|
773
855
|
toUpperCase() {
|
|
774
|
-
return new
|
|
856
|
+
return new E({
|
|
775
857
|
...this._def,
|
|
776
858
|
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
777
859
|
});
|
|
@@ -779,6 +861,15 @@ class O extends _ {
|
|
|
779
861
|
get isDatetime() {
|
|
780
862
|
return !!this._def.checks.find((e) => e.kind === "datetime");
|
|
781
863
|
}
|
|
864
|
+
get isDate() {
|
|
865
|
+
return !!this._def.checks.find((e) => e.kind === "date");
|
|
866
|
+
}
|
|
867
|
+
get isTime() {
|
|
868
|
+
return !!this._def.checks.find((e) => e.kind === "time");
|
|
869
|
+
}
|
|
870
|
+
get isDuration() {
|
|
871
|
+
return !!this._def.checks.find((e) => e.kind === "duration");
|
|
872
|
+
}
|
|
782
873
|
get isEmail() {
|
|
783
874
|
return !!this._def.checks.find((e) => e.kind === "email");
|
|
784
875
|
}
|
|
@@ -791,6 +882,9 @@ class O extends _ {
|
|
|
791
882
|
get isUUID() {
|
|
792
883
|
return !!this._def.checks.find((e) => e.kind === "uuid");
|
|
793
884
|
}
|
|
885
|
+
get isNANOID() {
|
|
886
|
+
return !!this._def.checks.find((e) => e.kind === "nanoid");
|
|
887
|
+
}
|
|
794
888
|
get isCUID() {
|
|
795
889
|
return !!this._def.checks.find((e) => e.kind === "cuid");
|
|
796
890
|
}
|
|
@@ -803,6 +897,9 @@ class O extends _ {
|
|
|
803
897
|
get isIP() {
|
|
804
898
|
return !!this._def.checks.find((e) => e.kind === "ip");
|
|
805
899
|
}
|
|
900
|
+
get isBase64() {
|
|
901
|
+
return !!this._def.checks.find((e) => e.kind === "base64");
|
|
902
|
+
}
|
|
806
903
|
get minLength() {
|
|
807
904
|
let e = null;
|
|
808
905
|
for (const t of this._def.checks)
|
|
@@ -816,29 +913,29 @@ class O extends _ {
|
|
|
816
913
|
return e;
|
|
817
914
|
}
|
|
818
915
|
}
|
|
819
|
-
|
|
916
|
+
E.create = (r) => {
|
|
820
917
|
var e;
|
|
821
|
-
return new
|
|
918
|
+
return new E({
|
|
822
919
|
checks: [],
|
|
823
920
|
typeName: m.ZodString,
|
|
824
921
|
coerce: (e = r == null ? void 0 : r.coerce) !== null && e !== void 0 ? e : !1,
|
|
825
|
-
...
|
|
922
|
+
..._(r)
|
|
826
923
|
});
|
|
827
924
|
};
|
|
828
|
-
function
|
|
925
|
+
function ft(r, e) {
|
|
829
926
|
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
927
|
return a % i / Math.pow(10, s);
|
|
831
928
|
}
|
|
832
|
-
class V extends
|
|
929
|
+
class V extends v {
|
|
833
930
|
constructor() {
|
|
834
931
|
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
835
932
|
}
|
|
836
933
|
_parse(e) {
|
|
837
|
-
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !==
|
|
934
|
+
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== f.number) {
|
|
838
935
|
const a = this._getOrReturnCtx(e);
|
|
839
936
|
return l(a, {
|
|
840
|
-
code:
|
|
841
|
-
expected:
|
|
937
|
+
code: d.invalid_type,
|
|
938
|
+
expected: f.number,
|
|
842
939
|
received: a.parsedType
|
|
843
940
|
}), p;
|
|
844
941
|
}
|
|
@@ -846,30 +943,30 @@ class V extends _ {
|
|
|
846
943
|
const s = new Z();
|
|
847
944
|
for (const a of this._def.checks)
|
|
848
945
|
a.kind === "int" ? x.isInteger(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
849
|
-
code:
|
|
946
|
+
code: d.invalid_type,
|
|
850
947
|
expected: "integer",
|
|
851
948
|
received: "float",
|
|
852
949
|
message: a.message
|
|
853
950
|
}), s.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
854
|
-
code:
|
|
951
|
+
code: d.too_small,
|
|
855
952
|
minimum: a.value,
|
|
856
953
|
type: "number",
|
|
857
954
|
inclusive: a.inclusive,
|
|
858
955
|
exact: !1,
|
|
859
956
|
message: a.message
|
|
860
957
|
}), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
861
|
-
code:
|
|
958
|
+
code: d.too_big,
|
|
862
959
|
maximum: a.value,
|
|
863
960
|
type: "number",
|
|
864
961
|
inclusive: a.inclusive,
|
|
865
962
|
exact: !1,
|
|
866
963
|
message: a.message
|
|
867
|
-
}), s.dirty()) : a.kind === "multipleOf" ?
|
|
868
|
-
code:
|
|
964
|
+
}), s.dirty()) : a.kind === "multipleOf" ? ft(e.data, a.value) !== 0 && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
965
|
+
code: d.not_multiple_of,
|
|
869
966
|
multipleOf: a.value,
|
|
870
967
|
message: a.message
|
|
871
968
|
}), s.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
872
|
-
code:
|
|
969
|
+
code: d.not_finite,
|
|
873
970
|
message: a.message
|
|
874
971
|
}), s.dirty()) : x.assertNever(a);
|
|
875
972
|
return { status: s.value, value: e.data };
|
|
@@ -999,18 +1096,18 @@ V.create = (r) => new V({
|
|
|
999
1096
|
checks: [],
|
|
1000
1097
|
typeName: m.ZodNumber,
|
|
1001
1098
|
coerce: (r == null ? void 0 : r.coerce) || !1,
|
|
1002
|
-
...
|
|
1099
|
+
..._(r)
|
|
1003
1100
|
});
|
|
1004
|
-
class
|
|
1101
|
+
class D extends v {
|
|
1005
1102
|
constructor() {
|
|
1006
1103
|
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
1007
1104
|
}
|
|
1008
1105
|
_parse(e) {
|
|
1009
|
-
if (this._def.coerce && (e.data = BigInt(e.data)), this._getType(e) !==
|
|
1106
|
+
if (this._def.coerce && (e.data = BigInt(e.data)), this._getType(e) !== f.bigint) {
|
|
1010
1107
|
const a = this._getOrReturnCtx(e);
|
|
1011
1108
|
return l(a, {
|
|
1012
|
-
code:
|
|
1013
|
-
expected:
|
|
1109
|
+
code: d.invalid_type,
|
|
1110
|
+
expected: f.bigint,
|
|
1014
1111
|
received: a.parsedType
|
|
1015
1112
|
}), p;
|
|
1016
1113
|
}
|
|
@@ -1018,19 +1115,19 @@ class $ extends _ {
|
|
|
1018
1115
|
const s = new Z();
|
|
1019
1116
|
for (const a of this._def.checks)
|
|
1020
1117
|
a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
1021
|
-
code:
|
|
1118
|
+
code: d.too_small,
|
|
1022
1119
|
type: "bigint",
|
|
1023
1120
|
minimum: a.value,
|
|
1024
1121
|
inclusive: a.inclusive,
|
|
1025
1122
|
message: a.message
|
|
1026
1123
|
}), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
1027
|
-
code:
|
|
1124
|
+
code: d.too_big,
|
|
1028
1125
|
type: "bigint",
|
|
1029
1126
|
maximum: a.value,
|
|
1030
1127
|
inclusive: a.inclusive,
|
|
1031
1128
|
message: a.message
|
|
1032
1129
|
}), s.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
1033
|
-
code:
|
|
1130
|
+
code: d.not_multiple_of,
|
|
1034
1131
|
multipleOf: a.value,
|
|
1035
1132
|
message: a.message
|
|
1036
1133
|
}), s.dirty()) : x.assertNever(a);
|
|
@@ -1049,7 +1146,7 @@ class $ extends _ {
|
|
|
1049
1146
|
return this.setLimit("max", e, !1, h.toString(t));
|
|
1050
1147
|
}
|
|
1051
1148
|
setLimit(e, t, n, s) {
|
|
1052
|
-
return new
|
|
1149
|
+
return new D({
|
|
1053
1150
|
...this._def,
|
|
1054
1151
|
checks: [
|
|
1055
1152
|
...this._def.checks,
|
|
@@ -1063,7 +1160,7 @@ class $ extends _ {
|
|
|
1063
1160
|
});
|
|
1064
1161
|
}
|
|
1065
1162
|
_addCheck(e) {
|
|
1066
|
-
return new
|
|
1163
|
+
return new D({
|
|
1067
1164
|
...this._def,
|
|
1068
1165
|
checks: [...this._def.checks, e]
|
|
1069
1166
|
});
|
|
@@ -1120,61 +1217,61 @@ class $ extends _ {
|
|
|
1120
1217
|
return e;
|
|
1121
1218
|
}
|
|
1122
1219
|
}
|
|
1123
|
-
|
|
1220
|
+
D.create = (r) => {
|
|
1124
1221
|
var e;
|
|
1125
|
-
return new
|
|
1222
|
+
return new D({
|
|
1126
1223
|
checks: [],
|
|
1127
1224
|
typeName: m.ZodBigInt,
|
|
1128
1225
|
coerce: (e = r == null ? void 0 : r.coerce) !== null && e !== void 0 ? e : !1,
|
|
1129
|
-
...
|
|
1226
|
+
..._(r)
|
|
1130
1227
|
});
|
|
1131
1228
|
};
|
|
1132
|
-
class
|
|
1229
|
+
class re extends v {
|
|
1133
1230
|
_parse(e) {
|
|
1134
|
-
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !==
|
|
1231
|
+
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== f.boolean) {
|
|
1135
1232
|
const n = this._getOrReturnCtx(e);
|
|
1136
1233
|
return l(n, {
|
|
1137
|
-
code:
|
|
1138
|
-
expected:
|
|
1234
|
+
code: d.invalid_type,
|
|
1235
|
+
expected: f.boolean,
|
|
1139
1236
|
received: n.parsedType
|
|
1140
1237
|
}), p;
|
|
1141
1238
|
}
|
|
1142
1239
|
return S(e.data);
|
|
1143
1240
|
}
|
|
1144
1241
|
}
|
|
1145
|
-
|
|
1242
|
+
re.create = (r) => new re({
|
|
1146
1243
|
typeName: m.ZodBoolean,
|
|
1147
1244
|
coerce: (r == null ? void 0 : r.coerce) || !1,
|
|
1148
|
-
...
|
|
1245
|
+
..._(r)
|
|
1149
1246
|
});
|
|
1150
|
-
class
|
|
1247
|
+
class q extends v {
|
|
1151
1248
|
_parse(e) {
|
|
1152
|
-
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !==
|
|
1249
|
+
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== f.date) {
|
|
1153
1250
|
const a = this._getOrReturnCtx(e);
|
|
1154
1251
|
return l(a, {
|
|
1155
|
-
code:
|
|
1156
|
-
expected:
|
|
1252
|
+
code: d.invalid_type,
|
|
1253
|
+
expected: f.date,
|
|
1157
1254
|
received: a.parsedType
|
|
1158
1255
|
}), p;
|
|
1159
1256
|
}
|
|
1160
1257
|
if (isNaN(e.data.getTime())) {
|
|
1161
1258
|
const a = this._getOrReturnCtx(e);
|
|
1162
1259
|
return l(a, {
|
|
1163
|
-
code:
|
|
1260
|
+
code: d.invalid_date
|
|
1164
1261
|
}), p;
|
|
1165
1262
|
}
|
|
1166
1263
|
const n = new Z();
|
|
1167
1264
|
let s;
|
|
1168
1265
|
for (const a of this._def.checks)
|
|
1169
1266
|
a.kind === "min" ? e.data.getTime() < a.value && (s = this._getOrReturnCtx(e, s), l(s, {
|
|
1170
|
-
code:
|
|
1267
|
+
code: d.too_small,
|
|
1171
1268
|
message: a.message,
|
|
1172
1269
|
inclusive: !0,
|
|
1173
1270
|
exact: !1,
|
|
1174
1271
|
minimum: a.value,
|
|
1175
1272
|
type: "date"
|
|
1176
1273
|
}), n.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (s = this._getOrReturnCtx(e, s), l(s, {
|
|
1177
|
-
code:
|
|
1274
|
+
code: d.too_big,
|
|
1178
1275
|
message: a.message,
|
|
1179
1276
|
inclusive: !0,
|
|
1180
1277
|
exact: !1,
|
|
@@ -1187,7 +1284,7 @@ class U extends _ {
|
|
|
1187
1284
|
};
|
|
1188
1285
|
}
|
|
1189
1286
|
_addCheck(e) {
|
|
1190
|
-
return new
|
|
1287
|
+
return new q({
|
|
1191
1288
|
...this._def,
|
|
1192
1289
|
checks: [...this._def.checks, e]
|
|
1193
1290
|
});
|
|
@@ -1219,64 +1316,64 @@ class U extends _ {
|
|
|
1219
1316
|
return e != null ? new Date(e) : null;
|
|
1220
1317
|
}
|
|
1221
1318
|
}
|
|
1222
|
-
|
|
1319
|
+
q.create = (r) => new q({
|
|
1223
1320
|
checks: [],
|
|
1224
1321
|
coerce: (r == null ? void 0 : r.coerce) || !1,
|
|
1225
1322
|
typeName: m.ZodDate,
|
|
1226
|
-
...
|
|
1323
|
+
..._(r)
|
|
1227
1324
|
});
|
|
1228
|
-
class
|
|
1325
|
+
class ge extends v {
|
|
1229
1326
|
_parse(e) {
|
|
1230
|
-
if (this._getType(e) !==
|
|
1327
|
+
if (this._getType(e) !== f.symbol) {
|
|
1231
1328
|
const n = this._getOrReturnCtx(e);
|
|
1232
1329
|
return l(n, {
|
|
1233
|
-
code:
|
|
1234
|
-
expected:
|
|
1330
|
+
code: d.invalid_type,
|
|
1331
|
+
expected: f.symbol,
|
|
1235
1332
|
received: n.parsedType
|
|
1236
1333
|
}), p;
|
|
1237
1334
|
}
|
|
1238
1335
|
return S(e.data);
|
|
1239
1336
|
}
|
|
1240
1337
|
}
|
|
1241
|
-
|
|
1338
|
+
ge.create = (r) => new ge({
|
|
1242
1339
|
typeName: m.ZodSymbol,
|
|
1243
|
-
...
|
|
1340
|
+
..._(r)
|
|
1244
1341
|
});
|
|
1245
|
-
class
|
|
1342
|
+
class ne extends v {
|
|
1246
1343
|
_parse(e) {
|
|
1247
|
-
if (this._getType(e) !==
|
|
1344
|
+
if (this._getType(e) !== f.undefined) {
|
|
1248
1345
|
const n = this._getOrReturnCtx(e);
|
|
1249
1346
|
return l(n, {
|
|
1250
|
-
code:
|
|
1251
|
-
expected:
|
|
1347
|
+
code: d.invalid_type,
|
|
1348
|
+
expected: f.undefined,
|
|
1252
1349
|
received: n.parsedType
|
|
1253
1350
|
}), p;
|
|
1254
1351
|
}
|
|
1255
1352
|
return S(e.data);
|
|
1256
1353
|
}
|
|
1257
1354
|
}
|
|
1258
|
-
|
|
1355
|
+
ne.create = (r) => new ne({
|
|
1259
1356
|
typeName: m.ZodUndefined,
|
|
1260
|
-
...
|
|
1357
|
+
..._(r)
|
|
1261
1358
|
});
|
|
1262
|
-
class
|
|
1359
|
+
class se extends v {
|
|
1263
1360
|
_parse(e) {
|
|
1264
|
-
if (this._getType(e) !==
|
|
1361
|
+
if (this._getType(e) !== f.null) {
|
|
1265
1362
|
const n = this._getOrReturnCtx(e);
|
|
1266
1363
|
return l(n, {
|
|
1267
|
-
code:
|
|
1268
|
-
expected:
|
|
1364
|
+
code: d.invalid_type,
|
|
1365
|
+
expected: f.null,
|
|
1269
1366
|
received: n.parsedType
|
|
1270
1367
|
}), p;
|
|
1271
1368
|
}
|
|
1272
1369
|
return S(e.data);
|
|
1273
1370
|
}
|
|
1274
1371
|
}
|
|
1275
|
-
|
|
1372
|
+
se.create = (r) => new se({
|
|
1276
1373
|
typeName: m.ZodNull,
|
|
1277
|
-
...
|
|
1374
|
+
..._(r)
|
|
1278
1375
|
});
|
|
1279
|
-
class
|
|
1376
|
+
class X extends v {
|
|
1280
1377
|
constructor() {
|
|
1281
1378
|
super(...arguments), this._any = !0;
|
|
1282
1379
|
}
|
|
@@ -1284,11 +1381,11 @@ class J extends _ {
|
|
|
1284
1381
|
return S(e.data);
|
|
1285
1382
|
}
|
|
1286
1383
|
}
|
|
1287
|
-
|
|
1384
|
+
X.create = (r) => new X({
|
|
1288
1385
|
typeName: m.ZodAny,
|
|
1289
|
-
...
|
|
1386
|
+
..._(r)
|
|
1290
1387
|
});
|
|
1291
|
-
class
|
|
1388
|
+
class B extends v {
|
|
1292
1389
|
constructor() {
|
|
1293
1390
|
super(...arguments), this._unknown = !0;
|
|
1294
1391
|
}
|
|
@@ -1296,54 +1393,54 @@ class D extends _ {
|
|
|
1296
1393
|
return S(e.data);
|
|
1297
1394
|
}
|
|
1298
1395
|
}
|
|
1299
|
-
|
|
1396
|
+
B.create = (r) => new B({
|
|
1300
1397
|
typeName: m.ZodUnknown,
|
|
1301
|
-
...
|
|
1398
|
+
..._(r)
|
|
1302
1399
|
});
|
|
1303
|
-
class z extends
|
|
1400
|
+
class z extends v {
|
|
1304
1401
|
_parse(e) {
|
|
1305
1402
|
const t = this._getOrReturnCtx(e);
|
|
1306
1403
|
return l(t, {
|
|
1307
|
-
code:
|
|
1308
|
-
expected:
|
|
1404
|
+
code: d.invalid_type,
|
|
1405
|
+
expected: f.never,
|
|
1309
1406
|
received: t.parsedType
|
|
1310
1407
|
}), p;
|
|
1311
1408
|
}
|
|
1312
1409
|
}
|
|
1313
1410
|
z.create = (r) => new z({
|
|
1314
1411
|
typeName: m.ZodNever,
|
|
1315
|
-
...
|
|
1412
|
+
..._(r)
|
|
1316
1413
|
});
|
|
1317
|
-
class
|
|
1414
|
+
class xe extends v {
|
|
1318
1415
|
_parse(e) {
|
|
1319
|
-
if (this._getType(e) !==
|
|
1416
|
+
if (this._getType(e) !== f.undefined) {
|
|
1320
1417
|
const n = this._getOrReturnCtx(e);
|
|
1321
1418
|
return l(n, {
|
|
1322
|
-
code:
|
|
1323
|
-
expected:
|
|
1419
|
+
code: d.invalid_type,
|
|
1420
|
+
expected: f.void,
|
|
1324
1421
|
received: n.parsedType
|
|
1325
1422
|
}), p;
|
|
1326
1423
|
}
|
|
1327
1424
|
return S(e.data);
|
|
1328
1425
|
}
|
|
1329
1426
|
}
|
|
1330
|
-
|
|
1427
|
+
xe.create = (r) => new xe({
|
|
1331
1428
|
typeName: m.ZodVoid,
|
|
1332
|
-
...
|
|
1429
|
+
..._(r)
|
|
1333
1430
|
});
|
|
1334
|
-
class
|
|
1431
|
+
class I extends v {
|
|
1335
1432
|
_parse(e) {
|
|
1336
1433
|
const { ctx: t, status: n } = this._processInputParams(e), s = this._def;
|
|
1337
|
-
if (t.parsedType !==
|
|
1434
|
+
if (t.parsedType !== f.array)
|
|
1338
1435
|
return l(t, {
|
|
1339
|
-
code:
|
|
1340
|
-
expected:
|
|
1436
|
+
code: d.invalid_type,
|
|
1437
|
+
expected: f.array,
|
|
1341
1438
|
received: t.parsedType
|
|
1342
1439
|
}), p;
|
|
1343
1440
|
if (s.exactLength !== null) {
|
|
1344
1441
|
const i = t.data.length > s.exactLength.value, o = t.data.length < s.exactLength.value;
|
|
1345
1442
|
(i || o) && (l(t, {
|
|
1346
|
-
code: i ?
|
|
1443
|
+
code: i ? d.too_big : d.too_small,
|
|
1347
1444
|
minimum: o ? s.exactLength.value : void 0,
|
|
1348
1445
|
maximum: i ? s.exactLength.value : void 0,
|
|
1349
1446
|
type: "array",
|
|
@@ -1353,41 +1450,41 @@ class E extends _ {
|
|
|
1353
1450
|
}), n.dirty());
|
|
1354
1451
|
}
|
|
1355
1452
|
if (s.minLength !== null && t.data.length < s.minLength.value && (l(t, {
|
|
1356
|
-
code:
|
|
1453
|
+
code: d.too_small,
|
|
1357
1454
|
minimum: s.minLength.value,
|
|
1358
1455
|
type: "array",
|
|
1359
1456
|
inclusive: !0,
|
|
1360
1457
|
exact: !1,
|
|
1361
1458
|
message: s.minLength.message
|
|
1362
1459
|
}), n.dirty()), s.maxLength !== null && t.data.length > s.maxLength.value && (l(t, {
|
|
1363
|
-
code:
|
|
1460
|
+
code: d.too_big,
|
|
1364
1461
|
maximum: s.maxLength.value,
|
|
1365
1462
|
type: "array",
|
|
1366
1463
|
inclusive: !0,
|
|
1367
1464
|
exact: !1,
|
|
1368
1465
|
message: s.maxLength.message
|
|
1369
1466
|
}), n.dirty()), t.common.async)
|
|
1370
|
-
return Promise.all([...t.data].map((i, o) => s.type._parseAsync(new
|
|
1371
|
-
const a = [...t.data].map((i, o) => s.type._parseSync(new
|
|
1467
|
+
return Promise.all([...t.data].map((i, o) => s.type._parseAsync(new A(t, i, t.path, o)))).then((i) => Z.mergeArray(n, i));
|
|
1468
|
+
const a = [...t.data].map((i, o) => s.type._parseSync(new A(t, i, t.path, o)));
|
|
1372
1469
|
return Z.mergeArray(n, a);
|
|
1373
1470
|
}
|
|
1374
1471
|
get element() {
|
|
1375
1472
|
return this._def.type;
|
|
1376
1473
|
}
|
|
1377
1474
|
min(e, t) {
|
|
1378
|
-
return new
|
|
1475
|
+
return new I({
|
|
1379
1476
|
...this._def,
|
|
1380
1477
|
minLength: { value: e, message: h.toString(t) }
|
|
1381
1478
|
});
|
|
1382
1479
|
}
|
|
1383
1480
|
max(e, t) {
|
|
1384
|
-
return new
|
|
1481
|
+
return new I({
|
|
1385
1482
|
...this._def,
|
|
1386
1483
|
maxLength: { value: e, message: h.toString(t) }
|
|
1387
1484
|
});
|
|
1388
1485
|
}
|
|
1389
1486
|
length(e, t) {
|
|
1390
|
-
return new
|
|
1487
|
+
return new I({
|
|
1391
1488
|
...this._def,
|
|
1392
1489
|
exactLength: { value: e, message: h.toString(t) }
|
|
1393
1490
|
});
|
|
@@ -1396,32 +1493,32 @@ class E extends _ {
|
|
|
1396
1493
|
return this.min(1, e);
|
|
1397
1494
|
}
|
|
1398
1495
|
}
|
|
1399
|
-
|
|
1496
|
+
I.create = (r, e) => new I({
|
|
1400
1497
|
type: r,
|
|
1401
1498
|
minLength: null,
|
|
1402
1499
|
maxLength: null,
|
|
1403
1500
|
exactLength: null,
|
|
1404
1501
|
typeName: m.ZodArray,
|
|
1405
|
-
...
|
|
1502
|
+
..._(e)
|
|
1406
1503
|
});
|
|
1407
|
-
function
|
|
1408
|
-
if (r instanceof
|
|
1504
|
+
function Y(r) {
|
|
1505
|
+
if (r instanceof k) {
|
|
1409
1506
|
const e = {};
|
|
1410
1507
|
for (const t in r.shape) {
|
|
1411
1508
|
const n = r.shape[t];
|
|
1412
|
-
e[t] =
|
|
1509
|
+
e[t] = j.create(Y(n));
|
|
1413
1510
|
}
|
|
1414
|
-
return new
|
|
1511
|
+
return new k({
|
|
1415
1512
|
...r._def,
|
|
1416
1513
|
shape: () => e
|
|
1417
1514
|
});
|
|
1418
1515
|
} else
|
|
1419
|
-
return r instanceof
|
|
1516
|
+
return r instanceof I ? new I({
|
|
1420
1517
|
...r._def,
|
|
1421
|
-
type:
|
|
1422
|
-
}) : r instanceof
|
|
1518
|
+
type: Y(r.element)
|
|
1519
|
+
}) : r instanceof j ? j.create(Y(r.unwrap())) : r instanceof U ? U.create(Y(r.unwrap())) : r instanceof M ? M.create(r.items.map((e) => Y(e))) : r;
|
|
1423
1520
|
}
|
|
1424
|
-
class
|
|
1521
|
+
class k extends v {
|
|
1425
1522
|
constructor() {
|
|
1426
1523
|
super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
|
|
1427
1524
|
}
|
|
@@ -1432,97 +1529,97 @@ class b extends _ {
|
|
|
1432
1529
|
return this._cached = { shape: e, keys: t };
|
|
1433
1530
|
}
|
|
1434
1531
|
_parse(e) {
|
|
1435
|
-
if (this._getType(e) !==
|
|
1436
|
-
const
|
|
1437
|
-
return l(
|
|
1438
|
-
code:
|
|
1439
|
-
expected:
|
|
1440
|
-
received:
|
|
1532
|
+
if (this._getType(e) !== f.object) {
|
|
1533
|
+
const c = this._getOrReturnCtx(e);
|
|
1534
|
+
return l(c, {
|
|
1535
|
+
code: d.invalid_type,
|
|
1536
|
+
expected: f.object,
|
|
1537
|
+
received: c.parsedType
|
|
1441
1538
|
}), p;
|
|
1442
1539
|
}
|
|
1443
1540
|
const { status: n, ctx: s } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), o = [];
|
|
1444
1541
|
if (!(this._def.catchall instanceof z && this._def.unknownKeys === "strip"))
|
|
1445
|
-
for (const
|
|
1446
|
-
i.includes(
|
|
1447
|
-
const
|
|
1448
|
-
for (const
|
|
1449
|
-
const
|
|
1450
|
-
|
|
1451
|
-
key: { status: "valid", value:
|
|
1452
|
-
value:
|
|
1453
|
-
alwaysSet:
|
|
1542
|
+
for (const c in s.data)
|
|
1543
|
+
i.includes(c) || o.push(c);
|
|
1544
|
+
const u = [];
|
|
1545
|
+
for (const c of i) {
|
|
1546
|
+
const y = a[c], N = s.data[c];
|
|
1547
|
+
u.push({
|
|
1548
|
+
key: { status: "valid", value: c },
|
|
1549
|
+
value: y._parse(new A(s, N, s.path, c)),
|
|
1550
|
+
alwaysSet: c in s.data
|
|
1454
1551
|
});
|
|
1455
1552
|
}
|
|
1456
1553
|
if (this._def.catchall instanceof z) {
|
|
1457
|
-
const
|
|
1458
|
-
if (
|
|
1459
|
-
for (const
|
|
1460
|
-
|
|
1461
|
-
key: { status: "valid", value:
|
|
1462
|
-
value: { status: "valid", value: s.data[
|
|
1554
|
+
const c = this._def.unknownKeys;
|
|
1555
|
+
if (c === "passthrough")
|
|
1556
|
+
for (const y of o)
|
|
1557
|
+
u.push({
|
|
1558
|
+
key: { status: "valid", value: y },
|
|
1559
|
+
value: { status: "valid", value: s.data[y] }
|
|
1463
1560
|
});
|
|
1464
|
-
else if (
|
|
1561
|
+
else if (c === "strict")
|
|
1465
1562
|
o.length > 0 && (l(s, {
|
|
1466
|
-
code:
|
|
1563
|
+
code: d.unrecognized_keys,
|
|
1467
1564
|
keys: o
|
|
1468
1565
|
}), n.dirty());
|
|
1469
|
-
else if (
|
|
1566
|
+
else if (c !== "strip")
|
|
1470
1567
|
throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
1471
1568
|
} else {
|
|
1472
|
-
const
|
|
1473
|
-
for (const
|
|
1474
|
-
const
|
|
1475
|
-
|
|
1476
|
-
key: { status: "valid", value:
|
|
1477
|
-
value:
|
|
1478
|
-
new
|
|
1569
|
+
const c = this._def.catchall;
|
|
1570
|
+
for (const y of o) {
|
|
1571
|
+
const N = s.data[y];
|
|
1572
|
+
u.push({
|
|
1573
|
+
key: { status: "valid", value: y },
|
|
1574
|
+
value: c._parse(
|
|
1575
|
+
new A(s, N, s.path, y)
|
|
1479
1576
|
//, ctx.child(key), value, getParsedType(value)
|
|
1480
1577
|
),
|
|
1481
|
-
alwaysSet:
|
|
1578
|
+
alwaysSet: y in s.data
|
|
1482
1579
|
});
|
|
1483
1580
|
}
|
|
1484
1581
|
}
|
|
1485
1582
|
return s.common.async ? Promise.resolve().then(async () => {
|
|
1486
|
-
const
|
|
1487
|
-
for (const
|
|
1488
|
-
const
|
|
1489
|
-
|
|
1490
|
-
key:
|
|
1491
|
-
value:
|
|
1492
|
-
alwaysSet:
|
|
1583
|
+
const c = [];
|
|
1584
|
+
for (const y of u) {
|
|
1585
|
+
const N = await y.key, Te = await y.value;
|
|
1586
|
+
c.push({
|
|
1587
|
+
key: N,
|
|
1588
|
+
value: Te,
|
|
1589
|
+
alwaysSet: y.alwaysSet
|
|
1493
1590
|
});
|
|
1494
1591
|
}
|
|
1495
|
-
return
|
|
1496
|
-
}).then((
|
|
1592
|
+
return c;
|
|
1593
|
+
}).then((c) => Z.mergeObjectSync(n, c)) : Z.mergeObjectSync(n, u);
|
|
1497
1594
|
}
|
|
1498
1595
|
get shape() {
|
|
1499
1596
|
return this._def.shape();
|
|
1500
1597
|
}
|
|
1501
1598
|
strict(e) {
|
|
1502
|
-
return h.errToObj, new
|
|
1599
|
+
return h.errToObj, new k({
|
|
1503
1600
|
...this._def,
|
|
1504
1601
|
unknownKeys: "strict",
|
|
1505
1602
|
...e !== void 0 ? {
|
|
1506
1603
|
errorMap: (t, n) => {
|
|
1507
1604
|
var s, a, i, o;
|
|
1508
|
-
const
|
|
1605
|
+
const u = (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
1606
|
return t.code === "unrecognized_keys" ? {
|
|
1510
|
-
message: (o = h.errToObj(e).message) !== null && o !== void 0 ? o :
|
|
1607
|
+
message: (o = h.errToObj(e).message) !== null && o !== void 0 ? o : u
|
|
1511
1608
|
} : {
|
|
1512
|
-
message:
|
|
1609
|
+
message: u
|
|
1513
1610
|
};
|
|
1514
1611
|
}
|
|
1515
1612
|
} : {}
|
|
1516
1613
|
});
|
|
1517
1614
|
}
|
|
1518
1615
|
strip() {
|
|
1519
|
-
return new
|
|
1616
|
+
return new k({
|
|
1520
1617
|
...this._def,
|
|
1521
1618
|
unknownKeys: "strip"
|
|
1522
1619
|
});
|
|
1523
1620
|
}
|
|
1524
1621
|
passthrough() {
|
|
1525
|
-
return new
|
|
1622
|
+
return new k({
|
|
1526
1623
|
...this._def,
|
|
1527
1624
|
unknownKeys: "passthrough"
|
|
1528
1625
|
});
|
|
@@ -1545,7 +1642,7 @@ class b extends _ {
|
|
|
1545
1642
|
// }) as any;
|
|
1546
1643
|
// };
|
|
1547
1644
|
extend(e) {
|
|
1548
|
-
return new
|
|
1645
|
+
return new k({
|
|
1549
1646
|
...this._def,
|
|
1550
1647
|
shape: () => ({
|
|
1551
1648
|
...this._def.shape(),
|
|
@@ -1559,7 +1656,7 @@ class b extends _ {
|
|
|
1559
1656
|
* upgrade if you are experiencing issues.
|
|
1560
1657
|
*/
|
|
1561
1658
|
merge(e) {
|
|
1562
|
-
return new
|
|
1659
|
+
return new k({
|
|
1563
1660
|
unknownKeys: e._def.unknownKeys,
|
|
1564
1661
|
catchall: e._def.catchall,
|
|
1565
1662
|
shape: () => ({
|
|
@@ -1629,7 +1726,7 @@ class b extends _ {
|
|
|
1629
1726
|
// return merged;
|
|
1630
1727
|
// }
|
|
1631
1728
|
catchall(e) {
|
|
1632
|
-
return new
|
|
1729
|
+
return new k({
|
|
1633
1730
|
...this._def,
|
|
1634
1731
|
catchall: e
|
|
1635
1732
|
});
|
|
@@ -1638,7 +1735,7 @@ class b extends _ {
|
|
|
1638
1735
|
const t = {};
|
|
1639
1736
|
return x.objectKeys(e).forEach((n) => {
|
|
1640
1737
|
e[n] && this.shape[n] && (t[n] = this.shape[n]);
|
|
1641
|
-
}), new
|
|
1738
|
+
}), new k({
|
|
1642
1739
|
...this._def,
|
|
1643
1740
|
shape: () => t
|
|
1644
1741
|
});
|
|
@@ -1647,7 +1744,7 @@ class b extends _ {
|
|
|
1647
1744
|
const t = {};
|
|
1648
1745
|
return x.objectKeys(this.shape).forEach((n) => {
|
|
1649
1746
|
e[n] || (t[n] = this.shape[n]);
|
|
1650
|
-
}), new
|
|
1747
|
+
}), new k({
|
|
1651
1748
|
...this._def,
|
|
1652
1749
|
shape: () => t
|
|
1653
1750
|
});
|
|
@@ -1656,14 +1753,14 @@ class b extends _ {
|
|
|
1656
1753
|
* @deprecated
|
|
1657
1754
|
*/
|
|
1658
1755
|
deepPartial() {
|
|
1659
|
-
return
|
|
1756
|
+
return Y(this);
|
|
1660
1757
|
}
|
|
1661
1758
|
partial(e) {
|
|
1662
1759
|
const t = {};
|
|
1663
1760
|
return x.objectKeys(this.shape).forEach((n) => {
|
|
1664
1761
|
const s = this.shape[n];
|
|
1665
1762
|
e && !e[n] ? t[n] = s : t[n] = s.optional();
|
|
1666
|
-
}), new
|
|
1763
|
+
}), new k({
|
|
1667
1764
|
...this._def,
|
|
1668
1765
|
shape: () => t
|
|
1669
1766
|
});
|
|
@@ -1675,41 +1772,41 @@ class b extends _ {
|
|
|
1675
1772
|
t[n] = this.shape[n];
|
|
1676
1773
|
else {
|
|
1677
1774
|
let a = this.shape[n];
|
|
1678
|
-
for (; a instanceof
|
|
1775
|
+
for (; a instanceof j; )
|
|
1679
1776
|
a = a._def.innerType;
|
|
1680
1777
|
t[n] = a;
|
|
1681
1778
|
}
|
|
1682
|
-
}), new
|
|
1779
|
+
}), new k({
|
|
1683
1780
|
...this._def,
|
|
1684
1781
|
shape: () => t
|
|
1685
1782
|
});
|
|
1686
1783
|
}
|
|
1687
1784
|
keyof() {
|
|
1688
|
-
return
|
|
1785
|
+
return Ve(x.objectKeys(this.shape));
|
|
1689
1786
|
}
|
|
1690
1787
|
}
|
|
1691
|
-
|
|
1788
|
+
k.create = (r, e) => new k({
|
|
1692
1789
|
shape: () => r,
|
|
1693
1790
|
unknownKeys: "strip",
|
|
1694
1791
|
catchall: z.create(),
|
|
1695
1792
|
typeName: m.ZodObject,
|
|
1696
|
-
...
|
|
1793
|
+
..._(e)
|
|
1697
1794
|
});
|
|
1698
|
-
|
|
1795
|
+
k.strictCreate = (r, e) => new k({
|
|
1699
1796
|
shape: () => r,
|
|
1700
1797
|
unknownKeys: "strict",
|
|
1701
1798
|
catchall: z.create(),
|
|
1702
1799
|
typeName: m.ZodObject,
|
|
1703
|
-
...
|
|
1800
|
+
..._(e)
|
|
1704
1801
|
});
|
|
1705
|
-
|
|
1802
|
+
k.lazycreate = (r, e) => new k({
|
|
1706
1803
|
shape: r,
|
|
1707
1804
|
unknownKeys: "strip",
|
|
1708
1805
|
catchall: z.create(),
|
|
1709
1806
|
typeName: m.ZodObject,
|
|
1710
|
-
...
|
|
1807
|
+
..._(e)
|
|
1711
1808
|
});
|
|
1712
|
-
class
|
|
1809
|
+
class ae extends v {
|
|
1713
1810
|
_parse(e) {
|
|
1714
1811
|
const { ctx: t } = this._processInputParams(e), n = this._def.options;
|
|
1715
1812
|
function s(a) {
|
|
@@ -1719,9 +1816,9 @@ class ee extends _ {
|
|
|
1719
1816
|
for (const o of a)
|
|
1720
1817
|
if (o.result.status === "dirty")
|
|
1721
1818
|
return t.common.issues.push(...o.ctx.common.issues), o.result;
|
|
1722
|
-
const i = a.map((o) => new
|
|
1819
|
+
const i = a.map((o) => new O(o.ctx.common.issues));
|
|
1723
1820
|
return l(t, {
|
|
1724
|
-
code:
|
|
1821
|
+
code: d.invalid_union,
|
|
1725
1822
|
unionErrors: i
|
|
1726
1823
|
}), p;
|
|
1727
1824
|
}
|
|
@@ -1747,28 +1844,28 @@ class ee extends _ {
|
|
|
1747
1844
|
{
|
|
1748
1845
|
let a;
|
|
1749
1846
|
const i = [];
|
|
1750
|
-
for (const
|
|
1751
|
-
const
|
|
1847
|
+
for (const u of n) {
|
|
1848
|
+
const c = {
|
|
1752
1849
|
...t,
|
|
1753
1850
|
common: {
|
|
1754
1851
|
...t.common,
|
|
1755
1852
|
issues: []
|
|
1756
1853
|
},
|
|
1757
1854
|
parent: null
|
|
1758
|
-
},
|
|
1855
|
+
}, y = u._parseSync({
|
|
1759
1856
|
data: t.data,
|
|
1760
1857
|
path: t.path,
|
|
1761
|
-
parent:
|
|
1858
|
+
parent: c
|
|
1762
1859
|
});
|
|
1763
|
-
if (
|
|
1764
|
-
return
|
|
1765
|
-
|
|
1860
|
+
if (y.status === "valid")
|
|
1861
|
+
return y;
|
|
1862
|
+
y.status === "dirty" && !a && (a = { result: y, ctx: c }), c.common.issues.length && i.push(c.common.issues);
|
|
1766
1863
|
}
|
|
1767
1864
|
if (a)
|
|
1768
1865
|
return t.common.issues.push(...a.ctx.common.issues), a.result;
|
|
1769
|
-
const o = i.map((
|
|
1866
|
+
const o = i.map((u) => new O(u));
|
|
1770
1867
|
return l(t, {
|
|
1771
|
-
code:
|
|
1868
|
+
code: d.invalid_union,
|
|
1772
1869
|
unionErrors: o
|
|
1773
1870
|
}), p;
|
|
1774
1871
|
}
|
|
@@ -1777,19 +1874,19 @@ class ee extends _ {
|
|
|
1777
1874
|
return this._def.options;
|
|
1778
1875
|
}
|
|
1779
1876
|
}
|
|
1780
|
-
|
|
1877
|
+
ae.create = (r, e) => new ae({
|
|
1781
1878
|
options: r,
|
|
1782
1879
|
typeName: m.ZodUnion,
|
|
1783
|
-
...
|
|
1880
|
+
..._(e)
|
|
1784
1881
|
});
|
|
1785
|
-
const
|
|
1786
|
-
class
|
|
1882
|
+
const $ = (r) => r instanceof de ? $(r.schema) : r instanceof R ? $(r.innerType()) : r instanceof ce ? [r.value] : r instanceof L ? r.options : r instanceof ue ? x.objectValues(r.enum) : r instanceof le ? $(r._def.innerType) : r instanceof ne ? [void 0] : r instanceof se ? [null] : r instanceof j ? [void 0, ...$(r.unwrap())] : r instanceof U ? [null, ...$(r.unwrap())] : r instanceof Ee || r instanceof he ? $(r.unwrap()) : r instanceof fe ? $(r._def.innerType) : [];
|
|
1883
|
+
class we extends v {
|
|
1787
1884
|
_parse(e) {
|
|
1788
1885
|
const { ctx: t } = this._processInputParams(e);
|
|
1789
|
-
if (t.parsedType !==
|
|
1886
|
+
if (t.parsedType !== f.object)
|
|
1790
1887
|
return l(t, {
|
|
1791
|
-
code:
|
|
1792
|
-
expected:
|
|
1888
|
+
code: d.invalid_type,
|
|
1889
|
+
expected: f.object,
|
|
1793
1890
|
received: t.parsedType
|
|
1794
1891
|
}), p;
|
|
1795
1892
|
const n = this.discriminator, s = t.data[n], a = this.optionsMap.get(s);
|
|
@@ -1802,7 +1899,7 @@ class ge extends _ {
|
|
|
1802
1899
|
path: t.path,
|
|
1803
1900
|
parent: t
|
|
1804
1901
|
}) : (l(t, {
|
|
1805
|
-
code:
|
|
1902
|
+
code: d.invalid_union_discriminator,
|
|
1806
1903
|
options: Array.from(this.optionsMap.keys()),
|
|
1807
1904
|
path: [n]
|
|
1808
1905
|
}), p);
|
|
@@ -1827,8 +1924,8 @@ class ge extends _ {
|
|
|
1827
1924
|
static create(e, t, n) {
|
|
1828
1925
|
const s = /* @__PURE__ */ new Map();
|
|
1829
1926
|
for (const a of t) {
|
|
1830
|
-
const i =
|
|
1831
|
-
if (!i)
|
|
1927
|
+
const i = $(a.shape[e]);
|
|
1928
|
+
if (!i.length)
|
|
1832
1929
|
throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
|
|
1833
1930
|
for (const o of i) {
|
|
1834
1931
|
if (s.has(o))
|
|
@@ -1836,50 +1933,50 @@ class ge extends _ {
|
|
|
1836
1933
|
s.set(o, a);
|
|
1837
1934
|
}
|
|
1838
1935
|
}
|
|
1839
|
-
return new
|
|
1936
|
+
return new we({
|
|
1840
1937
|
typeName: m.ZodDiscriminatedUnion,
|
|
1841
1938
|
discriminator: e,
|
|
1842
1939
|
options: t,
|
|
1843
1940
|
optionsMap: s,
|
|
1844
|
-
...
|
|
1941
|
+
..._(n)
|
|
1845
1942
|
});
|
|
1846
1943
|
}
|
|
1847
1944
|
}
|
|
1848
|
-
function
|
|
1945
|
+
function Oe(r, e) {
|
|
1849
1946
|
const t = P(r), n = P(e);
|
|
1850
1947
|
if (r === e)
|
|
1851
1948
|
return { valid: !0, data: r };
|
|
1852
|
-
if (t ===
|
|
1949
|
+
if (t === f.object && n === f.object) {
|
|
1853
1950
|
const s = x.objectKeys(e), a = x.objectKeys(r).filter((o) => s.indexOf(o) !== -1), i = { ...r, ...e };
|
|
1854
1951
|
for (const o of a) {
|
|
1855
|
-
const
|
|
1856
|
-
if (!
|
|
1952
|
+
const u = Oe(r[o], e[o]);
|
|
1953
|
+
if (!u.valid)
|
|
1857
1954
|
return { valid: !1 };
|
|
1858
|
-
i[o] =
|
|
1955
|
+
i[o] = u.data;
|
|
1859
1956
|
}
|
|
1860
1957
|
return { valid: !0, data: i };
|
|
1861
|
-
} else if (t ===
|
|
1958
|
+
} else if (t === f.array && n === f.array) {
|
|
1862
1959
|
if (r.length !== e.length)
|
|
1863
1960
|
return { valid: !1 };
|
|
1864
1961
|
const s = [];
|
|
1865
1962
|
for (let a = 0; a < r.length; a++) {
|
|
1866
|
-
const i = r[a], o = e[a],
|
|
1867
|
-
if (!
|
|
1963
|
+
const i = r[a], o = e[a], u = Oe(i, o);
|
|
1964
|
+
if (!u.valid)
|
|
1868
1965
|
return { valid: !1 };
|
|
1869
|
-
s.push(
|
|
1966
|
+
s.push(u.data);
|
|
1870
1967
|
}
|
|
1871
1968
|
return { valid: !0, data: s };
|
|
1872
1969
|
} else
|
|
1873
|
-
return t ===
|
|
1970
|
+
return t === f.date && n === f.date && +r == +e ? { valid: !0, data: r } : { valid: !1 };
|
|
1874
1971
|
}
|
|
1875
|
-
class
|
|
1972
|
+
class ie extends v {
|
|
1876
1973
|
_parse(e) {
|
|
1877
1974
|
const { status: t, ctx: n } = this._processInputParams(e), s = (a, i) => {
|
|
1878
|
-
if (
|
|
1975
|
+
if (Ce(a) || Ce(i))
|
|
1879
1976
|
return p;
|
|
1880
|
-
const o =
|
|
1881
|
-
return o.valid ? ((
|
|
1882
|
-
code:
|
|
1977
|
+
const o = Oe(a.value, i.value);
|
|
1978
|
+
return o.valid ? ((Ne(a) || Ne(i)) && t.dirty(), { status: t.value, value: o.data }) : (l(n, {
|
|
1979
|
+
code: d.invalid_intersection_types
|
|
1883
1980
|
}), p);
|
|
1884
1981
|
};
|
|
1885
1982
|
return n.common.async ? Promise.all([
|
|
@@ -1904,39 +2001,39 @@ class te extends _ {
|
|
|
1904
2001
|
}));
|
|
1905
2002
|
}
|
|
1906
2003
|
}
|
|
1907
|
-
|
|
2004
|
+
ie.create = (r, e, t) => new ie({
|
|
1908
2005
|
left: r,
|
|
1909
2006
|
right: e,
|
|
1910
2007
|
typeName: m.ZodIntersection,
|
|
1911
|
-
...
|
|
2008
|
+
..._(t)
|
|
1912
2009
|
});
|
|
1913
|
-
class
|
|
2010
|
+
class M extends v {
|
|
1914
2011
|
_parse(e) {
|
|
1915
2012
|
const { status: t, ctx: n } = this._processInputParams(e);
|
|
1916
|
-
if (n.parsedType !==
|
|
2013
|
+
if (n.parsedType !== f.array)
|
|
1917
2014
|
return l(n, {
|
|
1918
|
-
code:
|
|
1919
|
-
expected:
|
|
2015
|
+
code: d.invalid_type,
|
|
2016
|
+
expected: f.array,
|
|
1920
2017
|
received: n.parsedType
|
|
1921
2018
|
}), p;
|
|
1922
2019
|
if (n.data.length < this._def.items.length)
|
|
1923
2020
|
return l(n, {
|
|
1924
|
-
code:
|
|
2021
|
+
code: d.too_small,
|
|
1925
2022
|
minimum: this._def.items.length,
|
|
1926
2023
|
inclusive: !0,
|
|
1927
2024
|
exact: !1,
|
|
1928
2025
|
type: "array"
|
|
1929
2026
|
}), p;
|
|
1930
2027
|
!this._def.rest && n.data.length > this._def.items.length && (l(n, {
|
|
1931
|
-
code:
|
|
2028
|
+
code: d.too_big,
|
|
1932
2029
|
maximum: this._def.items.length,
|
|
1933
2030
|
inclusive: !0,
|
|
1934
2031
|
exact: !1,
|
|
1935
2032
|
type: "array"
|
|
1936
2033
|
}), t.dirty());
|
|
1937
2034
|
const a = [...n.data].map((i, o) => {
|
|
1938
|
-
const
|
|
1939
|
-
return
|
|
2035
|
+
const u = this._def.items[o] || this._def.rest;
|
|
2036
|
+
return u ? u._parse(new A(n, i, n.path, o)) : null;
|
|
1940
2037
|
}).filter((i) => !!i);
|
|
1941
2038
|
return n.common.async ? Promise.all(a).then((i) => Z.mergeArray(t, i)) : Z.mergeArray(t, a);
|
|
1942
2039
|
}
|
|
@@ -1944,23 +2041,23 @@ class A extends _ {
|
|
|
1944
2041
|
return this._def.items;
|
|
1945
2042
|
}
|
|
1946
2043
|
rest(e) {
|
|
1947
|
-
return new
|
|
2044
|
+
return new M({
|
|
1948
2045
|
...this._def,
|
|
1949
2046
|
rest: e
|
|
1950
2047
|
});
|
|
1951
2048
|
}
|
|
1952
2049
|
}
|
|
1953
|
-
|
|
2050
|
+
M.create = (r, e) => {
|
|
1954
2051
|
if (!Array.isArray(r))
|
|
1955
2052
|
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
1956
|
-
return new
|
|
2053
|
+
return new M({
|
|
1957
2054
|
items: r,
|
|
1958
2055
|
typeName: m.ZodTuple,
|
|
1959
2056
|
rest: null,
|
|
1960
|
-
...
|
|
2057
|
+
..._(e)
|
|
1961
2058
|
});
|
|
1962
2059
|
};
|
|
1963
|
-
class
|
|
2060
|
+
class oe extends v {
|
|
1964
2061
|
get keySchema() {
|
|
1965
2062
|
return this._def.keyType;
|
|
1966
2063
|
}
|
|
@@ -1969,17 +2066,18 @@ class re extends _ {
|
|
|
1969
2066
|
}
|
|
1970
2067
|
_parse(e) {
|
|
1971
2068
|
const { status: t, ctx: n } = this._processInputParams(e);
|
|
1972
|
-
if (n.parsedType !==
|
|
2069
|
+
if (n.parsedType !== f.object)
|
|
1973
2070
|
return l(n, {
|
|
1974
|
-
code:
|
|
1975
|
-
expected:
|
|
2071
|
+
code: d.invalid_type,
|
|
2072
|
+
expected: f.object,
|
|
1976
2073
|
received: n.parsedType
|
|
1977
2074
|
}), p;
|
|
1978
2075
|
const s = [], a = this._def.keyType, i = this._def.valueType;
|
|
1979
2076
|
for (const o in n.data)
|
|
1980
2077
|
s.push({
|
|
1981
|
-
key: a._parse(new
|
|
1982
|
-
value: i._parse(new
|
|
2078
|
+
key: a._parse(new A(n, o, n.path, o)),
|
|
2079
|
+
value: i._parse(new A(n, n.data[o], n.path, o)),
|
|
2080
|
+
alwaysSet: o in n.data
|
|
1983
2081
|
});
|
|
1984
2082
|
return n.common.async ? Z.mergeObjectAsync(t, s) : Z.mergeObjectSync(t, s);
|
|
1985
2083
|
}
|
|
@@ -1987,20 +2085,20 @@ class re extends _ {
|
|
|
1987
2085
|
return this._def.valueType;
|
|
1988
2086
|
}
|
|
1989
2087
|
static create(e, t, n) {
|
|
1990
|
-
return t instanceof
|
|
2088
|
+
return t instanceof v ? new oe({
|
|
1991
2089
|
keyType: e,
|
|
1992
2090
|
valueType: t,
|
|
1993
2091
|
typeName: m.ZodRecord,
|
|
1994
|
-
...
|
|
1995
|
-
}) : new
|
|
1996
|
-
keyType:
|
|
2092
|
+
..._(n)
|
|
2093
|
+
}) : new oe({
|
|
2094
|
+
keyType: E.create(),
|
|
1997
2095
|
valueType: e,
|
|
1998
2096
|
typeName: m.ZodRecord,
|
|
1999
|
-
...
|
|
2097
|
+
..._(t)
|
|
2000
2098
|
});
|
|
2001
2099
|
}
|
|
2002
2100
|
}
|
|
2003
|
-
class
|
|
2101
|
+
class ke extends v {
|
|
2004
2102
|
get keySchema() {
|
|
2005
2103
|
return this._def.keyType;
|
|
2006
2104
|
}
|
|
@@ -2009,64 +2107,64 @@ class pe extends _ {
|
|
|
2009
2107
|
}
|
|
2010
2108
|
_parse(e) {
|
|
2011
2109
|
const { status: t, ctx: n } = this._processInputParams(e);
|
|
2012
|
-
if (n.parsedType !==
|
|
2110
|
+
if (n.parsedType !== f.map)
|
|
2013
2111
|
return l(n, {
|
|
2014
|
-
code:
|
|
2015
|
-
expected:
|
|
2112
|
+
code: d.invalid_type,
|
|
2113
|
+
expected: f.map,
|
|
2016
2114
|
received: n.parsedType
|
|
2017
2115
|
}), p;
|
|
2018
|
-
const s = this._def.keyType, a = this._def.valueType, i = [...n.data.entries()].map(([o,
|
|
2019
|
-
key: s._parse(new
|
|
2020
|
-
value: a._parse(new
|
|
2116
|
+
const s = this._def.keyType, a = this._def.valueType, i = [...n.data.entries()].map(([o, u], c) => ({
|
|
2117
|
+
key: s._parse(new A(n, o, n.path, [c, "key"])),
|
|
2118
|
+
value: a._parse(new A(n, u, n.path, [c, "value"]))
|
|
2021
2119
|
}));
|
|
2022
2120
|
if (n.common.async) {
|
|
2023
2121
|
const o = /* @__PURE__ */ new Map();
|
|
2024
2122
|
return Promise.resolve().then(async () => {
|
|
2025
|
-
for (const
|
|
2026
|
-
const
|
|
2027
|
-
if (
|
|
2123
|
+
for (const u of i) {
|
|
2124
|
+
const c = await u.key, y = await u.value;
|
|
2125
|
+
if (c.status === "aborted" || y.status === "aborted")
|
|
2028
2126
|
return p;
|
|
2029
|
-
(
|
|
2127
|
+
(c.status === "dirty" || y.status === "dirty") && t.dirty(), o.set(c.value, y.value);
|
|
2030
2128
|
}
|
|
2031
2129
|
return { status: t.value, value: o };
|
|
2032
2130
|
});
|
|
2033
2131
|
} else {
|
|
2034
2132
|
const o = /* @__PURE__ */ new Map();
|
|
2035
|
-
for (const
|
|
2036
|
-
const
|
|
2037
|
-
if (
|
|
2133
|
+
for (const u of i) {
|
|
2134
|
+
const c = u.key, y = u.value;
|
|
2135
|
+
if (c.status === "aborted" || y.status === "aborted")
|
|
2038
2136
|
return p;
|
|
2039
|
-
(
|
|
2137
|
+
(c.status === "dirty" || y.status === "dirty") && t.dirty(), o.set(c.value, y.value);
|
|
2040
2138
|
}
|
|
2041
2139
|
return { status: t.value, value: o };
|
|
2042
2140
|
}
|
|
2043
2141
|
}
|
|
2044
2142
|
}
|
|
2045
|
-
|
|
2143
|
+
ke.create = (r, e, t) => new ke({
|
|
2046
2144
|
valueType: e,
|
|
2047
2145
|
keyType: r,
|
|
2048
2146
|
typeName: m.ZodMap,
|
|
2049
|
-
...
|
|
2147
|
+
..._(t)
|
|
2050
2148
|
});
|
|
2051
|
-
class
|
|
2149
|
+
class W extends v {
|
|
2052
2150
|
_parse(e) {
|
|
2053
2151
|
const { status: t, ctx: n } = this._processInputParams(e);
|
|
2054
|
-
if (n.parsedType !==
|
|
2152
|
+
if (n.parsedType !== f.set)
|
|
2055
2153
|
return l(n, {
|
|
2056
|
-
code:
|
|
2057
|
-
expected:
|
|
2154
|
+
code: d.invalid_type,
|
|
2155
|
+
expected: f.set,
|
|
2058
2156
|
received: n.parsedType
|
|
2059
2157
|
}), p;
|
|
2060
2158
|
const s = this._def;
|
|
2061
2159
|
s.minSize !== null && n.data.size < s.minSize.value && (l(n, {
|
|
2062
|
-
code:
|
|
2160
|
+
code: d.too_small,
|
|
2063
2161
|
minimum: s.minSize.value,
|
|
2064
2162
|
type: "set",
|
|
2065
2163
|
inclusive: !0,
|
|
2066
2164
|
exact: !1,
|
|
2067
2165
|
message: s.minSize.message
|
|
2068
2166
|
}), t.dirty()), s.maxSize !== null && n.data.size > s.maxSize.value && (l(n, {
|
|
2069
|
-
code:
|
|
2167
|
+
code: d.too_big,
|
|
2070
2168
|
maximum: s.maxSize.value,
|
|
2071
2169
|
type: "set",
|
|
2072
2170
|
inclusive: !0,
|
|
@@ -2074,26 +2172,26 @@ class B extends _ {
|
|
|
2074
2172
|
message: s.maxSize.message
|
|
2075
2173
|
}), t.dirty());
|
|
2076
2174
|
const a = this._def.valueType;
|
|
2077
|
-
function i(
|
|
2078
|
-
const
|
|
2079
|
-
for (const
|
|
2080
|
-
if (
|
|
2175
|
+
function i(u) {
|
|
2176
|
+
const c = /* @__PURE__ */ new Set();
|
|
2177
|
+
for (const y of u) {
|
|
2178
|
+
if (y.status === "aborted")
|
|
2081
2179
|
return p;
|
|
2082
|
-
|
|
2180
|
+
y.status === "dirty" && t.dirty(), c.add(y.value);
|
|
2083
2181
|
}
|
|
2084
|
-
return { status: t.value, value:
|
|
2182
|
+
return { status: t.value, value: c };
|
|
2085
2183
|
}
|
|
2086
|
-
const o = [...n.data.values()].map((
|
|
2087
|
-
return n.common.async ? Promise.all(o).then((
|
|
2184
|
+
const o = [...n.data.values()].map((u, c) => a._parse(new A(n, u, n.path, c)));
|
|
2185
|
+
return n.common.async ? Promise.all(o).then((u) => i(u)) : i(o);
|
|
2088
2186
|
}
|
|
2089
2187
|
min(e, t) {
|
|
2090
|
-
return new
|
|
2188
|
+
return new W({
|
|
2091
2189
|
...this._def,
|
|
2092
2190
|
minSize: { value: e, message: h.toString(t) }
|
|
2093
2191
|
});
|
|
2094
2192
|
}
|
|
2095
2193
|
max(e, t) {
|
|
2096
|
-
return new
|
|
2194
|
+
return new W({
|
|
2097
2195
|
...this._def,
|
|
2098
2196
|
maxSize: { value: e, message: h.toString(t) }
|
|
2099
2197
|
});
|
|
@@ -2105,78 +2203,78 @@ class B extends _ {
|
|
|
2105
2203
|
return this.min(1, e);
|
|
2106
2204
|
}
|
|
2107
2205
|
}
|
|
2108
|
-
|
|
2206
|
+
W.create = (r, e) => new W({
|
|
2109
2207
|
valueType: r,
|
|
2110
2208
|
minSize: null,
|
|
2111
2209
|
maxSize: null,
|
|
2112
2210
|
typeName: m.ZodSet,
|
|
2113
|
-
...
|
|
2211
|
+
..._(e)
|
|
2114
2212
|
});
|
|
2115
|
-
class
|
|
2213
|
+
class H extends v {
|
|
2116
2214
|
constructor() {
|
|
2117
2215
|
super(...arguments), this.validate = this.implement;
|
|
2118
2216
|
}
|
|
2119
2217
|
_parse(e) {
|
|
2120
2218
|
const { ctx: t } = this._processInputParams(e);
|
|
2121
|
-
if (t.parsedType !==
|
|
2219
|
+
if (t.parsedType !== f.function)
|
|
2122
2220
|
return l(t, {
|
|
2123
|
-
code:
|
|
2124
|
-
expected:
|
|
2221
|
+
code: d.invalid_type,
|
|
2222
|
+
expected: f.function,
|
|
2125
2223
|
received: t.parsedType
|
|
2126
2224
|
}), p;
|
|
2127
|
-
function n(o,
|
|
2128
|
-
return
|
|
2225
|
+
function n(o, u) {
|
|
2226
|
+
return _e({
|
|
2129
2227
|
data: o,
|
|
2130
2228
|
path: t.path,
|
|
2131
2229
|
errorMaps: [
|
|
2132
2230
|
t.common.contextualErrorMap,
|
|
2133
2231
|
t.schemaErrorMap,
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
].filter((
|
|
2232
|
+
ye(),
|
|
2233
|
+
G
|
|
2234
|
+
].filter((c) => !!c),
|
|
2137
2235
|
issueData: {
|
|
2138
|
-
code:
|
|
2139
|
-
argumentsError:
|
|
2236
|
+
code: d.invalid_arguments,
|
|
2237
|
+
argumentsError: u
|
|
2140
2238
|
}
|
|
2141
2239
|
});
|
|
2142
2240
|
}
|
|
2143
|
-
function s(o,
|
|
2144
|
-
return
|
|
2241
|
+
function s(o, u) {
|
|
2242
|
+
return _e({
|
|
2145
2243
|
data: o,
|
|
2146
2244
|
path: t.path,
|
|
2147
2245
|
errorMaps: [
|
|
2148
2246
|
t.common.contextualErrorMap,
|
|
2149
2247
|
t.schemaErrorMap,
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
].filter((
|
|
2248
|
+
ye(),
|
|
2249
|
+
G
|
|
2250
|
+
].filter((c) => !!c),
|
|
2153
2251
|
issueData: {
|
|
2154
|
-
code:
|
|
2155
|
-
returnTypeError:
|
|
2252
|
+
code: d.invalid_return_type,
|
|
2253
|
+
returnTypeError: u
|
|
2156
2254
|
}
|
|
2157
2255
|
});
|
|
2158
2256
|
}
|
|
2159
2257
|
const a = { errorMap: t.common.contextualErrorMap }, i = t.data;
|
|
2160
|
-
if (this._def.returns instanceof
|
|
2258
|
+
if (this._def.returns instanceof Q) {
|
|
2161
2259
|
const o = this;
|
|
2162
|
-
return S(async function(...
|
|
2163
|
-
const
|
|
2164
|
-
throw
|
|
2165
|
-
}),
|
|
2166
|
-
return await o._def.returns._def.type.parseAsync(
|
|
2167
|
-
throw
|
|
2260
|
+
return S(async function(...u) {
|
|
2261
|
+
const c = new O([]), y = await o._def.args.parseAsync(u, a).catch((pe) => {
|
|
2262
|
+
throw c.addIssue(n(u, pe)), c;
|
|
2263
|
+
}), N = await Reflect.apply(i, this, y);
|
|
2264
|
+
return await o._def.returns._def.type.parseAsync(N, a).catch((pe) => {
|
|
2265
|
+
throw c.addIssue(s(N, pe)), c;
|
|
2168
2266
|
});
|
|
2169
2267
|
});
|
|
2170
2268
|
} else {
|
|
2171
2269
|
const o = this;
|
|
2172
|
-
return S(function(...
|
|
2173
|
-
const
|
|
2174
|
-
if (!
|
|
2175
|
-
throw new
|
|
2176
|
-
const
|
|
2177
|
-
if (!
|
|
2178
|
-
throw new
|
|
2179
|
-
return
|
|
2270
|
+
return S(function(...u) {
|
|
2271
|
+
const c = o._def.args.safeParse(u, a);
|
|
2272
|
+
if (!c.success)
|
|
2273
|
+
throw new O([n(u, c.error)]);
|
|
2274
|
+
const y = Reflect.apply(i, this, c.data), N = o._def.returns.safeParse(y, a);
|
|
2275
|
+
if (!N.success)
|
|
2276
|
+
throw new O([s(y, N.error)]);
|
|
2277
|
+
return N.data;
|
|
2180
2278
|
});
|
|
2181
2279
|
}
|
|
2182
2280
|
}
|
|
@@ -2187,13 +2285,13 @@ class Y extends _ {
|
|
|
2187
2285
|
return this._def.returns;
|
|
2188
2286
|
}
|
|
2189
2287
|
args(...e) {
|
|
2190
|
-
return new
|
|
2288
|
+
return new H({
|
|
2191
2289
|
...this._def,
|
|
2192
|
-
args:
|
|
2290
|
+
args: M.create(e).rest(B.create())
|
|
2193
2291
|
});
|
|
2194
2292
|
}
|
|
2195
2293
|
returns(e) {
|
|
2196
|
-
return new
|
|
2294
|
+
return new H({
|
|
2197
2295
|
...this._def,
|
|
2198
2296
|
returns: e
|
|
2199
2297
|
});
|
|
@@ -2205,15 +2303,15 @@ class Y extends _ {
|
|
|
2205
2303
|
return this.parse(e);
|
|
2206
2304
|
}
|
|
2207
2305
|
static create(e, t, n) {
|
|
2208
|
-
return new
|
|
2209
|
-
args: e ||
|
|
2210
|
-
returns: t ||
|
|
2306
|
+
return new H({
|
|
2307
|
+
args: e || M.create([]).rest(B.create()),
|
|
2308
|
+
returns: t || B.create(),
|
|
2211
2309
|
typeName: m.ZodFunction,
|
|
2212
|
-
...
|
|
2310
|
+
..._(n)
|
|
2213
2311
|
});
|
|
2214
2312
|
}
|
|
2215
2313
|
}
|
|
2216
|
-
class
|
|
2314
|
+
class de extends v {
|
|
2217
2315
|
get schema() {
|
|
2218
2316
|
return this._def.getter();
|
|
2219
2317
|
}
|
|
@@ -2222,18 +2320,18 @@ class ne extends _ {
|
|
|
2222
2320
|
return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
|
|
2223
2321
|
}
|
|
2224
2322
|
}
|
|
2225
|
-
|
|
2323
|
+
de.create = (r, e) => new de({
|
|
2226
2324
|
getter: r,
|
|
2227
2325
|
typeName: m.ZodLazy,
|
|
2228
|
-
...
|
|
2326
|
+
..._(e)
|
|
2229
2327
|
});
|
|
2230
|
-
class
|
|
2328
|
+
class ce extends v {
|
|
2231
2329
|
_parse(e) {
|
|
2232
2330
|
if (e.data !== this._def.value) {
|
|
2233
2331
|
const t = this._getOrReturnCtx(e);
|
|
2234
2332
|
return l(t, {
|
|
2235
2333
|
received: t.data,
|
|
2236
|
-
code:
|
|
2334
|
+
code: d.invalid_literal,
|
|
2237
2335
|
expected: this._def.value
|
|
2238
2336
|
}), p;
|
|
2239
2337
|
}
|
|
@@ -2243,33 +2341,36 @@ class se extends _ {
|
|
|
2243
2341
|
return this._def.value;
|
|
2244
2342
|
}
|
|
2245
2343
|
}
|
|
2246
|
-
|
|
2344
|
+
ce.create = (r, e) => new ce({
|
|
2247
2345
|
value: r,
|
|
2248
2346
|
typeName: m.ZodLiteral,
|
|
2249
|
-
...
|
|
2347
|
+
..._(e)
|
|
2250
2348
|
});
|
|
2251
|
-
function
|
|
2349
|
+
function Ve(r, e) {
|
|
2252
2350
|
return new L({
|
|
2253
2351
|
values: r,
|
|
2254
2352
|
typeName: m.ZodEnum,
|
|
2255
|
-
...
|
|
2353
|
+
..._(e)
|
|
2256
2354
|
});
|
|
2257
2355
|
}
|
|
2258
|
-
class L extends
|
|
2356
|
+
class L extends v {
|
|
2357
|
+
constructor() {
|
|
2358
|
+
super(...arguments), K.set(this, void 0);
|
|
2359
|
+
}
|
|
2259
2360
|
_parse(e) {
|
|
2260
2361
|
if (typeof e.data != "string") {
|
|
2261
2362
|
const t = this._getOrReturnCtx(e), n = this._def.values;
|
|
2262
2363
|
return l(t, {
|
|
2263
2364
|
expected: x.joinValues(n),
|
|
2264
2365
|
received: t.parsedType,
|
|
2265
|
-
code:
|
|
2366
|
+
code: d.invalid_type
|
|
2266
2367
|
}), p;
|
|
2267
2368
|
}
|
|
2268
|
-
if (this._def.values.
|
|
2369
|
+
if (ve(this, K) || Me(this, K, new Set(this._def.values)), !ve(this, K).has(e.data)) {
|
|
2269
2370
|
const t = this._getOrReturnCtx(e), n = this._def.values;
|
|
2270
2371
|
return l(t, {
|
|
2271
2372
|
received: t.data,
|
|
2272
|
-
code:
|
|
2373
|
+
code: d.invalid_enum_value,
|
|
2273
2374
|
options: n
|
|
2274
2375
|
}), p;
|
|
2275
2376
|
}
|
|
@@ -2296,30 +2397,40 @@ class L extends _ {
|
|
|
2296
2397
|
e[t] = t;
|
|
2297
2398
|
return e;
|
|
2298
2399
|
}
|
|
2299
|
-
extract(e) {
|
|
2300
|
-
return L.create(e
|
|
2400
|
+
extract(e, t = this._def) {
|
|
2401
|
+
return L.create(e, {
|
|
2402
|
+
...this._def,
|
|
2403
|
+
...t
|
|
2404
|
+
});
|
|
2301
2405
|
}
|
|
2302
|
-
exclude(e) {
|
|
2303
|
-
return L.create(this.options.filter((
|
|
2406
|
+
exclude(e, t = this._def) {
|
|
2407
|
+
return L.create(this.options.filter((n) => !e.includes(n)), {
|
|
2408
|
+
...this._def,
|
|
2409
|
+
...t
|
|
2410
|
+
});
|
|
2304
2411
|
}
|
|
2305
2412
|
}
|
|
2306
|
-
|
|
2307
|
-
|
|
2413
|
+
K = /* @__PURE__ */ new WeakMap();
|
|
2414
|
+
L.create = Ve;
|
|
2415
|
+
class ue extends v {
|
|
2416
|
+
constructor() {
|
|
2417
|
+
super(...arguments), F.set(this, void 0);
|
|
2418
|
+
}
|
|
2308
2419
|
_parse(e) {
|
|
2309
2420
|
const t = x.getValidEnumValues(this._def.values), n = this._getOrReturnCtx(e);
|
|
2310
|
-
if (n.parsedType !==
|
|
2421
|
+
if (n.parsedType !== f.string && n.parsedType !== f.number) {
|
|
2311
2422
|
const s = x.objectValues(t);
|
|
2312
2423
|
return l(n, {
|
|
2313
2424
|
expected: x.joinValues(s),
|
|
2314
2425
|
received: n.parsedType,
|
|
2315
|
-
code:
|
|
2426
|
+
code: d.invalid_type
|
|
2316
2427
|
}), p;
|
|
2317
2428
|
}
|
|
2318
|
-
if (
|
|
2429
|
+
if (ve(this, F) || Me(this, F, new Set(x.getValidEnumValues(this._def.values))), !ve(this, F).has(e.data)) {
|
|
2319
2430
|
const s = x.objectValues(t);
|
|
2320
2431
|
return l(n, {
|
|
2321
2432
|
received: n.data,
|
|
2322
|
-
code:
|
|
2433
|
+
code: d.invalid_enum_value,
|
|
2323
2434
|
options: s
|
|
2324
2435
|
}), p;
|
|
2325
2436
|
}
|
|
@@ -2329,36 +2440,37 @@ class ae extends _ {
|
|
|
2329
2440
|
return this._def.values;
|
|
2330
2441
|
}
|
|
2331
2442
|
}
|
|
2332
|
-
|
|
2443
|
+
F = /* @__PURE__ */ new WeakMap();
|
|
2444
|
+
ue.create = (r, e) => new ue({
|
|
2333
2445
|
values: r,
|
|
2334
2446
|
typeName: m.ZodNativeEnum,
|
|
2335
|
-
...
|
|
2447
|
+
..._(e)
|
|
2336
2448
|
});
|
|
2337
|
-
class
|
|
2449
|
+
class Q extends v {
|
|
2338
2450
|
unwrap() {
|
|
2339
2451
|
return this._def.type;
|
|
2340
2452
|
}
|
|
2341
2453
|
_parse(e) {
|
|
2342
2454
|
const { ctx: t } = this._processInputParams(e);
|
|
2343
|
-
if (t.parsedType !==
|
|
2455
|
+
if (t.parsedType !== f.promise && t.common.async === !1)
|
|
2344
2456
|
return l(t, {
|
|
2345
|
-
code:
|
|
2346
|
-
expected:
|
|
2457
|
+
code: d.invalid_type,
|
|
2458
|
+
expected: f.promise,
|
|
2347
2459
|
received: t.parsedType
|
|
2348
2460
|
}), p;
|
|
2349
|
-
const n = t.parsedType ===
|
|
2461
|
+
const n = t.parsedType === f.promise ? t.data : Promise.resolve(t.data);
|
|
2350
2462
|
return S(n.then((s) => this._def.type.parseAsync(s, {
|
|
2351
2463
|
path: t.path,
|
|
2352
2464
|
errorMap: t.common.contextualErrorMap
|
|
2353
2465
|
})));
|
|
2354
2466
|
}
|
|
2355
2467
|
}
|
|
2356
|
-
|
|
2468
|
+
Q.create = (r, e) => new Q({
|
|
2357
2469
|
type: r,
|
|
2358
2470
|
typeName: m.ZodPromise,
|
|
2359
|
-
...
|
|
2471
|
+
..._(e)
|
|
2360
2472
|
});
|
|
2361
|
-
class R extends
|
|
2473
|
+
class R extends v {
|
|
2362
2474
|
innerType() {
|
|
2363
2475
|
return this._def.schema;
|
|
2364
2476
|
}
|
|
@@ -2376,25 +2488,34 @@ class R extends _ {
|
|
|
2376
2488
|
};
|
|
2377
2489
|
if (a.addIssue = a.addIssue.bind(a), s.type === "preprocess") {
|
|
2378
2490
|
const i = s.transform(n.data, a);
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2491
|
+
if (n.common.async)
|
|
2492
|
+
return Promise.resolve(i).then(async (o) => {
|
|
2493
|
+
if (t.value === "aborted")
|
|
2494
|
+
return p;
|
|
2495
|
+
const u = await this._def.schema._parseAsync({
|
|
2496
|
+
data: o,
|
|
2497
|
+
path: n.path,
|
|
2498
|
+
parent: n
|
|
2499
|
+
});
|
|
2500
|
+
return u.status === "aborted" ? p : u.status === "dirty" || t.value === "dirty" ? J(u.value) : u;
|
|
2501
|
+
});
|
|
2502
|
+
{
|
|
2503
|
+
if (t.value === "aborted")
|
|
2504
|
+
return p;
|
|
2505
|
+
const o = this._def.schema._parseSync({
|
|
2506
|
+
data: i,
|
|
2507
|
+
path: n.path,
|
|
2508
|
+
parent: n
|
|
2509
|
+
});
|
|
2510
|
+
return o.status === "aborted" ? p : o.status === "dirty" || t.value === "dirty" ? J(o.value) : o;
|
|
2511
|
+
}
|
|
2391
2512
|
}
|
|
2392
2513
|
if (s.type === "refinement") {
|
|
2393
2514
|
const i = (o) => {
|
|
2394
|
-
const
|
|
2515
|
+
const u = s.refinement(o, a);
|
|
2395
2516
|
if (n.common.async)
|
|
2396
|
-
return Promise.resolve(
|
|
2397
|
-
if (
|
|
2517
|
+
return Promise.resolve(u);
|
|
2518
|
+
if (u instanceof Promise)
|
|
2398
2519
|
throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2399
2520
|
return o;
|
|
2400
2521
|
};
|
|
@@ -2415,14 +2536,14 @@ class R extends _ {
|
|
|
2415
2536
|
path: n.path,
|
|
2416
2537
|
parent: n
|
|
2417
2538
|
});
|
|
2418
|
-
if (!
|
|
2539
|
+
if (!ee(i))
|
|
2419
2540
|
return i;
|
|
2420
2541
|
const o = s.transform(i.value, a);
|
|
2421
2542
|
if (o instanceof Promise)
|
|
2422
2543
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2423
2544
|
return { status: t.value, value: o };
|
|
2424
2545
|
} else
|
|
2425
|
-
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((i) =>
|
|
2546
|
+
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((i) => ee(i) ? Promise.resolve(s.transform(i.value, a)).then((o) => ({ status: t.value, value: o })) : i);
|
|
2426
2547
|
x.assertNever(s);
|
|
2427
2548
|
}
|
|
2428
2549
|
}
|
|
@@ -2430,45 +2551,45 @@ R.create = (r, e, t) => new R({
|
|
|
2430
2551
|
schema: r,
|
|
2431
2552
|
typeName: m.ZodEffects,
|
|
2432
2553
|
effect: e,
|
|
2433
|
-
...
|
|
2554
|
+
..._(t)
|
|
2434
2555
|
});
|
|
2435
2556
|
R.createWithPreprocess = (r, e, t) => new R({
|
|
2436
2557
|
schema: e,
|
|
2437
2558
|
effect: { type: "preprocess", transform: r },
|
|
2438
2559
|
typeName: m.ZodEffects,
|
|
2439
|
-
...
|
|
2560
|
+
..._(t)
|
|
2440
2561
|
});
|
|
2441
|
-
class
|
|
2562
|
+
class j extends v {
|
|
2442
2563
|
_parse(e) {
|
|
2443
|
-
return this._getType(e) ===
|
|
2564
|
+
return this._getType(e) === f.undefined ? S(void 0) : this._def.innerType._parse(e);
|
|
2444
2565
|
}
|
|
2445
2566
|
unwrap() {
|
|
2446
2567
|
return this._def.innerType;
|
|
2447
2568
|
}
|
|
2448
2569
|
}
|
|
2449
|
-
|
|
2570
|
+
j.create = (r, e) => new j({
|
|
2450
2571
|
innerType: r,
|
|
2451
2572
|
typeName: m.ZodOptional,
|
|
2452
|
-
...
|
|
2573
|
+
..._(e)
|
|
2453
2574
|
});
|
|
2454
|
-
class
|
|
2575
|
+
class U extends v {
|
|
2455
2576
|
_parse(e) {
|
|
2456
|
-
return this._getType(e) ===
|
|
2577
|
+
return this._getType(e) === f.null ? S(null) : this._def.innerType._parse(e);
|
|
2457
2578
|
}
|
|
2458
2579
|
unwrap() {
|
|
2459
2580
|
return this._def.innerType;
|
|
2460
2581
|
}
|
|
2461
2582
|
}
|
|
2462
|
-
|
|
2583
|
+
U.create = (r, e) => new U({
|
|
2463
2584
|
innerType: r,
|
|
2464
2585
|
typeName: m.ZodNullable,
|
|
2465
|
-
...
|
|
2586
|
+
..._(e)
|
|
2466
2587
|
});
|
|
2467
|
-
class
|
|
2588
|
+
class le extends v {
|
|
2468
2589
|
_parse(e) {
|
|
2469
2590
|
const { ctx: t } = this._processInputParams(e);
|
|
2470
2591
|
let n = t.data;
|
|
2471
|
-
return t.parsedType ===
|
|
2592
|
+
return t.parsedType === f.undefined && (n = this._def.defaultValue()), this._def.innerType._parse({
|
|
2472
2593
|
data: n,
|
|
2473
2594
|
path: t.path,
|
|
2474
2595
|
parent: t
|
|
@@ -2478,13 +2599,13 @@ class ie extends _ {
|
|
|
2478
2599
|
return this._def.innerType;
|
|
2479
2600
|
}
|
|
2480
2601
|
}
|
|
2481
|
-
|
|
2602
|
+
le.create = (r, e) => new le({
|
|
2482
2603
|
innerType: r,
|
|
2483
2604
|
typeName: m.ZodDefault,
|
|
2484
2605
|
defaultValue: typeof e.default == "function" ? e.default : () => e.default,
|
|
2485
|
-
...
|
|
2606
|
+
..._(e)
|
|
2486
2607
|
});
|
|
2487
|
-
class
|
|
2608
|
+
class fe extends v {
|
|
2488
2609
|
_parse(e) {
|
|
2489
2610
|
const { ctx: t } = this._processInputParams(e), n = {
|
|
2490
2611
|
...t,
|
|
@@ -2499,11 +2620,11 @@ class ye extends _ {
|
|
|
2499
2620
|
...n
|
|
2500
2621
|
}
|
|
2501
2622
|
});
|
|
2502
|
-
return
|
|
2623
|
+
return te(s) ? s.then((a) => ({
|
|
2503
2624
|
status: "valid",
|
|
2504
2625
|
value: a.status === "valid" ? a.value : this._def.catchValue({
|
|
2505
2626
|
get error() {
|
|
2506
|
-
return new
|
|
2627
|
+
return new O(n.common.issues);
|
|
2507
2628
|
},
|
|
2508
2629
|
input: n.data
|
|
2509
2630
|
})
|
|
@@ -2511,7 +2632,7 @@ class ye extends _ {
|
|
|
2511
2632
|
status: "valid",
|
|
2512
2633
|
value: s.status === "valid" ? s.value : this._def.catchValue({
|
|
2513
2634
|
get error() {
|
|
2514
|
-
return new
|
|
2635
|
+
return new O(n.common.issues);
|
|
2515
2636
|
},
|
|
2516
2637
|
input: n.data
|
|
2517
2638
|
})
|
|
@@ -2521,31 +2642,31 @@ class ye extends _ {
|
|
|
2521
2642
|
return this._def.innerType;
|
|
2522
2643
|
}
|
|
2523
2644
|
}
|
|
2524
|
-
|
|
2645
|
+
fe.create = (r, e) => new fe({
|
|
2525
2646
|
innerType: r,
|
|
2526
2647
|
typeName: m.ZodCatch,
|
|
2527
2648
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
|
|
2528
|
-
...
|
|
2649
|
+
..._(e)
|
|
2529
2650
|
});
|
|
2530
|
-
class
|
|
2651
|
+
class be extends v {
|
|
2531
2652
|
_parse(e) {
|
|
2532
|
-
if (this._getType(e) !==
|
|
2653
|
+
if (this._getType(e) !== f.nan) {
|
|
2533
2654
|
const n = this._getOrReturnCtx(e);
|
|
2534
2655
|
return l(n, {
|
|
2535
|
-
code:
|
|
2536
|
-
expected:
|
|
2656
|
+
code: d.invalid_type,
|
|
2657
|
+
expected: f.nan,
|
|
2537
2658
|
received: n.parsedType
|
|
2538
2659
|
}), p;
|
|
2539
2660
|
}
|
|
2540
2661
|
return { status: "valid", value: e.data };
|
|
2541
2662
|
}
|
|
2542
2663
|
}
|
|
2543
|
-
|
|
2664
|
+
be.create = (r) => new be({
|
|
2544
2665
|
typeName: m.ZodNaN,
|
|
2545
|
-
...
|
|
2666
|
+
..._(r)
|
|
2546
2667
|
});
|
|
2547
|
-
const
|
|
2548
|
-
class Ee extends
|
|
2668
|
+
const ht = Symbol("zod_brand");
|
|
2669
|
+
class Ee extends v {
|
|
2549
2670
|
_parse(e) {
|
|
2550
2671
|
const { ctx: t } = this._processInputParams(e), n = t.data;
|
|
2551
2672
|
return this._def.type._parse({
|
|
@@ -2558,7 +2679,7 @@ class Ee extends _ {
|
|
|
2558
2679
|
return this._def.type;
|
|
2559
2680
|
}
|
|
2560
2681
|
}
|
|
2561
|
-
class
|
|
2682
|
+
class me extends v {
|
|
2562
2683
|
_parse(e) {
|
|
2563
2684
|
const { status: t, ctx: n } = this._processInputParams(e);
|
|
2564
2685
|
if (n.common.async)
|
|
@@ -2568,7 +2689,7 @@ class oe extends _ {
|
|
|
2568
2689
|
path: n.path,
|
|
2569
2690
|
parent: n
|
|
2570
2691
|
});
|
|
2571
|
-
return a.status === "aborted" ? p : a.status === "dirty" ? (t.dirty(),
|
|
2692
|
+
return a.status === "aborted" ? p : a.status === "dirty" ? (t.dirty(), J(a.value)) : this._def.out._parseAsync({
|
|
2572
2693
|
data: a.value,
|
|
2573
2694
|
path: n.path,
|
|
2574
2695
|
parent: n
|
|
@@ -2591,172 +2712,179 @@ class oe extends _ {
|
|
|
2591
2712
|
}
|
|
2592
2713
|
}
|
|
2593
2714
|
static create(e, t) {
|
|
2594
|
-
return new
|
|
2715
|
+
return new me({
|
|
2595
2716
|
in: e,
|
|
2596
2717
|
out: t,
|
|
2597
2718
|
typeName: m.ZodPipeline
|
|
2598
2719
|
});
|
|
2599
2720
|
}
|
|
2600
2721
|
}
|
|
2601
|
-
class
|
|
2722
|
+
class he extends v {
|
|
2602
2723
|
_parse(e) {
|
|
2603
|
-
const t = this._def.innerType._parse(e);
|
|
2604
|
-
return
|
|
2724
|
+
const t = this._def.innerType._parse(e), n = (s) => (ee(s) && (s.value = Object.freeze(s.value)), s);
|
|
2725
|
+
return te(t) ? t.then((s) => n(s)) : n(t);
|
|
2726
|
+
}
|
|
2727
|
+
unwrap() {
|
|
2728
|
+
return this._def.innerType;
|
|
2605
2729
|
}
|
|
2606
2730
|
}
|
|
2607
|
-
|
|
2731
|
+
he.create = (r, e) => new he({
|
|
2608
2732
|
innerType: r,
|
|
2609
2733
|
typeName: m.ZodReadonly,
|
|
2610
|
-
...
|
|
2734
|
+
..._(e)
|
|
2611
2735
|
});
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
}
|
|
2619
|
-
|
|
2736
|
+
function De(r, e = {}, t) {
|
|
2737
|
+
return r ? X.create().superRefine((n, s) => {
|
|
2738
|
+
var a, i;
|
|
2739
|
+
if (!r(n)) {
|
|
2740
|
+
const o = typeof e == "function" ? e(n) : typeof e == "string" ? { message: e } : e, u = (i = (a = o.fatal) !== null && a !== void 0 ? a : t) !== null && i !== void 0 ? i : !0, c = typeof o == "string" ? { message: o } : o;
|
|
2741
|
+
s.addIssue({ code: "custom", ...c, fatal: u });
|
|
2742
|
+
}
|
|
2743
|
+
}) : X.create();
|
|
2744
|
+
}
|
|
2745
|
+
const mt = {
|
|
2746
|
+
object: k.lazycreate
|
|
2620
2747
|
};
|
|
2621
2748
|
var m;
|
|
2622
2749
|
(function(r) {
|
|
2623
2750
|
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
2751
|
})(m || (m = {}));
|
|
2625
|
-
const
|
|
2752
|
+
const pt = (r, e = {
|
|
2626
2753
|
message: `Input not instance of ${r.name}`
|
|
2627
|
-
}) =>
|
|
2628
|
-
string: (r) =>
|
|
2754
|
+
}) => De((t) => t instanceof r, e), Le = E.create, Ue = V.create, yt = be.create, _t = D.create, Be = re.create, vt = q.create, gt = ge.create, xt = ne.create, kt = se.create, bt = X.create, wt = B.create, Tt = z.create, Zt = xe.create, St = I.create, Ct = k.create, Nt = k.strictCreate, Ot = ae.create, Et = we.create, It = ie.create, Rt = M.create, jt = oe.create, At = ke.create, Mt = W.create, $t = H.create, zt = de.create, Pt = ce.create, Vt = L.create, Dt = ue.create, Lt = Q.create, je = R.create, Ut = j.create, Bt = U.create, qt = R.createWithPreprocess, Wt = me.create, Yt = () => Le().optional(), Jt = () => Ue().optional(), Ht = () => Be().optional(), Gt = {
|
|
2755
|
+
string: (r) => E.create({ ...r, coerce: !0 }),
|
|
2629
2756
|
number: (r) => V.create({ ...r, coerce: !0 }),
|
|
2630
|
-
boolean: (r) =>
|
|
2757
|
+
boolean: (r) => re.create({
|
|
2631
2758
|
...r,
|
|
2632
2759
|
coerce: !0
|
|
2633
2760
|
}),
|
|
2634
|
-
bigint: (r) =>
|
|
2635
|
-
date: (r) =>
|
|
2636
|
-
},
|
|
2637
|
-
var
|
|
2761
|
+
bigint: (r) => D.create({ ...r, coerce: !0 }),
|
|
2762
|
+
date: (r) => q.create({ ...r, coerce: !0 })
|
|
2763
|
+
}, Xt = p;
|
|
2764
|
+
var C = /* @__PURE__ */ Object.freeze({
|
|
2638
2765
|
__proto__: null,
|
|
2639
|
-
defaultErrorMap:
|
|
2640
|
-
setErrorMap:
|
|
2641
|
-
getErrorMap:
|
|
2642
|
-
makeIssue:
|
|
2643
|
-
EMPTY_PATH:
|
|
2766
|
+
defaultErrorMap: G,
|
|
2767
|
+
setErrorMap: Xe,
|
|
2768
|
+
getErrorMap: ye,
|
|
2769
|
+
makeIssue: _e,
|
|
2770
|
+
EMPTY_PATH: Qe,
|
|
2644
2771
|
addIssueToContext: l,
|
|
2645
2772
|
ParseStatus: Z,
|
|
2646
2773
|
INVALID: p,
|
|
2647
|
-
DIRTY:
|
|
2774
|
+
DIRTY: J,
|
|
2648
2775
|
OK: S,
|
|
2649
|
-
isAborted:
|
|
2650
|
-
isDirty:
|
|
2651
|
-
isValid:
|
|
2652
|
-
isAsync:
|
|
2776
|
+
isAborted: Ce,
|
|
2777
|
+
isDirty: Ne,
|
|
2778
|
+
isValid: ee,
|
|
2779
|
+
isAsync: te,
|
|
2653
2780
|
get util() {
|
|
2654
2781
|
return x;
|
|
2655
2782
|
},
|
|
2656
2783
|
get objectUtil() {
|
|
2657
|
-
return
|
|
2784
|
+
return Se;
|
|
2658
2785
|
},
|
|
2659
|
-
ZodParsedType:
|
|
2786
|
+
ZodParsedType: f,
|
|
2660
2787
|
getParsedType: P,
|
|
2661
|
-
ZodType:
|
|
2662
|
-
|
|
2788
|
+
ZodType: v,
|
|
2789
|
+
datetimeRegex: Pe,
|
|
2790
|
+
ZodString: E,
|
|
2663
2791
|
ZodNumber: V,
|
|
2664
|
-
ZodBigInt:
|
|
2665
|
-
ZodBoolean:
|
|
2666
|
-
ZodDate:
|
|
2667
|
-
ZodSymbol:
|
|
2668
|
-
ZodUndefined:
|
|
2669
|
-
ZodNull:
|
|
2670
|
-
ZodAny:
|
|
2671
|
-
ZodUnknown:
|
|
2792
|
+
ZodBigInt: D,
|
|
2793
|
+
ZodBoolean: re,
|
|
2794
|
+
ZodDate: q,
|
|
2795
|
+
ZodSymbol: ge,
|
|
2796
|
+
ZodUndefined: ne,
|
|
2797
|
+
ZodNull: se,
|
|
2798
|
+
ZodAny: X,
|
|
2799
|
+
ZodUnknown: B,
|
|
2672
2800
|
ZodNever: z,
|
|
2673
|
-
ZodVoid:
|
|
2674
|
-
ZodArray:
|
|
2675
|
-
ZodObject:
|
|
2676
|
-
ZodUnion:
|
|
2677
|
-
ZodDiscriminatedUnion:
|
|
2678
|
-
ZodIntersection:
|
|
2679
|
-
ZodTuple:
|
|
2680
|
-
ZodRecord:
|
|
2681
|
-
ZodMap:
|
|
2682
|
-
ZodSet:
|
|
2683
|
-
ZodFunction:
|
|
2684
|
-
ZodLazy:
|
|
2685
|
-
ZodLiteral:
|
|
2801
|
+
ZodVoid: xe,
|
|
2802
|
+
ZodArray: I,
|
|
2803
|
+
ZodObject: k,
|
|
2804
|
+
ZodUnion: ae,
|
|
2805
|
+
ZodDiscriminatedUnion: we,
|
|
2806
|
+
ZodIntersection: ie,
|
|
2807
|
+
ZodTuple: M,
|
|
2808
|
+
ZodRecord: oe,
|
|
2809
|
+
ZodMap: ke,
|
|
2810
|
+
ZodSet: W,
|
|
2811
|
+
ZodFunction: H,
|
|
2812
|
+
ZodLazy: de,
|
|
2813
|
+
ZodLiteral: ce,
|
|
2686
2814
|
ZodEnum: L,
|
|
2687
|
-
ZodNativeEnum:
|
|
2688
|
-
ZodPromise:
|
|
2815
|
+
ZodNativeEnum: ue,
|
|
2816
|
+
ZodPromise: Q,
|
|
2689
2817
|
ZodEffects: R,
|
|
2690
2818
|
ZodTransformer: R,
|
|
2691
|
-
ZodOptional:
|
|
2692
|
-
ZodNullable:
|
|
2693
|
-
ZodDefault:
|
|
2694
|
-
ZodCatch:
|
|
2695
|
-
ZodNaN:
|
|
2696
|
-
BRAND:
|
|
2819
|
+
ZodOptional: j,
|
|
2820
|
+
ZodNullable: U,
|
|
2821
|
+
ZodDefault: le,
|
|
2822
|
+
ZodCatch: fe,
|
|
2823
|
+
ZodNaN: be,
|
|
2824
|
+
BRAND: ht,
|
|
2697
2825
|
ZodBranded: Ee,
|
|
2698
|
-
ZodPipeline:
|
|
2699
|
-
ZodReadonly:
|
|
2700
|
-
custom:
|
|
2701
|
-
Schema:
|
|
2702
|
-
ZodSchema:
|
|
2703
|
-
late:
|
|
2826
|
+
ZodPipeline: me,
|
|
2827
|
+
ZodReadonly: he,
|
|
2828
|
+
custom: De,
|
|
2829
|
+
Schema: v,
|
|
2830
|
+
ZodSchema: v,
|
|
2831
|
+
late: mt,
|
|
2704
2832
|
get ZodFirstPartyTypeKind() {
|
|
2705
2833
|
return m;
|
|
2706
2834
|
},
|
|
2707
|
-
coerce:
|
|
2708
|
-
any:
|
|
2709
|
-
array:
|
|
2710
|
-
bigint:
|
|
2711
|
-
boolean:
|
|
2712
|
-
date:
|
|
2713
|
-
discriminatedUnion:
|
|
2714
|
-
effect:
|
|
2715
|
-
enum:
|
|
2716
|
-
function:
|
|
2717
|
-
instanceof:
|
|
2718
|
-
intersection:
|
|
2719
|
-
lazy:
|
|
2720
|
-
literal:
|
|
2721
|
-
map:
|
|
2722
|
-
nan:
|
|
2723
|
-
nativeEnum:
|
|
2724
|
-
never:
|
|
2725
|
-
null:
|
|
2726
|
-
nullable:
|
|
2727
|
-
number:
|
|
2728
|
-
object:
|
|
2729
|
-
oboolean:
|
|
2730
|
-
onumber:
|
|
2731
|
-
optional:
|
|
2732
|
-
ostring:
|
|
2733
|
-
pipeline:
|
|
2734
|
-
preprocess:
|
|
2735
|
-
promise:
|
|
2736
|
-
record:
|
|
2737
|
-
set:
|
|
2738
|
-
strictObject:
|
|
2739
|
-
string:
|
|
2740
|
-
symbol:
|
|
2741
|
-
transformer:
|
|
2742
|
-
tuple:
|
|
2743
|
-
undefined:
|
|
2744
|
-
union:
|
|
2745
|
-
unknown:
|
|
2746
|
-
void:
|
|
2747
|
-
NEVER:
|
|
2748
|
-
ZodIssueCode:
|
|
2749
|
-
quotelessJson:
|
|
2750
|
-
ZodError:
|
|
2835
|
+
coerce: Gt,
|
|
2836
|
+
any: bt,
|
|
2837
|
+
array: St,
|
|
2838
|
+
bigint: _t,
|
|
2839
|
+
boolean: Be,
|
|
2840
|
+
date: vt,
|
|
2841
|
+
discriminatedUnion: Et,
|
|
2842
|
+
effect: je,
|
|
2843
|
+
enum: Vt,
|
|
2844
|
+
function: $t,
|
|
2845
|
+
instanceof: pt,
|
|
2846
|
+
intersection: It,
|
|
2847
|
+
lazy: zt,
|
|
2848
|
+
literal: Pt,
|
|
2849
|
+
map: At,
|
|
2850
|
+
nan: yt,
|
|
2851
|
+
nativeEnum: Dt,
|
|
2852
|
+
never: Tt,
|
|
2853
|
+
null: kt,
|
|
2854
|
+
nullable: Bt,
|
|
2855
|
+
number: Ue,
|
|
2856
|
+
object: Ct,
|
|
2857
|
+
oboolean: Ht,
|
|
2858
|
+
onumber: Jt,
|
|
2859
|
+
optional: Ut,
|
|
2860
|
+
ostring: Yt,
|
|
2861
|
+
pipeline: Wt,
|
|
2862
|
+
preprocess: qt,
|
|
2863
|
+
promise: Lt,
|
|
2864
|
+
record: jt,
|
|
2865
|
+
set: Mt,
|
|
2866
|
+
strictObject: Nt,
|
|
2867
|
+
string: Le,
|
|
2868
|
+
symbol: gt,
|
|
2869
|
+
transformer: je,
|
|
2870
|
+
tuple: Rt,
|
|
2871
|
+
undefined: xt,
|
|
2872
|
+
union: Ot,
|
|
2873
|
+
unknown: wt,
|
|
2874
|
+
void: Zt,
|
|
2875
|
+
NEVER: Xt,
|
|
2876
|
+
ZodIssueCode: d,
|
|
2877
|
+
quotelessJson: Ge,
|
|
2878
|
+
ZodError: O
|
|
2751
2879
|
});
|
|
2752
|
-
const
|
|
2753
|
-
const { formValidationTexts: r } =
|
|
2880
|
+
const rr = () => {
|
|
2881
|
+
const { formValidationTexts: r } = Ye(We), e = (g) => (g != null && g.useCoerce ? C.coerce : C).string({
|
|
2754
2882
|
invalid_type_error: r.required
|
|
2755
|
-
}).transform((w) => w ?? null), t = (g) => e(g).nullable().optional().transform((
|
|
2883
|
+
}).transform((w) => w ?? null), t = (g) => e(g).nullable().optional().transform((b) => b ?? null), n = (g) => (g != null && g.useCoerce ? C.coerce : C).number({
|
|
2756
2884
|
invalid_type_error: r.required
|
|
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((
|
|
2885
|
+
}).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((b) => b ?? null), a = (g) => (g != null && g.useCoerce ? C.coerce : C).boolean({
|
|
2758
2886
|
invalid_type_error: r.required
|
|
2759
|
-
}).transform((
|
|
2887
|
+
}).transform((b) => b ?? null), i = (g) => (g != null && g.useCoerce ? C.coerce : C).string({ invalid_type_error: r.required }).refine(He, { message: r.invalidDate }).transform((w) => w ?? null), o = (g) => i(g).nullable().transform((b) => b ?? null), u = (g, b) => C.enum(g, { invalid_type_error: r.required }).transform((Ie) => Ie ?? null);
|
|
2760
2888
|
return {
|
|
2761
2889
|
zString: t,
|
|
2762
2890
|
zStringRequired: e,
|
|
@@ -2765,22 +2893,22 @@ const Wt = () => {
|
|
|
2765
2893
|
zBool: a,
|
|
2766
2894
|
zDate: o,
|
|
2767
2895
|
zDateRequired: i,
|
|
2768
|
-
zEnum: (g,
|
|
2769
|
-
zEnumRequired:
|
|
2770
|
-
zObjectIdInt: (g) =>
|
|
2771
|
-
zObjectIdIntRequired: (g) =>
|
|
2772
|
-
zObjectIdStr: (g) =>
|
|
2773
|
-
zObjectIdStrRequired: (g) =>
|
|
2774
|
-
zFile: ({ required: g, multiple:
|
|
2896
|
+
zEnum: (g, b) => u(g).nullable().transform((w) => w ?? null),
|
|
2897
|
+
zEnumRequired: u,
|
|
2898
|
+
zObjectIdInt: (g) => C.object({ id: s({ useCoerce: !0 }) }).nullable().transform((w) => w ?? null),
|
|
2899
|
+
zObjectIdIntRequired: (g) => C.object({ id: n() }).transform((w) => w ?? null),
|
|
2900
|
+
zObjectIdStr: (g) => C.object({ id: t({ useCoerce: !0 }) }).nullable().transform((w) => w ?? null),
|
|
2901
|
+
zObjectIdStrRequired: (g) => C.object({ id: e() }).transform((w) => w ?? null),
|
|
2902
|
+
zFile: ({ required: g, multiple: b, maxFileSize: w }) => C.any().transform((T) => Array.from(T ?? [])).refine((T) => !g || (T == null ? void 0 : T.length) > 0, "File is required.").refine((T) => b || (T == null ? void 0 : T.length) <= 1, "Multiple files not allowed.").refine((T) => T.every((qe) => qe.size <= w), `Maximum file size is ${Je(w)}.`).transform((T) => (b ? T : T == null ? void 0 : T[0]) ?? null)
|
|
2775
2903
|
};
|
|
2776
2904
|
};
|
|
2777
2905
|
export {
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2906
|
+
ar as cancelToken,
|
|
2907
|
+
ir as useAuth,
|
|
2908
|
+
or as useAxios,
|
|
2909
|
+
hr as useClickOutside,
|
|
2910
|
+
ur as useConfirm,
|
|
2911
|
+
dr as useNotifications,
|
|
2912
|
+
lr as usePrompt,
|
|
2913
|
+
rr as useZodSchemaTypes
|
|
2786
2914
|
};
|