@stoker-platform/node-client 0.3.1 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.cjs +7 -7
- package/dist/bundle.js +678 -680
- package/package.json +3 -3
package/dist/bundle.js
CHANGED
|
@@ -4,9 +4,9 @@ import ze from "lodash/isEqual.js";
|
|
|
4
4
|
import Wo from "lodash/merge.js";
|
|
5
5
|
import jo from "lodash/set.js";
|
|
6
6
|
import ye from "lodash/cloneDeep.js";
|
|
7
|
-
import { getFirestore as ue, Timestamp as
|
|
7
|
+
import { getFirestore as ue, Timestamp as lt, FieldValue as me } from "firebase-admin/firestore";
|
|
8
8
|
import { getDatabase as si } from "firebase-admin/database";
|
|
9
|
-
import { getAuth as
|
|
9
|
+
import { getAuth as gt } from "firebase-admin/auth";
|
|
10
10
|
const su = async (n, e, t, s) => new Promise((r, i) => {
|
|
11
11
|
const o = Uo(n, e, { cwd: t || process.cwd(), env: { ...process.env, ...s } });
|
|
12
12
|
let a = "";
|
|
@@ -179,7 +179,7 @@ const su = async (n, e, t, s) => new Promise((r, i) => {
|
|
|
179
179
|
return;
|
|
180
180
|
}
|
|
181
181
|
return l;
|
|
182
|
-
},
|
|
182
|
+
}, it = (n, e, t, s, r, i) => {
|
|
183
183
|
const { labels: o } = e, a = r.collections?.[o.collection];
|
|
184
184
|
let l = !0;
|
|
185
185
|
if (!a || !r.Role)
|
|
@@ -468,25 +468,25 @@ const su = async (n, e, t, s) => new Promise((r, i) => {
|
|
|
468
468
|
if (r && !c)
|
|
469
469
|
throw new Error("PERMISSION_DENIED");
|
|
470
470
|
r && !Te("Create", c) && (u = !1), r && // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
471
|
-
!
|
|
471
|
+
!it("Create", t, s, r, i, n) && (u = !1), t.auth && o && (r && !Wn(c) && (u = !1), Ls("create", n, e, t, s, r, i, o) || (u = !1));
|
|
472
472
|
for (const h of l) {
|
|
473
473
|
const f = n[h.name];
|
|
474
474
|
h.access && !jn(h, i) && f !== void 0 && (u = !1), f !== void 0 && !Zo(h, i) && (u = !1);
|
|
475
475
|
}
|
|
476
476
|
if (!u)
|
|
477
477
|
throw new Error("PERMISSION_DENIED");
|
|
478
|
-
}, Me = (n) => n && (n._methodName === "deleteField" || n.constructor.name === "DeleteTransform"),
|
|
478
|
+
}, Me = (n) => n && (n._methodName === "deleteField" || n.constructor.name === "DeleteTransform"), nt = (n) => {
|
|
479
479
|
for (const e in n)
|
|
480
|
-
Object.prototype.hasOwnProperty.call(n, e) && (Me(n[e]) ? delete n[e] : typeof n[e] == "object" && n[e] !== null &&
|
|
480
|
+
Object.prototype.hasOwnProperty.call(n, e) && (Me(n[e]) ? delete n[e] : typeof n[e] == "object" && n[e] !== null && nt(n[e]));
|
|
481
481
|
}, ir = (n, e, t, s, r, i, o, a, l, c) => {
|
|
482
482
|
const { labels: u, fields: h } = s, f = o?.collections?.[u.collection], d = { ...e, ...n };
|
|
483
|
-
|
|
483
|
+
nt(d);
|
|
484
484
|
let m = !0, O = "";
|
|
485
485
|
if (i && !f)
|
|
486
486
|
throw new Error("PERMISSION_DENIED");
|
|
487
487
|
i && !Te("Update", f) && (m = !1, O = "Authenticated user does not have Update access to this collection"), i && // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
488
|
-
(!
|
|
489
|
-
!
|
|
488
|
+
(!it("Update", s, r, i, o, e) || // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
489
|
+
!it("Update", s, r, i, o, d)) && (m = !1, O = "Authenticated user does not have Update access to this document"), a && (i && !Wn(f) && (m = !1, O = "Authenticated user does not have Auth access for this collection"), Ls("update", d, t, s, r, i, o, l, c, e, a) || (O = "Authenticated user does not have sufficient write access for this record", m = !1));
|
|
490
490
|
for (const y of h) {
|
|
491
491
|
const w = n[y.name];
|
|
492
492
|
y.access && !jn(y, o) && w !== void 0 && (O = `Authenticated user does not have access to field ${y.name}`, m = !1), w !== void 0 && !ri(y, o) && (O = `Authenticated user does not have Update access to field ${y.name}`, m = !1);
|
|
@@ -498,7 +498,7 @@ const su = async (n, e, t, s) => new Promise((r, i) => {
|
|
|
498
498
|
let l = !0;
|
|
499
499
|
if (!a)
|
|
500
500
|
throw new Error("PERMISSION_DENIED");
|
|
501
|
-
if (Te("Delete", a) || (l = !1),
|
|
501
|
+
if (Te("Delete", a) || (l = !1), it("Delete", t, s, r, i, n) || (l = !1), t.auth && n.User_ID && (Wn(a) || (l = !1), Ls("delete", n, e, t, s, r, i) || (l = !1)), !l)
|
|
502
502
|
throw new Error("PERMISSION_DENIED");
|
|
503
503
|
}, Jo = async (n, e, t, s, r) => {
|
|
504
504
|
const { labels: i } = e, o = r.collections?.[i.collection];
|
|
@@ -507,7 +507,7 @@ const su = async (n, e, t, s) => new Promise((r, i) => {
|
|
|
507
507
|
a = !1;
|
|
508
508
|
return;
|
|
509
509
|
}
|
|
510
|
-
if (Te("Read", o) || (a = !1),
|
|
510
|
+
if (Te("Read", o) || (a = !1), it("Read", e, t, s, r, n) || (a = !1), !a)
|
|
511
511
|
throw new Error("PERMISSION_DENIED");
|
|
512
512
|
}, Qo = async (n, e, t, s, r) => {
|
|
513
513
|
const { labels: i } = e, o = r.collections?.[i.collection];
|
|
@@ -517,7 +517,7 @@ const su = async (n, e, t, s) => new Promise((r, i) => {
|
|
|
517
517
|
return;
|
|
518
518
|
}
|
|
519
519
|
if (Te("Read", o) || (a = !1), n.forEach((l) => {
|
|
520
|
-
|
|
520
|
+
it("Read", e, t, s, r, l) || (a = !1);
|
|
521
521
|
}), !a)
|
|
522
522
|
throw new Error("PERMISSION_DENIED");
|
|
523
523
|
}, Ko = (n, e, t) => {
|
|
@@ -559,10 +559,10 @@ const su = async (n, e, t, s) => new Promise((r, i) => {
|
|
|
559
559
|
i[o] = l;
|
|
560
560
|
}
|
|
561
561
|
return i;
|
|
562
|
-
},
|
|
562
|
+
}, Ie = (n, e) => e.fields.filter((t) => t.name === n.name)[0], Kn = {
|
|
563
563
|
global: {},
|
|
564
564
|
collections: {}
|
|
565
|
-
},
|
|
565
|
+
}, qt = (n, e) => n && typeof n == "function" ? e ? n(...e) : n() : n, ie = async (n, e) => {
|
|
566
566
|
let t = n;
|
|
567
567
|
return n && (typeof n == "function" || typeof n.then == "function") && (e ? t = await n(...e) : t = await n()), t;
|
|
568
568
|
}, iu = async (n, e, t, s) => {
|
|
@@ -603,7 +603,7 @@ const su = async (n, e, t, s) => new Promise((r, i) => {
|
|
|
603
603
|
Wo(Kn, h);
|
|
604
604
|
}
|
|
605
605
|
return c;
|
|
606
|
-
},
|
|
606
|
+
}, ct = (n, e, t) => {
|
|
607
607
|
const s = Object.values(t.collections), { labels: r } = e;
|
|
608
608
|
let i = !1;
|
|
609
609
|
for (const o of s) {
|
|
@@ -626,7 +626,7 @@ const su = async (n, e, t, s) => new Promise((r, i) => {
|
|
|
626
626
|
});
|
|
627
627
|
});
|
|
628
628
|
}), r;
|
|
629
|
-
}, Xn = (n) => JSON.stringify(n.map((e) => e.name)),
|
|
629
|
+
}, Xn = (n) => JSON.stringify(n.map((e) => e.name)), pt = [
|
|
630
630
|
"id",
|
|
631
631
|
"Collection_Path",
|
|
632
632
|
"Last_Write_At",
|
|
@@ -638,7 +638,7 @@ const su = async (n, e, t, s) => new Promise((r, i) => {
|
|
|
638
638
|
"Created_At",
|
|
639
639
|
"Saved_At",
|
|
640
640
|
"Created_By"
|
|
641
|
-
], Zn = () =>
|
|
641
|
+
], Zn = () => pt.map((n) => {
|
|
642
642
|
let e = "", t;
|
|
643
643
|
switch (n) {
|
|
644
644
|
case "id":
|
|
@@ -734,17 +734,17 @@ const su = async (n, e, t, s) => new Promise((r, i) => {
|
|
|
734
734
|
}), r?.filter((c) => (!c.roles || c.roles.includes(e)) && c.field !== "Collection_Path").forEach((c) => {
|
|
735
735
|
t.push(W(a, c.field));
|
|
736
736
|
}), i?.range && i.range.fields.forEach((c) => {
|
|
737
|
-
|
|
737
|
+
pt.includes(c) && t.push(W(a, c));
|
|
738
738
|
}), o?.forEach((c) => {
|
|
739
739
|
const u = W(s.concat(a), c.field);
|
|
740
|
-
(!c.roles || c.roles.includes(e)) && u && (!u.access || u.access?.includes(e)) &&
|
|
740
|
+
(!c.roles || c.roles.includes(e)) && u && (!u.access || u.access?.includes(e)) && pt.includes(c.field) && t.push(W(a, c.field));
|
|
741
741
|
}), ui(n, e).forEach((c) => {
|
|
742
|
-
|
|
742
|
+
pt.includes(c.name) && t.push(W(a, c.name));
|
|
743
743
|
}), [...new Set(t)];
|
|
744
744
|
}, na = (n, e, t) => {
|
|
745
745
|
const s = [], { fields: r, preloadCache: i } = e, o = Zn();
|
|
746
746
|
i?.range && i.range.fields.forEach((c) => {
|
|
747
|
-
|
|
747
|
+
pt.includes(c) ? s.push(W(o, c)) : s.push(W(r, c));
|
|
748
748
|
});
|
|
749
749
|
const a = /* @__PURE__ */ new Set(), l = ci(e, t);
|
|
750
750
|
return Object.entries(l).map(([c, u]) => {
|
|
@@ -837,7 +837,7 @@ async function ae(n, e, t, s) {
|
|
|
837
837
|
if (n !== "setEmbedding" && (await es(n, e?.[n], s), n === "postWriteError"))
|
|
838
838
|
return r;
|
|
839
839
|
}
|
|
840
|
-
const Us = (n, e, t, s, r, i, o, a, l, c) => (n == "create" && (t.Collection_Path = e, t.Created_At = a, t.Saved_At = l, t.Created_By = o || "System"), t.Last_Write_App = r, t.Last_Write_At = a, t.Last_Save_At = l, t.Last_Write_By = o || "System", t.Last_Write_Connection_Status = i, t.Last_Write_Version = s.version, t),
|
|
840
|
+
const Us = (n, e, t, s, r, i, o, a, l, c) => (n == "create" && (t.Collection_Path = e, t.Created_At = a, t.Saved_At = l, t.Created_By = o || "System"), t.Last_Write_App = r, t.Last_Write_At = a, t.Last_Save_At = l, t.Last_Write_By = o || "System", t.Last_Write_Connection_Status = i, t.Last_Write_Version = s.version, t), ft = (n, e) => {
|
|
841
841
|
const { access: t, queries: s } = n, { serverReadOnly: r } = t, i = /* @__PURE__ */ new Set();
|
|
842
842
|
if (s)
|
|
843
843
|
for (const o of s) {
|
|
@@ -847,7 +847,7 @@ const Us = (n, e, t, s, r, i, o, a, l, c) => (n == "create" && (t.Collection_Pat
|
|
|
847
847
|
return e.forEach((o) => {
|
|
848
848
|
K(o) && ["OneToOne", "OneToMany"].includes(o.type) && o.sorting && (typeof o.sorting == "boolean" || !o.sorting.roles?.every((a) => r?.includes(a))) && i.add(o);
|
|
849
849
|
}), i;
|
|
850
|
-
},
|
|
850
|
+
}, wt = (n, e) => {
|
|
851
851
|
const { access: t, recordTitleField: s } = n, { serverReadOnly: r } = t, i = /* @__PURE__ */ new Set();
|
|
852
852
|
return e.forEach((o) => {
|
|
853
853
|
(s === o.name || o.sorting && (typeof o.sorting == "boolean" || !o.sorting.roles?.every((a) => r?.includes(a)))) && o.type === "String" && i.add(o);
|
|
@@ -862,13 +862,13 @@ const Us = (n, e, t, s, r, i, o, a, l, c) => (n == "create" && (t.Collection_Pat
|
|
|
862
862
|
else if (e[`${i.name}_Array`] = Object.keys(e[i.name]), i.includeFields)
|
|
863
863
|
for (const o of i.includeFields) {
|
|
864
864
|
const a = t.collections[i.collection], l = W(a.fields, o);
|
|
865
|
-
|
|
865
|
+
wt(a, [l]).size === 1 && Object.keys(e[i.name]).forEach((u) => {
|
|
866
866
|
e[i.name][u][o] ? e[i.name][u][`${o}_Lowercase`] = e[i.name][u][o].toLowerCase() : delete e[i.name][u][`${o}_Lowercase`];
|
|
867
867
|
});
|
|
868
868
|
}
|
|
869
869
|
} else
|
|
870
870
|
delete e[`${i.name}_Array`], delete e[`${i.name}_Single`];
|
|
871
|
-
}),
|
|
871
|
+
}), ft(n, s).forEach((i) => {
|
|
872
872
|
if (e[i.name])
|
|
873
873
|
if (Me(e[i.name]))
|
|
874
874
|
e[`${i.name}_Single`] = e[i.name];
|
|
@@ -881,14 +881,14 @@ const Us = (n, e, t, s, r, i, o, a, l, c) => (n == "create" && (t.Collection_Pat
|
|
|
881
881
|
}
|
|
882
882
|
});
|
|
883
883
|
}, Tn = (n, e) => {
|
|
884
|
-
|
|
884
|
+
wt(n, n.fields).forEach((s) => {
|
|
885
885
|
e[s.name] ? e[`${s.name}_Lowercase`] = e[s.name].toLowerCase() : delete e[`${s.name}_Lowercase`];
|
|
886
886
|
});
|
|
887
887
|
}, ra = async (n, e, t, s) => {
|
|
888
888
|
const { fields: r } = e;
|
|
889
889
|
for (const i of t.fields) {
|
|
890
890
|
const o = W(r, i.name);
|
|
891
|
-
i.custom?.initialValue && !(s && o.access && !o.access.includes(s)) && (n[i.name] = await ie(i.custom.initialValue, [n]),
|
|
891
|
+
i.custom?.initialValue && !(s && o.access && !o.access.includes(s)) && (n[i.name] = await ie(i.custom.initialValue, [n]), wt(e, [o]).size === 1 && (n[`${i.name}_Lowercase`] = n[i.name].toLowerCase()));
|
|
892
892
|
}
|
|
893
893
|
for (const i of r)
|
|
894
894
|
s && i.access && !i.access.includes(s) || ("autoIncrement" in i && i.autoIncrement && !n[i.name] && (n[i.name] = "Pending"), !K(i) && i.nullable && n[i.name] === void 0 && (n[i.name] = null));
|
|
@@ -959,7 +959,7 @@ const U = te.arrayToEnum([
|
|
|
959
959
|
"never",
|
|
960
960
|
"map",
|
|
961
961
|
"set"
|
|
962
|
-
]),
|
|
962
|
+
]), Xe = (n) => {
|
|
963
963
|
switch (typeof n) {
|
|
964
964
|
case "undefined":
|
|
965
965
|
return U.undefined;
|
|
@@ -980,7 +980,7 @@ const U = te.arrayToEnum([
|
|
|
980
980
|
default:
|
|
981
981
|
return U.unknown;
|
|
982
982
|
}
|
|
983
|
-
},
|
|
983
|
+
}, I = te.arrayToEnum([
|
|
984
984
|
"invalid_type",
|
|
985
985
|
"invalid_literal",
|
|
986
986
|
"custom",
|
|
@@ -1065,52 +1065,52 @@ Be.create = (n) => new Be(n);
|
|
|
1065
1065
|
const gs = (n, e) => {
|
|
1066
1066
|
let t;
|
|
1067
1067
|
switch (n.code) {
|
|
1068
|
-
case
|
|
1068
|
+
case I.invalid_type:
|
|
1069
1069
|
n.received === U.undefined ? t = "Required" : t = `Expected ${n.expected}, received ${n.received}`;
|
|
1070
1070
|
break;
|
|
1071
|
-
case
|
|
1071
|
+
case I.invalid_literal:
|
|
1072
1072
|
t = `Invalid literal value, expected ${JSON.stringify(n.expected, te.jsonStringifyReplacer)}`;
|
|
1073
1073
|
break;
|
|
1074
|
-
case
|
|
1074
|
+
case I.unrecognized_keys:
|
|
1075
1075
|
t = `Unrecognized key(s) in object: ${te.joinValues(n.keys, ", ")}`;
|
|
1076
1076
|
break;
|
|
1077
|
-
case
|
|
1077
|
+
case I.invalid_union:
|
|
1078
1078
|
t = "Invalid input";
|
|
1079
1079
|
break;
|
|
1080
|
-
case
|
|
1080
|
+
case I.invalid_union_discriminator:
|
|
1081
1081
|
t = `Invalid discriminator value. Expected ${te.joinValues(n.options)}`;
|
|
1082
1082
|
break;
|
|
1083
|
-
case
|
|
1083
|
+
case I.invalid_enum_value:
|
|
1084
1084
|
t = `Invalid enum value. Expected ${te.joinValues(n.options)}, received '${n.received}'`;
|
|
1085
1085
|
break;
|
|
1086
|
-
case
|
|
1086
|
+
case I.invalid_arguments:
|
|
1087
1087
|
t = "Invalid function arguments";
|
|
1088
1088
|
break;
|
|
1089
|
-
case
|
|
1089
|
+
case I.invalid_return_type:
|
|
1090
1090
|
t = "Invalid function return type";
|
|
1091
1091
|
break;
|
|
1092
|
-
case
|
|
1092
|
+
case I.invalid_date:
|
|
1093
1093
|
t = "Invalid date";
|
|
1094
1094
|
break;
|
|
1095
|
-
case
|
|
1095
|
+
case I.invalid_string:
|
|
1096
1096
|
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}"` : te.assertNever(n.validation) : n.validation !== "regex" ? t = `Invalid ${n.validation}` : t = "Invalid";
|
|
1097
1097
|
break;
|
|
1098
|
-
case
|
|
1098
|
+
case I.too_small:
|
|
1099
1099
|
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 === "bigint" ? 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";
|
|
1100
1100
|
break;
|
|
1101
|
-
case
|
|
1101
|
+
case I.too_big:
|
|
1102
1102
|
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";
|
|
1103
1103
|
break;
|
|
1104
|
-
case
|
|
1104
|
+
case I.custom:
|
|
1105
1105
|
t = "Invalid input";
|
|
1106
1106
|
break;
|
|
1107
|
-
case
|
|
1107
|
+
case I.invalid_intersection_types:
|
|
1108
1108
|
t = "Intersection results could not be merged";
|
|
1109
1109
|
break;
|
|
1110
|
-
case
|
|
1110
|
+
case I.not_multiple_of:
|
|
1111
1111
|
t = `Number must be a multiple of ${n.multipleOf}`;
|
|
1112
1112
|
break;
|
|
1113
|
-
case
|
|
1113
|
+
case I.not_finite:
|
|
1114
1114
|
t = "Number must be finite";
|
|
1115
1115
|
break;
|
|
1116
1116
|
default:
|
|
@@ -1204,7 +1204,7 @@ class ve {
|
|
|
1204
1204
|
}
|
|
1205
1205
|
const Y = Object.freeze({
|
|
1206
1206
|
status: "aborted"
|
|
1207
|
-
}),
|
|
1207
|
+
}), Bt = (n) => ({ status: "dirty", value: n }), Ae = (n) => ({ status: "valid", value: n }), ar = (n) => n.status === "aborted", lr = (n) => n.status === "dirty", xt = (n) => n.status === "valid", Rn = (n) => typeof Promise < "u" && n instanceof Promise;
|
|
1208
1208
|
var z;
|
|
1209
1209
|
(function(n) {
|
|
1210
1210
|
n.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, n.toString = (e) => typeof e == "string" ? e : e?.message;
|
|
@@ -1218,7 +1218,7 @@ class je {
|
|
|
1218
1218
|
}
|
|
1219
1219
|
}
|
|
1220
1220
|
const cr = (n, e) => {
|
|
1221
|
-
if (
|
|
1221
|
+
if (xt(e))
|
|
1222
1222
|
return { success: !0, data: e.value };
|
|
1223
1223
|
if (!n.common.issues.length)
|
|
1224
1224
|
throw new Error("Validation failed but no issues detected.");
|
|
@@ -1248,13 +1248,13 @@ class X {
|
|
|
1248
1248
|
return this._def.description;
|
|
1249
1249
|
}
|
|
1250
1250
|
_getType(e) {
|
|
1251
|
-
return
|
|
1251
|
+
return Xe(e.data);
|
|
1252
1252
|
}
|
|
1253
1253
|
_getOrReturnCtx(e, t) {
|
|
1254
1254
|
return t || {
|
|
1255
1255
|
common: e.parent.common,
|
|
1256
1256
|
data: e.data,
|
|
1257
|
-
parsedType:
|
|
1257
|
+
parsedType: Xe(e.data),
|
|
1258
1258
|
schemaErrorMap: this._def.errorMap,
|
|
1259
1259
|
path: e.path,
|
|
1260
1260
|
parent: e.parent
|
|
@@ -1266,7 +1266,7 @@ class X {
|
|
|
1266
1266
|
ctx: {
|
|
1267
1267
|
common: e.parent.common,
|
|
1268
1268
|
data: e.data,
|
|
1269
|
-
parsedType:
|
|
1269
|
+
parsedType: Xe(e.data),
|
|
1270
1270
|
schemaErrorMap: this._def.errorMap,
|
|
1271
1271
|
path: e.path,
|
|
1272
1272
|
parent: e.parent
|
|
@@ -1300,7 +1300,7 @@ class X {
|
|
|
1300
1300
|
schemaErrorMap: this._def.errorMap,
|
|
1301
1301
|
parent: null,
|
|
1302
1302
|
data: e,
|
|
1303
|
-
parsedType:
|
|
1303
|
+
parsedType: Xe(e)
|
|
1304
1304
|
}, r = this._parseSync({ data: e, path: s.path, parent: s });
|
|
1305
1305
|
return cr(s, r);
|
|
1306
1306
|
}
|
|
@@ -1314,12 +1314,12 @@ class X {
|
|
|
1314
1314
|
schemaErrorMap: this._def.errorMap,
|
|
1315
1315
|
parent: null,
|
|
1316
1316
|
data: e,
|
|
1317
|
-
parsedType:
|
|
1317
|
+
parsedType: Xe(e)
|
|
1318
1318
|
};
|
|
1319
1319
|
if (!this["~standard"].async)
|
|
1320
1320
|
try {
|
|
1321
1321
|
const s = this._parseSync({ data: e, path: [], parent: t });
|
|
1322
|
-
return
|
|
1322
|
+
return xt(s) ? {
|
|
1323
1323
|
value: s.value
|
|
1324
1324
|
} : {
|
|
1325
1325
|
issues: t.common.issues
|
|
@@ -1330,7 +1330,7 @@ class X {
|
|
|
1330
1330
|
async: !0
|
|
1331
1331
|
};
|
|
1332
1332
|
}
|
|
1333
|
-
return this._parseAsync({ data: e, path: [], parent: t }).then((s) =>
|
|
1333
|
+
return this._parseAsync({ data: e, path: [], parent: t }).then((s) => xt(s) ? {
|
|
1334
1334
|
value: s.value
|
|
1335
1335
|
} : {
|
|
1336
1336
|
issues: t.common.issues
|
|
@@ -1353,7 +1353,7 @@ class X {
|
|
|
1353
1353
|
schemaErrorMap: this._def.errorMap,
|
|
1354
1354
|
parent: null,
|
|
1355
1355
|
data: e,
|
|
1356
|
-
parsedType:
|
|
1356
|
+
parsedType: Xe(e)
|
|
1357
1357
|
}, r = this._parse({ data: e, path: s.path, parent: s }), i = await (Rn(r) ? r : Promise.resolve(r));
|
|
1358
1358
|
return cr(s, i);
|
|
1359
1359
|
}
|
|
@@ -1361,7 +1361,7 @@ class X {
|
|
|
1361
1361
|
const s = (r) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(r) : t;
|
|
1362
1362
|
return this._refinement((r, i) => {
|
|
1363
1363
|
const o = e(r), a = () => i.addIssue({
|
|
1364
|
-
code:
|
|
1364
|
+
code: I.custom,
|
|
1365
1365
|
...s(r)
|
|
1366
1366
|
});
|
|
1367
1367
|
return typeof Promise < "u" && o instanceof Promise ? o.then((l) => l ? !0 : (a(), !1)) : o ? !0 : (a(), !1);
|
|
@@ -1371,7 +1371,7 @@ class X {
|
|
|
1371
1371
|
return this._refinement((s, r) => e(s) ? !0 : (r.addIssue(typeof t == "function" ? t(s, r) : t), !1));
|
|
1372
1372
|
}
|
|
1373
1373
|
_refinement(e) {
|
|
1374
|
-
return new
|
|
1374
|
+
return new At({
|
|
1375
1375
|
schema: this,
|
|
1376
1376
|
typeName: G.ZodEffects,
|
|
1377
1377
|
effect: { type: "refinement", refinement: e }
|
|
@@ -1388,10 +1388,10 @@ class X {
|
|
|
1388
1388
|
};
|
|
1389
1389
|
}
|
|
1390
1390
|
optional() {
|
|
1391
|
-
return
|
|
1391
|
+
return st.create(this, this._def);
|
|
1392
1392
|
}
|
|
1393
1393
|
nullable() {
|
|
1394
|
-
return
|
|
1394
|
+
return Ct.create(this, this._def);
|
|
1395
1395
|
}
|
|
1396
1396
|
nullish() {
|
|
1397
1397
|
return this.nullable().optional();
|
|
@@ -1406,10 +1406,10 @@ class X {
|
|
|
1406
1406
|
return xn.create([this, e], this._def);
|
|
1407
1407
|
}
|
|
1408
1408
|
and(e) {
|
|
1409
|
-
return
|
|
1409
|
+
return In.create(this, e, this._def);
|
|
1410
1410
|
}
|
|
1411
1411
|
transform(e) {
|
|
1412
|
-
return new
|
|
1412
|
+
return new At({
|
|
1413
1413
|
...J(this._def),
|
|
1414
1414
|
schema: this,
|
|
1415
1415
|
typeName: G.ZodEffects,
|
|
@@ -1426,7 +1426,7 @@ class X {
|
|
|
1426
1426
|
});
|
|
1427
1427
|
}
|
|
1428
1428
|
brand() {
|
|
1429
|
-
return new
|
|
1429
|
+
return new Ia({
|
|
1430
1430
|
typeName: G.ZodBranded,
|
|
1431
1431
|
type: this,
|
|
1432
1432
|
...J(this._def)
|
|
@@ -1502,7 +1502,7 @@ class qe extends X {
|
|
|
1502
1502
|
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== U.string) {
|
|
1503
1503
|
const i = this._getOrReturnCtx(e);
|
|
1504
1504
|
return L(i, {
|
|
1505
|
-
code:
|
|
1505
|
+
code: I.invalid_type,
|
|
1506
1506
|
expected: U.string,
|
|
1507
1507
|
received: i.parsedType
|
|
1508
1508
|
}), Y;
|
|
@@ -1512,7 +1512,7 @@ class qe extends X {
|
|
|
1512
1512
|
for (const i of this._def.checks)
|
|
1513
1513
|
if (i.kind === "min")
|
|
1514
1514
|
e.data.length < i.value && (r = this._getOrReturnCtx(e, r), L(r, {
|
|
1515
|
-
code:
|
|
1515
|
+
code: I.too_small,
|
|
1516
1516
|
minimum: i.value,
|
|
1517
1517
|
type: "string",
|
|
1518
1518
|
inclusive: !0,
|
|
@@ -1521,7 +1521,7 @@ class qe extends X {
|
|
|
1521
1521
|
}), s.dirty());
|
|
1522
1522
|
else if (i.kind === "max")
|
|
1523
1523
|
e.data.length > i.value && (r = this._getOrReturnCtx(e, r), L(r, {
|
|
1524
|
-
code:
|
|
1524
|
+
code: I.too_big,
|
|
1525
1525
|
maximum: i.value,
|
|
1526
1526
|
type: "string",
|
|
1527
1527
|
inclusive: !0,
|
|
@@ -1531,14 +1531,14 @@ class qe extends X {
|
|
|
1531
1531
|
else if (i.kind === "length") {
|
|
1532
1532
|
const o = e.data.length > i.value, a = e.data.length < i.value;
|
|
1533
1533
|
(o || a) && (r = this._getOrReturnCtx(e, r), o ? L(r, {
|
|
1534
|
-
code:
|
|
1534
|
+
code: I.too_big,
|
|
1535
1535
|
maximum: i.value,
|
|
1536
1536
|
type: "string",
|
|
1537
1537
|
inclusive: !0,
|
|
1538
1538
|
exact: !0,
|
|
1539
1539
|
message: i.message
|
|
1540
1540
|
}) : a && L(r, {
|
|
1541
|
-
code:
|
|
1541
|
+
code: I.too_small,
|
|
1542
1542
|
minimum: i.value,
|
|
1543
1543
|
type: "string",
|
|
1544
1544
|
inclusive: !0,
|
|
@@ -1548,43 +1548,43 @@ class qe extends X {
|
|
|
1548
1548
|
} else if (i.kind === "email")
|
|
1549
1549
|
pa.test(e.data) || (r = this._getOrReturnCtx(e, r), L(r, {
|
|
1550
1550
|
validation: "email",
|
|
1551
|
-
code:
|
|
1551
|
+
code: I.invalid_string,
|
|
1552
1552
|
message: i.message
|
|
1553
1553
|
}), s.dirty());
|
|
1554
1554
|
else if (i.kind === "emoji")
|
|
1555
1555
|
ts || (ts = new RegExp(ya, "u")), ts.test(e.data) || (r = this._getOrReturnCtx(e, r), L(r, {
|
|
1556
1556
|
validation: "emoji",
|
|
1557
|
-
code:
|
|
1557
|
+
code: I.invalid_string,
|
|
1558
1558
|
message: i.message
|
|
1559
1559
|
}), s.dirty());
|
|
1560
1560
|
else if (i.kind === "uuid")
|
|
1561
1561
|
da.test(e.data) || (r = this._getOrReturnCtx(e, r), L(r, {
|
|
1562
1562
|
validation: "uuid",
|
|
1563
|
-
code:
|
|
1563
|
+
code: I.invalid_string,
|
|
1564
1564
|
message: i.message
|
|
1565
1565
|
}), s.dirty());
|
|
1566
1566
|
else if (i.kind === "nanoid")
|
|
1567
1567
|
fa.test(e.data) || (r = this._getOrReturnCtx(e, r), L(r, {
|
|
1568
1568
|
validation: "nanoid",
|
|
1569
|
-
code:
|
|
1569
|
+
code: I.invalid_string,
|
|
1570
1570
|
message: i.message
|
|
1571
1571
|
}), s.dirty());
|
|
1572
1572
|
else if (i.kind === "cuid")
|
|
1573
1573
|
la.test(e.data) || (r = this._getOrReturnCtx(e, r), L(r, {
|
|
1574
1574
|
validation: "cuid",
|
|
1575
|
-
code:
|
|
1575
|
+
code: I.invalid_string,
|
|
1576
1576
|
message: i.message
|
|
1577
1577
|
}), s.dirty());
|
|
1578
1578
|
else if (i.kind === "cuid2")
|
|
1579
1579
|
ca.test(e.data) || (r = this._getOrReturnCtx(e, r), L(r, {
|
|
1580
1580
|
validation: "cuid2",
|
|
1581
|
-
code:
|
|
1581
|
+
code: I.invalid_string,
|
|
1582
1582
|
message: i.message
|
|
1583
1583
|
}), s.dirty());
|
|
1584
1584
|
else if (i.kind === "ulid")
|
|
1585
1585
|
ua.test(e.data) || (r = this._getOrReturnCtx(e, r), L(r, {
|
|
1586
1586
|
validation: "ulid",
|
|
1587
|
-
code:
|
|
1587
|
+
code: I.invalid_string,
|
|
1588
1588
|
message: i.message
|
|
1589
1589
|
}), s.dirty());
|
|
1590
1590
|
else if (i.kind === "url")
|
|
@@ -1593,61 +1593,61 @@ class qe extends X {
|
|
|
1593
1593
|
} catch {
|
|
1594
1594
|
r = this._getOrReturnCtx(e, r), L(r, {
|
|
1595
1595
|
validation: "url",
|
|
1596
|
-
code:
|
|
1596
|
+
code: I.invalid_string,
|
|
1597
1597
|
message: i.message
|
|
1598
1598
|
}), s.dirty();
|
|
1599
1599
|
}
|
|
1600
1600
|
else i.kind === "regex" ? (i.regex.lastIndex = 0, i.regex.test(e.data) || (r = this._getOrReturnCtx(e, r), L(r, {
|
|
1601
1601
|
validation: "regex",
|
|
1602
|
-
code:
|
|
1602
|
+
code: I.invalid_string,
|
|
1603
1603
|
message: i.message
|
|
1604
1604
|
}), s.dirty())) : i.kind === "trim" ? e.data = e.data.trim() : i.kind === "includes" ? e.data.includes(i.value, i.position) || (r = this._getOrReturnCtx(e, r), L(r, {
|
|
1605
|
-
code:
|
|
1605
|
+
code: I.invalid_string,
|
|
1606
1606
|
validation: { includes: i.value, position: i.position },
|
|
1607
1607
|
message: i.message
|
|
1608
1608
|
}), s.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) || (r = this._getOrReturnCtx(e, r), L(r, {
|
|
1609
|
-
code:
|
|
1609
|
+
code: I.invalid_string,
|
|
1610
1610
|
validation: { startsWith: i.value },
|
|
1611
1611
|
message: i.message
|
|
1612
1612
|
}), s.dirty()) : i.kind === "endsWith" ? e.data.endsWith(i.value) || (r = this._getOrReturnCtx(e, r), L(r, {
|
|
1613
|
-
code:
|
|
1613
|
+
code: I.invalid_string,
|
|
1614
1614
|
validation: { endsWith: i.value },
|
|
1615
1615
|
message: i.message
|
|
1616
1616
|
}), s.dirty()) : i.kind === "datetime" ? Sa(i).test(e.data) || (r = this._getOrReturnCtx(e, r), L(r, {
|
|
1617
|
-
code:
|
|
1617
|
+
code: I.invalid_string,
|
|
1618
1618
|
validation: "datetime",
|
|
1619
1619
|
message: i.message
|
|
1620
1620
|
}), s.dirty()) : i.kind === "date" ? ka.test(e.data) || (r = this._getOrReturnCtx(e, r), L(r, {
|
|
1621
|
-
code:
|
|
1621
|
+
code: I.invalid_string,
|
|
1622
1622
|
validation: "date",
|
|
1623
1623
|
message: i.message
|
|
1624
1624
|
}), s.dirty()) : i.kind === "time" ? ba(i).test(e.data) || (r = this._getOrReturnCtx(e, r), L(r, {
|
|
1625
|
-
code:
|
|
1625
|
+
code: I.invalid_string,
|
|
1626
1626
|
validation: "time",
|
|
1627
1627
|
message: i.message
|
|
1628
1628
|
}), s.dirty()) : i.kind === "duration" ? ma.test(e.data) || (r = this._getOrReturnCtx(e, r), L(r, {
|
|
1629
1629
|
validation: "duration",
|
|
1630
|
-
code:
|
|
1630
|
+
code: I.invalid_string,
|
|
1631
1631
|
message: i.message
|
|
1632
1632
|
}), s.dirty()) : i.kind === "ip" ? Ta(e.data, i.version) || (r = this._getOrReturnCtx(e, r), L(r, {
|
|
1633
1633
|
validation: "ip",
|
|
1634
|
-
code:
|
|
1634
|
+
code: I.invalid_string,
|
|
1635
1635
|
message: i.message
|
|
1636
1636
|
}), s.dirty()) : i.kind === "jwt" ? Ra(e.data, i.alg) || (r = this._getOrReturnCtx(e, r), L(r, {
|
|
1637
1637
|
validation: "jwt",
|
|
1638
|
-
code:
|
|
1638
|
+
code: I.invalid_string,
|
|
1639
1639
|
message: i.message
|
|
1640
1640
|
}), s.dirty()) : i.kind === "cidr" ? Na(e.data, i.version) || (r = this._getOrReturnCtx(e, r), L(r, {
|
|
1641
1641
|
validation: "cidr",
|
|
1642
|
-
code:
|
|
1642
|
+
code: I.invalid_string,
|
|
1643
1643
|
message: i.message
|
|
1644
1644
|
}), s.dirty()) : i.kind === "base64" ? va.test(e.data) || (r = this._getOrReturnCtx(e, r), L(r, {
|
|
1645
1645
|
validation: "base64",
|
|
1646
|
-
code:
|
|
1646
|
+
code: I.invalid_string,
|
|
1647
1647
|
message: i.message
|
|
1648
1648
|
}), s.dirty()) : i.kind === "base64url" ? Oa.test(e.data) || (r = this._getOrReturnCtx(e, r), L(r, {
|
|
1649
1649
|
validation: "base64url",
|
|
1650
|
-
code:
|
|
1650
|
+
code: I.invalid_string,
|
|
1651
1651
|
message: i.message
|
|
1652
1652
|
}), s.dirty()) : te.assertNever(i);
|
|
1653
1653
|
return { status: s.value, value: e.data };
|
|
@@ -1655,7 +1655,7 @@ class qe extends X {
|
|
|
1655
1655
|
_regex(e, t, s) {
|
|
1656
1656
|
return this.refinement((r) => e.test(r), {
|
|
1657
1657
|
validation: t,
|
|
1658
|
-
code:
|
|
1658
|
+
code: I.invalid_string,
|
|
1659
1659
|
...z.errToObj(s)
|
|
1660
1660
|
});
|
|
1661
1661
|
}
|
|
@@ -1884,7 +1884,7 @@ function xa(n, e) {
|
|
|
1884
1884
|
const t = (n.toString().split(".")[1] || "").length, s = (e.toString().split(".")[1] || "").length, r = t > s ? t : s, i = Number.parseInt(n.toFixed(r).replace(".", "")), o = Number.parseInt(e.toFixed(r).replace(".", ""));
|
|
1885
1885
|
return i % o / 10 ** r;
|
|
1886
1886
|
}
|
|
1887
|
-
class
|
|
1887
|
+
class It extends X {
|
|
1888
1888
|
constructor() {
|
|
1889
1889
|
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
1890
1890
|
}
|
|
@@ -1892,7 +1892,7 @@ class xt extends X {
|
|
|
1892
1892
|
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== U.number) {
|
|
1893
1893
|
const i = this._getOrReturnCtx(e);
|
|
1894
1894
|
return L(i, {
|
|
1895
|
-
code:
|
|
1895
|
+
code: I.invalid_type,
|
|
1896
1896
|
expected: U.number,
|
|
1897
1897
|
received: i.parsedType
|
|
1898
1898
|
}), Y;
|
|
@@ -1901,30 +1901,30 @@ class xt extends X {
|
|
|
1901
1901
|
const r = new ve();
|
|
1902
1902
|
for (const i of this._def.checks)
|
|
1903
1903
|
i.kind === "int" ? te.isInteger(e.data) || (s = this._getOrReturnCtx(e, s), L(s, {
|
|
1904
|
-
code:
|
|
1904
|
+
code: I.invalid_type,
|
|
1905
1905
|
expected: "integer",
|
|
1906
1906
|
received: "float",
|
|
1907
1907
|
message: i.message
|
|
1908
1908
|
}), r.dirty()) : i.kind === "min" ? (i.inclusive ? e.data < i.value : e.data <= i.value) && (s = this._getOrReturnCtx(e, s), L(s, {
|
|
1909
|
-
code:
|
|
1909
|
+
code: I.too_small,
|
|
1910
1910
|
minimum: i.value,
|
|
1911
1911
|
type: "number",
|
|
1912
1912
|
inclusive: i.inclusive,
|
|
1913
1913
|
exact: !1,
|
|
1914
1914
|
message: i.message
|
|
1915
1915
|
}), r.dirty()) : i.kind === "max" ? (i.inclusive ? e.data > i.value : e.data >= i.value) && (s = this._getOrReturnCtx(e, s), L(s, {
|
|
1916
|
-
code:
|
|
1916
|
+
code: I.too_big,
|
|
1917
1917
|
maximum: i.value,
|
|
1918
1918
|
type: "number",
|
|
1919
1919
|
inclusive: i.inclusive,
|
|
1920
1920
|
exact: !1,
|
|
1921
1921
|
message: i.message
|
|
1922
1922
|
}), r.dirty()) : i.kind === "multipleOf" ? xa(e.data, i.value) !== 0 && (s = this._getOrReturnCtx(e, s), L(s, {
|
|
1923
|
-
code:
|
|
1923
|
+
code: I.not_multiple_of,
|
|
1924
1924
|
multipleOf: i.value,
|
|
1925
1925
|
message: i.message
|
|
1926
1926
|
}), r.dirty()) : i.kind === "finite" ? Number.isFinite(e.data) || (s = this._getOrReturnCtx(e, s), L(s, {
|
|
1927
|
-
code:
|
|
1927
|
+
code: I.not_finite,
|
|
1928
1928
|
message: i.message
|
|
1929
1929
|
}), r.dirty()) : te.assertNever(i);
|
|
1930
1930
|
return { status: r.value, value: e.data };
|
|
@@ -1942,7 +1942,7 @@ class xt extends X {
|
|
|
1942
1942
|
return this.setLimit("max", e, !1, z.toString(t));
|
|
1943
1943
|
}
|
|
1944
1944
|
setLimit(e, t, s, r) {
|
|
1945
|
-
return new
|
|
1945
|
+
return new It({
|
|
1946
1946
|
...this._def,
|
|
1947
1947
|
checks: [
|
|
1948
1948
|
...this._def.checks,
|
|
@@ -1956,7 +1956,7 @@ class xt extends X {
|
|
|
1956
1956
|
});
|
|
1957
1957
|
}
|
|
1958
1958
|
_addCheck(e) {
|
|
1959
|
-
return new
|
|
1959
|
+
return new It({
|
|
1960
1960
|
...this._def,
|
|
1961
1961
|
checks: [...this._def.checks, e]
|
|
1962
1962
|
});
|
|
@@ -2050,13 +2050,13 @@ class xt extends X {
|
|
|
2050
2050
|
return Number.isFinite(t) && Number.isFinite(e);
|
|
2051
2051
|
}
|
|
2052
2052
|
}
|
|
2053
|
-
|
|
2053
|
+
It.create = (n) => new It({
|
|
2054
2054
|
checks: [],
|
|
2055
2055
|
typeName: G.ZodNumber,
|
|
2056
2056
|
coerce: n?.coerce || !1,
|
|
2057
2057
|
...J(n)
|
|
2058
2058
|
});
|
|
2059
|
-
class
|
|
2059
|
+
class en extends X {
|
|
2060
2060
|
constructor() {
|
|
2061
2061
|
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
2062
2062
|
}
|
|
@@ -2073,19 +2073,19 @@ class Xt extends X {
|
|
|
2073
2073
|
const r = new ve();
|
|
2074
2074
|
for (const i of this._def.checks)
|
|
2075
2075
|
i.kind === "min" ? (i.inclusive ? e.data < i.value : e.data <= i.value) && (s = this._getOrReturnCtx(e, s), L(s, {
|
|
2076
|
-
code:
|
|
2076
|
+
code: I.too_small,
|
|
2077
2077
|
type: "bigint",
|
|
2078
2078
|
minimum: i.value,
|
|
2079
2079
|
inclusive: i.inclusive,
|
|
2080
2080
|
message: i.message
|
|
2081
2081
|
}), r.dirty()) : i.kind === "max" ? (i.inclusive ? e.data > i.value : e.data >= i.value) && (s = this._getOrReturnCtx(e, s), L(s, {
|
|
2082
|
-
code:
|
|
2082
|
+
code: I.too_big,
|
|
2083
2083
|
type: "bigint",
|
|
2084
2084
|
maximum: i.value,
|
|
2085
2085
|
inclusive: i.inclusive,
|
|
2086
2086
|
message: i.message
|
|
2087
2087
|
}), r.dirty()) : i.kind === "multipleOf" ? e.data % i.value !== BigInt(0) && (s = this._getOrReturnCtx(e, s), L(s, {
|
|
2088
|
-
code:
|
|
2088
|
+
code: I.not_multiple_of,
|
|
2089
2089
|
multipleOf: i.value,
|
|
2090
2090
|
message: i.message
|
|
2091
2091
|
}), r.dirty()) : te.assertNever(i);
|
|
@@ -2094,7 +2094,7 @@ class Xt extends X {
|
|
|
2094
2094
|
_getInvalidInput(e) {
|
|
2095
2095
|
const t = this._getOrReturnCtx(e);
|
|
2096
2096
|
return L(t, {
|
|
2097
|
-
code:
|
|
2097
|
+
code: I.invalid_type,
|
|
2098
2098
|
expected: U.bigint,
|
|
2099
2099
|
received: t.parsedType
|
|
2100
2100
|
}), Y;
|
|
@@ -2112,7 +2112,7 @@ class Xt extends X {
|
|
|
2112
2112
|
return this.setLimit("max", e, !1, z.toString(t));
|
|
2113
2113
|
}
|
|
2114
2114
|
setLimit(e, t, s, r) {
|
|
2115
|
-
return new
|
|
2115
|
+
return new en({
|
|
2116
2116
|
...this._def,
|
|
2117
2117
|
checks: [
|
|
2118
2118
|
...this._def.checks,
|
|
@@ -2126,7 +2126,7 @@ class Xt extends X {
|
|
|
2126
2126
|
});
|
|
2127
2127
|
}
|
|
2128
2128
|
_addCheck(e) {
|
|
2129
|
-
return new
|
|
2129
|
+
return new en({
|
|
2130
2130
|
...this._def,
|
|
2131
2131
|
checks: [...this._def.checks, e]
|
|
2132
2132
|
});
|
|
@@ -2183,7 +2183,7 @@ class Xt extends X {
|
|
|
2183
2183
|
return e;
|
|
2184
2184
|
}
|
|
2185
2185
|
}
|
|
2186
|
-
|
|
2186
|
+
en.create = (n) => new en({
|
|
2187
2187
|
checks: [],
|
|
2188
2188
|
typeName: G.ZodBigInt,
|
|
2189
2189
|
coerce: n?.coerce ?? !1,
|
|
@@ -2194,7 +2194,7 @@ class ws extends X {
|
|
|
2194
2194
|
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== U.boolean) {
|
|
2195
2195
|
const s = this._getOrReturnCtx(e);
|
|
2196
2196
|
return L(s, {
|
|
2197
|
-
code:
|
|
2197
|
+
code: I.invalid_type,
|
|
2198
2198
|
expected: U.boolean,
|
|
2199
2199
|
received: s.parsedType
|
|
2200
2200
|
}), Y;
|
|
@@ -2212,7 +2212,7 @@ class Nn extends X {
|
|
|
2212
2212
|
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== U.date) {
|
|
2213
2213
|
const i = this._getOrReturnCtx(e);
|
|
2214
2214
|
return L(i, {
|
|
2215
|
-
code:
|
|
2215
|
+
code: I.invalid_type,
|
|
2216
2216
|
expected: U.date,
|
|
2217
2217
|
received: i.parsedType
|
|
2218
2218
|
}), Y;
|
|
@@ -2220,21 +2220,21 @@ class Nn extends X {
|
|
|
2220
2220
|
if (Number.isNaN(e.data.getTime())) {
|
|
2221
2221
|
const i = this._getOrReturnCtx(e);
|
|
2222
2222
|
return L(i, {
|
|
2223
|
-
code:
|
|
2223
|
+
code: I.invalid_date
|
|
2224
2224
|
}), Y;
|
|
2225
2225
|
}
|
|
2226
2226
|
const s = new ve();
|
|
2227
2227
|
let r;
|
|
2228
2228
|
for (const i of this._def.checks)
|
|
2229
2229
|
i.kind === "min" ? e.data.getTime() < i.value && (r = this._getOrReturnCtx(e, r), L(r, {
|
|
2230
|
-
code:
|
|
2230
|
+
code: I.too_small,
|
|
2231
2231
|
message: i.message,
|
|
2232
2232
|
inclusive: !0,
|
|
2233
2233
|
exact: !1,
|
|
2234
2234
|
minimum: i.value,
|
|
2235
2235
|
type: "date"
|
|
2236
2236
|
}), s.dirty()) : i.kind === "max" ? e.data.getTime() > i.value && (r = this._getOrReturnCtx(e, r), L(r, {
|
|
2237
|
-
code:
|
|
2237
|
+
code: I.too_big,
|
|
2238
2238
|
message: i.message,
|
|
2239
2239
|
inclusive: !0,
|
|
2240
2240
|
exact: !1,
|
|
@@ -2290,7 +2290,7 @@ class ur extends X {
|
|
|
2290
2290
|
if (this._getType(e) !== U.symbol) {
|
|
2291
2291
|
const s = this._getOrReturnCtx(e);
|
|
2292
2292
|
return L(s, {
|
|
2293
|
-
code:
|
|
2293
|
+
code: I.invalid_type,
|
|
2294
2294
|
expected: U.symbol,
|
|
2295
2295
|
received: s.parsedType
|
|
2296
2296
|
}), Y;
|
|
@@ -2307,7 +2307,7 @@ class _s extends X {
|
|
|
2307
2307
|
if (this._getType(e) !== U.undefined) {
|
|
2308
2308
|
const s = this._getOrReturnCtx(e);
|
|
2309
2309
|
return L(s, {
|
|
2310
|
-
code:
|
|
2310
|
+
code: I.invalid_type,
|
|
2311
2311
|
expected: U.undefined,
|
|
2312
2312
|
received: s.parsedType
|
|
2313
2313
|
}), Y;
|
|
@@ -2324,7 +2324,7 @@ class dr extends X {
|
|
|
2324
2324
|
if (this._getType(e) !== U.null) {
|
|
2325
2325
|
const s = this._getOrReturnCtx(e);
|
|
2326
2326
|
return L(s, {
|
|
2327
|
-
code:
|
|
2327
|
+
code: I.invalid_type,
|
|
2328
2328
|
expected: U.null,
|
|
2329
2329
|
received: s.parsedType
|
|
2330
2330
|
}), Y;
|
|
@@ -2360,17 +2360,17 @@ fr.create = (n) => new fr({
|
|
|
2360
2360
|
typeName: G.ZodUnknown,
|
|
2361
2361
|
...J(n)
|
|
2362
2362
|
});
|
|
2363
|
-
class
|
|
2363
|
+
class ot extends X {
|
|
2364
2364
|
_parse(e) {
|
|
2365
2365
|
const t = this._getOrReturnCtx(e);
|
|
2366
2366
|
return L(t, {
|
|
2367
|
-
code:
|
|
2367
|
+
code: I.invalid_type,
|
|
2368
2368
|
expected: U.never,
|
|
2369
2369
|
received: t.parsedType
|
|
2370
2370
|
}), Y;
|
|
2371
2371
|
}
|
|
2372
2372
|
}
|
|
2373
|
-
|
|
2373
|
+
ot.create = (n) => new ot({
|
|
2374
2374
|
typeName: G.ZodNever,
|
|
2375
2375
|
...J(n)
|
|
2376
2376
|
});
|
|
@@ -2379,7 +2379,7 @@ class hr extends X {
|
|
|
2379
2379
|
if (this._getType(e) !== U.undefined) {
|
|
2380
2380
|
const s = this._getOrReturnCtx(e);
|
|
2381
2381
|
return L(s, {
|
|
2382
|
-
code:
|
|
2382
|
+
code: I.invalid_type,
|
|
2383
2383
|
expected: U.void,
|
|
2384
2384
|
received: s.parsedType
|
|
2385
2385
|
}), Y;
|
|
@@ -2396,14 +2396,14 @@ class Ue extends X {
|
|
|
2396
2396
|
const { ctx: t, status: s } = this._processInputParams(e), r = this._def;
|
|
2397
2397
|
if (t.parsedType !== U.array)
|
|
2398
2398
|
return L(t, {
|
|
2399
|
-
code:
|
|
2399
|
+
code: I.invalid_type,
|
|
2400
2400
|
expected: U.array,
|
|
2401
2401
|
received: t.parsedType
|
|
2402
2402
|
}), Y;
|
|
2403
2403
|
if (r.exactLength !== null) {
|
|
2404
2404
|
const o = t.data.length > r.exactLength.value, a = t.data.length < r.exactLength.value;
|
|
2405
2405
|
(o || a) && (L(t, {
|
|
2406
|
-
code: o ?
|
|
2406
|
+
code: o ? I.too_big : I.too_small,
|
|
2407
2407
|
minimum: a ? r.exactLength.value : void 0,
|
|
2408
2408
|
maximum: o ? r.exactLength.value : void 0,
|
|
2409
2409
|
type: "array",
|
|
@@ -2413,14 +2413,14 @@ class Ue extends X {
|
|
|
2413
2413
|
}), s.dirty());
|
|
2414
2414
|
}
|
|
2415
2415
|
if (r.minLength !== null && t.data.length < r.minLength.value && (L(t, {
|
|
2416
|
-
code:
|
|
2416
|
+
code: I.too_small,
|
|
2417
2417
|
minimum: r.minLength.value,
|
|
2418
2418
|
type: "array",
|
|
2419
2419
|
inclusive: !0,
|
|
2420
2420
|
exact: !1,
|
|
2421
2421
|
message: r.minLength.message
|
|
2422
2422
|
}), s.dirty()), r.maxLength !== null && t.data.length > r.maxLength.value && (L(t, {
|
|
2423
|
-
code:
|
|
2423
|
+
code: I.too_big,
|
|
2424
2424
|
maximum: r.maxLength.value,
|
|
2425
2425
|
type: "array",
|
|
2426
2426
|
inclusive: !0,
|
|
@@ -2464,12 +2464,12 @@ Ue.create = (n, e) => new Ue({
|
|
|
2464
2464
|
typeName: G.ZodArray,
|
|
2465
2465
|
...J(e)
|
|
2466
2466
|
});
|
|
2467
|
-
function
|
|
2467
|
+
function bt(n) {
|
|
2468
2468
|
if (n instanceof fe) {
|
|
2469
2469
|
const e = {};
|
|
2470
2470
|
for (const t in n.shape) {
|
|
2471
2471
|
const s = n.shape[t];
|
|
2472
|
-
e[t] =
|
|
2472
|
+
e[t] = st.create(bt(s));
|
|
2473
2473
|
}
|
|
2474
2474
|
return new fe({
|
|
2475
2475
|
...n._def,
|
|
@@ -2477,8 +2477,8 @@ function kt(n) {
|
|
|
2477
2477
|
});
|
|
2478
2478
|
} else return n instanceof Ue ? new Ue({
|
|
2479
2479
|
...n._def,
|
|
2480
|
-
type:
|
|
2481
|
-
}) : n instanceof
|
|
2480
|
+
type: bt(n.element)
|
|
2481
|
+
}) : n instanceof st ? st.create(bt(n.unwrap())) : n instanceof Ct ? Ct.create(bt(n.unwrap())) : n instanceof yt ? yt.create(n.items.map((e) => bt(e))) : n;
|
|
2482
2482
|
}
|
|
2483
2483
|
class fe extends X {
|
|
2484
2484
|
constructor() {
|
|
@@ -2494,13 +2494,13 @@ class fe extends X {
|
|
|
2494
2494
|
if (this._getType(e) !== U.object) {
|
|
2495
2495
|
const c = this._getOrReturnCtx(e);
|
|
2496
2496
|
return L(c, {
|
|
2497
|
-
code:
|
|
2497
|
+
code: I.invalid_type,
|
|
2498
2498
|
expected: U.object,
|
|
2499
2499
|
received: c.parsedType
|
|
2500
2500
|
}), Y;
|
|
2501
2501
|
}
|
|
2502
2502
|
const { status: s, ctx: r } = this._processInputParams(e), { shape: i, keys: o } = this._getCached(), a = [];
|
|
2503
|
-
if (!(this._def.catchall instanceof
|
|
2503
|
+
if (!(this._def.catchall instanceof ot && this._def.unknownKeys === "strip"))
|
|
2504
2504
|
for (const c in r.data)
|
|
2505
2505
|
o.includes(c) || a.push(c);
|
|
2506
2506
|
const l = [];
|
|
@@ -2512,7 +2512,7 @@ class fe extends X {
|
|
|
2512
2512
|
alwaysSet: c in r.data
|
|
2513
2513
|
});
|
|
2514
2514
|
}
|
|
2515
|
-
if (this._def.catchall instanceof
|
|
2515
|
+
if (this._def.catchall instanceof ot) {
|
|
2516
2516
|
const c = this._def.unknownKeys;
|
|
2517
2517
|
if (c === "passthrough")
|
|
2518
2518
|
for (const u of a)
|
|
@@ -2522,7 +2522,7 @@ class fe extends X {
|
|
|
2522
2522
|
});
|
|
2523
2523
|
else if (c === "strict")
|
|
2524
2524
|
a.length > 0 && (L(r, {
|
|
2525
|
-
code:
|
|
2525
|
+
code: I.unrecognized_keys,
|
|
2526
2526
|
keys: a
|
|
2527
2527
|
}), s.dirty());
|
|
2528
2528
|
else if (c !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
@@ -2713,7 +2713,7 @@ class fe extends X {
|
|
|
2713
2713
|
* @deprecated
|
|
2714
2714
|
*/
|
|
2715
2715
|
deepPartial() {
|
|
2716
|
-
return
|
|
2716
|
+
return bt(this);
|
|
2717
2717
|
}
|
|
2718
2718
|
partial(e) {
|
|
2719
2719
|
const t = {};
|
|
@@ -2733,7 +2733,7 @@ class fe extends X {
|
|
|
2733
2733
|
t[s] = this.shape[s];
|
|
2734
2734
|
else {
|
|
2735
2735
|
let i = this.shape[s];
|
|
2736
|
-
for (; i instanceof
|
|
2736
|
+
for (; i instanceof st; )
|
|
2737
2737
|
i = i._def.innerType;
|
|
2738
2738
|
t[s] = i;
|
|
2739
2739
|
}
|
|
@@ -2749,21 +2749,21 @@ class fe extends X {
|
|
|
2749
2749
|
fe.create = (n, e) => new fe({
|
|
2750
2750
|
shape: () => n,
|
|
2751
2751
|
unknownKeys: "strip",
|
|
2752
|
-
catchall:
|
|
2752
|
+
catchall: ot.create(),
|
|
2753
2753
|
typeName: G.ZodObject,
|
|
2754
2754
|
...J(e)
|
|
2755
2755
|
});
|
|
2756
2756
|
fe.strictCreate = (n, e) => new fe({
|
|
2757
2757
|
shape: () => n,
|
|
2758
2758
|
unknownKeys: "strict",
|
|
2759
|
-
catchall:
|
|
2759
|
+
catchall: ot.create(),
|
|
2760
2760
|
typeName: G.ZodObject,
|
|
2761
2761
|
...J(e)
|
|
2762
2762
|
});
|
|
2763
2763
|
fe.lazycreate = (n, e) => new fe({
|
|
2764
2764
|
shape: n,
|
|
2765
2765
|
unknownKeys: "strip",
|
|
2766
|
-
catchall:
|
|
2766
|
+
catchall: ot.create(),
|
|
2767
2767
|
typeName: G.ZodObject,
|
|
2768
2768
|
...J(e)
|
|
2769
2769
|
});
|
|
@@ -2779,7 +2779,7 @@ class xn extends X {
|
|
|
2779
2779
|
return t.common.issues.push(...a.ctx.common.issues), a.result;
|
|
2780
2780
|
const o = i.map((a) => new Be(a.ctx.common.issues));
|
|
2781
2781
|
return L(t, {
|
|
2782
|
-
code:
|
|
2782
|
+
code: I.invalid_union,
|
|
2783
2783
|
unionErrors: o
|
|
2784
2784
|
}), Y;
|
|
2785
2785
|
}
|
|
@@ -2826,7 +2826,7 @@ class xn extends X {
|
|
|
2826
2826
|
return t.common.issues.push(...i.ctx.common.issues), i.result;
|
|
2827
2827
|
const a = o.map((l) => new Be(l));
|
|
2828
2828
|
return L(t, {
|
|
2829
|
-
code:
|
|
2829
|
+
code: I.invalid_union,
|
|
2830
2830
|
unionErrors: a
|
|
2831
2831
|
}), Y;
|
|
2832
2832
|
}
|
|
@@ -2841,7 +2841,7 @@ xn.create = (n, e) => new xn({
|
|
|
2841
2841
|
...J(e)
|
|
2842
2842
|
});
|
|
2843
2843
|
function vs(n, e) {
|
|
2844
|
-
const t =
|
|
2844
|
+
const t = Xe(n), s = Xe(e);
|
|
2845
2845
|
if (n === e)
|
|
2846
2846
|
return { valid: !0, data: n };
|
|
2847
2847
|
if (t === U.object && s === U.object) {
|
|
@@ -2866,14 +2866,14 @@ function vs(n, e) {
|
|
|
2866
2866
|
return { valid: !0, data: r };
|
|
2867
2867
|
} else return t === U.date && s === U.date && +n == +e ? { valid: !0, data: n } : { valid: !1 };
|
|
2868
2868
|
}
|
|
2869
|
-
class
|
|
2869
|
+
class In extends X {
|
|
2870
2870
|
_parse(e) {
|
|
2871
2871
|
const { status: t, ctx: s } = this._processInputParams(e), r = (i, o) => {
|
|
2872
2872
|
if (ar(i) || ar(o))
|
|
2873
2873
|
return Y;
|
|
2874
2874
|
const a = vs(i.value, o.value);
|
|
2875
2875
|
return a.valid ? ((lr(i) || lr(o)) && t.dirty(), { status: t.value, value: a.data }) : (L(s, {
|
|
2876
|
-
code:
|
|
2876
|
+
code: I.invalid_intersection_types
|
|
2877
2877
|
}), Y);
|
|
2878
2878
|
};
|
|
2879
2879
|
return s.common.async ? Promise.all([
|
|
@@ -2898,31 +2898,31 @@ class Dn extends X {
|
|
|
2898
2898
|
}));
|
|
2899
2899
|
}
|
|
2900
2900
|
}
|
|
2901
|
-
|
|
2901
|
+
In.create = (n, e, t) => new In({
|
|
2902
2902
|
left: n,
|
|
2903
2903
|
right: e,
|
|
2904
2904
|
typeName: G.ZodIntersection,
|
|
2905
2905
|
...J(t)
|
|
2906
2906
|
});
|
|
2907
|
-
class
|
|
2907
|
+
class yt extends X {
|
|
2908
2908
|
_parse(e) {
|
|
2909
2909
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2910
2910
|
if (s.parsedType !== U.array)
|
|
2911
2911
|
return L(s, {
|
|
2912
|
-
code:
|
|
2912
|
+
code: I.invalid_type,
|
|
2913
2913
|
expected: U.array,
|
|
2914
2914
|
received: s.parsedType
|
|
2915
2915
|
}), Y;
|
|
2916
2916
|
if (s.data.length < this._def.items.length)
|
|
2917
2917
|
return L(s, {
|
|
2918
|
-
code:
|
|
2918
|
+
code: I.too_small,
|
|
2919
2919
|
minimum: this._def.items.length,
|
|
2920
2920
|
inclusive: !0,
|
|
2921
2921
|
exact: !1,
|
|
2922
2922
|
type: "array"
|
|
2923
2923
|
}), Y;
|
|
2924
2924
|
!this._def.rest && s.data.length > this._def.items.length && (L(s, {
|
|
2925
|
-
code:
|
|
2925
|
+
code: I.too_big,
|
|
2926
2926
|
maximum: this._def.items.length,
|
|
2927
2927
|
inclusive: !0,
|
|
2928
2928
|
exact: !1,
|
|
@@ -2938,23 +2938,23 @@ class pt extends X {
|
|
|
2938
2938
|
return this._def.items;
|
|
2939
2939
|
}
|
|
2940
2940
|
rest(e) {
|
|
2941
|
-
return new
|
|
2941
|
+
return new yt({
|
|
2942
2942
|
...this._def,
|
|
2943
2943
|
rest: e
|
|
2944
2944
|
});
|
|
2945
2945
|
}
|
|
2946
2946
|
}
|
|
2947
|
-
|
|
2947
|
+
yt.create = (n, e) => {
|
|
2948
2948
|
if (!Array.isArray(n))
|
|
2949
2949
|
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
2950
|
-
return new
|
|
2950
|
+
return new yt({
|
|
2951
2951
|
items: n,
|
|
2952
2952
|
typeName: G.ZodTuple,
|
|
2953
2953
|
rest: null,
|
|
2954
2954
|
...J(e)
|
|
2955
2955
|
});
|
|
2956
2956
|
};
|
|
2957
|
-
class
|
|
2957
|
+
class Dn extends X {
|
|
2958
2958
|
get keySchema() {
|
|
2959
2959
|
return this._def.keyType;
|
|
2960
2960
|
}
|
|
@@ -2965,7 +2965,7 @@ class In extends X {
|
|
|
2965
2965
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2966
2966
|
if (s.parsedType !== U.object)
|
|
2967
2967
|
return L(s, {
|
|
2968
|
-
code:
|
|
2968
|
+
code: I.invalid_type,
|
|
2969
2969
|
expected: U.object,
|
|
2970
2970
|
received: s.parsedType
|
|
2971
2971
|
}), Y;
|
|
@@ -2982,12 +2982,12 @@ class In extends X {
|
|
|
2982
2982
|
return this._def.valueType;
|
|
2983
2983
|
}
|
|
2984
2984
|
static create(e, t, s) {
|
|
2985
|
-
return t instanceof X ? new
|
|
2985
|
+
return t instanceof X ? new Dn({
|
|
2986
2986
|
keyType: e,
|
|
2987
2987
|
valueType: t,
|
|
2988
2988
|
typeName: G.ZodRecord,
|
|
2989
2989
|
...J(s)
|
|
2990
|
-
}) : new
|
|
2990
|
+
}) : new Dn({
|
|
2991
2991
|
keyType: qe.create(),
|
|
2992
2992
|
valueType: e,
|
|
2993
2993
|
typeName: G.ZodRecord,
|
|
@@ -3006,7 +3006,7 @@ class mr extends X {
|
|
|
3006
3006
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
3007
3007
|
if (s.parsedType !== U.map)
|
|
3008
3008
|
return L(s, {
|
|
3009
|
-
code:
|
|
3009
|
+
code: I.invalid_type,
|
|
3010
3010
|
expected: U.map,
|
|
3011
3011
|
received: s.parsedType
|
|
3012
3012
|
}), Y;
|
|
@@ -3043,25 +3043,25 @@ mr.create = (n, e, t) => new mr({
|
|
|
3043
3043
|
typeName: G.ZodMap,
|
|
3044
3044
|
...J(t)
|
|
3045
3045
|
});
|
|
3046
|
-
class
|
|
3046
|
+
class tn extends X {
|
|
3047
3047
|
_parse(e) {
|
|
3048
3048
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
3049
3049
|
if (s.parsedType !== U.set)
|
|
3050
3050
|
return L(s, {
|
|
3051
|
-
code:
|
|
3051
|
+
code: I.invalid_type,
|
|
3052
3052
|
expected: U.set,
|
|
3053
3053
|
received: s.parsedType
|
|
3054
3054
|
}), Y;
|
|
3055
3055
|
const r = this._def;
|
|
3056
3056
|
r.minSize !== null && s.data.size < r.minSize.value && (L(s, {
|
|
3057
|
-
code:
|
|
3057
|
+
code: I.too_small,
|
|
3058
3058
|
minimum: r.minSize.value,
|
|
3059
3059
|
type: "set",
|
|
3060
3060
|
inclusive: !0,
|
|
3061
3061
|
exact: !1,
|
|
3062
3062
|
message: r.minSize.message
|
|
3063
3063
|
}), t.dirty()), r.maxSize !== null && s.data.size > r.maxSize.value && (L(s, {
|
|
3064
|
-
code:
|
|
3064
|
+
code: I.too_big,
|
|
3065
3065
|
maximum: r.maxSize.value,
|
|
3066
3066
|
type: "set",
|
|
3067
3067
|
inclusive: !0,
|
|
@@ -3082,13 +3082,13 @@ class en extends X {
|
|
|
3082
3082
|
return s.common.async ? Promise.all(a).then((l) => o(l)) : o(a);
|
|
3083
3083
|
}
|
|
3084
3084
|
min(e, t) {
|
|
3085
|
-
return new
|
|
3085
|
+
return new tn({
|
|
3086
3086
|
...this._def,
|
|
3087
3087
|
minSize: { value: e, message: z.toString(t) }
|
|
3088
3088
|
});
|
|
3089
3089
|
}
|
|
3090
3090
|
max(e, t) {
|
|
3091
|
-
return new
|
|
3091
|
+
return new tn({
|
|
3092
3092
|
...this._def,
|
|
3093
3093
|
maxSize: { value: e, message: z.toString(t) }
|
|
3094
3094
|
});
|
|
@@ -3100,7 +3100,7 @@ class en extends X {
|
|
|
3100
3100
|
return this.min(1, e);
|
|
3101
3101
|
}
|
|
3102
3102
|
}
|
|
3103
|
-
|
|
3103
|
+
tn.create = (n, e) => new tn({
|
|
3104
3104
|
valueType: n,
|
|
3105
3105
|
minSize: null,
|
|
3106
3106
|
maxSize: null,
|
|
@@ -3127,7 +3127,7 @@ class Os extends X {
|
|
|
3127
3127
|
const t = this._getOrReturnCtx(e);
|
|
3128
3128
|
return L(t, {
|
|
3129
3129
|
received: t.data,
|
|
3130
|
-
code:
|
|
3130
|
+
code: I.invalid_literal,
|
|
3131
3131
|
expected: this._def.value
|
|
3132
3132
|
}), Y;
|
|
3133
3133
|
}
|
|
@@ -3156,14 +3156,14 @@ class Dt extends X {
|
|
|
3156
3156
|
return L(t, {
|
|
3157
3157
|
expected: te.joinValues(s),
|
|
3158
3158
|
received: t.parsedType,
|
|
3159
|
-
code:
|
|
3159
|
+
code: I.invalid_type
|
|
3160
3160
|
}), Y;
|
|
3161
3161
|
}
|
|
3162
3162
|
if (this._cache || (this._cache = new Set(this._def.values)), !this._cache.has(e.data)) {
|
|
3163
3163
|
const t = this._getOrReturnCtx(e), s = this._def.values;
|
|
3164
3164
|
return L(t, {
|
|
3165
3165
|
received: t.data,
|
|
3166
|
-
code:
|
|
3166
|
+
code: I.invalid_enum_value,
|
|
3167
3167
|
options: s
|
|
3168
3168
|
}), Y;
|
|
3169
3169
|
}
|
|
@@ -3212,14 +3212,14 @@ class yr extends X {
|
|
|
3212
3212
|
return L(s, {
|
|
3213
3213
|
expected: te.joinValues(r),
|
|
3214
3214
|
received: s.parsedType,
|
|
3215
|
-
code:
|
|
3215
|
+
code: I.invalid_type
|
|
3216
3216
|
}), Y;
|
|
3217
3217
|
}
|
|
3218
3218
|
if (this._cache || (this._cache = new Set(te.getValidEnumValues(this._def.values))), !this._cache.has(e.data)) {
|
|
3219
3219
|
const r = te.objectValues(t);
|
|
3220
3220
|
return L(s, {
|
|
3221
3221
|
received: s.data,
|
|
3222
|
-
code:
|
|
3222
|
+
code: I.invalid_enum_value,
|
|
3223
3223
|
options: r
|
|
3224
3224
|
}), Y;
|
|
3225
3225
|
}
|
|
@@ -3242,7 +3242,7 @@ class An extends X {
|
|
|
3242
3242
|
const { ctx: t } = this._processInputParams(e);
|
|
3243
3243
|
if (t.parsedType !== U.promise && t.common.async === !1)
|
|
3244
3244
|
return L(t, {
|
|
3245
|
-
code:
|
|
3245
|
+
code: I.invalid_type,
|
|
3246
3246
|
expected: U.promise,
|
|
3247
3247
|
received: t.parsedType
|
|
3248
3248
|
}), Y;
|
|
@@ -3258,7 +3258,7 @@ An.create = (n, e) => new An({
|
|
|
3258
3258
|
typeName: G.ZodPromise,
|
|
3259
3259
|
...J(e)
|
|
3260
3260
|
});
|
|
3261
|
-
class
|
|
3261
|
+
class At extends X {
|
|
3262
3262
|
innerType() {
|
|
3263
3263
|
return this._def.schema;
|
|
3264
3264
|
}
|
|
@@ -3285,7 +3285,7 @@ class It extends X {
|
|
|
3285
3285
|
path: s.path,
|
|
3286
3286
|
parent: s
|
|
3287
3287
|
});
|
|
3288
|
-
return l.status === "aborted" ? Y : l.status === "dirty" || t.value === "dirty" ?
|
|
3288
|
+
return l.status === "aborted" ? Y : l.status === "dirty" || t.value === "dirty" ? Bt(l.value) : l;
|
|
3289
3289
|
});
|
|
3290
3290
|
{
|
|
3291
3291
|
if (t.value === "aborted")
|
|
@@ -3295,7 +3295,7 @@ class It extends X {
|
|
|
3295
3295
|
path: s.path,
|
|
3296
3296
|
parent: s
|
|
3297
3297
|
});
|
|
3298
|
-
return a.status === "aborted" ? Y : a.status === "dirty" || t.value === "dirty" ?
|
|
3298
|
+
return a.status === "aborted" ? Y : a.status === "dirty" || t.value === "dirty" ? Bt(a.value) : a;
|
|
3299
3299
|
}
|
|
3300
3300
|
}
|
|
3301
3301
|
if (r.type === "refinement") {
|
|
@@ -3324,33 +3324,33 @@ class It extends X {
|
|
|
3324
3324
|
path: s.path,
|
|
3325
3325
|
parent: s
|
|
3326
3326
|
});
|
|
3327
|
-
if (!
|
|
3327
|
+
if (!xt(o))
|
|
3328
3328
|
return Y;
|
|
3329
3329
|
const a = r.transform(o.value, i);
|
|
3330
3330
|
if (a instanceof Promise)
|
|
3331
3331
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
3332
3332
|
return { status: t.value, value: a };
|
|
3333
3333
|
} else
|
|
3334
|
-
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((o) =>
|
|
3334
|
+
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((o) => xt(o) ? Promise.resolve(r.transform(o.value, i)).then((a) => ({
|
|
3335
3335
|
status: t.value,
|
|
3336
3336
|
value: a
|
|
3337
3337
|
})) : Y);
|
|
3338
3338
|
te.assertNever(r);
|
|
3339
3339
|
}
|
|
3340
3340
|
}
|
|
3341
|
-
|
|
3341
|
+
At.create = (n, e, t) => new At({
|
|
3342
3342
|
schema: n,
|
|
3343
3343
|
typeName: G.ZodEffects,
|
|
3344
3344
|
effect: e,
|
|
3345
3345
|
...J(t)
|
|
3346
3346
|
});
|
|
3347
|
-
|
|
3347
|
+
At.createWithPreprocess = (n, e, t) => new At({
|
|
3348
3348
|
schema: e,
|
|
3349
3349
|
effect: { type: "preprocess", transform: n },
|
|
3350
3350
|
typeName: G.ZodEffects,
|
|
3351
3351
|
...J(t)
|
|
3352
3352
|
});
|
|
3353
|
-
class
|
|
3353
|
+
class st extends X {
|
|
3354
3354
|
_parse(e) {
|
|
3355
3355
|
return this._getType(e) === U.undefined ? Ae(void 0) : this._def.innerType._parse(e);
|
|
3356
3356
|
}
|
|
@@ -3358,12 +3358,12 @@ class nt extends X {
|
|
|
3358
3358
|
return this._def.innerType;
|
|
3359
3359
|
}
|
|
3360
3360
|
}
|
|
3361
|
-
|
|
3361
|
+
st.create = (n, e) => new st({
|
|
3362
3362
|
innerType: n,
|
|
3363
3363
|
typeName: G.ZodOptional,
|
|
3364
3364
|
...J(e)
|
|
3365
3365
|
});
|
|
3366
|
-
class
|
|
3366
|
+
class Ct extends X {
|
|
3367
3367
|
_parse(e) {
|
|
3368
3368
|
return this._getType(e) === U.null ? Ae(null) : this._def.innerType._parse(e);
|
|
3369
3369
|
}
|
|
@@ -3371,7 +3371,7 @@ class At extends X {
|
|
|
3371
3371
|
return this._def.innerType;
|
|
3372
3372
|
}
|
|
3373
3373
|
}
|
|
3374
|
-
|
|
3374
|
+
Ct.create = (n, e) => new Ct({
|
|
3375
3375
|
innerType: n,
|
|
3376
3376
|
typeName: G.ZodNullable,
|
|
3377
3377
|
...J(e)
|
|
@@ -3444,7 +3444,7 @@ class gr extends X {
|
|
|
3444
3444
|
if (this._getType(e) !== U.nan) {
|
|
3445
3445
|
const s = this._getOrReturnCtx(e);
|
|
3446
3446
|
return L(s, {
|
|
3447
|
-
code:
|
|
3447
|
+
code: I.invalid_type,
|
|
3448
3448
|
expected: U.nan,
|
|
3449
3449
|
received: s.parsedType
|
|
3450
3450
|
}), Y;
|
|
@@ -3456,7 +3456,7 @@ gr.create = (n) => new gr({
|
|
|
3456
3456
|
typeName: G.ZodNaN,
|
|
3457
3457
|
...J(n)
|
|
3458
3458
|
});
|
|
3459
|
-
class
|
|
3459
|
+
class Ia extends X {
|
|
3460
3460
|
_parse(e) {
|
|
3461
3461
|
const { ctx: t } = this._processInputParams(e), s = t.data;
|
|
3462
3462
|
return this._def.type._parse({
|
|
@@ -3479,7 +3479,7 @@ class Ws extends X {
|
|
|
3479
3479
|
path: s.path,
|
|
3480
3480
|
parent: s
|
|
3481
3481
|
});
|
|
3482
|
-
return i.status === "aborted" ? Y : i.status === "dirty" ? (t.dirty(),
|
|
3482
|
+
return i.status === "aborted" ? Y : i.status === "dirty" ? (t.dirty(), Bt(i.value)) : this._def.out._parseAsync({
|
|
3483
3483
|
data: i.value,
|
|
3484
3484
|
path: s.path,
|
|
3485
3485
|
parent: s
|
|
@@ -3511,7 +3511,7 @@ class Ws extends X {
|
|
|
3511
3511
|
}
|
|
3512
3512
|
class Ss extends X {
|
|
3513
3513
|
_parse(e) {
|
|
3514
|
-
const t = this._def.innerType._parse(e), s = (r) => (
|
|
3514
|
+
const t = this._def.innerType._parse(e), s = (r) => (xt(r) && (r.value = Object.freeze(r.value)), r);
|
|
3515
3515
|
return Rn(t) ? t.then((r) => s(r)) : s(t);
|
|
3516
3516
|
}
|
|
3517
3517
|
unwrap() {
|
|
@@ -3527,15 +3527,15 @@ var G;
|
|
|
3527
3527
|
(function(n) {
|
|
3528
3528
|
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";
|
|
3529
3529
|
})(G || (G = {}));
|
|
3530
|
-
const be = qe.create,
|
|
3531
|
-
|
|
3532
|
-
const
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
const
|
|
3530
|
+
const be = qe.create, ht = It.create, Kt = ws.create, ns = _s.create, ge = Es.create;
|
|
3531
|
+
ot.create;
|
|
3532
|
+
const _t = Ue.create, We = fe.create, Oe = xn.create;
|
|
3533
|
+
In.create;
|
|
3534
|
+
yt.create;
|
|
3535
|
+
const rn = Dn.create, ke = Os.create, Cn = Dt.create;
|
|
3536
3536
|
An.create;
|
|
3537
|
-
|
|
3538
|
-
|
|
3537
|
+
st.create;
|
|
3538
|
+
Ct.create;
|
|
3539
3539
|
const wn = () => ge().refine((n) => n && (n.seconds !== void 0 && n.nanoseconds !== void 0 || n._seconds !== void 0 && n._nanoseconds !== void 0), {
|
|
3540
3540
|
message: "Value is not a valid timestamp"
|
|
3541
3541
|
}), wr = () => ge().refine((n) => n && (n._methodName === "serverTimestamp" || n.constructor.name === "ServerTimestampTransform"), {
|
|
@@ -3545,23 +3545,23 @@ const wn = () => ge().refine((n) => n && (n.seconds !== void 0 && n.nanoseconds
|
|
|
3545
3545
|
if (n.includeFields) {
|
|
3546
3546
|
const s = e.collections[n.collection];
|
|
3547
3547
|
if (!s)
|
|
3548
|
-
return
|
|
3548
|
+
return rn(ge());
|
|
3549
3549
|
n.includeFields.forEach((r) => {
|
|
3550
3550
|
const i = s.fields.find((a) => a.name === r);
|
|
3551
3551
|
if (!i)
|
|
3552
3552
|
throw new Error(`Field ${r} not found in collection ${n.collection}`);
|
|
3553
|
-
t[r] = $n(s, i),
|
|
3553
|
+
t[r] = $n(s, i), wt(s, [i]).size === 1 && (t[`${r}_Lowercase`] = $n(s, i, !0));
|
|
3554
3554
|
});
|
|
3555
3555
|
}
|
|
3556
3556
|
return We({
|
|
3557
|
-
Collection_Path:
|
|
3557
|
+
Collection_Path: _t(be()),
|
|
3558
3558
|
...t
|
|
3559
3559
|
});
|
|
3560
|
-
},
|
|
3561
|
-
let t =
|
|
3560
|
+
}, Da = (n, e) => {
|
|
3561
|
+
let t = rn(yi(n, e));
|
|
3562
3562
|
return n.required || (t = t.optional()), t;
|
|
3563
3563
|
}, Aa = (n) => {
|
|
3564
|
-
let e =
|
|
3564
|
+
let e = _t(Oe([be().length(20), be().length(28)]));
|
|
3565
3565
|
return ["OneToOne", "OneToMany"].includes(n.type) ? e = e.max(1) : (n.min && (e = e.min(n.min)), n.max && (e = e.max(n.max)), n.length && (e = e.length(n.length))), n.required ? e = e.nonempty() : e = e.optional(), e;
|
|
3566
3566
|
}, $n = (n, e, t) => {
|
|
3567
3567
|
const { softDelete: s } = n, r = s?.timestampField;
|
|
@@ -3576,10 +3576,10 @@ const wn = () => ge().refine((n) => n && (n.seconds !== void 0 && n.nanoseconds
|
|
|
3576
3576
|
i = Cn(e.values);
|
|
3577
3577
|
break;
|
|
3578
3578
|
case "Boolean":
|
|
3579
|
-
i =
|
|
3579
|
+
i = Kt();
|
|
3580
3580
|
break;
|
|
3581
3581
|
case "Number":
|
|
3582
|
-
e.autoIncrement ? i = Oe([ke("Pending"),
|
|
3582
|
+
e.autoIncrement ? i = Oe([ke("Pending"), ht().int()]) : (i = ht(), e.min && (i = i.min(e.min)), e.max && (i = i.max(e.max)), e.decimal ? i = i.refine((o) => e.decimal ? (o.toString().split(".")[1]?.length || 0) <= e.decimal : !1, {
|
|
3583
3583
|
message: `Value must have ${e.decimal} or fewer decimal places`
|
|
3584
3584
|
}) : i = i.int(), e.values && (i = i.refine((o) => e.values?.includes(o), {
|
|
3585
3585
|
message: "Value is not an allowed value"
|
|
@@ -3595,7 +3595,7 @@ const wn = () => ge().refine((n) => n && (n.seconds !== void 0 && n.nanoseconds
|
|
|
3595
3595
|
})));
|
|
3596
3596
|
break;
|
|
3597
3597
|
case "Array":
|
|
3598
|
-
i =
|
|
3598
|
+
i = _t(ge()), e.length && (i = i.length(e.length)), e.minlength ? i = i.min(e.minlength) : e.required && (i = i.nonempty()), e.maxlength && (i = i.max(e.maxlength)), e.values && (i = i.refine((o) => {
|
|
3599
3599
|
let a = !0;
|
|
3600
3600
|
return o.forEach((l) => {
|
|
3601
3601
|
e.values && !e.values.includes(l) && (a = !1);
|
|
@@ -3603,7 +3603,7 @@ const wn = () => ge().refine((n) => n && (n.seconds !== void 0 && n.nanoseconds
|
|
|
3603
3603
|
}, { message: "Value is not an allowed value" }));
|
|
3604
3604
|
break;
|
|
3605
3605
|
case "Map":
|
|
3606
|
-
i =
|
|
3606
|
+
i = rn(ge()), e.required && (i = i.refine((o) => o && typeof o == "object" && Object.keys(o).length > 0, {
|
|
3607
3607
|
message: "Value must have at least one object property"
|
|
3608
3608
|
}));
|
|
3609
3609
|
break;
|
|
@@ -3614,60 +3614,60 @@ const wn = () => ge().refine((n) => n && (n.seconds !== void 0 && n.nanoseconds
|
|
|
3614
3614
|
return !K(e) && e.nullable && (i = i.nullable()), e.required || (i = i.optional()), i;
|
|
3615
3615
|
}, Ca = (n, e, t) => {
|
|
3616
3616
|
const s = {
|
|
3617
|
-
Collection_Path:
|
|
3617
|
+
Collection_Path: _t(be()),
|
|
3618
3618
|
Last_Write_App: be(),
|
|
3619
3619
|
Last_Write_At: wn(),
|
|
3620
3620
|
Last_Save_At: wr(),
|
|
3621
3621
|
Last_Write_By: Oe([be().length(28), ke("System")]),
|
|
3622
3622
|
Last_Write_Connection_Status: Cn(["Online", "Offline"]),
|
|
3623
|
-
Last_Write_Version:
|
|
3623
|
+
Last_Write_Version: ht().int(),
|
|
3624
3624
|
id: be().regex(new RegExp("^[a-zA-Z0-9]+$")).length(20),
|
|
3625
3625
|
Created_At: wn(),
|
|
3626
3626
|
Created_By: Oe([be().length(28), ke("System")])
|
|
3627
3627
|
};
|
|
3628
3628
|
n === "create" && (s.Saved_At = wr()), n === "update" && (s.Saved_At = wn(), s.Collection_Path = s.Collection_Path.optional(), s.id = s.id.optional(), s.Created_At = s.Created_At.optional(), s.Saved_At = s.Saved_At.optional(), s.Created_By = s.Created_By.optional());
|
|
3629
|
-
const r =
|
|
3629
|
+
const r = ft(e, e.fields), i = Array.from(r).map((l) => l.name);
|
|
3630
3630
|
e.fields.forEach((l) => {
|
|
3631
|
-
K(l) ? (s[l.name] =
|
|
3631
|
+
K(l) ? (s[l.name] = Da(l, t), s[`${l.name}_Array`] = Aa(l), i.includes(l.name) && (s[`${l.name}_Single`] = yi(l, t), l.required || (s[`${l.name}_Single`] = s[`${l.name}_Single`].optional())), l.length && (s[l.name] = s[l.name].refine((c) => l.length && c && Object.keys(c).length === l.length, {
|
|
3632
3632
|
message: `Value must contain ${l.length} item(s)`
|
|
3633
3633
|
})), l.min && (s[l.name] = s[l.name].refine((c) => l.min && c && Object.keys(c).length >= l.min, {
|
|
3634
3634
|
message: `Value must contain at least ${l.min} item(s)`
|
|
3635
3635
|
})), l.max && (s[l.name] = s[l.name].refine((c) => l.max && (!c || Object.keys(c).length <= l.max), {
|
|
3636
3636
|
message: `Value must contain at most ${l.max} item(s)`
|
|
3637
3637
|
}))) : l.type !== "Computed" && (s[l.name] = $n(e, l));
|
|
3638
|
-
}),
|
|
3638
|
+
}), wt(e, e.fields).forEach((l) => {
|
|
3639
3639
|
s[l.name] && (s[`${l.name}_Lowercase`] = $n(e, l, !0));
|
|
3640
3640
|
});
|
|
3641
3641
|
const a = We(s);
|
|
3642
3642
|
return e.allowSchemalessFields ? a.passthrough() : a.strict();
|
|
3643
3643
|
};
|
|
3644
|
-
class
|
|
3644
|
+
class Et extends Error {
|
|
3645
3645
|
}
|
|
3646
|
-
class $a extends
|
|
3646
|
+
class $a extends Et {
|
|
3647
3647
|
constructor(e) {
|
|
3648
3648
|
super(`Invalid DateTime: ${e.toMessage()}`);
|
|
3649
3649
|
}
|
|
3650
3650
|
}
|
|
3651
|
-
class Ma extends
|
|
3651
|
+
class Ma extends Et {
|
|
3652
3652
|
constructor(e) {
|
|
3653
3653
|
super(`Invalid Interval: ${e.toMessage()}`);
|
|
3654
3654
|
}
|
|
3655
3655
|
}
|
|
3656
|
-
class Fa extends
|
|
3656
|
+
class Fa extends Et {
|
|
3657
3657
|
constructor(e) {
|
|
3658
3658
|
super(`Invalid Duration: ${e.toMessage()}`);
|
|
3659
3659
|
}
|
|
3660
3660
|
}
|
|
3661
|
-
class
|
|
3661
|
+
class St extends Et {
|
|
3662
3662
|
}
|
|
3663
|
-
class gi extends
|
|
3663
|
+
class gi extends Et {
|
|
3664
3664
|
constructor(e) {
|
|
3665
3665
|
super(`Invalid unit ${e}`);
|
|
3666
3666
|
}
|
|
3667
3667
|
}
|
|
3668
|
-
class we extends
|
|
3668
|
+
class we extends Et {
|
|
3669
3669
|
}
|
|
3670
|
-
class
|
|
3670
|
+
class Ke extends Et {
|
|
3671
3671
|
constructor() {
|
|
3672
3672
|
super("Zone is an abstract class");
|
|
3673
3673
|
}
|
|
@@ -3738,14 +3738,14 @@ const $ = "numeric", Pe = "short", Se = "long", Mn = {
|
|
|
3738
3738
|
day: $,
|
|
3739
3739
|
hour: $,
|
|
3740
3740
|
minute: $
|
|
3741
|
-
},
|
|
3741
|
+
}, Ii = {
|
|
3742
3742
|
year: $,
|
|
3743
3743
|
month: $,
|
|
3744
3744
|
day: $,
|
|
3745
3745
|
hour: $,
|
|
3746
3746
|
minute: $,
|
|
3747
3747
|
second: $
|
|
3748
|
-
},
|
|
3748
|
+
}, Di = {
|
|
3749
3749
|
year: $,
|
|
3750
3750
|
month: Pe,
|
|
3751
3751
|
day: $,
|
|
@@ -3798,14 +3798,14 @@ const $ = "numeric", Pe = "short", Se = "long", Mn = {
|
|
|
3798
3798
|
second: $,
|
|
3799
3799
|
timeZoneName: Se
|
|
3800
3800
|
};
|
|
3801
|
-
class
|
|
3801
|
+
class on {
|
|
3802
3802
|
/**
|
|
3803
3803
|
* The type of zone
|
|
3804
3804
|
* @abstract
|
|
3805
3805
|
* @type {string}
|
|
3806
3806
|
*/
|
|
3807
3807
|
get type() {
|
|
3808
|
-
throw new
|
|
3808
|
+
throw new Ke();
|
|
3809
3809
|
}
|
|
3810
3810
|
/**
|
|
3811
3811
|
* The name of this zone.
|
|
@@ -3813,7 +3813,7 @@ class rn {
|
|
|
3813
3813
|
* @type {string}
|
|
3814
3814
|
*/
|
|
3815
3815
|
get name() {
|
|
3816
|
-
throw new
|
|
3816
|
+
throw new Ke();
|
|
3817
3817
|
}
|
|
3818
3818
|
/**
|
|
3819
3819
|
* The IANA name of this zone.
|
|
@@ -3830,7 +3830,7 @@ class rn {
|
|
|
3830
3830
|
* @type {boolean}
|
|
3831
3831
|
*/
|
|
3832
3832
|
get isUniversal() {
|
|
3833
|
-
throw new
|
|
3833
|
+
throw new Ke();
|
|
3834
3834
|
}
|
|
3835
3835
|
/**
|
|
3836
3836
|
* Returns the offset's common name (such as EST) at the specified timestamp
|
|
@@ -3842,7 +3842,7 @@ class rn {
|
|
|
3842
3842
|
* @return {string}
|
|
3843
3843
|
*/
|
|
3844
3844
|
offsetName(e, t) {
|
|
3845
|
-
throw new
|
|
3845
|
+
throw new Ke();
|
|
3846
3846
|
}
|
|
3847
3847
|
/**
|
|
3848
3848
|
* Returns the offset's value as a string
|
|
@@ -3853,7 +3853,7 @@ class rn {
|
|
|
3853
3853
|
* @return {string}
|
|
3854
3854
|
*/
|
|
3855
3855
|
formatOffset(e, t) {
|
|
3856
|
-
throw new
|
|
3856
|
+
throw new Ke();
|
|
3857
3857
|
}
|
|
3858
3858
|
/**
|
|
3859
3859
|
* Return the offset in minutes for this zone at the specified timestamp.
|
|
@@ -3862,7 +3862,7 @@ class rn {
|
|
|
3862
3862
|
* @return {number}
|
|
3863
3863
|
*/
|
|
3864
3864
|
offset(e) {
|
|
3865
|
-
throw new
|
|
3865
|
+
throw new Ke();
|
|
3866
3866
|
}
|
|
3867
3867
|
/**
|
|
3868
3868
|
* Return whether this Zone is equal to another zone
|
|
@@ -3871,7 +3871,7 @@ class rn {
|
|
|
3871
3871
|
* @return {boolean}
|
|
3872
3872
|
*/
|
|
3873
3873
|
equals(e) {
|
|
3874
|
-
throw new
|
|
3874
|
+
throw new Ke();
|
|
3875
3875
|
}
|
|
3876
3876
|
/**
|
|
3877
3877
|
* Return whether this Zone is valid.
|
|
@@ -3879,11 +3879,11 @@ class rn {
|
|
|
3879
3879
|
* @type {boolean}
|
|
3880
3880
|
*/
|
|
3881
3881
|
get isValid() {
|
|
3882
|
-
throw new
|
|
3882
|
+
throw new Ke();
|
|
3883
3883
|
}
|
|
3884
3884
|
}
|
|
3885
3885
|
let ss = null;
|
|
3886
|
-
class zn extends
|
|
3886
|
+
class zn extends on {
|
|
3887
3887
|
/**
|
|
3888
3888
|
* Get a singleton instance of the local zone
|
|
3889
3889
|
* @return {SystemZone}
|
|
@@ -3909,7 +3909,7 @@ class zn extends rn {
|
|
|
3909
3909
|
}
|
|
3910
3910
|
/** @override **/
|
|
3911
3911
|
formatOffset(e, t) {
|
|
3912
|
-
return
|
|
3912
|
+
return Xt(this.offset(e), t);
|
|
3913
3913
|
}
|
|
3914
3914
|
/** @override **/
|
|
3915
3915
|
offset(e) {
|
|
@@ -3961,7 +3961,7 @@ function ja(n, e) {
|
|
|
3961
3961
|
return s;
|
|
3962
3962
|
}
|
|
3963
3963
|
const rs = /* @__PURE__ */ new Map();
|
|
3964
|
-
class He extends
|
|
3964
|
+
class He extends on {
|
|
3965
3965
|
/**
|
|
3966
3966
|
* @param {string} name - Zone name
|
|
3967
3967
|
* @return {IANAZone}
|
|
@@ -4054,7 +4054,7 @@ class He extends rn {
|
|
|
4054
4054
|
* @return {string}
|
|
4055
4055
|
*/
|
|
4056
4056
|
formatOffset(e, t) {
|
|
4057
|
-
return
|
|
4057
|
+
return Xt(this.offset(e), t);
|
|
4058
4058
|
}
|
|
4059
4059
|
/**
|
|
4060
4060
|
* Return the offset in minutes for this zone at the specified timestamp.
|
|
@@ -4118,20 +4118,20 @@ function za(n, e = {}) {
|
|
|
4118
4118
|
let s = xs.get(t);
|
|
4119
4119
|
return s === void 0 && (s = new Intl.NumberFormat(n, e), xs.set(t, s)), s;
|
|
4120
4120
|
}
|
|
4121
|
-
const
|
|
4121
|
+
const Is = /* @__PURE__ */ new Map();
|
|
4122
4122
|
function qa(n, e = {}) {
|
|
4123
4123
|
const { base: t, ...s } = e, r = JSON.stringify([n, s]);
|
|
4124
|
-
let i =
|
|
4125
|
-
return i === void 0 && (i = new Intl.RelativeTimeFormat(n, e),
|
|
4124
|
+
let i = Is.get(r);
|
|
4125
|
+
return i === void 0 && (i = new Intl.RelativeTimeFormat(n, e), Is.set(r, i)), i;
|
|
4126
4126
|
}
|
|
4127
|
-
let
|
|
4127
|
+
let Ht = null;
|
|
4128
4128
|
function Ba() {
|
|
4129
|
-
return
|
|
4129
|
+
return Ht || (Ht = new Intl.DateTimeFormat().resolvedOptions().locale, Ht);
|
|
4130
4130
|
}
|
|
4131
|
-
const
|
|
4131
|
+
const Ds = /* @__PURE__ */ new Map();
|
|
4132
4132
|
function Pi(n) {
|
|
4133
|
-
let e =
|
|
4134
|
-
return e === void 0 && (e = new Intl.DateTimeFormat(n).resolvedOptions(),
|
|
4133
|
+
let e = Ds.get(n);
|
|
4134
|
+
return e === void 0 && (e = new Intl.DateTimeFormat(n).resolvedOptions(), Ds.set(n, e)), e;
|
|
4135
4135
|
}
|
|
4136
4136
|
const As = /* @__PURE__ */ new Map();
|
|
4137
4137
|
function Ha(n) {
|
|
@@ -4272,7 +4272,7 @@ class se {
|
|
|
4272
4272
|
return new se(a, l, c, u, o);
|
|
4273
4273
|
}
|
|
4274
4274
|
static resetCache() {
|
|
4275
|
-
|
|
4275
|
+
Ht = null, Rs.clear(), xs.clear(), Is.clear(), Ds.clear(), As.clear();
|
|
4276
4276
|
}
|
|
4277
4277
|
static fromObject({ locale: e, numberingSystem: t, outputCalendar: s, weekSettings: r } = {}) {
|
|
4278
4278
|
return se.create(e, t, s, r);
|
|
@@ -4386,7 +4386,7 @@ class se {
|
|
|
4386
4386
|
}
|
|
4387
4387
|
}
|
|
4388
4388
|
let is = null;
|
|
4389
|
-
class Ee extends
|
|
4389
|
+
class Ee extends on {
|
|
4390
4390
|
/**
|
|
4391
4391
|
* Get a singleton instance of UTC
|
|
4392
4392
|
* @return {FixedOffsetZone}
|
|
@@ -4436,7 +4436,7 @@ class Ee extends rn {
|
|
|
4436
4436
|
* @type {string}
|
|
4437
4437
|
*/
|
|
4438
4438
|
get name() {
|
|
4439
|
-
return this.fixed === 0 ? "UTC" : `UTC${
|
|
4439
|
+
return this.fixed === 0 ? "UTC" : `UTC${Xt(this.fixed, "narrow")}`;
|
|
4440
4440
|
}
|
|
4441
4441
|
/**
|
|
4442
4442
|
* The IANA name of this zone, i.e. `Etc/UTC` or `Etc/GMT+/-nn`
|
|
@@ -4445,7 +4445,7 @@ class Ee extends rn {
|
|
|
4445
4445
|
* @type {string}
|
|
4446
4446
|
*/
|
|
4447
4447
|
get ianaName() {
|
|
4448
|
-
return this.fixed === 0 ? "Etc/UTC" : `Etc/GMT${
|
|
4448
|
+
return this.fixed === 0 ? "Etc/UTC" : `Etc/GMT${Xt(-this.fixed, "narrow")}`;
|
|
4449
4449
|
}
|
|
4450
4450
|
/**
|
|
4451
4451
|
* Returns the offset's common name at the specified timestamp.
|
|
@@ -4465,7 +4465,7 @@ class Ee extends rn {
|
|
|
4465
4465
|
* @return {string}
|
|
4466
4466
|
*/
|
|
4467
4467
|
formatOffset(e, t) {
|
|
4468
|
-
return
|
|
4468
|
+
return Xt(this.fixed, t);
|
|
4469
4469
|
}
|
|
4470
4470
|
/**
|
|
4471
4471
|
* Returns whether the offset is known to be fixed for the whole year:
|
|
@@ -4505,7 +4505,7 @@ class Ee extends rn {
|
|
|
4505
4505
|
return !0;
|
|
4506
4506
|
}
|
|
4507
4507
|
}
|
|
4508
|
-
class nl extends
|
|
4508
|
+
class nl extends on {
|
|
4509
4509
|
constructor(e) {
|
|
4510
4510
|
super(), this.zoneName = e;
|
|
4511
4511
|
}
|
|
@@ -4542,15 +4542,15 @@ class nl extends rn {
|
|
|
4542
4542
|
return !1;
|
|
4543
4543
|
}
|
|
4544
4544
|
}
|
|
4545
|
-
function
|
|
4545
|
+
function tt(n, e) {
|
|
4546
4546
|
if (H(n) || n === null)
|
|
4547
4547
|
return e;
|
|
4548
|
-
if (n instanceof
|
|
4548
|
+
if (n instanceof on)
|
|
4549
4549
|
return n;
|
|
4550
4550
|
if (ll(n)) {
|
|
4551
4551
|
const t = n.toLowerCase();
|
|
4552
4552
|
return t === "default" ? e : t === "local" || t === "system" ? zn.instance : t === "utc" || t === "gmt" ? Ee.utcInstance : Ee.parseSpecifier(t) || He.create(n);
|
|
4553
|
-
} else return
|
|
4553
|
+
} else return rt(n) ? Ee.instance(n) : typeof n == "object" && "offset" in n && typeof n.offset == "function" ? n : new nl(n);
|
|
4554
4554
|
}
|
|
4555
4555
|
const js = {
|
|
4556
4556
|
arab: "[٠-٩]",
|
|
@@ -4657,7 +4657,7 @@ class ce {
|
|
|
4657
4657
|
* @type {Zone}
|
|
4658
4658
|
*/
|
|
4659
4659
|
static get defaultZone() {
|
|
4660
|
-
return
|
|
4660
|
+
return tt(Or, zn.instance);
|
|
4661
4661
|
}
|
|
4662
4662
|
/**
|
|
4663
4663
|
* Get the default locale to create DateTimes with. Does not affect existing instances.
|
|
@@ -4786,10 +4786,10 @@ function Zs(n, e, t) {
|
|
|
4786
4786
|
return r === 0 ? 7 : r;
|
|
4787
4787
|
}
|
|
4788
4788
|
function Wi(n, e, t) {
|
|
4789
|
-
return t + (
|
|
4789
|
+
return t + (an(n) ? Ui : Vi)[e - 1];
|
|
4790
4790
|
}
|
|
4791
4791
|
function ji(n, e) {
|
|
4792
|
-
const t =
|
|
4792
|
+
const t = an(n) ? Ui : Vi, s = t.findIndex((i) => i < e), r = e - t[s];
|
|
4793
4793
|
return { month: s + 1, day: r };
|
|
4794
4794
|
}
|
|
4795
4795
|
function zs(n, e) {
|
|
@@ -4798,12 +4798,12 @@ function zs(n, e) {
|
|
|
4798
4798
|
function Fn(n, e = 4, t = 1) {
|
|
4799
4799
|
const { year: s, month: r, day: i } = n, o = Wi(s, r, i), a = zs(Zs(s, r, i), t);
|
|
4800
4800
|
let l = Math.floor((o - a + 14 - e) / 7), c;
|
|
4801
|
-
return l < 1 ? (c = s - 1, l =
|
|
4801
|
+
return l < 1 ? (c = s - 1, l = nn(c, e, t)) : l > nn(s, e, t) ? (c = s + 1, l = 1) : c = s, { weekYear: c, weekNumber: l, weekday: a, ...Gn(n) };
|
|
4802
4802
|
}
|
|
4803
4803
|
function xr(n, e = 4, t = 1) {
|
|
4804
|
-
const { weekYear: s, weekNumber: r, weekday: i } = n, o = zs(Zs(s, 1, e), t), a =
|
|
4804
|
+
const { weekYear: s, weekNumber: r, weekday: i } = n, o = zs(Zs(s, 1, e), t), a = Rt(s);
|
|
4805
4805
|
let l = r * 7 + i - o - 7 + e, c;
|
|
4806
|
-
l < 1 ? (c = s - 1, l +=
|
|
4806
|
+
l < 1 ? (c = s - 1, l += Rt(c)) : l > a ? (c = s + 1, l -= Rt(s)) : c = s;
|
|
4807
4807
|
const { month: u, day: h } = ji(c, l);
|
|
4808
4808
|
return { year: c, month: u, day: h, ...Gn(n) };
|
|
4809
4809
|
}
|
|
@@ -4811,14 +4811,14 @@ function os(n) {
|
|
|
4811
4811
|
const { year: e, month: t, day: s } = n, r = Wi(e, t, s);
|
|
4812
4812
|
return { year: e, ordinal: r, ...Gn(n) };
|
|
4813
4813
|
}
|
|
4814
|
-
function
|
|
4814
|
+
function Ir(n) {
|
|
4815
4815
|
const { year: e, ordinal: t } = n, { month: s, day: r } = ji(e, t);
|
|
4816
4816
|
return { year: e, month: s, day: r, ...Gn(n) };
|
|
4817
4817
|
}
|
|
4818
|
-
function
|
|
4818
|
+
function Dr(n, e) {
|
|
4819
4819
|
if (!H(n.localWeekday) || !H(n.localWeekNumber) || !H(n.localWeekYear)) {
|
|
4820
4820
|
if (!H(n.weekday) || !H(n.weekNumber) || !H(n.weekYear))
|
|
4821
|
-
throw new
|
|
4821
|
+
throw new St(
|
|
4822
4822
|
"Cannot mix locale-based week fields with ISO-based week fields"
|
|
4823
4823
|
);
|
|
4824
4824
|
return H(n.localWeekday) || (n.weekday = n.localWeekday), H(n.localWeekNumber) || (n.weekNumber = n.localWeekNumber), H(n.localWeekYear) || (n.weekYear = n.localWeekYear), delete n.localWeekday, delete n.localWeekNumber, delete n.localWeekYear, {
|
|
@@ -4832,12 +4832,12 @@ function ol(n, e = 4, t = 1) {
|
|
|
4832
4832
|
const s = qn(n.weekYear), r = xe(
|
|
4833
4833
|
n.weekNumber,
|
|
4834
4834
|
1,
|
|
4835
|
-
|
|
4835
|
+
nn(n.weekYear, e, t)
|
|
4836
4836
|
), i = xe(n.weekday, 1, 7);
|
|
4837
4837
|
return s ? r ? i ? !1 : Ne("weekday", n.weekday) : Ne("week", n.weekNumber) : Ne("weekYear", n.weekYear);
|
|
4838
4838
|
}
|
|
4839
4839
|
function al(n) {
|
|
4840
|
-
const e = qn(n.year), t = xe(n.ordinal, 1,
|
|
4840
|
+
const e = qn(n.year), t = xe(n.ordinal, 1, Rt(n.year));
|
|
4841
4841
|
return e ? t ? !1 : Ne("ordinal", n.ordinal) : Ne("year", n.year);
|
|
4842
4842
|
}
|
|
4843
4843
|
function Zi(n) {
|
|
@@ -4851,7 +4851,7 @@ function zi(n) {
|
|
|
4851
4851
|
function H(n) {
|
|
4852
4852
|
return typeof n > "u";
|
|
4853
4853
|
}
|
|
4854
|
-
function
|
|
4854
|
+
function rt(n) {
|
|
4855
4855
|
return typeof n == "number";
|
|
4856
4856
|
}
|
|
4857
4857
|
function qn(n) {
|
|
@@ -4890,7 +4890,7 @@ function Ar(n, e, t) {
|
|
|
4890
4890
|
function dl(n, e) {
|
|
4891
4891
|
return e.reduce((t, s) => (t[s] = n[s], t), {});
|
|
4892
4892
|
}
|
|
4893
|
-
function
|
|
4893
|
+
function $t(n, e) {
|
|
4894
4894
|
return Object.prototype.hasOwnProperty.call(n, e);
|
|
4895
4895
|
}
|
|
4896
4896
|
function $s(n) {
|
|
@@ -4917,11 +4917,11 @@ function he(n, e = 2) {
|
|
|
4917
4917
|
let s;
|
|
4918
4918
|
return t ? s = "-" + ("" + -n).padStart(e, "0") : s = ("" + n).padStart(e, "0"), s;
|
|
4919
4919
|
}
|
|
4920
|
-
function
|
|
4920
|
+
function et(n) {
|
|
4921
4921
|
if (!(H(n) || n === null || n === ""))
|
|
4922
4922
|
return parseInt(n, 10);
|
|
4923
4923
|
}
|
|
4924
|
-
function
|
|
4924
|
+
function ut(n) {
|
|
4925
4925
|
if (!(H(n) || n === null || n === ""))
|
|
4926
4926
|
return parseFloat(n);
|
|
4927
4927
|
}
|
|
@@ -4948,15 +4948,15 @@ function Bs(n, e, t = "round") {
|
|
|
4948
4948
|
throw new RangeError(`Value rounding ${t} is out of range`);
|
|
4949
4949
|
}
|
|
4950
4950
|
}
|
|
4951
|
-
function
|
|
4951
|
+
function an(n) {
|
|
4952
4952
|
return n % 4 === 0 && (n % 100 !== 0 || n % 400 === 0);
|
|
4953
4953
|
}
|
|
4954
|
-
function
|
|
4955
|
-
return
|
|
4954
|
+
function Rt(n) {
|
|
4955
|
+
return an(n) ? 366 : 365;
|
|
4956
4956
|
}
|
|
4957
4957
|
function Pn(n, e) {
|
|
4958
4958
|
const t = fl(e - 1, 12) + 1, s = n + (e - t) / 12;
|
|
4959
|
-
return t === 2 ?
|
|
4959
|
+
return t === 2 ? an(s) ? 29 : 28 : [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][t - 1];
|
|
4960
4960
|
}
|
|
4961
4961
|
function Bn(n) {
|
|
4962
4962
|
let e = Date.UTC(
|
|
@@ -4973,9 +4973,9 @@ function Bn(n) {
|
|
|
4973
4973
|
function Cr(n, e, t) {
|
|
4974
4974
|
return -zs(Zs(n, 1, e), t) + e - 1;
|
|
4975
4975
|
}
|
|
4976
|
-
function
|
|
4976
|
+
function nn(n, e = 4, t = 1) {
|
|
4977
4977
|
const s = Cr(n, e, t), r = Cr(n + 1, e, t);
|
|
4978
|
-
return (
|
|
4978
|
+
return (Rt(n) - s + r) / 7;
|
|
4979
4979
|
}
|
|
4980
4980
|
function Ms(n) {
|
|
4981
4981
|
return n > 99 ? n : n > ce.twoDigitCutoffYear ? 1900 + n : 2e3 + n;
|
|
@@ -5008,14 +5008,14 @@ function Gi(n) {
|
|
|
5008
5008
|
function Ln(n, e) {
|
|
5009
5009
|
const t = {};
|
|
5010
5010
|
for (const s in n)
|
|
5011
|
-
if (
|
|
5011
|
+
if ($t(n, s)) {
|
|
5012
5012
|
const r = n[s];
|
|
5013
5013
|
if (r == null) continue;
|
|
5014
5014
|
t[e(s)] = Gi(r);
|
|
5015
5015
|
}
|
|
5016
5016
|
return t;
|
|
5017
5017
|
}
|
|
5018
|
-
function
|
|
5018
|
+
function Xt(n, e) {
|
|
5019
5019
|
const t = Math.trunc(Math.abs(n / 60)), s = Math.trunc(Math.abs(n % 60)), r = n >= 0 ? "+" : "-";
|
|
5020
5020
|
switch (e) {
|
|
5021
5021
|
case "short":
|
|
@@ -5167,10 +5167,10 @@ const bl = {
|
|
|
5167
5167
|
TTT: Ri,
|
|
5168
5168
|
TTTT: Ni,
|
|
5169
5169
|
f: xi,
|
|
5170
|
-
ff:
|
|
5170
|
+
ff: Di,
|
|
5171
5171
|
fff: Ci,
|
|
5172
5172
|
ffff: Mi,
|
|
5173
|
-
F:
|
|
5173
|
+
F: Ii,
|
|
5174
5174
|
FF: Ai,
|
|
5175
5175
|
FFF: $i,
|
|
5176
5176
|
FFFF: Fi
|
|
@@ -5416,11 +5416,11 @@ class _e {
|
|
|
5416
5416
|
}
|
|
5417
5417
|
}
|
|
5418
5418
|
const no = /[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;
|
|
5419
|
-
function
|
|
5419
|
+
function Ft(...n) {
|
|
5420
5420
|
const e = n.reduce((t, s) => t + s.source, "");
|
|
5421
5421
|
return RegExp(`^${e}$`);
|
|
5422
5422
|
}
|
|
5423
|
-
function
|
|
5423
|
+
function Pt(...n) {
|
|
5424
5424
|
return (e) => n.reduce(
|
|
5425
5425
|
([t, s, r], i) => {
|
|
5426
5426
|
const [o, a, l] = i(e, r);
|
|
@@ -5429,7 +5429,7 @@ function Ft(...n) {
|
|
|
5429
5429
|
[{}, null, 1]
|
|
5430
5430
|
).slice(0, 2);
|
|
5431
5431
|
}
|
|
5432
|
-
function
|
|
5432
|
+
function Lt(n, ...e) {
|
|
5433
5433
|
if (n == null)
|
|
5434
5434
|
return [null, null];
|
|
5435
5435
|
for (const [t, s] of e) {
|
|
@@ -5444,37 +5444,37 @@ function so(...n) {
|
|
|
5444
5444
|
const s = {};
|
|
5445
5445
|
let r;
|
|
5446
5446
|
for (r = 0; r < n.length; r++)
|
|
5447
|
-
s[n[r]] =
|
|
5447
|
+
s[n[r]] = et(e[t + r]);
|
|
5448
5448
|
return [s, null, t + r];
|
|
5449
5449
|
};
|
|
5450
5450
|
}
|
|
5451
|
-
const ro = /(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/, Sl = `(?:${ro.source}?(?:\\[(${no.source})\\])?)?`, Hs = /(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/, io = RegExp(`${Hs.source}${Sl}`), Gs = RegExp(`(?:[Tt]${io.source})?`), Tl = /([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/, Rl = /(\d{4})-?W(\d\d)(?:-?(\d))?/, Nl = /(\d{4})-?(\d{3})/, xl = so("weekYear", "weekNumber", "weekDay"),
|
|
5451
|
+
const ro = /(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/, Sl = `(?:${ro.source}?(?:\\[(${no.source})\\])?)?`, Hs = /(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/, io = RegExp(`${Hs.source}${Sl}`), Gs = RegExp(`(?:[Tt]${io.source})?`), Tl = /([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/, Rl = /(\d{4})-?W(\d\d)(?:-?(\d))?/, Nl = /(\d{4})-?(\d{3})/, xl = so("weekYear", "weekNumber", "weekDay"), Il = so("year", "ordinal"), Dl = /(\d{4})-(\d\d)-(\d\d)/, oo = RegExp(
|
|
5452
5452
|
`${Hs.source} ?(?:${ro.source}|(${no.source}))?`
|
|
5453
5453
|
), Al = RegExp(`(?: ${oo.source})?`);
|
|
5454
|
-
function
|
|
5454
|
+
function Nt(n, e, t) {
|
|
5455
5455
|
const s = n[e];
|
|
5456
|
-
return H(s) ? t :
|
|
5456
|
+
return H(s) ? t : et(s);
|
|
5457
5457
|
}
|
|
5458
5458
|
function Cl(n, e) {
|
|
5459
5459
|
return [{
|
|
5460
|
-
year:
|
|
5461
|
-
month:
|
|
5462
|
-
day:
|
|
5460
|
+
year: Nt(n, e),
|
|
5461
|
+
month: Nt(n, e + 1, 1),
|
|
5462
|
+
day: Nt(n, e + 2, 1)
|
|
5463
5463
|
}, null, e + 3];
|
|
5464
5464
|
}
|
|
5465
|
-
function
|
|
5465
|
+
function Vt(n, e) {
|
|
5466
5466
|
return [{
|
|
5467
|
-
hours:
|
|
5468
|
-
minutes:
|
|
5469
|
-
seconds:
|
|
5467
|
+
hours: Nt(n, e, 0),
|
|
5468
|
+
minutes: Nt(n, e + 1, 0),
|
|
5469
|
+
seconds: Nt(n, e + 2, 0),
|
|
5470
5470
|
milliseconds: qs(n[e + 3])
|
|
5471
5471
|
}, null, e + 4];
|
|
5472
5472
|
}
|
|
5473
|
-
function
|
|
5473
|
+
function ln(n, e) {
|
|
5474
5474
|
const t = !n[e] && !n[e + 1], s = Hn(n[e + 1], n[e + 2]), r = t ? null : Ee.instance(s);
|
|
5475
5475
|
return [{}, r, e + 3];
|
|
5476
5476
|
}
|
|
5477
|
-
function
|
|
5477
|
+
function cn(n, e) {
|
|
5478
5478
|
const t = n[e] ? He.create(n[e]) : null;
|
|
5479
5479
|
return [{}, t, e + 1];
|
|
5480
5480
|
}
|
|
@@ -5483,13 +5483,13 @@ function Fl(n) {
|
|
|
5483
5483
|
const [e, t, s, r, i, o, a, l, c] = n, u = e[0] === "-", h = l && l[0] === "-", f = (d, m = !1) => d !== void 0 && (m || d && u) ? -d : d;
|
|
5484
5484
|
return [
|
|
5485
5485
|
{
|
|
5486
|
-
years: f(
|
|
5487
|
-
months: f(
|
|
5488
|
-
weeks: f(
|
|
5489
|
-
days: f(
|
|
5490
|
-
hours: f(
|
|
5491
|
-
minutes: f(
|
|
5492
|
-
seconds: f(
|
|
5486
|
+
years: f(ut(t)),
|
|
5487
|
+
months: f(ut(s)),
|
|
5488
|
+
weeks: f(ut(r)),
|
|
5489
|
+
days: f(ut(i)),
|
|
5490
|
+
hours: f(ut(o)),
|
|
5491
|
+
minutes: f(ut(a)),
|
|
5492
|
+
seconds: f(ut(l), l === "-0"),
|
|
5493
5493
|
milliseconds: f(qs(c), h)
|
|
5494
5494
|
}
|
|
5495
5495
|
];
|
|
@@ -5507,13 +5507,13 @@ const Pl = {
|
|
|
5507
5507
|
};
|
|
5508
5508
|
function Ys(n, e, t, s, r, i, o) {
|
|
5509
5509
|
const a = {
|
|
5510
|
-
year: e.length === 2 ? Ms(
|
|
5510
|
+
year: e.length === 2 ? Ms(et(e)) : et(e),
|
|
5511
5511
|
month: Yi.indexOf(t) + 1,
|
|
5512
|
-
day:
|
|
5513
|
-
hour:
|
|
5514
|
-
minute:
|
|
5512
|
+
day: et(s),
|
|
5513
|
+
hour: et(r),
|
|
5514
|
+
minute: et(i)
|
|
5515
5515
|
};
|
|
5516
|
-
return o && (a.second =
|
|
5516
|
+
return o && (a.second = et(o)), n && (a.weekday = n.length > 3 ? Qi.indexOf(n) + 1 : Ki.indexOf(n) + 1), a;
|
|
5517
5517
|
}
|
|
5518
5518
|
const Ll = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;
|
|
5519
5519
|
function Vl(n) {
|
|
@@ -5546,28 +5546,28 @@ function zl(n) {
|
|
|
5546
5546
|
const [, e, t, s, r, i, o, a] = n;
|
|
5547
5547
|
return [Ys(e, a, t, s, r, i, o), Ee.utcInstance];
|
|
5548
5548
|
}
|
|
5549
|
-
const ql =
|
|
5549
|
+
const ql = Ft(Tl, Gs), Bl = Ft(Rl, Gs), Hl = Ft(Nl, Gs), Gl = Ft(io), ao = Pt(
|
|
5550
5550
|
Cl,
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
|
|
5554
|
-
), Yl =
|
|
5551
|
+
Vt,
|
|
5552
|
+
ln,
|
|
5553
|
+
cn
|
|
5554
|
+
), Yl = Pt(
|
|
5555
5555
|
xl,
|
|
5556
|
-
|
|
5557
|
-
|
|
5558
|
-
|
|
5559
|
-
), Jl =
|
|
5560
|
-
|
|
5561
|
-
|
|
5562
|
-
|
|
5563
|
-
|
|
5564
|
-
), Ql =
|
|
5565
|
-
|
|
5566
|
-
|
|
5567
|
-
|
|
5556
|
+
Vt,
|
|
5557
|
+
ln,
|
|
5558
|
+
cn
|
|
5559
|
+
), Jl = Pt(
|
|
5560
|
+
Il,
|
|
5561
|
+
Vt,
|
|
5562
|
+
ln,
|
|
5563
|
+
cn
|
|
5564
|
+
), Ql = Pt(
|
|
5565
|
+
Vt,
|
|
5566
|
+
ln,
|
|
5567
|
+
cn
|
|
5568
5568
|
);
|
|
5569
5569
|
function Kl(n) {
|
|
5570
|
-
return
|
|
5570
|
+
return Lt(
|
|
5571
5571
|
n,
|
|
5572
5572
|
[ql, ao],
|
|
5573
5573
|
[Bl, Yl],
|
|
@@ -5576,10 +5576,10 @@ function Kl(n) {
|
|
|
5576
5576
|
);
|
|
5577
5577
|
}
|
|
5578
5578
|
function Xl(n) {
|
|
5579
|
-
return
|
|
5579
|
+
return Lt(Ul(n), [Ll, Vl]);
|
|
5580
5580
|
}
|
|
5581
5581
|
function ec(n) {
|
|
5582
|
-
return
|
|
5582
|
+
return Lt(
|
|
5583
5583
|
n,
|
|
5584
5584
|
[Wl, Mr],
|
|
5585
5585
|
[jl, Mr],
|
|
@@ -5587,19 +5587,19 @@ function ec(n) {
|
|
|
5587
5587
|
);
|
|
5588
5588
|
}
|
|
5589
5589
|
function tc(n) {
|
|
5590
|
-
return
|
|
5590
|
+
return Lt(n, [Ml, Fl]);
|
|
5591
5591
|
}
|
|
5592
|
-
const nc =
|
|
5592
|
+
const nc = Pt(Vt);
|
|
5593
5593
|
function sc(n) {
|
|
5594
|
-
return
|
|
5594
|
+
return Lt(n, [$l, nc]);
|
|
5595
5595
|
}
|
|
5596
|
-
const rc =
|
|
5597
|
-
|
|
5598
|
-
|
|
5599
|
-
|
|
5596
|
+
const rc = Ft(Dl, Al), ic = Ft(oo), oc = Pt(
|
|
5597
|
+
Vt,
|
|
5598
|
+
ln,
|
|
5599
|
+
cn
|
|
5600
5600
|
);
|
|
5601
5601
|
function ac(n) {
|
|
5602
|
-
return
|
|
5602
|
+
return Lt(
|
|
5603
5603
|
n,
|
|
5604
5604
|
[rc, ao],
|
|
5605
5605
|
[ic, oc]
|
|
@@ -5651,7 +5651,7 @@ const Fr = "Invalid Duration", lo = {
|
|
|
5651
5651
|
milliseconds: 720 * 60 * 60 * 1e3
|
|
5652
5652
|
},
|
|
5653
5653
|
...lo
|
|
5654
|
-
}, Re = 146097 / 400,
|
|
5654
|
+
}, Re = 146097 / 400, vt = 146097 / 4800, cc = {
|
|
5655
5655
|
years: {
|
|
5656
5656
|
quarters: 4,
|
|
5657
5657
|
months: 12,
|
|
@@ -5672,15 +5672,15 @@ const Fr = "Invalid Duration", lo = {
|
|
|
5672
5672
|
milliseconds: Re * 24 * 60 * 60 * 1e3 / 4
|
|
5673
5673
|
},
|
|
5674
5674
|
months: {
|
|
5675
|
-
weeks:
|
|
5676
|
-
days:
|
|
5677
|
-
hours:
|
|
5678
|
-
minutes:
|
|
5679
|
-
seconds:
|
|
5680
|
-
milliseconds:
|
|
5675
|
+
weeks: vt / 7,
|
|
5676
|
+
days: vt,
|
|
5677
|
+
hours: vt * 24,
|
|
5678
|
+
minutes: vt * 24 * 60,
|
|
5679
|
+
seconds: vt * 24 * 60 * 60,
|
|
5680
|
+
milliseconds: vt * 24 * 60 * 60 * 1e3
|
|
5681
5681
|
},
|
|
5682
5682
|
...lo
|
|
5683
|
-
},
|
|
5683
|
+
}, mt = [
|
|
5684
5684
|
"years",
|
|
5685
5685
|
"quarters",
|
|
5686
5686
|
"months",
|
|
@@ -5690,7 +5690,7 @@ const Fr = "Invalid Duration", lo = {
|
|
|
5690
5690
|
"minutes",
|
|
5691
5691
|
"seconds",
|
|
5692
5692
|
"milliseconds"
|
|
5693
|
-
], uc =
|
|
5693
|
+
], uc = mt.slice(0).reverse();
|
|
5694
5694
|
function Ze(n, e, t = !1) {
|
|
5695
5695
|
const s = {
|
|
5696
5696
|
values: t ? e.values : { ...n.values, ...e.values || {} },
|
|
@@ -5708,7 +5708,7 @@ function co(n, e) {
|
|
|
5708
5708
|
}
|
|
5709
5709
|
function Pr(n, e) {
|
|
5710
5710
|
const t = co(n, e) < 0 ? -1 : 1;
|
|
5711
|
-
|
|
5711
|
+
mt.reduceRight((s, r) => {
|
|
5712
5712
|
if (H(e[r]))
|
|
5713
5713
|
return s;
|
|
5714
5714
|
if (s) {
|
|
@@ -5716,7 +5716,7 @@ function Pr(n, e) {
|
|
|
5716
5716
|
e[r] += a * t, e[s] -= a * o * t;
|
|
5717
5717
|
}
|
|
5718
5718
|
return r;
|
|
5719
|
-
}, null),
|
|
5719
|
+
}, null), mt.reduce((s, r) => {
|
|
5720
5720
|
if (H(e[r]))
|
|
5721
5721
|
return s;
|
|
5722
5722
|
if (s) {
|
|
@@ -5796,7 +5796,7 @@ class ee {
|
|
|
5796
5796
|
* @return {Duration}
|
|
5797
5797
|
*/
|
|
5798
5798
|
static fromDurationLike(e) {
|
|
5799
|
-
if (
|
|
5799
|
+
if (rt(e))
|
|
5800
5800
|
return ee.fromMillis(e);
|
|
5801
5801
|
if (ee.isDuration(e))
|
|
5802
5802
|
return e;
|
|
@@ -5959,7 +5959,7 @@ class ee {
|
|
|
5959
5959
|
*/
|
|
5960
5960
|
toHuman(e = {}) {
|
|
5961
5961
|
if (!this.isValid) return Fr;
|
|
5962
|
-
const t = e.showZeros !== !1, s =
|
|
5962
|
+
const t = e.showZeros !== !1, s = mt.map((r) => {
|
|
5963
5963
|
const i = this.values[r];
|
|
5964
5964
|
return H(i) || i === 0 && !t ? null : this.loc.numberFormatter({ style: "unit", unitDisplay: "long", ...e, unit: r.slice(0, -1) }).format(i);
|
|
5965
5965
|
}).filter((r) => r);
|
|
@@ -6059,8 +6059,8 @@ class ee {
|
|
|
6059
6059
|
plus(e) {
|
|
6060
6060
|
if (!this.isValid) return this;
|
|
6061
6061
|
const t = ee.fromDurationLike(e), s = {};
|
|
6062
|
-
for (const r of
|
|
6063
|
-
(
|
|
6062
|
+
for (const r of mt)
|
|
6063
|
+
($t(t.values, r) || $t(this.values, r)) && (s[r] = t.get(r) + this.get(r));
|
|
6064
6064
|
return Ze(this, { values: s }, !0);
|
|
6065
6065
|
}
|
|
6066
6066
|
/**
|
|
@@ -6172,16 +6172,16 @@ class ee {
|
|
|
6172
6172
|
e = e.map((o) => ee.normalizeUnit(o));
|
|
6173
6173
|
const t = {}, s = {}, r = this.toObject();
|
|
6174
6174
|
let i;
|
|
6175
|
-
for (const o of
|
|
6175
|
+
for (const o of mt)
|
|
6176
6176
|
if (e.indexOf(o) >= 0) {
|
|
6177
6177
|
i = o;
|
|
6178
6178
|
let a = 0;
|
|
6179
6179
|
for (const c in s)
|
|
6180
6180
|
a += this.matrix[c][o] * s[c], s[c] = 0;
|
|
6181
|
-
|
|
6181
|
+
rt(r[o]) && (a += r[o]);
|
|
6182
6182
|
const l = Math.trunc(a);
|
|
6183
6183
|
t[o] = l, s[o] = (a * 1e3 - l * 1e3) / 1e3;
|
|
6184
|
-
} else
|
|
6184
|
+
} else rt(r[o]) && (s[o] = r[o]);
|
|
6185
6185
|
for (const o in s)
|
|
6186
6186
|
s[o] !== 0 && (t[i] += o === i ? s[o] : s[o] / this.matrix[i][o]);
|
|
6187
6187
|
return Pr(this.matrix, t), Ze(this, { values: t }, !0);
|
|
@@ -6322,13 +6322,13 @@ class ee {
|
|
|
6322
6322
|
function t(s, r) {
|
|
6323
6323
|
return s === void 0 || s === 0 ? r === void 0 || r === 0 : s === r;
|
|
6324
6324
|
}
|
|
6325
|
-
for (const s of
|
|
6325
|
+
for (const s of mt)
|
|
6326
6326
|
if (!t(this.values[s], e.values[s]))
|
|
6327
6327
|
return !1;
|
|
6328
6328
|
return !0;
|
|
6329
6329
|
}
|
|
6330
6330
|
}
|
|
6331
|
-
const
|
|
6331
|
+
const Ot = "Invalid Interval";
|
|
6332
6332
|
function dc(n, e) {
|
|
6333
6333
|
return !n || !n.isValid ? le.invalid("missing or invalid start") : !e || !e.isValid ? le.invalid("missing or invalid end") : e < n ? le.invalid(
|
|
6334
6334
|
"end before start",
|
|
@@ -6363,7 +6363,7 @@ class le {
|
|
|
6363
6363
|
* @return {Interval}
|
|
6364
6364
|
*/
|
|
6365
6365
|
static fromDateTimes(e, t) {
|
|
6366
|
-
const s =
|
|
6366
|
+
const s = zt(e), r = zt(t), i = dc(s, r);
|
|
6367
6367
|
return i ?? new le({
|
|
6368
6368
|
start: s,
|
|
6369
6369
|
end: r
|
|
@@ -6376,7 +6376,7 @@ class le {
|
|
|
6376
6376
|
* @return {Interval}
|
|
6377
6377
|
*/
|
|
6378
6378
|
static after(e, t) {
|
|
6379
|
-
const s = ee.fromDurationLike(t), r =
|
|
6379
|
+
const s = ee.fromDurationLike(t), r = zt(e);
|
|
6380
6380
|
return le.fromDateTimes(r, r.plus(s));
|
|
6381
6381
|
}
|
|
6382
6382
|
/**
|
|
@@ -6386,7 +6386,7 @@ class le {
|
|
|
6386
6386
|
* @return {Interval}
|
|
6387
6387
|
*/
|
|
6388
6388
|
static before(e, t) {
|
|
6389
|
-
const s = ee.fromDurationLike(t), r =
|
|
6389
|
+
const s = ee.fromDurationLike(t), r = zt(e);
|
|
6390
6390
|
return le.fromDateTimes(r.minus(s), r);
|
|
6391
6391
|
}
|
|
6392
6392
|
/**
|
|
@@ -6556,7 +6556,7 @@ class le {
|
|
|
6556
6556
|
*/
|
|
6557
6557
|
splitAt(...e) {
|
|
6558
6558
|
if (!this.isValid) return [];
|
|
6559
|
-
const t = e.map(
|
|
6559
|
+
const t = e.map(zt).filter((o) => this.contains(o)).sort((o, a) => o.toMillis() - a.toMillis()), s = [];
|
|
6560
6560
|
let { s: r } = this, i = 0;
|
|
6561
6561
|
for (; r < this.e; ) {
|
|
6562
6562
|
const o = t[i] || this.e, a = +o > +this.e ? this.e : o;
|
|
@@ -6697,7 +6697,7 @@ class le {
|
|
|
6697
6697
|
* @return {string}
|
|
6698
6698
|
*/
|
|
6699
6699
|
toString() {
|
|
6700
|
-
return this.isValid ? `[${this.s.toISO()} – ${this.e.toISO()})` :
|
|
6700
|
+
return this.isValid ? `[${this.s.toISO()} – ${this.e.toISO()})` : Ot;
|
|
6701
6701
|
}
|
|
6702
6702
|
/**
|
|
6703
6703
|
* Returns a string representation of this Interval appropriate for the REPL.
|
|
@@ -6725,7 +6725,7 @@ class le {
|
|
|
6725
6725
|
* @return {string}
|
|
6726
6726
|
*/
|
|
6727
6727
|
toLocaleString(e = Mn, t = {}) {
|
|
6728
|
-
return this.isValid ? _e.create(this.s.loc.clone(t), e).formatInterval(this) :
|
|
6728
|
+
return this.isValid ? _e.create(this.s.loc.clone(t), e).formatInterval(this) : Ot;
|
|
6729
6729
|
}
|
|
6730
6730
|
/**
|
|
6731
6731
|
* Returns an ISO 8601-compliant string representation of this Interval.
|
|
@@ -6734,7 +6734,7 @@ class le {
|
|
|
6734
6734
|
* @return {string}
|
|
6735
6735
|
*/
|
|
6736
6736
|
toISO(e) {
|
|
6737
|
-
return this.isValid ? `${this.s.toISO(e)}/${this.e.toISO(e)}` :
|
|
6737
|
+
return this.isValid ? `${this.s.toISO(e)}/${this.e.toISO(e)}` : Ot;
|
|
6738
6738
|
}
|
|
6739
6739
|
/**
|
|
6740
6740
|
* Returns an ISO 8601-compliant string representation of date of this Interval.
|
|
@@ -6743,7 +6743,7 @@ class le {
|
|
|
6743
6743
|
* @return {string}
|
|
6744
6744
|
*/
|
|
6745
6745
|
toISODate() {
|
|
6746
|
-
return this.isValid ? `${this.s.toISODate()}/${this.e.toISODate()}` :
|
|
6746
|
+
return this.isValid ? `${this.s.toISODate()}/${this.e.toISODate()}` : Ot;
|
|
6747
6747
|
}
|
|
6748
6748
|
/**
|
|
6749
6749
|
* Returns an ISO 8601-compliant string representation of time of this Interval.
|
|
@@ -6753,7 +6753,7 @@ class le {
|
|
|
6753
6753
|
* @return {string}
|
|
6754
6754
|
*/
|
|
6755
6755
|
toISOTime(e) {
|
|
6756
|
-
return this.isValid ? `${this.s.toISOTime(e)}/${this.e.toISOTime(e)}` :
|
|
6756
|
+
return this.isValid ? `${this.s.toISOTime(e)}/${this.e.toISOTime(e)}` : Ot;
|
|
6757
6757
|
}
|
|
6758
6758
|
/**
|
|
6759
6759
|
* Returns a string representation of this Interval formatted according to the specified format
|
|
@@ -6767,7 +6767,7 @@ class le {
|
|
|
6767
6767
|
* @return {string}
|
|
6768
6768
|
*/
|
|
6769
6769
|
toFormat(e, { separator: t = " – " } = {}) {
|
|
6770
|
-
return this.isValid ? `${this.s.toFormat(e)}${t}${this.e.toFormat(e)}` :
|
|
6770
|
+
return this.isValid ? `${this.s.toFormat(e)}${t}${this.e.toFormat(e)}` : Ot;
|
|
6771
6771
|
}
|
|
6772
6772
|
/**
|
|
6773
6773
|
* Return a Duration representing the time spanned by this interval.
|
|
@@ -6828,7 +6828,7 @@ class hn {
|
|
|
6828
6828
|
* @return {Zone}
|
|
6829
6829
|
*/
|
|
6830
6830
|
static normalizeZone(e) {
|
|
6831
|
-
return
|
|
6831
|
+
return tt(e, ce.defaultZone);
|
|
6832
6832
|
}
|
|
6833
6833
|
/**
|
|
6834
6834
|
* Get the weekday on which the week starts according to the given locale.
|
|
@@ -7220,7 +7220,7 @@ function Oc(n, e, t) {
|
|
|
7220
7220
|
const r = {};
|
|
7221
7221
|
let i = 1;
|
|
7222
7222
|
for (const o in t)
|
|
7223
|
-
if (
|
|
7223
|
+
if ($t(t, o)) {
|
|
7224
7224
|
const a = t[o], l = a.groups ? a.groups + 1 : 1;
|
|
7225
7225
|
!a.literal && a.token && (r[a.token.val[0]] = a.deser(s.slice(i, i + l))), i += l;
|
|
7226
7226
|
}
|
|
@@ -7291,8 +7291,8 @@ class mo {
|
|
|
7291
7291
|
explainFromTokens(e) {
|
|
7292
7292
|
if (this.isValid) {
|
|
7293
7293
|
const [t, s] = Oc(e, this.regex, this.handlers), [r, i, o] = s ? kc(s) : [null, null, void 0];
|
|
7294
|
-
if (
|
|
7295
|
-
throw new
|
|
7294
|
+
if ($t(s, "a") && $t(s, "H"))
|
|
7295
|
+
throw new St(
|
|
7296
7296
|
"Can't include meridiem when specifying 24-hour format"
|
|
7297
7297
|
);
|
|
7298
7298
|
return {
|
|
@@ -7329,7 +7329,7 @@ function yo(n, e) {
|
|
|
7329
7329
|
return r.map((o) => Ec(o, n, i));
|
|
7330
7330
|
}
|
|
7331
7331
|
const ls = "Invalid DateTime", jr = 864e13;
|
|
7332
|
-
function
|
|
7332
|
+
function Gt(n) {
|
|
7333
7333
|
return new Fe("unsupported zone", `the zone "${n.name}" is not supported`);
|
|
7334
7334
|
}
|
|
7335
7335
|
function cs(n) {
|
|
@@ -7342,7 +7342,7 @@ function us(n) {
|
|
|
7342
7342
|
n.loc.getStartOfWeek()
|
|
7343
7343
|
)), n.localWeekData;
|
|
7344
7344
|
}
|
|
7345
|
-
function
|
|
7345
|
+
function dt(n, e) {
|
|
7346
7346
|
const t = {
|
|
7347
7347
|
ts: n.ts,
|
|
7348
7348
|
zone: n.zone,
|
|
@@ -7398,7 +7398,7 @@ function Zr(n, e) {
|
|
|
7398
7398
|
let [l, c] = go(a, t, n.zone);
|
|
7399
7399
|
return o !== 0 && (l += o, c = n.zone.offset(l)), { ts: l, o: c };
|
|
7400
7400
|
}
|
|
7401
|
-
function
|
|
7401
|
+
function kt(n, e, t, s, r, i) {
|
|
7402
7402
|
const { setZone: o, zone: a } = t;
|
|
7403
7403
|
if (n && Object.keys(n).length !== 0 || e) {
|
|
7404
7404
|
const l = e || a, c = V.fromObject(n, {
|
|
@@ -7477,7 +7477,7 @@ const wo = {
|
|
|
7477
7477
|
"minute",
|
|
7478
7478
|
"second",
|
|
7479
7479
|
"millisecond"
|
|
7480
|
-
],
|
|
7480
|
+
], Ic = ["year", "ordinal", "hour", "minute", "second", "millisecond"];
|
|
7481
7481
|
function vn(n) {
|
|
7482
7482
|
const e = {
|
|
7483
7483
|
year: "year",
|
|
@@ -7523,17 +7523,17 @@ function qr(n) {
|
|
|
7523
7523
|
return vn(n);
|
|
7524
7524
|
}
|
|
7525
7525
|
}
|
|
7526
|
-
function
|
|
7527
|
-
if (
|
|
7528
|
-
return n.offset(
|
|
7526
|
+
function Dc(n) {
|
|
7527
|
+
if (Yt === void 0 && (Yt = ce.now()), n.type !== "iana")
|
|
7528
|
+
return n.offset(Yt);
|
|
7529
7529
|
const e = n.name;
|
|
7530
7530
|
let t = Fs.get(e);
|
|
7531
|
-
return t === void 0 && (t = n.offset(
|
|
7531
|
+
return t === void 0 && (t = n.offset(Yt), Fs.set(e, t)), t;
|
|
7532
7532
|
}
|
|
7533
7533
|
function Br(n, e) {
|
|
7534
|
-
const t =
|
|
7534
|
+
const t = tt(e.zone, ce.defaultZone);
|
|
7535
7535
|
if (!t.isValid)
|
|
7536
|
-
return V.invalid(
|
|
7536
|
+
return V.invalid(Gt(t));
|
|
7537
7537
|
const s = se.fromObject(e);
|
|
7538
7538
|
let r, i;
|
|
7539
7539
|
if (H(n.year))
|
|
@@ -7544,7 +7544,7 @@ function Br(n, e) {
|
|
|
7544
7544
|
const o = Zi(n) || zi(n);
|
|
7545
7545
|
if (o)
|
|
7546
7546
|
return V.invalid(o);
|
|
7547
|
-
const a =
|
|
7547
|
+
const a = Dc(t);
|
|
7548
7548
|
[r, i] = _n(n, a, t);
|
|
7549
7549
|
}
|
|
7550
7550
|
return new V({ ts: r, zone: t, loc: s, o: i });
|
|
@@ -7564,7 +7564,7 @@ function Gr(n) {
|
|
|
7564
7564
|
let e = {}, t;
|
|
7565
7565
|
return n.length > 0 && typeof n[n.length - 1] == "object" ? (e = n[n.length - 1], t = Array.from(n).slice(0, n.length - 1)) : t = Array.from(n), [e, t];
|
|
7566
7566
|
}
|
|
7567
|
-
let
|
|
7567
|
+
let Yt;
|
|
7568
7568
|
const Fs = /* @__PURE__ */ new Map();
|
|
7569
7569
|
class V {
|
|
7570
7570
|
/**
|
|
@@ -7572,14 +7572,14 @@ class V {
|
|
|
7572
7572
|
*/
|
|
7573
7573
|
constructor(e) {
|
|
7574
7574
|
const t = e.zone || ce.defaultZone;
|
|
7575
|
-
let s = e.invalid || (Number.isNaN(e.ts) ? new Fe("invalid input") : null) || (t.isValid ? null :
|
|
7575
|
+
let s = e.invalid || (Number.isNaN(e.ts) ? new Fe("invalid input") : null) || (t.isValid ? null : Gt(t));
|
|
7576
7576
|
this.ts = H(e.ts) ? ce.now() : e.ts;
|
|
7577
7577
|
let r = null, i = null;
|
|
7578
7578
|
if (!s)
|
|
7579
7579
|
if (e.old && e.old.ts === this.ts && e.old.zone.equals(t))
|
|
7580
7580
|
[r, i] = [e.old.c, e.old.o];
|
|
7581
7581
|
else {
|
|
7582
|
-
const a =
|
|
7582
|
+
const a = rt(e.o) && !e.old ? e.o : t.offset(this.ts);
|
|
7583
7583
|
r = pn(this.ts, a), s = Number.isNaN(r.year) ? new Fe("invalid input") : null, r = s ? null : r, i = s ? null : a;
|
|
7584
7584
|
}
|
|
7585
7585
|
this._zone = t, this.loc = e.loc || se.create(), this.invalid = s, this.weekData = null, this.localWeekData = null, this.c = r, this.o = i, this.isLuxonDateTime = !0;
|
|
@@ -7660,12 +7660,12 @@ class V {
|
|
|
7660
7660
|
const s = cl(e) ? e.valueOf() : NaN;
|
|
7661
7661
|
if (Number.isNaN(s))
|
|
7662
7662
|
return V.invalid("invalid input");
|
|
7663
|
-
const r =
|
|
7663
|
+
const r = tt(t.zone, ce.defaultZone);
|
|
7664
7664
|
return r.isValid ? new V({
|
|
7665
7665
|
ts: s,
|
|
7666
7666
|
zone: r,
|
|
7667
7667
|
loc: se.fromObject(t)
|
|
7668
|
-
}) : V.invalid(
|
|
7668
|
+
}) : V.invalid(Gt(r));
|
|
7669
7669
|
}
|
|
7670
7670
|
/**
|
|
7671
7671
|
* Create a DateTime from a number of milliseconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone.
|
|
@@ -7679,10 +7679,10 @@ class V {
|
|
|
7679
7679
|
* @return {DateTime}
|
|
7680
7680
|
*/
|
|
7681
7681
|
static fromMillis(e, t = {}) {
|
|
7682
|
-
if (
|
|
7682
|
+
if (rt(e))
|
|
7683
7683
|
return e < -jr || e > jr ? V.invalid("Timestamp out of range") : new V({
|
|
7684
7684
|
ts: e,
|
|
7685
|
-
zone:
|
|
7685
|
+
zone: tt(t.zone, ce.defaultZone),
|
|
7686
7686
|
loc: se.fromObject(t)
|
|
7687
7687
|
});
|
|
7688
7688
|
throw new we(
|
|
@@ -7701,10 +7701,10 @@ class V {
|
|
|
7701
7701
|
* @return {DateTime}
|
|
7702
7702
|
*/
|
|
7703
7703
|
static fromSeconds(e, t = {}) {
|
|
7704
|
-
if (
|
|
7704
|
+
if (rt(e))
|
|
7705
7705
|
return new V({
|
|
7706
7706
|
ts: e * 1e3,
|
|
7707
|
-
zone:
|
|
7707
|
+
zone: tt(t.zone, ce.defaultZone),
|
|
7708
7708
|
loc: se.fromObject(t)
|
|
7709
7709
|
});
|
|
7710
7710
|
throw new we("fromSeconds requires a numerical input");
|
|
@@ -7744,19 +7744,19 @@ class V {
|
|
|
7744
7744
|
*/
|
|
7745
7745
|
static fromObject(e, t = {}) {
|
|
7746
7746
|
e = e || {};
|
|
7747
|
-
const s =
|
|
7747
|
+
const s = tt(t.zone, ce.defaultZone);
|
|
7748
7748
|
if (!s.isValid)
|
|
7749
|
-
return V.invalid(
|
|
7750
|
-
const r = se.fromObject(t), i = Ln(e, qr), { minDaysInFirstWeek: o, startOfWeek: a } =
|
|
7749
|
+
return V.invalid(Gt(s));
|
|
7750
|
+
const r = se.fromObject(t), i = Ln(e, qr), { minDaysInFirstWeek: o, startOfWeek: a } = Dr(i, r), l = ce.now(), c = H(t.specificOffset) ? s.offset(l) : t.specificOffset, u = !H(i.ordinal), h = !H(i.year), f = !H(i.month) || !H(i.day), d = h || f, m = i.weekYear || i.weekNumber;
|
|
7751
7751
|
if ((d || u) && m)
|
|
7752
|
-
throw new
|
|
7752
|
+
throw new St(
|
|
7753
7753
|
"Can't mix weekYear/weekNumber units with year/month/day or ordinals"
|
|
7754
7754
|
);
|
|
7755
7755
|
if (f && u)
|
|
7756
|
-
throw new
|
|
7756
|
+
throw new St("Can't mix ordinal dates with month/day");
|
|
7757
7757
|
const O = m || i.weekday && !d;
|
|
7758
7758
|
let y, w, b = pn(l, c);
|
|
7759
|
-
O ? (y = xc, w = Rc, b = Fn(b, o, a)) : u ? (y =
|
|
7759
|
+
O ? (y = xc, w = Rc, b = Fn(b, o, a)) : u ? (y = Ic, w = Nc, b = os(b)) : (y = En, w = wo);
|
|
7760
7760
|
let N = !1;
|
|
7761
7761
|
for (const g of y) {
|
|
7762
7762
|
const k = i[g];
|
|
@@ -7765,7 +7765,7 @@ class V {
|
|
|
7765
7765
|
const p = O ? ol(i, o, a) : u ? al(i) : Zi(i), T = p || zi(i);
|
|
7766
7766
|
if (T)
|
|
7767
7767
|
return V.invalid(T);
|
|
7768
|
-
const C = O ? xr(i, o, a) : u ?
|
|
7768
|
+
const C = O ? xr(i, o, a) : u ? Ir(i) : i, [v, Z] = _n(C, c, s), x = new V({
|
|
7769
7769
|
ts: v,
|
|
7770
7770
|
zone: s,
|
|
7771
7771
|
o: Z,
|
|
@@ -7795,7 +7795,7 @@ class V {
|
|
|
7795
7795
|
*/
|
|
7796
7796
|
static fromISO(e, t = {}) {
|
|
7797
7797
|
const [s, r] = Kl(e);
|
|
7798
|
-
return
|
|
7798
|
+
return kt(s, r, t, "ISO 8601", e);
|
|
7799
7799
|
}
|
|
7800
7800
|
/**
|
|
7801
7801
|
* Create a DateTime from an RFC 2822 string
|
|
@@ -7814,7 +7814,7 @@ class V {
|
|
|
7814
7814
|
*/
|
|
7815
7815
|
static fromRFC2822(e, t = {}) {
|
|
7816
7816
|
const [s, r] = Xl(e);
|
|
7817
|
-
return
|
|
7817
|
+
return kt(s, r, t, "RFC 2822", e);
|
|
7818
7818
|
}
|
|
7819
7819
|
/**
|
|
7820
7820
|
* Create a DateTime from an HTTP header date
|
|
@@ -7834,7 +7834,7 @@ class V {
|
|
|
7834
7834
|
*/
|
|
7835
7835
|
static fromHTTP(e, t = {}) {
|
|
7836
7836
|
const [s, r] = ec(e);
|
|
7837
|
-
return
|
|
7837
|
+
return kt(s, r, t, "HTTP", t);
|
|
7838
7838
|
}
|
|
7839
7839
|
/**
|
|
7840
7840
|
* Create a DateTime from an input string and format string.
|
|
@@ -7858,7 +7858,7 @@ class V {
|
|
|
7858
7858
|
numberingSystem: i,
|
|
7859
7859
|
defaultToEN: !0
|
|
7860
7860
|
}), [a, l, c, u] = Tc(o, e, t);
|
|
7861
|
-
return u ? V.invalid(u) :
|
|
7861
|
+
return u ? V.invalid(u) : kt(a, l, s, `format ${t}`, e, c);
|
|
7862
7862
|
}
|
|
7863
7863
|
/**
|
|
7864
7864
|
* @deprecated use fromFormat instead
|
|
@@ -7889,7 +7889,7 @@ class V {
|
|
|
7889
7889
|
*/
|
|
7890
7890
|
static fromSQL(e, t = {}) {
|
|
7891
7891
|
const [s, r] = ac(e);
|
|
7892
|
-
return
|
|
7892
|
+
return kt(s, r, t, "SQL", e);
|
|
7893
7893
|
}
|
|
7894
7894
|
/**
|
|
7895
7895
|
* Create an invalid DateTime.
|
|
@@ -7934,7 +7934,7 @@ class V {
|
|
|
7934
7934
|
return ho(_e.parseFormat(e), se.fromObject(t)).map((r) => r.val).join("");
|
|
7935
7935
|
}
|
|
7936
7936
|
static resetCache() {
|
|
7937
|
-
|
|
7937
|
+
Yt = void 0, Fs.clear();
|
|
7938
7938
|
}
|
|
7939
7939
|
// INFO
|
|
7940
7940
|
/**
|
|
@@ -8236,7 +8236,7 @@ class V {
|
|
|
8236
8236
|
if (o === a)
|
|
8237
8237
|
return [this];
|
|
8238
8238
|
const l = s - o * t, c = s - a * t, u = pn(l, o), h = pn(c, a);
|
|
8239
|
-
return u.hour === h.hour && u.minute === h.minute && u.second === h.second && u.millisecond === h.millisecond ? [
|
|
8239
|
+
return u.hour === h.hour && u.minute === h.minute && u.second === h.second && u.millisecond === h.millisecond ? [dt(this, { ts: l }), dt(this, { ts: c })] : [this];
|
|
8240
8240
|
}
|
|
8241
8241
|
/**
|
|
8242
8242
|
* Returns true if this DateTime is in a leap year, false otherwise
|
|
@@ -8245,7 +8245,7 @@ class V {
|
|
|
8245
8245
|
* @type {boolean}
|
|
8246
8246
|
*/
|
|
8247
8247
|
get isInLeapYear() {
|
|
8248
|
-
return
|
|
8248
|
+
return an(this.year);
|
|
8249
8249
|
}
|
|
8250
8250
|
/**
|
|
8251
8251
|
* Returns the number of days in this DateTime's month
|
|
@@ -8263,7 +8263,7 @@ class V {
|
|
|
8263
8263
|
* @type {number}
|
|
8264
8264
|
*/
|
|
8265
8265
|
get daysInYear() {
|
|
8266
|
-
return this.isValid ?
|
|
8266
|
+
return this.isValid ? Rt(this.year) : NaN;
|
|
8267
8267
|
}
|
|
8268
8268
|
/**
|
|
8269
8269
|
* Returns the number of weeks in this DateTime's year
|
|
@@ -8273,7 +8273,7 @@ class V {
|
|
|
8273
8273
|
* @type {number}
|
|
8274
8274
|
*/
|
|
8275
8275
|
get weeksInWeekYear() {
|
|
8276
|
-
return this.isValid ?
|
|
8276
|
+
return this.isValid ? nn(this.weekYear) : NaN;
|
|
8277
8277
|
}
|
|
8278
8278
|
/**
|
|
8279
8279
|
* Returns the number of weeks in this DateTime's local week year
|
|
@@ -8282,7 +8282,7 @@ class V {
|
|
|
8282
8282
|
* @type {number}
|
|
8283
8283
|
*/
|
|
8284
8284
|
get weeksInLocalWeekYear() {
|
|
8285
|
-
return this.isValid ?
|
|
8285
|
+
return this.isValid ? nn(
|
|
8286
8286
|
this.localWeekYear,
|
|
8287
8287
|
this.loc.getMinDaysInFirstWeek(),
|
|
8288
8288
|
this.loc.getStartOfWeek()
|
|
@@ -8332,7 +8332,7 @@ class V {
|
|
|
8332
8332
|
* @return {DateTime}
|
|
8333
8333
|
*/
|
|
8334
8334
|
setZone(e, { keepLocalTime: t = !1, keepCalendarTime: s = !1 } = {}) {
|
|
8335
|
-
if (e =
|
|
8335
|
+
if (e = tt(e, ce.defaultZone), e.equals(this.zone))
|
|
8336
8336
|
return this;
|
|
8337
8337
|
if (e.isValid) {
|
|
8338
8338
|
let r = this.ts;
|
|
@@ -8340,9 +8340,9 @@ class V {
|
|
|
8340
8340
|
const i = e.offset(this.ts), o = this.toObject();
|
|
8341
8341
|
[r] = _n(o, i, e);
|
|
8342
8342
|
}
|
|
8343
|
-
return
|
|
8343
|
+
return dt(this, { ts: r, zone: e });
|
|
8344
8344
|
} else
|
|
8345
|
-
return V.invalid(
|
|
8345
|
+
return V.invalid(Gt(e));
|
|
8346
8346
|
}
|
|
8347
8347
|
/**
|
|
8348
8348
|
* "Set" the locale, numberingSystem, or outputCalendar. Returns a newly-constructed DateTime.
|
|
@@ -8352,7 +8352,7 @@ class V {
|
|
|
8352
8352
|
*/
|
|
8353
8353
|
reconfigure({ locale: e, numberingSystem: t, outputCalendar: s } = {}) {
|
|
8354
8354
|
const r = this.loc.clone({ locale: e, numberingSystem: t, outputCalendar: s });
|
|
8355
|
-
return
|
|
8355
|
+
return dt(this, { loc: r });
|
|
8356
8356
|
}
|
|
8357
8357
|
/**
|
|
8358
8358
|
* "Set" the locale. Returns a newly-constructed DateTime.
|
|
@@ -8378,21 +8378,21 @@ class V {
|
|
|
8378
8378
|
*/
|
|
8379
8379
|
set(e) {
|
|
8380
8380
|
if (!this.isValid) return this;
|
|
8381
|
-
const t = Ln(e, qr), { minDaysInFirstWeek: s, startOfWeek: r } =
|
|
8381
|
+
const t = Ln(e, qr), { minDaysInFirstWeek: s, startOfWeek: r } = Dr(t, this.loc), i = !H(t.weekYear) || !H(t.weekNumber) || !H(t.weekday), o = !H(t.ordinal), a = !H(t.year), l = !H(t.month) || !H(t.day), c = a || l, u = t.weekYear || t.weekNumber;
|
|
8382
8382
|
if ((c || o) && u)
|
|
8383
|
-
throw new
|
|
8383
|
+
throw new St(
|
|
8384
8384
|
"Can't mix weekYear/weekNumber units with year/month/day or ordinals"
|
|
8385
8385
|
);
|
|
8386
8386
|
if (l && o)
|
|
8387
|
-
throw new
|
|
8387
|
+
throw new St("Can't mix ordinal dates with month/day");
|
|
8388
8388
|
let h;
|
|
8389
8389
|
i ? h = xr(
|
|
8390
8390
|
{ ...Fn(this.c, s, r), ...t },
|
|
8391
8391
|
s,
|
|
8392
8392
|
r
|
|
8393
|
-
) : H(t.ordinal) ? (h = { ...this.toObject(), ...t }, H(t.day) && (h.day = Math.min(Pn(h.year, h.month), h.day))) : h =
|
|
8393
|
+
) : H(t.ordinal) ? (h = { ...this.toObject(), ...t }, H(t.day) && (h.day = Math.min(Pn(h.year, h.month), h.day))) : h = Ir({ ...os(this.c), ...t });
|
|
8394
8394
|
const [f, d] = _n(h, this.o, this.zone);
|
|
8395
|
-
return
|
|
8395
|
+
return dt(this, { ts: f, o: d });
|
|
8396
8396
|
}
|
|
8397
8397
|
/**
|
|
8398
8398
|
* Add a period of time to this DateTime and return the resulting DateTime
|
|
@@ -8410,7 +8410,7 @@ class V {
|
|
|
8410
8410
|
plus(e) {
|
|
8411
8411
|
if (!this.isValid) return this;
|
|
8412
8412
|
const t = ee.fromDurationLike(e);
|
|
8413
|
-
return
|
|
8413
|
+
return dt(this, Zr(this, t));
|
|
8414
8414
|
}
|
|
8415
8415
|
/**
|
|
8416
8416
|
* Subtract a period of time to this DateTime and return the resulting DateTime
|
|
@@ -8421,7 +8421,7 @@ class V {
|
|
|
8421
8421
|
minus(e) {
|
|
8422
8422
|
if (!this.isValid) return this;
|
|
8423
8423
|
const t = ee.fromDurationLike(e).negate();
|
|
8424
|
-
return
|
|
8424
|
+
return dt(this, Zr(this, t));
|
|
8425
8425
|
}
|
|
8426
8426
|
/**
|
|
8427
8427
|
* "Set" this DateTime to the beginning of a unit of time.
|
|
@@ -8977,7 +8977,7 @@ class V {
|
|
|
8977
8977
|
`fromFormatParser called with a locale of ${o}, but the format parser was created for ${t.locale}`
|
|
8978
8978
|
);
|
|
8979
8979
|
const { result: a, zone: l, specificOffset: c, invalidReason: u } = t.explainFromTokens(e);
|
|
8980
|
-
return u ? V.invalid(u) :
|
|
8980
|
+
return u ? V.invalid(u) : kt(
|
|
8981
8981
|
a,
|
|
8982
8982
|
l,
|
|
8983
8983
|
s,
|
|
@@ -9090,14 +9090,14 @@ class V {
|
|
|
9090
9090
|
* @type {Object}
|
|
9091
9091
|
*/
|
|
9092
9092
|
static get DATETIME_SHORT_WITH_SECONDS() {
|
|
9093
|
-
return
|
|
9093
|
+
return Ii;
|
|
9094
9094
|
}
|
|
9095
9095
|
/**
|
|
9096
9096
|
* {@link DateTime#toLocaleString} format like 'Oct 14, 1983, 9:30 AM'. Only 12-hour if the locale is.
|
|
9097
9097
|
* @type {Object}
|
|
9098
9098
|
*/
|
|
9099
9099
|
static get DATETIME_MED() {
|
|
9100
|
-
return
|
|
9100
|
+
return Di;
|
|
9101
9101
|
}
|
|
9102
9102
|
/**
|
|
9103
9103
|
* {@link DateTime#toLocaleString} format like 'Oct 14, 1983, 9:30:33 AM'. Only 12-hour if the locale is.
|
|
@@ -9142,10 +9142,10 @@ class V {
|
|
|
9142
9142
|
return Fi;
|
|
9143
9143
|
}
|
|
9144
9144
|
}
|
|
9145
|
-
function
|
|
9145
|
+
function zt(n) {
|
|
9146
9146
|
if (V.isDateTime(n))
|
|
9147
9147
|
return n;
|
|
9148
|
-
if (n && n.valueOf &&
|
|
9148
|
+
if (n && n.valueOf && rt(n.valueOf()))
|
|
9149
9149
|
return V.fromJSDate(n);
|
|
9150
9150
|
if (n && typeof n == "object")
|
|
9151
9151
|
return V.fromObject(n);
|
|
@@ -9158,34 +9158,34 @@ const Ac = (n, e) => {
|
|
|
9158
9158
|
if (n.includeFields) {
|
|
9159
9159
|
const s = e.collections[n.collection];
|
|
9160
9160
|
if (!s)
|
|
9161
|
-
return
|
|
9161
|
+
return rn(ge());
|
|
9162
9162
|
n.includeFields.forEach((r) => {
|
|
9163
9163
|
const i = s.fields.find((o) => o.name === r);
|
|
9164
9164
|
i ? t[r] = _o(i)?.nullable() : t[r] = ge();
|
|
9165
9165
|
});
|
|
9166
9166
|
}
|
|
9167
9167
|
return We({
|
|
9168
|
-
Collection_Path:
|
|
9168
|
+
Collection_Path: _t(be()),
|
|
9169
9169
|
...t
|
|
9170
9170
|
});
|
|
9171
9171
|
}, Cc = (n, e, t, s) => {
|
|
9172
9172
|
let r = We({}).catchall(Ac(n, e)), i;
|
|
9173
9173
|
if (!s && t) {
|
|
9174
|
-
const o =
|
|
9175
|
-
i =
|
|
9174
|
+
const o = Ie(n, t);
|
|
9175
|
+
i = qt(o.admin?.skipFormRequiredValidation);
|
|
9176
9176
|
}
|
|
9177
9177
|
return (!n.required || i) && (r = r.optional()), r;
|
|
9178
9178
|
}, $c = () => ge().refine((n) => n && (n.seconds !== void 0 && n.nanoseconds !== void 0 || n._seconds !== void 0 && n._nanoseconds !== void 0), {
|
|
9179
9179
|
message: "Must be a valid date"
|
|
9180
9180
|
}), _o = (n, e, t) => {
|
|
9181
9181
|
let s;
|
|
9182
|
-
const r = `${
|
|
9182
|
+
const r = `${qt(n.description)}
|
|
9183
9183
|
|
|
9184
9184
|
` || "";
|
|
9185
9185
|
let i, o, a;
|
|
9186
9186
|
if (!t && e) {
|
|
9187
|
-
const l =
|
|
9188
|
-
i = l.admin?.condition?.form !== void 0 && !
|
|
9187
|
+
const l = Ie(n, e);
|
|
9188
|
+
i = l.admin?.condition?.form !== void 0 && !qt(l.admin.condition.form), o = qt(l.admin?.skipFormRequiredValidation), a = qt(l.admin?.image);
|
|
9189
9189
|
}
|
|
9190
9190
|
switch (n.type) {
|
|
9191
9191
|
case "String":
|
|
@@ -9199,12 +9199,12 @@ const Ac = (n, e) => {
|
|
|
9199
9199
|
])), r && (s = s.describe(r.trim()));
|
|
9200
9200
|
break;
|
|
9201
9201
|
case "Boolean":
|
|
9202
|
-
s =
|
|
9202
|
+
s = Kt(), r && (s = s.describe(r.trim()));
|
|
9203
9203
|
break;
|
|
9204
9204
|
case "Number":
|
|
9205
|
-
n.autoIncrement ? s = Oe([ns(),
|
|
9205
|
+
n.autoIncrement ? s = Oe([ns(), ht().int()], {
|
|
9206
9206
|
message: "Must be a valid number"
|
|
9207
|
-
}) : (s =
|
|
9207
|
+
}) : (s = ht(), n.min && (s = s.min(n.min, `Must be greater than or equal to ${n.min}`)), n.max && (s = s.max(n.max, `Must be less than or equal to ${n.max}`)), n.decimal ? t ? s = s.describe(`${r}Must have ${n.decimal} decimal places`) : s = s.refine((l) => n.decimal ? (l.toString().split(".")[1]?.length || 0) <= n.decimal : !1, {
|
|
9208
9208
|
message: `Must have ${n.decimal} or fewer decimal places`
|
|
9209
9209
|
}) : s = s.int("Must not have decimal places"), n.values ? (t || (s = Oe([
|
|
9210
9210
|
s.refine((l) => n.values?.includes(l), {
|
|
@@ -9215,8 +9215,8 @@ const Ac = (n, e) => {
|
|
|
9215
9215
|
break;
|
|
9216
9216
|
case "Timestamp":
|
|
9217
9217
|
t ? (s = We({
|
|
9218
|
-
seconds:
|
|
9219
|
-
nanoseconds:
|
|
9218
|
+
seconds: ht(),
|
|
9219
|
+
nanoseconds: ht()
|
|
9220
9220
|
}), n.min && n.max ? s = s.describe(`${r}Must be between ${V.fromMillis(n.min).toLocaleString(V.DATE_MED)} and ${V.fromMillis(n.max).toLocaleString(V.DATE_MED)}`) : n.min ? s = s.describe(`${r}Must be greater than or equal to ${V.fromMillis(n.min).toLocaleString(V.DATE_MED)}`) : n.max ? s = s.describe(`${r}Must be less than or equal to ${V.fromMillis(n.max).toLocaleString(V.DATE_MED)}`) : r && (s = s.describe(r.trim()))) : (s = $c(), n.min && (s = s.refine((l) => l.toMillis() >= n.min, {
|
|
9221
9221
|
message: `Must be greater than or equal to ${V.fromMillis(n.min).toLocaleString(V.DATE_MED)}`
|
|
9222
9222
|
})), n.max && (s = s.refine((l) => l.toMillis() <= n.max, {
|
|
@@ -9224,7 +9224,7 @@ const Ac = (n, e) => {
|
|
|
9224
9224
|
})));
|
|
9225
9225
|
break;
|
|
9226
9226
|
case "Array":
|
|
9227
|
-
s =
|
|
9227
|
+
s = _t(ge()), n.length && (s = s.length(n.length, `Must contain ${n.length} item(s)`)), n.minlength ? s = s.min(n.minlength, `Must contain at least ${n.minlength} item(s)`) : n.required && !i && (s = s.nonempty("Must contain at least one item")), n.maxlength && (s = s.max(n.maxlength, `Must contain at most ${n.maxlength} item(s)`)), n.values ? (t || (s = s.refine((l) => {
|
|
9228
9228
|
let c = !0;
|
|
9229
9229
|
return l.forEach((u) => {
|
|
9230
9230
|
n.values && !n.values.includes(u) && (c = !1);
|
|
@@ -9232,7 +9232,7 @@ const Ac = (n, e) => {
|
|
|
9232
9232
|
}, { message: `Must only contain the following values: ${n.values.join(", ")}` })), s = s.describe(`${r}Must only contain the following values: ${n.values.join(", ")}`)) : r && (s = s.describe(r.trim())), n.nullable && (s = s.nullable());
|
|
9233
9233
|
break;
|
|
9234
9234
|
case "Map":
|
|
9235
|
-
n.required && !i ? t ? s = We({}).catchall(ge()).describe(`${r}Must be an object. Must contain at least one object property.`) : s =
|
|
9235
|
+
n.required && !i ? t ? s = We({}).catchall(ge()).describe(`${r}Must be an object. Must contain at least one object property.`) : s = rn(ge()).refine((l) => l && typeof l == "object" && Object.keys(l).length > 0, {
|
|
9236
9236
|
message: "Must not be an empty value"
|
|
9237
9237
|
}) : s = We({}).catchall(ge()).describe(`${r}Must be an object`);
|
|
9238
9238
|
break;
|
|
@@ -9251,8 +9251,8 @@ const Ac = (n, e) => {
|
|
|
9251
9251
|
message: `Must contain at most ${c.max} item(s)`
|
|
9252
9252
|
})))) : a[c.name] = _o(c, t, s), r && (a[c.name] = a[c.name].optional()));
|
|
9253
9253
|
}), !s && i && (a.operation = Oe([ke("create"), ke("update"), ke("delete")]).optional(), a.password = be().optional(), a.passwordConfirm = be().optional(), Object.values(e.collections).forEach((c) => {
|
|
9254
|
-
a[`auth-${c.labels.collection}`] =
|
|
9255
|
-
a[`attribute-${c.labels.collection}-${u.type}`] =
|
|
9254
|
+
a[`auth-${c.labels.collection}`] = Kt().optional(), a[`operations-${c.labels.collection}`] = _t(Oe([ke("Read"), ke("Create"), ke("Update"), ke("Delete")])).optional(), a[`restrict-${c.labels.collection}`] = Kt().optional(), c.access.attributeRestrictions?.forEach((u) => {
|
|
9255
|
+
a[`attribute-${c.labels.collection}-${u.type}`] = Kt().optional();
|
|
9256
9256
|
}), c.access.entityRestrictions?.restrictions?.forEach((u) => {
|
|
9257
9257
|
if (u.type === "Individual" && (a[`accessible-${c.labels.collection}-${c.labels.collection}`] = We({}).catchall(ge()).optional()), u.type === "Parent" || u.type === "Parent_Property") {
|
|
9258
9258
|
const h = W(c.fields, u.collectionField);
|
|
@@ -9268,7 +9268,7 @@ const Ac = (n, e) => {
|
|
|
9268
9268
|
if (!t.valid)
|
|
9269
9269
|
throw new Error(`VALIDATION_ERROR: ${t.message}`);
|
|
9270
9270
|
}
|
|
9271
|
-
},
|
|
9271
|
+
}, sn = async (n, e, t, s, r, i) => {
|
|
9272
9272
|
await Yr(s.custom?.preValidate, r);
|
|
9273
9273
|
for (const a of s.fields)
|
|
9274
9274
|
await Yr(a.custom?.preValidate, r);
|
|
@@ -9281,7 +9281,7 @@ const Ac = (n, e) => {
|
|
|
9281
9281
|
Collection_Path: t
|
|
9282
9282
|
}), p && p.size++);
|
|
9283
9283
|
}), T.forEach((g) => {
|
|
9284
|
-
if (
|
|
9284
|
+
if (ct(g, o, i)) {
|
|
9285
9285
|
const k = dn(g, o, i), _ = {};
|
|
9286
9286
|
r[g.name] !== void 0 && (_[g.name] = r[g.name], K(g) && (_[`${g.name}_Array`] = r[`${g.name}_Array`])), k.forEach((A) => {
|
|
9287
9287
|
r[A.name] !== void 0 && (K(A) ? _[`${A.name}_Array`] = r[`${A.name}_Array`] : _[A.name] = r[A.name]);
|
|
@@ -9297,26 +9297,26 @@ const Ac = (n, e) => {
|
|
|
9297
9297
|
}
|
|
9298
9298
|
const v = (g, k) => {
|
|
9299
9299
|
let _ = 1;
|
|
9300
|
-
|
|
9301
|
-
|
|
9300
|
+
ct(k, g, i) && _++, g.fields.forEach((E) => {
|
|
9301
|
+
ct(E, g, i) && JSON.parse(Xn(dn(E, g, i))).includes(k.name) && _++;
|
|
9302
9302
|
});
|
|
9303
9303
|
const A = l[g.labels.collection];
|
|
9304
9304
|
for (const E of A)
|
|
9305
|
-
E.fields.some((
|
|
9305
|
+
E.fields.some((D) => D.name === k.name) && K(k) && _++;
|
|
9306
9306
|
return _;
|
|
9307
9307
|
}, Z = (g, k, _, A, E) => {
|
|
9308
|
-
const
|
|
9309
|
-
|
|
9308
|
+
const D = {};
|
|
9309
|
+
D[`${_.name}.${s}`] = h(), D[`${_.name}_Array`] = u(s), D[`${_.name}_Single`] = h(), e.update(O(E, A), D), ct(_, k, i) && e.update(y(g, _.name, A), {
|
|
9310
9310
|
[`${_.name}.${s}`]: h(),
|
|
9311
9311
|
[`${_.name}_Array`]: u(s)
|
|
9312
9312
|
}), k.fields.forEach((F) => {
|
|
9313
|
-
|
|
9313
|
+
ct(F, k, i) && JSON.parse(Xn(dn(F, k, i))).includes(_.name) && e.update(y(g, F.name, A), {
|
|
9314
9314
|
[`${_.name}_Array`]: u(s)
|
|
9315
9315
|
});
|
|
9316
9316
|
});
|
|
9317
9317
|
const R = l[k.labels.collection];
|
|
9318
9318
|
for (const F of R)
|
|
9319
|
-
F.fields.some((M) => M.name === _.name) && K(_) && e.update(w(g, F.key, A),
|
|
9319
|
+
F.fields.some((M) => M.name === _.name) && K(_) && e.update(w(g, F.key, A), D);
|
|
9320
9320
|
};
|
|
9321
9321
|
if (n === "delete")
|
|
9322
9322
|
return;
|
|
@@ -9325,22 +9325,22 @@ const Ac = (n, e) => {
|
|
|
9325
9325
|
for (const g of x) {
|
|
9326
9326
|
if (!p)
|
|
9327
9327
|
throw new Error("VALIDATION_ERROR: batchSize is required");
|
|
9328
|
-
const k = i.collections[g.collection], _ = W(k.fields, g.twoWay), A =
|
|
9328
|
+
const k = i.collections[g.collection], _ = W(k.fields, g.twoWay), A = ft(k, k.fields), E = Array.from(A).map((D) => D.name);
|
|
9329
9329
|
if (!_)
|
|
9330
9330
|
throw new Error(`SCHEMA_ERROR: Field ${g.twoWay} not found in collection ${g.collection}`);
|
|
9331
9331
|
if (K(_)) {
|
|
9332
9332
|
if (r[`${g.name}_Array`])
|
|
9333
|
-
for (const [
|
|
9334
|
-
if (n === "update" && b && b[`${g.name}_Array`]?.includes(
|
|
9333
|
+
for (const [D, R] of Object.entries(r[g.name])) {
|
|
9334
|
+
if (n === "update" && b && b[`${g.name}_Array`]?.includes(D))
|
|
9335
9335
|
continue;
|
|
9336
9336
|
const F = { ...b, ...r };
|
|
9337
|
-
|
|
9337
|
+
nt(F);
|
|
9338
9338
|
const M = {};
|
|
9339
9339
|
_.includeFields && _.includeFields.forEach((S) => {
|
|
9340
9340
|
if (F[S] !== void 0) {
|
|
9341
9341
|
M[S] = F[S];
|
|
9342
9342
|
const q = W(o.fields, S);
|
|
9343
|
-
|
|
9343
|
+
wt(o, [q]).size === 1 && (M[`${S}_Lowercase`] = F[`${S}_Lowercase`]);
|
|
9344
9344
|
}
|
|
9345
9345
|
});
|
|
9346
9346
|
const P = {
|
|
@@ -9355,21 +9355,21 @@ const Ac = (n, e) => {
|
|
|
9355
9355
|
...M
|
|
9356
9356
|
});
|
|
9357
9357
|
const j = bn(r);
|
|
9358
|
-
e.update(O(R.Collection_Path,
|
|
9358
|
+
e.update(O(R.Collection_Path, D), {
|
|
9359
9359
|
...P,
|
|
9360
9360
|
...j
|
|
9361
|
-
}), p.size++,
|
|
9361
|
+
}), p.size++, ct(_, k, i) && (e.update(y(g, _.name, D), {
|
|
9362
9362
|
[`${_.name}.${s}`]: {
|
|
9363
9363
|
Collection_Path: t,
|
|
9364
9364
|
...M
|
|
9365
9365
|
},
|
|
9366
9366
|
[`${_.name}_Array`]: c(s)
|
|
9367
9367
|
}), p.size++), k.fields.forEach((S) => {
|
|
9368
|
-
if (
|
|
9368
|
+
if (ct(S, k, i)) {
|
|
9369
9369
|
const q = JSON.parse(Xn(dn(S, k, i))), B = {};
|
|
9370
9370
|
q.includes(_.name) && (B[`${g.twoWay}_Array`] = c(s)), Object.keys(j).forEach((re) => {
|
|
9371
9371
|
q.includes(re) && (B[re] = j[re]);
|
|
9372
|
-
}), Object.keys(B).length > 0 && (e.update(y(g, S.name,
|
|
9372
|
+
}), Object.keys(B).length > 0 && (e.update(y(g, S.name, D), B), p.size++);
|
|
9373
9373
|
}
|
|
9374
9374
|
});
|
|
9375
9375
|
const Q = l[k.labels.collection];
|
|
@@ -9378,7 +9378,7 @@ const Ac = (n, e) => {
|
|
|
9378
9378
|
const q = { ...P };
|
|
9379
9379
|
Object.keys(j).forEach((B) => {
|
|
9380
9380
|
S.fields.some((re) => re.name === B) && (q[B] = j[B]);
|
|
9381
|
-
}), Object.keys(q).length > 0 && (e.update(w(g, S.key,
|
|
9381
|
+
}), Object.keys(q).length > 0 && (e.update(w(g, S.key, D), q), p.size++);
|
|
9382
9382
|
}
|
|
9383
9383
|
}
|
|
9384
9384
|
} else
|
|
@@ -9471,8 +9471,8 @@ const Ac = (n, e) => {
|
|
|
9471
9471
|
);
|
|
9472
9472
|
return t;
|
|
9473
9473
|
};
|
|
9474
|
-
let hs, Eo, vo, Oo,
|
|
9475
|
-
const
|
|
9474
|
+
let hs, Eo, vo, Oo, Jt, ko, On, kn, ms = 0;
|
|
9475
|
+
const Tt = {
|
|
9476
9476
|
getTenant() {
|
|
9477
9477
|
return vo;
|
|
9478
9478
|
},
|
|
@@ -9483,12 +9483,12 @@ const St = {
|
|
|
9483
9483
|
return Oo;
|
|
9484
9484
|
},
|
|
9485
9485
|
getGlobalConfigModule() {
|
|
9486
|
-
return ye(
|
|
9486
|
+
return ye(Jt);
|
|
9487
9487
|
},
|
|
9488
9488
|
getCustomizationFile(n, e) {
|
|
9489
9489
|
if (!Object.keys(e.collections).includes(n))
|
|
9490
9490
|
throw new Error("PERMISSION_DENIED");
|
|
9491
|
-
const t = ea([n], ko, "node",
|
|
9491
|
+
const t = ea([n], ko, "node", Tt);
|
|
9492
9492
|
return ye(t?.[n]);
|
|
9493
9493
|
},
|
|
9494
9494
|
getVersionInfo() {
|
|
@@ -9499,7 +9499,7 @@ const St = {
|
|
|
9499
9499
|
}
|
|
9500
9500
|
}, au = async (n, e, t, s, r) => {
|
|
9501
9501
|
if (hs && !r)
|
|
9502
|
-
return
|
|
9502
|
+
return Tt;
|
|
9503
9503
|
if (!process.env.STOKER_FB_WEB_APP_CONFIG)
|
|
9504
9504
|
throw new Error("STOKER_FB_WEB_APP_CONFIG not set.");
|
|
9505
9505
|
const i = process.env.STOKER_FB_WEB_APP_CONFIG, o = JSON.parse(i);
|
|
@@ -9508,7 +9508,7 @@ const St = {
|
|
|
9508
9508
|
/* @vite-ignore */
|
|
9509
9509
|
t
|
|
9510
9510
|
)).default;
|
|
9511
|
-
|
|
9511
|
+
Jt = l("node", Tt), !r && n === "development" && (process.env.FIREBASE_AUTH_EMULATOR_HOST = "127.0.0.1:9099", process.env.FIREBASE_DATABASE_EMULATOR_HOST = "127.0.0.1:9000", process.env.FIRESTORE_EMULATOR_HOST = "127.0.0.1:8080", process.env.FIREBASE_STORAGE_EMULATOR_HOST = "127.0.0.1:9199");
|
|
9512
9512
|
try {
|
|
9513
9513
|
hs = ei();
|
|
9514
9514
|
} catch {
|
|
@@ -9520,27 +9520,27 @@ const St = {
|
|
|
9520
9520
|
});
|
|
9521
9521
|
}
|
|
9522
9522
|
const c = await Ge();
|
|
9523
|
-
return ko = await Fc(s, Object.keys(c.collections)), Oo = await ie(
|
|
9524
|
-
u.exists ? (kn = u.data(), ie(
|
|
9523
|
+
return ko = await Fc(s, Object.keys(c.collections)), Oo = await ie(Jt.timezone), ue().collection("system_deployment").doc("maintenance_mode").onSnapshot((u) => {
|
|
9524
|
+
u.exists ? (kn = u.data(), ie(Jt.onMaintenanceUpdate, ["node", kn.active ? "on" : "off"])) : console.error("Maintenance status not found");
|
|
9525
9525
|
}, (u) => {
|
|
9526
9526
|
console.error(u.message);
|
|
9527
9527
|
}), ue().collection("system_deployment").doc("latest_deploy").onSnapshot((u) => {
|
|
9528
|
-
u.exists ? (On = u.data(), ms++, ms > 1 && ie(
|
|
9528
|
+
u.exists ? (On = u.data(), ms++, ms > 1 && ie(Jt.onVersionUpdate, ["node", On, ms])) : console.error("Version info not found");
|
|
9529
9529
|
}, (u) => {
|
|
9530
9530
|
console.error(u.message);
|
|
9531
9531
|
}), await new Promise((u) => {
|
|
9532
9532
|
const h = () => {
|
|
9533
|
-
kn && On ? u(
|
|
9533
|
+
kn && On ? u(Tt) : setTimeout(h, 100);
|
|
9534
9534
|
};
|
|
9535
9535
|
h();
|
|
9536
|
-
}),
|
|
9537
|
-
}, { getTenant:
|
|
9536
|
+
}), Tt;
|
|
9537
|
+
}, { getTenant: Ye, getMode: bo, getTimezone: So, getGlobalConfigModule: Ut, getCustomizationFile: Je, getVersionInfo: lu, getMaintenanceInfo: cu } = Tt, Ge = async (n = !1) => {
|
|
9538
9538
|
const s = await si().ref("schema").orderByChild("published_time").limitToLast(1).get(), r = Object.values(s.val())[0];
|
|
9539
9539
|
if (n) {
|
|
9540
9540
|
for (const i of Object.values(r.collections))
|
|
9541
9541
|
for (const o of i.fields)
|
|
9542
9542
|
if (o.type === "Computed") {
|
|
9543
|
-
const a =
|
|
9543
|
+
const a = Ie(o, Je(i.labels.collection, r));
|
|
9544
9544
|
a.formula && (o.formula = a.formula);
|
|
9545
9545
|
}
|
|
9546
9546
|
} else
|
|
@@ -9551,7 +9551,7 @@ const St = {
|
|
|
9551
9551
|
const t = await si().ref("schema").orderByChild("published_time").limitToLast(2).get();
|
|
9552
9552
|
if (!(t.numChildren() < 2))
|
|
9553
9553
|
return Object.values(t.val())[0];
|
|
9554
|
-
},
|
|
9554
|
+
}, De = (n, e, t) => {
|
|
9555
9555
|
let s = n.collection("tenants").doc(t);
|
|
9556
9556
|
for (let r = 0; r < e.length; r++)
|
|
9557
9557
|
r % 2 === 0 ? s = s.collection(e[r]) : s = s.doc(e[r]);
|
|
@@ -9560,29 +9560,29 @@ const St = {
|
|
|
9560
9560
|
const i = ue(), o = e.at(-1);
|
|
9561
9561
|
if (!o)
|
|
9562
9562
|
throw new Error("EMPTY_PATH");
|
|
9563
|
-
const a = t.collections[o], { labels: l, fields: c, preloadCache: u } = a, h =
|
|
9563
|
+
const a = t.collections[o], { labels: l, fields: c, preloadCache: u } = a, h = Je(o, t), f = De(i, e, n);
|
|
9564
9564
|
if (r)
|
|
9565
9565
|
if (s) {
|
|
9566
9566
|
const d = r.collections?.[l.collection];
|
|
9567
9567
|
if (!r.Role)
|
|
9568
9568
|
throw new Error("PERMISSION_DENIED");
|
|
9569
9569
|
const m = d && Te("Read", d), O = ai(a, t, r), y = ii(a, r), w = Ps(a, r), b = oi(a, t, r), N = (E = []) => {
|
|
9570
|
-
const
|
|
9570
|
+
const D = [], R = fi(r.Role, a, t);
|
|
9571
9571
|
if (!R)
|
|
9572
9572
|
throw new Error("PERMISSION_DENIED");
|
|
9573
9573
|
if (m) {
|
|
9574
9574
|
let F = i.collection("tenants").doc(n).collection("system_fields").doc(l.collection).collection(`${l.collection}-${R.key}`).where("Collection_Path_String", "==", e.join("/"));
|
|
9575
9575
|
E.forEach((M) => {
|
|
9576
9576
|
F = F.where(...M);
|
|
9577
|
-
}),
|
|
9577
|
+
}), D.push(F);
|
|
9578
9578
|
} else if (O)
|
|
9579
9579
|
for (const F of O) {
|
|
9580
9580
|
let M = i.collection("tenants").doc(n).collection("system_fields").doc(l.collection).collection(`${l.collection}-${F.field}`).where("Collection_Path_String", "==", e.join("/"));
|
|
9581
9581
|
E.forEach((P) => {
|
|
9582
9582
|
M = M.where(...P);
|
|
9583
|
-
}),
|
|
9583
|
+
}), D.push(M);
|
|
9584
9584
|
}
|
|
9585
|
-
return
|
|
9585
|
+
return D;
|
|
9586
9586
|
}, p = y.filter((E) => "operations" in E && E.operations ? E.operations.includes("Read") : !0);
|
|
9587
9587
|
if (p.length === 0 && w.length === 0 && b.length === 0)
|
|
9588
9588
|
return N();
|
|
@@ -9593,10 +9593,10 @@ const St = {
|
|
|
9593
9593
|
if (p.length > 0) {
|
|
9594
9594
|
for (const E of p)
|
|
9595
9595
|
if (E.operations && E.type === "Record_Property") {
|
|
9596
|
-
const
|
|
9597
|
-
if (!
|
|
9596
|
+
const D = E.roles.find((R) => R.role === r.Role);
|
|
9597
|
+
if (!D)
|
|
9598
9598
|
throw new Error("PERMISSION_DENIED");
|
|
9599
|
-
C(
|
|
9599
|
+
C(D.values?.length);
|
|
9600
9600
|
}
|
|
9601
9601
|
}
|
|
9602
9602
|
u?.roles.includes(r.Role) && u.range && C(u.range.fields.length);
|
|
@@ -9605,25 +9605,25 @@ const St = {
|
|
|
9605
9605
|
const Z = T === 0 ? 30 : Math.max(1, Math.floor(30 / T)), x = [];
|
|
9606
9606
|
p.filter((E) => E.type === "Record_Owner").forEach(() => x.push(["Created_By", "==", s])), p.filter((E) => E.type === "Record_User").forEach((E) => {
|
|
9607
9607
|
if ("collectionField" in E) {
|
|
9608
|
-
const
|
|
9609
|
-
x.push([`${
|
|
9608
|
+
const D = W(c, E.collectionField);
|
|
9609
|
+
x.push([`${D.name}_Array`, "array-contains", r.Doc_ID]);
|
|
9610
9610
|
}
|
|
9611
9611
|
}), p.filter((E) => E.type === "Record_Property").forEach((E) => {
|
|
9612
9612
|
if ("propertyField" in E) {
|
|
9613
|
-
const
|
|
9614
|
-
if (!
|
|
9613
|
+
const D = E.roles.find((F) => F.role === r.Role);
|
|
9614
|
+
if (!D)
|
|
9615
9615
|
throw new Error("PERMISSION_DENIED");
|
|
9616
9616
|
const R = W(c, E.propertyField);
|
|
9617
|
-
R.type === "Array" ? x.push([`${R.name}_Array`, "array-contains-any",
|
|
9617
|
+
R.type === "Array" ? x.push([`${R.name}_Array`, "array-contains-any", D.values]) : x.push([R.name, "in", D.values]);
|
|
9618
9618
|
}
|
|
9619
9619
|
});
|
|
9620
9620
|
const g = [];
|
|
9621
9621
|
w.filter((E) => E.type === "Individual").forEach((E) => {
|
|
9622
|
-
const
|
|
9623
|
-
if (
|
|
9622
|
+
const D = d?.individualEntities, R = [];
|
|
9623
|
+
if (D) {
|
|
9624
9624
|
const F = E.singleQuery ? E.singleQuery : Z;
|
|
9625
|
-
for (let M = 0; M <
|
|
9626
|
-
const P =
|
|
9625
|
+
for (let M = 0; M < D.length; M += F) {
|
|
9626
|
+
const P = D.slice(M, M + F);
|
|
9627
9627
|
R.push(P);
|
|
9628
9628
|
}
|
|
9629
9629
|
if (!E.singleQuery)
|
|
@@ -9631,15 +9631,15 @@ const St = {
|
|
|
9631
9631
|
g.push(...N(x.concat([["id", "in", M]])));
|
|
9632
9632
|
});
|
|
9633
9633
|
else {
|
|
9634
|
-
if (
|
|
9634
|
+
if (D.length > F)
|
|
9635
9635
|
throw new Error(`INPUT_ERROR: Individual entity restriction with singleQuery set to true must not have more than ${E.singleQuery} entities`);
|
|
9636
|
-
x.push(["id", "in",
|
|
9636
|
+
x.push(["id", "in", D]);
|
|
9637
9637
|
}
|
|
9638
9638
|
}
|
|
9639
9639
|
}), b.filter((E) => E.parentFilter.type === "Individual").forEach((E) => {
|
|
9640
|
-
const { parentFilter:
|
|
9641
|
-
if ("collectionField" in
|
|
9642
|
-
const F = W(c,
|
|
9640
|
+
const { parentFilter: D, parentRestriction: R } = E;
|
|
9641
|
+
if ("collectionField" in D) {
|
|
9642
|
+
const F = W(c, D.collectionField);
|
|
9643
9643
|
if ("collection" in F) {
|
|
9644
9644
|
const M = r.collections?.[F.collection];
|
|
9645
9645
|
if (!M)
|
|
@@ -9667,8 +9667,8 @@ const St = {
|
|
|
9667
9667
|
const k = [];
|
|
9668
9668
|
w.filter((E) => E.type === "Parent").forEach((E) => {
|
|
9669
9669
|
if ("collectionField" in E) {
|
|
9670
|
-
const
|
|
9671
|
-
if ("collection" in
|
|
9670
|
+
const D = W(c, E.collectionField);
|
|
9671
|
+
if ("collection" in D) {
|
|
9672
9672
|
const R = d?.parentEntities, F = [];
|
|
9673
9673
|
if (R) {
|
|
9674
9674
|
const M = E.singleQuery ? E.singleQuery : Z;
|
|
@@ -9678,20 +9678,20 @@ const St = {
|
|
|
9678
9678
|
}
|
|
9679
9679
|
if (!E.singleQuery)
|
|
9680
9680
|
F.forEach((P) => {
|
|
9681
|
-
k.push(...N(x.concat([[`${
|
|
9681
|
+
k.push(...N(x.concat([[`${D.name}_Array`, "array-contains-any", P]])));
|
|
9682
9682
|
});
|
|
9683
9683
|
else {
|
|
9684
9684
|
if (R && R.length > M)
|
|
9685
9685
|
throw new Error(`INPUT_ERROR: Parent entity restriction with singleQuery set to true must not have more than ${E.singleQuery} entities`);
|
|
9686
|
-
x.push([`${
|
|
9686
|
+
x.push([`${D.name}_Array`, "array-contains-any", R]);
|
|
9687
9687
|
}
|
|
9688
9688
|
}
|
|
9689
9689
|
}
|
|
9690
9690
|
}
|
|
9691
9691
|
}), b.filter((E) => E.parentFilter.type === "Parent").forEach((E) => {
|
|
9692
|
-
const { parentFilter:
|
|
9693
|
-
if ("collectionField" in
|
|
9694
|
-
const F = W(c,
|
|
9692
|
+
const { parentFilter: D, parentRestriction: R } = E;
|
|
9693
|
+
if ("collectionField" in D && "parentCollectionField" in D) {
|
|
9694
|
+
const F = W(c, D.collectionField), M = W(c, D.parentCollectionField);
|
|
9695
9695
|
if ("collection" in F && "collection" in M) {
|
|
9696
9696
|
const P = r.collections?.[F.collection];
|
|
9697
9697
|
if (!P)
|
|
@@ -9725,8 +9725,8 @@ const St = {
|
|
|
9725
9725
|
const _ = [];
|
|
9726
9726
|
k.length === 0 && (w.filter((E) => E.type === "Parent_Property").forEach((E) => {
|
|
9727
9727
|
if ("collectionField" in E && "propertyField" in E) {
|
|
9728
|
-
const
|
|
9729
|
-
if ("collection" in
|
|
9728
|
+
const D = W(c, E.collectionField), R = W(c, E.propertyField);
|
|
9729
|
+
if ("collection" in D) {
|
|
9730
9730
|
const F = d?.parentPropertyEntities || {};
|
|
9731
9731
|
Object.entries(F).forEach(([M, P]) => {
|
|
9732
9732
|
if (P.length > 0) {
|
|
@@ -9737,7 +9737,7 @@ const St = {
|
|
|
9737
9737
|
}
|
|
9738
9738
|
j.forEach((Q) => {
|
|
9739
9739
|
_.push(...N(x.concat([
|
|
9740
|
-
[`${
|
|
9740
|
+
[`${D.name}_Array`, "array-contains-any", Q],
|
|
9741
9741
|
[R.name, "==", M]
|
|
9742
9742
|
])));
|
|
9743
9743
|
});
|
|
@@ -9746,9 +9746,9 @@ const St = {
|
|
|
9746
9746
|
}
|
|
9747
9747
|
}
|
|
9748
9748
|
}), b.filter((E) => E.parentFilter.type === "Parent_Property").forEach((E) => {
|
|
9749
|
-
const { parentFilter:
|
|
9750
|
-
if ("collectionField" in
|
|
9751
|
-
const R = W(c,
|
|
9749
|
+
const { parentFilter: D } = E;
|
|
9750
|
+
if ("collectionField" in D && "parentCollectionField" in D && "parentPropertyField" in D) {
|
|
9751
|
+
const R = W(c, D.collectionField), F = W(c, D.parentCollectionField), M = W(c, D.parentPropertyField);
|
|
9752
9752
|
if ("collection" in R && "collection" in F) {
|
|
9753
9753
|
const P = r.collections?.[R.collection];
|
|
9754
9754
|
if (!P)
|
|
@@ -9785,7 +9785,7 @@ const St = {
|
|
|
9785
9785
|
const i = ue(), o = e.at(-1);
|
|
9786
9786
|
if (!o)
|
|
9787
9787
|
throw new Error("EMPTY_PATH");
|
|
9788
|
-
const a = s.collections[o], { labels: l } = a, c =
|
|
9788
|
+
const a = s.collections[o], { labels: l } = a, c = De(i, e, n);
|
|
9789
9789
|
if (r) {
|
|
9790
9790
|
const u = r.collections?.[l.collection];
|
|
9791
9791
|
if (!r.Role)
|
|
@@ -9836,7 +9836,7 @@ const St = {
|
|
|
9836
9836
|
continue;
|
|
9837
9837
|
const m = Object.keys(d);
|
|
9838
9838
|
for (const O of m) {
|
|
9839
|
-
const y = d[O], w =
|
|
9839
|
+
const y = d[O], w = at(y.Collection_Path, O, {
|
|
9840
9840
|
user: o,
|
|
9841
9841
|
providedTransaction: a,
|
|
9842
9842
|
noEmbeddingFields: l
|
|
@@ -9874,11 +9874,11 @@ const St = {
|
|
|
9874
9874
|
if (typeof c != "number" || !Number.isFinite(c) || !Number.isInteger(c) || c < 1)
|
|
9875
9875
|
throw new Error("INPUT_ERROR: Pagination number must be a positive finite integer");
|
|
9876
9876
|
}
|
|
9877
|
-
const s =
|
|
9877
|
+
const s = Ye(), r = ue();
|
|
9878
9878
|
let i, o, a;
|
|
9879
9879
|
const l = async (c) => {
|
|
9880
9880
|
const [u, h, f] = await Promise.all([
|
|
9881
|
-
t?.user ? c.get(r.collection("system_user_permissions").doc(t.user)) : Promise.resolve(Promise.resolve({})),
|
|
9881
|
+
t?.user ? c.get(r.collection("tenants").doc(s).collection("system_user_permissions").doc(t.user)) : Promise.resolve(Promise.resolve({})),
|
|
9882
9882
|
c.get(r.collection("system_deployment").doc("maintenance_mode")),
|
|
9883
9883
|
Ge(!0)
|
|
9884
9884
|
]);
|
|
@@ -9888,13 +9888,13 @@ const St = {
|
|
|
9888
9888
|
throw new Error("MAINTENANCE_MODE");
|
|
9889
9889
|
const m = f;
|
|
9890
9890
|
let O;
|
|
9891
|
-
const y =
|
|
9891
|
+
const y = Ut(), w = n.at(-1);
|
|
9892
9892
|
if (!w)
|
|
9893
9893
|
throw new Error("EMPTY_PATH");
|
|
9894
9894
|
const b = Object.keys(m.collections).includes(w), N = y.disabledCollections?.includes(w);
|
|
9895
9895
|
if (!b || N)
|
|
9896
9896
|
throw new Error("COLLECTION_NOT_FOUND");
|
|
9897
|
-
const p = m.collections[w], { labels: T } = p, C =
|
|
9897
|
+
const p = m.collections[w], { labels: T } = p, C = Je(T.collection, m);
|
|
9898
9898
|
if (t?.user) {
|
|
9899
9899
|
if (!u?.exists)
|
|
9900
9900
|
throw new Error("PERMISSION_DENIED");
|
|
@@ -9906,8 +9906,8 @@ const St = {
|
|
|
9906
9906
|
let v = Pc(s, n, m, t?.user, O);
|
|
9907
9907
|
if (v.length === 0)
|
|
9908
9908
|
return { cursor: {}, pages: 0, docs: [] };
|
|
9909
|
-
if (e && (v = v.map((A) => (e.forEach(([E,
|
|
9910
|
-
A = A.where(E,
|
|
9909
|
+
if (e && (v = v.map((A) => (e.forEach(([E, D, R]) => {
|
|
9910
|
+
A = A.where(E, D, R);
|
|
9911
9911
|
}), A))), o = t?.pagination?.startAfter || t?.pagination?.endBefore || {
|
|
9912
9912
|
first: /* @__PURE__ */ new Map(),
|
|
9913
9913
|
last: /* @__PURE__ */ new Map()
|
|
@@ -9920,7 +9920,7 @@ const St = {
|
|
|
9920
9920
|
if (A && E !== !0)
|
|
9921
9921
|
throw new Error("INPUT_ERROR: Pagination is not allowed when using " + E);
|
|
9922
9922
|
}
|
|
9923
|
-
t.pagination.orderByField && t.pagination.orderByDirection ? !t.pagination.startAfter && !t.pagination.endBefore ? v = v.map((E) => E.orderBy(t.pagination.orderByField, t.pagination.orderByDirection).limit(t.pagination.number)) : t.pagination.startAfter ? v = v.map((E,
|
|
9923
|
+
t.pagination.orderByField && t.pagination.orderByDirection ? !t.pagination.startAfter && !t.pagination.endBefore ? v = v.map((E) => E.orderBy(t.pagination.orderByField, t.pagination.orderByDirection).limit(t.pagination.number)) : t.pagination.startAfter ? v = v.map((E, D) => E.orderBy(t.pagination.orderByField, t.pagination.orderByDirection).startAfter(o.last.get(D)).limit(t.pagination.number)) : v = v.map((E, D) => E.orderBy(t.pagination.orderByField, t.pagination.orderByDirection).endBefore(o.first.get(D)).limitToLast(t.pagination.number)) : !t.pagination.startAfter && !t.pagination.endBefore ? v = v.map((E) => E.limit(t.pagination.number)) : t.pagination.startAfter ? v = v.map((E, D) => E.startAfter(o.last.get(D)).limit(t.pagination.number)) : v = v.map((E, D) => E.endBefore(o.first.get(D)).limitToLast(t.pagination.number));
|
|
9924
9924
|
}
|
|
9925
9925
|
const Z = {};
|
|
9926
9926
|
await ae("preOperation", y, C, ["read", void 0, void 0, Z]), await ae("preRead", y, C, [Z, v, !0, !1]), a = /* @__PURE__ */ new Map();
|
|
@@ -9928,9 +9928,9 @@ const St = {
|
|
|
9928
9928
|
for (const A of _) {
|
|
9929
9929
|
for (const E of A.docs) {
|
|
9930
9930
|
a.has(E.id) || a.set(E.id, {});
|
|
9931
|
-
const
|
|
9931
|
+
const D = E.data(), R = a.get(E.id);
|
|
9932
9932
|
R.id ||= E.id;
|
|
9933
|
-
const F = { ...R, ...
|
|
9933
|
+
const F = { ...R, ...D };
|
|
9934
9934
|
delete F.Collection_Path_String, a.set(E.id, F);
|
|
9935
9935
|
}
|
|
9936
9936
|
o.first.set(_.indexOf(A), A.docs[0]), o.last.set(_.indexOf(A), A.docs.at(-1) || A.docs[0]);
|
|
@@ -9938,16 +9938,16 @@ const St = {
|
|
|
9938
9938
|
if (t?.pagination) {
|
|
9939
9939
|
let A = v[0];
|
|
9940
9940
|
e && (A = e.reduce((F, [M, P, j]) => F.where(M, P, j), A)), t.pagination.orderByField && t.pagination.orderByDirection && (A = A.orderBy(t.pagination.orderByField, t.pagination.orderByDirection));
|
|
9941
|
-
const
|
|
9942
|
-
i = R > 0 ? Math.ceil(
|
|
9941
|
+
const D = (await A.count().get()).data().count, R = t.pagination.number;
|
|
9942
|
+
i = R > 0 ? Math.ceil(D / R) : 0;
|
|
9943
9943
|
}
|
|
9944
9944
|
for (const A of a.values()) {
|
|
9945
|
-
const E = [],
|
|
9945
|
+
const E = [], D = [...A.Collection_Path, A.id];
|
|
9946
9946
|
t?.subcollections && E.push(Ro(
|
|
9947
9947
|
s,
|
|
9948
9948
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
9949
9949
|
a.get(A.id),
|
|
9950
|
-
|
|
9950
|
+
D,
|
|
9951
9951
|
ye(t.subcollections),
|
|
9952
9952
|
m,
|
|
9953
9953
|
ye(t?.relations),
|
|
@@ -9967,7 +9967,7 @@ const St = {
|
|
|
9967
9967
|
s,
|
|
9968
9968
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
9969
9969
|
a.get(A.id),
|
|
9970
|
-
|
|
9970
|
+
D,
|
|
9971
9971
|
ye(t.relations),
|
|
9972
9972
|
m,
|
|
9973
9973
|
void 0,
|
|
@@ -9978,7 +9978,7 @@ const St = {
|
|
|
9978
9978
|
for (const M of a.values())
|
|
9979
9979
|
for (const P of p.fields) {
|
|
9980
9980
|
if (P.type === "Computed") {
|
|
9981
|
-
const j =
|
|
9981
|
+
const j = Ie(P, C);
|
|
9982
9982
|
if (!j.formula)
|
|
9983
9983
|
continue;
|
|
9984
9984
|
M[P.name] = await j.formula(M);
|
|
@@ -9992,7 +9992,7 @@ const St = {
|
|
|
9992
9992
|
continue;
|
|
9993
9993
|
}
|
|
9994
9994
|
for (const j of p.fields) {
|
|
9995
|
-
const Q = !j.access || j.access.includes(M), S =
|
|
9995
|
+
const Q = !j.access || j.access.includes(M), S = Ie(j, C), q = S?.custom?.serverAccess?.read !== void 0 ? await ie(S.custom.serverAccess.read, [M, A]) : !0;
|
|
9996
9996
|
(!Q || !q) && (K(j) ? (delete a.get(A.id)[j.name], delete a.get(A.id)[`${j.name}_Array`], delete a.get(A.id)[`${j.name}_Single`]) : delete a.get(A.id)[j.name]);
|
|
9997
9997
|
}
|
|
9998
9998
|
}
|
|
@@ -10027,7 +10027,7 @@ const St = {
|
|
|
10027
10027
|
);
|
|
10028
10028
|
});
|
|
10029
10029
|
await Promise.all(h);
|
|
10030
|
-
},
|
|
10030
|
+
}, Io = async (n, e, t, s, r, i, o, a, l) => {
|
|
10031
10031
|
const c = s.at(-2);
|
|
10032
10032
|
i.fields ||= r.collections[c].fields.filter((f) => K(f));
|
|
10033
10033
|
const u = i.depth - 1, h = [];
|
|
@@ -10037,14 +10037,14 @@ const St = {
|
|
|
10037
10037
|
if (!d)
|
|
10038
10038
|
continue;
|
|
10039
10039
|
for (const [m, O] of Object.entries(d)) {
|
|
10040
|
-
const y =
|
|
10040
|
+
const y = at(O.Collection_Path, m, {
|
|
10041
10041
|
user: o,
|
|
10042
10042
|
providedTransaction: e,
|
|
10043
10043
|
noComputedFields: a,
|
|
10044
10044
|
noEmbeddingFields: l
|
|
10045
10045
|
}).then((w) => {
|
|
10046
10046
|
if (d[m] = w, u > 0)
|
|
10047
|
-
return
|
|
10047
|
+
return Io(
|
|
10048
10048
|
n,
|
|
10049
10049
|
e,
|
|
10050
10050
|
// eslint-disable-next-line security/detect-object-injection
|
|
@@ -10066,16 +10066,16 @@ const St = {
|
|
|
10066
10066
|
}
|
|
10067
10067
|
}
|
|
10068
10068
|
await Promise.all(h);
|
|
10069
|
-
},
|
|
10069
|
+
}, at = async (n, e, t) => {
|
|
10070
10070
|
if (t?.subcollections?.depth && t.subcollections.depth > 10)
|
|
10071
10071
|
throw new Error("INPUT_ERROR: Subcollections depth cannot exceed 10");
|
|
10072
10072
|
if (t?.relations?.depth && t.relations.depth > 10)
|
|
10073
10073
|
throw new Error("INPUT_ERROR: Relations depth cannot exceed 10");
|
|
10074
|
-
const s =
|
|
10074
|
+
const s = Ye(), r = ue();
|
|
10075
10075
|
let i;
|
|
10076
10076
|
const o = async (a) => {
|
|
10077
10077
|
const [l, c, u] = await Promise.all([
|
|
10078
|
-
t?.user ? a.get(r.collection("system_user_permissions").doc(t.user)) : Promise.resolve(Promise.resolve({})),
|
|
10078
|
+
t?.user ? a.get(r.collection("tenants").doc(s).collection("system_user_permissions").doc(t.user)) : Promise.resolve(Promise.resolve({})),
|
|
10079
10079
|
a.get(r.collection("system_deployment").doc("maintenance_mode")),
|
|
10080
10080
|
Ge(!0)
|
|
10081
10081
|
]);
|
|
@@ -10085,13 +10085,13 @@ const St = {
|
|
|
10085
10085
|
throw new Error("MAINTENANCE_MODE");
|
|
10086
10086
|
const f = u;
|
|
10087
10087
|
let d;
|
|
10088
|
-
const m =
|
|
10088
|
+
const m = Ut(), O = n.at(-1);
|
|
10089
10089
|
if (!O)
|
|
10090
10090
|
throw new Error("EMPTY_PATH");
|
|
10091
10091
|
const y = Object.keys(f.collections).includes(O), w = m.disabledCollections?.includes(O);
|
|
10092
10092
|
if (!y || w)
|
|
10093
10093
|
throw new Error("COLLECTION_NOT_FOUND");
|
|
10094
|
-
const b = f.collections[O], { labels: N } = b, p =
|
|
10094
|
+
const b = f.collections[O], { labels: N } = b, p = Je(N.collection, f);
|
|
10095
10095
|
let T;
|
|
10096
10096
|
if (t?.user) {
|
|
10097
10097
|
if (!l?.exists)
|
|
@@ -10126,10 +10126,10 @@ const St = {
|
|
|
10126
10126
|
throw new Error(`SCHEMA_ERROR: Field ${R} not found in collection ${O}`);
|
|
10127
10127
|
}
|
|
10128
10128
|
return R;
|
|
10129
|
-
})), _.push(
|
|
10129
|
+
})), _.push(Io(s, a, i, A, f, t.relations, t.user, t.noComputedFields, t.noEmbeddingFields))), await Promise.all(_), !t?.noComputedFields) {
|
|
10130
10130
|
for (const R of b.fields)
|
|
10131
10131
|
if (R.type === "Computed") {
|
|
10132
|
-
const F =
|
|
10132
|
+
const F = Ie(R, p);
|
|
10133
10133
|
if (!F.formula)
|
|
10134
10134
|
continue;
|
|
10135
10135
|
i[R.name] = await F.formula(i);
|
|
@@ -10143,7 +10143,7 @@ const St = {
|
|
|
10143
10143
|
if (!(p.custom?.serverAccess?.read !== void 0 ? await ie(p.custom?.serverAccess?.read, [R, i]) : !0))
|
|
10144
10144
|
throw new Error("PERMISSION_DENIED");
|
|
10145
10145
|
for (const M of b.fields) {
|
|
10146
|
-
const P = !M.access || M.access.includes(R), j =
|
|
10146
|
+
const P = !M.access || M.access.includes(R), j = Ie(M, p), Q = j?.custom?.serverAccess?.read !== void 0 ? await ie(j.custom.serverAccess.read, [R, i]) : !0;
|
|
10147
10147
|
(!P || !Q) && (K(M) ? (delete i[M.name], delete i[`${M.name}_Array`], delete i[`${M.name}_Single`]) : delete i[M.name]);
|
|
10148
10148
|
}
|
|
10149
10149
|
}
|
|
@@ -10152,13 +10152,13 @@ const St = {
|
|
|
10152
10152
|
return t?.providedTransaction ? await o(t.providedTransaction) : await r.runTransaction(async (a) => {
|
|
10153
10153
|
await o(a);
|
|
10154
10154
|
}, { readOnly: !0 }), i;
|
|
10155
|
-
},
|
|
10156
|
-
const l = ue(), c =
|
|
10155
|
+
}, Do = async (n, e, t, s, r, i, o, a) => {
|
|
10156
|
+
const l = ue(), c = Je(r.labels.collection, i), u = r.labels.collection, h = r.fields.filter((d) => "unique" in d && d.unique), f = [];
|
|
10157
10157
|
if (await Promise.all(h.map(async (d) => {
|
|
10158
10158
|
{
|
|
10159
10159
|
if (s[d.name] === void 0 || Me(s[d.name]))
|
|
10160
10160
|
return;
|
|
10161
|
-
|
|
10161
|
+
Ie(d, c);
|
|
10162
10162
|
const m = s[d.name].toString().toLowerCase().replace(/\s/g, "---").replaceAll("/", "|||");
|
|
10163
10163
|
if (!Qs(m))
|
|
10164
10164
|
f.push(`${d.name} "${s[d.name]}" is invalid`);
|
|
@@ -10169,8 +10169,8 @@ const St = {
|
|
|
10169
10169
|
}
|
|
10170
10170
|
})), f.length > 0)
|
|
10171
10171
|
throw new Error(f.join(", "));
|
|
10172
|
-
},
|
|
10173
|
-
const { labels: c } = o, u = ue(), h =
|
|
10172
|
+
}, Mt = async (n, e, t, s, r, i, o, a, l) => {
|
|
10173
|
+
const { labels: c } = o, u = ue(), h = Ut(), f = await ie(h.firebase?.writeLogTTL), d = {
|
|
10174
10174
|
operation: n,
|
|
10175
10175
|
collection: c.collection,
|
|
10176
10176
|
docId: i,
|
|
@@ -10186,35 +10186,35 @@ const St = {
|
|
|
10186
10186
|
};
|
|
10187
10187
|
if (f) {
|
|
10188
10188
|
const w = /* @__PURE__ */ new Date(), b = new Date((/* @__PURE__ */ new Date()).setDate(w.getDate() + f));
|
|
10189
|
-
d.TTL =
|
|
10189
|
+
d.TTL = lt.fromDate(b);
|
|
10190
10190
|
}
|
|
10191
10191
|
const m = ye(t);
|
|
10192
|
-
|
|
10193
|
-
const O =
|
|
10192
|
+
nt(m), n !== "delete" && (d.data.data = ye(m)), n === "update" && (d.data.originalRecord = ye(l)), n !== "delete" && ["started", "written"].includes(e) && (delete d.data.data.Saved_At, delete d.data.data.Last_Save_At), e === "failed" && (d.data.error = JSON.stringify(a));
|
|
10193
|
+
const O = De(u, r, s), y = t.Last_Write_At;
|
|
10194
10194
|
await O.doc(i).collection("system_write_log").doc(`${t.Last_Write_By}-${y.valueOf()}`).set(d);
|
|
10195
10195
|
}, un = async (n) => {
|
|
10196
|
-
const e =
|
|
10196
|
+
const e = Ye(), t = gt(), s = ue(), r = [];
|
|
10197
10197
|
if (await Promise.all([
|
|
10198
10198
|
(async () => {
|
|
10199
10199
|
try {
|
|
10200
|
-
await
|
|
10201
|
-
} catch (
|
|
10202
|
-
|
|
10203
|
-
${
|
|
10200
|
+
await s.collection("tenants").doc(e).collection("system_user_permissions").doc(n.User_ID).delete();
|
|
10201
|
+
} catch (i) {
|
|
10202
|
+
r.push(`Error deleting user permissions:
|
|
10203
|
+
${i}`);
|
|
10204
10204
|
}
|
|
10205
10205
|
})(),
|
|
10206
10206
|
(async () => {
|
|
10207
10207
|
try {
|
|
10208
|
-
await
|
|
10209
|
-
} catch (
|
|
10210
|
-
if (
|
|
10208
|
+
await t.deleteUser(n.User_ID);
|
|
10209
|
+
} catch (i) {
|
|
10210
|
+
if (i.code === "auth/user-not-found")
|
|
10211
10211
|
return;
|
|
10212
|
-
|
|
10213
|
-
${
|
|
10212
|
+
r.push(`Error deleting user:
|
|
10213
|
+
${i}`);
|
|
10214
10214
|
}
|
|
10215
10215
|
})()
|
|
10216
|
-
]),
|
|
10217
|
-
throw new Error(
|
|
10216
|
+
]), r.length > 0)
|
|
10217
|
+
throw new Error(r.join(", "));
|
|
10218
10218
|
}, Ao = async (n, e, t, s, r, i, o, a, l) => {
|
|
10219
10219
|
const c = ue(), u = bo(), h = process.env.ADMIN_EMAIL;
|
|
10220
10220
|
if (u === "development" || process.env.FIRESTORE_EMULATOR_HOST)
|
|
@@ -10236,7 +10236,7 @@ ${r}`);
|
|
|
10236
10236
|
}
|
|
10237
10237
|
b && (T.replyTo = b), a && (T.message.attachments = a), N && (T.from = N), await c.collection("system_mail").add(T);
|
|
10238
10238
|
}, Co = async (n, e, t, s, r, i, o) => {
|
|
10239
|
-
const a =
|
|
10239
|
+
const a = gt(), l = ue(), c = "USER_ERROR", u = async (d, m) => {
|
|
10240
10240
|
try {
|
|
10241
10241
|
await un(d);
|
|
10242
10242
|
} catch {
|
|
@@ -10267,13 +10267,12 @@ ${r}`);
|
|
|
10267
10267
|
throw await u(r, c), new Error(c);
|
|
10268
10268
|
}
|
|
10269
10269
|
try {
|
|
10270
|
-
await l.collection("system_user_permissions").doc(h.uid).set({
|
|
10270
|
+
await l.collection("tenants").doc(n).collection("system_user_permissions").doc(h.uid).set({
|
|
10271
10271
|
...i,
|
|
10272
10272
|
Role: r.Role,
|
|
10273
10273
|
Enabled: r.Enabled ?? !1,
|
|
10274
10274
|
Collection: s,
|
|
10275
|
-
Doc_ID: e
|
|
10276
|
-
Tenant_ID: n
|
|
10275
|
+
Doc_ID: e
|
|
10277
10276
|
});
|
|
10278
10277
|
} catch {
|
|
10279
10278
|
throw await u(r, c), new Error(c);
|
|
@@ -10309,7 +10308,7 @@ ${r}`);
|
|
|
10309
10308
|
const r = n.at(-2);
|
|
10310
10309
|
if (!r)
|
|
10311
10310
|
throw new Error("PERMISSION_DENIED");
|
|
10312
|
-
const i = [...n].slice(0, -2), o = await
|
|
10311
|
+
const i = [...n].slice(0, -2), o = await at(i, r).catch(() => {
|
|
10313
10312
|
throw new Error("PERMISSION_DENIED");
|
|
10314
10313
|
}), a = o.Collection_Path;
|
|
10315
10314
|
if (a.push(o.id), a.push(t.collection), !ze(n, a))
|
|
@@ -10319,14 +10318,14 @@ ${r}`);
|
|
|
10319
10318
|
}, Un = (n) => n !== null && typeof n == "object" && !Array.isArray(n), du = (n) => {
|
|
10320
10319
|
const e = (t) => {
|
|
10321
10320
|
Object.entries(t).forEach(([s, r]) => {
|
|
10322
|
-
Un(r) && Object.keys(r).length === 2 && typeof r.seconds == "number" && typeof r.nanoseconds == "number" ? t[s] = new
|
|
10321
|
+
Un(r) && Object.keys(r).length === 2 && typeof r.seconds == "number" && typeof r.nanoseconds == "number" ? t[s] = new lt(r.seconds, r.nanoseconds) : Un(r) && e(r);
|
|
10323
10322
|
});
|
|
10324
10323
|
};
|
|
10325
10324
|
e(n);
|
|
10326
10325
|
}, $o = (n) => {
|
|
10327
10326
|
const e = (t) => {
|
|
10328
10327
|
Object.entries(t).forEach(([s, r]) => {
|
|
10329
|
-
Un(r) && Object.keys(r).length === 2 && typeof r._seconds == "number" && typeof r._nanoseconds == "number" ? t[s] = new
|
|
10328
|
+
Un(r) && Object.keys(r).length === 2 && typeof r._seconds == "number" && typeof r._nanoseconds == "number" ? t[s] = new lt(r._seconds, r._nanoseconds) : Un(r) && e(r);
|
|
10330
10329
|
});
|
|
10331
10330
|
};
|
|
10332
10331
|
e(n);
|
|
@@ -10341,7 +10340,7 @@ ${r}`);
|
|
|
10341
10340
|
if (e[r] !== void 0) {
|
|
10342
10341
|
s[r] = e[r];
|
|
10343
10342
|
const i = W(n.fields, r);
|
|
10344
|
-
|
|
10343
|
+
wt(n, [i]).size === 1 && (s[`${r}_Lowercase`] = e[`${r}_Lowercase`]);
|
|
10345
10344
|
}
|
|
10346
10345
|
}), s;
|
|
10347
10346
|
}
|
|
@@ -10355,7 +10354,7 @@ ${r}`);
|
|
|
10355
10354
|
const [u, h] = c[0];
|
|
10356
10355
|
if (!h)
|
|
10357
10356
|
throw new Error(`VALIDATION_ERROR: Relation ${t.name} is required`);
|
|
10358
|
-
const f =
|
|
10357
|
+
const f = De(l, h.Collection_Path, n);
|
|
10359
10358
|
if (i.size++, !o && i.size > 500)
|
|
10360
10359
|
throw new Error("VALIDATION ERROR: The number of operations in the Firestore transaction has exceeded the limit of 500. This is likely due to a large number of unique field checks, entity restrictions (in permissions when dealing with user collections) or relation hierarchy checks.");
|
|
10361
10360
|
const d = await r.get(f.doc(u));
|
|
@@ -10379,7 +10378,7 @@ ${r}`);
|
|
|
10379
10378
|
K(w) && ["OneToOne", "OneToMany"].includes(w.type) && w.enforceHierarchy && s[w.name] && (n === "Create" || n === "Update" && !ze(h?.[w.name], s[w.name])) && await Kr(e, i, w, s, a, l);
|
|
10380
10379
|
for (const w of f)
|
|
10381
10380
|
if (K(w) && w.twoWay) {
|
|
10382
|
-
const b = o.collections[w.collection], N = W(b.fields, w.twoWay), p =
|
|
10381
|
+
const b = o.collections[w.collection], N = W(b.fields, w.twoWay), p = ft(b, [N]);
|
|
10383
10382
|
if (s[w.name]) {
|
|
10384
10383
|
const T = Object.entries(s[w.name]);
|
|
10385
10384
|
for (const C of T) {
|
|
@@ -10392,7 +10391,7 @@ ${r}`);
|
|
|
10392
10391
|
else {
|
|
10393
10392
|
if (l.size++, l && l.size > 500)
|
|
10394
10393
|
throw new Error("VALIDATION_ERROR: The number of operations in the Firestore transaction has exceeded the limit of 500. This is likely due to a large number of two way updates, unique field checks, entity restrictions (in permissions when dealing with user collections) or relation hierarchy checks.");
|
|
10395
|
-
const _ =
|
|
10394
|
+
const _ = De(d, Z.Collection_Path, e), A = await a.get(_.doc(v));
|
|
10396
10395
|
if (!A.exists) {
|
|
10397
10396
|
gn(w, r, v);
|
|
10398
10397
|
continue;
|
|
@@ -10429,7 +10428,7 @@ ${r}`);
|
|
|
10429
10428
|
else {
|
|
10430
10429
|
if (l.size++, l && l.size > 500)
|
|
10431
10430
|
throw new Error("VALIDATION_ERROR: The number of operations in the Firestore transaction has exceeded the limit of 500. This is likely due to a large number of two way updates, unique field checks, entity restrictions (in permissions when dealing with user collections) or relation hierarchy checks.");
|
|
10432
|
-
const k =
|
|
10431
|
+
const k = De(d, Z.Collection_Path, e), _ = await a.get(k.doc(v));
|
|
10433
10432
|
if (!_.exists) {
|
|
10434
10433
|
m.set(w.name, [...m.get(w.name) || [], v]);
|
|
10435
10434
|
continue;
|
|
@@ -10449,7 +10448,7 @@ ${r}`);
|
|
|
10449
10448
|
}
|
|
10450
10449
|
}
|
|
10451
10450
|
for (const [w, b] of y.entries()) {
|
|
10452
|
-
const N = o.collections[w], p =
|
|
10451
|
+
const N = o.collections[w], p = Je(w, o);
|
|
10453
10452
|
for (const [T, C] of Object.entries(b)) {
|
|
10454
10453
|
const { addedFields: v, removedFields: Z } = Vc(n, T, w, i, s, h);
|
|
10455
10454
|
if (c && u) {
|
|
@@ -10461,7 +10460,7 @@ ${r}`);
|
|
|
10461
10460
|
}
|
|
10462
10461
|
}
|
|
10463
10462
|
for (const x of Z) {
|
|
10464
|
-
const g = W(N.fields, x.twoWay), k =
|
|
10463
|
+
const g = W(N.fields, x.twoWay), k = ft(N, [g]);
|
|
10465
10464
|
if (!sr(N, g, u)) {
|
|
10466
10465
|
ps(
|
|
10467
10466
|
x,
|
|
@@ -10474,7 +10473,7 @@ ${r}`);
|
|
|
10474
10473
|
continue;
|
|
10475
10474
|
}
|
|
10476
10475
|
}
|
|
10477
|
-
if (!
|
|
10476
|
+
if (!it(
|
|
10478
10477
|
"Update",
|
|
10479
10478
|
N,
|
|
10480
10479
|
o,
|
|
@@ -10486,7 +10485,7 @@ ${r}`);
|
|
|
10486
10485
|
for (const x of v)
|
|
10487
10486
|
gn(x, r, T);
|
|
10488
10487
|
for (const x of Z) {
|
|
10489
|
-
const g = W(N.fields, x.twoWay), k =
|
|
10488
|
+
const g = W(N.fields, x.twoWay), k = ft(N, [g]);
|
|
10490
10489
|
ps(
|
|
10491
10490
|
x,
|
|
10492
10491
|
r,
|
|
@@ -10497,11 +10496,11 @@ ${r}`);
|
|
|
10497
10496
|
);
|
|
10498
10497
|
}
|
|
10499
10498
|
}
|
|
10500
|
-
if (!
|
|
10499
|
+
if (!it("Update", N, o, c, u, C)) {
|
|
10501
10500
|
for (const x of v)
|
|
10502
10501
|
gn(x, r, T);
|
|
10503
10502
|
for (const x of Z) {
|
|
10504
|
-
const g = W(N.fields, x.twoWay), k =
|
|
10503
|
+
const g = W(N.fields, x.twoWay), k = ft(N, [g]);
|
|
10505
10504
|
ps(
|
|
10506
10505
|
x,
|
|
10507
10506
|
r,
|
|
@@ -10514,7 +10513,7 @@ ${r}`);
|
|
|
10514
10513
|
}
|
|
10515
10514
|
}
|
|
10516
10515
|
try {
|
|
10517
|
-
await
|
|
10516
|
+
await sn("update", C, N, p, ["update", C, {}, void 0, C], o);
|
|
10518
10517
|
} catch (x) {
|
|
10519
10518
|
throw new Error(`VALIDATION_ERROR: Two way relation update would invalidate record ${T} in ${w}: ${x.message}`);
|
|
10520
10519
|
}
|
|
@@ -10526,13 +10525,13 @@ ${r}`);
|
|
|
10526
10525
|
}
|
|
10527
10526
|
return m;
|
|
10528
10527
|
}, Fo = (n, e, t) => {
|
|
10529
|
-
n === "create" &&
|
|
10528
|
+
n === "create" && pt.forEach((s) => {
|
|
10530
10529
|
if (!ze(e[s], t[s]))
|
|
10531
10530
|
throw new Error(`Updating system fields in hooks is not allowed: ${s}`);
|
|
10532
10531
|
}), n === "update" && (["id", "Collection_Path", "Created_At", "Saved_At", "Created_By"].forEach((s) => {
|
|
10533
10532
|
if (s in e)
|
|
10534
10533
|
throw new Error(`Cannot update system field: ${s}`);
|
|
10535
|
-
}),
|
|
10534
|
+
}), pt.forEach((s) => {
|
|
10536
10535
|
if (!["id", "Collection_Path", "Created_At", "Saved_At", "Created_By"].includes(s) && !ze(e[s], t[s]))
|
|
10537
10536
|
throw new Error(`Updating system fields in hooks is not allowed: ${s}`);
|
|
10538
10537
|
}));
|
|
@@ -10556,7 +10555,7 @@ ${r}`);
|
|
|
10556
10555
|
if (!Te("Read", r.collections?.[e.labels.collection]))
|
|
10557
10556
|
return !1;
|
|
10558
10557
|
try {
|
|
10559
|
-
await
|
|
10558
|
+
await at([e.labels.collection], t, { user: s, providedTransaction: n });
|
|
10560
10559
|
} catch {
|
|
10561
10560
|
return !1;
|
|
10562
10561
|
}
|
|
@@ -10626,30 +10625,30 @@ ${r}`);
|
|
|
10626
10625
|
}
|
|
10627
10626
|
}
|
|
10628
10627
|
}, fu = async (n, e, t, s, r, i, o) => {
|
|
10629
|
-
const a =
|
|
10628
|
+
const a = Ye(), l = Ut();
|
|
10630
10629
|
let c = await Ge();
|
|
10631
10630
|
if (n.length === 0)
|
|
10632
10631
|
throw new Error("EMPTY_PATH");
|
|
10633
10632
|
const u = n.at(-1), h = Object.keys(c.collections).includes(u), f = l.disabledCollections?.includes(u);
|
|
10634
10633
|
if (!h || f)
|
|
10635
10634
|
throw new Error("COLLECTION_NOT_FOUND");
|
|
10636
|
-
const d = c.collections[u], { labels: m, fields: O, enableWriteLog: y, softDelete: w } = d, b =
|
|
10635
|
+
const d = c.collections[u], { labels: m, fields: O, enableWriteLog: y, softDelete: w } = d, b = Je(m.collection, c), N = await ie(l.appName), p = ue(), T = gt(), v = (s ? await T.getUser(s) : void 0)?.customClaims?.role;
|
|
10637
10636
|
let Z;
|
|
10638
10637
|
s && await Xs(n, d);
|
|
10639
|
-
const x =
|
|
10638
|
+
const x = De(p, n, a), g = o || x.doc().id;
|
|
10640
10639
|
i = i || {}, i.collection = m.collection, e.id = g, $o(e), er(e);
|
|
10641
|
-
const k = Us("create", n, e, c, N, "Online", s || "System",
|
|
10642
|
-
w && (k[w.archivedField] = !1), Ve(e), y && await
|
|
10640
|
+
const k = Us("create", n, e, c, N, "Online", s || "System", lt.now(), me.serverTimestamp()), _ = ye(k);
|
|
10641
|
+
w && (k[w.archivedField] = !1), Ve(e), y && await Mt("create", "started", k, a, n, g, d), await ae("preOperation", l, b, ["create", k, g, i]), await ae("preWrite", l, b, ["create", k, g, i]), Sn(d, k, c), Tn(d, k), await ra(k, d, b, v), Ve(k);
|
|
10643
10642
|
try {
|
|
10644
10643
|
if (d.auth && t && !t.password)
|
|
10645
10644
|
throw new Error("Password is required");
|
|
10646
|
-
await
|
|
10645
|
+
await Do("create", a, g, k, d, c), await sn("create", k, d, b, ["create", k, i], c);
|
|
10647
10646
|
} catch (P) {
|
|
10648
10647
|
throw new Error(`VALIDATION_ERROR: ${P.message}`);
|
|
10649
10648
|
}
|
|
10650
10649
|
Ve(k), e.id = g, w && (k[w.archivedField] = !1), Sn(d, k, c), Tn(d, k);
|
|
10651
10650
|
try {
|
|
10652
|
-
Fo("create", k, _), Po("create", d, k), await
|
|
10651
|
+
Fo("create", k, _), Po("create", d, k), await sn("create", k, d, b, ["create", k, i], c);
|
|
10653
10652
|
} catch (P) {
|
|
10654
10653
|
throw new Error(`VALIDATION_ERROR: ${P.message}`);
|
|
10655
10654
|
}
|
|
@@ -10662,17 +10661,17 @@ ${r}`);
|
|
|
10662
10661
|
for (const Q of d.fields) {
|
|
10663
10662
|
if (!(Q.name in k))
|
|
10664
10663
|
continue;
|
|
10665
|
-
const S =
|
|
10664
|
+
const S = Ie(Q, b);
|
|
10666
10665
|
if (S?.custom?.serverAccess?.create !== void 0 && !await ie(S.custom.serverAccess.create, [P, k]))
|
|
10667
10666
|
throw new Error("PERMISSION_DENIED");
|
|
10668
10667
|
}
|
|
10669
10668
|
}
|
|
10670
10669
|
t && (t.permissions ||= {}, t.permissions.Role ||= k.Role, t.permissions.Enabled ||= k.Enabled);
|
|
10671
|
-
const
|
|
10670
|
+
const D = async (P, j) => {
|
|
10672
10671
|
const [Q, S, q, B] = await Promise.all([
|
|
10673
10672
|
P.get(p.collection("system_deployment").doc("latest_deploy")),
|
|
10674
10673
|
P.get(p.collection("system_deployment").doc("maintenance_mode")),
|
|
10675
|
-
s ? P.get(p.collection("system_user_permissions").doc(s)) : Promise.resolve(Promise.resolve({})),
|
|
10674
|
+
s ? P.get(p.collection("tenants").doc(a).collection("system_user_permissions").doc(s)) : Promise.resolve(Promise.resolve({})),
|
|
10676
10675
|
Ge()
|
|
10677
10676
|
]);
|
|
10678
10677
|
if (j && (j.size += 3), !Q.exists)
|
|
@@ -10696,7 +10695,7 @@ ${r}`);
|
|
|
10696
10695
|
if (!s || !oe.access || oe.access.includes(Z.Role)) {
|
|
10697
10696
|
if (!e[oe.name])
|
|
10698
10697
|
return;
|
|
10699
|
-
const Le =
|
|
10698
|
+
const Le = Ie(oe, b);
|
|
10700
10699
|
if (!(s && Le?.custom?.serverAccess?.read !== void 0 ? await ie(Le.custom.serverAccess.read, [
|
|
10701
10700
|
Z?.Role,
|
|
10702
10701
|
k
|
|
@@ -10716,7 +10715,7 @@ ${r}`);
|
|
|
10716
10715
|
};
|
|
10717
10716
|
if (d.auth && t) {
|
|
10718
10717
|
await p.runTransaction(async (j) => {
|
|
10719
|
-
await
|
|
10718
|
+
await D(j);
|
|
10720
10719
|
}, { maxAttempts: 10 });
|
|
10721
10720
|
const P = await Co(
|
|
10722
10721
|
a,
|
|
@@ -10733,24 +10732,24 @@ ${r}`);
|
|
|
10733
10732
|
try {
|
|
10734
10733
|
const P = { size: 1 };
|
|
10735
10734
|
await p.runTransaction(async (j) => {
|
|
10736
|
-
await
|
|
10735
|
+
await D(j, P), r?.noTwoWay || await Mo("Create", a, g, k, k, d, c, j, P, s, Z);
|
|
10737
10736
|
const Q = Vs(c);
|
|
10738
|
-
Js("create", j, n, g, k, c, d, r, Q, me.arrayUnion, me.arrayRemove, me.delete, (S) => p.collection("tenants").doc(a).collection("system_fields").doc(m.collection).collection(`${m.collection}-${S.name}`).doc(g), (S, q) => p.collection("tenants").doc(a).collection("system_unique").doc(m.collection).collection(`Unique-${m.collection}-${S.name}`).doc(q), (S) => p.collection("tenants").doc(a).collection("system_fields").doc(m.collection).collection(`${m.collection}-${S}`).doc(g), (S, q) =>
|
|
10737
|
+
Js("create", j, n, g, k, c, d, r, Q, me.arrayUnion, me.arrayRemove, me.delete, (S) => p.collection("tenants").doc(a).collection("system_fields").doc(m.collection).collection(`${m.collection}-${S.name}`).doc(g), (S, q) => p.collection("tenants").doc(a).collection("system_unique").doc(m.collection).collection(`Unique-${m.collection}-${S.name}`).doc(q), (S) => p.collection("tenants").doc(a).collection("system_fields").doc(m.collection).collection(`${m.collection}-${S}`).doc(g), (S, q) => De(p, S, a).doc(q), (S, q, B) => p.collection("tenants").doc(a).collection("system_fields").doc(S.collection).collection(`${S.collection}-${q}`).doc(B), (S, q, B) => p.collection("tenants").doc(a).collection("system_fields").doc(S.collection).collection(`${S.collection}-${q.replaceAll(" ", "-")}`).doc(B), void 0, void 0, P), j.set(x.doc(g), k);
|
|
10739
10738
|
}, { maxAttempts: 10 });
|
|
10740
10739
|
} catch (P) {
|
|
10741
10740
|
const Q = await ae("postWriteError", l, b, ["create", k, g, i, P]);
|
|
10742
10741
|
if (y && (await new Promise((S) => {
|
|
10743
10742
|
setTimeout(S, 250);
|
|
10744
|
-
}), await
|
|
10743
|
+
}), await Mt("create", Q?.resolved ? "success" : "failed", k, a, n, g, d, Q?.resolved ? void 0 : P)), !Q?.resolved)
|
|
10745
10744
|
throw d.auth && t && await un(k), P;
|
|
10746
10745
|
}
|
|
10747
10746
|
const R = ["create", k, g, i], F = [...R];
|
|
10748
10747
|
return await ae("postWrite", l, b, R), await ae("postOperation", l, b, F), { id: g, ...k };
|
|
10749
|
-
},
|
|
10750
|
-
const r =
|
|
10751
|
-
let
|
|
10748
|
+
}, Qt = async (n, e, t, s) => {
|
|
10749
|
+
const r = Ye(), i = gt(), o = ue(), a = e.customClaims || {};
|
|
10750
|
+
let l = !1;
|
|
10752
10751
|
try {
|
|
10753
|
-
await
|
|
10752
|
+
await i.updateUser(n, {
|
|
10754
10753
|
email: e.email,
|
|
10755
10754
|
disabled: e.disabled,
|
|
10756
10755
|
displayName: e.displayName,
|
|
@@ -10758,30 +10757,30 @@ ${r}`);
|
|
|
10758
10757
|
emailVerified: !!e.emailVerified
|
|
10759
10758
|
});
|
|
10760
10759
|
} catch {
|
|
10761
|
-
|
|
10760
|
+
l = !0;
|
|
10762
10761
|
}
|
|
10763
10762
|
try {
|
|
10764
|
-
await
|
|
10765
|
-
...
|
|
10763
|
+
await i.setCustomUserClaims(n, {
|
|
10764
|
+
...a
|
|
10766
10765
|
});
|
|
10767
10766
|
} catch {
|
|
10768
|
-
|
|
10767
|
+
l = !0;
|
|
10769
10768
|
}
|
|
10770
10769
|
try {
|
|
10771
|
-
await
|
|
10770
|
+
await o.collection("tenants").doc(r).collection("system_user_permissions").doc(n).update({
|
|
10772
10771
|
...t,
|
|
10773
|
-
Collection:
|
|
10774
|
-
Doc_ID:
|
|
10775
|
-
Role:
|
|
10772
|
+
Collection: a.collection,
|
|
10773
|
+
Doc_ID: a.doc,
|
|
10774
|
+
Role: a.role,
|
|
10776
10775
|
Enabled: !e.disabled
|
|
10777
10776
|
});
|
|
10778
10777
|
} catch {
|
|
10779
|
-
|
|
10778
|
+
l = !0;
|
|
10780
10779
|
}
|
|
10781
|
-
if (
|
|
10780
|
+
if (l)
|
|
10782
10781
|
throw new Error(`ROLLBACK_FAILED: ${s}`);
|
|
10783
10782
|
}, jc = async (n, e, t, s, r, i, o, a, l, c, u) => {
|
|
10784
|
-
const h =
|
|
10783
|
+
const h = gt(), f = ue(), d = a?.customClaims || {}, m = "USER_ERROR";
|
|
10785
10784
|
let O = "";
|
|
10786
10785
|
if (n === "create") {
|
|
10787
10786
|
if (!u)
|
|
@@ -10801,7 +10800,7 @@ ${r}`);
|
|
|
10801
10800
|
try {
|
|
10802
10801
|
await h.updateUser(o.User_ID, y), y.disabled === !0 && await h.revokeRefreshTokens(o.User_ID);
|
|
10803
10802
|
} catch {
|
|
10804
|
-
throw await
|
|
10803
|
+
throw await Qt(o.User_ID, a, c, m), new Error(m);
|
|
10805
10804
|
}
|
|
10806
10805
|
if (i.Role && i.Role !== o.Role)
|
|
10807
10806
|
try {
|
|
@@ -10810,19 +10809,18 @@ ${r}`);
|
|
|
10810
10809
|
role: i.Role
|
|
10811
10810
|
}), await h.revokeRefreshTokens(o.User_ID);
|
|
10812
10811
|
} catch {
|
|
10813
|
-
throw await
|
|
10812
|
+
throw await Qt(o.User_ID, a, c, m), new Error(m);
|
|
10814
10813
|
}
|
|
10815
10814
|
try {
|
|
10816
|
-
await f.collection("system_user_permissions").doc(o.User_ID).set({
|
|
10815
|
+
await f.collection("tenants").doc(e).collection("system_user_permissions").doc(o.User_ID).set({
|
|
10817
10816
|
...l || c,
|
|
10818
|
-
Tenant_ID: d.tenant,
|
|
10819
10817
|
Collection: d.collection,
|
|
10820
10818
|
Doc_ID: d.doc,
|
|
10821
10819
|
Role: i.Role,
|
|
10822
10820
|
Enabled: i.Enabled ?? o.Enabled ?? !1
|
|
10823
10821
|
});
|
|
10824
10822
|
} catch {
|
|
10825
|
-
throw await
|
|
10823
|
+
throw await Qt(o.User_ID, a, c, m), new Error(m);
|
|
10826
10824
|
}
|
|
10827
10825
|
if (o.Email !== i.Email) {
|
|
10828
10826
|
const w = s.auth.enableMultiFactorAuth;
|
|
@@ -10842,7 +10840,7 @@ ${r}`);
|
|
|
10842
10840
|
</br>
|
|
10843
10841
|
<a href="${N}">${N}</a>`);
|
|
10844
10842
|
} catch {
|
|
10845
|
-
throw await
|
|
10843
|
+
throw await Qt(o.User_ID, a, c, m), new Error(m);
|
|
10846
10844
|
}
|
|
10847
10845
|
}
|
|
10848
10846
|
}
|
|
@@ -10856,40 +10854,40 @@ ${r}`);
|
|
|
10856
10854
|
if (O)
|
|
10857
10855
|
return O;
|
|
10858
10856
|
}, Zc = async (n, e, t) => {
|
|
10859
|
-
const s =
|
|
10860
|
-
t && t.trim() !== "" &&
|
|
10861
|
-
const
|
|
10862
|
-
for (const
|
|
10863
|
-
const
|
|
10864
|
-
if ((await n.get(
|
|
10857
|
+
const s = Ye(), r = ue(), i = [e];
|
|
10858
|
+
t && t.trim() !== "" && i.push(t), i.sort();
|
|
10859
|
+
const o = [];
|
|
10860
|
+
for (const a of i) {
|
|
10861
|
+
const l = r.collection("tenants").doc(s).collection("system_locks").doc(a);
|
|
10862
|
+
if ((await n.get(l)).exists)
|
|
10865
10863
|
throw new Error("DOCUMENT_LOCKED");
|
|
10866
|
-
|
|
10864
|
+
o.push(l);
|
|
10867
10865
|
}
|
|
10868
|
-
for (const
|
|
10869
|
-
n.set(
|
|
10866
|
+
for (const a of o)
|
|
10867
|
+
n.set(a, { locked: !0 });
|
|
10870
10868
|
}, Xr = async (n, e) => {
|
|
10871
|
-
const t =
|
|
10872
|
-
e && e.trim() !== "" &&
|
|
10873
|
-
const
|
|
10874
|
-
for (const
|
|
10875
|
-
const
|
|
10876
|
-
|
|
10877
|
-
}
|
|
10878
|
-
await
|
|
10869
|
+
const t = Ye(), s = ue(), r = [n];
|
|
10870
|
+
e && e.trim() !== "" && r.push(e), r.sort();
|
|
10871
|
+
const i = s.batch();
|
|
10872
|
+
for (const o of r) {
|
|
10873
|
+
const a = s.collection("tenants").doc(t).collection("system_locks").doc(o);
|
|
10874
|
+
i.delete(a);
|
|
10875
|
+
}
|
|
10876
|
+
await i.commit();
|
|
10879
10877
|
}, zc = async (n, e, t, s, r, i, o) => {
|
|
10880
|
-
const a =
|
|
10878
|
+
const a = Ye(), l = Ut();
|
|
10881
10879
|
let c = await Ge(!0);
|
|
10882
10880
|
if (n.length === 0)
|
|
10883
10881
|
throw new Error("EMPTY_PATH");
|
|
10884
10882
|
const u = n.at(-1), h = Object.keys(c.collections).includes(u), f = l.disabledCollections?.includes(u);
|
|
10885
10883
|
if (!h || f)
|
|
10886
10884
|
throw new Error("COLLECTION_NOT_FOUND");
|
|
10887
|
-
const d = c.collections[u], { labels: m, fields: O, enableWriteLog: y } = d, w =
|
|
10885
|
+
const d = c.collections[u], { labels: m, fields: O, enableWriteLog: y } = d, w = Je(m.collection, c), b = await ie(l.appName), N = gt(), p = ue();
|
|
10888
10886
|
let T;
|
|
10889
10887
|
r && await Xs(n, d);
|
|
10890
|
-
const C =
|
|
10888
|
+
const C = De(p, n, a);
|
|
10891
10889
|
o = o || {}, o.collection = m.collection;
|
|
10892
|
-
let v = await
|
|
10890
|
+
let v = await at(n, e, {
|
|
10893
10891
|
user: r,
|
|
10894
10892
|
noComputedFields: !0,
|
|
10895
10893
|
noEmbeddingFields: !0
|
|
@@ -10913,10 +10911,10 @@ ${r}`);
|
|
|
10913
10911
|
throw new Error("VALIDATION_ERROR: Permissions are not allowed for delete operations");
|
|
10914
10912
|
const Z = d.auth && s?.operation === "create", x = d.auth && s?.operation === "delete", g = d.auth && !Z && !x && (s?.operation === "update" || t.Role || t.Enabled !== void 0 || t.Name || t.Email || t.Photo_URL), k = (S) => S.User_ID && (d.auth && !Z && !x && s?.operation === "update" || t.Role && t.Role !== S.Role || t.Enabled !== void 0 && t.Enabled !== S.Enabled || t.Name && t.Name !== S.Name || t.Email && t.Email !== S.Email || t.Photo_URL && t.Photo_URL !== S.Photo_URL);
|
|
10915
10913
|
delete t.id, $o(t), er(t);
|
|
10916
|
-
const _ = Us("update", n, t, c, b, "Online", r || "System",
|
|
10914
|
+
const _ = Us("update", n, t, c, b, "Online", r || "System", lt.now(), me.serverTimestamp()), A = ye(_);
|
|
10917
10915
|
for (const S of O)
|
|
10918
10916
|
!K(S) && Me(_[S.name]) && S.nullable && (_[S.name] = null);
|
|
10919
|
-
Ve(_), Ve(v), y && await
|
|
10917
|
+
Ve(_), Ve(v), y && await Mt("update", "started", _, a, n, e, d, void 0, v);
|
|
10920
10918
|
const E = [
|
|
10921
10919
|
"update",
|
|
10922
10920
|
_,
|
|
@@ -10926,13 +10924,13 @@ ${r}`);
|
|
|
10926
10924
|
ye(v)
|
|
10927
10925
|
];
|
|
10928
10926
|
await ae("preOperation", l, w, E);
|
|
10929
|
-
const
|
|
10930
|
-
await ae("preWrite", l, w,
|
|
10927
|
+
const D = ["update", _, e, o, void 0, ye(v)];
|
|
10928
|
+
await ae("preWrite", l, w, D), Sn(d, _, c), Tn(d, _), Ve(_);
|
|
10931
10929
|
try {
|
|
10932
10930
|
if (Z && !s.password)
|
|
10933
10931
|
throw new Error("Password is required");
|
|
10934
10932
|
const S = { ...v, ..._ };
|
|
10935
|
-
await
|
|
10933
|
+
await Do("update", a, e, S, d, c), nt(S), await sn("update", S, d, w, ["update", _, o, void 0, ye(v)], c);
|
|
10936
10934
|
} catch (S) {
|
|
10937
10935
|
throw new Error(`VALIDATION_ERROR: ${S.message}`);
|
|
10938
10936
|
}
|
|
@@ -10941,22 +10939,22 @@ ${r}`);
|
|
|
10941
10939
|
!K(S) && Me(_[S.name]) && S.nullable && (_[S.name] = null);
|
|
10942
10940
|
try {
|
|
10943
10941
|
const S = { ...v, ..._ };
|
|
10944
|
-
|
|
10942
|
+
nt(S), Po("update", d, _, v), Fo("update", _, A), await sn("update", S, d, w, ["update", _, o, void 0, v], c);
|
|
10945
10943
|
} catch (S) {
|
|
10946
10944
|
throw new Error(`VALIDATION_ERROR: ${S.message}`);
|
|
10947
10945
|
}
|
|
10948
10946
|
let R;
|
|
10949
10947
|
s && (s.permissions ||= {});
|
|
10950
10948
|
const F = async (S, q, B) => {
|
|
10951
|
-
const [re,
|
|
10949
|
+
const [re, Qe, Wt, pe, oe] = await Promise.all([
|
|
10952
10950
|
S.get(p.collection("system_deployment").doc("latest_deploy")),
|
|
10953
10951
|
S.get(p.collection("system_deployment").doc("maintenance_mode")),
|
|
10954
|
-
|
|
10952
|
+
at(n, e, {
|
|
10955
10953
|
user: r,
|
|
10956
10954
|
providedTransaction: S,
|
|
10957
10955
|
noComputedFields: !0
|
|
10958
10956
|
}),
|
|
10959
|
-
r ? S.get(p.collection("system_user_permissions").doc(r)) : Promise.resolve(Promise.resolve({})),
|
|
10957
|
+
r ? S.get(p.collection("tenants").doc(a).collection("system_user_permissions").doc(r)) : Promise.resolve(Promise.resolve({})),
|
|
10960
10958
|
Ge()
|
|
10961
10959
|
]);
|
|
10962
10960
|
if (B && (B.size += 3), !re.exists)
|
|
@@ -10964,13 +10962,13 @@ ${r}`);
|
|
|
10964
10962
|
const Le = re.data();
|
|
10965
10963
|
if (Le.force && _.Last_Write_At.valueOf() < Le.time.valueOf())
|
|
10966
10964
|
throw new Error("VERSION_ERROR");
|
|
10967
|
-
if (!
|
|
10965
|
+
if (!Qe.exists)
|
|
10968
10966
|
throw new Error("MAINTENANCE_MODE");
|
|
10969
|
-
if (
|
|
10967
|
+
if (Qe.data().active)
|
|
10970
10968
|
throw new Error("MAINTENANCE_MODE");
|
|
10971
|
-
if (!
|
|
10969
|
+
if (!Wt)
|
|
10972
10970
|
throw new Error("NOT_FOUND");
|
|
10973
|
-
if (v =
|
|
10971
|
+
if (v = Wt, c = oe, r) {
|
|
10974
10972
|
if (!pe?.exists)
|
|
10975
10973
|
throw new Error("PERMISSION_DENIED");
|
|
10976
10974
|
if (T = pe.data(), !T.Role)
|
|
@@ -10981,7 +10979,7 @@ ${r}`);
|
|
|
10981
10979
|
if (B && (B.size += To(a, n, e, c, T).length), Z && v.User_ID || x && !v.User_ID)
|
|
10982
10980
|
throw new Error("USER_ERROR");
|
|
10983
10981
|
if (k(v)) {
|
|
10984
|
-
const de = await S.get(p.collection("system_user_permissions").doc(v.User_ID));
|
|
10982
|
+
const de = await S.get(p.collection("tenants").doc(a).collection("system_user_permissions").doc(v.User_ID));
|
|
10985
10983
|
if (B && B.size++, !de?.exists)
|
|
10986
10984
|
throw new Error("PERMISSION_DENIED");
|
|
10987
10985
|
if (R = de.data(), s?.permissions) {
|
|
@@ -10995,17 +10993,17 @@ ${r}`);
|
|
|
10995
10993
|
if (!r || !de.access || de.access.includes(T.Role)) {
|
|
10996
10994
|
if (_[de.name] === void 0 || Me(_[de.name]))
|
|
10997
10995
|
return;
|
|
10998
|
-
const
|
|
10999
|
-
if (!(r &&
|
|
10996
|
+
const jt = Ie(de, w), nr = { ...v, ..._ };
|
|
10997
|
+
if (!(r && jt?.custom?.serverAccess?.read !== void 0 ? await ie(jt.custom.serverAccess.read, [
|
|
11000
10998
|
T?.Role,
|
|
11001
10999
|
nr
|
|
11002
11000
|
]) : !0))
|
|
11003
11001
|
throw new Error("PERMISSION_DENIED");
|
|
11004
|
-
const
|
|
11005
|
-
if (Qs(
|
|
11002
|
+
const Zt = _[de.name].toString().toLowerCase().replace(/\s/g, "---").replaceAll("/", "|||");
|
|
11003
|
+
if (Qs(Zt)) {
|
|
11006
11004
|
if (B && B.size++, B && B.size > 500)
|
|
11007
11005
|
throw new Error("VALIDATION_ERROR: The number of operations in the Firestore transaction has exceeded the limit of 500. This is likely due to a large number of unique field checks.");
|
|
11008
|
-
const Qn = await S.get(p.collection("system_unique").doc(m.collection).collection(`Unique-${m.collection}-${de.name}`).doc(
|
|
11006
|
+
const Qn = await S.get(p.collection("system_unique").doc(m.collection).collection(`Unique-${m.collection}-${de.name}`).doc(Zt));
|
|
11009
11007
|
if (Qn.exists && Qn.data().id !== e)
|
|
11010
11008
|
throw new Error(`VALIDATION_ERROR: ${de.name} "${_[de.name]}" already exists`);
|
|
11011
11009
|
} else
|
|
@@ -11013,14 +11011,14 @@ ${r}`);
|
|
|
11013
11011
|
}
|
|
11014
11012
|
});
|
|
11015
11013
|
if (await Promise.all(tr), r && T?.Role) {
|
|
11016
|
-
const de = T.Role,
|
|
11017
|
-
if (!(w.custom?.serverAccess?.update !== void 0 ? await ie(w.custom.serverAccess.update, [de,
|
|
11014
|
+
const de = T.Role, jt = { ...v, ..._ };
|
|
11015
|
+
if (!(w.custom?.serverAccess?.update !== void 0 ? await ie(w.custom.serverAccess.update, [de, jt, v]) : !0))
|
|
11018
11016
|
throw new Error("PERMISSION_DENIED");
|
|
11019
11017
|
for (const Jn of d.fields) {
|
|
11020
|
-
const
|
|
11021
|
-
if (Object.prototype.hasOwnProperty.call(_, Jn.name) &&
|
|
11018
|
+
const Zt = Ie(Jn, w);
|
|
11019
|
+
if (Object.prototype.hasOwnProperty.call(_, Jn.name) && Zt?.custom?.serverAccess?.update !== void 0 && !await ie(Zt.custom.serverAccess.update, [
|
|
11022
11020
|
de,
|
|
11023
|
-
|
|
11021
|
+
jt,
|
|
11024
11022
|
v
|
|
11025
11023
|
]))
|
|
11026
11024
|
throw new Error("PERMISSION_DENIED");
|
|
@@ -11041,7 +11039,7 @@ ${r}`);
|
|
|
11041
11039
|
throw new Error("USER_ERROR");
|
|
11042
11040
|
}
|
|
11043
11041
|
const q = { ...v, ..._ };
|
|
11044
|
-
|
|
11042
|
+
nt(q);
|
|
11045
11043
|
const B = await jc(s?.operation || "update", a, e, l, m.collection, q, v, S, s?.permissions, R, s?.password);
|
|
11046
11044
|
Z && (_.User_ID = B), x && (_.User_ID = me.delete());
|
|
11047
11045
|
}
|
|
@@ -11050,10 +11048,10 @@ ${r}`);
|
|
|
11050
11048
|
await p.runTransaction(async (B) => {
|
|
11051
11049
|
const re = { ...v, ..._ };
|
|
11052
11050
|
await F(B, !1, q);
|
|
11053
|
-
let
|
|
11054
|
-
i?.noTwoWay || (
|
|
11055
|
-
const
|
|
11056
|
-
Js("update", B, n, e, _, c, d, i,
|
|
11051
|
+
let Qe;
|
|
11052
|
+
i?.noTwoWay || (Qe = await Mo("Update", a, e, re, _, d, c, B, q, r, T, v));
|
|
11053
|
+
const Wt = Vs(c);
|
|
11054
|
+
Js("update", B, n, e, _, c, d, i, Wt, me.arrayUnion, me.arrayRemove, me.delete, (pe) => p.collection("tenants").doc(a).collection("system_fields").doc(m.collection).collection(`${m.collection}-${pe.name}`).doc(e), (pe, oe) => p.collection("tenants").doc(a).collection("system_unique").doc(m.collection).collection(`Unique-${m.collection}-${pe.name}`).doc(oe), (pe) => p.collection("tenants").doc(a).collection("system_fields").doc(m.collection).collection(`${m.collection}-${pe}`).doc(e), (pe, oe) => De(p, pe, a).doc(oe), (pe, oe, Le) => p.collection("tenants").doc(a).collection("system_fields").doc(pe.collection).collection(`${pe.collection}-${oe}`).doc(Le), (pe, oe, Le) => p.collection("tenants").doc(a).collection("system_fields").doc(pe.collection).collection(`${pe.collection}-${oe.replaceAll(" ", "-")}`).doc(Le), v, Qe, q), B.update(C.doc(e), _);
|
|
11057
11055
|
}, { maxAttempts: 10 });
|
|
11058
11056
|
} catch (q) {
|
|
11059
11057
|
const B = [
|
|
@@ -11066,10 +11064,10 @@ ${r}`);
|
|
|
11066
11064
|
void 0,
|
|
11067
11065
|
ye(v)
|
|
11068
11066
|
], re = await ae("postWriteError", l, w, B);
|
|
11069
|
-
if (y && (await new Promise((
|
|
11070
|
-
setTimeout(
|
|
11071
|
-
}), await
|
|
11072
|
-
throw Z && await un(v), k(v) && await
|
|
11067
|
+
if (y && (await new Promise((Qe) => {
|
|
11068
|
+
setTimeout(Qe, 250);
|
|
11069
|
+
}), await Mt("update", re?.resolved ? "success" : "failed", _, a, n, e, d, re?.resolved ? void 0 : q, v)), !re?.resolved)
|
|
11070
|
+
throw Z && await un(v), k(v) && await Qt(v.User_ID, S, R, "USER_ERROR"), x && await p.collection(m.collection).doc(e).update({ User_ID: me.delete() }), q;
|
|
11073
11071
|
}
|
|
11074
11072
|
(Z || k(v) || x) && await Jr(Xr, [e, v.User_ID]).catch(() => {
|
|
11075
11073
|
throw new Error("USER_ERROR");
|
|
@@ -11082,37 +11080,37 @@ ${r}`);
|
|
|
11082
11080
|
const M = ["update", _, e, o, void 0, ye(v)], P = [...M];
|
|
11083
11081
|
await ae("postWrite", l, w, M), await ae("postOperation", l, w, P);
|
|
11084
11082
|
const j = { ...v, ..._ };
|
|
11085
|
-
return
|
|
11083
|
+
return nt(j), { id: e, ...j };
|
|
11086
11084
|
}, hu = async (n, e, t, s, r) => {
|
|
11087
|
-
const i =
|
|
11085
|
+
const i = Ye(), o = Ut();
|
|
11088
11086
|
let a = await Ge();
|
|
11089
11087
|
if (n.length === 0)
|
|
11090
11088
|
throw new Error("EMPTY_PATH");
|
|
11091
11089
|
const l = n.at(-1), c = Object.keys(a.collections).includes(l), u = o.disabledCollections?.includes(l);
|
|
11092
11090
|
if (!c || u)
|
|
11093
11091
|
throw new Error("COLLECTION_NOT_FOUND");
|
|
11094
|
-
const h = a.collections[l], { labels: f, auth: d, enableWriteLog: m, softDelete: O } = h, y =
|
|
11092
|
+
const h = a.collections[l], { labels: f, auth: d, enableWriteLog: m, softDelete: O } = h, y = Je(f.collection, a), w = await ie(o.appName);
|
|
11095
11093
|
if (O && !d && !s?.force)
|
|
11096
11094
|
return await zc(n, e, { [O.archivedField]: !0, [O.timestampField]: me.serverTimestamp() }, void 0, t);
|
|
11097
11095
|
const b = ue();
|
|
11098
11096
|
let N;
|
|
11099
11097
|
t && await Xs(n, h);
|
|
11100
|
-
const p =
|
|
11098
|
+
const p = De(b, n, i);
|
|
11101
11099
|
r = r || {}, r.collection = f.collection;
|
|
11102
|
-
const T = await
|
|
11103
|
-
let C = Us("delete", n, T, a, w, "Online", t || "System",
|
|
11100
|
+
const T = await at(n, e, { user: t });
|
|
11101
|
+
let C = Us("delete", n, T, a, w, "Online", t || "System", lt.now(), me.serverTimestamp());
|
|
11104
11102
|
const v = bn(C);
|
|
11105
|
-
Ve(C), m && await
|
|
11103
|
+
Ve(C), m && await Mt("delete", "started", C, i, n, e, h), await ae("preOperation", o, y, ["delete", C, e, r]), await ae("preWrite", o, y, ["delete", C, e, r]), Ve(C);
|
|
11106
11104
|
const g = async (E) => {
|
|
11107
|
-
const [
|
|
11105
|
+
const [D, R, F, M] = await Promise.all([
|
|
11108
11106
|
E.get(b.collection("system_deployment").doc("maintenance_mode")),
|
|
11109
|
-
|
|
11110
|
-
t ? E.get(b.collection("system_user_permissions").doc(t)) : Promise.resolve(Promise.resolve({})),
|
|
11107
|
+
at([f.collection], e, { user: t, providedTransaction: E }),
|
|
11108
|
+
t ? E.get(b.collection("tenants").doc(i).collection("system_user_permissions").doc(t)) : Promise.resolve(Promise.resolve({})),
|
|
11111
11109
|
Ge()
|
|
11112
11110
|
]);
|
|
11113
|
-
if (!
|
|
11111
|
+
if (!D.exists)
|
|
11114
11112
|
throw new Error("MAINTENANCE_MODE");
|
|
11115
|
-
if (
|
|
11113
|
+
if (D.data().active)
|
|
11116
11114
|
throw new Error("MAINTENANCE_MODE");
|
|
11117
11115
|
if (!R)
|
|
11118
11116
|
throw new Error("NOT_FOUND");
|
|
@@ -11137,14 +11135,14 @@ ${r}`);
|
|
|
11137
11135
|
try {
|
|
11138
11136
|
await b.runTransaction(async (E) => {
|
|
11139
11137
|
await g(E);
|
|
11140
|
-
const
|
|
11141
|
-
Js("delete", E, n, e, C, a, h, s,
|
|
11138
|
+
const D = Vs(a);
|
|
11139
|
+
Js("delete", E, n, e, C, a, h, s, D, me.arrayUnion, me.arrayRemove, me.delete, (R) => b.collection("tenants").doc(i).collection("system_fields").doc(f.collection).collection(`${f.collection}-${R.name}`).doc(e), (R, F) => b.collection("tenants").doc(i).collection("system_unique").doc(f.collection).collection(`Unique-${f.collection}-${R.name}`).doc(F), (R) => b.collection("tenants").doc(i).collection("system_fields").doc(f.collection).collection(`${f.collection}-${R}`).doc(e), (R, F) => De(b, R, i).doc(F), (R, F, M) => b.collection("tenants").doc(i).collection("system_fields").doc(R.collection).collection(`${R.collection}-${F}`).doc(M), (R, F, M) => b.collection("tenants").doc(i).collection("system_fields").doc(R.collection).collection(`${R.collection}-${F.replaceAll(" ", "-")}`).doc(M)), E.delete(p.doc(e));
|
|
11142
11140
|
}, { maxAttempts: 10 });
|
|
11143
11141
|
} catch (E) {
|
|
11144
11142
|
const R = await ae("postWriteError", o, y, ["delete", C, e, r, E]);
|
|
11145
11143
|
if (m && (await new Promise((F) => {
|
|
11146
11144
|
setTimeout(F, 250);
|
|
11147
|
-
}), await
|
|
11145
|
+
}), await Mt("delete", R?.resolved ? "success" : "failed", C, i, n, e, h, R?.resolved ? void 0 : E)), !R?.resolved)
|
|
11148
11146
|
throw h.auth && C.User_ID && await b.collection(f.collection).doc(e).update({ User_ID: me.delete() }), E;
|
|
11149
11147
|
}
|
|
11150
11148
|
const k = ["delete", C, e, r], _ = [...k];
|
|
@@ -11161,14 +11159,14 @@ ${r}`);
|
|
|
11161
11159
|
}, qc = (n) => n !== null && typeof n == "object", pu = (n) => {
|
|
11162
11160
|
const e = (t) => {
|
|
11163
11161
|
Object.entries(t).forEach(([s, r]) => {
|
|
11164
|
-
r instanceof
|
|
11162
|
+
r instanceof lt ? t[s] = {
|
|
11165
11163
|
_seconds: r.seconds,
|
|
11166
11164
|
_nanoseconds: r.nanoseconds
|
|
11167
11165
|
} : qc(r) && e(r);
|
|
11168
11166
|
});
|
|
11169
11167
|
};
|
|
11170
11168
|
e(n);
|
|
11171
|
-
}, yu = async (n) => await
|
|
11169
|
+
}, yu = async (n) => await gt().getUser(n), gu = (n) => {
|
|
11172
11170
|
const e = So();
|
|
11173
11171
|
return V.fromJSDate(n).setZone(e);
|
|
11174
11172
|
}, Bc = (n) => {
|
|
@@ -11180,7 +11178,7 @@ ${r}`);
|
|
|
11180
11178
|
}, _u = (n, e) => {
|
|
11181
11179
|
const s = V.fromJSDate(n, { zone: e }).offset, i = V.fromJSDate(n).offset, o = s - i;
|
|
11182
11180
|
return V.fromJSDate(n).minus({ minutes: o }).toJSDate();
|
|
11183
|
-
}, Eu = (n) => "seconds" in n && "nanoseconds" in n ? Bc(new
|
|
11181
|
+
}, Eu = (n) => "seconds" in n && "nanoseconds" in n ? Bc(new lt(n.seconds, n.nanoseconds)).toFormat("MMMM d, yyyy '@' h:mm a") : "";
|
|
11184
11182
|
export {
|
|
11185
11183
|
fu as addRecord,
|
|
11186
11184
|
Co as addUser,
|
|
@@ -11198,9 +11196,9 @@ export {
|
|
|
11198
11196
|
Pc as getCollectionRefs,
|
|
11199
11197
|
Fc as getCustomizationFiles,
|
|
11200
11198
|
To as getDocumentRefs,
|
|
11201
|
-
|
|
11199
|
+
De as getFirestorePathRef,
|
|
11202
11200
|
ou as getInputSchema,
|
|
11203
|
-
|
|
11201
|
+
at as getOne,
|
|
11204
11202
|
No as getSome,
|
|
11205
11203
|
yu as getUser,
|
|
11206
11204
|
Ca as getZodSchema,
|
|
@@ -11218,5 +11216,5 @@ export {
|
|
|
11218
11216
|
jc as updateUser,
|
|
11219
11217
|
Mo as validateRelations,
|
|
11220
11218
|
Po as validateSoftDelete,
|
|
11221
|
-
|
|
11219
|
+
Mt as writeLog
|
|
11222
11220
|
};
|