@stoker-platform/node-client 0.5.88 → 0.5.89
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 +734 -718
- package/package.json +1 -1
package/dist/bundle.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import Je from "lodash/isEqual.js";
|
|
2
2
|
import Ko from "lodash/merge.js";
|
|
3
3
|
import Xo from "lodash/set.js";
|
|
4
|
-
import
|
|
4
|
+
import ge from "lodash/cloneDeep.js";
|
|
5
5
|
import { getApp as Hs, initializeApp as fi, applicationDefault as hi } from "firebase-admin/app";
|
|
6
|
-
import { getFirestore as ea, Timestamp as ht, FieldValue as
|
|
6
|
+
import { getFirestore as ea, Timestamp as ht, FieldValue as we } from "firebase-admin/firestore";
|
|
7
7
|
import { pathToFileURL as mi } from "node:url";
|
|
8
8
|
import ta from "cross-spawn";
|
|
9
9
|
import { getDatabase as pi } from "firebase-admin/database";
|
|
10
|
-
import { getAuth as
|
|
10
|
+
import { getAuth as Rt } from "firebase-admin/auth";
|
|
11
11
|
const Kn = (t) => !!t && !Array.isArray(t), ln = (t, e) => t.access ? Kn(t.access) ? !1 : t.access.includes(e) : !0, na = (t, e) => {
|
|
12
12
|
if (Kn(t.access))
|
|
13
13
|
return e.fieldAccessGroups?.[t.access.group];
|
|
@@ -38,13 +38,13 @@ const Kn = (t) => !!t && !Array.isArray(t), ln = (t, e) => t.access ? Kn(t.acces
|
|
|
38
38
|
}, sa = (t, e, n, s) => {
|
|
39
39
|
const r = na(t, e);
|
|
40
40
|
return r ? Xn(r, e.labels.collection, n, s) : !1;
|
|
41
|
-
}, es = (t) => !!t.auth,
|
|
41
|
+
}, es = (t) => !!t.auth, Ne = (t, e) => {
|
|
42
42
|
if (e?.operations)
|
|
43
43
|
return e.operations.includes(t);
|
|
44
44
|
}, Be = (t, e, n, s) => e ? e.Role ? Kn(t.access) ? !n || !s ? !1 : sa(t, n, e, s) : t.access?.includes(e.Role) : !1 : !0, yi = (t, e, n, s) => t === !0 ? !1 : Array.isArray(t) ? t.includes(e.Role) : typeof t == "object" && t !== null ? !n || !s ? !1 : Xn(t, n, e, s) : !0, ra = (t, e, n, s) => e ? e.Role ? yi(t.restrictCreate, e, n, s) : !1 : !0, gi = (t, e, n, s) => e ? e.Role ? yi(t.restrictUpdate, e, n, s) : !1 : !0, mr = (t, e, n, s) => {
|
|
45
45
|
const { labels: r } = t;
|
|
46
46
|
return n.collections && // eslint-disable-next-line security/detect-object-injection
|
|
47
|
-
|
|
47
|
+
Ne("Update", n.collections[r.collection]) && (!e.access || Be(e, n, t, s)) && gi(e, n, r.collection, s) && !(t.auth && !n.collections?.[r.collection].auth && ["Enabled", "Role", "Name", "Email", "Photo_URL"].includes(e.name));
|
|
48
48
|
}, V = (t, e) => t.filter((n) => n.name === e)[0], ee = (t) => ["OneToOne", "OneToMany", "ManyToOne", "ManyToMany"].includes(t.type), wi = (t, e) => {
|
|
49
49
|
const n = {
|
|
50
50
|
Record_Owner: "recordOwner",
|
|
@@ -117,24 +117,24 @@ const Kn = (t) => !!t && !Array.isArray(t), ln = (t, e) => t.access ? Kn(t.acces
|
|
|
117
117
|
h?.filter((v) => v.type === "Individual").forEach(() => {
|
|
118
118
|
g = !0, l?.individualEntities?.includes(i.id) || (f = !1);
|
|
119
119
|
});
|
|
120
|
-
let
|
|
120
|
+
let R = !0, m = !1;
|
|
121
121
|
if (h?.filter((v) => v.type === "Parent").forEach((v) => {
|
|
122
122
|
m = !0;
|
|
123
123
|
const N = V(a, v.collectionField);
|
|
124
|
-
l?.parentEntities?.some((W) => i[`${N.name}_Array`].includes(W)) || (
|
|
124
|
+
l?.parentEntities?.some((W) => i[`${N.name}_Array`].includes(W)) || (R = !1);
|
|
125
125
|
}), h?.filter((v) => v.type === "Parent_Property").forEach((v) => {
|
|
126
126
|
m = !0;
|
|
127
127
|
const N = V(a, v.collectionField), W = V(a, v.propertyField);
|
|
128
128
|
Object.entries(l?.parentPropertyEntities || {}).some((O) => {
|
|
129
|
-
const [H,
|
|
130
|
-
return H === i[W.name] && i[`${N.name}_Array`].some((p) =>
|
|
131
|
-
}) || (
|
|
129
|
+
const [H, S] = O;
|
|
130
|
+
return H === i[W.name] && i[`${N.name}_Array`].some((p) => S.includes(p));
|
|
131
|
+
}) || (R = !1);
|
|
132
132
|
}), g && m) {
|
|
133
|
-
if (!(f ||
|
|
133
|
+
if (!(f || R)) {
|
|
134
134
|
c = !1;
|
|
135
135
|
return;
|
|
136
136
|
}
|
|
137
|
-
} else if (!f || !
|
|
137
|
+
} else if (!f || !R) {
|
|
138
138
|
c = !1;
|
|
139
139
|
return;
|
|
140
140
|
}
|
|
@@ -156,15 +156,15 @@ const Kn = (t) => !!t && !Array.isArray(t), ln = (t, e) => t.access ? Kn(t.acces
|
|
|
156
156
|
c = !1;
|
|
157
157
|
return;
|
|
158
158
|
}
|
|
159
|
-
H.parentEntities?.some((
|
|
159
|
+
H.parentEntities?.some((S) => i[`${O.name}_Array`].includes(S)) || (x = !1);
|
|
160
160
|
}), u?.filter((v) => v.parentFilter.type === "Parent_Property").forEach((v) => {
|
|
161
161
|
k = !0;
|
|
162
|
-
const { parentFilter: N } = v, W = V(a, N.collectionField), O = V(a, N.parentPropertyField), H = V(a, N.parentCollectionField),
|
|
163
|
-
if (!
|
|
162
|
+
const { parentFilter: N } = v, W = V(a, N.collectionField), O = V(a, N.parentPropertyField), H = V(a, N.parentCollectionField), S = r.collections?.[W.collection];
|
|
163
|
+
if (!S) {
|
|
164
164
|
c = !1;
|
|
165
165
|
return;
|
|
166
166
|
}
|
|
167
|
-
Object.entries(
|
|
167
|
+
Object.entries(S.parentPropertyEntities || {}).some((p) => {
|
|
168
168
|
const [C, I] = p;
|
|
169
169
|
return C === i[O.name] && i[`${H.name}_Array`].some((P) => I.includes(P));
|
|
170
170
|
}) || (x = !1);
|
|
@@ -183,7 +183,7 @@ const Kn = (t) => !!t && !Array.isArray(t), ln = (t, e) => t.access ? Kn(t.acces
|
|
|
183
183
|
let l = !0;
|
|
184
184
|
if (!a || !r.Role)
|
|
185
185
|
return l = !1, l;
|
|
186
|
-
|
|
186
|
+
Ne(t, a) || (l = !1);
|
|
187
187
|
const d = Gs(e, r)?.filter((h) => h.type === "Individual").length > 0;
|
|
188
188
|
return t === "Create" && d && (l = !1), ia(t, e, n, s, r, i) || (l = !1), l;
|
|
189
189
|
}, vi = (t, e, n) => {
|
|
@@ -328,11 +328,11 @@ const Kn = (t) => !!t && !Array.isArray(t), ln = (t, e) => t.access ? Kn(t.acces
|
|
|
328
328
|
}
|
|
329
329
|
}), h?.assignable?.includes(n)))
|
|
330
330
|
continue;
|
|
331
|
-
let
|
|
331
|
+
let R = !1;
|
|
332
332
|
if (h?.restrictions?.forEach((m) => {
|
|
333
333
|
for (const E of m.roles)
|
|
334
334
|
if (E.role === n) {
|
|
335
|
-
if (
|
|
335
|
+
if (R = !0, m.type === "Individual" && !e.collections?.[o.collection]?.individualEntities) {
|
|
336
336
|
r = `Collection ${o.collection} is missing individual entities`, s = !1;
|
|
337
337
|
return;
|
|
338
338
|
}
|
|
@@ -359,7 +359,7 @@ const Kn = (t) => !!t && !Array.isArray(t), ln = (t, e) => t.access ? Kn(t.acces
|
|
|
359
359
|
}
|
|
360
360
|
}
|
|
361
361
|
}
|
|
362
|
-
}),
|
|
362
|
+
}), R && !e.collections?.[o.collection]?.restrictEntities) {
|
|
363
363
|
r = `Collection ${o.collection} must have restrictEntities set to true`, s = !1;
|
|
364
364
|
return;
|
|
365
365
|
}
|
|
@@ -371,19 +371,19 @@ const Kn = (t) => !!t && !Array.isArray(t), ln = (t, e) => t.access ? Kn(t.acces
|
|
|
371
371
|
const f = d?.filter((g) => s === g.userRole);
|
|
372
372
|
return f?.length && !f.some((g) => g.recordRole === r) ? (u = `User ${s} does not have write access to record with role ${r}`, h = !1, h) : t === "update" && // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
373
373
|
o.User_ID && f?.length && !f.some((g) => g.recordRole === a) ? (u = `User ${s} does not have write access to record with role ${r}`, h = !1, h) : (d?.forEach((g) => {
|
|
374
|
-
s === g.userRole && g.recordRole === r && t !== "delete" && i && Object.keys(n.collections).forEach((
|
|
375
|
-
const m = i.collections?.[
|
|
374
|
+
s === g.userRole && g.recordRole === r && t !== "delete" && i && Object.keys(n.collections).forEach((R) => {
|
|
375
|
+
const m = i.collections?.[R], E = l?.collections?.[R];
|
|
376
376
|
if (!(t === "update" && Je(m, E)) && m) {
|
|
377
|
-
const w = g.collections.some((x) => x.collection ===
|
|
377
|
+
const w = g.collections.some((x) => x.collection === R);
|
|
378
378
|
if (w) {
|
|
379
379
|
if (w) {
|
|
380
|
-
const x = g.collections.find((v) => v.collection ===
|
|
380
|
+
const x = g.collections.find((v) => v.collection === R);
|
|
381
381
|
if (!(m.operations.every((v) => x.operations.includes(v)) || t === "update" && Je(m.operations, E?.operations))) {
|
|
382
|
-
u = `User ${s} does not have write access to all included operations for collection ${
|
|
382
|
+
u = `User ${s} does not have write access to all included operations for collection ${R}`, h = !1;
|
|
383
383
|
return;
|
|
384
384
|
}
|
|
385
385
|
if (!x.auth && m.auth && !(t === "update" && Je(m.auth, E?.auth))) {
|
|
386
|
-
u = `User ${s} does not have write access to auth for collection ${
|
|
386
|
+
u = `User ${s} does not have write access to auth for collection ${R}`, h = !1;
|
|
387
387
|
return;
|
|
388
388
|
}
|
|
389
389
|
const k = {
|
|
@@ -394,16 +394,16 @@ const Kn = (t) => !!t && !Array.isArray(t), ln = (t, e) => t.access ? Kn(t.acces
|
|
|
394
394
|
if (Object.keys(k).forEach((v) => {
|
|
395
395
|
const N = k[v];
|
|
396
396
|
if (x.attributeRestrictions?.includes(N) && !(m[v]?.active || t === "update" && Je(m[v], E?.[v]))) {
|
|
397
|
-
u = `User ${s} does not have write access to attribute restriction ${v} for collection ${
|
|
397
|
+
u = `User ${s} does not have write access to attribute restriction ${v} for collection ${R}`, h = !1;
|
|
398
398
|
return;
|
|
399
399
|
}
|
|
400
400
|
}), x.restrictEntities && !m.restrictEntities && !(t === "update" && Je(m.restrictEntities, E?.restrictEntities))) {
|
|
401
|
-
u = `User ${s} does not have write access to restrictEntities for collection ${
|
|
401
|
+
u = `User ${s} does not have write access to restrictEntities for collection ${R}`, h = !1;
|
|
402
402
|
return;
|
|
403
403
|
}
|
|
404
404
|
}
|
|
405
405
|
} else {
|
|
406
|
-
u = `User ${s} does not have write access to collection ${
|
|
406
|
+
u = `User ${s} does not have write access to collection ${R}`, h = !1;
|
|
407
407
|
return;
|
|
408
408
|
}
|
|
409
409
|
}
|
|
@@ -418,7 +418,7 @@ const Kn = (t) => !!t && !Array.isArray(t), ln = (t, e) => t.access ? Kn(t.acces
|
|
|
418
418
|
return;
|
|
419
419
|
}
|
|
420
420
|
for (const d of a?.operations || [])
|
|
421
|
-
if (!l?.operations.includes(d) && (!
|
|
421
|
+
if (!l?.operations.includes(d) && (!Ne("Read", c) || !Ne(d, c))) {
|
|
422
422
|
i = `User does not have ${d.toLowerCase()} access to collection ${o.labels.collection}`, r = !1;
|
|
423
423
|
return;
|
|
424
424
|
}
|
|
@@ -466,7 +466,7 @@ const Kn = (t) => !!t && !Array.isArray(t), ln = (t, e) => t.access ? Kn(t.acces
|
|
|
466
466
|
let h = !0;
|
|
467
467
|
if (r && !d)
|
|
468
468
|
throw new Error("PERMISSION_DENIED");
|
|
469
|
-
r && !
|
|
469
|
+
r && !Ne("Create", d) && (h = !1), r && // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
470
470
|
!dt("Create", n, s, r, i, t) && (h = !1), n.auth && o && (r && !es(d) && (h = !1), Ys("create", t, e, n, s, r, i, o) || (h = !1));
|
|
471
471
|
for (const u of c) {
|
|
472
472
|
const f = t[u.name];
|
|
@@ -474,31 +474,31 @@ const Kn = (t) => !!t && !Array.isArray(t), ln = (t, e) => t.access ? Kn(t.acces
|
|
|
474
474
|
}
|
|
475
475
|
if (!h)
|
|
476
476
|
throw new Error("PERMISSION_DENIED");
|
|
477
|
-
},
|
|
477
|
+
}, ke = (t) => t && (t._methodName === "deleteField" || t.constructor.name === "DeleteTransform"), Qe = (t) => {
|
|
478
478
|
for (const e in t)
|
|
479
|
-
Object.prototype.hasOwnProperty.call(t, e) && (
|
|
479
|
+
Object.prototype.hasOwnProperty.call(t, e) && (ke(t[e]) ? delete t[e] : typeof t[e] == "object" && t[e] !== null && Qe(t[e]));
|
|
480
480
|
}, yr = (t, e, n, s, r, i, o, a, l, c, d) => {
|
|
481
481
|
const { labels: h, fields: u } = s, f = o?.collections?.[h.collection], g = { ...e, ...t };
|
|
482
|
-
|
|
483
|
-
let
|
|
482
|
+
Qe(g);
|
|
483
|
+
let R = !0, m = "";
|
|
484
484
|
if (i && !f)
|
|
485
485
|
throw new Error("PERMISSION_DENIED");
|
|
486
|
-
i && !
|
|
486
|
+
i && !Ne("Update", f) && (R = !1, m = "Authenticated user does not have Update access to this collection"), i && // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
487
487
|
(!dt("Update", s, r, i, o, e) || // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
488
|
-
!dt("Update", s, r, i, o, g)) && (
|
|
489
|
-
!
|
|
488
|
+
!dt("Update", s, r, i, o, g)) && (R = !1, m = "Authenticated user does not have Update access to this document"), i && s.softDelete && g[s.softDelete.archivedField] !== e[s.softDelete.archivedField] && // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
489
|
+
!Ne("Delete", f) && (R = !1, m = "Authenticated user does not have Delete or Restore access to this document"), a && (i && !es(f) && (R = !1, m = "Authenticated user does not have Auth access for this collection"), Ys("update", g, n, s, r, i, o, l, c, e, a) || (m = "Authenticated user does not have sufficient write access for this record", R = !1));
|
|
490
490
|
for (const E of u) {
|
|
491
491
|
const w = t[E.name];
|
|
492
|
-
E.access && !Be(E, o, s, d) && w !== void 0 && (m = `Authenticated user does not have access to field ${E.name}`,
|
|
492
|
+
E.access && !Be(E, o, s, d) && w !== void 0 && (m = `Authenticated user does not have access to field ${E.name}`, R = !1), w !== void 0 && !gi(E, o, h.collection, d) && (m = `Authenticated user does not have Update access to field ${E.name}`, R = !1);
|
|
493
493
|
}
|
|
494
|
-
if (!
|
|
494
|
+
if (!R)
|
|
495
495
|
throw m && console.error(`PERMISSION_DENIED: ${m}`), new Error("PERMISSION_DENIED");
|
|
496
496
|
}, ua = (t, e, n, s, r, i) => {
|
|
497
497
|
const { labels: o } = n, a = i.collections?.[o.collection];
|
|
498
498
|
let l = !0;
|
|
499
499
|
if (!a)
|
|
500
500
|
throw new Error("PERMISSION_DENIED");
|
|
501
|
-
if (
|
|
501
|
+
if (Ne("Delete", a) || (l = !1), dt("Delete", n, s, r, i, t) || (l = !1), n.auth && t.User_ID && (es(a) || (l = !1), Ys("delete", t, e, n, s, r, i) || (l = !1)), !l)
|
|
502
502
|
throw new Error("PERMISSION_DENIED");
|
|
503
503
|
}, da = async (t, e, n, s, r) => {
|
|
504
504
|
const { labels: i } = e, o = r.collections?.[i.collection];
|
|
@@ -507,7 +507,7 @@ const Kn = (t) => !!t && !Array.isArray(t), ln = (t, e) => t.access ? Kn(t.acces
|
|
|
507
507
|
a = !1;
|
|
508
508
|
return;
|
|
509
509
|
}
|
|
510
|
-
if (
|
|
510
|
+
if (Ne("Read", o) || (a = !1), dt("Read", e, n, s, r, t) || (a = !1), !a)
|
|
511
511
|
throw new Error("PERMISSION_DENIED");
|
|
512
512
|
}, fa = async (t, e, n, s, r) => {
|
|
513
513
|
const { labels: i } = e, o = r.collections?.[i.collection];
|
|
@@ -516,7 +516,7 @@ const Kn = (t) => !!t && !Array.isArray(t), ln = (t, e) => t.access ? Kn(t.acces
|
|
|
516
516
|
a = !1;
|
|
517
517
|
return;
|
|
518
518
|
}
|
|
519
|
-
if (
|
|
519
|
+
if (Ne("Read", o) || (a = !1), t.forEach((l) => {
|
|
520
520
|
dt("Read", e, n, s, r, l) || (a = !1);
|
|
521
521
|
}), !a)
|
|
522
522
|
throw new Error("PERMISSION_DENIED");
|
|
@@ -558,7 +558,7 @@ const Kn = (t) => !!t && !Array.isArray(t), ln = (t, e) => t.access ? Kn(t.acces
|
|
|
558
558
|
i[o] = l;
|
|
559
559
|
}
|
|
560
560
|
return i;
|
|
561
|
-
},
|
|
561
|
+
}, We = (t, e) => e.fields.filter((n) => n.name === t.name)[0], ls = {
|
|
562
562
|
global: {},
|
|
563
563
|
collections: {}
|
|
564
564
|
}, Qt = (t, e) => t && typeof t == "function" ? e ? t(...e) : t() : t, ae = async (t, e) => {
|
|
@@ -879,7 +879,7 @@ const Ks = (t, e, n, s, r, i, o, a, l, c) => (t === "create" && (n.Collection_Pa
|
|
|
879
879
|
return e.forEach((o) => {
|
|
880
880
|
ee(o) && ["OneToOne", "OneToMany"].includes(o.type) && o.sorting && (typeof o.sorting == "boolean" || !o.sorting.roles?.every((a) => r?.includes(a))) && i.add(o);
|
|
881
881
|
}), i;
|
|
882
|
-
},
|
|
882
|
+
}, Tt = (t, e) => {
|
|
883
883
|
const { access: n, recordTitleField: s } = t, { serverReadOnly: r } = n, i = /* @__PURE__ */ new Set();
|
|
884
884
|
return e.forEach((o) => {
|
|
885
885
|
(s === o.name || o.sorting && (typeof o.sorting == "boolean" || !o.sorting.roles?.every((a) => r?.includes(a)))) && o.type === "String" && i.add(o);
|
|
@@ -897,7 +897,7 @@ const Ks = (t, e, n, s, r, i, o, a, l, c) => (t === "create" && (n.Collection_Pa
|
|
|
897
897
|
s.forEach((i) => {
|
|
898
898
|
if (ee(i))
|
|
899
899
|
if (e[i.name]) {
|
|
900
|
-
if (
|
|
900
|
+
if (ke(e[i.name]))
|
|
901
901
|
e[`${i.name}_Array`] = e[i.name];
|
|
902
902
|
else if (Object.keys(e[i.name]).forEach((o) => {
|
|
903
903
|
const a = e[i.name][o];
|
|
@@ -905,7 +905,7 @@ const Ks = (t, e, n, s, r, i, o, a, l, c) => (t === "create" && (n.Collection_Pa
|
|
|
905
905
|
}), e[`${i.name}_Array`] = Object.keys(e[i.name]), i.includeFields)
|
|
906
906
|
for (const o of i.includeFields) {
|
|
907
907
|
const a = n.collections[i.collection], l = V(a.fields, o);
|
|
908
|
-
|
|
908
|
+
Tt(a, [l]).size === 1 && Object.keys(e[i.name]).forEach((d) => {
|
|
909
909
|
e[i.name][d][o] ? e[i.name][d][`${o}_Lowercase`] = e[i.name][d][o].toLowerCase() : delete e[i.name][d][`${o}_Lowercase`];
|
|
910
910
|
});
|
|
911
911
|
}
|
|
@@ -913,7 +913,7 @@ const Ks = (t, e, n, s, r, i, o, a, l, c) => (t === "create" && (n.Collection_Pa
|
|
|
913
913
|
delete e[`${i.name}_Array`], delete e[`${i.name}_Single`];
|
|
914
914
|
}), Et(t, s).forEach((i) => {
|
|
915
915
|
if (e[i.name])
|
|
916
|
-
if (
|
|
916
|
+
if (ke(e[i.name]))
|
|
917
917
|
e[`${i.name}_Single`] = e[i.name];
|
|
918
918
|
else {
|
|
919
919
|
const o = e[`${i.name}_Array`]?.[0];
|
|
@@ -924,14 +924,14 @@ const Ks = (t, e, n, s, r, i, o, a, l, c) => (t === "create" && (n.Collection_Pa
|
|
|
924
924
|
}
|
|
925
925
|
});
|
|
926
926
|
}, Pn = (t, e) => {
|
|
927
|
-
|
|
927
|
+
Tt(t, t.fields).forEach((s) => {
|
|
928
928
|
e[s.name] ? e[`${s.name}_Lowercase`] = e[s.name].toLowerCase() : delete e[`${s.name}_Lowercase`];
|
|
929
929
|
});
|
|
930
930
|
}, va = async (t, e, n, s, r) => {
|
|
931
931
|
const { fields: i } = e;
|
|
932
932
|
for (const o of n.fields) {
|
|
933
933
|
const a = V(i, o.name);
|
|
934
|
-
o.custom?.initialValue !== void 0 && (!a.access || Be(a, s, e, r || {})) && (t[o.name] = await ae(o.custom.initialValue, [t]),
|
|
934
|
+
o.custom?.initialValue !== void 0 && (!a.access || Be(a, s, e, r || {})) && (t[o.name] = await ae(o.custom.initialValue, [t]), Tt(e, [a]).size === 1 && (t[`${o.name}_Lowercase`] = t[o.name].toLowerCase()));
|
|
935
935
|
}
|
|
936
936
|
for (const o of i)
|
|
937
937
|
(!o.access || Be(o, s, e, r || {})) && ("autoIncrement" in o && o.autoIncrement && !t[o.name] && (t[o.name] = "Pending"), !ee(o) && o.nullable && t[o.name] === void 0 && (t[o.name] = null));
|
|
@@ -1002,7 +1002,7 @@ const Z = se.arrayToEnum([
|
|
|
1002
1002
|
"never",
|
|
1003
1003
|
"map",
|
|
1004
1004
|
"set"
|
|
1005
|
-
]),
|
|
1005
|
+
]), it = (t) => {
|
|
1006
1006
|
switch (typeof t) {
|
|
1007
1007
|
case "undefined":
|
|
1008
1008
|
return Z.undefined;
|
|
@@ -1041,7 +1041,7 @@ const Z = se.arrayToEnum([
|
|
|
1041
1041
|
"not_multiple_of",
|
|
1042
1042
|
"not_finite"
|
|
1043
1043
|
]);
|
|
1044
|
-
class
|
|
1044
|
+
class et extends Error {
|
|
1045
1045
|
get errors() {
|
|
1046
1046
|
return this.issues;
|
|
1047
1047
|
}
|
|
@@ -1078,7 +1078,7 @@ class Xe extends Error {
|
|
|
1078
1078
|
return r(this), s;
|
|
1079
1079
|
}
|
|
1080
1080
|
static assert(e) {
|
|
1081
|
-
if (!(e instanceof
|
|
1081
|
+
if (!(e instanceof et))
|
|
1082
1082
|
throw new Error(`Not a ZodError: ${e}`);
|
|
1083
1083
|
}
|
|
1084
1084
|
toString() {
|
|
@@ -1104,8 +1104,8 @@ class Xe extends Error {
|
|
|
1104
1104
|
return this.flatten();
|
|
1105
1105
|
}
|
|
1106
1106
|
}
|
|
1107
|
-
|
|
1108
|
-
const
|
|
1107
|
+
et.create = (t) => new et(t);
|
|
1108
|
+
const Ss = (t, e) => {
|
|
1109
1109
|
let n;
|
|
1110
1110
|
switch (t.code) {
|
|
1111
1111
|
case A.invalid_type:
|
|
@@ -1161,7 +1161,7 @@ const Rs = (t, e) => {
|
|
|
1161
1161
|
}
|
|
1162
1162
|
return { message: n };
|
|
1163
1163
|
};
|
|
1164
|
-
let Oa =
|
|
1164
|
+
let Oa = Ss;
|
|
1165
1165
|
function ka() {
|
|
1166
1166
|
return Oa;
|
|
1167
1167
|
}
|
|
@@ -1198,13 +1198,13 @@ function L(t, e) {
|
|
|
1198
1198
|
// then schema-bound map if available
|
|
1199
1199
|
n,
|
|
1200
1200
|
// then global override map
|
|
1201
|
-
n ===
|
|
1201
|
+
n === Ss ? void 0 : Ss
|
|
1202
1202
|
// then global default map
|
|
1203
1203
|
].filter((r) => !!r)
|
|
1204
1204
|
});
|
|
1205
1205
|
t.common.issues.push(s);
|
|
1206
1206
|
}
|
|
1207
|
-
class
|
|
1207
|
+
class Re {
|
|
1208
1208
|
constructor() {
|
|
1209
1209
|
this.value = "valid";
|
|
1210
1210
|
}
|
|
@@ -1232,7 +1232,7 @@ class ke {
|
|
|
1232
1232
|
value: o
|
|
1233
1233
|
});
|
|
1234
1234
|
}
|
|
1235
|
-
return
|
|
1235
|
+
return Re.mergeObjectSync(e, s);
|
|
1236
1236
|
}
|
|
1237
1237
|
static mergeObjectSync(e, n) {
|
|
1238
1238
|
const s = {};
|
|
@@ -1247,7 +1247,7 @@ class ke {
|
|
|
1247
1247
|
}
|
|
1248
1248
|
const Q = Object.freeze({
|
|
1249
1249
|
status: "aborted"
|
|
1250
|
-
}), Kt = (t) => ({ status: "dirty", value: t }),
|
|
1250
|
+
}), Kt = (t) => ({ status: "dirty", value: t }), Pe = (t) => ({ status: "valid", value: t }), wr = (t) => t.status === "aborted", _r = (t) => t.status === "dirty", Pt = (t) => t.status === "valid", Ln = (t) => typeof Promise < "u" && t instanceof Promise;
|
|
1251
1251
|
var q;
|
|
1252
1252
|
(function(t) {
|
|
1253
1253
|
t.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, t.toString = (e) => typeof e == "string" ? e : e?.message;
|
|
@@ -1270,7 +1270,7 @@ const Er = (t, e) => {
|
|
|
1270
1270
|
get error() {
|
|
1271
1271
|
if (this._error)
|
|
1272
1272
|
return this._error;
|
|
1273
|
-
const n = new
|
|
1273
|
+
const n = new et(t.common.issues);
|
|
1274
1274
|
return this._error = n, this._error;
|
|
1275
1275
|
}
|
|
1276
1276
|
};
|
|
@@ -1291,13 +1291,13 @@ class te {
|
|
|
1291
1291
|
return this._def.description;
|
|
1292
1292
|
}
|
|
1293
1293
|
_getType(e) {
|
|
1294
|
-
return
|
|
1294
|
+
return it(e.data);
|
|
1295
1295
|
}
|
|
1296
1296
|
_getOrReturnCtx(e, n) {
|
|
1297
1297
|
return n || {
|
|
1298
1298
|
common: e.parent.common,
|
|
1299
1299
|
data: e.data,
|
|
1300
|
-
parsedType:
|
|
1300
|
+
parsedType: it(e.data),
|
|
1301
1301
|
schemaErrorMap: this._def.errorMap,
|
|
1302
1302
|
path: e.path,
|
|
1303
1303
|
parent: e.parent
|
|
@@ -1305,11 +1305,11 @@ class te {
|
|
|
1305
1305
|
}
|
|
1306
1306
|
_processInputParams(e) {
|
|
1307
1307
|
return {
|
|
1308
|
-
status: new
|
|
1308
|
+
status: new Re(),
|
|
1309
1309
|
ctx: {
|
|
1310
1310
|
common: e.parent.common,
|
|
1311
1311
|
data: e.data,
|
|
1312
|
-
parsedType:
|
|
1312
|
+
parsedType: it(e.data),
|
|
1313
1313
|
schemaErrorMap: this._def.errorMap,
|
|
1314
1314
|
path: e.path,
|
|
1315
1315
|
parent: e.parent
|
|
@@ -1343,7 +1343,7 @@ class te {
|
|
|
1343
1343
|
schemaErrorMap: this._def.errorMap,
|
|
1344
1344
|
parent: null,
|
|
1345
1345
|
data: e,
|
|
1346
|
-
parsedType:
|
|
1346
|
+
parsedType: it(e)
|
|
1347
1347
|
}, r = this._parseSync({ data: e, path: s.path, parent: s });
|
|
1348
1348
|
return Er(s, r);
|
|
1349
1349
|
}
|
|
@@ -1357,7 +1357,7 @@ class te {
|
|
|
1357
1357
|
schemaErrorMap: this._def.errorMap,
|
|
1358
1358
|
parent: null,
|
|
1359
1359
|
data: e,
|
|
1360
|
-
parsedType:
|
|
1360
|
+
parsedType: it(e)
|
|
1361
1361
|
};
|
|
1362
1362
|
if (!this["~standard"].async)
|
|
1363
1363
|
try {
|
|
@@ -1396,7 +1396,7 @@ class te {
|
|
|
1396
1396
|
schemaErrorMap: this._def.errorMap,
|
|
1397
1397
|
parent: null,
|
|
1398
1398
|
data: e,
|
|
1399
|
-
parsedType:
|
|
1399
|
+
parsedType: it(e)
|
|
1400
1400
|
}, r = this._parse({ data: e, path: s.path, parent: s }), i = await (Ln(r) ? r : Promise.resolve(r));
|
|
1401
1401
|
return Er(s, i);
|
|
1402
1402
|
}
|
|
@@ -1504,20 +1504,20 @@ class te {
|
|
|
1504
1504
|
return this.safeParse(null).success;
|
|
1505
1505
|
}
|
|
1506
1506
|
}
|
|
1507
|
-
const
|
|
1507
|
+
const Ra = /^c[^\s-]{8,}$/i, Ta = /^[0-9a-z]+$/, Sa = /^[0-9A-HJKMNP-TV-Z]{26}$/i, Ia = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, xa = /^[a-z0-9_-]{21}$/i, Na = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Aa = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, Da = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Ca = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
1508
1508
|
let ds;
|
|
1509
|
-
const Fa = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, $a = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, Ma = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, Pa = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, La = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Va = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,
|
|
1510
|
-
function
|
|
1509
|
+
const Fa = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, $a = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, Ma = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, Pa = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, La = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Va = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, Ri = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", Ua = new RegExp(`^${Ri}$`);
|
|
1510
|
+
function Ti(t) {
|
|
1511
1511
|
let e = "[0-5]\\d";
|
|
1512
1512
|
t.precision ? e = `${e}\\.\\d{${t.precision}}` : t.precision == null && (e = `${e}(\\.\\d+)?`);
|
|
1513
1513
|
const n = t.precision ? "+" : "?";
|
|
1514
1514
|
return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`;
|
|
1515
1515
|
}
|
|
1516
1516
|
function Wa(t) {
|
|
1517
|
-
return new RegExp(`^${
|
|
1517
|
+
return new RegExp(`^${Ti(t)}$`);
|
|
1518
1518
|
}
|
|
1519
1519
|
function ja(t) {
|
|
1520
|
-
let e = `${
|
|
1520
|
+
let e = `${Ri}T${Ti(t)}`;
|
|
1521
1521
|
const n = [];
|
|
1522
1522
|
return n.push(t.local ? "Z?" : "Z"), t.offset && n.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${n.join("|")})`, new RegExp(`^${e}$`);
|
|
1523
1523
|
}
|
|
@@ -1540,7 +1540,7 @@ function za(t, e) {
|
|
|
1540
1540
|
function qa(t, e) {
|
|
1541
1541
|
return !!((e === "v4" || !e) && $a.test(t) || (e === "v6" || !e) && Pa.test(t));
|
|
1542
1542
|
}
|
|
1543
|
-
class
|
|
1543
|
+
class Ke extends te {
|
|
1544
1544
|
_parse(e) {
|
|
1545
1545
|
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== Z.string) {
|
|
1546
1546
|
const i = this._getOrReturnCtx(e);
|
|
@@ -1550,7 +1550,7 @@ class Qe extends te {
|
|
|
1550
1550
|
received: i.parsedType
|
|
1551
1551
|
}), Q;
|
|
1552
1552
|
}
|
|
1553
|
-
const s = new
|
|
1553
|
+
const s = new Re();
|
|
1554
1554
|
let r;
|
|
1555
1555
|
for (const i of this._def.checks)
|
|
1556
1556
|
if (i.kind === "min")
|
|
@@ -1613,19 +1613,19 @@ class Qe extends te {
|
|
|
1613
1613
|
message: i.message
|
|
1614
1614
|
}), s.dirty());
|
|
1615
1615
|
else if (i.kind === "cuid")
|
|
1616
|
-
|
|
1616
|
+
Ra.test(e.data) || (r = this._getOrReturnCtx(e, r), L(r, {
|
|
1617
1617
|
validation: "cuid",
|
|
1618
1618
|
code: A.invalid_string,
|
|
1619
1619
|
message: i.message
|
|
1620
1620
|
}), s.dirty());
|
|
1621
1621
|
else if (i.kind === "cuid2")
|
|
1622
|
-
|
|
1622
|
+
Ta.test(e.data) || (r = this._getOrReturnCtx(e, r), L(r, {
|
|
1623
1623
|
validation: "cuid2",
|
|
1624
1624
|
code: A.invalid_string,
|
|
1625
1625
|
message: i.message
|
|
1626
1626
|
}), s.dirty());
|
|
1627
1627
|
else if (i.kind === "ulid")
|
|
1628
|
-
|
|
1628
|
+
Sa.test(e.data) || (r = this._getOrReturnCtx(e, r), L(r, {
|
|
1629
1629
|
validation: "ulid",
|
|
1630
1630
|
code: A.invalid_string,
|
|
1631
1631
|
message: i.message
|
|
@@ -1703,7 +1703,7 @@ class Qe extends te {
|
|
|
1703
1703
|
});
|
|
1704
1704
|
}
|
|
1705
1705
|
_addCheck(e) {
|
|
1706
|
-
return new
|
|
1706
|
+
return new Ke({
|
|
1707
1707
|
...this._def,
|
|
1708
1708
|
checks: [...this._def.checks, e]
|
|
1709
1709
|
});
|
|
@@ -1839,19 +1839,19 @@ class Qe extends te {
|
|
|
1839
1839
|
return this.min(1, q.errToObj(e));
|
|
1840
1840
|
}
|
|
1841
1841
|
trim() {
|
|
1842
|
-
return new
|
|
1842
|
+
return new Ke({
|
|
1843
1843
|
...this._def,
|
|
1844
1844
|
checks: [...this._def.checks, { kind: "trim" }]
|
|
1845
1845
|
});
|
|
1846
1846
|
}
|
|
1847
1847
|
toLowerCase() {
|
|
1848
|
-
return new
|
|
1848
|
+
return new Ke({
|
|
1849
1849
|
...this._def,
|
|
1850
1850
|
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
1851
1851
|
});
|
|
1852
1852
|
}
|
|
1853
1853
|
toUpperCase() {
|
|
1854
|
-
return new
|
|
1854
|
+
return new Ke({
|
|
1855
1855
|
...this._def,
|
|
1856
1856
|
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
1857
1857
|
});
|
|
@@ -1917,7 +1917,7 @@ class Qe extends te {
|
|
|
1917
1917
|
return e;
|
|
1918
1918
|
}
|
|
1919
1919
|
}
|
|
1920
|
-
|
|
1920
|
+
Ke.create = (t) => new Ke({
|
|
1921
1921
|
checks: [],
|
|
1922
1922
|
typeName: Y.ZodString,
|
|
1923
1923
|
coerce: t?.coerce ?? !1,
|
|
@@ -1941,7 +1941,7 @@ class Lt extends te {
|
|
|
1941
1941
|
}), Q;
|
|
1942
1942
|
}
|
|
1943
1943
|
let s;
|
|
1944
|
-
const r = new
|
|
1944
|
+
const r = new Re();
|
|
1945
1945
|
for (const i of this._def.checks)
|
|
1946
1946
|
i.kind === "int" ? se.isInteger(e.data) || (s = this._getOrReturnCtx(e, s), L(s, {
|
|
1947
1947
|
code: A.invalid_type,
|
|
@@ -2113,7 +2113,7 @@ class cn extends te {
|
|
|
2113
2113
|
if (this._getType(e) !== Z.bigint)
|
|
2114
2114
|
return this._getInvalidInput(e);
|
|
2115
2115
|
let s;
|
|
2116
|
-
const r = new
|
|
2116
|
+
const r = new Re();
|
|
2117
2117
|
for (const i of this._def.checks)
|
|
2118
2118
|
i.kind === "min" ? (i.inclusive ? e.data < i.value : e.data <= i.value) && (s = this._getOrReturnCtx(e, s), L(s, {
|
|
2119
2119
|
code: A.too_small,
|
|
@@ -2242,7 +2242,7 @@ class Is extends te {
|
|
|
2242
2242
|
received: s.parsedType
|
|
2243
2243
|
}), Q;
|
|
2244
2244
|
}
|
|
2245
|
-
return
|
|
2245
|
+
return Pe(e.data);
|
|
2246
2246
|
}
|
|
2247
2247
|
}
|
|
2248
2248
|
Is.create = (t) => new Is({
|
|
@@ -2266,7 +2266,7 @@ class Vn extends te {
|
|
|
2266
2266
|
code: A.invalid_date
|
|
2267
2267
|
}), Q;
|
|
2268
2268
|
}
|
|
2269
|
-
const s = new
|
|
2269
|
+
const s = new Re();
|
|
2270
2270
|
let r;
|
|
2271
2271
|
for (const i of this._def.checks)
|
|
2272
2272
|
i.kind === "min" ? e.data.getTime() < i.value && (r = this._getOrReturnCtx(e, r), L(r, {
|
|
@@ -2338,7 +2338,7 @@ class vr extends te {
|
|
|
2338
2338
|
received: s.parsedType
|
|
2339
2339
|
}), Q;
|
|
2340
2340
|
}
|
|
2341
|
-
return
|
|
2341
|
+
return Pe(e.data);
|
|
2342
2342
|
}
|
|
2343
2343
|
}
|
|
2344
2344
|
vr.create = (t) => new vr({
|
|
@@ -2355,7 +2355,7 @@ class xs extends te {
|
|
|
2355
2355
|
received: s.parsedType
|
|
2356
2356
|
}), Q;
|
|
2357
2357
|
}
|
|
2358
|
-
return
|
|
2358
|
+
return Pe(e.data);
|
|
2359
2359
|
}
|
|
2360
2360
|
}
|
|
2361
2361
|
xs.create = (t) => new xs({
|
|
@@ -2372,7 +2372,7 @@ class Or extends te {
|
|
|
2372
2372
|
received: s.parsedType
|
|
2373
2373
|
}), Q;
|
|
2374
2374
|
}
|
|
2375
|
-
return
|
|
2375
|
+
return Pe(e.data);
|
|
2376
2376
|
}
|
|
2377
2377
|
}
|
|
2378
2378
|
Or.create = (t) => new Or({
|
|
@@ -2384,7 +2384,7 @@ class Ns extends te {
|
|
|
2384
2384
|
super(...arguments), this._any = !0;
|
|
2385
2385
|
}
|
|
2386
2386
|
_parse(e) {
|
|
2387
|
-
return
|
|
2387
|
+
return Pe(e.data);
|
|
2388
2388
|
}
|
|
2389
2389
|
}
|
|
2390
2390
|
Ns.create = (t) => new Ns({
|
|
@@ -2396,7 +2396,7 @@ class kr extends te {
|
|
|
2396
2396
|
super(...arguments), this._unknown = !0;
|
|
2397
2397
|
}
|
|
2398
2398
|
_parse(e) {
|
|
2399
|
-
return
|
|
2399
|
+
return Pe(e.data);
|
|
2400
2400
|
}
|
|
2401
2401
|
}
|
|
2402
2402
|
kr.create = (t) => new kr({
|
|
@@ -2427,7 +2427,7 @@ class br extends te {
|
|
|
2427
2427
|
received: s.parsedType
|
|
2428
2428
|
}), Q;
|
|
2429
2429
|
}
|
|
2430
|
-
return
|
|
2430
|
+
return Pe(e.data);
|
|
2431
2431
|
}
|
|
2432
2432
|
}
|
|
2433
2433
|
br.create = (t) => new br({
|
|
@@ -2470,9 +2470,9 @@ class ze extends te {
|
|
|
2470
2470
|
exact: !1,
|
|
2471
2471
|
message: r.maxLength.message
|
|
2472
2472
|
}), s.dirty()), n.common.async)
|
|
2473
|
-
return Promise.all([...n.data].map((o, a) => r.type._parseAsync(new He(n, o, n.path, a)))).then((o) =>
|
|
2473
|
+
return Promise.all([...n.data].map((o, a) => r.type._parseAsync(new He(n, o, n.path, a)))).then((o) => Re.mergeArray(s, o));
|
|
2474
2474
|
const i = [...n.data].map((o, a) => r.type._parseSync(new He(n, o, n.path, a)));
|
|
2475
|
-
return
|
|
2475
|
+
return Re.mergeArray(s, i);
|
|
2476
2476
|
}
|
|
2477
2477
|
get element() {
|
|
2478
2478
|
return this._def.type;
|
|
@@ -2508,13 +2508,13 @@ ze.create = (t, e) => new ze({
|
|
|
2508
2508
|
...X(e)
|
|
2509
2509
|
});
|
|
2510
2510
|
function Dt(t) {
|
|
2511
|
-
if (t instanceof
|
|
2511
|
+
if (t instanceof pe) {
|
|
2512
2512
|
const e = {};
|
|
2513
2513
|
for (const n in t.shape) {
|
|
2514
2514
|
const s = t.shape[n];
|
|
2515
2515
|
e[n] = ct.create(Dt(s));
|
|
2516
2516
|
}
|
|
2517
|
-
return new
|
|
2517
|
+
return new pe({
|
|
2518
2518
|
...t._def,
|
|
2519
2519
|
shape: () => e
|
|
2520
2520
|
});
|
|
@@ -2523,7 +2523,7 @@ function Dt(t) {
|
|
|
2523
2523
|
type: Dt(t.element)
|
|
2524
2524
|
}) : t instanceof ct ? ct.create(Dt(t.unwrap())) : t instanceof Wt ? Wt.create(Dt(t.unwrap())) : t instanceof bt ? bt.create(t.items.map((e) => Dt(e))) : t;
|
|
2525
2525
|
}
|
|
2526
|
-
class
|
|
2526
|
+
class pe extends te {
|
|
2527
2527
|
constructor() {
|
|
2528
2528
|
super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
|
|
2529
2529
|
}
|
|
@@ -2594,13 +2594,13 @@ class me extends te {
|
|
|
2594
2594
|
});
|
|
2595
2595
|
}
|
|
2596
2596
|
return c;
|
|
2597
|
-
}).then((c) =>
|
|
2597
|
+
}).then((c) => Re.mergeObjectSync(s, c)) : Re.mergeObjectSync(s, l);
|
|
2598
2598
|
}
|
|
2599
2599
|
get shape() {
|
|
2600
2600
|
return this._def.shape();
|
|
2601
2601
|
}
|
|
2602
2602
|
strict(e) {
|
|
2603
|
-
return q.errToObj, new
|
|
2603
|
+
return q.errToObj, new pe({
|
|
2604
2604
|
...this._def,
|
|
2605
2605
|
unknownKeys: "strict",
|
|
2606
2606
|
...e !== void 0 ? {
|
|
@@ -2616,13 +2616,13 @@ class me extends te {
|
|
|
2616
2616
|
});
|
|
2617
2617
|
}
|
|
2618
2618
|
strip() {
|
|
2619
|
-
return new
|
|
2619
|
+
return new pe({
|
|
2620
2620
|
...this._def,
|
|
2621
2621
|
unknownKeys: "strip"
|
|
2622
2622
|
});
|
|
2623
2623
|
}
|
|
2624
2624
|
passthrough() {
|
|
2625
|
-
return new
|
|
2625
|
+
return new pe({
|
|
2626
2626
|
...this._def,
|
|
2627
2627
|
unknownKeys: "passthrough"
|
|
2628
2628
|
});
|
|
@@ -2645,7 +2645,7 @@ class me extends te {
|
|
|
2645
2645
|
// }) as any;
|
|
2646
2646
|
// };
|
|
2647
2647
|
extend(e) {
|
|
2648
|
-
return new
|
|
2648
|
+
return new pe({
|
|
2649
2649
|
...this._def,
|
|
2650
2650
|
shape: () => ({
|
|
2651
2651
|
...this._def.shape(),
|
|
@@ -2659,7 +2659,7 @@ class me extends te {
|
|
|
2659
2659
|
* upgrade if you are experiencing issues.
|
|
2660
2660
|
*/
|
|
2661
2661
|
merge(e) {
|
|
2662
|
-
return new
|
|
2662
|
+
return new pe({
|
|
2663
2663
|
unknownKeys: e._def.unknownKeys,
|
|
2664
2664
|
catchall: e._def.catchall,
|
|
2665
2665
|
shape: () => ({
|
|
@@ -2729,7 +2729,7 @@ class me extends te {
|
|
|
2729
2729
|
// return merged;
|
|
2730
2730
|
// }
|
|
2731
2731
|
catchall(e) {
|
|
2732
|
-
return new
|
|
2732
|
+
return new pe({
|
|
2733
2733
|
...this._def,
|
|
2734
2734
|
catchall: e
|
|
2735
2735
|
});
|
|
@@ -2738,7 +2738,7 @@ class me extends te {
|
|
|
2738
2738
|
const n = {};
|
|
2739
2739
|
for (const s of se.objectKeys(e))
|
|
2740
2740
|
e[s] && this.shape[s] && (n[s] = this.shape[s]);
|
|
2741
|
-
return new
|
|
2741
|
+
return new pe({
|
|
2742
2742
|
...this._def,
|
|
2743
2743
|
shape: () => n
|
|
2744
2744
|
});
|
|
@@ -2747,7 +2747,7 @@ class me extends te {
|
|
|
2747
2747
|
const n = {};
|
|
2748
2748
|
for (const s of se.objectKeys(this.shape))
|
|
2749
2749
|
e[s] || (n[s] = this.shape[s]);
|
|
2750
|
-
return new
|
|
2750
|
+
return new pe({
|
|
2751
2751
|
...this._def,
|
|
2752
2752
|
shape: () => n
|
|
2753
2753
|
});
|
|
@@ -2764,7 +2764,7 @@ class me extends te {
|
|
|
2764
2764
|
const r = this.shape[s];
|
|
2765
2765
|
e && !e[s] ? n[s] = r : n[s] = r.optional();
|
|
2766
2766
|
}
|
|
2767
|
-
return new
|
|
2767
|
+
return new pe({
|
|
2768
2768
|
...this._def,
|
|
2769
2769
|
shape: () => n
|
|
2770
2770
|
});
|
|
@@ -2780,30 +2780,30 @@ class me extends te {
|
|
|
2780
2780
|
i = i._def.innerType;
|
|
2781
2781
|
n[s] = i;
|
|
2782
2782
|
}
|
|
2783
|
-
return new
|
|
2783
|
+
return new pe({
|
|
2784
2784
|
...this._def,
|
|
2785
2785
|
shape: () => n
|
|
2786
2786
|
});
|
|
2787
2787
|
}
|
|
2788
2788
|
keyof() {
|
|
2789
|
-
return
|
|
2789
|
+
return Si(se.objectKeys(this.shape));
|
|
2790
2790
|
}
|
|
2791
2791
|
}
|
|
2792
|
-
|
|
2792
|
+
pe.create = (t, e) => new pe({
|
|
2793
2793
|
shape: () => t,
|
|
2794
2794
|
unknownKeys: "strip",
|
|
2795
2795
|
catchall: ft.create(),
|
|
2796
2796
|
typeName: Y.ZodObject,
|
|
2797
2797
|
...X(e)
|
|
2798
2798
|
});
|
|
2799
|
-
|
|
2799
|
+
pe.strictCreate = (t, e) => new pe({
|
|
2800
2800
|
shape: () => t,
|
|
2801
2801
|
unknownKeys: "strict",
|
|
2802
2802
|
catchall: ft.create(),
|
|
2803
2803
|
typeName: Y.ZodObject,
|
|
2804
2804
|
...X(e)
|
|
2805
2805
|
});
|
|
2806
|
-
|
|
2806
|
+
pe.lazycreate = (t, e) => new pe({
|
|
2807
2807
|
shape: t,
|
|
2808
2808
|
unknownKeys: "strip",
|
|
2809
2809
|
catchall: ft.create(),
|
|
@@ -2820,7 +2820,7 @@ class Un extends te {
|
|
|
2820
2820
|
for (const a of i)
|
|
2821
2821
|
if (a.result.status === "dirty")
|
|
2822
2822
|
return n.common.issues.push(...a.ctx.common.issues), a.result;
|
|
2823
|
-
const o = i.map((a) => new
|
|
2823
|
+
const o = i.map((a) => new et(a.ctx.common.issues));
|
|
2824
2824
|
return L(n, {
|
|
2825
2825
|
code: A.invalid_union,
|
|
2826
2826
|
unionErrors: o
|
|
@@ -2867,7 +2867,7 @@ class Un extends te {
|
|
|
2867
2867
|
}
|
|
2868
2868
|
if (i)
|
|
2869
2869
|
return n.common.issues.push(...i.ctx.common.issues), i.result;
|
|
2870
|
-
const a = o.map((l) => new
|
|
2870
|
+
const a = o.map((l) => new et(l));
|
|
2871
2871
|
return L(n, {
|
|
2872
2872
|
code: A.invalid_union,
|
|
2873
2873
|
unionErrors: a
|
|
@@ -2884,7 +2884,7 @@ Un.create = (t, e) => new Un({
|
|
|
2884
2884
|
...X(e)
|
|
2885
2885
|
});
|
|
2886
2886
|
function As(t, e) {
|
|
2887
|
-
const n =
|
|
2887
|
+
const n = it(t), s = it(e);
|
|
2888
2888
|
if (t === e)
|
|
2889
2889
|
return { valid: !0, data: t };
|
|
2890
2890
|
if (n === Z.object && s === Z.object) {
|
|
@@ -2975,7 +2975,7 @@ class bt extends te {
|
|
|
2975
2975
|
const l = this._def.items[a] || this._def.rest;
|
|
2976
2976
|
return l ? l._parse(new He(s, o, s.path, a)) : null;
|
|
2977
2977
|
}).filter((o) => !!o);
|
|
2978
|
-
return s.common.async ? Promise.all(i).then((o) =>
|
|
2978
|
+
return s.common.async ? Promise.all(i).then((o) => Re.mergeArray(n, o)) : Re.mergeArray(n, i);
|
|
2979
2979
|
}
|
|
2980
2980
|
get items() {
|
|
2981
2981
|
return this._def.items;
|
|
@@ -3019,7 +3019,7 @@ class jn extends te {
|
|
|
3019
3019
|
value: o._parse(new He(s, s.data[a], s.path, a)),
|
|
3020
3020
|
alwaysSet: a in s.data
|
|
3021
3021
|
});
|
|
3022
|
-
return s.common.async ?
|
|
3022
|
+
return s.common.async ? Re.mergeObjectAsync(n, r) : Re.mergeObjectSync(n, r);
|
|
3023
3023
|
}
|
|
3024
3024
|
get element() {
|
|
3025
3025
|
return this._def.valueType;
|
|
@@ -3031,14 +3031,14 @@ class jn extends te {
|
|
|
3031
3031
|
typeName: Y.ZodRecord,
|
|
3032
3032
|
...X(s)
|
|
3033
3033
|
}) : new jn({
|
|
3034
|
-
keyType:
|
|
3034
|
+
keyType: Ke.create(),
|
|
3035
3035
|
valueType: e,
|
|
3036
3036
|
typeName: Y.ZodRecord,
|
|
3037
3037
|
...X(n)
|
|
3038
3038
|
});
|
|
3039
3039
|
}
|
|
3040
3040
|
}
|
|
3041
|
-
class
|
|
3041
|
+
class Rr extends te {
|
|
3042
3042
|
get keySchema() {
|
|
3043
3043
|
return this._def.keyType;
|
|
3044
3044
|
}
|
|
@@ -3080,7 +3080,7 @@ class Tr extends te {
|
|
|
3080
3080
|
}
|
|
3081
3081
|
}
|
|
3082
3082
|
}
|
|
3083
|
-
|
|
3083
|
+
Rr.create = (t, e, n) => new Rr({
|
|
3084
3084
|
valueType: e,
|
|
3085
3085
|
keyType: t,
|
|
3086
3086
|
typeName: Y.ZodMap,
|
|
@@ -3150,7 +3150,7 @@ un.create = (t, e) => new un({
|
|
|
3150
3150
|
typeName: Y.ZodSet,
|
|
3151
3151
|
...X(e)
|
|
3152
3152
|
});
|
|
3153
|
-
class
|
|
3153
|
+
class Tr extends te {
|
|
3154
3154
|
get schema() {
|
|
3155
3155
|
return this._def.getter();
|
|
3156
3156
|
}
|
|
@@ -3159,7 +3159,7 @@ class Sr extends te {
|
|
|
3159
3159
|
return this._def.getter()._parse({ data: n.data, path: n.path, parent: n });
|
|
3160
3160
|
}
|
|
3161
3161
|
}
|
|
3162
|
-
|
|
3162
|
+
Tr.create = (t, e) => new Tr({
|
|
3163
3163
|
getter: t,
|
|
3164
3164
|
typeName: Y.ZodLazy,
|
|
3165
3165
|
...X(e)
|
|
@@ -3185,7 +3185,7 @@ Ds.create = (t, e) => new Ds({
|
|
|
3185
3185
|
typeName: Y.ZodLiteral,
|
|
3186
3186
|
...X(e)
|
|
3187
3187
|
});
|
|
3188
|
-
function
|
|
3188
|
+
function Si(t, e) {
|
|
3189
3189
|
return new Vt({
|
|
3190
3190
|
values: t,
|
|
3191
3191
|
typeName: Y.ZodEnum,
|
|
@@ -3210,7 +3210,7 @@ class Vt extends te {
|
|
|
3210
3210
|
options: s
|
|
3211
3211
|
}), Q;
|
|
3212
3212
|
}
|
|
3213
|
-
return
|
|
3213
|
+
return Pe(e.data);
|
|
3214
3214
|
}
|
|
3215
3215
|
get options() {
|
|
3216
3216
|
return this._def.values;
|
|
@@ -3246,8 +3246,8 @@ class Vt extends te {
|
|
|
3246
3246
|
});
|
|
3247
3247
|
}
|
|
3248
3248
|
}
|
|
3249
|
-
Vt.create =
|
|
3250
|
-
class
|
|
3249
|
+
Vt.create = Si;
|
|
3250
|
+
class Sr extends te {
|
|
3251
3251
|
_parse(e) {
|
|
3252
3252
|
const n = se.getValidEnumValues(this._def.values), s = this._getOrReturnCtx(e);
|
|
3253
3253
|
if (s.parsedType !== Z.string && s.parsedType !== Z.number) {
|
|
@@ -3266,13 +3266,13 @@ class Rr extends te {
|
|
|
3266
3266
|
options: r
|
|
3267
3267
|
}), Q;
|
|
3268
3268
|
}
|
|
3269
|
-
return
|
|
3269
|
+
return Pe(e.data);
|
|
3270
3270
|
}
|
|
3271
3271
|
get enum() {
|
|
3272
3272
|
return this._def.values;
|
|
3273
3273
|
}
|
|
3274
3274
|
}
|
|
3275
|
-
|
|
3275
|
+
Sr.create = (t, e) => new Sr({
|
|
3276
3276
|
values: t,
|
|
3277
3277
|
typeName: Y.ZodNativeEnum,
|
|
3278
3278
|
...X(e)
|
|
@@ -3290,7 +3290,7 @@ class Zn extends te {
|
|
|
3290
3290
|
received: n.parsedType
|
|
3291
3291
|
}), Q;
|
|
3292
3292
|
const s = n.parsedType === Z.promise ? n.data : Promise.resolve(n.data);
|
|
3293
|
-
return
|
|
3293
|
+
return Pe(s.then((r) => this._def.type.parseAsync(r, {
|
|
3294
3294
|
path: n.path,
|
|
3295
3295
|
errorMap: n.common.contextualErrorMap
|
|
3296
3296
|
})));
|
|
@@ -3395,7 +3395,7 @@ Ut.createWithPreprocess = (t, e, n) => new Ut({
|
|
|
3395
3395
|
});
|
|
3396
3396
|
class ct extends te {
|
|
3397
3397
|
_parse(e) {
|
|
3398
|
-
return this._getType(e) === Z.undefined ?
|
|
3398
|
+
return this._getType(e) === Z.undefined ? Pe(void 0) : this._def.innerType._parse(e);
|
|
3399
3399
|
}
|
|
3400
3400
|
unwrap() {
|
|
3401
3401
|
return this._def.innerType;
|
|
@@ -3408,7 +3408,7 @@ ct.create = (t, e) => new ct({
|
|
|
3408
3408
|
});
|
|
3409
3409
|
class Wt extends te {
|
|
3410
3410
|
_parse(e) {
|
|
3411
|
-
return this._getType(e) === Z.null ?
|
|
3411
|
+
return this._getType(e) === Z.null ? Pe(null) : this._def.innerType._parse(e);
|
|
3412
3412
|
}
|
|
3413
3413
|
unwrap() {
|
|
3414
3414
|
return this._def.innerType;
|
|
@@ -3458,7 +3458,7 @@ class Fs extends te {
|
|
|
3458
3458
|
status: "valid",
|
|
3459
3459
|
value: i.status === "valid" ? i.value : this._def.catchValue({
|
|
3460
3460
|
get error() {
|
|
3461
|
-
return new
|
|
3461
|
+
return new et(s.common.issues);
|
|
3462
3462
|
},
|
|
3463
3463
|
input: s.data
|
|
3464
3464
|
})
|
|
@@ -3466,7 +3466,7 @@ class Fs extends te {
|
|
|
3466
3466
|
status: "valid",
|
|
3467
3467
|
value: r.status === "valid" ? r.value : this._def.catchValue({
|
|
3468
3468
|
get error() {
|
|
3469
|
-
return new
|
|
3469
|
+
return new et(s.common.issues);
|
|
3470
3470
|
},
|
|
3471
3471
|
input: s.data
|
|
3472
3472
|
})
|
|
@@ -3570,49 +3570,49 @@ var Y;
|
|
|
3570
3570
|
(function(t) {
|
|
3571
3571
|
t.ZodString = "ZodString", t.ZodNumber = "ZodNumber", t.ZodNaN = "ZodNaN", t.ZodBigInt = "ZodBigInt", t.ZodBoolean = "ZodBoolean", t.ZodDate = "ZodDate", t.ZodSymbol = "ZodSymbol", t.ZodUndefined = "ZodUndefined", t.ZodNull = "ZodNull", t.ZodAny = "ZodAny", t.ZodUnknown = "ZodUnknown", t.ZodNever = "ZodNever", t.ZodVoid = "ZodVoid", t.ZodArray = "ZodArray", t.ZodObject = "ZodObject", t.ZodUnion = "ZodUnion", t.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", t.ZodIntersection = "ZodIntersection", t.ZodTuple = "ZodTuple", t.ZodRecord = "ZodRecord", t.ZodMap = "ZodMap", t.ZodSet = "ZodSet", t.ZodFunction = "ZodFunction", t.ZodLazy = "ZodLazy", t.ZodLiteral = "ZodLiteral", t.ZodEnum = "ZodEnum", t.ZodEffects = "ZodEffects", t.ZodNativeEnum = "ZodNativeEnum", t.ZodOptional = "ZodOptional", t.ZodNullable = "ZodNullable", t.ZodDefault = "ZodDefault", t.ZodCatch = "ZodCatch", t.ZodPromise = "ZodPromise", t.ZodBranded = "ZodBranded", t.ZodPipeline = "ZodPipeline", t.ZodReadonly = "ZodReadonly";
|
|
3572
3572
|
})(Y || (Y = {}));
|
|
3573
|
-
const
|
|
3573
|
+
const xe = Ke.create, Ot = Lt.create, on = Is.create, fs = xs.create, _e = Ns.create;
|
|
3574
3574
|
ft.create;
|
|
3575
|
-
const
|
|
3575
|
+
const St = ze.create, qe = pe.create, Se = Un.create;
|
|
3576
3576
|
Wn.create;
|
|
3577
3577
|
bt.create;
|
|
3578
|
-
const mn = jn.create,
|
|
3578
|
+
const mn = jn.create, Ie = Ds.create, zn = Vt.create;
|
|
3579
3579
|
Zn.create;
|
|
3580
3580
|
ct.create;
|
|
3581
3581
|
Wt.create;
|
|
3582
|
-
const xn = () =>
|
|
3582
|
+
const xn = () => _e().refine((t) => t && (t.seconds !== void 0 && t.nanoseconds !== void 0 || t._seconds !== void 0 && t._nanoseconds !== void 0), {
|
|
3583
3583
|
message: "Value is not a valid timestamp"
|
|
3584
|
-
}), xr = () =>
|
|
3584
|
+
}), xr = () => _e().refine((t) => t && (t._methodName === "serverTimestamp" || t.constructor.name === "ServerTimestampTransform"), {
|
|
3585
3585
|
message: "Value is not a valid server timestamp"
|
|
3586
3586
|
}), Ii = (t, e, n) => {
|
|
3587
3587
|
const s = {};
|
|
3588
3588
|
if (t.includeFields) {
|
|
3589
3589
|
const i = e.collections[t.collection];
|
|
3590
3590
|
if (!i)
|
|
3591
|
-
return mn(
|
|
3591
|
+
return mn(_e());
|
|
3592
3592
|
t.includeFields.forEach((o) => {
|
|
3593
3593
|
const a = i.fields.find((c) => c.name === o);
|
|
3594
3594
|
if (!a)
|
|
3595
3595
|
throw new Error(`Field ${o} not found in collection ${t.collection}`);
|
|
3596
|
-
s[o] = qn(i, a),
|
|
3596
|
+
s[o] = qn(i, a), Tt(i, [a]).size === 1 && (s[`${o}_Lowercase`] = qn(i, a, !0));
|
|
3597
3597
|
});
|
|
3598
3598
|
}
|
|
3599
3599
|
const r = {
|
|
3600
|
-
Collection_Path:
|
|
3600
|
+
Collection_Path: St(xe()),
|
|
3601
3601
|
...s
|
|
3602
3602
|
};
|
|
3603
|
-
return n && (r.id =
|
|
3603
|
+
return n && (r.id = xe().length(20)), qe(r);
|
|
3604
3604
|
}, Ga = (t, e) => {
|
|
3605
3605
|
let n = mn(Ii(t, e));
|
|
3606
3606
|
return t.required || (n = n.optional()), n;
|
|
3607
3607
|
}, Ya = (t) => {
|
|
3608
|
-
let e =
|
|
3608
|
+
let e = St(Se([xe().length(20), xe().length(28)]));
|
|
3609
3609
|
return ["OneToOne", "OneToMany"].includes(t.type) ? e = e.max(1) : (t.min && (e = e.min(t.min)), t.max && (e = e.max(t.max)), t.length && (e = e.length(t.length))), t.required ? e = e.nonempty() : e = e.optional(), e;
|
|
3610
3610
|
}, qn = (t, e, n) => {
|
|
3611
3611
|
const { softDelete: s } = t, r = s?.timestampField;
|
|
3612
3612
|
let i;
|
|
3613
3613
|
switch (e.type) {
|
|
3614
3614
|
case "String":
|
|
3615
|
-
if (i =
|
|
3615
|
+
if (i = xe(), e.length && (i = i.length(e.length)), e.minlength && (i = i.min(e.minlength)), e.maxlength && (i = i.max(e.maxlength)), e.email && (i = i.email()), e.uuid && (i = i.uuid()), e.url && (i = i.url()), e.emoji && (i = i.emoji()), e.ip && (i = i.ip()), e.pattern && (i = i.regex(new RegExp(e.pattern))), n && (i = i.toLowerCase()), e.values)
|
|
3616
3616
|
if (n) {
|
|
3617
3617
|
const o = e.values.map((a) => a.toLowerCase());
|
|
3618
3618
|
i = zn(o);
|
|
@@ -3623,14 +3623,14 @@ const xn = () => we().refine((t) => t && (t.seconds !== void 0 && t.nanoseconds
|
|
|
3623
3623
|
i = on();
|
|
3624
3624
|
break;
|
|
3625
3625
|
case "Number":
|
|
3626
|
-
e.autoIncrement ? i =
|
|
3626
|
+
e.autoIncrement ? i = Se([Ie("Pending"), Ot().int()]) : (i = Ot(), e.min && (i = i.min(e.min)), e.max && (i = i.max(e.max)), e.decimal ? i = i.refine((o) => e.decimal ? (o.toString().split(".")[1]?.length || 0) <= e.decimal : !1, {
|
|
3627
3627
|
message: `Value must have ${e.decimal} or fewer decimal places`
|
|
3628
3628
|
}) : i = i.int(), e.values && (i = i.refine((o) => e.values?.includes(o), {
|
|
3629
3629
|
message: "Value is not an allowed value"
|
|
3630
3630
|
})));
|
|
3631
3631
|
break;
|
|
3632
3632
|
case "Timestamp":
|
|
3633
|
-
e.name === r ? i =
|
|
3633
|
+
e.name === r ? i = _e().refine((o) => o && (o._methodName === "serverTimestamp" || o.constructor.name === "ServerTimestampTransform" || o.seconds !== void 0 && o.nanoseconds !== void 0 || o._seconds !== void 0 && o._nanoseconds !== void 0), {
|
|
3634
3634
|
message: "Value is not a valid timestamp"
|
|
3635
3635
|
}) : (i = xn(), e.min && (i = i.refine((o) => o.toMillis() >= e.min, {
|
|
3636
3636
|
message: `Value is less than the minimum allowed value of ${e.min}`
|
|
@@ -3639,7 +3639,7 @@ const xn = () => we().refine((t) => t && (t.seconds !== void 0 && t.nanoseconds
|
|
|
3639
3639
|
})));
|
|
3640
3640
|
break;
|
|
3641
3641
|
case "Array":
|
|
3642
|
-
i =
|
|
3642
|
+
i = St(_e()), e.length && (i = i.length(e.length)), e.minlength ? i = i.min(e.minlength) : e.required && (i = i.nonempty()), e.maxlength && (i = i.max(e.maxlength)), e.values && (i = i.refine((o) => {
|
|
3643
3643
|
let a = !0;
|
|
3644
3644
|
return o.forEach((l) => {
|
|
3645
3645
|
e.values && !e.values.includes(l) && (a = !1);
|
|
@@ -3647,27 +3647,27 @@ const xn = () => we().refine((t) => t && (t.seconds !== void 0 && t.nanoseconds
|
|
|
3647
3647
|
}, { message: "Value is not an allowed value" }));
|
|
3648
3648
|
break;
|
|
3649
3649
|
case "Map":
|
|
3650
|
-
i = mn(
|
|
3650
|
+
i = mn(_e()), e.required && (i = i.refine((o) => o && typeof o == "object" && Object.keys(o).length > 0, {
|
|
3651
3651
|
message: "Value must have at least one object property"
|
|
3652
3652
|
}));
|
|
3653
3653
|
break;
|
|
3654
3654
|
case "Embedding":
|
|
3655
|
-
i =
|
|
3655
|
+
i = _e();
|
|
3656
3656
|
break;
|
|
3657
3657
|
}
|
|
3658
3658
|
return !ee(e) && e.nullable && (i = i.nullable()), e.required || (i = i.optional()), i;
|
|
3659
3659
|
}, Ja = (t, e, n) => {
|
|
3660
3660
|
const s = {
|
|
3661
|
-
Collection_Path:
|
|
3662
|
-
Last_Write_App:
|
|
3661
|
+
Collection_Path: St(xe()),
|
|
3662
|
+
Last_Write_App: xe(),
|
|
3663
3663
|
Last_Write_At: xn(),
|
|
3664
3664
|
Last_Save_At: xr(),
|
|
3665
|
-
Last_Write_By:
|
|
3665
|
+
Last_Write_By: Se([xe().length(28), Ie("System")]),
|
|
3666
3666
|
Last_Write_Connection_Status: zn(["Online", "Offline"]),
|
|
3667
3667
|
Last_Write_Version: Ot().int(),
|
|
3668
|
-
id:
|
|
3668
|
+
id: xe().regex(new RegExp("^[a-zA-Z0-9]+$")).length(20),
|
|
3669
3669
|
Created_At: xn(),
|
|
3670
|
-
Created_By:
|
|
3670
|
+
Created_By: Se([xe().length(28), Ie("System")])
|
|
3671
3671
|
};
|
|
3672
3672
|
t === "create" && (s.Saved_At = xr()), t === "update" && (s.Saved_At = xn(), 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());
|
|
3673
3673
|
const r = Et(e, e.fields), i = Array.from(r).map((l) => l.name);
|
|
@@ -3679,7 +3679,7 @@ const xn = () => we().refine((t) => t && (t.seconds !== void 0 && t.nanoseconds
|
|
|
3679
3679
|
})), l.max && (s[l.name] = s[l.name].refine((c) => l.max && (!c || Object.keys(c).length <= l.max), {
|
|
3680
3680
|
message: `Value must contain at most ${l.max} item(s)`
|
|
3681
3681
|
}))) : l.type !== "Computed" && (s[l.name] = qn(e, l));
|
|
3682
|
-
}),
|
|
3682
|
+
}), Tt(e, e.fields).forEach((l) => {
|
|
3683
3683
|
s[l.name] && (s[`${l.name}_Lowercase`] = qn(e, l, !0));
|
|
3684
3684
|
});
|
|
3685
3685
|
const a = qe(s);
|
|
@@ -3709,35 +3709,35 @@ class xi extends It {
|
|
|
3709
3709
|
super(`Invalid unit ${e}`);
|
|
3710
3710
|
}
|
|
3711
3711
|
}
|
|
3712
|
-
class
|
|
3712
|
+
class Ee extends It {
|
|
3713
3713
|
}
|
|
3714
|
-
class
|
|
3714
|
+
class rt extends It {
|
|
3715
3715
|
constructor() {
|
|
3716
3716
|
super("Zone is an abstract class");
|
|
3717
3717
|
}
|
|
3718
3718
|
}
|
|
3719
|
-
const $ = "numeric",
|
|
3719
|
+
const $ = "numeric", je = "short", Ae = "long", Bn = {
|
|
3720
3720
|
year: $,
|
|
3721
3721
|
month: $,
|
|
3722
3722
|
day: $
|
|
3723
3723
|
}, Ni = {
|
|
3724
3724
|
year: $,
|
|
3725
|
-
month:
|
|
3725
|
+
month: je,
|
|
3726
3726
|
day: $
|
|
3727
3727
|
}, el = {
|
|
3728
3728
|
year: $,
|
|
3729
|
-
month:
|
|
3729
|
+
month: je,
|
|
3730
3730
|
day: $,
|
|
3731
|
-
weekday:
|
|
3731
|
+
weekday: je
|
|
3732
3732
|
}, Ai = {
|
|
3733
3733
|
year: $,
|
|
3734
|
-
month:
|
|
3734
|
+
month: Ae,
|
|
3735
3735
|
day: $
|
|
3736
3736
|
}, Di = {
|
|
3737
3737
|
year: $,
|
|
3738
|
-
month:
|
|
3738
|
+
month: Ae,
|
|
3739
3739
|
day: $,
|
|
3740
|
-
weekday:
|
|
3740
|
+
weekday: Ae
|
|
3741
3741
|
}, Ci = {
|
|
3742
3742
|
hour: $,
|
|
3743
3743
|
minute: $
|
|
@@ -3749,12 +3749,12 @@ const $ = "numeric", We = "short", xe = "long", Bn = {
|
|
|
3749
3749
|
hour: $,
|
|
3750
3750
|
minute: $,
|
|
3751
3751
|
second: $,
|
|
3752
|
-
timeZoneName:
|
|
3752
|
+
timeZoneName: je
|
|
3753
3753
|
}, Mi = {
|
|
3754
3754
|
hour: $,
|
|
3755
3755
|
minute: $,
|
|
3756
3756
|
second: $,
|
|
3757
|
-
timeZoneName:
|
|
3757
|
+
timeZoneName: Ae
|
|
3758
3758
|
}, Pi = {
|
|
3759
3759
|
hour: $,
|
|
3760
3760
|
minute: $,
|
|
@@ -3769,13 +3769,13 @@ const $ = "numeric", We = "short", xe = "long", Bn = {
|
|
|
3769
3769
|
minute: $,
|
|
3770
3770
|
second: $,
|
|
3771
3771
|
hourCycle: "h23",
|
|
3772
|
-
timeZoneName:
|
|
3772
|
+
timeZoneName: je
|
|
3773
3773
|
}, Ui = {
|
|
3774
3774
|
hour: $,
|
|
3775
3775
|
minute: $,
|
|
3776
3776
|
second: $,
|
|
3777
3777
|
hourCycle: "h23",
|
|
3778
|
-
timeZoneName:
|
|
3778
|
+
timeZoneName: Ae
|
|
3779
3779
|
}, Wi = {
|
|
3780
3780
|
year: $,
|
|
3781
3781
|
month: $,
|
|
@@ -3791,56 +3791,56 @@ const $ = "numeric", We = "short", xe = "long", Bn = {
|
|
|
3791
3791
|
second: $
|
|
3792
3792
|
}, Zi = {
|
|
3793
3793
|
year: $,
|
|
3794
|
-
month:
|
|
3794
|
+
month: je,
|
|
3795
3795
|
day: $,
|
|
3796
3796
|
hour: $,
|
|
3797
3797
|
minute: $
|
|
3798
3798
|
}, zi = {
|
|
3799
3799
|
year: $,
|
|
3800
|
-
month:
|
|
3800
|
+
month: je,
|
|
3801
3801
|
day: $,
|
|
3802
3802
|
hour: $,
|
|
3803
3803
|
minute: $,
|
|
3804
3804
|
second: $
|
|
3805
3805
|
}, tl = {
|
|
3806
3806
|
year: $,
|
|
3807
|
-
month:
|
|
3807
|
+
month: je,
|
|
3808
3808
|
day: $,
|
|
3809
|
-
weekday:
|
|
3809
|
+
weekday: je,
|
|
3810
3810
|
hour: $,
|
|
3811
3811
|
minute: $
|
|
3812
3812
|
}, qi = {
|
|
3813
3813
|
year: $,
|
|
3814
|
-
month:
|
|
3814
|
+
month: Ae,
|
|
3815
3815
|
day: $,
|
|
3816
3816
|
hour: $,
|
|
3817
3817
|
minute: $,
|
|
3818
|
-
timeZoneName:
|
|
3818
|
+
timeZoneName: je
|
|
3819
3819
|
}, Bi = {
|
|
3820
3820
|
year: $,
|
|
3821
|
-
month:
|
|
3821
|
+
month: Ae,
|
|
3822
3822
|
day: $,
|
|
3823
3823
|
hour: $,
|
|
3824
3824
|
minute: $,
|
|
3825
3825
|
second: $,
|
|
3826
|
-
timeZoneName:
|
|
3826
|
+
timeZoneName: je
|
|
3827
3827
|
}, Hi = {
|
|
3828
3828
|
year: $,
|
|
3829
|
-
month:
|
|
3829
|
+
month: Ae,
|
|
3830
3830
|
day: $,
|
|
3831
|
-
weekday:
|
|
3831
|
+
weekday: Ae,
|
|
3832
3832
|
hour: $,
|
|
3833
3833
|
minute: $,
|
|
3834
|
-
timeZoneName:
|
|
3834
|
+
timeZoneName: Ae
|
|
3835
3835
|
}, Gi = {
|
|
3836
3836
|
year: $,
|
|
3837
|
-
month:
|
|
3837
|
+
month: Ae,
|
|
3838
3838
|
day: $,
|
|
3839
|
-
weekday:
|
|
3839
|
+
weekday: Ae,
|
|
3840
3840
|
hour: $,
|
|
3841
3841
|
minute: $,
|
|
3842
3842
|
second: $,
|
|
3843
|
-
timeZoneName:
|
|
3843
|
+
timeZoneName: Ae
|
|
3844
3844
|
};
|
|
3845
3845
|
class pn {
|
|
3846
3846
|
/**
|
|
@@ -3849,7 +3849,7 @@ class pn {
|
|
|
3849
3849
|
* @type {string}
|
|
3850
3850
|
*/
|
|
3851
3851
|
get type() {
|
|
3852
|
-
throw new
|
|
3852
|
+
throw new rt();
|
|
3853
3853
|
}
|
|
3854
3854
|
/**
|
|
3855
3855
|
* The name of this zone.
|
|
@@ -3857,7 +3857,7 @@ class pn {
|
|
|
3857
3857
|
* @type {string}
|
|
3858
3858
|
*/
|
|
3859
3859
|
get name() {
|
|
3860
|
-
throw new
|
|
3860
|
+
throw new rt();
|
|
3861
3861
|
}
|
|
3862
3862
|
/**
|
|
3863
3863
|
* The IANA name of this zone.
|
|
@@ -3874,7 +3874,7 @@ class pn {
|
|
|
3874
3874
|
* @type {boolean}
|
|
3875
3875
|
*/
|
|
3876
3876
|
get isUniversal() {
|
|
3877
|
-
throw new
|
|
3877
|
+
throw new rt();
|
|
3878
3878
|
}
|
|
3879
3879
|
/**
|
|
3880
3880
|
* Returns the offset's common name (such as EST) at the specified timestamp
|
|
@@ -3886,7 +3886,7 @@ class pn {
|
|
|
3886
3886
|
* @return {string}
|
|
3887
3887
|
*/
|
|
3888
3888
|
offsetName(e, n) {
|
|
3889
|
-
throw new
|
|
3889
|
+
throw new rt();
|
|
3890
3890
|
}
|
|
3891
3891
|
/**
|
|
3892
3892
|
* Returns the offset's value as a string
|
|
@@ -3897,7 +3897,7 @@ class pn {
|
|
|
3897
3897
|
* @return {string}
|
|
3898
3898
|
*/
|
|
3899
3899
|
formatOffset(e, n) {
|
|
3900
|
-
throw new
|
|
3900
|
+
throw new rt();
|
|
3901
3901
|
}
|
|
3902
3902
|
/**
|
|
3903
3903
|
* Return the offset in minutes for this zone at the specified timestamp.
|
|
@@ -3906,7 +3906,7 @@ class pn {
|
|
|
3906
3906
|
* @return {number}
|
|
3907
3907
|
*/
|
|
3908
3908
|
offset(e) {
|
|
3909
|
-
throw new
|
|
3909
|
+
throw new rt();
|
|
3910
3910
|
}
|
|
3911
3911
|
/**
|
|
3912
3912
|
* Return whether this Zone is equal to another zone
|
|
@@ -3915,7 +3915,7 @@ class pn {
|
|
|
3915
3915
|
* @return {boolean}
|
|
3916
3916
|
*/
|
|
3917
3917
|
equals(e) {
|
|
3918
|
-
throw new
|
|
3918
|
+
throw new rt();
|
|
3919
3919
|
}
|
|
3920
3920
|
/**
|
|
3921
3921
|
* Return whether this Zone is valid.
|
|
@@ -3923,7 +3923,7 @@ class pn {
|
|
|
3923
3923
|
* @type {boolean}
|
|
3924
3924
|
*/
|
|
3925
3925
|
get isValid() {
|
|
3926
|
-
throw new
|
|
3926
|
+
throw new rt();
|
|
3927
3927
|
}
|
|
3928
3928
|
}
|
|
3929
3929
|
let hs = null;
|
|
@@ -4005,14 +4005,14 @@ function il(t, e) {
|
|
|
4005
4005
|
return s;
|
|
4006
4006
|
}
|
|
4007
4007
|
const ms = /* @__PURE__ */ new Map();
|
|
4008
|
-
class
|
|
4008
|
+
class tt extends pn {
|
|
4009
4009
|
/**
|
|
4010
4010
|
* @param {string} name - Zone name
|
|
4011
4011
|
* @return {IANAZone}
|
|
4012
4012
|
*/
|
|
4013
4013
|
static create(e) {
|
|
4014
4014
|
let n = ms.get(e);
|
|
4015
|
-
return n === void 0 && ms.set(e, n = new
|
|
4015
|
+
return n === void 0 && ms.set(e, n = new tt(e)), n;
|
|
4016
4016
|
}
|
|
4017
4017
|
/**
|
|
4018
4018
|
* Reset local caches. Should only be necessary in testing scenarios.
|
|
@@ -4050,7 +4050,7 @@ class et extends pn {
|
|
|
4050
4050
|
}
|
|
4051
4051
|
}
|
|
4052
4052
|
constructor(e) {
|
|
4053
|
-
super(), this.zoneName = e, this.valid =
|
|
4053
|
+
super(), this.zoneName = e, this.valid = tt.isValidZone(e);
|
|
4054
4054
|
}
|
|
4055
4055
|
/**
|
|
4056
4056
|
* The type of zone. `iana` for all instances of `IANAZone`.
|
|
@@ -4245,7 +4245,7 @@ class yl {
|
|
|
4245
4245
|
return this.inf.format(n);
|
|
4246
4246
|
} else {
|
|
4247
4247
|
const n = this.floor ? Math.floor(e) : rr(e, 3);
|
|
4248
|
-
return
|
|
4248
|
+
return ye(n, this.padTo);
|
|
4249
4249
|
}
|
|
4250
4250
|
}
|
|
4251
4251
|
}
|
|
@@ -4257,7 +4257,7 @@ class gl {
|
|
|
4257
4257
|
this.dt = e;
|
|
4258
4258
|
else if (e.zone.type === "fixed") {
|
|
4259
4259
|
const o = -1 * (e.offset / 60), a = o >= 0 ? `Etc/GMT+${o}` : `Etc/GMT${o}`;
|
|
4260
|
-
e.offset !== 0 &&
|
|
4260
|
+
e.offset !== 0 && tt.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);
|
|
4261
4261
|
} 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);
|
|
4262
4262
|
const i = { ...this.opts };
|
|
4263
4263
|
i.timeZone = i.timeZone || r, this.dtf = Ls(n, i);
|
|
@@ -4430,13 +4430,13 @@ class ie {
|
|
|
4430
4430
|
}
|
|
4431
4431
|
}
|
|
4432
4432
|
let ps = null;
|
|
4433
|
-
class
|
|
4433
|
+
class be extends pn {
|
|
4434
4434
|
/**
|
|
4435
4435
|
* Get a singleton instance of UTC
|
|
4436
4436
|
* @return {FixedOffsetZone}
|
|
4437
4437
|
*/
|
|
4438
4438
|
static get utcInstance() {
|
|
4439
|
-
return ps === null && (ps = new
|
|
4439
|
+
return ps === null && (ps = new be(0)), ps;
|
|
4440
4440
|
}
|
|
4441
4441
|
/**
|
|
4442
4442
|
* Get an instance with a specified offset
|
|
@@ -4444,7 +4444,7 @@ class Oe extends pn {
|
|
|
4444
4444
|
* @return {FixedOffsetZone}
|
|
4445
4445
|
*/
|
|
4446
4446
|
static instance(e) {
|
|
4447
|
-
return e === 0 ?
|
|
4447
|
+
return e === 0 ? be.utcInstance : new be(e);
|
|
4448
4448
|
}
|
|
4449
4449
|
/**
|
|
4450
4450
|
* Get an instance of FixedOffsetZone from a UTC offset string, like "UTC+6"
|
|
@@ -4458,7 +4458,7 @@ class Oe extends pn {
|
|
|
4458
4458
|
if (e) {
|
|
4459
4459
|
const n = e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);
|
|
4460
4460
|
if (n)
|
|
4461
|
-
return new
|
|
4461
|
+
return new be(rs(n[1], n[2]));
|
|
4462
4462
|
}
|
|
4463
4463
|
return null;
|
|
4464
4464
|
}
|
|
@@ -4586,15 +4586,15 @@ class _l extends pn {
|
|
|
4586
4586
|
return !1;
|
|
4587
4587
|
}
|
|
4588
4588
|
}
|
|
4589
|
-
function
|
|
4589
|
+
function at(t, e) {
|
|
4590
4590
|
if (G(t) || t === null)
|
|
4591
4591
|
return e;
|
|
4592
4592
|
if (t instanceof pn)
|
|
4593
4593
|
return t;
|
|
4594
|
-
if (
|
|
4594
|
+
if (Rl(t)) {
|
|
4595
4595
|
const n = t.toLowerCase();
|
|
4596
|
-
return n === "default" ? e : n === "local" || n === "system" ? ts.instance : n === "utc" || n === "gmt" ?
|
|
4597
|
-
} else return ut(t) ?
|
|
4596
|
+
return n === "default" ? e : n === "local" || n === "system" ? ts.instance : n === "utc" || n === "gmt" ? be.utcInstance : be.parseSpecifier(n) || tt.create(t);
|
|
4597
|
+
} else return ut(t) ? be.instance(t) : typeof t == "object" && "offset" in t && typeof t.offset == "function" ? t : new _l(t);
|
|
4598
4598
|
}
|
|
4599
4599
|
const er = {
|
|
4600
4600
|
arab: "[٠-٩]",
|
|
@@ -4661,7 +4661,7 @@ const Zs = /* @__PURE__ */ new Map();
|
|
|
4661
4661
|
function Ol() {
|
|
4662
4662
|
Zs.clear();
|
|
4663
4663
|
}
|
|
4664
|
-
function
|
|
4664
|
+
function Le({ numberingSystem: t }, e = "") {
|
|
4665
4665
|
const n = t || "latn";
|
|
4666
4666
|
let s = Zs.get(n);
|
|
4667
4667
|
s === void 0 && (s = /* @__PURE__ */ new Map(), Zs.set(n, s));
|
|
@@ -4701,7 +4701,7 @@ class fe {
|
|
|
4701
4701
|
* @type {Zone}
|
|
4702
4702
|
*/
|
|
4703
4703
|
static get defaultZone() {
|
|
4704
|
-
return
|
|
4704
|
+
return at(Cr, ts.instance);
|
|
4705
4705
|
}
|
|
4706
4706
|
/**
|
|
4707
4707
|
* Get the default locale to create DateTimes with. Does not affect existing instances.
|
|
@@ -4805,10 +4805,10 @@ class fe {
|
|
|
4805
4805
|
* @return {void}
|
|
4806
4806
|
*/
|
|
4807
4807
|
static resetCaches() {
|
|
4808
|
-
ie.resetCache(),
|
|
4808
|
+
ie.resetCache(), tt.resetCache(), j.resetCache(), Ol();
|
|
4809
4809
|
}
|
|
4810
4810
|
}
|
|
4811
|
-
class
|
|
4811
|
+
class Ue {
|
|
4812
4812
|
constructor(e, n) {
|
|
4813
4813
|
this.reason = e, this.explanation = n;
|
|
4814
4814
|
}
|
|
@@ -4817,8 +4817,8 @@ class Ve {
|
|
|
4817
4817
|
}
|
|
4818
4818
|
}
|
|
4819
4819
|
const Qi = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334], Ki = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335];
|
|
4820
|
-
function
|
|
4821
|
-
return new
|
|
4820
|
+
function Fe(t, e) {
|
|
4821
|
+
return new Ue(
|
|
4822
4822
|
"unit out of range",
|
|
4823
4823
|
`you specified ${e} (of type ${typeof e}) as a ${t}, which is invalid`
|
|
4824
4824
|
);
|
|
@@ -4873,24 +4873,24 @@ function jr(t, e) {
|
|
|
4873
4873
|
return { minDaysInFirstWeek: 4, startOfWeek: 1 };
|
|
4874
4874
|
}
|
|
4875
4875
|
function kl(t, e = 4, n = 1) {
|
|
4876
|
-
const s = ns(t.weekYear), r =
|
|
4876
|
+
const s = ns(t.weekYear), r = $e(
|
|
4877
4877
|
t.weekNumber,
|
|
4878
4878
|
1,
|
|
4879
4879
|
dn(t.weekYear, e, n)
|
|
4880
|
-
), i =
|
|
4881
|
-
return s ? r ? i ? !1 :
|
|
4880
|
+
), i = $e(t.weekday, 1, 7);
|
|
4881
|
+
return s ? r ? i ? !1 : Fe("weekday", t.weekday) : Fe("week", t.weekNumber) : Fe("weekYear", t.weekYear);
|
|
4882
4882
|
}
|
|
4883
4883
|
function bl(t) {
|
|
4884
|
-
const e = ns(t.year), n =
|
|
4885
|
-
return e ? n ? !1 :
|
|
4884
|
+
const e = ns(t.year), n = $e(t.ordinal, 1, $t(t.year));
|
|
4885
|
+
return e ? n ? !1 : Fe("ordinal", t.ordinal) : Fe("year", t.year);
|
|
4886
4886
|
}
|
|
4887
4887
|
function to(t) {
|
|
4888
|
-
const e = ns(t.year), n =
|
|
4889
|
-
return e ? n ? s ? !1 :
|
|
4888
|
+
const e = ns(t.year), n = $e(t.month, 1, 12), s = $e(t.day, 1, Gn(t.year, t.month));
|
|
4889
|
+
return e ? n ? s ? !1 : Fe("day", t.day) : Fe("month", t.month) : Fe("year", t.year);
|
|
4890
4890
|
}
|
|
4891
4891
|
function no(t) {
|
|
4892
|
-
const { hour: e, minute: n, second: s, millisecond: r } = t, i =
|
|
4893
|
-
return i ? o ? a ? l ? !1 :
|
|
4892
|
+
const { hour: e, minute: n, second: s, millisecond: r } = t, i = $e(e, 0, 23) || e === 24 && n === 0 && s === 0 && r === 0, o = $e(n, 0, 59), a = $e(s, 0, 59), l = $e(r, 0, 999);
|
|
4893
|
+
return i ? o ? a ? l ? !1 : Fe("millisecond", r) : Fe("second", s) : Fe("minute", n) : Fe("hour", e);
|
|
4894
4894
|
}
|
|
4895
4895
|
function G(t) {
|
|
4896
4896
|
return typeof t > "u";
|
|
@@ -4901,10 +4901,10 @@ function ut(t) {
|
|
|
4901
4901
|
function ns(t) {
|
|
4902
4902
|
return typeof t == "number" && t % 1 === 0;
|
|
4903
4903
|
}
|
|
4904
|
-
function
|
|
4904
|
+
function Rl(t) {
|
|
4905
4905
|
return typeof t == "string";
|
|
4906
4906
|
}
|
|
4907
|
-
function
|
|
4907
|
+
function Tl(t) {
|
|
4908
4908
|
return Object.prototype.toString.call(t) === "[object Date]";
|
|
4909
4909
|
}
|
|
4910
4910
|
function so() {
|
|
@@ -4921,7 +4921,7 @@ function ro() {
|
|
|
4921
4921
|
return !1;
|
|
4922
4922
|
}
|
|
4923
4923
|
}
|
|
4924
|
-
function
|
|
4924
|
+
function Sl(t) {
|
|
4925
4925
|
return Array.isArray(t) ? t : [t];
|
|
4926
4926
|
}
|
|
4927
4927
|
function Zr(t, e, n) {
|
|
@@ -4941,27 +4941,27 @@ function zs(t) {
|
|
|
4941
4941
|
if (t == null)
|
|
4942
4942
|
return null;
|
|
4943
4943
|
if (typeof t != "object")
|
|
4944
|
-
throw new
|
|
4945
|
-
if (
|
|
4946
|
-
throw new
|
|
4944
|
+
throw new Ee("Week settings must be an object");
|
|
4945
|
+
if (!$e(t.firstDay, 1, 7) || !$e(t.minimalDays, 1, 7) || !Array.isArray(t.weekend) || t.weekend.some((e) => !$e(e, 1, 7)))
|
|
4946
|
+
throw new Ee("Invalid week settings");
|
|
4947
4947
|
return {
|
|
4948
4948
|
firstDay: t.firstDay,
|
|
4949
4949
|
minimalDays: t.minimalDays,
|
|
4950
4950
|
weekend: Array.from(t.weekend)
|
|
4951
4951
|
};
|
|
4952
4952
|
}
|
|
4953
|
-
function
|
|
4953
|
+
function $e(t, e, n) {
|
|
4954
4954
|
return ns(t) && t >= e && t <= n;
|
|
4955
4955
|
}
|
|
4956
4956
|
function xl(t, e) {
|
|
4957
4957
|
return t - e * Math.floor(t / e);
|
|
4958
4958
|
}
|
|
4959
|
-
function
|
|
4959
|
+
function ye(t, e = 2) {
|
|
4960
4960
|
const n = t < 0;
|
|
4961
4961
|
let s;
|
|
4962
4962
|
return n ? s = "-" + ("" + -t).padStart(e, "0") : s = ("" + t).padStart(e, "0"), s;
|
|
4963
4963
|
}
|
|
4964
|
-
function
|
|
4964
|
+
function ot(t) {
|
|
4965
4965
|
if (!(G(t) || t === null || t === ""))
|
|
4966
4966
|
return parseInt(t, 10);
|
|
4967
4967
|
}
|
|
@@ -5046,7 +5046,7 @@ function rs(t, e) {
|
|
|
5046
5046
|
function oo(t) {
|
|
5047
5047
|
const e = Number(t);
|
|
5048
5048
|
if (typeof t == "boolean" || t === "" || !Number.isFinite(e))
|
|
5049
|
-
throw new
|
|
5049
|
+
throw new Ee(`Invalid unit value ${t}`);
|
|
5050
5050
|
return e;
|
|
5051
5051
|
}
|
|
5052
5052
|
function Yn(t, e) {
|
|
@@ -5063,11 +5063,11 @@ function an(t, e) {
|
|
|
5063
5063
|
const n = Math.trunc(Math.abs(t / 60)), s = Math.trunc(Math.abs(t % 60)), r = t >= 0 ? "+" : "-";
|
|
5064
5064
|
switch (e) {
|
|
5065
5065
|
case "short":
|
|
5066
|
-
return `${r}${
|
|
5066
|
+
return `${r}${ye(n, 2)}:${ye(s, 2)}`;
|
|
5067
5067
|
case "narrow":
|
|
5068
5068
|
return `${r}${n}${s > 0 ? `:${s}` : ""}`;
|
|
5069
5069
|
case "techie":
|
|
5070
|
-
return `${r}${
|
|
5070
|
+
return `${r}${ye(n, 2)}${ye(s, 2)}`;
|
|
5071
5071
|
default:
|
|
5072
5072
|
throw new RangeError(`Value format ${e} is out of range for property format`);
|
|
5073
5073
|
}
|
|
@@ -5219,9 +5219,9 @@ const Wl = {
|
|
|
5219
5219
|
FFF: Bi,
|
|
5220
5220
|
FFFF: Gi
|
|
5221
5221
|
};
|
|
5222
|
-
class
|
|
5222
|
+
class ve {
|
|
5223
5223
|
static create(e, n = {}) {
|
|
5224
|
-
return new
|
|
5224
|
+
return new ve(e, n);
|
|
5225
5225
|
}
|
|
5226
5226
|
static parseFormat(e) {
|
|
5227
5227
|
let n = null, s = "", r = !1;
|
|
@@ -5261,7 +5261,7 @@ class Ee {
|
|
|
5261
5261
|
}
|
|
5262
5262
|
num(e, n = 0, s = void 0) {
|
|
5263
5263
|
if (this.opts.forceSimple)
|
|
5264
|
-
return
|
|
5264
|
+
return ye(e, n);
|
|
5265
5265
|
const r = { ...this.opts };
|
|
5266
5266
|
return n > 0 && (r.padTo = n), s && (r.signDisplay = s), this.loc.numberFormatter(r).format(e);
|
|
5267
5267
|
}
|
|
@@ -5270,7 +5270,7 @@ class Ee {
|
|
|
5270
5270
|
g ? { weekday: f } : { weekday: f, month: "long", day: "numeric" },
|
|
5271
5271
|
"weekday"
|
|
5272
5272
|
), d = (f) => {
|
|
5273
|
-
const g =
|
|
5273
|
+
const g = ve.macroTokenToFormatOpts(f);
|
|
5274
5274
|
return g ? this.formatWithSystemDefault(e, g) : f;
|
|
5275
5275
|
}, h = (f) => s ? Vl(e, f) : i({ era: f }, "era"), u = (f) => {
|
|
5276
5276
|
switch (f) {
|
|
@@ -5415,7 +5415,7 @@ class Ee {
|
|
|
5415
5415
|
return d(f);
|
|
5416
5416
|
}
|
|
5417
5417
|
};
|
|
5418
|
-
return qr(
|
|
5418
|
+
return qr(ve.parseFormat(n), u);
|
|
5419
5419
|
}
|
|
5420
5420
|
formatDurationFromString(e, n) {
|
|
5421
5421
|
const s = this.opts.signMode === "negativeLargestOnly" ? -1 : 1, r = (d) => {
|
|
@@ -5443,11 +5443,11 @@ class Ee {
|
|
|
5443
5443
|
const f = r(u);
|
|
5444
5444
|
if (f) {
|
|
5445
5445
|
const g = h.isNegativeDuration && f !== h.largestUnit ? s : 1;
|
|
5446
|
-
let
|
|
5447
|
-
return this.opts.signMode === "negativeLargestOnly" && f !== h.largestUnit ?
|
|
5446
|
+
let R;
|
|
5447
|
+
return this.opts.signMode === "negativeLargestOnly" && f !== h.largestUnit ? R = "never" : this.opts.signMode === "all" ? R = "always" : R = "auto", this.num(d.get(f) * g, u.length, R);
|
|
5448
5448
|
} else
|
|
5449
5449
|
return u;
|
|
5450
|
-
}, o =
|
|
5450
|
+
}, o = ve.parseFormat(n), a = o.reduce(
|
|
5451
5451
|
(d, { literal: h, val: u }) => h ? d : d.concat(u),
|
|
5452
5452
|
[]
|
|
5453
5453
|
), l = e.shiftTo(...a.map(r).filter((d) => d)), c = {
|
|
@@ -5488,7 +5488,7 @@ function yo(...t) {
|
|
|
5488
5488
|
const s = {};
|
|
5489
5489
|
let r;
|
|
5490
5490
|
for (r = 0; r < t.length; r++)
|
|
5491
|
-
s[t[r]] =
|
|
5491
|
+
s[t[r]] = ot(e[n + r]);
|
|
5492
5492
|
return [s, null, n + r];
|
|
5493
5493
|
};
|
|
5494
5494
|
}
|
|
@@ -5497,7 +5497,7 @@ const go = /(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/, jl = `(?:${go.source}?(?:\\[(${
|
|
|
5497
5497
|
), Yl = RegExp(`(?: ${_o.source})?`);
|
|
5498
5498
|
function Mt(t, e, n) {
|
|
5499
5499
|
const s = t[e];
|
|
5500
|
-
return G(s) ? n :
|
|
5500
|
+
return G(s) ? n : ot(s);
|
|
5501
5501
|
}
|
|
5502
5502
|
function Jl(t, e) {
|
|
5503
5503
|
return [{
|
|
@@ -5515,11 +5515,11 @@ function Ht(t, e) {
|
|
|
5515
5515
|
}, null, e + 4];
|
|
5516
5516
|
}
|
|
5517
5517
|
function gn(t, e) {
|
|
5518
|
-
const n = !t[e] && !t[e + 1], s = rs(t[e + 1], t[e + 2]), r = n ? null :
|
|
5518
|
+
const n = !t[e] && !t[e + 1], s = rs(t[e + 1], t[e + 2]), r = n ? null : be.instance(s);
|
|
5519
5519
|
return [{}, r, e + 3];
|
|
5520
5520
|
}
|
|
5521
5521
|
function wn(t, e) {
|
|
5522
|
-
const n = t[e] ?
|
|
5522
|
+
const n = t[e] ? tt.create(t[e]) : null;
|
|
5523
5523
|
return [{}, n, e + 1];
|
|
5524
5524
|
}
|
|
5525
5525
|
const Ql = RegExp(`^T?${ir.source}$`), Kl = /^-?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)?)?)$/;
|
|
@@ -5551,13 +5551,13 @@ const ec = {
|
|
|
5551
5551
|
};
|
|
5552
5552
|
function ar(t, e, n, s, r, i, o) {
|
|
5553
5553
|
const a = {
|
|
5554
|
-
year: e.length === 2 ? qs(
|
|
5554
|
+
year: e.length === 2 ? qs(ot(e)) : ot(e),
|
|
5555
5555
|
month: ao.indexOf(n) + 1,
|
|
5556
|
-
day:
|
|
5557
|
-
hour:
|
|
5558
|
-
minute:
|
|
5556
|
+
day: ot(s),
|
|
5557
|
+
hour: ot(r),
|
|
5558
|
+
minute: ot(i)
|
|
5559
5559
|
};
|
|
5560
|
-
return o && (a.second =
|
|
5560
|
+
return o && (a.second = ot(o)), t && (a.weekday = t.length > 3 ? co.indexOf(t) + 1 : uo.indexOf(t) + 1), a;
|
|
5561
5561
|
}
|
|
5562
5562
|
const tc = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;
|
|
5563
5563
|
function nc(t) {
|
|
@@ -5576,7 +5576,7 @@ function nc(t) {
|
|
|
5576
5576
|
h
|
|
5577
5577
|
] = t, u = ar(e, r, s, n, i, o, a);
|
|
5578
5578
|
let f;
|
|
5579
|
-
return l ? f = ec[l] : c ? f = 0 : f = rs(d, h), [u, new
|
|
5579
|
+
return l ? f = ec[l] : c ? f = 0 : f = rs(d, h), [u, new be(f)];
|
|
5580
5580
|
}
|
|
5581
5581
|
function sc(t) {
|
|
5582
5582
|
return t.replace(/\([^()]*\)|[\n\t]/g, " ").replace(/(\s\s+)/g, " ").trim();
|
|
@@ -5584,11 +5584,11 @@ function sc(t) {
|
|
|
5584
5584
|
const rc = /^(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$/, ic = /^(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$/, oc = /^(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})$/;
|
|
5585
5585
|
function Br(t) {
|
|
5586
5586
|
const [, e, n, s, r, i, o, a] = t;
|
|
5587
|
-
return [ar(e, r, s, n, i, o, a),
|
|
5587
|
+
return [ar(e, r, s, n, i, o, a), be.utcInstance];
|
|
5588
5588
|
}
|
|
5589
5589
|
function ac(t) {
|
|
5590
5590
|
const [, e, n, s, r, i, o, a] = t;
|
|
5591
|
-
return [ar(e, a, n, s, r, i, o),
|
|
5591
|
+
return [ar(e, a, n, s, r, i, o), be.utcInstance];
|
|
5592
5592
|
}
|
|
5593
5593
|
const lc = zt(Zl, or), cc = zt(zl, or), uc = zt(ql, or), dc = zt(wo), Eo = qt(
|
|
5594
5594
|
Jl,
|
|
@@ -5666,7 +5666,7 @@ const Hr = "Invalid Duration", vo = {
|
|
|
5666
5666
|
hours: { minutes: 60, seconds: 3600, milliseconds: 3600 * 1e3 },
|
|
5667
5667
|
minutes: { seconds: 60, milliseconds: 60 * 1e3 },
|
|
5668
5668
|
seconds: { milliseconds: 1e3 }
|
|
5669
|
-
},
|
|
5669
|
+
}, Rc = {
|
|
5670
5670
|
years: {
|
|
5671
5671
|
quarters: 4,
|
|
5672
5672
|
months: 12,
|
|
@@ -5695,25 +5695,25 @@ const Hr = "Invalid Duration", vo = {
|
|
|
5695
5695
|
milliseconds: 720 * 60 * 60 * 1e3
|
|
5696
5696
|
},
|
|
5697
5697
|
...vo
|
|
5698
|
-
},
|
|
5698
|
+
}, Ce = 146097 / 400, xt = 146097 / 4800, Tc = {
|
|
5699
5699
|
years: {
|
|
5700
5700
|
quarters: 4,
|
|
5701
5701
|
months: 12,
|
|
5702
|
-
weeks:
|
|
5703
|
-
days:
|
|
5704
|
-
hours:
|
|
5705
|
-
minutes:
|
|
5706
|
-
seconds:
|
|
5707
|
-
milliseconds:
|
|
5702
|
+
weeks: Ce / 7,
|
|
5703
|
+
days: Ce,
|
|
5704
|
+
hours: Ce * 24,
|
|
5705
|
+
minutes: Ce * 24 * 60,
|
|
5706
|
+
seconds: Ce * 24 * 60 * 60,
|
|
5707
|
+
milliseconds: Ce * 24 * 60 * 60 * 1e3
|
|
5708
5708
|
},
|
|
5709
5709
|
quarters: {
|
|
5710
5710
|
months: 3,
|
|
5711
|
-
weeks:
|
|
5712
|
-
days:
|
|
5713
|
-
hours:
|
|
5714
|
-
minutes:
|
|
5715
|
-
seconds:
|
|
5716
|
-
milliseconds:
|
|
5711
|
+
weeks: Ce / 28,
|
|
5712
|
+
days: Ce / 4,
|
|
5713
|
+
hours: Ce * 24 / 4,
|
|
5714
|
+
minutes: Ce * 24 * 60 / 4,
|
|
5715
|
+
seconds: Ce * 24 * 60 * 60 / 4,
|
|
5716
|
+
milliseconds: Ce * 24 * 60 * 60 * 1e3 / 4
|
|
5717
5717
|
},
|
|
5718
5718
|
months: {
|
|
5719
5719
|
weeks: xt / 7,
|
|
@@ -5734,7 +5734,7 @@ const Hr = "Invalid Duration", vo = {
|
|
|
5734
5734
|
"minutes",
|
|
5735
5735
|
"seconds",
|
|
5736
5736
|
"milliseconds"
|
|
5737
|
-
],
|
|
5737
|
+
], Sc = kt.slice(0).reverse();
|
|
5738
5738
|
function Ye(t, e, n = !1) {
|
|
5739
5739
|
const s = {
|
|
5740
5740
|
values: n ? e.values : { ...t.values, ...e.values || {} },
|
|
@@ -5746,7 +5746,7 @@ function Ye(t, e, n = !1) {
|
|
|
5746
5746
|
}
|
|
5747
5747
|
function Oo(t, e) {
|
|
5748
5748
|
let n = e.milliseconds ?? 0;
|
|
5749
|
-
for (const s of
|
|
5749
|
+
for (const s of Sc.slice(1))
|
|
5750
5750
|
e[s] && (n += e[s] * t[s].milliseconds);
|
|
5751
5751
|
return n;
|
|
5752
5752
|
}
|
|
@@ -5782,7 +5782,7 @@ class ne {
|
|
|
5782
5782
|
*/
|
|
5783
5783
|
constructor(e) {
|
|
5784
5784
|
const n = e.conversionAccuracy === "longterm" || !1;
|
|
5785
|
-
let s = n ?
|
|
5785
|
+
let s = n ? Tc : Rc;
|
|
5786
5786
|
e.matrix && (s = e.matrix), this.values = e.values, this.loc = e.loc || ie.create(), this.conversionAccuracy = n ? "longterm" : "casual", this.invalid = e.invalid || null, this.matrix = s, this.isLuxonDuration = !0;
|
|
5787
5787
|
}
|
|
5788
5788
|
/**
|
|
@@ -5819,7 +5819,7 @@ class ne {
|
|
|
5819
5819
|
*/
|
|
5820
5820
|
static fromObject(e, n = {}) {
|
|
5821
5821
|
if (e == null || typeof e != "object")
|
|
5822
|
-
throw new
|
|
5822
|
+
throw new Ee(
|
|
5823
5823
|
`Duration.fromObject: argument expected to be an object, got ${e === null ? "null" : typeof e}`
|
|
5824
5824
|
);
|
|
5825
5825
|
return new ne({
|
|
@@ -5846,7 +5846,7 @@ class ne {
|
|
|
5846
5846
|
return e;
|
|
5847
5847
|
if (typeof e == "object")
|
|
5848
5848
|
return ne.fromObject(e);
|
|
5849
|
-
throw new
|
|
5849
|
+
throw new Ee(
|
|
5850
5850
|
`Unknown duration argument ${e} of type ${typeof e}`
|
|
5851
5851
|
);
|
|
5852
5852
|
}
|
|
@@ -5896,8 +5896,8 @@ class ne {
|
|
|
5896
5896
|
*/
|
|
5897
5897
|
static invalid(e, n = null) {
|
|
5898
5898
|
if (!e)
|
|
5899
|
-
throw new
|
|
5900
|
-
const s = e instanceof
|
|
5899
|
+
throw new Ee("need to specify a reason the Duration is invalid");
|
|
5900
|
+
const s = e instanceof Ue ? e : new Ue(e, n);
|
|
5901
5901
|
if (fe.throwOnInvalid)
|
|
5902
5902
|
throw new Xa(s);
|
|
5903
5903
|
return new ne({ invalid: s });
|
|
@@ -5983,7 +5983,7 @@ class ne {
|
|
|
5983
5983
|
...n,
|
|
5984
5984
|
floor: n.round !== !1 && n.floor !== !1
|
|
5985
5985
|
};
|
|
5986
|
-
return this.isValid ?
|
|
5986
|
+
return this.isValid ? ve.create(this.loc, s).formatDurationFromString(this, e) : Hr;
|
|
5987
5987
|
}
|
|
5988
5988
|
/**
|
|
5989
5989
|
* Returns a string representation of a Duration with all units included.
|
|
@@ -6394,8 +6394,8 @@ class de {
|
|
|
6394
6394
|
*/
|
|
6395
6395
|
static invalid(e, n = null) {
|
|
6396
6396
|
if (!e)
|
|
6397
|
-
throw new
|
|
6398
|
-
const s = e instanceof
|
|
6397
|
+
throw new Ee("need to specify a reason the Interval is invalid");
|
|
6398
|
+
const s = e instanceof Ue ? e : new Ue(e, n);
|
|
6399
6399
|
if (fe.throwOnInvalid)
|
|
6400
6400
|
throw new Ka(s);
|
|
6401
6401
|
return new de({ invalid: s });
|
|
@@ -6769,7 +6769,7 @@ class de {
|
|
|
6769
6769
|
* @return {string}
|
|
6770
6770
|
*/
|
|
6771
6771
|
toLocaleString(e = Bn, n = {}) {
|
|
6772
|
-
return this.isValid ?
|
|
6772
|
+
return this.isValid ? ve.create(this.s.loc.clone(n), e).formatInterval(this) : Nt;
|
|
6773
6773
|
}
|
|
6774
6774
|
/**
|
|
6775
6775
|
* Returns an ISO 8601-compliant string representation of this Interval.
|
|
@@ -6855,7 +6855,7 @@ class bn {
|
|
|
6855
6855
|
* @return {boolean}
|
|
6856
6856
|
*/
|
|
6857
6857
|
static isValidIANAZone(e) {
|
|
6858
|
-
return
|
|
6858
|
+
return tt.isValidZone(e);
|
|
6859
6859
|
}
|
|
6860
6860
|
/**
|
|
6861
6861
|
* Converts the input into a {@link Zone} instance.
|
|
@@ -6872,7 +6872,7 @@ class bn {
|
|
|
6872
6872
|
* @return {Zone}
|
|
6873
6873
|
*/
|
|
6874
6874
|
static normalizeZone(e) {
|
|
6875
|
-
return
|
|
6875
|
+
return at(e, fe.defaultZone);
|
|
6876
6876
|
}
|
|
6877
6877
|
/**
|
|
6878
6878
|
* Get the weekday on which the week starts according to the given locale.
|
|
@@ -7053,7 +7053,7 @@ function Cc(t) {
|
|
|
7053
7053
|
function Qr(t) {
|
|
7054
7054
|
return t.replace(/\./g, "").replace(bo, " ").toLowerCase();
|
|
7055
7055
|
}
|
|
7056
|
-
function
|
|
7056
|
+
function Ve(t, e) {
|
|
7057
7057
|
return t === null ? null : {
|
|
7058
7058
|
regex: RegExp(t.map(Cc).join("|")),
|
|
7059
7059
|
deser: ([n]) => t.findIndex((s) => Qr(n) === Qr(s)) + e
|
|
@@ -7062,22 +7062,22 @@ function Le(t, e) {
|
|
|
7062
7062
|
function Kr(t, e) {
|
|
7063
7063
|
return { regex: t, deser: ([, n, s]) => rs(n, s), groups: e };
|
|
7064
7064
|
}
|
|
7065
|
-
function
|
|
7065
|
+
function Rn(t) {
|
|
7066
7066
|
return { regex: t, deser: ([e]) => e };
|
|
7067
7067
|
}
|
|
7068
7068
|
function Fc(t) {
|
|
7069
7069
|
return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
|
|
7070
7070
|
}
|
|
7071
7071
|
function $c(t, e) {
|
|
7072
|
-
const n =
|
|
7072
|
+
const n = Le(e), s = Le(e, "{2}"), r = Le(e, "{3}"), i = Le(e, "{4}"), o = Le(e, "{6}"), a = Le(e, "{1,2}"), l = Le(e, "{1,3}"), c = Le(e, "{1,6}"), d = Le(e, "{1,9}"), h = Le(e, "{2,4}"), u = Le(e, "{4,6}"), f = (m) => ({ regex: RegExp(Fc(m.val)), deser: ([E]) => E, literal: !0 }), R = ((m) => {
|
|
7073
7073
|
if (t.literal)
|
|
7074
7074
|
return f(m);
|
|
7075
7075
|
switch (m.val) {
|
|
7076
7076
|
// era
|
|
7077
7077
|
case "G":
|
|
7078
|
-
return
|
|
7078
|
+
return Ve(e.eras("short"), 0);
|
|
7079
7079
|
case "GG":
|
|
7080
|
-
return
|
|
7080
|
+
return Ve(e.eras("long"), 0);
|
|
7081
7081
|
// years
|
|
7082
7082
|
case "y":
|
|
7083
7083
|
return re(c);
|
|
@@ -7095,17 +7095,17 @@ function $c(t, e) {
|
|
|
7095
7095
|
case "MM":
|
|
7096
7096
|
return re(s);
|
|
7097
7097
|
case "MMM":
|
|
7098
|
-
return
|
|
7098
|
+
return Ve(e.months("short", !0), 1);
|
|
7099
7099
|
case "MMMM":
|
|
7100
|
-
return
|
|
7100
|
+
return Ve(e.months("long", !0), 1);
|
|
7101
7101
|
case "L":
|
|
7102
7102
|
return re(a);
|
|
7103
7103
|
case "LL":
|
|
7104
7104
|
return re(s);
|
|
7105
7105
|
case "LLL":
|
|
7106
|
-
return
|
|
7106
|
+
return Ve(e.months("short", !1), 1);
|
|
7107
7107
|
case "LLLL":
|
|
7108
|
-
return
|
|
7108
|
+
return Ve(e.months("long", !1), 1);
|
|
7109
7109
|
// dates
|
|
7110
7110
|
case "d":
|
|
7111
7111
|
return re(a);
|
|
@@ -7142,14 +7142,14 @@ function $c(t, e) {
|
|
|
7142
7142
|
case "SSS":
|
|
7143
7143
|
return re(r);
|
|
7144
7144
|
case "u":
|
|
7145
|
-
return
|
|
7145
|
+
return Rn(d);
|
|
7146
7146
|
case "uu":
|
|
7147
|
-
return
|
|
7147
|
+
return Rn(a);
|
|
7148
7148
|
case "uuu":
|
|
7149
7149
|
return re(n);
|
|
7150
7150
|
// meridiem
|
|
7151
7151
|
case "a":
|
|
7152
|
-
return
|
|
7152
|
+
return Ve(e.meridiems(), 0);
|
|
7153
7153
|
// weekYear (k)
|
|
7154
7154
|
case "kkkk":
|
|
7155
7155
|
return re(i);
|
|
@@ -7165,13 +7165,13 @@ function $c(t, e) {
|
|
|
7165
7165
|
case "c":
|
|
7166
7166
|
return re(n);
|
|
7167
7167
|
case "EEE":
|
|
7168
|
-
return
|
|
7168
|
+
return Ve(e.weekdays("short", !1), 1);
|
|
7169
7169
|
case "EEEE":
|
|
7170
|
-
return
|
|
7170
|
+
return Ve(e.weekdays("long", !1), 1);
|
|
7171
7171
|
case "ccc":
|
|
7172
|
-
return
|
|
7172
|
+
return Ve(e.weekdays("short", !0), 1);
|
|
7173
7173
|
case "cccc":
|
|
7174
|
-
return
|
|
7174
|
+
return Ve(e.weekdays("long", !0), 1);
|
|
7175
7175
|
// offset/zone
|
|
7176
7176
|
case "Z":
|
|
7177
7177
|
case "ZZ":
|
|
@@ -7181,18 +7181,18 @@ function $c(t, e) {
|
|
|
7181
7181
|
// we don't support ZZZZ (PST) or ZZZZZ (Pacific Standard Time) in parsing
|
|
7182
7182
|
// because we don't have any way to figure out what they are
|
|
7183
7183
|
case "z":
|
|
7184
|
-
return
|
|
7184
|
+
return Rn(/[a-z_+-/]{1,256}?/i);
|
|
7185
7185
|
// this special-case "token" represents a place where a macro-token expanded into a white-space literal
|
|
7186
7186
|
// in this case we accept any non-newline white-space
|
|
7187
7187
|
case " ":
|
|
7188
|
-
return
|
|
7188
|
+
return Rn(/[^\S\n\r]/);
|
|
7189
7189
|
default:
|
|
7190
7190
|
return f(m);
|
|
7191
7191
|
}
|
|
7192
7192
|
})(t) || {
|
|
7193
7193
|
invalidReason: Ac
|
|
7194
7194
|
};
|
|
7195
|
-
return
|
|
7195
|
+
return R.token = t, R;
|
|
7196
7196
|
}
|
|
7197
7197
|
const Mc = {
|
|
7198
7198
|
year: {
|
|
@@ -7307,7 +7307,7 @@ function Uc(t) {
|
|
|
7307
7307
|
}
|
|
7308
7308
|
};
|
|
7309
7309
|
let n = null, s;
|
|
7310
|
-
return G(t.z) || (n =
|
|
7310
|
+
return G(t.z) || (n = tt.create(t.z)), G(t.Z) || (n || (n = new be(t.Z)), s = t.Z), G(t.q) || (t.M = (t.q - 1) * 3 + 1), G(t.h) || (t.h < 12 && t.a === 1 ? t.h += 12 : t.h === 12 && t.a === 0 && (t.h = 0)), t.G === 0 && t.y && (t.y = -t.y), G(t.u) || (t.S = sr(t.u)), [Object.keys(t).reduce((i, o) => {
|
|
7311
7311
|
const a = e(o);
|
|
7312
7312
|
return a && (i[a] = t[o]), i;
|
|
7313
7313
|
}, {}), n, s];
|
|
@@ -7319,15 +7319,15 @@ function Wc() {
|
|
|
7319
7319
|
function jc(t, e) {
|
|
7320
7320
|
if (t.literal)
|
|
7321
7321
|
return t;
|
|
7322
|
-
const n =
|
|
7322
|
+
const n = ve.macroTokenToFormatOpts(t.val), s = Io(n, e);
|
|
7323
7323
|
return s == null || s.includes(void 0) ? t : s;
|
|
7324
7324
|
}
|
|
7325
|
-
function
|
|
7325
|
+
function Ro(t, e) {
|
|
7326
7326
|
return Array.prototype.concat(...t.map((n) => jc(n, e)));
|
|
7327
7327
|
}
|
|
7328
|
-
class
|
|
7328
|
+
class To {
|
|
7329
7329
|
constructor(e, n) {
|
|
7330
|
-
if (this.locale = e, this.format = n, this.tokens =
|
|
7330
|
+
if (this.locale = e, this.format = n, this.tokens = Ro(ve.parseFormat(n), e), this.units = this.tokens.map((s) => $c(s, e)), this.disqualifyingUnit = this.units.find((s) => s.invalidReason), !this.disqualifyingUnit) {
|
|
7331
7331
|
const [s, r] = Lc(this.units);
|
|
7332
7332
|
this.regex = RegExp(s, "i"), this.handlers = r;
|
|
7333
7333
|
}
|
|
@@ -7359,22 +7359,22 @@ class So {
|
|
|
7359
7359
|
return this.disqualifyingUnit ? this.disqualifyingUnit.invalidReason : null;
|
|
7360
7360
|
}
|
|
7361
7361
|
}
|
|
7362
|
-
function
|
|
7363
|
-
return new
|
|
7362
|
+
function So(t, e, n) {
|
|
7363
|
+
return new To(t, n).explainFromTokens(e);
|
|
7364
7364
|
}
|
|
7365
7365
|
function Zc(t, e, n) {
|
|
7366
|
-
const { result: s, zone: r, specificOffset: i, invalidReason: o } =
|
|
7366
|
+
const { result: s, zone: r, specificOffset: i, invalidReason: o } = So(t, e, n);
|
|
7367
7367
|
return [s, r, i, o];
|
|
7368
7368
|
}
|
|
7369
7369
|
function Io(t, e) {
|
|
7370
7370
|
if (!t)
|
|
7371
7371
|
return null;
|
|
7372
|
-
const s =
|
|
7372
|
+
const s = ve.create(e, t).dtFormatter(Wc()), r = s.formatToParts(), i = s.resolvedOptions();
|
|
7373
7373
|
return r.map((o) => Pc(o, t, i));
|
|
7374
7374
|
}
|
|
7375
7375
|
const ws = "Invalid DateTime", Xr = 864e13;
|
|
7376
7376
|
function en(t) {
|
|
7377
|
-
return new
|
|
7377
|
+
return new Ue("unsupported zone", `the zone "${t.name}" is not supported`);
|
|
7378
7378
|
}
|
|
7379
7379
|
function _s(t) {
|
|
7380
7380
|
return t.weekData === null && (t.weekData = Hn(t.c)), t.weekData;
|
|
@@ -7406,7 +7406,7 @@ function xo(t, e, n) {
|
|
|
7406
7406
|
const i = n.offset(s);
|
|
7407
7407
|
return r === i ? [s, r] : [t - Math.min(r, i) * 60 * 1e3, Math.max(r, i)];
|
|
7408
7408
|
}
|
|
7409
|
-
function
|
|
7409
|
+
function Tn(t, e) {
|
|
7410
7410
|
t += e * 60 * 1e3;
|
|
7411
7411
|
const n = new Date(t);
|
|
7412
7412
|
return {
|
|
@@ -7453,11 +7453,11 @@ function At(t, e, n, s, r, i) {
|
|
|
7453
7453
|
return o ? c : c.setZone(a);
|
|
7454
7454
|
} else
|
|
7455
7455
|
return j.invalid(
|
|
7456
|
-
new
|
|
7456
|
+
new Ue("unparsable", `the input "${r}" can't be parsed as ${s}`)
|
|
7457
7457
|
);
|
|
7458
7458
|
}
|
|
7459
|
-
function
|
|
7460
|
-
return t.isValid ?
|
|
7459
|
+
function Sn(t, e, n = !0) {
|
|
7460
|
+
return t.isValid ? ve.create(ie.create("en-US"), {
|
|
7461
7461
|
allowZ: n,
|
|
7462
7462
|
forceSimple: !0
|
|
7463
7463
|
}).formatDateTimeFromString(t, e) : null;
|
|
@@ -7465,12 +7465,12 @@ function Rn(t, e, n = !0) {
|
|
|
7465
7465
|
function vs(t, e, n) {
|
|
7466
7466
|
const s = t.c.year > 9999 || t.c.year < 0;
|
|
7467
7467
|
let r = "";
|
|
7468
|
-
if (s && t.c.year >= 0 && (r += "+"), r +=
|
|
7468
|
+
if (s && t.c.year >= 0 && (r += "+"), r += ye(t.c.year, s ? 6 : 4), n === "year") return r;
|
|
7469
7469
|
if (e) {
|
|
7470
|
-
if (r += "-", r +=
|
|
7470
|
+
if (r += "-", r += ye(t.c.month), n === "month") return r;
|
|
7471
7471
|
r += "-";
|
|
7472
|
-
} else if (r +=
|
|
7473
|
-
return r +=
|
|
7472
|
+
} else if (r += ye(t.c.month), n === "month") return r;
|
|
7473
|
+
return r += ye(t.c.day), r;
|
|
7474
7474
|
}
|
|
7475
7475
|
function ti(t, e, n, s, r, i, o) {
|
|
7476
7476
|
let a = !n || t.c.millisecond !== 0 || t.c.second !== 0, l = "";
|
|
@@ -7480,18 +7480,18 @@ function ti(t, e, n, s, r, i, o) {
|
|
|
7480
7480
|
case "year":
|
|
7481
7481
|
break;
|
|
7482
7482
|
default:
|
|
7483
|
-
if (l +=
|
|
7483
|
+
if (l += ye(t.c.hour), o === "hour") break;
|
|
7484
7484
|
if (e) {
|
|
7485
|
-
if (l += ":", l +=
|
|
7486
|
-
a && (l += ":", l +=
|
|
7485
|
+
if (l += ":", l += ye(t.c.minute), o === "minute") break;
|
|
7486
|
+
a && (l += ":", l += ye(t.c.second));
|
|
7487
7487
|
} else {
|
|
7488
|
-
if (l +=
|
|
7489
|
-
a && (l +=
|
|
7488
|
+
if (l += ye(t.c.minute), o === "minute") break;
|
|
7489
|
+
a && (l += ye(t.c.second));
|
|
7490
7490
|
}
|
|
7491
7491
|
if (o === "second") break;
|
|
7492
|
-
a && (!s || t.c.millisecond !== 0) && (l += ".", l +=
|
|
7492
|
+
a && (!s || t.c.millisecond !== 0) && (l += ".", l += ye(t.c.millisecond, 3));
|
|
7493
7493
|
}
|
|
7494
|
-
return r && (t.isOffsetFixed && t.offset === 0 && !i ? l += "Z" : t.o < 0 ? (l += "-", l +=
|
|
7494
|
+
return r && (t.isOffsetFixed && t.offset === 0 && !i ? l += "Z" : t.o < 0 ? (l += "-", l += ye(Math.trunc(-t.o / 60)), l += ":", l += ye(Math.trunc(-t.o % 60))) : (l += "+", l += ye(Math.trunc(t.o / 60)), l += ":", l += ye(Math.trunc(t.o % 60)))), i && (l += "[" + t.zone.ianaName + "]"), l;
|
|
7495
7495
|
}
|
|
7496
7496
|
const No = {
|
|
7497
7497
|
month: 1,
|
|
@@ -7575,7 +7575,7 @@ function Gc(t) {
|
|
|
7575
7575
|
return n === void 0 && (n = t.offset(tn), Bs.set(e, n)), n;
|
|
7576
7576
|
}
|
|
7577
7577
|
function si(t, e) {
|
|
7578
|
-
const n =
|
|
7578
|
+
const n = at(e.zone, fe.defaultZone);
|
|
7579
7579
|
if (!n.isValid)
|
|
7580
7580
|
return j.invalid(en(n));
|
|
7581
7581
|
const s = ie.fromObject(e);
|
|
@@ -7616,7 +7616,7 @@ class j {
|
|
|
7616
7616
|
*/
|
|
7617
7617
|
constructor(e) {
|
|
7618
7618
|
const n = e.zone || fe.defaultZone;
|
|
7619
|
-
let s = e.invalid || (Number.isNaN(e.ts) ? new
|
|
7619
|
+
let s = e.invalid || (Number.isNaN(e.ts) ? new Ue("invalid input") : null) || (n.isValid ? null : en(n));
|
|
7620
7620
|
this.ts = G(e.ts) ? fe.now() : e.ts;
|
|
7621
7621
|
let r = null, i = null;
|
|
7622
7622
|
if (!s)
|
|
@@ -7624,7 +7624,7 @@ class j {
|
|
|
7624
7624
|
[r, i] = [e.old.c, e.old.o];
|
|
7625
7625
|
else {
|
|
7626
7626
|
const a = ut(e.o) && !e.old ? e.o : n.offset(this.ts);
|
|
7627
|
-
r =
|
|
7627
|
+
r = Tn(this.ts, a), s = Number.isNaN(r.year) ? new Ue("invalid input") : null, r = s ? null : r, i = s ? null : a;
|
|
7628
7628
|
}
|
|
7629
7629
|
this._zone = n, this.loc = e.loc || ie.create(), this.invalid = s, this.weekData = null, this.localWeekData = null, this.c = r, this.o = i, this.isLuxonDateTime = !0;
|
|
7630
7630
|
}
|
|
@@ -7691,7 +7691,7 @@ class j {
|
|
|
7691
7691
|
*/
|
|
7692
7692
|
static utc() {
|
|
7693
7693
|
const [e, n] = ii(arguments), [s, r, i, o, a, l, c] = n;
|
|
7694
|
-
return e.zone =
|
|
7694
|
+
return e.zone = be.utcInstance, si({ year: s, month: r, day: i, hour: o, minute: a, second: l, millisecond: c }, e);
|
|
7695
7695
|
}
|
|
7696
7696
|
/**
|
|
7697
7697
|
* Create a DateTime from a JavaScript Date object. Uses the default zone.
|
|
@@ -7701,10 +7701,10 @@ class j {
|
|
|
7701
7701
|
* @return {DateTime}
|
|
7702
7702
|
*/
|
|
7703
7703
|
static fromJSDate(e, n = {}) {
|
|
7704
|
-
const s =
|
|
7704
|
+
const s = Tl(e) ? e.valueOf() : NaN;
|
|
7705
7705
|
if (Number.isNaN(s))
|
|
7706
7706
|
return j.invalid("invalid input");
|
|
7707
|
-
const r =
|
|
7707
|
+
const r = at(n.zone, fe.defaultZone);
|
|
7708
7708
|
return r.isValid ? new j({
|
|
7709
7709
|
ts: s,
|
|
7710
7710
|
zone: r,
|
|
@@ -7726,10 +7726,10 @@ class j {
|
|
|
7726
7726
|
if (ut(e))
|
|
7727
7727
|
return e < -Xr || e > Xr ? j.invalid("Timestamp out of range") : new j({
|
|
7728
7728
|
ts: e,
|
|
7729
|
-
zone:
|
|
7729
|
+
zone: at(n.zone, fe.defaultZone),
|
|
7730
7730
|
loc: ie.fromObject(n)
|
|
7731
7731
|
});
|
|
7732
|
-
throw new
|
|
7732
|
+
throw new Ee(
|
|
7733
7733
|
`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`
|
|
7734
7734
|
);
|
|
7735
7735
|
}
|
|
@@ -7748,10 +7748,10 @@ class j {
|
|
|
7748
7748
|
if (ut(e))
|
|
7749
7749
|
return new j({
|
|
7750
7750
|
ts: e * 1e3,
|
|
7751
|
-
zone:
|
|
7751
|
+
zone: at(n.zone, fe.defaultZone),
|
|
7752
7752
|
loc: ie.fromObject(n)
|
|
7753
7753
|
});
|
|
7754
|
-
throw new
|
|
7754
|
+
throw new Ee("fromSeconds requires a numerical input");
|
|
7755
7755
|
}
|
|
7756
7756
|
/**
|
|
7757
7757
|
* Create a DateTime from a JavaScript object with keys like 'year' and 'hour' with reasonable defaults.
|
|
@@ -7788,7 +7788,7 @@ class j {
|
|
|
7788
7788
|
*/
|
|
7789
7789
|
static fromObject(e, n = {}) {
|
|
7790
7790
|
e = e || {};
|
|
7791
|
-
const s =
|
|
7791
|
+
const s = at(n.zone, fe.defaultZone);
|
|
7792
7792
|
if (!s.isValid)
|
|
7793
7793
|
return j.invalid(en(s));
|
|
7794
7794
|
const r = ie.fromObject(n), i = Yn(e, ni), { minDaysInFirstWeek: o, startOfWeek: a } = jr(i, r), l = fe.now(), c = G(n.specificOffset) ? s.offset(l) : n.specificOffset, d = !G(i.ordinal), h = !G(i.year), u = !G(i.month) || !G(i.day), f = h || u, g = i.weekYear || i.weekNumber;
|
|
@@ -7798,18 +7798,18 @@ class j {
|
|
|
7798
7798
|
);
|
|
7799
7799
|
if (u && d)
|
|
7800
7800
|
throw new Ct("Can't mix ordinal dates with month/day");
|
|
7801
|
-
const
|
|
7802
|
-
let m, E, w =
|
|
7803
|
-
|
|
7801
|
+
const R = g || i.weekday && !f;
|
|
7802
|
+
let m, E, w = Tn(l, c);
|
|
7803
|
+
R ? (m = Bc, E = zc, w = Hn(w, o, a)) : d ? (m = Hc, E = qc, w = ys(w)) : (m = An, E = No);
|
|
7804
7804
|
let x = !1;
|
|
7805
|
-
for (const
|
|
7806
|
-
const p = i[
|
|
7807
|
-
G(p) ? x ? i[
|
|
7805
|
+
for (const S of m) {
|
|
7806
|
+
const p = i[S];
|
|
7807
|
+
G(p) ? x ? i[S] = E[S] : i[S] = w[S] : x = !0;
|
|
7808
7808
|
}
|
|
7809
|
-
const k =
|
|
7809
|
+
const k = R ? kl(i, o, a) : d ? bl(i) : to(i), v = k || no(i);
|
|
7810
7810
|
if (v)
|
|
7811
7811
|
return j.invalid(v);
|
|
7812
|
-
const N =
|
|
7812
|
+
const N = R ? Ur(i, o, a) : d ? Wr(i) : i, [W, O] = Nn(N, c, s), H = new j({
|
|
7813
7813
|
ts: W,
|
|
7814
7814
|
zone: s,
|
|
7815
7815
|
o: O,
|
|
@@ -7896,7 +7896,7 @@ class j {
|
|
|
7896
7896
|
*/
|
|
7897
7897
|
static fromFormat(e, n, s = {}) {
|
|
7898
7898
|
if (G(e) || G(n))
|
|
7899
|
-
throw new
|
|
7899
|
+
throw new Ee("fromFormat requires an input string and a format");
|
|
7900
7900
|
const { locale: r = null, numberingSystem: i = null } = s, o = ie.fromOpts({
|
|
7901
7901
|
locale: r,
|
|
7902
7902
|
numberingSystem: i,
|
|
@@ -7943,8 +7943,8 @@ class j {
|
|
|
7943
7943
|
*/
|
|
7944
7944
|
static invalid(e, n = null) {
|
|
7945
7945
|
if (!e)
|
|
7946
|
-
throw new
|
|
7947
|
-
const s = e instanceof
|
|
7946
|
+
throw new Ee("need to specify a reason the DateTime is invalid");
|
|
7947
|
+
const s = e instanceof Ue ? e : new Ue(e, n);
|
|
7948
7948
|
if (fe.throwOnInvalid)
|
|
7949
7949
|
throw new Qa(s);
|
|
7950
7950
|
return new j({ invalid: s });
|
|
@@ -7975,7 +7975,7 @@ class j {
|
|
|
7975
7975
|
* @returns {string}
|
|
7976
7976
|
*/
|
|
7977
7977
|
static expandFormat(e, n = {}) {
|
|
7978
|
-
return
|
|
7978
|
+
return Ro(ve.parseFormat(e), ie.fromObject(n)).map((r) => r.val).join("");
|
|
7979
7979
|
}
|
|
7980
7980
|
static resetCache() {
|
|
7981
7981
|
tn = void 0, Bs.clear();
|
|
@@ -8279,7 +8279,7 @@ class j {
|
|
|
8279
8279
|
const e = 864e5, n = 6e4, s = ss(this.c), r = this.zone.offset(s - e), i = this.zone.offset(s + e), o = this.zone.offset(s - r * n), a = this.zone.offset(s - i * n);
|
|
8280
8280
|
if (o === a)
|
|
8281
8281
|
return [this];
|
|
8282
|
-
const l = s - o * n, c = s - a * n, d =
|
|
8282
|
+
const l = s - o * n, c = s - a * n, d = Tn(l, o), h = Tn(c, a);
|
|
8283
8283
|
return d.hour === h.hour && d.minute === h.minute && d.second === h.second && d.millisecond === h.millisecond ? [wt(this, { ts: l }), wt(this, { ts: c })] : [this];
|
|
8284
8284
|
}
|
|
8285
8285
|
/**
|
|
@@ -8339,7 +8339,7 @@ class j {
|
|
|
8339
8339
|
* @return {Object}
|
|
8340
8340
|
*/
|
|
8341
8341
|
resolvedLocaleOptions(e = {}) {
|
|
8342
|
-
const { locale: n, numberingSystem: s, calendar: r } =
|
|
8342
|
+
const { locale: n, numberingSystem: s, calendar: r } = ve.create(
|
|
8343
8343
|
this.loc.clone(e),
|
|
8344
8344
|
e
|
|
8345
8345
|
).resolvedOptions(this);
|
|
@@ -8355,7 +8355,7 @@ class j {
|
|
|
8355
8355
|
* @return {DateTime}
|
|
8356
8356
|
*/
|
|
8357
8357
|
toUTC(e = 0, n = {}) {
|
|
8358
|
-
return this.setZone(
|
|
8358
|
+
return this.setZone(be.instance(e), n);
|
|
8359
8359
|
}
|
|
8360
8360
|
/**
|
|
8361
8361
|
* "Set" the DateTime's zone to the host's local zone. Returns a newly-constructed DateTime.
|
|
@@ -8376,7 +8376,7 @@ class j {
|
|
|
8376
8376
|
* @return {DateTime}
|
|
8377
8377
|
*/
|
|
8378
8378
|
setZone(e, { keepLocalTime: n = !1, keepCalendarTime: s = !1 } = {}) {
|
|
8379
|
-
if (e =
|
|
8379
|
+
if (e = at(e, fe.defaultZone), e.equals(this.zone))
|
|
8380
8380
|
return this;
|
|
8381
8381
|
if (e.isValid) {
|
|
8382
8382
|
let r = this.ts;
|
|
@@ -8545,7 +8545,7 @@ class j {
|
|
|
8545
8545
|
* @return {string}
|
|
8546
8546
|
*/
|
|
8547
8547
|
toFormat(e, n = {}) {
|
|
8548
|
-
return this.isValid ?
|
|
8548
|
+
return this.isValid ? ve.create(this.loc.redefaultToEN(n)).formatDateTimeFromString(this, e) : ws;
|
|
8549
8549
|
}
|
|
8550
8550
|
/**
|
|
8551
8551
|
* Returns a localized string representing this date. Accepts the same options as the Intl.DateTimeFormat constructor and any presets defined by Luxon, such as `DateTime.DATE_FULL` or `DateTime.TIME_SIMPLE`.
|
|
@@ -8567,7 +8567,7 @@ class j {
|
|
|
8567
8567
|
* @return {string}
|
|
8568
8568
|
*/
|
|
8569
8569
|
toLocaleString(e = Bn, n = {}) {
|
|
8570
|
-
return this.isValid ?
|
|
8570
|
+
return this.isValid ? ve.create(this.loc.clone(n), e).formatDateTime(this) : ws;
|
|
8571
8571
|
}
|
|
8572
8572
|
/**
|
|
8573
8573
|
* Returns an array of format "parts", meaning individual tokens along with metadata. This is allows callers to post-process individual sections of the formatted output.
|
|
@@ -8583,7 +8583,7 @@ class j {
|
|
|
8583
8583
|
* //=> ]
|
|
8584
8584
|
*/
|
|
8585
8585
|
toLocaleParts(e = {}) {
|
|
8586
|
-
return this.isValid ?
|
|
8586
|
+
return this.isValid ? ve.create(this.loc.clone(e), e).formatDateTimeParts(this) : [];
|
|
8587
8587
|
}
|
|
8588
8588
|
/**
|
|
8589
8589
|
* Returns an ISO 8601-compliant string representation of this DateTime
|
|
@@ -8644,7 +8644,7 @@ class j {
|
|
|
8644
8644
|
* @return {string}
|
|
8645
8645
|
*/
|
|
8646
8646
|
toISOWeekDate() {
|
|
8647
|
-
return
|
|
8647
|
+
return Sn(this, "kkkk-'W'WW-c");
|
|
8648
8648
|
}
|
|
8649
8649
|
/**
|
|
8650
8650
|
* Returns an ISO 8601-compliant string representation of this DateTime's time component
|
|
@@ -8689,7 +8689,7 @@ class j {
|
|
|
8689
8689
|
* @return {string}
|
|
8690
8690
|
*/
|
|
8691
8691
|
toRFC2822() {
|
|
8692
|
-
return
|
|
8692
|
+
return Sn(this, "EEE, dd LLL yyyy HH:mm:ss ZZZ", !1);
|
|
8693
8693
|
}
|
|
8694
8694
|
/**
|
|
8695
8695
|
* Returns a string representation of this DateTime appropriate for use in HTTP headers. The output is always expressed in GMT.
|
|
@@ -8700,7 +8700,7 @@ class j {
|
|
|
8700
8700
|
* @return {string}
|
|
8701
8701
|
*/
|
|
8702
8702
|
toHTTP() {
|
|
8703
|
-
return
|
|
8703
|
+
return Sn(this.toUTC(), "EEE, dd LLL yyyy HH:mm:ss 'GMT'");
|
|
8704
8704
|
}
|
|
8705
8705
|
/**
|
|
8706
8706
|
* Returns a string representation of this DateTime appropriate for use in SQL Date
|
|
@@ -8724,7 +8724,7 @@ class j {
|
|
|
8724
8724
|
*/
|
|
8725
8725
|
toSQLTime({ includeOffset: e = !0, includeZone: n = !1, includeOffsetSpace: s = !0 } = {}) {
|
|
8726
8726
|
let r = "HH:mm:ss.SSS";
|
|
8727
|
-
return (n || e) && (s && (r += " "), n ? r += "z" : e && (r += "ZZ")),
|
|
8727
|
+
return (n || e) && (s && (r += " "), n ? r += "z" : e && (r += "ZZ")), Sn(this, r, !0);
|
|
8728
8728
|
}
|
|
8729
8729
|
/**
|
|
8730
8730
|
* Returns a string representation of this DateTime appropriate for use in SQL DateTime
|
|
@@ -8835,7 +8835,7 @@ class j {
|
|
|
8835
8835
|
diff(e, n = "milliseconds", s = {}) {
|
|
8836
8836
|
if (!this.isValid || !e.isValid)
|
|
8837
8837
|
return ne.invalid("created by diffing an invalid DateTime");
|
|
8838
|
-
const r = { locale: this.locale, numberingSystem: this.numberingSystem, ...s }, i =
|
|
8838
|
+
const r = { locale: this.locale, numberingSystem: this.numberingSystem, ...s }, i = Sl(n).map(ne.normalizeUnit), o = e.valueOf() > this.valueOf(), a = o ? this : e, l = o ? e : this, c = Nc(a, l, i, r);
|
|
8839
8839
|
return o ? c.negate() : c;
|
|
8840
8840
|
}
|
|
8841
8841
|
/**
|
|
@@ -8941,7 +8941,7 @@ class j {
|
|
|
8941
8941
|
*/
|
|
8942
8942
|
static min(...e) {
|
|
8943
8943
|
if (!e.every(j.isDateTime))
|
|
8944
|
-
throw new
|
|
8944
|
+
throw new Ee("min requires all arguments be DateTimes");
|
|
8945
8945
|
return Zr(e, (n) => n.valueOf(), Math.min);
|
|
8946
8946
|
}
|
|
8947
8947
|
/**
|
|
@@ -8951,7 +8951,7 @@ class j {
|
|
|
8951
8951
|
*/
|
|
8952
8952
|
static max(...e) {
|
|
8953
8953
|
if (!e.every(j.isDateTime))
|
|
8954
|
-
throw new
|
|
8954
|
+
throw new Ee("max requires all arguments be DateTimes");
|
|
8955
8955
|
return Zr(e, (n) => n.valueOf(), Math.max);
|
|
8956
8956
|
}
|
|
8957
8957
|
// MISC
|
|
@@ -8968,7 +8968,7 @@ class j {
|
|
|
8968
8968
|
numberingSystem: i,
|
|
8969
8969
|
defaultToEN: !0
|
|
8970
8970
|
});
|
|
8971
|
-
return
|
|
8971
|
+
return So(o, e, n);
|
|
8972
8972
|
}
|
|
8973
8973
|
/**
|
|
8974
8974
|
* @deprecated use fromFormatExplain instead
|
|
@@ -8994,7 +8994,7 @@ class j {
|
|
|
8994
8994
|
numberingSystem: r,
|
|
8995
8995
|
defaultToEN: !0
|
|
8996
8996
|
});
|
|
8997
|
-
return new
|
|
8997
|
+
return new To(i, e);
|
|
8998
8998
|
}
|
|
8999
8999
|
/**
|
|
9000
9000
|
* Create a DateTime from an input string and format parser.
|
|
@@ -9008,7 +9008,7 @@ class j {
|
|
|
9008
9008
|
*/
|
|
9009
9009
|
static fromFormatParser(e, n, s = {}) {
|
|
9010
9010
|
if (G(e) || G(n))
|
|
9011
|
-
throw new
|
|
9011
|
+
throw new Ee(
|
|
9012
9012
|
"fromFormatParser requires an input string and a format parser"
|
|
9013
9013
|
);
|
|
9014
9014
|
const { locale: r = null, numberingSystem: i = null } = s, o = ie.fromOpts({
|
|
@@ -9017,7 +9017,7 @@ class j {
|
|
|
9017
9017
|
defaultToEN: !0
|
|
9018
9018
|
});
|
|
9019
9019
|
if (!o.equals(n.locale))
|
|
9020
|
-
throw new
|
|
9020
|
+
throw new Ee(
|
|
9021
9021
|
`fromFormatParser called with a locale of ${o}, but the format parser was created for ${n.locale}`
|
|
9022
9022
|
);
|
|
9023
9023
|
const { result: a, zone: l, specificOffset: c, invalidReason: d } = n.explainFromTokens(e);
|
|
@@ -9193,7 +9193,7 @@ function Jt(t) {
|
|
|
9193
9193
|
return j.fromJSDate(t);
|
|
9194
9194
|
if (t && typeof t == "object")
|
|
9195
9195
|
return j.fromObject(t);
|
|
9196
|
-
throw new
|
|
9196
|
+
throw new Ee(
|
|
9197
9197
|
`Unknown datetime argument: ${t}, of type ${typeof t}`
|
|
9198
9198
|
);
|
|
9199
9199
|
}
|
|
@@ -9202,24 +9202,24 @@ const Yc = (t, e) => {
|
|
|
9202
9202
|
if (t.includeFields) {
|
|
9203
9203
|
const s = e.collections[t.collection];
|
|
9204
9204
|
if (!s)
|
|
9205
|
-
return mn(
|
|
9205
|
+
return mn(_e());
|
|
9206
9206
|
t.includeFields.forEach((r) => {
|
|
9207
9207
|
const i = s.fields.find((o) => o.name === r);
|
|
9208
|
-
i ? n[r] = Ao(i)?.nullable() : n[r] =
|
|
9208
|
+
i ? n[r] = Ao(i)?.nullable() : n[r] = _e();
|
|
9209
9209
|
});
|
|
9210
9210
|
}
|
|
9211
9211
|
return qe({
|
|
9212
|
-
Collection_Path:
|
|
9212
|
+
Collection_Path: St(xe()),
|
|
9213
9213
|
...n
|
|
9214
9214
|
});
|
|
9215
9215
|
}, Jc = (t, e, n, s) => {
|
|
9216
9216
|
let r = qe({}).catchall(Yc(t, e)), i;
|
|
9217
9217
|
if (!s && n) {
|
|
9218
|
-
const o =
|
|
9218
|
+
const o = We(t, n);
|
|
9219
9219
|
i = Qt(o.admin?.skipFormRequiredValidation);
|
|
9220
9220
|
}
|
|
9221
9221
|
return (!t.required || i) && (r = r.optional()), r;
|
|
9222
|
-
}, Qc = () =>
|
|
9222
|
+
}, Qc = () => _e().refine((t) => t === null || t && (t.seconds !== void 0 && t.nanoseconds !== void 0 || t._seconds !== void 0 && t._nanoseconds !== void 0), {
|
|
9223
9223
|
message: "Must be a valid date"
|
|
9224
9224
|
}), Ao = (t, e, n) => {
|
|
9225
9225
|
let s;
|
|
@@ -9228,14 +9228,14 @@ const Yc = (t, e) => {
|
|
|
9228
9228
|
` || "";
|
|
9229
9229
|
let i, o, a;
|
|
9230
9230
|
if (!n && e) {
|
|
9231
|
-
const l =
|
|
9231
|
+
const l = We(t, e);
|
|
9232
9232
|
i = l.admin?.condition?.form !== void 0 && !Qt(l.admin.condition.form), o = Qt(l.admin?.skipFormRequiredValidation), a = Qt(l.admin?.image);
|
|
9233
9233
|
}
|
|
9234
9234
|
switch (t.type) {
|
|
9235
9235
|
case "String":
|
|
9236
|
-
s =
|
|
9236
|
+
s = xe(), t.length && (s = s.length(t.length, `Must be ${t.length} character(s) long`)), t.minlength && (s = s.min(t.minlength, `Must contain at least ${t.minlength} character(s)`)), t.maxlength && (s = s.max(t.maxlength, `Must contain at most ${t.maxlength} character(s)`)), t.email ? s = s.email("Must be a valid email address") : t.uuid ? s = Se([s.uuid("Must be a valid UUID"), Ie("")]) : t.url ? s = Se([s.url("Must be a valid URL"), Ie("")]) : t.emoji ? s = Se([s.emoji("Must be a valid emoji"), Ie("")]) : t.ip ? s = Se([s.ip("Must be a valid IP address"), Ie("")]) : t.pattern && (!n && a ? s = Se([s.regex(new RegExp(t.pattern)), s.regex(/^blob:/)], {
|
|
9237
9237
|
message: "Must be a valid value"
|
|
9238
|
-
}) : s = s.regex(new RegExp(t.pattern), "Must be a valid value")), t.values && (s =
|
|
9238
|
+
}) : s = s.regex(new RegExp(t.pattern), "Must be a valid value")), t.values && (s = Se([
|
|
9239
9239
|
zn(t.values, {
|
|
9240
9240
|
message: `Must be one of the following values: ${t.values.join(", ")}`
|
|
9241
9241
|
}),
|
|
@@ -9246,13 +9246,13 @@ const Yc = (t, e) => {
|
|
|
9246
9246
|
s = on(), r && (s = s.describe(r.trim()));
|
|
9247
9247
|
break;
|
|
9248
9248
|
case "Number":
|
|
9249
|
-
t.autoIncrement ? s =
|
|
9249
|
+
t.autoIncrement ? s = Se([fs(), Ot().int()], {
|
|
9250
9250
|
message: "Must be a valid number"
|
|
9251
9251
|
}) : (s = Ot({
|
|
9252
9252
|
message: "Must be a valid number"
|
|
9253
9253
|
}), t.min && (s = s.min(t.min, `Must be greater than or equal to ${t.min}`)), t.max && (s = s.max(t.max, `Must be less than or equal to ${t.max}`)), t.decimal ? n ? s = s.describe(`${r}Must have ${t.decimal} decimal places`) : s = s.refine((l) => t.decimal ? (l.toString().split(".")[1]?.length || 0) <= t.decimal : !1, {
|
|
9254
9254
|
message: `Must have ${t.decimal} or fewer decimal places`
|
|
9255
|
-
}) : s = s.int("Must not have decimal places"), t.values ? (n || (s =
|
|
9255
|
+
}) : s = s.int("Must not have decimal places"), t.values ? (n || (s = Se([
|
|
9256
9256
|
s.refine((l) => t.values?.includes(l), {
|
|
9257
9257
|
message: `Must be one of the following values: ${t.values.join(", ")}`
|
|
9258
9258
|
}),
|
|
@@ -9270,7 +9270,7 @@ const Yc = (t, e) => {
|
|
|
9270
9270
|
})));
|
|
9271
9271
|
break;
|
|
9272
9272
|
case "Array":
|
|
9273
|
-
s =
|
|
9273
|
+
s = St(_e()), t.length && (s = s.length(t.length, `Must contain ${t.length} item(s)`)), t.minlength ? s = s.min(t.minlength, `Must contain at least ${t.minlength} item(s)`) : t.required && !i && (s = s.nonempty("Must contain at least one item")), t.maxlength && (s = s.max(t.maxlength, `Must contain at most ${t.maxlength} item(s)`)), t.values ? (n || (s = s.refine((l) => {
|
|
9274
9274
|
let c = !0;
|
|
9275
9275
|
return l.forEach((d) => {
|
|
9276
9276
|
t.values && !t.values.includes(d) && (c = !1);
|
|
@@ -9278,12 +9278,12 @@ const Yc = (t, e) => {
|
|
|
9278
9278
|
}, { message: `Must only contain the following values: ${t.values.join(", ")}` })), s = s.describe(`${r}Must only contain the following values: ${t.values.join(", ")}`)) : r && (s = s.describe(r.trim())), t.nullable && (s = s.nullable());
|
|
9279
9279
|
break;
|
|
9280
9280
|
case "Map":
|
|
9281
|
-
t.required && !i ? n ? s = qe({}).catchall(
|
|
9281
|
+
t.required && !i ? n ? s = qe({}).catchall(_e()).describe(`${r}Must be an object. Must contain at least one object property.`) : s = mn(_e()).refine((l) => l && typeof l == "object" && Object.keys(l).length > 0, {
|
|
9282
9282
|
message: "Must not be an empty value"
|
|
9283
|
-
}) : s = qe({}).catchall(
|
|
9283
|
+
}) : s = qe({}).catchall(_e()).describe(`${r}Must be an object`);
|
|
9284
9284
|
break;
|
|
9285
9285
|
case "Computed":
|
|
9286
|
-
s =
|
|
9286
|
+
s = _e();
|
|
9287
9287
|
}
|
|
9288
9288
|
return (!t.required || i || o) && (s = s.optional()), s;
|
|
9289
9289
|
}, bu = (t, e, n, s, r) => {
|
|
@@ -9296,13 +9296,13 @@ const Yc = (t, e) => {
|
|
|
9296
9296
|
})), c.max && (a[c.name] = a[c.name].refine((d) => c.max && (!d || Object.keys(d).length <= c.max), {
|
|
9297
9297
|
message: `Must contain at most ${c.max} item(s)`
|
|
9298
9298
|
})))) : a[c.name] = Ao(c, n, s), r && (a[c.name] = a[c.name].optional()));
|
|
9299
|
-
}), !s && i && (a.operation =
|
|
9300
|
-
a[`auth-${c.labels.collection}`] = on().optional(), a[`operations-${c.labels.collection}`] =
|
|
9299
|
+
}), !s && i && (a.operation = Se([Ie("create"), Ie("update"), Ie("delete")]).optional(), a.password = xe().optional(), a.passwordConfirm = xe().optional(), Object.values(e.collections).forEach((c) => {
|
|
9300
|
+
a[`auth-${c.labels.collection}`] = on().optional(), a[`operations-${c.labels.collection}`] = St(Se([Ie("Read"), Ie("Create"), Ie("Update"), Ie("Delete")])).optional(), a[`restrict-${c.labels.collection}`] = on().optional(), c.access.attributeRestrictions?.forEach((d) => {
|
|
9301
9301
|
a[`attribute-${c.labels.collection}-${d.type}`] = on().optional();
|
|
9302
9302
|
}), c.access.entityRestrictions?.restrictions?.forEach((d) => {
|
|
9303
|
-
if (d.type === "Individual" && (a[`accessible-${c.labels.collection}-${c.labels.collection}`] = qe({}).catchall(
|
|
9303
|
+
if (d.type === "Individual" && (a[`accessible-${c.labels.collection}-${c.labels.collection}`] = qe({}).catchall(_e()).optional()), d.type === "Parent" || d.type === "Parent_Property") {
|
|
9304
9304
|
const h = V(c.fields, d.collectionField);
|
|
9305
|
-
a[`accessible-${c.labels.collection}-${h.collection}`] = qe({}).catchall(
|
|
9305
|
+
a[`accessible-${c.labels.collection}-${h.collection}`] = qe({}).catchall(_e()).optional();
|
|
9306
9306
|
}
|
|
9307
9307
|
});
|
|
9308
9308
|
}));
|
|
@@ -9319,7 +9319,7 @@ const Yc = (t, e) => {
|
|
|
9319
9319
|
for (const a of s.fields)
|
|
9320
9320
|
await oi(a.custom?.preValidate, r);
|
|
9321
9321
|
return Ja(t, n, i).parse(e), e;
|
|
9322
|
-
}, lr = (t, e, n, s, r, i, o, a, l, c, d, h, u, f, g,
|
|
9322
|
+
}, lr = (t, e, n, s, r, i, o, a, l, c, d, h, u, f, g, R, m, E, w, x, k) => {
|
|
9323
9323
|
const { fields: v } = o;
|
|
9324
9324
|
v.filter((p) => "unique" in p && p.unique).forEach((p) => {
|
|
9325
9325
|
t !== "delete" && (typeof r[p.name] == "string" || typeof r[p.name] == "number") && (e.set(f(p, r[p.name].toString().toLowerCase().replace(/\s/g, "---").replaceAll("/", "|||")), {
|
|
@@ -9342,12 +9342,12 @@ const Yc = (t, e) => {
|
|
|
9342
9342
|
if (P.length === 0)
|
|
9343
9343
|
continue;
|
|
9344
9344
|
const y = rn(p, I.key), _ = {};
|
|
9345
|
-
P.forEach((
|
|
9345
|
+
P.forEach((T) => {
|
|
9346
9346
|
[
|
|
9347
|
-
|
|
9348
|
-
`${
|
|
9349
|
-
`${
|
|
9350
|
-
`${
|
|
9347
|
+
T.name,
|
|
9348
|
+
`${T.name}_Array`,
|
|
9349
|
+
`${T.name}_Single`,
|
|
9350
|
+
`${T.name}_Lowercase`
|
|
9351
9351
|
].forEach((F) => {
|
|
9352
9352
|
r[F] !== void 0 && (_[F] = r[F]);
|
|
9353
9353
|
});
|
|
@@ -9367,16 +9367,16 @@ const Yc = (t, e) => {
|
|
|
9367
9367
|
});
|
|
9368
9368
|
const P = l[p.labels.collection];
|
|
9369
9369
|
for (const _ of P)
|
|
9370
|
-
_.fields.some((
|
|
9370
|
+
_.fields.some((T) => T.name === C.name) && ee(C) && I++;
|
|
9371
9371
|
const y = _t(p);
|
|
9372
|
-
for (const [_,
|
|
9373
|
-
if (
|
|
9372
|
+
for (const [_, T] of Object.entries(y))
|
|
9373
|
+
if (T.length !== 0)
|
|
9374
9374
|
for (const U of P)
|
|
9375
9375
|
On(_, p, U).some((D) => D.name === C.name) && ee(C) && I++;
|
|
9376
9376
|
return I;
|
|
9377
9377
|
}, H = (p, C, I, P, y) => {
|
|
9378
9378
|
const _ = {};
|
|
9379
|
-
_[`${I.name}.${s}`] = h(), _[`${I.name}_Array`] = d(s), _[`${I.name}_Single`] = h(), e.update(
|
|
9379
|
+
_[`${I.name}.${s}`] = h(), _[`${I.name}_Array`] = d(s), _[`${I.name}_Single`] = h(), e.update(R(y, P), _), yt(I, C, i) && e.update(m(p, I.name, P), {
|
|
9380
9380
|
[`${I.name}.${s}`]: h(),
|
|
9381
9381
|
[`${I.name}_Array`]: d(s)
|
|
9382
9382
|
}), C.fields.forEach((F) => {
|
|
@@ -9384,22 +9384,22 @@ const Yc = (t, e) => {
|
|
|
9384
9384
|
[`${I.name}_Array`]: d(s)
|
|
9385
9385
|
});
|
|
9386
9386
|
});
|
|
9387
|
-
const
|
|
9388
|
-
for (const F of
|
|
9387
|
+
const T = l[C.labels.collection];
|
|
9388
|
+
for (const F of T)
|
|
9389
9389
|
F.fields.some((D) => D.name === I.name) && ee(I) && e.update(E(p, F.key, P), _);
|
|
9390
9390
|
const U = _t(C);
|
|
9391
9391
|
for (const [F, D] of Object.entries(U))
|
|
9392
9392
|
if (D.length !== 0)
|
|
9393
|
-
for (const M of
|
|
9393
|
+
for (const M of T) {
|
|
9394
9394
|
const J = On(F, C, M), z = rn(F, M.key);
|
|
9395
9395
|
J.some((b) => b.name === I.name) && ee(I) && e.update(E(p, z, P), _);
|
|
9396
9396
|
}
|
|
9397
9397
|
};
|
|
9398
9398
|
if (t === "delete")
|
|
9399
9399
|
return;
|
|
9400
|
-
const
|
|
9400
|
+
const S = v.filter((p) => ee(p) && p.twoWay);
|
|
9401
9401
|
if (!a?.noTwoWay) {
|
|
9402
|
-
for (const p of
|
|
9402
|
+
for (const p of S) {
|
|
9403
9403
|
if (!k)
|
|
9404
9404
|
throw new Error("VALIDATION_ERROR: batchSize is required");
|
|
9405
9405
|
const C = i.collections[p.collection], I = V(C.fields, p.twoWay), P = Et(C, C.fields), y = Array.from(P).map((_) => _.name);
|
|
@@ -9407,17 +9407,17 @@ const Yc = (t, e) => {
|
|
|
9407
9407
|
throw new Error(`SCHEMA_ERROR: Field ${p.twoWay} not found in collection ${p.collection}`);
|
|
9408
9408
|
if (ee(I)) {
|
|
9409
9409
|
if (r[`${p.name}_Array`])
|
|
9410
|
-
for (const [_,
|
|
9410
|
+
for (const [_, T] of Object.entries(r[p.name])) {
|
|
9411
9411
|
if (t === "update" && w && w[`${p.name}_Array`]?.includes(_))
|
|
9412
9412
|
continue;
|
|
9413
9413
|
const U = { ...w, ...r };
|
|
9414
|
-
|
|
9414
|
+
Qe(U);
|
|
9415
9415
|
const F = {};
|
|
9416
9416
|
I.includeFields && I.includeFields.forEach((b) => {
|
|
9417
9417
|
if (U[b] !== void 0) {
|
|
9418
9418
|
F[b] = U[b];
|
|
9419
9419
|
const B = V(o.fields, b);
|
|
9420
|
-
|
|
9420
|
+
Tt(o, [B]).size === 1 && (F[`${b}_Lowercase`] = U[`${b}_Lowercase`]);
|
|
9421
9421
|
}
|
|
9422
9422
|
});
|
|
9423
9423
|
const D = {
|
|
@@ -9433,7 +9433,7 @@ const Yc = (t, e) => {
|
|
|
9433
9433
|
...F
|
|
9434
9434
|
});
|
|
9435
9435
|
const M = Mn(r);
|
|
9436
|
-
e.update(T
|
|
9436
|
+
e.update(R(T.Collection_Path, _), {
|
|
9437
9437
|
...D,
|
|
9438
9438
|
...M
|
|
9439
9439
|
}), k.size++, yt(I, C, i) && (e.update(m(p, I.name, _), {
|
|
@@ -9462,12 +9462,12 @@ const Yc = (t, e) => {
|
|
|
9462
9462
|
for (const [b, B] of Object.entries(z))
|
|
9463
9463
|
if (B.length !== 0)
|
|
9464
9464
|
for (const K of J) {
|
|
9465
|
-
const le = On(b, C, K),
|
|
9465
|
+
const le = On(b, C, K), Te = rn(b, K.key);
|
|
9466
9466
|
if (le.some((oe) => oe.name === I.name)) {
|
|
9467
9467
|
const oe = { ...D };
|
|
9468
9468
|
Object.keys(M).forEach((ce) => {
|
|
9469
|
-
le.some((
|
|
9470
|
-
}), Object.keys(oe).length > 0 && (e.update(E(p,
|
|
9469
|
+
le.some((De) => De.name === ce) && (oe[ce] = M[ce]);
|
|
9470
|
+
}), Object.keys(oe).length > 0 && (e.update(E(p, Te, _), oe), k.size++);
|
|
9471
9471
|
}
|
|
9472
9472
|
}
|
|
9473
9473
|
}
|
|
@@ -9475,27 +9475,27 @@ const Yc = (t, e) => {
|
|
|
9475
9475
|
throw new Error(`SCHEMA_ERROR: Invalid field type: ${I.type}`);
|
|
9476
9476
|
}
|
|
9477
9477
|
k && k.size > 500 && console.error(new Error(`VALIDATION_ERROR: ${k.size} operations in the Firestore transaction has exceeded the recommended limit of 500. This is likely due to a large number of two way updates, roles, dependencies on the collection, unique field checks, entity restrictions (in permissions when dealing with user collections) or relation hierarchy checks.`));
|
|
9478
|
-
for (const p of
|
|
9478
|
+
for (const p of S) {
|
|
9479
9479
|
if (!k)
|
|
9480
9480
|
throw new Error("VALIDATION_ERROR: batchSize is required");
|
|
9481
9481
|
const C = i.collections[p.collection], I = V(C.fields, p.twoWay);
|
|
9482
9482
|
if (!I)
|
|
9483
9483
|
throw new Error(`SCHEMA_ERROR: Field ${p.twoWay} not found in collection ${p.collection}`);
|
|
9484
9484
|
if (ee(I)) {
|
|
9485
|
-
if (t === "update" && w && !(r[p.name] &&
|
|
9485
|
+
if (t === "update" && w && !(r[p.name] && ke(r[p.name])) && r[`${p.name}_Array`] && w[`${p.name}_Array`]?.length > 0)
|
|
9486
9486
|
for (const [P, y] of Object.entries(w[p.name]))
|
|
9487
9487
|
!r[`${p.name}_Array`].includes(P) && !x?.get(p.name)?.includes(P) && (k.size += O(C, I), k.size <= 500 && H(p, C, I, P, y.Collection_Path));
|
|
9488
9488
|
} else
|
|
9489
9489
|
throw new Error(`SCHEMA_ERROR: Invalid field type: ${I.type}`);
|
|
9490
9490
|
}
|
|
9491
|
-
for (const p of
|
|
9491
|
+
for (const p of S) {
|
|
9492
9492
|
if (!k)
|
|
9493
9493
|
throw new Error("VALIDATION_ERROR: batchSize is required");
|
|
9494
9494
|
const C = i.collections[p.collection], I = V(C.fields, p.twoWay);
|
|
9495
9495
|
if (!I)
|
|
9496
9496
|
throw new Error(`SCHEMA_ERROR: Field ${p.twoWay} not found in collection ${p.collection}`);
|
|
9497
9497
|
if (ee(I)) {
|
|
9498
|
-
if (t === "update" && w && r[p.name] &&
|
|
9498
|
+
if (t === "update" && w && r[p.name] && ke(r[p.name]) && w[`${p.name}_Array`]?.length > 0)
|
|
9499
9499
|
for (const [P, y] of Object.entries(w[p.name]))
|
|
9500
9500
|
x?.get(p.name)?.includes(P) || (k.size += O(C, I), k.size <= 500 && H(p, C, I, P, y.Collection_Path));
|
|
9501
9501
|
} else
|
|
@@ -9584,13 +9584,13 @@ const Ft = {
|
|
|
9584
9584
|
return Fo;
|
|
9585
9585
|
},
|
|
9586
9586
|
getGlobalConfigModule() {
|
|
9587
|
-
return
|
|
9587
|
+
return ge(nn);
|
|
9588
9588
|
},
|
|
9589
9589
|
getCustomizationFile(t, e) {
|
|
9590
9590
|
if (!Object.keys(e.collections).includes(t))
|
|
9591
9591
|
throw new Error("PERMISSION_DENIED");
|
|
9592
9592
|
const n = pa([t], $o, "node", Ft);
|
|
9593
|
-
return
|
|
9593
|
+
return ge(n?.[t]);
|
|
9594
9594
|
},
|
|
9595
9595
|
getVersionInfo() {
|
|
9596
9596
|
return Fn;
|
|
@@ -9599,7 +9599,7 @@ const Ft = {
|
|
|
9599
9599
|
return $n;
|
|
9600
9600
|
},
|
|
9601
9601
|
getStokerFirestore: he
|
|
9602
|
-
},
|
|
9602
|
+
}, Ru = async (t, e, n, s, r) => {
|
|
9603
9603
|
const i = !!ci;
|
|
9604
9604
|
if (ci = !0, e && (Cn = e), Co = t, ks && !r)
|
|
9605
9605
|
return Ft;
|
|
@@ -9617,7 +9617,7 @@ const Ft = {
|
|
|
9617
9617
|
projectId: a.projectId
|
|
9618
9618
|
});
|
|
9619
9619
|
}
|
|
9620
|
-
const h = await
|
|
9620
|
+
const h = await nt();
|
|
9621
9621
|
return $o = await eu(s, Object.keys(h.collections)), Fo = await ae(nn.timezone), i || he().collection("system_deployment").doc("maintenance_mode").onSnapshot((u) => {
|
|
9622
9622
|
u.exists ? ($n = u.data(), ae(nn.onMaintenanceUpdate, ["node", $n.active ? "on" : "off"])) : console.error("Maintenance status not found");
|
|
9623
9623
|
}, (u) => {
|
|
@@ -9632,7 +9632,7 @@ const Ft = {
|
|
|
9632
9632
|
};
|
|
9633
9633
|
f();
|
|
9634
9634
|
}), Ft;
|
|
9635
|
-
}, { getTenant:
|
|
9635
|
+
}, { getTenant: st, setTenant: Tu, getMode: Mo, getTimezone: Po, getGlobalConfigModule: Gt, getCustomizationFile: mt, getVersionInfo: Su, getMaintenanceInfo: Iu } = Ft, xu = async (t, e, n, s) => new Promise((r, i) => {
|
|
9636
9636
|
const o = ta(t, e, { cwd: n || process.cwd(), env: { ...process.env, ...s } });
|
|
9637
9637
|
let a = "";
|
|
9638
9638
|
const l = () => {
|
|
@@ -9664,13 +9664,13 @@ const Ft = {
|
|
|
9664
9664
|
projectId: e.projectId
|
|
9665
9665
|
});
|
|
9666
9666
|
}
|
|
9667
|
-
},
|
|
9667
|
+
}, nt = async (t = !1) => {
|
|
9668
9668
|
const s = await pi().ref("schema").orderByChild("published_time").limitToLast(1).get(), r = Object.values(s.val())[0];
|
|
9669
9669
|
if (t) {
|
|
9670
9670
|
for (const i of Object.values(r.collections))
|
|
9671
9671
|
for (const o of i.fields)
|
|
9672
9672
|
if (o.type === "Computed") {
|
|
9673
|
-
const a =
|
|
9673
|
+
const a = We(o, mt(i.labels.collection, r));
|
|
9674
9674
|
a.formula && (o.formula = a.formula);
|
|
9675
9675
|
}
|
|
9676
9676
|
} else
|
|
@@ -9681,7 +9681,7 @@ const Ft = {
|
|
|
9681
9681
|
const n = await pi().ref("schema").orderByChild("published_time").limitToLast(2).get();
|
|
9682
9682
|
if (!(n.numChildren() < 2))
|
|
9683
9683
|
return Object.values(n.val())[0];
|
|
9684
|
-
},
|
|
9684
|
+
}, Me = (t, e, n) => {
|
|
9685
9685
|
let s = t.collection("tenants").doc(n);
|
|
9686
9686
|
for (let r = 0; r < e.length; r++)
|
|
9687
9687
|
r % 2 === 0 ? s = s.collection(e[r]) : s = s.doc(e[r]);
|
|
@@ -9690,18 +9690,18 @@ const Ft = {
|
|
|
9690
9690
|
const o = he(), a = e.at(-1);
|
|
9691
9691
|
if (!a)
|
|
9692
9692
|
throw new Error("EMPTY_PATH");
|
|
9693
|
-
const l = n.collections[a], { labels: c, fields: d, preloadCache: h } = l, u = mt(a, n), f =
|
|
9693
|
+
const l = n.collections[a], { labels: c, fields: d, preloadCache: h } = l, u = mt(a, n), f = Me(o, e, t);
|
|
9694
9694
|
if (r)
|
|
9695
9695
|
if (s) {
|
|
9696
9696
|
const g = r.collections?.[c.collection];
|
|
9697
9697
|
if (!r.Role)
|
|
9698
9698
|
throw new Error("PERMISSION_DENIED");
|
|
9699
|
-
const
|
|
9700
|
-
const _ = [],
|
|
9701
|
-
if (!
|
|
9699
|
+
const R = g && Ne("Read", g), m = Ei(l, n, r, i ?? {}), E = wi(l, r), w = Gs(l, r), x = _i(l, n, r), k = (y = []) => {
|
|
9700
|
+
const _ = [], T = bi(r.Role, l, n);
|
|
9701
|
+
if (!T)
|
|
9702
9702
|
throw new Error("PERMISSION_DENIED");
|
|
9703
|
-
if (
|
|
9704
|
-
let U = o.collection("tenants").doc(t).collection("system_fields").doc(c.collection).collection(`${c.collection}-${
|
|
9703
|
+
if (R) {
|
|
9704
|
+
let U = o.collection("tenants").doc(t).collection("system_fields").doc(c.collection).collection(`${c.collection}-${T.key}`).where("Collection_Path_String", "==", e.join("/"));
|
|
9705
9705
|
y.forEach((D) => {
|
|
9706
9706
|
U = U.where(...D);
|
|
9707
9707
|
}), _.push(U);
|
|
@@ -9709,7 +9709,7 @@ const Ft = {
|
|
|
9709
9709
|
Object.entries(l.fieldAccessGroups || {}).forEach(([D, M]) => {
|
|
9710
9710
|
if (!F[D]?.length || !Xn(M, c.collection, r, i ?? {}))
|
|
9711
9711
|
return;
|
|
9712
|
-
const J = rn(D,
|
|
9712
|
+
const J = rn(D, T.key);
|
|
9713
9713
|
let z = o.collection("tenants").doc(t).collection("system_fields").doc(c.collection).collection(`${c.collection}-${J}`).where("Collection_Path_String", "==", e.join("/"));
|
|
9714
9714
|
y.forEach((b) => {
|
|
9715
9715
|
z = z.where(...b);
|
|
@@ -9733,7 +9733,7 @@ const Ft = {
|
|
|
9733
9733
|
if (v.length > 0) {
|
|
9734
9734
|
for (const y of v)
|
|
9735
9735
|
if (y.operations && y.type === "Record_Property") {
|
|
9736
|
-
const _ = y.roles.find((
|
|
9736
|
+
const _ = y.roles.find((T) => T.role === r.Role);
|
|
9737
9737
|
if (!_)
|
|
9738
9738
|
throw new Error("PERMISSION_DENIED");
|
|
9739
9739
|
W(_.values?.length);
|
|
@@ -9742,42 +9742,42 @@ const Ft = {
|
|
|
9742
9742
|
h?.roles.includes(r.Role) && h.range && W(h.range.fields.length);
|
|
9743
9743
|
const O = u.admin?.statusField;
|
|
9744
9744
|
O && !h?.roles.includes(r.Role) && W(Math.max(O.active?.length || 0, O.archived?.length || 0));
|
|
9745
|
-
const H = N === 0 ? 30 : Math.max(1, Math.floor(30 / N)),
|
|
9746
|
-
v.filter((y) => y.type === "Record_Owner").forEach(() =>
|
|
9745
|
+
const H = N === 0 ? 30 : Math.max(1, Math.floor(30 / N)), S = [];
|
|
9746
|
+
v.filter((y) => y.type === "Record_Owner").forEach(() => S.push(["Created_By", "==", s])), v.filter((y) => y.type === "Record_User").forEach((y) => {
|
|
9747
9747
|
if ("collectionField" in y) {
|
|
9748
9748
|
const _ = V(d, y.collectionField);
|
|
9749
|
-
|
|
9749
|
+
S.push([`${_.name}_Array`, "array-contains", r.Doc_ID]);
|
|
9750
9750
|
}
|
|
9751
9751
|
}), v.filter((y) => y.type === "Record_Property").forEach((y) => {
|
|
9752
9752
|
if ("propertyField" in y) {
|
|
9753
9753
|
const _ = y.roles.find((U) => U.role === r.Role);
|
|
9754
9754
|
if (!_)
|
|
9755
9755
|
throw new Error("PERMISSION_DENIED");
|
|
9756
|
-
const
|
|
9757
|
-
|
|
9756
|
+
const T = V(d, y.propertyField);
|
|
9757
|
+
T.type === "Array" ? S.push([`${T.name}_Array`, "array-contains-any", _.values]) : S.push([T.name, "in", _.values]);
|
|
9758
9758
|
}
|
|
9759
9759
|
});
|
|
9760
9760
|
const p = [];
|
|
9761
9761
|
w.filter((y) => y.type === "Individual").forEach((y) => {
|
|
9762
|
-
const _ = g?.individualEntities,
|
|
9762
|
+
const _ = g?.individualEntities, T = [];
|
|
9763
9763
|
if (_) {
|
|
9764
9764
|
const U = y.singleQuery ? y.singleQuery : H;
|
|
9765
9765
|
for (let F = 0; F < _.length; F += U) {
|
|
9766
9766
|
const D = _.slice(F, F + U);
|
|
9767
|
-
|
|
9767
|
+
T.push(D);
|
|
9768
9768
|
}
|
|
9769
9769
|
if (!y.singleQuery)
|
|
9770
|
-
|
|
9771
|
-
p.push(...k(
|
|
9770
|
+
T.forEach((F) => {
|
|
9771
|
+
p.push(...k(S.concat([["id", "in", F]])));
|
|
9772
9772
|
});
|
|
9773
9773
|
else {
|
|
9774
9774
|
if (_.length > U)
|
|
9775
9775
|
throw new Error(`INPUT_ERROR: Individual entity restriction with singleQuery set to true must not have more than ${y.singleQuery} entities`);
|
|
9776
|
-
|
|
9776
|
+
S.push(["id", "in", _]);
|
|
9777
9777
|
}
|
|
9778
9778
|
}
|
|
9779
9779
|
}), x.filter((y) => y.parentFilter.type === "Individual").forEach((y) => {
|
|
9780
|
-
const { parentFilter: _, parentRestriction:
|
|
9780
|
+
const { parentFilter: _, parentRestriction: T } = y;
|
|
9781
9781
|
if ("collectionField" in _) {
|
|
9782
9782
|
const U = V(d, _.collectionField);
|
|
9783
9783
|
if ("collection" in U) {
|
|
@@ -9786,19 +9786,19 @@ const Ft = {
|
|
|
9786
9786
|
throw new Error("PERMISSION_DENIED");
|
|
9787
9787
|
const D = F.individualEntities, M = [];
|
|
9788
9788
|
if (D) {
|
|
9789
|
-
const J =
|
|
9789
|
+
const J = T.singleQuery ? T.singleQuery : H;
|
|
9790
9790
|
for (let z = 0; z < D.length; z += J) {
|
|
9791
9791
|
const b = D.slice(z, z + J);
|
|
9792
9792
|
M.push(b);
|
|
9793
9793
|
}
|
|
9794
|
-
if (!
|
|
9794
|
+
if (!T.singleQuery)
|
|
9795
9795
|
M.forEach((z) => {
|
|
9796
|
-
p.push(...k(
|
|
9796
|
+
p.push(...k(S.concat([[`${U.name}_Array`, "array-contains-any", z]])));
|
|
9797
9797
|
});
|
|
9798
9798
|
else {
|
|
9799
9799
|
if (D.length > J)
|
|
9800
|
-
throw new Error(`INPUT_ERROR: Individual entity parentFilter with singleQuery set to true must not have more than ${
|
|
9801
|
-
|
|
9800
|
+
throw new Error(`INPUT_ERROR: Individual entity parentFilter with singleQuery set to true must not have more than ${T.singleQuery} entities`);
|
|
9801
|
+
S.push([`${U.name}_Array`, "array-contains-any", D]);
|
|
9802
9802
|
}
|
|
9803
9803
|
}
|
|
9804
9804
|
}
|
|
@@ -9809,27 +9809,27 @@ const Ft = {
|
|
|
9809
9809
|
if ("collectionField" in y) {
|
|
9810
9810
|
const _ = V(d, y.collectionField);
|
|
9811
9811
|
if ("collection" in _) {
|
|
9812
|
-
const
|
|
9813
|
-
if (
|
|
9812
|
+
const T = g?.parentEntities, U = [];
|
|
9813
|
+
if (T) {
|
|
9814
9814
|
const F = y.singleQuery ? y.singleQuery : H;
|
|
9815
|
-
for (let D = 0; D <
|
|
9816
|
-
const M =
|
|
9815
|
+
for (let D = 0; D < T.length; D += F) {
|
|
9816
|
+
const M = T.slice(D, D + F);
|
|
9817
9817
|
U.push(M);
|
|
9818
9818
|
}
|
|
9819
9819
|
if (!y.singleQuery)
|
|
9820
9820
|
U.forEach((D) => {
|
|
9821
|
-
C.push(...k(
|
|
9821
|
+
C.push(...k(S.concat([[`${_.name}_Array`, "array-contains-any", D]])));
|
|
9822
9822
|
});
|
|
9823
9823
|
else {
|
|
9824
|
-
if (
|
|
9824
|
+
if (T && T.length > F)
|
|
9825
9825
|
throw new Error(`INPUT_ERROR: Parent entity restriction with singleQuery set to true must not have more than ${y.singleQuery} entities`);
|
|
9826
|
-
|
|
9826
|
+
S.push([`${_.name}_Array`, "array-contains-any", T]);
|
|
9827
9827
|
}
|
|
9828
9828
|
}
|
|
9829
9829
|
}
|
|
9830
9830
|
}
|
|
9831
9831
|
}), x.filter((y) => y.parentFilter.type === "Parent").forEach((y) => {
|
|
9832
|
-
const { parentFilter: _, parentRestriction:
|
|
9832
|
+
const { parentFilter: _, parentRestriction: T } = y;
|
|
9833
9833
|
if ("collectionField" in _ && "parentCollectionField" in _) {
|
|
9834
9834
|
const U = V(d, _.collectionField), F = V(d, _.parentCollectionField);
|
|
9835
9835
|
if ("collection" in U && "collection" in F) {
|
|
@@ -9838,21 +9838,21 @@ const Ft = {
|
|
|
9838
9838
|
throw new Error("PERMISSION_DENIED");
|
|
9839
9839
|
const M = D.parentEntities, J = [];
|
|
9840
9840
|
if (M) {
|
|
9841
|
-
const z =
|
|
9841
|
+
const z = T.singleQuery ? T.singleQuery : H;
|
|
9842
9842
|
for (let b = 0; b < M.length; b += z) {
|
|
9843
9843
|
const B = M.slice(b, b + z);
|
|
9844
9844
|
J.push(B);
|
|
9845
9845
|
}
|
|
9846
|
-
if (!
|
|
9846
|
+
if (!T.singleQuery)
|
|
9847
9847
|
J.forEach((b) => {
|
|
9848
|
-
C.push(...k(
|
|
9848
|
+
C.push(...k(S.concat([
|
|
9849
9849
|
[`${F.name}_Array`, "array-contains-any", b]
|
|
9850
9850
|
])));
|
|
9851
9851
|
});
|
|
9852
9852
|
else {
|
|
9853
9853
|
if (M && M.length > z)
|
|
9854
|
-
throw new Error(`INPUT_ERROR: Profile_Parent entity parentFilter with singleQuery set to true must not have more than ${
|
|
9855
|
-
|
|
9854
|
+
throw new Error(`INPUT_ERROR: Profile_Parent entity parentFilter with singleQuery set to true must not have more than ${T.singleQuery} entities`);
|
|
9855
|
+
S.push([
|
|
9856
9856
|
`${F.name}_Array`,
|
|
9857
9857
|
"array-contains-any",
|
|
9858
9858
|
M
|
|
@@ -9865,7 +9865,7 @@ const Ft = {
|
|
|
9865
9865
|
const I = [];
|
|
9866
9866
|
C.length === 0 && (w.filter((y) => y.type === "Parent_Property").forEach((y) => {
|
|
9867
9867
|
if ("collectionField" in y && "propertyField" in y) {
|
|
9868
|
-
const _ = V(d, y.collectionField),
|
|
9868
|
+
const _ = V(d, y.collectionField), T = V(d, y.propertyField);
|
|
9869
9869
|
if ("collection" in _) {
|
|
9870
9870
|
const U = g?.parentPropertyEntities || {};
|
|
9871
9871
|
Object.entries(U).forEach(([F, D]) => {
|
|
@@ -9876,9 +9876,9 @@ const Ft = {
|
|
|
9876
9876
|
M.push(z);
|
|
9877
9877
|
}
|
|
9878
9878
|
M.forEach((J) => {
|
|
9879
|
-
I.push(...k(
|
|
9879
|
+
I.push(...k(S.concat([
|
|
9880
9880
|
[`${_.name}_Array`, "array-contains-any", J],
|
|
9881
|
-
[
|
|
9881
|
+
[T.name, "==", F]
|
|
9882
9882
|
])));
|
|
9883
9883
|
});
|
|
9884
9884
|
}
|
|
@@ -9888,9 +9888,9 @@ const Ft = {
|
|
|
9888
9888
|
}), x.filter((y) => y.parentFilter.type === "Parent_Property").forEach((y) => {
|
|
9889
9889
|
const { parentFilter: _ } = y;
|
|
9890
9890
|
if ("collectionField" in _ && "parentCollectionField" in _ && "parentPropertyField" in _) {
|
|
9891
|
-
const
|
|
9892
|
-
if ("collection" in
|
|
9893
|
-
const D = r.collections?.[
|
|
9891
|
+
const T = V(d, _.collectionField), U = V(d, _.parentCollectionField), F = V(d, _.parentPropertyField);
|
|
9892
|
+
if ("collection" in T && "collection" in U) {
|
|
9893
|
+
const D = r.collections?.[T.collection];
|
|
9894
9894
|
if (!D)
|
|
9895
9895
|
throw new Error("PERMISSION_DENIED");
|
|
9896
9896
|
const M = D.parentPropertyEntities || {};
|
|
@@ -9902,7 +9902,7 @@ const Ft = {
|
|
|
9902
9902
|
b.push(K);
|
|
9903
9903
|
}
|
|
9904
9904
|
b.forEach((B) => {
|
|
9905
|
-
I.push(...k(
|
|
9905
|
+
I.push(...k(S.concat([
|
|
9906
9906
|
[
|
|
9907
9907
|
`${U.name}_Array`,
|
|
9908
9908
|
"array-contains-any",
|
|
@@ -9917,7 +9917,7 @@ const Ft = {
|
|
|
9917
9917
|
}
|
|
9918
9918
|
}));
|
|
9919
9919
|
const P = [...p, ...C, ...I];
|
|
9920
|
-
return !w.length && !x.length ? k(
|
|
9920
|
+
return !w.length && !x.length ? k(S) : P;
|
|
9921
9921
|
} else
|
|
9922
9922
|
throw new Error("PERMISSION_DENIED");
|
|
9923
9923
|
else return [f];
|
|
@@ -9925,21 +9925,21 @@ const Ft = {
|
|
|
9925
9925
|
const o = he(), a = e.at(-1);
|
|
9926
9926
|
if (!a)
|
|
9927
9927
|
throw new Error("EMPTY_PATH");
|
|
9928
|
-
const l = s.collections[a], { labels: c } = l, d =
|
|
9928
|
+
const l = s.collections[a], { labels: c } = l, d = Me(o, e, t);
|
|
9929
9929
|
if (r) {
|
|
9930
9930
|
const h = r.collections?.[c.collection];
|
|
9931
9931
|
if (!r.Role)
|
|
9932
9932
|
throw new Error("PERMISSION_DENIED");
|
|
9933
|
-
const u = h &&
|
|
9934
|
-
if (!
|
|
9933
|
+
const u = h && Ne("Read", h), f = Ei(l, s, r, i ?? {}), g = [], R = bi(r.Role, l, s);
|
|
9934
|
+
if (!R)
|
|
9935
9935
|
throw new Error("PERMISSION_DENIED");
|
|
9936
9936
|
if (u) {
|
|
9937
|
-
g.push(o.collection("tenants").doc(t).collection("system_fields").doc(c.collection).collection(`${c.collection}-${
|
|
9937
|
+
g.push(o.collection("tenants").doc(t).collection("system_fields").doc(c.collection).collection(`${c.collection}-${R.key}`).doc(n));
|
|
9938
9938
|
const m = _t(l);
|
|
9939
9939
|
Object.entries(l.fieldAccessGroups || {}).forEach(([E, w]) => {
|
|
9940
9940
|
if (!m[E]?.length || !Xn(w, c.collection, r, i ?? {}))
|
|
9941
9941
|
return;
|
|
9942
|
-
const x = rn(E,
|
|
9942
|
+
const x = rn(E, R.key);
|
|
9943
9943
|
g.push(o.collection("tenants").doc(t).collection("system_fields").doc(c.collection).collection(`${c.collection}-${x}`).doc(n));
|
|
9944
9944
|
});
|
|
9945
9945
|
} else if (f)
|
|
@@ -9948,14 +9948,14 @@ const Ft = {
|
|
|
9948
9948
|
return g;
|
|
9949
9949
|
} else
|
|
9950
9950
|
return [d.doc(n)];
|
|
9951
|
-
}, os = async (t) => await
|
|
9951
|
+
}, os = async (t) => await Rt().getUser(t), Vo = async (t, e, n, s, r, i, o, a, l, c) => {
|
|
9952
9952
|
const d = n.at(-2), h = vi(r.collections[d], r).map((g) => g.labels.collection);
|
|
9953
9953
|
s.collections ? s.collections.forEach((g) => {
|
|
9954
9954
|
if (!h.includes(g))
|
|
9955
9955
|
throw new Error(`SCHEMA_ERROR: Collection ${g} not found in subcollections of ${d}`);
|
|
9956
9956
|
}) : s.collections = h;
|
|
9957
9957
|
const u = s.depth - 1, f = s.collections.map(async (g) => {
|
|
9958
|
-
const
|
|
9958
|
+
const R = await Uo([...n, g], {
|
|
9959
9959
|
constraints: s.constraints,
|
|
9960
9960
|
userId: a,
|
|
9961
9961
|
pagination: s.limit,
|
|
@@ -9964,7 +9964,7 @@ const Ft = {
|
|
|
9964
9964
|
}).catch((m) => {
|
|
9965
9965
|
throw m.code === "permission-denied" && console.info(`PERMISSION_DENIED for subcollection ${g} for document at ${n.join("/")}`), m;
|
|
9966
9966
|
});
|
|
9967
|
-
e[g] =
|
|
9967
|
+
e[g] = R.records, i && await Promise.all(
|
|
9968
9968
|
// eslint-disable-next-line security/detect-object-injection
|
|
9969
9969
|
e[g].map((m) => cr(t, m, [...n, g, m.id], i, r, void 0, a, l, c))
|
|
9970
9970
|
), u > 0 && await Promise.all(
|
|
@@ -9983,18 +9983,18 @@ const Ft = {
|
|
|
9983
9983
|
if (!f)
|
|
9984
9984
|
continue;
|
|
9985
9985
|
const g = Object.keys(f);
|
|
9986
|
-
for (const
|
|
9987
|
-
const m = f[
|
|
9986
|
+
for (const R of g) {
|
|
9987
|
+
const m = f[R], E = Xe(m.Collection_Path, R, {
|
|
9988
9988
|
userId: o,
|
|
9989
9989
|
providedTransaction: a,
|
|
9990
9990
|
noEmbeddingFields: l
|
|
9991
9991
|
}).then((w) => {
|
|
9992
|
-
if (f[
|
|
9992
|
+
if (f[R] = w, d > 0)
|
|
9993
9993
|
return cr(
|
|
9994
9994
|
t,
|
|
9995
9995
|
// eslint-disable-next-line security/detect-object-injection
|
|
9996
|
-
f[
|
|
9997
|
-
[...m.Collection_Path,
|
|
9996
|
+
f[R],
|
|
9997
|
+
[...m.Collection_Path, R],
|
|
9998
9998
|
{ depth: d },
|
|
9999
9999
|
r,
|
|
10000
10000
|
i,
|
|
@@ -10004,7 +10004,7 @@ const Ft = {
|
|
|
10004
10004
|
);
|
|
10005
10005
|
}).catch((w) => {
|
|
10006
10006
|
if (w.message.includes("NOT_FOUND") || w.code === "permission-denied")
|
|
10007
|
-
delete f[
|
|
10007
|
+
delete f[R];
|
|
10008
10008
|
else
|
|
10009
10009
|
throw w;
|
|
10010
10010
|
});
|
|
@@ -10022,28 +10022,28 @@ const Ft = {
|
|
|
10022
10022
|
if (typeof c != "number" || !Number.isFinite(c) || !Number.isInteger(c) || c < 1)
|
|
10023
10023
|
throw new Error("INPUT_ERROR: Pagination number must be a positive finite integer");
|
|
10024
10024
|
}
|
|
10025
|
-
const n = e?.constraints, s =
|
|
10025
|
+
const n = e?.constraints, s = st(), r = he();
|
|
10026
10026
|
let i, o, a;
|
|
10027
10027
|
const l = async (c) => {
|
|
10028
10028
|
const [d, h, u, f] = await Promise.all([
|
|
10029
10029
|
e?.userId ? c.get(r.collection("tenants").doc(s).collection("system_user_permissions").doc(e.userId)) : Promise.resolve({}),
|
|
10030
10030
|
c.get(r.collection("system_deployment").doc("maintenance_mode")),
|
|
10031
|
-
|
|
10031
|
+
nt(!0),
|
|
10032
10032
|
e?.userId ? os(e.userId) : Promise.resolve(void 0)
|
|
10033
10033
|
]);
|
|
10034
10034
|
if (!h.exists)
|
|
10035
10035
|
throw new Error("MAINTENANCE_MODE");
|
|
10036
10036
|
if (h.data().active)
|
|
10037
10037
|
throw new Error("MAINTENANCE_MODE");
|
|
10038
|
-
const
|
|
10038
|
+
const R = u;
|
|
10039
10039
|
let m;
|
|
10040
10040
|
const E = Gt(), w = t.at(-1);
|
|
10041
10041
|
if (!w)
|
|
10042
10042
|
throw new Error("EMPTY_PATH");
|
|
10043
|
-
const x = Object.keys(
|
|
10043
|
+
const x = Object.keys(R.collections).includes(w), k = E.disabledCollections?.includes(w);
|
|
10044
10044
|
if (!x || k)
|
|
10045
10045
|
throw new Error("COLLECTION_NOT_FOUND");
|
|
10046
|
-
const v =
|
|
10046
|
+
const v = R.collections[w], { labels: N } = v, W = mt(N.collection, R);
|
|
10047
10047
|
if (e?.userId) {
|
|
10048
10048
|
if (!d?.exists)
|
|
10049
10049
|
throw new Error("PERMISSION_DENIED");
|
|
@@ -10055,7 +10055,7 @@ const Ft = {
|
|
|
10055
10055
|
let O = tu(
|
|
10056
10056
|
s,
|
|
10057
10057
|
t,
|
|
10058
|
-
|
|
10058
|
+
R,
|
|
10059
10059
|
e?.userId,
|
|
10060
10060
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
10061
10061
|
m,
|
|
@@ -10063,8 +10063,8 @@ const Ft = {
|
|
|
10063
10063
|
);
|
|
10064
10064
|
if (O.length === 0)
|
|
10065
10065
|
return { cursor: {}, pages: 0, records: [] };
|
|
10066
|
-
if (n && (O = O.map((y) => (n.forEach(([_,
|
|
10067
|
-
y = y.where(_,
|
|
10066
|
+
if (n && (O = O.map((y) => (n.forEach(([_, T, U]) => {
|
|
10067
|
+
y = y.where(_, T, U);
|
|
10068
10068
|
}), y))), o = e?.pagination?.startAfter || e?.pagination?.endBefore || {
|
|
10069
10069
|
first: /* @__PURE__ */ new Map(),
|
|
10070
10070
|
last: /* @__PURE__ */ new Map()
|
|
@@ -10073,11 +10073,11 @@ const Ft = {
|
|
|
10073
10073
|
throw new Error("INPUT_ERROR: startAfter and endBefore cannot be provided together");
|
|
10074
10074
|
const y = e.pagination.startAfter || e.pagination.endBefore;
|
|
10075
10075
|
if (e?.userId) {
|
|
10076
|
-
const _ = ma(m.Role, v,
|
|
10076
|
+
const _ = ma(m.Role, v, R);
|
|
10077
10077
|
if (y && _ !== !0)
|
|
10078
10078
|
throw new Error("INPUT_ERROR: Pagination is not allowed when using " + _);
|
|
10079
10079
|
}
|
|
10080
|
-
e.pagination.orderByField && e.pagination.orderByDirection ? !e.pagination.startAfter && !e.pagination.endBefore ? O = O.map((_) => _.orderBy(e.pagination.orderByField, e.pagination.orderByDirection).limit(e.pagination.number)) : e.pagination.startAfter ? O = O.map((_,
|
|
10080
|
+
e.pagination.orderByField && e.pagination.orderByDirection ? !e.pagination.startAfter && !e.pagination.endBefore ? O = O.map((_) => _.orderBy(e.pagination.orderByField, e.pagination.orderByDirection).limit(e.pagination.number)) : e.pagination.startAfter ? O = O.map((_, T) => _.orderBy(e.pagination.orderByField, e.pagination.orderByDirection).startAfter(o.last.get(T)).limit(e.pagination.number)) : O = O.map((_, T) => _.orderBy(e.pagination.orderByField, e.pagination.orderByDirection).endBefore(o.first.get(T)).limitToLast(e.pagination.number)) : !e.pagination.startAfter && !e.pagination.endBefore ? O = O.map((_) => _.limit(e.pagination.number)) : e.pagination.startAfter ? O = O.map((_, T) => _.startAfter(o.last.get(T)).limit(e.pagination.number)) : O = O.map((_, T) => _.endBefore(o.first.get(T)).limitToLast(e.pagination.number));
|
|
10081
10081
|
}
|
|
10082
10082
|
const H = {};
|
|
10083
10083
|
await ue("preOperation", E, W, { operation: "read", context: H }), await ue("preRead", E, W, { context: H, refs: O, multiple: !0, listener: !1 }), a = /* @__PURE__ */ new Map();
|
|
@@ -10085,9 +10085,9 @@ const Ft = {
|
|
|
10085
10085
|
for (const y of I) {
|
|
10086
10086
|
for (const _ of y.docs) {
|
|
10087
10087
|
a.has(_.id) || a.set(_.id, {});
|
|
10088
|
-
const
|
|
10088
|
+
const T = _.data(), U = a.get(_.id);
|
|
10089
10089
|
U.id ||= _.id;
|
|
10090
|
-
const F = { ...U, ...
|
|
10090
|
+
const F = { ...U, ...T };
|
|
10091
10091
|
delete F.Collection_Path_String, a.set(_.id, F);
|
|
10092
10092
|
}
|
|
10093
10093
|
o.first.set(I.indexOf(y), y.docs[0]), o.last.set(I.indexOf(y), y.docs.at(-1) || y.docs[0]);
|
|
@@ -10095,21 +10095,21 @@ const Ft = {
|
|
|
10095
10095
|
if (e?.pagination) {
|
|
10096
10096
|
let y = O[0];
|
|
10097
10097
|
n && (y = n.reduce((F, [D, M, J]) => F.where(D, M, J), y)), e.pagination.orderByField && e.pagination.orderByDirection && (y = y.orderBy(e.pagination.orderByField, e.pagination.orderByDirection));
|
|
10098
|
-
const
|
|
10099
|
-
i = U > 0 ? Math.ceil(
|
|
10098
|
+
const T = (await y.count().get()).data().count, U = e.pagination.number;
|
|
10099
|
+
i = U > 0 ? Math.ceil(T / U) : 0;
|
|
10100
10100
|
}
|
|
10101
10101
|
let P;
|
|
10102
10102
|
e?.noComputedFields || (P = await ae(W.admin?.retriever));
|
|
10103
10103
|
for (const y of a.values()) {
|
|
10104
|
-
const _ = [],
|
|
10104
|
+
const _ = [], T = [...y.Collection_Path, y.id];
|
|
10105
10105
|
e?.subcollections && _.push(Vo(
|
|
10106
10106
|
s,
|
|
10107
10107
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
10108
10108
|
a.get(y.id),
|
|
10109
|
-
S,
|
|
10110
|
-
ye(e.subcollections),
|
|
10111
10109
|
T,
|
|
10112
|
-
|
|
10110
|
+
ge(e.subcollections),
|
|
10111
|
+
R,
|
|
10112
|
+
ge(e?.relations),
|
|
10113
10113
|
void 0,
|
|
10114
10114
|
e.userId,
|
|
10115
10115
|
e.transactional ? c : void 0,
|
|
@@ -10126,9 +10126,9 @@ const Ft = {
|
|
|
10126
10126
|
s,
|
|
10127
10127
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
10128
10128
|
a.get(y.id),
|
|
10129
|
-
S,
|
|
10130
|
-
ye(e.relations),
|
|
10131
10129
|
T,
|
|
10130
|
+
ge(e.relations),
|
|
10131
|
+
R,
|
|
10132
10132
|
void 0,
|
|
10133
10133
|
e.userId,
|
|
10134
10134
|
e.transactional ? c : void 0,
|
|
@@ -10137,7 +10137,7 @@ const Ft = {
|
|
|
10137
10137
|
const U = [];
|
|
10138
10138
|
for (const M of v.fields) {
|
|
10139
10139
|
if (M.type === "Computed" && !e?.noComputedFields) {
|
|
10140
|
-
const J =
|
|
10140
|
+
const J = We(M, W);
|
|
10141
10141
|
if (!J.formula)
|
|
10142
10142
|
continue;
|
|
10143
10143
|
U.push(ae(J.formula, [y, P]).then((z) => {
|
|
@@ -10153,7 +10153,7 @@ const Ft = {
|
|
|
10153
10153
|
continue;
|
|
10154
10154
|
}
|
|
10155
10155
|
for (const z of v.fields) {
|
|
10156
|
-
const b = !z.access || Be(z, m, v, f?.customClaims ?? {}), B =
|
|
10156
|
+
const b = !z.access || Be(z, m, v, f?.customClaims ?? {}), B = We(z, W), K = B?.custom?.serverAccess?.read !== void 0 ? await ae(B.custom.serverAccess.read, [M, y]) : !0;
|
|
10157
10157
|
(!b || !K) && (ee(z) ? (delete a.get(y.id)[z.name], delete a.get(y.id)[`${z.name}_Array`], delete a.get(y.id)[`${z.name}_Single`]) : delete a.get(y.id)[z.name]);
|
|
10158
10158
|
}
|
|
10159
10159
|
}
|
|
@@ -10168,7 +10168,7 @@ const Ft = {
|
|
|
10168
10168
|
e?.userId && await fa(
|
|
10169
10169
|
Array.from(a.values()),
|
|
10170
10170
|
v,
|
|
10171
|
-
|
|
10171
|
+
R,
|
|
10172
10172
|
e.userId,
|
|
10173
10173
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
10174
10174
|
m
|
|
@@ -10210,8 +10210,8 @@ const Ft = {
|
|
|
10210
10210
|
const f = n[u.name];
|
|
10211
10211
|
if (!f)
|
|
10212
10212
|
continue;
|
|
10213
|
-
for (const [g,
|
|
10214
|
-
const m =
|
|
10213
|
+
for (const [g, R] of Object.entries(f)) {
|
|
10214
|
+
const m = Xe(R.Collection_Path, g, {
|
|
10215
10215
|
userId: o,
|
|
10216
10216
|
providedTransaction: e,
|
|
10217
10217
|
noComputedFields: a,
|
|
@@ -10223,7 +10223,7 @@ const Ft = {
|
|
|
10223
10223
|
e,
|
|
10224
10224
|
// eslint-disable-next-line security/detect-object-injection
|
|
10225
10225
|
f[g],
|
|
10226
|
-
[...
|
|
10226
|
+
[...R.Collection_Path, g],
|
|
10227
10227
|
r,
|
|
10228
10228
|
{ depth: d },
|
|
10229
10229
|
o,
|
|
@@ -10240,18 +10240,18 @@ const Ft = {
|
|
|
10240
10240
|
}
|
|
10241
10241
|
}
|
|
10242
10242
|
await Promise.all(h);
|
|
10243
|
-
},
|
|
10243
|
+
}, Xe = async (t, e, n) => {
|
|
10244
10244
|
if (n?.subcollections?.depth && n.subcollections.depth > 10)
|
|
10245
10245
|
throw new Error("INPUT_ERROR: Subcollections depth cannot exceed 10");
|
|
10246
10246
|
if (n?.relations?.depth && n.relations.depth > 10)
|
|
10247
10247
|
throw new Error("INPUT_ERROR: Relations depth cannot exceed 10");
|
|
10248
|
-
const s =
|
|
10248
|
+
const s = st(), r = he();
|
|
10249
10249
|
let i;
|
|
10250
10250
|
const o = async (a) => {
|
|
10251
10251
|
const [l, c, d, h] = await Promise.all([
|
|
10252
10252
|
n?.userId ? a.get(r.collection("tenants").doc(s).collection("system_user_permissions").doc(n.userId)) : Promise.resolve({}),
|
|
10253
10253
|
a.get(r.collection("system_deployment").doc("maintenance_mode")),
|
|
10254
|
-
|
|
10254
|
+
nt(!0),
|
|
10255
10255
|
n?.userId ? os(n.userId) : Promise.resolve(void 0)
|
|
10256
10256
|
]);
|
|
10257
10257
|
if (!c.exists)
|
|
@@ -10260,10 +10260,10 @@ const Ft = {
|
|
|
10260
10260
|
throw new Error("MAINTENANCE_MODE");
|
|
10261
10261
|
const f = d;
|
|
10262
10262
|
let g;
|
|
10263
|
-
const
|
|
10263
|
+
const R = Gt(), m = t.at(-1);
|
|
10264
10264
|
if (!m)
|
|
10265
10265
|
throw new Error("EMPTY_PATH");
|
|
10266
|
-
const E = Object.keys(f.collections).includes(m), w =
|
|
10266
|
+
const E = Object.keys(f.collections).includes(m), w = R.disabledCollections?.includes(m);
|
|
10267
10267
|
if (!E || w)
|
|
10268
10268
|
throw new Error("COLLECTION_NOT_FOUND");
|
|
10269
10269
|
const x = f.collections[m], { labels: k } = x, v = mt(k.collection, f);
|
|
@@ -10278,51 +10278,51 @@ const Ft = {
|
|
|
10278
10278
|
if (N = g.collections?.[k.collection], !N)
|
|
10279
10279
|
throw new Error("PERMISSION_DENIED");
|
|
10280
10280
|
}
|
|
10281
|
-
if (n?.userId && (!N || !
|
|
10281
|
+
if (n?.userId && (!N || !Ne("Read", N)))
|
|
10282
10282
|
throw new Error("PERMISSION_DENIED");
|
|
10283
10283
|
const W = Lo(s, t, e, f, g, h?.customClaims ?? {});
|
|
10284
10284
|
if (W.length === 0)
|
|
10285
10285
|
throw new Error("PERMISSION_DENIED");
|
|
10286
10286
|
const O = {};
|
|
10287
|
-
await ue("preOperation",
|
|
10288
|
-
const p = W.map((
|
|
10289
|
-
for (const
|
|
10290
|
-
if (
|
|
10291
|
-
const U =
|
|
10292
|
-
i.id ||=
|
|
10287
|
+
await ue("preOperation", R, v, { operation: "read", recordId: e, context: O }), await ue("preRead", R, v, { context: O, refs: W, multiple: !1, listener: !1 }), i = {};
|
|
10288
|
+
const p = W.map((T) => a.get(T)), C = await Promise.all(p);
|
|
10289
|
+
for (const T of C)
|
|
10290
|
+
if (T.exists) {
|
|
10291
|
+
const U = T.data();
|
|
10292
|
+
i.id ||= T.id, i = { ...i, ...U }, delete i.Collection_Path_String;
|
|
10293
10293
|
} else
|
|
10294
10294
|
throw new Error(`NOT_FOUND: Document with ID ${e} does not exist at location ${t?.join("/") || k.collection}`);
|
|
10295
10295
|
const I = [], P = t ? [...t, e] : [k.collection, e];
|
|
10296
|
-
if (n?.subcollections && I.push(Wo(s, a, i, P, n.subcollections, f, void 0, n.userId)), n?.relations && (n.relations.fields && (n.relations.fields = n.relations.fields.map((
|
|
10297
|
-
if (typeof
|
|
10298
|
-
const U = x.fields.find((F) => F.name ===
|
|
10296
|
+
if (n?.subcollections && I.push(Wo(s, a, i, P, n.subcollections, f, void 0, n.userId)), n?.relations && (n.relations.fields && (n.relations.fields = n.relations.fields.map((T) => {
|
|
10297
|
+
if (typeof T == "string") {
|
|
10298
|
+
const U = x.fields.find((F) => F.name === T);
|
|
10299
10299
|
if (U)
|
|
10300
10300
|
return U;
|
|
10301
|
-
throw new Error(`SCHEMA_ERROR: Field ${
|
|
10301
|
+
throw new Error(`SCHEMA_ERROR: Field ${T} not found in collection ${m}`);
|
|
10302
10302
|
}
|
|
10303
|
-
return
|
|
10303
|
+
return T;
|
|
10304
10304
|
})), I.push(jo(s, a, i, P, f, n.relations, n.userId, n.noComputedFields, n.noEmbeddingFields))), await Promise.all(I), !n?.noComputedFields) {
|
|
10305
|
-
for (const
|
|
10306
|
-
if (
|
|
10307
|
-
const U =
|
|
10305
|
+
for (const T of x.fields)
|
|
10306
|
+
if (T.type === "Computed") {
|
|
10307
|
+
const U = We(T, v);
|
|
10308
10308
|
if (!U.formula)
|
|
10309
10309
|
continue;
|
|
10310
|
-
i[
|
|
10310
|
+
i[T.name] = await U.formula(i);
|
|
10311
10311
|
}
|
|
10312
10312
|
}
|
|
10313
10313
|
if (n?.noEmbeddingFields)
|
|
10314
|
-
for (const
|
|
10315
|
-
|
|
10314
|
+
for (const T of x.fields)
|
|
10315
|
+
T.type === "Embedding" && delete i[T.name];
|
|
10316
10316
|
if (n?.userId && g?.Role) {
|
|
10317
|
-
const
|
|
10318
|
-
if (!(v.custom?.serverAccess?.read !== void 0 ? await ae(v.custom?.serverAccess?.read, [
|
|
10317
|
+
const T = g.Role;
|
|
10318
|
+
if (!(v.custom?.serverAccess?.read !== void 0 ? await ae(v.custom?.serverAccess?.read, [T, i]) : !0))
|
|
10319
10319
|
throw new Error("PERMISSION_DENIED");
|
|
10320
10320
|
for (const F of x.fields) {
|
|
10321
|
-
const D = !F.access || Be(F, g, x, h?.customClaims ?? {}), M =
|
|
10321
|
+
const D = !F.access || Be(F, g, x, h?.customClaims ?? {}), M = We(F, v), J = M?.custom?.serverAccess?.read !== void 0 ? await ae(M.custom.serverAccess.read, [T, i]) : !0;
|
|
10322
10322
|
(!D || !J) && (ee(F) ? (delete i[F.name], delete i[`${F.name}_Array`], delete i[`${F.name}_Single`]) : delete i[F.name]);
|
|
10323
10323
|
}
|
|
10324
10324
|
}
|
|
10325
|
-
await ue("postOperation",
|
|
10325
|
+
await ue("postOperation", R, v, { operation: "read", data: i, recordId: e, context: O }), await ue("postRead", R, v, { context: O, refs: W, record: i, listener: !1 }), n?.userId && await da(i, x, f, n.userId, g);
|
|
10326
10326
|
};
|
|
10327
10327
|
return n?.providedTransaction ? await o(n.providedTransaction) : await r.runTransaction(async (a) => {
|
|
10328
10328
|
await o(a);
|
|
@@ -10346,12 +10346,12 @@ const Ft = {
|
|
|
10346
10346
|
const E = /* @__PURE__ */ new Date(), w = new Date((/* @__PURE__ */ new Date()).setDate(E.getDate() + u));
|
|
10347
10347
|
f.TTL = ht.fromDate(w);
|
|
10348
10348
|
}
|
|
10349
|
-
const g =
|
|
10350
|
-
|
|
10351
|
-
const
|
|
10352
|
-
await
|
|
10349
|
+
const g = ge(n);
|
|
10350
|
+
Qe(g), t !== "delete" && (f.data.data = ge(g)), t === "update" && (f.data.originalRecord = ge(l)), t !== "delete" && ["started", "written"].includes(e) && (delete f.data.data.Saved_At, delete f.data.data.Last_Save_At), e === "failed" && (f.data.error = JSON.stringify(a));
|
|
10351
|
+
const R = Me(d, r, s), m = n.Last_Write_At;
|
|
10352
|
+
await R.doc(i).collection("system_write_log").doc(`${n.Last_Write_By}-${m.valueOf()}`).set(f);
|
|
10353
10353
|
}, _n = async (t) => {
|
|
10354
|
-
const e =
|
|
10354
|
+
const e = st(), n = Rt(), s = he(), r = [];
|
|
10355
10355
|
if (await Promise.all([
|
|
10356
10356
|
(async () => {
|
|
10357
10357
|
try {
|
|
@@ -10380,11 +10380,11 @@ ${i}`);
|
|
|
10380
10380
|
t = h;
|
|
10381
10381
|
else
|
|
10382
10382
|
throw new Error("Admin email not set");
|
|
10383
|
-
const u = Os(t), f = Kc(e), g = n ? li(n) : void 0,
|
|
10383
|
+
const u = Os(t), f = Kc(e), g = n ? li(n) : void 0, R = s ? li(s) : void 0, m = r ? Os(r) : void 0, E = i ? Os(i) : void 0, w = o ? Jn(o) : void 0, x = l ? Jn(l) : void 0, k = Array.isArray(u) ? u : [u];
|
|
10384
10384
|
if (k.length === 0 || k.length === 1 && !k[0])
|
|
10385
10385
|
throw new Error("No valid email addresses provided");
|
|
10386
10386
|
const v = { to: u, message: { subject: f } };
|
|
10387
|
-
if (g && (v.message.text = g),
|
|
10387
|
+
if (g && (v.message.text = g), R && (v.message.html = R), m) {
|
|
10388
10388
|
const N = Array.isArray(m) ? m : [m];
|
|
10389
10389
|
N.length > 0 && N[0] && (v.cc = m);
|
|
10390
10390
|
}
|
|
@@ -10406,7 +10406,14 @@ function su(t) {
|
|
|
10406
10406
|
return e;
|
|
10407
10407
|
}
|
|
10408
10408
|
const qo = async (t, e, n, s, r, i, o) => {
|
|
10409
|
-
const a =
|
|
10409
|
+
const a = Rt(), l = he(), { labels: c, fields: d } = s;
|
|
10410
|
+
if (r.Email === void 0 || r.Email === null || ke(r.Email) || r.Email === "")
|
|
10411
|
+
throw new Error("VALIDATION_ERROR: Email field is required");
|
|
10412
|
+
if (r.Role === void 0 || r.Role === null || ke(r.Role) || r.Role === "")
|
|
10413
|
+
throw new Error("VALIDATION_ERROR: Role field is required");
|
|
10414
|
+
if (r.Enabled === void 0 || r.Enabled === null || ke(r.Enabled))
|
|
10415
|
+
throw new Error("VALIDATION_ERROR: Enabled field is required");
|
|
10416
|
+
const h = "USER_ERROR", u = async (m, E) => {
|
|
10410
10417
|
try {
|
|
10411
10418
|
await _n(m);
|
|
10412
10419
|
} catch {
|
|
@@ -10428,7 +10435,7 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
10428
10435
|
}
|
|
10429
10436
|
const g = {};
|
|
10430
10437
|
for (const m of d)
|
|
10431
|
-
m.saveToAuthToken && !ur(m.name) && r[m.name] !== void 0 && m.type !== "Timestamp" && m.type !== "Computed" && m.type !== "Embedding" && (
|
|
10438
|
+
m.saveToAuthToken && !ur(m.name) && r[m.name] !== void 0 && m.type !== "Timestamp" && m.type !== "Computed" && m.type !== "Embedding" && (ke(r[m.name]) ? g[m.name] = null : g[m.name] = r[m.name]);
|
|
10432
10439
|
try {
|
|
10433
10440
|
await a.setCustomUserClaims(f.uid, {
|
|
10434
10441
|
...g,
|
|
@@ -10451,8 +10458,8 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
10451
10458
|
} catch {
|
|
10452
10459
|
throw await u(r, h), new Error(h);
|
|
10453
10460
|
}
|
|
10454
|
-
const
|
|
10455
|
-
if (
|
|
10461
|
+
const R = n.auth.enableMultiFactorAuth;
|
|
10462
|
+
if (R === !0 || typeof R == "object" && R.includes(r.Role)) {
|
|
10456
10463
|
let m;
|
|
10457
10464
|
try {
|
|
10458
10465
|
m = await a.generateEmailVerificationLink(r.Email);
|
|
@@ -10482,7 +10489,7 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
10482
10489
|
const r = t.at(-2);
|
|
10483
10490
|
if (!r)
|
|
10484
10491
|
throw new Error("PERMISSION_DENIED");
|
|
10485
|
-
const i = [...t].slice(0, -2), o = await
|
|
10492
|
+
const i = [...t].slice(0, -2), o = await Xe(i, r).catch(() => {
|
|
10486
10493
|
throw new Error("PERMISSION_DENIED");
|
|
10487
10494
|
}), a = o.Collection_Path;
|
|
10488
10495
|
if (a.push(o.id), a.push(n.collection), !Je(t, a))
|
|
@@ -10506,7 +10513,7 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
10506
10513
|
}, fr = (t) => {
|
|
10507
10514
|
if (typeof t == "object")
|
|
10508
10515
|
for (const e in t)
|
|
10509
|
-
Object.prototype.hasOwnProperty.call(t, e) && (t[e] === "_DELETE_FIELD" ? t[e] =
|
|
10516
|
+
Object.prototype.hasOwnProperty.call(t, e) && (t[e] === "_DELETE_FIELD" ? t[e] = we.delete() : fr(t[e]));
|
|
10510
10517
|
}, ru = (t, e, n) => {
|
|
10511
10518
|
if (ee(n) && n.includeFields) {
|
|
10512
10519
|
const s = {};
|
|
@@ -10514,7 +10521,7 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
10514
10521
|
if (e[r] !== void 0) {
|
|
10515
10522
|
s[r] = e[r];
|
|
10516
10523
|
const i = V(t.fields, r);
|
|
10517
|
-
|
|
10524
|
+
Tt(t, [i]).size === 1 && (s[`${r}_Lowercase`] = e[`${r}_Lowercase`]);
|
|
10518
10525
|
}
|
|
10519
10526
|
}), s;
|
|
10520
10527
|
}
|
|
@@ -10528,18 +10535,18 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
10528
10535
|
const [d, h] = c[0];
|
|
10529
10536
|
if (!h)
|
|
10530
10537
|
throw new Error(`VALIDATION_ERROR: Relation ${n.name} is required`);
|
|
10531
|
-
const u =
|
|
10538
|
+
const u = Me(l, h.Collection_Path, t);
|
|
10532
10539
|
if (i.size++, !o && i.size > 500)
|
|
10533
10540
|
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.");
|
|
10534
10541
|
const f = await r.get(u.doc(d));
|
|
10535
10542
|
if (!f.exists)
|
|
10536
10543
|
throw new Error(`VALIDATION_ERROR: Record ${d} not found in collection ${n.collection}`);
|
|
10537
|
-
const g = f.data(),
|
|
10538
|
-
if (!g[m.recordLinkField] || !s[
|
|
10544
|
+
const g = f.data(), R = V(a, n.enforceHierarchy.field), m = n.enforceHierarchy;
|
|
10545
|
+
if (!g[m.recordLinkField] || !s[R.name] || !Object.keys(s[R.name]).every((E) => Object.keys(g[m.recordLinkField]).includes(E)))
|
|
10539
10546
|
throw new Error("VALIDATION_ERROR: Invalid relation hierarchy");
|
|
10540
10547
|
}, In = async (t, e, n) => {
|
|
10541
10548
|
delete e[t.name][n], e[`${t.name}_Array`] = e[`${t.name}_Array`]?.filter((s) => s !== n), delete e[`${t.name}_Single`];
|
|
10542
|
-
},
|
|
10549
|
+
}, Rs = async (t, e, n, s, r) => {
|
|
10543
10550
|
e[t.name] ||= {}, e[t.name][s] = n, e[`${t.name}_Array`] ||= [], e[`${t.name}_Array`].push(s), r && (e[`${t.name}_Single`] = { id: s, ...n });
|
|
10544
10551
|
}, iu = (t, e, n, s, r, i) => {
|
|
10545
10552
|
const o = [], a = [];
|
|
@@ -10547,7 +10554,7 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
10547
10554
|
ee(l) && l.twoWay && l.collection === n && ((t === "Create" || !i?.[l.name]?.[e]) && r[l.name]?.[e] && o.push(l), t === "Update" && i?.[l.name]?.[e] && !r[l.name]?.[e] && a.push(l));
|
|
10548
10555
|
return { addedFields: o, removedFields: a };
|
|
10549
10556
|
}, Ho = async (t, e, n, s, r, i, o, a, l, c, d, h, u) => {
|
|
10550
|
-
const { fields: f } = i, g = he(),
|
|
10557
|
+
const { fields: f } = i, g = he(), R = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), E = /* @__PURE__ */ new Map();
|
|
10551
10558
|
for (const w of f)
|
|
10552
10559
|
ee(w) && ["OneToOne", "OneToMany"].includes(w.type) && w.enforceHierarchy && s[w.name] && (t === "Create" || t === "Update" && !Je(h?.[w.name], s[w.name])) && await ui(e, i, w, s, a, l);
|
|
10553
10560
|
for (const w of f)
|
|
@@ -10558,13 +10565,13 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
10558
10565
|
for (const W of N) {
|
|
10559
10566
|
const [O, H] = W;
|
|
10560
10567
|
if (t === "Create" || !h?.[w.name]?.[O]) {
|
|
10561
|
-
let
|
|
10568
|
+
let S;
|
|
10562
10569
|
const p = E.get(w.collection)?.[O];
|
|
10563
10570
|
if (p)
|
|
10564
|
-
|
|
10571
|
+
S = p;
|
|
10565
10572
|
else {
|
|
10566
10573
|
l.size++, l && l.size > 500 && console.error(new Error(`VALIDATION_ERROR: ${l.size} 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.`));
|
|
10567
|
-
const I =
|
|
10574
|
+
const I = Me(g, H.Collection_Path, e), P = await a.get(I.doc(O));
|
|
10568
10575
|
if (!P.exists) {
|
|
10569
10576
|
In(w, r, O);
|
|
10570
10577
|
continue;
|
|
@@ -10573,18 +10580,18 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
10573
10580
|
m.set(w.collection, {
|
|
10574
10581
|
...m.get(w.collection) || {},
|
|
10575
10582
|
[O]: y
|
|
10576
|
-
}),
|
|
10583
|
+
}), S = ge({ ...y, ...Mn(s) });
|
|
10577
10584
|
}
|
|
10578
10585
|
const C = {
|
|
10579
|
-
...
|
|
10586
|
+
...S[k.name],
|
|
10580
10587
|
[n]: {
|
|
10581
10588
|
Collection_Path: s.Collection_Path,
|
|
10582
10589
|
...ru(i, s, k)
|
|
10583
10590
|
}
|
|
10584
10591
|
};
|
|
10585
|
-
|
|
10592
|
+
S[k.name] = C, S[`${k.name}_Array`] ||= [], S[`${k.name}_Array`].push(n), v.size === 1 && (S[`${k.name}_Single`] = { id: n, ...C }), E.set(w.collection, {
|
|
10586
10593
|
...E.get(w.collection) || {},
|
|
10587
|
-
[O]:
|
|
10594
|
+
[O]: S
|
|
10588
10595
|
});
|
|
10589
10596
|
}
|
|
10590
10597
|
}
|
|
@@ -10594,26 +10601,26 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
10594
10601
|
for (const W of N) {
|
|
10595
10602
|
const [O, H] = W;
|
|
10596
10603
|
if (!s[w.name]?.[O]) {
|
|
10597
|
-
let
|
|
10604
|
+
let S;
|
|
10598
10605
|
const p = E.get(w.collection)?.[O];
|
|
10599
10606
|
if (p)
|
|
10600
|
-
|
|
10607
|
+
S = p;
|
|
10601
10608
|
else {
|
|
10602
10609
|
l.size++, l && l.size > 500 && console.error(new Error(`VALIDATION_ERROR: ${l.size} 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.`));
|
|
10603
|
-
const C =
|
|
10610
|
+
const C = Me(g, H.Collection_Path, e), I = await a.get(C.doc(O));
|
|
10604
10611
|
if (!I.exists) {
|
|
10605
|
-
|
|
10612
|
+
R.set(w.name, [...R.get(w.name) || [], O]);
|
|
10606
10613
|
continue;
|
|
10607
10614
|
}
|
|
10608
10615
|
const P = I.data();
|
|
10609
10616
|
m.set(w.collection, {
|
|
10610
10617
|
...m.get(w.collection) || {},
|
|
10611
10618
|
[O]: P
|
|
10612
|
-
}),
|
|
10619
|
+
}), S = ge({ ...P, ...Mn(s) });
|
|
10613
10620
|
}
|
|
10614
|
-
|
|
10621
|
+
S[k.name][n] && delete S[k.name][n], Array.isArray(S[`${k.name}_Array`]) && (S[`${k.name}_Array`] = S[`${k.name}_Array`].filter((C) => C !== n)), v.size === 1 && delete S[`${k.name}_Single`], E.set(w.collection, {
|
|
10615
10622
|
...E.get(w.collection) || {},
|
|
10616
|
-
[O]:
|
|
10623
|
+
[O]: S
|
|
10617
10624
|
});
|
|
10618
10625
|
}
|
|
10619
10626
|
}
|
|
@@ -10624,21 +10631,21 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
10624
10631
|
for (const [N, W] of Object.entries(x)) {
|
|
10625
10632
|
const { addedFields: O, removedFields: H } = iu(t, N, w, i, s, h);
|
|
10626
10633
|
if (c && d) {
|
|
10627
|
-
for (const
|
|
10628
|
-
const p = V(k.fields,
|
|
10634
|
+
for (const S of O) {
|
|
10635
|
+
const p = V(k.fields, S.twoWay);
|
|
10629
10636
|
if (!mr(k, p, d, u ?? {})) {
|
|
10630
|
-
In(
|
|
10637
|
+
In(S, r, N);
|
|
10631
10638
|
continue;
|
|
10632
10639
|
}
|
|
10633
10640
|
}
|
|
10634
|
-
for (const
|
|
10635
|
-
const p = V(k.fields,
|
|
10641
|
+
for (const S of H) {
|
|
10642
|
+
const p = V(k.fields, S.twoWay), C = Et(k, [p]);
|
|
10636
10643
|
if (!mr(k, p, d, u ?? {})) {
|
|
10637
|
-
|
|
10638
|
-
|
|
10644
|
+
Rs(
|
|
10645
|
+
S,
|
|
10639
10646
|
r,
|
|
10640
10647
|
// eslint-disable-next-line security/detect-object-injection
|
|
10641
|
-
h?.[
|
|
10648
|
+
h?.[S.name]?.[N],
|
|
10642
10649
|
N,
|
|
10643
10650
|
C.size === 1
|
|
10644
10651
|
);
|
|
@@ -10654,30 +10661,30 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
10654
10661
|
// eslint-disable-next-line security/detect-object-injection
|
|
10655
10662
|
m.get(w)?.[N]
|
|
10656
10663
|
)) {
|
|
10657
|
-
for (const
|
|
10658
|
-
In(
|
|
10659
|
-
for (const
|
|
10660
|
-
const p = V(k.fields,
|
|
10661
|
-
|
|
10662
|
-
|
|
10664
|
+
for (const S of O)
|
|
10665
|
+
In(S, r, N);
|
|
10666
|
+
for (const S of H) {
|
|
10667
|
+
const p = V(k.fields, S.twoWay), C = Et(k, [p]);
|
|
10668
|
+
Rs(
|
|
10669
|
+
S,
|
|
10663
10670
|
r,
|
|
10664
10671
|
// eslint-disable-next-line security/detect-object-injection
|
|
10665
|
-
h?.[
|
|
10672
|
+
h?.[S.name]?.[N],
|
|
10666
10673
|
N,
|
|
10667
10674
|
C.size === 1
|
|
10668
10675
|
);
|
|
10669
10676
|
}
|
|
10670
10677
|
}
|
|
10671
10678
|
if (!dt("Update", k, o, c, d, W)) {
|
|
10672
|
-
for (const
|
|
10673
|
-
In(
|
|
10674
|
-
for (const
|
|
10675
|
-
const p = V(k.fields,
|
|
10676
|
-
|
|
10677
|
-
|
|
10679
|
+
for (const S of O)
|
|
10680
|
+
In(S, r, N);
|
|
10681
|
+
for (const S of H) {
|
|
10682
|
+
const p = V(k.fields, S.twoWay), C = Et(k, [p]);
|
|
10683
|
+
Rs(
|
|
10684
|
+
S,
|
|
10678
10685
|
r,
|
|
10679
10686
|
// eslint-disable-next-line security/detect-object-injection
|
|
10680
|
-
h?.[
|
|
10687
|
+
h?.[S.name]?.[N],
|
|
10681
10688
|
N,
|
|
10682
10689
|
C.size === 1
|
|
10683
10690
|
);
|
|
@@ -10686,16 +10693,16 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
10686
10693
|
}
|
|
10687
10694
|
try {
|
|
10688
10695
|
await fn("update", W, k, v, { operation: "update", data: W, context: {}, originalRecord: W }, o);
|
|
10689
|
-
} catch (
|
|
10690
|
-
throw new Error(`VALIDATION_ERROR: Two way relation update would invalidate record ${N} in ${w}: ${
|
|
10696
|
+
} catch (S) {
|
|
10697
|
+
throw new Error(`VALIDATION_ERROR: Two way relation update would invalidate record ${N} in ${w}: ${S.message}`);
|
|
10691
10698
|
}
|
|
10692
|
-
for (const
|
|
10693
|
-
const p = V(k.fields,
|
|
10699
|
+
for (const S of O) {
|
|
10700
|
+
const p = V(k.fields, S.twoWay);
|
|
10694
10701
|
["OneToOne", "OneToMany"].includes(p.type) && ee(p) && p.enforceHierarchy && await ui(e, k, p, W, a, l, !0);
|
|
10695
10702
|
}
|
|
10696
10703
|
}
|
|
10697
10704
|
}
|
|
10698
|
-
return
|
|
10705
|
+
return R;
|
|
10699
10706
|
}, Go = (t, e, n) => {
|
|
10700
10707
|
t === "create" && lt.forEach((s) => {
|
|
10701
10708
|
if (!Je(e[s], n[s]))
|
|
@@ -10714,20 +10721,20 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
10714
10721
|
const i = r?.archivedField, o = r?.timestampField;
|
|
10715
10722
|
if (n[i] === !0)
|
|
10716
10723
|
if (t === "create")
|
|
10717
|
-
n[o] =
|
|
10724
|
+
n[o] = we.serverTimestamp();
|
|
10718
10725
|
else {
|
|
10719
10726
|
if (!s)
|
|
10720
10727
|
throw new Error("Original record is required for update");
|
|
10721
10728
|
if (!s[i])
|
|
10722
|
-
n[o] =
|
|
10729
|
+
n[o] = we.serverTimestamp();
|
|
10723
10730
|
else if (n[o] && n[o]?.valueOf() !== s[o]?.valueOf())
|
|
10724
10731
|
throw new Error("Soft delete timestamp cannot be changed");
|
|
10725
10732
|
}
|
|
10726
|
-
},
|
|
10727
|
-
if (!
|
|
10733
|
+
}, Ts = async (t, e, n, s, r) => {
|
|
10734
|
+
if (!Ne("Read", r.collections?.[e.labels.collection]))
|
|
10728
10735
|
return !1;
|
|
10729
10736
|
try {
|
|
10730
|
-
await
|
|
10737
|
+
await Xe([e.labels.collection], n, { userId: s, providedTransaction: t });
|
|
10731
10738
|
} catch {
|
|
10732
10739
|
return !1;
|
|
10733
10740
|
}
|
|
@@ -10752,12 +10759,12 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
10752
10759
|
if (s.collections?.[a]?.restrictEntities || s?.collections?.[a]?.recordOwner?.active || s?.collections?.[a]?.recordUser?.active || s?.collections?.[a]?.recordProperty?.active) {
|
|
10753
10760
|
const u = i?.collections?.[a], f = [];
|
|
10754
10761
|
if (l.individualEntities) {
|
|
10755
|
-
const g = l.individualEntities,
|
|
10762
|
+
const g = l.individualEntities, R = u?.individualEntities || [], m = i ? g.filter((E) => !R.includes(E)) : g;
|
|
10756
10763
|
for (const E of m) {
|
|
10757
10764
|
if (o && o.size++, o && o.size > 500)
|
|
10758
10765
|
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).");
|
|
10759
10766
|
f.push(async () => {
|
|
10760
|
-
if (!await
|
|
10767
|
+
if (!await Ts(t, d, E, n, s))
|
|
10761
10768
|
throw new Error("PERMISSION_DENIED");
|
|
10762
10769
|
});
|
|
10763
10770
|
}
|
|
@@ -10766,12 +10773,12 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
10766
10773
|
const g = c.entityRestrictions?.restrictions?.find((k) => k.type === "Parent" && k.roles.some((v) => v.role === e.Role));
|
|
10767
10774
|
if (!g)
|
|
10768
10775
|
throw new Error("PERMISSION_DENIED");
|
|
10769
|
-
const
|
|
10776
|
+
const R = V(d.fields, g.collectionField), m = r.collections[R.collection], E = l.parentEntities, w = u?.parentEntities || [], x = i ? E.filter((k) => !w.includes(k)) : E;
|
|
10770
10777
|
for (const k of x) {
|
|
10771
10778
|
if (o && o.size++, o && o.size > 500)
|
|
10772
10779
|
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).");
|
|
10773
10780
|
f.push(async () => {
|
|
10774
|
-
if (!await
|
|
10781
|
+
if (!await Ts(t, m, k, n, s))
|
|
10775
10782
|
throw new Error("PERMISSION_DENIED");
|
|
10776
10783
|
});
|
|
10777
10784
|
}
|
|
@@ -10780,14 +10787,14 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
10780
10787
|
const g = c.entityRestrictions?.restrictions?.find((x) => x.type === "Parent_Property" && x.roles.some((k) => k.role === e.Role));
|
|
10781
10788
|
if (!g)
|
|
10782
10789
|
throw new Error("PERMISSION_DENIED");
|
|
10783
|
-
const
|
|
10790
|
+
const R = V(d.fields, g.collectionField), m = r.collections[R.collection], E = l.parentPropertyEntities, w = u?.parentPropertyEntities || {};
|
|
10784
10791
|
for (const [x, k] of Object.entries(E)) {
|
|
10785
10792
|
const v = w[x] || [], N = i ? k.filter((W) => !v.includes(W)) : k;
|
|
10786
10793
|
for (const W of N) {
|
|
10787
10794
|
if (o && o.size++, o && o.size > 500)
|
|
10788
10795
|
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).");
|
|
10789
10796
|
f.push(async () => {
|
|
10790
|
-
if (!await
|
|
10797
|
+
if (!await Ts(t, m, W, n, s))
|
|
10791
10798
|
throw new Error("PERMISSION_DENIED");
|
|
10792
10799
|
});
|
|
10793
10800
|
}
|
|
@@ -10799,26 +10806,26 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
10799
10806
|
}, Cu = async (t, e, n) => {
|
|
10800
10807
|
const s = n?.userId, r = n?.user;
|
|
10801
10808
|
let i = n?.context;
|
|
10802
|
-
const o =
|
|
10809
|
+
const o = st(), a = Gt();
|
|
10803
10810
|
if (n?.providedTransaction && s)
|
|
10804
10811
|
throw new Error("PERMISSION_DENIED");
|
|
10805
10812
|
if (n?.providedSchema && s)
|
|
10806
10813
|
throw new Error("PERMISSION_DENIED");
|
|
10807
|
-
let l = n?.providedSchema || await
|
|
10814
|
+
let l = n?.providedSchema || await nt();
|
|
10808
10815
|
if (t.length === 0)
|
|
10809
10816
|
throw new Error("EMPTY_PATH");
|
|
10810
10817
|
const c = t.at(-1), d = Object.keys(l.collections).includes(c), h = a.disabledCollections?.includes(c);
|
|
10811
10818
|
if (!d || h)
|
|
10812
10819
|
throw new Error("COLLECTION_NOT_FOUND");
|
|
10813
|
-
const u = l.collections[c], { labels: f, fields: g, enableWriteLog:
|
|
10820
|
+
const u = l.collections[c], { labels: f, fields: g, enableWriteLog: R, softDelete: m } = u, E = mt(f.collection, l), w = await ae(a.appName), x = he(), k = Rt(), v = s ? await k.getUser(s) : void 0, N = v?.customClaims?.role;
|
|
10814
10821
|
let W, O;
|
|
10815
10822
|
s && await dr(t, u);
|
|
10816
|
-
const H =
|
|
10817
|
-
i = i || {}, i.collection = f.collection, e.id =
|
|
10818
|
-
const p = Ks("create", t, e, l, w, "Online", s || "System", ht.now(),
|
|
10823
|
+
const H = Me(x, t, o), S = n?.id || H.doc().id;
|
|
10824
|
+
i = i || {}, i.collection = f.collection, e.id = S, Bo(e), fr(e);
|
|
10825
|
+
const p = Ks("create", t, e, l, w, "Online", s || "System", ht.now(), we.serverTimestamp());
|
|
10819
10826
|
n?.createdAt && (p.Created_At = n.createdAt), n?.createdBy && (p.Created_By = n.createdBy);
|
|
10820
|
-
const C =
|
|
10821
|
-
m && (p[m.archivedField] = !1), Ze(e), vt(u, p, l),
|
|
10827
|
+
const C = ge(p);
|
|
10828
|
+
m && (p[m.archivedField] = !1), Ze(e), vt(u, p, l), R && !n?.providedTransaction && await Zt("create", "started", p, o, t, S, u), await ue("preOperation", a, E, { operation: "create", data: p, recordId: S, context: i }), await ue("preWrite", a, E, { operation: "create", data: p, recordId: S, context: i }), vt(u, p, l), Pn(u, p);
|
|
10822
10829
|
const _ = (s ? await x.collection("tenants").doc(o).collection("system_user_permissions").doc(s).get() : void 0)?.data();
|
|
10823
10830
|
await va(p, u, E, _, v?.customClaims || {}), Ze(p);
|
|
10824
10831
|
try {
|
|
@@ -10828,7 +10835,7 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
10828
10835
|
} catch (D) {
|
|
10829
10836
|
throw new Error(`VALIDATION_ERROR: ${D.message}`);
|
|
10830
10837
|
}
|
|
10831
|
-
Ze(p), e.id =
|
|
10838
|
+
Ze(p), e.id = S, m && (p[m.archivedField] = !1), vt(u, p, l), Pn(u, p);
|
|
10832
10839
|
try {
|
|
10833
10840
|
Go("create", p, C), Yo("create", u, p), await fn("create", p, u, E, { operation: "create", data: p, context: i }, l);
|
|
10834
10841
|
} catch (D) {
|
|
@@ -10843,18 +10850,18 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
10843
10850
|
for (const J of u.fields) {
|
|
10844
10851
|
if (!(J.name in p))
|
|
10845
10852
|
continue;
|
|
10846
|
-
const z =
|
|
10853
|
+
const z = We(J, E);
|
|
10847
10854
|
if (z?.custom?.serverAccess?.create !== void 0 && !await ae(z.custom.serverAccess.create, [D, p]))
|
|
10848
10855
|
throw new Error("PERMISSION_DENIED");
|
|
10849
10856
|
}
|
|
10850
10857
|
}
|
|
10851
10858
|
r && (r.permissions ||= {}, r.permissions.Role ||= p.Role, r.permissions.Enabled ||= p.Enabled);
|
|
10852
|
-
const
|
|
10859
|
+
const T = async (D, M) => {
|
|
10853
10860
|
const [J, z, b, B, K] = await Promise.all([
|
|
10854
10861
|
n?.providedTransaction ? Promise.resolve({}) : D.get(x.collection("system_deployment").doc("latest_deploy")),
|
|
10855
10862
|
n?.providedTransaction ? Promise.resolve({}) : D.get(x.collection("system_deployment").doc("maintenance_mode")),
|
|
10856
10863
|
s ? D.get(x.collection("tenants").doc(o).collection("system_user_permissions").doc(s)) : Promise.resolve({}),
|
|
10857
|
-
n?.providedSchema ? Promise.resolve(n.providedSchema) :
|
|
10864
|
+
n?.providedSchema ? Promise.resolve(n.providedSchema) : nt(),
|
|
10858
10865
|
s ? os(s) : Promise.resolve(void 0)
|
|
10859
10866
|
]);
|
|
10860
10867
|
if (M && (M.size += 3), !n?.providedTransaction) {
|
|
@@ -10878,11 +10885,11 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
10878
10885
|
O = K?.customClaims ?? {};
|
|
10879
10886
|
}
|
|
10880
10887
|
if (!n?.providedTransaction) {
|
|
10881
|
-
const
|
|
10888
|
+
const Te = g.filter((oe) => "unique" in oe && oe.unique).map(async (oe) => {
|
|
10882
10889
|
if (!s || !oe.access || Be(oe, W, u, O)) {
|
|
10883
10890
|
if (!p[oe.name])
|
|
10884
10891
|
return;
|
|
10885
|
-
const ce =
|
|
10892
|
+
const ce = We(oe, E);
|
|
10886
10893
|
if (!(s && ce?.custom?.serverAccess?.read !== void 0 ? await ae(ce.custom.serverAccess.read, [
|
|
10887
10894
|
W?.Role,
|
|
10888
10895
|
p
|
|
@@ -10898,17 +10905,17 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
10898
10905
|
throw new Error(`VALIDATION_ERROR: ${oe.name} "${p[oe.name]}" is invalid`);
|
|
10899
10906
|
}
|
|
10900
10907
|
});
|
|
10901
|
-
await Promise.all(
|
|
10908
|
+
await Promise.all(Te);
|
|
10902
10909
|
}
|
|
10903
|
-
pr(p,
|
|
10910
|
+
pr(p, S, u, l, s, W, r?.permissions, O), r?.permissions && s && W && await Jo(D, r.permissions, s, W, l), pr(p, S, u, l, s, W, r?.permissions, O);
|
|
10904
10911
|
};
|
|
10905
10912
|
if (u.auth && r) {
|
|
10906
10913
|
await x.runTransaction(async (M) => {
|
|
10907
|
-
await
|
|
10914
|
+
await T(M);
|
|
10908
10915
|
}, { maxAttempts: 10 });
|
|
10909
10916
|
const D = await qo(
|
|
10910
10917
|
o,
|
|
10911
|
-
|
|
10918
|
+
S,
|
|
10912
10919
|
a,
|
|
10913
10920
|
u,
|
|
10914
10921
|
p,
|
|
@@ -10921,9 +10928,9 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
10921
10928
|
const U = async (D) => {
|
|
10922
10929
|
try {
|
|
10923
10930
|
const M = { size: 1 };
|
|
10924
|
-
await
|
|
10931
|
+
await T(D, M), n?.noTwoWay || await Ho("Create", o, S, p, p, u, l, D, M, s, W, void 0, O);
|
|
10925
10932
|
const J = Qs(l);
|
|
10926
|
-
lr("create", D, t,
|
|
10933
|
+
lr("create", D, t, S, p, l, u, n, J, we.arrayUnion, we.arrayRemove, we.delete, (z) => x.collection("tenants").doc(o).collection("system_fields").doc(f.collection).collection(`${f.collection}-${z.name}`).doc(S), (z, b) => x.collection("tenants").doc(o).collection("system_unique").doc(f.collection).collection(`Unique-${f.collection}-${z.name}`).doc(b), (z) => x.collection("tenants").doc(o).collection("system_fields").doc(f.collection).collection(`${f.collection}-${z}`).doc(S), (z, b) => Me(x, z, o).doc(b), (z, b, B) => x.collection("tenants").doc(o).collection("system_fields").doc(z.collection).collection(`${z.collection}-${b}`).doc(B), (z, b, B) => x.collection("tenants").doc(o).collection("system_fields").doc(z.collection).collection(`${z.collection}-${b.replaceAll(" ", "-")}`).doc(B), void 0, void 0, M), D.set(H.doc(S), p);
|
|
10927
10934
|
} catch (M) {
|
|
10928
10935
|
if (n?.providedTransaction)
|
|
10929
10936
|
throw M;
|
|
@@ -10931,13 +10938,13 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
10931
10938
|
const z = await ue("postWriteError", a, E, {
|
|
10932
10939
|
operation: "create",
|
|
10933
10940
|
data: p,
|
|
10934
|
-
recordId:
|
|
10941
|
+
recordId: S,
|
|
10935
10942
|
context: i,
|
|
10936
10943
|
error: M
|
|
10937
10944
|
});
|
|
10938
|
-
if (
|
|
10945
|
+
if (R && (await new Promise((b) => {
|
|
10939
10946
|
setTimeout(b, 250);
|
|
10940
|
-
}), await Zt("create", z?.resolved ? "success" : "failed", p, o, t,
|
|
10947
|
+
}), await Zt("create", z?.resolved ? "success" : "failed", p, o, t, S, u, z?.resolved ? void 0 : M)), !z?.resolved)
|
|
10941
10948
|
throw u.auth && r && await _n(p), M;
|
|
10942
10949
|
}
|
|
10943
10950
|
}
|
|
@@ -10945,12 +10952,12 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
10945
10952
|
if (n?.providedTransaction ? await U(n.providedTransaction) : await x.runTransaction(async (D) => {
|
|
10946
10953
|
await U(D);
|
|
10947
10954
|
}, { maxAttempts: 10 }), !n?.providedTransaction) {
|
|
10948
|
-
const D = { operation: "create", data: p, recordId:
|
|
10955
|
+
const D = { operation: "create", data: p, recordId: S, context: i }, M = { ...D };
|
|
10949
10956
|
await ue("postWrite", a, E, D), await ue("postOperation", a, E, M);
|
|
10950
10957
|
}
|
|
10951
|
-
return { id:
|
|
10958
|
+
return { id: S, ...p };
|
|
10952
10959
|
}, sn = async (t, e, n, s) => {
|
|
10953
|
-
const r =
|
|
10960
|
+
const r = st(), i = Rt(), o = he(), a = e.customClaims || {};
|
|
10954
10961
|
let l = !1;
|
|
10955
10962
|
try {
|
|
10956
10963
|
await i.updateUser(t, {
|
|
@@ -10984,18 +10991,18 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
10984
10991
|
if (l)
|
|
10985
10992
|
throw new Error(`ROLLBACK_FAILED: ${s}`);
|
|
10986
10993
|
}, lu = async (t, e, n, s, r, i, o, a, l, c, d) => {
|
|
10987
|
-
const h =
|
|
10994
|
+
const h = Rt(), u = he(), f = {};
|
|
10988
10995
|
for (const m of r.fields)
|
|
10989
|
-
m.saveToAuthToken && !ur(m.name) && i[m.name] !== void 0 && m.type !== "Timestamp" && m.type !== "Computed" && m.type !== "Embedding" && (
|
|
10996
|
+
m.saveToAuthToken && !ur(m.name) && i[m.name] !== void 0 && m.type !== "Timestamp" && m.type !== "Computed" && m.type !== "Embedding" && (ke(i[m.name]) ? f[m.name] = null : f[m.name] = i[m.name]);
|
|
10990
10997
|
const g = "USER_ERROR";
|
|
10991
|
-
let
|
|
10998
|
+
let R = "";
|
|
10992
10999
|
if (t === "create") {
|
|
10993
11000
|
if (!d)
|
|
10994
11001
|
throw new Error("VALIDATION_ERROR: Password is required");
|
|
10995
11002
|
if (!l)
|
|
10996
11003
|
throw new Error("VALIDATION_ERROR: Permissions are required");
|
|
10997
11004
|
try {
|
|
10998
|
-
|
|
11005
|
+
R = await qo(e, n, s, r, i, l, d);
|
|
10999
11006
|
} catch (m) {
|
|
11000
11007
|
throw new Error(m.message);
|
|
11001
11008
|
}
|
|
@@ -11065,10 +11072,10 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
11065
11072
|
} catch (m) {
|
|
11066
11073
|
throw new Error(m.message);
|
|
11067
11074
|
}
|
|
11068
|
-
if (
|
|
11069
|
-
return
|
|
11075
|
+
if (R)
|
|
11076
|
+
return R;
|
|
11070
11077
|
}, cu = async (t, e, n) => {
|
|
11071
|
-
const s =
|
|
11078
|
+
const s = st(), r = he(), i = [e];
|
|
11072
11079
|
n && n.trim() !== "" && i.push(n), i.sort();
|
|
11073
11080
|
const o = [];
|
|
11074
11081
|
for (const a of i) {
|
|
@@ -11080,7 +11087,7 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
11080
11087
|
for (const a of o)
|
|
11081
11088
|
t.set(a, { locked: !0 });
|
|
11082
11089
|
}, di = async (t, e) => {
|
|
11083
|
-
const n =
|
|
11090
|
+
const n = st(), s = he(), r = [t];
|
|
11084
11091
|
e && e.trim() !== "" && r.push(e), r.sort();
|
|
11085
11092
|
const i = s.batch();
|
|
11086
11093
|
for (const o of r) {
|
|
@@ -11091,34 +11098,34 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
11091
11098
|
}, uu = async (t, e, n, s) => {
|
|
11092
11099
|
const r = s?.userId;
|
|
11093
11100
|
let i = s?.user, o = s?.context;
|
|
11094
|
-
const a =
|
|
11101
|
+
const a = st(), l = Gt();
|
|
11095
11102
|
if (s?.providedTransaction && r)
|
|
11096
11103
|
throw new Error("PERMISSION_DENIED");
|
|
11097
11104
|
if (s?.providedSchema && r)
|
|
11098
11105
|
throw new Error("PERMISSION_DENIED");
|
|
11099
11106
|
if (s?.providedTransaction && !s?.originalRecord)
|
|
11100
11107
|
throw new Error("PERMISSION_DENIED");
|
|
11101
|
-
let c = s?.providedSchema || await
|
|
11108
|
+
let c = s?.providedSchema || await nt(!0);
|
|
11102
11109
|
if (t.length === 0)
|
|
11103
11110
|
throw new Error("EMPTY_PATH");
|
|
11104
11111
|
const d = t.at(-1), h = Object.keys(c.collections).includes(d), u = l.disabledCollections?.includes(d);
|
|
11105
11112
|
if (!h || u)
|
|
11106
11113
|
throw new Error("COLLECTION_NOT_FOUND");
|
|
11107
|
-
const f = c.collections[d], { labels: g, fields:
|
|
11114
|
+
const f = c.collections[d], { labels: g, fields: R, enableWriteLog: m } = f, E = mt(g.collection, c), w = await ae(l.appName), x = Rt(), k = he();
|
|
11108
11115
|
let v, N;
|
|
11109
11116
|
r && await dr(t, f);
|
|
11110
|
-
const W =
|
|
11117
|
+
const W = Me(k, t, a);
|
|
11111
11118
|
o = o || {}, o.collection = g.collection;
|
|
11112
|
-
let O = s?.originalRecord || await
|
|
11119
|
+
let O = s?.originalRecord || await Xe(t, e, {
|
|
11113
11120
|
userId: r,
|
|
11114
11121
|
noComputedFields: !0,
|
|
11115
11122
|
noEmbeddingFields: !0
|
|
11116
11123
|
}), H = O;
|
|
11117
|
-
r && (H = await
|
|
11124
|
+
r && (H = await Xe(t, e, {
|
|
11118
11125
|
noComputedFields: !0,
|
|
11119
11126
|
noEmbeddingFields: !0
|
|
11120
11127
|
}));
|
|
11121
|
-
for (const b of
|
|
11128
|
+
for (const b of R)
|
|
11122
11129
|
b.type === "Computed" && (delete n[b.name], delete O[b.name]);
|
|
11123
11130
|
if (c = {
|
|
11124
11131
|
...c,
|
|
@@ -11135,30 +11142,30 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
11135
11142
|
throw new Error("VALIDATION_ERROR: User operations are only permitted for auth collections");
|
|
11136
11143
|
if (i?.operation === "delete" && i.permissions)
|
|
11137
11144
|
throw new Error("VALIDATION_ERROR: Permissions are not allowed for delete operations");
|
|
11138
|
-
const
|
|
11139
|
-
|
|
11145
|
+
const S = f.fields.filter((b) => b.saveToAuthToken && !ur(b.name)), p = f.auth && i?.operation === "create", C = f.auth && i?.operation === "delete", I = f.auth && !p && !C && (i?.operation === "update" || n.Role || n.Enabled !== void 0 || n.Name || n.Email || n.Photo_URL || // eslint-disable-next-line security/detect-object-injection
|
|
11146
|
+
S.some((b) => n[b.name] !== void 0)), P = (b) => b.User_ID && (f.auth && !p && !C && i?.operation === "update" || n.Role && n.Role !== b.Role || n.Enabled !== void 0 && n.Enabled !== b.Enabled || n.Name && n.Name !== b.Name || n.Email && n.Email !== b.Email || n.Photo_URL && n.Photo_URL !== b.Photo_URL || S.some(
|
|
11140
11147
|
// eslint-disable-next-line security/detect-object-injection
|
|
11141
11148
|
(B) => n[B.name] !== void 0 && n[B.name] !== b[B.name]
|
|
11142
11149
|
));
|
|
11143
11150
|
delete n.id, Bo(n), fr(n);
|
|
11144
|
-
const y = Ks("update", t, n, c, w, "Online", r || "System", ht.now(),
|
|
11145
|
-
for (const b of
|
|
11146
|
-
!ee(b) &&
|
|
11151
|
+
const y = Ks("update", t, n, c, w, "Online", r || "System", ht.now(), we.serverTimestamp()), _ = ge(y);
|
|
11152
|
+
for (const b of R)
|
|
11153
|
+
!ee(b) && ke(y[b.name]) && b.nullable && (y[b.name] = null);
|
|
11147
11154
|
Ze(y), Ze(O), vt(f, y, c), vt(f, O, c), m && !s?.providedTransaction && await Zt("update", "started", y, a, t, e, f, void 0, O);
|
|
11148
|
-
const
|
|
11155
|
+
const T = {
|
|
11149
11156
|
operation: "update",
|
|
11150
11157
|
data: y,
|
|
11151
11158
|
recordId: e,
|
|
11152
11159
|
context: o,
|
|
11153
|
-
originalRecord:
|
|
11160
|
+
originalRecord: ge(O)
|
|
11154
11161
|
};
|
|
11155
|
-
await ue("preOperation", l, E,
|
|
11162
|
+
await ue("preOperation", l, E, T);
|
|
11156
11163
|
const U = {
|
|
11157
11164
|
operation: "update",
|
|
11158
11165
|
data: y,
|
|
11159
11166
|
recordId: e,
|
|
11160
11167
|
context: o,
|
|
11161
|
-
originalRecord:
|
|
11168
|
+
originalRecord: ge(O)
|
|
11162
11169
|
};
|
|
11163
11170
|
await ue("preWrite", l, E, U), vt(f, y, c), Pn(f, y), Ze(y);
|
|
11164
11171
|
try {
|
|
@@ -11166,49 +11173,49 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
11166
11173
|
throw new Error("Password is required");
|
|
11167
11174
|
if (!s?.providedTransaction) {
|
|
11168
11175
|
const b = { ...H, ...y };
|
|
11169
|
-
|
|
11176
|
+
Qe(b), await fn("update", b, f, E, { operation: "update", data: y, context: o, originalRecord: ge(O) }, c);
|
|
11170
11177
|
}
|
|
11171
11178
|
} catch (b) {
|
|
11172
11179
|
throw new Error(`VALIDATION_ERROR: ${b.message}`);
|
|
11173
11180
|
}
|
|
11174
11181
|
Ze(y), delete n.id, vt(f, y, c), Pn(f, y);
|
|
11175
|
-
for (const b of
|
|
11176
|
-
!ee(b) &&
|
|
11182
|
+
for (const b of R)
|
|
11183
|
+
!ee(b) && ke(y[b.name]) && b.nullable && (y[b.name] = null);
|
|
11177
11184
|
try {
|
|
11178
11185
|
const b = { ...H, ...y };
|
|
11179
|
-
|
|
11186
|
+
Qe(b), Yo("update", f, y, O), Go("update", y, _), await fn("update", b, f, E, { operation: "update", data: y, context: o, originalRecord: ge(O) }, c);
|
|
11180
11187
|
} catch (b) {
|
|
11181
11188
|
throw new Error(`VALIDATION_ERROR: ${b.message}`);
|
|
11182
11189
|
}
|
|
11183
11190
|
let F;
|
|
11184
11191
|
i && (i.permissions ||= {});
|
|
11185
11192
|
const D = async (b, B, K) => {
|
|
11186
|
-
const [le,
|
|
11193
|
+
const [le, Te, oe, ce, De, Ge] = await Promise.all([
|
|
11187
11194
|
s?.providedTransaction ? Promise.resolve({}) : b.get(k.collection("system_deployment").doc("latest_deploy")),
|
|
11188
11195
|
s?.providedTransaction ? Promise.resolve({}) : b.get(k.collection("system_deployment").doc("maintenance_mode")),
|
|
11189
|
-
s?.providedTransaction ? Promise.resolve(O) :
|
|
11196
|
+
s?.providedTransaction ? Promise.resolve(O) : Xe(t, e, {
|
|
11190
11197
|
userId: r,
|
|
11191
11198
|
providedTransaction: b,
|
|
11192
11199
|
noComputedFields: !0
|
|
11193
11200
|
}),
|
|
11194
11201
|
r ? b.get(k.collection("tenants").doc(a).collection("system_user_permissions").doc(r)) : Promise.resolve({}),
|
|
11195
|
-
s?.providedSchema ? Promise.resolve(s.providedSchema) :
|
|
11202
|
+
s?.providedSchema ? Promise.resolve(s.providedSchema) : nt(),
|
|
11196
11203
|
r ? os(r) : Promise.resolve(void 0)
|
|
11197
11204
|
]);
|
|
11198
11205
|
if (K && (K.size += 3), !s?.providedTransaction) {
|
|
11199
11206
|
if (!le.exists)
|
|
11200
11207
|
throw new Error("VERSION_ERROR");
|
|
11201
|
-
const
|
|
11202
|
-
if (
|
|
11208
|
+
const me = le.data();
|
|
11209
|
+
if (me.force && y.Last_Write_At.valueOf() < me.time.valueOf())
|
|
11203
11210
|
throw new Error("VERSION_ERROR");
|
|
11204
|
-
if (!
|
|
11211
|
+
if (!Te.exists)
|
|
11205
11212
|
throw new Error("MAINTENANCE_MODE");
|
|
11206
|
-
if (
|
|
11213
|
+
if (Te.data().active)
|
|
11207
11214
|
throw new Error("MAINTENANCE_MODE");
|
|
11208
11215
|
}
|
|
11209
11216
|
if (!oe)
|
|
11210
11217
|
throw new Error("NOT_FOUND");
|
|
11211
|
-
if (O = oe, c =
|
|
11218
|
+
if (O = oe, c = De, r) {
|
|
11212
11219
|
if (!ce?.exists)
|
|
11213
11220
|
throw new Error("PERMISSION_DENIED");
|
|
11214
11221
|
if (v = ce.data(), !v.Role)
|
|
@@ -11220,50 +11227,59 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
11220
11227
|
if (K && (K.size += Lo(a, t, e, c, v, N).length), p && O.User_ID || C && !O.User_ID)
|
|
11221
11228
|
throw new Error("USER_ERROR");
|
|
11222
11229
|
if (P(O)) {
|
|
11223
|
-
const
|
|
11224
|
-
if (K && K.size++, !
|
|
11230
|
+
const me = await b.get(k.collection("tenants").doc(a).collection("system_user_permissions").doc(O.User_ID));
|
|
11231
|
+
if (K && K.size++, !me?.exists)
|
|
11225
11232
|
throw new Error("PERMISSION_DENIED");
|
|
11226
|
-
F =
|
|
11233
|
+
F = me.data();
|
|
11227
11234
|
const pt = i?.permissions && Object.keys(i.permissions).length > 0 ? i.permissions : void 0;
|
|
11228
|
-
if (y.Role && y.Role !== O.Role && !pt && (i ||= { operation: "update", permissions: {} }, i.permissions =
|
|
11229
|
-
if (i.permissions.Role ||= y.Role || O.Role, i.permissions.Enabled ??= y.Enabled ?? O.Enabled,
|
|
11235
|
+
if (y.Role && y.Role !== O.Role && !pt && (i ||= { operation: "update", permissions: {} }, i.permissions = ge(F), i.permissions.Role = y.Role), i?.permissions) {
|
|
11236
|
+
if (i.permissions.Role ||= y.Role || O.Role, i.permissions.Enabled ??= y.Enabled ?? O.Enabled, ke(i.permissions.Role) || !i.permissions.Role)
|
|
11230
11237
|
throw new Error("VALIDATION_ERROR: Role field is required");
|
|
11231
|
-
if (
|
|
11238
|
+
if (ke(i.permissions.Enabled) || i.permissions.Enabled === void 0 || i.permissions.Enabled === null)
|
|
11232
11239
|
throw new Error("VALIDATION_ERROR: Enabled field is required");
|
|
11233
11240
|
}
|
|
11234
11241
|
}
|
|
11242
|
+
if (p) {
|
|
11243
|
+
const me = { ...O, ...y };
|
|
11244
|
+
if (Qe(me), me.Role === void 0 || me.Role === null || me.Role === "")
|
|
11245
|
+
throw new Error("VALIDATION_ERROR: Role field is required");
|
|
11246
|
+
if (me.Enabled === void 0 || me.Enabled === null)
|
|
11247
|
+
throw new Error("VALIDATION_ERROR: Enabled field is required");
|
|
11248
|
+
if (me.Email === void 0 || me.Email === null || me.Email === "")
|
|
11249
|
+
throw new Error("VALIDATION_ERROR: Email field is required");
|
|
11250
|
+
}
|
|
11235
11251
|
if (!s?.providedTransaction) {
|
|
11236
|
-
const pt =
|
|
11237
|
-
if (!r || !
|
|
11238
|
-
if (y[
|
|
11252
|
+
const pt = R.filter((Oe) => "unique" in Oe && Oe.unique).map(async (Oe) => {
|
|
11253
|
+
if (!r || !Oe.access || Be(Oe, v, f, N)) {
|
|
11254
|
+
if (y[Oe.name] === void 0 || ke(y[Oe.name]))
|
|
11239
11255
|
return;
|
|
11240
|
-
const Yt =
|
|
11256
|
+
const Yt = We(Oe, E), En = { ...O, ...y };
|
|
11241
11257
|
if (!(r && Yt?.custom?.serverAccess?.read !== void 0 ? await ae(Yt.custom.serverAccess.read, [
|
|
11242
11258
|
v?.Role,
|
|
11243
11259
|
En
|
|
11244
11260
|
]) : !0))
|
|
11245
11261
|
throw new Error("PERMISSION_DENIED");
|
|
11246
|
-
const as = y[
|
|
11262
|
+
const as = y[Oe.name].toString().toLowerCase().replace(/\s/g, "---").replaceAll("/", "|||");
|
|
11247
11263
|
if (Do(as)) {
|
|
11248
11264
|
if (K && K.size++, K && K.size > 500)
|
|
11249
11265
|
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.");
|
|
11250
|
-
const hr = await b.get(k.collection("tenants").doc(a).collection("system_unique").doc(g.collection).collection(`Unique-${g.collection}-${
|
|
11266
|
+
const hr = await b.get(k.collection("tenants").doc(a).collection("system_unique").doc(g.collection).collection(`Unique-${g.collection}-${Oe.name}`).doc(as));
|
|
11251
11267
|
if (hr.exists && hr.data().id !== e)
|
|
11252
|
-
throw new Error(`VALIDATION_ERROR: ${
|
|
11268
|
+
throw new Error(`VALIDATION_ERROR: ${Oe.name} "${y[Oe.name]}" already exists`);
|
|
11253
11269
|
} else
|
|
11254
|
-
throw new Error(`VALIDATION_ERROR: ${
|
|
11270
|
+
throw new Error(`VALIDATION_ERROR: ${Oe.name} "${y[Oe.name]}" is invalid`);
|
|
11255
11271
|
}
|
|
11256
11272
|
});
|
|
11257
11273
|
await Promise.all(pt);
|
|
11258
11274
|
}
|
|
11259
11275
|
if (r && v?.Role) {
|
|
11260
|
-
const
|
|
11261
|
-
if (!(E.custom?.serverAccess?.update !== void 0 ? await ae(E.custom.serverAccess.update, [
|
|
11276
|
+
const me = v.Role, pt = { ...O, ...y };
|
|
11277
|
+
if (!(E.custom?.serverAccess?.update !== void 0 ? await ae(E.custom.serverAccess.update, [me, pt, O]) : !0))
|
|
11262
11278
|
throw new Error("PERMISSION_DENIED");
|
|
11263
11279
|
for (const Yt of f.fields) {
|
|
11264
|
-
const En =
|
|
11280
|
+
const En = We(Yt, E);
|
|
11265
11281
|
if (Object.prototype.hasOwnProperty.call(y, Yt.name) && En?.custom?.serverAccess?.update !== void 0 && !await ae(En.custom.serverAccess.update, [
|
|
11266
|
-
|
|
11282
|
+
me,
|
|
11267
11283
|
pt,
|
|
11268
11284
|
O
|
|
11269
11285
|
]))
|
|
@@ -11281,10 +11297,10 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
11281
11297
|
try {
|
|
11282
11298
|
const K = { size: 1 }, le = { ...O, ...y };
|
|
11283
11299
|
await D(b, !1, K);
|
|
11284
|
-
let
|
|
11285
|
-
!s?.noTwoWay && !s?.providedTransaction && (
|
|
11300
|
+
let Te;
|
|
11301
|
+
!s?.noTwoWay && !s?.providedTransaction && (Te = await Ho("Update", a, e, le, y, f, c, b, K, r, v, O, N));
|
|
11286
11302
|
const oe = Qs(c);
|
|
11287
|
-
lr("update", b, t, e, y, c, f, s, oe,
|
|
11303
|
+
lr("update", b, t, e, y, c, f, s, oe, we.arrayUnion, we.arrayRemove, we.delete, (ce) => k.collection("tenants").doc(a).collection("system_fields").doc(g.collection).collection(`${g.collection}-${ce.name}`).doc(e), (ce, De) => k.collection("tenants").doc(a).collection("system_unique").doc(g.collection).collection(`Unique-${g.collection}-${ce.name}`).doc(De), (ce) => k.collection("tenants").doc(a).collection("system_fields").doc(g.collection).collection(`${g.collection}-${ce}`).doc(e), (ce, De) => Me(k, ce, a).doc(De), (ce, De, Ge) => k.collection("tenants").doc(a).collection("system_fields").doc(ce.collection).collection(`${ce.collection}-${De}`).doc(Ge), (ce, De, Ge) => k.collection("tenants").doc(a).collection("system_fields").doc(ce.collection).collection(`${ce.collection}-${De.replaceAll(" ", "-")}`).doc(Ge), O, Te, K), b.update(W.doc(e), y);
|
|
11288
11304
|
} catch (K) {
|
|
11289
11305
|
if (s?.providedTransaction)
|
|
11290
11306
|
throw K;
|
|
@@ -11295,12 +11311,12 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
11295
11311
|
recordId: e,
|
|
11296
11312
|
context: o,
|
|
11297
11313
|
error: K,
|
|
11298
|
-
originalRecord:
|
|
11299
|
-
},
|
|
11314
|
+
originalRecord: ge(O)
|
|
11315
|
+
}, Te = await ue("postWriteError", l, E, le);
|
|
11300
11316
|
if (m && (await new Promise((oe) => {
|
|
11301
11317
|
setTimeout(oe, 250);
|
|
11302
|
-
}), await Zt("update",
|
|
11303
|
-
throw p && await _n(O), P(O) && await sn(O.User_ID, B, F, "USER_ERROR"), C && await k.collection("tenants").doc(a).collection(g.collection).doc(e).update({ User_ID:
|
|
11318
|
+
}), await Zt("update", Te?.resolved ? "success" : "failed", y, a, t, e, f, Te?.resolved ? void 0 : K, O)), !Te?.resolved)
|
|
11319
|
+
throw p && await _n(O), P(O) && await sn(O.User_ID, B, F, "USER_ERROR"), C && await k.collection("tenants").doc(a).collection(g.collection).doc(e).update({ User_ID: we.delete() }), K;
|
|
11304
11320
|
}
|
|
11305
11321
|
}
|
|
11306
11322
|
(p || P(O) || C) && await ai(di, [e, O.User_ID]).catch(() => {
|
|
@@ -11317,9 +11333,9 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
11317
11333
|
throw new Error("USER_ERROR");
|
|
11318
11334
|
}
|
|
11319
11335
|
const B = { ...O, ...y };
|
|
11320
|
-
|
|
11336
|
+
Qe(B);
|
|
11321
11337
|
const K = await lu(i?.operation || "update", a, e, l, f, B, O, b, i?.permissions, F, i?.password);
|
|
11322
|
-
p && (y.User_ID = K), C && (y.User_ID =
|
|
11338
|
+
p && (y.User_ID = K), C && (y.User_ID = we.delete());
|
|
11323
11339
|
}
|
|
11324
11340
|
s?.providedTransaction ? await M(s.providedTransaction, b) : await k.runTransaction(async (B) => {
|
|
11325
11341
|
await M(B, b);
|
|
@@ -11335,40 +11351,40 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
11335
11351
|
data: y,
|
|
11336
11352
|
recordId: e,
|
|
11337
11353
|
context: o,
|
|
11338
|
-
originalRecord:
|
|
11354
|
+
originalRecord: ge(O)
|
|
11339
11355
|
}, B = { ...b };
|
|
11340
11356
|
await ue("postWrite", l, E, b), await ue("postOperation", l, E, B);
|
|
11341
11357
|
}
|
|
11342
11358
|
const J = { ...O, ...y };
|
|
11343
|
-
return
|
|
11359
|
+
return Qe(J), { id: e, ...J };
|
|
11344
11360
|
}, Fu = async (t, e, n) => {
|
|
11345
11361
|
const s = n?.userId;
|
|
11346
11362
|
let r = n?.context;
|
|
11347
|
-
const i =
|
|
11348
|
-
let a = await
|
|
11363
|
+
const i = st(), o = Gt();
|
|
11364
|
+
let a = await nt();
|
|
11349
11365
|
if (t.length === 0)
|
|
11350
11366
|
throw new Error("EMPTY_PATH");
|
|
11351
11367
|
const l = t.at(-1), c = Object.keys(a.collections).includes(l), d = o.disabledCollections?.includes(l);
|
|
11352
11368
|
if (!c || d)
|
|
11353
11369
|
throw new Error("COLLECTION_NOT_FOUND");
|
|
11354
|
-
const h = a.collections[l], { labels: u, auth: f, enableWriteLog: g, softDelete:
|
|
11355
|
-
if (
|
|
11356
|
-
return await uu(t, e, { [
|
|
11370
|
+
const h = a.collections[l], { labels: u, auth: f, enableWriteLog: g, softDelete: R } = h, m = mt(u.collection, a), E = await ae(o.appName);
|
|
11371
|
+
if (R && !f && !n?.force)
|
|
11372
|
+
return await uu(t, e, { [R.archivedField]: !0, [R.timestampField]: we.serverTimestamp() }, { userId: s });
|
|
11357
11373
|
const w = he();
|
|
11358
11374
|
let x;
|
|
11359
11375
|
s && await dr(t, h);
|
|
11360
|
-
const k =
|
|
11376
|
+
const k = Me(w, t, i);
|
|
11361
11377
|
r = r || {}, r.collection = u.collection;
|
|
11362
|
-
const v = await
|
|
11363
|
-
let N = Ks("delete", t, v, a, E, "Online", s || "System", ht.now(),
|
|
11378
|
+
const v = await Xe(t, e, { userId: s });
|
|
11379
|
+
let N = Ks("delete", t, v, a, E, "Online", s || "System", ht.now(), we.serverTimestamp());
|
|
11364
11380
|
const W = Mn(N);
|
|
11365
11381
|
Ze(N), g && await Zt("delete", "started", N, i, t, e, h), await ue("preOperation", o, m, { operation: "delete", data: N, recordId: e, context: r }), await ue("preWrite", o, m, { operation: "delete", data: N, recordId: e, context: r }), Ze(N);
|
|
11366
|
-
const
|
|
11367
|
-
const [y, _,
|
|
11382
|
+
const S = async (P) => {
|
|
11383
|
+
const [y, _, T, U] = await Promise.all([
|
|
11368
11384
|
P.get(w.collection("system_deployment").doc("maintenance_mode")),
|
|
11369
|
-
|
|
11385
|
+
Xe(t, e, { userId: s, providedTransaction: P }),
|
|
11370
11386
|
s ? P.get(w.collection("tenants").doc(i).collection("system_user_permissions").doc(s)) : Promise.resolve({}),
|
|
11371
|
-
|
|
11387
|
+
nt()
|
|
11372
11388
|
]);
|
|
11373
11389
|
if (!y.exists)
|
|
11374
11390
|
throw new Error("MAINTENANCE_MODE");
|
|
@@ -11377,9 +11393,9 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
11377
11393
|
if (!_)
|
|
11378
11394
|
throw new Error("NOT_FOUND");
|
|
11379
11395
|
if (N = { ..._, ...W }, a = U, s) {
|
|
11380
|
-
if (!
|
|
11396
|
+
if (!T?.exists)
|
|
11381
11397
|
throw new Error("PERMISSION_DENIED");
|
|
11382
|
-
if (x =
|
|
11398
|
+
if (x = T.data(), !x.Role)
|
|
11383
11399
|
throw new Error("USER_ERROR");
|
|
11384
11400
|
if (!x.Enabled)
|
|
11385
11401
|
throw new Error("PERMISSION_DENIED");
|
|
@@ -11392,13 +11408,13 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
11392
11408
|
}
|
|
11393
11409
|
};
|
|
11394
11410
|
h.auth && (await w.runTransaction(async (P) => {
|
|
11395
|
-
await
|
|
11411
|
+
await S(P);
|
|
11396
11412
|
}, { maxAttempts: 10 }), N.User_ID && await _n(N));
|
|
11397
11413
|
try {
|
|
11398
11414
|
await w.runTransaction(async (P) => {
|
|
11399
|
-
await
|
|
11415
|
+
await S(P);
|
|
11400
11416
|
const y = Qs(a);
|
|
11401
|
-
lr("delete", P, t, e, N, a, h, n, y,
|
|
11417
|
+
lr("delete", P, t, e, N, a, h, n, y, we.arrayUnion, we.arrayRemove, we.delete, (_) => w.collection("tenants").doc(i).collection("system_fields").doc(u.collection).collection(`${u.collection}-${_.name}`).doc(e), (_, T) => w.collection("tenants").doc(i).collection("system_unique").doc(u.collection).collection(`Unique-${u.collection}-${_.name}`).doc(T), (_) => w.collection("tenants").doc(i).collection("system_fields").doc(u.collection).collection(`${u.collection}-${_}`).doc(e), (_, T) => Me(w, _, i).doc(T), (_, T, U) => w.collection("tenants").doc(i).collection("system_fields").doc(_.collection).collection(`${_.collection}-${T}`).doc(U), (_, T, U) => w.collection("tenants").doc(i).collection("system_fields").doc(_.collection).collection(`${_.collection}-${T.replaceAll(" ", "-")}`).doc(U)), P.delete(k.doc(e));
|
|
11402
11418
|
}, { maxAttempts: 10 });
|
|
11403
11419
|
} catch (P) {
|
|
11404
11420
|
const _ = await ue("postWriteError", o, m, {
|
|
@@ -11408,10 +11424,10 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
11408
11424
|
context: r,
|
|
11409
11425
|
error: P
|
|
11410
11426
|
});
|
|
11411
|
-
if (g && (await new Promise((
|
|
11412
|
-
setTimeout(
|
|
11427
|
+
if (g && (await new Promise((T) => {
|
|
11428
|
+
setTimeout(T, 250);
|
|
11413
11429
|
}), await Zt("delete", _?.resolved ? "success" : "failed", N, i, t, e, h, _?.resolved ? void 0 : P)), !_?.resolved)
|
|
11414
|
-
throw h.auth && N.User_ID && await w.collection("tenants").doc(i).collection(u.collection).doc(e).update({ User_ID:
|
|
11430
|
+
throw h.auth && N.User_ID && await w.collection("tenants").doc(i).collection(u.collection).doc(e).update({ User_ID: we.delete() }), P;
|
|
11415
11431
|
}
|
|
11416
11432
|
const p = { operation: "delete", data: N, recordId: e, context: r }, C = { ...p };
|
|
11417
11433
|
return await ue("postWrite", o, m, p), await ue("postOperation", o, m, C), { id: e, ...N };
|
|
@@ -11458,36 +11474,36 @@ export {
|
|
|
11458
11474
|
Bo as deserializeTimestamps,
|
|
11459
11475
|
Du as deserializeTimestampsWithoutUnderscores,
|
|
11460
11476
|
Uu as displayDate,
|
|
11461
|
-
|
|
11477
|
+
nt as fetchCurrentSchema,
|
|
11462
11478
|
Au as fetchLastSchema,
|
|
11463
11479
|
ku as getCachedConfigValue,
|
|
11464
11480
|
tu as getCollectionRefs,
|
|
11465
11481
|
mt as getCustomizationFile,
|
|
11466
11482
|
eu as getCustomizationFiles,
|
|
11467
11483
|
Lo as getDocumentRefs,
|
|
11468
|
-
|
|
11484
|
+
Me as getFirestorePathRef,
|
|
11469
11485
|
Gt as getGlobalConfigModule,
|
|
11470
11486
|
bu as getInputSchema,
|
|
11471
11487
|
Iu as getMaintenanceInfo,
|
|
11472
11488
|
Mo as getMode,
|
|
11473
|
-
|
|
11489
|
+
Xe as getOne,
|
|
11474
11490
|
Uo as getSome,
|
|
11475
11491
|
he as getStokerFirestore,
|
|
11476
|
-
|
|
11492
|
+
st as getTenant,
|
|
11477
11493
|
Po as getTimezone,
|
|
11478
11494
|
os as getUser,
|
|
11479
|
-
|
|
11495
|
+
Su as getVersionInfo,
|
|
11480
11496
|
Ja as getZodSchema,
|
|
11481
11497
|
Nu as initializeFirebase,
|
|
11482
|
-
|
|
11483
|
-
|
|
11498
|
+
Ru as initializeStoker,
|
|
11499
|
+
ke as isDeleteSentinel,
|
|
11484
11500
|
Lu as keepTimezone,
|
|
11485
11501
|
Vu as removeTimezone,
|
|
11486
11502
|
xu as runChildProcess,
|
|
11487
11503
|
Zo as sendMail,
|
|
11488
11504
|
$u as sendMessage,
|
|
11489
11505
|
Mu as serializeTimestamps,
|
|
11490
|
-
|
|
11506
|
+
Tu as setTenant,
|
|
11491
11507
|
ae as tryPromise,
|
|
11492
11508
|
uu as updateRecord,
|
|
11493
11509
|
lu as updateUser,
|