@stoker-platform/node-client 0.5.3 → 0.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.cjs +6 -6
- package/dist/bundle.js +493 -492
- package/package.json +3 -3
package/dist/bundle.js
CHANGED
|
@@ -10,7 +10,7 @@ import { getAuth as gt } from "firebase-admin/auth";
|
|
|
10
10
|
const jn = (n) => !!n.auth, Te = (n, e) => {
|
|
11
11
|
if (e?.operations)
|
|
12
12
|
return e.operations.includes(n);
|
|
13
|
-
}, Zn = (n, e) => e ? e.Role ? n.access?.includes(e.Role) : !1 : !0, zo = (n, e) => n.restrictCreate === !0 ? !1 : e && typeof n.restrictCreate == "object" ? e.Role ? n.restrictCreate?.includes(e.Role) : !1 : !0, oi = (n, e) => n.restrictUpdate === !0 ? !1 : e && typeof n.restrictUpdate == "object" ? e.Role ? n.restrictUpdate?.includes(e.Role) : !1 : !0,
|
|
13
|
+
}, Zn = (n, e) => e ? e.Role ? n.access?.includes(e.Role) : !1 : !0, zo = (n, e) => n.restrictCreate === !0 ? !1 : e && typeof n.restrictCreate == "object" ? e.Role ? n.restrictCreate?.includes(e.Role) : !1 : !0, oi = (n, e) => n.restrictUpdate === !0 ? !1 : e && typeof n.restrictUpdate == "object" ? e.Role ? n.restrictUpdate?.includes(e.Role) : !1 : !0, rr = (n, e, t) => {
|
|
14
14
|
const { labels: s } = n;
|
|
15
15
|
return t.collections && // eslint-disable-next-line security/detect-object-injection
|
|
16
16
|
Te("Update", t.collections[s.collection]) && (!e.access || Zn(e, t)) && oi(e, t) && !(n.auth && !t.collections?.[s.collection].auth && ["Enabled", "Role", "Name", "Email", "Photo_URL"].includes(e.name));
|
|
@@ -26,7 +26,7 @@ const jn = (n) => !!n.auth, Te = (n, e) => {
|
|
|
26
26
|
c.role === e.Role && (!c.assignable || u?.active) && s.push(l);
|
|
27
27
|
});
|
|
28
28
|
}), s;
|
|
29
|
-
},
|
|
29
|
+
}, Ls = (n, e) => {
|
|
30
30
|
const t = [], { labels: s, access: r } = n, { entityRestrictions: i } = r, o = e.collections?.[s.collection];
|
|
31
31
|
return i?.restrictions?.forEach((a) => {
|
|
32
32
|
"roles" in a && a.roles.forEach((l) => {
|
|
@@ -68,7 +68,7 @@ const jn = (n) => !!n.auth, Te = (n, e) => {
|
|
|
68
68
|
l = !1;
|
|
69
69
|
return;
|
|
70
70
|
}
|
|
71
|
-
const c = ai(e, r), u =
|
|
71
|
+
const c = ai(e, r), u = Ls(e, r), h = li(e, t, r);
|
|
72
72
|
c?.filter((p) => p.type === "Record_Owner").forEach((p) => {
|
|
73
73
|
"operations" in p && p.operations && !p.operations.includes(n) || i.Created_By !== s && (l = !1);
|
|
74
74
|
}), c?.filter((p) => p.type === "Record_User").forEach((p) => {
|
|
@@ -153,7 +153,7 @@ const jn = (n) => !!n.auth, Te = (n, e) => {
|
|
|
153
153
|
if (!a || !r.Role)
|
|
154
154
|
return l = !1, l;
|
|
155
155
|
Te(n, a) || (l = !1);
|
|
156
|
-
const u =
|
|
156
|
+
const u = Ls(e, r)?.filter((h) => h.type === "Individual").length > 0;
|
|
157
157
|
return n === "Create" && u && (l = !1), qo(n, e, t, s, r, i) || (l = !1), l;
|
|
158
158
|
}, ui = (n, e, t) => {
|
|
159
159
|
const { labels: s } = n, r = [];
|
|
@@ -408,7 +408,7 @@ const jn = (n) => !!n.auth, Te = (n, e) => {
|
|
|
408
408
|
return;
|
|
409
409
|
}
|
|
410
410
|
}), i && console.error(`PERMISSION_DENIED: ${i}`), r;
|
|
411
|
-
},
|
|
411
|
+
}, Vs = (n, e, t, s, r, i, o, a, l, c, u) => {
|
|
412
412
|
const { labels: h } = s;
|
|
413
413
|
let f = !0, d = "";
|
|
414
414
|
if (!e.Role)
|
|
@@ -430,13 +430,13 @@ const jn = (n) => !!n.auth, Te = (n, e) => {
|
|
|
430
430
|
return d = "User cannot delete their own record", f = !1, f;
|
|
431
431
|
}
|
|
432
432
|
return n === "delete" || u === "delete" || !a ? f : a.Role ? (Bo(r, a) || (f = !1), a.Collection && a.Collection !== h.collection ? (d = "Permissions collection does not match record collection", f = !1, f) : a.Role !== e.Role ? (d = "Permissions role does not match record role", f = !1, f) : a.Enabled !== void 0 && !!a.Enabled != !!e.Enabled ? (d = "Permissions enabled state does not match record enabled state", f = !1, f) : a.Doc_ID && a.Doc_ID !== t ? (d = "Permissions doc ID does not match record doc ID", f = !1, f) : !Ho(r, a, a.Role) || i && o && l && !Yo(r, o, a, l) ? (f = !1, f) : (d && console.error(`PERMISSION_DENIED: ${d}`), f)) : (d = "Permissions do not have a role", f = !1, f);
|
|
433
|
-
},
|
|
433
|
+
}, ir = (n, e, t, s, r, i, o) => {
|
|
434
434
|
const { labels: a, fields: l } = t, c = i?.collections?.[a.collection];
|
|
435
435
|
let u = !0;
|
|
436
436
|
if (r && !c)
|
|
437
437
|
throw new Error("PERMISSION_DENIED");
|
|
438
438
|
r && !Te("Create", c) && (u = !1), r && // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
439
|
-
!it("Create", t, s, r, i, n) && (u = !1), t.auth && o && (r && !jn(c) && (u = !1),
|
|
439
|
+
!it("Create", t, s, r, i, n) && (u = !1), t.auth && o && (r && !jn(c) && (u = !1), Vs("create", n, e, t, s, r, i, o) || (u = !1));
|
|
440
440
|
for (const h of l) {
|
|
441
441
|
const f = n[h.name];
|
|
442
442
|
h.access && !Zn(h, i) && f !== void 0 && (u = !1), f !== void 0 && !zo(h, i) && (u = !1);
|
|
@@ -446,7 +446,7 @@ const jn = (n) => !!n.auth, Te = (n, e) => {
|
|
|
446
446
|
}, Me = (n) => n && (n._methodName === "deleteField" || n.constructor.name === "DeleteTransform"), nt = (n) => {
|
|
447
447
|
for (const e in n)
|
|
448
448
|
Object.prototype.hasOwnProperty.call(n, e) && (Me(n[e]) ? delete n[e] : typeof n[e] == "object" && n[e] !== null && nt(n[e]));
|
|
449
|
-
},
|
|
449
|
+
}, or = (n, e, t, s, r, i, o, a, l, c) => {
|
|
450
450
|
const { labels: u, fields: h } = s, f = o?.collections?.[u.collection], d = { ...e, ...n };
|
|
451
451
|
nt(d);
|
|
452
452
|
let m = !0, O = "";
|
|
@@ -454,7 +454,7 @@ const jn = (n) => !!n.auth, Te = (n, e) => {
|
|
|
454
454
|
throw new Error("PERMISSION_DENIED");
|
|
455
455
|
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
|
|
456
456
|
(!it("Update", s, r, i, o, e) || // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
457
|
-
!it("Update", s, r, i, o, d)) && (m = !1, O = "Authenticated user does not have Update access to this document"), a && (i && !jn(f) && (m = !1, O = "Authenticated user does not have Auth access for this collection"),
|
|
457
|
+
!it("Update", s, r, i, o, d)) && (m = !1, O = "Authenticated user does not have Update access to this document"), a && (i && !jn(f) && (m = !1, O = "Authenticated user does not have Auth access for this collection"), Vs("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));
|
|
458
458
|
for (const y of h) {
|
|
459
459
|
const w = n[y.name];
|
|
460
460
|
y.access && !Zn(y, o) && w !== void 0 && (O = `Authenticated user does not have access to field ${y.name}`, m = !1), w !== void 0 && !oi(y, o) && (O = `Authenticated user does not have Update access to field ${y.name}`, m = !1);
|
|
@@ -466,7 +466,7 @@ const jn = (n) => !!n.auth, Te = (n, e) => {
|
|
|
466
466
|
let l = !0;
|
|
467
467
|
if (!a)
|
|
468
468
|
throw new Error("PERMISSION_DENIED");
|
|
469
|
-
if (Te("Delete", a) || (l = !1), it("Delete", t, s, r, i, n) || (l = !1), t.auth && n.User_ID && (jn(a) || (l = !1),
|
|
469
|
+
if (Te("Delete", a) || (l = !1), it("Delete", t, s, r, i, n) || (l = !1), t.auth && n.User_ID && (jn(a) || (l = !1), Vs("delete", n, e, t, s, r, i) || (l = !1)), !l)
|
|
470
470
|
throw new Error("PERMISSION_DENIED");
|
|
471
471
|
}, Qo = async (n, e, t, s, r) => {
|
|
472
472
|
const { labels: i } = e, o = r.collections?.[i.collection];
|
|
@@ -527,7 +527,7 @@ const jn = (n) => !!n.auth, Te = (n, e) => {
|
|
|
527
527
|
i[o] = l;
|
|
528
528
|
}
|
|
529
529
|
return i;
|
|
530
|
-
},
|
|
530
|
+
}, Ie = (n, e) => e.fields.filter((t) => t.name === n.name)[0], Xn = {
|
|
531
531
|
global: {},
|
|
532
532
|
collections: {}
|
|
533
533
|
}, qt = (n, e) => n && typeof n == "function" ? e ? n(...e) : n() : n, ie = async (n, e) => {
|
|
@@ -776,7 +776,7 @@ const jn = (n) => !!n.auth, Te = (n, e) => {
|
|
|
776
776
|
return [...t, ...s.filter((o) => o.name !== "id")].forEach((o) => {
|
|
777
777
|
n?.fields.some((a) => a.name === o.name) || r.push(o);
|
|
778
778
|
}), r;
|
|
779
|
-
},
|
|
779
|
+
}, Us = (n, e, t) => {
|
|
780
780
|
const s = {};
|
|
781
781
|
return Object.values(n.collections).forEach((r) => {
|
|
782
782
|
const i = hi(r, n), o = Array.from(i);
|
|
@@ -805,7 +805,7 @@ async function ae(n, e, t, s) {
|
|
|
805
805
|
if (n !== "setEmbedding" && (await ts(n, e?.[n], s), n === "postWriteError"))
|
|
806
806
|
return r;
|
|
807
807
|
}
|
|
808
|
-
const
|
|
808
|
+
const Ws = (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) => {
|
|
809
809
|
const { access: t, queries: s } = n, { serverReadOnly: r } = t, i = /* @__PURE__ */ new Set();
|
|
810
810
|
if (s)
|
|
811
811
|
for (const o of s) {
|
|
@@ -898,14 +898,14 @@ var te;
|
|
|
898
898
|
}
|
|
899
899
|
n.joinValues = s, n.jsonStringifyReplacer = (r, i) => typeof i == "bigint" ? i.toString() : i;
|
|
900
900
|
})(te || (te = {}));
|
|
901
|
-
var
|
|
901
|
+
var ar;
|
|
902
902
|
(function(n) {
|
|
903
903
|
n.mergeShapes = (e, t) => ({
|
|
904
904
|
...e,
|
|
905
905
|
...t
|
|
906
906
|
// second overwrites first
|
|
907
907
|
});
|
|
908
|
-
})(
|
|
908
|
+
})(ar || (ar = {}));
|
|
909
909
|
const U = te.arrayToEnum([
|
|
910
910
|
"string",
|
|
911
911
|
"nan",
|
|
@@ -948,7 +948,7 @@ const U = te.arrayToEnum([
|
|
|
948
948
|
default:
|
|
949
949
|
return U.unknown;
|
|
950
950
|
}
|
|
951
|
-
},
|
|
951
|
+
}, I = te.arrayToEnum([
|
|
952
952
|
"invalid_type",
|
|
953
953
|
"invalid_literal",
|
|
954
954
|
"custom",
|
|
@@ -1030,55 +1030,55 @@ class Be extends Error {
|
|
|
1030
1030
|
}
|
|
1031
1031
|
}
|
|
1032
1032
|
Be.create = (n) => new Be(n);
|
|
1033
|
-
const
|
|
1033
|
+
const ws = (n, e) => {
|
|
1034
1034
|
let t;
|
|
1035
1035
|
switch (n.code) {
|
|
1036
|
-
case
|
|
1036
|
+
case I.invalid_type:
|
|
1037
1037
|
n.received === U.undefined ? t = "Required" : t = `Expected ${n.expected}, received ${n.received}`;
|
|
1038
1038
|
break;
|
|
1039
|
-
case
|
|
1039
|
+
case I.invalid_literal:
|
|
1040
1040
|
t = `Invalid literal value, expected ${JSON.stringify(n.expected, te.jsonStringifyReplacer)}`;
|
|
1041
1041
|
break;
|
|
1042
|
-
case
|
|
1042
|
+
case I.unrecognized_keys:
|
|
1043
1043
|
t = `Unrecognized key(s) in object: ${te.joinValues(n.keys, ", ")}`;
|
|
1044
1044
|
break;
|
|
1045
|
-
case
|
|
1045
|
+
case I.invalid_union:
|
|
1046
1046
|
t = "Invalid input";
|
|
1047
1047
|
break;
|
|
1048
|
-
case
|
|
1048
|
+
case I.invalid_union_discriminator:
|
|
1049
1049
|
t = `Invalid discriminator value. Expected ${te.joinValues(n.options)}`;
|
|
1050
1050
|
break;
|
|
1051
|
-
case
|
|
1051
|
+
case I.invalid_enum_value:
|
|
1052
1052
|
t = `Invalid enum value. Expected ${te.joinValues(n.options)}, received '${n.received}'`;
|
|
1053
1053
|
break;
|
|
1054
|
-
case
|
|
1054
|
+
case I.invalid_arguments:
|
|
1055
1055
|
t = "Invalid function arguments";
|
|
1056
1056
|
break;
|
|
1057
|
-
case
|
|
1057
|
+
case I.invalid_return_type:
|
|
1058
1058
|
t = "Invalid function return type";
|
|
1059
1059
|
break;
|
|
1060
|
-
case
|
|
1060
|
+
case I.invalid_date:
|
|
1061
1061
|
t = "Invalid date";
|
|
1062
1062
|
break;
|
|
1063
|
-
case
|
|
1063
|
+
case I.invalid_string:
|
|
1064
1064
|
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";
|
|
1065
1065
|
break;
|
|
1066
|
-
case
|
|
1066
|
+
case I.too_small:
|
|
1067
1067
|
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";
|
|
1068
1068
|
break;
|
|
1069
|
-
case
|
|
1069
|
+
case I.too_big:
|
|
1070
1070
|
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";
|
|
1071
1071
|
break;
|
|
1072
|
-
case
|
|
1072
|
+
case I.custom:
|
|
1073
1073
|
t = "Invalid input";
|
|
1074
1074
|
break;
|
|
1075
|
-
case
|
|
1075
|
+
case I.invalid_intersection_types:
|
|
1076
1076
|
t = "Intersection results could not be merged";
|
|
1077
1077
|
break;
|
|
1078
|
-
case
|
|
1078
|
+
case I.not_multiple_of:
|
|
1079
1079
|
t = `Number must be a multiple of ${n.multipleOf}`;
|
|
1080
1080
|
break;
|
|
1081
|
-
case
|
|
1081
|
+
case I.not_finite:
|
|
1082
1082
|
t = "Number must be finite";
|
|
1083
1083
|
break;
|
|
1084
1084
|
default:
|
|
@@ -1086,7 +1086,7 @@ const _s = (n, e) => {
|
|
|
1086
1086
|
}
|
|
1087
1087
|
return { message: t };
|
|
1088
1088
|
};
|
|
1089
|
-
let oa =
|
|
1089
|
+
let oa = ws;
|
|
1090
1090
|
function aa() {
|
|
1091
1091
|
return oa;
|
|
1092
1092
|
}
|
|
@@ -1123,7 +1123,7 @@ function L(n, e) {
|
|
|
1123
1123
|
// then schema-bound map if available
|
|
1124
1124
|
t,
|
|
1125
1125
|
// then global override map
|
|
1126
|
-
t ===
|
|
1126
|
+
t === ws ? void 0 : ws
|
|
1127
1127
|
// then global default map
|
|
1128
1128
|
].filter((r) => !!r)
|
|
1129
1129
|
});
|
|
@@ -1172,7 +1172,7 @@ class ve {
|
|
|
1172
1172
|
}
|
|
1173
1173
|
const Y = Object.freeze({
|
|
1174
1174
|
status: "aborted"
|
|
1175
|
-
}), Bt = (n) => ({ status: "dirty", value: n }), Ae = (n) => ({ status: "valid", value: n }),
|
|
1175
|
+
}), Bt = (n) => ({ status: "dirty", value: n }), Ae = (n) => ({ status: "valid", value: n }), lr = (n) => n.status === "aborted", cr = (n) => n.status === "dirty", xt = (n) => n.status === "valid", Nn = (n) => typeof Promise < "u" && n instanceof Promise;
|
|
1176
1176
|
var z;
|
|
1177
1177
|
(function(n) {
|
|
1178
1178
|
n.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, n.toString = (e) => typeof e == "string" ? e : e?.message;
|
|
@@ -1185,7 +1185,7 @@ class je {
|
|
|
1185
1185
|
return this._cachedPath.length || (Array.isArray(this._key) ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
|
|
1186
1186
|
}
|
|
1187
1187
|
}
|
|
1188
|
-
const
|
|
1188
|
+
const ur = (n, e) => {
|
|
1189
1189
|
if (xt(e))
|
|
1190
1190
|
return { success: !0, data: e.value };
|
|
1191
1191
|
if (!n.common.issues.length)
|
|
@@ -1270,7 +1270,7 @@ class X {
|
|
|
1270
1270
|
data: e,
|
|
1271
1271
|
parsedType: Xe(e)
|
|
1272
1272
|
}, r = this._parseSync({ data: e, path: s.path, parent: s });
|
|
1273
|
-
return
|
|
1273
|
+
return ur(s, r);
|
|
1274
1274
|
}
|
|
1275
1275
|
"~validate"(e) {
|
|
1276
1276
|
const t = {
|
|
@@ -1323,13 +1323,13 @@ class X {
|
|
|
1323
1323
|
data: e,
|
|
1324
1324
|
parsedType: Xe(e)
|
|
1325
1325
|
}, r = this._parse({ data: e, path: s.path, parent: s }), i = await (Nn(r) ? r : Promise.resolve(r));
|
|
1326
|
-
return
|
|
1326
|
+
return ur(s, i);
|
|
1327
1327
|
}
|
|
1328
1328
|
refine(e, t) {
|
|
1329
1329
|
const s = (r) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(r) : t;
|
|
1330
1330
|
return this._refinement((r, i) => {
|
|
1331
1331
|
const o = e(r), a = () => i.addIssue({
|
|
1332
|
-
code:
|
|
1332
|
+
code: I.custom,
|
|
1333
1333
|
...s(r)
|
|
1334
1334
|
});
|
|
1335
1335
|
return typeof Promise < "u" && o instanceof Promise ? o.then((l) => l ? !0 : (a(), !1)) : o ? !0 : (a(), !1);
|
|
@@ -1371,10 +1371,10 @@ class X {
|
|
|
1371
1371
|
return Cn.create(this, this._def);
|
|
1372
1372
|
}
|
|
1373
1373
|
or(e) {
|
|
1374
|
-
return
|
|
1374
|
+
return In.create([this, e], this._def);
|
|
1375
1375
|
}
|
|
1376
1376
|
and(e) {
|
|
1377
|
-
return
|
|
1377
|
+
return Dn.create(this, e, this._def);
|
|
1378
1378
|
}
|
|
1379
1379
|
transform(e) {
|
|
1380
1380
|
return new At({
|
|
@@ -1386,7 +1386,7 @@ class X {
|
|
|
1386
1386
|
}
|
|
1387
1387
|
default(e) {
|
|
1388
1388
|
const t = typeof e == "function" ? e : () => e;
|
|
1389
|
-
return new
|
|
1389
|
+
return new bs({
|
|
1390
1390
|
...J(this._def),
|
|
1391
1391
|
innerType: this,
|
|
1392
1392
|
defaultValue: t,
|
|
@@ -1394,7 +1394,7 @@ class X {
|
|
|
1394
1394
|
});
|
|
1395
1395
|
}
|
|
1396
1396
|
brand() {
|
|
1397
|
-
return new
|
|
1397
|
+
return new Da({
|
|
1398
1398
|
typeName: G.ZodBranded,
|
|
1399
1399
|
type: this,
|
|
1400
1400
|
...J(this._def)
|
|
@@ -1402,7 +1402,7 @@ class X {
|
|
|
1402
1402
|
}
|
|
1403
1403
|
catch(e) {
|
|
1404
1404
|
const t = typeof e == "function" ? e : () => e;
|
|
1405
|
-
return new
|
|
1405
|
+
return new Ss({
|
|
1406
1406
|
...J(this._def),
|
|
1407
1407
|
innerType: this,
|
|
1408
1408
|
catchValue: t,
|
|
@@ -1417,10 +1417,10 @@ class X {
|
|
|
1417
1417
|
});
|
|
1418
1418
|
}
|
|
1419
1419
|
pipe(e) {
|
|
1420
|
-
return
|
|
1420
|
+
return js.create(this, e);
|
|
1421
1421
|
}
|
|
1422
1422
|
readonly() {
|
|
1423
|
-
return
|
|
1423
|
+
return Ts.create(this);
|
|
1424
1424
|
}
|
|
1425
1425
|
isOptional() {
|
|
1426
1426
|
return this.safeParse(void 0).success;
|
|
@@ -1470,7 +1470,7 @@ class qe extends X {
|
|
|
1470
1470
|
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== U.string) {
|
|
1471
1471
|
const i = this._getOrReturnCtx(e);
|
|
1472
1472
|
return L(i, {
|
|
1473
|
-
code:
|
|
1473
|
+
code: I.invalid_type,
|
|
1474
1474
|
expected: U.string,
|
|
1475
1475
|
received: i.parsedType
|
|
1476
1476
|
}), Y;
|
|
@@ -1480,7 +1480,7 @@ class qe extends X {
|
|
|
1480
1480
|
for (const i of this._def.checks)
|
|
1481
1481
|
if (i.kind === "min")
|
|
1482
1482
|
e.data.length < i.value && (r = this._getOrReturnCtx(e, r), L(r, {
|
|
1483
|
-
code:
|
|
1483
|
+
code: I.too_small,
|
|
1484
1484
|
minimum: i.value,
|
|
1485
1485
|
type: "string",
|
|
1486
1486
|
inclusive: !0,
|
|
@@ -1489,7 +1489,7 @@ class qe extends X {
|
|
|
1489
1489
|
}), s.dirty());
|
|
1490
1490
|
else if (i.kind === "max")
|
|
1491
1491
|
e.data.length > i.value && (r = this._getOrReturnCtx(e, r), L(r, {
|
|
1492
|
-
code:
|
|
1492
|
+
code: I.too_big,
|
|
1493
1493
|
maximum: i.value,
|
|
1494
1494
|
type: "string",
|
|
1495
1495
|
inclusive: !0,
|
|
@@ -1499,14 +1499,14 @@ class qe extends X {
|
|
|
1499
1499
|
else if (i.kind === "length") {
|
|
1500
1500
|
const o = e.data.length > i.value, a = e.data.length < i.value;
|
|
1501
1501
|
(o || a) && (r = this._getOrReturnCtx(e, r), o ? L(r, {
|
|
1502
|
-
code:
|
|
1502
|
+
code: I.too_big,
|
|
1503
1503
|
maximum: i.value,
|
|
1504
1504
|
type: "string",
|
|
1505
1505
|
inclusive: !0,
|
|
1506
1506
|
exact: !0,
|
|
1507
1507
|
message: i.message
|
|
1508
1508
|
}) : a && L(r, {
|
|
1509
|
-
code:
|
|
1509
|
+
code: I.too_small,
|
|
1510
1510
|
minimum: i.value,
|
|
1511
1511
|
type: "string",
|
|
1512
1512
|
inclusive: !0,
|
|
@@ -1516,43 +1516,43 @@ class qe extends X {
|
|
|
1516
1516
|
} else if (i.kind === "email")
|
|
1517
1517
|
ya.test(e.data) || (r = this._getOrReturnCtx(e, r), L(r, {
|
|
1518
1518
|
validation: "email",
|
|
1519
|
-
code:
|
|
1519
|
+
code: I.invalid_string,
|
|
1520
1520
|
message: i.message
|
|
1521
1521
|
}), s.dirty());
|
|
1522
1522
|
else if (i.kind === "emoji")
|
|
1523
1523
|
ns || (ns = new RegExp(ga, "u")), ns.test(e.data) || (r = this._getOrReturnCtx(e, r), L(r, {
|
|
1524
1524
|
validation: "emoji",
|
|
1525
|
-
code:
|
|
1525
|
+
code: I.invalid_string,
|
|
1526
1526
|
message: i.message
|
|
1527
1527
|
}), s.dirty());
|
|
1528
1528
|
else if (i.kind === "uuid")
|
|
1529
1529
|
fa.test(e.data) || (r = this._getOrReturnCtx(e, r), L(r, {
|
|
1530
1530
|
validation: "uuid",
|
|
1531
|
-
code:
|
|
1531
|
+
code: I.invalid_string,
|
|
1532
1532
|
message: i.message
|
|
1533
1533
|
}), s.dirty());
|
|
1534
1534
|
else if (i.kind === "nanoid")
|
|
1535
1535
|
ha.test(e.data) || (r = this._getOrReturnCtx(e, r), L(r, {
|
|
1536
1536
|
validation: "nanoid",
|
|
1537
|
-
code:
|
|
1537
|
+
code: I.invalid_string,
|
|
1538
1538
|
message: i.message
|
|
1539
1539
|
}), s.dirty());
|
|
1540
1540
|
else if (i.kind === "cuid")
|
|
1541
1541
|
ca.test(e.data) || (r = this._getOrReturnCtx(e, r), L(r, {
|
|
1542
1542
|
validation: "cuid",
|
|
1543
|
-
code:
|
|
1543
|
+
code: I.invalid_string,
|
|
1544
1544
|
message: i.message
|
|
1545
1545
|
}), s.dirty());
|
|
1546
1546
|
else if (i.kind === "cuid2")
|
|
1547
1547
|
ua.test(e.data) || (r = this._getOrReturnCtx(e, r), L(r, {
|
|
1548
1548
|
validation: "cuid2",
|
|
1549
|
-
code:
|
|
1549
|
+
code: I.invalid_string,
|
|
1550
1550
|
message: i.message
|
|
1551
1551
|
}), s.dirty());
|
|
1552
1552
|
else if (i.kind === "ulid")
|
|
1553
1553
|
da.test(e.data) || (r = this._getOrReturnCtx(e, r), L(r, {
|
|
1554
1554
|
validation: "ulid",
|
|
1555
|
-
code:
|
|
1555
|
+
code: I.invalid_string,
|
|
1556
1556
|
message: i.message
|
|
1557
1557
|
}), s.dirty());
|
|
1558
1558
|
else if (i.kind === "url")
|
|
@@ -1561,61 +1561,61 @@ class qe extends X {
|
|
|
1561
1561
|
} catch {
|
|
1562
1562
|
r = this._getOrReturnCtx(e, r), L(r, {
|
|
1563
1563
|
validation: "url",
|
|
1564
|
-
code:
|
|
1564
|
+
code: I.invalid_string,
|
|
1565
1565
|
message: i.message
|
|
1566
1566
|
}), s.dirty();
|
|
1567
1567
|
}
|
|
1568
1568
|
else i.kind === "regex" ? (i.regex.lastIndex = 0, i.regex.test(e.data) || (r = this._getOrReturnCtx(e, r), L(r, {
|
|
1569
1569
|
validation: "regex",
|
|
1570
|
-
code:
|
|
1570
|
+
code: I.invalid_string,
|
|
1571
1571
|
message: i.message
|
|
1572
1572
|
}), 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, {
|
|
1573
|
-
code:
|
|
1573
|
+
code: I.invalid_string,
|
|
1574
1574
|
validation: { includes: i.value, position: i.position },
|
|
1575
1575
|
message: i.message
|
|
1576
1576
|
}), 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, {
|
|
1577
|
-
code:
|
|
1577
|
+
code: I.invalid_string,
|
|
1578
1578
|
validation: { startsWith: i.value },
|
|
1579
1579
|
message: i.message
|
|
1580
1580
|
}), s.dirty()) : i.kind === "endsWith" ? e.data.endsWith(i.value) || (r = this._getOrReturnCtx(e, r), L(r, {
|
|
1581
|
-
code:
|
|
1581
|
+
code: I.invalid_string,
|
|
1582
1582
|
validation: { endsWith: i.value },
|
|
1583
1583
|
message: i.message
|
|
1584
1584
|
}), s.dirty()) : i.kind === "datetime" ? Ta(i).test(e.data) || (r = this._getOrReturnCtx(e, r), L(r, {
|
|
1585
|
-
code:
|
|
1585
|
+
code: I.invalid_string,
|
|
1586
1586
|
validation: "datetime",
|
|
1587
1587
|
message: i.message
|
|
1588
1588
|
}), s.dirty()) : i.kind === "date" ? ba.test(e.data) || (r = this._getOrReturnCtx(e, r), L(r, {
|
|
1589
|
-
code:
|
|
1589
|
+
code: I.invalid_string,
|
|
1590
1590
|
validation: "date",
|
|
1591
1591
|
message: i.message
|
|
1592
1592
|
}), s.dirty()) : i.kind === "time" ? Sa(i).test(e.data) || (r = this._getOrReturnCtx(e, r), L(r, {
|
|
1593
|
-
code:
|
|
1593
|
+
code: I.invalid_string,
|
|
1594
1594
|
validation: "time",
|
|
1595
1595
|
message: i.message
|
|
1596
1596
|
}), s.dirty()) : i.kind === "duration" ? pa.test(e.data) || (r = this._getOrReturnCtx(e, r), L(r, {
|
|
1597
1597
|
validation: "duration",
|
|
1598
|
-
code:
|
|
1598
|
+
code: I.invalid_string,
|
|
1599
1599
|
message: i.message
|
|
1600
1600
|
}), s.dirty()) : i.kind === "ip" ? Ra(e.data, i.version) || (r = this._getOrReturnCtx(e, r), L(r, {
|
|
1601
1601
|
validation: "ip",
|
|
1602
|
-
code:
|
|
1602
|
+
code: I.invalid_string,
|
|
1603
1603
|
message: i.message
|
|
1604
1604
|
}), s.dirty()) : i.kind === "jwt" ? Na(e.data, i.alg) || (r = this._getOrReturnCtx(e, r), L(r, {
|
|
1605
1605
|
validation: "jwt",
|
|
1606
|
-
code:
|
|
1606
|
+
code: I.invalid_string,
|
|
1607
1607
|
message: i.message
|
|
1608
1608
|
}), s.dirty()) : i.kind === "cidr" ? xa(e.data, i.version) || (r = this._getOrReturnCtx(e, r), L(r, {
|
|
1609
1609
|
validation: "cidr",
|
|
1610
|
-
code:
|
|
1610
|
+
code: I.invalid_string,
|
|
1611
1611
|
message: i.message
|
|
1612
1612
|
}), s.dirty()) : i.kind === "base64" ? Oa.test(e.data) || (r = this._getOrReturnCtx(e, r), L(r, {
|
|
1613
1613
|
validation: "base64",
|
|
1614
|
-
code:
|
|
1614
|
+
code: I.invalid_string,
|
|
1615
1615
|
message: i.message
|
|
1616
1616
|
}), s.dirty()) : i.kind === "base64url" ? ka.test(e.data) || (r = this._getOrReturnCtx(e, r), L(r, {
|
|
1617
1617
|
validation: "base64url",
|
|
1618
|
-
code:
|
|
1618
|
+
code: I.invalid_string,
|
|
1619
1619
|
message: i.message
|
|
1620
1620
|
}), s.dirty()) : te.assertNever(i);
|
|
1621
1621
|
return { status: s.value, value: e.data };
|
|
@@ -1623,7 +1623,7 @@ class qe extends X {
|
|
|
1623
1623
|
_regex(e, t, s) {
|
|
1624
1624
|
return this.refinement((r) => e.test(r), {
|
|
1625
1625
|
validation: t,
|
|
1626
|
-
code:
|
|
1626
|
+
code: I.invalid_string,
|
|
1627
1627
|
...z.errToObj(s)
|
|
1628
1628
|
});
|
|
1629
1629
|
}
|
|
@@ -1848,11 +1848,11 @@ qe.create = (n) => new qe({
|
|
|
1848
1848
|
coerce: n?.coerce ?? !1,
|
|
1849
1849
|
...J(n)
|
|
1850
1850
|
});
|
|
1851
|
-
function
|
|
1851
|
+
function Ia(n, e) {
|
|
1852
1852
|
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(".", ""));
|
|
1853
1853
|
return i % o / 10 ** r;
|
|
1854
1854
|
}
|
|
1855
|
-
class
|
|
1855
|
+
class It extends X {
|
|
1856
1856
|
constructor() {
|
|
1857
1857
|
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
1858
1858
|
}
|
|
@@ -1860,7 +1860,7 @@ class Dt extends X {
|
|
|
1860
1860
|
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== U.number) {
|
|
1861
1861
|
const i = this._getOrReturnCtx(e);
|
|
1862
1862
|
return L(i, {
|
|
1863
|
-
code:
|
|
1863
|
+
code: I.invalid_type,
|
|
1864
1864
|
expected: U.number,
|
|
1865
1865
|
received: i.parsedType
|
|
1866
1866
|
}), Y;
|
|
@@ -1869,30 +1869,30 @@ class Dt extends X {
|
|
|
1869
1869
|
const r = new ve();
|
|
1870
1870
|
for (const i of this._def.checks)
|
|
1871
1871
|
i.kind === "int" ? te.isInteger(e.data) || (s = this._getOrReturnCtx(e, s), L(s, {
|
|
1872
|
-
code:
|
|
1872
|
+
code: I.invalid_type,
|
|
1873
1873
|
expected: "integer",
|
|
1874
1874
|
received: "float",
|
|
1875
1875
|
message: i.message
|
|
1876
1876
|
}), r.dirty()) : i.kind === "min" ? (i.inclusive ? e.data < i.value : e.data <= i.value) && (s = this._getOrReturnCtx(e, s), L(s, {
|
|
1877
|
-
code:
|
|
1877
|
+
code: I.too_small,
|
|
1878
1878
|
minimum: i.value,
|
|
1879
1879
|
type: "number",
|
|
1880
1880
|
inclusive: i.inclusive,
|
|
1881
1881
|
exact: !1,
|
|
1882
1882
|
message: i.message
|
|
1883
1883
|
}), r.dirty()) : i.kind === "max" ? (i.inclusive ? e.data > i.value : e.data >= i.value) && (s = this._getOrReturnCtx(e, s), L(s, {
|
|
1884
|
-
code:
|
|
1884
|
+
code: I.too_big,
|
|
1885
1885
|
maximum: i.value,
|
|
1886
1886
|
type: "number",
|
|
1887
1887
|
inclusive: i.inclusive,
|
|
1888
1888
|
exact: !1,
|
|
1889
1889
|
message: i.message
|
|
1890
|
-
}), r.dirty()) : i.kind === "multipleOf" ?
|
|
1891
|
-
code:
|
|
1890
|
+
}), r.dirty()) : i.kind === "multipleOf" ? Ia(e.data, i.value) !== 0 && (s = this._getOrReturnCtx(e, s), L(s, {
|
|
1891
|
+
code: I.not_multiple_of,
|
|
1892
1892
|
multipleOf: i.value,
|
|
1893
1893
|
message: i.message
|
|
1894
1894
|
}), r.dirty()) : i.kind === "finite" ? Number.isFinite(e.data) || (s = this._getOrReturnCtx(e, s), L(s, {
|
|
1895
|
-
code:
|
|
1895
|
+
code: I.not_finite,
|
|
1896
1896
|
message: i.message
|
|
1897
1897
|
}), r.dirty()) : te.assertNever(i);
|
|
1898
1898
|
return { status: r.value, value: e.data };
|
|
@@ -1910,7 +1910,7 @@ class Dt extends X {
|
|
|
1910
1910
|
return this.setLimit("max", e, !1, z.toString(t));
|
|
1911
1911
|
}
|
|
1912
1912
|
setLimit(e, t, s, r) {
|
|
1913
|
-
return new
|
|
1913
|
+
return new It({
|
|
1914
1914
|
...this._def,
|
|
1915
1915
|
checks: [
|
|
1916
1916
|
...this._def.checks,
|
|
@@ -1924,7 +1924,7 @@ class Dt extends X {
|
|
|
1924
1924
|
});
|
|
1925
1925
|
}
|
|
1926
1926
|
_addCheck(e) {
|
|
1927
|
-
return new
|
|
1927
|
+
return new It({
|
|
1928
1928
|
...this._def,
|
|
1929
1929
|
checks: [...this._def.checks, e]
|
|
1930
1930
|
});
|
|
@@ -2018,7 +2018,7 @@ class Dt extends X {
|
|
|
2018
2018
|
return Number.isFinite(t) && Number.isFinite(e);
|
|
2019
2019
|
}
|
|
2020
2020
|
}
|
|
2021
|
-
|
|
2021
|
+
It.create = (n) => new It({
|
|
2022
2022
|
checks: [],
|
|
2023
2023
|
typeName: G.ZodNumber,
|
|
2024
2024
|
coerce: n?.coerce || !1,
|
|
@@ -2041,19 +2041,19 @@ class en extends X {
|
|
|
2041
2041
|
const r = new ve();
|
|
2042
2042
|
for (const i of this._def.checks)
|
|
2043
2043
|
i.kind === "min" ? (i.inclusive ? e.data < i.value : e.data <= i.value) && (s = this._getOrReturnCtx(e, s), L(s, {
|
|
2044
|
-
code:
|
|
2044
|
+
code: I.too_small,
|
|
2045
2045
|
type: "bigint",
|
|
2046
2046
|
minimum: i.value,
|
|
2047
2047
|
inclusive: i.inclusive,
|
|
2048
2048
|
message: i.message
|
|
2049
2049
|
}), r.dirty()) : i.kind === "max" ? (i.inclusive ? e.data > i.value : e.data >= i.value) && (s = this._getOrReturnCtx(e, s), L(s, {
|
|
2050
|
-
code:
|
|
2050
|
+
code: I.too_big,
|
|
2051
2051
|
type: "bigint",
|
|
2052
2052
|
maximum: i.value,
|
|
2053
2053
|
inclusive: i.inclusive,
|
|
2054
2054
|
message: i.message
|
|
2055
2055
|
}), r.dirty()) : i.kind === "multipleOf" ? e.data % i.value !== BigInt(0) && (s = this._getOrReturnCtx(e, s), L(s, {
|
|
2056
|
-
code:
|
|
2056
|
+
code: I.not_multiple_of,
|
|
2057
2057
|
multipleOf: i.value,
|
|
2058
2058
|
message: i.message
|
|
2059
2059
|
}), r.dirty()) : te.assertNever(i);
|
|
@@ -2062,7 +2062,7 @@ class en extends X {
|
|
|
2062
2062
|
_getInvalidInput(e) {
|
|
2063
2063
|
const t = this._getOrReturnCtx(e);
|
|
2064
2064
|
return L(t, {
|
|
2065
|
-
code:
|
|
2065
|
+
code: I.invalid_type,
|
|
2066
2066
|
expected: U.bigint,
|
|
2067
2067
|
received: t.parsedType
|
|
2068
2068
|
}), Y;
|
|
@@ -2157,12 +2157,12 @@ en.create = (n) => new en({
|
|
|
2157
2157
|
coerce: n?.coerce ?? !1,
|
|
2158
2158
|
...J(n)
|
|
2159
2159
|
});
|
|
2160
|
-
class
|
|
2160
|
+
class _s extends X {
|
|
2161
2161
|
_parse(e) {
|
|
2162
2162
|
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== U.boolean) {
|
|
2163
2163
|
const s = this._getOrReturnCtx(e);
|
|
2164
2164
|
return L(s, {
|
|
2165
|
-
code:
|
|
2165
|
+
code: I.invalid_type,
|
|
2166
2166
|
expected: U.boolean,
|
|
2167
2167
|
received: s.parsedType
|
|
2168
2168
|
}), Y;
|
|
@@ -2170,7 +2170,7 @@ class Es extends X {
|
|
|
2170
2170
|
return Ae(e.data);
|
|
2171
2171
|
}
|
|
2172
2172
|
}
|
|
2173
|
-
|
|
2173
|
+
_s.create = (n) => new _s({
|
|
2174
2174
|
typeName: G.ZodBoolean,
|
|
2175
2175
|
coerce: n?.coerce || !1,
|
|
2176
2176
|
...J(n)
|
|
@@ -2180,7 +2180,7 @@ class xn extends X {
|
|
|
2180
2180
|
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== U.date) {
|
|
2181
2181
|
const i = this._getOrReturnCtx(e);
|
|
2182
2182
|
return L(i, {
|
|
2183
|
-
code:
|
|
2183
|
+
code: I.invalid_type,
|
|
2184
2184
|
expected: U.date,
|
|
2185
2185
|
received: i.parsedType
|
|
2186
2186
|
}), Y;
|
|
@@ -2188,21 +2188,21 @@ class xn extends X {
|
|
|
2188
2188
|
if (Number.isNaN(e.data.getTime())) {
|
|
2189
2189
|
const i = this._getOrReturnCtx(e);
|
|
2190
2190
|
return L(i, {
|
|
2191
|
-
code:
|
|
2191
|
+
code: I.invalid_date
|
|
2192
2192
|
}), Y;
|
|
2193
2193
|
}
|
|
2194
2194
|
const s = new ve();
|
|
2195
2195
|
let r;
|
|
2196
2196
|
for (const i of this._def.checks)
|
|
2197
2197
|
i.kind === "min" ? e.data.getTime() < i.value && (r = this._getOrReturnCtx(e, r), L(r, {
|
|
2198
|
-
code:
|
|
2198
|
+
code: I.too_small,
|
|
2199
2199
|
message: i.message,
|
|
2200
2200
|
inclusive: !0,
|
|
2201
2201
|
exact: !1,
|
|
2202
2202
|
minimum: i.value,
|
|
2203
2203
|
type: "date"
|
|
2204
2204
|
}), s.dirty()) : i.kind === "max" ? e.data.getTime() > i.value && (r = this._getOrReturnCtx(e, r), L(r, {
|
|
2205
|
-
code:
|
|
2205
|
+
code: I.too_big,
|
|
2206
2206
|
message: i.message,
|
|
2207
2207
|
inclusive: !0,
|
|
2208
2208
|
exact: !1,
|
|
@@ -2253,12 +2253,12 @@ xn.create = (n) => new xn({
|
|
|
2253
2253
|
typeName: G.ZodDate,
|
|
2254
2254
|
...J(n)
|
|
2255
2255
|
});
|
|
2256
|
-
class
|
|
2256
|
+
class dr extends X {
|
|
2257
2257
|
_parse(e) {
|
|
2258
2258
|
if (this._getType(e) !== U.symbol) {
|
|
2259
2259
|
const s = this._getOrReturnCtx(e);
|
|
2260
2260
|
return L(s, {
|
|
2261
|
-
code:
|
|
2261
|
+
code: I.invalid_type,
|
|
2262
2262
|
expected: U.symbol,
|
|
2263
2263
|
received: s.parsedType
|
|
2264
2264
|
}), Y;
|
|
@@ -2266,16 +2266,16 @@ class fr extends X {
|
|
|
2266
2266
|
return Ae(e.data);
|
|
2267
2267
|
}
|
|
2268
2268
|
}
|
|
2269
|
-
|
|
2269
|
+
dr.create = (n) => new dr({
|
|
2270
2270
|
typeName: G.ZodSymbol,
|
|
2271
2271
|
...J(n)
|
|
2272
2272
|
});
|
|
2273
|
-
class
|
|
2273
|
+
class Es extends X {
|
|
2274
2274
|
_parse(e) {
|
|
2275
2275
|
if (this._getType(e) !== U.undefined) {
|
|
2276
2276
|
const s = this._getOrReturnCtx(e);
|
|
2277
2277
|
return L(s, {
|
|
2278
|
-
code:
|
|
2278
|
+
code: I.invalid_type,
|
|
2279
2279
|
expected: U.undefined,
|
|
2280
2280
|
received: s.parsedType
|
|
2281
2281
|
}), Y;
|
|
@@ -2283,16 +2283,16 @@ class vs extends X {
|
|
|
2283
2283
|
return Ae(e.data);
|
|
2284
2284
|
}
|
|
2285
2285
|
}
|
|
2286
|
-
|
|
2286
|
+
Es.create = (n) => new Es({
|
|
2287
2287
|
typeName: G.ZodUndefined,
|
|
2288
2288
|
...J(n)
|
|
2289
2289
|
});
|
|
2290
|
-
class
|
|
2290
|
+
class fr extends X {
|
|
2291
2291
|
_parse(e) {
|
|
2292
2292
|
if (this._getType(e) !== U.null) {
|
|
2293
2293
|
const s = this._getOrReturnCtx(e);
|
|
2294
2294
|
return L(s, {
|
|
2295
|
-
code:
|
|
2295
|
+
code: I.invalid_type,
|
|
2296
2296
|
expected: U.null,
|
|
2297
2297
|
received: s.parsedType
|
|
2298
2298
|
}), Y;
|
|
@@ -2300,11 +2300,11 @@ class hr extends X {
|
|
|
2300
2300
|
return Ae(e.data);
|
|
2301
2301
|
}
|
|
2302
2302
|
}
|
|
2303
|
-
|
|
2303
|
+
fr.create = (n) => new fr({
|
|
2304
2304
|
typeName: G.ZodNull,
|
|
2305
2305
|
...J(n)
|
|
2306
2306
|
});
|
|
2307
|
-
class
|
|
2307
|
+
class vs extends X {
|
|
2308
2308
|
constructor() {
|
|
2309
2309
|
super(...arguments), this._any = !0;
|
|
2310
2310
|
}
|
|
@@ -2312,11 +2312,11 @@ class Os extends X {
|
|
|
2312
2312
|
return Ae(e.data);
|
|
2313
2313
|
}
|
|
2314
2314
|
}
|
|
2315
|
-
|
|
2315
|
+
vs.create = (n) => new vs({
|
|
2316
2316
|
typeName: G.ZodAny,
|
|
2317
2317
|
...J(n)
|
|
2318
2318
|
});
|
|
2319
|
-
class
|
|
2319
|
+
class hr extends X {
|
|
2320
2320
|
constructor() {
|
|
2321
2321
|
super(...arguments), this._unknown = !0;
|
|
2322
2322
|
}
|
|
@@ -2324,7 +2324,7 @@ class mr extends X {
|
|
|
2324
2324
|
return Ae(e.data);
|
|
2325
2325
|
}
|
|
2326
2326
|
}
|
|
2327
|
-
|
|
2327
|
+
hr.create = (n) => new hr({
|
|
2328
2328
|
typeName: G.ZodUnknown,
|
|
2329
2329
|
...J(n)
|
|
2330
2330
|
});
|
|
@@ -2332,7 +2332,7 @@ class ot extends X {
|
|
|
2332
2332
|
_parse(e) {
|
|
2333
2333
|
const t = this._getOrReturnCtx(e);
|
|
2334
2334
|
return L(t, {
|
|
2335
|
-
code:
|
|
2335
|
+
code: I.invalid_type,
|
|
2336
2336
|
expected: U.never,
|
|
2337
2337
|
received: t.parsedType
|
|
2338
2338
|
}), Y;
|
|
@@ -2342,12 +2342,12 @@ ot.create = (n) => new ot({
|
|
|
2342
2342
|
typeName: G.ZodNever,
|
|
2343
2343
|
...J(n)
|
|
2344
2344
|
});
|
|
2345
|
-
class
|
|
2345
|
+
class mr extends X {
|
|
2346
2346
|
_parse(e) {
|
|
2347
2347
|
if (this._getType(e) !== U.undefined) {
|
|
2348
2348
|
const s = this._getOrReturnCtx(e);
|
|
2349
2349
|
return L(s, {
|
|
2350
|
-
code:
|
|
2350
|
+
code: I.invalid_type,
|
|
2351
2351
|
expected: U.void,
|
|
2352
2352
|
received: s.parsedType
|
|
2353
2353
|
}), Y;
|
|
@@ -2355,7 +2355,7 @@ class pr extends X {
|
|
|
2355
2355
|
return Ae(e.data);
|
|
2356
2356
|
}
|
|
2357
2357
|
}
|
|
2358
|
-
|
|
2358
|
+
mr.create = (n) => new mr({
|
|
2359
2359
|
typeName: G.ZodVoid,
|
|
2360
2360
|
...J(n)
|
|
2361
2361
|
});
|
|
@@ -2364,14 +2364,14 @@ class Ue extends X {
|
|
|
2364
2364
|
const { ctx: t, status: s } = this._processInputParams(e), r = this._def;
|
|
2365
2365
|
if (t.parsedType !== U.array)
|
|
2366
2366
|
return L(t, {
|
|
2367
|
-
code:
|
|
2367
|
+
code: I.invalid_type,
|
|
2368
2368
|
expected: U.array,
|
|
2369
2369
|
received: t.parsedType
|
|
2370
2370
|
}), Y;
|
|
2371
2371
|
if (r.exactLength !== null) {
|
|
2372
2372
|
const o = t.data.length > r.exactLength.value, a = t.data.length < r.exactLength.value;
|
|
2373
2373
|
(o || a) && (L(t, {
|
|
2374
|
-
code: o ?
|
|
2374
|
+
code: o ? I.too_big : I.too_small,
|
|
2375
2375
|
minimum: a ? r.exactLength.value : void 0,
|
|
2376
2376
|
maximum: o ? r.exactLength.value : void 0,
|
|
2377
2377
|
type: "array",
|
|
@@ -2381,14 +2381,14 @@ class Ue extends X {
|
|
|
2381
2381
|
}), s.dirty());
|
|
2382
2382
|
}
|
|
2383
2383
|
if (r.minLength !== null && t.data.length < r.minLength.value && (L(t, {
|
|
2384
|
-
code:
|
|
2384
|
+
code: I.too_small,
|
|
2385
2385
|
minimum: r.minLength.value,
|
|
2386
2386
|
type: "array",
|
|
2387
2387
|
inclusive: !0,
|
|
2388
2388
|
exact: !1,
|
|
2389
2389
|
message: r.minLength.message
|
|
2390
2390
|
}), s.dirty()), r.maxLength !== null && t.data.length > r.maxLength.value && (L(t, {
|
|
2391
|
-
code:
|
|
2391
|
+
code: I.too_big,
|
|
2392
2392
|
maximum: r.maxLength.value,
|
|
2393
2393
|
type: "array",
|
|
2394
2394
|
inclusive: !0,
|
|
@@ -2462,7 +2462,7 @@ class fe extends X {
|
|
|
2462
2462
|
if (this._getType(e) !== U.object) {
|
|
2463
2463
|
const c = this._getOrReturnCtx(e);
|
|
2464
2464
|
return L(c, {
|
|
2465
|
-
code:
|
|
2465
|
+
code: I.invalid_type,
|
|
2466
2466
|
expected: U.object,
|
|
2467
2467
|
received: c.parsedType
|
|
2468
2468
|
}), Y;
|
|
@@ -2490,7 +2490,7 @@ class fe extends X {
|
|
|
2490
2490
|
});
|
|
2491
2491
|
else if (c === "strict")
|
|
2492
2492
|
a.length > 0 && (L(r, {
|
|
2493
|
-
code:
|
|
2493
|
+
code: I.unrecognized_keys,
|
|
2494
2494
|
keys: a
|
|
2495
2495
|
}), s.dirty());
|
|
2496
2496
|
else if (c !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
@@ -2735,7 +2735,7 @@ fe.lazycreate = (n, e) => new fe({
|
|
|
2735
2735
|
typeName: G.ZodObject,
|
|
2736
2736
|
...J(e)
|
|
2737
2737
|
});
|
|
2738
|
-
class
|
|
2738
|
+
class In extends X {
|
|
2739
2739
|
_parse(e) {
|
|
2740
2740
|
const { ctx: t } = this._processInputParams(e), s = this._def.options;
|
|
2741
2741
|
function r(i) {
|
|
@@ -2747,7 +2747,7 @@ class Dn extends X {
|
|
|
2747
2747
|
return t.common.issues.push(...a.ctx.common.issues), a.result;
|
|
2748
2748
|
const o = i.map((a) => new Be(a.ctx.common.issues));
|
|
2749
2749
|
return L(t, {
|
|
2750
|
-
code:
|
|
2750
|
+
code: I.invalid_union,
|
|
2751
2751
|
unionErrors: o
|
|
2752
2752
|
}), Y;
|
|
2753
2753
|
}
|
|
@@ -2794,7 +2794,7 @@ class Dn extends X {
|
|
|
2794
2794
|
return t.common.issues.push(...i.ctx.common.issues), i.result;
|
|
2795
2795
|
const a = o.map((l) => new Be(l));
|
|
2796
2796
|
return L(t, {
|
|
2797
|
-
code:
|
|
2797
|
+
code: I.invalid_union,
|
|
2798
2798
|
unionErrors: a
|
|
2799
2799
|
}), Y;
|
|
2800
2800
|
}
|
|
@@ -2803,19 +2803,19 @@ class Dn extends X {
|
|
|
2803
2803
|
return this._def.options;
|
|
2804
2804
|
}
|
|
2805
2805
|
}
|
|
2806
|
-
|
|
2806
|
+
In.create = (n, e) => new In({
|
|
2807
2807
|
options: n,
|
|
2808
2808
|
typeName: G.ZodUnion,
|
|
2809
2809
|
...J(e)
|
|
2810
2810
|
});
|
|
2811
|
-
function
|
|
2811
|
+
function Os(n, e) {
|
|
2812
2812
|
const t = Xe(n), s = Xe(e);
|
|
2813
2813
|
if (n === e)
|
|
2814
2814
|
return { valid: !0, data: n };
|
|
2815
2815
|
if (t === U.object && s === U.object) {
|
|
2816
2816
|
const r = te.objectKeys(e), i = te.objectKeys(n).filter((a) => r.indexOf(a) !== -1), o = { ...n, ...e };
|
|
2817
2817
|
for (const a of i) {
|
|
2818
|
-
const l =
|
|
2818
|
+
const l = Os(n[a], e[a]);
|
|
2819
2819
|
if (!l.valid)
|
|
2820
2820
|
return { valid: !1 };
|
|
2821
2821
|
o[a] = l.data;
|
|
@@ -2826,7 +2826,7 @@ function ks(n, e) {
|
|
|
2826
2826
|
return { valid: !1 };
|
|
2827
2827
|
const r = [];
|
|
2828
2828
|
for (let i = 0; i < n.length; i++) {
|
|
2829
|
-
const o = n[i], a = e[i], l =
|
|
2829
|
+
const o = n[i], a = e[i], l = Os(o, a);
|
|
2830
2830
|
if (!l.valid)
|
|
2831
2831
|
return { valid: !1 };
|
|
2832
2832
|
r.push(l.data);
|
|
@@ -2834,14 +2834,14 @@ function ks(n, e) {
|
|
|
2834
2834
|
return { valid: !0, data: r };
|
|
2835
2835
|
} else return t === U.date && s === U.date && +n == +e ? { valid: !0, data: n } : { valid: !1 };
|
|
2836
2836
|
}
|
|
2837
|
-
class
|
|
2837
|
+
class Dn extends X {
|
|
2838
2838
|
_parse(e) {
|
|
2839
2839
|
const { status: t, ctx: s } = this._processInputParams(e), r = (i, o) => {
|
|
2840
|
-
if (
|
|
2840
|
+
if (lr(i) || lr(o))
|
|
2841
2841
|
return Y;
|
|
2842
|
-
const a =
|
|
2843
|
-
return a.valid ? ((
|
|
2844
|
-
code:
|
|
2842
|
+
const a = Os(i.value, o.value);
|
|
2843
|
+
return a.valid ? ((cr(i) || cr(o)) && t.dirty(), { status: t.value, value: a.data }) : (L(s, {
|
|
2844
|
+
code: I.invalid_intersection_types
|
|
2845
2845
|
}), Y);
|
|
2846
2846
|
};
|
|
2847
2847
|
return s.common.async ? Promise.all([
|
|
@@ -2866,7 +2866,7 @@ class In extends X {
|
|
|
2866
2866
|
}));
|
|
2867
2867
|
}
|
|
2868
2868
|
}
|
|
2869
|
-
|
|
2869
|
+
Dn.create = (n, e, t) => new Dn({
|
|
2870
2870
|
left: n,
|
|
2871
2871
|
right: e,
|
|
2872
2872
|
typeName: G.ZodIntersection,
|
|
@@ -2877,20 +2877,20 @@ class yt extends X {
|
|
|
2877
2877
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2878
2878
|
if (s.parsedType !== U.array)
|
|
2879
2879
|
return L(s, {
|
|
2880
|
-
code:
|
|
2880
|
+
code: I.invalid_type,
|
|
2881
2881
|
expected: U.array,
|
|
2882
2882
|
received: s.parsedType
|
|
2883
2883
|
}), Y;
|
|
2884
2884
|
if (s.data.length < this._def.items.length)
|
|
2885
2885
|
return L(s, {
|
|
2886
|
-
code:
|
|
2886
|
+
code: I.too_small,
|
|
2887
2887
|
minimum: this._def.items.length,
|
|
2888
2888
|
inclusive: !0,
|
|
2889
2889
|
exact: !1,
|
|
2890
2890
|
type: "array"
|
|
2891
2891
|
}), Y;
|
|
2892
2892
|
!this._def.rest && s.data.length > this._def.items.length && (L(s, {
|
|
2893
|
-
code:
|
|
2893
|
+
code: I.too_big,
|
|
2894
2894
|
maximum: this._def.items.length,
|
|
2895
2895
|
inclusive: !0,
|
|
2896
2896
|
exact: !1,
|
|
@@ -2933,7 +2933,7 @@ class An extends X {
|
|
|
2933
2933
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2934
2934
|
if (s.parsedType !== U.object)
|
|
2935
2935
|
return L(s, {
|
|
2936
|
-
code:
|
|
2936
|
+
code: I.invalid_type,
|
|
2937
2937
|
expected: U.object,
|
|
2938
2938
|
received: s.parsedType
|
|
2939
2939
|
}), Y;
|
|
@@ -2963,7 +2963,7 @@ class An extends X {
|
|
|
2963
2963
|
});
|
|
2964
2964
|
}
|
|
2965
2965
|
}
|
|
2966
|
-
class
|
|
2966
|
+
class pr extends X {
|
|
2967
2967
|
get keySchema() {
|
|
2968
2968
|
return this._def.keyType;
|
|
2969
2969
|
}
|
|
@@ -2974,7 +2974,7 @@ class yr extends X {
|
|
|
2974
2974
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2975
2975
|
if (s.parsedType !== U.map)
|
|
2976
2976
|
return L(s, {
|
|
2977
|
-
code:
|
|
2977
|
+
code: I.invalid_type,
|
|
2978
2978
|
expected: U.map,
|
|
2979
2979
|
received: s.parsedType
|
|
2980
2980
|
}), Y;
|
|
@@ -3005,7 +3005,7 @@ class yr extends X {
|
|
|
3005
3005
|
}
|
|
3006
3006
|
}
|
|
3007
3007
|
}
|
|
3008
|
-
|
|
3008
|
+
pr.create = (n, e, t) => new pr({
|
|
3009
3009
|
valueType: e,
|
|
3010
3010
|
keyType: n,
|
|
3011
3011
|
typeName: G.ZodMap,
|
|
@@ -3016,20 +3016,20 @@ class tn extends X {
|
|
|
3016
3016
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
3017
3017
|
if (s.parsedType !== U.set)
|
|
3018
3018
|
return L(s, {
|
|
3019
|
-
code:
|
|
3019
|
+
code: I.invalid_type,
|
|
3020
3020
|
expected: U.set,
|
|
3021
3021
|
received: s.parsedType
|
|
3022
3022
|
}), Y;
|
|
3023
3023
|
const r = this._def;
|
|
3024
3024
|
r.minSize !== null && s.data.size < r.minSize.value && (L(s, {
|
|
3025
|
-
code:
|
|
3025
|
+
code: I.too_small,
|
|
3026
3026
|
minimum: r.minSize.value,
|
|
3027
3027
|
type: "set",
|
|
3028
3028
|
inclusive: !0,
|
|
3029
3029
|
exact: !1,
|
|
3030
3030
|
message: r.minSize.message
|
|
3031
3031
|
}), t.dirty()), r.maxSize !== null && s.data.size > r.maxSize.value && (L(s, {
|
|
3032
|
-
code:
|
|
3032
|
+
code: I.too_big,
|
|
3033
3033
|
maximum: r.maxSize.value,
|
|
3034
3034
|
type: "set",
|
|
3035
3035
|
inclusive: !0,
|
|
@@ -3075,7 +3075,7 @@ tn.create = (n, e) => new tn({
|
|
|
3075
3075
|
typeName: G.ZodSet,
|
|
3076
3076
|
...J(e)
|
|
3077
3077
|
});
|
|
3078
|
-
class
|
|
3078
|
+
class yr extends X {
|
|
3079
3079
|
get schema() {
|
|
3080
3080
|
return this._def.getter();
|
|
3081
3081
|
}
|
|
@@ -3084,18 +3084,18 @@ class gr extends X {
|
|
|
3084
3084
|
return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
|
|
3085
3085
|
}
|
|
3086
3086
|
}
|
|
3087
|
-
|
|
3087
|
+
yr.create = (n, e) => new yr({
|
|
3088
3088
|
getter: n,
|
|
3089
3089
|
typeName: G.ZodLazy,
|
|
3090
3090
|
...J(e)
|
|
3091
3091
|
});
|
|
3092
|
-
class
|
|
3092
|
+
class ks extends X {
|
|
3093
3093
|
_parse(e) {
|
|
3094
3094
|
if (e.data !== this._def.value) {
|
|
3095
3095
|
const t = this._getOrReturnCtx(e);
|
|
3096
3096
|
return L(t, {
|
|
3097
3097
|
received: t.data,
|
|
3098
|
-
code:
|
|
3098
|
+
code: I.invalid_literal,
|
|
3099
3099
|
expected: this._def.value
|
|
3100
3100
|
}), Y;
|
|
3101
3101
|
}
|
|
@@ -3105,33 +3105,33 @@ class bs extends X {
|
|
|
3105
3105
|
return this._def.value;
|
|
3106
3106
|
}
|
|
3107
3107
|
}
|
|
3108
|
-
|
|
3108
|
+
ks.create = (n, e) => new ks({
|
|
3109
3109
|
value: n,
|
|
3110
3110
|
typeName: G.ZodLiteral,
|
|
3111
3111
|
...J(e)
|
|
3112
3112
|
});
|
|
3113
3113
|
function gi(n, e) {
|
|
3114
|
-
return new
|
|
3114
|
+
return new Dt({
|
|
3115
3115
|
values: n,
|
|
3116
3116
|
typeName: G.ZodEnum,
|
|
3117
3117
|
...J(e)
|
|
3118
3118
|
});
|
|
3119
3119
|
}
|
|
3120
|
-
class
|
|
3120
|
+
class Dt extends X {
|
|
3121
3121
|
_parse(e) {
|
|
3122
3122
|
if (typeof e.data != "string") {
|
|
3123
3123
|
const t = this._getOrReturnCtx(e), s = this._def.values;
|
|
3124
3124
|
return L(t, {
|
|
3125
3125
|
expected: te.joinValues(s),
|
|
3126
3126
|
received: t.parsedType,
|
|
3127
|
-
code:
|
|
3127
|
+
code: I.invalid_type
|
|
3128
3128
|
}), Y;
|
|
3129
3129
|
}
|
|
3130
3130
|
if (this._cache || (this._cache = new Set(this._def.values)), !this._cache.has(e.data)) {
|
|
3131
3131
|
const t = this._getOrReturnCtx(e), s = this._def.values;
|
|
3132
3132
|
return L(t, {
|
|
3133
3133
|
received: t.data,
|
|
3134
|
-
code:
|
|
3134
|
+
code: I.invalid_enum_value,
|
|
3135
3135
|
options: s
|
|
3136
3136
|
}), Y;
|
|
3137
3137
|
}
|
|
@@ -3159,20 +3159,20 @@ class It extends X {
|
|
|
3159
3159
|
return e;
|
|
3160
3160
|
}
|
|
3161
3161
|
extract(e, t = this._def) {
|
|
3162
|
-
return
|
|
3162
|
+
return Dt.create(e, {
|
|
3163
3163
|
...this._def,
|
|
3164
3164
|
...t
|
|
3165
3165
|
});
|
|
3166
3166
|
}
|
|
3167
3167
|
exclude(e, t = this._def) {
|
|
3168
|
-
return
|
|
3168
|
+
return Dt.create(this.options.filter((s) => !e.includes(s)), {
|
|
3169
3169
|
...this._def,
|
|
3170
3170
|
...t
|
|
3171
3171
|
});
|
|
3172
3172
|
}
|
|
3173
3173
|
}
|
|
3174
|
-
|
|
3175
|
-
class
|
|
3174
|
+
Dt.create = gi;
|
|
3175
|
+
class gr extends X {
|
|
3176
3176
|
_parse(e) {
|
|
3177
3177
|
const t = te.getValidEnumValues(this._def.values), s = this._getOrReturnCtx(e);
|
|
3178
3178
|
if (s.parsedType !== U.string && s.parsedType !== U.number) {
|
|
@@ -3180,14 +3180,14 @@ class wr extends X {
|
|
|
3180
3180
|
return L(s, {
|
|
3181
3181
|
expected: te.joinValues(r),
|
|
3182
3182
|
received: s.parsedType,
|
|
3183
|
-
code:
|
|
3183
|
+
code: I.invalid_type
|
|
3184
3184
|
}), Y;
|
|
3185
3185
|
}
|
|
3186
3186
|
if (this._cache || (this._cache = new Set(te.getValidEnumValues(this._def.values))), !this._cache.has(e.data)) {
|
|
3187
3187
|
const r = te.objectValues(t);
|
|
3188
3188
|
return L(s, {
|
|
3189
3189
|
received: s.data,
|
|
3190
|
-
code:
|
|
3190
|
+
code: I.invalid_enum_value,
|
|
3191
3191
|
options: r
|
|
3192
3192
|
}), Y;
|
|
3193
3193
|
}
|
|
@@ -3197,7 +3197,7 @@ class wr extends X {
|
|
|
3197
3197
|
return this._def.values;
|
|
3198
3198
|
}
|
|
3199
3199
|
}
|
|
3200
|
-
|
|
3200
|
+
gr.create = (n, e) => new gr({
|
|
3201
3201
|
values: n,
|
|
3202
3202
|
typeName: G.ZodNativeEnum,
|
|
3203
3203
|
...J(e)
|
|
@@ -3210,7 +3210,7 @@ class Cn extends X {
|
|
|
3210
3210
|
const { ctx: t } = this._processInputParams(e);
|
|
3211
3211
|
if (t.parsedType !== U.promise && t.common.async === !1)
|
|
3212
3212
|
return L(t, {
|
|
3213
|
-
code:
|
|
3213
|
+
code: I.invalid_type,
|
|
3214
3214
|
expected: U.promise,
|
|
3215
3215
|
received: t.parsedType
|
|
3216
3216
|
}), Y;
|
|
@@ -3344,7 +3344,7 @@ Ct.create = (n, e) => new Ct({
|
|
|
3344
3344
|
typeName: G.ZodNullable,
|
|
3345
3345
|
...J(e)
|
|
3346
3346
|
});
|
|
3347
|
-
class
|
|
3347
|
+
class bs extends X {
|
|
3348
3348
|
_parse(e) {
|
|
3349
3349
|
const { ctx: t } = this._processInputParams(e);
|
|
3350
3350
|
let s = t.data;
|
|
@@ -3358,13 +3358,13 @@ class Ss extends X {
|
|
|
3358
3358
|
return this._def.innerType;
|
|
3359
3359
|
}
|
|
3360
3360
|
}
|
|
3361
|
-
|
|
3361
|
+
bs.create = (n, e) => new bs({
|
|
3362
3362
|
innerType: n,
|
|
3363
3363
|
typeName: G.ZodDefault,
|
|
3364
3364
|
defaultValue: typeof e.default == "function" ? e.default : () => e.default,
|
|
3365
3365
|
...J(e)
|
|
3366
3366
|
});
|
|
3367
|
-
class
|
|
3367
|
+
class Ss extends X {
|
|
3368
3368
|
_parse(e) {
|
|
3369
3369
|
const { ctx: t } = this._processInputParams(e), s = {
|
|
3370
3370
|
...t,
|
|
@@ -3401,18 +3401,18 @@ class Ts extends X {
|
|
|
3401
3401
|
return this._def.innerType;
|
|
3402
3402
|
}
|
|
3403
3403
|
}
|
|
3404
|
-
|
|
3404
|
+
Ss.create = (n, e) => new Ss({
|
|
3405
3405
|
innerType: n,
|
|
3406
3406
|
typeName: G.ZodCatch,
|
|
3407
3407
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
|
|
3408
3408
|
...J(e)
|
|
3409
3409
|
});
|
|
3410
|
-
class
|
|
3410
|
+
class wr extends X {
|
|
3411
3411
|
_parse(e) {
|
|
3412
3412
|
if (this._getType(e) !== U.nan) {
|
|
3413
3413
|
const s = this._getOrReturnCtx(e);
|
|
3414
3414
|
return L(s, {
|
|
3415
|
-
code:
|
|
3415
|
+
code: I.invalid_type,
|
|
3416
3416
|
expected: U.nan,
|
|
3417
3417
|
received: s.parsedType
|
|
3418
3418
|
}), Y;
|
|
@@ -3420,11 +3420,11 @@ class _r extends X {
|
|
|
3420
3420
|
return { status: "valid", value: e.data };
|
|
3421
3421
|
}
|
|
3422
3422
|
}
|
|
3423
|
-
|
|
3423
|
+
wr.create = (n) => new wr({
|
|
3424
3424
|
typeName: G.ZodNaN,
|
|
3425
3425
|
...J(n)
|
|
3426
3426
|
});
|
|
3427
|
-
class
|
|
3427
|
+
class Da extends X {
|
|
3428
3428
|
_parse(e) {
|
|
3429
3429
|
const { ctx: t } = this._processInputParams(e), s = t.data;
|
|
3430
3430
|
return this._def.type._parse({
|
|
@@ -3437,7 +3437,7 @@ class Ia extends X {
|
|
|
3437
3437
|
return this._def.type;
|
|
3438
3438
|
}
|
|
3439
3439
|
}
|
|
3440
|
-
class
|
|
3440
|
+
class js extends X {
|
|
3441
3441
|
_parse(e) {
|
|
3442
3442
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
3443
3443
|
if (s.common.async)
|
|
@@ -3470,14 +3470,14 @@ class Zs extends X {
|
|
|
3470
3470
|
}
|
|
3471
3471
|
}
|
|
3472
3472
|
static create(e, t) {
|
|
3473
|
-
return new
|
|
3473
|
+
return new js({
|
|
3474
3474
|
in: e,
|
|
3475
3475
|
out: t,
|
|
3476
3476
|
typeName: G.ZodPipeline
|
|
3477
3477
|
});
|
|
3478
3478
|
}
|
|
3479
3479
|
}
|
|
3480
|
-
class
|
|
3480
|
+
class Ts extends X {
|
|
3481
3481
|
_parse(e) {
|
|
3482
3482
|
const t = this._def.innerType._parse(e), s = (r) => (xt(r) && (r.value = Object.freeze(r.value)), r);
|
|
3483
3483
|
return Nn(t) ? t.then((r) => s(r)) : s(t);
|
|
@@ -3486,7 +3486,7 @@ class Rs extends X {
|
|
|
3486
3486
|
return this._def.innerType;
|
|
3487
3487
|
}
|
|
3488
3488
|
}
|
|
3489
|
-
|
|
3489
|
+
Ts.create = (n, e) => new Ts({
|
|
3490
3490
|
innerType: n,
|
|
3491
3491
|
typeName: G.ZodReadonly,
|
|
3492
3492
|
...J(e)
|
|
@@ -3495,18 +3495,18 @@ var G;
|
|
|
3495
3495
|
(function(n) {
|
|
3496
3496
|
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";
|
|
3497
3497
|
})(G || (G = {}));
|
|
3498
|
-
const be = qe.create, ht =
|
|
3498
|
+
const be = qe.create, ht = It.create, Kt = _s.create, ss = Es.create, ge = vs.create;
|
|
3499
3499
|
ot.create;
|
|
3500
|
-
const _t = Ue.create, We = fe.create, Oe =
|
|
3501
|
-
|
|
3500
|
+
const _t = Ue.create, We = fe.create, Oe = In.create;
|
|
3501
|
+
Dn.create;
|
|
3502
3502
|
yt.create;
|
|
3503
|
-
const rn = An.create, ke =
|
|
3503
|
+
const rn = An.create, ke = ks.create, $n = Dt.create;
|
|
3504
3504
|
Cn.create;
|
|
3505
3505
|
st.create;
|
|
3506
3506
|
Ct.create;
|
|
3507
3507
|
const wn = () => ge().refine((n) => n && (n.seconds !== void 0 && n.nanoseconds !== void 0 || n._seconds !== void 0 && n._nanoseconds !== void 0), {
|
|
3508
3508
|
message: "Value is not a valid timestamp"
|
|
3509
|
-
}),
|
|
3509
|
+
}), _r = () => ge().refine((n) => n && (n._methodName === "serverTimestamp" || n.constructor.name === "ServerTimestampTransform"), {
|
|
3510
3510
|
message: "Value is not a valid server timestamp"
|
|
3511
3511
|
}), wi = (n, e) => {
|
|
3512
3512
|
const t = {};
|
|
@@ -3585,7 +3585,7 @@ const wn = () => ge().refine((n) => n && (n.seconds !== void 0 && n.nanoseconds
|
|
|
3585
3585
|
Collection_Path: _t(be()),
|
|
3586
3586
|
Last_Write_App: be(),
|
|
3587
3587
|
Last_Write_At: wn(),
|
|
3588
|
-
Last_Save_At:
|
|
3588
|
+
Last_Save_At: _r(),
|
|
3589
3589
|
Last_Write_By: Oe([be().length(28), ke("System")]),
|
|
3590
3590
|
Last_Write_Connection_Status: $n(["Online", "Offline"]),
|
|
3591
3591
|
Last_Write_Version: ht().int(),
|
|
@@ -3593,7 +3593,7 @@ const wn = () => ge().refine((n) => n && (n.seconds !== void 0 && n.nanoseconds
|
|
|
3593
3593
|
Created_At: wn(),
|
|
3594
3594
|
Created_By: Oe([be().length(28), ke("System")])
|
|
3595
3595
|
};
|
|
3596
|
-
n === "create" && (s.Saved_At =
|
|
3596
|
+
n === "create" && (s.Saved_At = _r()), 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());
|
|
3597
3597
|
const r = ft(e, e.fields), i = Array.from(r).map((l) => l.name);
|
|
3598
3598
|
e.fields.forEach((l) => {
|
|
3599
3599
|
K(l) ? (s[l.name] = Aa(l, t), s[`${l.name}_Array`] = Ca(l), i.includes(l.name) && (s[`${l.name}_Single`] = wi(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, {
|
|
@@ -3694,13 +3694,13 @@ const $ = "numeric", Pe = "short", Se = "long", Fn = {
|
|
|
3694
3694
|
second: $,
|
|
3695
3695
|
hourCycle: "h23",
|
|
3696
3696
|
timeZoneName: Pe
|
|
3697
|
-
},
|
|
3697
|
+
}, Ii = {
|
|
3698
3698
|
hour: $,
|
|
3699
3699
|
minute: $,
|
|
3700
3700
|
second: $,
|
|
3701
3701
|
hourCycle: "h23",
|
|
3702
3702
|
timeZoneName: Se
|
|
3703
|
-
},
|
|
3703
|
+
}, Di = {
|
|
3704
3704
|
year: $,
|
|
3705
3705
|
month: $,
|
|
3706
3706
|
day: $,
|
|
@@ -3892,9 +3892,9 @@ class qn extends on {
|
|
|
3892
3892
|
return !0;
|
|
3893
3893
|
}
|
|
3894
3894
|
}
|
|
3895
|
-
const
|
|
3895
|
+
const Rs = /* @__PURE__ */ new Map();
|
|
3896
3896
|
function Ua(n) {
|
|
3897
|
-
let e =
|
|
3897
|
+
let e = Rs.get(n);
|
|
3898
3898
|
return e === void 0 && (e = new Intl.DateTimeFormat("en-US", {
|
|
3899
3899
|
hour12: !1,
|
|
3900
3900
|
timeZone: n,
|
|
@@ -3905,7 +3905,7 @@ function Ua(n) {
|
|
|
3905
3905
|
minute: "2-digit",
|
|
3906
3906
|
second: "2-digit",
|
|
3907
3907
|
era: "short"
|
|
3908
|
-
}),
|
|
3908
|
+
}), Rs.set(n, e)), e;
|
|
3909
3909
|
}
|
|
3910
3910
|
const Wa = {
|
|
3911
3911
|
year: 0,
|
|
@@ -3943,7 +3943,7 @@ class He extends on {
|
|
|
3943
3943
|
* @return {void}
|
|
3944
3944
|
*/
|
|
3945
3945
|
static resetCache() {
|
|
3946
|
-
is.clear(),
|
|
3946
|
+
is.clear(), Rs.clear();
|
|
3947
3947
|
}
|
|
3948
3948
|
/**
|
|
3949
3949
|
* Returns whether the provided string is a valid specifier. This only checks the string's format, not that the specifier identifies a known zone; see isValidZone for that.
|
|
@@ -4068,17 +4068,17 @@ class He extends on {
|
|
|
4068
4068
|
return this.valid;
|
|
4069
4069
|
}
|
|
4070
4070
|
}
|
|
4071
|
-
let
|
|
4071
|
+
let Er = {};
|
|
4072
4072
|
function za(n, e = {}) {
|
|
4073
4073
|
const t = JSON.stringify([n, e]);
|
|
4074
|
-
let s =
|
|
4075
|
-
return s || (s = new Intl.ListFormat(n, e),
|
|
4074
|
+
let s = Er[t];
|
|
4075
|
+
return s || (s = new Intl.ListFormat(n, e), Er[t] = s), s;
|
|
4076
4076
|
}
|
|
4077
|
-
const
|
|
4078
|
-
function
|
|
4077
|
+
const Ns = /* @__PURE__ */ new Map();
|
|
4078
|
+
function xs(n, e = {}) {
|
|
4079
4079
|
const t = JSON.stringify([n, e]);
|
|
4080
|
-
let s =
|
|
4081
|
-
return s === void 0 && (s = new Intl.DateTimeFormat(n, e),
|
|
4080
|
+
let s = Ns.get(t);
|
|
4081
|
+
return s === void 0 && (s = new Intl.DateTimeFormat(n, e), Ns.set(t, s)), s;
|
|
4082
4082
|
}
|
|
4083
4083
|
const Is = /* @__PURE__ */ new Map();
|
|
4084
4084
|
function qa(n, e = {}) {
|
|
@@ -4086,27 +4086,27 @@ function qa(n, e = {}) {
|
|
|
4086
4086
|
let s = Is.get(t);
|
|
4087
4087
|
return s === void 0 && (s = new Intl.NumberFormat(n, e), Is.set(t, s)), s;
|
|
4088
4088
|
}
|
|
4089
|
-
const
|
|
4089
|
+
const Ds = /* @__PURE__ */ new Map();
|
|
4090
4090
|
function Ba(n, e = {}) {
|
|
4091
4091
|
const { base: t, ...s } = e, r = JSON.stringify([n, s]);
|
|
4092
|
-
let i =
|
|
4093
|
-
return i === void 0 && (i = new Intl.RelativeTimeFormat(n, e),
|
|
4092
|
+
let i = Ds.get(r);
|
|
4093
|
+
return i === void 0 && (i = new Intl.RelativeTimeFormat(n, e), Ds.set(r, i)), i;
|
|
4094
4094
|
}
|
|
4095
4095
|
let Ht = null;
|
|
4096
4096
|
function Ha() {
|
|
4097
4097
|
return Ht || (Ht = new Intl.DateTimeFormat().resolvedOptions().locale, Ht);
|
|
4098
4098
|
}
|
|
4099
|
-
const
|
|
4099
|
+
const As = /* @__PURE__ */ new Map();
|
|
4100
4100
|
function Vi(n) {
|
|
4101
|
-
let e =
|
|
4102
|
-
return e === void 0 && (e = new Intl.DateTimeFormat(n).resolvedOptions(),
|
|
4101
|
+
let e = As.get(n);
|
|
4102
|
+
return e === void 0 && (e = new Intl.DateTimeFormat(n).resolvedOptions(), As.set(n, e)), e;
|
|
4103
4103
|
}
|
|
4104
|
-
const
|
|
4104
|
+
const Cs = /* @__PURE__ */ new Map();
|
|
4105
4105
|
function Ga(n) {
|
|
4106
|
-
let e =
|
|
4106
|
+
let e = Cs.get(n);
|
|
4107
4107
|
if (!e) {
|
|
4108
4108
|
const t = new Intl.Locale(n);
|
|
4109
|
-
e = "getWeekInfo" in t ? t.getWeekInfo() : t.weekInfo, "minimalDays" in e || (e = { ...Ui, ...e }),
|
|
4109
|
+
e = "getWeekInfo" in t ? t.getWeekInfo() : t.weekInfo, "minimalDays" in e || (e = { ...Ui, ...e }), Cs.set(n, e);
|
|
4110
4110
|
}
|
|
4111
4111
|
return e;
|
|
4112
4112
|
}
|
|
@@ -4119,10 +4119,10 @@ function Ya(n) {
|
|
|
4119
4119
|
{
|
|
4120
4120
|
let s, r;
|
|
4121
4121
|
try {
|
|
4122
|
-
s =
|
|
4122
|
+
s = xs(n).resolvedOptions(), r = n;
|
|
4123
4123
|
} catch {
|
|
4124
4124
|
const l = n.substring(0, t);
|
|
4125
|
-
s =
|
|
4125
|
+
s = xs(l).resolvedOptions(), r = l;
|
|
4126
4126
|
}
|
|
4127
4127
|
const { numberingSystem: i, calendar: o } = s;
|
|
4128
4128
|
return [r, i, o];
|
|
@@ -4168,7 +4168,7 @@ class el {
|
|
|
4168
4168
|
const t = this.floor ? Math.floor(e) : e;
|
|
4169
4169
|
return this.inf.format(t);
|
|
4170
4170
|
} else {
|
|
4171
|
-
const t = this.floor ? Math.floor(e) :
|
|
4171
|
+
const t = this.floor ? Math.floor(e) : Hs(e, 3);
|
|
4172
4172
|
return he(t, this.padTo);
|
|
4173
4173
|
}
|
|
4174
4174
|
}
|
|
@@ -4184,7 +4184,7 @@ class tl {
|
|
|
4184
4184
|
e.offset !== 0 && He.create(a).valid ? (r = a, this.dt = e) : (r = "UTC", this.dt = e.offset === 0 ? e : e.setZone("UTC").plus({ minutes: e.offset }), this.originalZone = e.zone);
|
|
4185
4185
|
} else e.zone.type === "system" ? this.dt = e : e.zone.type === "iana" ? (this.dt = e, r = e.zone.name) : (r = "UTC", this.dt = e.setZone("UTC").plus({ minutes: e.offset }), this.originalZone = e.zone);
|
|
4186
4186
|
const i = { ...this.opts };
|
|
4187
|
-
i.timeZone = i.timeZone || r, this.dtf =
|
|
4187
|
+
i.timeZone = i.timeZone || r, this.dtf = xs(t, i);
|
|
4188
4188
|
}
|
|
4189
4189
|
format() {
|
|
4190
4190
|
return this.originalZone ? this.formatToParts().map(({ value: e }) => e).join("") : this.dtf.format(this.dt.toJSDate());
|
|
@@ -4236,11 +4236,11 @@ class se {
|
|
|
4236
4236
|
);
|
|
4237
4237
|
}
|
|
4238
4238
|
static create(e, t, s, r, i = !1) {
|
|
4239
|
-
const o = e || ce.defaultLocale, a = o || (i ? "en-US" : Ha()), l = t || ce.defaultNumberingSystem, c = s || ce.defaultOutputCalendar, u =
|
|
4239
|
+
const o = e || ce.defaultLocale, a = o || (i ? "en-US" : Ha()), l = t || ce.defaultNumberingSystem, c = s || ce.defaultOutputCalendar, u = Ms(r) || ce.defaultWeekSettings;
|
|
4240
4240
|
return new se(a, l, c, u, o);
|
|
4241
4241
|
}
|
|
4242
4242
|
static resetCache() {
|
|
4243
|
-
Ht = null,
|
|
4243
|
+
Ht = null, Ns.clear(), Is.clear(), Ds.clear(), As.clear(), Cs.clear();
|
|
4244
4244
|
}
|
|
4245
4245
|
static fromObject({ locale: e, numberingSystem: t, outputCalendar: s, weekSettings: r } = {}) {
|
|
4246
4246
|
return se.create(e, t, s, r);
|
|
@@ -4261,7 +4261,7 @@ class se {
|
|
|
4261
4261
|
e.locale || this.specifiedLocale,
|
|
4262
4262
|
e.numberingSystem || this.numberingSystem,
|
|
4263
4263
|
e.outputCalendar || this.outputCalendar,
|
|
4264
|
-
|
|
4264
|
+
Ms(e.weekSettings) || this.weekSettings,
|
|
4265
4265
|
e.defaultToEN || !1
|
|
4266
4266
|
);
|
|
4267
4267
|
}
|
|
@@ -4520,7 +4520,7 @@ function tt(n, e) {
|
|
|
4520
4520
|
return t === "default" ? e : t === "local" || t === "system" ? qn.instance : t === "utc" || t === "gmt" ? Ee.utcInstance : Ee.parseSpecifier(t) || He.create(n);
|
|
4521
4521
|
} else return rt(n) ? Ee.instance(n) : typeof n == "object" && "offset" in n && typeof n.offset == "function" ? n : new sl(n);
|
|
4522
4522
|
}
|
|
4523
|
-
const
|
|
4523
|
+
const Zs = {
|
|
4524
4524
|
arab: "[٠-٩]",
|
|
4525
4525
|
arabext: "[۰-۹]",
|
|
4526
4526
|
bali: "[᭐-᭙]",
|
|
@@ -4542,7 +4542,7 @@ const zs = {
|
|
|
4542
4542
|
thai: "[๐-๙]",
|
|
4543
4543
|
tibt: "[༠-༩]",
|
|
4544
4544
|
latn: "\\d"
|
|
4545
|
-
},
|
|
4545
|
+
}, vr = {
|
|
4546
4546
|
arab: [1632, 1641],
|
|
4547
4547
|
arabext: [1776, 1785],
|
|
4548
4548
|
bali: [6992, 7001],
|
|
@@ -4562,18 +4562,18 @@ const zs = {
|
|
|
4562
4562
|
telu: [3174, 3183],
|
|
4563
4563
|
thai: [3664, 3673],
|
|
4564
4564
|
tibt: [3872, 3881]
|
|
4565
|
-
}, rl =
|
|
4565
|
+
}, rl = Zs.hanidec.replace(/[\[|\]]/g, "").split("");
|
|
4566
4566
|
function il(n) {
|
|
4567
4567
|
let e = parseInt(n, 10);
|
|
4568
4568
|
if (isNaN(e)) {
|
|
4569
4569
|
e = "";
|
|
4570
4570
|
for (let t = 0; t < n.length; t++) {
|
|
4571
4571
|
const s = n.charCodeAt(t);
|
|
4572
|
-
if (n[t].search(
|
|
4572
|
+
if (n[t].search(Zs.hanidec) !== -1)
|
|
4573
4573
|
e += rl.indexOf(n[t]);
|
|
4574
4574
|
else
|
|
4575
|
-
for (const r in
|
|
4576
|
-
const [i, o] =
|
|
4575
|
+
for (const r in vr) {
|
|
4576
|
+
const [i, o] = vr[r];
|
|
4577
4577
|
s >= i && s <= o && (e += s - i);
|
|
4578
4578
|
}
|
|
4579
4579
|
}
|
|
@@ -4581,25 +4581,25 @@ function il(n) {
|
|
|
4581
4581
|
} else
|
|
4582
4582
|
return e;
|
|
4583
4583
|
}
|
|
4584
|
-
const
|
|
4584
|
+
const $s = /* @__PURE__ */ new Map();
|
|
4585
4585
|
function ol() {
|
|
4586
|
-
|
|
4586
|
+
$s.clear();
|
|
4587
4587
|
}
|
|
4588
4588
|
function Ce({ numberingSystem: n }, e = "") {
|
|
4589
4589
|
const t = n || "latn";
|
|
4590
|
-
let s =
|
|
4591
|
-
s === void 0 && (s = /* @__PURE__ */ new Map(),
|
|
4590
|
+
let s = $s.get(t);
|
|
4591
|
+
s === void 0 && (s = /* @__PURE__ */ new Map(), $s.set(t, s));
|
|
4592
4592
|
let r = s.get(e);
|
|
4593
|
-
return r === void 0 && (r = new RegExp(`${
|
|
4593
|
+
return r === void 0 && (r = new RegExp(`${Zs[t]}${e}`), s.set(e, r)), r;
|
|
4594
4594
|
}
|
|
4595
|
-
let
|
|
4595
|
+
let Or = () => Date.now(), kr = "system", br = null, Sr = null, Tr = null, Rr = 60, Nr, xr = null;
|
|
4596
4596
|
class ce {
|
|
4597
4597
|
/**
|
|
4598
4598
|
* Get the callback for returning the current timestamp.
|
|
4599
4599
|
* @type {function}
|
|
4600
4600
|
*/
|
|
4601
4601
|
static get now() {
|
|
4602
|
-
return
|
|
4602
|
+
return Or;
|
|
4603
4603
|
}
|
|
4604
4604
|
/**
|
|
4605
4605
|
* Set the callback for returning the current timestamp.
|
|
@@ -4609,7 +4609,7 @@ class ce {
|
|
|
4609
4609
|
* @example Settings.now = () => 0 // always pretend it's Jan 1, 1970 at midnight in UTC time
|
|
4610
4610
|
*/
|
|
4611
4611
|
static set now(e) {
|
|
4612
|
-
|
|
4612
|
+
Or = e;
|
|
4613
4613
|
}
|
|
4614
4614
|
/**
|
|
4615
4615
|
* Set the default time zone to create DateTimes in. Does not affect existing instances.
|
|
@@ -4617,7 +4617,7 @@ class ce {
|
|
|
4617
4617
|
* @type {string}
|
|
4618
4618
|
*/
|
|
4619
4619
|
static set defaultZone(e) {
|
|
4620
|
-
|
|
4620
|
+
kr = e;
|
|
4621
4621
|
}
|
|
4622
4622
|
/**
|
|
4623
4623
|
* Get the default time zone object currently used to create DateTimes. Does not affect existing instances.
|
|
@@ -4625,49 +4625,49 @@ class ce {
|
|
|
4625
4625
|
* @type {Zone}
|
|
4626
4626
|
*/
|
|
4627
4627
|
static get defaultZone() {
|
|
4628
|
-
return tt(
|
|
4628
|
+
return tt(kr, qn.instance);
|
|
4629
4629
|
}
|
|
4630
4630
|
/**
|
|
4631
4631
|
* Get the default locale to create DateTimes with. Does not affect existing instances.
|
|
4632
4632
|
* @type {string}
|
|
4633
4633
|
*/
|
|
4634
4634
|
static get defaultLocale() {
|
|
4635
|
-
return
|
|
4635
|
+
return br;
|
|
4636
4636
|
}
|
|
4637
4637
|
/**
|
|
4638
4638
|
* Set the default locale to create DateTimes with. Does not affect existing instances.
|
|
4639
4639
|
* @type {string}
|
|
4640
4640
|
*/
|
|
4641
4641
|
static set defaultLocale(e) {
|
|
4642
|
-
|
|
4642
|
+
br = e;
|
|
4643
4643
|
}
|
|
4644
4644
|
/**
|
|
4645
4645
|
* Get the default numbering system to create DateTimes with. Does not affect existing instances.
|
|
4646
4646
|
* @type {string}
|
|
4647
4647
|
*/
|
|
4648
4648
|
static get defaultNumberingSystem() {
|
|
4649
|
-
return
|
|
4649
|
+
return Sr;
|
|
4650
4650
|
}
|
|
4651
4651
|
/**
|
|
4652
4652
|
* Set the default numbering system to create DateTimes with. Does not affect existing instances.
|
|
4653
4653
|
* @type {string}
|
|
4654
4654
|
*/
|
|
4655
4655
|
static set defaultNumberingSystem(e) {
|
|
4656
|
-
|
|
4656
|
+
Sr = e;
|
|
4657
4657
|
}
|
|
4658
4658
|
/**
|
|
4659
4659
|
* Get the default output calendar to create DateTimes with. Does not affect existing instances.
|
|
4660
4660
|
* @type {string}
|
|
4661
4661
|
*/
|
|
4662
4662
|
static get defaultOutputCalendar() {
|
|
4663
|
-
return
|
|
4663
|
+
return Tr;
|
|
4664
4664
|
}
|
|
4665
4665
|
/**
|
|
4666
4666
|
* Set the default output calendar to create DateTimes with. Does not affect existing instances.
|
|
4667
4667
|
* @type {string}
|
|
4668
4668
|
*/
|
|
4669
4669
|
static set defaultOutputCalendar(e) {
|
|
4670
|
-
|
|
4670
|
+
Tr = e;
|
|
4671
4671
|
}
|
|
4672
4672
|
/**
|
|
4673
4673
|
* @typedef {Object} WeekSettings
|
|
@@ -4679,7 +4679,7 @@ class ce {
|
|
|
4679
4679
|
* @return {WeekSettings|null}
|
|
4680
4680
|
*/
|
|
4681
4681
|
static get defaultWeekSettings() {
|
|
4682
|
-
return
|
|
4682
|
+
return xr;
|
|
4683
4683
|
}
|
|
4684
4684
|
/**
|
|
4685
4685
|
* Allows overriding the default locale week settings, i.e. the start of the week, the weekend and
|
|
@@ -4689,14 +4689,14 @@ class ce {
|
|
|
4689
4689
|
* @param {WeekSettings|null} weekSettings
|
|
4690
4690
|
*/
|
|
4691
4691
|
static set defaultWeekSettings(e) {
|
|
4692
|
-
|
|
4692
|
+
xr = Ms(e);
|
|
4693
4693
|
}
|
|
4694
4694
|
/**
|
|
4695
4695
|
* Get the cutoff year for whether a 2-digit year string is interpreted in the current or previous century. Numbers higher than the cutoff will be considered to mean 19xx and numbers lower or equal to the cutoff will be considered 20xx.
|
|
4696
4696
|
* @type {number}
|
|
4697
4697
|
*/
|
|
4698
4698
|
static get twoDigitCutoffYear() {
|
|
4699
|
-
return
|
|
4699
|
+
return Rr;
|
|
4700
4700
|
}
|
|
4701
4701
|
/**
|
|
4702
4702
|
* Set the cutoff year for whether a 2-digit year string is interpreted in the current or previous century. Numbers higher than the cutoff will be considered to mean 19xx and numbers lower or equal to the cutoff will be considered 20xx.
|
|
@@ -4708,21 +4708,21 @@ class ce {
|
|
|
4708
4708
|
* @example Settings.twoDigitCutoffYear = 2050 // ALSO interpreted as 50
|
|
4709
4709
|
*/
|
|
4710
4710
|
static set twoDigitCutoffYear(e) {
|
|
4711
|
-
|
|
4711
|
+
Rr = e % 100;
|
|
4712
4712
|
}
|
|
4713
4713
|
/**
|
|
4714
4714
|
* Get whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals
|
|
4715
4715
|
* @type {boolean}
|
|
4716
4716
|
*/
|
|
4717
4717
|
static get throwOnInvalid() {
|
|
4718
|
-
return
|
|
4718
|
+
return Nr;
|
|
4719
4719
|
}
|
|
4720
4720
|
/**
|
|
4721
4721
|
* Set whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals
|
|
4722
4722
|
* @type {boolean}
|
|
4723
4723
|
*/
|
|
4724
4724
|
static set throwOnInvalid(e) {
|
|
4725
|
-
|
|
4725
|
+
Nr = e;
|
|
4726
4726
|
}
|
|
4727
4727
|
/**
|
|
4728
4728
|
* Reset Luxon's global caches. Should only be necessary in testing scenarios.
|
|
@@ -4747,7 +4747,7 @@ function Ne(n, e) {
|
|
|
4747
4747
|
`you specified ${e} (of type ${typeof e}) as a ${n}, which is invalid`
|
|
4748
4748
|
);
|
|
4749
4749
|
}
|
|
4750
|
-
function
|
|
4750
|
+
function zs(n, e, t) {
|
|
4751
4751
|
const s = new Date(Date.UTC(n, e - 1, t));
|
|
4752
4752
|
n < 100 && n >= 0 && s.setUTCFullYear(s.getUTCFullYear() - 1900);
|
|
4753
4753
|
const r = s.getUTCDay();
|
|
@@ -4760,16 +4760,16 @@ function zi(n, e) {
|
|
|
4760
4760
|
const t = an(n) ? ji : Wi, s = t.findIndex((i) => i < e), r = e - t[s];
|
|
4761
4761
|
return { month: s + 1, day: r };
|
|
4762
4762
|
}
|
|
4763
|
-
function
|
|
4763
|
+
function qs(n, e) {
|
|
4764
4764
|
return (n - e + 7) % 7 + 1;
|
|
4765
4765
|
}
|
|
4766
4766
|
function Pn(n, e = 4, t = 1) {
|
|
4767
|
-
const { year: s, month: r, day: i } = n, o = Zi(s, r, i), a =
|
|
4767
|
+
const { year: s, month: r, day: i } = n, o = Zi(s, r, i), a = qs(zs(s, r, i), t);
|
|
4768
4768
|
let l = Math.floor((o - a + 14 - e) / 7), c;
|
|
4769
4769
|
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, ...Yn(n) };
|
|
4770
4770
|
}
|
|
4771
4771
|
function Ir(n, e = 4, t = 1) {
|
|
4772
|
-
const { weekYear: s, weekNumber: r, weekday: i } = n, o =
|
|
4772
|
+
const { weekYear: s, weekNumber: r, weekday: i } = n, o = qs(zs(s, 1, e), t), a = Rt(s);
|
|
4773
4773
|
let l = r * 7 + i - o - 7 + e, c;
|
|
4774
4774
|
l < 1 ? (c = s - 1, l += Rt(c)) : l > a ? (c = s + 1, l -= Rt(s)) : c = s;
|
|
4775
4775
|
const { month: u, day: h } = zi(c, l);
|
|
@@ -4779,11 +4779,11 @@ function as(n) {
|
|
|
4779
4779
|
const { year: e, month: t, day: s } = n, r = Zi(e, t, s);
|
|
4780
4780
|
return { year: e, ordinal: r, ...Yn(n) };
|
|
4781
4781
|
}
|
|
4782
|
-
function
|
|
4782
|
+
function Dr(n) {
|
|
4783
4783
|
const { year: e, ordinal: t } = n, { month: s, day: r } = zi(e, t);
|
|
4784
4784
|
return { year: e, month: s, day: r, ...Yn(n) };
|
|
4785
4785
|
}
|
|
4786
|
-
function
|
|
4786
|
+
function Ar(n, e) {
|
|
4787
4787
|
if (!H(n.localWeekday) || !H(n.localWeekNumber) || !H(n.localWeekYear)) {
|
|
4788
4788
|
if (!H(n.weekday) || !H(n.weekNumber) || !H(n.weekYear))
|
|
4789
4789
|
throw new St(
|
|
@@ -4848,7 +4848,7 @@ function Gi() {
|
|
|
4848
4848
|
function dl(n) {
|
|
4849
4849
|
return Array.isArray(n) ? n : [n];
|
|
4850
4850
|
}
|
|
4851
|
-
function
|
|
4851
|
+
function Cr(n, e, t) {
|
|
4852
4852
|
if (n.length !== 0)
|
|
4853
4853
|
return n.reduce((s, r) => {
|
|
4854
4854
|
const i = [e(r), r];
|
|
@@ -4861,7 +4861,7 @@ function fl(n, e) {
|
|
|
4861
4861
|
function $t(n, e) {
|
|
4862
4862
|
return Object.prototype.hasOwnProperty.call(n, e);
|
|
4863
4863
|
}
|
|
4864
|
-
function
|
|
4864
|
+
function Ms(n) {
|
|
4865
4865
|
if (n == null)
|
|
4866
4866
|
return null;
|
|
4867
4867
|
if (typeof n != "object")
|
|
@@ -4893,13 +4893,13 @@ function ut(n) {
|
|
|
4893
4893
|
if (!(H(n) || n === null || n === ""))
|
|
4894
4894
|
return parseFloat(n);
|
|
4895
4895
|
}
|
|
4896
|
-
function
|
|
4896
|
+
function Bs(n) {
|
|
4897
4897
|
if (!(H(n) || n === null || n === "")) {
|
|
4898
4898
|
const e = parseFloat("0." + n) * 1e3;
|
|
4899
4899
|
return Math.floor(e);
|
|
4900
4900
|
}
|
|
4901
4901
|
}
|
|
4902
|
-
function
|
|
4902
|
+
function Hs(n, e, t = "round") {
|
|
4903
4903
|
const s = 10 ** e;
|
|
4904
4904
|
switch (t) {
|
|
4905
4905
|
case "expand":
|
|
@@ -4938,14 +4938,14 @@ function Hn(n) {
|
|
|
4938
4938
|
);
|
|
4939
4939
|
return n.year < 100 && n.year >= 0 && (e = new Date(e), e.setUTCFullYear(n.year, n.month - 1, n.day)), +e;
|
|
4940
4940
|
}
|
|
4941
|
-
function
|
|
4942
|
-
return -
|
|
4941
|
+
function $r(n, e, t) {
|
|
4942
|
+
return -qs(zs(n, 1, e), t) + e - 1;
|
|
4943
4943
|
}
|
|
4944
4944
|
function nn(n, e = 4, t = 1) {
|
|
4945
|
-
const s =
|
|
4945
|
+
const s = $r(n, e, t), r = $r(n + 1, e, t);
|
|
4946
4946
|
return (Rt(n) - s + r) / 7;
|
|
4947
4947
|
}
|
|
4948
|
-
function
|
|
4948
|
+
function Fs(n) {
|
|
4949
4949
|
return n > 99 ? n : n > ce.twoDigitCutoffYear ? 1900 + n : 2e3 + n;
|
|
4950
4950
|
}
|
|
4951
4951
|
function Yi(n, e, t, s = null) {
|
|
@@ -5115,7 +5115,7 @@ function bl(n, e, t = "always", s = !1) {
|
|
|
5115
5115
|
const o = Object.is(e, -0) || e < 0, a = Math.abs(e), l = a === 1, c = r[n], u = s ? l ? c[1] : c[2] || c[1] : l ? r[n][0] : n;
|
|
5116
5116
|
return o ? `${a} ${u} ago` : `in ${a} ${u}`;
|
|
5117
5117
|
}
|
|
5118
|
-
function
|
|
5118
|
+
function Mr(n, e) {
|
|
5119
5119
|
let t = "";
|
|
5120
5120
|
for (const s of n)
|
|
5121
5121
|
s.literal ? t += s.val : t += e(s.val);
|
|
@@ -5133,8 +5133,8 @@ const Sl = {
|
|
|
5133
5133
|
T: Ri,
|
|
5134
5134
|
TT: Ni,
|
|
5135
5135
|
TTT: xi,
|
|
5136
|
-
TTTT:
|
|
5137
|
-
f:
|
|
5136
|
+
TTTT: Ii,
|
|
5137
|
+
f: Di,
|
|
5138
5138
|
ff: Ci,
|
|
5139
5139
|
fff: Mi,
|
|
5140
5140
|
ffff: Pi,
|
|
@@ -5339,7 +5339,7 @@ class _e {
|
|
|
5339
5339
|
return u(d);
|
|
5340
5340
|
}
|
|
5341
5341
|
};
|
|
5342
|
-
return
|
|
5342
|
+
return Mr(_e.parseFormat(t), f);
|
|
5343
5343
|
}
|
|
5344
5344
|
formatDurationFromString(e, t) {
|
|
5345
5345
|
const s = this.opts.signMode === "negativeLargestOnly" ? -1 : 1, r = (u) => {
|
|
@@ -5380,7 +5380,7 @@ class _e {
|
|
|
5380
5380
|
// in order
|
|
5381
5381
|
largestUnit: Object.keys(l.values)[0]
|
|
5382
5382
|
};
|
|
5383
|
-
return
|
|
5383
|
+
return Mr(o, i(l, c));
|
|
5384
5384
|
}
|
|
5385
5385
|
}
|
|
5386
5386
|
const ro = /[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;
|
|
@@ -5416,8 +5416,8 @@ function io(...n) {
|
|
|
5416
5416
|
return [s, null, t + r];
|
|
5417
5417
|
};
|
|
5418
5418
|
}
|
|
5419
|
-
const oo = /(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/, Tl = `(?:${oo.source}?(?:\\[(${ro.source})\\])?)?`,
|
|
5420
|
-
`${
|
|
5419
|
+
const oo = /(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/, Tl = `(?:${oo.source}?(?:\\[(${ro.source})\\])?)?`, Gs = /(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/, ao = RegExp(`${Gs.source}${Tl}`), Ys = RegExp(`(?:[Tt]${ao.source})?`), Rl = /([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/, Nl = /(\d{4})-?W(\d\d)(?:-?(\d))?/, xl = /(\d{4})-?(\d{3})/, Il = io("weekYear", "weekNumber", "weekDay"), Dl = io("year", "ordinal"), Al = /(\d{4})-(\d\d)-(\d\d)/, lo = RegExp(
|
|
5420
|
+
`${Gs.source} ?(?:${oo.source}|(${ro.source}))?`
|
|
5421
5421
|
), Cl = RegExp(`(?: ${lo.source})?`);
|
|
5422
5422
|
function Nt(n, e, t) {
|
|
5423
5423
|
const s = n[e];
|
|
@@ -5435,7 +5435,7 @@ function Vt(n, e) {
|
|
|
5435
5435
|
hours: Nt(n, e, 0),
|
|
5436
5436
|
minutes: Nt(n, e + 1, 0),
|
|
5437
5437
|
seconds: Nt(n, e + 2, 0),
|
|
5438
|
-
milliseconds:
|
|
5438
|
+
milliseconds: Bs(n[e + 3])
|
|
5439
5439
|
}, null, e + 4];
|
|
5440
5440
|
}
|
|
5441
5441
|
function ln(n, e) {
|
|
@@ -5446,7 +5446,7 @@ function cn(n, e) {
|
|
|
5446
5446
|
const t = n[e] ? He.create(n[e]) : null;
|
|
5447
5447
|
return [{}, t, e + 1];
|
|
5448
5448
|
}
|
|
5449
|
-
const Ml = RegExp(`^T?${
|
|
5449
|
+
const Ml = RegExp(`^T?${Gs.source}$`), Fl = /^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;
|
|
5450
5450
|
function Pl(n) {
|
|
5451
5451
|
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;
|
|
5452
5452
|
return [
|
|
@@ -5458,7 +5458,7 @@ function Pl(n) {
|
|
|
5458
5458
|
hours: f(ut(o)),
|
|
5459
5459
|
minutes: f(ut(a)),
|
|
5460
5460
|
seconds: f(ut(l), l === "-0"),
|
|
5461
|
-
milliseconds: f(
|
|
5461
|
+
milliseconds: f(Bs(c), h)
|
|
5462
5462
|
}
|
|
5463
5463
|
];
|
|
5464
5464
|
}
|
|
@@ -5473,9 +5473,9 @@ const Ll = {
|
|
|
5473
5473
|
PDT: -420,
|
|
5474
5474
|
PST: -480
|
|
5475
5475
|
};
|
|
5476
|
-
function
|
|
5476
|
+
function Js(n, e, t, s, r, i, o) {
|
|
5477
5477
|
const a = {
|
|
5478
|
-
year: e.length === 2 ?
|
|
5478
|
+
year: e.length === 2 ? Fs(et(e)) : et(e),
|
|
5479
5479
|
month: Qi.indexOf(t) + 1,
|
|
5480
5480
|
day: et(s),
|
|
5481
5481
|
hour: et(r),
|
|
@@ -5498,7 +5498,7 @@ function Ul(n) {
|
|
|
5498
5498
|
c,
|
|
5499
5499
|
u,
|
|
5500
5500
|
h
|
|
5501
|
-
] = n, f =
|
|
5501
|
+
] = n, f = Js(e, r, s, t, i, o, a);
|
|
5502
5502
|
let d;
|
|
5503
5503
|
return l ? d = Ll[l] : c ? d = 0 : d = Gn(u, h), [f, new Ee(d)];
|
|
5504
5504
|
}
|
|
@@ -5506,26 +5506,26 @@ function Wl(n) {
|
|
|
5506
5506
|
return n.replace(/\([^()]*\)|[\n\t]/g, " ").replace(/(\s\s+)/g, " ").trim();
|
|
5507
5507
|
}
|
|
5508
5508
|
const jl = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/, Zl = /^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/, zl = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;
|
|
5509
|
-
function
|
|
5509
|
+
function Fr(n) {
|
|
5510
5510
|
const [, e, t, s, r, i, o, a] = n;
|
|
5511
|
-
return [
|
|
5511
|
+
return [Js(e, r, s, t, i, o, a), Ee.utcInstance];
|
|
5512
5512
|
}
|
|
5513
5513
|
function ql(n) {
|
|
5514
5514
|
const [, e, t, s, r, i, o, a] = n;
|
|
5515
|
-
return [
|
|
5515
|
+
return [Js(e, a, t, s, r, i, o), Ee.utcInstance];
|
|
5516
5516
|
}
|
|
5517
|
-
const Bl = Ft(Rl,
|
|
5517
|
+
const Bl = Ft(Rl, Ys), Hl = Ft(Nl, Ys), Gl = Ft(xl, Ys), Yl = Ft(ao), co = Pt(
|
|
5518
5518
|
$l,
|
|
5519
5519
|
Vt,
|
|
5520
5520
|
ln,
|
|
5521
5521
|
cn
|
|
5522
5522
|
), Jl = Pt(
|
|
5523
|
-
|
|
5523
|
+
Il,
|
|
5524
5524
|
Vt,
|
|
5525
5525
|
ln,
|
|
5526
5526
|
cn
|
|
5527
5527
|
), Ql = Pt(
|
|
5528
|
-
|
|
5528
|
+
Dl,
|
|
5529
5529
|
Vt,
|
|
5530
5530
|
ln,
|
|
5531
5531
|
cn
|
|
@@ -5549,8 +5549,8 @@ function ec(n) {
|
|
|
5549
5549
|
function tc(n) {
|
|
5550
5550
|
return Lt(
|
|
5551
5551
|
n,
|
|
5552
|
-
[jl,
|
|
5553
|
-
[Zl,
|
|
5552
|
+
[jl, Fr],
|
|
5553
|
+
[Zl, Fr],
|
|
5554
5554
|
[zl, ql]
|
|
5555
5555
|
);
|
|
5556
5556
|
}
|
|
@@ -5573,7 +5573,7 @@ function lc(n) {
|
|
|
5573
5573
|
[oc, ac]
|
|
5574
5574
|
);
|
|
5575
5575
|
}
|
|
5576
|
-
const
|
|
5576
|
+
const Pr = "Invalid Duration", uo = {
|
|
5577
5577
|
weeks: {
|
|
5578
5578
|
days: 7,
|
|
5579
5579
|
hours: 168,
|
|
@@ -5674,7 +5674,7 @@ function fo(n, e) {
|
|
|
5674
5674
|
e[s] && (t += e[s] * n[s].milliseconds);
|
|
5675
5675
|
return t;
|
|
5676
5676
|
}
|
|
5677
|
-
function
|
|
5677
|
+
function Lr(n, e) {
|
|
5678
5678
|
const t = fo(n, e) < 0 ? -1 : 1;
|
|
5679
5679
|
mt.reduceRight((s, r) => {
|
|
5680
5680
|
if (H(e[r]))
|
|
@@ -5694,7 +5694,7 @@ function Vr(n, e) {
|
|
|
5694
5694
|
return r;
|
|
5695
5695
|
}, null);
|
|
5696
5696
|
}
|
|
5697
|
-
function
|
|
5697
|
+
function Vr(n) {
|
|
5698
5698
|
const e = {};
|
|
5699
5699
|
for (const [t, s] of Object.entries(n))
|
|
5700
5700
|
s !== 0 && (e[t] = s);
|
|
@@ -5907,7 +5907,7 @@ class ee {
|
|
|
5907
5907
|
...t,
|
|
5908
5908
|
floor: t.round !== !1 && t.floor !== !1
|
|
5909
5909
|
};
|
|
5910
|
-
return this.isValid ? _e.create(this.loc, s).formatDurationFromString(this, e) :
|
|
5910
|
+
return this.isValid ? _e.create(this.loc, s).formatDurationFromString(this, e) : Pr;
|
|
5911
5911
|
}
|
|
5912
5912
|
/**
|
|
5913
5913
|
* Returns a string representation of a Duration with all units included.
|
|
@@ -5926,7 +5926,7 @@ class ee {
|
|
|
5926
5926
|
* ```
|
|
5927
5927
|
*/
|
|
5928
5928
|
toHuman(e = {}) {
|
|
5929
|
-
if (!this.isValid) return
|
|
5929
|
+
if (!this.isValid) return Pr;
|
|
5930
5930
|
const t = e.showZeros !== !1, s = mt.map((r) => {
|
|
5931
5931
|
const i = this.values[r];
|
|
5932
5932
|
return H(i) || i === 0 && !t ? null : this.loc.numberFormatter({ style: "unit", unitDisplay: "long", ...e, unit: r.slice(0, -1) }).format(i);
|
|
@@ -5954,7 +5954,7 @@ class ee {
|
|
|
5954
5954
|
toISO() {
|
|
5955
5955
|
if (!this.isValid) return null;
|
|
5956
5956
|
let e = "P";
|
|
5957
|
-
return this.years !== 0 && (e += this.years + "Y"), (this.months !== 0 || this.quarters !== 0) && (e += this.months + this.quarters * 3 + "M"), this.weeks !== 0 && (e += this.weeks + "W"), this.days !== 0 && (e += this.days + "D"), (this.hours !== 0 || this.minutes !== 0 || this.seconds !== 0 || this.milliseconds !== 0) && (e += "T"), this.hours !== 0 && (e += this.hours + "H"), this.minutes !== 0 && (e += this.minutes + "M"), (this.seconds !== 0 || this.milliseconds !== 0) && (e +=
|
|
5957
|
+
return this.years !== 0 && (e += this.years + "Y"), (this.months !== 0 || this.quarters !== 0) && (e += this.months + this.quarters * 3 + "M"), this.weeks !== 0 && (e += this.weeks + "W"), this.days !== 0 && (e += this.days + "D"), (this.hours !== 0 || this.minutes !== 0 || this.seconds !== 0 || this.milliseconds !== 0) && (e += "T"), this.hours !== 0 && (e += this.hours + "H"), this.minutes !== 0 && (e += this.minutes + "M"), (this.seconds !== 0 || this.milliseconds !== 0) && (e += Hs(this.seconds + this.milliseconds / 1e3, 3) + "S"), e === "P" && (e += "T0S"), e;
|
|
5958
5958
|
}
|
|
5959
5959
|
/**
|
|
5960
5960
|
* Returns an ISO 8601-compliant string representation of this Duration, formatted as a time of day.
|
|
@@ -6002,7 +6002,7 @@ class ee {
|
|
|
6002
6002
|
* Returns a string representation of this Duration appropriate for the REPL.
|
|
6003
6003
|
* @return {string}
|
|
6004
6004
|
*/
|
|
6005
|
-
[Symbol.for("nodejs.util.inspect.custom")]() {
|
|
6005
|
+
[/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")]() {
|
|
6006
6006
|
return this.isValid ? `Duration { values: ${JSON.stringify(this.values)} }` : `Duration { Invalid, reason: ${this.invalidReason} }`;
|
|
6007
6007
|
}
|
|
6008
6008
|
/**
|
|
@@ -6116,7 +6116,7 @@ class ee {
|
|
|
6116
6116
|
normalize() {
|
|
6117
6117
|
if (!this.isValid) return this;
|
|
6118
6118
|
const e = this.toObject();
|
|
6119
|
-
return
|
|
6119
|
+
return Lr(this.matrix, e), Ze(this, { values: e }, !0);
|
|
6120
6120
|
}
|
|
6121
6121
|
/**
|
|
6122
6122
|
* Rescale units to its largest representation
|
|
@@ -6125,7 +6125,7 @@ class ee {
|
|
|
6125
6125
|
*/
|
|
6126
6126
|
rescale() {
|
|
6127
6127
|
if (!this.isValid) return this;
|
|
6128
|
-
const e =
|
|
6128
|
+
const e = Vr(this.normalize().shiftToAll().toObject());
|
|
6129
6129
|
return Ze(this, { values: e }, !0);
|
|
6130
6130
|
}
|
|
6131
6131
|
/**
|
|
@@ -6152,7 +6152,7 @@ class ee {
|
|
|
6152
6152
|
} else rt(r[o]) && (s[o] = r[o]);
|
|
6153
6153
|
for (const o in s)
|
|
6154
6154
|
s[o] !== 0 && (t[i] += o === i ? s[o] : s[o] / this.matrix[i][o]);
|
|
6155
|
-
return
|
|
6155
|
+
return Lr(this.matrix, t), Ze(this, { values: t }, !0);
|
|
6156
6156
|
}
|
|
6157
6157
|
/**
|
|
6158
6158
|
* Shift this Duration to all available units.
|
|
@@ -6190,7 +6190,7 @@ class ee {
|
|
|
6190
6190
|
*/
|
|
6191
6191
|
removeZeros() {
|
|
6192
6192
|
if (!this.isValid) return this;
|
|
6193
|
-
const e =
|
|
6193
|
+
const e = Vr(this.values);
|
|
6194
6194
|
return Ze(this, { values: e }, !0);
|
|
6195
6195
|
}
|
|
6196
6196
|
/**
|
|
@@ -6671,7 +6671,7 @@ class le {
|
|
|
6671
6671
|
* Returns a string representation of this Interval appropriate for the REPL.
|
|
6672
6672
|
* @return {string}
|
|
6673
6673
|
*/
|
|
6674
|
-
[Symbol.for("nodejs.util.inspect.custom")]() {
|
|
6674
|
+
[/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")]() {
|
|
6675
6675
|
return this.isValid ? `Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }` : `Interval { Invalid, reason: ${this.invalidReason} }`;
|
|
6676
6676
|
}
|
|
6677
6677
|
/**
|
|
@@ -6934,7 +6934,7 @@ class hn {
|
|
|
6934
6934
|
return { relative: Hi(), localeWeek: Gi() };
|
|
6935
6935
|
}
|
|
6936
6936
|
}
|
|
6937
|
-
function
|
|
6937
|
+
function Ur(n, e) {
|
|
6938
6938
|
const t = (r) => r.toUTC(0, { keepLocalTime: !0 }).startOf("day").valueOf(), s = t(e) - t(n);
|
|
6939
6939
|
return Math.floor(ee.fromMillis(s).as("days"));
|
|
6940
6940
|
}
|
|
@@ -6946,11 +6946,11 @@ function hc(n, e, t) {
|
|
|
6946
6946
|
[
|
|
6947
6947
|
"weeks",
|
|
6948
6948
|
(l, c) => {
|
|
6949
|
-
const u =
|
|
6949
|
+
const u = Ur(l, c);
|
|
6950
6950
|
return (u - u % 7) / 7;
|
|
6951
6951
|
}
|
|
6952
6952
|
],
|
|
6953
|
-
["days",
|
|
6953
|
+
["days", Ur]
|
|
6954
6954
|
], r = {}, i = n;
|
|
6955
6955
|
let o, a;
|
|
6956
6956
|
for (const [l, c] of s)
|
|
@@ -6974,16 +6974,16 @@ const yc = " ", ho = `[ ${yc}]`, mo = new RegExp(ho, "g");
|
|
|
6974
6974
|
function gc(n) {
|
|
6975
6975
|
return n.replace(/\./g, "\\.?").replace(mo, ho);
|
|
6976
6976
|
}
|
|
6977
|
-
function
|
|
6977
|
+
function Wr(n) {
|
|
6978
6978
|
return n.replace(/\./g, "").replace(mo, " ").toLowerCase();
|
|
6979
6979
|
}
|
|
6980
6980
|
function $e(n, e) {
|
|
6981
6981
|
return n === null ? null : {
|
|
6982
6982
|
regex: RegExp(n.map(gc).join("|")),
|
|
6983
|
-
deser: ([t]) => n.findIndex((s) =>
|
|
6983
|
+
deser: ([t]) => n.findIndex((s) => Wr(t) === Wr(s)) + e
|
|
6984
6984
|
};
|
|
6985
6985
|
}
|
|
6986
|
-
function
|
|
6986
|
+
function jr(n, e) {
|
|
6987
6987
|
return { regex: n, deser: ([, t, s]) => Gn(t, s), groups: e };
|
|
6988
6988
|
}
|
|
6989
6989
|
function mn(n) {
|
|
@@ -7006,7 +7006,7 @@ function _c(n, e) {
|
|
|
7006
7006
|
case "y":
|
|
7007
7007
|
return ne(c);
|
|
7008
7008
|
case "yy":
|
|
7009
|
-
return ne(h,
|
|
7009
|
+
return ne(h, Fs);
|
|
7010
7010
|
case "yyyy":
|
|
7011
7011
|
return ne(i);
|
|
7012
7012
|
case "yyyyy":
|
|
@@ -7078,7 +7078,7 @@ function _c(n, e) {
|
|
|
7078
7078
|
case "kkkk":
|
|
7079
7079
|
return ne(i);
|
|
7080
7080
|
case "kk":
|
|
7081
|
-
return ne(h,
|
|
7081
|
+
return ne(h, Fs);
|
|
7082
7082
|
// weekNumber (W)
|
|
7083
7083
|
case "W":
|
|
7084
7084
|
return ne(a);
|
|
@@ -7099,9 +7099,9 @@ function _c(n, e) {
|
|
|
7099
7099
|
// offset/zone
|
|
7100
7100
|
case "Z":
|
|
7101
7101
|
case "ZZ":
|
|
7102
|
-
return
|
|
7102
|
+
return jr(new RegExp(`([+-]${a.source})(?::(${s.source}))?`), 2);
|
|
7103
7103
|
case "ZZZ":
|
|
7104
|
-
return
|
|
7104
|
+
return jr(new RegExp(`([+-]${a.source})(${s.source})?`), 2);
|
|
7105
7105
|
// we don't support ZZZZ (PST) or ZZZZZ (Pacific Standard Time) in parsing
|
|
7106
7106
|
// because we don't have any way to figure out what they are
|
|
7107
7107
|
case "z":
|
|
@@ -7231,7 +7231,7 @@ function bc(n) {
|
|
|
7231
7231
|
}
|
|
7232
7232
|
};
|
|
7233
7233
|
let t = null, s;
|
|
7234
|
-
return H(n.z) || (t = He.create(n.z)), H(n.Z) || (t || (t = new Ee(n.Z)), s = n.Z), H(n.q) || (n.M = (n.q - 1) * 3 + 1), H(n.h) || (n.h < 12 && n.a === 1 ? n.h += 12 : n.h === 12 && n.a === 0 && (n.h = 0)), n.G === 0 && n.y && (n.y = -n.y), H(n.u) || (n.S =
|
|
7234
|
+
return H(n.z) || (t = He.create(n.z)), H(n.Z) || (t || (t = new Ee(n.Z)), s = n.Z), H(n.q) || (n.M = (n.q - 1) * 3 + 1), H(n.h) || (n.h < 12 && n.a === 1 ? n.h += 12 : n.h === 12 && n.a === 0 && (n.h = 0)), n.G === 0 && n.y && (n.y = -n.y), H(n.u) || (n.S = Bs(n.u)), [Object.keys(n).reduce((i, o) => {
|
|
7235
7235
|
const a = e(o);
|
|
7236
7236
|
return a && (i[a] = n[o]), i;
|
|
7237
7237
|
}, {}), t, s];
|
|
@@ -7296,7 +7296,7 @@ function wo(n, e) {
|
|
|
7296
7296
|
const s = _e.create(e, n).dtFormatter(Sc()), r = s.formatToParts(), i = s.resolvedOptions();
|
|
7297
7297
|
return r.map((o) => vc(o, n, i));
|
|
7298
7298
|
}
|
|
7299
|
-
const cs = "Invalid DateTime",
|
|
7299
|
+
const cs = "Invalid DateTime", Zr = 864e13;
|
|
7300
7300
|
function Gt(n) {
|
|
7301
7301
|
return new Fe("unsupported zone", `the zone "${n.name}" is not supported`);
|
|
7302
7302
|
}
|
|
@@ -7346,7 +7346,7 @@ function pn(n, e) {
|
|
|
7346
7346
|
function _n(n, e, t) {
|
|
7347
7347
|
return _o(Hn(n), e, t);
|
|
7348
7348
|
}
|
|
7349
|
-
function
|
|
7349
|
+
function zr(n, e) {
|
|
7350
7350
|
const t = n.o, s = n.c.year + Math.trunc(e.years), r = n.c.month + Math.trunc(e.months) + Math.trunc(e.quarters) * 3, i = {
|
|
7351
7351
|
...n.c,
|
|
7352
7352
|
year: s,
|
|
@@ -7396,7 +7396,7 @@ function fs(n, e, t) {
|
|
|
7396
7396
|
} else if (r += he(n.c.month), t === "month") return r;
|
|
7397
7397
|
return r += he(n.c.day), r;
|
|
7398
7398
|
}
|
|
7399
|
-
function
|
|
7399
|
+
function qr(n, e, t, s, r, i, o) {
|
|
7400
7400
|
let a = !t || n.c.millisecond !== 0 || n.c.second !== 0, l = "";
|
|
7401
7401
|
switch (o) {
|
|
7402
7402
|
case "day":
|
|
@@ -7437,7 +7437,7 @@ const Eo = {
|
|
|
7437
7437
|
minute: 0,
|
|
7438
7438
|
second: 0,
|
|
7439
7439
|
millisecond: 0
|
|
7440
|
-
}, En = ["year", "month", "day", "hour", "minute", "second", "millisecond"],
|
|
7440
|
+
}, En = ["year", "month", "day", "hour", "minute", "second", "millisecond"], Ic = [
|
|
7441
7441
|
"weekYear",
|
|
7442
7442
|
"weekNumber",
|
|
7443
7443
|
"weekday",
|
|
@@ -7445,7 +7445,7 @@ const Eo = {
|
|
|
7445
7445
|
"minute",
|
|
7446
7446
|
"second",
|
|
7447
7447
|
"millisecond"
|
|
7448
|
-
],
|
|
7448
|
+
], Dc = ["year", "ordinal", "hour", "minute", "second", "millisecond"];
|
|
7449
7449
|
function vn(n) {
|
|
7450
7450
|
const e = {
|
|
7451
7451
|
year: "year",
|
|
@@ -7476,7 +7476,7 @@ function vn(n) {
|
|
|
7476
7476
|
if (!e) throw new _i(n);
|
|
7477
7477
|
return e;
|
|
7478
7478
|
}
|
|
7479
|
-
function
|
|
7479
|
+
function Br(n) {
|
|
7480
7480
|
switch (n.toLowerCase()) {
|
|
7481
7481
|
case "localweekday":
|
|
7482
7482
|
case "localweekdays":
|
|
@@ -7495,10 +7495,10 @@ function Ac(n) {
|
|
|
7495
7495
|
if (Yt === void 0 && (Yt = ce.now()), n.type !== "iana")
|
|
7496
7496
|
return n.offset(Yt);
|
|
7497
7497
|
const e = n.name;
|
|
7498
|
-
let t =
|
|
7499
|
-
return t === void 0 && (t = n.offset(Yt),
|
|
7498
|
+
let t = Ps.get(e);
|
|
7499
|
+
return t === void 0 && (t = n.offset(Yt), Ps.set(e, t)), t;
|
|
7500
7500
|
}
|
|
7501
|
-
function
|
|
7501
|
+
function Hr(n, e) {
|
|
7502
7502
|
const t = tt(e.zone, ce.defaultZone);
|
|
7503
7503
|
if (!t.isValid)
|
|
7504
7504
|
return V.invalid(Gt(t));
|
|
@@ -7517,8 +7517,8 @@ function Gr(n, e) {
|
|
|
7517
7517
|
}
|
|
7518
7518
|
return new V({ ts: r, zone: t, loc: s, o: i });
|
|
7519
7519
|
}
|
|
7520
|
-
function
|
|
7521
|
-
const s = H(t.round) ? !0 : t.round, r = H(t.rounding) ? "trunc" : t.rounding, i = (a, l) => (a =
|
|
7520
|
+
function Gr(n, e, t) {
|
|
7521
|
+
const s = H(t.round) ? !0 : t.round, r = H(t.rounding) ? "trunc" : t.rounding, i = (a, l) => (a = Hs(a, s || t.calendary ? 0 : 2, t.calendary ? "round" : r), e.loc.clone(t).relFormatter(t).format(a, l)), o = (a) => t.calendary ? e.hasSame(n, a) ? 0 : e.startOf(a).diff(n.startOf(a), a).get(a) : e.diff(n, a).get(a);
|
|
7522
7522
|
if (t.unit)
|
|
7523
7523
|
return i(o(t.unit), t.unit);
|
|
7524
7524
|
for (const a of t.units) {
|
|
@@ -7528,12 +7528,12 @@ function Yr(n, e, t) {
|
|
|
7528
7528
|
}
|
|
7529
7529
|
return i(n > e ? -0 : 0, t.units[t.units.length - 1]);
|
|
7530
7530
|
}
|
|
7531
|
-
function
|
|
7531
|
+
function Yr(n) {
|
|
7532
7532
|
let e = {}, t;
|
|
7533
7533
|
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];
|
|
7534
7534
|
}
|
|
7535
7535
|
let Yt;
|
|
7536
|
-
const
|
|
7536
|
+
const Ps = /* @__PURE__ */ new Map();
|
|
7537
7537
|
class V {
|
|
7538
7538
|
/**
|
|
7539
7539
|
* @access private
|
|
@@ -7585,8 +7585,8 @@ class V {
|
|
|
7585
7585
|
* @return {DateTime}
|
|
7586
7586
|
*/
|
|
7587
7587
|
static local() {
|
|
7588
|
-
const [e, t] =
|
|
7589
|
-
return
|
|
7588
|
+
const [e, t] = Yr(arguments), [s, r, i, o, a, l, c] = t;
|
|
7589
|
+
return Hr({ year: s, month: r, day: i, hour: o, minute: a, second: l, millisecond: c }, e);
|
|
7590
7590
|
}
|
|
7591
7591
|
/**
|
|
7592
7592
|
* Create a DateTime in UTC
|
|
@@ -7614,8 +7614,8 @@ class V {
|
|
|
7614
7614
|
* @return {DateTime}
|
|
7615
7615
|
*/
|
|
7616
7616
|
static utc() {
|
|
7617
|
-
const [e, t] =
|
|
7618
|
-
return e.zone = Ee.utcInstance,
|
|
7617
|
+
const [e, t] = Yr(arguments), [s, r, i, o, a, l, c] = t;
|
|
7618
|
+
return e.zone = Ee.utcInstance, Hr({ year: s, month: r, day: i, hour: o, minute: a, second: l, millisecond: c }, e);
|
|
7619
7619
|
}
|
|
7620
7620
|
/**
|
|
7621
7621
|
* Create a DateTime from a JavaScript Date object. Uses the default zone.
|
|
@@ -7648,7 +7648,7 @@ class V {
|
|
|
7648
7648
|
*/
|
|
7649
7649
|
static fromMillis(e, t = {}) {
|
|
7650
7650
|
if (rt(e))
|
|
7651
|
-
return e < -
|
|
7651
|
+
return e < -Zr || e > Zr ? V.invalid("Timestamp out of range") : new V({
|
|
7652
7652
|
ts: e,
|
|
7653
7653
|
zone: tt(t.zone, ce.defaultZone),
|
|
7654
7654
|
loc: se.fromObject(t)
|
|
@@ -7715,7 +7715,7 @@ class V {
|
|
|
7715
7715
|
const s = tt(t.zone, ce.defaultZone);
|
|
7716
7716
|
if (!s.isValid)
|
|
7717
7717
|
return V.invalid(Gt(s));
|
|
7718
|
-
const r = se.fromObject(t), i = Vn(e,
|
|
7718
|
+
const r = se.fromObject(t), i = Vn(e, Br), { minDaysInFirstWeek: o, startOfWeek: a } = Ar(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;
|
|
7719
7719
|
if ((d || u) && m)
|
|
7720
7720
|
throw new St(
|
|
7721
7721
|
"Can't mix weekYear/weekNumber units with year/month/day or ordinals"
|
|
@@ -7724,7 +7724,7 @@ class V {
|
|
|
7724
7724
|
throw new St("Can't mix ordinal dates with month/day");
|
|
7725
7725
|
const O = m || i.weekday && !d;
|
|
7726
7726
|
let y, w, b = pn(l, c);
|
|
7727
|
-
O ? (y =
|
|
7727
|
+
O ? (y = Ic, w = Nc, b = Pn(b, o, a)) : u ? (y = Dc, w = xc, b = as(b)) : (y = En, w = Eo);
|
|
7728
7728
|
let N = !1;
|
|
7729
7729
|
for (const g of y) {
|
|
7730
7730
|
const k = i[g];
|
|
@@ -7733,7 +7733,7 @@ class V {
|
|
|
7733
7733
|
const p = O ? al(i, o, a) : u ? ll(i) : qi(i), T = p || Bi(i);
|
|
7734
7734
|
if (T)
|
|
7735
7735
|
return V.invalid(T);
|
|
7736
|
-
const C = O ? Ir(i, o, a) : u ?
|
|
7736
|
+
const C = O ? Ir(i, o, a) : u ? Dr(i) : i, [v, Z] = _n(C, c, s), x = new V({
|
|
7737
7737
|
ts: v,
|
|
7738
7738
|
zone: s,
|
|
7739
7739
|
o: Z,
|
|
@@ -7902,7 +7902,7 @@ class V {
|
|
|
7902
7902
|
return po(_e.parseFormat(e), se.fromObject(t)).map((r) => r.val).join("");
|
|
7903
7903
|
}
|
|
7904
7904
|
static resetCache() {
|
|
7905
|
-
Yt = void 0,
|
|
7905
|
+
Yt = void 0, Ps.clear();
|
|
7906
7906
|
}
|
|
7907
7907
|
// INFO
|
|
7908
7908
|
/**
|
|
@@ -8346,7 +8346,7 @@ class V {
|
|
|
8346
8346
|
*/
|
|
8347
8347
|
set(e) {
|
|
8348
8348
|
if (!this.isValid) return this;
|
|
8349
|
-
const t = Vn(e,
|
|
8349
|
+
const t = Vn(e, Br), { minDaysInFirstWeek: s, startOfWeek: r } = Ar(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;
|
|
8350
8350
|
if ((c || o) && u)
|
|
8351
8351
|
throw new St(
|
|
8352
8352
|
"Can't mix weekYear/weekNumber units with year/month/day or ordinals"
|
|
@@ -8358,7 +8358,7 @@ class V {
|
|
|
8358
8358
|
{ ...Pn(this.c, s, r), ...t },
|
|
8359
8359
|
s,
|
|
8360
8360
|
r
|
|
8361
|
-
) : H(t.ordinal) ? (h = { ...this.toObject(), ...t }, H(t.day) && (h.day = Math.min(Ln(h.year, h.month), h.day))) : h =
|
|
8361
|
+
) : H(t.ordinal) ? (h = { ...this.toObject(), ...t }, H(t.day) && (h.day = Math.min(Ln(h.year, h.month), h.day))) : h = Dr({ ...as(this.c), ...t });
|
|
8362
8362
|
const [f, d] = _n(h, this.o, this.zone);
|
|
8363
8363
|
return dt(this, { ts: f, o: d });
|
|
8364
8364
|
}
|
|
@@ -8378,7 +8378,7 @@ class V {
|
|
|
8378
8378
|
plus(e) {
|
|
8379
8379
|
if (!this.isValid) return this;
|
|
8380
8380
|
const t = ee.fromDurationLike(e);
|
|
8381
|
-
return dt(this,
|
|
8381
|
+
return dt(this, zr(this, t));
|
|
8382
8382
|
}
|
|
8383
8383
|
/**
|
|
8384
8384
|
* Subtract a period of time to this DateTime and return the resulting DateTime
|
|
@@ -8389,7 +8389,7 @@ class V {
|
|
|
8389
8389
|
minus(e) {
|
|
8390
8390
|
if (!this.isValid) return this;
|
|
8391
8391
|
const t = ee.fromDurationLike(e).negate();
|
|
8392
|
-
return dt(this,
|
|
8392
|
+
return dt(this, zr(this, t));
|
|
8393
8393
|
}
|
|
8394
8394
|
/**
|
|
8395
8395
|
* "Set" this DateTime to the beginning of a unit of time.
|
|
@@ -8539,7 +8539,7 @@ class V {
|
|
|
8539
8539
|
o = vn(o);
|
|
8540
8540
|
const a = e === "extended";
|
|
8541
8541
|
let l = fs(this, a, o);
|
|
8542
|
-
return En.indexOf(o) >= 3 && (l += "T"), l +=
|
|
8542
|
+
return En.indexOf(o) >= 3 && (l += "T"), l += qr(
|
|
8543
8543
|
this,
|
|
8544
8544
|
a,
|
|
8545
8545
|
t,
|
|
@@ -8596,7 +8596,7 @@ class V {
|
|
|
8596
8596
|
format: o = "extended",
|
|
8597
8597
|
precision: a = "milliseconds"
|
|
8598
8598
|
} = {}) {
|
|
8599
|
-
return this.isValid ? (a = vn(a), (r && En.indexOf(a) >= 3 ? "T" : "") +
|
|
8599
|
+
return this.isValid ? (a = vn(a), (r && En.indexOf(a) >= 3 ? "T" : "") + qr(
|
|
8600
8600
|
this,
|
|
8601
8601
|
o === "extended",
|
|
8602
8602
|
t,
|
|
@@ -8676,7 +8676,7 @@ class V {
|
|
|
8676
8676
|
* Returns a string representation of this DateTime appropriate for the REPL.
|
|
8677
8677
|
* @return {string}
|
|
8678
8678
|
*/
|
|
8679
|
-
[Symbol.for("nodejs.util.inspect.custom")]() {
|
|
8679
|
+
[/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")]() {
|
|
8680
8680
|
return this.isValid ? `DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }` : `DateTime { Invalid, reason: ${this.invalidReason} }`;
|
|
8681
8681
|
}
|
|
8682
8682
|
/**
|
|
@@ -8830,7 +8830,7 @@ class V {
|
|
|
8830
8830
|
if (!this.isValid) return null;
|
|
8831
8831
|
const t = e.base || V.fromObject({}, { zone: this.zone }), s = e.padding ? this < t ? -e.padding : e.padding : 0;
|
|
8832
8832
|
let r = ["years", "months", "days", "hours", "minutes", "seconds"], i = e.unit;
|
|
8833
|
-
return Array.isArray(e.unit) && (r = e.unit, i = void 0),
|
|
8833
|
+
return Array.isArray(e.unit) && (r = e.unit, i = void 0), Gr(t, this.plus(s), {
|
|
8834
8834
|
...e,
|
|
8835
8835
|
numeric: "always",
|
|
8836
8836
|
units: r,
|
|
@@ -8851,7 +8851,7 @@ class V {
|
|
|
8851
8851
|
* @example DateTime.now().minus({ days: 2 }).toRelativeCalendar() //=> "2 days ago"
|
|
8852
8852
|
*/
|
|
8853
8853
|
toRelativeCalendar(e = {}) {
|
|
8854
|
-
return this.isValid ?
|
|
8854
|
+
return this.isValid ? Gr(e.base || V.fromObject({}, { zone: this.zone }), this, {
|
|
8855
8855
|
...e,
|
|
8856
8856
|
numeric: "auto",
|
|
8857
8857
|
units: ["years", "months", "days"],
|
|
@@ -8866,7 +8866,7 @@ class V {
|
|
|
8866
8866
|
static min(...e) {
|
|
8867
8867
|
if (!e.every(V.isDateTime))
|
|
8868
8868
|
throw new we("min requires all arguments be DateTimes");
|
|
8869
|
-
return
|
|
8869
|
+
return Cr(e, (t) => t.valueOf(), Math.min);
|
|
8870
8870
|
}
|
|
8871
8871
|
/**
|
|
8872
8872
|
* Return the max of several date times
|
|
@@ -8876,7 +8876,7 @@ class V {
|
|
|
8876
8876
|
static max(...e) {
|
|
8877
8877
|
if (!e.every(V.isDateTime))
|
|
8878
8878
|
throw new we("max requires all arguments be DateTimes");
|
|
8879
|
-
return
|
|
8879
|
+
return Cr(e, (t) => t.valueOf(), Math.max);
|
|
8880
8880
|
}
|
|
8881
8881
|
// MISC
|
|
8882
8882
|
/**
|
|
@@ -9044,14 +9044,14 @@ class V {
|
|
|
9044
9044
|
* @type {Object}
|
|
9045
9045
|
*/
|
|
9046
9046
|
static get TIME_24_WITH_LONG_OFFSET() {
|
|
9047
|
-
return
|
|
9047
|
+
return Ii;
|
|
9048
9048
|
}
|
|
9049
9049
|
/**
|
|
9050
9050
|
* {@link DateTime#toLocaleString} format like '10/14/1983, 9:30 AM'. Only 12-hour if the locale is.
|
|
9051
9051
|
* @type {Object}
|
|
9052
9052
|
*/
|
|
9053
9053
|
static get DATETIME_SHORT() {
|
|
9054
|
-
return
|
|
9054
|
+
return Di;
|
|
9055
9055
|
}
|
|
9056
9056
|
/**
|
|
9057
9057
|
* {@link DateTime#toLocaleString} format like '10/14/1983, 9:30:33 AM'. Only 12-hour if the locale is.
|
|
@@ -9139,7 +9139,7 @@ const Cc = (n, e) => {
|
|
|
9139
9139
|
}, $c = (n, e, t, s) => {
|
|
9140
9140
|
let r = We({}).catchall(Cc(n, e)), i;
|
|
9141
9141
|
if (!s && t) {
|
|
9142
|
-
const o =
|
|
9142
|
+
const o = Ie(n, t);
|
|
9143
9143
|
i = qt(o.admin?.skipFormRequiredValidation);
|
|
9144
9144
|
}
|
|
9145
9145
|
return (!n.required || i) && (r = r.optional()), r;
|
|
@@ -9152,7 +9152,7 @@ const Cc = (n, e) => {
|
|
|
9152
9152
|
` || "";
|
|
9153
9153
|
let i, o, a;
|
|
9154
9154
|
if (!t && e) {
|
|
9155
|
-
const l =
|
|
9155
|
+
const l = Ie(n, e);
|
|
9156
9156
|
i = l.admin?.condition?.form !== void 0 && !qt(l.admin.condition.form), o = qt(l.admin?.skipFormRequiredValidation), a = qt(l.admin?.image);
|
|
9157
9157
|
}
|
|
9158
9158
|
switch (n.type) {
|
|
@@ -9230,18 +9230,18 @@ const Cc = (n, e) => {
|
|
|
9230
9230
|
}));
|
|
9231
9231
|
const l = We(a);
|
|
9232
9232
|
return n.allowSchemalessFields ? l.passthrough() : l.strict();
|
|
9233
|
-
},
|
|
9233
|
+
}, Jr = async (n, e) => {
|
|
9234
9234
|
if (n) {
|
|
9235
9235
|
const t = await ie(n, e);
|
|
9236
9236
|
if (!t.valid)
|
|
9237
9237
|
throw new Error(`VALIDATION_ERROR: ${t.message}`);
|
|
9238
9238
|
}
|
|
9239
9239
|
}, sn = async (n, e, t, s, r, i) => {
|
|
9240
|
-
await
|
|
9240
|
+
await Jr(s.custom?.preValidate, r);
|
|
9241
9241
|
for (const a of s.fields)
|
|
9242
|
-
await
|
|
9242
|
+
await Jr(a.custom?.preValidate, r);
|
|
9243
9243
|
return $a(n, t, i).parse(e), e;
|
|
9244
|
-
},
|
|
9244
|
+
}, Qs = (n, e, t, s, r, i, o, a, l, c, u, h, f, d, m, O, y, w, b, N, p) => {
|
|
9245
9245
|
const { fields: T } = o;
|
|
9246
9246
|
T.filter((g) => "unique" in g && g.unique).forEach((g) => {
|
|
9247
9247
|
n !== "delete" && (typeof r[g.name] == "string" || typeof r[g.name] == "number") && (e.set(d(g, r[g.name].toString().toLowerCase().replace(/\s/g, "---").replaceAll("/", "|||")), {
|
|
@@ -9270,11 +9270,11 @@ const Cc = (n, e) => {
|
|
|
9270
9270
|
});
|
|
9271
9271
|
const A = l[g.labels.collection];
|
|
9272
9272
|
for (const E of A)
|
|
9273
|
-
E.fields.some((
|
|
9273
|
+
E.fields.some((D) => D.name === k.name) && K(k) && _++;
|
|
9274
9274
|
return _;
|
|
9275
9275
|
}, Z = (g, k, _, A, E) => {
|
|
9276
|
-
const
|
|
9277
|
-
|
|
9276
|
+
const D = {};
|
|
9277
|
+
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), {
|
|
9278
9278
|
[`${_.name}.${s}`]: h(),
|
|
9279
9279
|
[`${_.name}_Array`]: u(s)
|
|
9280
9280
|
}), k.fields.forEach((F) => {
|
|
@@ -9284,7 +9284,7 @@ const Cc = (n, e) => {
|
|
|
9284
9284
|
});
|
|
9285
9285
|
const R = l[k.labels.collection];
|
|
9286
9286
|
for (const F of R)
|
|
9287
|
-
F.fields.some((M) => M.name === _.name) && K(_) && e.update(w(g, F.key, A),
|
|
9287
|
+
F.fields.some((M) => M.name === _.name) && K(_) && e.update(w(g, F.key, A), D);
|
|
9288
9288
|
};
|
|
9289
9289
|
if (n === "delete")
|
|
9290
9290
|
return;
|
|
@@ -9293,13 +9293,13 @@ const Cc = (n, e) => {
|
|
|
9293
9293
|
for (const g of x) {
|
|
9294
9294
|
if (!p)
|
|
9295
9295
|
throw new Error("VALIDATION_ERROR: batchSize is required");
|
|
9296
|
-
const k = i.collections[g.collection], _ = W(k.fields, g.twoWay), A = ft(k, k.fields), E = Array.from(A).map((
|
|
9296
|
+
const k = i.collections[g.collection], _ = W(k.fields, g.twoWay), A = ft(k, k.fields), E = Array.from(A).map((D) => D.name);
|
|
9297
9297
|
if (!_)
|
|
9298
9298
|
throw new Error(`SCHEMA_ERROR: Field ${g.twoWay} not found in collection ${g.collection}`);
|
|
9299
9299
|
if (K(_)) {
|
|
9300
9300
|
if (r[`${g.name}_Array`])
|
|
9301
|
-
for (const [
|
|
9302
|
-
if (n === "update" && b && b[`${g.name}_Array`]?.includes(
|
|
9301
|
+
for (const [D, R] of Object.entries(r[g.name])) {
|
|
9302
|
+
if (n === "update" && b && b[`${g.name}_Array`]?.includes(D))
|
|
9303
9303
|
continue;
|
|
9304
9304
|
const F = { ...b, ...r };
|
|
9305
9305
|
nt(F);
|
|
@@ -9323,10 +9323,10 @@ const Cc = (n, e) => {
|
|
|
9323
9323
|
...M
|
|
9324
9324
|
});
|
|
9325
9325
|
const j = Sn(r);
|
|
9326
|
-
e.update(O(R.Collection_Path,
|
|
9326
|
+
e.update(O(R.Collection_Path, D), {
|
|
9327
9327
|
...P,
|
|
9328
9328
|
...j
|
|
9329
|
-
}), p.size++, ct(_, k, i) && (e.update(y(g, _.name,
|
|
9329
|
+
}), p.size++, ct(_, k, i) && (e.update(y(g, _.name, D), {
|
|
9330
9330
|
[`${_.name}.${s}`]: {
|
|
9331
9331
|
Collection_Path: t,
|
|
9332
9332
|
...M
|
|
@@ -9337,7 +9337,7 @@ const Cc = (n, e) => {
|
|
|
9337
9337
|
const q = JSON.parse(es(dn(S, k, i))), B = {};
|
|
9338
9338
|
q.includes(_.name) && (B[`${g.twoWay}_Array`] = c(s)), Object.keys(j).forEach((re) => {
|
|
9339
9339
|
q.includes(re) && (B[re] = j[re]);
|
|
9340
|
-
}), Object.keys(B).length > 0 && (e.update(y(g, S.name,
|
|
9340
|
+
}), Object.keys(B).length > 0 && (e.update(y(g, S.name, D), B), p.size++);
|
|
9341
9341
|
}
|
|
9342
9342
|
});
|
|
9343
9343
|
const Q = l[k.labels.collection];
|
|
@@ -9346,7 +9346,7 @@ const Cc = (n, e) => {
|
|
|
9346
9346
|
const q = { ...P };
|
|
9347
9347
|
Object.keys(j).forEach((B) => {
|
|
9348
9348
|
S.fields.some((re) => re.name === B) && (q[B] = j[B]);
|
|
9349
|
-
}), Object.keys(q).length > 0 && (e.update(w(g, S.key,
|
|
9349
|
+
}), Object.keys(q).length > 0 && (e.update(w(g, S.key, D), q), p.size++);
|
|
9350
9350
|
}
|
|
9351
9351
|
}
|
|
9352
9352
|
} else
|
|
@@ -9384,7 +9384,7 @@ const Cc = (n, e) => {
|
|
|
9384
9384
|
}, Ve = (n) => {
|
|
9385
9385
|
for (const e in n)
|
|
9386
9386
|
Object.prototype.hasOwnProperty.call(n, e) && (n[e] === void 0 ? delete n[e] : typeof n[e] == "object" && n[e] !== null && Ve(n[e]));
|
|
9387
|
-
},
|
|
9387
|
+
}, Ks = (n) => {
|
|
9388
9388
|
if (n = n.toString(), /[/]|^\.+$|^__.*__$/.test(n))
|
|
9389
9389
|
return !1;
|
|
9390
9390
|
try {
|
|
@@ -9395,7 +9395,7 @@ const Cc = (n, e) => {
|
|
|
9395
9395
|
return !1;
|
|
9396
9396
|
}
|
|
9397
9397
|
return !(new Blob([n]).size > 1500);
|
|
9398
|
-
},
|
|
9398
|
+
}, Qr = async (n, e, t, s = 1e3) => {
|
|
9399
9399
|
let r = 5;
|
|
9400
9400
|
for (; r > 0; )
|
|
9401
9401
|
try {
|
|
@@ -9420,7 +9420,7 @@ const Cc = (n, e) => {
|
|
|
9420
9420
|
if (e = e.replace(/\0/g, ""), e = e.replace(/[\x00-\x08\x0B-\x1F\x7F]/g, ""), e = e.trim(), e.length > 998)
|
|
9421
9421
|
throw new Error("Email subject is too long");
|
|
9422
9422
|
return e;
|
|
9423
|
-
},
|
|
9423
|
+
}, Kr = (n) => {
|
|
9424
9424
|
if (!n || typeof n != "string")
|
|
9425
9425
|
return "";
|
|
9426
9426
|
let e = n.replace(/\0/g, "");
|
|
@@ -9439,7 +9439,7 @@ const Cc = (n, e) => {
|
|
|
9439
9439
|
);
|
|
9440
9440
|
return t;
|
|
9441
9441
|
};
|
|
9442
|
-
let ms, Oo, On, ko, Jt, bo, kn, bn, ps = 0,
|
|
9442
|
+
let ms, Oo, On, ko, Jt, bo, kn, bn, ps = 0, Xr = !1;
|
|
9443
9443
|
const Tt = {
|
|
9444
9444
|
getTenant() {
|
|
9445
9445
|
if (!On)
|
|
@@ -9471,39 +9471,40 @@ const Tt = {
|
|
|
9471
9471
|
return bn;
|
|
9472
9472
|
}
|
|
9473
9473
|
}, ou = async (n, e, t, s, r) => {
|
|
9474
|
-
|
|
9474
|
+
const i = !!Xr;
|
|
9475
|
+
if (Xr = !0, e && (On = e), Oo = n, ms && !r)
|
|
9475
9476
|
return Tt;
|
|
9476
9477
|
if (!process.env.STOKER_FB_WEB_APP_CONFIG)
|
|
9477
9478
|
throw new Error("STOKER_FB_WEB_APP_CONFIG not set.");
|
|
9478
|
-
const
|
|
9479
|
+
const o = process.env.STOKER_FB_WEB_APP_CONFIG, a = JSON.parse(o), c = (await import(
|
|
9479
9480
|
/* @vite-ignore */
|
|
9480
9481
|
t
|
|
9481
9482
|
)).default;
|
|
9482
|
-
Jt =
|
|
9483
|
+
Jt = c("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");
|
|
9483
9484
|
try {
|
|
9484
9485
|
ms = ni();
|
|
9485
9486
|
} catch {
|
|
9486
9487
|
ms = si({
|
|
9487
9488
|
credential: ri(),
|
|
9488
|
-
databaseURL:
|
|
9489
|
-
storageBucket:
|
|
9490
|
-
projectId:
|
|
9489
|
+
databaseURL: a.databaseURL,
|
|
9490
|
+
storageBucket: a.storageBucket,
|
|
9491
|
+
projectId: a.projectId
|
|
9491
9492
|
});
|
|
9492
9493
|
}
|
|
9493
|
-
const
|
|
9494
|
-
return bo = await Pc(s, Object.keys(
|
|
9495
|
-
|
|
9496
|
-
}, (
|
|
9497
|
-
console.error(
|
|
9498
|
-
}),
|
|
9499
|
-
|
|
9500
|
-
}, (
|
|
9501
|
-
console.error(
|
|
9502
|
-
}), await new Promise((
|
|
9503
|
-
const
|
|
9504
|
-
bn && kn ?
|
|
9494
|
+
const u = await Ge();
|
|
9495
|
+
return bo = await Pc(s, Object.keys(u.collections)), ko = await ie(Jt.timezone), i || ue().collection("system_deployment").doc("maintenance_mode").onSnapshot((h) => {
|
|
9496
|
+
h.exists ? (bn = h.data(), ie(Jt.onMaintenanceUpdate, ["node", bn.active ? "on" : "off"])) : console.error("Maintenance status not found");
|
|
9497
|
+
}, (h) => {
|
|
9498
|
+
console.error(h.message);
|
|
9499
|
+
}), i || ue().collection("system_deployment").doc("latest_deploy").onSnapshot((h) => {
|
|
9500
|
+
h.exists ? (kn = h.data(), ps++, ps > 1 && ie(Jt.onVersionUpdate, ["node", kn, ps])) : console.error("Version info not found");
|
|
9501
|
+
}, (h) => {
|
|
9502
|
+
console.error(h.message);
|
|
9503
|
+
}), await new Promise((h) => {
|
|
9504
|
+
const f = () => {
|
|
9505
|
+
bn && kn ? h(Tt) : setTimeout(f, 100);
|
|
9505
9506
|
};
|
|
9506
|
-
|
|
9507
|
+
f();
|
|
9507
9508
|
}), Tt;
|
|
9508
9509
|
}, { getTenant: Ye, setTenant: au, getMode: So, getTimezone: To, getGlobalConfigModule: Ut, getCustomizationFile: Je, getVersionInfo: lu, getMaintenanceInfo: cu } = Tt, uu = async (n, e, t, s) => new Promise((r, i) => {
|
|
9509
9510
|
const o = Zo(n, e, { cwd: t || process.cwd(), env: { ...process.env, ...s } });
|
|
@@ -9543,7 +9544,7 @@ const Tt = {
|
|
|
9543
9544
|
for (const i of Object.values(r.collections))
|
|
9544
9545
|
for (const o of i.fields)
|
|
9545
9546
|
if (o.type === "Computed") {
|
|
9546
|
-
const a =
|
|
9547
|
+
const a = Ie(o, Je(i.labels.collection, r));
|
|
9547
9548
|
a.formula && (o.formula = a.formula);
|
|
9548
9549
|
}
|
|
9549
9550
|
} else
|
|
@@ -9554,7 +9555,7 @@ const Tt = {
|
|
|
9554
9555
|
const t = await ii().ref("schema").orderByChild("published_time").limitToLast(2).get();
|
|
9555
9556
|
if (!(t.numChildren() < 2))
|
|
9556
9557
|
return Object.values(t.val())[0];
|
|
9557
|
-
},
|
|
9558
|
+
}, De = (n, e, t) => {
|
|
9558
9559
|
let s = n.collection("tenants").doc(t);
|
|
9559
9560
|
for (let r = 0; r < e.length; r++)
|
|
9560
9561
|
r % 2 === 0 ? s = s.collection(e[r]) : s = s.doc(e[r]);
|
|
@@ -9563,29 +9564,29 @@ const Tt = {
|
|
|
9563
9564
|
const i = ue(), o = e.at(-1);
|
|
9564
9565
|
if (!o)
|
|
9565
9566
|
throw new Error("EMPTY_PATH");
|
|
9566
|
-
const a = t.collections[o], { labels: l, fields: c, preloadCache: u } = a, h = Je(o, t), f =
|
|
9567
|
+
const a = t.collections[o], { labels: l, fields: c, preloadCache: u } = a, h = Je(o, t), f = De(i, e, n);
|
|
9567
9568
|
if (r)
|
|
9568
9569
|
if (s) {
|
|
9569
9570
|
const d = r.collections?.[l.collection];
|
|
9570
9571
|
if (!r.Role)
|
|
9571
9572
|
throw new Error("PERMISSION_DENIED");
|
|
9572
|
-
const m = d && Te("Read", d), O = ci(a, t, r), y = ai(a, r), w =
|
|
9573
|
-
const
|
|
9573
|
+
const m = d && Te("Read", d), O = ci(a, t, r), y = ai(a, r), w = Ls(a, r), b = li(a, t, r), N = (E = []) => {
|
|
9574
|
+
const D = [], R = mi(r.Role, a, t);
|
|
9574
9575
|
if (!R)
|
|
9575
9576
|
throw new Error("PERMISSION_DENIED");
|
|
9576
9577
|
if (m) {
|
|
9577
9578
|
let F = i.collection("tenants").doc(n).collection("system_fields").doc(l.collection).collection(`${l.collection}-${R.key}`).where("Collection_Path_String", "==", e.join("/"));
|
|
9578
9579
|
E.forEach((M) => {
|
|
9579
9580
|
F = F.where(...M);
|
|
9580
|
-
}),
|
|
9581
|
+
}), D.push(F);
|
|
9581
9582
|
} else if (O)
|
|
9582
9583
|
for (const F of O) {
|
|
9583
9584
|
let M = i.collection("tenants").doc(n).collection("system_fields").doc(l.collection).collection(`${l.collection}-${F.field}`).where("Collection_Path_String", "==", e.join("/"));
|
|
9584
9585
|
E.forEach((P) => {
|
|
9585
9586
|
M = M.where(...P);
|
|
9586
|
-
}),
|
|
9587
|
+
}), D.push(M);
|
|
9587
9588
|
}
|
|
9588
|
-
return
|
|
9589
|
+
return D;
|
|
9589
9590
|
}, p = y.filter((E) => "operations" in E && E.operations ? E.operations.includes("Read") : !0);
|
|
9590
9591
|
if (p.length === 0 && w.length === 0 && b.length === 0)
|
|
9591
9592
|
return N();
|
|
@@ -9596,10 +9597,10 @@ const Tt = {
|
|
|
9596
9597
|
if (p.length > 0) {
|
|
9597
9598
|
for (const E of p)
|
|
9598
9599
|
if (E.operations && E.type === "Record_Property") {
|
|
9599
|
-
const
|
|
9600
|
-
if (!
|
|
9600
|
+
const D = E.roles.find((R) => R.role === r.Role);
|
|
9601
|
+
if (!D)
|
|
9601
9602
|
throw new Error("PERMISSION_DENIED");
|
|
9602
|
-
C(
|
|
9603
|
+
C(D.values?.length);
|
|
9603
9604
|
}
|
|
9604
9605
|
}
|
|
9605
9606
|
u?.roles.includes(r.Role) && u.range && C(u.range.fields.length);
|
|
@@ -9608,25 +9609,25 @@ const Tt = {
|
|
|
9608
9609
|
const Z = T === 0 ? 30 : Math.max(1, Math.floor(30 / T)), x = [];
|
|
9609
9610
|
p.filter((E) => E.type === "Record_Owner").forEach(() => x.push(["Created_By", "==", s])), p.filter((E) => E.type === "Record_User").forEach((E) => {
|
|
9610
9611
|
if ("collectionField" in E) {
|
|
9611
|
-
const
|
|
9612
|
-
x.push([`${
|
|
9612
|
+
const D = W(c, E.collectionField);
|
|
9613
|
+
x.push([`${D.name}_Array`, "array-contains", r.Doc_ID]);
|
|
9613
9614
|
}
|
|
9614
9615
|
}), p.filter((E) => E.type === "Record_Property").forEach((E) => {
|
|
9615
9616
|
if ("propertyField" in E) {
|
|
9616
|
-
const
|
|
9617
|
-
if (!
|
|
9617
|
+
const D = E.roles.find((F) => F.role === r.Role);
|
|
9618
|
+
if (!D)
|
|
9618
9619
|
throw new Error("PERMISSION_DENIED");
|
|
9619
9620
|
const R = W(c, E.propertyField);
|
|
9620
|
-
R.type === "Array" ? x.push([`${R.name}_Array`, "array-contains-any",
|
|
9621
|
+
R.type === "Array" ? x.push([`${R.name}_Array`, "array-contains-any", D.values]) : x.push([R.name, "in", D.values]);
|
|
9621
9622
|
}
|
|
9622
9623
|
});
|
|
9623
9624
|
const g = [];
|
|
9624
9625
|
w.filter((E) => E.type === "Individual").forEach((E) => {
|
|
9625
|
-
const
|
|
9626
|
-
if (
|
|
9626
|
+
const D = d?.individualEntities, R = [];
|
|
9627
|
+
if (D) {
|
|
9627
9628
|
const F = E.singleQuery ? E.singleQuery : Z;
|
|
9628
|
-
for (let M = 0; M <
|
|
9629
|
-
const P =
|
|
9629
|
+
for (let M = 0; M < D.length; M += F) {
|
|
9630
|
+
const P = D.slice(M, M + F);
|
|
9630
9631
|
R.push(P);
|
|
9631
9632
|
}
|
|
9632
9633
|
if (!E.singleQuery)
|
|
@@ -9634,15 +9635,15 @@ const Tt = {
|
|
|
9634
9635
|
g.push(...N(x.concat([["id", "in", M]])));
|
|
9635
9636
|
});
|
|
9636
9637
|
else {
|
|
9637
|
-
if (
|
|
9638
|
+
if (D.length > F)
|
|
9638
9639
|
throw new Error(`INPUT_ERROR: Individual entity restriction with singleQuery set to true must not have more than ${E.singleQuery} entities`);
|
|
9639
|
-
x.push(["id", "in",
|
|
9640
|
+
x.push(["id", "in", D]);
|
|
9640
9641
|
}
|
|
9641
9642
|
}
|
|
9642
9643
|
}), b.filter((E) => E.parentFilter.type === "Individual").forEach((E) => {
|
|
9643
|
-
const { parentFilter:
|
|
9644
|
-
if ("collectionField" in
|
|
9645
|
-
const F = W(c,
|
|
9644
|
+
const { parentFilter: D, parentRestriction: R } = E;
|
|
9645
|
+
if ("collectionField" in D) {
|
|
9646
|
+
const F = W(c, D.collectionField);
|
|
9646
9647
|
if ("collection" in F) {
|
|
9647
9648
|
const M = r.collections?.[F.collection];
|
|
9648
9649
|
if (!M)
|
|
@@ -9670,8 +9671,8 @@ const Tt = {
|
|
|
9670
9671
|
const k = [];
|
|
9671
9672
|
w.filter((E) => E.type === "Parent").forEach((E) => {
|
|
9672
9673
|
if ("collectionField" in E) {
|
|
9673
|
-
const
|
|
9674
|
-
if ("collection" in
|
|
9674
|
+
const D = W(c, E.collectionField);
|
|
9675
|
+
if ("collection" in D) {
|
|
9675
9676
|
const R = d?.parentEntities, F = [];
|
|
9676
9677
|
if (R) {
|
|
9677
9678
|
const M = E.singleQuery ? E.singleQuery : Z;
|
|
@@ -9681,20 +9682,20 @@ const Tt = {
|
|
|
9681
9682
|
}
|
|
9682
9683
|
if (!E.singleQuery)
|
|
9683
9684
|
F.forEach((P) => {
|
|
9684
|
-
k.push(...N(x.concat([[`${
|
|
9685
|
+
k.push(...N(x.concat([[`${D.name}_Array`, "array-contains-any", P]])));
|
|
9685
9686
|
});
|
|
9686
9687
|
else {
|
|
9687
9688
|
if (R && R.length > M)
|
|
9688
9689
|
throw new Error(`INPUT_ERROR: Parent entity restriction with singleQuery set to true must not have more than ${E.singleQuery} entities`);
|
|
9689
|
-
x.push([`${
|
|
9690
|
+
x.push([`${D.name}_Array`, "array-contains-any", R]);
|
|
9690
9691
|
}
|
|
9691
9692
|
}
|
|
9692
9693
|
}
|
|
9693
9694
|
}
|
|
9694
9695
|
}), b.filter((E) => E.parentFilter.type === "Parent").forEach((E) => {
|
|
9695
|
-
const { parentFilter:
|
|
9696
|
-
if ("collectionField" in
|
|
9697
|
-
const F = W(c,
|
|
9696
|
+
const { parentFilter: D, parentRestriction: R } = E;
|
|
9697
|
+
if ("collectionField" in D && "parentCollectionField" in D) {
|
|
9698
|
+
const F = W(c, D.collectionField), M = W(c, D.parentCollectionField);
|
|
9698
9699
|
if ("collection" in F && "collection" in M) {
|
|
9699
9700
|
const P = r.collections?.[F.collection];
|
|
9700
9701
|
if (!P)
|
|
@@ -9728,8 +9729,8 @@ const Tt = {
|
|
|
9728
9729
|
const _ = [];
|
|
9729
9730
|
k.length === 0 && (w.filter((E) => E.type === "Parent_Property").forEach((E) => {
|
|
9730
9731
|
if ("collectionField" in E && "propertyField" in E) {
|
|
9731
|
-
const
|
|
9732
|
-
if ("collection" in
|
|
9732
|
+
const D = W(c, E.collectionField), R = W(c, E.propertyField);
|
|
9733
|
+
if ("collection" in D) {
|
|
9733
9734
|
const F = d?.parentPropertyEntities || {};
|
|
9734
9735
|
Object.entries(F).forEach(([M, P]) => {
|
|
9735
9736
|
if (P.length > 0) {
|
|
@@ -9740,7 +9741,7 @@ const Tt = {
|
|
|
9740
9741
|
}
|
|
9741
9742
|
j.forEach((Q) => {
|
|
9742
9743
|
_.push(...N(x.concat([
|
|
9743
|
-
[`${
|
|
9744
|
+
[`${D.name}_Array`, "array-contains-any", Q],
|
|
9744
9745
|
[R.name, "==", M]
|
|
9745
9746
|
])));
|
|
9746
9747
|
});
|
|
@@ -9749,9 +9750,9 @@ const Tt = {
|
|
|
9749
9750
|
}
|
|
9750
9751
|
}
|
|
9751
9752
|
}), b.filter((E) => E.parentFilter.type === "Parent_Property").forEach((E) => {
|
|
9752
|
-
const { parentFilter:
|
|
9753
|
-
if ("collectionField" in
|
|
9754
|
-
const R = W(c,
|
|
9753
|
+
const { parentFilter: D } = E;
|
|
9754
|
+
if ("collectionField" in D && "parentCollectionField" in D && "parentPropertyField" in D) {
|
|
9755
|
+
const R = W(c, D.collectionField), F = W(c, D.parentCollectionField), M = W(c, D.parentPropertyField);
|
|
9755
9756
|
if ("collection" in R && "collection" in F) {
|
|
9756
9757
|
const P = r.collections?.[R.collection];
|
|
9757
9758
|
if (!P)
|
|
@@ -9788,7 +9789,7 @@ const Tt = {
|
|
|
9788
9789
|
const i = ue(), o = e.at(-1);
|
|
9789
9790
|
if (!o)
|
|
9790
9791
|
throw new Error("EMPTY_PATH");
|
|
9791
|
-
const a = s.collections[o], { labels: l } = a, c =
|
|
9792
|
+
const a = s.collections[o], { labels: l } = a, c = De(i, e, n);
|
|
9792
9793
|
if (r) {
|
|
9793
9794
|
const u = r.collections?.[l.collection];
|
|
9794
9795
|
if (!r.Role)
|
|
@@ -9821,14 +9822,14 @@ const Tt = {
|
|
|
9821
9822
|
});
|
|
9822
9823
|
e[m] = O.docs, i && await Promise.all(
|
|
9823
9824
|
// eslint-disable-next-line security/detect-object-injection
|
|
9824
|
-
e[m].map((y) =>
|
|
9825
|
+
e[m].map((y) => Xs(n, y, [...t, m, y.id], i, r, void 0, a, l, c))
|
|
9825
9826
|
), f > 0 && await Promise.all(
|
|
9826
9827
|
// eslint-disable-next-line security/detect-object-injection
|
|
9827
9828
|
e[m].map((y) => No(n, y, [...t, m, y.id], { depth: f }, r, i, o, a, l, c))
|
|
9828
9829
|
);
|
|
9829
9830
|
});
|
|
9830
9831
|
await Promise.all(d);
|
|
9831
|
-
},
|
|
9832
|
+
}, Xs = async (n, e, t, s, r, i, o, a, l) => {
|
|
9832
9833
|
const c = t.at(-2);
|
|
9833
9834
|
s.fields ||= r.collections[c].fields.filter((f) => K(f));
|
|
9834
9835
|
const u = s.depth - 1, h = [];
|
|
@@ -9845,7 +9846,7 @@ const Tt = {
|
|
|
9845
9846
|
noEmbeddingFields: l
|
|
9846
9847
|
}).then((b) => {
|
|
9847
9848
|
if (d[O] = b, u > 0)
|
|
9848
|
-
return
|
|
9849
|
+
return Xs(
|
|
9849
9850
|
n,
|
|
9850
9851
|
// eslint-disable-next-line security/detect-object-injection
|
|
9851
9852
|
d[O],
|
|
@@ -9909,8 +9910,8 @@ const Tt = {
|
|
|
9909
9910
|
let v = Lc(s, n, m, t?.user, O);
|
|
9910
9911
|
if (v.length === 0)
|
|
9911
9912
|
return { cursor: {}, pages: 0, docs: [] };
|
|
9912
|
-
if (e && (v = v.map((A) => (e.forEach(([E,
|
|
9913
|
-
A = A.where(E,
|
|
9913
|
+
if (e && (v = v.map((A) => (e.forEach(([E, D, R]) => {
|
|
9914
|
+
A = A.where(E, D, R);
|
|
9914
9915
|
}), A))), o = t?.pagination?.startAfter || t?.pagination?.endBefore || {
|
|
9915
9916
|
first: /* @__PURE__ */ new Map(),
|
|
9916
9917
|
last: /* @__PURE__ */ new Map()
|
|
@@ -9923,7 +9924,7 @@ const Tt = {
|
|
|
9923
9924
|
if (A && E !== !0)
|
|
9924
9925
|
throw new Error("INPUT_ERROR: Pagination is not allowed when using " + E);
|
|
9925
9926
|
}
|
|
9926
|
-
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,
|
|
9927
|
+
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));
|
|
9927
9928
|
}
|
|
9928
9929
|
const Z = {};
|
|
9929
9930
|
await ae("preOperation", y, C, ["read", void 0, void 0, Z]), await ae("preRead", y, C, [Z, v, !0, !1]), a = /* @__PURE__ */ new Map();
|
|
@@ -9931,9 +9932,9 @@ const Tt = {
|
|
|
9931
9932
|
for (const A of _) {
|
|
9932
9933
|
for (const E of A.docs) {
|
|
9933
9934
|
a.has(E.id) || a.set(E.id, {});
|
|
9934
|
-
const
|
|
9935
|
+
const D = E.data(), R = a.get(E.id);
|
|
9935
9936
|
R.id ||= E.id;
|
|
9936
|
-
const F = { ...R, ...
|
|
9937
|
+
const F = { ...R, ...D };
|
|
9937
9938
|
delete F.Collection_Path_String, a.set(E.id, F);
|
|
9938
9939
|
}
|
|
9939
9940
|
o.first.set(_.indexOf(A), A.docs[0]), o.last.set(_.indexOf(A), A.docs.at(-1) || A.docs[0]);
|
|
@@ -9941,16 +9942,16 @@ const Tt = {
|
|
|
9941
9942
|
if (t?.pagination) {
|
|
9942
9943
|
let A = v[0];
|
|
9943
9944
|
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));
|
|
9944
|
-
const
|
|
9945
|
-
i = R > 0 ? Math.ceil(
|
|
9945
|
+
const D = (await A.count().get()).data().count, R = t.pagination.number;
|
|
9946
|
+
i = R > 0 ? Math.ceil(D / R) : 0;
|
|
9946
9947
|
}
|
|
9947
9948
|
for (const A of a.values()) {
|
|
9948
|
-
const E = [],
|
|
9949
|
+
const E = [], D = [...A.Collection_Path, A.id];
|
|
9949
9950
|
t?.subcollections && E.push(No(
|
|
9950
9951
|
s,
|
|
9951
9952
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
9952
9953
|
a.get(A.id),
|
|
9953
|
-
|
|
9954
|
+
D,
|
|
9954
9955
|
ye(t.subcollections),
|
|
9955
9956
|
m,
|
|
9956
9957
|
ye(t?.relations),
|
|
@@ -9966,11 +9967,11 @@ const Tt = {
|
|
|
9966
9967
|
throw new Error(`SCHEMA_ERROR: Field ${M} not found in collection ${w}`);
|
|
9967
9968
|
}
|
|
9968
9969
|
return M;
|
|
9969
|
-
})), E.push(
|
|
9970
|
+
})), E.push(Xs(
|
|
9970
9971
|
s,
|
|
9971
9972
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
9972
9973
|
a.get(A.id),
|
|
9973
|
-
|
|
9974
|
+
D,
|
|
9974
9975
|
ye(t.relations),
|
|
9975
9976
|
m,
|
|
9976
9977
|
void 0,
|
|
@@ -9981,7 +9982,7 @@ const Tt = {
|
|
|
9981
9982
|
for (const M of a.values())
|
|
9982
9983
|
for (const P of p.fields) {
|
|
9983
9984
|
if (P.type === "Computed") {
|
|
9984
|
-
const j =
|
|
9985
|
+
const j = Ie(P, C);
|
|
9985
9986
|
if (!j.formula)
|
|
9986
9987
|
continue;
|
|
9987
9988
|
M[P.name] = await j.formula(M);
|
|
@@ -9995,7 +9996,7 @@ const Tt = {
|
|
|
9995
9996
|
continue;
|
|
9996
9997
|
}
|
|
9997
9998
|
for (const j of p.fields) {
|
|
9998
|
-
const Q = !j.access || j.access.includes(M), S =
|
|
9999
|
+
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;
|
|
9999
10000
|
(!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]);
|
|
10000
10001
|
}
|
|
10001
10002
|
}
|
|
@@ -10007,7 +10008,7 @@ const Tt = {
|
|
|
10007
10008
|
return t?.providedTransaction ? await l(t.providedTransaction) : await r.runTransaction(async (c) => {
|
|
10008
10009
|
await l(c);
|
|
10009
10010
|
}, { readOnly: !0 }), { cursor: o, pages: i, docs: Array.from(a.values()) };
|
|
10010
|
-
},
|
|
10011
|
+
}, Io = async (n, e, t, s, r, i, o, a) => {
|
|
10011
10012
|
const l = s.at(-2), c = ui(i.collections[l], i).map((f) => f.labels.collection);
|
|
10012
10013
|
r.collections ? r.collections.forEach((f) => {
|
|
10013
10014
|
if (!c.includes(f))
|
|
@@ -10025,12 +10026,12 @@ const Tt = {
|
|
|
10025
10026
|
t[f] = d.docs, u > 0 && await Promise.all(
|
|
10026
10027
|
// eslint-disable-next-line security/detect-object-injection
|
|
10027
10028
|
t[f].map(async (m) => {
|
|
10028
|
-
await
|
|
10029
|
+
await Io(n, e, m, [...s, f, m.id], { depth: u }, i, o, a);
|
|
10029
10030
|
})
|
|
10030
10031
|
);
|
|
10031
10032
|
});
|
|
10032
10033
|
await Promise.all(h);
|
|
10033
|
-
},
|
|
10034
|
+
}, Do = async (n, e, t, s, r, i, o, a, l) => {
|
|
10034
10035
|
const c = s.at(-2);
|
|
10035
10036
|
i.fields ||= r.collections[c].fields.filter((f) => K(f));
|
|
10036
10037
|
const u = i.depth - 1, h = [];
|
|
@@ -10047,7 +10048,7 @@ const Tt = {
|
|
|
10047
10048
|
noEmbeddingFields: l
|
|
10048
10049
|
}).then((w) => {
|
|
10049
10050
|
if (d[m] = w, u > 0)
|
|
10050
|
-
return
|
|
10051
|
+
return Do(
|
|
10051
10052
|
n,
|
|
10052
10053
|
e,
|
|
10053
10054
|
// eslint-disable-next-line security/detect-object-injection
|
|
@@ -10121,7 +10122,7 @@ const Tt = {
|
|
|
10121
10122
|
} else
|
|
10122
10123
|
throw new Error(`NOT_FOUND: Document with ID ${e} does not exist at location ${n?.join("/") || N.collection}`);
|
|
10123
10124
|
const _ = [], A = n ? [...n, e] : [N.collection, e];
|
|
10124
|
-
if (t?.subcollections && _.push(
|
|
10125
|
+
if (t?.subcollections && _.push(Io(s, a, i, A, t.subcollections, f, void 0, t.user)), t?.relations && (t.relations.fields && (t.relations.fields = t.relations.fields.map((R) => {
|
|
10125
10126
|
if (typeof R == "string") {
|
|
10126
10127
|
const F = b.fields.find((M) => M.name === R);
|
|
10127
10128
|
if (F)
|
|
@@ -10129,10 +10130,10 @@ const Tt = {
|
|
|
10129
10130
|
throw new Error(`SCHEMA_ERROR: Field ${R} not found in collection ${O}`);
|
|
10130
10131
|
}
|
|
10131
10132
|
return R;
|
|
10132
|
-
})), _.push(
|
|
10133
|
+
})), _.push(Do(s, a, i, A, f, t.relations, t.user, t.noComputedFields, t.noEmbeddingFields))), await Promise.all(_), !t?.noComputedFields) {
|
|
10133
10134
|
for (const R of b.fields)
|
|
10134
10135
|
if (R.type === "Computed") {
|
|
10135
|
-
const F =
|
|
10136
|
+
const F = Ie(R, p);
|
|
10136
10137
|
if (!F.formula)
|
|
10137
10138
|
continue;
|
|
10138
10139
|
i[R.name] = await F.formula(i);
|
|
@@ -10146,7 +10147,7 @@ const Tt = {
|
|
|
10146
10147
|
if (!(p.custom?.serverAccess?.read !== void 0 ? await ie(p.custom?.serverAccess?.read, [R, i]) : !0))
|
|
10147
10148
|
throw new Error("PERMISSION_DENIED");
|
|
10148
10149
|
for (const M of b.fields) {
|
|
10149
|
-
const P = !M.access || M.access.includes(R), j =
|
|
10150
|
+
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;
|
|
10150
10151
|
(!P || !Q) && (K(M) ? (delete i[M.name], delete i[`${M.name}_Array`], delete i[`${M.name}_Single`]) : delete i[M.name]);
|
|
10151
10152
|
}
|
|
10152
10153
|
}
|
|
@@ -10161,9 +10162,9 @@ const Tt = {
|
|
|
10161
10162
|
{
|
|
10162
10163
|
if (s[d.name] === void 0 || Me(s[d.name]))
|
|
10163
10164
|
return;
|
|
10164
|
-
|
|
10165
|
+
Ie(d, c);
|
|
10165
10166
|
const m = s[d.name].toString().toLowerCase().replace(/\s/g, "---").replaceAll("/", "|||");
|
|
10166
|
-
if (!
|
|
10167
|
+
if (!Ks(m))
|
|
10167
10168
|
f.push(`${d.name} "${s[d.name]}" is invalid`);
|
|
10168
10169
|
else {
|
|
10169
10170
|
const O = await l.collection("tenants").doc(e).collection("system_unique").doc(u).collection(`Unique-${u}-${d.name}`).doc(m).get();
|
|
@@ -10193,7 +10194,7 @@ const Tt = {
|
|
|
10193
10194
|
}
|
|
10194
10195
|
const m = ye(t);
|
|
10195
10196
|
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));
|
|
10196
|
-
const O =
|
|
10197
|
+
const O = De(u, r, s), y = t.Last_Write_At;
|
|
10197
10198
|
await O.doc(i).collection("system_write_log").doc(`${t.Last_Write_By}-${y.valueOf()}`).set(d);
|
|
10198
10199
|
}, un = async (n) => {
|
|
10199
10200
|
const e = Ye(), t = gt(), s = ue(), r = [];
|
|
@@ -10225,7 +10226,7 @@ ${i}`);
|
|
|
10225
10226
|
n = h;
|
|
10226
10227
|
else
|
|
10227
10228
|
throw new Error("Admin email not set");
|
|
10228
|
-
const f = hs(n), d = Fc(e), m = t ?
|
|
10229
|
+
const f = hs(n), d = Fc(e), m = t ? Kr(t) : void 0, O = s ? Kr(s) : void 0, y = r ? hs(r) : void 0, w = i ? hs(i) : void 0, b = o ? Un(o) : void 0, N = l ? Un(l) : void 0, p = Array.isArray(f) ? f : [f];
|
|
10229
10230
|
if (p.length === 0 || p.length === 1 && !p[0])
|
|
10230
10231
|
throw new Error("No valid email addresses provided");
|
|
10231
10232
|
const T = { to: f, message: { subject: d } };
|
|
@@ -10305,7 +10306,7 @@ ${i}`);
|
|
|
10305
10306
|
}
|
|
10306
10307
|
}
|
|
10307
10308
|
return h.uid;
|
|
10308
|
-
},
|
|
10309
|
+
}, er = async (n, e) => {
|
|
10309
10310
|
const { labels: t, parentCollection: s } = e;
|
|
10310
10311
|
if (s) {
|
|
10311
10312
|
const r = n.at(-2);
|
|
@@ -10332,10 +10333,10 @@ ${i}`);
|
|
|
10332
10333
|
});
|
|
10333
10334
|
};
|
|
10334
10335
|
e(n);
|
|
10335
|
-
},
|
|
10336
|
+
}, tr = (n) => {
|
|
10336
10337
|
if (typeof n == "object")
|
|
10337
10338
|
for (const e in n)
|
|
10338
|
-
Object.prototype.hasOwnProperty.call(n, e) && (n[e] === "_DELETE_FIELD" ? n[e] = me.delete() :
|
|
10339
|
+
Object.prototype.hasOwnProperty.call(n, e) && (n[e] === "_DELETE_FIELD" ? n[e] = me.delete() : tr(n[e]));
|
|
10339
10340
|
}, Vc = (n, e, t) => {
|
|
10340
10341
|
if (K(t) && t.includeFields) {
|
|
10341
10342
|
const s = {};
|
|
@@ -10357,7 +10358,7 @@ ${i}`);
|
|
|
10357
10358
|
const [u, h] = c[0];
|
|
10358
10359
|
if (!h)
|
|
10359
10360
|
throw new Error(`VALIDATION_ERROR: Relation ${t.name} is required`);
|
|
10360
|
-
const f =
|
|
10361
|
+
const f = De(l, h.Collection_Path, n);
|
|
10361
10362
|
if (i.size++, !o && i.size > 500)
|
|
10362
10363
|
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.");
|
|
10363
10364
|
const d = await r.get(f.doc(u));
|
|
@@ -10368,7 +10369,7 @@ ${i}`);
|
|
|
10368
10369
|
throw new Error("VALIDATION_ERROR: Invalid relation hierarchy");
|
|
10369
10370
|
}, gn = async (n, e, t) => {
|
|
10370
10371
|
delete e[n.name][t], e[`${n.name}_Array`] = e[`${n.name}_Array`]?.filter((s) => s !== t), delete e[`${n.name}_Single`];
|
|
10371
|
-
},
|
|
10372
|
+
}, ys = async (n, e, t, s, r) => {
|
|
10372
10373
|
e[n.name] ||= {}, e[n.name][s] = t, e[`${n.name}_Array`] ||= [], e[`${n.name}_Array`].push(s), r && (e[`${n.name}_Single`] = t);
|
|
10373
10374
|
}, Uc = (n, e, t, s, r, i) => {
|
|
10374
10375
|
const o = [], a = [];
|
|
@@ -10394,7 +10395,7 @@ ${i}`);
|
|
|
10394
10395
|
else {
|
|
10395
10396
|
if (l.size++, l && l.size > 500)
|
|
10396
10397
|
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.");
|
|
10397
|
-
const _ =
|
|
10398
|
+
const _ = De(d, Z.Collection_Path, e), A = await a.get(_.doc(v));
|
|
10398
10399
|
if (!A.exists) {
|
|
10399
10400
|
gn(w, r, v);
|
|
10400
10401
|
continue;
|
|
@@ -10431,7 +10432,7 @@ ${i}`);
|
|
|
10431
10432
|
else {
|
|
10432
10433
|
if (l.size++, l && l.size > 500)
|
|
10433
10434
|
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.");
|
|
10434
|
-
const k =
|
|
10435
|
+
const k = De(d, Z.Collection_Path, e), _ = await a.get(k.doc(v));
|
|
10435
10436
|
if (!_.exists) {
|
|
10436
10437
|
m.set(w.name, [...m.get(w.name) || [], v]);
|
|
10437
10438
|
continue;
|
|
@@ -10457,15 +10458,15 @@ ${i}`);
|
|
|
10457
10458
|
if (c && u) {
|
|
10458
10459
|
for (const x of v) {
|
|
10459
10460
|
const g = W(N.fields, x.twoWay);
|
|
10460
|
-
if (!
|
|
10461
|
+
if (!rr(N, g, u)) {
|
|
10461
10462
|
gn(x, r, T);
|
|
10462
10463
|
continue;
|
|
10463
10464
|
}
|
|
10464
10465
|
}
|
|
10465
10466
|
for (const x of Z) {
|
|
10466
10467
|
const g = W(N.fields, x.twoWay), k = ft(N, [g]);
|
|
10467
|
-
if (!
|
|
10468
|
-
|
|
10468
|
+
if (!rr(N, g, u)) {
|
|
10469
|
+
ys(
|
|
10469
10470
|
x,
|
|
10470
10471
|
r,
|
|
10471
10472
|
// eslint-disable-next-line security/detect-object-injection
|
|
@@ -10489,7 +10490,7 @@ ${i}`);
|
|
|
10489
10490
|
gn(x, r, T);
|
|
10490
10491
|
for (const x of Z) {
|
|
10491
10492
|
const g = W(N.fields, x.twoWay), k = ft(N, [g]);
|
|
10492
|
-
|
|
10493
|
+
ys(
|
|
10493
10494
|
x,
|
|
10494
10495
|
r,
|
|
10495
10496
|
// eslint-disable-next-line security/detect-object-injection
|
|
@@ -10504,7 +10505,7 @@ ${i}`);
|
|
|
10504
10505
|
gn(x, r, T);
|
|
10505
10506
|
for (const x of Z) {
|
|
10506
10507
|
const g = W(N.fields, x.twoWay), k = ft(N, [g]);
|
|
10507
|
-
|
|
10508
|
+
ys(
|
|
10508
10509
|
x,
|
|
10509
10510
|
r,
|
|
10510
10511
|
// eslint-disable-next-line security/detect-object-injection
|
|
@@ -10554,7 +10555,7 @@ ${i}`);
|
|
|
10554
10555
|
else if (t[o] && t[o]?.valueOf() !== s[o]?.valueOf())
|
|
10555
10556
|
throw new Error("Soft delete timestamp cannot be changed");
|
|
10556
10557
|
}
|
|
10557
|
-
},
|
|
10558
|
+
}, gs = async (n, e, t, s, r) => {
|
|
10558
10559
|
if (!Te("Read", r.collections?.[e.labels.collection]))
|
|
10559
10560
|
return !1;
|
|
10560
10561
|
try {
|
|
@@ -10588,7 +10589,7 @@ ${i}`);
|
|
|
10588
10589
|
if (o && o.size++, o && o.size > 500)
|
|
10589
10590
|
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 or entity restrictions (in permissions when dealing with user collections).");
|
|
10590
10591
|
d.push(async () => {
|
|
10591
|
-
if (!await
|
|
10592
|
+
if (!await gs(n, u, w, t, s))
|
|
10592
10593
|
throw new Error("PERMISSION_DENIED");
|
|
10593
10594
|
});
|
|
10594
10595
|
}
|
|
@@ -10602,7 +10603,7 @@ ${i}`);
|
|
|
10602
10603
|
if (o && o.size++, o && o.size > 500)
|
|
10603
10604
|
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 or entity restrictions (in permissions when dealing with user collections).");
|
|
10604
10605
|
d.push(async () => {
|
|
10605
|
-
if (!await
|
|
10606
|
+
if (!await gs(n, y, p, t, s))
|
|
10606
10607
|
throw new Error("PERMISSION_DENIED");
|
|
10607
10608
|
});
|
|
10608
10609
|
}
|
|
@@ -10618,7 +10619,7 @@ ${i}`);
|
|
|
10618
10619
|
if (o && o.size++, o && o.size > 500)
|
|
10619
10620
|
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 or entity restrictions (in permissions when dealing with user collections).");
|
|
10620
10621
|
d.push(async () => {
|
|
10621
|
-
if (!await
|
|
10622
|
+
if (!await gs(n, y, v, t, s))
|
|
10622
10623
|
throw new Error("PERMISSION_DENIED");
|
|
10623
10624
|
});
|
|
10624
10625
|
}
|
|
@@ -10637,10 +10638,10 @@ ${i}`);
|
|
|
10637
10638
|
throw new Error("COLLECTION_NOT_FOUND");
|
|
10638
10639
|
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;
|
|
10639
10640
|
let Z;
|
|
10640
|
-
s && await
|
|
10641
|
-
const x =
|
|
10642
|
-
i = i || {}, i.collection = m.collection, e.id = g, Mo(e),
|
|
10643
|
-
const k =
|
|
10641
|
+
s && await er(n, d);
|
|
10642
|
+
const x = De(p, n, a), g = o || x.doc().id;
|
|
10643
|
+
i = i || {}, i.collection = m.collection, e.id = g, Mo(e), tr(e);
|
|
10644
|
+
const k = Ws("create", n, e, c, N, "Online", s || "System", lt.now(), me.serverTimestamp()), _ = ye(k);
|
|
10644
10645
|
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]), Tn(d, k, c), Rn(d, k), await ia(k, d, b, v), Ve(k);
|
|
10645
10646
|
try {
|
|
10646
10647
|
if (d.auth && t && !t.password)
|
|
@@ -10664,13 +10665,13 @@ ${i}`);
|
|
|
10664
10665
|
for (const Q of d.fields) {
|
|
10665
10666
|
if (!(Q.name in k))
|
|
10666
10667
|
continue;
|
|
10667
|
-
const S =
|
|
10668
|
+
const S = Ie(Q, b);
|
|
10668
10669
|
if (S?.custom?.serverAccess?.create !== void 0 && !await ie(S.custom.serverAccess.create, [P, k]))
|
|
10669
10670
|
throw new Error("PERMISSION_DENIED");
|
|
10670
10671
|
}
|
|
10671
10672
|
}
|
|
10672
10673
|
t && (t.permissions ||= {}, t.permissions.Role ||= k.Role, t.permissions.Enabled ||= k.Enabled);
|
|
10673
|
-
const
|
|
10674
|
+
const D = async (P, j) => {
|
|
10674
10675
|
const [Q, S, q, B] = await Promise.all([
|
|
10675
10676
|
P.get(p.collection("system_deployment").doc("latest_deploy")),
|
|
10676
10677
|
P.get(p.collection("system_deployment").doc("maintenance_mode")),
|
|
@@ -10698,14 +10699,14 @@ ${i}`);
|
|
|
10698
10699
|
if (!s || !oe.access || oe.access.includes(Z.Role)) {
|
|
10699
10700
|
if (!e[oe.name])
|
|
10700
10701
|
return;
|
|
10701
|
-
const Le =
|
|
10702
|
+
const Le = Ie(oe, b);
|
|
10702
10703
|
if (!(s && Le?.custom?.serverAccess?.read !== void 0 ? await ie(Le.custom.serverAccess.read, [
|
|
10703
10704
|
Z?.Role,
|
|
10704
10705
|
k
|
|
10705
10706
|
]) : !0))
|
|
10706
10707
|
throw new Error("PERMISSION_DENIED");
|
|
10707
10708
|
const Jn = e[oe.name].toString().toLowerCase().replace(/\s/g, "---").replaceAll("/", "|||");
|
|
10708
|
-
if (
|
|
10709
|
+
if (Ks(Jn)) {
|
|
10709
10710
|
if (j && j.size++, j && j.size > 500)
|
|
10710
10711
|
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.");
|
|
10711
10712
|
if ((await P.get(p.collection("tenants").doc(a).collection("system_unique").doc(m.collection).collection(`Unique-${m.collection}-${oe.name}`).doc(Jn)))?.exists)
|
|
@@ -10714,11 +10715,11 @@ ${i}`);
|
|
|
10714
10715
|
throw new Error(`VALIDATION_ERROR: ${oe.name} "${k[oe.name]}" is invalid`);
|
|
10715
10716
|
}
|
|
10716
10717
|
});
|
|
10717
|
-
await Promise.all(pe),
|
|
10718
|
+
await Promise.all(pe), ir(k, g, d, c, s, Z, t?.permissions), t?.permissions && s && Z && await Vo(P, t.permissions, s, Z, c), ir(k, g, d, c, s, Z, t?.permissions);
|
|
10718
10719
|
};
|
|
10719
10720
|
if (d.auth && t) {
|
|
10720
10721
|
await p.runTransaction(async (j) => {
|
|
10721
|
-
await
|
|
10722
|
+
await D(j);
|
|
10722
10723
|
}, { maxAttempts: 10 });
|
|
10723
10724
|
const P = await $o(
|
|
10724
10725
|
a,
|
|
@@ -10735,9 +10736,9 @@ ${i}`);
|
|
|
10735
10736
|
try {
|
|
10736
10737
|
const P = { size: 1 };
|
|
10737
10738
|
await p.runTransaction(async (j) => {
|
|
10738
|
-
await
|
|
10739
|
-
const Q =
|
|
10740
|
-
|
|
10739
|
+
await D(j, P), r?.noTwoWay || await Fo("Create", a, g, k, k, d, c, j, P, s, Z);
|
|
10740
|
+
const Q = Us(c);
|
|
10741
|
+
Qs("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);
|
|
10741
10742
|
}, { maxAttempts: 10 });
|
|
10742
10743
|
} catch (P) {
|
|
10743
10744
|
const Q = await ae("postWriteError", l, b, ["create", k, g, i, P]);
|
|
@@ -10887,8 +10888,8 @@ ${i}`);
|
|
|
10887
10888
|
throw new Error("COLLECTION_NOT_FOUND");
|
|
10888
10889
|
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();
|
|
10889
10890
|
let T;
|
|
10890
|
-
r && await
|
|
10891
|
-
const C =
|
|
10891
|
+
r && await er(n, d);
|
|
10892
|
+
const C = De(p, n, a);
|
|
10892
10893
|
o = o || {}, o.collection = m.collection;
|
|
10893
10894
|
let v = await at(n, e, {
|
|
10894
10895
|
user: r,
|
|
@@ -10913,8 +10914,8 @@ ${i}`);
|
|
|
10913
10914
|
if (s?.operation === "delete" && s.permissions)
|
|
10914
10915
|
throw new Error("VALIDATION_ERROR: Permissions are not allowed for delete operations");
|
|
10915
10916
|
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);
|
|
10916
|
-
delete t.id, Mo(t),
|
|
10917
|
-
const _ =
|
|
10917
|
+
delete t.id, Mo(t), tr(t);
|
|
10918
|
+
const _ = Ws("update", n, t, c, b, "Online", r || "System", lt.now(), me.serverTimestamp()), A = ye(_);
|
|
10918
10919
|
for (const S of O)
|
|
10919
10920
|
!K(S) && Me(_[S.name]) && S.nullable && (_[S.name] = null);
|
|
10920
10921
|
Ve(_), Ve(v), y && await Mt("update", "started", _, a, n, e, d, void 0, v);
|
|
@@ -10927,8 +10928,8 @@ ${i}`);
|
|
|
10927
10928
|
ye(v)
|
|
10928
10929
|
];
|
|
10929
10930
|
await ae("preOperation", l, w, E);
|
|
10930
|
-
const
|
|
10931
|
-
await ae("preWrite", l, w,
|
|
10931
|
+
const D = ["update", _, e, o, void 0, ye(v)];
|
|
10932
|
+
await ae("preWrite", l, w, D), Tn(d, _, c), Rn(d, _), Ve(_);
|
|
10932
10933
|
try {
|
|
10933
10934
|
if (Z && !s.password)
|
|
10934
10935
|
throw new Error("Password is required");
|
|
@@ -10992,18 +10993,18 @@ ${i}`);
|
|
|
10992
10993
|
throw new Error("VALIDATION_ERROR: Enabled field is required");
|
|
10993
10994
|
}
|
|
10994
10995
|
}
|
|
10995
|
-
const
|
|
10996
|
+
const nr = O.filter((de) => "unique" in de && de.unique).map(async (de) => {
|
|
10996
10997
|
if (!r || !de.access || de.access.includes(T.Role)) {
|
|
10997
10998
|
if (_[de.name] === void 0 || Me(_[de.name]))
|
|
10998
10999
|
return;
|
|
10999
|
-
const jt =
|
|
11000
|
+
const jt = Ie(de, w), sr = { ...v, ..._ };
|
|
11000
11001
|
if (!(r && jt?.custom?.serverAccess?.read !== void 0 ? await ie(jt.custom.serverAccess.read, [
|
|
11001
11002
|
T?.Role,
|
|
11002
|
-
|
|
11003
|
+
sr
|
|
11003
11004
|
]) : !0))
|
|
11004
11005
|
throw new Error("PERMISSION_DENIED");
|
|
11005
11006
|
const Zt = _[de.name].toString().toLowerCase().replace(/\s/g, "---").replaceAll("/", "|||");
|
|
11006
|
-
if (
|
|
11007
|
+
if (Ks(Zt)) {
|
|
11007
11008
|
if (B && B.size++, B && B.size > 500)
|
|
11008
11009
|
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.");
|
|
11009
11010
|
const Kn = await S.get(p.collection("tenants").doc(a).collection("system_unique").doc(m.collection).collection(`Unique-${m.collection}-${de.name}`).doc(Zt));
|
|
@@ -11013,12 +11014,12 @@ ${i}`);
|
|
|
11013
11014
|
throw new Error(`VALIDATION_ERROR: ${de.name} "${_[de.name]}" is invalid`);
|
|
11014
11015
|
}
|
|
11015
11016
|
});
|
|
11016
|
-
if (await Promise.all(
|
|
11017
|
+
if (await Promise.all(nr), r && T?.Role) {
|
|
11017
11018
|
const de = T.Role, jt = { ...v, ..._ };
|
|
11018
11019
|
if (!(w.custom?.serverAccess?.update !== void 0 ? await ie(w.custom.serverAccess.update, [de, jt, v]) : !0))
|
|
11019
11020
|
throw new Error("PERMISSION_DENIED");
|
|
11020
11021
|
for (const Qn of d.fields) {
|
|
11021
|
-
const Zt =
|
|
11022
|
+
const Zt = Ie(Qn, w);
|
|
11022
11023
|
if (Object.prototype.hasOwnProperty.call(_, Qn.name) && Zt?.custom?.serverAccess?.update !== void 0 && !await ie(Zt.custom.serverAccess.update, [
|
|
11023
11024
|
de,
|
|
11024
11025
|
jt,
|
|
@@ -11027,7 +11028,7 @@ ${i}`);
|
|
|
11027
11028
|
throw new Error("PERMISSION_DENIED");
|
|
11028
11029
|
}
|
|
11029
11030
|
}
|
|
11030
|
-
|
|
11031
|
+
or(_, v, e, d, c, r, T, s?.operation ? s.operation : g ? "update" : void 0, s?.permissions, R), s?.permissions && r && T && await Vo(S, s.permissions, r, T, c, R, B), or(_, v, e, d, c, r, T, s?.operation ? s.operation : g ? "update" : void 0, s?.permissions, R), q && (Z || k(v) || x) && await zc(S, e, v.User_ID);
|
|
11031
11032
|
};
|
|
11032
11033
|
(Z || g || x) && await p.runTransaction(async (S) => {
|
|
11033
11034
|
await F(S, !0);
|
|
@@ -11053,8 +11054,8 @@ ${i}`);
|
|
|
11053
11054
|
await F(B, !1, q);
|
|
11054
11055
|
let Qe;
|
|
11055
11056
|
i?.noTwoWay || (Qe = await Fo("Update", a, e, re, _, d, c, B, q, r, T, v));
|
|
11056
|
-
const Wt =
|
|
11057
|
-
|
|
11057
|
+
const Wt = Us(c);
|
|
11058
|
+
Qs("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), _);
|
|
11058
11059
|
}, { maxAttempts: 10 });
|
|
11059
11060
|
} catch (q) {
|
|
11060
11061
|
const B = [
|
|
@@ -11072,11 +11073,11 @@ ${i}`);
|
|
|
11072
11073
|
}), await Mt("update", re?.resolved ? "success" : "failed", _, a, n, e, d, re?.resolved ? void 0 : q, v)), !re?.resolved)
|
|
11073
11074
|
throw Z && await un(v), k(v) && await Qt(v.User_ID, S, R, "USER_ERROR"), x && await p.collection("tenants").doc(a).collection(m.collection).doc(e).update({ User_ID: me.delete() }), q;
|
|
11074
11075
|
}
|
|
11075
|
-
(Z || k(v) || x) && await
|
|
11076
|
+
(Z || k(v) || x) && await Qr(ti, [e, v.User_ID]).catch(() => {
|
|
11076
11077
|
throw new Error("USER_ERROR");
|
|
11077
11078
|
});
|
|
11078
11079
|
} catch (S) {
|
|
11079
|
-
throw (Z || k(v) || x) && await
|
|
11080
|
+
throw (Z || k(v) || x) && await Qr(ti, [e, v.User_ID]).catch(() => {
|
|
11080
11081
|
throw new Error("USER_ERROR");
|
|
11081
11082
|
}), S;
|
|
11082
11083
|
}
|
|
@@ -11097,23 +11098,23 @@ ${i}`);
|
|
|
11097
11098
|
return await qc(n, e, { [O.archivedField]: !0, [O.timestampField]: me.serverTimestamp() }, void 0, t);
|
|
11098
11099
|
const b = ue();
|
|
11099
11100
|
let N;
|
|
11100
|
-
t && await
|
|
11101
|
-
const p =
|
|
11101
|
+
t && await er(n, h);
|
|
11102
|
+
const p = De(b, n, i);
|
|
11102
11103
|
r = r || {}, r.collection = f.collection;
|
|
11103
11104
|
const T = await at(n, e, { user: t });
|
|
11104
|
-
let C =
|
|
11105
|
+
let C = Ws("delete", n, T, a, w, "Online", t || "System", lt.now(), me.serverTimestamp());
|
|
11105
11106
|
const v = Sn(C);
|
|
11106
11107
|
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);
|
|
11107
11108
|
const g = async (E) => {
|
|
11108
|
-
const [
|
|
11109
|
+
const [D, R, F, M] = await Promise.all([
|
|
11109
11110
|
E.get(b.collection("system_deployment").doc("maintenance_mode")),
|
|
11110
11111
|
at([f.collection], e, { user: t, providedTransaction: E }),
|
|
11111
11112
|
t ? E.get(b.collection("tenants").doc(i).collection("system_user_permissions").doc(t)) : Promise.resolve(Promise.resolve({})),
|
|
11112
11113
|
Ge()
|
|
11113
11114
|
]);
|
|
11114
|
-
if (!
|
|
11115
|
+
if (!D.exists)
|
|
11115
11116
|
throw new Error("MAINTENANCE_MODE");
|
|
11116
|
-
if (
|
|
11117
|
+
if (D.data().active)
|
|
11117
11118
|
throw new Error("MAINTENANCE_MODE");
|
|
11118
11119
|
if (!R)
|
|
11119
11120
|
throw new Error("NOT_FOUND");
|
|
@@ -11138,8 +11139,8 @@ ${i}`);
|
|
|
11138
11139
|
try {
|
|
11139
11140
|
await b.runTransaction(async (E) => {
|
|
11140
11141
|
await g(E);
|
|
11141
|
-
const
|
|
11142
|
-
|
|
11142
|
+
const D = Us(a);
|
|
11143
|
+
Qs("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));
|
|
11143
11144
|
}, { maxAttempts: 10 });
|
|
11144
11145
|
} catch (E) {
|
|
11145
11146
|
const R = await ae("postWriteError", o, y, ["delete", C, e, r, E]);
|
|
@@ -11189,7 +11190,7 @@ export {
|
|
|
11189
11190
|
Hc as convertTimestampToTimezone,
|
|
11190
11191
|
pu as deleteRecord,
|
|
11191
11192
|
un as deleteUser,
|
|
11192
|
-
|
|
11193
|
+
tr as deserializeDeleteSentinels,
|
|
11193
11194
|
Mo as deserializeTimestamps,
|
|
11194
11195
|
hu as deserializeTimestampsWithoutUnderscores,
|
|
11195
11196
|
Ou as displayDate,
|
|
@@ -11200,7 +11201,7 @@ export {
|
|
|
11200
11201
|
Je as getCustomizationFile,
|
|
11201
11202
|
Pc as getCustomizationFiles,
|
|
11202
11203
|
Ro as getDocumentRefs,
|
|
11203
|
-
|
|
11204
|
+
De as getFirestorePathRef,
|
|
11204
11205
|
Ut as getGlobalConfigModule,
|
|
11205
11206
|
iu as getInputSchema,
|
|
11206
11207
|
cu as getMaintenanceInfo,
|