@jsdev_ninja/core 0.13.15 → 0.13.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core.cjs.js +1 -1
- package/dist/core.cjs.js.map +1 -1
- package/dist/core.es.js +167 -159
- package/dist/core.es.js.map +1 -1
- package/dist/core.umd.js +1 -1
- package/dist/core.umd.js.map +1 -1
- package/dist/entities/Order.d.ts +137 -0
- package/dist/entities/Order.d.ts.map +1 -1
- package/dist/entities/Order.js +2 -0
- package/dist/entities/Organization.d.ts +46 -0
- package/dist/entities/Organization.d.ts.map +1 -1
- package/dist/entities/Organization.js +5 -0
- package/lib/entities/Organization.ts +7 -0
- package/package.json +1 -1
package/dist/core.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var Pe = (r, e, t) =>
|
|
1
|
+
var st = Object.defineProperty;
|
|
2
|
+
var at = (r, e, t) => e in r ? st(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var Pe = (r, e, t) => at(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
var x;
|
|
5
5
|
(function(r) {
|
|
6
6
|
r.assertEqual = (s) => s;
|
|
@@ -104,7 +104,7 @@ const h = x.arrayToEnum([
|
|
|
104
104
|
"invalid_intersection_types",
|
|
105
105
|
"not_multiple_of",
|
|
106
106
|
"not_finite"
|
|
107
|
-
]),
|
|
107
|
+
]), it = (r) => JSON.stringify(r, null, 2).replace(/"([^"]+)":/g, "$1:");
|
|
108
108
|
class C extends Error {
|
|
109
109
|
get errors() {
|
|
110
110
|
return this.issues;
|
|
@@ -222,7 +222,7 @@ const X = (r, e) => {
|
|
|
222
222
|
return { message: t };
|
|
223
223
|
};
|
|
224
224
|
let Ve = X;
|
|
225
|
-
function
|
|
225
|
+
function ot(r) {
|
|
226
226
|
Ve = r;
|
|
227
227
|
}
|
|
228
228
|
function ge() {
|
|
@@ -248,7 +248,7 @@ const ve = (r) => {
|
|
|
248
248
|
path: a,
|
|
249
249
|
message: c
|
|
250
250
|
};
|
|
251
|
-
},
|
|
251
|
+
}, ct = [];
|
|
252
252
|
function f(r, e) {
|
|
253
253
|
const t = ge(), n = ve({
|
|
254
254
|
issueData: e,
|
|
@@ -579,14 +579,14 @@ class _ {
|
|
|
579
579
|
return this.safeParse(null).success;
|
|
580
580
|
}
|
|
581
581
|
}
|
|
582
|
-
const
|
|
582
|
+
const dt = /^c[^\s-]{8,}$/i, ut = /^[0-9a-z]+$/, lt = /^[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, mt = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, pt = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, yt = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, gt = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
583
583
|
let Ce;
|
|
584
|
-
const
|
|
584
|
+
const vt = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, _t = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, bt = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, xt = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, kt = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, wt = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, ze = "((\\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])))", Tt = new RegExp(`^${ze}$`);
|
|
585
585
|
function Le(r) {
|
|
586
586
|
let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
|
|
587
587
|
return r.precision ? e = `${e}\\.\\d{${r.precision}}` : r.precision == null && (e = `${e}(\\.\\d+)?`), e;
|
|
588
588
|
}
|
|
589
|
-
function
|
|
589
|
+
function It(r) {
|
|
590
590
|
return new RegExp(`^${Le(r)}$`);
|
|
591
591
|
}
|
|
592
592
|
function Ue(r) {
|
|
@@ -594,11 +594,11 @@ function Ue(r) {
|
|
|
594
594
|
const t = [];
|
|
595
595
|
return t.push(r.local ? "Z?" : "Z"), r.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
|
|
596
596
|
}
|
|
597
|
-
function It(r, e) {
|
|
598
|
-
return !!((e === "v4" || !e) && gt.test(r) || (e === "v6" || !e) && _t.test(r));
|
|
599
|
-
}
|
|
600
597
|
function St(r, e) {
|
|
601
|
-
|
|
598
|
+
return !!((e === "v4" || !e) && vt.test(r) || (e === "v6" || !e) && bt.test(r));
|
|
599
|
+
}
|
|
600
|
+
function Ct(r, e) {
|
|
601
|
+
if (!mt.test(r))
|
|
602
602
|
return !1;
|
|
603
603
|
try {
|
|
604
604
|
const [t] = r.split("."), n = t.replace(/-/g, "+").replace(/_/g, "/").padEnd(t.length + (4 - t.length % 4) % 4, "="), s = JSON.parse(atob(n));
|
|
@@ -607,8 +607,8 @@ function St(r, e) {
|
|
|
607
607
|
return !1;
|
|
608
608
|
}
|
|
609
609
|
}
|
|
610
|
-
function
|
|
611
|
-
return !!((e === "v4" || !e) &&
|
|
610
|
+
function At(r, e) {
|
|
611
|
+
return !!((e === "v4" || !e) && _t.test(r) || (e === "v6" || !e) && xt.test(r));
|
|
612
612
|
}
|
|
613
613
|
class N extends _ {
|
|
614
614
|
_parse(e) {
|
|
@@ -659,43 +659,43 @@ class N extends _ {
|
|
|
659
659
|
message: a.message
|
|
660
660
|
}), n.dirty());
|
|
661
661
|
} else if (a.kind === "email")
|
|
662
|
-
|
|
662
|
+
yt.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
663
663
|
validation: "email",
|
|
664
664
|
code: u.invalid_string,
|
|
665
665
|
message: a.message
|
|
666
666
|
}), n.dirty());
|
|
667
667
|
else if (a.kind === "emoji")
|
|
668
|
-
Ce || (Ce = new RegExp(
|
|
668
|
+
Ce || (Ce = new RegExp(gt, "u")), Ce.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
669
669
|
validation: "emoji",
|
|
670
670
|
code: u.invalid_string,
|
|
671
671
|
message: a.message
|
|
672
672
|
}), n.dirty());
|
|
673
673
|
else if (a.kind === "uuid")
|
|
674
|
-
|
|
674
|
+
ft.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
675
675
|
validation: "uuid",
|
|
676
676
|
code: u.invalid_string,
|
|
677
677
|
message: a.message
|
|
678
678
|
}), n.dirty());
|
|
679
679
|
else if (a.kind === "nanoid")
|
|
680
|
-
|
|
680
|
+
ht.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
681
681
|
validation: "nanoid",
|
|
682
682
|
code: u.invalid_string,
|
|
683
683
|
message: a.message
|
|
684
684
|
}), n.dirty());
|
|
685
685
|
else if (a.kind === "cuid")
|
|
686
|
-
|
|
686
|
+
dt.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
687
687
|
validation: "cuid",
|
|
688
688
|
code: u.invalid_string,
|
|
689
689
|
message: a.message
|
|
690
690
|
}), n.dirty());
|
|
691
691
|
else if (a.kind === "cuid2")
|
|
692
|
-
|
|
692
|
+
ut.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
693
693
|
validation: "cuid2",
|
|
694
694
|
code: u.invalid_string,
|
|
695
695
|
message: a.message
|
|
696
696
|
}), n.dirty());
|
|
697
697
|
else if (a.kind === "ulid")
|
|
698
|
-
|
|
698
|
+
lt.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
699
699
|
validation: "ulid",
|
|
700
700
|
code: u.invalid_string,
|
|
701
701
|
message: a.message
|
|
@@ -730,35 +730,35 @@ class N extends _ {
|
|
|
730
730
|
code: u.invalid_string,
|
|
731
731
|
validation: "datetime",
|
|
732
732
|
message: a.message
|
|
733
|
-
}), n.dirty()) : a.kind === "date" ?
|
|
733
|
+
}), n.dirty()) : a.kind === "date" ? Tt.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
734
734
|
code: u.invalid_string,
|
|
735
735
|
validation: "date",
|
|
736
736
|
message: a.message
|
|
737
|
-
}), n.dirty()) : a.kind === "time" ?
|
|
737
|
+
}), n.dirty()) : a.kind === "time" ? It(a).test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
738
738
|
code: u.invalid_string,
|
|
739
739
|
validation: "time",
|
|
740
740
|
message: a.message
|
|
741
|
-
}), n.dirty()) : a.kind === "duration" ?
|
|
741
|
+
}), n.dirty()) : a.kind === "duration" ? pt.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
742
742
|
validation: "duration",
|
|
743
743
|
code: u.invalid_string,
|
|
744
744
|
message: a.message
|
|
745
|
-
}), n.dirty()) : a.kind === "ip" ?
|
|
745
|
+
}), n.dirty()) : a.kind === "ip" ? St(e.data, a.version) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
746
746
|
validation: "ip",
|
|
747
747
|
code: u.invalid_string,
|
|
748
748
|
message: a.message
|
|
749
|
-
}), n.dirty()) : a.kind === "jwt" ?
|
|
749
|
+
}), n.dirty()) : a.kind === "jwt" ? Ct(e.data, a.alg) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
750
750
|
validation: "jwt",
|
|
751
751
|
code: u.invalid_string,
|
|
752
752
|
message: a.message
|
|
753
|
-
}), n.dirty()) : a.kind === "cidr" ?
|
|
753
|
+
}), n.dirty()) : a.kind === "cidr" ? At(e.data, a.version) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
754
754
|
validation: "cidr",
|
|
755
755
|
code: u.invalid_string,
|
|
756
756
|
message: a.message
|
|
757
|
-
}), n.dirty()) : a.kind === "base64" ?
|
|
757
|
+
}), n.dirty()) : a.kind === "base64" ? kt.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
758
758
|
validation: "base64",
|
|
759
759
|
code: u.invalid_string,
|
|
760
760
|
message: a.message
|
|
761
|
-
}), n.dirty()) : a.kind === "base64url" ?
|
|
761
|
+
}), n.dirty()) : a.kind === "base64url" ? wt.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
762
762
|
validation: "base64url",
|
|
763
763
|
code: u.invalid_string,
|
|
764
764
|
message: a.message
|
|
@@ -997,7 +997,7 @@ N.create = (r) => {
|
|
|
997
997
|
...v(r)
|
|
998
998
|
});
|
|
999
999
|
};
|
|
1000
|
-
function
|
|
1000
|
+
function Nt(r, e) {
|
|
1001
1001
|
const t = (r.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, s = t > n ? t : n, a = parseInt(r.toFixed(s).replace(".", "")), o = parseInt(e.toFixed(s).replace(".", ""));
|
|
1002
1002
|
return a % o / Math.pow(10, s);
|
|
1003
1003
|
}
|
|
@@ -1036,7 +1036,7 @@ class V extends _ {
|
|
|
1036
1036
|
inclusive: a.inclusive,
|
|
1037
1037
|
exact: !1,
|
|
1038
1038
|
message: a.message
|
|
1039
|
-
}), s.dirty()) : a.kind === "multipleOf" ?
|
|
1039
|
+
}), s.dirty()) : a.kind === "multipleOf" ? Nt(e.data, a.value) !== 0 && (n = this._getOrReturnCtx(e, n), f(n, {
|
|
1040
1040
|
code: u.not_multiple_of,
|
|
1041
1041
|
multipleOf: a.value,
|
|
1042
1042
|
message: a.message
|
|
@@ -2745,7 +2745,7 @@ we.create = (r) => new we({
|
|
|
2745
2745
|
typeName: y.ZodNaN,
|
|
2746
2746
|
...v(r)
|
|
2747
2747
|
});
|
|
2748
|
-
const
|
|
2748
|
+
const Zt = Symbol("zod_brand");
|
|
2749
2749
|
class Ee extends _ {
|
|
2750
2750
|
_parse(e) {
|
|
2751
2751
|
const { ctx: t } = this._processInputParams(e), n = t.data;
|
|
@@ -2835,16 +2835,16 @@ function qe(r, e = {}, t) {
|
|
|
2835
2835
|
}
|
|
2836
2836
|
}) : H.create();
|
|
2837
2837
|
}
|
|
2838
|
-
const
|
|
2838
|
+
const Ot = {
|
|
2839
2839
|
object: k.lazycreate
|
|
2840
2840
|
};
|
|
2841
2841
|
var y;
|
|
2842
2842
|
(function(r) {
|
|
2843
2843
|
r.ZodString = "ZodString", r.ZodNumber = "ZodNumber", r.ZodNaN = "ZodNaN", r.ZodBigInt = "ZodBigInt", r.ZodBoolean = "ZodBoolean", r.ZodDate = "ZodDate", r.ZodSymbol = "ZodSymbol", r.ZodUndefined = "ZodUndefined", r.ZodNull = "ZodNull", r.ZodAny = "ZodAny", r.ZodUnknown = "ZodUnknown", r.ZodNever = "ZodNever", r.ZodVoid = "ZodVoid", r.ZodArray = "ZodArray", r.ZodObject = "ZodObject", r.ZodUnion = "ZodUnion", r.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", r.ZodIntersection = "ZodIntersection", r.ZodTuple = "ZodTuple", r.ZodRecord = "ZodRecord", r.ZodMap = "ZodMap", r.ZodSet = "ZodSet", r.ZodFunction = "ZodFunction", r.ZodLazy = "ZodLazy", r.ZodLiteral = "ZodLiteral", r.ZodEnum = "ZodEnum", r.ZodEffects = "ZodEffects", r.ZodNativeEnum = "ZodNativeEnum", r.ZodOptional = "ZodOptional", r.ZodNullable = "ZodNullable", r.ZodDefault = "ZodDefault", r.ZodCatch = "ZodCatch", r.ZodPromise = "ZodPromise", r.ZodBranded = "ZodBranded", r.ZodPipeline = "ZodPipeline", r.ZodReadonly = "ZodReadonly";
|
|
2844
2844
|
})(y || (y = {}));
|
|
2845
|
-
const
|
|
2845
|
+
const jt = (r, e = {
|
|
2846
2846
|
message: `Input not instance of ${r.name}`
|
|
2847
|
-
}) => qe((t) => t instanceof r, e), We = N.create, Qe = V.create,
|
|
2847
|
+
}) => qe((t) => t instanceof r, e), We = N.create, Qe = V.create, Et = we.create, Dt = F.create, Ye = se.create, Pt = q.create, Rt = be.create, Mt = ae.create, $t = ie.create, Vt = H.create, Ft = U.create, zt = $.create, Lt = xe.create, Ut = Z.create, Bt = k.create, qt = k.strictCreate, Wt = oe.create, Qt = Te.create, Yt = ce.create, Jt = D.create, Xt = de.create, Ht = ke.create, Gt = W.create, Kt = J.create, er = ue.create, tr = le.create, rr = z.create, nr = fe.create, sr = G.create, $e = O.create, ar = j.create, ir = L.create, or = O.createWithPreprocess, cr = ye.create, dr = () => We().optional(), ur = () => Qe().optional(), lr = () => Ye().optional(), fr = {
|
|
2848
2848
|
string: (r) => N.create({ ...r, coerce: !0 }),
|
|
2849
2849
|
number: (r) => V.create({ ...r, coerce: !0 }),
|
|
2850
2850
|
boolean: (r) => se.create({
|
|
@@ -2853,14 +2853,14 @@ const Ot = (r, e = {
|
|
|
2853
2853
|
}),
|
|
2854
2854
|
bigint: (r) => F.create({ ...r, coerce: !0 }),
|
|
2855
2855
|
date: (r) => q.create({ ...r, coerce: !0 })
|
|
2856
|
-
},
|
|
2856
|
+
}, hr = g;
|
|
2857
2857
|
var i = /* @__PURE__ */ Object.freeze({
|
|
2858
2858
|
__proto__: null,
|
|
2859
2859
|
defaultErrorMap: X,
|
|
2860
|
-
setErrorMap:
|
|
2860
|
+
setErrorMap: ot,
|
|
2861
2861
|
getErrorMap: ge,
|
|
2862
2862
|
makeIssue: ve,
|
|
2863
|
-
EMPTY_PATH:
|
|
2863
|
+
EMPTY_PATH: ct,
|
|
2864
2864
|
addIssueToContext: f,
|
|
2865
2865
|
ParseStatus: T,
|
|
2866
2866
|
INVALID: g,
|
|
@@ -2914,63 +2914,63 @@ var i = /* @__PURE__ */ Object.freeze({
|
|
|
2914
2914
|
ZodDefault: he,
|
|
2915
2915
|
ZodCatch: me,
|
|
2916
2916
|
ZodNaN: we,
|
|
2917
|
-
BRAND:
|
|
2917
|
+
BRAND: Zt,
|
|
2918
2918
|
ZodBranded: Ee,
|
|
2919
2919
|
ZodPipeline: ye,
|
|
2920
2920
|
ZodReadonly: pe,
|
|
2921
2921
|
custom: qe,
|
|
2922
2922
|
Schema: _,
|
|
2923
2923
|
ZodSchema: _,
|
|
2924
|
-
late:
|
|
2924
|
+
late: Ot,
|
|
2925
2925
|
get ZodFirstPartyTypeKind() {
|
|
2926
2926
|
return y;
|
|
2927
2927
|
},
|
|
2928
|
-
coerce:
|
|
2929
|
-
any:
|
|
2930
|
-
array:
|
|
2931
|
-
bigint:
|
|
2928
|
+
coerce: fr,
|
|
2929
|
+
any: Vt,
|
|
2930
|
+
array: Ut,
|
|
2931
|
+
bigint: Dt,
|
|
2932
2932
|
boolean: Ye,
|
|
2933
|
-
date:
|
|
2934
|
-
discriminatedUnion:
|
|
2933
|
+
date: Pt,
|
|
2934
|
+
discriminatedUnion: Qt,
|
|
2935
2935
|
effect: $e,
|
|
2936
|
-
enum:
|
|
2937
|
-
function:
|
|
2938
|
-
instanceof:
|
|
2939
|
-
intersection:
|
|
2940
|
-
lazy:
|
|
2941
|
-
literal:
|
|
2942
|
-
map:
|
|
2943
|
-
nan:
|
|
2944
|
-
nativeEnum:
|
|
2945
|
-
never:
|
|
2946
|
-
null:
|
|
2947
|
-
nullable:
|
|
2936
|
+
enum: rr,
|
|
2937
|
+
function: Kt,
|
|
2938
|
+
instanceof: jt,
|
|
2939
|
+
intersection: Yt,
|
|
2940
|
+
lazy: er,
|
|
2941
|
+
literal: tr,
|
|
2942
|
+
map: Ht,
|
|
2943
|
+
nan: Et,
|
|
2944
|
+
nativeEnum: nr,
|
|
2945
|
+
never: zt,
|
|
2946
|
+
null: $t,
|
|
2947
|
+
nullable: ir,
|
|
2948
2948
|
number: Qe,
|
|
2949
|
-
object:
|
|
2950
|
-
oboolean:
|
|
2951
|
-
onumber:
|
|
2952
|
-
optional:
|
|
2953
|
-
ostring:
|
|
2954
|
-
pipeline:
|
|
2955
|
-
preprocess:
|
|
2956
|
-
promise:
|
|
2957
|
-
record:
|
|
2958
|
-
set:
|
|
2959
|
-
strictObject:
|
|
2949
|
+
object: Bt,
|
|
2950
|
+
oboolean: lr,
|
|
2951
|
+
onumber: ur,
|
|
2952
|
+
optional: ar,
|
|
2953
|
+
ostring: dr,
|
|
2954
|
+
pipeline: cr,
|
|
2955
|
+
preprocess: or,
|
|
2956
|
+
promise: sr,
|
|
2957
|
+
record: Xt,
|
|
2958
|
+
set: Gt,
|
|
2959
|
+
strictObject: qt,
|
|
2960
2960
|
string: We,
|
|
2961
|
-
symbol:
|
|
2961
|
+
symbol: Rt,
|
|
2962
2962
|
transformer: $e,
|
|
2963
|
-
tuple:
|
|
2964
|
-
undefined:
|
|
2965
|
-
union:
|
|
2966
|
-
unknown:
|
|
2967
|
-
void:
|
|
2968
|
-
NEVER:
|
|
2963
|
+
tuple: Jt,
|
|
2964
|
+
undefined: Mt,
|
|
2965
|
+
union: Wt,
|
|
2966
|
+
unknown: Ft,
|
|
2967
|
+
void: Lt,
|
|
2968
|
+
NEVER: hr,
|
|
2969
2969
|
ZodIssueCode: u,
|
|
2970
|
-
quotelessJson:
|
|
2970
|
+
quotelessJson: it,
|
|
2971
2971
|
ZodError: C
|
|
2972
2972
|
});
|
|
2973
|
-
const
|
|
2973
|
+
const mr = i.object({
|
|
2974
2974
|
country: i.string(),
|
|
2975
2975
|
city: i.string(),
|
|
2976
2976
|
street: i.string(),
|
|
@@ -3082,7 +3082,7 @@ const re = i.object({
|
|
|
3082
3082
|
productId: i.string().uuid()
|
|
3083
3083
|
}), Ge = i.enum(["default", "delayed"], {
|
|
3084
3084
|
description: "delayed is J5 transaction"
|
|
3085
|
-
}),
|
|
3085
|
+
}), pr = i.object({
|
|
3086
3086
|
type: i.literal("Profile"),
|
|
3087
3087
|
id: M,
|
|
3088
3088
|
companyId: M,
|
|
@@ -3093,7 +3093,7 @@ const re = i.object({
|
|
|
3093
3093
|
displayName: M,
|
|
3094
3094
|
email: i.string().email(),
|
|
3095
3095
|
phoneNumber: i.string().optional(),
|
|
3096
|
-
address:
|
|
3096
|
+
address: mr.optional(),
|
|
3097
3097
|
isAnonymous: i.boolean(),
|
|
3098
3098
|
createdDate: i.number(),
|
|
3099
3099
|
lastActivityDate: i.number(),
|
|
@@ -3126,7 +3126,36 @@ function Mr() {
|
|
|
3126
3126
|
paymentType: Ge.Values.default
|
|
3127
3127
|
};
|
|
3128
3128
|
}
|
|
3129
|
-
const
|
|
3129
|
+
const Ke = i.object({
|
|
3130
|
+
_COMMENT: i.string().optional(),
|
|
3131
|
+
transaction_id: i.string(),
|
|
3132
|
+
date: i.string().regex(/^\d{4}-\d{2}-\d{2}$/, "Date must be in YYYY-MM-DD format"),
|
|
3133
|
+
currency: i.string().length(3, "Currency must be 3 characters"),
|
|
3134
|
+
rate: i.number().positive(),
|
|
3135
|
+
vat: i.string().regex(/^\d+\.\d{2}$/, "VAT must be in format XX.XX"),
|
|
3136
|
+
vat_price: i.number().positive(),
|
|
3137
|
+
price_discount: i.number(),
|
|
3138
|
+
price_discount_in_currency: i.number(),
|
|
3139
|
+
price_total: i.string().regex(/^\d+\.\d{2}$/, "Price total must be in format XX.XX"),
|
|
3140
|
+
price_total_in_currency: i.number().positive()
|
|
3141
|
+
}), et = i.object({
|
|
3142
|
+
doc_uuid: i.string().uuid("Document UUID must be a valid UUID"),
|
|
3143
|
+
pdf_link: i.string().url("PDF link must be a valid URL"),
|
|
3144
|
+
pdf_link_copy: i.string().url("PDF copy link must be a valid URL"),
|
|
3145
|
+
doc_number: i.string().min(1, "Document number is required"),
|
|
3146
|
+
sent_mails: i.array(i.string().email("Each email must be valid")),
|
|
3147
|
+
success: i.boolean(),
|
|
3148
|
+
ua_uuid: i.string().uuid("UA UUID must be a valid UUID"),
|
|
3149
|
+
calculatedData: Ke,
|
|
3150
|
+
warning: i.string().optional()
|
|
3151
|
+
});
|
|
3152
|
+
function $r(r) {
|
|
3153
|
+
return et.safeParse(r).success;
|
|
3154
|
+
}
|
|
3155
|
+
function Vr(r) {
|
|
3156
|
+
return Ke.safeParse(r).success;
|
|
3157
|
+
}
|
|
3158
|
+
const Fr = i.object({
|
|
3130
3159
|
type: i.literal("Order"),
|
|
3131
3160
|
id: M,
|
|
3132
3161
|
companyId: M,
|
|
@@ -3162,10 +3191,11 @@ const $r = i.object({
|
|
|
3162
3191
|
// what store charge
|
|
3163
3192
|
date: i.number(),
|
|
3164
3193
|
deliveryDate: i.coerce.number(),
|
|
3165
|
-
client:
|
|
3194
|
+
client: pr.required({}),
|
|
3166
3195
|
nameOnInvoice: i.string().optional(),
|
|
3167
|
-
clientComment: i.string().optional()
|
|
3168
|
-
|
|
3196
|
+
clientComment: i.string().optional(),
|
|
3197
|
+
deliveryNote: et.optional()
|
|
3198
|
+
}), yr = i.enum(["individual", "company"]), zr = i.object({
|
|
3169
3199
|
id: i.string(),
|
|
3170
3200
|
companyId: i.string(),
|
|
3171
3201
|
name: i.string(),
|
|
@@ -3176,14 +3206,14 @@ const $r = i.object({
|
|
|
3176
3206
|
paymentType: i.enum(["external", "j5"]),
|
|
3177
3207
|
allowAnonymousClients: i.boolean(),
|
|
3178
3208
|
isVatIncludedInPrice: i.boolean(),
|
|
3179
|
-
clientTypes: i.array(
|
|
3209
|
+
clientTypes: i.array(yr),
|
|
3180
3210
|
minimumOrder: i.number().optional(),
|
|
3181
3211
|
freeDeliveryPrice: i.number().optional(),
|
|
3182
3212
|
deliveryPrice: i.number().optional()
|
|
3183
|
-
}),
|
|
3213
|
+
}), gr = i.object({
|
|
3184
3214
|
minSpend: i.number().positive().optional(),
|
|
3185
3215
|
stackable: i.boolean().default(!1)
|
|
3186
|
-
}).optional(),
|
|
3216
|
+
}).optional(), vr = i.discriminatedUnion("variantType", [
|
|
3187
3217
|
i.object({
|
|
3188
3218
|
variantType: i.literal("bundle"),
|
|
3189
3219
|
productsId: i.array(i.string().nonempty()).min(1),
|
|
@@ -3193,7 +3223,7 @@ const $r = i.object({
|
|
|
3193
3223
|
bundlePrice: i.number().positive()
|
|
3194
3224
|
// Total price for the bundle (e.g., $25)
|
|
3195
3225
|
})
|
|
3196
|
-
]),
|
|
3226
|
+
]), Lr = i.object({
|
|
3197
3227
|
type: i.literal("Discount"),
|
|
3198
3228
|
storeId: i.string().min(1),
|
|
3199
3229
|
companyId: i.string().min(1),
|
|
@@ -3202,10 +3232,10 @@ const $r = i.object({
|
|
|
3202
3232
|
active: i.boolean(),
|
|
3203
3233
|
startDate: i.number(),
|
|
3204
3234
|
endDate: i.number(),
|
|
3205
|
-
variant:
|
|
3206
|
-
conditions:
|
|
3235
|
+
variant: vr,
|
|
3236
|
+
conditions: gr
|
|
3207
3237
|
});
|
|
3208
|
-
class
|
|
3238
|
+
class _r {
|
|
3209
3239
|
canApply(e, t) {
|
|
3210
3240
|
if (e.variant.variantType !== "bundle" || !this.isDiscountActive(e)) return !1;
|
|
3211
3241
|
const { productsId: n, requiredQuantity: s } = e.variant;
|
|
@@ -3258,7 +3288,7 @@ class vr {
|
|
|
3258
3288
|
});
|
|
3259
3289
|
}
|
|
3260
3290
|
}
|
|
3261
|
-
class
|
|
3291
|
+
class tt {
|
|
3262
3292
|
static getStrategy(e) {
|
|
3263
3293
|
return this.strategies.get(e.variant.variantType) || null;
|
|
3264
3294
|
}
|
|
@@ -3272,10 +3302,10 @@ class Ke {
|
|
|
3272
3302
|
this.strategies.clear();
|
|
3273
3303
|
}
|
|
3274
3304
|
}
|
|
3275
|
-
Pe(
|
|
3276
|
-
["bundle", new
|
|
3305
|
+
Pe(tt, "strategies", /* @__PURE__ */ new Map([
|
|
3306
|
+
["bundle", new _r()]
|
|
3277
3307
|
]));
|
|
3278
|
-
class
|
|
3308
|
+
class br {
|
|
3279
3309
|
static calculateDiscounts(e, t, n) {
|
|
3280
3310
|
var l, m;
|
|
3281
3311
|
const s = {
|
|
@@ -3284,7 +3314,7 @@ class _r {
|
|
|
3284
3314
|
appliedDiscounts: []
|
|
3285
3315
|
}, a = this.filterActiveDiscounts(t), o = [];
|
|
3286
3316
|
for (const b of a) {
|
|
3287
|
-
const w =
|
|
3317
|
+
const w = tt.getStrategy(b);
|
|
3288
3318
|
if (!w || !w.canApply(b, s) || !((l = b.conditions) != null && l.stackable) && o.length > 0) continue;
|
|
3289
3319
|
const S = w.calculate(b, s);
|
|
3290
3320
|
S.applicable && (o.push({
|
|
@@ -3338,55 +3368,33 @@ class _r {
|
|
|
3338
3368
|
return this.filterActiveDiscounts(e);
|
|
3339
3369
|
}
|
|
3340
3370
|
}
|
|
3341
|
-
function
|
|
3371
|
+
function rt(r) {
|
|
3342
3372
|
return Number(r.toFixed(2));
|
|
3343
3373
|
}
|
|
3344
|
-
function
|
|
3374
|
+
function Ur(r) {
|
|
3345
3375
|
return r.toFixed(2);
|
|
3346
3376
|
}
|
|
3347
|
-
function
|
|
3348
|
-
return Math.max(0,
|
|
3377
|
+
function Br(r) {
|
|
3378
|
+
return Math.max(0, rt(r));
|
|
3349
3379
|
}
|
|
3350
|
-
function
|
|
3380
|
+
function qr(r, e) {
|
|
3351
3381
|
if (r <= 0) return 0;
|
|
3352
3382
|
const t = r - e;
|
|
3353
|
-
return
|
|
3383
|
+
return rt(t / r * 100);
|
|
3354
3384
|
}
|
|
3355
|
-
const
|
|
3385
|
+
const xr = i.object({
|
|
3356
3386
|
id: i.string(),
|
|
3357
3387
|
name: i.string(),
|
|
3358
3388
|
discountPercentage: i.number().positive().min(0).max(100).optional(),
|
|
3359
|
-
nameOnInvoice: i.string().optional()
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
price_discount: i.number(),
|
|
3369
|
-
price_discount_in_currency: i.number(),
|
|
3370
|
-
price_total: i.string().regex(/^\d+\.\d{2}$/, "Price total must be in format XX.XX"),
|
|
3371
|
-
price_total_in_currency: i.number().positive()
|
|
3372
|
-
}), xr = i.object({
|
|
3373
|
-
doc_uuid: i.string().uuid("Document UUID must be a valid UUID"),
|
|
3374
|
-
pdf_link: i.string().url("PDF link must be a valid URL"),
|
|
3375
|
-
pdf_link_copy: i.string().url("PDF copy link must be a valid URL"),
|
|
3376
|
-
doc_number: i.string().min(1, "Document number is required"),
|
|
3377
|
-
sent_mails: i.array(i.string().email("Each email must be valid")),
|
|
3378
|
-
success: i.boolean(),
|
|
3379
|
-
ua_uuid: i.string().uuid("UA UUID must be a valid UUID"),
|
|
3380
|
-
calculatedData: tt,
|
|
3381
|
-
warning: i.string().optional()
|
|
3382
|
-
});
|
|
3383
|
-
function qr(r) {
|
|
3384
|
-
return xr.safeParse(r).success;
|
|
3385
|
-
}
|
|
3386
|
-
function Wr(r) {
|
|
3387
|
-
return tt.safeParse(r).success;
|
|
3388
|
-
}
|
|
3389
|
-
const Ae = {
|
|
3389
|
+
nameOnInvoice: i.string().optional(),
|
|
3390
|
+
billingAccounts: i.array(
|
|
3391
|
+
i.object({
|
|
3392
|
+
number: i.string(),
|
|
3393
|
+
name: i.string(),
|
|
3394
|
+
id: i.string()
|
|
3395
|
+
})
|
|
3396
|
+
)
|
|
3397
|
+
}), Wr = xr.omit({ id: !0 }), Ae = {
|
|
3390
3398
|
VAT: 18
|
|
3391
3399
|
};
|
|
3392
3400
|
function kr(r) {
|
|
@@ -3412,7 +3420,7 @@ function Qr({
|
|
|
3412
3420
|
id: d.product.id,
|
|
3413
3421
|
price: d.product.price
|
|
3414
3422
|
}
|
|
3415
|
-
})), a =
|
|
3423
|
+
})), a = br.calculateDiscounts(s, e), o = r.map((d, l) => {
|
|
3416
3424
|
const m = a.items[l];
|
|
3417
3425
|
return {
|
|
3418
3426
|
amount: d.amount,
|
|
@@ -3428,8 +3436,8 @@ function Qr({
|
|
|
3428
3436
|
if (m.vat) {
|
|
3429
3437
|
let Se = 0;
|
|
3430
3438
|
if (n) {
|
|
3431
|
-
const
|
|
3432
|
-
A = Number(
|
|
3439
|
+
const nt = w * (Ae.VAT / (100 + Ae.VAT));
|
|
3440
|
+
A = Number(nt.toFixed(2)), A = A * b, Se = Number(A.toFixed(2));
|
|
3433
3441
|
} else
|
|
3434
3442
|
A = w * Ae.VAT / 100, A = A * b, Se = Number(A.toFixed(2));
|
|
3435
3443
|
d.vat = Number((d.vat + Se).toFixed(2));
|
|
@@ -3479,43 +3487,43 @@ const Tr = {
|
|
|
3479
3487
|
firestore: Sr
|
|
3480
3488
|
};
|
|
3481
3489
|
export {
|
|
3482
|
-
|
|
3490
|
+
mr as AddressSchema,
|
|
3483
3491
|
Je as BaseCategorySchema,
|
|
3484
|
-
|
|
3485
|
-
|
|
3492
|
+
_r as BundleDiscountStrategy,
|
|
3493
|
+
Ke as CalculatedDataSchema,
|
|
3486
3494
|
He as CartItemProductSchema,
|
|
3487
3495
|
Dr as CartSchema,
|
|
3488
3496
|
De as CategorySchema,
|
|
3489
3497
|
Pr as CompanySchema,
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3498
|
+
et as DeliveryNoteSchema,
|
|
3499
|
+
gr as DiscountConditionsSchema,
|
|
3500
|
+
br as DiscountEngine,
|
|
3501
|
+
Lr as DiscountSchema,
|
|
3502
|
+
tt as DiscountStrategyFactory,
|
|
3503
|
+
vr as DiscountVariantSchema,
|
|
3496
3504
|
Rr as FavoriteProductSchema,
|
|
3497
3505
|
Nr as FileSchema,
|
|
3498
3506
|
Yr as FirebaseAPI,
|
|
3499
3507
|
re as LocaleSchema,
|
|
3500
3508
|
Or as LocaleValueSchema,
|
|
3501
|
-
|
|
3509
|
+
Wr as NewOrganizationSchema,
|
|
3502
3510
|
Er as NewProductSchema,
|
|
3503
|
-
|
|
3504
|
-
|
|
3511
|
+
Fr as OrderSchema,
|
|
3512
|
+
xr as OrganizationSchema,
|
|
3505
3513
|
Xe as ProductSchema,
|
|
3506
3514
|
Ge as ProfilePaymentTypeSchema,
|
|
3507
|
-
|
|
3508
|
-
|
|
3515
|
+
pr as ProfileSchema,
|
|
3516
|
+
zr as StoreSchema,
|
|
3509
3517
|
jr as TFlattenCategorySchema,
|
|
3510
|
-
|
|
3511
|
-
|
|
3518
|
+
qr as calculatePercentageDiscount,
|
|
3519
|
+
yr as clientTypesSchema,
|
|
3512
3520
|
Mr as createEmptyProfile,
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3521
|
+
Br as ensureNonNegative,
|
|
3522
|
+
rt as formatCurrency,
|
|
3523
|
+
Ur as formatCurrencyString,
|
|
3516
3524
|
Qr as getCartCost,
|
|
3517
|
-
|
|
3518
|
-
|
|
3525
|
+
Vr as isCalculatedData,
|
|
3526
|
+
$r as isDeliveryNote,
|
|
3519
3527
|
Zr as isFile,
|
|
3520
3528
|
M as notEmptyTextSchema,
|
|
3521
3529
|
Ar as numericTextSchema
|