@jsdev_ninja/core 0.10.3 → 0.10.5
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 +489 -468
- 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/Discount.d.ts +68 -0
- package/dist/entities/Discount.d.ts.map +1 -0
- package/dist/entities/Discount.js +19 -0
- package/dist/entities/Order.d.ts +5 -0
- package/dist/entities/Order.d.ts.map +1 -1
- package/dist/entities/Profile.d.ts +5 -0
- package/dist/entities/Profile.d.ts.map +1 -1
- package/dist/entities/Profile.js +3 -0
- package/dist/entities/Store.d.ts +5 -2
- package/dist/entities/Store.d.ts.map +1 -1
- package/dist/entities/Store.js +1 -0
- package/dist/entities/index.d.ts +1 -0
- package/dist/entities/index.d.ts.map +1 -1
- package/dist/entities/index.js +1 -0
- package/dist/firebase-api/index.d.ts +3 -0
- package/dist/firebase-api/index.d.ts.map +1 -1
- package/dist/firebase-api/index.js +1 -0
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/lib/entities/Discount.ts +22 -0
- package/lib/entities/Store.ts +1 -0
- package/lib/entities/index.ts +1 -0
- package/lib/firebase-api/index.ts +1 -0
- package/package.json +1 -1
package/dist/core.es.js
CHANGED
|
@@ -9,28 +9,28 @@ var b;
|
|
|
9
9
|
}
|
|
10
10
|
r.assertNever = t, r.arrayToEnum = (s) => {
|
|
11
11
|
const a = {};
|
|
12
|
-
for (const
|
|
13
|
-
a[
|
|
12
|
+
for (const o of s)
|
|
13
|
+
a[o] = o;
|
|
14
14
|
return a;
|
|
15
15
|
}, r.getValidEnumValues = (s) => {
|
|
16
|
-
const a = r.objectKeys(s).filter((
|
|
17
|
-
for (const
|
|
18
|
-
|
|
19
|
-
return r.objectValues(
|
|
16
|
+
const a = r.objectKeys(s).filter((d) => typeof s[s[d]] != "number"), o = {};
|
|
17
|
+
for (const d of a)
|
|
18
|
+
o[d] = s[d];
|
|
19
|
+
return r.objectValues(o);
|
|
20
20
|
}, r.objectValues = (s) => r.objectKeys(s).map(function(a) {
|
|
21
21
|
return s[a];
|
|
22
22
|
}), r.objectKeys = typeof Object.keys == "function" ? (s) => Object.keys(s) : (s) => {
|
|
23
23
|
const a = [];
|
|
24
|
-
for (const
|
|
25
|
-
Object.prototype.hasOwnProperty.call(s,
|
|
24
|
+
for (const o in s)
|
|
25
|
+
Object.prototype.hasOwnProperty.call(s, o) && a.push(o);
|
|
26
26
|
return a;
|
|
27
27
|
}, r.find = (s, a) => {
|
|
28
|
-
for (const
|
|
29
|
-
if (a(
|
|
30
|
-
return
|
|
28
|
+
for (const o of s)
|
|
29
|
+
if (a(o))
|
|
30
|
+
return o;
|
|
31
31
|
}, r.isInteger = typeof Number.isInteger == "function" ? (s) => Number.isInteger(s) : (s) => typeof s == "number" && isFinite(s) && Math.floor(s) === s;
|
|
32
32
|
function n(s, a = " | ") {
|
|
33
|
-
return s.map((
|
|
33
|
+
return s.map((o) => typeof o == "string" ? `'${o}'` : o).join(a);
|
|
34
34
|
}
|
|
35
35
|
r.joinValues = n, r.jsonStringifyReplacer = (s, a) => typeof a == "bigint" ? a.toString() : a;
|
|
36
36
|
})(b || (b = {}));
|
|
@@ -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
|
+
]), Ye = (r) => JSON.stringify(r, null, 2).replace(/"([^"]+)":/g, "$1:");
|
|
105
|
+
class Z extends Error {
|
|
106
106
|
get errors() {
|
|
107
107
|
return this.issues;
|
|
108
108
|
}
|
|
@@ -119,27 +119,27 @@ class S extends Error {
|
|
|
119
119
|
const t = e || function(a) {
|
|
120
120
|
return a.message;
|
|
121
121
|
}, n = { _errors: [] }, s = (a) => {
|
|
122
|
-
for (const
|
|
123
|
-
if (
|
|
124
|
-
|
|
125
|
-
else if (
|
|
126
|
-
s(
|
|
127
|
-
else if (
|
|
128
|
-
s(
|
|
129
|
-
else if (
|
|
130
|
-
n._errors.push(t(
|
|
122
|
+
for (const o of a.issues)
|
|
123
|
+
if (o.code === "invalid_union")
|
|
124
|
+
o.unionErrors.map(s);
|
|
125
|
+
else if (o.code === "invalid_return_type")
|
|
126
|
+
s(o.returnTypeError);
|
|
127
|
+
else if (o.code === "invalid_arguments")
|
|
128
|
+
s(o.argumentsError);
|
|
129
|
+
else if (o.path.length === 0)
|
|
130
|
+
n._errors.push(t(o));
|
|
131
131
|
else {
|
|
132
|
-
let
|
|
133
|
-
for (; f <
|
|
134
|
-
const u =
|
|
135
|
-
f ===
|
|
132
|
+
let d = n, f = 0;
|
|
133
|
+
for (; f < o.path.length; ) {
|
|
134
|
+
const u = o.path[f];
|
|
135
|
+
f === o.path.length - 1 ? (d[u] = d[u] || { _errors: [] }, d[u]._errors.push(t(o))) : d[u] = d[u] || { _errors: [] }, d = d[u], f++;
|
|
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 Z))
|
|
143
143
|
throw new Error(`Not a ZodError: ${e}`);
|
|
144
144
|
}
|
|
145
145
|
toString() {
|
|
@@ -161,8 +161,8 @@ class S extends Error {
|
|
|
161
161
|
return this.flatten();
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
|
-
|
|
165
|
-
const
|
|
164
|
+
Z.create = (r) => new Z(r);
|
|
165
|
+
const Y = (r, e) => {
|
|
166
166
|
let t;
|
|
167
167
|
switch (r.code) {
|
|
168
168
|
case c.invalid_type:
|
|
@@ -218,15 +218,15 @@ const J = (r, e) => {
|
|
|
218
218
|
}
|
|
219
219
|
return { message: t };
|
|
220
220
|
};
|
|
221
|
-
let
|
|
222
|
-
function
|
|
223
|
-
|
|
221
|
+
let $e = Y;
|
|
222
|
+
function He(r) {
|
|
223
|
+
$e = r;
|
|
224
224
|
}
|
|
225
225
|
function pe() {
|
|
226
|
-
return
|
|
226
|
+
return $e;
|
|
227
227
|
}
|
|
228
228
|
const ye = (r) => {
|
|
229
|
-
const { data: e, path: t, errorMaps: n, issueData: s } = r, a = [...t, ...s.path || []],
|
|
229
|
+
const { data: e, path: t, errorMaps: n, issueData: s } = r, a = [...t, ...s.path || []], o = {
|
|
230
230
|
...s,
|
|
231
231
|
path: a
|
|
232
232
|
};
|
|
@@ -236,16 +236,16 @@ const ye = (r) => {
|
|
|
236
236
|
path: a,
|
|
237
237
|
message: s.message
|
|
238
238
|
};
|
|
239
|
-
let
|
|
239
|
+
let d = "";
|
|
240
240
|
const f = n.filter((u) => !!u).slice().reverse();
|
|
241
241
|
for (const u of f)
|
|
242
|
-
|
|
242
|
+
d = u(o, { data: e, defaultError: d }).message;
|
|
243
243
|
return {
|
|
244
244
|
...s,
|
|
245
245
|
path: a,
|
|
246
|
-
message:
|
|
246
|
+
message: d
|
|
247
247
|
};
|
|
248
|
-
},
|
|
248
|
+
}, Ge = [];
|
|
249
249
|
function l(r, e) {
|
|
250
250
|
const t = pe(), n = ye({
|
|
251
251
|
issueData: e,
|
|
@@ -258,7 +258,7 @@ function l(r, e) {
|
|
|
258
258
|
// then schema-bound map if available
|
|
259
259
|
t,
|
|
260
260
|
// then global override map
|
|
261
|
-
t ===
|
|
261
|
+
t === Y ? void 0 : Y
|
|
262
262
|
// then global default map
|
|
263
263
|
].filter((s) => !!s)
|
|
264
264
|
});
|
|
@@ -286,10 +286,10 @@ class w {
|
|
|
286
286
|
static async mergeObjectAsync(e, t) {
|
|
287
287
|
const n = [];
|
|
288
288
|
for (const s of t) {
|
|
289
|
-
const a = await s.key,
|
|
289
|
+
const a = await s.key, o = await s.value;
|
|
290
290
|
n.push({
|
|
291
291
|
key: a,
|
|
292
|
-
value:
|
|
292
|
+
value: o
|
|
293
293
|
});
|
|
294
294
|
}
|
|
295
295
|
return w.mergeObjectSync(e, n);
|
|
@@ -297,22 +297,22 @@ class w {
|
|
|
297
297
|
static mergeObjectSync(e, t) {
|
|
298
298
|
const n = {};
|
|
299
299
|
for (const s of t) {
|
|
300
|
-
const { key: a, value:
|
|
301
|
-
if (a.status === "aborted" ||
|
|
300
|
+
const { key: a, value: o } = s;
|
|
301
|
+
if (a.status === "aborted" || o.status === "aborted")
|
|
302
302
|
return g;
|
|
303
|
-
a.status === "dirty" && e.dirty(),
|
|
303
|
+
a.status === "dirty" && e.dirty(), o.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof o.value < "u" || s.alwaysSet) && (n[a.value] = o.value);
|
|
304
304
|
}
|
|
305
305
|
return { status: e.value, value: n };
|
|
306
306
|
}
|
|
307
307
|
}
|
|
308
308
|
const g = Object.freeze({
|
|
309
309
|
status: "aborted"
|
|
310
|
-
}), W = (r) => ({ status: "dirty", value: r }),
|
|
310
|
+
}), W = (r) => ({ status: "dirty", value: r }), S = (r) => ({ status: "valid", value: r }), Ce = (r) => r.status === "aborted", Ie = (r) => r.status === "dirty", z = (r) => r.status === "valid", ee = (r) => typeof Promise < "u" && r instanceof Promise;
|
|
311
311
|
function ge(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);
|
|
314
314
|
}
|
|
315
|
-
function
|
|
315
|
+
function Me(r, e, t, n, s) {
|
|
316
316
|
if (typeof e == "function" ? r !== e || !0 : !e.has(r)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
317
317
|
return e.set(r, t), t;
|
|
318
318
|
}
|
|
@@ -320,7 +320,7 @@ 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
|
|
323
|
+
var X, K;
|
|
324
324
|
class O {
|
|
325
325
|
constructor(e, t, n, s) {
|
|
326
326
|
this._cachedPath = [], this.parent = e, this.data = t, this._path = n, this._key = s;
|
|
@@ -329,7 +329,7 @@ class O {
|
|
|
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 Ee = (r, e) => {
|
|
333
333
|
if (z(e))
|
|
334
334
|
return { success: !0, data: e.value };
|
|
335
335
|
if (!r.common.issues.length)
|
|
@@ -339,7 +339,7 @@ const je = (r, e) => {
|
|
|
339
339
|
get error() {
|
|
340
340
|
if (this._error)
|
|
341
341
|
return this._error;
|
|
342
|
-
const t = new
|
|
342
|
+
const t = new Z(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: (
|
|
353
|
+
return e ? { errorMap: e, description: s } : { errorMap: (o, d) => {
|
|
354
354
|
var f, u;
|
|
355
355
|
const { message: p } = r;
|
|
356
|
-
return
|
|
356
|
+
return o.code === "invalid_enum_value" ? { message: p ?? d.defaultError } : typeof d.data > "u" ? { message: (f = p ?? n) !== null && f !== void 0 ? f : d.defaultError } : o.code !== "invalid_type" ? { message: d.defaultError } : { message: (u = p ?? t) !== null && u !== void 0 ? u : d.defaultError };
|
|
357
357
|
}, description: s };
|
|
358
358
|
}
|
|
359
359
|
class _ {
|
|
@@ -416,7 +416,7 @@ class _ {
|
|
|
416
416
|
data: e,
|
|
417
417
|
parsedType: R(e)
|
|
418
418
|
}, a = this._parseSync({ data: e, path: s.path, parent: s });
|
|
419
|
-
return
|
|
419
|
+
return Ee(s, a);
|
|
420
420
|
}
|
|
421
421
|
"~validate"(e) {
|
|
422
422
|
var t, n;
|
|
@@ -470,23 +470,23 @@ class _ {
|
|
|
470
470
|
data: e,
|
|
471
471
|
parsedType: R(e)
|
|
472
472
|
}, s = this._parse({ data: e, path: n.path, parent: n }), a = await (ee(s) ? s : Promise.resolve(s));
|
|
473
|
-
return
|
|
473
|
+
return Ee(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
|
|
478
|
+
const o = e(s), d = () => a.addIssue({
|
|
479
479
|
code: c.custom,
|
|
480
480
|
...n(s)
|
|
481
481
|
});
|
|
482
|
-
return typeof Promise < "u" &&
|
|
482
|
+
return typeof Promise < "u" && o instanceof Promise ? o.then((f) => f ? !0 : (d(), !1)) : o ? !0 : (d(), !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 A({
|
|
490
490
|
schema: this,
|
|
491
491
|
typeName: y.ZodEffects,
|
|
492
492
|
effect: { type: "refinement", refinement: e }
|
|
@@ -512,10 +512,10 @@ class _ {
|
|
|
512
512
|
return this.nullable().optional();
|
|
513
513
|
}
|
|
514
514
|
array() {
|
|
515
|
-
return
|
|
515
|
+
return I.create(this);
|
|
516
516
|
}
|
|
517
517
|
promise() {
|
|
518
|
-
return
|
|
518
|
+
return G.create(this, this._def);
|
|
519
519
|
}
|
|
520
520
|
or(e) {
|
|
521
521
|
return se.create([this, e], this._def);
|
|
@@ -524,7 +524,7 @@ class _ {
|
|
|
524
524
|
return ae.create(this, e, this._def);
|
|
525
525
|
}
|
|
526
526
|
transform(e) {
|
|
527
|
-
return new
|
|
527
|
+
return new A({
|
|
528
528
|
...v(this._def),
|
|
529
529
|
schema: this,
|
|
530
530
|
typeName: y.ZodEffects,
|
|
@@ -541,7 +541,7 @@ class _ {
|
|
|
541
541
|
});
|
|
542
542
|
}
|
|
543
543
|
brand() {
|
|
544
|
-
return new
|
|
544
|
+
return new Ne({
|
|
545
545
|
typeName: y.ZodBranded,
|
|
546
546
|
type: this,
|
|
547
547
|
...v(this._def)
|
|
@@ -576,26 +576,26 @@ class _ {
|
|
|
576
576
|
return this.safeParse(null).success;
|
|
577
577
|
}
|
|
578
578
|
}
|
|
579
|
-
const
|
|
579
|
+
const Qe = /^c[^\s-]{8,}$/i, Xe = /^[0-9a-z]+$/, Ke = /^[0-9A-HJKMNP-TV-Z]{26}$/i, et = /^[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, tt = /^[a-z0-9_-]{21}$/i, rt = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, nt = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, st = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, at = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
580
580
|
let Te;
|
|
581
|
-
const
|
|
582
|
-
function
|
|
581
|
+
const it = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, ot = /^(?:(?: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])$/, dt = /^(([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]))$/, ct = /^(([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])$/, ut = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, lt = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, Ve = "((\\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])))", ft = new RegExp(`^${Ve}$`);
|
|
582
|
+
function De(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
|
|
587
|
-
return new RegExp(`^${
|
|
586
|
+
function ht(r) {
|
|
587
|
+
return new RegExp(`^${De(r)}$`);
|
|
588
588
|
}
|
|
589
|
-
function
|
|
590
|
-
let e = `${
|
|
589
|
+
function Le(r) {
|
|
590
|
+
let e = `${Ve}T${De(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
|
|
595
|
-
return !!((e === "v4" || !e) &&
|
|
594
|
+
function mt(r, e) {
|
|
595
|
+
return !!((e === "v4" || !e) && it.test(r) || (e === "v6" || !e) && dt.test(r));
|
|
596
596
|
}
|
|
597
|
-
function
|
|
598
|
-
if (!
|
|
597
|
+
function pt(r, e) {
|
|
598
|
+
if (!rt.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,8 +604,8 @@ function ht(r, e) {
|
|
|
604
604
|
return !1;
|
|
605
605
|
}
|
|
606
606
|
}
|
|
607
|
-
function
|
|
608
|
-
return !!((e === "v4" || !e) &&
|
|
607
|
+
function yt(r, e) {
|
|
608
|
+
return !!((e === "v4" || !e) && ot.test(r) || (e === "v6" || !e) && ct.test(r));
|
|
609
609
|
}
|
|
610
610
|
class C extends _ {
|
|
611
611
|
_parse(e) {
|
|
@@ -639,15 +639,15 @@ class C extends _ {
|
|
|
639
639
|
message: a.message
|
|
640
640
|
}), n.dirty());
|
|
641
641
|
else if (a.kind === "length") {
|
|
642
|
-
const
|
|
643
|
-
(
|
|
642
|
+
const o = e.data.length > a.value, d = e.data.length < a.value;
|
|
643
|
+
(o || d) && (s = this._getOrReturnCtx(e, s), o ? l(s, {
|
|
644
644
|
code: c.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
|
+
}) : d && l(s, {
|
|
651
651
|
code: c.too_small,
|
|
652
652
|
minimum: a.value,
|
|
653
653
|
type: "string",
|
|
@@ -656,43 +656,43 @@ class C extends _ {
|
|
|
656
656
|
message: a.message
|
|
657
657
|
}), n.dirty());
|
|
658
658
|
} else if (a.kind === "email")
|
|
659
|
-
|
|
659
|
+
st.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
660
660
|
validation: "email",
|
|
661
661
|
code: c.invalid_string,
|
|
662
662
|
message: a.message
|
|
663
663
|
}), n.dirty());
|
|
664
664
|
else if (a.kind === "emoji")
|
|
665
|
-
Te || (Te = new RegExp(
|
|
665
|
+
Te || (Te = new RegExp(at, "u")), Te.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
666
666
|
validation: "emoji",
|
|
667
667
|
code: c.invalid_string,
|
|
668
668
|
message: a.message
|
|
669
669
|
}), n.dirty());
|
|
670
670
|
else if (a.kind === "uuid")
|
|
671
|
-
|
|
671
|
+
et.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
672
672
|
validation: "uuid",
|
|
673
673
|
code: c.invalid_string,
|
|
674
674
|
message: a.message
|
|
675
675
|
}), n.dirty());
|
|
676
676
|
else if (a.kind === "nanoid")
|
|
677
|
-
|
|
677
|
+
tt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
678
678
|
validation: "nanoid",
|
|
679
679
|
code: c.invalid_string,
|
|
680
680
|
message: a.message
|
|
681
681
|
}), n.dirty());
|
|
682
682
|
else if (a.kind === "cuid")
|
|
683
|
-
|
|
683
|
+
Qe.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
684
684
|
validation: "cuid",
|
|
685
685
|
code: c.invalid_string,
|
|
686
686
|
message: a.message
|
|
687
687
|
}), n.dirty());
|
|
688
688
|
else if (a.kind === "cuid2")
|
|
689
|
-
|
|
689
|
+
Xe.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
690
690
|
validation: "cuid2",
|
|
691
691
|
code: c.invalid_string,
|
|
692
692
|
message: a.message
|
|
693
693
|
}), n.dirty());
|
|
694
694
|
else if (a.kind === "ulid")
|
|
695
|
-
|
|
695
|
+
Ke.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
696
696
|
validation: "ulid",
|
|
697
697
|
code: c.invalid_string,
|
|
698
698
|
message: a.message
|
|
@@ -723,39 +723,39 @@ class C extends _ {
|
|
|
723
723
|
code: c.invalid_string,
|
|
724
724
|
validation: { endsWith: a.value },
|
|
725
725
|
message: a.message
|
|
726
|
-
}), n.dirty()) : a.kind === "datetime" ?
|
|
726
|
+
}), n.dirty()) : a.kind === "datetime" ? Le(a).test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
727
727
|
code: c.invalid_string,
|
|
728
728
|
validation: "datetime",
|
|
729
729
|
message: a.message
|
|
730
|
-
}), n.dirty()) : a.kind === "date" ?
|
|
730
|
+
}), n.dirty()) : a.kind === "date" ? ft.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
731
731
|
code: c.invalid_string,
|
|
732
732
|
validation: "date",
|
|
733
733
|
message: a.message
|
|
734
|
-
}), n.dirty()) : a.kind === "time" ?
|
|
734
|
+
}), n.dirty()) : a.kind === "time" ? ht(a).test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
735
735
|
code: c.invalid_string,
|
|
736
736
|
validation: "time",
|
|
737
737
|
message: a.message
|
|
738
|
-
}), n.dirty()) : a.kind === "duration" ?
|
|
738
|
+
}), n.dirty()) : a.kind === "duration" ? nt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
739
739
|
validation: "duration",
|
|
740
740
|
code: c.invalid_string,
|
|
741
741
|
message: a.message
|
|
742
|
-
}), n.dirty()) : a.kind === "ip" ?
|
|
742
|
+
}), n.dirty()) : a.kind === "ip" ? mt(e.data, a.version) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
743
743
|
validation: "ip",
|
|
744
744
|
code: c.invalid_string,
|
|
745
745
|
message: a.message
|
|
746
|
-
}), n.dirty()) : a.kind === "jwt" ?
|
|
746
|
+
}), n.dirty()) : a.kind === "jwt" ? pt(e.data, a.alg) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
747
747
|
validation: "jwt",
|
|
748
748
|
code: c.invalid_string,
|
|
749
749
|
message: a.message
|
|
750
|
-
}), n.dirty()) : a.kind === "cidr" ?
|
|
750
|
+
}), n.dirty()) : a.kind === "cidr" ? yt(e.data, a.version) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
751
751
|
validation: "cidr",
|
|
752
752
|
code: c.invalid_string,
|
|
753
753
|
message: a.message
|
|
754
|
-
}), n.dirty()) : a.kind === "base64" ?
|
|
754
|
+
}), n.dirty()) : a.kind === "base64" ? ut.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
755
755
|
validation: "base64",
|
|
756
756
|
code: c.invalid_string,
|
|
757
757
|
message: a.message
|
|
758
|
-
}), n.dirty()) : a.kind === "base64url" ?
|
|
758
|
+
}), n.dirty()) : a.kind === "base64url" ? lt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
759
759
|
validation: "base64url",
|
|
760
760
|
code: c.invalid_string,
|
|
761
761
|
message: a.message
|
|
@@ -994,9 +994,9 @@ C.create = (r) => {
|
|
|
994
994
|
...v(r)
|
|
995
995
|
});
|
|
996
996
|
};
|
|
997
|
-
function
|
|
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(".", "")),
|
|
999
|
-
return a %
|
|
997
|
+
function gt(r, e) {
|
|
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(".", "")), o = parseInt(e.toFixed(s).replace(".", ""));
|
|
999
|
+
return a % o / Math.pow(10, s);
|
|
1000
1000
|
}
|
|
1001
1001
|
class $ extends _ {
|
|
1002
1002
|
constructor() {
|
|
@@ -1033,7 +1033,7 @@ class $ 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" ? gt(e.data, a.value) !== 0 && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
1037
1037
|
code: c.not_multiple_of,
|
|
1038
1038
|
multipleOf: a.value,
|
|
1039
1039
|
message: a.message
|
|
@@ -1316,7 +1316,7 @@ class te extends _ {
|
|
|
1316
1316
|
received: n.parsedType
|
|
1317
1317
|
}), g;
|
|
1318
1318
|
}
|
|
1319
|
-
return
|
|
1319
|
+
return S(e.data);
|
|
1320
1320
|
}
|
|
1321
1321
|
}
|
|
1322
1322
|
te.create = (r) => new te({
|
|
@@ -1412,7 +1412,7 @@ class ve extends _ {
|
|
|
1412
1412
|
received: n.parsedType
|
|
1413
1413
|
}), g;
|
|
1414
1414
|
}
|
|
1415
|
-
return
|
|
1415
|
+
return S(e.data);
|
|
1416
1416
|
}
|
|
1417
1417
|
}
|
|
1418
1418
|
ve.create = (r) => new ve({
|
|
@@ -1429,7 +1429,7 @@ class re extends _ {
|
|
|
1429
1429
|
received: n.parsedType
|
|
1430
1430
|
}), g;
|
|
1431
1431
|
}
|
|
1432
|
-
return
|
|
1432
|
+
return S(e.data);
|
|
1433
1433
|
}
|
|
1434
1434
|
}
|
|
1435
1435
|
re.create = (r) => new re({
|
|
@@ -1446,22 +1446,22 @@ class ne extends _ {
|
|
|
1446
1446
|
received: n.parsedType
|
|
1447
1447
|
}), g;
|
|
1448
1448
|
}
|
|
1449
|
-
return
|
|
1449
|
+
return S(e.data);
|
|
1450
1450
|
}
|
|
1451
1451
|
}
|
|
1452
1452
|
ne.create = (r) => new ne({
|
|
1453
1453
|
typeName: y.ZodNull,
|
|
1454
1454
|
...v(r)
|
|
1455
1455
|
});
|
|
1456
|
-
class
|
|
1456
|
+
class H extends _ {
|
|
1457
1457
|
constructor() {
|
|
1458
1458
|
super(...arguments), this._any = !0;
|
|
1459
1459
|
}
|
|
1460
1460
|
_parse(e) {
|
|
1461
|
-
return
|
|
1461
|
+
return S(e.data);
|
|
1462
1462
|
}
|
|
1463
1463
|
}
|
|
1464
|
-
|
|
1464
|
+
H.create = (r) => new H({
|
|
1465
1465
|
typeName: y.ZodAny,
|
|
1466
1466
|
...v(r)
|
|
1467
1467
|
});
|
|
@@ -1470,7 +1470,7 @@ class L extends _ {
|
|
|
1470
1470
|
super(...arguments), this._unknown = !0;
|
|
1471
1471
|
}
|
|
1472
1472
|
_parse(e) {
|
|
1473
|
-
return
|
|
1473
|
+
return S(e.data);
|
|
1474
1474
|
}
|
|
1475
1475
|
}
|
|
1476
1476
|
L.create = (r) => new L({
|
|
@@ -1501,14 +1501,14 @@ class _e extends _ {
|
|
|
1501
1501
|
received: n.parsedType
|
|
1502
1502
|
}), g;
|
|
1503
1503
|
}
|
|
1504
|
-
return
|
|
1504
|
+
return S(e.data);
|
|
1505
1505
|
}
|
|
1506
1506
|
}
|
|
1507
1507
|
_e.create = (r) => new _e({
|
|
1508
1508
|
typeName: y.ZodVoid,
|
|
1509
1509
|
...v(r)
|
|
1510
1510
|
});
|
|
1511
|
-
class
|
|
1511
|
+
class I 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,11 +1518,11 @@ class A extends _ {
|
|
|
1518
1518
|
received: t.parsedType
|
|
1519
1519
|
}), g;
|
|
1520
1520
|
if (s.exactLength !== null) {
|
|
1521
|
-
const
|
|
1522
|
-
(
|
|
1523
|
-
code:
|
|
1524
|
-
minimum:
|
|
1525
|
-
maximum:
|
|
1521
|
+
const o = t.data.length > s.exactLength.value, d = t.data.length < s.exactLength.value;
|
|
1522
|
+
(o || d) && (l(t, {
|
|
1523
|
+
code: o ? c.too_big : c.too_small,
|
|
1524
|
+
minimum: d ? s.exactLength.value : void 0,
|
|
1525
|
+
maximum: o ? s.exactLength.value : void 0,
|
|
1526
1526
|
type: "array",
|
|
1527
1527
|
inclusive: !0,
|
|
1528
1528
|
exact: !0,
|
|
@@ -1544,27 +1544,27 @@ class A 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((
|
|
1548
|
-
const a = [...t.data].map((
|
|
1547
|
+
return Promise.all([...t.data].map((o, d) => s.type._parseAsync(new O(t, o, t.path, d)))).then((o) => w.mergeArray(n, o));
|
|
1548
|
+
const a = [...t.data].map((o, d) => s.type._parseSync(new O(t, o, t.path, d)));
|
|
1549
1549
|
return w.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 I({
|
|
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 I({
|
|
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 I({
|
|
1568
1568
|
...this._def,
|
|
1569
1569
|
exactLength: { value: e, message: m.toString(t) }
|
|
1570
1570
|
});
|
|
@@ -1573,7 +1573,7 @@ class A extends _ {
|
|
|
1573
1573
|
return this.min(1, e);
|
|
1574
1574
|
}
|
|
1575
1575
|
}
|
|
1576
|
-
|
|
1576
|
+
I.create = (r, e) => new I({
|
|
1577
1577
|
type: r,
|
|
1578
1578
|
minLength: null,
|
|
1579
1579
|
maxLength: null,
|
|
@@ -1592,7 +1592,7 @@ function B(r) {
|
|
|
1592
1592
|
...r._def,
|
|
1593
1593
|
shape: () => e
|
|
1594
1594
|
});
|
|
1595
|
-
} else return r instanceof
|
|
1595
|
+
} else return r instanceof I ? new I({
|
|
1596
1596
|
...r._def,
|
|
1597
1597
|
type: B(r.element)
|
|
1598
1598
|
}) : r instanceof N ? N.create(B(r.unwrap())) : r instanceof D ? D.create(B(r.unwrap())) : r instanceof j ? j.create(r.items.map((e) => B(e))) : r;
|
|
@@ -1616,12 +1616,12 @@ class x extends _ {
|
|
|
1616
1616
|
received: u.parsedType
|
|
1617
1617
|
}), g;
|
|
1618
1618
|
}
|
|
1619
|
-
const { status: n, ctx: s } = this._processInputParams(e), { shape: a, keys:
|
|
1619
|
+
const { status: n, ctx: s } = this._processInputParams(e), { shape: a, keys: o } = this._getCached(), d = [];
|
|
1620
1620
|
if (!(this._def.catchall instanceof P && this._def.unknownKeys === "strip"))
|
|
1621
1621
|
for (const u in s.data)
|
|
1622
|
-
|
|
1622
|
+
o.includes(u) || d.push(u);
|
|
1623
1623
|
const f = [];
|
|
1624
|
-
for (const u of
|
|
1624
|
+
for (const u of o) {
|
|
1625
1625
|
const p = a[u], T = s.data[u];
|
|
1626
1626
|
f.push({
|
|
1627
1627
|
key: { status: "valid", value: u },
|
|
@@ -1632,20 +1632,20 @@ class x extends _ {
|
|
|
1632
1632
|
if (this._def.catchall instanceof P) {
|
|
1633
1633
|
const u = this._def.unknownKeys;
|
|
1634
1634
|
if (u === "passthrough")
|
|
1635
|
-
for (const p of
|
|
1635
|
+
for (const p of d)
|
|
1636
1636
|
f.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
|
+
d.length > 0 && (l(s, {
|
|
1642
1642
|
code: c.unrecognized_keys,
|
|
1643
|
-
keys:
|
|
1643
|
+
keys: d
|
|
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 d) {
|
|
1649
1649
|
const T = s.data[p];
|
|
1650
1650
|
f.push({
|
|
1651
1651
|
key: { status: "valid", value: p },
|
|
@@ -1679,10 +1679,10 @@ class x extends _ {
|
|
|
1679
1679
|
unknownKeys: "strict",
|
|
1680
1680
|
...e !== void 0 ? {
|
|
1681
1681
|
errorMap: (t, n) => {
|
|
1682
|
-
var s, a,
|
|
1683
|
-
const f = (
|
|
1682
|
+
var s, a, o, d;
|
|
1683
|
+
const f = (o = (a = (s = this._def).errorMap) === null || a === void 0 ? void 0 : a.call(s, t, n).message) !== null && o !== void 0 ? o : n.defaultError;
|
|
1684
1684
|
return t.code === "unrecognized_keys" ? {
|
|
1685
|
-
message: (
|
|
1685
|
+
message: (d = m.errToObj(e).message) !== null && d !== void 0 ? d : f
|
|
1686
1686
|
} : {
|
|
1687
1687
|
message: f
|
|
1688
1688
|
};
|
|
@@ -1860,7 +1860,7 @@ class x extends _ {
|
|
|
1860
1860
|
});
|
|
1861
1861
|
}
|
|
1862
1862
|
keyof() {
|
|
1863
|
-
return
|
|
1863
|
+
return ze(b.objectKeys(this.shape));
|
|
1864
1864
|
}
|
|
1865
1865
|
}
|
|
1866
1866
|
x.create = (r, e) => new x({
|
|
@@ -1888,21 +1888,21 @@ class se 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
|
|
1891
|
+
for (const d of a)
|
|
1892
|
+
if (d.result.status === "valid")
|
|
1893
|
+
return d.result;
|
|
1894
|
+
for (const d of a)
|
|
1895
|
+
if (d.result.status === "dirty")
|
|
1896
|
+
return t.common.issues.push(...d.ctx.common.issues), d.result;
|
|
1897
|
+
const o = a.map((d) => new Z(d.ctx.common.issues));
|
|
1898
1898
|
return l(t, {
|
|
1899
1899
|
code: c.invalid_union,
|
|
1900
|
-
unionErrors:
|
|
1900
|
+
unionErrors: o
|
|
1901
1901
|
}), g;
|
|
1902
1902
|
}
|
|
1903
1903
|
if (t.common.async)
|
|
1904
1904
|
return Promise.all(n.map(async (a) => {
|
|
1905
|
-
const
|
|
1905
|
+
const o = {
|
|
1906
1906
|
...t,
|
|
1907
1907
|
common: {
|
|
1908
1908
|
...t.common,
|
|
@@ -1914,14 +1914,14 @@ class se extends _ {
|
|
|
1914
1914
|
result: await a._parseAsync({
|
|
1915
1915
|
data: t.data,
|
|
1916
1916
|
path: t.path,
|
|
1917
|
-
parent:
|
|
1917
|
+
parent: o
|
|
1918
1918
|
}),
|
|
1919
|
-
ctx:
|
|
1919
|
+
ctx: o
|
|
1920
1920
|
};
|
|
1921
1921
|
})).then(s);
|
|
1922
1922
|
{
|
|
1923
1923
|
let a;
|
|
1924
|
-
const
|
|
1924
|
+
const o = [];
|
|
1925
1925
|
for (const f of n) {
|
|
1926
1926
|
const u = {
|
|
1927
1927
|
...t,
|
|
@@ -1937,14 +1937,14 @@ class se extends _ {
|
|
|
1937
1937
|
});
|
|
1938
1938
|
if (p.status === "valid")
|
|
1939
1939
|
return p;
|
|
1940
|
-
p.status === "dirty" && !a && (a = { result: p, ctx: u }), u.common.issues.length &&
|
|
1940
|
+
p.status === "dirty" && !a && (a = { result: p, ctx: u }), u.common.issues.length && o.push(u.common.issues);
|
|
1941
1941
|
}
|
|
1942
1942
|
if (a)
|
|
1943
1943
|
return t.common.issues.push(...a.ctx.common.issues), a.result;
|
|
1944
|
-
const
|
|
1944
|
+
const d = o.map((f) => new Z(f));
|
|
1945
1945
|
return l(t, {
|
|
1946
1946
|
code: c.invalid_union,
|
|
1947
|
-
unionErrors:
|
|
1947
|
+
unionErrors: d
|
|
1948
1948
|
}), g;
|
|
1949
1949
|
}
|
|
1950
1950
|
}
|
|
@@ -1957,7 +1957,7 @@ se.create = (r, e) => new se({
|
|
|
1957
1957
|
typeName: y.ZodUnion,
|
|
1958
1958
|
...v(e)
|
|
1959
1959
|
});
|
|
1960
|
-
const E = (r) => r instanceof oe ? E(r.schema) : r instanceof
|
|
1960
|
+
const E = (r) => r instanceof oe ? E(r.schema) : r instanceof A ? E(r.innerType()) : r instanceof de ? [r.value] : r instanceof V ? r.options : r instanceof ce ? b.objectValues(r.enum) : r instanceof ue ? E(r._def.innerType) : r instanceof re ? [void 0] : r instanceof ne ? [null] : r instanceof N ? [void 0, ...E(r.unwrap())] : r instanceof D ? [null, ...E(r.unwrap())] : r instanceof Ne || r instanceof fe ? E(r.unwrap()) : r instanceof le ? E(r._def.innerType) : [];
|
|
1961
1961
|
class ke extends _ {
|
|
1962
1962
|
_parse(e) {
|
|
1963
1963
|
const { ctx: t } = this._processInputParams(e);
|
|
@@ -2002,13 +2002,13 @@ class ke extends _ {
|
|
|
2002
2002
|
static create(e, t, n) {
|
|
2003
2003
|
const s = /* @__PURE__ */ new Map();
|
|
2004
2004
|
for (const a of t) {
|
|
2005
|
-
const
|
|
2006
|
-
if (!
|
|
2005
|
+
const o = E(a.shape[e]);
|
|
2006
|
+
if (!o.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 d of o) {
|
|
2009
|
+
if (s.has(d))
|
|
2010
|
+
throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(d)}`);
|
|
2011
|
+
s.set(d, a);
|
|
2012
2012
|
}
|
|
2013
2013
|
}
|
|
2014
2014
|
return new ke({
|
|
@@ -2025,20 +2025,20 @@ function Ae(r, 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 f = Ae(r[
|
|
2028
|
+
const s = b.objectKeys(e), a = b.objectKeys(r).filter((d) => s.indexOf(d) !== -1), o = { ...r, ...e };
|
|
2029
|
+
for (const d of a) {
|
|
2030
|
+
const f = Ae(r[d], e[d]);
|
|
2031
2031
|
if (!f.valid)
|
|
2032
2032
|
return { valid: !1 };
|
|
2033
|
-
|
|
2033
|
+
o[d] = f.data;
|
|
2034
2034
|
}
|
|
2035
|
-
return { valid: !0, data:
|
|
2035
|
+
return { valid: !0, data: o };
|
|
2036
2036
|
} else if (t === h.array && n === h.array) {
|
|
2037
2037
|
if (r.length !== e.length)
|
|
2038
2038
|
return { valid: !1 };
|
|
2039
2039
|
const s = [];
|
|
2040
2040
|
for (let a = 0; a < r.length; a++) {
|
|
2041
|
-
const
|
|
2041
|
+
const o = r[a], d = e[a], f = Ae(o, d);
|
|
2042
2042
|
if (!f.valid)
|
|
2043
2043
|
return { valid: !1 };
|
|
2044
2044
|
s.push(f.data);
|
|
@@ -2048,11 +2048,11 @@ function Ae(r, e) {
|
|
|
2048
2048
|
}
|
|
2049
2049
|
class ae extends _ {
|
|
2050
2050
|
_parse(e) {
|
|
2051
|
-
const { status: t, ctx: n } = this._processInputParams(e), s = (a,
|
|
2052
|
-
if (
|
|
2051
|
+
const { status: t, ctx: n } = this._processInputParams(e), s = (a, o) => {
|
|
2052
|
+
if (Ce(a) || Ce(o))
|
|
2053
2053
|
return g;
|
|
2054
|
-
const
|
|
2055
|
-
return
|
|
2054
|
+
const d = Ae(a.value, o.value);
|
|
2055
|
+
return d.valid ? ((Ie(a) || Ie(o)) && t.dirty(), { status: t.value, value: d.data }) : (l(n, {
|
|
2056
2056
|
code: c.invalid_intersection_types
|
|
2057
2057
|
}), g);
|
|
2058
2058
|
};
|
|
@@ -2067,7 +2067,7 @@ class ae extends _ {
|
|
|
2067
2067
|
path: n.path,
|
|
2068
2068
|
parent: n
|
|
2069
2069
|
})
|
|
2070
|
-
]).then(([a,
|
|
2070
|
+
]).then(([a, o]) => s(a, o)) : s(this._def.left._parseSync({
|
|
2071
2071
|
data: n.data,
|
|
2072
2072
|
path: n.path,
|
|
2073
2073
|
parent: n
|
|
@@ -2108,11 +2108,11 @@ class j extends _ {
|
|
|
2108
2108
|
exact: !1,
|
|
2109
2109
|
type: "array"
|
|
2110
2110
|
}), t.dirty());
|
|
2111
|
-
const a = [...n.data].map((
|
|
2112
|
-
const f = this._def.items[
|
|
2113
|
-
return f ? f._parse(new O(n,
|
|
2114
|
-
}).filter((
|
|
2115
|
-
return n.common.async ? Promise.all(a).then((
|
|
2111
|
+
const a = [...n.data].map((o, d) => {
|
|
2112
|
+
const f = this._def.items[d] || this._def.rest;
|
|
2113
|
+
return f ? f._parse(new O(n, o, n.path, d)) : null;
|
|
2114
|
+
}).filter((o) => !!o);
|
|
2115
|
+
return n.common.async ? Promise.all(a).then((o) => w.mergeArray(t, o)) : w.mergeArray(t, a);
|
|
2116
2116
|
}
|
|
2117
2117
|
get items() {
|
|
2118
2118
|
return this._def.items;
|
|
@@ -2149,12 +2149,12 @@ class ie extends _ {
|
|
|
2149
2149
|
expected: h.object,
|
|
2150
2150
|
received: n.parsedType
|
|
2151
2151
|
}), g;
|
|
2152
|
-
const s = [], a = this._def.keyType,
|
|
2153
|
-
for (const
|
|
2152
|
+
const s = [], a = this._def.keyType, o = this._def.valueType;
|
|
2153
|
+
for (const d in n.data)
|
|
2154
2154
|
s.push({
|
|
2155
|
-
key: a._parse(new O(n,
|
|
2156
|
-
value:
|
|
2157
|
-
alwaysSet:
|
|
2155
|
+
key: a._parse(new O(n, d, n.path, d)),
|
|
2156
|
+
value: o._parse(new O(n, n.data[d], n.path, d)),
|
|
2157
|
+
alwaysSet: d in n.data
|
|
2158
2158
|
});
|
|
2159
2159
|
return n.common.async ? w.mergeObjectAsync(t, s) : w.mergeObjectSync(t, s);
|
|
2160
2160
|
}
|
|
@@ -2190,30 +2190,30 @@ class be extends _ {
|
|
|
2190
2190
|
expected: h.map,
|
|
2191
2191
|
received: n.parsedType
|
|
2192
2192
|
}), g;
|
|
2193
|
-
const s = this._def.keyType, a = this._def.valueType,
|
|
2194
|
-
key: s._parse(new O(n,
|
|
2193
|
+
const s = this._def.keyType, a = this._def.valueType, o = [...n.data.entries()].map(([d, f], u) => ({
|
|
2194
|
+
key: s._parse(new O(n, d, n.path, [u, "key"])),
|
|
2195
2195
|
value: a._parse(new O(n, f, n.path, [u, "value"]))
|
|
2196
2196
|
}));
|
|
2197
2197
|
if (n.common.async) {
|
|
2198
|
-
const
|
|
2198
|
+
const d = /* @__PURE__ */ new Map();
|
|
2199
2199
|
return Promise.resolve().then(async () => {
|
|
2200
|
-
for (const f of
|
|
2200
|
+
for (const f of o) {
|
|
2201
2201
|
const u = await f.key, p = await f.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(), d.set(u.value, p.value);
|
|
2205
2205
|
}
|
|
2206
|
-
return { status: t.value, value:
|
|
2206
|
+
return { status: t.value, value: d };
|
|
2207
2207
|
});
|
|
2208
2208
|
} else {
|
|
2209
|
-
const
|
|
2210
|
-
for (const f of
|
|
2209
|
+
const d = /* @__PURE__ */ new Map();
|
|
2210
|
+
for (const f of o) {
|
|
2211
2211
|
const u = f.key, p = f.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(), d.set(u.value, p.value);
|
|
2215
2215
|
}
|
|
2216
|
-
return { status: t.value, value:
|
|
2216
|
+
return { status: t.value, value: d };
|
|
2217
2217
|
}
|
|
2218
2218
|
}
|
|
2219
2219
|
}
|
|
@@ -2249,7 +2249,7 @@ class F extends _ {
|
|
|
2249
2249
|
message: s.maxSize.message
|
|
2250
2250
|
}), t.dirty());
|
|
2251
2251
|
const a = this._def.valueType;
|
|
2252
|
-
function
|
|
2252
|
+
function o(f) {
|
|
2253
2253
|
const u = /* @__PURE__ */ new Set();
|
|
2254
2254
|
for (const p of f) {
|
|
2255
2255
|
if (p.status === "aborted")
|
|
@@ -2258,8 +2258,8 @@ class F extends _ {
|
|
|
2258
2258
|
}
|
|
2259
2259
|
return { status: t.value, value: u };
|
|
2260
2260
|
}
|
|
2261
|
-
const
|
|
2262
|
-
return n.common.async ? Promise.all(
|
|
2261
|
+
const d = [...n.data.values()].map((f, u) => a._parse(new O(n, f, n.path, u)));
|
|
2262
|
+
return n.common.async ? Promise.all(d).then((f) => o(f)) : o(d);
|
|
2263
2263
|
}
|
|
2264
2264
|
min(e, t) {
|
|
2265
2265
|
return new F({
|
|
@@ -2299,15 +2299,15 @@ class q extends _ {
|
|
|
2299
2299
|
expected: h.function,
|
|
2300
2300
|
received: t.parsedType
|
|
2301
2301
|
}), g;
|
|
2302
|
-
function n(
|
|
2302
|
+
function n(d, f) {
|
|
2303
2303
|
return ye({
|
|
2304
|
-
data:
|
|
2304
|
+
data: d,
|
|
2305
2305
|
path: t.path,
|
|
2306
2306
|
errorMaps: [
|
|
2307
2307
|
t.common.contextualErrorMap,
|
|
2308
2308
|
t.schemaErrorMap,
|
|
2309
2309
|
pe(),
|
|
2310
|
-
|
|
2310
|
+
Y
|
|
2311
2311
|
].filter((u) => !!u),
|
|
2312
2312
|
issueData: {
|
|
2313
2313
|
code: c.invalid_arguments,
|
|
@@ -2315,15 +2315,15 @@ class q extends _ {
|
|
|
2315
2315
|
}
|
|
2316
2316
|
});
|
|
2317
2317
|
}
|
|
2318
|
-
function s(
|
|
2318
|
+
function s(d, f) {
|
|
2319
2319
|
return ye({
|
|
2320
|
-
data:
|
|
2320
|
+
data: d,
|
|
2321
2321
|
path: t.path,
|
|
2322
2322
|
errorMaps: [
|
|
2323
2323
|
t.common.contextualErrorMap,
|
|
2324
2324
|
t.schemaErrorMap,
|
|
2325
2325
|
pe(),
|
|
2326
|
-
|
|
2326
|
+
Y
|
|
2327
2327
|
].filter((u) => !!u),
|
|
2328
2328
|
issueData: {
|
|
2329
2329
|
code: c.invalid_return_type,
|
|
@@ -2331,26 +2331,26 @@ class q extends _ {
|
|
|
2331
2331
|
}
|
|
2332
2332
|
});
|
|
2333
2333
|
}
|
|
2334
|
-
const a = { errorMap: t.common.contextualErrorMap },
|
|
2335
|
-
if (this._def.returns instanceof
|
|
2336
|
-
const
|
|
2337
|
-
return
|
|
2338
|
-
const u = new
|
|
2334
|
+
const a = { errorMap: t.common.contextualErrorMap }, o = t.data;
|
|
2335
|
+
if (this._def.returns instanceof G) {
|
|
2336
|
+
const d = this;
|
|
2337
|
+
return S(async function(...f) {
|
|
2338
|
+
const u = new Z([]), p = await d._def.args.parseAsync(f, a).catch((we) => {
|
|
2339
2339
|
throw u.addIssue(n(f, we)), u;
|
|
2340
|
-
}), T = await Reflect.apply(
|
|
2341
|
-
return await
|
|
2340
|
+
}), T = await Reflect.apply(o, this, p);
|
|
2341
|
+
return await d._def.returns._def.type.parseAsync(T, a).catch((we) => {
|
|
2342
2342
|
throw u.addIssue(s(T, we)), u;
|
|
2343
2343
|
});
|
|
2344
2344
|
});
|
|
2345
2345
|
} else {
|
|
2346
|
-
const
|
|
2347
|
-
return
|
|
2348
|
-
const u =
|
|
2346
|
+
const d = this;
|
|
2347
|
+
return S(function(...f) {
|
|
2348
|
+
const u = d._def.args.safeParse(f, a);
|
|
2349
2349
|
if (!u.success)
|
|
2350
|
-
throw new
|
|
2351
|
-
const p = Reflect.apply(
|
|
2350
|
+
throw new Z([n(f, u.error)]);
|
|
2351
|
+
const p = Reflect.apply(o, this, u.data), T = d._def.returns.safeParse(p, a);
|
|
2352
2352
|
if (!T.success)
|
|
2353
|
-
throw new
|
|
2353
|
+
throw new Z([s(p, T.error)]);
|
|
2354
2354
|
return T.data;
|
|
2355
2355
|
});
|
|
2356
2356
|
}
|
|
@@ -2423,7 +2423,7 @@ de.create = (r, e) => new de({
|
|
|
2423
2423
|
typeName: y.ZodLiteral,
|
|
2424
2424
|
...v(e)
|
|
2425
2425
|
});
|
|
2426
|
-
function
|
|
2426
|
+
function ze(r, e) {
|
|
2427
2427
|
return new V({
|
|
2428
2428
|
values: r,
|
|
2429
2429
|
typeName: y.ZodEnum,
|
|
@@ -2432,7 +2432,7 @@ function Le(r, e) {
|
|
|
2432
2432
|
}
|
|
2433
2433
|
class V extends _ {
|
|
2434
2434
|
constructor() {
|
|
2435
|
-
super(...arguments),
|
|
2435
|
+
super(...arguments), X.set(this, void 0);
|
|
2436
2436
|
}
|
|
2437
2437
|
_parse(e) {
|
|
2438
2438
|
if (typeof e.data != "string") {
|
|
@@ -2443,7 +2443,7 @@ class V extends _ {
|
|
|
2443
2443
|
code: c.invalid_type
|
|
2444
2444
|
}), g;
|
|
2445
2445
|
}
|
|
2446
|
-
if (ge(this,
|
|
2446
|
+
if (ge(this, X) || Me(this, X, new Set(this._def.values)), !ge(this, X).has(e.data)) {
|
|
2447
2447
|
const t = this._getOrReturnCtx(e), n = this._def.values;
|
|
2448
2448
|
return l(t, {
|
|
2449
2449
|
received: t.data,
|
|
@@ -2451,7 +2451,7 @@ class V extends _ {
|
|
|
2451
2451
|
options: n
|
|
2452
2452
|
}), g;
|
|
2453
2453
|
}
|
|
2454
|
-
return
|
|
2454
|
+
return S(e.data);
|
|
2455
2455
|
}
|
|
2456
2456
|
get options() {
|
|
2457
2457
|
return this._def.values;
|
|
@@ -2487,11 +2487,11 @@ class V extends _ {
|
|
|
2487
2487
|
});
|
|
2488
2488
|
}
|
|
2489
2489
|
}
|
|
2490
|
-
|
|
2491
|
-
V.create =
|
|
2490
|
+
X = /* @__PURE__ */ new WeakMap();
|
|
2491
|
+
V.create = ze;
|
|
2492
2492
|
class ce extends _ {
|
|
2493
2493
|
constructor() {
|
|
2494
|
-
super(...arguments),
|
|
2494
|
+
super(...arguments), K.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 ce extends _ {
|
|
|
2503
2503
|
code: c.invalid_type
|
|
2504
2504
|
}), g;
|
|
2505
2505
|
}
|
|
2506
|
-
if (ge(this,
|
|
2506
|
+
if (ge(this, K) || Me(this, K, new Set(b.getValidEnumValues(this._def.values))), !ge(this, K).has(e.data)) {
|
|
2507
2507
|
const s = b.objectValues(t);
|
|
2508
2508
|
return l(n, {
|
|
2509
2509
|
received: n.data,
|
|
@@ -2511,19 +2511,19 @@ class ce extends _ {
|
|
|
2511
2511
|
options: s
|
|
2512
2512
|
}), g;
|
|
2513
2513
|
}
|
|
2514
|
-
return
|
|
2514
|
+
return S(e.data);
|
|
2515
2515
|
}
|
|
2516
2516
|
get enum() {
|
|
2517
2517
|
return this._def.values;
|
|
2518
2518
|
}
|
|
2519
2519
|
}
|
|
2520
|
-
|
|
2520
|
+
K = /* @__PURE__ */ new WeakMap();
|
|
2521
2521
|
ce.create = (r, e) => new ce({
|
|
2522
2522
|
values: r,
|
|
2523
2523
|
typeName: y.ZodNativeEnum,
|
|
2524
2524
|
...v(e)
|
|
2525
2525
|
});
|
|
2526
|
-
class
|
|
2526
|
+
class G extends _ {
|
|
2527
2527
|
unwrap() {
|
|
2528
2528
|
return this._def.type;
|
|
2529
2529
|
}
|
|
@@ -2536,18 +2536,18 @@ class H 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 S(n.then((s) => this._def.type.parseAsync(s, {
|
|
2540
2540
|
path: t.path,
|
|
2541
2541
|
errorMap: t.common.contextualErrorMap
|
|
2542
2542
|
})));
|
|
2543
2543
|
}
|
|
2544
2544
|
}
|
|
2545
|
-
|
|
2545
|
+
G.create = (r, e) => new G({
|
|
2546
2546
|
type: r,
|
|
2547
2547
|
typeName: y.ZodPromise,
|
|
2548
2548
|
...v(e)
|
|
2549
2549
|
});
|
|
2550
|
-
class
|
|
2550
|
+
class A extends _ {
|
|
2551
2551
|
innerType() {
|
|
2552
2552
|
return this._def.schema;
|
|
2553
2553
|
}
|
|
@@ -2556,21 +2556,21 @@ class I extends _ {
|
|
|
2556
2556
|
}
|
|
2557
2557
|
_parse(e) {
|
|
2558
2558
|
const { status: t, ctx: n } = this._processInputParams(e), s = this._def.effect || null, a = {
|
|
2559
|
-
addIssue: (
|
|
2560
|
-
l(n,
|
|
2559
|
+
addIssue: (o) => {
|
|
2560
|
+
l(n, o), o.fatal ? t.abort() : t.dirty();
|
|
2561
2561
|
},
|
|
2562
2562
|
get path() {
|
|
2563
2563
|
return n.path;
|
|
2564
2564
|
}
|
|
2565
2565
|
};
|
|
2566
2566
|
if (a.addIssue = a.addIssue.bind(a), s.type === "preprocess") {
|
|
2567
|
-
const
|
|
2567
|
+
const o = s.transform(n.data, a);
|
|
2568
2568
|
if (n.common.async)
|
|
2569
|
-
return Promise.resolve(
|
|
2569
|
+
return Promise.resolve(o).then(async (d) => {
|
|
2570
2570
|
if (t.value === "aborted")
|
|
2571
2571
|
return g;
|
|
2572
2572
|
const f = await this._def.schema._parseAsync({
|
|
2573
|
-
data:
|
|
2573
|
+
data: d,
|
|
2574
2574
|
path: n.path,
|
|
2575
2575
|
parent: n
|
|
2576
2576
|
});
|
|
@@ -2579,58 +2579,58 @@ class I extends _ {
|
|
|
2579
2579
|
{
|
|
2580
2580
|
if (t.value === "aborted")
|
|
2581
2581
|
return g;
|
|
2582
|
-
const
|
|
2583
|
-
data:
|
|
2582
|
+
const d = this._def.schema._parseSync({
|
|
2583
|
+
data: o,
|
|
2584
2584
|
path: n.path,
|
|
2585
2585
|
parent: n
|
|
2586
2586
|
});
|
|
2587
|
-
return
|
|
2587
|
+
return d.status === "aborted" ? g : d.status === "dirty" || t.value === "dirty" ? W(d.value) : d;
|
|
2588
2588
|
}
|
|
2589
2589
|
}
|
|
2590
2590
|
if (s.type === "refinement") {
|
|
2591
|
-
const
|
|
2592
|
-
const f = s.refinement(
|
|
2591
|
+
const o = (d) => {
|
|
2592
|
+
const f = s.refinement(d, a);
|
|
2593
2593
|
if (n.common.async)
|
|
2594
2594
|
return Promise.resolve(f);
|
|
2595
2595
|
if (f instanceof Promise)
|
|
2596
2596
|
throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2597
|
-
return
|
|
2597
|
+
return d;
|
|
2598
2598
|
};
|
|
2599
2599
|
if (n.common.async === !1) {
|
|
2600
|
-
const
|
|
2600
|
+
const d = this._def.schema._parseSync({
|
|
2601
2601
|
data: n.data,
|
|
2602
2602
|
path: n.path,
|
|
2603
2603
|
parent: n
|
|
2604
2604
|
});
|
|
2605
|
-
return
|
|
2605
|
+
return d.status === "aborted" ? g : (d.status === "dirty" && t.dirty(), o(d.value), { status: t.value, value: d.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((d) => d.status === "aborted" ? g : (d.status === "dirty" && t.dirty(), o(d.value).then(() => ({ status: t.value, value: d.value }))));
|
|
2608
2608
|
}
|
|
2609
2609
|
if (s.type === "transform")
|
|
2610
2610
|
if (n.common.async === !1) {
|
|
2611
|
-
const
|
|
2611
|
+
const o = this._def.schema._parseSync({
|
|
2612
2612
|
data: n.data,
|
|
2613
2613
|
path: n.path,
|
|
2614
2614
|
parent: n
|
|
2615
2615
|
});
|
|
2616
|
-
if (!z(
|
|
2617
|
-
return
|
|
2618
|
-
const
|
|
2619
|
-
if (
|
|
2616
|
+
if (!z(o))
|
|
2617
|
+
return o;
|
|
2618
|
+
const d = s.transform(o.value, a);
|
|
2619
|
+
if (d 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: d };
|
|
2622
2622
|
} else
|
|
2623
|
-
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((
|
|
2623
|
+
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((o) => z(o) ? Promise.resolve(s.transform(o.value, a)).then((d) => ({ status: t.value, value: d })) : o);
|
|
2624
2624
|
b.assertNever(s);
|
|
2625
2625
|
}
|
|
2626
2626
|
}
|
|
2627
|
-
|
|
2627
|
+
A.create = (r, e, t) => new A({
|
|
2628
2628
|
schema: r,
|
|
2629
2629
|
typeName: y.ZodEffects,
|
|
2630
2630
|
effect: e,
|
|
2631
2631
|
...v(t)
|
|
2632
2632
|
});
|
|
2633
|
-
|
|
2633
|
+
A.createWithPreprocess = (r, e, t) => new A({
|
|
2634
2634
|
schema: e,
|
|
2635
2635
|
effect: { type: "preprocess", transform: r },
|
|
2636
2636
|
typeName: y.ZodEffects,
|
|
@@ -2638,7 +2638,7 @@ I.createWithPreprocess = (r, e, t) => new I({
|
|
|
2638
2638
|
});
|
|
2639
2639
|
class N extends _ {
|
|
2640
2640
|
_parse(e) {
|
|
2641
|
-
return this._getType(e) === h.undefined ?
|
|
2641
|
+
return this._getType(e) === h.undefined ? S(void 0) : this._def.innerType._parse(e);
|
|
2642
2642
|
}
|
|
2643
2643
|
unwrap() {
|
|
2644
2644
|
return this._def.innerType;
|
|
@@ -2651,7 +2651,7 @@ N.create = (r, e) => new N({
|
|
|
2651
2651
|
});
|
|
2652
2652
|
class D extends _ {
|
|
2653
2653
|
_parse(e) {
|
|
2654
|
-
return this._getType(e) === h.null ?
|
|
2654
|
+
return this._getType(e) === h.null ? S(null) : this._def.innerType._parse(e);
|
|
2655
2655
|
}
|
|
2656
2656
|
unwrap() {
|
|
2657
2657
|
return this._def.innerType;
|
|
@@ -2701,7 +2701,7 @@ class le extends _ {
|
|
|
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 Z(n.common.issues);
|
|
2705
2705
|
},
|
|
2706
2706
|
input: n.data
|
|
2707
2707
|
})
|
|
@@ -2709,7 +2709,7 @@ class le 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 Z(n.common.issues);
|
|
2713
2713
|
},
|
|
2714
2714
|
input: n.data
|
|
2715
2715
|
})
|
|
@@ -2742,8 +2742,8 @@ xe.create = (r) => new xe({
|
|
|
2742
2742
|
typeName: y.ZodNaN,
|
|
2743
2743
|
...v(r)
|
|
2744
2744
|
});
|
|
2745
|
-
const
|
|
2746
|
-
class
|
|
2745
|
+
const vt = Symbol("zod_brand");
|
|
2746
|
+
class Ne extends _ {
|
|
2747
2747
|
_parse(e) {
|
|
2748
2748
|
const { ctx: t } = this._processInputParams(e), n = t.data;
|
|
2749
2749
|
return this._def.type._parse({
|
|
@@ -2810,38 +2810,38 @@ fe.create = (r, e) => new fe({
|
|
|
2810
2810
|
typeName: y.ZodReadonly,
|
|
2811
2811
|
...v(e)
|
|
2812
2812
|
});
|
|
2813
|
-
function
|
|
2813
|
+
function Re(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
|
|
2818
|
-
return r ?
|
|
2819
|
-
var a,
|
|
2820
|
-
const
|
|
2821
|
-
if (
|
|
2822
|
-
return
|
|
2817
|
+
function Ue(r, e = {}, t) {
|
|
2818
|
+
return r ? H.create().superRefine((n, s) => {
|
|
2819
|
+
var a, o;
|
|
2820
|
+
const d = r(n);
|
|
2821
|
+
if (d instanceof Promise)
|
|
2822
|
+
return d.then((f) => {
|
|
2823
2823
|
var u, p;
|
|
2824
2824
|
if (!f) {
|
|
2825
|
-
const T =
|
|
2825
|
+
const T = Re(e, n), me = (p = (u = T.fatal) !== null && u !== void 0 ? u : t) !== null && p !== void 0 ? p : !0;
|
|
2826
2826
|
s.addIssue({ code: "custom", ...T, fatal: me });
|
|
2827
2827
|
}
|
|
2828
2828
|
});
|
|
2829
|
-
if (!
|
|
2830
|
-
const f =
|
|
2829
|
+
if (!d) {
|
|
2830
|
+
const f = Re(e, n), u = (o = (a = f.fatal) !== null && a !== void 0 ? a : t) !== null && o !== void 0 ? o : !0;
|
|
2831
2831
|
s.addIssue({ code: "custom", ...f, fatal: u });
|
|
2832
2832
|
}
|
|
2833
|
-
}) :
|
|
2833
|
+
}) : H.create();
|
|
2834
2834
|
}
|
|
2835
|
-
const
|
|
2835
|
+
const _t = {
|
|
2836
2836
|
object: x.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 bt = (r, e = {
|
|
2843
2843
|
message: `Input not instance of ${r.name}`
|
|
2844
|
-
}) =>
|
|
2844
|
+
}) => Ue((t) => t instanceof r, e), Fe = C.create, Be = $.create, xt = xe.create, kt = M.create, We = te.create, wt = U.create, Tt = ve.create, St = re.create, Zt = ne.create, Ct = H.create, It = L.create, At = P.create, Nt = _e.create, Ot = I.create, jt = x.create, Et = x.strictCreate, Rt = se.create, Pt = ke.create, $t = ae.create, Mt = j.create, Vt = ie.create, Dt = be.create, Lt = F.create, zt = q.create, Ut = oe.create, Ft = de.create, Bt = V.create, Wt = ce.create, qt = G.create, Pe = A.create, Jt = N.create, Yt = D.create, Ht = A.createWithPreprocess, Gt = he.create, Qt = () => Fe().optional(), Xt = () => Be().optional(), Kt = () => We().optional(), er = {
|
|
2845
2845
|
string: (r) => C.create({ ...r, coerce: !0 }),
|
|
2846
2846
|
number: (r) => $.create({ ...r, coerce: !0 }),
|
|
2847
2847
|
boolean: (r) => te.create({
|
|
@@ -2850,21 +2850,21 @@ const vt = (r, e = {
|
|
|
2850
2850
|
}),
|
|
2851
2851
|
bigint: (r) => M.create({ ...r, coerce: !0 }),
|
|
2852
2852
|
date: (r) => U.create({ ...r, coerce: !0 })
|
|
2853
|
-
},
|
|
2854
|
-
var
|
|
2853
|
+
}, tr = g;
|
|
2854
|
+
var i = /* @__PURE__ */ Object.freeze({
|
|
2855
2855
|
__proto__: null,
|
|
2856
|
-
defaultErrorMap:
|
|
2857
|
-
setErrorMap:
|
|
2856
|
+
defaultErrorMap: Y,
|
|
2857
|
+
setErrorMap: He,
|
|
2858
2858
|
getErrorMap: pe,
|
|
2859
2859
|
makeIssue: ye,
|
|
2860
|
-
EMPTY_PATH:
|
|
2860
|
+
EMPTY_PATH: Ge,
|
|
2861
2861
|
addIssueToContext: l,
|
|
2862
2862
|
ParseStatus: w,
|
|
2863
2863
|
INVALID: g,
|
|
2864
2864
|
DIRTY: W,
|
|
2865
|
-
OK:
|
|
2866
|
-
isAborted:
|
|
2867
|
-
isDirty:
|
|
2865
|
+
OK: S,
|
|
2866
|
+
isAborted: Ce,
|
|
2867
|
+
isDirty: Ie,
|
|
2868
2868
|
isValid: z,
|
|
2869
2869
|
isAsync: ee,
|
|
2870
2870
|
get util() {
|
|
@@ -2876,7 +2876,7 @@ var d = /* @__PURE__ */ Object.freeze({
|
|
|
2876
2876
|
ZodParsedType: h,
|
|
2877
2877
|
getParsedType: R,
|
|
2878
2878
|
ZodType: _,
|
|
2879
|
-
datetimeRegex:
|
|
2879
|
+
datetimeRegex: Le,
|
|
2880
2880
|
ZodString: C,
|
|
2881
2881
|
ZodNumber: $,
|
|
2882
2882
|
ZodBigInt: M,
|
|
@@ -2885,11 +2885,11 @@ var d = /* @__PURE__ */ Object.freeze({
|
|
|
2885
2885
|
ZodSymbol: ve,
|
|
2886
2886
|
ZodUndefined: re,
|
|
2887
2887
|
ZodNull: ne,
|
|
2888
|
-
ZodAny:
|
|
2888
|
+
ZodAny: H,
|
|
2889
2889
|
ZodUnknown: L,
|
|
2890
2890
|
ZodNever: P,
|
|
2891
2891
|
ZodVoid: _e,
|
|
2892
|
-
ZodArray:
|
|
2892
|
+
ZodArray: I,
|
|
2893
2893
|
ZodObject: x,
|
|
2894
2894
|
ZodUnion: se,
|
|
2895
2895
|
ZodDiscriminatedUnion: ke,
|
|
@@ -2903,71 +2903,71 @@ var d = /* @__PURE__ */ Object.freeze({
|
|
|
2903
2903
|
ZodLiteral: de,
|
|
2904
2904
|
ZodEnum: V,
|
|
2905
2905
|
ZodNativeEnum: ce,
|
|
2906
|
-
ZodPromise:
|
|
2907
|
-
ZodEffects:
|
|
2908
|
-
ZodTransformer:
|
|
2906
|
+
ZodPromise: G,
|
|
2907
|
+
ZodEffects: A,
|
|
2908
|
+
ZodTransformer: A,
|
|
2909
2909
|
ZodOptional: N,
|
|
2910
2910
|
ZodNullable: D,
|
|
2911
2911
|
ZodDefault: ue,
|
|
2912
2912
|
ZodCatch: le,
|
|
2913
2913
|
ZodNaN: xe,
|
|
2914
|
-
BRAND:
|
|
2915
|
-
ZodBranded:
|
|
2914
|
+
BRAND: vt,
|
|
2915
|
+
ZodBranded: Ne,
|
|
2916
2916
|
ZodPipeline: he,
|
|
2917
2917
|
ZodReadonly: fe,
|
|
2918
|
-
custom:
|
|
2918
|
+
custom: Ue,
|
|
2919
2919
|
Schema: _,
|
|
2920
2920
|
ZodSchema: _,
|
|
2921
|
-
late:
|
|
2921
|
+
late: _t,
|
|
2922
2922
|
get ZodFirstPartyTypeKind() {
|
|
2923
2923
|
return y;
|
|
2924
2924
|
},
|
|
2925
|
-
coerce:
|
|
2926
|
-
any:
|
|
2927
|
-
array:
|
|
2928
|
-
bigint:
|
|
2929
|
-
boolean:
|
|
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:
|
|
2945
|
-
number:
|
|
2946
|
-
object:
|
|
2947
|
-
oboolean:
|
|
2948
|
-
onumber:
|
|
2949
|
-
optional:
|
|
2950
|
-
ostring:
|
|
2951
|
-
pipeline:
|
|
2952
|
-
preprocess:
|
|
2953
|
-
promise:
|
|
2954
|
-
record:
|
|
2955
|
-
set:
|
|
2956
|
-
strictObject:
|
|
2957
|
-
string:
|
|
2958
|
-
symbol:
|
|
2959
|
-
transformer:
|
|
2960
|
-
tuple:
|
|
2961
|
-
undefined:
|
|
2962
|
-
union:
|
|
2963
|
-
unknown:
|
|
2964
|
-
void:
|
|
2965
|
-
NEVER:
|
|
2925
|
+
coerce: er,
|
|
2926
|
+
any: Ct,
|
|
2927
|
+
array: Ot,
|
|
2928
|
+
bigint: kt,
|
|
2929
|
+
boolean: We,
|
|
2930
|
+
date: wt,
|
|
2931
|
+
discriminatedUnion: Pt,
|
|
2932
|
+
effect: Pe,
|
|
2933
|
+
enum: Bt,
|
|
2934
|
+
function: zt,
|
|
2935
|
+
instanceof: bt,
|
|
2936
|
+
intersection: $t,
|
|
2937
|
+
lazy: Ut,
|
|
2938
|
+
literal: Ft,
|
|
2939
|
+
map: Dt,
|
|
2940
|
+
nan: xt,
|
|
2941
|
+
nativeEnum: Wt,
|
|
2942
|
+
never: At,
|
|
2943
|
+
null: Zt,
|
|
2944
|
+
nullable: Yt,
|
|
2945
|
+
number: Be,
|
|
2946
|
+
object: jt,
|
|
2947
|
+
oboolean: Kt,
|
|
2948
|
+
onumber: Xt,
|
|
2949
|
+
optional: Jt,
|
|
2950
|
+
ostring: Qt,
|
|
2951
|
+
pipeline: Gt,
|
|
2952
|
+
preprocess: Ht,
|
|
2953
|
+
promise: qt,
|
|
2954
|
+
record: Vt,
|
|
2955
|
+
set: Lt,
|
|
2956
|
+
strictObject: Et,
|
|
2957
|
+
string: Fe,
|
|
2958
|
+
symbol: Tt,
|
|
2959
|
+
transformer: Pe,
|
|
2960
|
+
tuple: Mt,
|
|
2961
|
+
undefined: St,
|
|
2962
|
+
union: Rt,
|
|
2963
|
+
unknown: It,
|
|
2964
|
+
void: Nt,
|
|
2965
|
+
NEVER: tr,
|
|
2966
2966
|
ZodIssueCode: c,
|
|
2967
|
-
quotelessJson:
|
|
2968
|
-
ZodError:
|
|
2967
|
+
quotelessJson: Ye,
|
|
2968
|
+
ZodError: Z
|
|
2969
2969
|
});
|
|
2970
|
-
const k =
|
|
2970
|
+
const k = i.string().min(1, { message: "שדה חובה" }), or = i.string().regex(/^\d+$/, "Must be a numeric string"), rr = i.object({
|
|
2971
2971
|
country: k,
|
|
2972
2972
|
city: k,
|
|
2973
2973
|
street: k,
|
|
@@ -2975,118 +2975,119 @@ const k = d.string().min(1, { message: "שדה חובה" }), ar = d.string().reg
|
|
|
2975
2975
|
floor: k,
|
|
2976
2976
|
apartmentEnterNumber: k,
|
|
2977
2977
|
apartmentNumber: k
|
|
2978
|
-
}),
|
|
2979
|
-
lang:
|
|
2980
|
-
value:
|
|
2981
|
-
}),
|
|
2982
|
-
id:
|
|
2983
|
-
companyId:
|
|
2984
|
-
storeId:
|
|
2985
|
-
parentId:
|
|
2986
|
-
tag:
|
|
2987
|
-
locales:
|
|
2988
|
-
depth:
|
|
2989
|
-
}),
|
|
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:
|
|
2978
|
+
}), J = i.object({
|
|
2979
|
+
lang: i.enum(["he"]),
|
|
2980
|
+
value: i.string()
|
|
2981
|
+
}), dr = i.array(J), qe = i.object({
|
|
2982
|
+
id: i.string().min(1),
|
|
2983
|
+
companyId: i.string().min(1),
|
|
2984
|
+
storeId: i.string().min(1),
|
|
2985
|
+
parentId: i.string().nullish(),
|
|
2986
|
+
tag: i.string().min(1),
|
|
2987
|
+
locales: i.array(J),
|
|
2988
|
+
depth: i.number()
|
|
2989
|
+
}), Oe = qe.extend({
|
|
2990
|
+
children: i.lazy(() => Oe.array())
|
|
2991
|
+
}), cr = qe.extend({
|
|
2992
|
+
index: i.number(),
|
|
2993
|
+
depth: i.number(),
|
|
2994
|
+
collapsed: i.boolean().optional(),
|
|
2995
|
+
children: i.array(Oe)
|
|
2996
|
+
}), Q = i.string().min(1), je = i.object({
|
|
2997
|
+
type: i.literal("Product"),
|
|
2998
|
+
storeId: Q,
|
|
2999
|
+
companyId: Q,
|
|
3000
|
+
id: Q,
|
|
3001
|
+
objectID: Q,
|
|
3002
|
+
sku: Q,
|
|
3003
|
+
name: i.array(J),
|
|
3004
|
+
description: i.array(J),
|
|
3005
|
+
isPublished: i.boolean(),
|
|
3006
|
+
vat: i.boolean(),
|
|
3007
|
+
priceType: i.object({
|
|
3008
|
+
type: i.enum(["unit", "kg", "gram", "liter", "ml"]),
|
|
3009
|
+
value: i.number()
|
|
3010
3010
|
}),
|
|
3011
|
-
price:
|
|
3012
|
-
purchasePrice:
|
|
3013
|
-
profitPercentage:
|
|
3014
|
-
currency:
|
|
3015
|
-
discount:
|
|
3016
|
-
type:
|
|
3017
|
-
value:
|
|
3011
|
+
price: i.number().positive(),
|
|
3012
|
+
purchasePrice: i.number().optional(),
|
|
3013
|
+
profitPercentage: i.number().optional(),
|
|
3014
|
+
currency: i.literal("ILS"),
|
|
3015
|
+
discount: i.object({
|
|
3016
|
+
type: i.enum(["number", "percent", "none"]),
|
|
3017
|
+
value: i.number()
|
|
3018
3018
|
}),
|
|
3019
|
-
weight:
|
|
3020
|
-
value:
|
|
3021
|
-
unit:
|
|
3019
|
+
weight: i.object({
|
|
3020
|
+
value: i.number(),
|
|
3021
|
+
unit: i.enum(["kg", "gram", "none"])
|
|
3022
3022
|
}),
|
|
3023
|
-
volume:
|
|
3024
|
-
value:
|
|
3025
|
-
unit:
|
|
3023
|
+
volume: i.object({
|
|
3024
|
+
value: i.number(),
|
|
3025
|
+
unit: i.enum(["liter", "ml", "none"])
|
|
3026
3026
|
}),
|
|
3027
|
-
images:
|
|
3028
|
-
manufacturer:
|
|
3029
|
-
brand:
|
|
3030
|
-
importer:
|
|
3031
|
-
supplier:
|
|
3032
|
-
ingredients:
|
|
3033
|
-
created_at:
|
|
3034
|
-
updated_at:
|
|
3035
|
-
categoryIds:
|
|
3027
|
+
images: i.array(i.object({ url: i.string().url(), id: i.string() })),
|
|
3028
|
+
manufacturer: i.string(),
|
|
3029
|
+
brand: i.string(),
|
|
3030
|
+
importer: i.string(),
|
|
3031
|
+
supplier: i.string(),
|
|
3032
|
+
ingredients: i.array(J),
|
|
3033
|
+
created_at: i.number(),
|
|
3034
|
+
updated_at: i.number(),
|
|
3035
|
+
categoryIds: i.array(i.string().nonempty()),
|
|
3036
3036
|
// @deprecated
|
|
3037
|
-
categoryList:
|
|
3037
|
+
categoryList: i.array(Oe),
|
|
3038
3038
|
// @deprecated
|
|
3039
|
-
categories:
|
|
3040
|
-
lvl0:
|
|
3041
|
-
lvl1:
|
|
3042
|
-
lvl2:
|
|
3043
|
-
lvl3:
|
|
3044
|
-
lvl4:
|
|
3039
|
+
categories: i.object({
|
|
3040
|
+
lvl0: i.array(i.string()),
|
|
3041
|
+
lvl1: i.array(i.string()),
|
|
3042
|
+
lvl2: i.array(i.string()),
|
|
3043
|
+
lvl3: i.array(i.string()),
|
|
3044
|
+
lvl4: i.array(i.string())
|
|
3045
3045
|
}),
|
|
3046
3046
|
// @deprecated
|
|
3047
|
-
categoryNames:
|
|
3048
|
-
}),
|
|
3049
|
-
image:
|
|
3050
|
-
}),
|
|
3051
|
-
type:
|
|
3052
|
-
id:
|
|
3053
|
-
companyId:
|
|
3054
|
-
storeId:
|
|
3055
|
-
userId:
|
|
3056
|
-
status:
|
|
3057
|
-
items:
|
|
3058
|
-
|
|
3059
|
-
product:
|
|
3060
|
-
amount:
|
|
3047
|
+
categoryNames: i.array(i.string())
|
|
3048
|
+
}), ur = je.extend({
|
|
3049
|
+
image: i.instanceof(File).optional()
|
|
3050
|
+
}), lr = i.object({
|
|
3051
|
+
type: i.literal("Cart"),
|
|
3052
|
+
id: i.string().uuid(),
|
|
3053
|
+
companyId: i.string().uuid(),
|
|
3054
|
+
storeId: i.string().uuid(),
|
|
3055
|
+
userId: i.string().uuid(),
|
|
3056
|
+
status: i.enum(["active", "draft", "completed"]),
|
|
3057
|
+
items: i.array(
|
|
3058
|
+
i.object({
|
|
3059
|
+
product: je,
|
|
3060
|
+
amount: i.number().int().positive({ message: "Quantity must be a positive integer." })
|
|
3061
3061
|
})
|
|
3062
3062
|
)
|
|
3063
|
-
}),
|
|
3064
|
-
id:
|
|
3065
|
-
name:
|
|
3066
|
-
websiteDomains:
|
|
3067
|
-
}),
|
|
3068
|
-
type:
|
|
3069
|
-
id:
|
|
3070
|
-
companyId:
|
|
3071
|
-
storeId:
|
|
3072
|
-
userId:
|
|
3073
|
-
productId:
|
|
3074
|
-
}),
|
|
3075
|
-
type:
|
|
3063
|
+
}), fr = i.object({
|
|
3064
|
+
id: i.string(),
|
|
3065
|
+
name: i.string(),
|
|
3066
|
+
websiteDomains: i.array(i.string())
|
|
3067
|
+
}), hr = i.object({
|
|
3068
|
+
type: i.literal("FavoriteProduct"),
|
|
3069
|
+
id: i.string().uuid(),
|
|
3070
|
+
companyId: i.string().uuid(),
|
|
3071
|
+
storeId: i.string().uuid(),
|
|
3072
|
+
userId: i.string().uuid(),
|
|
3073
|
+
productId: i.string().uuid()
|
|
3074
|
+
}), Je = i.enum(["default", "delayed"]), nr = i.object({
|
|
3075
|
+
type: i.literal("Profile"),
|
|
3076
3076
|
id: k,
|
|
3077
3077
|
companyId: k,
|
|
3078
3078
|
storeId: k,
|
|
3079
3079
|
tenantId: k,
|
|
3080
|
-
clientType:
|
|
3080
|
+
clientType: i.enum(["user", "company"]),
|
|
3081
3081
|
displayName: k,
|
|
3082
|
-
email:
|
|
3082
|
+
email: i.string().email(),
|
|
3083
3083
|
phoneNumber: k.optional(),
|
|
3084
|
-
address:
|
|
3085
|
-
isAnonymous:
|
|
3086
|
-
createdDate:
|
|
3087
|
-
lastActivityDate:
|
|
3084
|
+
address: rr.optional(),
|
|
3085
|
+
isAnonymous: i.boolean(),
|
|
3086
|
+
createdDate: i.number(),
|
|
3087
|
+
lastActivityDate: i.number(),
|
|
3088
|
+
paymentType: Je
|
|
3088
3089
|
});
|
|
3089
|
-
function
|
|
3090
|
+
function mr() {
|
|
3090
3091
|
return {
|
|
3091
3092
|
type: "Profile",
|
|
3092
3093
|
id: "",
|
|
@@ -3108,16 +3109,17 @@ function fr() {
|
|
|
3108
3109
|
},
|
|
3109
3110
|
createdDate: 0,
|
|
3110
3111
|
lastActivityDate: 0,
|
|
3111
|
-
isAnonymous: !0
|
|
3112
|
+
isAnonymous: !0,
|
|
3113
|
+
paymentType: Je.Values.default
|
|
3112
3114
|
};
|
|
3113
3115
|
}
|
|
3114
|
-
const
|
|
3115
|
-
type:
|
|
3116
|
+
const pr = i.object({
|
|
3117
|
+
type: i.literal("Order"),
|
|
3116
3118
|
id: k,
|
|
3117
3119
|
companyId: k,
|
|
3118
3120
|
storeId: k,
|
|
3119
3121
|
userId: k,
|
|
3120
|
-
status:
|
|
3122
|
+
status: i.enum([
|
|
3121
3123
|
"draft",
|
|
3122
3124
|
// before payment
|
|
3123
3125
|
"pending",
|
|
@@ -3131,38 +3133,54 @@ const hr = d.object({
|
|
|
3131
3133
|
"completed",
|
|
3132
3134
|
"refunded"
|
|
3133
3135
|
]),
|
|
3134
|
-
paymentStatus:
|
|
3136
|
+
paymentStatus: i.enum(["pending", "pending_j5", "completed", "failed", "refunded"]),
|
|
3135
3137
|
//todo check if hyp support partial refund
|
|
3136
|
-
cart:
|
|
3137
|
-
id:
|
|
3138
|
-
items:
|
|
3139
|
-
cartDiscount:
|
|
3140
|
-
cartTotal:
|
|
3141
|
-
cartVat:
|
|
3138
|
+
cart: i.object({
|
|
3139
|
+
id: i.string(),
|
|
3140
|
+
items: i.array(i.object({ product: je, amount: i.number() })),
|
|
3141
|
+
cartDiscount: i.number(),
|
|
3142
|
+
cartTotal: i.number(),
|
|
3143
|
+
cartVat: i.number()
|
|
3142
3144
|
}),
|
|
3143
|
-
originalAmount:
|
|
3145
|
+
originalAmount: i.number().positive().optional(),
|
|
3144
3146
|
// what client pay
|
|
3145
|
-
actualAmount:
|
|
3147
|
+
actualAmount: i.number().positive().optional(),
|
|
3146
3148
|
// what store charge
|
|
3147
|
-
date:
|
|
3148
|
-
deliveryDate:
|
|
3149
|
-
createdAt:
|
|
3150
|
-
client:
|
|
3149
|
+
date: i.number(),
|
|
3150
|
+
deliveryDate: i.number().optional(),
|
|
3151
|
+
createdAt: i.number().optional(),
|
|
3152
|
+
client: nr.required({})
|
|
3151
3153
|
});
|
|
3152
|
-
|
|
3153
|
-
id:
|
|
3154
|
-
companyId:
|
|
3155
|
-
name:
|
|
3156
|
-
urls:
|
|
3157
|
-
logoUrl:
|
|
3158
|
-
tenantId:
|
|
3154
|
+
i.object({
|
|
3155
|
+
id: i.string(),
|
|
3156
|
+
companyId: i.string(),
|
|
3157
|
+
name: i.string(),
|
|
3158
|
+
urls: i.array(i.string()),
|
|
3159
|
+
logoUrl: i.string(),
|
|
3160
|
+
tenantId: i.string(),
|
|
3159
3161
|
// firebase auth tenantId
|
|
3160
|
-
paymentType:
|
|
3162
|
+
paymentType: i.enum(["external", "j5"]),
|
|
3163
|
+
allowAnonymousClients: i.boolean()
|
|
3161
3164
|
});
|
|
3162
|
-
const
|
|
3165
|
+
const Se = i.string().min(1), yr = i.object({
|
|
3166
|
+
type: i.literal("Discount"),
|
|
3167
|
+
storeId: Se,
|
|
3168
|
+
companyId: Se,
|
|
3169
|
+
id: Se,
|
|
3170
|
+
name: i.array(J),
|
|
3171
|
+
active: i.boolean(),
|
|
3172
|
+
variant: i.discriminatedUnion("variantType", [
|
|
3173
|
+
i.object({
|
|
3174
|
+
variantType: i.literal("bundle"),
|
|
3175
|
+
productsId: i.array(i.string()),
|
|
3176
|
+
requiredQuantity: i.number().positive(),
|
|
3177
|
+
discountPrice: i.number().positive()
|
|
3178
|
+
})
|
|
3179
|
+
])
|
|
3180
|
+
}), sr = {
|
|
3163
3181
|
stores: "STORES",
|
|
3164
3182
|
companies: "COMPANIES"
|
|
3165
|
-
},
|
|
3183
|
+
}, ar = {
|
|
3166
3184
|
products: "products",
|
|
3167
3185
|
profiles: "profiles",
|
|
3168
3186
|
cart: "cart",
|
|
@@ -3171,10 +3189,11 @@ const rr = {
|
|
|
3171
3189
|
categories: "categories",
|
|
3172
3190
|
favorites: "favorites",
|
|
3173
3191
|
payments: "payments",
|
|
3174
|
-
settings: "settings"
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3192
|
+
settings: "settings",
|
|
3193
|
+
discounts: "discounts"
|
|
3194
|
+
}, ir = {
|
|
3195
|
+
systemCollections: sr,
|
|
3196
|
+
storeCollections: ar,
|
|
3178
3197
|
// for client
|
|
3179
3198
|
getPath: ({
|
|
3180
3199
|
companyId: r,
|
|
@@ -3184,26 +3203,28 @@ const rr = {
|
|
|
3184
3203
|
}) => `${r}/${e}/${t}${n ? `/${n}` : ""}`,
|
|
3185
3204
|
// for backend
|
|
3186
3205
|
getDocPath: (r) => `{companyId}/{storeId}/${r}/{id}`
|
|
3187
|
-
},
|
|
3188
|
-
firestore:
|
|
3206
|
+
}, gr = {
|
|
3207
|
+
firestore: ir
|
|
3189
3208
|
};
|
|
3190
3209
|
export {
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
dr as
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3210
|
+
rr as AddressSchema,
|
|
3211
|
+
qe as BaseCategorySchema,
|
|
3212
|
+
lr as CartSchema,
|
|
3213
|
+
Oe as CategorySchema,
|
|
3214
|
+
fr as CompanySchema,
|
|
3215
|
+
yr as DiscountSchema,
|
|
3216
|
+
hr as FavoriteProductSchema,
|
|
3217
|
+
gr as FirebaseAPI,
|
|
3218
|
+
J as LocaleSchema,
|
|
3219
|
+
dr as LocaleValueSchema,
|
|
3220
|
+
ur as NewProductSchema,
|
|
3221
|
+
pr as OrderSchema,
|
|
3222
|
+
je as ProductSchema,
|
|
3223
|
+
Je as ProfilePaymentTypeSchema,
|
|
3224
|
+
nr as ProfileSchema,
|
|
3225
|
+
cr as TFlattenCategorySchema,
|
|
3226
|
+
mr as createEmptyProfile,
|
|
3206
3227
|
k as notEmptyTextSchema,
|
|
3207
|
-
|
|
3228
|
+
or as numericTextSchema
|
|
3208
3229
|
};
|
|
3209
3230
|
//# sourceMappingURL=core.es.js.map
|