@jsdev_ninja/core 0.12.0 → 0.12.3
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 +565 -564
- 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/entities/Address.d.ts.map +1 -1
- package/dist/entities/Address.js +7 -8
- package/dist/entities/Atoms.d.ts +12 -0
- package/dist/entities/Atoms.d.ts.map +1 -1
- package/dist/entities/Atoms.js +4 -0
- package/dist/entities/Cart.d.ts +14 -14
- package/dist/entities/Order.d.ts +12 -12
- package/dist/entities/Product.d.ts +8 -8
- package/dist/entities/Profile.js +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +11 -15
- package/lib/entities/Address.ts +7 -8
- package/lib/entities/Atoms.ts +7 -0
- package/lib/entities/Profile.ts +1 -1
- package/lib/utils/index.ts +14 -26
- package/package.json +1 -1
package/dist/core.es.js
CHANGED
|
@@ -13,9 +13,9 @@ var b;
|
|
|
13
13
|
a[c] = c;
|
|
14
14
|
return a;
|
|
15
15
|
}, r.getValidEnumValues = (s) => {
|
|
16
|
-
const a = r.objectKeys(s).filter((
|
|
17
|
-
for (const
|
|
18
|
-
c[
|
|
16
|
+
const a = r.objectKeys(s).filter((o) => typeof s[s[o]] != "number"), c = {};
|
|
17
|
+
for (const o of a)
|
|
18
|
+
c[o] = s[o];
|
|
19
19
|
return r.objectValues(c);
|
|
20
20
|
}, r.objectValues = (s) => r.objectKeys(s).map(function(a) {
|
|
21
21
|
return s[a];
|
|
@@ -63,7 +63,7 @@ const h = b.arrayToEnum([
|
|
|
63
63
|
"never",
|
|
64
64
|
"map",
|
|
65
65
|
"set"
|
|
66
|
-
]),
|
|
66
|
+
]), $ = (r) => {
|
|
67
67
|
switch (typeof r) {
|
|
68
68
|
case "undefined":
|
|
69
69
|
return h.undefined;
|
|
@@ -101,8 +101,8 @@ const h = b.arrayToEnum([
|
|
|
101
101
|
"invalid_intersection_types",
|
|
102
102
|
"not_multiple_of",
|
|
103
103
|
"not_finite"
|
|
104
|
-
]),
|
|
105
|
-
class
|
|
104
|
+
]), at = (r) => JSON.stringify(r, null, 2).replace(/"([^"]+)":/g, "$1:");
|
|
105
|
+
class S extends Error {
|
|
106
106
|
get errors() {
|
|
107
107
|
return this.issues;
|
|
108
108
|
}
|
|
@@ -129,17 +129,17 @@ class Z extends Error {
|
|
|
129
129
|
else if (c.path.length === 0)
|
|
130
130
|
n._errors.push(t(c));
|
|
131
131
|
else {
|
|
132
|
-
let
|
|
132
|
+
let o = n, l = 0;
|
|
133
133
|
for (; l < c.path.length; ) {
|
|
134
134
|
const u = c.path[l];
|
|
135
|
-
l === c.path.length - 1 ? (
|
|
135
|
+
l === c.path.length - 1 ? (o[u] = o[u] || { _errors: [] }, o[u]._errors.push(t(c))) : o[u] = o[u] || { _errors: [] }, o = o[u], l++;
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
};
|
|
139
139
|
return s(this), n;
|
|
140
140
|
}
|
|
141
141
|
static assert(e) {
|
|
142
|
-
if (!(e instanceof
|
|
142
|
+
if (!(e instanceof S))
|
|
143
143
|
throw new Error(`Not a ZodError: ${e}`);
|
|
144
144
|
}
|
|
145
145
|
toString() {
|
|
@@ -161,7 +161,7 @@ class Z extends Error {
|
|
|
161
161
|
return this.flatten();
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
|
-
|
|
164
|
+
S.create = (r) => new S(r);
|
|
165
165
|
const G = (r, e) => {
|
|
166
166
|
let t;
|
|
167
167
|
switch (r.code) {
|
|
@@ -219,7 +219,7 @@ const G = (r, e) => {
|
|
|
219
219
|
return { message: t };
|
|
220
220
|
};
|
|
221
221
|
let Ue = G;
|
|
222
|
-
function
|
|
222
|
+
function it(r) {
|
|
223
223
|
Ue = r;
|
|
224
224
|
}
|
|
225
225
|
function ve() {
|
|
@@ -236,16 +236,16 @@ const _e = (r) => {
|
|
|
236
236
|
path: a,
|
|
237
237
|
message: s.message
|
|
238
238
|
};
|
|
239
|
-
let
|
|
239
|
+
let o = "";
|
|
240
240
|
const l = n.filter((u) => !!u).slice().reverse();
|
|
241
241
|
for (const u of l)
|
|
242
|
-
|
|
242
|
+
o = u(c, { data: e, defaultError: o }).message;
|
|
243
243
|
return {
|
|
244
244
|
...s,
|
|
245
245
|
path: a,
|
|
246
|
-
message:
|
|
246
|
+
message: o
|
|
247
247
|
};
|
|
248
|
-
},
|
|
248
|
+
}, ot = [];
|
|
249
249
|
function f(r, e) {
|
|
250
250
|
const t = ve(), n = _e({
|
|
251
251
|
issueData: e,
|
|
@@ -264,7 +264,7 @@ function f(r, e) {
|
|
|
264
264
|
});
|
|
265
265
|
r.common.issues.push(n);
|
|
266
266
|
}
|
|
267
|
-
class
|
|
267
|
+
class T {
|
|
268
268
|
constructor() {
|
|
269
269
|
this.value = "valid";
|
|
270
270
|
}
|
|
@@ -292,7 +292,7 @@ class C {
|
|
|
292
292
|
value: c
|
|
293
293
|
});
|
|
294
294
|
}
|
|
295
|
-
return
|
|
295
|
+
return T.mergeObjectSync(e, n);
|
|
296
296
|
}
|
|
297
297
|
static mergeObjectSync(e, t) {
|
|
298
298
|
const n = {};
|
|
@@ -307,7 +307,7 @@ class C {
|
|
|
307
307
|
}
|
|
308
308
|
const g = Object.freeze({
|
|
309
309
|
status: "aborted"
|
|
310
|
-
}),
|
|
310
|
+
}), Y = (r) => ({ status: "dirty", value: r }), C = (r) => ({ status: "valid", value: r }), Oe = (r) => r.status === "aborted", je = (r) => r.status === "dirty", B = (r) => r.status === "valid", se = (r) => typeof Promise < "u" && r instanceof Promise;
|
|
311
311
|
function be(r, e, t, n) {
|
|
312
312
|
if (typeof e == "function" ? r !== e || !0 : !e.has(r)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
313
313
|
return e.get(r);
|
|
@@ -320,8 +320,8 @@ var m;
|
|
|
320
320
|
(function(r) {
|
|
321
321
|
r.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, r.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
|
|
322
322
|
})(m || (m = {}));
|
|
323
|
-
var
|
|
324
|
-
class
|
|
323
|
+
var re, ne;
|
|
324
|
+
class E {
|
|
325
325
|
constructor(e, t, n, s) {
|
|
326
326
|
this._cachedPath = [], this.parent = e, this.data = t, this._path = n, this._key = s;
|
|
327
327
|
}
|
|
@@ -329,7 +329,7 @@ class R {
|
|
|
329
329
|
return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
|
|
330
330
|
}
|
|
331
331
|
}
|
|
332
|
-
const
|
|
332
|
+
const Me = (r, e) => {
|
|
333
333
|
if (B(e))
|
|
334
334
|
return { success: !0, data: e.value };
|
|
335
335
|
if (!r.common.issues.length)
|
|
@@ -339,7 +339,7 @@ const Le = (r, e) => {
|
|
|
339
339
|
get error() {
|
|
340
340
|
if (this._error)
|
|
341
341
|
return this._error;
|
|
342
|
-
const t = new
|
|
342
|
+
const t = new S(r.common.issues);
|
|
343
343
|
return this._error = t, this._error;
|
|
344
344
|
}
|
|
345
345
|
};
|
|
@@ -350,10 +350,10 @@ function v(r) {
|
|
|
350
350
|
const { errorMap: e, invalid_type_error: t, required_error: n, description: s } = r;
|
|
351
351
|
if (e && (t || n))
|
|
352
352
|
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
353
|
-
return e ? { errorMap: e, description: s } : { errorMap: (c,
|
|
353
|
+
return e ? { errorMap: e, description: s } : { errorMap: (c, o) => {
|
|
354
354
|
var l, u;
|
|
355
355
|
const { message: p } = r;
|
|
356
|
-
return c.code === "invalid_enum_value" ? { message: p ??
|
|
356
|
+
return c.code === "invalid_enum_value" ? { message: p ?? o.defaultError } : typeof o.data > "u" ? { message: (l = p ?? n) !== null && l !== void 0 ? l : o.defaultError } : c.code !== "invalid_type" ? { message: o.defaultError } : { message: (u = p ?? t) !== null && u !== void 0 ? u : o.defaultError };
|
|
357
357
|
}, description: s };
|
|
358
358
|
}
|
|
359
359
|
class _ {
|
|
@@ -361,13 +361,13 @@ class _ {
|
|
|
361
361
|
return this._def.description;
|
|
362
362
|
}
|
|
363
363
|
_getType(e) {
|
|
364
|
-
return
|
|
364
|
+
return $(e.data);
|
|
365
365
|
}
|
|
366
366
|
_getOrReturnCtx(e, t) {
|
|
367
367
|
return t || {
|
|
368
368
|
common: e.parent.common,
|
|
369
369
|
data: e.data,
|
|
370
|
-
parsedType:
|
|
370
|
+
parsedType: $(e.data),
|
|
371
371
|
schemaErrorMap: this._def.errorMap,
|
|
372
372
|
path: e.path,
|
|
373
373
|
parent: e.parent
|
|
@@ -375,11 +375,11 @@ class _ {
|
|
|
375
375
|
}
|
|
376
376
|
_processInputParams(e) {
|
|
377
377
|
return {
|
|
378
|
-
status: new
|
|
378
|
+
status: new T(),
|
|
379
379
|
ctx: {
|
|
380
380
|
common: e.parent.common,
|
|
381
381
|
data: e.data,
|
|
382
|
-
parsedType:
|
|
382
|
+
parsedType: $(e.data),
|
|
383
383
|
schemaErrorMap: this._def.errorMap,
|
|
384
384
|
path: e.path,
|
|
385
385
|
parent: e.parent
|
|
@@ -388,7 +388,7 @@ class _ {
|
|
|
388
388
|
}
|
|
389
389
|
_parseSync(e) {
|
|
390
390
|
const t = this._parse(e);
|
|
391
|
-
if (
|
|
391
|
+
if (se(t))
|
|
392
392
|
throw new Error("Synchronous parse encountered promise.");
|
|
393
393
|
return t;
|
|
394
394
|
}
|
|
@@ -414,9 +414,9 @@ class _ {
|
|
|
414
414
|
schemaErrorMap: this._def.errorMap,
|
|
415
415
|
parent: null,
|
|
416
416
|
data: e,
|
|
417
|
-
parsedType:
|
|
417
|
+
parsedType: $(e)
|
|
418
418
|
}, a = this._parseSync({ data: e, path: s.path, parent: s });
|
|
419
|
-
return
|
|
419
|
+
return Me(s, a);
|
|
420
420
|
}
|
|
421
421
|
"~validate"(e) {
|
|
422
422
|
var t, n;
|
|
@@ -429,7 +429,7 @@ class _ {
|
|
|
429
429
|
schemaErrorMap: this._def.errorMap,
|
|
430
430
|
parent: null,
|
|
431
431
|
data: e,
|
|
432
|
-
parsedType:
|
|
432
|
+
parsedType: $(e)
|
|
433
433
|
};
|
|
434
434
|
if (!this["~standard"].async)
|
|
435
435
|
try {
|
|
@@ -468,25 +468,25 @@ class _ {
|
|
|
468
468
|
schemaErrorMap: this._def.errorMap,
|
|
469
469
|
parent: null,
|
|
470
470
|
data: e,
|
|
471
|
-
parsedType:
|
|
472
|
-
}, s = this._parse({ data: e, path: n.path, parent: n }), a = await (
|
|
473
|
-
return
|
|
471
|
+
parsedType: $(e)
|
|
472
|
+
}, s = this._parse({ data: e, path: n.path, parent: n }), a = await (se(s) ? s : Promise.resolve(s));
|
|
473
|
+
return Me(n, a);
|
|
474
474
|
}
|
|
475
475
|
refine(e, t) {
|
|
476
476
|
const n = (s) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(s) : t;
|
|
477
477
|
return this._refinement((s, a) => {
|
|
478
|
-
const c = e(s),
|
|
478
|
+
const c = e(s), o = () => a.addIssue({
|
|
479
479
|
code: d.custom,
|
|
480
480
|
...n(s)
|
|
481
481
|
});
|
|
482
|
-
return typeof Promise < "u" && c instanceof Promise ? c.then((l) => l ? !0 : (
|
|
482
|
+
return typeof Promise < "u" && c instanceof Promise ? c.then((l) => l ? !0 : (o(), !1)) : c ? !0 : (o(), !1);
|
|
483
483
|
});
|
|
484
484
|
}
|
|
485
485
|
refinement(e, t) {
|
|
486
486
|
return this._refinement((n, s) => e(n) ? !0 : (s.addIssue(typeof t == "function" ? t(n, s) : t), !1));
|
|
487
487
|
}
|
|
488
488
|
_refinement(e) {
|
|
489
|
-
return new
|
|
489
|
+
return new N({
|
|
490
490
|
schema: this,
|
|
491
491
|
typeName: y.ZodEffects,
|
|
492
492
|
effect: { type: "refinement", refinement: e }
|
|
@@ -503,7 +503,7 @@ class _ {
|
|
|
503
503
|
};
|
|
504
504
|
}
|
|
505
505
|
optional() {
|
|
506
|
-
return
|
|
506
|
+
return j.create(this, this._def);
|
|
507
507
|
}
|
|
508
508
|
nullable() {
|
|
509
509
|
return F.create(this, this._def);
|
|
@@ -512,19 +512,19 @@ class _ {
|
|
|
512
512
|
return this.nullable().optional();
|
|
513
513
|
}
|
|
514
514
|
array() {
|
|
515
|
-
return
|
|
515
|
+
return A.create(this);
|
|
516
516
|
}
|
|
517
517
|
promise() {
|
|
518
518
|
return K.create(this, this._def);
|
|
519
519
|
}
|
|
520
520
|
or(e) {
|
|
521
|
-
return
|
|
521
|
+
return ce.create([this, e], this._def);
|
|
522
522
|
}
|
|
523
523
|
and(e) {
|
|
524
|
-
return
|
|
524
|
+
return de.create(this, e, this._def);
|
|
525
525
|
}
|
|
526
526
|
transform(e) {
|
|
527
|
-
return new
|
|
527
|
+
return new N({
|
|
528
528
|
...v(this._def),
|
|
529
529
|
schema: this,
|
|
530
530
|
typeName: y.ZodEffects,
|
|
@@ -533,7 +533,7 @@ class _ {
|
|
|
533
533
|
}
|
|
534
534
|
default(e) {
|
|
535
535
|
const t = typeof e == "function" ? e : () => e;
|
|
536
|
-
return new
|
|
536
|
+
return new pe({
|
|
537
537
|
...v(this._def),
|
|
538
538
|
innerType: this,
|
|
539
539
|
defaultValue: t,
|
|
@@ -549,7 +549,7 @@ class _ {
|
|
|
549
549
|
}
|
|
550
550
|
catch(e) {
|
|
551
551
|
const t = typeof e == "function" ? e : () => e;
|
|
552
|
-
return new
|
|
552
|
+
return new me({
|
|
553
553
|
...v(this._def),
|
|
554
554
|
innerType: this,
|
|
555
555
|
catchValue: t,
|
|
@@ -564,10 +564,10 @@ class _ {
|
|
|
564
564
|
});
|
|
565
565
|
}
|
|
566
566
|
pipe(e) {
|
|
567
|
-
return
|
|
567
|
+
return ge.create(this, e);
|
|
568
568
|
}
|
|
569
569
|
readonly() {
|
|
570
|
-
return
|
|
570
|
+
return ye.create(this);
|
|
571
571
|
}
|
|
572
572
|
isOptional() {
|
|
573
573
|
return this.safeParse(void 0).success;
|
|
@@ -576,14 +576,14 @@ class _ {
|
|
|
576
576
|
return this.safeParse(null).success;
|
|
577
577
|
}
|
|
578
578
|
}
|
|
579
|
-
const
|
|
579
|
+
const ct = /^c[^\s-]{8,}$/i, dt = /^[0-9a-z]+$/, ut = /^[0-9A-HJKMNP-TV-Z]{26}$/i, lt = /^[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, ft = /^[a-z0-9_-]{21}$/i, ht = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, pt = /^[-+]?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)?)??$/, mt = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, yt = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
580
580
|
let Ze;
|
|
581
|
-
const
|
|
581
|
+
const gt = /^(?:(?: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])$/, vt = /^(?:(?: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])$/, _t = /^(([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]))$/, bt = /^(([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])$/, xt = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, kt = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, qe = "((\\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])))", wt = new RegExp(`^${qe}$`);
|
|
582
582
|
function We(r) {
|
|
583
583
|
let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
|
|
584
584
|
return r.precision ? e = `${e}\\.\\d{${r.precision}}` : r.precision == null && (e = `${e}(\\.\\d+)?`), e;
|
|
585
585
|
}
|
|
586
|
-
function
|
|
586
|
+
function Tt(r) {
|
|
587
587
|
return new RegExp(`^${We(r)}$`);
|
|
588
588
|
}
|
|
589
589
|
function Je(r) {
|
|
@@ -591,11 +591,11 @@ function Je(r) {
|
|
|
591
591
|
const t = [];
|
|
592
592
|
return t.push(r.local ? "Z?" : "Z"), r.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
|
|
593
593
|
}
|
|
594
|
-
function Tt(r, e) {
|
|
595
|
-
return !!((e === "v4" || !e) && yt.test(r) || (e === "v6" || !e) && vt.test(r));
|
|
596
|
-
}
|
|
597
594
|
function Ct(r, e) {
|
|
598
|
-
|
|
595
|
+
return !!((e === "v4" || !e) && gt.test(r) || (e === "v6" || !e) && _t.test(r));
|
|
596
|
+
}
|
|
597
|
+
function St(r, e) {
|
|
598
|
+
if (!ht.test(r))
|
|
599
599
|
return !1;
|
|
600
600
|
try {
|
|
601
601
|
const [t] = r.split("."), n = t.replace(/-/g, "+").replace(/_/g, "/").padEnd(t.length + (4 - t.length % 4) % 4, "="), s = JSON.parse(atob(n));
|
|
@@ -604,10 +604,10 @@ function Ct(r, e) {
|
|
|
604
604
|
return !1;
|
|
605
605
|
}
|
|
606
606
|
}
|
|
607
|
-
function
|
|
608
|
-
return !!((e === "v4" || !e) &&
|
|
607
|
+
function Zt(r, e) {
|
|
608
|
+
return !!((e === "v4" || !e) && vt.test(r) || (e === "v6" || !e) && bt.test(r));
|
|
609
609
|
}
|
|
610
|
-
class
|
|
610
|
+
class I extends _ {
|
|
611
611
|
_parse(e) {
|
|
612
612
|
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== h.string) {
|
|
613
613
|
const a = this._getOrReturnCtx(e);
|
|
@@ -617,7 +617,7 @@ class N extends _ {
|
|
|
617
617
|
received: a.parsedType
|
|
618
618
|
}), g;
|
|
619
619
|
}
|
|
620
|
-
const n = new
|
|
620
|
+
const n = new T();
|
|
621
621
|
let s;
|
|
622
622
|
for (const a of this._def.checks)
|
|
623
623
|
if (a.kind === "min")
|
|
@@ -639,15 +639,15 @@ class N extends _ {
|
|
|
639
639
|
message: a.message
|
|
640
640
|
}), n.dirty());
|
|
641
641
|
else if (a.kind === "length") {
|
|
642
|
-
const c = e.data.length > a.value,
|
|
643
|
-
(c ||
|
|
642
|
+
const c = e.data.length > a.value, o = e.data.length < a.value;
|
|
643
|
+
(c || o) && (s = this._getOrReturnCtx(e, s), c ? f(s, {
|
|
644
644
|
code: d.too_big,
|
|
645
645
|
maximum: a.value,
|
|
646
646
|
type: "string",
|
|
647
647
|
inclusive: !0,
|
|
648
648
|
exact: !0,
|
|
649
649
|
message: a.message
|
|
650
|
-
}) :
|
|
650
|
+
}) : o && f(s, {
|
|
651
651
|
code: d.too_small,
|
|
652
652
|
minimum: a.value,
|
|
653
653
|
type: "string",
|
|
@@ -656,43 +656,43 @@ class N extends _ {
|
|
|
656
656
|
message: a.message
|
|
657
657
|
}), n.dirty());
|
|
658
658
|
} else if (a.kind === "email")
|
|
659
|
-
|
|
659
|
+
mt.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
660
660
|
validation: "email",
|
|
661
661
|
code: d.invalid_string,
|
|
662
662
|
message: a.message
|
|
663
663
|
}), n.dirty());
|
|
664
664
|
else if (a.kind === "emoji")
|
|
665
|
-
Ze || (Ze = new RegExp(
|
|
665
|
+
Ze || (Ze = new RegExp(yt, "u")), Ze.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
666
666
|
validation: "emoji",
|
|
667
667
|
code: d.invalid_string,
|
|
668
668
|
message: a.message
|
|
669
669
|
}), n.dirty());
|
|
670
670
|
else if (a.kind === "uuid")
|
|
671
|
-
|
|
671
|
+
lt.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
672
672
|
validation: "uuid",
|
|
673
673
|
code: d.invalid_string,
|
|
674
674
|
message: a.message
|
|
675
675
|
}), n.dirty());
|
|
676
676
|
else if (a.kind === "nanoid")
|
|
677
|
-
|
|
677
|
+
ft.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
678
678
|
validation: "nanoid",
|
|
679
679
|
code: d.invalid_string,
|
|
680
680
|
message: a.message
|
|
681
681
|
}), n.dirty());
|
|
682
682
|
else if (a.kind === "cuid")
|
|
683
|
-
|
|
683
|
+
ct.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
684
684
|
validation: "cuid",
|
|
685
685
|
code: d.invalid_string,
|
|
686
686
|
message: a.message
|
|
687
687
|
}), n.dirty());
|
|
688
688
|
else if (a.kind === "cuid2")
|
|
689
|
-
|
|
689
|
+
dt.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
690
690
|
validation: "cuid2",
|
|
691
691
|
code: d.invalid_string,
|
|
692
692
|
message: a.message
|
|
693
693
|
}), n.dirty());
|
|
694
694
|
else if (a.kind === "ulid")
|
|
695
|
-
|
|
695
|
+
ut.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
696
696
|
validation: "ulid",
|
|
697
697
|
code: d.invalid_string,
|
|
698
698
|
message: a.message
|
|
@@ -727,35 +727,35 @@ class N extends _ {
|
|
|
727
727
|
code: d.invalid_string,
|
|
728
728
|
validation: "datetime",
|
|
729
729
|
message: a.message
|
|
730
|
-
}), n.dirty()) : a.kind === "date" ?
|
|
730
|
+
}), n.dirty()) : a.kind === "date" ? wt.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
731
731
|
code: d.invalid_string,
|
|
732
732
|
validation: "date",
|
|
733
733
|
message: a.message
|
|
734
|
-
}), n.dirty()) : a.kind === "time" ?
|
|
734
|
+
}), n.dirty()) : a.kind === "time" ? Tt(a).test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
735
735
|
code: d.invalid_string,
|
|
736
736
|
validation: "time",
|
|
737
737
|
message: a.message
|
|
738
|
-
}), n.dirty()) : a.kind === "duration" ?
|
|
738
|
+
}), n.dirty()) : a.kind === "duration" ? pt.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
739
739
|
validation: "duration",
|
|
740
740
|
code: d.invalid_string,
|
|
741
741
|
message: a.message
|
|
742
|
-
}), n.dirty()) : a.kind === "ip" ?
|
|
742
|
+
}), n.dirty()) : a.kind === "ip" ? Ct(e.data, a.version) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
743
743
|
validation: "ip",
|
|
744
744
|
code: d.invalid_string,
|
|
745
745
|
message: a.message
|
|
746
|
-
}), n.dirty()) : a.kind === "jwt" ?
|
|
746
|
+
}), n.dirty()) : a.kind === "jwt" ? St(e.data, a.alg) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
747
747
|
validation: "jwt",
|
|
748
748
|
code: d.invalid_string,
|
|
749
749
|
message: a.message
|
|
750
|
-
}), n.dirty()) : a.kind === "cidr" ?
|
|
750
|
+
}), n.dirty()) : a.kind === "cidr" ? Zt(e.data, a.version) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
751
751
|
validation: "cidr",
|
|
752
752
|
code: d.invalid_string,
|
|
753
753
|
message: a.message
|
|
754
|
-
}), n.dirty()) : a.kind === "base64" ?
|
|
754
|
+
}), n.dirty()) : a.kind === "base64" ? xt.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
755
755
|
validation: "base64",
|
|
756
756
|
code: d.invalid_string,
|
|
757
757
|
message: a.message
|
|
758
|
-
}), n.dirty()) : a.kind === "base64url" ?
|
|
758
|
+
}), n.dirty()) : a.kind === "base64url" ? kt.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
759
759
|
validation: "base64url",
|
|
760
760
|
code: d.invalid_string,
|
|
761
761
|
message: a.message
|
|
@@ -770,7 +770,7 @@ class N extends _ {
|
|
|
770
770
|
});
|
|
771
771
|
}
|
|
772
772
|
_addCheck(e) {
|
|
773
|
-
return new
|
|
773
|
+
return new I({
|
|
774
774
|
...this._def,
|
|
775
775
|
checks: [...this._def.checks, e]
|
|
776
776
|
});
|
|
@@ -907,19 +907,19 @@ class N extends _ {
|
|
|
907
907
|
return this.min(1, m.errToObj(e));
|
|
908
908
|
}
|
|
909
909
|
trim() {
|
|
910
|
-
return new
|
|
910
|
+
return new I({
|
|
911
911
|
...this._def,
|
|
912
912
|
checks: [...this._def.checks, { kind: "trim" }]
|
|
913
913
|
});
|
|
914
914
|
}
|
|
915
915
|
toLowerCase() {
|
|
916
|
-
return new
|
|
916
|
+
return new I({
|
|
917
917
|
...this._def,
|
|
918
918
|
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
919
919
|
});
|
|
920
920
|
}
|
|
921
921
|
toUpperCase() {
|
|
922
|
-
return new
|
|
922
|
+
return new I({
|
|
923
923
|
...this._def,
|
|
924
924
|
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
925
925
|
});
|
|
@@ -985,16 +985,16 @@ class N extends _ {
|
|
|
985
985
|
return e;
|
|
986
986
|
}
|
|
987
987
|
}
|
|
988
|
-
|
|
988
|
+
I.create = (r) => {
|
|
989
989
|
var e;
|
|
990
|
-
return new
|
|
990
|
+
return new I({
|
|
991
991
|
checks: [],
|
|
992
992
|
typeName: y.ZodString,
|
|
993
993
|
coerce: (e = r == null ? void 0 : r.coerce) !== null && e !== void 0 ? e : !1,
|
|
994
994
|
...v(r)
|
|
995
995
|
});
|
|
996
996
|
};
|
|
997
|
-
function
|
|
997
|
+
function It(r, e) {
|
|
998
998
|
const t = (r.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, s = t > n ? t : n, a = parseInt(r.toFixed(s).replace(".", "")), c = parseInt(e.toFixed(s).replace(".", ""));
|
|
999
999
|
return a % c / Math.pow(10, s);
|
|
1000
1000
|
}
|
|
@@ -1012,7 +1012,7 @@ class V extends _ {
|
|
|
1012
1012
|
}), g;
|
|
1013
1013
|
}
|
|
1014
1014
|
let n;
|
|
1015
|
-
const s = new
|
|
1015
|
+
const s = new T();
|
|
1016
1016
|
for (const a of this._def.checks)
|
|
1017
1017
|
a.kind === "int" ? b.isInteger(e.data) || (n = this._getOrReturnCtx(e, n), f(n, {
|
|
1018
1018
|
code: d.invalid_type,
|
|
@@ -1033,7 +1033,7 @@ class V extends _ {
|
|
|
1033
1033
|
inclusive: a.inclusive,
|
|
1034
1034
|
exact: !1,
|
|
1035
1035
|
message: a.message
|
|
1036
|
-
}), s.dirty()) : a.kind === "multipleOf" ?
|
|
1036
|
+
}), s.dirty()) : a.kind === "multipleOf" ? It(e.data, a.value) !== 0 && (n = this._getOrReturnCtx(e, n), f(n, {
|
|
1037
1037
|
code: d.not_multiple_of,
|
|
1038
1038
|
multipleOf: a.value,
|
|
1039
1039
|
message: a.message
|
|
@@ -1184,7 +1184,7 @@ class L extends _ {
|
|
|
1184
1184
|
if (this._getType(e) !== h.bigint)
|
|
1185
1185
|
return this._getInvalidInput(e);
|
|
1186
1186
|
let n;
|
|
1187
|
-
const s = new
|
|
1187
|
+
const s = new T();
|
|
1188
1188
|
for (const a of this._def.checks)
|
|
1189
1189
|
a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n), f(n, {
|
|
1190
1190
|
code: d.too_small,
|
|
@@ -1306,7 +1306,7 @@ L.create = (r) => {
|
|
|
1306
1306
|
...v(r)
|
|
1307
1307
|
});
|
|
1308
1308
|
};
|
|
1309
|
-
class
|
|
1309
|
+
class ae extends _ {
|
|
1310
1310
|
_parse(e) {
|
|
1311
1311
|
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== h.boolean) {
|
|
1312
1312
|
const n = this._getOrReturnCtx(e);
|
|
@@ -1316,10 +1316,10 @@ class se extends _ {
|
|
|
1316
1316
|
received: n.parsedType
|
|
1317
1317
|
}), g;
|
|
1318
1318
|
}
|
|
1319
|
-
return
|
|
1319
|
+
return C(e.data);
|
|
1320
1320
|
}
|
|
1321
1321
|
}
|
|
1322
|
-
|
|
1322
|
+
ae.create = (r) => new ae({
|
|
1323
1323
|
typeName: y.ZodBoolean,
|
|
1324
1324
|
coerce: (r == null ? void 0 : r.coerce) || !1,
|
|
1325
1325
|
...v(r)
|
|
@@ -1340,7 +1340,7 @@ class q extends _ {
|
|
|
1340
1340
|
code: d.invalid_date
|
|
1341
1341
|
}), g;
|
|
1342
1342
|
}
|
|
1343
|
-
const n = new
|
|
1343
|
+
const n = new T();
|
|
1344
1344
|
let s;
|
|
1345
1345
|
for (const a of this._def.checks)
|
|
1346
1346
|
a.kind === "min" ? e.data.getTime() < a.value && (s = this._getOrReturnCtx(e, s), f(s, {
|
|
@@ -1412,14 +1412,14 @@ class xe extends _ {
|
|
|
1412
1412
|
received: n.parsedType
|
|
1413
1413
|
}), g;
|
|
1414
1414
|
}
|
|
1415
|
-
return
|
|
1415
|
+
return C(e.data);
|
|
1416
1416
|
}
|
|
1417
1417
|
}
|
|
1418
1418
|
xe.create = (r) => new xe({
|
|
1419
1419
|
typeName: y.ZodSymbol,
|
|
1420
1420
|
...v(r)
|
|
1421
1421
|
});
|
|
1422
|
-
class
|
|
1422
|
+
class ie extends _ {
|
|
1423
1423
|
_parse(e) {
|
|
1424
1424
|
if (this._getType(e) !== h.undefined) {
|
|
1425
1425
|
const n = this._getOrReturnCtx(e);
|
|
@@ -1429,14 +1429,14 @@ class ae extends _ {
|
|
|
1429
1429
|
received: n.parsedType
|
|
1430
1430
|
}), g;
|
|
1431
1431
|
}
|
|
1432
|
-
return
|
|
1432
|
+
return C(e.data);
|
|
1433
1433
|
}
|
|
1434
1434
|
}
|
|
1435
|
-
|
|
1435
|
+
ie.create = (r) => new ie({
|
|
1436
1436
|
typeName: y.ZodUndefined,
|
|
1437
1437
|
...v(r)
|
|
1438
1438
|
});
|
|
1439
|
-
class
|
|
1439
|
+
class oe extends _ {
|
|
1440
1440
|
_parse(e) {
|
|
1441
1441
|
if (this._getType(e) !== h.null) {
|
|
1442
1442
|
const n = this._getOrReturnCtx(e);
|
|
@@ -1446,10 +1446,10 @@ class ie extends _ {
|
|
|
1446
1446
|
received: n.parsedType
|
|
1447
1447
|
}), g;
|
|
1448
1448
|
}
|
|
1449
|
-
return
|
|
1449
|
+
return C(e.data);
|
|
1450
1450
|
}
|
|
1451
1451
|
}
|
|
1452
|
-
|
|
1452
|
+
oe.create = (r) => new oe({
|
|
1453
1453
|
typeName: y.ZodNull,
|
|
1454
1454
|
...v(r)
|
|
1455
1455
|
});
|
|
@@ -1458,7 +1458,7 @@ class X extends _ {
|
|
|
1458
1458
|
super(...arguments), this._any = !0;
|
|
1459
1459
|
}
|
|
1460
1460
|
_parse(e) {
|
|
1461
|
-
return
|
|
1461
|
+
return C(e.data);
|
|
1462
1462
|
}
|
|
1463
1463
|
}
|
|
1464
1464
|
X.create = (r) => new X({
|
|
@@ -1470,7 +1470,7 @@ class U extends _ {
|
|
|
1470
1470
|
super(...arguments), this._unknown = !0;
|
|
1471
1471
|
}
|
|
1472
1472
|
_parse(e) {
|
|
1473
|
-
return
|
|
1473
|
+
return C(e.data);
|
|
1474
1474
|
}
|
|
1475
1475
|
}
|
|
1476
1476
|
U.create = (r) => new U({
|
|
@@ -1501,14 +1501,14 @@ class ke extends _ {
|
|
|
1501
1501
|
received: n.parsedType
|
|
1502
1502
|
}), g;
|
|
1503
1503
|
}
|
|
1504
|
-
return
|
|
1504
|
+
return C(e.data);
|
|
1505
1505
|
}
|
|
1506
1506
|
}
|
|
1507
1507
|
ke.create = (r) => new ke({
|
|
1508
1508
|
typeName: y.ZodVoid,
|
|
1509
1509
|
...v(r)
|
|
1510
1510
|
});
|
|
1511
|
-
class
|
|
1511
|
+
class A extends _ {
|
|
1512
1512
|
_parse(e) {
|
|
1513
1513
|
const { ctx: t, status: n } = this._processInputParams(e), s = this._def;
|
|
1514
1514
|
if (t.parsedType !== h.array)
|
|
@@ -1518,10 +1518,10 @@ class O extends _ {
|
|
|
1518
1518
|
received: t.parsedType
|
|
1519
1519
|
}), g;
|
|
1520
1520
|
if (s.exactLength !== null) {
|
|
1521
|
-
const c = t.data.length > s.exactLength.value,
|
|
1522
|
-
(c ||
|
|
1521
|
+
const c = t.data.length > s.exactLength.value, o = t.data.length < s.exactLength.value;
|
|
1522
|
+
(c || o) && (f(t, {
|
|
1523
1523
|
code: c ? d.too_big : d.too_small,
|
|
1524
|
-
minimum:
|
|
1524
|
+
minimum: o ? s.exactLength.value : void 0,
|
|
1525
1525
|
maximum: c ? s.exactLength.value : void 0,
|
|
1526
1526
|
type: "array",
|
|
1527
1527
|
inclusive: !0,
|
|
@@ -1544,27 +1544,27 @@ class O extends _ {
|
|
|
1544
1544
|
exact: !1,
|
|
1545
1545
|
message: s.maxLength.message
|
|
1546
1546
|
}), n.dirty()), t.common.async)
|
|
1547
|
-
return Promise.all([...t.data].map((c,
|
|
1548
|
-
const a = [...t.data].map((c,
|
|
1549
|
-
return
|
|
1547
|
+
return Promise.all([...t.data].map((c, o) => s.type._parseAsync(new E(t, c, t.path, o)))).then((c) => T.mergeArray(n, c));
|
|
1548
|
+
const a = [...t.data].map((c, o) => s.type._parseSync(new E(t, c, t.path, o)));
|
|
1549
|
+
return T.mergeArray(n, a);
|
|
1550
1550
|
}
|
|
1551
1551
|
get element() {
|
|
1552
1552
|
return this._def.type;
|
|
1553
1553
|
}
|
|
1554
1554
|
min(e, t) {
|
|
1555
|
-
return new
|
|
1555
|
+
return new A({
|
|
1556
1556
|
...this._def,
|
|
1557
1557
|
minLength: { value: e, message: m.toString(t) }
|
|
1558
1558
|
});
|
|
1559
1559
|
}
|
|
1560
1560
|
max(e, t) {
|
|
1561
|
-
return new
|
|
1561
|
+
return new A({
|
|
1562
1562
|
...this._def,
|
|
1563
1563
|
maxLength: { value: e, message: m.toString(t) }
|
|
1564
1564
|
});
|
|
1565
1565
|
}
|
|
1566
1566
|
length(e, t) {
|
|
1567
|
-
return new
|
|
1567
|
+
return new A({
|
|
1568
1568
|
...this._def,
|
|
1569
1569
|
exactLength: { value: e, message: m.toString(t) }
|
|
1570
1570
|
});
|
|
@@ -1573,7 +1573,7 @@ class O extends _ {
|
|
|
1573
1573
|
return this.min(1, e);
|
|
1574
1574
|
}
|
|
1575
1575
|
}
|
|
1576
|
-
|
|
1576
|
+
A.create = (r, e) => new A({
|
|
1577
1577
|
type: r,
|
|
1578
1578
|
minLength: null,
|
|
1579
1579
|
maxLength: null,
|
|
@@ -1586,16 +1586,16 @@ function J(r) {
|
|
|
1586
1586
|
const e = {};
|
|
1587
1587
|
for (const t in r.shape) {
|
|
1588
1588
|
const n = r.shape[t];
|
|
1589
|
-
e[t] =
|
|
1589
|
+
e[t] = j.create(J(n));
|
|
1590
1590
|
}
|
|
1591
1591
|
return new k({
|
|
1592
1592
|
...r._def,
|
|
1593
1593
|
shape: () => e
|
|
1594
1594
|
});
|
|
1595
|
-
} else return r instanceof
|
|
1595
|
+
} else return r instanceof A ? new A({
|
|
1596
1596
|
...r._def,
|
|
1597
1597
|
type: J(r.element)
|
|
1598
|
-
}) : r instanceof
|
|
1598
|
+
}) : r instanceof j ? j.create(J(r.unwrap())) : r instanceof F ? F.create(J(r.unwrap())) : r instanceof R ? R.create(r.items.map((e) => J(e))) : r;
|
|
1599
1599
|
}
|
|
1600
1600
|
class k extends _ {
|
|
1601
1601
|
constructor() {
|
|
@@ -1616,41 +1616,41 @@ class k extends _ {
|
|
|
1616
1616
|
received: u.parsedType
|
|
1617
1617
|
}), g;
|
|
1618
1618
|
}
|
|
1619
|
-
const { status: n, ctx: s } = this._processInputParams(e), { shape: a, keys: c } = this._getCached(),
|
|
1619
|
+
const { status: n, ctx: s } = this._processInputParams(e), { shape: a, keys: c } = this._getCached(), o = [];
|
|
1620
1620
|
if (!(this._def.catchall instanceof M && this._def.unknownKeys === "strip"))
|
|
1621
1621
|
for (const u in s.data)
|
|
1622
|
-
c.includes(u) ||
|
|
1622
|
+
c.includes(u) || o.push(u);
|
|
1623
1623
|
const l = [];
|
|
1624
1624
|
for (const u of c) {
|
|
1625
1625
|
const p = a[u], x = s.data[u];
|
|
1626
1626
|
l.push({
|
|
1627
1627
|
key: { status: "valid", value: u },
|
|
1628
|
-
value: p._parse(new
|
|
1628
|
+
value: p._parse(new E(s, x, s.path, u)),
|
|
1629
1629
|
alwaysSet: u in s.data
|
|
1630
1630
|
});
|
|
1631
1631
|
}
|
|
1632
1632
|
if (this._def.catchall instanceof M) {
|
|
1633
1633
|
const u = this._def.unknownKeys;
|
|
1634
1634
|
if (u === "passthrough")
|
|
1635
|
-
for (const p of
|
|
1635
|
+
for (const p of o)
|
|
1636
1636
|
l.push({
|
|
1637
1637
|
key: { status: "valid", value: p },
|
|
1638
1638
|
value: { status: "valid", value: s.data[p] }
|
|
1639
1639
|
});
|
|
1640
1640
|
else if (u === "strict")
|
|
1641
|
-
|
|
1641
|
+
o.length > 0 && (f(s, {
|
|
1642
1642
|
code: d.unrecognized_keys,
|
|
1643
|
-
keys:
|
|
1643
|
+
keys: o
|
|
1644
1644
|
}), n.dirty());
|
|
1645
1645
|
else if (u !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
1646
1646
|
} else {
|
|
1647
1647
|
const u = this._def.catchall;
|
|
1648
|
-
for (const p of
|
|
1648
|
+
for (const p of o) {
|
|
1649
1649
|
const x = s.data[p];
|
|
1650
1650
|
l.push({
|
|
1651
1651
|
key: { status: "valid", value: p },
|
|
1652
1652
|
value: u._parse(
|
|
1653
|
-
new
|
|
1653
|
+
new E(s, x, s.path, p)
|
|
1654
1654
|
//, ctx.child(key), value, getParsedType(value)
|
|
1655
1655
|
),
|
|
1656
1656
|
alwaysSet: p in s.data
|
|
@@ -1660,15 +1660,15 @@ class k extends _ {
|
|
|
1660
1660
|
return s.common.async ? Promise.resolve().then(async () => {
|
|
1661
1661
|
const u = [];
|
|
1662
1662
|
for (const p of l) {
|
|
1663
|
-
const x = await p.key,
|
|
1663
|
+
const x = await p.key, O = await p.value;
|
|
1664
1664
|
u.push({
|
|
1665
1665
|
key: x,
|
|
1666
|
-
value:
|
|
1666
|
+
value: O,
|
|
1667
1667
|
alwaysSet: p.alwaysSet
|
|
1668
1668
|
});
|
|
1669
1669
|
}
|
|
1670
1670
|
return u;
|
|
1671
|
-
}).then((u) =>
|
|
1671
|
+
}).then((u) => T.mergeObjectSync(n, u)) : T.mergeObjectSync(n, l);
|
|
1672
1672
|
}
|
|
1673
1673
|
get shape() {
|
|
1674
1674
|
return this._def.shape();
|
|
@@ -1679,10 +1679,10 @@ class k extends _ {
|
|
|
1679
1679
|
unknownKeys: "strict",
|
|
1680
1680
|
...e !== void 0 ? {
|
|
1681
1681
|
errorMap: (t, n) => {
|
|
1682
|
-
var s, a, c,
|
|
1682
|
+
var s, a, c, o;
|
|
1683
1683
|
const l = (c = (a = (s = this._def).errorMap) === null || a === void 0 ? void 0 : a.call(s, t, n).message) !== null && c !== void 0 ? c : n.defaultError;
|
|
1684
1684
|
return t.code === "unrecognized_keys" ? {
|
|
1685
|
-
message: (
|
|
1685
|
+
message: (o = m.errToObj(e).message) !== null && o !== void 0 ? o : l
|
|
1686
1686
|
} : {
|
|
1687
1687
|
message: l
|
|
1688
1688
|
};
|
|
@@ -1850,7 +1850,7 @@ class k extends _ {
|
|
|
1850
1850
|
t[n] = this.shape[n];
|
|
1851
1851
|
else {
|
|
1852
1852
|
let a = this.shape[n];
|
|
1853
|
-
for (; a instanceof
|
|
1853
|
+
for (; a instanceof j; )
|
|
1854
1854
|
a = a._def.innerType;
|
|
1855
1855
|
t[n] = a;
|
|
1856
1856
|
}
|
|
@@ -1860,7 +1860,7 @@ class k extends _ {
|
|
|
1860
1860
|
});
|
|
1861
1861
|
}
|
|
1862
1862
|
keyof() {
|
|
1863
|
-
return
|
|
1863
|
+
return Ye(b.objectKeys(this.shape));
|
|
1864
1864
|
}
|
|
1865
1865
|
}
|
|
1866
1866
|
k.create = (r, e) => new k({
|
|
@@ -1884,17 +1884,17 @@ k.lazycreate = (r, e) => new k({
|
|
|
1884
1884
|
typeName: y.ZodObject,
|
|
1885
1885
|
...v(e)
|
|
1886
1886
|
});
|
|
1887
|
-
class
|
|
1887
|
+
class ce extends _ {
|
|
1888
1888
|
_parse(e) {
|
|
1889
1889
|
const { ctx: t } = this._processInputParams(e), n = this._def.options;
|
|
1890
1890
|
function s(a) {
|
|
1891
|
-
for (const
|
|
1892
|
-
if (
|
|
1893
|
-
return
|
|
1894
|
-
for (const
|
|
1895
|
-
if (
|
|
1896
|
-
return t.common.issues.push(...
|
|
1897
|
-
const c = a.map((
|
|
1891
|
+
for (const o of a)
|
|
1892
|
+
if (o.result.status === "valid")
|
|
1893
|
+
return o.result;
|
|
1894
|
+
for (const o of a)
|
|
1895
|
+
if (o.result.status === "dirty")
|
|
1896
|
+
return t.common.issues.push(...o.ctx.common.issues), o.result;
|
|
1897
|
+
const c = a.map((o) => new S(o.ctx.common.issues));
|
|
1898
1898
|
return f(t, {
|
|
1899
1899
|
code: d.invalid_union,
|
|
1900
1900
|
unionErrors: c
|
|
@@ -1941,10 +1941,10 @@ class oe extends _ {
|
|
|
1941
1941
|
}
|
|
1942
1942
|
if (a)
|
|
1943
1943
|
return t.common.issues.push(...a.ctx.common.issues), a.result;
|
|
1944
|
-
const
|
|
1944
|
+
const o = c.map((l) => new S(l));
|
|
1945
1945
|
return f(t, {
|
|
1946
1946
|
code: d.invalid_union,
|
|
1947
|
-
unionErrors:
|
|
1947
|
+
unionErrors: o
|
|
1948
1948
|
}), g;
|
|
1949
1949
|
}
|
|
1950
1950
|
}
|
|
@@ -1952,12 +1952,12 @@ class oe extends _ {
|
|
|
1952
1952
|
return this._def.options;
|
|
1953
1953
|
}
|
|
1954
1954
|
}
|
|
1955
|
-
|
|
1955
|
+
ce.create = (r, e) => new ce({
|
|
1956
1956
|
options: r,
|
|
1957
1957
|
typeName: y.ZodUnion,
|
|
1958
1958
|
...v(e)
|
|
1959
1959
|
});
|
|
1960
|
-
const
|
|
1960
|
+
const P = (r) => r instanceof le ? P(r.schema) : r instanceof N ? P(r.innerType()) : r instanceof fe ? [r.value] : r instanceof z ? r.options : r instanceof he ? b.objectValues(r.enum) : r instanceof pe ? P(r._def.innerType) : r instanceof ie ? [void 0] : r instanceof oe ? [null] : r instanceof j ? [void 0, ...P(r.unwrap())] : r instanceof F ? [null, ...P(r.unwrap())] : r instanceof Re || r instanceof ye ? P(r.unwrap()) : r instanceof me ? P(r._def.innerType) : [];
|
|
1961
1961
|
class Ce extends _ {
|
|
1962
1962
|
_parse(e) {
|
|
1963
1963
|
const { ctx: t } = this._processInputParams(e);
|
|
@@ -2002,13 +2002,13 @@ class Ce extends _ {
|
|
|
2002
2002
|
static create(e, t, n) {
|
|
2003
2003
|
const s = /* @__PURE__ */ new Map();
|
|
2004
2004
|
for (const a of t) {
|
|
2005
|
-
const c =
|
|
2005
|
+
const c = P(a.shape[e]);
|
|
2006
2006
|
if (!c.length)
|
|
2007
2007
|
throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
|
|
2008
|
-
for (const
|
|
2009
|
-
if (s.has(
|
|
2010
|
-
throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(
|
|
2011
|
-
s.set(
|
|
2008
|
+
for (const o of c) {
|
|
2009
|
+
if (s.has(o))
|
|
2010
|
+
throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);
|
|
2011
|
+
s.set(o, a);
|
|
2012
2012
|
}
|
|
2013
2013
|
}
|
|
2014
2014
|
return new Ce({
|
|
@@ -2021,16 +2021,16 @@ class Ce extends _ {
|
|
|
2021
2021
|
}
|
|
2022
2022
|
}
|
|
2023
2023
|
function Ee(r, e) {
|
|
2024
|
-
const t =
|
|
2024
|
+
const t = $(r), n = $(e);
|
|
2025
2025
|
if (r === e)
|
|
2026
2026
|
return { valid: !0, data: r };
|
|
2027
2027
|
if (t === h.object && n === h.object) {
|
|
2028
|
-
const s = b.objectKeys(e), a = b.objectKeys(r).filter((
|
|
2029
|
-
for (const
|
|
2030
|
-
const l = Ee(r[
|
|
2028
|
+
const s = b.objectKeys(e), a = b.objectKeys(r).filter((o) => s.indexOf(o) !== -1), c = { ...r, ...e };
|
|
2029
|
+
for (const o of a) {
|
|
2030
|
+
const l = Ee(r[o], e[o]);
|
|
2031
2031
|
if (!l.valid)
|
|
2032
2032
|
return { valid: !1 };
|
|
2033
|
-
c[
|
|
2033
|
+
c[o] = l.data;
|
|
2034
2034
|
}
|
|
2035
2035
|
return { valid: !0, data: c };
|
|
2036
2036
|
} else if (t === h.array && n === h.array) {
|
|
@@ -2038,7 +2038,7 @@ function Ee(r, e) {
|
|
|
2038
2038
|
return { valid: !1 };
|
|
2039
2039
|
const s = [];
|
|
2040
2040
|
for (let a = 0; a < r.length; a++) {
|
|
2041
|
-
const c = r[a],
|
|
2041
|
+
const c = r[a], o = e[a], l = Ee(c, o);
|
|
2042
2042
|
if (!l.valid)
|
|
2043
2043
|
return { valid: !1 };
|
|
2044
2044
|
s.push(l.data);
|
|
@@ -2046,13 +2046,13 @@ function Ee(r, e) {
|
|
|
2046
2046
|
return { valid: !0, data: s };
|
|
2047
2047
|
} else return t === h.date && n === h.date && +r == +e ? { valid: !0, data: r } : { valid: !1 };
|
|
2048
2048
|
}
|
|
2049
|
-
class
|
|
2049
|
+
class de extends _ {
|
|
2050
2050
|
_parse(e) {
|
|
2051
2051
|
const { status: t, ctx: n } = this._processInputParams(e), s = (a, c) => {
|
|
2052
2052
|
if (Oe(a) || Oe(c))
|
|
2053
2053
|
return g;
|
|
2054
|
-
const
|
|
2055
|
-
return
|
|
2054
|
+
const o = Ee(a.value, c.value);
|
|
2055
|
+
return o.valid ? ((je(a) || je(c)) && t.dirty(), { status: t.value, value: o.data }) : (f(n, {
|
|
2056
2056
|
code: d.invalid_intersection_types
|
|
2057
2057
|
}), g);
|
|
2058
2058
|
};
|
|
@@ -2078,13 +2078,13 @@ class ce extends _ {
|
|
|
2078
2078
|
}));
|
|
2079
2079
|
}
|
|
2080
2080
|
}
|
|
2081
|
-
|
|
2081
|
+
de.create = (r, e, t) => new de({
|
|
2082
2082
|
left: r,
|
|
2083
2083
|
right: e,
|
|
2084
2084
|
typeName: y.ZodIntersection,
|
|
2085
2085
|
...v(t)
|
|
2086
2086
|
});
|
|
2087
|
-
class
|
|
2087
|
+
class R extends _ {
|
|
2088
2088
|
_parse(e) {
|
|
2089
2089
|
const { status: t, ctx: n } = this._processInputParams(e);
|
|
2090
2090
|
if (n.parsedType !== h.array)
|
|
@@ -2108,33 +2108,33 @@ class P extends _ {
|
|
|
2108
2108
|
exact: !1,
|
|
2109
2109
|
type: "array"
|
|
2110
2110
|
}), t.dirty());
|
|
2111
|
-
const a = [...n.data].map((c,
|
|
2112
|
-
const l = this._def.items[
|
|
2113
|
-
return l ? l._parse(new
|
|
2111
|
+
const a = [...n.data].map((c, o) => {
|
|
2112
|
+
const l = this._def.items[o] || this._def.rest;
|
|
2113
|
+
return l ? l._parse(new E(n, c, n.path, o)) : null;
|
|
2114
2114
|
}).filter((c) => !!c);
|
|
2115
|
-
return n.common.async ? Promise.all(a).then((c) =>
|
|
2115
|
+
return n.common.async ? Promise.all(a).then((c) => T.mergeArray(t, c)) : T.mergeArray(t, a);
|
|
2116
2116
|
}
|
|
2117
2117
|
get items() {
|
|
2118
2118
|
return this._def.items;
|
|
2119
2119
|
}
|
|
2120
2120
|
rest(e) {
|
|
2121
|
-
return new
|
|
2121
|
+
return new R({
|
|
2122
2122
|
...this._def,
|
|
2123
2123
|
rest: e
|
|
2124
2124
|
});
|
|
2125
2125
|
}
|
|
2126
2126
|
}
|
|
2127
|
-
|
|
2127
|
+
R.create = (r, e) => {
|
|
2128
2128
|
if (!Array.isArray(r))
|
|
2129
2129
|
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
2130
|
-
return new
|
|
2130
|
+
return new R({
|
|
2131
2131
|
items: r,
|
|
2132
2132
|
typeName: y.ZodTuple,
|
|
2133
2133
|
rest: null,
|
|
2134
2134
|
...v(e)
|
|
2135
2135
|
});
|
|
2136
2136
|
};
|
|
2137
|
-
class
|
|
2137
|
+
class ue extends _ {
|
|
2138
2138
|
get keySchema() {
|
|
2139
2139
|
return this._def.keyType;
|
|
2140
2140
|
}
|
|
@@ -2150,25 +2150,25 @@ class de extends _ {
|
|
|
2150
2150
|
received: n.parsedType
|
|
2151
2151
|
}), g;
|
|
2152
2152
|
const s = [], a = this._def.keyType, c = this._def.valueType;
|
|
2153
|
-
for (const
|
|
2153
|
+
for (const o in n.data)
|
|
2154
2154
|
s.push({
|
|
2155
|
-
key: a._parse(new
|
|
2156
|
-
value: c._parse(new
|
|
2157
|
-
alwaysSet:
|
|
2155
|
+
key: a._parse(new E(n, o, n.path, o)),
|
|
2156
|
+
value: c._parse(new E(n, n.data[o], n.path, o)),
|
|
2157
|
+
alwaysSet: o in n.data
|
|
2158
2158
|
});
|
|
2159
|
-
return n.common.async ?
|
|
2159
|
+
return n.common.async ? T.mergeObjectAsync(t, s) : T.mergeObjectSync(t, s);
|
|
2160
2160
|
}
|
|
2161
2161
|
get element() {
|
|
2162
2162
|
return this._def.valueType;
|
|
2163
2163
|
}
|
|
2164
2164
|
static create(e, t, n) {
|
|
2165
|
-
return t instanceof _ ? new
|
|
2165
|
+
return t instanceof _ ? new ue({
|
|
2166
2166
|
keyType: e,
|
|
2167
2167
|
valueType: t,
|
|
2168
2168
|
typeName: y.ZodRecord,
|
|
2169
2169
|
...v(n)
|
|
2170
|
-
}) : new
|
|
2171
|
-
keyType:
|
|
2170
|
+
}) : new ue({
|
|
2171
|
+
keyType: I.create(),
|
|
2172
2172
|
valueType: e,
|
|
2173
2173
|
typeName: y.ZodRecord,
|
|
2174
2174
|
...v(t)
|
|
@@ -2190,30 +2190,30 @@ class we extends _ {
|
|
|
2190
2190
|
expected: h.map,
|
|
2191
2191
|
received: n.parsedType
|
|
2192
2192
|
}), g;
|
|
2193
|
-
const s = this._def.keyType, a = this._def.valueType, c = [...n.data.entries()].map(([
|
|
2194
|
-
key: s._parse(new
|
|
2195
|
-
value: a._parse(new
|
|
2193
|
+
const s = this._def.keyType, a = this._def.valueType, c = [...n.data.entries()].map(([o, l], u) => ({
|
|
2194
|
+
key: s._parse(new E(n, o, n.path, [u, "key"])),
|
|
2195
|
+
value: a._parse(new E(n, l, n.path, [u, "value"]))
|
|
2196
2196
|
}));
|
|
2197
2197
|
if (n.common.async) {
|
|
2198
|
-
const
|
|
2198
|
+
const o = /* @__PURE__ */ new Map();
|
|
2199
2199
|
return Promise.resolve().then(async () => {
|
|
2200
2200
|
for (const l of c) {
|
|
2201
2201
|
const u = await l.key, p = await l.value;
|
|
2202
2202
|
if (u.status === "aborted" || p.status === "aborted")
|
|
2203
2203
|
return g;
|
|
2204
|
-
(u.status === "dirty" || p.status === "dirty") && t.dirty(),
|
|
2204
|
+
(u.status === "dirty" || p.status === "dirty") && t.dirty(), o.set(u.value, p.value);
|
|
2205
2205
|
}
|
|
2206
|
-
return { status: t.value, value:
|
|
2206
|
+
return { status: t.value, value: o };
|
|
2207
2207
|
});
|
|
2208
2208
|
} else {
|
|
2209
|
-
const
|
|
2209
|
+
const o = /* @__PURE__ */ new Map();
|
|
2210
2210
|
for (const l of c) {
|
|
2211
2211
|
const u = l.key, p = l.value;
|
|
2212
2212
|
if (u.status === "aborted" || p.status === "aborted")
|
|
2213
2213
|
return g;
|
|
2214
|
-
(u.status === "dirty" || p.status === "dirty") && t.dirty(),
|
|
2214
|
+
(u.status === "dirty" || p.status === "dirty") && t.dirty(), o.set(u.value, p.value);
|
|
2215
2215
|
}
|
|
2216
|
-
return { status: t.value, value:
|
|
2216
|
+
return { status: t.value, value: o };
|
|
2217
2217
|
}
|
|
2218
2218
|
}
|
|
2219
2219
|
}
|
|
@@ -2258,8 +2258,8 @@ class W extends _ {
|
|
|
2258
2258
|
}
|
|
2259
2259
|
return { status: t.value, value: u };
|
|
2260
2260
|
}
|
|
2261
|
-
const
|
|
2262
|
-
return n.common.async ? Promise.all(
|
|
2261
|
+
const o = [...n.data.values()].map((l, u) => a._parse(new E(n, l, n.path, u)));
|
|
2262
|
+
return n.common.async ? Promise.all(o).then((l) => c(l)) : c(o);
|
|
2263
2263
|
}
|
|
2264
2264
|
min(e, t) {
|
|
2265
2265
|
return new W({
|
|
@@ -2287,7 +2287,7 @@ W.create = (r, e) => new W({
|
|
|
2287
2287
|
typeName: y.ZodSet,
|
|
2288
2288
|
...v(e)
|
|
2289
2289
|
});
|
|
2290
|
-
class
|
|
2290
|
+
class Q extends _ {
|
|
2291
2291
|
constructor() {
|
|
2292
2292
|
super(...arguments), this.validate = this.implement;
|
|
2293
2293
|
}
|
|
@@ -2299,9 +2299,9 @@ class Y extends _ {
|
|
|
2299
2299
|
expected: h.function,
|
|
2300
2300
|
received: t.parsedType
|
|
2301
2301
|
}), g;
|
|
2302
|
-
function n(
|
|
2302
|
+
function n(o, l) {
|
|
2303
2303
|
return _e({
|
|
2304
|
-
data:
|
|
2304
|
+
data: o,
|
|
2305
2305
|
path: t.path,
|
|
2306
2306
|
errorMaps: [
|
|
2307
2307
|
t.common.contextualErrorMap,
|
|
@@ -2315,9 +2315,9 @@ class Y extends _ {
|
|
|
2315
2315
|
}
|
|
2316
2316
|
});
|
|
2317
2317
|
}
|
|
2318
|
-
function s(
|
|
2318
|
+
function s(o, l) {
|
|
2319
2319
|
return _e({
|
|
2320
|
-
data:
|
|
2320
|
+
data: o,
|
|
2321
2321
|
path: t.path,
|
|
2322
2322
|
errorMaps: [
|
|
2323
2323
|
t.common.contextualErrorMap,
|
|
@@ -2333,24 +2333,24 @@ class Y extends _ {
|
|
|
2333
2333
|
}
|
|
2334
2334
|
const a = { errorMap: t.common.contextualErrorMap }, c = t.data;
|
|
2335
2335
|
if (this._def.returns instanceof K) {
|
|
2336
|
-
const
|
|
2337
|
-
return
|
|
2338
|
-
const u = new
|
|
2336
|
+
const o = this;
|
|
2337
|
+
return C(async function(...l) {
|
|
2338
|
+
const u = new S([]), p = await o._def.args.parseAsync(l, a).catch((w) => {
|
|
2339
2339
|
throw u.addIssue(n(l, w)), u;
|
|
2340
2340
|
}), x = await Reflect.apply(c, this, p);
|
|
2341
|
-
return await
|
|
2341
|
+
return await o._def.returns._def.type.parseAsync(x, a).catch((w) => {
|
|
2342
2342
|
throw u.addIssue(s(x, w)), u;
|
|
2343
2343
|
});
|
|
2344
2344
|
});
|
|
2345
2345
|
} else {
|
|
2346
|
-
const
|
|
2347
|
-
return
|
|
2348
|
-
const u =
|
|
2346
|
+
const o = this;
|
|
2347
|
+
return C(function(...l) {
|
|
2348
|
+
const u = o._def.args.safeParse(l, a);
|
|
2349
2349
|
if (!u.success)
|
|
2350
|
-
throw new
|
|
2351
|
-
const p = Reflect.apply(c, this, u.data), x =
|
|
2350
|
+
throw new S([n(l, u.error)]);
|
|
2351
|
+
const p = Reflect.apply(c, this, u.data), x = o._def.returns.safeParse(p, a);
|
|
2352
2352
|
if (!x.success)
|
|
2353
|
-
throw new
|
|
2353
|
+
throw new S([s(p, x.error)]);
|
|
2354
2354
|
return x.data;
|
|
2355
2355
|
});
|
|
2356
2356
|
}
|
|
@@ -2362,13 +2362,13 @@ class Y extends _ {
|
|
|
2362
2362
|
return this._def.returns;
|
|
2363
2363
|
}
|
|
2364
2364
|
args(...e) {
|
|
2365
|
-
return new
|
|
2365
|
+
return new Q({
|
|
2366
2366
|
...this._def,
|
|
2367
|
-
args:
|
|
2367
|
+
args: R.create(e).rest(U.create())
|
|
2368
2368
|
});
|
|
2369
2369
|
}
|
|
2370
2370
|
returns(e) {
|
|
2371
|
-
return new
|
|
2371
|
+
return new Q({
|
|
2372
2372
|
...this._def,
|
|
2373
2373
|
returns: e
|
|
2374
2374
|
});
|
|
@@ -2380,15 +2380,15 @@ class Y extends _ {
|
|
|
2380
2380
|
return this.parse(e);
|
|
2381
2381
|
}
|
|
2382
2382
|
static create(e, t, n) {
|
|
2383
|
-
return new
|
|
2384
|
-
args: e ||
|
|
2383
|
+
return new Q({
|
|
2384
|
+
args: e || R.create([]).rest(U.create()),
|
|
2385
2385
|
returns: t || U.create(),
|
|
2386
2386
|
typeName: y.ZodFunction,
|
|
2387
2387
|
...v(n)
|
|
2388
2388
|
});
|
|
2389
2389
|
}
|
|
2390
2390
|
}
|
|
2391
|
-
class
|
|
2391
|
+
class le extends _ {
|
|
2392
2392
|
get schema() {
|
|
2393
2393
|
return this._def.getter();
|
|
2394
2394
|
}
|
|
@@ -2397,12 +2397,12 @@ class ue extends _ {
|
|
|
2397
2397
|
return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
|
|
2398
2398
|
}
|
|
2399
2399
|
}
|
|
2400
|
-
|
|
2400
|
+
le.create = (r, e) => new le({
|
|
2401
2401
|
getter: r,
|
|
2402
2402
|
typeName: y.ZodLazy,
|
|
2403
2403
|
...v(e)
|
|
2404
2404
|
});
|
|
2405
|
-
class
|
|
2405
|
+
class fe extends _ {
|
|
2406
2406
|
_parse(e) {
|
|
2407
2407
|
if (e.data !== this._def.value) {
|
|
2408
2408
|
const t = this._getOrReturnCtx(e);
|
|
@@ -2418,12 +2418,12 @@ class le extends _ {
|
|
|
2418
2418
|
return this._def.value;
|
|
2419
2419
|
}
|
|
2420
2420
|
}
|
|
2421
|
-
|
|
2421
|
+
fe.create = (r, e) => new fe({
|
|
2422
2422
|
value: r,
|
|
2423
2423
|
typeName: y.ZodLiteral,
|
|
2424
2424
|
...v(e)
|
|
2425
2425
|
});
|
|
2426
|
-
function
|
|
2426
|
+
function Ye(r, e) {
|
|
2427
2427
|
return new z({
|
|
2428
2428
|
values: r,
|
|
2429
2429
|
typeName: y.ZodEnum,
|
|
@@ -2432,7 +2432,7 @@ function Qe(r, e) {
|
|
|
2432
2432
|
}
|
|
2433
2433
|
class z extends _ {
|
|
2434
2434
|
constructor() {
|
|
2435
|
-
super(...arguments),
|
|
2435
|
+
super(...arguments), re.set(this, void 0);
|
|
2436
2436
|
}
|
|
2437
2437
|
_parse(e) {
|
|
2438
2438
|
if (typeof e.data != "string") {
|
|
@@ -2443,7 +2443,7 @@ class z extends _ {
|
|
|
2443
2443
|
code: d.invalid_type
|
|
2444
2444
|
}), g;
|
|
2445
2445
|
}
|
|
2446
|
-
if (be(this,
|
|
2446
|
+
if (be(this, re) || Be(this, re, new Set(this._def.values)), !be(this, re).has(e.data)) {
|
|
2447
2447
|
const t = this._getOrReturnCtx(e), n = this._def.values;
|
|
2448
2448
|
return f(t, {
|
|
2449
2449
|
received: t.data,
|
|
@@ -2451,7 +2451,7 @@ class z extends _ {
|
|
|
2451
2451
|
options: n
|
|
2452
2452
|
}), g;
|
|
2453
2453
|
}
|
|
2454
|
-
return
|
|
2454
|
+
return C(e.data);
|
|
2455
2455
|
}
|
|
2456
2456
|
get options() {
|
|
2457
2457
|
return this._def.values;
|
|
@@ -2487,11 +2487,11 @@ class z extends _ {
|
|
|
2487
2487
|
});
|
|
2488
2488
|
}
|
|
2489
2489
|
}
|
|
2490
|
-
|
|
2491
|
-
z.create =
|
|
2492
|
-
class
|
|
2490
|
+
re = /* @__PURE__ */ new WeakMap();
|
|
2491
|
+
z.create = Ye;
|
|
2492
|
+
class he extends _ {
|
|
2493
2493
|
constructor() {
|
|
2494
|
-
super(...arguments),
|
|
2494
|
+
super(...arguments), ne.set(this, void 0);
|
|
2495
2495
|
}
|
|
2496
2496
|
_parse(e) {
|
|
2497
2497
|
const t = b.getValidEnumValues(this._def.values), n = this._getOrReturnCtx(e);
|
|
@@ -2503,7 +2503,7 @@ class fe extends _ {
|
|
|
2503
2503
|
code: d.invalid_type
|
|
2504
2504
|
}), g;
|
|
2505
2505
|
}
|
|
2506
|
-
if (be(this,
|
|
2506
|
+
if (be(this, ne) || Be(this, ne, new Set(b.getValidEnumValues(this._def.values))), !be(this, ne).has(e.data)) {
|
|
2507
2507
|
const s = b.objectValues(t);
|
|
2508
2508
|
return f(n, {
|
|
2509
2509
|
received: n.data,
|
|
@@ -2511,14 +2511,14 @@ class fe extends _ {
|
|
|
2511
2511
|
options: s
|
|
2512
2512
|
}), g;
|
|
2513
2513
|
}
|
|
2514
|
-
return
|
|
2514
|
+
return C(e.data);
|
|
2515
2515
|
}
|
|
2516
2516
|
get enum() {
|
|
2517
2517
|
return this._def.values;
|
|
2518
2518
|
}
|
|
2519
2519
|
}
|
|
2520
|
-
|
|
2521
|
-
|
|
2520
|
+
ne = /* @__PURE__ */ new WeakMap();
|
|
2521
|
+
he.create = (r, e) => new he({
|
|
2522
2522
|
values: r,
|
|
2523
2523
|
typeName: y.ZodNativeEnum,
|
|
2524
2524
|
...v(e)
|
|
@@ -2536,7 +2536,7 @@ class K extends _ {
|
|
|
2536
2536
|
received: t.parsedType
|
|
2537
2537
|
}), g;
|
|
2538
2538
|
const n = t.parsedType === h.promise ? t.data : Promise.resolve(t.data);
|
|
2539
|
-
return
|
|
2539
|
+
return C(n.then((s) => this._def.type.parseAsync(s, {
|
|
2540
2540
|
path: t.path,
|
|
2541
2541
|
errorMap: t.common.contextualErrorMap
|
|
2542
2542
|
})));
|
|
@@ -2547,7 +2547,7 @@ K.create = (r, e) => new K({
|
|
|
2547
2547
|
typeName: y.ZodPromise,
|
|
2548
2548
|
...v(e)
|
|
2549
2549
|
});
|
|
2550
|
-
class
|
|
2550
|
+
class N extends _ {
|
|
2551
2551
|
innerType() {
|
|
2552
2552
|
return this._def.schema;
|
|
2553
2553
|
}
|
|
@@ -2566,45 +2566,45 @@ class j extends _ {
|
|
|
2566
2566
|
if (a.addIssue = a.addIssue.bind(a), s.type === "preprocess") {
|
|
2567
2567
|
const c = s.transform(n.data, a);
|
|
2568
2568
|
if (n.common.async)
|
|
2569
|
-
return Promise.resolve(c).then(async (
|
|
2569
|
+
return Promise.resolve(c).then(async (o) => {
|
|
2570
2570
|
if (t.value === "aborted")
|
|
2571
2571
|
return g;
|
|
2572
2572
|
const l = await this._def.schema._parseAsync({
|
|
2573
|
-
data:
|
|
2573
|
+
data: o,
|
|
2574
2574
|
path: n.path,
|
|
2575
2575
|
parent: n
|
|
2576
2576
|
});
|
|
2577
|
-
return l.status === "aborted" ? g : l.status === "dirty" || t.value === "dirty" ?
|
|
2577
|
+
return l.status === "aborted" ? g : l.status === "dirty" || t.value === "dirty" ? Y(l.value) : l;
|
|
2578
2578
|
});
|
|
2579
2579
|
{
|
|
2580
2580
|
if (t.value === "aborted")
|
|
2581
2581
|
return g;
|
|
2582
|
-
const
|
|
2582
|
+
const o = this._def.schema._parseSync({
|
|
2583
2583
|
data: c,
|
|
2584
2584
|
path: n.path,
|
|
2585
2585
|
parent: n
|
|
2586
2586
|
});
|
|
2587
|
-
return
|
|
2587
|
+
return o.status === "aborted" ? g : o.status === "dirty" || t.value === "dirty" ? Y(o.value) : o;
|
|
2588
2588
|
}
|
|
2589
2589
|
}
|
|
2590
2590
|
if (s.type === "refinement") {
|
|
2591
|
-
const c = (
|
|
2592
|
-
const l = s.refinement(
|
|
2591
|
+
const c = (o) => {
|
|
2592
|
+
const l = s.refinement(o, a);
|
|
2593
2593
|
if (n.common.async)
|
|
2594
2594
|
return Promise.resolve(l);
|
|
2595
2595
|
if (l instanceof Promise)
|
|
2596
2596
|
throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2597
|
-
return
|
|
2597
|
+
return o;
|
|
2598
2598
|
};
|
|
2599
2599
|
if (n.common.async === !1) {
|
|
2600
|
-
const
|
|
2600
|
+
const o = this._def.schema._parseSync({
|
|
2601
2601
|
data: n.data,
|
|
2602
2602
|
path: n.path,
|
|
2603
2603
|
parent: n
|
|
2604
2604
|
});
|
|
2605
|
-
return
|
|
2605
|
+
return o.status === "aborted" ? g : (o.status === "dirty" && t.dirty(), c(o.value), { status: t.value, value: o.value });
|
|
2606
2606
|
} else
|
|
2607
|
-
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((
|
|
2607
|
+
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((o) => o.status === "aborted" ? g : (o.status === "dirty" && t.dirty(), c(o.value).then(() => ({ status: t.value, value: o.value }))));
|
|
2608
2608
|
}
|
|
2609
2609
|
if (s.type === "transform")
|
|
2610
2610
|
if (n.common.async === !1) {
|
|
@@ -2615,43 +2615,43 @@ class j extends _ {
|
|
|
2615
2615
|
});
|
|
2616
2616
|
if (!B(c))
|
|
2617
2617
|
return c;
|
|
2618
|
-
const
|
|
2619
|
-
if (
|
|
2618
|
+
const o = s.transform(c.value, a);
|
|
2619
|
+
if (o instanceof Promise)
|
|
2620
2620
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2621
|
-
return { status: t.value, value:
|
|
2621
|
+
return { status: t.value, value: o };
|
|
2622
2622
|
} else
|
|
2623
|
-
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((c) => B(c) ? Promise.resolve(s.transform(c.value, a)).then((
|
|
2623
|
+
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((c) => B(c) ? Promise.resolve(s.transform(c.value, a)).then((o) => ({ status: t.value, value: o })) : c);
|
|
2624
2624
|
b.assertNever(s);
|
|
2625
2625
|
}
|
|
2626
2626
|
}
|
|
2627
|
-
|
|
2627
|
+
N.create = (r, e, t) => new N({
|
|
2628
2628
|
schema: r,
|
|
2629
2629
|
typeName: y.ZodEffects,
|
|
2630
2630
|
effect: e,
|
|
2631
2631
|
...v(t)
|
|
2632
2632
|
});
|
|
2633
|
-
|
|
2633
|
+
N.createWithPreprocess = (r, e, t) => new N({
|
|
2634
2634
|
schema: e,
|
|
2635
2635
|
effect: { type: "preprocess", transform: r },
|
|
2636
2636
|
typeName: y.ZodEffects,
|
|
2637
2637
|
...v(t)
|
|
2638
2638
|
});
|
|
2639
|
-
class
|
|
2639
|
+
class j extends _ {
|
|
2640
2640
|
_parse(e) {
|
|
2641
|
-
return this._getType(e) === h.undefined ?
|
|
2641
|
+
return this._getType(e) === h.undefined ? C(void 0) : this._def.innerType._parse(e);
|
|
2642
2642
|
}
|
|
2643
2643
|
unwrap() {
|
|
2644
2644
|
return this._def.innerType;
|
|
2645
2645
|
}
|
|
2646
2646
|
}
|
|
2647
|
-
|
|
2647
|
+
j.create = (r, e) => new j({
|
|
2648
2648
|
innerType: r,
|
|
2649
2649
|
typeName: y.ZodOptional,
|
|
2650
2650
|
...v(e)
|
|
2651
2651
|
});
|
|
2652
2652
|
class F extends _ {
|
|
2653
2653
|
_parse(e) {
|
|
2654
|
-
return this._getType(e) === h.null ?
|
|
2654
|
+
return this._getType(e) === h.null ? C(null) : this._def.innerType._parse(e);
|
|
2655
2655
|
}
|
|
2656
2656
|
unwrap() {
|
|
2657
2657
|
return this._def.innerType;
|
|
@@ -2662,7 +2662,7 @@ F.create = (r, e) => new F({
|
|
|
2662
2662
|
typeName: y.ZodNullable,
|
|
2663
2663
|
...v(e)
|
|
2664
2664
|
});
|
|
2665
|
-
class
|
|
2665
|
+
class pe extends _ {
|
|
2666
2666
|
_parse(e) {
|
|
2667
2667
|
const { ctx: t } = this._processInputParams(e);
|
|
2668
2668
|
let n = t.data;
|
|
@@ -2676,13 +2676,13 @@ class he extends _ {
|
|
|
2676
2676
|
return this._def.innerType;
|
|
2677
2677
|
}
|
|
2678
2678
|
}
|
|
2679
|
-
|
|
2679
|
+
pe.create = (r, e) => new pe({
|
|
2680
2680
|
innerType: r,
|
|
2681
2681
|
typeName: y.ZodDefault,
|
|
2682
2682
|
defaultValue: typeof e.default == "function" ? e.default : () => e.default,
|
|
2683
2683
|
...v(e)
|
|
2684
2684
|
});
|
|
2685
|
-
class
|
|
2685
|
+
class me extends _ {
|
|
2686
2686
|
_parse(e) {
|
|
2687
2687
|
const { ctx: t } = this._processInputParams(e), n = {
|
|
2688
2688
|
...t,
|
|
@@ -2697,11 +2697,11 @@ class pe extends _ {
|
|
|
2697
2697
|
...n
|
|
2698
2698
|
}
|
|
2699
2699
|
});
|
|
2700
|
-
return
|
|
2700
|
+
return se(s) ? s.then((a) => ({
|
|
2701
2701
|
status: "valid",
|
|
2702
2702
|
value: a.status === "valid" ? a.value : this._def.catchValue({
|
|
2703
2703
|
get error() {
|
|
2704
|
-
return new
|
|
2704
|
+
return new S(n.common.issues);
|
|
2705
2705
|
},
|
|
2706
2706
|
input: n.data
|
|
2707
2707
|
})
|
|
@@ -2709,7 +2709,7 @@ class pe extends _ {
|
|
|
2709
2709
|
status: "valid",
|
|
2710
2710
|
value: s.status === "valid" ? s.value : this._def.catchValue({
|
|
2711
2711
|
get error() {
|
|
2712
|
-
return new
|
|
2712
|
+
return new S(n.common.issues);
|
|
2713
2713
|
},
|
|
2714
2714
|
input: n.data
|
|
2715
2715
|
})
|
|
@@ -2719,7 +2719,7 @@ class pe extends _ {
|
|
|
2719
2719
|
return this._def.innerType;
|
|
2720
2720
|
}
|
|
2721
2721
|
}
|
|
2722
|
-
|
|
2722
|
+
me.create = (r, e) => new me({
|
|
2723
2723
|
innerType: r,
|
|
2724
2724
|
typeName: y.ZodCatch,
|
|
2725
2725
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
|
|
@@ -2742,7 +2742,7 @@ Te.create = (r) => new Te({
|
|
|
2742
2742
|
typeName: y.ZodNaN,
|
|
2743
2743
|
...v(r)
|
|
2744
2744
|
});
|
|
2745
|
-
const
|
|
2745
|
+
const At = Symbol("zod_brand");
|
|
2746
2746
|
class Re extends _ {
|
|
2747
2747
|
_parse(e) {
|
|
2748
2748
|
const { ctx: t } = this._processInputParams(e), n = t.data;
|
|
@@ -2756,7 +2756,7 @@ class Re extends _ {
|
|
|
2756
2756
|
return this._def.type;
|
|
2757
2757
|
}
|
|
2758
2758
|
}
|
|
2759
|
-
class
|
|
2759
|
+
class ge extends _ {
|
|
2760
2760
|
_parse(e) {
|
|
2761
2761
|
const { status: t, ctx: n } = this._processInputParams(e);
|
|
2762
2762
|
if (n.common.async)
|
|
@@ -2766,7 +2766,7 @@ class ye extends _ {
|
|
|
2766
2766
|
path: n.path,
|
|
2767
2767
|
parent: n
|
|
2768
2768
|
});
|
|
2769
|
-
return a.status === "aborted" ? g : a.status === "dirty" ? (t.dirty(),
|
|
2769
|
+
return a.status === "aborted" ? g : a.status === "dirty" ? (t.dirty(), Y(a.value)) : this._def.out._parseAsync({
|
|
2770
2770
|
data: a.value,
|
|
2771
2771
|
path: n.path,
|
|
2772
2772
|
parent: n
|
|
@@ -2789,84 +2789,84 @@ class ye extends _ {
|
|
|
2789
2789
|
}
|
|
2790
2790
|
}
|
|
2791
2791
|
static create(e, t) {
|
|
2792
|
-
return new
|
|
2792
|
+
return new ge({
|
|
2793
2793
|
in: e,
|
|
2794
2794
|
out: t,
|
|
2795
2795
|
typeName: y.ZodPipeline
|
|
2796
2796
|
});
|
|
2797
2797
|
}
|
|
2798
2798
|
}
|
|
2799
|
-
class
|
|
2799
|
+
class ye extends _ {
|
|
2800
2800
|
_parse(e) {
|
|
2801
2801
|
const t = this._def.innerType._parse(e), n = (s) => (B(s) && (s.value = Object.freeze(s.value)), s);
|
|
2802
|
-
return
|
|
2802
|
+
return se(t) ? t.then((s) => n(s)) : n(t);
|
|
2803
2803
|
}
|
|
2804
2804
|
unwrap() {
|
|
2805
2805
|
return this._def.innerType;
|
|
2806
2806
|
}
|
|
2807
2807
|
}
|
|
2808
|
-
|
|
2808
|
+
ye.create = (r, e) => new ye({
|
|
2809
2809
|
innerType: r,
|
|
2810
2810
|
typeName: y.ZodReadonly,
|
|
2811
2811
|
...v(e)
|
|
2812
2812
|
});
|
|
2813
|
-
function
|
|
2813
|
+
function Ve(r, e) {
|
|
2814
2814
|
const t = typeof r == "function" ? r(e) : typeof r == "string" ? { message: r } : r;
|
|
2815
2815
|
return typeof t == "string" ? { message: t } : t;
|
|
2816
2816
|
}
|
|
2817
|
-
function
|
|
2817
|
+
function Qe(r, e = {}, t) {
|
|
2818
2818
|
return r ? X.create().superRefine((n, s) => {
|
|
2819
2819
|
var a, c;
|
|
2820
|
-
const
|
|
2821
|
-
if (
|
|
2822
|
-
return
|
|
2820
|
+
const o = r(n);
|
|
2821
|
+
if (o instanceof Promise)
|
|
2822
|
+
return o.then((l) => {
|
|
2823
2823
|
var u, p;
|
|
2824
2824
|
if (!l) {
|
|
2825
|
-
const x =
|
|
2826
|
-
s.addIssue({ code: "custom", ...x, fatal:
|
|
2825
|
+
const x = Ve(e, n), O = (p = (u = x.fatal) !== null && u !== void 0 ? u : t) !== null && p !== void 0 ? p : !0;
|
|
2826
|
+
s.addIssue({ code: "custom", ...x, fatal: O });
|
|
2827
2827
|
}
|
|
2828
2828
|
});
|
|
2829
|
-
if (!
|
|
2830
|
-
const l =
|
|
2829
|
+
if (!o) {
|
|
2830
|
+
const l = Ve(e, n), u = (c = (a = l.fatal) !== null && a !== void 0 ? a : t) !== null && c !== void 0 ? c : !0;
|
|
2831
2831
|
s.addIssue({ code: "custom", ...l, fatal: u });
|
|
2832
2832
|
}
|
|
2833
2833
|
}) : X.create();
|
|
2834
2834
|
}
|
|
2835
|
-
const
|
|
2835
|
+
const Nt = {
|
|
2836
2836
|
object: k.lazycreate
|
|
2837
2837
|
};
|
|
2838
2838
|
var y;
|
|
2839
2839
|
(function(r) {
|
|
2840
2840
|
r.ZodString = "ZodString", r.ZodNumber = "ZodNumber", r.ZodNaN = "ZodNaN", r.ZodBigInt = "ZodBigInt", r.ZodBoolean = "ZodBoolean", r.ZodDate = "ZodDate", r.ZodSymbol = "ZodSymbol", r.ZodUndefined = "ZodUndefined", r.ZodNull = "ZodNull", r.ZodAny = "ZodAny", r.ZodUnknown = "ZodUnknown", r.ZodNever = "ZodNever", r.ZodVoid = "ZodVoid", r.ZodArray = "ZodArray", r.ZodObject = "ZodObject", r.ZodUnion = "ZodUnion", r.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", r.ZodIntersection = "ZodIntersection", r.ZodTuple = "ZodTuple", r.ZodRecord = "ZodRecord", r.ZodMap = "ZodMap", r.ZodSet = "ZodSet", r.ZodFunction = "ZodFunction", r.ZodLazy = "ZodLazy", r.ZodLiteral = "ZodLiteral", r.ZodEnum = "ZodEnum", r.ZodEffects = "ZodEffects", r.ZodNativeEnum = "ZodNativeEnum", r.ZodOptional = "ZodOptional", r.ZodNullable = "ZodNullable", r.ZodDefault = "ZodDefault", r.ZodCatch = "ZodCatch", r.ZodPromise = "ZodPromise", r.ZodBranded = "ZodBranded", r.ZodPipeline = "ZodPipeline", r.ZodReadonly = "ZodReadonly";
|
|
2841
2841
|
})(y || (y = {}));
|
|
2842
|
-
const
|
|
2842
|
+
const Ot = (r, e = {
|
|
2843
2843
|
message: `Input not instance of ${r.name}`
|
|
2844
|
-
}) =>
|
|
2845
|
-
string: (r) =>
|
|
2844
|
+
}) => Qe((t) => t instanceof r, e), He = I.create, Ge = V.create, jt = Te.create, Et = L.create, Xe = ae.create, Rt = q.create, Pt = xe.create, $t = ie.create, Dt = oe.create, Mt = X.create, Vt = U.create, Lt = M.create, zt = ke.create, Ft = A.create, Ut = k.create, Bt = k.strictCreate, qt = ce.create, Wt = Ce.create, Jt = de.create, Yt = R.create, Qt = ue.create, Ht = we.create, Gt = W.create, Xt = Q.create, Kt = le.create, er = fe.create, tr = z.create, rr = he.create, nr = K.create, Le = N.create, sr = j.create, ar = F.create, ir = N.createWithPreprocess, or = ge.create, cr = () => He().optional(), dr = () => Ge().optional(), ur = () => Xe().optional(), lr = {
|
|
2845
|
+
string: (r) => I.create({ ...r, coerce: !0 }),
|
|
2846
2846
|
number: (r) => V.create({ ...r, coerce: !0 }),
|
|
2847
|
-
boolean: (r) =>
|
|
2847
|
+
boolean: (r) => ae.create({
|
|
2848
2848
|
...r,
|
|
2849
2849
|
coerce: !0
|
|
2850
2850
|
}),
|
|
2851
2851
|
bigint: (r) => L.create({ ...r, coerce: !0 }),
|
|
2852
2852
|
date: (r) => q.create({ ...r, coerce: !0 })
|
|
2853
|
-
},
|
|
2854
|
-
var
|
|
2853
|
+
}, fr = g;
|
|
2854
|
+
var i = /* @__PURE__ */ Object.freeze({
|
|
2855
2855
|
__proto__: null,
|
|
2856
2856
|
defaultErrorMap: G,
|
|
2857
|
-
setErrorMap:
|
|
2857
|
+
setErrorMap: it,
|
|
2858
2858
|
getErrorMap: ve,
|
|
2859
2859
|
makeIssue: _e,
|
|
2860
|
-
EMPTY_PATH:
|
|
2860
|
+
EMPTY_PATH: ot,
|
|
2861
2861
|
addIssueToContext: f,
|
|
2862
|
-
ParseStatus:
|
|
2862
|
+
ParseStatus: T,
|
|
2863
2863
|
INVALID: g,
|
|
2864
|
-
DIRTY:
|
|
2865
|
-
OK:
|
|
2864
|
+
DIRTY: Y,
|
|
2865
|
+
OK: C,
|
|
2866
2866
|
isAborted: Oe,
|
|
2867
2867
|
isDirty: je,
|
|
2868
2868
|
isValid: B,
|
|
2869
|
-
isAsync:
|
|
2869
|
+
isAsync: se,
|
|
2870
2870
|
get util() {
|
|
2871
2871
|
return b;
|
|
2872
2872
|
},
|
|
@@ -2874,223 +2874,227 @@ var o = /* @__PURE__ */ Object.freeze({
|
|
|
2874
2874
|
return Ne;
|
|
2875
2875
|
},
|
|
2876
2876
|
ZodParsedType: h,
|
|
2877
|
-
getParsedType:
|
|
2877
|
+
getParsedType: $,
|
|
2878
2878
|
ZodType: _,
|
|
2879
2879
|
datetimeRegex: Je,
|
|
2880
|
-
ZodString:
|
|
2880
|
+
ZodString: I,
|
|
2881
2881
|
ZodNumber: V,
|
|
2882
2882
|
ZodBigInt: L,
|
|
2883
|
-
ZodBoolean:
|
|
2883
|
+
ZodBoolean: ae,
|
|
2884
2884
|
ZodDate: q,
|
|
2885
2885
|
ZodSymbol: xe,
|
|
2886
|
-
ZodUndefined:
|
|
2887
|
-
ZodNull:
|
|
2886
|
+
ZodUndefined: ie,
|
|
2887
|
+
ZodNull: oe,
|
|
2888
2888
|
ZodAny: X,
|
|
2889
2889
|
ZodUnknown: U,
|
|
2890
2890
|
ZodNever: M,
|
|
2891
2891
|
ZodVoid: ke,
|
|
2892
|
-
ZodArray:
|
|
2892
|
+
ZodArray: A,
|
|
2893
2893
|
ZodObject: k,
|
|
2894
|
-
ZodUnion:
|
|
2894
|
+
ZodUnion: ce,
|
|
2895
2895
|
ZodDiscriminatedUnion: Ce,
|
|
2896
|
-
ZodIntersection:
|
|
2897
|
-
ZodTuple:
|
|
2898
|
-
ZodRecord:
|
|
2896
|
+
ZodIntersection: de,
|
|
2897
|
+
ZodTuple: R,
|
|
2898
|
+
ZodRecord: ue,
|
|
2899
2899
|
ZodMap: we,
|
|
2900
2900
|
ZodSet: W,
|
|
2901
|
-
ZodFunction:
|
|
2902
|
-
ZodLazy:
|
|
2903
|
-
ZodLiteral:
|
|
2901
|
+
ZodFunction: Q,
|
|
2902
|
+
ZodLazy: le,
|
|
2903
|
+
ZodLiteral: fe,
|
|
2904
2904
|
ZodEnum: z,
|
|
2905
|
-
ZodNativeEnum:
|
|
2905
|
+
ZodNativeEnum: he,
|
|
2906
2906
|
ZodPromise: K,
|
|
2907
|
-
ZodEffects:
|
|
2908
|
-
ZodTransformer:
|
|
2909
|
-
ZodOptional:
|
|
2907
|
+
ZodEffects: N,
|
|
2908
|
+
ZodTransformer: N,
|
|
2909
|
+
ZodOptional: j,
|
|
2910
2910
|
ZodNullable: F,
|
|
2911
|
-
ZodDefault:
|
|
2912
|
-
ZodCatch:
|
|
2911
|
+
ZodDefault: pe,
|
|
2912
|
+
ZodCatch: me,
|
|
2913
2913
|
ZodNaN: Te,
|
|
2914
|
-
BRAND:
|
|
2914
|
+
BRAND: At,
|
|
2915
2915
|
ZodBranded: Re,
|
|
2916
|
-
ZodPipeline:
|
|
2917
|
-
ZodReadonly:
|
|
2918
|
-
custom:
|
|
2916
|
+
ZodPipeline: ge,
|
|
2917
|
+
ZodReadonly: ye,
|
|
2918
|
+
custom: Qe,
|
|
2919
2919
|
Schema: _,
|
|
2920
2920
|
ZodSchema: _,
|
|
2921
|
-
late:
|
|
2921
|
+
late: Nt,
|
|
2922
2922
|
get ZodFirstPartyTypeKind() {
|
|
2923
2923
|
return y;
|
|
2924
2924
|
},
|
|
2925
|
-
coerce:
|
|
2926
|
-
any:
|
|
2927
|
-
array:
|
|
2928
|
-
bigint:
|
|
2925
|
+
coerce: lr,
|
|
2926
|
+
any: Mt,
|
|
2927
|
+
array: Ft,
|
|
2928
|
+
bigint: Et,
|
|
2929
2929
|
boolean: Xe,
|
|
2930
|
-
date:
|
|
2931
|
-
discriminatedUnion:
|
|
2932
|
-
effect:
|
|
2933
|
-
enum:
|
|
2934
|
-
function:
|
|
2935
|
-
instanceof:
|
|
2936
|
-
intersection:
|
|
2937
|
-
lazy:
|
|
2938
|
-
literal:
|
|
2939
|
-
map:
|
|
2940
|
-
nan:
|
|
2941
|
-
nativeEnum:
|
|
2942
|
-
never:
|
|
2943
|
-
null:
|
|
2944
|
-
nullable:
|
|
2930
|
+
date: Rt,
|
|
2931
|
+
discriminatedUnion: Wt,
|
|
2932
|
+
effect: Le,
|
|
2933
|
+
enum: tr,
|
|
2934
|
+
function: Xt,
|
|
2935
|
+
instanceof: Ot,
|
|
2936
|
+
intersection: Jt,
|
|
2937
|
+
lazy: Kt,
|
|
2938
|
+
literal: er,
|
|
2939
|
+
map: Ht,
|
|
2940
|
+
nan: jt,
|
|
2941
|
+
nativeEnum: rr,
|
|
2942
|
+
never: Lt,
|
|
2943
|
+
null: Dt,
|
|
2944
|
+
nullable: ar,
|
|
2945
2945
|
number: Ge,
|
|
2946
|
-
object:
|
|
2947
|
-
oboolean:
|
|
2948
|
-
onumber:
|
|
2949
|
-
optional:
|
|
2950
|
-
ostring:
|
|
2951
|
-
pipeline:
|
|
2952
|
-
preprocess:
|
|
2953
|
-
promise:
|
|
2946
|
+
object: Ut,
|
|
2947
|
+
oboolean: ur,
|
|
2948
|
+
onumber: dr,
|
|
2949
|
+
optional: sr,
|
|
2950
|
+
ostring: cr,
|
|
2951
|
+
pipeline: or,
|
|
2952
|
+
preprocess: ir,
|
|
2953
|
+
promise: nr,
|
|
2954
2954
|
record: Qt,
|
|
2955
|
-
set:
|
|
2956
|
-
strictObject:
|
|
2955
|
+
set: Gt,
|
|
2956
|
+
strictObject: Bt,
|
|
2957
2957
|
string: He,
|
|
2958
|
-
symbol:
|
|
2959
|
-
transformer:
|
|
2960
|
-
tuple:
|
|
2961
|
-
undefined:
|
|
2962
|
-
union:
|
|
2963
|
-
unknown:
|
|
2964
|
-
void:
|
|
2965
|
-
NEVER:
|
|
2958
|
+
symbol: Pt,
|
|
2959
|
+
transformer: Le,
|
|
2960
|
+
tuple: Yt,
|
|
2961
|
+
undefined: $t,
|
|
2962
|
+
union: qt,
|
|
2963
|
+
unknown: Vt,
|
|
2964
|
+
void: zt,
|
|
2965
|
+
NEVER: fr,
|
|
2966
2966
|
ZodIssueCode: d,
|
|
2967
|
-
quotelessJson:
|
|
2968
|
-
ZodError:
|
|
2967
|
+
quotelessJson: at,
|
|
2968
|
+
ZodError: S
|
|
2969
2969
|
});
|
|
2970
|
-
const
|
|
2971
|
-
country:
|
|
2972
|
-
city:
|
|
2973
|
-
street:
|
|
2974
|
-
streetNumber:
|
|
2975
|
-
floor:
|
|
2976
|
-
apartmentEnterNumber:
|
|
2977
|
-
apartmentNumber:
|
|
2978
|
-
}),
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
}
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2970
|
+
const hr = i.object({
|
|
2971
|
+
country: i.string(),
|
|
2972
|
+
city: i.string(),
|
|
2973
|
+
street: i.string(),
|
|
2974
|
+
streetNumber: i.string(),
|
|
2975
|
+
floor: i.string(),
|
|
2976
|
+
apartmentEnterNumber: i.string(),
|
|
2977
|
+
apartmentNumber: i.string()
|
|
2978
|
+
}), D = i.string().min(1, { message: "שדה חובה" }), br = i.string().regex(/^\d+$/, "Must be a numeric string"), xr = i.object({ url: i.string().url(), id: i.string() });
|
|
2979
|
+
function kr(r) {
|
|
2980
|
+
return !!(r != null && r.url);
|
|
2981
|
+
}
|
|
2982
|
+
const H = i.object({
|
|
2983
|
+
lang: i.enum(["he"]),
|
|
2984
|
+
value: i.string()
|
|
2985
|
+
}), wr = i.array(H), Ke = i.object({
|
|
2986
|
+
id: i.string().min(1),
|
|
2987
|
+
companyId: i.string().min(1),
|
|
2988
|
+
storeId: i.string().min(1),
|
|
2989
|
+
parentId: i.string().nullish(),
|
|
2990
|
+
tag: i.string().optional(),
|
|
2991
|
+
locales: i.array(H),
|
|
2992
|
+
depth: i.number()
|
|
2989
2993
|
}), Pe = Ke.extend({
|
|
2990
|
-
children:
|
|
2991
|
-
}),
|
|
2992
|
-
index:
|
|
2993
|
-
depth:
|
|
2994
|
-
collapsed:
|
|
2995
|
-
children:
|
|
2996
|
-
}),
|
|
2997
|
-
type:
|
|
2998
|
-
storeId:
|
|
2999
|
-
companyId:
|
|
3000
|
-
id:
|
|
3001
|
-
objectID:
|
|
3002
|
-
sku:
|
|
3003
|
-
name:
|
|
3004
|
-
description:
|
|
3005
|
-
isPublished:
|
|
3006
|
-
vat:
|
|
3007
|
-
priceType:
|
|
3008
|
-
type:
|
|
3009
|
-
value:
|
|
2994
|
+
children: i.lazy(() => Pe.array())
|
|
2995
|
+
}), Tr = Ke.extend({
|
|
2996
|
+
index: i.number(),
|
|
2997
|
+
depth: i.number(),
|
|
2998
|
+
collapsed: i.boolean().optional(),
|
|
2999
|
+
children: i.array(Pe)
|
|
3000
|
+
}), te = i.string().min(1), et = i.object({
|
|
3001
|
+
type: i.literal("Product"),
|
|
3002
|
+
storeId: te,
|
|
3003
|
+
companyId: te,
|
|
3004
|
+
id: te,
|
|
3005
|
+
objectID: te,
|
|
3006
|
+
sku: te,
|
|
3007
|
+
name: i.array(H),
|
|
3008
|
+
description: i.array(H),
|
|
3009
|
+
isPublished: i.boolean(),
|
|
3010
|
+
vat: i.boolean(),
|
|
3011
|
+
priceType: i.object({
|
|
3012
|
+
type: i.enum(["unit", "kg", "gram", "liter", "ml"]),
|
|
3013
|
+
value: i.number()
|
|
3010
3014
|
}),
|
|
3011
|
-
price:
|
|
3012
|
-
purchasePrice:
|
|
3013
|
-
profitPercentage:
|
|
3014
|
-
currency:
|
|
3015
|
-
discount:
|
|
3016
|
-
type:
|
|
3017
|
-
value:
|
|
3015
|
+
price: i.number().positive(),
|
|
3016
|
+
purchasePrice: i.number().optional(),
|
|
3017
|
+
profitPercentage: i.number().optional(),
|
|
3018
|
+
currency: i.literal("ILS"),
|
|
3019
|
+
discount: i.object({
|
|
3020
|
+
type: i.enum(["number", "percent", "none"]),
|
|
3021
|
+
value: i.number()
|
|
3018
3022
|
}),
|
|
3019
|
-
isDiscountable:
|
|
3020
|
-
weight:
|
|
3021
|
-
value:
|
|
3022
|
-
unit:
|
|
3023
|
+
isDiscountable: i.boolean({ description: "included in store discounts" }).optional(),
|
|
3024
|
+
weight: i.object({
|
|
3025
|
+
value: i.number(),
|
|
3026
|
+
unit: i.enum(["kg", "gram", "none"])
|
|
3023
3027
|
}),
|
|
3024
|
-
volume:
|
|
3025
|
-
value:
|
|
3026
|
-
unit:
|
|
3028
|
+
volume: i.object({
|
|
3029
|
+
value: i.number(),
|
|
3030
|
+
unit: i.enum(["liter", "ml", "none"])
|
|
3027
3031
|
}),
|
|
3028
|
-
images:
|
|
3029
|
-
manufacturer:
|
|
3030
|
-
brand:
|
|
3031
|
-
importer:
|
|
3032
|
-
supplier:
|
|
3033
|
-
ingredients:
|
|
3034
|
-
created_at:
|
|
3035
|
-
updated_at:
|
|
3036
|
-
categoryIds:
|
|
3032
|
+
images: i.array(i.object({ url: i.string().url(), id: i.string() })),
|
|
3033
|
+
manufacturer: i.string(),
|
|
3034
|
+
brand: i.string(),
|
|
3035
|
+
importer: i.string(),
|
|
3036
|
+
supplier: i.string(),
|
|
3037
|
+
ingredients: i.array(H),
|
|
3038
|
+
created_at: i.number(),
|
|
3039
|
+
updated_at: i.number(),
|
|
3040
|
+
categoryIds: i.array(i.string().nonempty()),
|
|
3037
3041
|
// @deprecated
|
|
3038
|
-
categoryList:
|
|
3042
|
+
categoryList: i.array(Pe),
|
|
3039
3043
|
// @deprecated
|
|
3040
|
-
categories:
|
|
3041
|
-
lvl0:
|
|
3042
|
-
lvl1:
|
|
3043
|
-
lvl2:
|
|
3044
|
-
lvl3:
|
|
3045
|
-
lvl4:
|
|
3044
|
+
categories: i.object({
|
|
3045
|
+
lvl0: i.array(i.string()),
|
|
3046
|
+
lvl1: i.array(i.string()),
|
|
3047
|
+
lvl2: i.array(i.string()),
|
|
3048
|
+
lvl3: i.array(i.string()),
|
|
3049
|
+
lvl4: i.array(i.string())
|
|
3046
3050
|
}),
|
|
3047
3051
|
// @deprecated
|
|
3048
|
-
categoryNames:
|
|
3049
|
-
}),
|
|
3050
|
-
image:
|
|
3051
|
-
}), tt =
|
|
3052
|
+
categoryNames: i.array(i.string())
|
|
3053
|
+
}), Cr = et.extend({
|
|
3054
|
+
image: i.instanceof(File).optional()
|
|
3055
|
+
}), tt = i.object({
|
|
3052
3056
|
product: et,
|
|
3053
|
-
originalPrice:
|
|
3054
|
-
finalPrice:
|
|
3055
|
-
finalDiscount:
|
|
3056
|
-
amount:
|
|
3057
|
-
}),
|
|
3058
|
-
type:
|
|
3059
|
-
id:
|
|
3060
|
-
companyId:
|
|
3061
|
-
storeId:
|
|
3062
|
-
userId:
|
|
3063
|
-
status:
|
|
3064
|
-
items:
|
|
3065
|
-
}),
|
|
3066
|
-
id:
|
|
3067
|
-
name:
|
|
3068
|
-
websiteDomains:
|
|
3069
|
-
}),
|
|
3070
|
-
type:
|
|
3071
|
-
id:
|
|
3072
|
-
companyId:
|
|
3073
|
-
storeId:
|
|
3074
|
-
userId:
|
|
3075
|
-
productId:
|
|
3076
|
-
}), rt =
|
|
3077
|
-
type:
|
|
3078
|
-
id:
|
|
3079
|
-
companyId:
|
|
3080
|
-
storeId:
|
|
3081
|
-
tenantId:
|
|
3082
|
-
clientType:
|
|
3083
|
-
companyName:
|
|
3084
|
-
displayName:
|
|
3085
|
-
email:
|
|
3086
|
-
phoneNumber:
|
|
3087
|
-
address:
|
|
3088
|
-
isAnonymous:
|
|
3089
|
-
createdDate:
|
|
3090
|
-
lastActivityDate:
|
|
3057
|
+
originalPrice: i.number().optional(),
|
|
3058
|
+
finalPrice: i.number().optional(),
|
|
3059
|
+
finalDiscount: i.number().optional(),
|
|
3060
|
+
amount: i.number().int().positive({ message: "Quantity must be a positive integer." })
|
|
3061
|
+
}), Sr = i.object({
|
|
3062
|
+
type: i.literal("Cart"),
|
|
3063
|
+
id: i.string().uuid(),
|
|
3064
|
+
companyId: i.string().uuid(),
|
|
3065
|
+
storeId: i.string().uuid(),
|
|
3066
|
+
userId: i.string().uuid(),
|
|
3067
|
+
status: i.enum(["active", "draft", "completed"]),
|
|
3068
|
+
items: i.array(tt)
|
|
3069
|
+
}), Zr = i.object({
|
|
3070
|
+
id: i.string(),
|
|
3071
|
+
name: i.string(),
|
|
3072
|
+
websiteDomains: i.array(i.string())
|
|
3073
|
+
}), Ir = i.object({
|
|
3074
|
+
type: i.literal("FavoriteProduct"),
|
|
3075
|
+
id: i.string().uuid(),
|
|
3076
|
+
companyId: i.string().uuid(),
|
|
3077
|
+
storeId: i.string().uuid(),
|
|
3078
|
+
userId: i.string().uuid(),
|
|
3079
|
+
productId: i.string().uuid()
|
|
3080
|
+
}), rt = i.enum(["default", "delayed"]), pr = i.object({
|
|
3081
|
+
type: i.literal("Profile"),
|
|
3082
|
+
id: D,
|
|
3083
|
+
companyId: D,
|
|
3084
|
+
storeId: D,
|
|
3085
|
+
tenantId: D,
|
|
3086
|
+
clientType: i.enum(["user", "company"]),
|
|
3087
|
+
companyName: i.string().optional(),
|
|
3088
|
+
displayName: D,
|
|
3089
|
+
email: i.string().email(),
|
|
3090
|
+
phoneNumber: i.string().optional(),
|
|
3091
|
+
address: hr.optional(),
|
|
3092
|
+
isAnonymous: i.boolean(),
|
|
3093
|
+
createdDate: i.number(),
|
|
3094
|
+
lastActivityDate: i.number(),
|
|
3091
3095
|
paymentType: rt
|
|
3092
3096
|
});
|
|
3093
|
-
function
|
|
3097
|
+
function Ar() {
|
|
3094
3098
|
return {
|
|
3095
3099
|
type: "Profile",
|
|
3096
3100
|
id: "",
|
|
@@ -3116,13 +3120,13 @@ function Zr() {
|
|
|
3116
3120
|
paymentType: rt.Values.default
|
|
3117
3121
|
};
|
|
3118
3122
|
}
|
|
3119
|
-
const
|
|
3120
|
-
type:
|
|
3121
|
-
id:
|
|
3122
|
-
companyId:
|
|
3123
|
-
storeId:
|
|
3124
|
-
userId:
|
|
3125
|
-
status:
|
|
3123
|
+
const Nr = i.object({
|
|
3124
|
+
type: i.literal("Order"),
|
|
3125
|
+
id: D,
|
|
3126
|
+
companyId: D,
|
|
3127
|
+
storeId: D,
|
|
3128
|
+
userId: D,
|
|
3129
|
+
status: i.enum([
|
|
3126
3130
|
"draft",
|
|
3127
3131
|
// before payment
|
|
3128
3132
|
"pending",
|
|
@@ -3136,66 +3140,66 @@ const Ir = o.object({
|
|
|
3136
3140
|
"completed",
|
|
3137
3141
|
"refunded"
|
|
3138
3142
|
]),
|
|
3139
|
-
paymentStatus:
|
|
3143
|
+
paymentStatus: i.enum(["pending", "pending_j5", "external", "completed", "failed", "refunded"]),
|
|
3140
3144
|
//todo check if hyp support partial refund
|
|
3141
|
-
cart:
|
|
3142
|
-
id:
|
|
3143
|
-
items:
|
|
3144
|
-
cartDiscount:
|
|
3145
|
-
cartTotal:
|
|
3146
|
-
cartVat:
|
|
3145
|
+
cart: i.object({
|
|
3146
|
+
id: i.string(),
|
|
3147
|
+
items: i.array(tt),
|
|
3148
|
+
cartDiscount: i.number(),
|
|
3149
|
+
cartTotal: i.number(),
|
|
3150
|
+
cartVat: i.number()
|
|
3147
3151
|
}),
|
|
3148
|
-
originalAmount:
|
|
3152
|
+
originalAmount: i.number().positive().optional(),
|
|
3149
3153
|
// what client pay
|
|
3150
|
-
actualAmount:
|
|
3154
|
+
actualAmount: i.number().positive().optional(),
|
|
3151
3155
|
// what store charge
|
|
3152
|
-
date:
|
|
3153
|
-
deliveryDate:
|
|
3154
|
-
createdAt:
|
|
3155
|
-
client:
|
|
3156
|
-
nameOnInvoice:
|
|
3157
|
-
clientComment:
|
|
3158
|
-
}),
|
|
3159
|
-
|
|
3160
|
-
id:
|
|
3161
|
-
companyId:
|
|
3162
|
-
name:
|
|
3163
|
-
urls:
|
|
3164
|
-
logoUrl:
|
|
3165
|
-
tenantId:
|
|
3156
|
+
date: i.number(),
|
|
3157
|
+
deliveryDate: i.coerce.number().optional(),
|
|
3158
|
+
createdAt: i.number().optional(),
|
|
3159
|
+
client: pr.required({}),
|
|
3160
|
+
nameOnInvoice: i.string().optional(),
|
|
3161
|
+
clientComment: i.string().optional()
|
|
3162
|
+
}), mr = i.enum(["individual", "company"]);
|
|
3163
|
+
i.object({
|
|
3164
|
+
id: i.string(),
|
|
3165
|
+
companyId: i.string(),
|
|
3166
|
+
name: i.string(),
|
|
3167
|
+
urls: i.array(i.string()),
|
|
3168
|
+
logoUrl: i.string(),
|
|
3169
|
+
tenantId: i.string(),
|
|
3166
3170
|
// firebase auth tenantId
|
|
3167
|
-
paymentType:
|
|
3168
|
-
allowAnonymousClients:
|
|
3169
|
-
isVatIncludedInPrice:
|
|
3170
|
-
clientTypes:
|
|
3171
|
-
minimumOrder:
|
|
3172
|
-
freeDeliveryPrice:
|
|
3173
|
-
deliveryPrice:
|
|
3171
|
+
paymentType: i.enum(["external", "j5"]),
|
|
3172
|
+
allowAnonymousClients: i.boolean(),
|
|
3173
|
+
isVatIncludedInPrice: i.boolean(),
|
|
3174
|
+
clientTypes: i.array(mr),
|
|
3175
|
+
minimumOrder: i.number().optional(),
|
|
3176
|
+
freeDeliveryPrice: i.number().optional(),
|
|
3177
|
+
deliveryPrice: i.number().optional()
|
|
3174
3178
|
});
|
|
3175
|
-
const Ie =
|
|
3176
|
-
type:
|
|
3179
|
+
const Ie = i.string().min(1), Or = i.object({
|
|
3180
|
+
type: i.literal("Discount"),
|
|
3177
3181
|
storeId: Ie,
|
|
3178
3182
|
companyId: Ie,
|
|
3179
3183
|
id: Ie,
|
|
3180
|
-
name:
|
|
3181
|
-
active:
|
|
3182
|
-
variant:
|
|
3183
|
-
|
|
3184
|
-
variantType:
|
|
3185
|
-
productsId:
|
|
3186
|
-
requiredQuantity:
|
|
3187
|
-
discountPrice:
|
|
3184
|
+
name: i.array(H),
|
|
3185
|
+
active: i.boolean(),
|
|
3186
|
+
variant: i.discriminatedUnion("variantType", [
|
|
3187
|
+
i.object({
|
|
3188
|
+
variantType: i.literal("bundle"),
|
|
3189
|
+
productsId: i.array(i.string()).min(1),
|
|
3190
|
+
requiredQuantity: i.number().positive(),
|
|
3191
|
+
discountPrice: i.number().positive()
|
|
3188
3192
|
})
|
|
3189
3193
|
]),
|
|
3190
|
-
images:
|
|
3194
|
+
images: i.array(i.string().nonempty()).optional()
|
|
3191
3195
|
}), Ae = {
|
|
3192
3196
|
VAT: 18
|
|
3193
3197
|
};
|
|
3194
|
-
function
|
|
3198
|
+
function ze(r) {
|
|
3195
3199
|
var e, t;
|
|
3196
|
-
return ((e = r.discount) == null ? void 0 : e.type) === "percent" ? r.price * (r.discount.value ?? 100) / 100 : ((t = r.discount) == null ? void 0 : t.type) === "number" ? r.
|
|
3200
|
+
return ((e = r.discount) == null ? void 0 : e.type) === "percent" ? r.price * (r.discount.value ?? 100) / 100 : ((t = r.discount) == null ? void 0 : t.type) === "number" ? r.discount.value ?? 0 : 0;
|
|
3197
3201
|
}
|
|
3198
|
-
function
|
|
3202
|
+
function Fe(r) {
|
|
3199
3203
|
var e, t;
|
|
3200
3204
|
if (((e = r.discount) == null ? void 0 : e.type) === "percent") {
|
|
3201
3205
|
const n = r.price * r.discount.value / 100;
|
|
@@ -3203,60 +3207,55 @@ function yr(r) {
|
|
|
3203
3207
|
}
|
|
3204
3208
|
return ((t = r.discount) == null ? void 0 : t.type) === "number" ? r.price - r.discount.value : r.price;
|
|
3205
3209
|
}
|
|
3206
|
-
function
|
|
3210
|
+
function jr({
|
|
3207
3211
|
cart: r,
|
|
3208
3212
|
discounts: e,
|
|
3209
3213
|
store: t
|
|
3210
3214
|
}) {
|
|
3211
3215
|
const { isVatIncludedInPrice: n } = t;
|
|
3212
|
-
let s = r.map((
|
|
3213
|
-
amount:
|
|
3214
|
-
product: { ...
|
|
3215
|
-
originalPrice:
|
|
3216
|
-
finalPrice:
|
|
3217
|
-
finalDiscount:
|
|
3216
|
+
let s = r.map((o) => ({
|
|
3217
|
+
amount: o.amount,
|
|
3218
|
+
product: { ...o.product },
|
|
3219
|
+
originalPrice: o.product.price,
|
|
3220
|
+
finalPrice: Fe(o.product),
|
|
3221
|
+
finalDiscount: ze(o.product)
|
|
3218
3222
|
}));
|
|
3219
|
-
const a = e.filter((
|
|
3220
|
-
console.log("activeDiscounts", a), a.forEach((
|
|
3223
|
+
const a = e.filter((o) => o.variant.variantType === "bundle" && ((r == null ? void 0 : r.reduce((u, p) => (o.variant.productsId.includes(p.product.id) && (u += p.amount), u), 0)) ?? 0) >= o.variant.requiredQuantity);
|
|
3224
|
+
console.log("activeDiscounts", a), a.forEach((o) => {
|
|
3221
3225
|
var l, u;
|
|
3222
|
-
if (
|
|
3226
|
+
if (o.variant.variantType === "bundle") {
|
|
3223
3227
|
const p = r.filter(
|
|
3224
|
-
(
|
|
3225
|
-
), x = (p == null ? void 0 : p.reduce((
|
|
3226
|
-
console.log("price", w,
|
|
3227
|
-
const
|
|
3228
|
-
(
|
|
3228
|
+
(Z) => o.variant.productsId.includes(Z.product.id)
|
|
3229
|
+
), x = (p == null ? void 0 : p.reduce((Z, De) => (o.variant.productsId.includes(De.product.id) && (Z += De.amount), Z), 0)) ?? 0, O = Math.floor(x / o.variant.requiredQuantity), w = Fe((l = p[0]) == null ? void 0 : l.product), ee = ze((u = p[0]) == null ? void 0 : u.product);
|
|
3230
|
+
console.log("price", w, ee);
|
|
3231
|
+
const Se = Number(
|
|
3232
|
+
(o.variant.discountPrice / o.variant.requiredQuantity).toFixed(2)
|
|
3229
3233
|
) * 1;
|
|
3230
|
-
console.log("discountPrice",
|
|
3231
|
-
const
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
finalPrice: ge,
|
|
3237
|
-
originalPrice: A.product.price,
|
|
3234
|
+
console.log("discountPrice", Se);
|
|
3235
|
+
const nt = (w * o.variant.requiredQuantity - o.variant.discountPrice) * O, st = x * w - nt, $e = Number((st / x).toFixed(2));
|
|
3236
|
+
s = s.map((Z) => o.variant.productsId.includes(Z.product.id) ? {
|
|
3237
|
+
...Z,
|
|
3238
|
+
finalPrice: $e,
|
|
3239
|
+
originalPrice: Z.product.price,
|
|
3238
3240
|
discountPrice: w,
|
|
3239
|
-
finalDiscount:
|
|
3240
|
-
} :
|
|
3241
|
-
"yes",
|
|
3242
|
-
I,
|
|
3243
|
-
i.variant.requiredQuantity,
|
|
3244
|
-
i.variant.discountPrice
|
|
3245
|
-
), console.log("dis", x, p);
|
|
3241
|
+
finalDiscount: Z.finalDiscount + (Z.product.price - $e)
|
|
3242
|
+
} : Z);
|
|
3246
3243
|
}
|
|
3247
|
-
})
|
|
3244
|
+
});
|
|
3248
3245
|
const c = s.reduce(
|
|
3249
|
-
(
|
|
3250
|
-
const { product: u, amount: p, finalPrice: x, finalDiscount:
|
|
3251
|
-
console.log("isVatIncludedInPrice", n);
|
|
3246
|
+
(o, l) => {
|
|
3247
|
+
const { product: u, amount: p, finalPrice: x, finalDiscount: O } = l;
|
|
3252
3248
|
let w = 0;
|
|
3253
|
-
if (u.vat)
|
|
3249
|
+
if (u.vat) {
|
|
3250
|
+
let ee = 0;
|
|
3254
3251
|
if (n) {
|
|
3255
3252
|
const Se = x * (Ae.VAT / (100 + Ae.VAT));
|
|
3256
|
-
w = Number(Se.toFixed(2)), w = w * p,
|
|
3253
|
+
w = Number(Se.toFixed(2)), w = w * p, ee = Number(w.toFixed(2));
|
|
3257
3254
|
} else
|
|
3258
|
-
w = x * Ae.VAT / 100, w = w * p,
|
|
3259
|
-
|
|
3255
|
+
w = x * Ae.VAT / 100, w = w * p, ee = Number(w.toFixed(2));
|
|
3256
|
+
o.vat = Number((o.vat + ee).toFixed(2));
|
|
3257
|
+
}
|
|
3258
|
+
return o.cost += p * x, o.discount += O && p * O, o.finalCost += p * x + (n ? 0 : w), o.productsCost += p * x + (n ? 0 : w), o;
|
|
3260
3259
|
},
|
|
3261
3260
|
{
|
|
3262
3261
|
discount: 0,
|
|
@@ -3269,10 +3268,10 @@ function Nr({
|
|
|
3269
3268
|
);
|
|
3270
3269
|
return c.deliveryPrice && c.productsCost >= (t.freeDeliveryPrice ?? 0) ? c.deliveryPrice = 0 : c.finalCost += c.deliveryPrice, console.log("cartDetails", c), { items: s, ...c };
|
|
3271
3270
|
}
|
|
3272
|
-
const
|
|
3271
|
+
const yr = {
|
|
3273
3272
|
stores: "STORES",
|
|
3274
3273
|
companies: "COMPANIES"
|
|
3275
|
-
},
|
|
3274
|
+
}, gr = {
|
|
3276
3275
|
products: "products",
|
|
3277
3276
|
profiles: "profiles",
|
|
3278
3277
|
cart: "cart",
|
|
@@ -3283,9 +3282,9 @@ const gr = {
|
|
|
3283
3282
|
payments: "payments",
|
|
3284
3283
|
settings: "settings",
|
|
3285
3284
|
discounts: "discounts"
|
|
3286
|
-
},
|
|
3287
|
-
systemCollections:
|
|
3288
|
-
storeCollections:
|
|
3285
|
+
}, vr = {
|
|
3286
|
+
systemCollections: yr,
|
|
3287
|
+
storeCollections: gr,
|
|
3289
3288
|
// for client
|
|
3290
3289
|
getPath: ({
|
|
3291
3290
|
companyId: r,
|
|
@@ -3295,30 +3294,32 @@ const gr = {
|
|
|
3295
3294
|
}) => `${r}/${e}/${t}${n ? `/${n}` : ""}`,
|
|
3296
3295
|
// for backend
|
|
3297
3296
|
getDocPath: (r) => `{companyId}/{storeId}/${r}/{id}`
|
|
3298
|
-
},
|
|
3299
|
-
firestore:
|
|
3297
|
+
}, Er = {
|
|
3298
|
+
firestore: vr
|
|
3300
3299
|
};
|
|
3301
3300
|
export {
|
|
3302
|
-
|
|
3301
|
+
hr as AddressSchema,
|
|
3303
3302
|
Ke as BaseCategorySchema,
|
|
3304
3303
|
tt as CartItemProductSchema,
|
|
3305
|
-
|
|
3304
|
+
Sr as CartSchema,
|
|
3306
3305
|
Pe as CategorySchema,
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3306
|
+
Zr as CompanySchema,
|
|
3307
|
+
Or as DiscountSchema,
|
|
3308
|
+
Ir as FavoriteProductSchema,
|
|
3309
|
+
xr as FileSchema,
|
|
3310
|
+
Er as FirebaseAPI,
|
|
3311
3311
|
H as LocaleSchema,
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3312
|
+
wr as LocaleValueSchema,
|
|
3313
|
+
Cr as NewProductSchema,
|
|
3314
|
+
Nr as OrderSchema,
|
|
3315
3315
|
et as ProductSchema,
|
|
3316
3316
|
rt as ProfilePaymentTypeSchema,
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3317
|
+
pr as ProfileSchema,
|
|
3318
|
+
Tr as TFlattenCategorySchema,
|
|
3319
|
+
Ar as createEmptyProfile,
|
|
3320
|
+
jr as getCartCost,
|
|
3321
|
+
kr as isFile,
|
|
3322
|
+
D as notEmptyTextSchema,
|
|
3322
3323
|
br as numericTextSchema
|
|
3323
3324
|
};
|
|
3324
3325
|
//# sourceMappingURL=core.es.js.map
|