@jsdev_ninja/core 0.15.0 → 0.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core.cjs +1 -1
- package/dist/core.cjs.map +1 -1
- package/dist/core.es.js +493 -530
- package/dist/core.es.js.map +1 -1
- package/dist/core.umd.js +1 -1
- package/dist/core.umd.js.map +1 -1
- package/dist/lib/entities/Budget.d.ts +68 -59
- package/dist/lib/entities/Budget.d.ts.map +1 -1
- package/dist/lib/entities/Budget.js +47 -36
- package/dist/lib/entities/Cart.d.ts +2257 -10
- package/dist/lib/entities/Cart.d.ts.map +1 -1
- package/dist/lib/entities/Cart.js +16 -0
- package/dist/lib/entities/DeliveryNote.d.ts +0 -1
- package/dist/lib/entities/DeliveryNote.d.ts.map +1 -1
- package/dist/lib/entities/Discount/index.d.ts +0 -1
- package/dist/lib/entities/Discount/index.d.ts.map +1 -1
- package/dist/lib/entities/Discount/index.js +0 -1
- package/dist/lib/entities/Invoice.d.ts +0 -2
- package/dist/lib/entities/Invoice.d.ts.map +1 -1
- package/dist/lib/entities/Locale.d.ts +0 -10
- package/dist/lib/entities/Locale.d.ts.map +1 -1
- package/dist/lib/entities/Locale.js +0 -1
- package/dist/lib/entities/Order.d.ts +1138 -2
- package/dist/lib/entities/Order.d.ts.map +1 -1
- package/dist/lib/entities/Order.js +3 -0
- package/dist/lib/entities/SupplierInvoice.d.ts +0 -1
- package/dist/lib/entities/SupplierInvoice.d.ts.map +1 -1
- package/dist/lib/entities/index.d.ts +0 -1
- package/dist/lib/entities/index.d.ts.map +1 -1
- package/dist/lib/entities/index.js +0 -1
- package/dist/lib/firebase-api/index.d.ts +15 -0
- package/dist/lib/firebase-api/index.d.ts.map +1 -1
- package/dist/lib/firebase-api/index.js +5 -0
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/package.json +58 -58
- package/dist/lib/entities/Chatbot/index.d.ts +0 -96
- package/dist/lib/entities/Chatbot/index.d.ts.map +0 -1
- package/dist/lib/entities/Chatbot/index.js +0 -37
- package/dist/lib/entities/Discount/__tests__/utils.test.d.ts +0 -2
- package/dist/lib/entities/Discount/__tests__/utils.test.d.ts.map +0 -1
- package/dist/lib/entities/Discount/__tests__/utils.test.js +0 -55
- package/dist/lib/entities/Discount/utils.d.ts +0 -29
- package/dist/lib/entities/Discount/utils.d.ts.map +0 -1
- package/dist/lib/entities/Discount/utils.js +0 -39
- package/dist/lib/firebase-api/app.d.ts +0 -2
- package/dist/lib/firebase-api/app.d.ts.map +0 -1
- package/dist/lib/firebase-api/app.js +0 -16
package/dist/core.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
1
|
+
var it = Object.defineProperty;
|
|
2
|
+
var ot = (n, e, t) => e in n ? it(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
|
+
var $e = (n, e, t) => ot(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
var b;
|
|
5
5
|
(function(n) {
|
|
6
6
|
n.assertEqual = (a) => a;
|
|
@@ -87,7 +87,7 @@ const p = b.arrayToEnum([
|
|
|
87
87
|
default:
|
|
88
88
|
return p.unknown;
|
|
89
89
|
}
|
|
90
|
-
},
|
|
90
|
+
}, d = b.arrayToEnum([
|
|
91
91
|
"invalid_type",
|
|
92
92
|
"invalid_literal",
|
|
93
93
|
"custom",
|
|
@@ -104,8 +104,8 @@ const p = b.arrayToEnum([
|
|
|
104
104
|
"invalid_intersection_types",
|
|
105
105
|
"not_multiple_of",
|
|
106
106
|
"not_finite"
|
|
107
|
-
]),
|
|
108
|
-
class
|
|
107
|
+
]), ct = (n) => JSON.stringify(n, null, 2).replace(/"([^"]+)":/g, "$1:");
|
|
108
|
+
class A extends Error {
|
|
109
109
|
get errors() {
|
|
110
110
|
return this.issues;
|
|
111
111
|
}
|
|
@@ -134,15 +134,15 @@ class N extends Error {
|
|
|
134
134
|
else {
|
|
135
135
|
let o = r, l = 0;
|
|
136
136
|
for (; l < c.path.length; ) {
|
|
137
|
-
const
|
|
138
|
-
l === c.path.length - 1 ? (o[
|
|
137
|
+
const u = c.path[l];
|
|
138
|
+
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++;
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
};
|
|
142
142
|
return a(this), r;
|
|
143
143
|
}
|
|
144
144
|
static assert(e) {
|
|
145
|
-
if (!(e instanceof
|
|
145
|
+
if (!(e instanceof A))
|
|
146
146
|
throw new Error(`Not a ZodError: ${e}`);
|
|
147
147
|
}
|
|
148
148
|
toString() {
|
|
@@ -164,56 +164,56 @@ class N extends Error {
|
|
|
164
164
|
return this.flatten();
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
|
-
|
|
167
|
+
A.create = (n) => new A(n);
|
|
168
168
|
const X = (n, e) => {
|
|
169
169
|
let t;
|
|
170
170
|
switch (n.code) {
|
|
171
|
-
case
|
|
171
|
+
case d.invalid_type:
|
|
172
172
|
n.received === p.undefined ? t = "Required" : t = `Expected ${n.expected}, received ${n.received}`;
|
|
173
173
|
break;
|
|
174
|
-
case
|
|
174
|
+
case d.invalid_literal:
|
|
175
175
|
t = `Invalid literal value, expected ${JSON.stringify(n.expected, b.jsonStringifyReplacer)}`;
|
|
176
176
|
break;
|
|
177
|
-
case
|
|
177
|
+
case d.unrecognized_keys:
|
|
178
178
|
t = `Unrecognized key(s) in object: ${b.joinValues(n.keys, ", ")}`;
|
|
179
179
|
break;
|
|
180
|
-
case
|
|
180
|
+
case d.invalid_union:
|
|
181
181
|
t = "Invalid input";
|
|
182
182
|
break;
|
|
183
|
-
case
|
|
183
|
+
case d.invalid_union_discriminator:
|
|
184
184
|
t = `Invalid discriminator value. Expected ${b.joinValues(n.options)}`;
|
|
185
185
|
break;
|
|
186
|
-
case
|
|
186
|
+
case d.invalid_enum_value:
|
|
187
187
|
t = `Invalid enum value. Expected ${b.joinValues(n.options)}, received '${n.received}'`;
|
|
188
188
|
break;
|
|
189
|
-
case
|
|
189
|
+
case d.invalid_arguments:
|
|
190
190
|
t = "Invalid function arguments";
|
|
191
191
|
break;
|
|
192
|
-
case
|
|
192
|
+
case d.invalid_return_type:
|
|
193
193
|
t = "Invalid function return type";
|
|
194
194
|
break;
|
|
195
|
-
case
|
|
195
|
+
case d.invalid_date:
|
|
196
196
|
t = "Invalid date";
|
|
197
197
|
break;
|
|
198
|
-
case
|
|
198
|
+
case d.invalid_string:
|
|
199
199
|
typeof n.validation == "object" ? "includes" in n.validation ? (t = `Invalid input: must include "${n.validation.includes}"`, typeof n.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${n.validation.position}`)) : "startsWith" in n.validation ? t = `Invalid input: must start with "${n.validation.startsWith}"` : "endsWith" in n.validation ? t = `Invalid input: must end with "${n.validation.endsWith}"` : b.assertNever(n.validation) : n.validation !== "regex" ? t = `Invalid ${n.validation}` : t = "Invalid";
|
|
200
200
|
break;
|
|
201
|
-
case
|
|
201
|
+
case d.too_small:
|
|
202
202
|
n.type === "array" ? t = `Array must contain ${n.exact ? "exactly" : n.inclusive ? "at least" : "more than"} ${n.minimum} element(s)` : n.type === "string" ? t = `String must contain ${n.exact ? "exactly" : n.inclusive ? "at least" : "over"} ${n.minimum} character(s)` : n.type === "number" ? t = `Number must be ${n.exact ? "exactly equal to " : n.inclusive ? "greater than or equal to " : "greater than "}${n.minimum}` : n.type === "date" ? t = `Date must be ${n.exact ? "exactly equal to " : n.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(n.minimum))}` : t = "Invalid input";
|
|
203
203
|
break;
|
|
204
|
-
case
|
|
204
|
+
case d.too_big:
|
|
205
205
|
n.type === "array" ? t = `Array must contain ${n.exact ? "exactly" : n.inclusive ? "at most" : "less than"} ${n.maximum} element(s)` : n.type === "string" ? t = `String must contain ${n.exact ? "exactly" : n.inclusive ? "at most" : "under"} ${n.maximum} character(s)` : n.type === "number" ? t = `Number must be ${n.exact ? "exactly" : n.inclusive ? "less than or equal to" : "less than"} ${n.maximum}` : n.type === "bigint" ? t = `BigInt must be ${n.exact ? "exactly" : n.inclusive ? "less than or equal to" : "less than"} ${n.maximum}` : n.type === "date" ? t = `Date must be ${n.exact ? "exactly" : n.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(n.maximum))}` : t = "Invalid input";
|
|
206
206
|
break;
|
|
207
|
-
case
|
|
207
|
+
case d.custom:
|
|
208
208
|
t = "Invalid input";
|
|
209
209
|
break;
|
|
210
|
-
case
|
|
210
|
+
case d.invalid_intersection_types:
|
|
211
211
|
t = "Intersection results could not be merged";
|
|
212
212
|
break;
|
|
213
|
-
case
|
|
213
|
+
case d.not_multiple_of:
|
|
214
214
|
t = `Number must be a multiple of ${n.multipleOf}`;
|
|
215
215
|
break;
|
|
216
|
-
case
|
|
216
|
+
case d.not_finite:
|
|
217
217
|
t = "Number must be finite";
|
|
218
218
|
break;
|
|
219
219
|
default:
|
|
@@ -240,15 +240,15 @@ const ve = (n) => {
|
|
|
240
240
|
message: a.message
|
|
241
241
|
};
|
|
242
242
|
let o = "";
|
|
243
|
-
const l = r.filter((
|
|
244
|
-
for (const
|
|
245
|
-
o =
|
|
243
|
+
const l = r.filter((u) => !!u).slice().reverse();
|
|
244
|
+
for (const u of l)
|
|
245
|
+
o = u(c, { data: e, defaultError: o }).message;
|
|
246
246
|
return {
|
|
247
247
|
...a,
|
|
248
248
|
path: i,
|
|
249
249
|
message: o
|
|
250
250
|
};
|
|
251
|
-
},
|
|
251
|
+
}, ut = [];
|
|
252
252
|
function m(n, e) {
|
|
253
253
|
const t = ye(), r = ve({
|
|
254
254
|
issueData: e,
|
|
@@ -310,7 +310,7 @@ class S {
|
|
|
310
310
|
}
|
|
311
311
|
const y = Object.freeze({
|
|
312
312
|
status: "aborted"
|
|
313
|
-
}), Q = (n) => ({ status: "dirty", value: n }), I = (n) => ({ status: "valid", value: n }), je = (n) => n.status === "aborted", Ze = (n) => n.status === "dirty",
|
|
313
|
+
}), Q = (n) => ({ status: "dirty", value: n }), I = (n) => ({ status: "valid", value: n }), je = (n) => n.status === "aborted", Ze = (n) => n.status === "dirty", U = (n) => n.status === "valid", ne = (n) => typeof Promise < "u" && n instanceof Promise;
|
|
314
314
|
function _e(n, e, t, r) {
|
|
315
315
|
if (typeof e == "function" ? n !== e || !0 : !e.has(n)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
316
316
|
return e.get(n);
|
|
@@ -332,8 +332,8 @@ class O {
|
|
|
332
332
|
return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
|
|
333
333
|
}
|
|
334
334
|
}
|
|
335
|
-
const
|
|
336
|
-
if (
|
|
335
|
+
const Me = (n, e) => {
|
|
336
|
+
if (U(e))
|
|
337
337
|
return { success: !0, data: e.value };
|
|
338
338
|
if (!n.common.issues.length)
|
|
339
339
|
throw new Error("Validation failed but no issues detected.");
|
|
@@ -342,7 +342,7 @@ const $e = (n, e) => {
|
|
|
342
342
|
get error() {
|
|
343
343
|
if (this._error)
|
|
344
344
|
return this._error;
|
|
345
|
-
const t = new
|
|
345
|
+
const t = new A(n.common.issues);
|
|
346
346
|
return this._error = t, this._error;
|
|
347
347
|
}
|
|
348
348
|
};
|
|
@@ -354,9 +354,9 @@ function v(n) {
|
|
|
354
354
|
if (e && (t || r))
|
|
355
355
|
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
356
356
|
return e ? { errorMap: e, description: a } : { errorMap: (c, o) => {
|
|
357
|
-
var l,
|
|
357
|
+
var l, u;
|
|
358
358
|
const { message: f } = n;
|
|
359
|
-
return c.code === "invalid_enum_value" ? { message: f ?? o.defaultError } : typeof o.data > "u" ? { message: (l = f ?? r) !== null && l !== void 0 ? l : o.defaultError } : c.code !== "invalid_type" ? { message: o.defaultError } : { message: (
|
|
359
|
+
return c.code === "invalid_enum_value" ? { message: f ?? o.defaultError } : typeof o.data > "u" ? { message: (l = f ?? r) !== null && l !== void 0 ? l : o.defaultError } : c.code !== "invalid_type" ? { message: o.defaultError } : { message: (u = f ?? t) !== null && u !== void 0 ? u : o.defaultError };
|
|
360
360
|
}, description: a };
|
|
361
361
|
}
|
|
362
362
|
class _ {
|
|
@@ -391,7 +391,7 @@ class _ {
|
|
|
391
391
|
}
|
|
392
392
|
_parseSync(e) {
|
|
393
393
|
const t = this._parse(e);
|
|
394
|
-
if (
|
|
394
|
+
if (ne(t))
|
|
395
395
|
throw new Error("Synchronous parse encountered promise.");
|
|
396
396
|
return t;
|
|
397
397
|
}
|
|
@@ -419,7 +419,7 @@ class _ {
|
|
|
419
419
|
data: e,
|
|
420
420
|
parsedType: E(e)
|
|
421
421
|
}, i = this._parseSync({ data: e, path: a.path, parent: a });
|
|
422
|
-
return
|
|
422
|
+
return Me(a, i);
|
|
423
423
|
}
|
|
424
424
|
"~validate"(e) {
|
|
425
425
|
var t, r;
|
|
@@ -437,7 +437,7 @@ class _ {
|
|
|
437
437
|
if (!this["~standard"].async)
|
|
438
438
|
try {
|
|
439
439
|
const i = this._parseSync({ data: e, path: [], parent: a });
|
|
440
|
-
return
|
|
440
|
+
return U(i) ? {
|
|
441
441
|
value: i.value
|
|
442
442
|
} : {
|
|
443
443
|
issues: a.common.issues
|
|
@@ -448,7 +448,7 @@ class _ {
|
|
|
448
448
|
async: !0
|
|
449
449
|
};
|
|
450
450
|
}
|
|
451
|
-
return this._parseAsync({ data: e, path: [], parent: a }).then((i) =>
|
|
451
|
+
return this._parseAsync({ data: e, path: [], parent: a }).then((i) => U(i) ? {
|
|
452
452
|
value: i.value
|
|
453
453
|
} : {
|
|
454
454
|
issues: a.common.issues
|
|
@@ -472,14 +472,14 @@ class _ {
|
|
|
472
472
|
parent: null,
|
|
473
473
|
data: e,
|
|
474
474
|
parsedType: E(e)
|
|
475
|
-
}, a = this._parse({ data: e, path: r.path, parent: r }), i = await (
|
|
476
|
-
return
|
|
475
|
+
}, a = this._parse({ data: e, path: r.path, parent: r }), i = await (ne(a) ? a : Promise.resolve(a));
|
|
476
|
+
return Me(r, i);
|
|
477
477
|
}
|
|
478
478
|
refine(e, t) {
|
|
479
479
|
const r = (a) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(a) : t;
|
|
480
480
|
return this._refinement((a, i) => {
|
|
481
481
|
const c = e(a), o = () => i.addIssue({
|
|
482
|
-
code:
|
|
482
|
+
code: d.custom,
|
|
483
483
|
...r(a)
|
|
484
484
|
});
|
|
485
485
|
return typeof Promise < "u" && c instanceof Promise ? c.then((l) => l ? !0 : (o(), !1)) : c ? !0 : (o(), !1);
|
|
@@ -509,7 +509,7 @@ class _ {
|
|
|
509
509
|
return Z.create(this, this._def);
|
|
510
510
|
}
|
|
511
511
|
nullable() {
|
|
512
|
-
return
|
|
512
|
+
return L.create(this, this._def);
|
|
513
513
|
}
|
|
514
514
|
nullish() {
|
|
515
515
|
return this.nullable().optional();
|
|
@@ -521,10 +521,10 @@ class _ {
|
|
|
521
521
|
return J.create(this, this._def);
|
|
522
522
|
}
|
|
523
523
|
or(e) {
|
|
524
|
-
return
|
|
524
|
+
return ie.create([this, e], this._def);
|
|
525
525
|
}
|
|
526
526
|
and(e) {
|
|
527
|
-
return
|
|
527
|
+
return oe.create(this, e, this._def);
|
|
528
528
|
}
|
|
529
529
|
transform(e) {
|
|
530
530
|
return new j({
|
|
@@ -536,7 +536,7 @@ class _ {
|
|
|
536
536
|
}
|
|
537
537
|
default(e) {
|
|
538
538
|
const t = typeof e == "function" ? e : () => e;
|
|
539
|
-
return new
|
|
539
|
+
return new me({
|
|
540
540
|
...v(this._def),
|
|
541
541
|
innerType: this,
|
|
542
542
|
defaultValue: t,
|
|
@@ -552,7 +552,7 @@ class _ {
|
|
|
552
552
|
}
|
|
553
553
|
catch(e) {
|
|
554
554
|
const t = typeof e == "function" ? e : () => e;
|
|
555
|
-
return new
|
|
555
|
+
return new pe({
|
|
556
556
|
...v(this._def),
|
|
557
557
|
innerType: this,
|
|
558
558
|
catchValue: t,
|
|
@@ -567,10 +567,10 @@ class _ {
|
|
|
567
567
|
});
|
|
568
568
|
}
|
|
569
569
|
pipe(e) {
|
|
570
|
-
return
|
|
570
|
+
return he.create(this, e);
|
|
571
571
|
}
|
|
572
572
|
readonly() {
|
|
573
|
-
return
|
|
573
|
+
return fe.create(this);
|
|
574
574
|
}
|
|
575
575
|
isOptional() {
|
|
576
576
|
return this.safeParse(void 0).success;
|
|
@@ -579,26 +579,26 @@ class _ {
|
|
|
579
579
|
return this.safeParse(null).success;
|
|
580
580
|
}
|
|
581
581
|
}
|
|
582
|
-
const
|
|
583
|
-
let
|
|
584
|
-
const
|
|
585
|
-
function
|
|
582
|
+
const lt = /^c[^\s-]{8,}$/i, mt = /^[0-9a-z]+$/, pt = /^[0-9A-HJKMNP-TV-Z]{26}$/i, ft = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, ht = /^[a-z0-9_-]{21}$/i, gt = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, yt = /^[-+]?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)?)??$/, vt = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, _t = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
583
|
+
let Ne;
|
|
584
|
+
const bt = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, xt = /^(?:(?: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])$/, kt = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, wt = /^(([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])$/, Tt = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, St = /^([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])))", It = new RegExp(`^${qe}$`);
|
|
585
|
+
function Be(n) {
|
|
586
586
|
let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
|
|
587
587
|
return n.precision ? e = `${e}\\.\\d{${n.precision}}` : n.precision == null && (e = `${e}(\\.\\d+)?`), e;
|
|
588
588
|
}
|
|
589
589
|
function At(n) {
|
|
590
|
-
return new RegExp(`^${
|
|
590
|
+
return new RegExp(`^${Be(n)}$`);
|
|
591
591
|
}
|
|
592
|
-
function
|
|
593
|
-
let e = `${
|
|
592
|
+
function We(n) {
|
|
593
|
+
let e = `${qe}T${Be(n)}`;
|
|
594
594
|
const t = [];
|
|
595
595
|
return t.push(n.local ? "Z?" : "Z"), n.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
|
|
596
596
|
}
|
|
597
|
-
function
|
|
598
|
-
return !!((e === "v4" || !e) &&
|
|
597
|
+
function Nt(n, e) {
|
|
598
|
+
return !!((e === "v4" || !e) && bt.test(n) || (e === "v6" || !e) && kt.test(n));
|
|
599
599
|
}
|
|
600
|
-
function
|
|
601
|
-
if (!
|
|
600
|
+
function Ct(n, e) {
|
|
601
|
+
if (!gt.test(n))
|
|
602
602
|
return !1;
|
|
603
603
|
try {
|
|
604
604
|
const [t] = n.split("."), r = t.replace(/-/g, "+").replace(/_/g, "/").padEnd(t.length + (4 - t.length % 4) % 4, "="), a = JSON.parse(atob(r));
|
|
@@ -607,15 +607,15 @@ function jt(n, e) {
|
|
|
607
607
|
return !1;
|
|
608
608
|
}
|
|
609
609
|
}
|
|
610
|
-
function
|
|
611
|
-
return !!((e === "v4" || !e) &&
|
|
610
|
+
function jt(n, e) {
|
|
611
|
+
return !!((e === "v4" || !e) && xt.test(n) || (e === "v6" || !e) && wt.test(n));
|
|
612
612
|
}
|
|
613
|
-
class
|
|
613
|
+
class N extends _ {
|
|
614
614
|
_parse(e) {
|
|
615
615
|
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== p.string) {
|
|
616
616
|
const i = this._getOrReturnCtx(e);
|
|
617
617
|
return m(i, {
|
|
618
|
-
code:
|
|
618
|
+
code: d.invalid_type,
|
|
619
619
|
expected: p.string,
|
|
620
620
|
received: i.parsedType
|
|
621
621
|
}), y;
|
|
@@ -625,7 +625,7 @@ class A extends _ {
|
|
|
625
625
|
for (const i of this._def.checks)
|
|
626
626
|
if (i.kind === "min")
|
|
627
627
|
e.data.length < i.value && (a = this._getOrReturnCtx(e, a), m(a, {
|
|
628
|
-
code:
|
|
628
|
+
code: d.too_small,
|
|
629
629
|
minimum: i.value,
|
|
630
630
|
type: "string",
|
|
631
631
|
inclusive: !0,
|
|
@@ -634,7 +634,7 @@ class A extends _ {
|
|
|
634
634
|
}), r.dirty());
|
|
635
635
|
else if (i.kind === "max")
|
|
636
636
|
e.data.length > i.value && (a = this._getOrReturnCtx(e, a), m(a, {
|
|
637
|
-
code:
|
|
637
|
+
code: d.too_big,
|
|
638
638
|
maximum: i.value,
|
|
639
639
|
type: "string",
|
|
640
640
|
inclusive: !0,
|
|
@@ -644,14 +644,14 @@ class A extends _ {
|
|
|
644
644
|
else if (i.kind === "length") {
|
|
645
645
|
const c = e.data.length > i.value, o = e.data.length < i.value;
|
|
646
646
|
(c || o) && (a = this._getOrReturnCtx(e, a), c ? m(a, {
|
|
647
|
-
code:
|
|
647
|
+
code: d.too_big,
|
|
648
648
|
maximum: i.value,
|
|
649
649
|
type: "string",
|
|
650
650
|
inclusive: !0,
|
|
651
651
|
exact: !0,
|
|
652
652
|
message: i.message
|
|
653
653
|
}) : o && m(a, {
|
|
654
|
-
code:
|
|
654
|
+
code: d.too_small,
|
|
655
655
|
minimum: i.value,
|
|
656
656
|
type: "string",
|
|
657
657
|
inclusive: !0,
|
|
@@ -659,45 +659,45 @@ class A extends _ {
|
|
|
659
659
|
message: i.message
|
|
660
660
|
}), r.dirty());
|
|
661
661
|
} else if (i.kind === "email")
|
|
662
|
-
|
|
662
|
+
vt.test(e.data) || (a = this._getOrReturnCtx(e, a), m(a, {
|
|
663
663
|
validation: "email",
|
|
664
|
-
code:
|
|
664
|
+
code: d.invalid_string,
|
|
665
665
|
message: i.message
|
|
666
666
|
}), r.dirty());
|
|
667
667
|
else if (i.kind === "emoji")
|
|
668
|
-
|
|
668
|
+
Ne || (Ne = new RegExp(_t, "u")), Ne.test(e.data) || (a = this._getOrReturnCtx(e, a), m(a, {
|
|
669
669
|
validation: "emoji",
|
|
670
|
-
code:
|
|
670
|
+
code: d.invalid_string,
|
|
671
671
|
message: i.message
|
|
672
672
|
}), r.dirty());
|
|
673
673
|
else if (i.kind === "uuid")
|
|
674
|
-
|
|
674
|
+
ft.test(e.data) || (a = this._getOrReturnCtx(e, a), m(a, {
|
|
675
675
|
validation: "uuid",
|
|
676
|
-
code:
|
|
676
|
+
code: d.invalid_string,
|
|
677
677
|
message: i.message
|
|
678
678
|
}), r.dirty());
|
|
679
679
|
else if (i.kind === "nanoid")
|
|
680
|
-
|
|
680
|
+
ht.test(e.data) || (a = this._getOrReturnCtx(e, a), m(a, {
|
|
681
681
|
validation: "nanoid",
|
|
682
|
-
code:
|
|
682
|
+
code: d.invalid_string,
|
|
683
683
|
message: i.message
|
|
684
684
|
}), r.dirty());
|
|
685
685
|
else if (i.kind === "cuid")
|
|
686
|
-
|
|
686
|
+
lt.test(e.data) || (a = this._getOrReturnCtx(e, a), m(a, {
|
|
687
687
|
validation: "cuid",
|
|
688
|
-
code:
|
|
688
|
+
code: d.invalid_string,
|
|
689
689
|
message: i.message
|
|
690
690
|
}), r.dirty());
|
|
691
691
|
else if (i.kind === "cuid2")
|
|
692
|
-
|
|
692
|
+
mt.test(e.data) || (a = this._getOrReturnCtx(e, a), m(a, {
|
|
693
693
|
validation: "cuid2",
|
|
694
|
-
code:
|
|
694
|
+
code: d.invalid_string,
|
|
695
695
|
message: i.message
|
|
696
696
|
}), r.dirty());
|
|
697
697
|
else if (i.kind === "ulid")
|
|
698
|
-
|
|
698
|
+
pt.test(e.data) || (a = this._getOrReturnCtx(e, a), m(a, {
|
|
699
699
|
validation: "ulid",
|
|
700
|
-
code:
|
|
700
|
+
code: d.invalid_string,
|
|
701
701
|
message: i.message
|
|
702
702
|
}), r.dirty());
|
|
703
703
|
else if (i.kind === "url")
|
|
@@ -706,61 +706,61 @@ class A extends _ {
|
|
|
706
706
|
} catch {
|
|
707
707
|
a = this._getOrReturnCtx(e, a), m(a, {
|
|
708
708
|
validation: "url",
|
|
709
|
-
code:
|
|
709
|
+
code: d.invalid_string,
|
|
710
710
|
message: i.message
|
|
711
711
|
}), r.dirty();
|
|
712
712
|
}
|
|
713
713
|
else i.kind === "regex" ? (i.regex.lastIndex = 0, i.regex.test(e.data) || (a = this._getOrReturnCtx(e, a), m(a, {
|
|
714
714
|
validation: "regex",
|
|
715
|
-
code:
|
|
715
|
+
code: d.invalid_string,
|
|
716
716
|
message: i.message
|
|
717
717
|
}), r.dirty())) : i.kind === "trim" ? e.data = e.data.trim() : i.kind === "includes" ? e.data.includes(i.value, i.position) || (a = this._getOrReturnCtx(e, a), m(a, {
|
|
718
|
-
code:
|
|
718
|
+
code: d.invalid_string,
|
|
719
719
|
validation: { includes: i.value, position: i.position },
|
|
720
720
|
message: i.message
|
|
721
721
|
}), r.dirty()) : i.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : i.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : i.kind === "startsWith" ? e.data.startsWith(i.value) || (a = this._getOrReturnCtx(e, a), m(a, {
|
|
722
|
-
code:
|
|
722
|
+
code: d.invalid_string,
|
|
723
723
|
validation: { startsWith: i.value },
|
|
724
724
|
message: i.message
|
|
725
725
|
}), r.dirty()) : i.kind === "endsWith" ? e.data.endsWith(i.value) || (a = this._getOrReturnCtx(e, a), m(a, {
|
|
726
|
-
code:
|
|
726
|
+
code: d.invalid_string,
|
|
727
727
|
validation: { endsWith: i.value },
|
|
728
728
|
message: i.message
|
|
729
|
-
}), r.dirty()) : i.kind === "datetime" ?
|
|
730
|
-
code:
|
|
729
|
+
}), r.dirty()) : i.kind === "datetime" ? We(i).test(e.data) || (a = this._getOrReturnCtx(e, a), m(a, {
|
|
730
|
+
code: d.invalid_string,
|
|
731
731
|
validation: "datetime",
|
|
732
732
|
message: i.message
|
|
733
|
-
}), r.dirty()) : i.kind === "date" ?
|
|
734
|
-
code:
|
|
733
|
+
}), r.dirty()) : i.kind === "date" ? It.test(e.data) || (a = this._getOrReturnCtx(e, a), m(a, {
|
|
734
|
+
code: d.invalid_string,
|
|
735
735
|
validation: "date",
|
|
736
736
|
message: i.message
|
|
737
737
|
}), r.dirty()) : i.kind === "time" ? At(i).test(e.data) || (a = this._getOrReturnCtx(e, a), m(a, {
|
|
738
|
-
code:
|
|
738
|
+
code: d.invalid_string,
|
|
739
739
|
validation: "time",
|
|
740
740
|
message: i.message
|
|
741
|
-
}), r.dirty()) : i.kind === "duration" ?
|
|
741
|
+
}), r.dirty()) : i.kind === "duration" ? yt.test(e.data) || (a = this._getOrReturnCtx(e, a), m(a, {
|
|
742
742
|
validation: "duration",
|
|
743
|
-
code:
|
|
743
|
+
code: d.invalid_string,
|
|
744
744
|
message: i.message
|
|
745
|
-
}), r.dirty()) : i.kind === "ip" ?
|
|
745
|
+
}), r.dirty()) : i.kind === "ip" ? Nt(e.data, i.version) || (a = this._getOrReturnCtx(e, a), m(a, {
|
|
746
746
|
validation: "ip",
|
|
747
|
-
code:
|
|
747
|
+
code: d.invalid_string,
|
|
748
748
|
message: i.message
|
|
749
|
-
}), r.dirty()) : i.kind === "jwt" ?
|
|
749
|
+
}), r.dirty()) : i.kind === "jwt" ? Ct(e.data, i.alg) || (a = this._getOrReturnCtx(e, a), m(a, {
|
|
750
750
|
validation: "jwt",
|
|
751
|
-
code:
|
|
751
|
+
code: d.invalid_string,
|
|
752
752
|
message: i.message
|
|
753
|
-
}), r.dirty()) : i.kind === "cidr" ?
|
|
753
|
+
}), r.dirty()) : i.kind === "cidr" ? jt(e.data, i.version) || (a = this._getOrReturnCtx(e, a), m(a, {
|
|
754
754
|
validation: "cidr",
|
|
755
|
-
code:
|
|
755
|
+
code: d.invalid_string,
|
|
756
756
|
message: i.message
|
|
757
|
-
}), r.dirty()) : i.kind === "base64" ?
|
|
757
|
+
}), r.dirty()) : i.kind === "base64" ? Tt.test(e.data) || (a = this._getOrReturnCtx(e, a), m(a, {
|
|
758
758
|
validation: "base64",
|
|
759
|
-
code:
|
|
759
|
+
code: d.invalid_string,
|
|
760
760
|
message: i.message
|
|
761
|
-
}), r.dirty()) : i.kind === "base64url" ?
|
|
761
|
+
}), r.dirty()) : i.kind === "base64url" ? St.test(e.data) || (a = this._getOrReturnCtx(e, a), m(a, {
|
|
762
762
|
validation: "base64url",
|
|
763
|
-
code:
|
|
763
|
+
code: d.invalid_string,
|
|
764
764
|
message: i.message
|
|
765
765
|
}), r.dirty()) : b.assertNever(i);
|
|
766
766
|
return { status: r.value, value: e.data };
|
|
@@ -768,12 +768,12 @@ class A extends _ {
|
|
|
768
768
|
_regex(e, t, r) {
|
|
769
769
|
return this.refinement((a) => e.test(a), {
|
|
770
770
|
validation: t,
|
|
771
|
-
code:
|
|
771
|
+
code: d.invalid_string,
|
|
772
772
|
...h.errToObj(r)
|
|
773
773
|
});
|
|
774
774
|
}
|
|
775
775
|
_addCheck(e) {
|
|
776
|
-
return new
|
|
776
|
+
return new N({
|
|
777
777
|
...this._def,
|
|
778
778
|
checks: [...this._def.checks, e]
|
|
779
779
|
});
|
|
@@ -910,19 +910,19 @@ class A extends _ {
|
|
|
910
910
|
return this.min(1, h.errToObj(e));
|
|
911
911
|
}
|
|
912
912
|
trim() {
|
|
913
|
-
return new
|
|
913
|
+
return new N({
|
|
914
914
|
...this._def,
|
|
915
915
|
checks: [...this._def.checks, { kind: "trim" }]
|
|
916
916
|
});
|
|
917
917
|
}
|
|
918
918
|
toLowerCase() {
|
|
919
|
-
return new
|
|
919
|
+
return new N({
|
|
920
920
|
...this._def,
|
|
921
921
|
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
922
922
|
});
|
|
923
923
|
}
|
|
924
924
|
toUpperCase() {
|
|
925
|
-
return new
|
|
925
|
+
return new N({
|
|
926
926
|
...this._def,
|
|
927
927
|
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
928
928
|
});
|
|
@@ -988,16 +988,16 @@ class A extends _ {
|
|
|
988
988
|
return e;
|
|
989
989
|
}
|
|
990
990
|
}
|
|
991
|
-
|
|
991
|
+
N.create = (n) => {
|
|
992
992
|
var e;
|
|
993
|
-
return new
|
|
993
|
+
return new N({
|
|
994
994
|
checks: [],
|
|
995
995
|
typeName: g.ZodString,
|
|
996
996
|
coerce: (e = n == null ? void 0 : n.coerce) !== null && e !== void 0 ? e : !1,
|
|
997
997
|
...v(n)
|
|
998
998
|
});
|
|
999
999
|
};
|
|
1000
|
-
function
|
|
1000
|
+
function Zt(n, e) {
|
|
1001
1001
|
const t = (n.toString().split(".")[1] || "").length, r = (e.toString().split(".")[1] || "").length, a = t > r ? t : r, i = parseInt(n.toFixed(a).replace(".", "")), c = parseInt(e.toFixed(a).replace(".", ""));
|
|
1002
1002
|
return i % c / Math.pow(10, a);
|
|
1003
1003
|
}
|
|
@@ -1009,7 +1009,7 @@ class M extends _ {
|
|
|
1009
1009
|
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== p.number) {
|
|
1010
1010
|
const i = this._getOrReturnCtx(e);
|
|
1011
1011
|
return m(i, {
|
|
1012
|
-
code:
|
|
1012
|
+
code: d.invalid_type,
|
|
1013
1013
|
expected: p.number,
|
|
1014
1014
|
received: i.parsedType
|
|
1015
1015
|
}), y;
|
|
@@ -1018,30 +1018,30 @@ class M extends _ {
|
|
|
1018
1018
|
const a = new S();
|
|
1019
1019
|
for (const i of this._def.checks)
|
|
1020
1020
|
i.kind === "int" ? b.isInteger(e.data) || (r = this._getOrReturnCtx(e, r), m(r, {
|
|
1021
|
-
code:
|
|
1021
|
+
code: d.invalid_type,
|
|
1022
1022
|
expected: "integer",
|
|
1023
1023
|
received: "float",
|
|
1024
1024
|
message: i.message
|
|
1025
1025
|
}), a.dirty()) : i.kind === "min" ? (i.inclusive ? e.data < i.value : e.data <= i.value) && (r = this._getOrReturnCtx(e, r), m(r, {
|
|
1026
|
-
code:
|
|
1026
|
+
code: d.too_small,
|
|
1027
1027
|
minimum: i.value,
|
|
1028
1028
|
type: "number",
|
|
1029
1029
|
inclusive: i.inclusive,
|
|
1030
1030
|
exact: !1,
|
|
1031
1031
|
message: i.message
|
|
1032
1032
|
}), a.dirty()) : i.kind === "max" ? (i.inclusive ? e.data > i.value : e.data >= i.value) && (r = this._getOrReturnCtx(e, r), m(r, {
|
|
1033
|
-
code:
|
|
1033
|
+
code: d.too_big,
|
|
1034
1034
|
maximum: i.value,
|
|
1035
1035
|
type: "number",
|
|
1036
1036
|
inclusive: i.inclusive,
|
|
1037
1037
|
exact: !1,
|
|
1038
1038
|
message: i.message
|
|
1039
|
-
}), a.dirty()) : i.kind === "multipleOf" ?
|
|
1040
|
-
code:
|
|
1039
|
+
}), a.dirty()) : i.kind === "multipleOf" ? Zt(e.data, i.value) !== 0 && (r = this._getOrReturnCtx(e, r), m(r, {
|
|
1040
|
+
code: d.not_multiple_of,
|
|
1041
1041
|
multipleOf: i.value,
|
|
1042
1042
|
message: i.message
|
|
1043
1043
|
}), a.dirty()) : i.kind === "finite" ? Number.isFinite(e.data) || (r = this._getOrReturnCtx(e, r), m(r, {
|
|
1044
|
-
code:
|
|
1044
|
+
code: d.not_finite,
|
|
1045
1045
|
message: i.message
|
|
1046
1046
|
}), a.dirty()) : b.assertNever(i);
|
|
1047
1047
|
return { status: a.value, value: e.data };
|
|
@@ -1190,19 +1190,19 @@ class V extends _ {
|
|
|
1190
1190
|
const a = new S();
|
|
1191
1191
|
for (const i of this._def.checks)
|
|
1192
1192
|
i.kind === "min" ? (i.inclusive ? e.data < i.value : e.data <= i.value) && (r = this._getOrReturnCtx(e, r), m(r, {
|
|
1193
|
-
code:
|
|
1193
|
+
code: d.too_small,
|
|
1194
1194
|
type: "bigint",
|
|
1195
1195
|
minimum: i.value,
|
|
1196
1196
|
inclusive: i.inclusive,
|
|
1197
1197
|
message: i.message
|
|
1198
1198
|
}), a.dirty()) : i.kind === "max" ? (i.inclusive ? e.data > i.value : e.data >= i.value) && (r = this._getOrReturnCtx(e, r), m(r, {
|
|
1199
|
-
code:
|
|
1199
|
+
code: d.too_big,
|
|
1200
1200
|
type: "bigint",
|
|
1201
1201
|
maximum: i.value,
|
|
1202
1202
|
inclusive: i.inclusive,
|
|
1203
1203
|
message: i.message
|
|
1204
1204
|
}), a.dirty()) : i.kind === "multipleOf" ? e.data % i.value !== BigInt(0) && (r = this._getOrReturnCtx(e, r), m(r, {
|
|
1205
|
-
code:
|
|
1205
|
+
code: d.not_multiple_of,
|
|
1206
1206
|
multipleOf: i.value,
|
|
1207
1207
|
message: i.message
|
|
1208
1208
|
}), a.dirty()) : b.assertNever(i);
|
|
@@ -1211,7 +1211,7 @@ class V extends _ {
|
|
|
1211
1211
|
_getInvalidInput(e) {
|
|
1212
1212
|
const t = this._getOrReturnCtx(e);
|
|
1213
1213
|
return m(t, {
|
|
1214
|
-
code:
|
|
1214
|
+
code: d.invalid_type,
|
|
1215
1215
|
expected: p.bigint,
|
|
1216
1216
|
received: t.parsedType
|
|
1217
1217
|
}), y;
|
|
@@ -1309,12 +1309,12 @@ V.create = (n) => {
|
|
|
1309
1309
|
...v(n)
|
|
1310
1310
|
});
|
|
1311
1311
|
};
|
|
1312
|
-
class
|
|
1312
|
+
class re extends _ {
|
|
1313
1313
|
_parse(e) {
|
|
1314
1314
|
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== p.boolean) {
|
|
1315
1315
|
const r = this._getOrReturnCtx(e);
|
|
1316
1316
|
return m(r, {
|
|
1317
|
-
code:
|
|
1317
|
+
code: d.invalid_type,
|
|
1318
1318
|
expected: p.boolean,
|
|
1319
1319
|
received: r.parsedType
|
|
1320
1320
|
}), y;
|
|
@@ -1322,7 +1322,7 @@ class se extends _ {
|
|
|
1322
1322
|
return I(e.data);
|
|
1323
1323
|
}
|
|
1324
1324
|
}
|
|
1325
|
-
|
|
1325
|
+
re.create = (n) => new re({
|
|
1326
1326
|
typeName: g.ZodBoolean,
|
|
1327
1327
|
coerce: (n == null ? void 0 : n.coerce) || !1,
|
|
1328
1328
|
...v(n)
|
|
@@ -1332,7 +1332,7 @@ class q extends _ {
|
|
|
1332
1332
|
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== p.date) {
|
|
1333
1333
|
const i = this._getOrReturnCtx(e);
|
|
1334
1334
|
return m(i, {
|
|
1335
|
-
code:
|
|
1335
|
+
code: d.invalid_type,
|
|
1336
1336
|
expected: p.date,
|
|
1337
1337
|
received: i.parsedType
|
|
1338
1338
|
}), y;
|
|
@@ -1340,21 +1340,21 @@ class q extends _ {
|
|
|
1340
1340
|
if (isNaN(e.data.getTime())) {
|
|
1341
1341
|
const i = this._getOrReturnCtx(e);
|
|
1342
1342
|
return m(i, {
|
|
1343
|
-
code:
|
|
1343
|
+
code: d.invalid_date
|
|
1344
1344
|
}), y;
|
|
1345
1345
|
}
|
|
1346
1346
|
const r = new S();
|
|
1347
1347
|
let a;
|
|
1348
1348
|
for (const i of this._def.checks)
|
|
1349
1349
|
i.kind === "min" ? e.data.getTime() < i.value && (a = this._getOrReturnCtx(e, a), m(a, {
|
|
1350
|
-
code:
|
|
1350
|
+
code: d.too_small,
|
|
1351
1351
|
message: i.message,
|
|
1352
1352
|
inclusive: !0,
|
|
1353
1353
|
exact: !1,
|
|
1354
1354
|
minimum: i.value,
|
|
1355
1355
|
type: "date"
|
|
1356
1356
|
}), r.dirty()) : i.kind === "max" ? e.data.getTime() > i.value && (a = this._getOrReturnCtx(e, a), m(a, {
|
|
1357
|
-
code:
|
|
1357
|
+
code: d.too_big,
|
|
1358
1358
|
message: i.message,
|
|
1359
1359
|
inclusive: !0,
|
|
1360
1360
|
exact: !1,
|
|
@@ -1410,7 +1410,7 @@ class be extends _ {
|
|
|
1410
1410
|
if (this._getType(e) !== p.symbol) {
|
|
1411
1411
|
const r = this._getOrReturnCtx(e);
|
|
1412
1412
|
return m(r, {
|
|
1413
|
-
code:
|
|
1413
|
+
code: d.invalid_type,
|
|
1414
1414
|
expected: p.symbol,
|
|
1415
1415
|
received: r.parsedType
|
|
1416
1416
|
}), y;
|
|
@@ -1422,12 +1422,12 @@ be.create = (n) => new be({
|
|
|
1422
1422
|
typeName: g.ZodSymbol,
|
|
1423
1423
|
...v(n)
|
|
1424
1424
|
});
|
|
1425
|
-
class
|
|
1425
|
+
class se extends _ {
|
|
1426
1426
|
_parse(e) {
|
|
1427
1427
|
if (this._getType(e) !== p.undefined) {
|
|
1428
1428
|
const r = this._getOrReturnCtx(e);
|
|
1429
1429
|
return m(r, {
|
|
1430
|
-
code:
|
|
1430
|
+
code: d.invalid_type,
|
|
1431
1431
|
expected: p.undefined,
|
|
1432
1432
|
received: r.parsedType
|
|
1433
1433
|
}), y;
|
|
@@ -1435,16 +1435,16 @@ class ae extends _ {
|
|
|
1435
1435
|
return I(e.data);
|
|
1436
1436
|
}
|
|
1437
1437
|
}
|
|
1438
|
-
|
|
1438
|
+
se.create = (n) => new se({
|
|
1439
1439
|
typeName: g.ZodUndefined,
|
|
1440
1440
|
...v(n)
|
|
1441
1441
|
});
|
|
1442
|
-
class
|
|
1442
|
+
class ae extends _ {
|
|
1443
1443
|
_parse(e) {
|
|
1444
1444
|
if (this._getType(e) !== p.null) {
|
|
1445
1445
|
const r = this._getOrReturnCtx(e);
|
|
1446
1446
|
return m(r, {
|
|
1447
|
-
code:
|
|
1447
|
+
code: d.invalid_type,
|
|
1448
1448
|
expected: p.null,
|
|
1449
1449
|
received: r.parsedType
|
|
1450
1450
|
}), y;
|
|
@@ -1452,7 +1452,7 @@ class ie extends _ {
|
|
|
1452
1452
|
return I(e.data);
|
|
1453
1453
|
}
|
|
1454
1454
|
}
|
|
1455
|
-
|
|
1455
|
+
ae.create = (n) => new ae({
|
|
1456
1456
|
typeName: g.ZodNull,
|
|
1457
1457
|
...v(n)
|
|
1458
1458
|
});
|
|
@@ -1468,7 +1468,7 @@ G.create = (n) => new G({
|
|
|
1468
1468
|
typeName: g.ZodAny,
|
|
1469
1469
|
...v(n)
|
|
1470
1470
|
});
|
|
1471
|
-
class
|
|
1471
|
+
class F extends _ {
|
|
1472
1472
|
constructor() {
|
|
1473
1473
|
super(...arguments), this._unknown = !0;
|
|
1474
1474
|
}
|
|
@@ -1476,7 +1476,7 @@ class U extends _ {
|
|
|
1476
1476
|
return I(e.data);
|
|
1477
1477
|
}
|
|
1478
1478
|
}
|
|
1479
|
-
|
|
1479
|
+
F.create = (n) => new F({
|
|
1480
1480
|
typeName: g.ZodUnknown,
|
|
1481
1481
|
...v(n)
|
|
1482
1482
|
});
|
|
@@ -1484,7 +1484,7 @@ class $ extends _ {
|
|
|
1484
1484
|
_parse(e) {
|
|
1485
1485
|
const t = this._getOrReturnCtx(e);
|
|
1486
1486
|
return m(t, {
|
|
1487
|
-
code:
|
|
1487
|
+
code: d.invalid_type,
|
|
1488
1488
|
expected: p.never,
|
|
1489
1489
|
received: t.parsedType
|
|
1490
1490
|
}), y;
|
|
@@ -1499,7 +1499,7 @@ class xe extends _ {
|
|
|
1499
1499
|
if (this._getType(e) !== p.undefined) {
|
|
1500
1500
|
const r = this._getOrReturnCtx(e);
|
|
1501
1501
|
return m(r, {
|
|
1502
|
-
code:
|
|
1502
|
+
code: d.invalid_type,
|
|
1503
1503
|
expected: p.void,
|
|
1504
1504
|
received: r.parsedType
|
|
1505
1505
|
}), y;
|
|
@@ -1516,14 +1516,14 @@ class C extends _ {
|
|
|
1516
1516
|
const { ctx: t, status: r } = this._processInputParams(e), a = this._def;
|
|
1517
1517
|
if (t.parsedType !== p.array)
|
|
1518
1518
|
return m(t, {
|
|
1519
|
-
code:
|
|
1519
|
+
code: d.invalid_type,
|
|
1520
1520
|
expected: p.array,
|
|
1521
1521
|
received: t.parsedType
|
|
1522
1522
|
}), y;
|
|
1523
1523
|
if (a.exactLength !== null) {
|
|
1524
1524
|
const c = t.data.length > a.exactLength.value, o = t.data.length < a.exactLength.value;
|
|
1525
1525
|
(c || o) && (m(t, {
|
|
1526
|
-
code: c ?
|
|
1526
|
+
code: c ? d.too_big : d.too_small,
|
|
1527
1527
|
minimum: o ? a.exactLength.value : void 0,
|
|
1528
1528
|
maximum: c ? a.exactLength.value : void 0,
|
|
1529
1529
|
type: "array",
|
|
@@ -1533,14 +1533,14 @@ class C extends _ {
|
|
|
1533
1533
|
}), r.dirty());
|
|
1534
1534
|
}
|
|
1535
1535
|
if (a.minLength !== null && t.data.length < a.minLength.value && (m(t, {
|
|
1536
|
-
code:
|
|
1536
|
+
code: d.too_small,
|
|
1537
1537
|
minimum: a.minLength.value,
|
|
1538
1538
|
type: "array",
|
|
1539
1539
|
inclusive: !0,
|
|
1540
1540
|
exact: !1,
|
|
1541
1541
|
message: a.minLength.message
|
|
1542
1542
|
}), r.dirty()), a.maxLength !== null && t.data.length > a.maxLength.value && (m(t, {
|
|
1543
|
-
code:
|
|
1543
|
+
code: d.too_big,
|
|
1544
1544
|
maximum: a.maxLength.value,
|
|
1545
1545
|
type: "array",
|
|
1546
1546
|
inclusive: !0,
|
|
@@ -1598,7 +1598,7 @@ function W(n) {
|
|
|
1598
1598
|
} else return n instanceof C ? new C({
|
|
1599
1599
|
...n._def,
|
|
1600
1600
|
type: W(n.element)
|
|
1601
|
-
}) : n instanceof Z ? Z.create(W(n.unwrap())) : n instanceof
|
|
1601
|
+
}) : n instanceof Z ? Z.create(W(n.unwrap())) : n instanceof L ? L.create(W(n.unwrap())) : n instanceof D ? D.create(n.items.map((e) => W(e))) : n;
|
|
1602
1602
|
}
|
|
1603
1603
|
class k extends _ {
|
|
1604
1604
|
constructor() {
|
|
@@ -1612,47 +1612,47 @@ class k extends _ {
|
|
|
1612
1612
|
}
|
|
1613
1613
|
_parse(e) {
|
|
1614
1614
|
if (this._getType(e) !== p.object) {
|
|
1615
|
-
const
|
|
1616
|
-
return m(
|
|
1617
|
-
code:
|
|
1615
|
+
const u = this._getOrReturnCtx(e);
|
|
1616
|
+
return m(u, {
|
|
1617
|
+
code: d.invalid_type,
|
|
1618
1618
|
expected: p.object,
|
|
1619
|
-
received:
|
|
1619
|
+
received: u.parsedType
|
|
1620
1620
|
}), y;
|
|
1621
1621
|
}
|
|
1622
1622
|
const { status: r, ctx: a } = this._processInputParams(e), { shape: i, keys: c } = this._getCached(), o = [];
|
|
1623
1623
|
if (!(this._def.catchall instanceof $ && this._def.unknownKeys === "strip"))
|
|
1624
|
-
for (const
|
|
1625
|
-
c.includes(
|
|
1624
|
+
for (const u in a.data)
|
|
1625
|
+
c.includes(u) || o.push(u);
|
|
1626
1626
|
const l = [];
|
|
1627
|
-
for (const
|
|
1628
|
-
const f = i[
|
|
1627
|
+
for (const u of c) {
|
|
1628
|
+
const f = i[u], x = a.data[u];
|
|
1629
1629
|
l.push({
|
|
1630
|
-
key: { status: "valid", value:
|
|
1631
|
-
value: f._parse(new O(a, x, a.path,
|
|
1632
|
-
alwaysSet:
|
|
1630
|
+
key: { status: "valid", value: u },
|
|
1631
|
+
value: f._parse(new O(a, x, a.path, u)),
|
|
1632
|
+
alwaysSet: u in a.data
|
|
1633
1633
|
});
|
|
1634
1634
|
}
|
|
1635
1635
|
if (this._def.catchall instanceof $) {
|
|
1636
|
-
const
|
|
1637
|
-
if (
|
|
1636
|
+
const u = this._def.unknownKeys;
|
|
1637
|
+
if (u === "passthrough")
|
|
1638
1638
|
for (const f of o)
|
|
1639
1639
|
l.push({
|
|
1640
1640
|
key: { status: "valid", value: f },
|
|
1641
1641
|
value: { status: "valid", value: a.data[f] }
|
|
1642
1642
|
});
|
|
1643
|
-
else if (
|
|
1643
|
+
else if (u === "strict")
|
|
1644
1644
|
o.length > 0 && (m(a, {
|
|
1645
|
-
code:
|
|
1645
|
+
code: d.unrecognized_keys,
|
|
1646
1646
|
keys: o
|
|
1647
1647
|
}), r.dirty());
|
|
1648
|
-
else if (
|
|
1648
|
+
else if (u !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
1649
1649
|
} else {
|
|
1650
|
-
const
|
|
1650
|
+
const u = this._def.catchall;
|
|
1651
1651
|
for (const f of o) {
|
|
1652
1652
|
const x = a.data[f];
|
|
1653
1653
|
l.push({
|
|
1654
1654
|
key: { status: "valid", value: f },
|
|
1655
|
-
value:
|
|
1655
|
+
value: u._parse(
|
|
1656
1656
|
new O(a, x, a.path, f)
|
|
1657
1657
|
//, ctx.child(key), value, getParsedType(value)
|
|
1658
1658
|
),
|
|
@@ -1661,17 +1661,17 @@ class k extends _ {
|
|
|
1661
1661
|
}
|
|
1662
1662
|
}
|
|
1663
1663
|
return a.common.async ? Promise.resolve().then(async () => {
|
|
1664
|
-
const
|
|
1664
|
+
const u = [];
|
|
1665
1665
|
for (const f of l) {
|
|
1666
1666
|
const x = await f.key, T = await f.value;
|
|
1667
|
-
|
|
1667
|
+
u.push({
|
|
1668
1668
|
key: x,
|
|
1669
1669
|
value: T,
|
|
1670
1670
|
alwaysSet: f.alwaysSet
|
|
1671
1671
|
});
|
|
1672
1672
|
}
|
|
1673
|
-
return
|
|
1674
|
-
}).then((
|
|
1673
|
+
return u;
|
|
1674
|
+
}).then((u) => S.mergeObjectSync(r, u)) : S.mergeObjectSync(r, l);
|
|
1675
1675
|
}
|
|
1676
1676
|
get shape() {
|
|
1677
1677
|
return this._def.shape();
|
|
@@ -1863,7 +1863,7 @@ class k extends _ {
|
|
|
1863
1863
|
});
|
|
1864
1864
|
}
|
|
1865
1865
|
keyof() {
|
|
1866
|
-
return
|
|
1866
|
+
return Qe(b.objectKeys(this.shape));
|
|
1867
1867
|
}
|
|
1868
1868
|
}
|
|
1869
1869
|
k.create = (n, e) => new k({
|
|
@@ -1887,7 +1887,7 @@ k.lazycreate = (n, e) => new k({
|
|
|
1887
1887
|
typeName: g.ZodObject,
|
|
1888
1888
|
...v(e)
|
|
1889
1889
|
});
|
|
1890
|
-
class
|
|
1890
|
+
class ie extends _ {
|
|
1891
1891
|
_parse(e) {
|
|
1892
1892
|
const { ctx: t } = this._processInputParams(e), r = this._def.options;
|
|
1893
1893
|
function a(i) {
|
|
@@ -1897,9 +1897,9 @@ class oe extends _ {
|
|
|
1897
1897
|
for (const o of i)
|
|
1898
1898
|
if (o.result.status === "dirty")
|
|
1899
1899
|
return t.common.issues.push(...o.ctx.common.issues), o.result;
|
|
1900
|
-
const c = i.map((o) => new
|
|
1900
|
+
const c = i.map((o) => new A(o.ctx.common.issues));
|
|
1901
1901
|
return m(t, {
|
|
1902
|
-
code:
|
|
1902
|
+
code: d.invalid_union,
|
|
1903
1903
|
unionErrors: c
|
|
1904
1904
|
}), y;
|
|
1905
1905
|
}
|
|
@@ -1926,7 +1926,7 @@ class oe extends _ {
|
|
|
1926
1926
|
let i;
|
|
1927
1927
|
const c = [];
|
|
1928
1928
|
for (const l of r) {
|
|
1929
|
-
const
|
|
1929
|
+
const u = {
|
|
1930
1930
|
...t,
|
|
1931
1931
|
common: {
|
|
1932
1932
|
...t.common,
|
|
@@ -1936,17 +1936,17 @@ class oe extends _ {
|
|
|
1936
1936
|
}, f = l._parseSync({
|
|
1937
1937
|
data: t.data,
|
|
1938
1938
|
path: t.path,
|
|
1939
|
-
parent:
|
|
1939
|
+
parent: u
|
|
1940
1940
|
});
|
|
1941
1941
|
if (f.status === "valid")
|
|
1942
1942
|
return f;
|
|
1943
|
-
f.status === "dirty" && !i && (i = { result: f, ctx:
|
|
1943
|
+
f.status === "dirty" && !i && (i = { result: f, ctx: u }), u.common.issues.length && c.push(u.common.issues);
|
|
1944
1944
|
}
|
|
1945
1945
|
if (i)
|
|
1946
1946
|
return t.common.issues.push(...i.ctx.common.issues), i.result;
|
|
1947
|
-
const o = c.map((l) => new
|
|
1947
|
+
const o = c.map((l) => new A(l));
|
|
1948
1948
|
return m(t, {
|
|
1949
|
-
code:
|
|
1949
|
+
code: d.invalid_union,
|
|
1950
1950
|
unionErrors: o
|
|
1951
1951
|
}), y;
|
|
1952
1952
|
}
|
|
@@ -1955,18 +1955,18 @@ class oe extends _ {
|
|
|
1955
1955
|
return this._def.options;
|
|
1956
1956
|
}
|
|
1957
1957
|
}
|
|
1958
|
-
|
|
1958
|
+
ie.create = (n, e) => new ie({
|
|
1959
1959
|
options: n,
|
|
1960
1960
|
typeName: g.ZodUnion,
|
|
1961
1961
|
...v(e)
|
|
1962
1962
|
});
|
|
1963
|
-
const P = (n) => n instanceof de ? P(n.schema) : n instanceof j ? P(n.innerType()) : n instanceof
|
|
1963
|
+
const P = (n) => n instanceof de ? P(n.schema) : n instanceof j ? P(n.innerType()) : n instanceof ue ? [n.value] : n instanceof z ? n.options : n instanceof le ? b.objectValues(n.enum) : n instanceof me ? P(n._def.innerType) : n instanceof se ? [void 0] : n instanceof ae ? [null] : n instanceof Z ? [void 0, ...P(n.unwrap())] : n instanceof L ? [null, ...P(n.unwrap())] : n instanceof Pe || n instanceof fe ? P(n.unwrap()) : n instanceof pe ? P(n._def.innerType) : [];
|
|
1964
1964
|
class Te extends _ {
|
|
1965
1965
|
_parse(e) {
|
|
1966
1966
|
const { ctx: t } = this._processInputParams(e);
|
|
1967
1967
|
if (t.parsedType !== p.object)
|
|
1968
1968
|
return m(t, {
|
|
1969
|
-
code:
|
|
1969
|
+
code: d.invalid_type,
|
|
1970
1970
|
expected: p.object,
|
|
1971
1971
|
received: t.parsedType
|
|
1972
1972
|
}), y;
|
|
@@ -1980,7 +1980,7 @@ class Te extends _ {
|
|
|
1980
1980
|
path: t.path,
|
|
1981
1981
|
parent: t
|
|
1982
1982
|
}) : (m(t, {
|
|
1983
|
-
code:
|
|
1983
|
+
code: d.invalid_union_discriminator,
|
|
1984
1984
|
options: Array.from(this.optionsMap.keys()),
|
|
1985
1985
|
path: [r]
|
|
1986
1986
|
}), y);
|
|
@@ -2049,14 +2049,14 @@ function Oe(n, e) {
|
|
|
2049
2049
|
return { valid: !0, data: a };
|
|
2050
2050
|
} else return t === p.date && r === p.date && +n == +e ? { valid: !0, data: n } : { valid: !1 };
|
|
2051
2051
|
}
|
|
2052
|
-
class
|
|
2052
|
+
class oe extends _ {
|
|
2053
2053
|
_parse(e) {
|
|
2054
2054
|
const { status: t, ctx: r } = this._processInputParams(e), a = (i, c) => {
|
|
2055
2055
|
if (je(i) || je(c))
|
|
2056
2056
|
return y;
|
|
2057
2057
|
const o = Oe(i.value, c.value);
|
|
2058
2058
|
return o.valid ? ((Ze(i) || Ze(c)) && t.dirty(), { status: t.value, value: o.data }) : (m(r, {
|
|
2059
|
-
code:
|
|
2059
|
+
code: d.invalid_intersection_types
|
|
2060
2060
|
}), y);
|
|
2061
2061
|
};
|
|
2062
2062
|
return r.common.async ? Promise.all([
|
|
@@ -2081,7 +2081,7 @@ class ce extends _ {
|
|
|
2081
2081
|
}));
|
|
2082
2082
|
}
|
|
2083
2083
|
}
|
|
2084
|
-
|
|
2084
|
+
oe.create = (n, e, t) => new oe({
|
|
2085
2085
|
left: n,
|
|
2086
2086
|
right: e,
|
|
2087
2087
|
typeName: g.ZodIntersection,
|
|
@@ -2092,20 +2092,20 @@ class D extends _ {
|
|
|
2092
2092
|
const { status: t, ctx: r } = this._processInputParams(e);
|
|
2093
2093
|
if (r.parsedType !== p.array)
|
|
2094
2094
|
return m(r, {
|
|
2095
|
-
code:
|
|
2095
|
+
code: d.invalid_type,
|
|
2096
2096
|
expected: p.array,
|
|
2097
2097
|
received: r.parsedType
|
|
2098
2098
|
}), y;
|
|
2099
2099
|
if (r.data.length < this._def.items.length)
|
|
2100
2100
|
return m(r, {
|
|
2101
|
-
code:
|
|
2101
|
+
code: d.too_small,
|
|
2102
2102
|
minimum: this._def.items.length,
|
|
2103
2103
|
inclusive: !0,
|
|
2104
2104
|
exact: !1,
|
|
2105
2105
|
type: "array"
|
|
2106
2106
|
}), y;
|
|
2107
2107
|
!this._def.rest && r.data.length > this._def.items.length && (m(r, {
|
|
2108
|
-
code:
|
|
2108
|
+
code: d.too_big,
|
|
2109
2109
|
maximum: this._def.items.length,
|
|
2110
2110
|
inclusive: !0,
|
|
2111
2111
|
exact: !1,
|
|
@@ -2137,7 +2137,7 @@ D.create = (n, e) => {
|
|
|
2137
2137
|
...v(e)
|
|
2138
2138
|
});
|
|
2139
2139
|
};
|
|
2140
|
-
class
|
|
2140
|
+
class ce extends _ {
|
|
2141
2141
|
get keySchema() {
|
|
2142
2142
|
return this._def.keyType;
|
|
2143
2143
|
}
|
|
@@ -2148,7 +2148,7 @@ class ue extends _ {
|
|
|
2148
2148
|
const { status: t, ctx: r } = this._processInputParams(e);
|
|
2149
2149
|
if (r.parsedType !== p.object)
|
|
2150
2150
|
return m(r, {
|
|
2151
|
-
code:
|
|
2151
|
+
code: d.invalid_type,
|
|
2152
2152
|
expected: p.object,
|
|
2153
2153
|
received: r.parsedType
|
|
2154
2154
|
}), y;
|
|
@@ -2165,13 +2165,13 @@ class ue extends _ {
|
|
|
2165
2165
|
return this._def.valueType;
|
|
2166
2166
|
}
|
|
2167
2167
|
static create(e, t, r) {
|
|
2168
|
-
return t instanceof _ ? new
|
|
2168
|
+
return t instanceof _ ? new ce({
|
|
2169
2169
|
keyType: e,
|
|
2170
2170
|
valueType: t,
|
|
2171
2171
|
typeName: g.ZodRecord,
|
|
2172
2172
|
...v(r)
|
|
2173
|
-
}) : new
|
|
2174
|
-
keyType:
|
|
2173
|
+
}) : new ce({
|
|
2174
|
+
keyType: N.create(),
|
|
2175
2175
|
valueType: e,
|
|
2176
2176
|
typeName: g.ZodRecord,
|
|
2177
2177
|
...v(t)
|
|
@@ -2189,32 +2189,32 @@ class ke extends _ {
|
|
|
2189
2189
|
const { status: t, ctx: r } = this._processInputParams(e);
|
|
2190
2190
|
if (r.parsedType !== p.map)
|
|
2191
2191
|
return m(r, {
|
|
2192
|
-
code:
|
|
2192
|
+
code: d.invalid_type,
|
|
2193
2193
|
expected: p.map,
|
|
2194
2194
|
received: r.parsedType
|
|
2195
2195
|
}), y;
|
|
2196
|
-
const a = this._def.keyType, i = this._def.valueType, c = [...r.data.entries()].map(([o, l],
|
|
2197
|
-
key: a._parse(new O(r, o, r.path, [
|
|
2198
|
-
value: i._parse(new O(r, l, r.path, [
|
|
2196
|
+
const a = this._def.keyType, i = this._def.valueType, c = [...r.data.entries()].map(([o, l], u) => ({
|
|
2197
|
+
key: a._parse(new O(r, o, r.path, [u, "key"])),
|
|
2198
|
+
value: i._parse(new O(r, l, r.path, [u, "value"]))
|
|
2199
2199
|
}));
|
|
2200
2200
|
if (r.common.async) {
|
|
2201
2201
|
const o = /* @__PURE__ */ new Map();
|
|
2202
2202
|
return Promise.resolve().then(async () => {
|
|
2203
2203
|
for (const l of c) {
|
|
2204
|
-
const
|
|
2205
|
-
if (
|
|
2204
|
+
const u = await l.key, f = await l.value;
|
|
2205
|
+
if (u.status === "aborted" || f.status === "aborted")
|
|
2206
2206
|
return y;
|
|
2207
|
-
(
|
|
2207
|
+
(u.status === "dirty" || f.status === "dirty") && t.dirty(), o.set(u.value, f.value);
|
|
2208
2208
|
}
|
|
2209
2209
|
return { status: t.value, value: o };
|
|
2210
2210
|
});
|
|
2211
2211
|
} else {
|
|
2212
2212
|
const o = /* @__PURE__ */ new Map();
|
|
2213
2213
|
for (const l of c) {
|
|
2214
|
-
const
|
|
2215
|
-
if (
|
|
2214
|
+
const u = l.key, f = l.value;
|
|
2215
|
+
if (u.status === "aborted" || f.status === "aborted")
|
|
2216
2216
|
return y;
|
|
2217
|
-
(
|
|
2217
|
+
(u.status === "dirty" || f.status === "dirty") && t.dirty(), o.set(u.value, f.value);
|
|
2218
2218
|
}
|
|
2219
2219
|
return { status: t.value, value: o };
|
|
2220
2220
|
}
|
|
@@ -2231,20 +2231,20 @@ class B extends _ {
|
|
|
2231
2231
|
const { status: t, ctx: r } = this._processInputParams(e);
|
|
2232
2232
|
if (r.parsedType !== p.set)
|
|
2233
2233
|
return m(r, {
|
|
2234
|
-
code:
|
|
2234
|
+
code: d.invalid_type,
|
|
2235
2235
|
expected: p.set,
|
|
2236
2236
|
received: r.parsedType
|
|
2237
2237
|
}), y;
|
|
2238
2238
|
const a = this._def;
|
|
2239
2239
|
a.minSize !== null && r.data.size < a.minSize.value && (m(r, {
|
|
2240
|
-
code:
|
|
2240
|
+
code: d.too_small,
|
|
2241
2241
|
minimum: a.minSize.value,
|
|
2242
2242
|
type: "set",
|
|
2243
2243
|
inclusive: !0,
|
|
2244
2244
|
exact: !1,
|
|
2245
2245
|
message: a.minSize.message
|
|
2246
2246
|
}), t.dirty()), a.maxSize !== null && r.data.size > a.maxSize.value && (m(r, {
|
|
2247
|
-
code:
|
|
2247
|
+
code: d.too_big,
|
|
2248
2248
|
maximum: a.maxSize.value,
|
|
2249
2249
|
type: "set",
|
|
2250
2250
|
inclusive: !0,
|
|
@@ -2253,15 +2253,15 @@ class B extends _ {
|
|
|
2253
2253
|
}), t.dirty());
|
|
2254
2254
|
const i = this._def.valueType;
|
|
2255
2255
|
function c(l) {
|
|
2256
|
-
const
|
|
2256
|
+
const u = /* @__PURE__ */ new Set();
|
|
2257
2257
|
for (const f of l) {
|
|
2258
2258
|
if (f.status === "aborted")
|
|
2259
2259
|
return y;
|
|
2260
|
-
f.status === "dirty" && t.dirty(),
|
|
2260
|
+
f.status === "dirty" && t.dirty(), u.add(f.value);
|
|
2261
2261
|
}
|
|
2262
|
-
return { status: t.value, value:
|
|
2262
|
+
return { status: t.value, value: u };
|
|
2263
2263
|
}
|
|
2264
|
-
const o = [...r.data.values()].map((l,
|
|
2264
|
+
const o = [...r.data.values()].map((l, u) => i._parse(new O(r, l, r.path, u)));
|
|
2265
2265
|
return r.common.async ? Promise.all(o).then((l) => c(l)) : c(o);
|
|
2266
2266
|
}
|
|
2267
2267
|
min(e, t) {
|
|
@@ -2298,7 +2298,7 @@ class Y extends _ {
|
|
|
2298
2298
|
const { ctx: t } = this._processInputParams(e);
|
|
2299
2299
|
if (t.parsedType !== p.function)
|
|
2300
2300
|
return m(t, {
|
|
2301
|
-
code:
|
|
2301
|
+
code: d.invalid_type,
|
|
2302
2302
|
expected: p.function,
|
|
2303
2303
|
received: t.parsedType
|
|
2304
2304
|
}), y;
|
|
@@ -2311,9 +2311,9 @@ class Y extends _ {
|
|
|
2311
2311
|
t.schemaErrorMap,
|
|
2312
2312
|
ye(),
|
|
2313
2313
|
X
|
|
2314
|
-
].filter((
|
|
2314
|
+
].filter((u) => !!u),
|
|
2315
2315
|
issueData: {
|
|
2316
|
-
code:
|
|
2316
|
+
code: d.invalid_arguments,
|
|
2317
2317
|
argumentsError: l
|
|
2318
2318
|
}
|
|
2319
2319
|
});
|
|
@@ -2327,9 +2327,9 @@ class Y extends _ {
|
|
|
2327
2327
|
t.schemaErrorMap,
|
|
2328
2328
|
ye(),
|
|
2329
2329
|
X
|
|
2330
|
-
].filter((
|
|
2330
|
+
].filter((u) => !!u),
|
|
2331
2331
|
issueData: {
|
|
2332
|
-
code:
|
|
2332
|
+
code: d.invalid_return_type,
|
|
2333
2333
|
returnTypeError: l
|
|
2334
2334
|
}
|
|
2335
2335
|
});
|
|
@@ -2338,22 +2338,22 @@ class Y extends _ {
|
|
|
2338
2338
|
if (this._def.returns instanceof J) {
|
|
2339
2339
|
const o = this;
|
|
2340
2340
|
return I(async function(...l) {
|
|
2341
|
-
const
|
|
2342
|
-
throw
|
|
2341
|
+
const u = new A([]), f = await o._def.args.parseAsync(l, i).catch((w) => {
|
|
2342
|
+
throw u.addIssue(r(l, w)), u;
|
|
2343
2343
|
}), x = await Reflect.apply(c, this, f);
|
|
2344
2344
|
return await o._def.returns._def.type.parseAsync(x, i).catch((w) => {
|
|
2345
|
-
throw
|
|
2345
|
+
throw u.addIssue(a(x, w)), u;
|
|
2346
2346
|
});
|
|
2347
2347
|
});
|
|
2348
2348
|
} else {
|
|
2349
2349
|
const o = this;
|
|
2350
2350
|
return I(function(...l) {
|
|
2351
|
-
const
|
|
2352
|
-
if (!
|
|
2353
|
-
throw new
|
|
2354
|
-
const f = Reflect.apply(c, this,
|
|
2351
|
+
const u = o._def.args.safeParse(l, i);
|
|
2352
|
+
if (!u.success)
|
|
2353
|
+
throw new A([r(l, u.error)]);
|
|
2354
|
+
const f = Reflect.apply(c, this, u.data), x = o._def.returns.safeParse(f, i);
|
|
2355
2355
|
if (!x.success)
|
|
2356
|
-
throw new
|
|
2356
|
+
throw new A([a(f, x.error)]);
|
|
2357
2357
|
return x.data;
|
|
2358
2358
|
});
|
|
2359
2359
|
}
|
|
@@ -2367,7 +2367,7 @@ class Y extends _ {
|
|
|
2367
2367
|
args(...e) {
|
|
2368
2368
|
return new Y({
|
|
2369
2369
|
...this._def,
|
|
2370
|
-
args: D.create(e).rest(
|
|
2370
|
+
args: D.create(e).rest(F.create())
|
|
2371
2371
|
});
|
|
2372
2372
|
}
|
|
2373
2373
|
returns(e) {
|
|
@@ -2384,8 +2384,8 @@ class Y extends _ {
|
|
|
2384
2384
|
}
|
|
2385
2385
|
static create(e, t, r) {
|
|
2386
2386
|
return new Y({
|
|
2387
|
-
args: e || D.create([]).rest(
|
|
2388
|
-
returns: t ||
|
|
2387
|
+
args: e || D.create([]).rest(F.create()),
|
|
2388
|
+
returns: t || F.create(),
|
|
2389
2389
|
typeName: g.ZodFunction,
|
|
2390
2390
|
...v(r)
|
|
2391
2391
|
});
|
|
@@ -2405,13 +2405,13 @@ de.create = (n, e) => new de({
|
|
|
2405
2405
|
typeName: g.ZodLazy,
|
|
2406
2406
|
...v(e)
|
|
2407
2407
|
});
|
|
2408
|
-
class
|
|
2408
|
+
class ue extends _ {
|
|
2409
2409
|
_parse(e) {
|
|
2410
2410
|
if (e.data !== this._def.value) {
|
|
2411
2411
|
const t = this._getOrReturnCtx(e);
|
|
2412
2412
|
return m(t, {
|
|
2413
2413
|
received: t.data,
|
|
2414
|
-
code:
|
|
2414
|
+
code: d.invalid_literal,
|
|
2415
2415
|
expected: this._def.value
|
|
2416
2416
|
}), y;
|
|
2417
2417
|
}
|
|
@@ -2421,12 +2421,12 @@ class le extends _ {
|
|
|
2421
2421
|
return this._def.value;
|
|
2422
2422
|
}
|
|
2423
2423
|
}
|
|
2424
|
-
|
|
2424
|
+
ue.create = (n, e) => new ue({
|
|
2425
2425
|
value: n,
|
|
2426
2426
|
typeName: g.ZodLiteral,
|
|
2427
2427
|
...v(e)
|
|
2428
2428
|
});
|
|
2429
|
-
function
|
|
2429
|
+
function Qe(n, e) {
|
|
2430
2430
|
return new z({
|
|
2431
2431
|
values: n,
|
|
2432
2432
|
typeName: g.ZodEnum,
|
|
@@ -2443,14 +2443,14 @@ class z extends _ {
|
|
|
2443
2443
|
return m(t, {
|
|
2444
2444
|
expected: b.joinValues(r),
|
|
2445
2445
|
received: t.parsedType,
|
|
2446
|
-
code:
|
|
2446
|
+
code: d.invalid_type
|
|
2447
2447
|
}), y;
|
|
2448
2448
|
}
|
|
2449
2449
|
if (_e(this, ee) || Ue(this, ee, new Set(this._def.values)), !_e(this, ee).has(e.data)) {
|
|
2450
2450
|
const t = this._getOrReturnCtx(e), r = this._def.values;
|
|
2451
2451
|
return m(t, {
|
|
2452
2452
|
received: t.data,
|
|
2453
|
-
code:
|
|
2453
|
+
code: d.invalid_enum_value,
|
|
2454
2454
|
options: r
|
|
2455
2455
|
}), y;
|
|
2456
2456
|
}
|
|
@@ -2491,8 +2491,8 @@ class z extends _ {
|
|
|
2491
2491
|
}
|
|
2492
2492
|
}
|
|
2493
2493
|
ee = /* @__PURE__ */ new WeakMap();
|
|
2494
|
-
z.create =
|
|
2495
|
-
class
|
|
2494
|
+
z.create = Qe;
|
|
2495
|
+
class le extends _ {
|
|
2496
2496
|
constructor() {
|
|
2497
2497
|
super(...arguments), te.set(this, void 0);
|
|
2498
2498
|
}
|
|
@@ -2503,14 +2503,14 @@ class me extends _ {
|
|
|
2503
2503
|
return m(r, {
|
|
2504
2504
|
expected: b.joinValues(a),
|
|
2505
2505
|
received: r.parsedType,
|
|
2506
|
-
code:
|
|
2506
|
+
code: d.invalid_type
|
|
2507
2507
|
}), y;
|
|
2508
2508
|
}
|
|
2509
2509
|
if (_e(this, te) || Ue(this, te, new Set(b.getValidEnumValues(this._def.values))), !_e(this, te).has(e.data)) {
|
|
2510
2510
|
const a = b.objectValues(t);
|
|
2511
2511
|
return m(r, {
|
|
2512
2512
|
received: r.data,
|
|
2513
|
-
code:
|
|
2513
|
+
code: d.invalid_enum_value,
|
|
2514
2514
|
options: a
|
|
2515
2515
|
}), y;
|
|
2516
2516
|
}
|
|
@@ -2521,7 +2521,7 @@ class me extends _ {
|
|
|
2521
2521
|
}
|
|
2522
2522
|
}
|
|
2523
2523
|
te = /* @__PURE__ */ new WeakMap();
|
|
2524
|
-
|
|
2524
|
+
le.create = (n, e) => new le({
|
|
2525
2525
|
values: n,
|
|
2526
2526
|
typeName: g.ZodNativeEnum,
|
|
2527
2527
|
...v(e)
|
|
@@ -2534,7 +2534,7 @@ class J extends _ {
|
|
|
2534
2534
|
const { ctx: t } = this._processInputParams(e);
|
|
2535
2535
|
if (t.parsedType !== p.promise && t.common.async === !1)
|
|
2536
2536
|
return m(t, {
|
|
2537
|
-
code:
|
|
2537
|
+
code: d.invalid_type,
|
|
2538
2538
|
expected: p.promise,
|
|
2539
2539
|
received: t.parsedType
|
|
2540
2540
|
}), y;
|
|
@@ -2616,14 +2616,14 @@ class j extends _ {
|
|
|
2616
2616
|
path: r.path,
|
|
2617
2617
|
parent: r
|
|
2618
2618
|
});
|
|
2619
|
-
if (!
|
|
2619
|
+
if (!U(c))
|
|
2620
2620
|
return c;
|
|
2621
2621
|
const o = a.transform(c.value, i);
|
|
2622
2622
|
if (o instanceof Promise)
|
|
2623
2623
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2624
2624
|
return { status: t.value, value: o };
|
|
2625
2625
|
} else
|
|
2626
|
-
return this._def.schema._parseAsync({ data: r.data, path: r.path, parent: r }).then((c) =>
|
|
2626
|
+
return this._def.schema._parseAsync({ data: r.data, path: r.path, parent: r }).then((c) => U(c) ? Promise.resolve(a.transform(c.value, i)).then((o) => ({ status: t.value, value: o })) : c);
|
|
2627
2627
|
b.assertNever(a);
|
|
2628
2628
|
}
|
|
2629
2629
|
}
|
|
@@ -2652,7 +2652,7 @@ Z.create = (n, e) => new Z({
|
|
|
2652
2652
|
typeName: g.ZodOptional,
|
|
2653
2653
|
...v(e)
|
|
2654
2654
|
});
|
|
2655
|
-
class
|
|
2655
|
+
class L extends _ {
|
|
2656
2656
|
_parse(e) {
|
|
2657
2657
|
return this._getType(e) === p.null ? I(null) : this._def.innerType._parse(e);
|
|
2658
2658
|
}
|
|
@@ -2660,12 +2660,12 @@ class F extends _ {
|
|
|
2660
2660
|
return this._def.innerType;
|
|
2661
2661
|
}
|
|
2662
2662
|
}
|
|
2663
|
-
|
|
2663
|
+
L.create = (n, e) => new L({
|
|
2664
2664
|
innerType: n,
|
|
2665
2665
|
typeName: g.ZodNullable,
|
|
2666
2666
|
...v(e)
|
|
2667
2667
|
});
|
|
2668
|
-
class
|
|
2668
|
+
class me extends _ {
|
|
2669
2669
|
_parse(e) {
|
|
2670
2670
|
const { ctx: t } = this._processInputParams(e);
|
|
2671
2671
|
let r = t.data;
|
|
@@ -2679,13 +2679,13 @@ class pe extends _ {
|
|
|
2679
2679
|
return this._def.innerType;
|
|
2680
2680
|
}
|
|
2681
2681
|
}
|
|
2682
|
-
|
|
2682
|
+
me.create = (n, e) => new me({
|
|
2683
2683
|
innerType: n,
|
|
2684
2684
|
typeName: g.ZodDefault,
|
|
2685
2685
|
defaultValue: typeof e.default == "function" ? e.default : () => e.default,
|
|
2686
2686
|
...v(e)
|
|
2687
2687
|
});
|
|
2688
|
-
class
|
|
2688
|
+
class pe extends _ {
|
|
2689
2689
|
_parse(e) {
|
|
2690
2690
|
const { ctx: t } = this._processInputParams(e), r = {
|
|
2691
2691
|
...t,
|
|
@@ -2700,11 +2700,11 @@ class fe extends _ {
|
|
|
2700
2700
|
...r
|
|
2701
2701
|
}
|
|
2702
2702
|
});
|
|
2703
|
-
return
|
|
2703
|
+
return ne(a) ? a.then((i) => ({
|
|
2704
2704
|
status: "valid",
|
|
2705
2705
|
value: i.status === "valid" ? i.value : this._def.catchValue({
|
|
2706
2706
|
get error() {
|
|
2707
|
-
return new
|
|
2707
|
+
return new A(r.common.issues);
|
|
2708
2708
|
},
|
|
2709
2709
|
input: r.data
|
|
2710
2710
|
})
|
|
@@ -2712,7 +2712,7 @@ class fe extends _ {
|
|
|
2712
2712
|
status: "valid",
|
|
2713
2713
|
value: a.status === "valid" ? a.value : this._def.catchValue({
|
|
2714
2714
|
get error() {
|
|
2715
|
-
return new
|
|
2715
|
+
return new A(r.common.issues);
|
|
2716
2716
|
},
|
|
2717
2717
|
input: r.data
|
|
2718
2718
|
})
|
|
@@ -2722,7 +2722,7 @@ class fe extends _ {
|
|
|
2722
2722
|
return this._def.innerType;
|
|
2723
2723
|
}
|
|
2724
2724
|
}
|
|
2725
|
-
|
|
2725
|
+
pe.create = (n, e) => new pe({
|
|
2726
2726
|
innerType: n,
|
|
2727
2727
|
typeName: g.ZodCatch,
|
|
2728
2728
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
|
|
@@ -2733,7 +2733,7 @@ class we extends _ {
|
|
|
2733
2733
|
if (this._getType(e) !== p.nan) {
|
|
2734
2734
|
const r = this._getOrReturnCtx(e);
|
|
2735
2735
|
return m(r, {
|
|
2736
|
-
code:
|
|
2736
|
+
code: d.invalid_type,
|
|
2737
2737
|
expected: p.nan,
|
|
2738
2738
|
received: r.parsedType
|
|
2739
2739
|
}), y;
|
|
@@ -2745,7 +2745,7 @@ we.create = (n) => new we({
|
|
|
2745
2745
|
typeName: g.ZodNaN,
|
|
2746
2746
|
...v(n)
|
|
2747
2747
|
});
|
|
2748
|
-
const
|
|
2748
|
+
const Ot = Symbol("zod_brand");
|
|
2749
2749
|
class Pe extends _ {
|
|
2750
2750
|
_parse(e) {
|
|
2751
2751
|
const { ctx: t } = this._processInputParams(e), r = t.data;
|
|
@@ -2759,7 +2759,7 @@ class Pe extends _ {
|
|
|
2759
2759
|
return this._def.type;
|
|
2760
2760
|
}
|
|
2761
2761
|
}
|
|
2762
|
-
class
|
|
2762
|
+
class he extends _ {
|
|
2763
2763
|
_parse(e) {
|
|
2764
2764
|
const { status: t, ctx: r } = this._processInputParams(e);
|
|
2765
2765
|
if (r.common.async)
|
|
@@ -2792,75 +2792,75 @@ class ge extends _ {
|
|
|
2792
2792
|
}
|
|
2793
2793
|
}
|
|
2794
2794
|
static create(e, t) {
|
|
2795
|
-
return new
|
|
2795
|
+
return new he({
|
|
2796
2796
|
in: e,
|
|
2797
2797
|
out: t,
|
|
2798
2798
|
typeName: g.ZodPipeline
|
|
2799
2799
|
});
|
|
2800
2800
|
}
|
|
2801
2801
|
}
|
|
2802
|
-
class
|
|
2802
|
+
class fe extends _ {
|
|
2803
2803
|
_parse(e) {
|
|
2804
|
-
const t = this._def.innerType._parse(e), r = (a) => (
|
|
2805
|
-
return
|
|
2804
|
+
const t = this._def.innerType._parse(e), r = (a) => (U(a) && (a.value = Object.freeze(a.value)), a);
|
|
2805
|
+
return ne(t) ? t.then((a) => r(a)) : r(t);
|
|
2806
2806
|
}
|
|
2807
2807
|
unwrap() {
|
|
2808
2808
|
return this._def.innerType;
|
|
2809
2809
|
}
|
|
2810
2810
|
}
|
|
2811
|
-
|
|
2811
|
+
fe.create = (n, e) => new fe({
|
|
2812
2812
|
innerType: n,
|
|
2813
2813
|
typeName: g.ZodReadonly,
|
|
2814
2814
|
...v(e)
|
|
2815
2815
|
});
|
|
2816
|
-
function
|
|
2816
|
+
function Ve(n, e) {
|
|
2817
2817
|
const t = typeof n == "function" ? n(e) : typeof n == "string" ? { message: n } : n;
|
|
2818
2818
|
return typeof t == "string" ? { message: t } : t;
|
|
2819
2819
|
}
|
|
2820
|
-
function
|
|
2820
|
+
function Ye(n, e = {}, t) {
|
|
2821
2821
|
return n ? G.create().superRefine((r, a) => {
|
|
2822
2822
|
var i, c;
|
|
2823
2823
|
const o = n(r);
|
|
2824
2824
|
if (o instanceof Promise)
|
|
2825
2825
|
return o.then((l) => {
|
|
2826
|
-
var
|
|
2826
|
+
var u, f;
|
|
2827
2827
|
if (!l) {
|
|
2828
|
-
const x =
|
|
2828
|
+
const x = Ve(e, r), T = (f = (u = x.fatal) !== null && u !== void 0 ? u : t) !== null && f !== void 0 ? f : !0;
|
|
2829
2829
|
a.addIssue({ code: "custom", ...x, fatal: T });
|
|
2830
2830
|
}
|
|
2831
2831
|
});
|
|
2832
2832
|
if (!o) {
|
|
2833
|
-
const l =
|
|
2834
|
-
a.addIssue({ code: "custom", ...l, fatal:
|
|
2833
|
+
const l = Ve(e, r), u = (c = (i = l.fatal) !== null && i !== void 0 ? i : t) !== null && c !== void 0 ? c : !0;
|
|
2834
|
+
a.addIssue({ code: "custom", ...l, fatal: u });
|
|
2835
2835
|
}
|
|
2836
2836
|
}) : G.create();
|
|
2837
2837
|
}
|
|
2838
|
-
const
|
|
2838
|
+
const Dt = {
|
|
2839
2839
|
object: k.lazycreate
|
|
2840
2840
|
};
|
|
2841
2841
|
var g;
|
|
2842
2842
|
(function(n) {
|
|
2843
2843
|
n.ZodString = "ZodString", n.ZodNumber = "ZodNumber", n.ZodNaN = "ZodNaN", n.ZodBigInt = "ZodBigInt", n.ZodBoolean = "ZodBoolean", n.ZodDate = "ZodDate", n.ZodSymbol = "ZodSymbol", n.ZodUndefined = "ZodUndefined", n.ZodNull = "ZodNull", n.ZodAny = "ZodAny", n.ZodUnknown = "ZodUnknown", n.ZodNever = "ZodNever", n.ZodVoid = "ZodVoid", n.ZodArray = "ZodArray", n.ZodObject = "ZodObject", n.ZodUnion = "ZodUnion", n.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", n.ZodIntersection = "ZodIntersection", n.ZodTuple = "ZodTuple", n.ZodRecord = "ZodRecord", n.ZodMap = "ZodMap", n.ZodSet = "ZodSet", n.ZodFunction = "ZodFunction", n.ZodLazy = "ZodLazy", n.ZodLiteral = "ZodLiteral", n.ZodEnum = "ZodEnum", n.ZodEffects = "ZodEffects", n.ZodNativeEnum = "ZodNativeEnum", n.ZodOptional = "ZodOptional", n.ZodNullable = "ZodNullable", n.ZodDefault = "ZodDefault", n.ZodCatch = "ZodCatch", n.ZodPromise = "ZodPromise", n.ZodBranded = "ZodBranded", n.ZodPipeline = "ZodPipeline", n.ZodReadonly = "ZodReadonly";
|
|
2844
2844
|
})(g || (g = {}));
|
|
2845
|
-
const
|
|
2845
|
+
const Pt = (n, e = {
|
|
2846
2846
|
message: `Input not instance of ${n.name}`
|
|
2847
|
-
}) =>
|
|
2848
|
-
string: (n) =>
|
|
2847
|
+
}) => Ye((t) => t instanceof n, e), Xe = N.create, Ge = M.create, Et = we.create, Rt = V.create, Je = re.create, $t = q.create, Mt = be.create, Vt = se.create, zt = ae.create, Lt = G.create, Ft = F.create, Ut = $.create, qt = xe.create, Bt = C.create, Wt = k.create, Qt = k.strictCreate, Yt = ie.create, Xt = Te.create, Gt = oe.create, Jt = D.create, Ht = ce.create, Kt = ke.create, en = B.create, tn = Y.create, nn = de.create, rn = ue.create, sn = z.create, an = le.create, on = J.create, ze = j.create, cn = Z.create, dn = L.create, un = j.createWithPreprocess, ln = he.create, mn = () => Xe().optional(), pn = () => Ge().optional(), fn = () => Je().optional(), hn = {
|
|
2848
|
+
string: (n) => N.create({ ...n, coerce: !0 }),
|
|
2849
2849
|
number: (n) => M.create({ ...n, coerce: !0 }),
|
|
2850
|
-
boolean: (n) =>
|
|
2850
|
+
boolean: (n) => re.create({
|
|
2851
2851
|
...n,
|
|
2852
2852
|
coerce: !0
|
|
2853
2853
|
}),
|
|
2854
2854
|
bigint: (n) => V.create({ ...n, coerce: !0 }),
|
|
2855
2855
|
date: (n) => q.create({ ...n, coerce: !0 })
|
|
2856
|
-
},
|
|
2856
|
+
}, gn = y;
|
|
2857
2857
|
var s = /* @__PURE__ */ Object.freeze({
|
|
2858
2858
|
__proto__: null,
|
|
2859
2859
|
defaultErrorMap: X,
|
|
2860
2860
|
setErrorMap: dt,
|
|
2861
2861
|
getErrorMap: ye,
|
|
2862
2862
|
makeIssue: ve,
|
|
2863
|
-
EMPTY_PATH:
|
|
2863
|
+
EMPTY_PATH: ut,
|
|
2864
2864
|
addIssueToContext: m,
|
|
2865
2865
|
ParseStatus: S,
|
|
2866
2866
|
INVALID: y,
|
|
@@ -2868,8 +2868,8 @@ var s = /* @__PURE__ */ Object.freeze({
|
|
|
2868
2868
|
OK: I,
|
|
2869
2869
|
isAborted: je,
|
|
2870
2870
|
isDirty: Ze,
|
|
2871
|
-
isValid:
|
|
2872
|
-
isAsync:
|
|
2871
|
+
isValid: U,
|
|
2872
|
+
isAsync: ne,
|
|
2873
2873
|
get util() {
|
|
2874
2874
|
return b;
|
|
2875
2875
|
},
|
|
@@ -2879,96 +2879,96 @@ var s = /* @__PURE__ */ Object.freeze({
|
|
|
2879
2879
|
ZodParsedType: p,
|
|
2880
2880
|
getParsedType: E,
|
|
2881
2881
|
ZodType: _,
|
|
2882
|
-
datetimeRegex:
|
|
2883
|
-
ZodString:
|
|
2882
|
+
datetimeRegex: We,
|
|
2883
|
+
ZodString: N,
|
|
2884
2884
|
ZodNumber: M,
|
|
2885
2885
|
ZodBigInt: V,
|
|
2886
|
-
ZodBoolean:
|
|
2886
|
+
ZodBoolean: re,
|
|
2887
2887
|
ZodDate: q,
|
|
2888
2888
|
ZodSymbol: be,
|
|
2889
|
-
ZodUndefined:
|
|
2890
|
-
ZodNull:
|
|
2889
|
+
ZodUndefined: se,
|
|
2890
|
+
ZodNull: ae,
|
|
2891
2891
|
ZodAny: G,
|
|
2892
|
-
ZodUnknown:
|
|
2892
|
+
ZodUnknown: F,
|
|
2893
2893
|
ZodNever: $,
|
|
2894
2894
|
ZodVoid: xe,
|
|
2895
2895
|
ZodArray: C,
|
|
2896
2896
|
ZodObject: k,
|
|
2897
|
-
ZodUnion:
|
|
2897
|
+
ZodUnion: ie,
|
|
2898
2898
|
ZodDiscriminatedUnion: Te,
|
|
2899
|
-
ZodIntersection:
|
|
2899
|
+
ZodIntersection: oe,
|
|
2900
2900
|
ZodTuple: D,
|
|
2901
|
-
ZodRecord:
|
|
2901
|
+
ZodRecord: ce,
|
|
2902
2902
|
ZodMap: ke,
|
|
2903
2903
|
ZodSet: B,
|
|
2904
2904
|
ZodFunction: Y,
|
|
2905
2905
|
ZodLazy: de,
|
|
2906
|
-
ZodLiteral:
|
|
2906
|
+
ZodLiteral: ue,
|
|
2907
2907
|
ZodEnum: z,
|
|
2908
|
-
ZodNativeEnum:
|
|
2908
|
+
ZodNativeEnum: le,
|
|
2909
2909
|
ZodPromise: J,
|
|
2910
2910
|
ZodEffects: j,
|
|
2911
2911
|
ZodTransformer: j,
|
|
2912
2912
|
ZodOptional: Z,
|
|
2913
|
-
ZodNullable:
|
|
2914
|
-
ZodDefault:
|
|
2915
|
-
ZodCatch:
|
|
2913
|
+
ZodNullable: L,
|
|
2914
|
+
ZodDefault: me,
|
|
2915
|
+
ZodCatch: pe,
|
|
2916
2916
|
ZodNaN: we,
|
|
2917
|
-
BRAND:
|
|
2917
|
+
BRAND: Ot,
|
|
2918
2918
|
ZodBranded: Pe,
|
|
2919
|
-
ZodPipeline:
|
|
2920
|
-
ZodReadonly:
|
|
2921
|
-
custom:
|
|
2919
|
+
ZodPipeline: he,
|
|
2920
|
+
ZodReadonly: fe,
|
|
2921
|
+
custom: Ye,
|
|
2922
2922
|
Schema: _,
|
|
2923
2923
|
ZodSchema: _,
|
|
2924
|
-
late:
|
|
2924
|
+
late: Dt,
|
|
2925
2925
|
get ZodFirstPartyTypeKind() {
|
|
2926
2926
|
return g;
|
|
2927
2927
|
},
|
|
2928
|
-
coerce:
|
|
2929
|
-
any:
|
|
2930
|
-
array:
|
|
2931
|
-
bigint:
|
|
2932
|
-
boolean:
|
|
2933
|
-
date:
|
|
2934
|
-
discriminatedUnion:
|
|
2935
|
-
effect:
|
|
2936
|
-
enum:
|
|
2937
|
-
function:
|
|
2938
|
-
instanceof:
|
|
2939
|
-
intersection:
|
|
2940
|
-
lazy:
|
|
2941
|
-
literal:
|
|
2942
|
-
map:
|
|
2943
|
-
nan:
|
|
2944
|
-
nativeEnum:
|
|
2945
|
-
never:
|
|
2946
|
-
null:
|
|
2928
|
+
coerce: hn,
|
|
2929
|
+
any: Lt,
|
|
2930
|
+
array: Bt,
|
|
2931
|
+
bigint: Rt,
|
|
2932
|
+
boolean: Je,
|
|
2933
|
+
date: $t,
|
|
2934
|
+
discriminatedUnion: Xt,
|
|
2935
|
+
effect: ze,
|
|
2936
|
+
enum: sn,
|
|
2937
|
+
function: tn,
|
|
2938
|
+
instanceof: Pt,
|
|
2939
|
+
intersection: Gt,
|
|
2940
|
+
lazy: nn,
|
|
2941
|
+
literal: rn,
|
|
2942
|
+
map: Kt,
|
|
2943
|
+
nan: Et,
|
|
2944
|
+
nativeEnum: an,
|
|
2945
|
+
never: Ut,
|
|
2946
|
+
null: zt,
|
|
2947
2947
|
nullable: dn,
|
|
2948
|
-
number:
|
|
2949
|
-
object:
|
|
2950
|
-
oboolean:
|
|
2951
|
-
onumber:
|
|
2952
|
-
optional:
|
|
2953
|
-
ostring:
|
|
2954
|
-
pipeline:
|
|
2955
|
-
preprocess:
|
|
2956
|
-
promise:
|
|
2957
|
-
record:
|
|
2958
|
-
set:
|
|
2959
|
-
strictObject:
|
|
2960
|
-
string:
|
|
2961
|
-
symbol:
|
|
2962
|
-
transformer:
|
|
2963
|
-
tuple:
|
|
2964
|
-
undefined:
|
|
2965
|
-
union:
|
|
2966
|
-
unknown:
|
|
2967
|
-
void:
|
|
2968
|
-
NEVER:
|
|
2969
|
-
ZodIssueCode:
|
|
2970
|
-
quotelessJson:
|
|
2971
|
-
ZodError:
|
|
2948
|
+
number: Ge,
|
|
2949
|
+
object: Wt,
|
|
2950
|
+
oboolean: fn,
|
|
2951
|
+
onumber: pn,
|
|
2952
|
+
optional: cn,
|
|
2953
|
+
ostring: mn,
|
|
2954
|
+
pipeline: ln,
|
|
2955
|
+
preprocess: un,
|
|
2956
|
+
promise: on,
|
|
2957
|
+
record: Ht,
|
|
2958
|
+
set: en,
|
|
2959
|
+
strictObject: Qt,
|
|
2960
|
+
string: Xe,
|
|
2961
|
+
symbol: Mt,
|
|
2962
|
+
transformer: ze,
|
|
2963
|
+
tuple: Jt,
|
|
2964
|
+
undefined: Vt,
|
|
2965
|
+
union: Yt,
|
|
2966
|
+
unknown: Ft,
|
|
2967
|
+
void: qt,
|
|
2968
|
+
NEVER: gn,
|
|
2969
|
+
ZodIssueCode: d,
|
|
2970
|
+
quotelessJson: ct,
|
|
2971
|
+
ZodError: A
|
|
2972
2972
|
});
|
|
2973
2973
|
const Se = s.object({
|
|
2974
2974
|
country: s.string().optional(),
|
|
@@ -2982,33 +2982,33 @@ const Se = s.object({
|
|
|
2982
2982
|
function zn(n) {
|
|
2983
2983
|
return !!(n != null && n.url);
|
|
2984
2984
|
}
|
|
2985
|
-
const
|
|
2985
|
+
const ge = s.object({
|
|
2986
2986
|
lang: s.enum(["he"]),
|
|
2987
2987
|
value: s.string()
|
|
2988
|
-
}),
|
|
2988
|
+
}), He = s.object({
|
|
2989
2989
|
id: s.string().min(1),
|
|
2990
2990
|
companyId: s.string().min(1),
|
|
2991
2991
|
storeId: s.string().min(1),
|
|
2992
2992
|
parentId: s.string().nullish(),
|
|
2993
2993
|
tag: s.string().optional(),
|
|
2994
|
-
locales: s.array(
|
|
2994
|
+
locales: s.array(ge),
|
|
2995
2995
|
depth: s.number()
|
|
2996
|
-
}), Ee =
|
|
2996
|
+
}), Ee = He.extend({
|
|
2997
2997
|
children: s.lazy(() => Ee.array())
|
|
2998
|
-
}),
|
|
2998
|
+
}), Ln = He.extend({
|
|
2999
2999
|
index: s.number(),
|
|
3000
3000
|
depth: s.number(),
|
|
3001
3001
|
collapsed: s.boolean().optional(),
|
|
3002
3002
|
children: s.array(Ee)
|
|
3003
|
-
}), K = s.string().min(1),
|
|
3003
|
+
}), K = s.string().min(1), Re = s.object({
|
|
3004
3004
|
type: s.literal("Product"),
|
|
3005
3005
|
storeId: K,
|
|
3006
3006
|
companyId: K,
|
|
3007
3007
|
id: K,
|
|
3008
3008
|
objectID: K,
|
|
3009
3009
|
sku: K,
|
|
3010
|
-
name: s.array(
|
|
3011
|
-
description: s.array(
|
|
3010
|
+
name: s.array(ge),
|
|
3011
|
+
description: s.array(ge),
|
|
3012
3012
|
isPublished: s.boolean(),
|
|
3013
3013
|
vat: s.boolean(),
|
|
3014
3014
|
priceType: s.object({
|
|
@@ -3037,7 +3037,7 @@ const ne = s.object({
|
|
|
3037
3037
|
brand: s.string(),
|
|
3038
3038
|
importer: s.string(),
|
|
3039
3039
|
supplier: s.string(),
|
|
3040
|
-
ingredients: s.array(
|
|
3040
|
+
ingredients: s.array(ge),
|
|
3041
3041
|
created_at: s.number(),
|
|
3042
3042
|
updated_at: s.number(),
|
|
3043
3043
|
categoryIds: s.array(s.string().nonempty()),
|
|
@@ -3057,15 +3057,22 @@ const ne = s.object({
|
|
|
3057
3057
|
}).optional(),
|
|
3058
3058
|
// @deprecated
|
|
3059
3059
|
categoryNames: s.array(s.string()).optional()
|
|
3060
|
-
}),
|
|
3060
|
+
}), Fn = Re.extend({
|
|
3061
3061
|
image: s.instanceof(File).optional()
|
|
3062
|
+
}), yn = s.enum(["delivered", "missing", "substituted"]), vn = s.object({
|
|
3063
|
+
product: Re,
|
|
3064
|
+
amount: s.number().positive(),
|
|
3065
|
+
price: s.number()
|
|
3062
3066
|
}), Ke = s.object({
|
|
3063
|
-
product:
|
|
3067
|
+
product: Re,
|
|
3064
3068
|
originalPrice: s.number().optional(),
|
|
3065
3069
|
finalPrice: s.number().optional(),
|
|
3066
3070
|
finalDiscount: s.number().optional(),
|
|
3067
|
-
amount: s.number().positive({ message: "Quantity must be a positive number." })
|
|
3068
|
-
|
|
3071
|
+
amount: s.number().positive({ message: "Quantity must be a positive number." }),
|
|
3072
|
+
// Picking / fulfillment — optional so existing items stay valid (treated as "delivered").
|
|
3073
|
+
status: yn.optional(),
|
|
3074
|
+
substitutedWith: vn.nullable().optional()
|
|
3075
|
+
}), Un = s.object({
|
|
3069
3076
|
type: s.literal("Cart"),
|
|
3070
3077
|
id: s.string().uuid(),
|
|
3071
3078
|
companyId: s.string().uuid(),
|
|
@@ -3073,18 +3080,18 @@ const ne = s.object({
|
|
|
3073
3080
|
userId: s.string().uuid(),
|
|
3074
3081
|
status: s.enum(["active", "draft", "completed"]),
|
|
3075
3082
|
items: s.array(Ke)
|
|
3076
|
-
}),
|
|
3083
|
+
}), qn = s.object({
|
|
3077
3084
|
id: s.string(),
|
|
3078
3085
|
name: s.string(),
|
|
3079
3086
|
websiteDomains: s.array(s.string())
|
|
3080
|
-
}),
|
|
3087
|
+
}), Bn = s.object({
|
|
3081
3088
|
type: s.literal("FavoriteProduct"),
|
|
3082
3089
|
id: s.string().uuid(),
|
|
3083
3090
|
companyId: s.string().uuid(),
|
|
3084
3091
|
storeId: s.string().uuid(),
|
|
3085
3092
|
userId: s.string().uuid(),
|
|
3086
3093
|
productId: s.string().uuid()
|
|
3087
|
-
}), Ie = s.enum(["external", "j5", "none"]),
|
|
3094
|
+
}), Ie = s.enum(["external", "j5", "none"]), _n = s.object({
|
|
3088
3095
|
type: s.literal("Profile"),
|
|
3089
3096
|
id: R,
|
|
3090
3097
|
companyId: R,
|
|
@@ -3118,7 +3125,7 @@ const ne = s.object({
|
|
|
3118
3125
|
price_discount_in_currency: s.number(),
|
|
3119
3126
|
price_total: s.string().regex(/^\d+\.\d{2}$/, "Price total must be in format XX.XX"),
|
|
3120
3127
|
price_total_in_currency: s.number().positive()
|
|
3121
|
-
}),
|
|
3128
|
+
}), bn = s.object({
|
|
3122
3129
|
doc_uuid: s.string().uuid("Document UUID must be a valid UUID"),
|
|
3123
3130
|
pdf_link: s.string().url("PDF link must be a valid URL"),
|
|
3124
3131
|
pdf_link_copy: s.string().url("PDF copy link must be a valid URL"),
|
|
@@ -3129,7 +3136,7 @@ const ne = s.object({
|
|
|
3129
3136
|
calculatedData: et,
|
|
3130
3137
|
warning: s.string().optional(),
|
|
3131
3138
|
date: s.number().optional()
|
|
3132
|
-
}),
|
|
3139
|
+
}), xn = s.object({
|
|
3133
3140
|
id: s.string().min(1, "ID is required"),
|
|
3134
3141
|
number: s.string().min(1, "Number is required"),
|
|
3135
3142
|
date: s.number().min(1, "Date is required"),
|
|
@@ -3162,7 +3169,7 @@ const ne = s.object({
|
|
|
3162
3169
|
number: s.string(),
|
|
3163
3170
|
name: s.string(),
|
|
3164
3171
|
id: s.string()
|
|
3165
|
-
}),
|
|
3172
|
+
}), kn = s.object({
|
|
3166
3173
|
id: s.string(),
|
|
3167
3174
|
name: s.string(),
|
|
3168
3175
|
discountPercentage: s.number().positive().min(0).max(100).optional(),
|
|
@@ -3172,7 +3179,7 @@ const ne = s.object({
|
|
|
3172
3179
|
companyNumber: s.string().optional(),
|
|
3173
3180
|
address: Se.optional(),
|
|
3174
3181
|
groupId: s.string().optional()
|
|
3175
|
-
}),
|
|
3182
|
+
}), Wn = kn.omit({ id: !0 }), wn = s.object({
|
|
3176
3183
|
doc_uuid: s.string().uuid("Document UUID must be a valid UUID"),
|
|
3177
3184
|
pdf_link: s.string().url("PDF link must be a valid URL"),
|
|
3178
3185
|
pdf_link_copy: s.string().url("PDF copy link must be a valid URL"),
|
|
@@ -3183,7 +3190,7 @@ const ne = s.object({
|
|
|
3183
3190
|
calculatedData: et,
|
|
3184
3191
|
warning: s.string().optional(),
|
|
3185
3192
|
date: s.number().optional()
|
|
3186
|
-
}),
|
|
3193
|
+
}), Tn = s.object({
|
|
3187
3194
|
id: s.string().min(1, "ID is required"),
|
|
3188
3195
|
number: s.string().min(1, "Number is required"),
|
|
3189
3196
|
date: s.string().min(1, "Date is required"),
|
|
@@ -3212,7 +3219,7 @@ const ne = s.object({
|
|
|
3212
3219
|
total: s.number().min(1, "Total is required").optional(),
|
|
3213
3220
|
vat: s.number().min(1, "VAT is required").optional(),
|
|
3214
3221
|
link: s.string().url("Link must be a valid URL").optional()
|
|
3215
|
-
}),
|
|
3222
|
+
}), Qn = s.object({
|
|
3216
3223
|
type: s.literal("Order"),
|
|
3217
3224
|
createdBy: s.enum(["user", "admin"]).optional(),
|
|
3218
3225
|
id: R,
|
|
@@ -3256,7 +3263,7 @@ const ne = s.object({
|
|
|
3256
3263
|
// what store charge
|
|
3257
3264
|
date: s.number(),
|
|
3258
3265
|
deliveryDate: s.coerce.number(),
|
|
3259
|
-
client:
|
|
3266
|
+
client: _n.optional(),
|
|
3260
3267
|
address: Se.optional(),
|
|
3261
3268
|
nameOnInvoice: s.string().optional(),
|
|
3262
3269
|
emailOnInvoice: s.string().email().optional(),
|
|
@@ -3264,11 +3271,14 @@ const ne = s.object({
|
|
|
3264
3271
|
clientComment: s.string().optional(),
|
|
3265
3272
|
organizationId: s.string().optional(),
|
|
3266
3273
|
billingAccount: tt.optional(),
|
|
3267
|
-
deliveryNote:
|
|
3268
|
-
invoice:
|
|
3269
|
-
ezInvoice:
|
|
3270
|
-
ezDeliveryNote:
|
|
3271
|
-
|
|
3274
|
+
deliveryNote: xn.optional(),
|
|
3275
|
+
invoice: Tn.optional(),
|
|
3276
|
+
ezInvoice: wn.optional(),
|
|
3277
|
+
ezDeliveryNote: bn.optional(),
|
|
3278
|
+
// Audit: who last changed the order + when (epoch millis). Stamped by admin writes.
|
|
3279
|
+
updatedBy: s.string().optional(),
|
|
3280
|
+
updatedAt: s.number().optional()
|
|
3281
|
+
}), Sn = s.enum(["individual", "company"]), Yn = s.object({
|
|
3272
3282
|
id: s.string(),
|
|
3273
3283
|
companyId: s.string(),
|
|
3274
3284
|
name: s.string(),
|
|
@@ -3279,17 +3289,17 @@ const ne = s.object({
|
|
|
3279
3289
|
paymentType: Ie,
|
|
3280
3290
|
allowAnonymousClients: s.boolean(),
|
|
3281
3291
|
isVatIncludedInPrice: s.boolean(),
|
|
3282
|
-
clientTypes: s.array(
|
|
3292
|
+
clientTypes: s.array(Sn),
|
|
3283
3293
|
minimumOrder: s.number().optional(),
|
|
3284
3294
|
freeDeliveryPrice: s.number().optional(),
|
|
3285
3295
|
deliveryPrice: s.number().optional(),
|
|
3286
3296
|
address: Se.optional(),
|
|
3287
3297
|
companyNumber: s.string().optional()
|
|
3288
3298
|
// חפ של החברה
|
|
3289
|
-
}),
|
|
3299
|
+
}), In = s.object({
|
|
3290
3300
|
minSpend: s.number().positive().optional(),
|
|
3291
3301
|
stackable: s.boolean().default(!1)
|
|
3292
|
-
}).optional(),
|
|
3302
|
+
}).optional(), An = s.discriminatedUnion("variantType", [
|
|
3293
3303
|
s.object({
|
|
3294
3304
|
variantType: s.literal("bundle"),
|
|
3295
3305
|
productsId: s.array(s.string().nonempty()).min(1),
|
|
@@ -3299,7 +3309,7 @@ const ne = s.object({
|
|
|
3299
3309
|
bundlePrice: s.number().positive()
|
|
3300
3310
|
// Total price for the bundle (e.g., $25)
|
|
3301
3311
|
})
|
|
3302
|
-
]),
|
|
3312
|
+
]), Xn = s.object({
|
|
3303
3313
|
type: s.literal("Discount"),
|
|
3304
3314
|
storeId: s.string().min(1),
|
|
3305
3315
|
companyId: s.string().min(1),
|
|
@@ -3308,8 +3318,8 @@ const ne = s.object({
|
|
|
3308
3318
|
active: s.boolean(),
|
|
3309
3319
|
startDate: s.number(),
|
|
3310
3320
|
endDate: s.number(),
|
|
3311
|
-
variant:
|
|
3312
|
-
conditions:
|
|
3321
|
+
variant: An,
|
|
3322
|
+
conditions: In
|
|
3313
3323
|
});
|
|
3314
3324
|
class Nn {
|
|
3315
3325
|
canApply(e, t) {
|
|
@@ -3323,13 +3333,13 @@ class Nn {
|
|
|
3323
3333
|
const { productsId: r, requiredQuantity: a, bundlePrice: i } = e.variant, c = t.cart.filter((H) => r.includes(H.product.id)), o = this.getTotalQuantity(t.cart, r), l = Math.floor(o / a);
|
|
3324
3334
|
if (l === 0)
|
|
3325
3335
|
return { applicable: !1, discountAmount: 0, affectedItems: [] };
|
|
3326
|
-
const
|
|
3327
|
-
|
|
3336
|
+
const u = this.calculateOriginalPrice(c), f = this.getTotalQuantity(t.cart, r), x = this.calculateDiscountedPrice(
|
|
3337
|
+
u,
|
|
3328
3338
|
i,
|
|
3329
3339
|
l,
|
|
3330
3340
|
a,
|
|
3331
3341
|
f
|
|
3332
|
-
), T =
|
|
3342
|
+
), T = u - x, w = this.distributeDiscount(c, T, u);
|
|
3333
3343
|
return {
|
|
3334
3344
|
applicable: !0,
|
|
3335
3345
|
discountAmount: Number(T.toFixed(2)),
|
|
@@ -3347,8 +3357,8 @@ class Nn {
|
|
|
3347
3357
|
return e.reduce((t, r) => t + r.product.price * r.amount, 0);
|
|
3348
3358
|
}
|
|
3349
3359
|
calculateDiscountedPrice(e, t, r, a, i) {
|
|
3350
|
-
const c = t * r, o = r * a,
|
|
3351
|
-
return c +
|
|
3360
|
+
const c = t * r, o = r * a, u = Math.max(0, i - o) / i * e;
|
|
3361
|
+
return c + u;
|
|
3352
3362
|
}
|
|
3353
3363
|
distributeDiscount(e, t, r) {
|
|
3354
3364
|
const a = t / r;
|
|
@@ -3378,12 +3388,12 @@ class nt {
|
|
|
3378
3388
|
this.strategies.clear();
|
|
3379
3389
|
}
|
|
3380
3390
|
}
|
|
3381
|
-
|
|
3391
|
+
$e(nt, "strategies", /* @__PURE__ */ new Map([
|
|
3382
3392
|
["bundle", new Nn()]
|
|
3383
3393
|
]));
|
|
3384
|
-
class
|
|
3394
|
+
class Gn {
|
|
3385
3395
|
static calculateDiscounts(e, t, r) {
|
|
3386
|
-
var
|
|
3396
|
+
var u, f;
|
|
3387
3397
|
const a = {
|
|
3388
3398
|
cart: e,
|
|
3389
3399
|
user: r,
|
|
@@ -3391,7 +3401,7 @@ class Jn {
|
|
|
3391
3401
|
}, i = this.filterActiveDiscounts(t), c = [];
|
|
3392
3402
|
for (const x of i) {
|
|
3393
3403
|
const T = nt.getStrategy(x);
|
|
3394
|
-
if (!T || !T.canApply(x, a) || !((
|
|
3404
|
+
if (!T || !T.canApply(x, a) || !((u = x.conditions) != null && u.stackable) && c.length > 0) continue;
|
|
3395
3405
|
const w = T.calculate(x, a);
|
|
3396
3406
|
w.applicable && (c.push({
|
|
3397
3407
|
discountId: x.id,
|
|
@@ -3419,9 +3429,9 @@ class Jn {
|
|
|
3419
3429
|
static calculateFinalPrices(e, t) {
|
|
3420
3430
|
return e.map((r) => {
|
|
3421
3431
|
const a = t.filter(
|
|
3422
|
-
(l) => l.affectedItems.some((
|
|
3423
|
-
), i = a.reduce((l,
|
|
3424
|
-
const f =
|
|
3432
|
+
(l) => l.affectedItems.some((u) => u.productId === r.product.id)
|
|
3433
|
+
), i = a.reduce((l, u) => {
|
|
3434
|
+
const f = u.affectedItems.find(
|
|
3425
3435
|
(x) => x.productId === r.product.id
|
|
3426
3436
|
);
|
|
3427
3437
|
return l + ((f == null ? void 0 : f.discountAmount) || 0);
|
|
@@ -3444,33 +3454,19 @@ class Jn {
|
|
|
3444
3454
|
return this.filterActiveDiscounts(e);
|
|
3445
3455
|
}
|
|
3446
3456
|
}
|
|
3447
|
-
|
|
3448
|
-
return Number(n.toFixed(2));
|
|
3449
|
-
}
|
|
3450
|
-
function Hn(n) {
|
|
3451
|
-
return n.toFixed(2);
|
|
3452
|
-
}
|
|
3453
|
-
function Kn(n) {
|
|
3454
|
-
return Math.max(0, rt(n));
|
|
3455
|
-
}
|
|
3456
|
-
function er(n, e) {
|
|
3457
|
-
if (n <= 0) return 0;
|
|
3458
|
-
const t = n - e;
|
|
3459
|
-
return rt(t / n * 100);
|
|
3460
|
-
}
|
|
3461
|
-
const An = s.object({
|
|
3457
|
+
const Cn = s.object({
|
|
3462
3458
|
id: s.string(),
|
|
3463
3459
|
name: s.string()
|
|
3464
|
-
}),
|
|
3460
|
+
}), Jn = Cn.omit({ id: !0 }), rt = s.object({
|
|
3465
3461
|
type: s.literal("Supplier"),
|
|
3466
3462
|
id: s.string(),
|
|
3467
3463
|
name: s.string(),
|
|
3468
3464
|
code: s.string()
|
|
3469
3465
|
// supplier code number
|
|
3470
|
-
}),
|
|
3466
|
+
}), Hn = rt.omit({ id: !0 }), jn = s.object({
|
|
3471
3467
|
type: s.literal("SupplierInvoice"),
|
|
3472
3468
|
id: s.string(),
|
|
3473
|
-
supplier:
|
|
3469
|
+
supplier: rt,
|
|
3474
3470
|
invoiceNumber: s.string(),
|
|
3475
3471
|
date: s.number(),
|
|
3476
3472
|
rows: s.array(
|
|
@@ -3508,41 +3504,46 @@ const An = s.object({
|
|
|
3508
3504
|
total: s.number().optional(),
|
|
3509
3505
|
totalBeforeVat: s.number().optional(),
|
|
3510
3506
|
vat: s.number().optional()
|
|
3511
|
-
}),
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
s.
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
s.
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
s.
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3507
|
+
}), Kn = jn.omit({ id: !0 }), Zn = s.enum(["debt_increase", "debt_reduction"]), er = s.object({
|
|
3508
|
+
recordId: s.string().min(1),
|
|
3509
|
+
organizationId: s.string().min(1),
|
|
3510
|
+
customerId: s.string(),
|
|
3511
|
+
// "system" when no acting user
|
|
3512
|
+
customerName: s.string(),
|
|
3513
|
+
billingAccountId: s.string().nullable(),
|
|
3514
|
+
type: Zn,
|
|
3515
|
+
/** Integer agorot, always positive */
|
|
3516
|
+
amount: s.number().int().positive(),
|
|
3517
|
+
currency: s.literal("ILS"),
|
|
3518
|
+
/** orderId (debt_increase) | ledger transactionId (debt_reduction) */
|
|
3519
|
+
relatedId: s.string().min(1),
|
|
3520
|
+
source: s.enum(["order", "ledger", "manual"]),
|
|
3521
|
+
/** event that caused this — trace + idempotency key; null for manual */
|
|
3522
|
+
causedByEventId: s.string().nullable(),
|
|
3523
|
+
/** epoch millis */
|
|
3524
|
+
createdAt: s.number().int().positive(),
|
|
3525
|
+
/** Asia/Jerusalem date parts */
|
|
3526
|
+
year: s.number().int(),
|
|
3527
|
+
month: s.number().int().min(1).max(12),
|
|
3528
|
+
/** "2026-05" */
|
|
3529
|
+
yearMonth: s.string(),
|
|
3530
|
+
companyId: s.string().min(1),
|
|
3531
|
+
storeId: s.string().min(1)
|
|
3532
|
+
}), tr = s.object({
|
|
3533
|
+
/** = doc id */
|
|
3534
|
+
organizationId: s.string().min(1),
|
|
3535
|
+
organizationName: s.string(),
|
|
3536
|
+
/** integer agorot — current outstanding debt */
|
|
3537
|
+
totalCurrentDebt: s.number().int(),
|
|
3538
|
+
/** lifetime sums (agorot) */
|
|
3539
|
+
totalDebits: s.number().int(),
|
|
3540
|
+
totalCredits: s.number().int(),
|
|
3541
|
+
currency: s.literal("ILS"),
|
|
3542
|
+
/** epoch millis */
|
|
3543
|
+
updatedAt: s.number().int().positive(),
|
|
3544
|
+
companyId: s.string().min(1),
|
|
3545
|
+
storeId: s.string().min(1)
|
|
3546
|
+
}), nr = s.enum([
|
|
3546
3547
|
"delivery_note",
|
|
3547
3548
|
"payment_received",
|
|
3548
3549
|
"credit_note",
|
|
@@ -3553,48 +3554,7 @@ const An = s.object({
|
|
|
3553
3554
|
// legacy
|
|
3554
3555
|
"order_refunded"
|
|
3555
3556
|
// legacy
|
|
3556
|
-
]),
|
|
3557
|
-
id: s.string(),
|
|
3558
|
-
type: jn,
|
|
3559
|
-
// positive = debt added (delivery note / debit note), negative = debt reduced (payment / credit)
|
|
3560
|
-
debt: s.number(),
|
|
3561
|
-
runningBalance: s.number(),
|
|
3562
|
-
// order reference
|
|
3563
|
-
orderId: s.string().nullable(),
|
|
3564
|
-
orderTotal: s.number().nullable(),
|
|
3565
|
-
// delivery note reference (for delivery_note type)
|
|
3566
|
-
deliveryNoteId: s.string().nullable(),
|
|
3567
|
-
deliveryNoteNumber: s.string().nullable(),
|
|
3568
|
-
// billing account snapshot (if order had one)
|
|
3569
|
-
billingAccountId: s.string().nullable(),
|
|
3570
|
-
billingAccountName: s.string().nullable(),
|
|
3571
|
-
billingAccountNumber: s.string().nullable(),
|
|
3572
|
-
// payment details (for payment_received type — entered by admin)
|
|
3573
|
-
paymentReference: s.string().nullable(),
|
|
3574
|
-
// check number, bank transfer ref, etc.
|
|
3575
|
-
paymentDate: s.number().nullable(),
|
|
3576
|
-
// timestamp
|
|
3577
|
-
paymentMethod: Zn.nullable(),
|
|
3578
|
-
note: s.string().nullable(),
|
|
3579
|
-
createdAt: s.number(),
|
|
3580
|
-
createdBy: s.string()
|
|
3581
|
-
// userId or "system"
|
|
3582
|
-
}), or = s.object({
|
|
3583
|
-
id: s.string(),
|
|
3584
|
-
// organizationId
|
|
3585
|
-
organizationId: s.string(),
|
|
3586
|
-
organizationName: s.string(),
|
|
3587
|
-
companyId: s.string(),
|
|
3588
|
-
storeId: s.string(),
|
|
3589
|
-
totalDebits: s.number(),
|
|
3590
|
-
// sum of delivery note amounts
|
|
3591
|
-
totalCredits: s.number(),
|
|
3592
|
-
// sum of payments received
|
|
3593
|
-
balance: s.number(),
|
|
3594
|
-
// totalDebits - totalCredits (positive = owes money)
|
|
3595
|
-
currency: s.literal("ILS"),
|
|
3596
|
-
updatedAt: s.number()
|
|
3597
|
-
}), De = {
|
|
3557
|
+
]), rr = s.enum(["check", "bank_transfer", "cash", "credit_card", "other"]), De = {
|
|
3598
3558
|
VAT: 18
|
|
3599
3559
|
};
|
|
3600
3560
|
function On(n, e) {
|
|
@@ -3610,7 +3570,7 @@ function Dn(n, e) {
|
|
|
3610
3570
|
}
|
|
3611
3571
|
return ((a = n.discount) == null ? void 0 : a.type) === "number" ? t - n.discount.value : t;
|
|
3612
3572
|
}
|
|
3613
|
-
function
|
|
3573
|
+
function sr({
|
|
3614
3574
|
cart: n,
|
|
3615
3575
|
discounts: e,
|
|
3616
3576
|
deliveryPrice: t = 0,
|
|
@@ -3625,16 +3585,16 @@ function cr({
|
|
|
3625
3585
|
finalDiscount: On(o.product)
|
|
3626
3586
|
})), c = i.reduce(
|
|
3627
3587
|
(o, l) => {
|
|
3628
|
-
const { product:
|
|
3588
|
+
const { product: u, amount: f, finalPrice: x, finalDiscount: T } = l;
|
|
3629
3589
|
let w = 0;
|
|
3630
|
-
if (
|
|
3631
|
-
let
|
|
3590
|
+
if (u.vat) {
|
|
3591
|
+
let Ae = 0;
|
|
3632
3592
|
if (a) {
|
|
3633
|
-
const
|
|
3634
|
-
w = Number(
|
|
3593
|
+
const st = Number((x / (1 + De.VAT / 100)).toFixed(2)), at = x - st;
|
|
3594
|
+
w = Number(at.toFixed(2)), w = w * f, Ae = Number(w.toFixed(2));
|
|
3635
3595
|
} else
|
|
3636
|
-
w = x * De.VAT / 100, w = w * f,
|
|
3637
|
-
o.vat = Number((o.vat +
|
|
3596
|
+
w = x * De.VAT / 100, w = w * f, Ae = Number(w.toFixed(2));
|
|
3597
|
+
o.vat = Number((o.vat + Ae).toFixed(2));
|
|
3638
3598
|
}
|
|
3639
3599
|
const H = Number(x.toFixed(2));
|
|
3640
3600
|
return o.cost += f * H, o.discount += T && f * T, o.finalCost += f * H + (a ? 0 : w), o.productsCost += f * H + (a ? 0 : w), o.cost = Number(o.cost.toFixed(2)), o.discount = Number(o.discount.toFixed(2)), o.finalCost = Number(o.finalCost.toFixed(2)), o.productsCost = Number(o.productsCost.toFixed(2)), o;
|
|
@@ -3674,7 +3634,12 @@ const Pn = {
|
|
|
3674
3634
|
chatSessionMessages: "chatSessionMessages",
|
|
3675
3635
|
contactSubmissions: "contactSubmissions",
|
|
3676
3636
|
budgetAccounts: "budgetAccounts",
|
|
3677
|
-
budgetTransactions: "budgetTransactions"
|
|
3637
|
+
budgetTransactions: "budgetTransactions",
|
|
3638
|
+
budgetRecords: "budgetRecords",
|
|
3639
|
+
organizationBudgets: "organizationBudgets",
|
|
3640
|
+
transactions: "transactions",
|
|
3641
|
+
paymentLinks: "paymentLinks",
|
|
3642
|
+
duplicateChargeAlerts: "duplicateChargeAlerts"
|
|
3678
3643
|
}, Rn = {
|
|
3679
3644
|
systemCollections: Pn,
|
|
3680
3645
|
storeCollections: En,
|
|
@@ -3696,70 +3661,68 @@ const Pn = {
|
|
|
3696
3661
|
// for firestore events
|
|
3697
3662
|
getDocPath: (n) => `{companyId}/{storeId}/${n}/{id}`,
|
|
3698
3663
|
getSubDocPath: (n, e, t) => `{companyId}/{storeId}/${n}/${e}/${t}/{id}`
|
|
3699
|
-
},
|
|
3664
|
+
}, ar = {
|
|
3700
3665
|
firestore: Rn
|
|
3701
|
-
},
|
|
3666
|
+
}, Le = {
|
|
3702
3667
|
round: (n, e = 2) => {
|
|
3703
3668
|
const t = 10 ** e;
|
|
3704
3669
|
return Math.round((n + Number.EPSILON) * t) / t;
|
|
3705
3670
|
}
|
|
3706
|
-
},
|
|
3707
|
-
calcSalePriceFromMargin: (n, e) => n <= 0 || e <= 0 || n >= 100 ? e :
|
|
3708
|
-
calcMarginFromSalePrice: (n, e) => n <= 0 || e <= 0 ? 0 :
|
|
3671
|
+
}, ir = {
|
|
3672
|
+
calcSalePriceFromMargin: (n, e) => n <= 0 || e <= 0 || n >= 100 ? e : Le.round(e / (1 - n / 100)),
|
|
3673
|
+
calcMarginFromSalePrice: (n, e) => n <= 0 || e <= 0 ? 0 : Le.round((n - e) / n * 100)
|
|
3709
3674
|
};
|
|
3710
3675
|
export {
|
|
3711
3676
|
Se as AddressSchema,
|
|
3712
|
-
|
|
3677
|
+
He as BaseCategorySchema,
|
|
3713
3678
|
tt as BillingAccountSchema,
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3679
|
+
er as BudgetRecordSchema,
|
|
3680
|
+
Zn as BudgetRecordTypeSchema,
|
|
3681
|
+
nr as BudgetTransactionTypeSchema,
|
|
3717
3682
|
Nn as BundleDiscountStrategy,
|
|
3718
3683
|
et as CalculatedDataSchema,
|
|
3719
3684
|
Ke as CartItemProductSchema,
|
|
3720
|
-
|
|
3685
|
+
Un as CartSchema,
|
|
3721
3686
|
Ee as CategorySchema,
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
Jn as DiscountEngine,
|
|
3728
|
-
Gn as DiscountSchema,
|
|
3687
|
+
qn as CompanySchema,
|
|
3688
|
+
xn as DeliveryNoteSchema,
|
|
3689
|
+
In as DiscountConditionsSchema,
|
|
3690
|
+
Gn as DiscountEngine,
|
|
3691
|
+
Xn as DiscountSchema,
|
|
3729
3692
|
nt as DiscountStrategyFactory,
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3693
|
+
An as DiscountVariantSchema,
|
|
3694
|
+
bn as EzDeliveryNoteSchema,
|
|
3695
|
+
Bn as FavoriteProductSchema,
|
|
3733
3696
|
Vn as FileSchema,
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3697
|
+
ar as FirebaseAPI,
|
|
3698
|
+
yn as FulfillmentStatusSchema,
|
|
3699
|
+
ge as LocaleSchema,
|
|
3700
|
+
Jn as NewOrganizationGroupSchema,
|
|
3701
|
+
Wn as NewOrganizationSchema,
|
|
3702
|
+
Fn as NewProductSchema,
|
|
3703
|
+
Kn as NewSupplierInvoiceSchema,
|
|
3704
|
+
Hn as NewSupplierSchema,
|
|
3705
|
+
Qn as OrderSchema,
|
|
3706
|
+
tr as OrganizationBudgetSchema,
|
|
3707
|
+
Cn as OrganizationGroupSchema,
|
|
3708
|
+
kn as OrganizationSchema,
|
|
3709
|
+
rr as PaymentMethodSchema,
|
|
3746
3710
|
Ie as PaymentTypeSchema,
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
rt as formatCurrency,
|
|
3757
|
-
Hn as formatCurrencyString,
|
|
3758
|
-
cr as getCartCost,
|
|
3711
|
+
Re as ProductSchema,
|
|
3712
|
+
_n as ProfileSchema,
|
|
3713
|
+
Yn as StoreSchema,
|
|
3714
|
+
vn as SubstitutedWithSchema,
|
|
3715
|
+
jn as SupplierInvoiceSchema,
|
|
3716
|
+
rt as SupplierSchema,
|
|
3717
|
+
Ln as TFlattenCategorySchema,
|
|
3718
|
+
Sn as clientTypesSchema,
|
|
3719
|
+
sr as getCartCost,
|
|
3759
3720
|
zn as isFile,
|
|
3760
|
-
|
|
3721
|
+
Le as math,
|
|
3761
3722
|
R as notEmptyTextSchema,
|
|
3762
3723
|
Mn as numericTextSchema,
|
|
3763
|
-
|
|
3724
|
+
ir as storeCalculator,
|
|
3725
|
+
En as storeCollections,
|
|
3726
|
+
Pn as systemCollections
|
|
3764
3727
|
};
|
|
3765
3728
|
//# sourceMappingURL=core.es.js.map
|