@jsdev_ninja/core 0.13.23 → 0.13.25
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/core.cjs.js +1 -1
- package/dist/core.cjs.js.map +1 -1
- package/dist/core.es.js +781 -719
- package/dist/core.es.js.map +1 -1
- package/dist/core.umd.js +1 -1
- package/dist/core.umd.js.map +1 -1
- package/dist/lib/entities/DeliveryNote.d.ts +114 -3
- package/dist/lib/entities/DeliveryNote.d.ts.map +1 -1
- package/dist/lib/entities/DeliveryNote.js +35 -9
- package/dist/lib/entities/Invoice.d.ts +114 -2
- package/dist/lib/entities/Invoice.d.ts.map +1 -1
- package/dist/lib/entities/Invoice.js +35 -5
- package/dist/lib/entities/Order.d.ts +391 -29
- package/dist/lib/entities/Order.d.ts.map +1 -1
- package/dist/lib/entities/Order.js +15 -5
- package/dist/lib/entities/Store.d.ts +4 -4
- package/dist/lib/firebase-api/index.js +2 -2
- package/dist/lib/utils/index.d.ts +5 -3
- package/dist/lib/utils/index.d.ts.map +1 -1
- package/dist/lib/utils/index.js +3 -4
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/lib/entities/DeliveryNote.ts +1 -1
- package/lib/entities/Order.ts +9 -1
- package/lib/utils/index.ts +8 -6
- package/package.json +1 -1
- package/tsconfig.json +3 -1
package/dist/core.es.js
CHANGED
|
@@ -37,15 +37,15 @@ var x;
|
|
|
37
37
|
}
|
|
38
38
|
n.joinValues = r, n.jsonStringifyReplacer = (s, a) => typeof a == "bigint" ? a.toString() : a;
|
|
39
39
|
})(x || (x = {}));
|
|
40
|
-
var
|
|
40
|
+
var Ze;
|
|
41
41
|
(function(n) {
|
|
42
42
|
n.mergeShapes = (e, t) => ({
|
|
43
43
|
...e,
|
|
44
44
|
...t
|
|
45
45
|
// second overwrites first
|
|
46
46
|
});
|
|
47
|
-
})(
|
|
48
|
-
const
|
|
47
|
+
})(Ze || (Ze = {}));
|
|
48
|
+
const f = x.arrayToEnum([
|
|
49
49
|
"string",
|
|
50
50
|
"nan",
|
|
51
51
|
"number",
|
|
@@ -69,23 +69,23 @@ const m = x.arrayToEnum([
|
|
|
69
69
|
]), R = (n) => {
|
|
70
70
|
switch (typeof n) {
|
|
71
71
|
case "undefined":
|
|
72
|
-
return
|
|
72
|
+
return f.undefined;
|
|
73
73
|
case "string":
|
|
74
|
-
return
|
|
74
|
+
return f.string;
|
|
75
75
|
case "number":
|
|
76
|
-
return isNaN(n) ?
|
|
76
|
+
return isNaN(n) ? f.nan : f.number;
|
|
77
77
|
case "boolean":
|
|
78
|
-
return
|
|
78
|
+
return f.boolean;
|
|
79
79
|
case "function":
|
|
80
|
-
return
|
|
80
|
+
return f.function;
|
|
81
81
|
case "bigint":
|
|
82
|
-
return
|
|
82
|
+
return f.bigint;
|
|
83
83
|
case "symbol":
|
|
84
|
-
return
|
|
84
|
+
return f.symbol;
|
|
85
85
|
case "object":
|
|
86
|
-
return Array.isArray(n) ?
|
|
86
|
+
return Array.isArray(n) ? f.array : n === null ? f.null : n.then && typeof n.then == "function" && n.catch && typeof n.catch == "function" ? f.promise : typeof Map < "u" && n instanceof Map ? f.map : typeof Set < "u" && n instanceof Set ? f.set : typeof Date < "u" && n instanceof Date ? f.date : f.object;
|
|
87
87
|
default:
|
|
88
|
-
return
|
|
88
|
+
return f.unknown;
|
|
89
89
|
}
|
|
90
90
|
}, u = x.arrayToEnum([
|
|
91
91
|
"invalid_type",
|
|
@@ -105,7 +105,7 @@ const m = x.arrayToEnum([
|
|
|
105
105
|
"not_multiple_of",
|
|
106
106
|
"not_finite"
|
|
107
107
|
]), ot = (n) => JSON.stringify(n, null, 2).replace(/"([^"]+)":/g, "$1:");
|
|
108
|
-
class
|
|
108
|
+
class S extends Error {
|
|
109
109
|
get errors() {
|
|
110
110
|
return this.issues;
|
|
111
111
|
}
|
|
@@ -132,17 +132,17 @@ class A extends Error {
|
|
|
132
132
|
else if (o.path.length === 0)
|
|
133
133
|
r._errors.push(t(o));
|
|
134
134
|
else {
|
|
135
|
-
let c = r,
|
|
136
|
-
for (;
|
|
137
|
-
const
|
|
138
|
-
|
|
135
|
+
let c = r, l = 0;
|
|
136
|
+
for (; l < o.path.length; ) {
|
|
137
|
+
const d = o.path[l];
|
|
138
|
+
l === o.path.length - 1 ? (c[d] = c[d] || { _errors: [] }, c[d]._errors.push(t(o))) : c[d] = c[d] || { _errors: [] }, c = c[d], l++;
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
};
|
|
142
142
|
return s(this), r;
|
|
143
143
|
}
|
|
144
144
|
static assert(e) {
|
|
145
|
-
if (!(e instanceof
|
|
145
|
+
if (!(e instanceof S))
|
|
146
146
|
throw new Error(`Not a ZodError: ${e}`);
|
|
147
147
|
}
|
|
148
148
|
toString() {
|
|
@@ -164,12 +164,12 @@ class A extends Error {
|
|
|
164
164
|
return this.flatten();
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
|
-
|
|
167
|
+
S.create = (n) => new S(n);
|
|
168
168
|
const X = (n, e) => {
|
|
169
169
|
let t;
|
|
170
170
|
switch (n.code) {
|
|
171
171
|
case u.invalid_type:
|
|
172
|
-
n.received ===
|
|
172
|
+
n.received === f.undefined ? t = "Required" : t = `Expected ${n.expected}, received ${n.received}`;
|
|
173
173
|
break;
|
|
174
174
|
case u.invalid_literal:
|
|
175
175
|
t = `Invalid literal value, expected ${JSON.stringify(n.expected, x.jsonStringifyReplacer)}`;
|
|
@@ -225,10 +225,10 @@ let Fe = X;
|
|
|
225
225
|
function ct(n) {
|
|
226
226
|
Fe = n;
|
|
227
227
|
}
|
|
228
|
-
function
|
|
228
|
+
function ve() {
|
|
229
229
|
return Fe;
|
|
230
230
|
}
|
|
231
|
-
const
|
|
231
|
+
const _e = (n) => {
|
|
232
232
|
const { data: e, path: t, errorMaps: r, issueData: s } = n, a = [...t, ...s.path || []], o = {
|
|
233
233
|
...s,
|
|
234
234
|
path: a
|
|
@@ -240,17 +240,17 @@ const ve = (n) => {
|
|
|
240
240
|
message: s.message
|
|
241
241
|
};
|
|
242
242
|
let c = "";
|
|
243
|
-
const
|
|
244
|
-
for (const
|
|
245
|
-
c =
|
|
243
|
+
const l = r.filter((d) => !!d).slice().reverse();
|
|
244
|
+
for (const d of l)
|
|
245
|
+
c = d(o, { data: e, defaultError: c }).message;
|
|
246
246
|
return {
|
|
247
247
|
...s,
|
|
248
248
|
path: a,
|
|
249
249
|
message: c
|
|
250
250
|
};
|
|
251
251
|
}, dt = [];
|
|
252
|
-
function
|
|
253
|
-
const t =
|
|
252
|
+
function m(n, e) {
|
|
253
|
+
const t = ve(), r = _e({
|
|
254
254
|
issueData: e,
|
|
255
255
|
data: n.data,
|
|
256
256
|
path: n.path,
|
|
@@ -281,7 +281,7 @@ class T {
|
|
|
281
281
|
const r = [];
|
|
282
282
|
for (const s of t) {
|
|
283
283
|
if (s.status === "aborted")
|
|
284
|
-
return
|
|
284
|
+
return y;
|
|
285
285
|
s.status === "dirty" && e.dirty(), r.push(s.value);
|
|
286
286
|
}
|
|
287
287
|
return { status: e.value, value: r };
|
|
@@ -302,29 +302,29 @@ class T {
|
|
|
302
302
|
for (const s of t) {
|
|
303
303
|
const { key: a, value: o } = s;
|
|
304
304
|
if (a.status === "aborted" || o.status === "aborted")
|
|
305
|
-
return
|
|
305
|
+
return y;
|
|
306
306
|
a.status === "dirty" && e.dirty(), o.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof o.value < "u" || s.alwaysSet) && (r[a.value] = o.value);
|
|
307
307
|
}
|
|
308
308
|
return { status: e.value, value: r };
|
|
309
309
|
}
|
|
310
310
|
}
|
|
311
|
-
const
|
|
311
|
+
const y = Object.freeze({
|
|
312
312
|
status: "aborted"
|
|
313
|
-
}), Y = (n) => ({ status: "dirty", value: n }), I = (n) => ({ status: "valid", value: n }),
|
|
314
|
-
function
|
|
313
|
+
}), Y = (n) => ({ status: "dirty", value: n }), I = (n) => ({ status: "valid", value: n }), De = (n) => n.status === "aborted", je = (n) => n.status === "dirty", q = (n) => n.status === "valid", se = (n) => typeof Promise < "u" && n instanceof Promise;
|
|
314
|
+
function be(n, e, t, r) {
|
|
315
315
|
if (typeof e == "function" ? n !== e || !0 : !e.has(n)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
316
316
|
return e.get(n);
|
|
317
317
|
}
|
|
318
|
-
function
|
|
318
|
+
function ze(n, e, t, r, s) {
|
|
319
319
|
if (typeof e == "function" ? n !== e || !0 : !e.has(n)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
320
320
|
return e.set(n, t), t;
|
|
321
321
|
}
|
|
322
|
-
var
|
|
322
|
+
var h;
|
|
323
323
|
(function(n) {
|
|
324
324
|
n.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, n.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
|
|
325
|
-
})(
|
|
326
|
-
var
|
|
327
|
-
class
|
|
325
|
+
})(h || (h = {}));
|
|
326
|
+
var te, ne;
|
|
327
|
+
class O {
|
|
328
328
|
constructor(e, t, r, s) {
|
|
329
329
|
this._cachedPath = [], this.parent = e, this.data = t, this._path = r, this._key = s;
|
|
330
330
|
}
|
|
@@ -333,7 +333,7 @@ class j {
|
|
|
333
333
|
}
|
|
334
334
|
}
|
|
335
335
|
const Me = (n, e) => {
|
|
336
|
-
if (
|
|
336
|
+
if (q(e))
|
|
337
337
|
return { success: !0, data: e.value };
|
|
338
338
|
if (!n.common.issues.length)
|
|
339
339
|
throw new Error("Validation failed but no issues detected.");
|
|
@@ -342,7 +342,7 @@ const Me = (n, e) => {
|
|
|
342
342
|
get error() {
|
|
343
343
|
if (this._error)
|
|
344
344
|
return this._error;
|
|
345
|
-
const t = new
|
|
345
|
+
const t = new S(n.common.issues);
|
|
346
346
|
return this._error = t, this._error;
|
|
347
347
|
}
|
|
348
348
|
};
|
|
@@ -354,9 +354,9 @@ function v(n) {
|
|
|
354
354
|
if (e && (t || r))
|
|
355
355
|
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
356
356
|
return e ? { errorMap: e, description: s } : { errorMap: (o, c) => {
|
|
357
|
-
var
|
|
358
|
-
const { message:
|
|
359
|
-
return o.code === "invalid_enum_value" ? { message:
|
|
357
|
+
var l, d;
|
|
358
|
+
const { message: p } = n;
|
|
359
|
+
return o.code === "invalid_enum_value" ? { message: p ?? c.defaultError } : typeof c.data > "u" ? { message: (l = p ?? r) !== null && l !== void 0 ? l : c.defaultError } : o.code !== "invalid_type" ? { message: c.defaultError } : { message: (d = p ?? t) !== null && d !== void 0 ? d : c.defaultError };
|
|
360
360
|
}, description: s };
|
|
361
361
|
}
|
|
362
362
|
class _ {
|
|
@@ -391,7 +391,7 @@ class _ {
|
|
|
391
391
|
}
|
|
392
392
|
_parseSync(e) {
|
|
393
393
|
const t = this._parse(e);
|
|
394
|
-
if (
|
|
394
|
+
if (se(t))
|
|
395
395
|
throw new Error("Synchronous parse encountered promise.");
|
|
396
396
|
return t;
|
|
397
397
|
}
|
|
@@ -437,7 +437,7 @@ class _ {
|
|
|
437
437
|
if (!this["~standard"].async)
|
|
438
438
|
try {
|
|
439
439
|
const a = this._parseSync({ data: e, path: [], parent: s });
|
|
440
|
-
return
|
|
440
|
+
return q(a) ? {
|
|
441
441
|
value: a.value
|
|
442
442
|
} : {
|
|
443
443
|
issues: s.common.issues
|
|
@@ -448,7 +448,7 @@ class _ {
|
|
|
448
448
|
async: !0
|
|
449
449
|
};
|
|
450
450
|
}
|
|
451
|
-
return this._parseAsync({ data: e, path: [], parent: s }).then((a) =>
|
|
451
|
+
return this._parseAsync({ data: e, path: [], parent: s }).then((a) => q(a) ? {
|
|
452
452
|
value: a.value
|
|
453
453
|
} : {
|
|
454
454
|
issues: s.common.issues
|
|
@@ -472,7 +472,7 @@ class _ {
|
|
|
472
472
|
parent: null,
|
|
473
473
|
data: e,
|
|
474
474
|
parsedType: R(e)
|
|
475
|
-
}, s = this._parse({ data: e, path: r.path, parent: r }), a = await (
|
|
475
|
+
}, s = this._parse({ data: e, path: r.path, parent: r }), a = await (se(s) ? s : Promise.resolve(s));
|
|
476
476
|
return Me(r, a);
|
|
477
477
|
}
|
|
478
478
|
refine(e, t) {
|
|
@@ -482,16 +482,16 @@ class _ {
|
|
|
482
482
|
code: u.custom,
|
|
483
483
|
...r(s)
|
|
484
484
|
});
|
|
485
|
-
return typeof Promise < "u" && o instanceof Promise ? o.then((
|
|
485
|
+
return typeof Promise < "u" && o instanceof Promise ? o.then((l) => l ? !0 : (c(), !1)) : o ? !0 : (c(), !1);
|
|
486
486
|
});
|
|
487
487
|
}
|
|
488
488
|
refinement(e, t) {
|
|
489
489
|
return this._refinement((r, s) => e(r) ? !0 : (s.addIssue(typeof t == "function" ? t(r, s) : t), !1));
|
|
490
490
|
}
|
|
491
491
|
_refinement(e) {
|
|
492
|
-
return new
|
|
492
|
+
return new Z({
|
|
493
493
|
schema: this,
|
|
494
|
-
typeName:
|
|
494
|
+
typeName: g.ZodEffects,
|
|
495
495
|
effect: { type: "refinement", refinement: e }
|
|
496
496
|
});
|
|
497
497
|
}
|
|
@@ -506,46 +506,46 @@ class _ {
|
|
|
506
506
|
};
|
|
507
507
|
}
|
|
508
508
|
optional() {
|
|
509
|
-
return
|
|
509
|
+
return j.create(this, this._def);
|
|
510
510
|
}
|
|
511
511
|
nullable() {
|
|
512
|
-
return
|
|
512
|
+
return U.create(this, this._def);
|
|
513
513
|
}
|
|
514
514
|
nullish() {
|
|
515
515
|
return this.nullable().optional();
|
|
516
516
|
}
|
|
517
517
|
array() {
|
|
518
|
-
return
|
|
518
|
+
return C.create(this);
|
|
519
519
|
}
|
|
520
520
|
promise() {
|
|
521
521
|
return G.create(this, this._def);
|
|
522
522
|
}
|
|
523
523
|
or(e) {
|
|
524
|
-
return
|
|
524
|
+
return ce.create([this, e], this._def);
|
|
525
525
|
}
|
|
526
526
|
and(e) {
|
|
527
|
-
return
|
|
527
|
+
return de.create(this, e, this._def);
|
|
528
528
|
}
|
|
529
529
|
transform(e) {
|
|
530
|
-
return new
|
|
530
|
+
return new Z({
|
|
531
531
|
...v(this._def),
|
|
532
532
|
schema: this,
|
|
533
|
-
typeName:
|
|
533
|
+
typeName: g.ZodEffects,
|
|
534
534
|
effect: { type: "transform", transform: e }
|
|
535
535
|
});
|
|
536
536
|
}
|
|
537
537
|
default(e) {
|
|
538
538
|
const t = typeof e == "function" ? e : () => e;
|
|
539
|
-
return new
|
|
539
|
+
return new pe({
|
|
540
540
|
...v(this._def),
|
|
541
541
|
innerType: this,
|
|
542
542
|
defaultValue: t,
|
|
543
|
-
typeName:
|
|
543
|
+
typeName: g.ZodDefault
|
|
544
544
|
});
|
|
545
545
|
}
|
|
546
546
|
brand() {
|
|
547
|
-
return new
|
|
548
|
-
typeName:
|
|
547
|
+
return new Ee({
|
|
548
|
+
typeName: g.ZodBranded,
|
|
549
549
|
type: this,
|
|
550
550
|
...v(this._def)
|
|
551
551
|
});
|
|
@@ -556,7 +556,7 @@ class _ {
|
|
|
556
556
|
...v(this._def),
|
|
557
557
|
innerType: this,
|
|
558
558
|
catchValue: t,
|
|
559
|
-
typeName:
|
|
559
|
+
typeName: g.ZodCatch
|
|
560
560
|
});
|
|
561
561
|
}
|
|
562
562
|
describe(e) {
|
|
@@ -570,7 +570,7 @@ class _ {
|
|
|
570
570
|
return ye.create(this, e);
|
|
571
571
|
}
|
|
572
572
|
readonly() {
|
|
573
|
-
return
|
|
573
|
+
return ge.create(this);
|
|
574
574
|
}
|
|
575
575
|
isOptional() {
|
|
576
576
|
return this.safeParse(void 0).success;
|
|
@@ -579,26 +579,26 @@ class _ {
|
|
|
579
579
|
return this.safeParse(null).success;
|
|
580
580
|
}
|
|
581
581
|
}
|
|
582
|
-
const ut = /^c[^\s-]{8,}$/i, lt = /^[0-9a-z]+$/,
|
|
583
|
-
let
|
|
584
|
-
const _t = /^(?:(?: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])$/, bt = /^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/, xt = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, kt = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, wt = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Tt = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,
|
|
582
|
+
const ut = /^c[^\s-]{8,}$/i, lt = /^[0-9a-z]+$/, mt = /^[0-9A-HJKMNP-TV-Z]{26}$/i, ft = /^[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, pt = /^[a-z0-9_-]{21}$/i, ht = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, gt = /^[-+]?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)?)??$/, yt = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, vt = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
583
|
+
let Ne;
|
|
584
|
+
const _t = /^(?:(?: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])$/, bt = /^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/, xt = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, kt = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, wt = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Tt = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, Ue = "((\\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])))", It = new RegExp(`^${Ue}$`);
|
|
585
585
|
function Le(n) {
|
|
586
586
|
let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
|
|
587
587
|
return n.precision ? e = `${e}\\.\\d{${n.precision}}` : n.precision == null && (e = `${e}(\\.\\d+)?`), e;
|
|
588
588
|
}
|
|
589
|
-
function
|
|
589
|
+
function At(n) {
|
|
590
590
|
return new RegExp(`^${Le(n)}$`);
|
|
591
591
|
}
|
|
592
|
-
function
|
|
593
|
-
let e = `${
|
|
592
|
+
function qe(n) {
|
|
593
|
+
let e = `${Ue}T${Le(n)}`;
|
|
594
594
|
const t = [];
|
|
595
595
|
return t.push(n.local ? "Z?" : "Z"), n.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
|
|
596
596
|
}
|
|
597
|
-
function
|
|
597
|
+
function St(n, e) {
|
|
598
598
|
return !!((e === "v4" || !e) && _t.test(n) || (e === "v6" || !e) && xt.test(n));
|
|
599
599
|
}
|
|
600
|
-
function
|
|
601
|
-
if (!
|
|
600
|
+
function Nt(n, e) {
|
|
601
|
+
if (!ht.test(n))
|
|
602
602
|
return !1;
|
|
603
603
|
try {
|
|
604
604
|
const [t] = n.split("."), r = t.replace(/-/g, "+").replace(/_/g, "/").padEnd(t.length + (4 - t.length % 4) % 4, "="), s = JSON.parse(atob(r));
|
|
@@ -607,24 +607,24 @@ function Ct(n, e) {
|
|
|
607
607
|
return !1;
|
|
608
608
|
}
|
|
609
609
|
}
|
|
610
|
-
function
|
|
610
|
+
function Ct(n, e) {
|
|
611
611
|
return !!((e === "v4" || !e) && bt.test(n) || (e === "v6" || !e) && kt.test(n));
|
|
612
612
|
}
|
|
613
613
|
class N extends _ {
|
|
614
614
|
_parse(e) {
|
|
615
|
-
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !==
|
|
615
|
+
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== f.string) {
|
|
616
616
|
const a = this._getOrReturnCtx(e);
|
|
617
|
-
return
|
|
617
|
+
return m(a, {
|
|
618
618
|
code: u.invalid_type,
|
|
619
|
-
expected:
|
|
619
|
+
expected: f.string,
|
|
620
620
|
received: a.parsedType
|
|
621
|
-
}),
|
|
621
|
+
}), y;
|
|
622
622
|
}
|
|
623
623
|
const r = new T();
|
|
624
624
|
let s;
|
|
625
625
|
for (const a of this._def.checks)
|
|
626
626
|
if (a.kind === "min")
|
|
627
|
-
e.data.length < a.value && (s = this._getOrReturnCtx(e, s),
|
|
627
|
+
e.data.length < a.value && (s = this._getOrReturnCtx(e, s), m(s, {
|
|
628
628
|
code: u.too_small,
|
|
629
629
|
minimum: a.value,
|
|
630
630
|
type: "string",
|
|
@@ -633,7 +633,7 @@ class N extends _ {
|
|
|
633
633
|
message: a.message
|
|
634
634
|
}), r.dirty());
|
|
635
635
|
else if (a.kind === "max")
|
|
636
|
-
e.data.length > a.value && (s = this._getOrReturnCtx(e, s),
|
|
636
|
+
e.data.length > a.value && (s = this._getOrReturnCtx(e, s), m(s, {
|
|
637
637
|
code: u.too_big,
|
|
638
638
|
maximum: a.value,
|
|
639
639
|
type: "string",
|
|
@@ -643,14 +643,14 @@ class N extends _ {
|
|
|
643
643
|
}), r.dirty());
|
|
644
644
|
else if (a.kind === "length") {
|
|
645
645
|
const o = e.data.length > a.value, c = e.data.length < a.value;
|
|
646
|
-
(o || c) && (s = this._getOrReturnCtx(e, s), o ?
|
|
646
|
+
(o || c) && (s = this._getOrReturnCtx(e, s), o ? m(s, {
|
|
647
647
|
code: u.too_big,
|
|
648
648
|
maximum: a.value,
|
|
649
649
|
type: "string",
|
|
650
650
|
inclusive: !0,
|
|
651
651
|
exact: !0,
|
|
652
652
|
message: a.message
|
|
653
|
-
}) : c &&
|
|
653
|
+
}) : c && m(s, {
|
|
654
654
|
code: u.too_small,
|
|
655
655
|
minimum: a.value,
|
|
656
656
|
type: "string",
|
|
@@ -659,43 +659,43 @@ class N extends _ {
|
|
|
659
659
|
message: a.message
|
|
660
660
|
}), r.dirty());
|
|
661
661
|
} else if (a.kind === "email")
|
|
662
|
-
|
|
662
|
+
yt.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
663
663
|
validation: "email",
|
|
664
664
|
code: u.invalid_string,
|
|
665
665
|
message: a.message
|
|
666
666
|
}), r.dirty());
|
|
667
667
|
else if (a.kind === "emoji")
|
|
668
|
-
|
|
668
|
+
Ne || (Ne = new RegExp(vt, "u")), Ne.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
669
669
|
validation: "emoji",
|
|
670
670
|
code: u.invalid_string,
|
|
671
671
|
message: a.message
|
|
672
672
|
}), r.dirty());
|
|
673
673
|
else if (a.kind === "uuid")
|
|
674
|
-
|
|
674
|
+
ft.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
675
675
|
validation: "uuid",
|
|
676
676
|
code: u.invalid_string,
|
|
677
677
|
message: a.message
|
|
678
678
|
}), r.dirty());
|
|
679
679
|
else if (a.kind === "nanoid")
|
|
680
|
-
|
|
680
|
+
pt.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
681
681
|
validation: "nanoid",
|
|
682
682
|
code: u.invalid_string,
|
|
683
683
|
message: a.message
|
|
684
684
|
}), r.dirty());
|
|
685
685
|
else if (a.kind === "cuid")
|
|
686
|
-
ut.test(e.data) || (s = this._getOrReturnCtx(e, s),
|
|
686
|
+
ut.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
687
687
|
validation: "cuid",
|
|
688
688
|
code: u.invalid_string,
|
|
689
689
|
message: a.message
|
|
690
690
|
}), r.dirty());
|
|
691
691
|
else if (a.kind === "cuid2")
|
|
692
|
-
lt.test(e.data) || (s = this._getOrReturnCtx(e, s),
|
|
692
|
+
lt.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
693
693
|
validation: "cuid2",
|
|
694
694
|
code: u.invalid_string,
|
|
695
695
|
message: a.message
|
|
696
696
|
}), r.dirty());
|
|
697
697
|
else if (a.kind === "ulid")
|
|
698
|
-
|
|
698
|
+
mt.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
699
699
|
validation: "ulid",
|
|
700
700
|
code: u.invalid_string,
|
|
701
701
|
message: a.message
|
|
@@ -704,61 +704,61 @@ class N extends _ {
|
|
|
704
704
|
try {
|
|
705
705
|
new URL(e.data);
|
|
706
706
|
} catch {
|
|
707
|
-
s = this._getOrReturnCtx(e, s),
|
|
707
|
+
s = this._getOrReturnCtx(e, s), m(s, {
|
|
708
708
|
validation: "url",
|
|
709
709
|
code: u.invalid_string,
|
|
710
710
|
message: a.message
|
|
711
711
|
}), r.dirty();
|
|
712
712
|
}
|
|
713
|
-
else a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (s = this._getOrReturnCtx(e, s),
|
|
713
|
+
else a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
714
714
|
validation: "regex",
|
|
715
715
|
code: u.invalid_string,
|
|
716
716
|
message: a.message
|
|
717
|
-
}), r.dirty())) : a.kind === "trim" ? e.data = e.data.trim() : a.kind === "includes" ? e.data.includes(a.value, a.position) || (s = this._getOrReturnCtx(e, s),
|
|
717
|
+
}), r.dirty())) : a.kind === "trim" ? e.data = e.data.trim() : a.kind === "includes" ? e.data.includes(a.value, a.position) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
718
718
|
code: u.invalid_string,
|
|
719
719
|
validation: { includes: a.value, position: a.position },
|
|
720
720
|
message: a.message
|
|
721
|
-
}), r.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),
|
|
721
|
+
}), r.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), m(s, {
|
|
722
722
|
code: u.invalid_string,
|
|
723
723
|
validation: { startsWith: a.value },
|
|
724
724
|
message: a.message
|
|
725
|
-
}), r.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (s = this._getOrReturnCtx(e, s),
|
|
725
|
+
}), r.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
726
726
|
code: u.invalid_string,
|
|
727
727
|
validation: { endsWith: a.value },
|
|
728
728
|
message: a.message
|
|
729
|
-
}), r.dirty()) : a.kind === "datetime" ?
|
|
729
|
+
}), r.dirty()) : a.kind === "datetime" ? qe(a).test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
730
730
|
code: u.invalid_string,
|
|
731
731
|
validation: "datetime",
|
|
732
732
|
message: a.message
|
|
733
|
-
}), r.dirty()) : a.kind === "date" ? It.test(e.data) || (s = this._getOrReturnCtx(e, s),
|
|
733
|
+
}), r.dirty()) : a.kind === "date" ? It.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
734
734
|
code: u.invalid_string,
|
|
735
735
|
validation: "date",
|
|
736
736
|
message: a.message
|
|
737
|
-
}), r.dirty()) : a.kind === "time" ?
|
|
737
|
+
}), r.dirty()) : a.kind === "time" ? At(a).test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
738
738
|
code: u.invalid_string,
|
|
739
739
|
validation: "time",
|
|
740
740
|
message: a.message
|
|
741
|
-
}), r.dirty()) : a.kind === "duration" ?
|
|
741
|
+
}), r.dirty()) : a.kind === "duration" ? gt.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
742
742
|
validation: "duration",
|
|
743
743
|
code: u.invalid_string,
|
|
744
744
|
message: a.message
|
|
745
|
-
}), r.dirty()) : a.kind === "ip" ?
|
|
745
|
+
}), r.dirty()) : a.kind === "ip" ? St(e.data, a.version) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
746
746
|
validation: "ip",
|
|
747
747
|
code: u.invalid_string,
|
|
748
748
|
message: a.message
|
|
749
|
-
}), r.dirty()) : a.kind === "jwt" ?
|
|
749
|
+
}), r.dirty()) : a.kind === "jwt" ? Nt(e.data, a.alg) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
750
750
|
validation: "jwt",
|
|
751
751
|
code: u.invalid_string,
|
|
752
752
|
message: a.message
|
|
753
|
-
}), r.dirty()) : a.kind === "cidr" ?
|
|
753
|
+
}), r.dirty()) : a.kind === "cidr" ? Ct(e.data, a.version) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
754
754
|
validation: "cidr",
|
|
755
755
|
code: u.invalid_string,
|
|
756
756
|
message: a.message
|
|
757
|
-
}), r.dirty()) : a.kind === "base64" ? wt.test(e.data) || (s = this._getOrReturnCtx(e, s),
|
|
757
|
+
}), r.dirty()) : a.kind === "base64" ? wt.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
758
758
|
validation: "base64",
|
|
759
759
|
code: u.invalid_string,
|
|
760
760
|
message: a.message
|
|
761
|
-
}), r.dirty()) : a.kind === "base64url" ? Tt.test(e.data) || (s = this._getOrReturnCtx(e, s),
|
|
761
|
+
}), r.dirty()) : a.kind === "base64url" ? Tt.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
762
762
|
validation: "base64url",
|
|
763
763
|
code: u.invalid_string,
|
|
764
764
|
message: a.message
|
|
@@ -769,7 +769,7 @@ class N extends _ {
|
|
|
769
769
|
return this.refinement((s) => e.test(s), {
|
|
770
770
|
validation: t,
|
|
771
771
|
code: u.invalid_string,
|
|
772
|
-
...
|
|
772
|
+
...h.errToObj(r)
|
|
773
773
|
});
|
|
774
774
|
}
|
|
775
775
|
_addCheck(e) {
|
|
@@ -779,46 +779,46 @@ class N extends _ {
|
|
|
779
779
|
});
|
|
780
780
|
}
|
|
781
781
|
email(e) {
|
|
782
|
-
return this._addCheck({ kind: "email", ...
|
|
782
|
+
return this._addCheck({ kind: "email", ...h.errToObj(e) });
|
|
783
783
|
}
|
|
784
784
|
url(e) {
|
|
785
|
-
return this._addCheck({ kind: "url", ...
|
|
785
|
+
return this._addCheck({ kind: "url", ...h.errToObj(e) });
|
|
786
786
|
}
|
|
787
787
|
emoji(e) {
|
|
788
|
-
return this._addCheck({ kind: "emoji", ...
|
|
788
|
+
return this._addCheck({ kind: "emoji", ...h.errToObj(e) });
|
|
789
789
|
}
|
|
790
790
|
uuid(e) {
|
|
791
|
-
return this._addCheck({ kind: "uuid", ...
|
|
791
|
+
return this._addCheck({ kind: "uuid", ...h.errToObj(e) });
|
|
792
792
|
}
|
|
793
793
|
nanoid(e) {
|
|
794
|
-
return this._addCheck({ kind: "nanoid", ...
|
|
794
|
+
return this._addCheck({ kind: "nanoid", ...h.errToObj(e) });
|
|
795
795
|
}
|
|
796
796
|
cuid(e) {
|
|
797
|
-
return this._addCheck({ kind: "cuid", ...
|
|
797
|
+
return this._addCheck({ kind: "cuid", ...h.errToObj(e) });
|
|
798
798
|
}
|
|
799
799
|
cuid2(e) {
|
|
800
|
-
return this._addCheck({ kind: "cuid2", ...
|
|
800
|
+
return this._addCheck({ kind: "cuid2", ...h.errToObj(e) });
|
|
801
801
|
}
|
|
802
802
|
ulid(e) {
|
|
803
|
-
return this._addCheck({ kind: "ulid", ...
|
|
803
|
+
return this._addCheck({ kind: "ulid", ...h.errToObj(e) });
|
|
804
804
|
}
|
|
805
805
|
base64(e) {
|
|
806
|
-
return this._addCheck({ kind: "base64", ...
|
|
806
|
+
return this._addCheck({ kind: "base64", ...h.errToObj(e) });
|
|
807
807
|
}
|
|
808
808
|
base64url(e) {
|
|
809
809
|
return this._addCheck({
|
|
810
810
|
kind: "base64url",
|
|
811
|
-
...
|
|
811
|
+
...h.errToObj(e)
|
|
812
812
|
});
|
|
813
813
|
}
|
|
814
814
|
jwt(e) {
|
|
815
|
-
return this._addCheck({ kind: "jwt", ...
|
|
815
|
+
return this._addCheck({ kind: "jwt", ...h.errToObj(e) });
|
|
816
816
|
}
|
|
817
817
|
ip(e) {
|
|
818
|
-
return this._addCheck({ kind: "ip", ...
|
|
818
|
+
return this._addCheck({ kind: "ip", ...h.errToObj(e) });
|
|
819
819
|
}
|
|
820
820
|
cidr(e) {
|
|
821
|
-
return this._addCheck({ kind: "cidr", ...
|
|
821
|
+
return this._addCheck({ kind: "cidr", ...h.errToObj(e) });
|
|
822
822
|
}
|
|
823
823
|
datetime(e) {
|
|
824
824
|
var t, r;
|
|
@@ -833,7 +833,7 @@ class N extends _ {
|
|
|
833
833
|
precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
|
|
834
834
|
offset: (t = e == null ? void 0 : e.offset) !== null && t !== void 0 ? t : !1,
|
|
835
835
|
local: (r = e == null ? void 0 : e.local) !== null && r !== void 0 ? r : !1,
|
|
836
|
-
...
|
|
836
|
+
...h.errToObj(e == null ? void 0 : e.message)
|
|
837
837
|
});
|
|
838
838
|
}
|
|
839
839
|
date(e) {
|
|
@@ -847,17 +847,17 @@ class N extends _ {
|
|
|
847
847
|
}) : this._addCheck({
|
|
848
848
|
kind: "time",
|
|
849
849
|
precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
|
|
850
|
-
...
|
|
850
|
+
...h.errToObj(e == null ? void 0 : e.message)
|
|
851
851
|
});
|
|
852
852
|
}
|
|
853
853
|
duration(e) {
|
|
854
|
-
return this._addCheck({ kind: "duration", ...
|
|
854
|
+
return this._addCheck({ kind: "duration", ...h.errToObj(e) });
|
|
855
855
|
}
|
|
856
856
|
regex(e, t) {
|
|
857
857
|
return this._addCheck({
|
|
858
858
|
kind: "regex",
|
|
859
859
|
regex: e,
|
|
860
|
-
...
|
|
860
|
+
...h.errToObj(t)
|
|
861
861
|
});
|
|
862
862
|
}
|
|
863
863
|
includes(e, t) {
|
|
@@ -865,49 +865,49 @@ class N extends _ {
|
|
|
865
865
|
kind: "includes",
|
|
866
866
|
value: e,
|
|
867
867
|
position: t == null ? void 0 : t.position,
|
|
868
|
-
...
|
|
868
|
+
...h.errToObj(t == null ? void 0 : t.message)
|
|
869
869
|
});
|
|
870
870
|
}
|
|
871
871
|
startsWith(e, t) {
|
|
872
872
|
return this._addCheck({
|
|
873
873
|
kind: "startsWith",
|
|
874
874
|
value: e,
|
|
875
|
-
...
|
|
875
|
+
...h.errToObj(t)
|
|
876
876
|
});
|
|
877
877
|
}
|
|
878
878
|
endsWith(e, t) {
|
|
879
879
|
return this._addCheck({
|
|
880
880
|
kind: "endsWith",
|
|
881
881
|
value: e,
|
|
882
|
-
...
|
|
882
|
+
...h.errToObj(t)
|
|
883
883
|
});
|
|
884
884
|
}
|
|
885
885
|
min(e, t) {
|
|
886
886
|
return this._addCheck({
|
|
887
887
|
kind: "min",
|
|
888
888
|
value: e,
|
|
889
|
-
...
|
|
889
|
+
...h.errToObj(t)
|
|
890
890
|
});
|
|
891
891
|
}
|
|
892
892
|
max(e, t) {
|
|
893
893
|
return this._addCheck({
|
|
894
894
|
kind: "max",
|
|
895
895
|
value: e,
|
|
896
|
-
...
|
|
896
|
+
...h.errToObj(t)
|
|
897
897
|
});
|
|
898
898
|
}
|
|
899
899
|
length(e, t) {
|
|
900
900
|
return this._addCheck({
|
|
901
901
|
kind: "length",
|
|
902
902
|
value: e,
|
|
903
|
-
...
|
|
903
|
+
...h.errToObj(t)
|
|
904
904
|
});
|
|
905
905
|
}
|
|
906
906
|
/**
|
|
907
907
|
* Equivalent to `.min(1)`
|
|
908
908
|
*/
|
|
909
909
|
nonempty(e) {
|
|
910
|
-
return this.min(1,
|
|
910
|
+
return this.min(1, h.errToObj(e));
|
|
911
911
|
}
|
|
912
912
|
trim() {
|
|
913
913
|
return new N({
|
|
@@ -992,7 +992,7 @@ N.create = (n) => {
|
|
|
992
992
|
var e;
|
|
993
993
|
return new N({
|
|
994
994
|
checks: [],
|
|
995
|
-
typeName:
|
|
995
|
+
typeName: g.ZodString,
|
|
996
996
|
coerce: (e = n == null ? void 0 : n.coerce) !== null && e !== void 0 ? e : !1,
|
|
997
997
|
...v(n)
|
|
998
998
|
});
|
|
@@ -1006,57 +1006,57 @@ class V extends _ {
|
|
|
1006
1006
|
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
1007
1007
|
}
|
|
1008
1008
|
_parse(e) {
|
|
1009
|
-
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !==
|
|
1009
|
+
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== f.number) {
|
|
1010
1010
|
const a = this._getOrReturnCtx(e);
|
|
1011
|
-
return
|
|
1011
|
+
return m(a, {
|
|
1012
1012
|
code: u.invalid_type,
|
|
1013
|
-
expected:
|
|
1013
|
+
expected: f.number,
|
|
1014
1014
|
received: a.parsedType
|
|
1015
|
-
}),
|
|
1015
|
+
}), y;
|
|
1016
1016
|
}
|
|
1017
1017
|
let r;
|
|
1018
1018
|
const s = new T();
|
|
1019
1019
|
for (const a of this._def.checks)
|
|
1020
|
-
a.kind === "int" ? x.isInteger(e.data) || (r = this._getOrReturnCtx(e, r),
|
|
1020
|
+
a.kind === "int" ? x.isInteger(e.data) || (r = this._getOrReturnCtx(e, r), m(r, {
|
|
1021
1021
|
code: u.invalid_type,
|
|
1022
1022
|
expected: "integer",
|
|
1023
1023
|
received: "float",
|
|
1024
1024
|
message: a.message
|
|
1025
|
-
}), s.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (r = this._getOrReturnCtx(e, r),
|
|
1025
|
+
}), s.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (r = this._getOrReturnCtx(e, r), m(r, {
|
|
1026
1026
|
code: u.too_small,
|
|
1027
1027
|
minimum: a.value,
|
|
1028
1028
|
type: "number",
|
|
1029
1029
|
inclusive: a.inclusive,
|
|
1030
1030
|
exact: !1,
|
|
1031
1031
|
message: a.message
|
|
1032
|
-
}), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (r = this._getOrReturnCtx(e, r),
|
|
1032
|
+
}), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (r = this._getOrReturnCtx(e, r), m(r, {
|
|
1033
1033
|
code: u.too_big,
|
|
1034
1034
|
maximum: a.value,
|
|
1035
1035
|
type: "number",
|
|
1036
1036
|
inclusive: a.inclusive,
|
|
1037
1037
|
exact: !1,
|
|
1038
1038
|
message: a.message
|
|
1039
|
-
}), s.dirty()) : a.kind === "multipleOf" ? Zt(e.data, a.value) !== 0 && (r = this._getOrReturnCtx(e, r),
|
|
1039
|
+
}), s.dirty()) : a.kind === "multipleOf" ? Zt(e.data, a.value) !== 0 && (r = this._getOrReturnCtx(e, r), m(r, {
|
|
1040
1040
|
code: u.not_multiple_of,
|
|
1041
1041
|
multipleOf: a.value,
|
|
1042
1042
|
message: a.message
|
|
1043
|
-
}), s.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (r = this._getOrReturnCtx(e, r),
|
|
1043
|
+
}), s.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (r = this._getOrReturnCtx(e, r), m(r, {
|
|
1044
1044
|
code: u.not_finite,
|
|
1045
1045
|
message: a.message
|
|
1046
1046
|
}), s.dirty()) : x.assertNever(a);
|
|
1047
1047
|
return { status: s.value, value: e.data };
|
|
1048
1048
|
}
|
|
1049
1049
|
gte(e, t) {
|
|
1050
|
-
return this.setLimit("min", e, !0,
|
|
1050
|
+
return this.setLimit("min", e, !0, h.toString(t));
|
|
1051
1051
|
}
|
|
1052
1052
|
gt(e, t) {
|
|
1053
|
-
return this.setLimit("min", e, !1,
|
|
1053
|
+
return this.setLimit("min", e, !1, h.toString(t));
|
|
1054
1054
|
}
|
|
1055
1055
|
lte(e, t) {
|
|
1056
|
-
return this.setLimit("max", e, !0,
|
|
1056
|
+
return this.setLimit("max", e, !0, h.toString(t));
|
|
1057
1057
|
}
|
|
1058
1058
|
lt(e, t) {
|
|
1059
|
-
return this.setLimit("max", e, !1,
|
|
1059
|
+
return this.setLimit("max", e, !1, h.toString(t));
|
|
1060
1060
|
}
|
|
1061
1061
|
setLimit(e, t, r, s) {
|
|
1062
1062
|
return new V({
|
|
@@ -1067,7 +1067,7 @@ class V extends _ {
|
|
|
1067
1067
|
kind: e,
|
|
1068
1068
|
value: t,
|
|
1069
1069
|
inclusive: r,
|
|
1070
|
-
message:
|
|
1070
|
+
message: h.toString(s)
|
|
1071
1071
|
}
|
|
1072
1072
|
]
|
|
1073
1073
|
});
|
|
@@ -1081,7 +1081,7 @@ class V extends _ {
|
|
|
1081
1081
|
int(e) {
|
|
1082
1082
|
return this._addCheck({
|
|
1083
1083
|
kind: "int",
|
|
1084
|
-
message:
|
|
1084
|
+
message: h.toString(e)
|
|
1085
1085
|
});
|
|
1086
1086
|
}
|
|
1087
1087
|
positive(e) {
|
|
@@ -1089,7 +1089,7 @@ class V extends _ {
|
|
|
1089
1089
|
kind: "min",
|
|
1090
1090
|
value: 0,
|
|
1091
1091
|
inclusive: !1,
|
|
1092
|
-
message:
|
|
1092
|
+
message: h.toString(e)
|
|
1093
1093
|
});
|
|
1094
1094
|
}
|
|
1095
1095
|
negative(e) {
|
|
@@ -1097,7 +1097,7 @@ class V extends _ {
|
|
|
1097
1097
|
kind: "max",
|
|
1098
1098
|
value: 0,
|
|
1099
1099
|
inclusive: !1,
|
|
1100
|
-
message:
|
|
1100
|
+
message: h.toString(e)
|
|
1101
1101
|
});
|
|
1102
1102
|
}
|
|
1103
1103
|
nonpositive(e) {
|
|
@@ -1105,7 +1105,7 @@ class V extends _ {
|
|
|
1105
1105
|
kind: "max",
|
|
1106
1106
|
value: 0,
|
|
1107
1107
|
inclusive: !0,
|
|
1108
|
-
message:
|
|
1108
|
+
message: h.toString(e)
|
|
1109
1109
|
});
|
|
1110
1110
|
}
|
|
1111
1111
|
nonnegative(e) {
|
|
@@ -1113,20 +1113,20 @@ class V extends _ {
|
|
|
1113
1113
|
kind: "min",
|
|
1114
1114
|
value: 0,
|
|
1115
1115
|
inclusive: !0,
|
|
1116
|
-
message:
|
|
1116
|
+
message: h.toString(e)
|
|
1117
1117
|
});
|
|
1118
1118
|
}
|
|
1119
1119
|
multipleOf(e, t) {
|
|
1120
1120
|
return this._addCheck({
|
|
1121
1121
|
kind: "multipleOf",
|
|
1122
1122
|
value: e,
|
|
1123
|
-
message:
|
|
1123
|
+
message: h.toString(t)
|
|
1124
1124
|
});
|
|
1125
1125
|
}
|
|
1126
1126
|
finite(e) {
|
|
1127
1127
|
return this._addCheck({
|
|
1128
1128
|
kind: "finite",
|
|
1129
|
-
message:
|
|
1129
|
+
message: h.toString(e)
|
|
1130
1130
|
});
|
|
1131
1131
|
}
|
|
1132
1132
|
safe(e) {
|
|
@@ -1134,12 +1134,12 @@ class V extends _ {
|
|
|
1134
1134
|
kind: "min",
|
|
1135
1135
|
inclusive: !0,
|
|
1136
1136
|
value: Number.MIN_SAFE_INTEGER,
|
|
1137
|
-
message:
|
|
1137
|
+
message: h.toString(e)
|
|
1138
1138
|
})._addCheck({
|
|
1139
1139
|
kind: "max",
|
|
1140
1140
|
inclusive: !0,
|
|
1141
1141
|
value: Number.MAX_SAFE_INTEGER,
|
|
1142
|
-
message:
|
|
1142
|
+
message: h.toString(e)
|
|
1143
1143
|
});
|
|
1144
1144
|
}
|
|
1145
1145
|
get minValue() {
|
|
@@ -1169,7 +1169,7 @@ class V extends _ {
|
|
|
1169
1169
|
}
|
|
1170
1170
|
V.create = (n) => new V({
|
|
1171
1171
|
checks: [],
|
|
1172
|
-
typeName:
|
|
1172
|
+
typeName: g.ZodNumber,
|
|
1173
1173
|
coerce: (n == null ? void 0 : n.coerce) || !1,
|
|
1174
1174
|
...v(n)
|
|
1175
1175
|
});
|
|
@@ -1184,24 +1184,24 @@ class F extends _ {
|
|
|
1184
1184
|
} catch {
|
|
1185
1185
|
return this._getInvalidInput(e);
|
|
1186
1186
|
}
|
|
1187
|
-
if (this._getType(e) !==
|
|
1187
|
+
if (this._getType(e) !== f.bigint)
|
|
1188
1188
|
return this._getInvalidInput(e);
|
|
1189
1189
|
let r;
|
|
1190
1190
|
const s = new T();
|
|
1191
1191
|
for (const a of this._def.checks)
|
|
1192
|
-
a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (r = this._getOrReturnCtx(e, r),
|
|
1192
|
+
a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (r = this._getOrReturnCtx(e, r), m(r, {
|
|
1193
1193
|
code: u.too_small,
|
|
1194
1194
|
type: "bigint",
|
|
1195
1195
|
minimum: a.value,
|
|
1196
1196
|
inclusive: a.inclusive,
|
|
1197
1197
|
message: a.message
|
|
1198
|
-
}), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (r = this._getOrReturnCtx(e, r),
|
|
1198
|
+
}), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (r = this._getOrReturnCtx(e, r), m(r, {
|
|
1199
1199
|
code: u.too_big,
|
|
1200
1200
|
type: "bigint",
|
|
1201
1201
|
maximum: a.value,
|
|
1202
1202
|
inclusive: a.inclusive,
|
|
1203
1203
|
message: a.message
|
|
1204
|
-
}), s.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (r = this._getOrReturnCtx(e, r),
|
|
1204
|
+
}), s.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (r = this._getOrReturnCtx(e, r), m(r, {
|
|
1205
1205
|
code: u.not_multiple_of,
|
|
1206
1206
|
multipleOf: a.value,
|
|
1207
1207
|
message: a.message
|
|
@@ -1210,23 +1210,23 @@ class F extends _ {
|
|
|
1210
1210
|
}
|
|
1211
1211
|
_getInvalidInput(e) {
|
|
1212
1212
|
const t = this._getOrReturnCtx(e);
|
|
1213
|
-
return
|
|
1213
|
+
return m(t, {
|
|
1214
1214
|
code: u.invalid_type,
|
|
1215
|
-
expected:
|
|
1215
|
+
expected: f.bigint,
|
|
1216
1216
|
received: t.parsedType
|
|
1217
|
-
}),
|
|
1217
|
+
}), y;
|
|
1218
1218
|
}
|
|
1219
1219
|
gte(e, t) {
|
|
1220
|
-
return this.setLimit("min", e, !0,
|
|
1220
|
+
return this.setLimit("min", e, !0, h.toString(t));
|
|
1221
1221
|
}
|
|
1222
1222
|
gt(e, t) {
|
|
1223
|
-
return this.setLimit("min", e, !1,
|
|
1223
|
+
return this.setLimit("min", e, !1, h.toString(t));
|
|
1224
1224
|
}
|
|
1225
1225
|
lte(e, t) {
|
|
1226
|
-
return this.setLimit("max", e, !0,
|
|
1226
|
+
return this.setLimit("max", e, !0, h.toString(t));
|
|
1227
1227
|
}
|
|
1228
1228
|
lt(e, t) {
|
|
1229
|
-
return this.setLimit("max", e, !1,
|
|
1229
|
+
return this.setLimit("max", e, !1, h.toString(t));
|
|
1230
1230
|
}
|
|
1231
1231
|
setLimit(e, t, r, s) {
|
|
1232
1232
|
return new F({
|
|
@@ -1237,7 +1237,7 @@ class F extends _ {
|
|
|
1237
1237
|
kind: e,
|
|
1238
1238
|
value: t,
|
|
1239
1239
|
inclusive: r,
|
|
1240
|
-
message:
|
|
1240
|
+
message: h.toString(s)
|
|
1241
1241
|
}
|
|
1242
1242
|
]
|
|
1243
1243
|
});
|
|
@@ -1253,7 +1253,7 @@ class F extends _ {
|
|
|
1253
1253
|
kind: "min",
|
|
1254
1254
|
value: BigInt(0),
|
|
1255
1255
|
inclusive: !1,
|
|
1256
|
-
message:
|
|
1256
|
+
message: h.toString(e)
|
|
1257
1257
|
});
|
|
1258
1258
|
}
|
|
1259
1259
|
negative(e) {
|
|
@@ -1261,7 +1261,7 @@ class F extends _ {
|
|
|
1261
1261
|
kind: "max",
|
|
1262
1262
|
value: BigInt(0),
|
|
1263
1263
|
inclusive: !1,
|
|
1264
|
-
message:
|
|
1264
|
+
message: h.toString(e)
|
|
1265
1265
|
});
|
|
1266
1266
|
}
|
|
1267
1267
|
nonpositive(e) {
|
|
@@ -1269,7 +1269,7 @@ class F extends _ {
|
|
|
1269
1269
|
kind: "max",
|
|
1270
1270
|
value: BigInt(0),
|
|
1271
1271
|
inclusive: !0,
|
|
1272
|
-
message:
|
|
1272
|
+
message: h.toString(e)
|
|
1273
1273
|
});
|
|
1274
1274
|
}
|
|
1275
1275
|
nonnegative(e) {
|
|
@@ -1277,14 +1277,14 @@ class F extends _ {
|
|
|
1277
1277
|
kind: "min",
|
|
1278
1278
|
value: BigInt(0),
|
|
1279
1279
|
inclusive: !0,
|
|
1280
|
-
message:
|
|
1280
|
+
message: h.toString(e)
|
|
1281
1281
|
});
|
|
1282
1282
|
}
|
|
1283
1283
|
multipleOf(e, t) {
|
|
1284
1284
|
return this._addCheck({
|
|
1285
1285
|
kind: "multipleOf",
|
|
1286
1286
|
value: e,
|
|
1287
|
-
message:
|
|
1287
|
+
message: h.toString(t)
|
|
1288
1288
|
});
|
|
1289
1289
|
}
|
|
1290
1290
|
get minValue() {
|
|
@@ -1304,56 +1304,56 @@ F.create = (n) => {
|
|
|
1304
1304
|
var e;
|
|
1305
1305
|
return new F({
|
|
1306
1306
|
checks: [],
|
|
1307
|
-
typeName:
|
|
1307
|
+
typeName: g.ZodBigInt,
|
|
1308
1308
|
coerce: (e = n == null ? void 0 : n.coerce) !== null && e !== void 0 ? e : !1,
|
|
1309
1309
|
...v(n)
|
|
1310
1310
|
});
|
|
1311
1311
|
};
|
|
1312
|
-
class
|
|
1312
|
+
class ae extends _ {
|
|
1313
1313
|
_parse(e) {
|
|
1314
|
-
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !==
|
|
1314
|
+
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== f.boolean) {
|
|
1315
1315
|
const r = this._getOrReturnCtx(e);
|
|
1316
|
-
return
|
|
1316
|
+
return m(r, {
|
|
1317
1317
|
code: u.invalid_type,
|
|
1318
|
-
expected:
|
|
1318
|
+
expected: f.boolean,
|
|
1319
1319
|
received: r.parsedType
|
|
1320
|
-
}),
|
|
1320
|
+
}), y;
|
|
1321
1321
|
}
|
|
1322
1322
|
return I(e.data);
|
|
1323
1323
|
}
|
|
1324
1324
|
}
|
|
1325
|
-
|
|
1326
|
-
typeName:
|
|
1325
|
+
ae.create = (n) => new ae({
|
|
1326
|
+
typeName: g.ZodBoolean,
|
|
1327
1327
|
coerce: (n == null ? void 0 : n.coerce) || !1,
|
|
1328
1328
|
...v(n)
|
|
1329
1329
|
});
|
|
1330
|
-
class
|
|
1330
|
+
class B extends _ {
|
|
1331
1331
|
_parse(e) {
|
|
1332
|
-
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !==
|
|
1332
|
+
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== f.date) {
|
|
1333
1333
|
const a = this._getOrReturnCtx(e);
|
|
1334
|
-
return
|
|
1334
|
+
return m(a, {
|
|
1335
1335
|
code: u.invalid_type,
|
|
1336
|
-
expected:
|
|
1336
|
+
expected: f.date,
|
|
1337
1337
|
received: a.parsedType
|
|
1338
|
-
}),
|
|
1338
|
+
}), y;
|
|
1339
1339
|
}
|
|
1340
1340
|
if (isNaN(e.data.getTime())) {
|
|
1341
1341
|
const a = this._getOrReturnCtx(e);
|
|
1342
|
-
return
|
|
1342
|
+
return m(a, {
|
|
1343
1343
|
code: u.invalid_date
|
|
1344
|
-
}),
|
|
1344
|
+
}), y;
|
|
1345
1345
|
}
|
|
1346
1346
|
const r = new T();
|
|
1347
1347
|
let s;
|
|
1348
1348
|
for (const a of this._def.checks)
|
|
1349
|
-
a.kind === "min" ? e.data.getTime() < a.value && (s = this._getOrReturnCtx(e, s),
|
|
1349
|
+
a.kind === "min" ? e.data.getTime() < a.value && (s = this._getOrReturnCtx(e, s), m(s, {
|
|
1350
1350
|
code: u.too_small,
|
|
1351
1351
|
message: a.message,
|
|
1352
1352
|
inclusive: !0,
|
|
1353
1353
|
exact: !1,
|
|
1354
1354
|
minimum: a.value,
|
|
1355
1355
|
type: "date"
|
|
1356
|
-
}), r.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (s = this._getOrReturnCtx(e, s),
|
|
1356
|
+
}), r.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (s = this._getOrReturnCtx(e, s), m(s, {
|
|
1357
1357
|
code: u.too_big,
|
|
1358
1358
|
message: a.message,
|
|
1359
1359
|
inclusive: !0,
|
|
@@ -1367,7 +1367,7 @@ class q extends _ {
|
|
|
1367
1367
|
};
|
|
1368
1368
|
}
|
|
1369
1369
|
_addCheck(e) {
|
|
1370
|
-
return new
|
|
1370
|
+
return new B({
|
|
1371
1371
|
...this._def,
|
|
1372
1372
|
checks: [...this._def.checks, e]
|
|
1373
1373
|
});
|
|
@@ -1376,14 +1376,14 @@ class q extends _ {
|
|
|
1376
1376
|
return this._addCheck({
|
|
1377
1377
|
kind: "min",
|
|
1378
1378
|
value: e.getTime(),
|
|
1379
|
-
message:
|
|
1379
|
+
message: h.toString(t)
|
|
1380
1380
|
});
|
|
1381
1381
|
}
|
|
1382
1382
|
max(e, t) {
|
|
1383
1383
|
return this._addCheck({
|
|
1384
1384
|
kind: "max",
|
|
1385
1385
|
value: e.getTime(),
|
|
1386
|
-
message:
|
|
1386
|
+
message: h.toString(t)
|
|
1387
1387
|
});
|
|
1388
1388
|
}
|
|
1389
1389
|
get minDate() {
|
|
@@ -1399,61 +1399,61 @@ class q extends _ {
|
|
|
1399
1399
|
return e != null ? new Date(e) : null;
|
|
1400
1400
|
}
|
|
1401
1401
|
}
|
|
1402
|
-
|
|
1402
|
+
B.create = (n) => new B({
|
|
1403
1403
|
checks: [],
|
|
1404
1404
|
coerce: (n == null ? void 0 : n.coerce) || !1,
|
|
1405
|
-
typeName:
|
|
1405
|
+
typeName: g.ZodDate,
|
|
1406
1406
|
...v(n)
|
|
1407
1407
|
});
|
|
1408
|
-
class
|
|
1408
|
+
class xe extends _ {
|
|
1409
1409
|
_parse(e) {
|
|
1410
|
-
if (this._getType(e) !==
|
|
1410
|
+
if (this._getType(e) !== f.symbol) {
|
|
1411
1411
|
const r = this._getOrReturnCtx(e);
|
|
1412
|
-
return
|
|
1412
|
+
return m(r, {
|
|
1413
1413
|
code: u.invalid_type,
|
|
1414
|
-
expected:
|
|
1414
|
+
expected: f.symbol,
|
|
1415
1415
|
received: r.parsedType
|
|
1416
|
-
}),
|
|
1416
|
+
}), y;
|
|
1417
1417
|
}
|
|
1418
1418
|
return I(e.data);
|
|
1419
1419
|
}
|
|
1420
1420
|
}
|
|
1421
|
-
|
|
1422
|
-
typeName:
|
|
1421
|
+
xe.create = (n) => new xe({
|
|
1422
|
+
typeName: g.ZodSymbol,
|
|
1423
1423
|
...v(n)
|
|
1424
1424
|
});
|
|
1425
|
-
class
|
|
1425
|
+
class ie extends _ {
|
|
1426
1426
|
_parse(e) {
|
|
1427
|
-
if (this._getType(e) !==
|
|
1427
|
+
if (this._getType(e) !== f.undefined) {
|
|
1428
1428
|
const r = this._getOrReturnCtx(e);
|
|
1429
|
-
return
|
|
1429
|
+
return m(r, {
|
|
1430
1430
|
code: u.invalid_type,
|
|
1431
|
-
expected:
|
|
1431
|
+
expected: f.undefined,
|
|
1432
1432
|
received: r.parsedType
|
|
1433
|
-
}),
|
|
1433
|
+
}), y;
|
|
1434
1434
|
}
|
|
1435
1435
|
return I(e.data);
|
|
1436
1436
|
}
|
|
1437
1437
|
}
|
|
1438
|
-
|
|
1439
|
-
typeName:
|
|
1438
|
+
ie.create = (n) => new ie({
|
|
1439
|
+
typeName: g.ZodUndefined,
|
|
1440
1440
|
...v(n)
|
|
1441
1441
|
});
|
|
1442
|
-
class
|
|
1442
|
+
class oe extends _ {
|
|
1443
1443
|
_parse(e) {
|
|
1444
|
-
if (this._getType(e) !==
|
|
1444
|
+
if (this._getType(e) !== f.null) {
|
|
1445
1445
|
const r = this._getOrReturnCtx(e);
|
|
1446
|
-
return
|
|
1446
|
+
return m(r, {
|
|
1447
1447
|
code: u.invalid_type,
|
|
1448
|
-
expected:
|
|
1448
|
+
expected: f.null,
|
|
1449
1449
|
received: r.parsedType
|
|
1450
|
-
}),
|
|
1450
|
+
}), y;
|
|
1451
1451
|
}
|
|
1452
1452
|
return I(e.data);
|
|
1453
1453
|
}
|
|
1454
1454
|
}
|
|
1455
|
-
|
|
1456
|
-
typeName:
|
|
1455
|
+
oe.create = (n) => new oe({
|
|
1456
|
+
typeName: g.ZodNull,
|
|
1457
1457
|
...v(n)
|
|
1458
1458
|
});
|
|
1459
1459
|
class H extends _ {
|
|
@@ -1465,7 +1465,7 @@ class H extends _ {
|
|
|
1465
1465
|
}
|
|
1466
1466
|
}
|
|
1467
1467
|
H.create = (n) => new H({
|
|
1468
|
-
typeName:
|
|
1468
|
+
typeName: g.ZodAny,
|
|
1469
1469
|
...v(n)
|
|
1470
1470
|
});
|
|
1471
1471
|
class L extends _ {
|
|
@@ -1477,52 +1477,52 @@ class L extends _ {
|
|
|
1477
1477
|
}
|
|
1478
1478
|
}
|
|
1479
1479
|
L.create = (n) => new L({
|
|
1480
|
-
typeName:
|
|
1480
|
+
typeName: g.ZodUnknown,
|
|
1481
1481
|
...v(n)
|
|
1482
1482
|
});
|
|
1483
1483
|
class $ extends _ {
|
|
1484
1484
|
_parse(e) {
|
|
1485
1485
|
const t = this._getOrReturnCtx(e);
|
|
1486
|
-
return
|
|
1486
|
+
return m(t, {
|
|
1487
1487
|
code: u.invalid_type,
|
|
1488
|
-
expected:
|
|
1488
|
+
expected: f.never,
|
|
1489
1489
|
received: t.parsedType
|
|
1490
|
-
}),
|
|
1490
|
+
}), y;
|
|
1491
1491
|
}
|
|
1492
1492
|
}
|
|
1493
1493
|
$.create = (n) => new $({
|
|
1494
|
-
typeName:
|
|
1494
|
+
typeName: g.ZodNever,
|
|
1495
1495
|
...v(n)
|
|
1496
1496
|
});
|
|
1497
|
-
class
|
|
1497
|
+
class ke extends _ {
|
|
1498
1498
|
_parse(e) {
|
|
1499
|
-
if (this._getType(e) !==
|
|
1499
|
+
if (this._getType(e) !== f.undefined) {
|
|
1500
1500
|
const r = this._getOrReturnCtx(e);
|
|
1501
|
-
return
|
|
1501
|
+
return m(r, {
|
|
1502
1502
|
code: u.invalid_type,
|
|
1503
|
-
expected:
|
|
1503
|
+
expected: f.void,
|
|
1504
1504
|
received: r.parsedType
|
|
1505
|
-
}),
|
|
1505
|
+
}), y;
|
|
1506
1506
|
}
|
|
1507
1507
|
return I(e.data);
|
|
1508
1508
|
}
|
|
1509
1509
|
}
|
|
1510
|
-
|
|
1511
|
-
typeName:
|
|
1510
|
+
ke.create = (n) => new ke({
|
|
1511
|
+
typeName: g.ZodVoid,
|
|
1512
1512
|
...v(n)
|
|
1513
1513
|
});
|
|
1514
|
-
class
|
|
1514
|
+
class C extends _ {
|
|
1515
1515
|
_parse(e) {
|
|
1516
1516
|
const { ctx: t, status: r } = this._processInputParams(e), s = this._def;
|
|
1517
|
-
if (t.parsedType !==
|
|
1518
|
-
return
|
|
1517
|
+
if (t.parsedType !== f.array)
|
|
1518
|
+
return m(t, {
|
|
1519
1519
|
code: u.invalid_type,
|
|
1520
|
-
expected:
|
|
1520
|
+
expected: f.array,
|
|
1521
1521
|
received: t.parsedType
|
|
1522
|
-
}),
|
|
1522
|
+
}), y;
|
|
1523
1523
|
if (s.exactLength !== null) {
|
|
1524
1524
|
const o = t.data.length > s.exactLength.value, c = t.data.length < s.exactLength.value;
|
|
1525
|
-
(o || c) && (
|
|
1525
|
+
(o || c) && (m(t, {
|
|
1526
1526
|
code: o ? u.too_big : u.too_small,
|
|
1527
1527
|
minimum: c ? s.exactLength.value : void 0,
|
|
1528
1528
|
maximum: o ? s.exactLength.value : void 0,
|
|
@@ -1532,14 +1532,14 @@ class Z extends _ {
|
|
|
1532
1532
|
message: s.exactLength.message
|
|
1533
1533
|
}), r.dirty());
|
|
1534
1534
|
}
|
|
1535
|
-
if (s.minLength !== null && t.data.length < s.minLength.value && (
|
|
1535
|
+
if (s.minLength !== null && t.data.length < s.minLength.value && (m(t, {
|
|
1536
1536
|
code: u.too_small,
|
|
1537
1537
|
minimum: s.minLength.value,
|
|
1538
1538
|
type: "array",
|
|
1539
1539
|
inclusive: !0,
|
|
1540
1540
|
exact: !1,
|
|
1541
1541
|
message: s.minLength.message
|
|
1542
|
-
}), r.dirty()), s.maxLength !== null && t.data.length > s.maxLength.value && (
|
|
1542
|
+
}), r.dirty()), s.maxLength !== null && t.data.length > s.maxLength.value && (m(t, {
|
|
1543
1543
|
code: u.too_big,
|
|
1544
1544
|
maximum: s.maxLength.value,
|
|
1545
1545
|
type: "array",
|
|
@@ -1547,41 +1547,41 @@ class Z extends _ {
|
|
|
1547
1547
|
exact: !1,
|
|
1548
1548
|
message: s.maxLength.message
|
|
1549
1549
|
}), r.dirty()), t.common.async)
|
|
1550
|
-
return Promise.all([...t.data].map((o, c) => s.type._parseAsync(new
|
|
1551
|
-
const a = [...t.data].map((o, c) => s.type._parseSync(new
|
|
1550
|
+
return Promise.all([...t.data].map((o, c) => s.type._parseAsync(new O(t, o, t.path, c)))).then((o) => T.mergeArray(r, o));
|
|
1551
|
+
const a = [...t.data].map((o, c) => s.type._parseSync(new O(t, o, t.path, c)));
|
|
1552
1552
|
return T.mergeArray(r, a);
|
|
1553
1553
|
}
|
|
1554
1554
|
get element() {
|
|
1555
1555
|
return this._def.type;
|
|
1556
1556
|
}
|
|
1557
1557
|
min(e, t) {
|
|
1558
|
-
return new
|
|
1558
|
+
return new C({
|
|
1559
1559
|
...this._def,
|
|
1560
|
-
minLength: { value: e, message:
|
|
1560
|
+
minLength: { value: e, message: h.toString(t) }
|
|
1561
1561
|
});
|
|
1562
1562
|
}
|
|
1563
1563
|
max(e, t) {
|
|
1564
|
-
return new
|
|
1564
|
+
return new C({
|
|
1565
1565
|
...this._def,
|
|
1566
|
-
maxLength: { value: e, message:
|
|
1566
|
+
maxLength: { value: e, message: h.toString(t) }
|
|
1567
1567
|
});
|
|
1568
1568
|
}
|
|
1569
1569
|
length(e, t) {
|
|
1570
|
-
return new
|
|
1570
|
+
return new C({
|
|
1571
1571
|
...this._def,
|
|
1572
|
-
exactLength: { value: e, message:
|
|
1572
|
+
exactLength: { value: e, message: h.toString(t) }
|
|
1573
1573
|
});
|
|
1574
1574
|
}
|
|
1575
1575
|
nonempty(e) {
|
|
1576
1576
|
return this.min(1, e);
|
|
1577
1577
|
}
|
|
1578
1578
|
}
|
|
1579
|
-
|
|
1579
|
+
C.create = (n, e) => new C({
|
|
1580
1580
|
type: n,
|
|
1581
1581
|
minLength: null,
|
|
1582
1582
|
maxLength: null,
|
|
1583
1583
|
exactLength: null,
|
|
1584
|
-
typeName:
|
|
1584
|
+
typeName: g.ZodArray,
|
|
1585
1585
|
...v(e)
|
|
1586
1586
|
});
|
|
1587
1587
|
function Q(n) {
|
|
@@ -1589,16 +1589,16 @@ function Q(n) {
|
|
|
1589
1589
|
const e = {};
|
|
1590
1590
|
for (const t in n.shape) {
|
|
1591
1591
|
const r = n.shape[t];
|
|
1592
|
-
e[t] =
|
|
1592
|
+
e[t] = j.create(Q(r));
|
|
1593
1593
|
}
|
|
1594
1594
|
return new k({
|
|
1595
1595
|
...n._def,
|
|
1596
1596
|
shape: () => e
|
|
1597
1597
|
});
|
|
1598
|
-
} else return n instanceof
|
|
1598
|
+
} else return n instanceof C ? new C({
|
|
1599
1599
|
...n._def,
|
|
1600
1600
|
type: Q(n.element)
|
|
1601
|
-
}) : n instanceof
|
|
1601
|
+
}) : n instanceof j ? j.create(Q(n.unwrap())) : n instanceof U ? U.create(Q(n.unwrap())) : n instanceof E ? E.create(n.items.map((e) => Q(e))) : n;
|
|
1602
1602
|
}
|
|
1603
1603
|
class k extends _ {
|
|
1604
1604
|
constructor() {
|
|
@@ -1611,83 +1611,83 @@ class k extends _ {
|
|
|
1611
1611
|
return this._cached = { shape: e, keys: t };
|
|
1612
1612
|
}
|
|
1613
1613
|
_parse(e) {
|
|
1614
|
-
if (this._getType(e) !==
|
|
1615
|
-
const
|
|
1616
|
-
return
|
|
1614
|
+
if (this._getType(e) !== f.object) {
|
|
1615
|
+
const d = this._getOrReturnCtx(e);
|
|
1616
|
+
return m(d, {
|
|
1617
1617
|
code: u.invalid_type,
|
|
1618
|
-
expected:
|
|
1619
|
-
received:
|
|
1620
|
-
}),
|
|
1618
|
+
expected: f.object,
|
|
1619
|
+
received: d.parsedType
|
|
1620
|
+
}), y;
|
|
1621
1621
|
}
|
|
1622
1622
|
const { status: r, ctx: s } = this._processInputParams(e), { shape: a, keys: o } = this._getCached(), c = [];
|
|
1623
1623
|
if (!(this._def.catchall instanceof $ && this._def.unknownKeys === "strip"))
|
|
1624
|
-
for (const
|
|
1625
|
-
o.includes(
|
|
1626
|
-
const
|
|
1627
|
-
for (const
|
|
1628
|
-
const
|
|
1629
|
-
|
|
1630
|
-
key: { status: "valid", value:
|
|
1631
|
-
value:
|
|
1632
|
-
alwaysSet:
|
|
1624
|
+
for (const d in s.data)
|
|
1625
|
+
o.includes(d) || c.push(d);
|
|
1626
|
+
const l = [];
|
|
1627
|
+
for (const d of o) {
|
|
1628
|
+
const p = a[d], b = s.data[d];
|
|
1629
|
+
l.push({
|
|
1630
|
+
key: { status: "valid", value: d },
|
|
1631
|
+
value: p._parse(new O(s, b, s.path, d)),
|
|
1632
|
+
alwaysSet: d in s.data
|
|
1633
1633
|
});
|
|
1634
1634
|
}
|
|
1635
1635
|
if (this._def.catchall instanceof $) {
|
|
1636
|
-
const
|
|
1637
|
-
if (
|
|
1638
|
-
for (const
|
|
1639
|
-
|
|
1640
|
-
key: { status: "valid", value:
|
|
1641
|
-
value: { status: "valid", value: s.data[
|
|
1636
|
+
const d = this._def.unknownKeys;
|
|
1637
|
+
if (d === "passthrough")
|
|
1638
|
+
for (const p of c)
|
|
1639
|
+
l.push({
|
|
1640
|
+
key: { status: "valid", value: p },
|
|
1641
|
+
value: { status: "valid", value: s.data[p] }
|
|
1642
1642
|
});
|
|
1643
|
-
else if (
|
|
1644
|
-
c.length > 0 && (
|
|
1643
|
+
else if (d === "strict")
|
|
1644
|
+
c.length > 0 && (m(s, {
|
|
1645
1645
|
code: u.unrecognized_keys,
|
|
1646
1646
|
keys: c
|
|
1647
1647
|
}), r.dirty());
|
|
1648
|
-
else if (
|
|
1648
|
+
else if (d !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
1649
1649
|
} else {
|
|
1650
|
-
const
|
|
1651
|
-
for (const
|
|
1652
|
-
const b = s.data[
|
|
1653
|
-
|
|
1654
|
-
key: { status: "valid", value:
|
|
1655
|
-
value:
|
|
1656
|
-
new
|
|
1650
|
+
const d = this._def.catchall;
|
|
1651
|
+
for (const p of c) {
|
|
1652
|
+
const b = s.data[p];
|
|
1653
|
+
l.push({
|
|
1654
|
+
key: { status: "valid", value: p },
|
|
1655
|
+
value: d._parse(
|
|
1656
|
+
new O(s, b, s.path, p)
|
|
1657
1657
|
//, ctx.child(key), value, getParsedType(value)
|
|
1658
1658
|
),
|
|
1659
|
-
alwaysSet:
|
|
1659
|
+
alwaysSet: p in s.data
|
|
1660
1660
|
});
|
|
1661
1661
|
}
|
|
1662
1662
|
}
|
|
1663
1663
|
return s.common.async ? Promise.resolve().then(async () => {
|
|
1664
|
-
const
|
|
1665
|
-
for (const
|
|
1666
|
-
const b = await
|
|
1667
|
-
|
|
1664
|
+
const d = [];
|
|
1665
|
+
for (const p of l) {
|
|
1666
|
+
const b = await p.key, w = await p.value;
|
|
1667
|
+
d.push({
|
|
1668
1668
|
key: b,
|
|
1669
1669
|
value: w,
|
|
1670
|
-
alwaysSet:
|
|
1670
|
+
alwaysSet: p.alwaysSet
|
|
1671
1671
|
});
|
|
1672
1672
|
}
|
|
1673
|
-
return
|
|
1674
|
-
}).then((
|
|
1673
|
+
return d;
|
|
1674
|
+
}).then((d) => T.mergeObjectSync(r, d)) : T.mergeObjectSync(r, l);
|
|
1675
1675
|
}
|
|
1676
1676
|
get shape() {
|
|
1677
1677
|
return this._def.shape();
|
|
1678
1678
|
}
|
|
1679
1679
|
strict(e) {
|
|
1680
|
-
return
|
|
1680
|
+
return h.errToObj, new k({
|
|
1681
1681
|
...this._def,
|
|
1682
1682
|
unknownKeys: "strict",
|
|
1683
1683
|
...e !== void 0 ? {
|
|
1684
1684
|
errorMap: (t, r) => {
|
|
1685
1685
|
var s, a, o, c;
|
|
1686
|
-
const
|
|
1686
|
+
const l = (o = (a = (s = this._def).errorMap) === null || a === void 0 ? void 0 : a.call(s, t, r).message) !== null && o !== void 0 ? o : r.defaultError;
|
|
1687
1687
|
return t.code === "unrecognized_keys" ? {
|
|
1688
|
-
message: (c =
|
|
1688
|
+
message: (c = h.errToObj(e).message) !== null && c !== void 0 ? c : l
|
|
1689
1689
|
} : {
|
|
1690
|
-
message:
|
|
1690
|
+
message: l
|
|
1691
1691
|
};
|
|
1692
1692
|
}
|
|
1693
1693
|
} : {}
|
|
@@ -1744,7 +1744,7 @@ class k extends _ {
|
|
|
1744
1744
|
...this._def.shape(),
|
|
1745
1745
|
...e._def.shape()
|
|
1746
1746
|
}),
|
|
1747
|
-
typeName:
|
|
1747
|
+
typeName: g.ZodObject
|
|
1748
1748
|
});
|
|
1749
1749
|
}
|
|
1750
1750
|
// merge<
|
|
@@ -1853,7 +1853,7 @@ class k extends _ {
|
|
|
1853
1853
|
t[r] = this.shape[r];
|
|
1854
1854
|
else {
|
|
1855
1855
|
let a = this.shape[r];
|
|
1856
|
-
for (; a instanceof
|
|
1856
|
+
for (; a instanceof j; )
|
|
1857
1857
|
a = a._def.innerType;
|
|
1858
1858
|
t[r] = a;
|
|
1859
1859
|
}
|
|
@@ -1863,31 +1863,31 @@ class k extends _ {
|
|
|
1863
1863
|
});
|
|
1864
1864
|
}
|
|
1865
1865
|
keyof() {
|
|
1866
|
-
return
|
|
1866
|
+
return Be(x.objectKeys(this.shape));
|
|
1867
1867
|
}
|
|
1868
1868
|
}
|
|
1869
1869
|
k.create = (n, e) => new k({
|
|
1870
1870
|
shape: () => n,
|
|
1871
1871
|
unknownKeys: "strip",
|
|
1872
1872
|
catchall: $.create(),
|
|
1873
|
-
typeName:
|
|
1873
|
+
typeName: g.ZodObject,
|
|
1874
1874
|
...v(e)
|
|
1875
1875
|
});
|
|
1876
1876
|
k.strictCreate = (n, e) => new k({
|
|
1877
1877
|
shape: () => n,
|
|
1878
1878
|
unknownKeys: "strict",
|
|
1879
1879
|
catchall: $.create(),
|
|
1880
|
-
typeName:
|
|
1880
|
+
typeName: g.ZodObject,
|
|
1881
1881
|
...v(e)
|
|
1882
1882
|
});
|
|
1883
1883
|
k.lazycreate = (n, e) => new k({
|
|
1884
1884
|
shape: n,
|
|
1885
1885
|
unknownKeys: "strip",
|
|
1886
1886
|
catchall: $.create(),
|
|
1887
|
-
typeName:
|
|
1887
|
+
typeName: g.ZodObject,
|
|
1888
1888
|
...v(e)
|
|
1889
1889
|
});
|
|
1890
|
-
class
|
|
1890
|
+
class ce extends _ {
|
|
1891
1891
|
_parse(e) {
|
|
1892
1892
|
const { ctx: t } = this._processInputParams(e), r = this._def.options;
|
|
1893
1893
|
function s(a) {
|
|
@@ -1897,11 +1897,11 @@ class oe extends _ {
|
|
|
1897
1897
|
for (const c of a)
|
|
1898
1898
|
if (c.result.status === "dirty")
|
|
1899
1899
|
return t.common.issues.push(...c.ctx.common.issues), c.result;
|
|
1900
|
-
const o = a.map((c) => new
|
|
1901
|
-
return
|
|
1900
|
+
const o = a.map((c) => new S(c.ctx.common.issues));
|
|
1901
|
+
return m(t, {
|
|
1902
1902
|
code: u.invalid_union,
|
|
1903
1903
|
unionErrors: o
|
|
1904
|
-
}),
|
|
1904
|
+
}), y;
|
|
1905
1905
|
}
|
|
1906
1906
|
if (t.common.async)
|
|
1907
1907
|
return Promise.all(r.map(async (a) => {
|
|
@@ -1925,51 +1925,51 @@ class oe extends _ {
|
|
|
1925
1925
|
{
|
|
1926
1926
|
let a;
|
|
1927
1927
|
const o = [];
|
|
1928
|
-
for (const
|
|
1929
|
-
const
|
|
1928
|
+
for (const l of r) {
|
|
1929
|
+
const d = {
|
|
1930
1930
|
...t,
|
|
1931
1931
|
common: {
|
|
1932
1932
|
...t.common,
|
|
1933
1933
|
issues: []
|
|
1934
1934
|
},
|
|
1935
1935
|
parent: null
|
|
1936
|
-
},
|
|
1936
|
+
}, p = l._parseSync({
|
|
1937
1937
|
data: t.data,
|
|
1938
1938
|
path: t.path,
|
|
1939
|
-
parent:
|
|
1939
|
+
parent: d
|
|
1940
1940
|
});
|
|
1941
|
-
if (
|
|
1942
|
-
return
|
|
1943
|
-
|
|
1941
|
+
if (p.status === "valid")
|
|
1942
|
+
return p;
|
|
1943
|
+
p.status === "dirty" && !a && (a = { result: p, ctx: d }), d.common.issues.length && o.push(d.common.issues);
|
|
1944
1944
|
}
|
|
1945
1945
|
if (a)
|
|
1946
1946
|
return t.common.issues.push(...a.ctx.common.issues), a.result;
|
|
1947
|
-
const c = o.map((
|
|
1948
|
-
return
|
|
1947
|
+
const c = o.map((l) => new S(l));
|
|
1948
|
+
return m(t, {
|
|
1949
1949
|
code: u.invalid_union,
|
|
1950
1950
|
unionErrors: c
|
|
1951
|
-
}),
|
|
1951
|
+
}), y;
|
|
1952
1952
|
}
|
|
1953
1953
|
}
|
|
1954
1954
|
get options() {
|
|
1955
1955
|
return this._def.options;
|
|
1956
1956
|
}
|
|
1957
1957
|
}
|
|
1958
|
-
|
|
1958
|
+
ce.create = (n, e) => new ce({
|
|
1959
1959
|
options: n,
|
|
1960
|
-
typeName:
|
|
1960
|
+
typeName: g.ZodUnion,
|
|
1961
1961
|
...v(e)
|
|
1962
1962
|
});
|
|
1963
|
-
const P = (n) => n instanceof
|
|
1964
|
-
class
|
|
1963
|
+
const P = (n) => n instanceof le ? P(n.schema) : n instanceof Z ? P(n.innerType()) : n instanceof me ? [n.value] : n instanceof z ? n.options : n instanceof fe ? x.objectValues(n.enum) : n instanceof pe ? P(n._def.innerType) : n instanceof ie ? [void 0] : n instanceof oe ? [null] : n instanceof j ? [void 0, ...P(n.unwrap())] : n instanceof U ? [null, ...P(n.unwrap())] : n instanceof Ee || n instanceof ge ? P(n.unwrap()) : n instanceof he ? P(n._def.innerType) : [];
|
|
1964
|
+
class Ie extends _ {
|
|
1965
1965
|
_parse(e) {
|
|
1966
1966
|
const { ctx: t } = this._processInputParams(e);
|
|
1967
|
-
if (t.parsedType !==
|
|
1968
|
-
return
|
|
1967
|
+
if (t.parsedType !== f.object)
|
|
1968
|
+
return m(t, {
|
|
1969
1969
|
code: u.invalid_type,
|
|
1970
|
-
expected:
|
|
1970
|
+
expected: f.object,
|
|
1971
1971
|
received: t.parsedType
|
|
1972
|
-
}),
|
|
1972
|
+
}), y;
|
|
1973
1973
|
const r = this.discriminator, s = t.data[r], a = this.optionsMap.get(s);
|
|
1974
1974
|
return a ? t.common.async ? a._parseAsync({
|
|
1975
1975
|
data: t.data,
|
|
@@ -1979,11 +1979,11 @@ class Te extends _ {
|
|
|
1979
1979
|
data: t.data,
|
|
1980
1980
|
path: t.path,
|
|
1981
1981
|
parent: t
|
|
1982
|
-
}) : (
|
|
1982
|
+
}) : (m(t, {
|
|
1983
1983
|
code: u.invalid_union_discriminator,
|
|
1984
1984
|
options: Array.from(this.optionsMap.keys()),
|
|
1985
1985
|
path: [r]
|
|
1986
|
-
}),
|
|
1986
|
+
}), y);
|
|
1987
1987
|
}
|
|
1988
1988
|
get discriminator() {
|
|
1989
1989
|
return this._def.discriminator;
|
|
@@ -2014,8 +2014,8 @@ class Te extends _ {
|
|
|
2014
2014
|
s.set(c, a);
|
|
2015
2015
|
}
|
|
2016
2016
|
}
|
|
2017
|
-
return new
|
|
2018
|
-
typeName:
|
|
2017
|
+
return new Ie({
|
|
2018
|
+
typeName: g.ZodDiscriminatedUnion,
|
|
2019
2019
|
discriminator: e,
|
|
2020
2020
|
options: t,
|
|
2021
2021
|
optionsMap: s,
|
|
@@ -2023,41 +2023,41 @@ class Te extends _ {
|
|
|
2023
2023
|
});
|
|
2024
2024
|
}
|
|
2025
2025
|
}
|
|
2026
|
-
function
|
|
2026
|
+
function Oe(n, e) {
|
|
2027
2027
|
const t = R(n), r = R(e);
|
|
2028
2028
|
if (n === e)
|
|
2029
2029
|
return { valid: !0, data: n };
|
|
2030
|
-
if (t ===
|
|
2030
|
+
if (t === f.object && r === f.object) {
|
|
2031
2031
|
const s = x.objectKeys(e), a = x.objectKeys(n).filter((c) => s.indexOf(c) !== -1), o = { ...n, ...e };
|
|
2032
2032
|
for (const c of a) {
|
|
2033
|
-
const
|
|
2034
|
-
if (!
|
|
2033
|
+
const l = Oe(n[c], e[c]);
|
|
2034
|
+
if (!l.valid)
|
|
2035
2035
|
return { valid: !1 };
|
|
2036
|
-
o[c] =
|
|
2036
|
+
o[c] = l.data;
|
|
2037
2037
|
}
|
|
2038
2038
|
return { valid: !0, data: o };
|
|
2039
|
-
} else if (t ===
|
|
2039
|
+
} else if (t === f.array && r === f.array) {
|
|
2040
2040
|
if (n.length !== e.length)
|
|
2041
2041
|
return { valid: !1 };
|
|
2042
2042
|
const s = [];
|
|
2043
2043
|
for (let a = 0; a < n.length; a++) {
|
|
2044
|
-
const o = n[a], c = e[a],
|
|
2045
|
-
if (!
|
|
2044
|
+
const o = n[a], c = e[a], l = Oe(o, c);
|
|
2045
|
+
if (!l.valid)
|
|
2046
2046
|
return { valid: !1 };
|
|
2047
|
-
s.push(
|
|
2047
|
+
s.push(l.data);
|
|
2048
2048
|
}
|
|
2049
2049
|
return { valid: !0, data: s };
|
|
2050
|
-
} else return t ===
|
|
2050
|
+
} else return t === f.date && r === f.date && +n == +e ? { valid: !0, data: n } : { valid: !1 };
|
|
2051
2051
|
}
|
|
2052
|
-
class
|
|
2052
|
+
class de extends _ {
|
|
2053
2053
|
_parse(e) {
|
|
2054
2054
|
const { status: t, ctx: r } = this._processInputParams(e), s = (a, o) => {
|
|
2055
|
-
if (
|
|
2056
|
-
return
|
|
2057
|
-
const c =
|
|
2058
|
-
return c.valid ? ((
|
|
2055
|
+
if (De(a) || De(o))
|
|
2056
|
+
return y;
|
|
2057
|
+
const c = Oe(a.value, o.value);
|
|
2058
|
+
return c.valid ? ((je(a) || je(o)) && t.dirty(), { status: t.value, value: c.data }) : (m(r, {
|
|
2059
2059
|
code: u.invalid_intersection_types
|
|
2060
|
-
}),
|
|
2060
|
+
}), y);
|
|
2061
2061
|
};
|
|
2062
2062
|
return r.common.async ? Promise.all([
|
|
2063
2063
|
this._def.left._parseAsync({
|
|
@@ -2081,30 +2081,30 @@ class ce extends _ {
|
|
|
2081
2081
|
}));
|
|
2082
2082
|
}
|
|
2083
2083
|
}
|
|
2084
|
-
|
|
2084
|
+
de.create = (n, e, t) => new de({
|
|
2085
2085
|
left: n,
|
|
2086
2086
|
right: e,
|
|
2087
|
-
typeName:
|
|
2087
|
+
typeName: g.ZodIntersection,
|
|
2088
2088
|
...v(t)
|
|
2089
2089
|
});
|
|
2090
2090
|
class E extends _ {
|
|
2091
2091
|
_parse(e) {
|
|
2092
2092
|
const { status: t, ctx: r } = this._processInputParams(e);
|
|
2093
|
-
if (r.parsedType !==
|
|
2094
|
-
return
|
|
2093
|
+
if (r.parsedType !== f.array)
|
|
2094
|
+
return m(r, {
|
|
2095
2095
|
code: u.invalid_type,
|
|
2096
|
-
expected:
|
|
2096
|
+
expected: f.array,
|
|
2097
2097
|
received: r.parsedType
|
|
2098
|
-
}),
|
|
2098
|
+
}), y;
|
|
2099
2099
|
if (r.data.length < this._def.items.length)
|
|
2100
|
-
return
|
|
2100
|
+
return m(r, {
|
|
2101
2101
|
code: u.too_small,
|
|
2102
2102
|
minimum: this._def.items.length,
|
|
2103
2103
|
inclusive: !0,
|
|
2104
2104
|
exact: !1,
|
|
2105
2105
|
type: "array"
|
|
2106
|
-
}),
|
|
2107
|
-
!this._def.rest && r.data.length > this._def.items.length && (
|
|
2106
|
+
}), y;
|
|
2107
|
+
!this._def.rest && r.data.length > this._def.items.length && (m(r, {
|
|
2108
2108
|
code: u.too_big,
|
|
2109
2109
|
maximum: this._def.items.length,
|
|
2110
2110
|
inclusive: !0,
|
|
@@ -2112,8 +2112,8 @@ class E extends _ {
|
|
|
2112
2112
|
type: "array"
|
|
2113
2113
|
}), t.dirty());
|
|
2114
2114
|
const a = [...r.data].map((o, c) => {
|
|
2115
|
-
const
|
|
2116
|
-
return
|
|
2115
|
+
const l = this._def.items[c] || this._def.rest;
|
|
2116
|
+
return l ? l._parse(new O(r, o, r.path, c)) : null;
|
|
2117
2117
|
}).filter((o) => !!o);
|
|
2118
2118
|
return r.common.async ? Promise.all(a).then((o) => T.mergeArray(t, o)) : T.mergeArray(t, a);
|
|
2119
2119
|
}
|
|
@@ -2132,12 +2132,12 @@ E.create = (n, e) => {
|
|
|
2132
2132
|
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
2133
2133
|
return new E({
|
|
2134
2134
|
items: n,
|
|
2135
|
-
typeName:
|
|
2135
|
+
typeName: g.ZodTuple,
|
|
2136
2136
|
rest: null,
|
|
2137
2137
|
...v(e)
|
|
2138
2138
|
});
|
|
2139
2139
|
};
|
|
2140
|
-
class
|
|
2140
|
+
class ue extends _ {
|
|
2141
2141
|
get keySchema() {
|
|
2142
2142
|
return this._def.keyType;
|
|
2143
2143
|
}
|
|
@@ -2146,17 +2146,17 @@ class de extends _ {
|
|
|
2146
2146
|
}
|
|
2147
2147
|
_parse(e) {
|
|
2148
2148
|
const { status: t, ctx: r } = this._processInputParams(e);
|
|
2149
|
-
if (r.parsedType !==
|
|
2150
|
-
return
|
|
2149
|
+
if (r.parsedType !== f.object)
|
|
2150
|
+
return m(r, {
|
|
2151
2151
|
code: u.invalid_type,
|
|
2152
|
-
expected:
|
|
2152
|
+
expected: f.object,
|
|
2153
2153
|
received: r.parsedType
|
|
2154
|
-
}),
|
|
2154
|
+
}), y;
|
|
2155
2155
|
const s = [], a = this._def.keyType, o = this._def.valueType;
|
|
2156
2156
|
for (const c in r.data)
|
|
2157
2157
|
s.push({
|
|
2158
|
-
key: a._parse(new
|
|
2159
|
-
value: o._parse(new
|
|
2158
|
+
key: a._parse(new O(r, c, r.path, c)),
|
|
2159
|
+
value: o._parse(new O(r, r.data[c], r.path, c)),
|
|
2160
2160
|
alwaysSet: c in r.data
|
|
2161
2161
|
});
|
|
2162
2162
|
return r.common.async ? T.mergeObjectAsync(t, s) : T.mergeObjectSync(t, s);
|
|
@@ -2165,20 +2165,20 @@ class de extends _ {
|
|
|
2165
2165
|
return this._def.valueType;
|
|
2166
2166
|
}
|
|
2167
2167
|
static create(e, t, r) {
|
|
2168
|
-
return t instanceof _ ? new
|
|
2168
|
+
return t instanceof _ ? new ue({
|
|
2169
2169
|
keyType: e,
|
|
2170
2170
|
valueType: t,
|
|
2171
|
-
typeName:
|
|
2171
|
+
typeName: g.ZodRecord,
|
|
2172
2172
|
...v(r)
|
|
2173
|
-
}) : new
|
|
2173
|
+
}) : new ue({
|
|
2174
2174
|
keyType: N.create(),
|
|
2175
2175
|
valueType: e,
|
|
2176
|
-
typeName:
|
|
2176
|
+
typeName: g.ZodRecord,
|
|
2177
2177
|
...v(t)
|
|
2178
2178
|
});
|
|
2179
2179
|
}
|
|
2180
2180
|
}
|
|
2181
|
-
class
|
|
2181
|
+
class we extends _ {
|
|
2182
2182
|
get keySchema() {
|
|
2183
2183
|
return this._def.keyType;
|
|
2184
2184
|
}
|
|
@@ -2187,63 +2187,63 @@ class ke extends _ {
|
|
|
2187
2187
|
}
|
|
2188
2188
|
_parse(e) {
|
|
2189
2189
|
const { status: t, ctx: r } = this._processInputParams(e);
|
|
2190
|
-
if (r.parsedType !==
|
|
2191
|
-
return
|
|
2190
|
+
if (r.parsedType !== f.map)
|
|
2191
|
+
return m(r, {
|
|
2192
2192
|
code: u.invalid_type,
|
|
2193
|
-
expected:
|
|
2193
|
+
expected: f.map,
|
|
2194
2194
|
received: r.parsedType
|
|
2195
|
-
}),
|
|
2196
|
-
const s = this._def.keyType, a = this._def.valueType, o = [...r.data.entries()].map(([c,
|
|
2197
|
-
key: s._parse(new
|
|
2198
|
-
value: a._parse(new
|
|
2195
|
+
}), y;
|
|
2196
|
+
const s = this._def.keyType, a = this._def.valueType, o = [...r.data.entries()].map(([c, l], d) => ({
|
|
2197
|
+
key: s._parse(new O(r, c, r.path, [d, "key"])),
|
|
2198
|
+
value: a._parse(new O(r, l, r.path, [d, "value"]))
|
|
2199
2199
|
}));
|
|
2200
2200
|
if (r.common.async) {
|
|
2201
2201
|
const c = /* @__PURE__ */ new Map();
|
|
2202
2202
|
return Promise.resolve().then(async () => {
|
|
2203
|
-
for (const
|
|
2204
|
-
const
|
|
2205
|
-
if (
|
|
2206
|
-
return
|
|
2207
|
-
(
|
|
2203
|
+
for (const l of o) {
|
|
2204
|
+
const d = await l.key, p = await l.value;
|
|
2205
|
+
if (d.status === "aborted" || p.status === "aborted")
|
|
2206
|
+
return y;
|
|
2207
|
+
(d.status === "dirty" || p.status === "dirty") && t.dirty(), c.set(d.value, p.value);
|
|
2208
2208
|
}
|
|
2209
2209
|
return { status: t.value, value: c };
|
|
2210
2210
|
});
|
|
2211
2211
|
} else {
|
|
2212
2212
|
const c = /* @__PURE__ */ new Map();
|
|
2213
|
-
for (const
|
|
2214
|
-
const
|
|
2215
|
-
if (
|
|
2216
|
-
return
|
|
2217
|
-
(
|
|
2213
|
+
for (const l of o) {
|
|
2214
|
+
const d = l.key, p = l.value;
|
|
2215
|
+
if (d.status === "aborted" || p.status === "aborted")
|
|
2216
|
+
return y;
|
|
2217
|
+
(d.status === "dirty" || p.status === "dirty") && t.dirty(), c.set(d.value, p.value);
|
|
2218
2218
|
}
|
|
2219
2219
|
return { status: t.value, value: c };
|
|
2220
2220
|
}
|
|
2221
2221
|
}
|
|
2222
2222
|
}
|
|
2223
|
-
|
|
2223
|
+
we.create = (n, e, t) => new we({
|
|
2224
2224
|
valueType: e,
|
|
2225
2225
|
keyType: n,
|
|
2226
|
-
typeName:
|
|
2226
|
+
typeName: g.ZodMap,
|
|
2227
2227
|
...v(t)
|
|
2228
2228
|
});
|
|
2229
2229
|
class W extends _ {
|
|
2230
2230
|
_parse(e) {
|
|
2231
2231
|
const { status: t, ctx: r } = this._processInputParams(e);
|
|
2232
|
-
if (r.parsedType !==
|
|
2233
|
-
return
|
|
2232
|
+
if (r.parsedType !== f.set)
|
|
2233
|
+
return m(r, {
|
|
2234
2234
|
code: u.invalid_type,
|
|
2235
|
-
expected:
|
|
2235
|
+
expected: f.set,
|
|
2236
2236
|
received: r.parsedType
|
|
2237
|
-
}),
|
|
2237
|
+
}), y;
|
|
2238
2238
|
const s = this._def;
|
|
2239
|
-
s.minSize !== null && r.data.size < s.minSize.value && (
|
|
2239
|
+
s.minSize !== null && r.data.size < s.minSize.value && (m(r, {
|
|
2240
2240
|
code: u.too_small,
|
|
2241
2241
|
minimum: s.minSize.value,
|
|
2242
2242
|
type: "set",
|
|
2243
2243
|
inclusive: !0,
|
|
2244
2244
|
exact: !1,
|
|
2245
2245
|
message: s.minSize.message
|
|
2246
|
-
}), t.dirty()), s.maxSize !== null && r.data.size > s.maxSize.value && (
|
|
2246
|
+
}), t.dirty()), s.maxSize !== null && r.data.size > s.maxSize.value && (m(r, {
|
|
2247
2247
|
code: u.too_big,
|
|
2248
2248
|
maximum: s.maxSize.value,
|
|
2249
2249
|
type: "set",
|
|
@@ -2252,28 +2252,28 @@ class W extends _ {
|
|
|
2252
2252
|
message: s.maxSize.message
|
|
2253
2253
|
}), t.dirty());
|
|
2254
2254
|
const a = this._def.valueType;
|
|
2255
|
-
function o(
|
|
2256
|
-
const
|
|
2257
|
-
for (const
|
|
2258
|
-
if (
|
|
2259
|
-
return
|
|
2260
|
-
|
|
2255
|
+
function o(l) {
|
|
2256
|
+
const d = /* @__PURE__ */ new Set();
|
|
2257
|
+
for (const p of l) {
|
|
2258
|
+
if (p.status === "aborted")
|
|
2259
|
+
return y;
|
|
2260
|
+
p.status === "dirty" && t.dirty(), d.add(p.value);
|
|
2261
2261
|
}
|
|
2262
|
-
return { status: t.value, value:
|
|
2262
|
+
return { status: t.value, value: d };
|
|
2263
2263
|
}
|
|
2264
|
-
const c = [...r.data.values()].map((
|
|
2265
|
-
return r.common.async ? Promise.all(c).then((
|
|
2264
|
+
const c = [...r.data.values()].map((l, d) => a._parse(new O(r, l, r.path, d)));
|
|
2265
|
+
return r.common.async ? Promise.all(c).then((l) => o(l)) : o(c);
|
|
2266
2266
|
}
|
|
2267
2267
|
min(e, t) {
|
|
2268
2268
|
return new W({
|
|
2269
2269
|
...this._def,
|
|
2270
|
-
minSize: { value: e, message:
|
|
2270
|
+
minSize: { value: e, message: h.toString(t) }
|
|
2271
2271
|
});
|
|
2272
2272
|
}
|
|
2273
2273
|
max(e, t) {
|
|
2274
2274
|
return new W({
|
|
2275
2275
|
...this._def,
|
|
2276
|
-
maxSize: { value: e, message:
|
|
2276
|
+
maxSize: { value: e, message: h.toString(t) }
|
|
2277
2277
|
});
|
|
2278
2278
|
}
|
|
2279
2279
|
size(e, t) {
|
|
@@ -2287,7 +2287,7 @@ W.create = (n, e) => new W({
|
|
|
2287
2287
|
valueType: n,
|
|
2288
2288
|
minSize: null,
|
|
2289
2289
|
maxSize: null,
|
|
2290
|
-
typeName:
|
|
2290
|
+
typeName: g.ZodSet,
|
|
2291
2291
|
...v(e)
|
|
2292
2292
|
});
|
|
2293
2293
|
class J extends _ {
|
|
@@ -2296,64 +2296,64 @@ class J extends _ {
|
|
|
2296
2296
|
}
|
|
2297
2297
|
_parse(e) {
|
|
2298
2298
|
const { ctx: t } = this._processInputParams(e);
|
|
2299
|
-
if (t.parsedType !==
|
|
2300
|
-
return
|
|
2299
|
+
if (t.parsedType !== f.function)
|
|
2300
|
+
return m(t, {
|
|
2301
2301
|
code: u.invalid_type,
|
|
2302
|
-
expected:
|
|
2302
|
+
expected: f.function,
|
|
2303
2303
|
received: t.parsedType
|
|
2304
|
-
}),
|
|
2305
|
-
function r(c,
|
|
2306
|
-
return
|
|
2304
|
+
}), y;
|
|
2305
|
+
function r(c, l) {
|
|
2306
|
+
return _e({
|
|
2307
2307
|
data: c,
|
|
2308
2308
|
path: t.path,
|
|
2309
2309
|
errorMaps: [
|
|
2310
2310
|
t.common.contextualErrorMap,
|
|
2311
2311
|
t.schemaErrorMap,
|
|
2312
|
-
|
|
2312
|
+
ve(),
|
|
2313
2313
|
X
|
|
2314
|
-
].filter((
|
|
2314
|
+
].filter((d) => !!d),
|
|
2315
2315
|
issueData: {
|
|
2316
2316
|
code: u.invalid_arguments,
|
|
2317
|
-
argumentsError:
|
|
2317
|
+
argumentsError: l
|
|
2318
2318
|
}
|
|
2319
2319
|
});
|
|
2320
2320
|
}
|
|
2321
|
-
function s(c,
|
|
2322
|
-
return
|
|
2321
|
+
function s(c, l) {
|
|
2322
|
+
return _e({
|
|
2323
2323
|
data: c,
|
|
2324
2324
|
path: t.path,
|
|
2325
2325
|
errorMaps: [
|
|
2326
2326
|
t.common.contextualErrorMap,
|
|
2327
2327
|
t.schemaErrorMap,
|
|
2328
|
-
|
|
2328
|
+
ve(),
|
|
2329
2329
|
X
|
|
2330
|
-
].filter((
|
|
2330
|
+
].filter((d) => !!d),
|
|
2331
2331
|
issueData: {
|
|
2332
2332
|
code: u.invalid_return_type,
|
|
2333
|
-
returnTypeError:
|
|
2333
|
+
returnTypeError: l
|
|
2334
2334
|
}
|
|
2335
2335
|
});
|
|
2336
2336
|
}
|
|
2337
2337
|
const a = { errorMap: t.common.contextualErrorMap }, o = t.data;
|
|
2338
2338
|
if (this._def.returns instanceof G) {
|
|
2339
2339
|
const c = this;
|
|
2340
|
-
return I(async function(...
|
|
2341
|
-
const
|
|
2342
|
-
throw
|
|
2343
|
-
}), b = await Reflect.apply(o, this,
|
|
2344
|
-
return await c._def.returns._def.type.parseAsync(b, a).catch((
|
|
2345
|
-
throw
|
|
2340
|
+
return I(async function(...l) {
|
|
2341
|
+
const d = new S([]), p = await c._def.args.parseAsync(l, a).catch((A) => {
|
|
2342
|
+
throw d.addIssue(r(l, A)), d;
|
|
2343
|
+
}), b = await Reflect.apply(o, this, p);
|
|
2344
|
+
return await c._def.returns._def.type.parseAsync(b, a).catch((A) => {
|
|
2345
|
+
throw d.addIssue(s(b, A)), d;
|
|
2346
2346
|
});
|
|
2347
2347
|
});
|
|
2348
2348
|
} else {
|
|
2349
2349
|
const c = this;
|
|
2350
|
-
return I(function(...
|
|
2351
|
-
const
|
|
2352
|
-
if (!
|
|
2353
|
-
throw new
|
|
2354
|
-
const
|
|
2350
|
+
return I(function(...l) {
|
|
2351
|
+
const d = c._def.args.safeParse(l, a);
|
|
2352
|
+
if (!d.success)
|
|
2353
|
+
throw new S([r(l, d.error)]);
|
|
2354
|
+
const p = Reflect.apply(o, this, d.data), b = c._def.returns.safeParse(p, a);
|
|
2355
2355
|
if (!b.success)
|
|
2356
|
-
throw new
|
|
2356
|
+
throw new S([s(p, b.error)]);
|
|
2357
2357
|
return b.data;
|
|
2358
2358
|
});
|
|
2359
2359
|
}
|
|
@@ -2386,12 +2386,12 @@ class J extends _ {
|
|
|
2386
2386
|
return new J({
|
|
2387
2387
|
args: e || E.create([]).rest(L.create()),
|
|
2388
2388
|
returns: t || L.create(),
|
|
2389
|
-
typeName:
|
|
2389
|
+
typeName: g.ZodFunction,
|
|
2390
2390
|
...v(r)
|
|
2391
2391
|
});
|
|
2392
2392
|
}
|
|
2393
2393
|
}
|
|
2394
|
-
class
|
|
2394
|
+
class le extends _ {
|
|
2395
2395
|
get schema() {
|
|
2396
2396
|
return this._def.getter();
|
|
2397
2397
|
}
|
|
@@ -2400,20 +2400,20 @@ class ue extends _ {
|
|
|
2400
2400
|
return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
|
|
2401
2401
|
}
|
|
2402
2402
|
}
|
|
2403
|
-
|
|
2403
|
+
le.create = (n, e) => new le({
|
|
2404
2404
|
getter: n,
|
|
2405
|
-
typeName:
|
|
2405
|
+
typeName: g.ZodLazy,
|
|
2406
2406
|
...v(e)
|
|
2407
2407
|
});
|
|
2408
|
-
class
|
|
2408
|
+
class me extends _ {
|
|
2409
2409
|
_parse(e) {
|
|
2410
2410
|
if (e.data !== this._def.value) {
|
|
2411
2411
|
const t = this._getOrReturnCtx(e);
|
|
2412
|
-
return
|
|
2412
|
+
return m(t, {
|
|
2413
2413
|
received: t.data,
|
|
2414
2414
|
code: u.invalid_literal,
|
|
2415
2415
|
expected: this._def.value
|
|
2416
|
-
}),
|
|
2416
|
+
}), y;
|
|
2417
2417
|
}
|
|
2418
2418
|
return { status: "valid", value: e.data };
|
|
2419
2419
|
}
|
|
@@ -2421,38 +2421,38 @@ class le extends _ {
|
|
|
2421
2421
|
return this._def.value;
|
|
2422
2422
|
}
|
|
2423
2423
|
}
|
|
2424
|
-
|
|
2424
|
+
me.create = (n, e) => new me({
|
|
2425
2425
|
value: n,
|
|
2426
|
-
typeName:
|
|
2426
|
+
typeName: g.ZodLiteral,
|
|
2427
2427
|
...v(e)
|
|
2428
2428
|
});
|
|
2429
|
-
function
|
|
2430
|
-
return new
|
|
2429
|
+
function Be(n, e) {
|
|
2430
|
+
return new z({
|
|
2431
2431
|
values: n,
|
|
2432
|
-
typeName:
|
|
2432
|
+
typeName: g.ZodEnum,
|
|
2433
2433
|
...v(e)
|
|
2434
2434
|
});
|
|
2435
2435
|
}
|
|
2436
|
-
class
|
|
2436
|
+
class z extends _ {
|
|
2437
2437
|
constructor() {
|
|
2438
|
-
super(...arguments),
|
|
2438
|
+
super(...arguments), te.set(this, void 0);
|
|
2439
2439
|
}
|
|
2440
2440
|
_parse(e) {
|
|
2441
2441
|
if (typeof e.data != "string") {
|
|
2442
2442
|
const t = this._getOrReturnCtx(e), r = this._def.values;
|
|
2443
|
-
return
|
|
2443
|
+
return m(t, {
|
|
2444
2444
|
expected: x.joinValues(r),
|
|
2445
2445
|
received: t.parsedType,
|
|
2446
2446
|
code: u.invalid_type
|
|
2447
|
-
}),
|
|
2447
|
+
}), y;
|
|
2448
2448
|
}
|
|
2449
|
-
if (
|
|
2449
|
+
if (be(this, te) || ze(this, te, new Set(this._def.values)), !be(this, te).has(e.data)) {
|
|
2450
2450
|
const t = this._getOrReturnCtx(e), r = this._def.values;
|
|
2451
|
-
return
|
|
2451
|
+
return m(t, {
|
|
2452
2452
|
received: t.data,
|
|
2453
2453
|
code: u.invalid_enum_value,
|
|
2454
2454
|
options: r
|
|
2455
|
-
}),
|
|
2455
|
+
}), y;
|
|
2456
2456
|
}
|
|
2457
2457
|
return I(e.data);
|
|
2458
2458
|
}
|
|
@@ -2478,41 +2478,41 @@ class U extends _ {
|
|
|
2478
2478
|
return e;
|
|
2479
2479
|
}
|
|
2480
2480
|
extract(e, t = this._def) {
|
|
2481
|
-
return
|
|
2481
|
+
return z.create(e, {
|
|
2482
2482
|
...this._def,
|
|
2483
2483
|
...t
|
|
2484
2484
|
});
|
|
2485
2485
|
}
|
|
2486
2486
|
exclude(e, t = this._def) {
|
|
2487
|
-
return
|
|
2487
|
+
return z.create(this.options.filter((r) => !e.includes(r)), {
|
|
2488
2488
|
...this._def,
|
|
2489
2489
|
...t
|
|
2490
2490
|
});
|
|
2491
2491
|
}
|
|
2492
2492
|
}
|
|
2493
|
-
|
|
2494
|
-
|
|
2493
|
+
te = /* @__PURE__ */ new WeakMap();
|
|
2494
|
+
z.create = Be;
|
|
2495
2495
|
class fe extends _ {
|
|
2496
2496
|
constructor() {
|
|
2497
|
-
super(...arguments),
|
|
2497
|
+
super(...arguments), ne.set(this, void 0);
|
|
2498
2498
|
}
|
|
2499
2499
|
_parse(e) {
|
|
2500
2500
|
const t = x.getValidEnumValues(this._def.values), r = this._getOrReturnCtx(e);
|
|
2501
|
-
if (r.parsedType !==
|
|
2501
|
+
if (r.parsedType !== f.string && r.parsedType !== f.number) {
|
|
2502
2502
|
const s = x.objectValues(t);
|
|
2503
|
-
return
|
|
2503
|
+
return m(r, {
|
|
2504
2504
|
expected: x.joinValues(s),
|
|
2505
2505
|
received: r.parsedType,
|
|
2506
2506
|
code: u.invalid_type
|
|
2507
|
-
}),
|
|
2507
|
+
}), y;
|
|
2508
2508
|
}
|
|
2509
|
-
if (
|
|
2509
|
+
if (be(this, ne) || ze(this, ne, new Set(x.getValidEnumValues(this._def.values))), !be(this, ne).has(e.data)) {
|
|
2510
2510
|
const s = x.objectValues(t);
|
|
2511
|
-
return
|
|
2511
|
+
return m(r, {
|
|
2512
2512
|
received: r.data,
|
|
2513
2513
|
code: u.invalid_enum_value,
|
|
2514
2514
|
options: s
|
|
2515
|
-
}),
|
|
2515
|
+
}), y;
|
|
2516
2516
|
}
|
|
2517
2517
|
return I(e.data);
|
|
2518
2518
|
}
|
|
@@ -2520,10 +2520,10 @@ class fe extends _ {
|
|
|
2520
2520
|
return this._def.values;
|
|
2521
2521
|
}
|
|
2522
2522
|
}
|
|
2523
|
-
|
|
2523
|
+
ne = /* @__PURE__ */ new WeakMap();
|
|
2524
2524
|
fe.create = (n, e) => new fe({
|
|
2525
2525
|
values: n,
|
|
2526
|
-
typeName:
|
|
2526
|
+
typeName: g.ZodNativeEnum,
|
|
2527
2527
|
...v(e)
|
|
2528
2528
|
});
|
|
2529
2529
|
class G extends _ {
|
|
@@ -2532,13 +2532,13 @@ class G extends _ {
|
|
|
2532
2532
|
}
|
|
2533
2533
|
_parse(e) {
|
|
2534
2534
|
const { ctx: t } = this._processInputParams(e);
|
|
2535
|
-
if (t.parsedType !==
|
|
2536
|
-
return
|
|
2535
|
+
if (t.parsedType !== f.promise && t.common.async === !1)
|
|
2536
|
+
return m(t, {
|
|
2537
2537
|
code: u.invalid_type,
|
|
2538
|
-
expected:
|
|
2538
|
+
expected: f.promise,
|
|
2539
2539
|
received: t.parsedType
|
|
2540
|
-
}),
|
|
2541
|
-
const r = t.parsedType ===
|
|
2540
|
+
}), y;
|
|
2541
|
+
const r = t.parsedType === f.promise ? t.data : Promise.resolve(t.data);
|
|
2542
2542
|
return I(r.then((s) => this._def.type.parseAsync(s, {
|
|
2543
2543
|
path: t.path,
|
|
2544
2544
|
errorMap: t.common.contextualErrorMap
|
|
@@ -2547,20 +2547,20 @@ class G extends _ {
|
|
|
2547
2547
|
}
|
|
2548
2548
|
G.create = (n, e) => new G({
|
|
2549
2549
|
type: n,
|
|
2550
|
-
typeName:
|
|
2550
|
+
typeName: g.ZodPromise,
|
|
2551
2551
|
...v(e)
|
|
2552
2552
|
});
|
|
2553
|
-
class
|
|
2553
|
+
class Z extends _ {
|
|
2554
2554
|
innerType() {
|
|
2555
2555
|
return this._def.schema;
|
|
2556
2556
|
}
|
|
2557
2557
|
sourceType() {
|
|
2558
|
-
return this._def.schema._def.typeName ===
|
|
2558
|
+
return this._def.schema._def.typeName === g.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
|
|
2559
2559
|
}
|
|
2560
2560
|
_parse(e) {
|
|
2561
2561
|
const { status: t, ctx: r } = this._processInputParams(e), s = this._def.effect || null, a = {
|
|
2562
2562
|
addIssue: (o) => {
|
|
2563
|
-
|
|
2563
|
+
m(r, o), o.fatal ? t.abort() : t.dirty();
|
|
2564
2564
|
},
|
|
2565
2565
|
get path() {
|
|
2566
2566
|
return r.path;
|
|
@@ -2571,31 +2571,31 @@ class O extends _ {
|
|
|
2571
2571
|
if (r.common.async)
|
|
2572
2572
|
return Promise.resolve(o).then(async (c) => {
|
|
2573
2573
|
if (t.value === "aborted")
|
|
2574
|
-
return
|
|
2575
|
-
const
|
|
2574
|
+
return y;
|
|
2575
|
+
const l = await this._def.schema._parseAsync({
|
|
2576
2576
|
data: c,
|
|
2577
2577
|
path: r.path,
|
|
2578
2578
|
parent: r
|
|
2579
2579
|
});
|
|
2580
|
-
return
|
|
2580
|
+
return l.status === "aborted" ? y : l.status === "dirty" || t.value === "dirty" ? Y(l.value) : l;
|
|
2581
2581
|
});
|
|
2582
2582
|
{
|
|
2583
2583
|
if (t.value === "aborted")
|
|
2584
|
-
return
|
|
2584
|
+
return y;
|
|
2585
2585
|
const c = this._def.schema._parseSync({
|
|
2586
2586
|
data: o,
|
|
2587
2587
|
path: r.path,
|
|
2588
2588
|
parent: r
|
|
2589
2589
|
});
|
|
2590
|
-
return c.status === "aborted" ?
|
|
2590
|
+
return c.status === "aborted" ? y : c.status === "dirty" || t.value === "dirty" ? Y(c.value) : c;
|
|
2591
2591
|
}
|
|
2592
2592
|
}
|
|
2593
2593
|
if (s.type === "refinement") {
|
|
2594
2594
|
const o = (c) => {
|
|
2595
|
-
const
|
|
2595
|
+
const l = s.refinement(c, a);
|
|
2596
2596
|
if (r.common.async)
|
|
2597
|
-
return Promise.resolve(
|
|
2598
|
-
if (
|
|
2597
|
+
return Promise.resolve(l);
|
|
2598
|
+
if (l instanceof Promise)
|
|
2599
2599
|
throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2600
2600
|
return c;
|
|
2601
2601
|
};
|
|
@@ -2605,9 +2605,9 @@ class O extends _ {
|
|
|
2605
2605
|
path: r.path,
|
|
2606
2606
|
parent: r
|
|
2607
2607
|
});
|
|
2608
|
-
return c.status === "aborted" ?
|
|
2608
|
+
return c.status === "aborted" ? y : (c.status === "dirty" && t.dirty(), o(c.value), { status: t.value, value: c.value });
|
|
2609
2609
|
} else
|
|
2610
|
-
return this._def.schema._parseAsync({ data: r.data, path: r.path, parent: r }).then((c) => c.status === "aborted" ?
|
|
2610
|
+
return this._def.schema._parseAsync({ data: r.data, path: r.path, parent: r }).then((c) => c.status === "aborted" ? y : (c.status === "dirty" && t.dirty(), o(c.value).then(() => ({ status: t.value, value: c.value }))));
|
|
2611
2611
|
}
|
|
2612
2612
|
if (s.type === "transform")
|
|
2613
2613
|
if (r.common.async === !1) {
|
|
@@ -2616,60 +2616,60 @@ class O extends _ {
|
|
|
2616
2616
|
path: r.path,
|
|
2617
2617
|
parent: r
|
|
2618
2618
|
});
|
|
2619
|
-
if (!
|
|
2619
|
+
if (!q(o))
|
|
2620
2620
|
return o;
|
|
2621
2621
|
const c = s.transform(o.value, a);
|
|
2622
2622
|
if (c instanceof Promise)
|
|
2623
2623
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2624
2624
|
return { status: t.value, value: c };
|
|
2625
2625
|
} else
|
|
2626
|
-
return this._def.schema._parseAsync({ data: r.data, path: r.path, parent: r }).then((o) =>
|
|
2626
|
+
return this._def.schema._parseAsync({ data: r.data, path: r.path, parent: r }).then((o) => q(o) ? Promise.resolve(s.transform(o.value, a)).then((c) => ({ status: t.value, value: c })) : o);
|
|
2627
2627
|
x.assertNever(s);
|
|
2628
2628
|
}
|
|
2629
2629
|
}
|
|
2630
|
-
|
|
2630
|
+
Z.create = (n, e, t) => new Z({
|
|
2631
2631
|
schema: n,
|
|
2632
|
-
typeName:
|
|
2632
|
+
typeName: g.ZodEffects,
|
|
2633
2633
|
effect: e,
|
|
2634
2634
|
...v(t)
|
|
2635
2635
|
});
|
|
2636
|
-
|
|
2636
|
+
Z.createWithPreprocess = (n, e, t) => new Z({
|
|
2637
2637
|
schema: e,
|
|
2638
2638
|
effect: { type: "preprocess", transform: n },
|
|
2639
|
-
typeName:
|
|
2639
|
+
typeName: g.ZodEffects,
|
|
2640
2640
|
...v(t)
|
|
2641
2641
|
});
|
|
2642
|
-
class
|
|
2642
|
+
class j extends _ {
|
|
2643
2643
|
_parse(e) {
|
|
2644
|
-
return this._getType(e) ===
|
|
2644
|
+
return this._getType(e) === f.undefined ? I(void 0) : this._def.innerType._parse(e);
|
|
2645
2645
|
}
|
|
2646
2646
|
unwrap() {
|
|
2647
2647
|
return this._def.innerType;
|
|
2648
2648
|
}
|
|
2649
2649
|
}
|
|
2650
|
-
|
|
2650
|
+
j.create = (n, e) => new j({
|
|
2651
2651
|
innerType: n,
|
|
2652
|
-
typeName:
|
|
2652
|
+
typeName: g.ZodOptional,
|
|
2653
2653
|
...v(e)
|
|
2654
2654
|
});
|
|
2655
|
-
class
|
|
2655
|
+
class U extends _ {
|
|
2656
2656
|
_parse(e) {
|
|
2657
|
-
return this._getType(e) ===
|
|
2657
|
+
return this._getType(e) === f.null ? I(null) : this._def.innerType._parse(e);
|
|
2658
2658
|
}
|
|
2659
2659
|
unwrap() {
|
|
2660
2660
|
return this._def.innerType;
|
|
2661
2661
|
}
|
|
2662
2662
|
}
|
|
2663
|
-
|
|
2663
|
+
U.create = (n, e) => new U({
|
|
2664
2664
|
innerType: n,
|
|
2665
|
-
typeName:
|
|
2665
|
+
typeName: g.ZodNullable,
|
|
2666
2666
|
...v(e)
|
|
2667
2667
|
});
|
|
2668
|
-
class
|
|
2668
|
+
class pe extends _ {
|
|
2669
2669
|
_parse(e) {
|
|
2670
2670
|
const { ctx: t } = this._processInputParams(e);
|
|
2671
2671
|
let r = t.data;
|
|
2672
|
-
return t.parsedType ===
|
|
2672
|
+
return t.parsedType === f.undefined && (r = this._def.defaultValue()), this._def.innerType._parse({
|
|
2673
2673
|
data: r,
|
|
2674
2674
|
path: t.path,
|
|
2675
2675
|
parent: t
|
|
@@ -2679,9 +2679,9 @@ class me extends _ {
|
|
|
2679
2679
|
return this._def.innerType;
|
|
2680
2680
|
}
|
|
2681
2681
|
}
|
|
2682
|
-
|
|
2682
|
+
pe.create = (n, e) => new pe({
|
|
2683
2683
|
innerType: n,
|
|
2684
|
-
typeName:
|
|
2684
|
+
typeName: g.ZodDefault,
|
|
2685
2685
|
defaultValue: typeof e.default == "function" ? e.default : () => e.default,
|
|
2686
2686
|
...v(e)
|
|
2687
2687
|
});
|
|
@@ -2700,11 +2700,11 @@ class he extends _ {
|
|
|
2700
2700
|
...r
|
|
2701
2701
|
}
|
|
2702
2702
|
});
|
|
2703
|
-
return
|
|
2703
|
+
return se(s) ? s.then((a) => ({
|
|
2704
2704
|
status: "valid",
|
|
2705
2705
|
value: a.status === "valid" ? a.value : this._def.catchValue({
|
|
2706
2706
|
get error() {
|
|
2707
|
-
return new
|
|
2707
|
+
return new S(r.common.issues);
|
|
2708
2708
|
},
|
|
2709
2709
|
input: r.data
|
|
2710
2710
|
})
|
|
@@ -2712,7 +2712,7 @@ class he extends _ {
|
|
|
2712
2712
|
status: "valid",
|
|
2713
2713
|
value: s.status === "valid" ? s.value : this._def.catchValue({
|
|
2714
2714
|
get error() {
|
|
2715
|
-
return new
|
|
2715
|
+
return new S(r.common.issues);
|
|
2716
2716
|
},
|
|
2717
2717
|
input: r.data
|
|
2718
2718
|
})
|
|
@@ -2724,29 +2724,29 @@ class he extends _ {
|
|
|
2724
2724
|
}
|
|
2725
2725
|
he.create = (n, e) => new he({
|
|
2726
2726
|
innerType: n,
|
|
2727
|
-
typeName:
|
|
2727
|
+
typeName: g.ZodCatch,
|
|
2728
2728
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
|
|
2729
2729
|
...v(e)
|
|
2730
2730
|
});
|
|
2731
|
-
class
|
|
2731
|
+
class Te extends _ {
|
|
2732
2732
|
_parse(e) {
|
|
2733
|
-
if (this._getType(e) !==
|
|
2733
|
+
if (this._getType(e) !== f.nan) {
|
|
2734
2734
|
const r = this._getOrReturnCtx(e);
|
|
2735
|
-
return
|
|
2735
|
+
return m(r, {
|
|
2736
2736
|
code: u.invalid_type,
|
|
2737
|
-
expected:
|
|
2737
|
+
expected: f.nan,
|
|
2738
2738
|
received: r.parsedType
|
|
2739
|
-
}),
|
|
2739
|
+
}), y;
|
|
2740
2740
|
}
|
|
2741
2741
|
return { status: "valid", value: e.data };
|
|
2742
2742
|
}
|
|
2743
2743
|
}
|
|
2744
|
-
|
|
2745
|
-
typeName:
|
|
2744
|
+
Te.create = (n) => new Te({
|
|
2745
|
+
typeName: g.ZodNaN,
|
|
2746
2746
|
...v(n)
|
|
2747
2747
|
});
|
|
2748
|
-
const
|
|
2749
|
-
class
|
|
2748
|
+
const Dt = Symbol("zod_brand");
|
|
2749
|
+
class Ee extends _ {
|
|
2750
2750
|
_parse(e) {
|
|
2751
2751
|
const { ctx: t } = this._processInputParams(e), r = t.data;
|
|
2752
2752
|
return this._def.type._parse({
|
|
@@ -2769,7 +2769,7 @@ class ye extends _ {
|
|
|
2769
2769
|
path: r.path,
|
|
2770
2770
|
parent: r
|
|
2771
2771
|
});
|
|
2772
|
-
return a.status === "aborted" ?
|
|
2772
|
+
return a.status === "aborted" ? y : a.status === "dirty" ? (t.dirty(), Y(a.value)) : this._def.out._parseAsync({
|
|
2773
2773
|
data: a.value,
|
|
2774
2774
|
path: r.path,
|
|
2775
2775
|
parent: r
|
|
@@ -2781,7 +2781,7 @@ class ye extends _ {
|
|
|
2781
2781
|
path: r.path,
|
|
2782
2782
|
parent: r
|
|
2783
2783
|
});
|
|
2784
|
-
return s.status === "aborted" ?
|
|
2784
|
+
return s.status === "aborted" ? y : s.status === "dirty" ? (t.dirty(), {
|
|
2785
2785
|
status: "dirty",
|
|
2786
2786
|
value: s.value
|
|
2787
2787
|
}) : this._def.out._parseSync({
|
|
@@ -2795,22 +2795,22 @@ class ye extends _ {
|
|
|
2795
2795
|
return new ye({
|
|
2796
2796
|
in: e,
|
|
2797
2797
|
out: t,
|
|
2798
|
-
typeName:
|
|
2798
|
+
typeName: g.ZodPipeline
|
|
2799
2799
|
});
|
|
2800
2800
|
}
|
|
2801
2801
|
}
|
|
2802
|
-
class
|
|
2802
|
+
class ge extends _ {
|
|
2803
2803
|
_parse(e) {
|
|
2804
|
-
const t = this._def.innerType._parse(e), r = (s) => (
|
|
2805
|
-
return
|
|
2804
|
+
const t = this._def.innerType._parse(e), r = (s) => (q(s) && (s.value = Object.freeze(s.value)), s);
|
|
2805
|
+
return se(t) ? t.then((s) => r(s)) : r(t);
|
|
2806
2806
|
}
|
|
2807
2807
|
unwrap() {
|
|
2808
2808
|
return this._def.innerType;
|
|
2809
2809
|
}
|
|
2810
2810
|
}
|
|
2811
|
-
|
|
2811
|
+
ge.create = (n, e) => new ge({
|
|
2812
2812
|
innerType: n,
|
|
2813
|
-
typeName:
|
|
2813
|
+
typeName: g.ZodReadonly,
|
|
2814
2814
|
...v(e)
|
|
2815
2815
|
});
|
|
2816
2816
|
function $e(n, e) {
|
|
@@ -2822,112 +2822,112 @@ function We(n, e = {}, t) {
|
|
|
2822
2822
|
var a, o;
|
|
2823
2823
|
const c = n(r);
|
|
2824
2824
|
if (c instanceof Promise)
|
|
2825
|
-
return c.then((
|
|
2826
|
-
var
|
|
2827
|
-
if (!
|
|
2828
|
-
const b = $e(e, r), w = (
|
|
2825
|
+
return c.then((l) => {
|
|
2826
|
+
var d, p;
|
|
2827
|
+
if (!l) {
|
|
2828
|
+
const b = $e(e, r), w = (p = (d = b.fatal) !== null && d !== void 0 ? d : t) !== null && p !== void 0 ? p : !0;
|
|
2829
2829
|
s.addIssue({ code: "custom", ...b, fatal: w });
|
|
2830
2830
|
}
|
|
2831
2831
|
});
|
|
2832
2832
|
if (!c) {
|
|
2833
|
-
const
|
|
2834
|
-
s.addIssue({ code: "custom", ...
|
|
2833
|
+
const l = $e(e, r), d = (o = (a = l.fatal) !== null && a !== void 0 ? a : t) !== null && o !== void 0 ? o : !0;
|
|
2834
|
+
s.addIssue({ code: "custom", ...l, fatal: d });
|
|
2835
2835
|
}
|
|
2836
2836
|
}) : H.create();
|
|
2837
2837
|
}
|
|
2838
|
-
const
|
|
2838
|
+
const jt = {
|
|
2839
2839
|
object: k.lazycreate
|
|
2840
2840
|
};
|
|
2841
|
-
var
|
|
2841
|
+
var g;
|
|
2842
2842
|
(function(n) {
|
|
2843
2843
|
n.ZodString = "ZodString", n.ZodNumber = "ZodNumber", n.ZodNaN = "ZodNaN", n.ZodBigInt = "ZodBigInt", n.ZodBoolean = "ZodBoolean", n.ZodDate = "ZodDate", n.ZodSymbol = "ZodSymbol", n.ZodUndefined = "ZodUndefined", n.ZodNull = "ZodNull", n.ZodAny = "ZodAny", n.ZodUnknown = "ZodUnknown", n.ZodNever = "ZodNever", n.ZodVoid = "ZodVoid", n.ZodArray = "ZodArray", n.ZodObject = "ZodObject", n.ZodUnion = "ZodUnion", n.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", n.ZodIntersection = "ZodIntersection", n.ZodTuple = "ZodTuple", n.ZodRecord = "ZodRecord", n.ZodMap = "ZodMap", n.ZodSet = "ZodSet", n.ZodFunction = "ZodFunction", n.ZodLazy = "ZodLazy", n.ZodLiteral = "ZodLiteral", n.ZodEnum = "ZodEnum", n.ZodEffects = "ZodEffects", n.ZodNativeEnum = "ZodNativeEnum", n.ZodOptional = "ZodOptional", n.ZodNullable = "ZodNullable", n.ZodDefault = "ZodDefault", n.ZodCatch = "ZodCatch", n.ZodPromise = "ZodPromise", n.ZodBranded = "ZodBranded", n.ZodPipeline = "ZodPipeline", n.ZodReadonly = "ZodReadonly";
|
|
2844
|
-
})(
|
|
2845
|
-
const
|
|
2844
|
+
})(g || (g = {}));
|
|
2845
|
+
const Ot = (n, e = {
|
|
2846
2846
|
message: `Input not instance of ${n.name}`
|
|
2847
|
-
}) => We((t) => t instanceof n, e), Qe = N.create, Ye = V.create, Et =
|
|
2847
|
+
}) => We((t) => t instanceof n, e), Qe = N.create, Ye = V.create, Et = Te.create, Pt = F.create, Je = ae.create, Rt = B.create, Mt = xe.create, $t = ie.create, Vt = oe.create, Ft = H.create, zt = L.create, Ut = $.create, Lt = ke.create, qt = C.create, Bt = k.create, Wt = k.strictCreate, Qt = ce.create, Yt = Ie.create, Jt = de.create, Xt = E.create, Ht = ue.create, Gt = we.create, Kt = W.create, en = J.create, tn = le.create, nn = me.create, rn = z.create, sn = fe.create, an = G.create, Ve = Z.create, on = j.create, cn = U.create, dn = Z.createWithPreprocess, un = ye.create, ln = () => Qe().optional(), mn = () => Ye().optional(), fn = () => Je().optional(), pn = {
|
|
2848
2848
|
string: (n) => N.create({ ...n, coerce: !0 }),
|
|
2849
2849
|
number: (n) => V.create({ ...n, coerce: !0 }),
|
|
2850
|
-
boolean: (n) =>
|
|
2850
|
+
boolean: (n) => ae.create({
|
|
2851
2851
|
...n,
|
|
2852
2852
|
coerce: !0
|
|
2853
2853
|
}),
|
|
2854
2854
|
bigint: (n) => F.create({ ...n, coerce: !0 }),
|
|
2855
|
-
date: (n) =>
|
|
2856
|
-
},
|
|
2855
|
+
date: (n) => B.create({ ...n, coerce: !0 })
|
|
2856
|
+
}, hn = y;
|
|
2857
2857
|
var i = /* @__PURE__ */ Object.freeze({
|
|
2858
2858
|
__proto__: null,
|
|
2859
2859
|
defaultErrorMap: X,
|
|
2860
2860
|
setErrorMap: ct,
|
|
2861
|
-
getErrorMap:
|
|
2862
|
-
makeIssue:
|
|
2861
|
+
getErrorMap: ve,
|
|
2862
|
+
makeIssue: _e,
|
|
2863
2863
|
EMPTY_PATH: dt,
|
|
2864
|
-
addIssueToContext:
|
|
2864
|
+
addIssueToContext: m,
|
|
2865
2865
|
ParseStatus: T,
|
|
2866
|
-
INVALID:
|
|
2866
|
+
INVALID: y,
|
|
2867
2867
|
DIRTY: Y,
|
|
2868
2868
|
OK: I,
|
|
2869
|
-
isAborted:
|
|
2870
|
-
isDirty:
|
|
2871
|
-
isValid:
|
|
2872
|
-
isAsync:
|
|
2869
|
+
isAborted: De,
|
|
2870
|
+
isDirty: je,
|
|
2871
|
+
isValid: q,
|
|
2872
|
+
isAsync: se,
|
|
2873
2873
|
get util() {
|
|
2874
2874
|
return x;
|
|
2875
2875
|
},
|
|
2876
2876
|
get objectUtil() {
|
|
2877
|
-
return
|
|
2877
|
+
return Ze;
|
|
2878
2878
|
},
|
|
2879
|
-
ZodParsedType:
|
|
2879
|
+
ZodParsedType: f,
|
|
2880
2880
|
getParsedType: R,
|
|
2881
2881
|
ZodType: _,
|
|
2882
|
-
datetimeRegex:
|
|
2882
|
+
datetimeRegex: qe,
|
|
2883
2883
|
ZodString: N,
|
|
2884
2884
|
ZodNumber: V,
|
|
2885
2885
|
ZodBigInt: F,
|
|
2886
|
-
ZodBoolean:
|
|
2887
|
-
ZodDate:
|
|
2888
|
-
ZodSymbol:
|
|
2889
|
-
ZodUndefined:
|
|
2890
|
-
ZodNull:
|
|
2886
|
+
ZodBoolean: ae,
|
|
2887
|
+
ZodDate: B,
|
|
2888
|
+
ZodSymbol: xe,
|
|
2889
|
+
ZodUndefined: ie,
|
|
2890
|
+
ZodNull: oe,
|
|
2891
2891
|
ZodAny: H,
|
|
2892
2892
|
ZodUnknown: L,
|
|
2893
2893
|
ZodNever: $,
|
|
2894
|
-
ZodVoid:
|
|
2895
|
-
ZodArray:
|
|
2894
|
+
ZodVoid: ke,
|
|
2895
|
+
ZodArray: C,
|
|
2896
2896
|
ZodObject: k,
|
|
2897
|
-
ZodUnion:
|
|
2898
|
-
ZodDiscriminatedUnion:
|
|
2899
|
-
ZodIntersection:
|
|
2897
|
+
ZodUnion: ce,
|
|
2898
|
+
ZodDiscriminatedUnion: Ie,
|
|
2899
|
+
ZodIntersection: de,
|
|
2900
2900
|
ZodTuple: E,
|
|
2901
|
-
ZodRecord:
|
|
2902
|
-
ZodMap:
|
|
2901
|
+
ZodRecord: ue,
|
|
2902
|
+
ZodMap: we,
|
|
2903
2903
|
ZodSet: W,
|
|
2904
2904
|
ZodFunction: J,
|
|
2905
|
-
ZodLazy:
|
|
2906
|
-
ZodLiteral:
|
|
2907
|
-
ZodEnum:
|
|
2905
|
+
ZodLazy: le,
|
|
2906
|
+
ZodLiteral: me,
|
|
2907
|
+
ZodEnum: z,
|
|
2908
2908
|
ZodNativeEnum: fe,
|
|
2909
2909
|
ZodPromise: G,
|
|
2910
|
-
ZodEffects:
|
|
2911
|
-
ZodTransformer:
|
|
2912
|
-
ZodOptional:
|
|
2913
|
-
ZodNullable:
|
|
2914
|
-
ZodDefault:
|
|
2910
|
+
ZodEffects: Z,
|
|
2911
|
+
ZodTransformer: Z,
|
|
2912
|
+
ZodOptional: j,
|
|
2913
|
+
ZodNullable: U,
|
|
2914
|
+
ZodDefault: pe,
|
|
2915
2915
|
ZodCatch: he,
|
|
2916
|
-
ZodNaN:
|
|
2917
|
-
BRAND:
|
|
2918
|
-
ZodBranded:
|
|
2916
|
+
ZodNaN: Te,
|
|
2917
|
+
BRAND: Dt,
|
|
2918
|
+
ZodBranded: Ee,
|
|
2919
2919
|
ZodPipeline: ye,
|
|
2920
|
-
ZodReadonly:
|
|
2920
|
+
ZodReadonly: ge,
|
|
2921
2921
|
custom: We,
|
|
2922
2922
|
Schema: _,
|
|
2923
2923
|
ZodSchema: _,
|
|
2924
|
-
late:
|
|
2924
|
+
late: jt,
|
|
2925
2925
|
get ZodFirstPartyTypeKind() {
|
|
2926
|
-
return
|
|
2926
|
+
return g;
|
|
2927
2927
|
},
|
|
2928
|
-
coerce:
|
|
2928
|
+
coerce: pn,
|
|
2929
2929
|
any: Ft,
|
|
2930
|
-
array:
|
|
2930
|
+
array: qt,
|
|
2931
2931
|
bigint: Pt,
|
|
2932
2932
|
boolean: Je,
|
|
2933
2933
|
date: Rt,
|
|
@@ -2935,20 +2935,20 @@ var i = /* @__PURE__ */ Object.freeze({
|
|
|
2935
2935
|
effect: Ve,
|
|
2936
2936
|
enum: rn,
|
|
2937
2937
|
function: en,
|
|
2938
|
-
instanceof:
|
|
2938
|
+
instanceof: Ot,
|
|
2939
2939
|
intersection: Jt,
|
|
2940
2940
|
lazy: tn,
|
|
2941
2941
|
literal: nn,
|
|
2942
2942
|
map: Gt,
|
|
2943
2943
|
nan: Et,
|
|
2944
2944
|
nativeEnum: sn,
|
|
2945
|
-
never:
|
|
2945
|
+
never: Ut,
|
|
2946
2946
|
null: Vt,
|
|
2947
2947
|
nullable: cn,
|
|
2948
2948
|
number: Ye,
|
|
2949
|
-
object:
|
|
2950
|
-
oboolean:
|
|
2951
|
-
onumber:
|
|
2949
|
+
object: Bt,
|
|
2950
|
+
oboolean: fn,
|
|
2951
|
+
onumber: mn,
|
|
2952
2952
|
optional: on,
|
|
2953
2953
|
ostring: ln,
|
|
2954
2954
|
pipeline: un,
|
|
@@ -2963,14 +2963,14 @@ var i = /* @__PURE__ */ Object.freeze({
|
|
|
2963
2963
|
tuple: Xt,
|
|
2964
2964
|
undefined: $t,
|
|
2965
2965
|
union: Qt,
|
|
2966
|
-
unknown:
|
|
2966
|
+
unknown: zt,
|
|
2967
2967
|
void: Lt,
|
|
2968
|
-
NEVER:
|
|
2968
|
+
NEVER: hn,
|
|
2969
2969
|
ZodIssueCode: u,
|
|
2970
2970
|
quotelessJson: ot,
|
|
2971
|
-
ZodError:
|
|
2971
|
+
ZodError: S
|
|
2972
2972
|
});
|
|
2973
|
-
const
|
|
2973
|
+
const gn = i.object({
|
|
2974
2974
|
country: i.string(),
|
|
2975
2975
|
city: i.string(),
|
|
2976
2976
|
street: i.string(),
|
|
@@ -2978,37 +2978,37 @@ const yn = i.object({
|
|
|
2978
2978
|
floor: i.string(),
|
|
2979
2979
|
apartmentEnterNumber: i.string(),
|
|
2980
2980
|
apartmentNumber: i.string()
|
|
2981
|
-
}), M = i.string().min(1, { message: "שדה חובה" }),
|
|
2982
|
-
function
|
|
2981
|
+
}), M = i.string().min(1, { message: "שדה חובה" }), En = i.string().regex(/^\d+$/, "Must be a numeric string"), Pn = i.object({ url: i.string().url(), id: i.string() });
|
|
2982
|
+
function Rn(n) {
|
|
2983
2983
|
return !!(n != null && n.url);
|
|
2984
2984
|
}
|
|
2985
|
-
const
|
|
2985
|
+
const re = i.object({
|
|
2986
2986
|
lang: i.enum(["he"]),
|
|
2987
2987
|
value: i.string()
|
|
2988
|
-
}),
|
|
2988
|
+
}), Mn = i.array(re), Xe = i.object({
|
|
2989
2989
|
id: i.string().min(1),
|
|
2990
2990
|
companyId: i.string().min(1),
|
|
2991
2991
|
storeId: i.string().min(1),
|
|
2992
2992
|
parentId: i.string().nullish(),
|
|
2993
2993
|
tag: i.string().optional(),
|
|
2994
|
-
locales: i.array(
|
|
2994
|
+
locales: i.array(re),
|
|
2995
2995
|
depth: i.number()
|
|
2996
|
-
}),
|
|
2997
|
-
children: i.lazy(() =>
|
|
2998
|
-
}),
|
|
2996
|
+
}), Pe = Xe.extend({
|
|
2997
|
+
children: i.lazy(() => Pe.array())
|
|
2998
|
+
}), $n = Xe.extend({
|
|
2999
2999
|
index: i.number(),
|
|
3000
3000
|
depth: i.number(),
|
|
3001
3001
|
collapsed: i.boolean().optional(),
|
|
3002
|
-
children: i.array(
|
|
3003
|
-
}),
|
|
3002
|
+
children: i.array(Pe)
|
|
3003
|
+
}), ee = i.string().min(1), He = i.object({
|
|
3004
3004
|
type: i.literal("Product"),
|
|
3005
|
-
storeId:
|
|
3006
|
-
companyId:
|
|
3007
|
-
id:
|
|
3008
|
-
objectID:
|
|
3009
|
-
sku:
|
|
3010
|
-
name: i.array(
|
|
3011
|
-
description: i.array(
|
|
3005
|
+
storeId: ee,
|
|
3006
|
+
companyId: ee,
|
|
3007
|
+
id: ee,
|
|
3008
|
+
objectID: ee,
|
|
3009
|
+
sku: ee,
|
|
3010
|
+
name: i.array(re),
|
|
3011
|
+
description: i.array(re),
|
|
3012
3012
|
isPublished: i.boolean(),
|
|
3013
3013
|
vat: i.boolean(),
|
|
3014
3014
|
priceType: i.object({
|
|
@@ -3037,12 +3037,12 @@ const ne = i.object({
|
|
|
3037
3037
|
brand: i.string(),
|
|
3038
3038
|
importer: i.string(),
|
|
3039
3039
|
supplier: i.string(),
|
|
3040
|
-
ingredients: i.array(
|
|
3040
|
+
ingredients: i.array(re),
|
|
3041
3041
|
created_at: i.number(),
|
|
3042
3042
|
updated_at: i.number(),
|
|
3043
3043
|
categoryIds: i.array(i.string().nonempty()),
|
|
3044
3044
|
// @deprecated
|
|
3045
|
-
categoryList: i.array(
|
|
3045
|
+
categoryList: i.array(Pe).optional(),
|
|
3046
3046
|
// @deprecated
|
|
3047
3047
|
categories: i.object({
|
|
3048
3048
|
lvl0: i.array(i.string()),
|
|
@@ -3053,7 +3053,7 @@ const ne = i.object({
|
|
|
3053
3053
|
}).optional(),
|
|
3054
3054
|
// @deprecated
|
|
3055
3055
|
categoryNames: i.array(i.string()).optional()
|
|
3056
|
-
}),
|
|
3056
|
+
}), Vn = He.extend({
|
|
3057
3057
|
image: i.instanceof(File).optional()
|
|
3058
3058
|
}), Ge = i.object({
|
|
3059
3059
|
product: He,
|
|
@@ -3061,7 +3061,7 @@ const ne = i.object({
|
|
|
3061
3061
|
finalPrice: i.number().optional(),
|
|
3062
3062
|
finalDiscount: i.number().optional(),
|
|
3063
3063
|
amount: i.number().positive({ message: "Quantity must be a positive number." })
|
|
3064
|
-
}),
|
|
3064
|
+
}), Fn = i.object({
|
|
3065
3065
|
type: i.literal("Cart"),
|
|
3066
3066
|
id: i.string().uuid(),
|
|
3067
3067
|
companyId: i.string().uuid(),
|
|
@@ -3069,11 +3069,11 @@ const ne = i.object({
|
|
|
3069
3069
|
userId: i.string().uuid(),
|
|
3070
3070
|
status: i.enum(["active", "draft", "completed"]),
|
|
3071
3071
|
items: i.array(Ge)
|
|
3072
|
-
}),
|
|
3072
|
+
}), zn = i.object({
|
|
3073
3073
|
id: i.string(),
|
|
3074
3074
|
name: i.string(),
|
|
3075
3075
|
websiteDomains: i.array(i.string())
|
|
3076
|
-
}),
|
|
3076
|
+
}), Un = i.object({
|
|
3077
3077
|
type: i.literal("FavoriteProduct"),
|
|
3078
3078
|
id: i.string().uuid(),
|
|
3079
3079
|
companyId: i.string().uuid(),
|
|
@@ -3082,7 +3082,7 @@ const ne = i.object({
|
|
|
3082
3082
|
productId: i.string().uuid()
|
|
3083
3083
|
}), Ke = i.enum(["default", "delayed"], {
|
|
3084
3084
|
description: "delayed is J5 transaction"
|
|
3085
|
-
}),
|
|
3085
|
+
}), yn = i.object({
|
|
3086
3086
|
type: i.literal("Profile"),
|
|
3087
3087
|
id: M,
|
|
3088
3088
|
companyId: M,
|
|
@@ -3093,14 +3093,14 @@ const ne = i.object({
|
|
|
3093
3093
|
displayName: M,
|
|
3094
3094
|
email: i.string().email(),
|
|
3095
3095
|
phoneNumber: i.string().optional(),
|
|
3096
|
-
address:
|
|
3096
|
+
address: gn.optional(),
|
|
3097
3097
|
isAnonymous: i.boolean(),
|
|
3098
3098
|
createdDate: i.number(),
|
|
3099
3099
|
lastActivityDate: i.number(),
|
|
3100
3100
|
paymentType: Ke,
|
|
3101
3101
|
organizationId: i.string().optional().nullable()
|
|
3102
3102
|
});
|
|
3103
|
-
function
|
|
3103
|
+
function Ln() {
|
|
3104
3104
|
return {
|
|
3105
3105
|
type: "Profile",
|
|
3106
3106
|
id: "",
|
|
@@ -3126,7 +3126,7 @@ function Fn() {
|
|
|
3126
3126
|
paymentType: Ke.Values.default
|
|
3127
3127
|
};
|
|
3128
3128
|
}
|
|
3129
|
-
const
|
|
3129
|
+
const et = i.object({
|
|
3130
3130
|
_COMMENT: i.string().optional(),
|
|
3131
3131
|
transaction_id: i.string(),
|
|
3132
3132
|
date: i.string().regex(/^\d{4}-\d{2}-\d{2}$/, "Date must be in YYYY-MM-DD format"),
|
|
@@ -3138,7 +3138,7 @@ const Pe = i.object({
|
|
|
3138
3138
|
price_discount_in_currency: i.number(),
|
|
3139
3139
|
price_total: i.string().regex(/^\d+\.\d{2}$/, "Price total must be in format XX.XX"),
|
|
3140
3140
|
price_total_in_currency: i.number().positive()
|
|
3141
|
-
}),
|
|
3141
|
+
}), vn = i.object({
|
|
3142
3142
|
doc_uuid: i.string().uuid("Document UUID must be a valid UUID"),
|
|
3143
3143
|
pdf_link: i.string().url("PDF link must be a valid URL"),
|
|
3144
3144
|
pdf_link_copy: i.string().url("PDF copy link must be a valid URL"),
|
|
@@ -3146,28 +3146,50 @@ const Pe = i.object({
|
|
|
3146
3146
|
sent_mails: i.array(i.string().email("Each email must be valid")),
|
|
3147
3147
|
success: i.boolean(),
|
|
3148
3148
|
ua_uuid: i.string().uuid("UA UUID must be a valid UUID"),
|
|
3149
|
-
calculatedData:
|
|
3149
|
+
calculatedData: et,
|
|
3150
3150
|
warning: i.string().optional(),
|
|
3151
3151
|
date: i.number().optional()
|
|
3152
|
-
})
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3152
|
+
}), _n = i.object({
|
|
3153
|
+
id: i.string().min(1, "ID is required"),
|
|
3154
|
+
number: i.string().min(1, "Number is required"),
|
|
3155
|
+
date: i.number().min(1, "Date is required"),
|
|
3156
|
+
createdAt: i.number().min(1, "Created at is required"),
|
|
3157
|
+
status: i.enum(["pending", "paid", "cancelled"]),
|
|
3158
|
+
companyDetails: i.object({
|
|
3159
|
+
name: i.string().min(1, "Name is required").optional(),
|
|
3160
|
+
address: i.string().min(1, "Address is required").optional(),
|
|
3161
|
+
phone: i.string().min(1, "Phone is required").optional(),
|
|
3162
|
+
email: i.string().email("Email must be valid").optional()
|
|
3163
|
+
}).optional(),
|
|
3164
|
+
clientDetails: i.object({
|
|
3165
|
+
name: i.string().min(1, "Name is required").optional(),
|
|
3166
|
+
address: i.string().min(1, "Address is required").optional(),
|
|
3167
|
+
phone: i.string().min(1, "Phone is required").optional(),
|
|
3168
|
+
email: i.string().email("Email must be valid").optional()
|
|
3169
|
+
}).optional(),
|
|
3170
|
+
items: i.array(
|
|
3171
|
+
i.object({
|
|
3172
|
+
name: i.string().min(1, "Name is required").optional(),
|
|
3173
|
+
price: i.number().min(1, "Price is required").optional(),
|
|
3174
|
+
quantity: i.number().min(1, "Quantity is required").optional(),
|
|
3175
|
+
total: i.number().min(1, "Total is required").optional()
|
|
3176
|
+
})
|
|
3177
|
+
).optional(),
|
|
3178
|
+
total: i.number().min(1, "Total is required").optional(),
|
|
3179
|
+
vat: i.number().min(1, "VAT is required").optional(),
|
|
3180
|
+
link: i.string().url("Link must be a valid URL").optional()
|
|
3181
|
+
}), tt = i.object({
|
|
3160
3182
|
number: i.string(),
|
|
3161
3183
|
name: i.string(),
|
|
3162
3184
|
id: i.string()
|
|
3163
|
-
}),
|
|
3185
|
+
}), bn = i.object({
|
|
3164
3186
|
id: i.string(),
|
|
3165
3187
|
name: i.string(),
|
|
3166
3188
|
discountPercentage: i.number().positive().min(0).max(100).optional(),
|
|
3167
3189
|
nameOnInvoice: i.string().optional(),
|
|
3168
3190
|
billingAccounts: i.array(tt),
|
|
3169
3191
|
paymentType: i.enum(["default", "delayed"])
|
|
3170
|
-
}),
|
|
3192
|
+
}), qn = bn.omit({ id: !0 }), xn = i.object({
|
|
3171
3193
|
doc_uuid: i.string().uuid("Document UUID must be a valid UUID"),
|
|
3172
3194
|
pdf_link: i.string().url("PDF link must be a valid URL"),
|
|
3173
3195
|
pdf_link_copy: i.string().url("PDF copy link must be a valid URL"),
|
|
@@ -3175,9 +3197,38 @@ const tt = i.object({
|
|
|
3175
3197
|
sent_mails: i.array(i.string().email("Each email must be valid")),
|
|
3176
3198
|
success: i.boolean(),
|
|
3177
3199
|
ua_uuid: i.string().uuid("UA UUID must be a valid UUID"),
|
|
3178
|
-
calculatedData:
|
|
3200
|
+
calculatedData: et,
|
|
3179
3201
|
warning: i.string().optional(),
|
|
3180
3202
|
date: i.number().optional()
|
|
3203
|
+
}), kn = i.object({
|
|
3204
|
+
id: i.string().min(1, "ID is required"),
|
|
3205
|
+
number: i.string().min(1, "Number is required"),
|
|
3206
|
+
date: i.string().min(1, "Date is required"),
|
|
3207
|
+
createdAt: i.number().min(1, "Created at is required"),
|
|
3208
|
+
status: i.enum(["pending", "paid", "cancelled"]),
|
|
3209
|
+
companyDetails: i.object({
|
|
3210
|
+
name: i.string().min(1, "Name is required").optional(),
|
|
3211
|
+
address: i.string().min(1, "Address is required").optional(),
|
|
3212
|
+
phone: i.string().min(1, "Phone is required").optional(),
|
|
3213
|
+
email: i.string().email("Email must be valid").optional()
|
|
3214
|
+
}).optional(),
|
|
3215
|
+
clientDetails: i.object({
|
|
3216
|
+
name: i.string().min(1, "Name is required").optional(),
|
|
3217
|
+
address: i.string().min(1, "Address is required").optional(),
|
|
3218
|
+
phone: i.string().min(1, "Phone is required").optional(),
|
|
3219
|
+
email: i.string().email("Email must be valid").optional()
|
|
3220
|
+
}).optional(),
|
|
3221
|
+
items: i.array(
|
|
3222
|
+
i.object({
|
|
3223
|
+
name: i.string().min(1, "Name is required").optional(),
|
|
3224
|
+
price: i.number().min(1, "Price is required").optional(),
|
|
3225
|
+
quantity: i.number().min(1, "Quantity is required").optional(),
|
|
3226
|
+
total: i.number().min(1, "Total is required").optional()
|
|
3227
|
+
})
|
|
3228
|
+
).optional(),
|
|
3229
|
+
total: i.number().min(1, "Total is required").optional(),
|
|
3230
|
+
vat: i.number().min(1, "VAT is required").optional(),
|
|
3231
|
+
link: i.string().url("Link must be a valid URL").optional()
|
|
3181
3232
|
}), Bn = i.object({
|
|
3182
3233
|
type: i.literal("Order"),
|
|
3183
3234
|
id: M,
|
|
@@ -3208,21 +3259,31 @@ const tt = i.object({
|
|
|
3208
3259
|
cartTotal: i.number(),
|
|
3209
3260
|
cartVat: i.number(),
|
|
3210
3261
|
deliveryPrice: i.number().optional()
|
|
3262
|
+
// final delivery price for cart
|
|
3211
3263
|
}),
|
|
3264
|
+
storeOptions: i.object({
|
|
3265
|
+
deliveryPrice: i.number().optional(),
|
|
3266
|
+
freeDeliveryPrice: i.number().optional(),
|
|
3267
|
+
isVatIncludedInPrice: i.boolean().optional()
|
|
3268
|
+
}).optional(),
|
|
3269
|
+
orderDeliveryPrice: i.number().optional(),
|
|
3270
|
+
// delivery price for order
|
|
3212
3271
|
originalAmount: i.number().positive().optional(),
|
|
3213
3272
|
// what client pay
|
|
3214
3273
|
actualAmount: i.number().positive().optional(),
|
|
3215
3274
|
// what store charge
|
|
3216
3275
|
date: i.number(),
|
|
3217
3276
|
deliveryDate: i.coerce.number(),
|
|
3218
|
-
client:
|
|
3277
|
+
client: yn.required({}),
|
|
3219
3278
|
nameOnInvoice: i.string().optional(),
|
|
3220
3279
|
clientComment: i.string().optional(),
|
|
3221
|
-
deliveryNote: et.optional(),
|
|
3222
|
-
invoice: _n.optional(),
|
|
3223
3280
|
organizationId: i.string().optional(),
|
|
3224
|
-
billingAccount: tt.optional()
|
|
3225
|
-
|
|
3281
|
+
billingAccount: tt.optional(),
|
|
3282
|
+
deliveryNote: _n.optional(),
|
|
3283
|
+
invoice: kn.optional(),
|
|
3284
|
+
ezInvoice: xn.optional(),
|
|
3285
|
+
ezDeliveryNote: vn.optional()
|
|
3286
|
+
}), wn = i.enum(["individual", "company"]), Wn = i.object({
|
|
3226
3287
|
id: i.string(),
|
|
3227
3288
|
companyId: i.string(),
|
|
3228
3289
|
name: i.string(),
|
|
@@ -3233,14 +3294,14 @@ const tt = i.object({
|
|
|
3233
3294
|
paymentType: i.enum(["external", "j5"]),
|
|
3234
3295
|
allowAnonymousClients: i.boolean(),
|
|
3235
3296
|
isVatIncludedInPrice: i.boolean(),
|
|
3236
|
-
clientTypes: i.array(
|
|
3297
|
+
clientTypes: i.array(wn),
|
|
3237
3298
|
minimumOrder: i.number().optional(),
|
|
3238
3299
|
freeDeliveryPrice: i.number().optional(),
|
|
3239
3300
|
deliveryPrice: i.number().optional()
|
|
3240
|
-
}),
|
|
3301
|
+
}), Tn = i.object({
|
|
3241
3302
|
minSpend: i.number().positive().optional(),
|
|
3242
3303
|
stackable: i.boolean().default(!1)
|
|
3243
|
-
}).optional(),
|
|
3304
|
+
}).optional(), In = i.discriminatedUnion("variantType", [
|
|
3244
3305
|
i.object({
|
|
3245
3306
|
variantType: i.literal("bundle"),
|
|
3246
3307
|
productsId: i.array(i.string().nonempty()).min(1),
|
|
@@ -3250,7 +3311,7 @@ const tt = i.object({
|
|
|
3250
3311
|
bundlePrice: i.number().positive()
|
|
3251
3312
|
// Total price for the bundle (e.g., $25)
|
|
3252
3313
|
})
|
|
3253
|
-
]),
|
|
3314
|
+
]), Qn = i.object({
|
|
3254
3315
|
type: i.literal("Discount"),
|
|
3255
3316
|
storeId: i.string().min(1),
|
|
3256
3317
|
companyId: i.string().min(1),
|
|
@@ -3259,10 +3320,10 @@ const tt = i.object({
|
|
|
3259
3320
|
active: i.boolean(),
|
|
3260
3321
|
startDate: i.number(),
|
|
3261
3322
|
endDate: i.number(),
|
|
3262
|
-
variant:
|
|
3263
|
-
conditions:
|
|
3323
|
+
variant: In,
|
|
3324
|
+
conditions: Tn
|
|
3264
3325
|
});
|
|
3265
|
-
class
|
|
3326
|
+
class An {
|
|
3266
3327
|
canApply(e, t) {
|
|
3267
3328
|
if (e.variant.variantType !== "bundle" || !this.isDiscountActive(e)) return !1;
|
|
3268
3329
|
const { productsId: r, requiredQuantity: s } = e.variant;
|
|
@@ -3271,20 +3332,20 @@ class wn {
|
|
|
3271
3332
|
calculate(e, t) {
|
|
3272
3333
|
if (e.variant.variantType !== "bundle")
|
|
3273
3334
|
return { applicable: !1, discountAmount: 0, affectedItems: [] };
|
|
3274
|
-
const { productsId: r, requiredQuantity: s, bundlePrice: a } = e.variant, o = t.cart.filter((
|
|
3275
|
-
if (
|
|
3335
|
+
const { productsId: r, requiredQuantity: s, bundlePrice: a } = e.variant, o = t.cart.filter((K) => r.includes(K.product.id)), c = this.getTotalQuantity(t.cart, r), l = Math.floor(c / s);
|
|
3336
|
+
if (l === 0)
|
|
3276
3337
|
return { applicable: !1, discountAmount: 0, affectedItems: [] };
|
|
3277
|
-
const
|
|
3278
|
-
l,
|
|
3279
|
-
a,
|
|
3338
|
+
const d = this.calculateOriginalPrice(o), p = this.getTotalQuantity(t.cart, r), b = this.calculateDiscountedPrice(
|
|
3280
3339
|
d,
|
|
3340
|
+
a,
|
|
3341
|
+
l,
|
|
3281
3342
|
s,
|
|
3282
|
-
|
|
3283
|
-
), w =
|
|
3343
|
+
p
|
|
3344
|
+
), w = d - b, A = this.distributeDiscount(o, w, d);
|
|
3284
3345
|
return {
|
|
3285
3346
|
applicable: !0,
|
|
3286
3347
|
discountAmount: Number(w.toFixed(2)),
|
|
3287
|
-
affectedItems:
|
|
3348
|
+
affectedItems: A
|
|
3288
3349
|
};
|
|
3289
3350
|
}
|
|
3290
3351
|
isDiscountActive(e) {
|
|
@@ -3298,8 +3359,8 @@ class wn {
|
|
|
3298
3359
|
return e.reduce((t, r) => t + r.product.price * r.amount, 0);
|
|
3299
3360
|
}
|
|
3300
3361
|
calculateDiscountedPrice(e, t, r, s, a) {
|
|
3301
|
-
const o = t * r, c = r * s,
|
|
3302
|
-
return o +
|
|
3362
|
+
const o = t * r, c = r * s, d = Math.max(0, a - c) / a * e;
|
|
3363
|
+
return o + d;
|
|
3303
3364
|
}
|
|
3304
3365
|
distributeDiscount(e, t, r) {
|
|
3305
3366
|
const s = t / r;
|
|
@@ -3330,11 +3391,11 @@ class nt {
|
|
|
3330
3391
|
}
|
|
3331
3392
|
}
|
|
3332
3393
|
Re(nt, "strategies", /* @__PURE__ */ new Map([
|
|
3333
|
-
["bundle", new
|
|
3394
|
+
["bundle", new An()]
|
|
3334
3395
|
]));
|
|
3335
|
-
class
|
|
3396
|
+
class Sn {
|
|
3336
3397
|
static calculateDiscounts(e, t, r) {
|
|
3337
|
-
var
|
|
3398
|
+
var d, p;
|
|
3338
3399
|
const s = {
|
|
3339
3400
|
cart: e,
|
|
3340
3401
|
user: r,
|
|
@@ -3342,22 +3403,22 @@ class Tn {
|
|
|
3342
3403
|
}, a = this.filterActiveDiscounts(t), o = [];
|
|
3343
3404
|
for (const b of a) {
|
|
3344
3405
|
const w = nt.getStrategy(b);
|
|
3345
|
-
if (!w || !w.canApply(b, s) || !((
|
|
3346
|
-
const
|
|
3347
|
-
|
|
3406
|
+
if (!w || !w.canApply(b, s) || !((d = b.conditions) != null && d.stackable) && o.length > 0) continue;
|
|
3407
|
+
const A = w.calculate(b, s);
|
|
3408
|
+
A.applicable && (o.push({
|
|
3348
3409
|
discountId: b.id,
|
|
3349
|
-
discountName: ((
|
|
3350
|
-
discountAmount: Number(
|
|
3351
|
-
affectedItems:
|
|
3410
|
+
discountName: ((p = b.name[0]) == null ? void 0 : p.value) || "Discount",
|
|
3411
|
+
discountAmount: Number(A.discountAmount.toFixed(2)),
|
|
3412
|
+
affectedItems: A.affectedItems
|
|
3352
3413
|
}), s.appliedDiscounts = o);
|
|
3353
3414
|
}
|
|
3354
|
-
const c = this.calculateFinalPrices(e, o),
|
|
3415
|
+
const c = this.calculateFinalPrices(e, o), l = o.reduce(
|
|
3355
3416
|
(b, w) => b + w.discountAmount,
|
|
3356
3417
|
0
|
|
3357
3418
|
);
|
|
3358
3419
|
return {
|
|
3359
3420
|
items: c,
|
|
3360
|
-
totalDiscount: Number(
|
|
3421
|
+
totalDiscount: Number(l.toFixed(2)),
|
|
3361
3422
|
appliedDiscounts: o
|
|
3362
3423
|
};
|
|
3363
3424
|
}
|
|
@@ -3370,12 +3431,12 @@ class Tn {
|
|
|
3370
3431
|
static calculateFinalPrices(e, t) {
|
|
3371
3432
|
return e.map((r) => {
|
|
3372
3433
|
const s = t.filter(
|
|
3373
|
-
(
|
|
3374
|
-
), a = s.reduce((
|
|
3375
|
-
const
|
|
3434
|
+
(l) => l.affectedItems.some((d) => d.productId === r.product.id)
|
|
3435
|
+
), a = s.reduce((l, d) => {
|
|
3436
|
+
const p = d.affectedItems.find(
|
|
3376
3437
|
(b) => b.productId === r.product.id
|
|
3377
3438
|
);
|
|
3378
|
-
return
|
|
3439
|
+
return l + ((p == null ? void 0 : p.discountAmount) || 0);
|
|
3379
3440
|
}, 0), o = a / r.amount, c = r.product.price - o;
|
|
3380
3441
|
return {
|
|
3381
3442
|
amount: r.amount,
|
|
@@ -3383,7 +3444,7 @@ class Tn {
|
|
|
3383
3444
|
originalPrice: Number(r.product.price.toFixed(2)),
|
|
3384
3445
|
finalPrice: Number(Math.max(0, c).toFixed(2)),
|
|
3385
3446
|
finalDiscount: Number(a.toFixed(2)),
|
|
3386
|
-
appliedDiscounts: s.map((
|
|
3447
|
+
appliedDiscounts: s.map((l) => l.discountId)
|
|
3387
3448
|
};
|
|
3388
3449
|
});
|
|
3389
3450
|
}
|
|
@@ -3398,13 +3459,13 @@ class Tn {
|
|
|
3398
3459
|
function rt(n) {
|
|
3399
3460
|
return Number(n.toFixed(2));
|
|
3400
3461
|
}
|
|
3401
|
-
function
|
|
3462
|
+
function Yn(n) {
|
|
3402
3463
|
return n.toFixed(2);
|
|
3403
3464
|
}
|
|
3404
|
-
function
|
|
3465
|
+
function Jn(n) {
|
|
3405
3466
|
return Math.max(0, rt(n));
|
|
3406
3467
|
}
|
|
3407
|
-
function
|
|
3468
|
+
function Xn(n, e) {
|
|
3408
3469
|
if (n <= 0) return 0;
|
|
3409
3470
|
const t = n - e;
|
|
3410
3471
|
return rt(t / n * 100);
|
|
@@ -3412,11 +3473,11 @@ function Jn(n, e) {
|
|
|
3412
3473
|
const Ce = {
|
|
3413
3474
|
VAT: 18
|
|
3414
3475
|
};
|
|
3415
|
-
function
|
|
3476
|
+
function Nn(n) {
|
|
3416
3477
|
var e, t;
|
|
3417
3478
|
return ((e = n.discount) == null ? void 0 : e.type) === "percent" ? n.price * (n.discount.value ?? 100) / 100 : ((t = n.discount) == null ? void 0 : t.type) === "number" ? n.discount.value ?? 0 : 0;
|
|
3418
3479
|
}
|
|
3419
|
-
function
|
|
3480
|
+
function Cn(n) {
|
|
3420
3481
|
var e, t;
|
|
3421
3482
|
if (((e = n.discount) == null ? void 0 : e.type) === "percent") {
|
|
3422
3483
|
const r = n.price * n.discount.value / 100;
|
|
@@ -3424,41 +3485,43 @@ function Sn(n) {
|
|
|
3424
3485
|
}
|
|
3425
3486
|
return ((t = n.discount) == null ? void 0 : t.type) === "number" ? n.price - n.discount.value : n.price;
|
|
3426
3487
|
}
|
|
3427
|
-
function
|
|
3488
|
+
function Hn({
|
|
3428
3489
|
cart: n,
|
|
3429
3490
|
discounts: e,
|
|
3430
|
-
|
|
3491
|
+
deliveryPrice: t = 0,
|
|
3492
|
+
freeDeliveryPrice: r = 0,
|
|
3493
|
+
isVatIncludedInPrice: s = !1
|
|
3431
3494
|
}) {
|
|
3432
|
-
const
|
|
3495
|
+
const a = n.map((d) => ({
|
|
3433
3496
|
amount: d.amount,
|
|
3434
3497
|
product: {
|
|
3435
3498
|
id: d.product.id,
|
|
3436
3499
|
price: d.product.price
|
|
3437
3500
|
}
|
|
3438
|
-
})),
|
|
3439
|
-
const
|
|
3501
|
+
})), o = Sn.calculateDiscounts(a, e), c = n.map((d, p) => {
|
|
3502
|
+
const b = o.items[p];
|
|
3440
3503
|
return {
|
|
3441
3504
|
amount: d.amount,
|
|
3442
3505
|
product: { ...d.product },
|
|
3443
3506
|
originalPrice: d.product.price,
|
|
3444
|
-
finalPrice:
|
|
3445
|
-
finalDiscount:
|
|
3507
|
+
finalPrice: b ? b.finalPrice : Cn(d.product),
|
|
3508
|
+
finalDiscount: b ? b.finalDiscount : Nn(d.product)
|
|
3446
3509
|
};
|
|
3447
|
-
}),
|
|
3448
|
-
(d,
|
|
3449
|
-
const { product:
|
|
3450
|
-
let
|
|
3451
|
-
if (
|
|
3510
|
+
}), l = c.reduce(
|
|
3511
|
+
(d, p) => {
|
|
3512
|
+
const { product: b, amount: w, finalPrice: A, finalDiscount: K } = p;
|
|
3513
|
+
let D = 0;
|
|
3514
|
+
if (b.vat) {
|
|
3452
3515
|
let Se = 0;
|
|
3453
|
-
if (
|
|
3454
|
-
const st =
|
|
3455
|
-
|
|
3516
|
+
if (s) {
|
|
3517
|
+
const st = A * (Ce.VAT / (100 + Ce.VAT));
|
|
3518
|
+
D = Number(st.toFixed(2)), D = D * w, Se = Number(D.toFixed(2));
|
|
3456
3519
|
} else
|
|
3457
|
-
|
|
3520
|
+
D = A * Ce.VAT / 100, D = D * w, Se = Number(D.toFixed(2));
|
|
3458
3521
|
d.vat = Number((d.vat + Se).toFixed(2));
|
|
3459
3522
|
}
|
|
3460
|
-
const
|
|
3461
|
-
return d.cost +=
|
|
3523
|
+
const Ae = Number(A.toFixed(2));
|
|
3524
|
+
return d.cost += w * Ae, d.discount += K && w * K, d.finalCost += w * Ae + (s ? 0 : D), d.productsCost += w * Ae + (s ? 0 : D), d.cost = Number(d.cost.toFixed(2)), d.discount = Number(d.discount.toFixed(2)), d.finalCost = Number(d.finalCost.toFixed(2)), d.productsCost = Number(d.productsCost.toFixed(2)), d;
|
|
3462
3525
|
},
|
|
3463
3526
|
{
|
|
3464
3527
|
discount: 0,
|
|
@@ -3466,15 +3529,15 @@ function Xn({
|
|
|
3466
3529
|
finalCost: 0,
|
|
3467
3530
|
vat: 0,
|
|
3468
3531
|
productsCost: 0,
|
|
3469
|
-
deliveryPrice:
|
|
3532
|
+
deliveryPrice: t
|
|
3470
3533
|
}
|
|
3471
3534
|
);
|
|
3472
|
-
return
|
|
3535
|
+
return l.deliveryPrice && l.productsCost >= r ? l.deliveryPrice = 0 : l.finalCost += l.deliveryPrice, console.log("cartDetails", l), { items: c, ...l };
|
|
3473
3536
|
}
|
|
3474
|
-
const
|
|
3537
|
+
const Zn = {
|
|
3475
3538
|
stores: "STORES",
|
|
3476
3539
|
companies: "COMPANIES"
|
|
3477
|
-
},
|
|
3540
|
+
}, Dn = {
|
|
3478
3541
|
products: "products",
|
|
3479
3542
|
profiles: "profiles",
|
|
3480
3543
|
cart: "cart",
|
|
@@ -3487,62 +3550,61 @@ const An = {
|
|
|
3487
3550
|
discounts: "discounts",
|
|
3488
3551
|
organizations: "organizations",
|
|
3489
3552
|
invoices: "invoices"
|
|
3490
|
-
},
|
|
3491
|
-
systemCollections:
|
|
3492
|
-
storeCollections:
|
|
3493
|
-
// for client
|
|
3553
|
+
}, jn = {
|
|
3554
|
+
systemCollections: Zn,
|
|
3555
|
+
storeCollections: Dn,
|
|
3556
|
+
// for client and server
|
|
3494
3557
|
getPath: ({
|
|
3495
3558
|
companyId: n,
|
|
3496
3559
|
storeId: e,
|
|
3497
3560
|
collectionName: t,
|
|
3498
3561
|
id: r
|
|
3499
3562
|
}) => `${n}/${e}/${t}${r ? `/${r}` : ""}`,
|
|
3500
|
-
// for
|
|
3563
|
+
// for firestore events
|
|
3501
3564
|
getDocPath: (n) => `{companyId}/{storeId}/${n}/{id}`
|
|
3502
|
-
},
|
|
3503
|
-
firestore:
|
|
3565
|
+
}, Gn = {
|
|
3566
|
+
firestore: jn
|
|
3504
3567
|
};
|
|
3505
3568
|
export {
|
|
3506
|
-
|
|
3569
|
+
gn as AddressSchema,
|
|
3507
3570
|
Xe as BaseCategorySchema,
|
|
3508
3571
|
tt as BillingAccountSchema,
|
|
3509
|
-
|
|
3510
|
-
|
|
3572
|
+
An as BundleDiscountStrategy,
|
|
3573
|
+
et as CalculatedDataSchema,
|
|
3511
3574
|
Ge as CartItemProductSchema,
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3575
|
+
Fn as CartSchema,
|
|
3576
|
+
Pe as CategorySchema,
|
|
3577
|
+
zn as CompanySchema,
|
|
3578
|
+
_n as DeliveryNoteSchema,
|
|
3579
|
+
Tn as DiscountConditionsSchema,
|
|
3580
|
+
Sn as DiscountEngine,
|
|
3581
|
+
Qn as DiscountSchema,
|
|
3519
3582
|
nt as DiscountStrategyFactory,
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3583
|
+
In as DiscountVariantSchema,
|
|
3584
|
+
vn as EzDeliveryNoteSchema,
|
|
3585
|
+
Un as FavoriteProductSchema,
|
|
3586
|
+
Pn as FileSchema,
|
|
3587
|
+
Gn as FirebaseAPI,
|
|
3588
|
+
re as LocaleSchema,
|
|
3589
|
+
Mn as LocaleValueSchema,
|
|
3590
|
+
qn as NewOrganizationSchema,
|
|
3591
|
+
Vn as NewProductSchema,
|
|
3528
3592
|
Bn as OrderSchema,
|
|
3529
|
-
|
|
3593
|
+
bn as OrganizationSchema,
|
|
3530
3594
|
He as ProductSchema,
|
|
3531
3595
|
Ke as ProfilePaymentTypeSchema,
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3596
|
+
yn as ProfileSchema,
|
|
3597
|
+
Wn as StoreSchema,
|
|
3598
|
+
$n as TFlattenCategorySchema,
|
|
3599
|
+
Xn as calculatePercentageDiscount,
|
|
3600
|
+
wn as clientTypesSchema,
|
|
3601
|
+
Ln as createEmptyProfile,
|
|
3602
|
+
Jn as ensureNonNegative,
|
|
3539
3603
|
rt as formatCurrency,
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
Un as isDeliveryNote,
|
|
3544
|
-
jn as isFile,
|
|
3604
|
+
Yn as formatCurrencyString,
|
|
3605
|
+
Hn as getCartCost,
|
|
3606
|
+
Rn as isFile,
|
|
3545
3607
|
M as notEmptyTextSchema,
|
|
3546
|
-
|
|
3608
|
+
En as numericTextSchema
|
|
3547
3609
|
};
|
|
3548
3610
|
//# sourceMappingURL=core.es.js.map
|