@stoker-platform/web-client 0.5.35 → 0.5.37
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.js +1129 -1123
- package/dist/types/main.d.ts +1 -0
- package/dist/types/read/cache/preloadCollection.d.ts +1 -1
- package/dist/types/read/cache/preloadData.d.ts +1 -1
- package/dist/types/read/getCollectionRefs.d.ts +1 -1
- package/dist/types/read/getSome.d.ts +0 -1
- package/dist/types/read/subscribeMany.d.ts +5 -1
- package/package.json +3 -3
package/dist/bundle.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { getApp as it, registerVersion as xm, initializeApp as zn, setLogLevel as Qr, onLog as Nm } from "firebase/app";
|
|
2
2
|
import { isSupported as Fm, initializeAnalytics as Dm, setConsent as Mm } from "firebase/analytics";
|
|
3
|
-
import { getAuth as
|
|
3
|
+
import { getAuth as dr, validatePassword as _d, initializeAuth as Oc, indexedDBLocalPersistence as Pm, browserLocalPersistence as qm, browserSessionPersistence as Ec, inMemoryPersistence as Sc, beforeAuthStateChanged as Lm, connectAuthEmulator as $m, onAuthStateChanged as Bn, getIdTokenResult as jm, signOut as vd, signInWithEmailAndPassword as Um, getMultiFactorResolver as Vm, TotpMultiFactorGenerator as Xa, signInWithCustomToken as Wm, multiFactor as Tc } from "firebase/auth";
|
|
4
4
|
import { getDatabase as wd, onValue as zm, ref as Bm, connectDatabaseEmulator as Zm } from "firebase/database";
|
|
5
|
-
import { getFirestore as
|
|
5
|
+
import { getFirestore as We, where as ye, query as he, collection as qr, and as Xr, or as Rc, onSnapshot as hr, doc as ke, Timestamp as Bt, setDoc as Gm, getDoc as bd, orderBy as rt, limit as Xt, startAfter as eo, endBefore as to, limitToLast as Fr, getDocsFromCache as Od, getDocsFromServer as Hm, getDocs as Km, getCountFromServer as Ed, getDocFromCache as Ym, getDocFromServer as Jm, writeBatch as Ao, serverTimestamp as Lr, deleteField as Cn, arrayRemove as ko, arrayUnion as Io, collectionGroup as Qm, connectFirestoreEmulator as Cc, persistentLocalCache as Ac, persistentSingleTabManager as kc, persistentMultipleTabManager as Ic, memoryEagerGarbageCollector as Xm, memoryLruGarbageCollector as ep, memoryLocalCache as tp, initializeFirestore as Zn, getPersistentCacheIndexManager as rp, enablePersistentCacheIndexAutoCreation as np, terminate as sp, clearIndexedDbPersistence as xc, waitForPendingWrites as ip, onSnapshotsInSync as Sd, startAt as ap, endAt as op, addDoc as Td } from "firebase/firestore";
|
|
6
6
|
import { connectStorageEmulator as cp, getStorage as lp } from "firebase/storage";
|
|
7
7
|
import { getFunctions as Ue, httpsCallable as Je, connectFunctionsEmulator as up } from "firebase/functions";
|
|
8
8
|
import { ReCaptchaEnterpriseProvider as fp, initializeAppCheck as Gn, onTokenChanged as Hn } from "firebase/app-check";
|
|
9
9
|
import { getPerformance as dp } from "firebase/performance";
|
|
10
10
|
import { getRemoteConfig as hp, fetchAndActivate as mp } from "firebase/remote-config";
|
|
11
|
-
const pp = "0.5.
|
|
11
|
+
const pp = "0.5.37", yp = (r) => !!r.auth, vt = (r, e) => {
|
|
12
12
|
if (e?.operations)
|
|
13
13
|
return e.operations.includes(r);
|
|
14
14
|
}, An = (r, e) => e ? e.Role ? r.access?.includes(e.Role) : !1 : !0, gp = (r, e) => e ? !e.Role || r.restrictCreate === !0 ? !1 : typeof r.restrictCreate == "object" ? r.restrictCreate?.includes(e.Role) : !0 : !0, _p = (r, e) => e ? !e.Role || r.restrictUpdate === !0 ? !1 : typeof r.restrictUpdate == "object" ? r.restrictUpdate?.includes(e.Role) : !0 : !0, re = (r, e) => r.filter((t) => t.name === e)[0], _e = (r) => ["OneToOne", "OneToMany", "ManyToOne", "ManyToMany"].includes(r.type), Rd = (r, e) => {
|
|
@@ -33,7 +33,7 @@ const pp = "0.5.35", yp = (r) => !!r.auth, vt = (r, e) => {
|
|
|
33
33
|
}, Cd = (r, e, t) => {
|
|
34
34
|
const n = [], { access: s } = r, { entityRestrictions: i } = s;
|
|
35
35
|
return i?.parentFilters?.forEach((a) => {
|
|
36
|
-
if (!a.roles.some((
|
|
36
|
+
if (!a.roles.some((d) => d.role === t.Role))
|
|
37
37
|
return;
|
|
38
38
|
const o = a.collectionField, c = re(r.fields, o);
|
|
39
39
|
if (!_e(c))
|
|
@@ -41,11 +41,11 @@ const pp = "0.5.35", yp = (r) => !!r.auth, vt = (r, e) => {
|
|
|
41
41
|
const l = t.collections?.[c.collection], f = e.collections[c.collection].access.entityRestrictions;
|
|
42
42
|
if (!f)
|
|
43
43
|
throw new Error("PERMISSION_DENIED");
|
|
44
|
-
const
|
|
45
|
-
if (!
|
|
44
|
+
const h = f.restrictions?.find((d) => d.type === a.type && d.roles.some((p) => p.role === t.Role));
|
|
45
|
+
if (!h)
|
|
46
46
|
throw new Error("PERMISSION_DENIED");
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
h.roles.forEach((d) => {
|
|
48
|
+
d.role === t.Role && (!f.assignable?.includes(t.Role) || l?.restrictEntities) && n.push({ parentFilter: a, parentRestriction: h });
|
|
49
49
|
});
|
|
50
50
|
}), n;
|
|
51
51
|
}, kn = (r, e, t) => {
|
|
@@ -65,81 +65,81 @@ const pp = "0.5.35", yp = (r) => !!r.auth, vt = (r, e) => {
|
|
|
65
65
|
l = !1;
|
|
66
66
|
return;
|
|
67
67
|
}
|
|
68
|
-
const u = Rd(e, s), f = xo(e, s),
|
|
69
|
-
u?.filter((
|
|
70
|
-
"operations" in
|
|
71
|
-
}), u?.filter((
|
|
72
|
-
if ("operations" in
|
|
68
|
+
const u = Rd(e, s), f = xo(e, s), h = Cd(e, t, s);
|
|
69
|
+
u?.filter((m) => m.type === "Record_Owner").forEach((m) => {
|
|
70
|
+
"operations" in m && m.operations && !m.operations.includes(r) || i.Created_By !== n && (l = !1);
|
|
71
|
+
}), u?.filter((m) => m.type === "Record_User").forEach((m) => {
|
|
72
|
+
if ("operations" in m && m.operations && !m.operations.includes(r))
|
|
73
73
|
return;
|
|
74
|
-
const
|
|
75
|
-
i[`${
|
|
76
|
-
}), u?.filter((
|
|
77
|
-
if ("operations" in
|
|
74
|
+
const T = re(o, m.collectionField);
|
|
75
|
+
i[`${T.name}_Array`]?.includes(s.Doc_ID) || (l = !1);
|
|
76
|
+
}), u?.filter((m) => m.type === "Record_Property").forEach((m) => {
|
|
77
|
+
if ("operations" in m && m.operations && !m.operations.includes(r))
|
|
78
78
|
return;
|
|
79
|
-
const
|
|
80
|
-
|
|
79
|
+
const T = re(o, m.propertyField), R = m.roles.find((v) => v.role === s.Role);
|
|
80
|
+
T.type === "Array" ? R.values?.some((v) => i[T.name].includes(v)) || (l = !1) : R.values?.includes(i[T.name]) || (l = !1);
|
|
81
81
|
});
|
|
82
|
-
let
|
|
83
|
-
f?.filter((
|
|
84
|
-
|
|
82
|
+
let d = !0, p = !1;
|
|
83
|
+
f?.filter((m) => m.type === "Individual").forEach(() => {
|
|
84
|
+
p = !0, c?.individualEntities?.includes(i.id) || (d = !1);
|
|
85
85
|
});
|
|
86
|
-
let E = !0,
|
|
87
|
-
if (f?.filter((
|
|
88
|
-
|
|
89
|
-
const
|
|
90
|
-
c?.parentEntities?.some((R) => i[`${
|
|
91
|
-
}), f?.filter((
|
|
92
|
-
|
|
93
|
-
const
|
|
94
|
-
Object.entries(c?.parentPropertyEntities || {}).some((
|
|
95
|
-
const [
|
|
96
|
-
return
|
|
86
|
+
let E = !0, y = !1;
|
|
87
|
+
if (f?.filter((m) => m.type === "Parent").forEach((m) => {
|
|
88
|
+
y = !0;
|
|
89
|
+
const T = re(o, m.collectionField);
|
|
90
|
+
c?.parentEntities?.some((R) => i[`${T.name}_Array`].includes(R)) || (E = !1);
|
|
91
|
+
}), f?.filter((m) => m.type === "Parent_Property").forEach((m) => {
|
|
92
|
+
y = !0;
|
|
93
|
+
const T = re(o, m.collectionField), R = re(o, m.propertyField);
|
|
94
|
+
Object.entries(c?.parentPropertyEntities || {}).some((v) => {
|
|
95
|
+
const [C, g] = v;
|
|
96
|
+
return C === i[R.name] && i[`${T.name}_Array`].some((k) => g.includes(k));
|
|
97
97
|
}) || (E = !1);
|
|
98
|
-
}),
|
|
99
|
-
if (!(
|
|
98
|
+
}), p && y) {
|
|
99
|
+
if (!(d || E)) {
|
|
100
100
|
l = !1;
|
|
101
101
|
return;
|
|
102
102
|
}
|
|
103
|
-
} else if (!
|
|
103
|
+
} else if (!d || !E) {
|
|
104
104
|
l = !1;
|
|
105
105
|
return;
|
|
106
106
|
}
|
|
107
|
-
let
|
|
108
|
-
|
|
107
|
+
let _ = !0, S = !1;
|
|
108
|
+
h?.filter((m) => m.parentFilter.type === "Individual").forEach((m) => {
|
|
109
109
|
S = !0;
|
|
110
|
-
const { parentFilter:
|
|
111
|
-
if (!
|
|
110
|
+
const { parentFilter: T } = m, R = re(o, T.collectionField), v = s.collections?.[R.collection];
|
|
111
|
+
if (!v) {
|
|
112
112
|
l = !1;
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
115
|
-
|
|
115
|
+
v.individualEntities?.some((C) => i[`${R.name}_Array`].includes(C)) || (_ = !1);
|
|
116
116
|
});
|
|
117
|
-
let
|
|
118
|
-
if (
|
|
119
|
-
|
|
120
|
-
const { parentFilter:
|
|
121
|
-
if (!
|
|
117
|
+
let A = !0, F = !1;
|
|
118
|
+
if (h?.filter((m) => m.parentFilter.type === "Parent").forEach((m) => {
|
|
119
|
+
F = !0;
|
|
120
|
+
const { parentFilter: T } = m, R = re(o, T.collectionField), v = re(o, T.parentCollectionField), C = s.collections?.[R.collection];
|
|
121
|
+
if (!C) {
|
|
122
122
|
l = !1;
|
|
123
123
|
return;
|
|
124
124
|
}
|
|
125
|
-
|
|
126
|
-
}),
|
|
127
|
-
|
|
128
|
-
const { parentFilter:
|
|
129
|
-
if (!
|
|
125
|
+
C.parentEntities?.some((g) => i[`${v.name}_Array`].includes(g)) || (A = !1);
|
|
126
|
+
}), h?.filter((m) => m.parentFilter.type === "Parent_Property").forEach((m) => {
|
|
127
|
+
F = !0;
|
|
128
|
+
const { parentFilter: T } = m, R = re(o, T.collectionField), v = re(o, T.parentPropertyField), C = re(o, T.parentCollectionField), g = s.collections?.[R.collection];
|
|
129
|
+
if (!g) {
|
|
130
130
|
l = !1;
|
|
131
131
|
return;
|
|
132
132
|
}
|
|
133
|
-
Object.entries(
|
|
133
|
+
Object.entries(g.parentPropertyEntities || {}).some((k) => {
|
|
134
134
|
const [I, b] = k;
|
|
135
|
-
return I === i[
|
|
136
|
-
}) || (
|
|
137
|
-
}), S &&
|
|
138
|
-
if (!(
|
|
135
|
+
return I === i[v.name] && i[`${C.name}_Array`].some((w) => b.includes(w));
|
|
136
|
+
}) || (A = !1);
|
|
137
|
+
}), S && F) {
|
|
138
|
+
if (!(_ || A)) {
|
|
139
139
|
l = !1;
|
|
140
140
|
return;
|
|
141
141
|
}
|
|
142
|
-
} else if (!
|
|
142
|
+
} else if (!_ || !A) {
|
|
143
143
|
l = !1;
|
|
144
144
|
return;
|
|
145
145
|
}
|
|
@@ -354,7 +354,7 @@ function Ip() {
|
|
|
354
354
|
return fs = t, fs;
|
|
355
355
|
}
|
|
356
356
|
var ds, Kc;
|
|
357
|
-
function
|
|
357
|
+
function mr() {
|
|
358
358
|
if (Kc) return ds;
|
|
359
359
|
Kc = 1;
|
|
360
360
|
var r = Wr(), e = kp(), t = Ip(), n = "[object Null]", s = "[object Undefined]", i = r ? r.toStringTag : void 0;
|
|
@@ -377,7 +377,7 @@ var ms, Jc;
|
|
|
377
377
|
function No() {
|
|
378
378
|
if (Jc) return ms;
|
|
379
379
|
Jc = 1;
|
|
380
|
-
var r =
|
|
380
|
+
var r = mr(), e = wt(), t = "[object AsyncFunction]", n = "[object Function]", s = "[object GeneratorFunction]", i = "[object Proxy]";
|
|
381
381
|
function a(o) {
|
|
382
382
|
if (!e(o))
|
|
383
383
|
return !1;
|
|
@@ -433,11 +433,11 @@ function Fp() {
|
|
|
433
433
|
var r = No(), e = Np(), t = wt(), n = Id(), s = /[\\^$.*+?()[\]{}|]/g, i = /^\[object .+?Constructor\]$/, a = Function.prototype, o = Object.prototype, c = a.toString, l = o.hasOwnProperty, u = RegExp(
|
|
434
434
|
"^" + c.call(l).replace(s, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
435
435
|
);
|
|
436
|
-
function f(
|
|
437
|
-
if (!t(
|
|
436
|
+
function f(h) {
|
|
437
|
+
if (!t(h) || e(h))
|
|
438
438
|
return !1;
|
|
439
|
-
var
|
|
440
|
-
return
|
|
439
|
+
var d = r(h) ? u : i;
|
|
440
|
+
return d.test(n(h));
|
|
441
441
|
}
|
|
442
442
|
return _s = f, _s;
|
|
443
443
|
}
|
|
@@ -723,32 +723,32 @@ function xd() {
|
|
|
723
723
|
Cl = 1;
|
|
724
724
|
var r = Yp(), e = Jp(), t = Qp(), n = 1, s = 2;
|
|
725
725
|
function i(a, o, c, l, u, f) {
|
|
726
|
-
var
|
|
727
|
-
if (
|
|
726
|
+
var h = c & n, d = a.length, p = o.length;
|
|
727
|
+
if (d != p && !(h && p > d))
|
|
728
728
|
return !1;
|
|
729
|
-
var E = f.get(a),
|
|
730
|
-
if (E &&
|
|
731
|
-
return E == o &&
|
|
732
|
-
var
|
|
733
|
-
for (f.set(a, o), f.set(o, a); ++
|
|
734
|
-
var
|
|
729
|
+
var E = f.get(a), y = f.get(o);
|
|
730
|
+
if (E && y)
|
|
731
|
+
return E == o && y == a;
|
|
732
|
+
var _ = -1, S = !0, A = c & s ? new r() : void 0;
|
|
733
|
+
for (f.set(a, o), f.set(o, a); ++_ < d; ) {
|
|
734
|
+
var F = a[_], m = o[_];
|
|
735
735
|
if (l)
|
|
736
|
-
var
|
|
737
|
-
if (
|
|
738
|
-
if (
|
|
736
|
+
var T = h ? l(m, F, _, o, a, f) : l(F, m, _, a, o, f);
|
|
737
|
+
if (T !== void 0) {
|
|
738
|
+
if (T)
|
|
739
739
|
continue;
|
|
740
740
|
S = !1;
|
|
741
741
|
break;
|
|
742
742
|
}
|
|
743
|
-
if (
|
|
744
|
-
if (!e(o, function(R,
|
|
745
|
-
if (!t(
|
|
746
|
-
return
|
|
743
|
+
if (A) {
|
|
744
|
+
if (!e(o, function(R, v) {
|
|
745
|
+
if (!t(A, v) && (F === R || u(F, R, c, l, f)))
|
|
746
|
+
return A.push(v);
|
|
747
747
|
})) {
|
|
748
748
|
S = !1;
|
|
749
749
|
break;
|
|
750
750
|
}
|
|
751
|
-
} else if (!(
|
|
751
|
+
} else if (!(F === m || u(F, m, c, l, f))) {
|
|
752
752
|
S = !1;
|
|
753
753
|
break;
|
|
754
754
|
}
|
|
@@ -792,43 +792,43 @@ var Hs, xl;
|
|
|
792
792
|
function ty() {
|
|
793
793
|
if (xl) return Hs;
|
|
794
794
|
xl = 1;
|
|
795
|
-
var r = Wr(), e = Nd(), t = Vr(), n = xd(), s = Xp(), i = ey(), a = 1, o = 2, c = "[object Boolean]", l = "[object Date]", u = "[object Error]", f = "[object Map]",
|
|
796
|
-
function
|
|
797
|
-
switch (
|
|
795
|
+
var r = Wr(), e = Nd(), t = Vr(), n = xd(), s = Xp(), i = ey(), a = 1, o = 2, c = "[object Boolean]", l = "[object Date]", u = "[object Error]", f = "[object Map]", h = "[object Number]", d = "[object RegExp]", p = "[object Set]", E = "[object String]", y = "[object Symbol]", _ = "[object ArrayBuffer]", S = "[object DataView]", A = r ? r.prototype : void 0, F = A ? A.valueOf : void 0;
|
|
796
|
+
function m(T, R, v, C, g, k, I) {
|
|
797
|
+
switch (v) {
|
|
798
798
|
case S:
|
|
799
|
-
if (
|
|
799
|
+
if (T.byteLength != R.byteLength || T.byteOffset != R.byteOffset)
|
|
800
800
|
return !1;
|
|
801
|
-
|
|
802
|
-
case
|
|
803
|
-
return !(
|
|
801
|
+
T = T.buffer, R = R.buffer;
|
|
802
|
+
case _:
|
|
803
|
+
return !(T.byteLength != R.byteLength || !k(new e(T), new e(R)));
|
|
804
804
|
case c:
|
|
805
805
|
case l:
|
|
806
|
-
case d:
|
|
807
|
-
return t(+C, +R);
|
|
808
|
-
case u:
|
|
809
|
-
return C.name == R.name && C.message == R.message;
|
|
810
806
|
case h:
|
|
807
|
+
return t(+T, +R);
|
|
808
|
+
case u:
|
|
809
|
+
return T.name == R.name && T.message == R.message;
|
|
810
|
+
case d:
|
|
811
811
|
case E:
|
|
812
|
-
return
|
|
812
|
+
return T == R + "";
|
|
813
813
|
case f:
|
|
814
814
|
var b = s;
|
|
815
|
-
case
|
|
816
|
-
var w =
|
|
817
|
-
if (b || (b = i),
|
|
815
|
+
case p:
|
|
816
|
+
var w = C & a;
|
|
817
|
+
if (b || (b = i), T.size != R.size && !w)
|
|
818
818
|
return !1;
|
|
819
|
-
var O = I.get(
|
|
819
|
+
var O = I.get(T);
|
|
820
820
|
if (O)
|
|
821
821
|
return O == R;
|
|
822
|
-
|
|
823
|
-
var x = n(b(
|
|
824
|
-
return I.delete(
|
|
825
|
-
case
|
|
826
|
-
if (
|
|
827
|
-
return
|
|
822
|
+
C |= o, I.set(T, R);
|
|
823
|
+
var x = n(b(T), b(R), C, g, k, I);
|
|
824
|
+
return I.delete(T), x;
|
|
825
|
+
case y:
|
|
826
|
+
if (F)
|
|
827
|
+
return F.call(T) == F.call(R);
|
|
828
828
|
}
|
|
829
829
|
return !1;
|
|
830
830
|
}
|
|
831
|
-
return Hs =
|
|
831
|
+
return Hs = m, Hs;
|
|
832
832
|
}
|
|
833
833
|
var Ks, Nl;
|
|
834
834
|
function Fd() {
|
|
@@ -916,7 +916,7 @@ var ni, jl;
|
|
|
916
916
|
function sy() {
|
|
917
917
|
if (jl) return ni;
|
|
918
918
|
jl = 1;
|
|
919
|
-
var r =
|
|
919
|
+
var r = mr(), e = bt(), t = "[object Arguments]";
|
|
920
920
|
function n(s) {
|
|
921
921
|
return e(s) && r(s) == t;
|
|
922
922
|
}
|
|
@@ -933,7 +933,7 @@ function Pd() {
|
|
|
933
933
|
};
|
|
934
934
|
return si = i, si;
|
|
935
935
|
}
|
|
936
|
-
var
|
|
936
|
+
var Sr = { exports: {} }, ii, Vl;
|
|
937
937
|
function iy() {
|
|
938
938
|
if (Vl) return ii;
|
|
939
939
|
Vl = 1;
|
|
@@ -942,13 +942,13 @@ function iy() {
|
|
|
942
942
|
}
|
|
943
943
|
return ii = r, ii;
|
|
944
944
|
}
|
|
945
|
-
|
|
945
|
+
Sr.exports;
|
|
946
946
|
var Wl;
|
|
947
947
|
function Mn() {
|
|
948
948
|
return Wl || (Wl = 1, (function(r, e) {
|
|
949
949
|
var t = ct(), n = iy(), s = e && !e.nodeType && e, i = s && !0 && r && !r.nodeType && r, a = i && i.exports === s, o = a ? t.Buffer : void 0, c = o ? o.isBuffer : void 0, l = c || n;
|
|
950
950
|
r.exports = l;
|
|
951
|
-
})(
|
|
951
|
+
})(Sr, Sr.exports)), Sr.exports;
|
|
952
952
|
}
|
|
953
953
|
var ai, zl;
|
|
954
954
|
function qo() {
|
|
@@ -975,8 +975,8 @@ var ci, Zl;
|
|
|
975
975
|
function ay() {
|
|
976
976
|
if (Zl) return ci;
|
|
977
977
|
Zl = 1;
|
|
978
|
-
var r =
|
|
979
|
-
k[S] = k[
|
|
978
|
+
var r = mr(), e = qd(), t = bt(), n = "[object Arguments]", s = "[object Array]", i = "[object Boolean]", a = "[object Date]", o = "[object Error]", c = "[object Function]", l = "[object Map]", u = "[object Number]", f = "[object Object]", h = "[object RegExp]", d = "[object Set]", p = "[object String]", E = "[object WeakMap]", y = "[object ArrayBuffer]", _ = "[object DataView]", S = "[object Float32Array]", A = "[object Float64Array]", F = "[object Int8Array]", m = "[object Int16Array]", T = "[object Int32Array]", R = "[object Uint8Array]", v = "[object Uint8ClampedArray]", C = "[object Uint16Array]", g = "[object Uint32Array]", k = {};
|
|
979
|
+
k[S] = k[A] = k[F] = k[m] = k[T] = k[R] = k[v] = k[C] = k[g] = !0, k[n] = k[s] = k[y] = k[i] = k[_] = k[a] = k[o] = k[c] = k[l] = k[u] = k[f] = k[h] = k[d] = k[p] = k[E] = !1;
|
|
980
980
|
function I(b) {
|
|
981
981
|
return t(b) && e(b.length) && !!k[r(b)];
|
|
982
982
|
}
|
|
@@ -993,8 +993,8 @@ function Lo() {
|
|
|
993
993
|
}
|
|
994
994
|
return li = r, li;
|
|
995
995
|
}
|
|
996
|
-
var
|
|
997
|
-
|
|
996
|
+
var Tr = { exports: {} };
|
|
997
|
+
Tr.exports;
|
|
998
998
|
var Hl;
|
|
999
999
|
function $o() {
|
|
1000
1000
|
return Hl || (Hl = 1, (function(r, e) {
|
|
@@ -1006,7 +1006,7 @@ function $o() {
|
|
|
1006
1006
|
}
|
|
1007
1007
|
})();
|
|
1008
1008
|
r.exports = o;
|
|
1009
|
-
})(
|
|
1009
|
+
})(Tr, Tr.exports)), Tr.exports;
|
|
1010
1010
|
}
|
|
1011
1011
|
var ui, Kl;
|
|
1012
1012
|
function jo() {
|
|
@@ -1021,14 +1021,14 @@ function Ld() {
|
|
|
1021
1021
|
Yl = 1;
|
|
1022
1022
|
var r = ny(), e = Pd(), t = Dt(), n = Mn(), s = qo(), i = jo(), a = Object.prototype, o = a.hasOwnProperty;
|
|
1023
1023
|
function c(l, u) {
|
|
1024
|
-
var f = t(l),
|
|
1024
|
+
var f = t(l), h = !f && e(l), d = !f && !h && n(l), p = !f && !h && !d && i(l), E = f || h || d || p, y = E ? r(l.length, String) : [], _ = y.length;
|
|
1025
1025
|
for (var S in l)
|
|
1026
1026
|
(u || o.call(l, S)) && !(E && // Safari 9 has enumerable `arguments.length` in strict mode.
|
|
1027
1027
|
(S == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
s(S,
|
|
1031
|
-
return
|
|
1028
|
+
d && (S == "offset" || S == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
1029
|
+
p && (S == "buffer" || S == "byteLength" || S == "byteOffset") || // Skip index properties.
|
|
1030
|
+
s(S, _))) && y.push(S);
|
|
1031
|
+
return y;
|
|
1032
1032
|
}
|
|
1033
1033
|
return fi = c, fi;
|
|
1034
1034
|
}
|
|
@@ -1112,35 +1112,35 @@ function ly() {
|
|
|
1112
1112
|
su = 1;
|
|
1113
1113
|
var r = jd(), e = 1, t = Object.prototype, n = t.hasOwnProperty;
|
|
1114
1114
|
function s(i, a, o, c, l, u) {
|
|
1115
|
-
var f = o & e,
|
|
1116
|
-
if (
|
|
1115
|
+
var f = o & e, h = r(i), d = h.length, p = r(a), E = p.length;
|
|
1116
|
+
if (d != E && !f)
|
|
1117
1117
|
return !1;
|
|
1118
|
-
for (var
|
|
1119
|
-
var
|
|
1120
|
-
if (!(f ?
|
|
1118
|
+
for (var y = d; y--; ) {
|
|
1119
|
+
var _ = h[y];
|
|
1120
|
+
if (!(f ? _ in a : n.call(a, _)))
|
|
1121
1121
|
return !1;
|
|
1122
1122
|
}
|
|
1123
|
-
var S = u.get(i),
|
|
1124
|
-
if (S &&
|
|
1125
|
-
return S == a &&
|
|
1126
|
-
var
|
|
1123
|
+
var S = u.get(i), A = u.get(a);
|
|
1124
|
+
if (S && A)
|
|
1125
|
+
return S == a && A == i;
|
|
1126
|
+
var F = !0;
|
|
1127
1127
|
u.set(i, a), u.set(a, i);
|
|
1128
|
-
for (var
|
|
1129
|
-
|
|
1130
|
-
var
|
|
1128
|
+
for (var m = f; ++y < d; ) {
|
|
1129
|
+
_ = h[y];
|
|
1130
|
+
var T = i[_], R = a[_];
|
|
1131
1131
|
if (c)
|
|
1132
|
-
var
|
|
1133
|
-
if (!(
|
|
1134
|
-
|
|
1132
|
+
var v = f ? c(R, T, _, a, i, u) : c(T, R, _, i, a, u);
|
|
1133
|
+
if (!(v === void 0 ? T === R || l(T, R, o, c, u) : v)) {
|
|
1134
|
+
F = !1;
|
|
1135
1135
|
break;
|
|
1136
1136
|
}
|
|
1137
|
-
|
|
1137
|
+
m || (m = _ == "constructor");
|
|
1138
1138
|
}
|
|
1139
|
-
if (
|
|
1140
|
-
var
|
|
1141
|
-
|
|
1139
|
+
if (F && !m) {
|
|
1140
|
+
var C = i.constructor, g = a.constructor;
|
|
1141
|
+
C != g && "constructor" in i && "constructor" in a && !(typeof C == "function" && C instanceof C && typeof g == "function" && g instanceof g) && (F = !1);
|
|
1142
1142
|
}
|
|
1143
|
-
return u.delete(i), u.delete(a),
|
|
1143
|
+
return u.delete(i), u.delete(a), F;
|
|
1144
1144
|
}
|
|
1145
1145
|
return vi = s, vi;
|
|
1146
1146
|
}
|
|
@@ -1176,51 +1176,51 @@ var Si, lu;
|
|
|
1176
1176
|
function qn() {
|
|
1177
1177
|
if (lu) return Si;
|
|
1178
1178
|
lu = 1;
|
|
1179
|
-
var r = uy(), e = Fo(), t = fy(), n = dy(), s = hy(), i =
|
|
1180
|
-
return (r && S(new r(new ArrayBuffer(1))) !=
|
|
1181
|
-
var
|
|
1182
|
-
if (
|
|
1183
|
-
switch (
|
|
1184
|
-
case
|
|
1185
|
-
return
|
|
1186
|
-
case
|
|
1179
|
+
var r = uy(), e = Fo(), t = fy(), n = dy(), s = hy(), i = mr(), a = Id(), o = "[object Map]", c = "[object Object]", l = "[object Promise]", u = "[object Set]", f = "[object WeakMap]", h = "[object DataView]", d = a(r), p = a(e), E = a(t), y = a(n), _ = a(s), S = i;
|
|
1180
|
+
return (r && S(new r(new ArrayBuffer(1))) != h || e && S(new e()) != o || t && S(t.resolve()) != l || n && S(new n()) != u || s && S(new s()) != f) && (S = function(A) {
|
|
1181
|
+
var F = i(A), m = F == c ? A.constructor : void 0, T = m ? a(m) : "";
|
|
1182
|
+
if (T)
|
|
1183
|
+
switch (T) {
|
|
1184
|
+
case d:
|
|
1185
|
+
return h;
|
|
1186
|
+
case p:
|
|
1187
1187
|
return o;
|
|
1188
1188
|
case E:
|
|
1189
1189
|
return l;
|
|
1190
|
-
case
|
|
1190
|
+
case y:
|
|
1191
1191
|
return u;
|
|
1192
|
-
case
|
|
1192
|
+
case _:
|
|
1193
1193
|
return f;
|
|
1194
1194
|
}
|
|
1195
|
-
return
|
|
1195
|
+
return F;
|
|
1196
1196
|
}), Si = S, Si;
|
|
1197
1197
|
}
|
|
1198
1198
|
var Ti, uu;
|
|
1199
1199
|
function my() {
|
|
1200
1200
|
if (uu) return Ti;
|
|
1201
1201
|
uu = 1;
|
|
1202
|
-
var r = Mo(), e = xd(), t = ty(), n = ly(), s = qn(), i = Dt(), a = Mn(), o = jo(), c = 1, l = "[object Arguments]", u = "[object Array]", f = "[object Object]",
|
|
1203
|
-
function
|
|
1204
|
-
var
|
|
1205
|
-
R = R == l ? f : R,
|
|
1206
|
-
var
|
|
1202
|
+
var r = Mo(), e = xd(), t = ty(), n = ly(), s = qn(), i = Dt(), a = Mn(), o = jo(), c = 1, l = "[object Arguments]", u = "[object Array]", f = "[object Object]", h = Object.prototype, d = h.hasOwnProperty;
|
|
1203
|
+
function p(E, y, _, S, A, F) {
|
|
1204
|
+
var m = i(E), T = i(y), R = m ? u : s(E), v = T ? u : s(y);
|
|
1205
|
+
R = R == l ? f : R, v = v == l ? f : v;
|
|
1206
|
+
var C = R == f, g = v == f, k = R == v;
|
|
1207
1207
|
if (k && a(E)) {
|
|
1208
|
-
if (!a(
|
|
1208
|
+
if (!a(y))
|
|
1209
1209
|
return !1;
|
|
1210
|
-
|
|
1210
|
+
m = !0, C = !1;
|
|
1211
1211
|
}
|
|
1212
|
-
if (k && !
|
|
1213
|
-
return
|
|
1214
|
-
if (!(
|
|
1215
|
-
var I =
|
|
1212
|
+
if (k && !C)
|
|
1213
|
+
return F || (F = new r()), m || o(E) ? e(E, y, _, S, A, F) : t(E, y, R, _, S, A, F);
|
|
1214
|
+
if (!(_ & c)) {
|
|
1215
|
+
var I = C && d.call(E, "__wrapped__"), b = g && d.call(y, "__wrapped__");
|
|
1216
1216
|
if (I || b) {
|
|
1217
|
-
var w = I ? E.value() : E, O = b ?
|
|
1218
|
-
return
|
|
1217
|
+
var w = I ? E.value() : E, O = b ? y.value() : y;
|
|
1218
|
+
return F || (F = new r()), A(w, O, _, S, F);
|
|
1219
1219
|
}
|
|
1220
1220
|
}
|
|
1221
|
-
return k ? (
|
|
1221
|
+
return k ? (F || (F = new r()), n(E, y, _, S, A, F)) : !1;
|
|
1222
1222
|
}
|
|
1223
|
-
return Ti =
|
|
1223
|
+
return Ti = p, Ti;
|
|
1224
1224
|
}
|
|
1225
1225
|
var Ri, fu;
|
|
1226
1226
|
function py() {
|
|
@@ -1245,15 +1245,15 @@ function yy() {
|
|
|
1245
1245
|
var gy = yy();
|
|
1246
1246
|
const _y = /* @__PURE__ */ In(gy), vy = (r, e, t, n, s, i, a, o, c) => {
|
|
1247
1247
|
const { access: l } = e, { permissionWriteRestrictions: u } = l;
|
|
1248
|
-
let f = !0,
|
|
1249
|
-
const
|
|
1250
|
-
return
|
|
1251
|
-
n ===
|
|
1252
|
-
}),
|
|
1248
|
+
let f = !0, h = "";
|
|
1249
|
+
const d = u?.filter((p) => n === p.userRole);
|
|
1250
|
+
return d?.length && !d.some((p) => p.recordRole === s) ? (h = `User ${n} does not have write access to record with role ${s}`, f = !1, f) : (u?.forEach((p) => {
|
|
1251
|
+
n === p.userRole && p.recordRole;
|
|
1252
|
+
}), h && console.error(`PERMISSION_DENIED: ${h}`), f);
|
|
1253
1253
|
}, wy = (r, e, t, n, s, i, a, o, c, l, u) => {
|
|
1254
1254
|
const { labels: f } = n;
|
|
1255
|
-
let
|
|
1256
|
-
return (!e.Role || i && (!a?.Role || !vy(r, n, s, a.Role, e.Role) || i === e.User_ID)) && (
|
|
1255
|
+
let h = !0;
|
|
1256
|
+
return (!e.Role || i && (!a?.Role || !vy(r, n, s, a.Role, e.Role) || i === e.User_ID)) && (h = !1), h;
|
|
1257
1257
|
}, by = (r, e, t, n, s, i, a) => {
|
|
1258
1258
|
const { labels: o, fields: c } = t, l = i?.collections?.[o.collection];
|
|
1259
1259
|
let u = !0;
|
|
@@ -1262,28 +1262,28 @@ const _y = /* @__PURE__ */ In(gy), vy = (r, e, t, n, s, i, a, o, c) => {
|
|
|
1262
1262
|
s && !vt("Create", l) && (u = !1), s && // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
1263
1263
|
!dn("Create", t, n, s, i, r) && (u = !1), t.auth;
|
|
1264
1264
|
for (const f of c) {
|
|
1265
|
-
const
|
|
1266
|
-
f.access && !An(f, i) &&
|
|
1265
|
+
const h = r[f.name];
|
|
1266
|
+
f.access && !An(f, i) && h !== void 0 && (u = !1), h !== void 0 && !gp(f, i) && (u = !1);
|
|
1267
1267
|
}
|
|
1268
1268
|
if (!u)
|
|
1269
1269
|
throw new Error("PERMISSION_DENIED");
|
|
1270
|
-
},
|
|
1270
|
+
}, ir = (r) => r && (r._methodName === "deleteField" || r.constructor.name === "DeleteTransform"), tr = (r) => {
|
|
1271
1271
|
for (const e in r)
|
|
1272
|
-
Object.prototype.hasOwnProperty.call(r, e) && (
|
|
1272
|
+
Object.prototype.hasOwnProperty.call(r, e) && (ir(r[e]) ? delete r[e] : typeof r[e] == "object" && r[e] !== null && tr(r[e]));
|
|
1273
1273
|
}, Oy = (r, e, t, n, s, i, a, o, c, l) => {
|
|
1274
|
-
const { labels: u, fields: f } = n,
|
|
1275
|
-
tr(
|
|
1276
|
-
let
|
|
1277
|
-
if (i && !
|
|
1274
|
+
const { labels: u, fields: f } = n, h = a?.collections?.[u.collection], d = { ...e, ...r };
|
|
1275
|
+
tr(d);
|
|
1276
|
+
let p = !0, E = "";
|
|
1277
|
+
if (i && !h)
|
|
1278
1278
|
throw new Error("PERMISSION_DENIED");
|
|
1279
|
-
i && !vt("Update",
|
|
1279
|
+
i && !vt("Update", h) && (p = !1, E = "Authenticated user does not have Update access to this collection"), i && // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
1280
1280
|
(!dn("Update", n, s, i, a, e) || // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
1281
|
-
!dn("Update", n, s, i, a,
|
|
1282
|
-
for (const
|
|
1283
|
-
const
|
|
1284
|
-
|
|
1281
|
+
!dn("Update", n, s, i, a, d)) && (p = !1, E = "Authenticated user does not have Update access to this document");
|
|
1282
|
+
for (const y of f) {
|
|
1283
|
+
const _ = r[y.name];
|
|
1284
|
+
y.access && !An(y, a) && _ !== void 0 && (E = `Authenticated user does not have access to field ${y.name}`, p = !1), _ !== void 0 && !_p(y, a) && (E = `Authenticated user does not have Update access to field ${y.name}`, p = !1);
|
|
1285
1285
|
}
|
|
1286
|
-
if (!
|
|
1286
|
+
if (!p)
|
|
1287
1287
|
throw E && console.error(`PERMISSION_DENIED: ${E}`), new Error("PERMISSION_DENIED");
|
|
1288
1288
|
}, Ey = (r, e, t, n, s, i) => {
|
|
1289
1289
|
const { labels: a } = t, o = i.collections?.[a.collection];
|
|
@@ -1389,8 +1389,8 @@ function Cy() {
|
|
|
1389
1389
|
var r = Ry(), e = r();
|
|
1390
1390
|
return Ni = e, Ni;
|
|
1391
1391
|
}
|
|
1392
|
-
var
|
|
1393
|
-
|
|
1392
|
+
var Rr = { exports: {} };
|
|
1393
|
+
Rr.exports;
|
|
1394
1394
|
var _u;
|
|
1395
1395
|
function zd() {
|
|
1396
1396
|
return _u || (_u = 1, (function(r, e) {
|
|
@@ -1398,11 +1398,11 @@ function zd() {
|
|
|
1398
1398
|
function c(l, u) {
|
|
1399
1399
|
if (u)
|
|
1400
1400
|
return l.slice();
|
|
1401
|
-
var f = l.length,
|
|
1402
|
-
return l.copy(
|
|
1401
|
+
var f = l.length, h = o ? o(f) : new l.constructor(f);
|
|
1402
|
+
return l.copy(h), h;
|
|
1403
1403
|
}
|
|
1404
1404
|
r.exports = c;
|
|
1405
|
-
})(
|
|
1405
|
+
})(Rr, Rr.exports)), Rr.exports;
|
|
1406
1406
|
}
|
|
1407
1407
|
var Fi, vu;
|
|
1408
1408
|
function zo() {
|
|
@@ -1488,15 +1488,15 @@ var ji, Ru;
|
|
|
1488
1488
|
function Iy() {
|
|
1489
1489
|
if (Ru) return ji;
|
|
1490
1490
|
Ru = 1;
|
|
1491
|
-
var r =
|
|
1491
|
+
var r = mr(), e = Bo(), t = bt(), n = "[object Object]", s = Function.prototype, i = Object.prototype, a = s.toString, o = i.hasOwnProperty, c = a.call(Object);
|
|
1492
1492
|
function l(u) {
|
|
1493
1493
|
if (!t(u) || r(u) != n)
|
|
1494
1494
|
return !1;
|
|
1495
1495
|
var f = e(u);
|
|
1496
1496
|
if (f === null)
|
|
1497
1497
|
return !0;
|
|
1498
|
-
var
|
|
1499
|
-
return typeof
|
|
1498
|
+
var h = o.call(f, "constructor") && f.constructor;
|
|
1499
|
+
return typeof h == "function" && h instanceof h && a.call(h) == c;
|
|
1500
1500
|
}
|
|
1501
1501
|
return ji = l, ji;
|
|
1502
1502
|
}
|
|
@@ -1589,19 +1589,19 @@ var Hi, Du;
|
|
|
1589
1589
|
function Dy() {
|
|
1590
1590
|
if (Du) return Hi;
|
|
1591
1591
|
Du = 1;
|
|
1592
|
-
var r = Wd(), e = zd(), t = Bd(), n = Zd(), s = Gd(), i = Pd(), a = Dt(), o = ky(), c = Mn(), l = No(), u = wt(), f = Iy(),
|
|
1593
|
-
function E(
|
|
1594
|
-
var R =
|
|
1595
|
-
if (
|
|
1596
|
-
r(
|
|
1592
|
+
var r = Wd(), e = zd(), t = Bd(), n = Zd(), s = Gd(), i = Pd(), a = Dt(), o = ky(), c = Mn(), l = No(), u = wt(), f = Iy(), h = jo(), d = Hd(), p = Fy();
|
|
1593
|
+
function E(y, _, S, A, F, m, T) {
|
|
1594
|
+
var R = d(y, S), v = d(_, S), C = T.get(v);
|
|
1595
|
+
if (C) {
|
|
1596
|
+
r(y, S, C);
|
|
1597
1597
|
return;
|
|
1598
1598
|
}
|
|
1599
|
-
var
|
|
1599
|
+
var g = m ? m(R, v, S + "", y, _, T) : void 0, k = g === void 0;
|
|
1600
1600
|
if (k) {
|
|
1601
|
-
var I = a(
|
|
1602
|
-
|
|
1601
|
+
var I = a(v), b = !I && c(v), w = !I && !b && h(v);
|
|
1602
|
+
g = v, I || b || w ? a(R) ? g = R : o(R) ? g = n(R) : b ? (k = !1, g = e(v, !0)) : w ? (k = !1, g = t(v, !0)) : g = [] : f(v) || i(v) ? (g = R, i(R) ? g = p(R) : (!u(R) || l(R)) && (g = s(v))) : k = !1;
|
|
1603
1603
|
}
|
|
1604
|
-
k && (
|
|
1604
|
+
k && (T.set(v, g), F(g, v, A, m, T), T.delete(v)), r(y, S, g);
|
|
1605
1605
|
}
|
|
1606
1606
|
return Hi = E, Hi;
|
|
1607
1607
|
}
|
|
@@ -1610,13 +1610,13 @@ function My() {
|
|
|
1610
1610
|
if (Mu) return Ki;
|
|
1611
1611
|
Mu = 1;
|
|
1612
1612
|
var r = Mo(), e = Wd(), t = Cy(), n = Dy(), s = wt(), i = Br(), a = Hd();
|
|
1613
|
-
function o(c, l, u, f,
|
|
1614
|
-
c !== l && t(l, function(
|
|
1615
|
-
if (
|
|
1616
|
-
n(c, l,
|
|
1613
|
+
function o(c, l, u, f, h) {
|
|
1614
|
+
c !== l && t(l, function(d, p) {
|
|
1615
|
+
if (h || (h = new r()), s(d))
|
|
1616
|
+
n(c, l, p, u, o, f, h);
|
|
1617
1617
|
else {
|
|
1618
|
-
var E = f ? f(a(c,
|
|
1619
|
-
E === void 0 && (E =
|
|
1618
|
+
var E = f ? f(a(c, p), d, p + "", c, l, h) : void 0;
|
|
1619
|
+
E === void 0 && (E = d), e(c, p, E);
|
|
1620
1620
|
}
|
|
1621
1621
|
}, i);
|
|
1622
1622
|
}
|
|
@@ -1773,7 +1773,7 @@ var oa, Gu;
|
|
|
1773
1773
|
function Go() {
|
|
1774
1774
|
if (Gu) return oa;
|
|
1775
1775
|
Gu = 1;
|
|
1776
|
-
var r =
|
|
1776
|
+
var r = mr(), e = bt(), t = "[object Symbol]";
|
|
1777
1777
|
function n(s) {
|
|
1778
1778
|
return typeof s == "symbol" || e(s) && r(s) == t;
|
|
1779
1779
|
}
|
|
@@ -1906,15 +1906,15 @@ function ng() {
|
|
|
1906
1906
|
if (!n(a))
|
|
1907
1907
|
return a;
|
|
1908
1908
|
o = e(o, a);
|
|
1909
|
-
for (var u = -1, f = o.length,
|
|
1910
|
-
var
|
|
1911
|
-
if (
|
|
1909
|
+
for (var u = -1, f = o.length, h = f - 1, d = a; d != null && ++u < f; ) {
|
|
1910
|
+
var p = s(o[u]), E = c;
|
|
1911
|
+
if (p === "__proto__" || p === "constructor" || p === "prototype")
|
|
1912
1912
|
return a;
|
|
1913
|
-
if (u !=
|
|
1914
|
-
var
|
|
1915
|
-
E = l ? l(
|
|
1913
|
+
if (u != h) {
|
|
1914
|
+
var y = d[p];
|
|
1915
|
+
E = l ? l(y, p, d) : void 0, E === void 0 && (E = n(y) ? y : t(o[u + 1]) ? [] : {});
|
|
1916
1916
|
}
|
|
1917
|
-
r(
|
|
1917
|
+
r(d, p, E), d = d[p];
|
|
1918
1918
|
}
|
|
1919
1919
|
return a;
|
|
1920
1920
|
}
|
|
@@ -1931,11 +1931,11 @@ function sg() {
|
|
|
1931
1931
|
return _a = e, _a;
|
|
1932
1932
|
}
|
|
1933
1933
|
var ig = sg();
|
|
1934
|
-
const ag = /* @__PURE__ */ In(ig),
|
|
1934
|
+
const ag = /* @__PURE__ */ In(ig), Dr = {
|
|
1935
1935
|
global: {},
|
|
1936
1936
|
collections: {}
|
|
1937
1937
|
}, og = () => {
|
|
1938
|
-
|
|
1938
|
+
Dr.global = {}, Dr.collections = {};
|
|
1939
1939
|
}, ve = async (r, e) => {
|
|
1940
1940
|
let t = r;
|
|
1941
1941
|
return r && (typeof r == "function" || typeof r.then == "function") && (e ? t = await r(...e) : t = await r()), t;
|
|
@@ -1943,7 +1943,7 @@ const ag = /* @__PURE__ */ In(ig), Fr = {
|
|
|
1943
1943
|
for (const u of e)
|
|
1944
1944
|
if (u === "__proto__" || u === "constructor" || u === "prototype")
|
|
1945
1945
|
throw new Error("Invalid config path: prototype pollution keys are not allowed");
|
|
1946
|
-
let s =
|
|
1946
|
+
let s = Dr, i = !0;
|
|
1947
1947
|
for (const u of e) {
|
|
1948
1948
|
if (u === void 0 || s[u] === void 0) {
|
|
1949
1949
|
i = !1;
|
|
@@ -1964,17 +1964,17 @@ const ag = /* @__PURE__ */ In(ig), Fr = {
|
|
|
1964
1964
|
}
|
|
1965
1965
|
let l;
|
|
1966
1966
|
if (c && (l = await ve(o, t)), l) {
|
|
1967
|
-
let u =
|
|
1967
|
+
let u = Dr;
|
|
1968
1968
|
const f = {};
|
|
1969
|
-
for (let
|
|
1970
|
-
const
|
|
1971
|
-
if (
|
|
1972
|
-
if (
|
|
1969
|
+
for (let h = 0; h < e.length; h++) {
|
|
1970
|
+
const d = e[h];
|
|
1971
|
+
if (d !== void 0) {
|
|
1972
|
+
if (d === "__proto__" || d === "constructor" || d === "prototype")
|
|
1973
1973
|
throw new Error("Invalid config path: prototype pollution keys are not allowed");
|
|
1974
|
-
|
|
1974
|
+
h === e.length - 1 ? ag(f, e.join("."), l) : (u[d] ||= {}, u = u[d]);
|
|
1975
1975
|
}
|
|
1976
1976
|
}
|
|
1977
|
-
Gy(
|
|
1977
|
+
Gy(Dr, f);
|
|
1978
1978
|
}
|
|
1979
1979
|
return l;
|
|
1980
1980
|
}, cg = (r, e, t) => {
|
|
@@ -2105,8 +2105,8 @@ const ag = /* @__PURE__ */ In(ig), Fr = {
|
|
|
2105
2105
|
const o = /* @__PURE__ */ new Set(), c = Yd(e, t);
|
|
2106
2106
|
return Object.entries(c).map(([l, u]) => {
|
|
2107
2107
|
r.name === l && Object.values(u).forEach((f) => {
|
|
2108
|
-
f.forEach((
|
|
2109
|
-
o.add(
|
|
2108
|
+
f.forEach((h) => {
|
|
2109
|
+
o.add(h);
|
|
2110
2110
|
});
|
|
2111
2111
|
});
|
|
2112
2112
|
}), o.forEach((l) => {
|
|
@@ -2127,8 +2127,8 @@ const ag = /* @__PURE__ */ In(ig), Fr = {
|
|
|
2127
2127
|
if (Object.values(o).forEach((c) => {
|
|
2128
2128
|
Object.keys(c).forEach((l) => {
|
|
2129
2129
|
t.collections[l].fields.forEach((f) => {
|
|
2130
|
-
_e(f) && f.collection === e.labels.collection && f.dependencyFields?.some((
|
|
2131
|
-
a.push(
|
|
2130
|
+
_e(f) && f.collection === e.labels.collection && f.dependencyFields?.some((h) => h.field === r.name) && f.constraints && f.constraints.forEach((h) => {
|
|
2131
|
+
a.push(h[0]);
|
|
2132
2132
|
});
|
|
2133
2133
|
});
|
|
2134
2134
|
});
|
|
@@ -2179,7 +2179,7 @@ const Ko = (r, e, t, n, s, i, a, o, c, l) => (r == "create" && (t.Collection_Pat
|
|
|
2179
2179
|
n.forEach((i) => {
|
|
2180
2180
|
if (_e(i))
|
|
2181
2181
|
if (e[i.name]) {
|
|
2182
|
-
if (
|
|
2182
|
+
if (ir(e[i.name]))
|
|
2183
2183
|
e[`${i.name}_Array`] = e[i.name];
|
|
2184
2184
|
else if (e[`${i.name}_Array`] = Object.keys(e[i.name]), i.includeFields)
|
|
2185
2185
|
for (const a of i.includeFields) {
|
|
@@ -2192,7 +2192,7 @@ const Ko = (r, e, t, n, s, i, a, o, c, l) => (r == "create" && (t.Collection_Pat
|
|
|
2192
2192
|
delete e[`${i.name}_Array`], delete e[`${i.name}_Single`];
|
|
2193
2193
|
}), Qd(r, n).forEach((i) => {
|
|
2194
2194
|
if (e[i.name])
|
|
2195
|
-
if (
|
|
2195
|
+
if (ir(e[i.name]))
|
|
2196
2196
|
e[`${i.name}_Single`] = e[i.name];
|
|
2197
2197
|
else {
|
|
2198
2198
|
const a = e[`${i.name}_Array`]?.[0];
|
|
@@ -2526,7 +2526,7 @@ class qe {
|
|
|
2526
2526
|
}
|
|
2527
2527
|
const X = Object.freeze({
|
|
2528
2528
|
status: "aborted"
|
|
2529
|
-
}),
|
|
2529
|
+
}), Cr = (r) => ({ status: "dirty", value: r }), Qe = (r) => ({ status: "valid", value: r }), of = (r) => r.status === "aborted", cf = (r) => r.status === "dirty", ar = (r) => r.status === "valid", hn = (r) => typeof Promise < "u" && r instanceof Promise;
|
|
2530
2530
|
var W;
|
|
2531
2531
|
(function(r) {
|
|
2532
2532
|
r.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, r.toString = (e) => typeof e == "string" ? e : e?.message;
|
|
@@ -2540,7 +2540,7 @@ class ot {
|
|
|
2540
2540
|
}
|
|
2541
2541
|
}
|
|
2542
2542
|
const lf = (r, e) => {
|
|
2543
|
-
if (
|
|
2543
|
+
if (ar(e))
|
|
2544
2544
|
return { success: !0, data: e.value };
|
|
2545
2545
|
if (!r.common.issues.length)
|
|
2546
2546
|
throw new Error("Validation failed but no issues detected.");
|
|
@@ -2641,7 +2641,7 @@ class le {
|
|
|
2641
2641
|
if (!this["~standard"].async)
|
|
2642
2642
|
try {
|
|
2643
2643
|
const n = this._parseSync({ data: e, path: [], parent: t });
|
|
2644
|
-
return
|
|
2644
|
+
return ar(n) ? {
|
|
2645
2645
|
value: n.value
|
|
2646
2646
|
} : {
|
|
2647
2647
|
issues: t.common.issues
|
|
@@ -2652,7 +2652,7 @@ class le {
|
|
|
2652
2652
|
async: !0
|
|
2653
2653
|
};
|
|
2654
2654
|
}
|
|
2655
|
-
return this._parseAsync({ data: e, path: [], parent: t }).then((n) =>
|
|
2655
|
+
return this._parseAsync({ data: e, path: [], parent: t }).then((n) => ar(n) ? {
|
|
2656
2656
|
value: n.value
|
|
2657
2657
|
} : {
|
|
2658
2658
|
issues: t.common.issues
|
|
@@ -2693,7 +2693,7 @@ class le {
|
|
|
2693
2693
|
return this._refinement((n, s) => e(n) ? !0 : (s.addIssue(typeof t == "function" ? t(n, s) : t), !1));
|
|
2694
2694
|
}
|
|
2695
2695
|
_refinement(e) {
|
|
2696
|
-
return new
|
|
2696
|
+
return new lr({
|
|
2697
2697
|
schema: this,
|
|
2698
2698
|
typeName: Q.ZodEffects,
|
|
2699
2699
|
effect: { type: "refinement", refinement: e }
|
|
@@ -2713,7 +2713,7 @@ class le {
|
|
|
2713
2713
|
return It.create(this, this._def);
|
|
2714
2714
|
}
|
|
2715
2715
|
nullable() {
|
|
2716
|
-
return
|
|
2716
|
+
return ur.create(this, this._def);
|
|
2717
2717
|
}
|
|
2718
2718
|
nullish() {
|
|
2719
2719
|
return this.nullable().optional();
|
|
@@ -2731,7 +2731,7 @@ class le {
|
|
|
2731
2731
|
return yn.create(this, e, this._def);
|
|
2732
2732
|
}
|
|
2733
2733
|
transform(e) {
|
|
2734
|
-
return new
|
|
2734
|
+
return new lr({
|
|
2735
2735
|
...ae(this._def),
|
|
2736
2736
|
schema: this,
|
|
2737
2737
|
typeName: Q.ZodEffects,
|
|
@@ -3206,7 +3206,7 @@ function Lg(r, e) {
|
|
|
3206
3206
|
const t = (r.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, s = t > n ? t : n, i = Number.parseInt(r.toFixed(s).replace(".", "")), a = Number.parseInt(e.toFixed(s).replace(".", ""));
|
|
3207
3207
|
return i % a / 10 ** s;
|
|
3208
3208
|
}
|
|
3209
|
-
class
|
|
3209
|
+
class or extends le {
|
|
3210
3210
|
constructor() {
|
|
3211
3211
|
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
3212
3212
|
}
|
|
@@ -3264,7 +3264,7 @@ class ar extends le {
|
|
|
3264
3264
|
return this.setLimit("max", e, !1, W.toString(t));
|
|
3265
3265
|
}
|
|
3266
3266
|
setLimit(e, t, n, s) {
|
|
3267
|
-
return new
|
|
3267
|
+
return new or({
|
|
3268
3268
|
...this._def,
|
|
3269
3269
|
checks: [
|
|
3270
3270
|
...this._def.checks,
|
|
@@ -3278,7 +3278,7 @@ class ar extends le {
|
|
|
3278
3278
|
});
|
|
3279
3279
|
}
|
|
3280
3280
|
_addCheck(e) {
|
|
3281
|
-
return new
|
|
3281
|
+
return new or({
|
|
3282
3282
|
...this._def,
|
|
3283
3283
|
checks: [...this._def.checks, e]
|
|
3284
3284
|
});
|
|
@@ -3372,7 +3372,7 @@ class ar extends le {
|
|
|
3372
3372
|
return Number.isFinite(t) && Number.isFinite(e);
|
|
3373
3373
|
}
|
|
3374
3374
|
}
|
|
3375
|
-
|
|
3375
|
+
or.create = (r) => new or({
|
|
3376
3376
|
checks: [],
|
|
3377
3377
|
typeName: Q.ZodNumber,
|
|
3378
3378
|
coerce: r?.coerce || !1,
|
|
@@ -3800,7 +3800,7 @@ function Qt(r) {
|
|
|
3800
3800
|
} else return r instanceof at ? new at({
|
|
3801
3801
|
...r._def,
|
|
3802
3802
|
type: Qt(r.element)
|
|
3803
|
-
}) : r instanceof It ? It.create(Qt(r.unwrap())) : r instanceof
|
|
3803
|
+
}) : r instanceof It ? It.create(Qt(r.unwrap())) : r instanceof ur ? ur.create(Qt(r.unwrap())) : r instanceof Wt ? Wt.create(r.items.map((e) => Qt(e))) : r;
|
|
3804
3804
|
}
|
|
3805
3805
|
class Ce extends le {
|
|
3806
3806
|
constructor() {
|
|
@@ -3865,10 +3865,10 @@ class Ce extends le {
|
|
|
3865
3865
|
return s.common.async ? Promise.resolve().then(async () => {
|
|
3866
3866
|
const l = [];
|
|
3867
3867
|
for (const u of c) {
|
|
3868
|
-
const f = await u.key,
|
|
3868
|
+
const f = await u.key, h = await u.value;
|
|
3869
3869
|
l.push({
|
|
3870
3870
|
key: f,
|
|
3871
|
-
value:
|
|
3871
|
+
value: h,
|
|
3872
3872
|
alwaysSet: u.alwaysSet
|
|
3873
3873
|
});
|
|
3874
3874
|
}
|
|
@@ -4465,13 +4465,13 @@ ao.create = (r, e) => new ao({
|
|
|
4465
4465
|
...ae(e)
|
|
4466
4466
|
});
|
|
4467
4467
|
function nh(r, e) {
|
|
4468
|
-
return new
|
|
4468
|
+
return new cr({
|
|
4469
4469
|
values: r,
|
|
4470
4470
|
typeName: Q.ZodEnum,
|
|
4471
4471
|
...ae(e)
|
|
4472
4472
|
});
|
|
4473
4473
|
}
|
|
4474
|
-
class
|
|
4474
|
+
class cr extends le {
|
|
4475
4475
|
_parse(e) {
|
|
4476
4476
|
if (typeof e.data != "string") {
|
|
4477
4477
|
const t = this._getOrReturnCtx(e), n = this._def.values;
|
|
@@ -4513,19 +4513,19 @@ class or extends le {
|
|
|
4513
4513
|
return e;
|
|
4514
4514
|
}
|
|
4515
4515
|
extract(e, t = this._def) {
|
|
4516
|
-
return
|
|
4516
|
+
return cr.create(e, {
|
|
4517
4517
|
...this._def,
|
|
4518
4518
|
...t
|
|
4519
4519
|
});
|
|
4520
4520
|
}
|
|
4521
4521
|
exclude(e, t = this._def) {
|
|
4522
|
-
return
|
|
4522
|
+
return cr.create(this.options.filter((n) => !e.includes(n)), {
|
|
4523
4523
|
...this._def,
|
|
4524
4524
|
...t
|
|
4525
4525
|
});
|
|
4526
4526
|
}
|
|
4527
4527
|
}
|
|
4528
|
-
|
|
4528
|
+
cr.create = nh;
|
|
4529
4529
|
class gf extends le {
|
|
4530
4530
|
_parse(e) {
|
|
4531
4531
|
const t = fe.getValidEnumValues(this._def.values), n = this._getOrReturnCtx(e);
|
|
@@ -4580,7 +4580,7 @@ _n.create = (r, e) => new _n({
|
|
|
4580
4580
|
typeName: Q.ZodPromise,
|
|
4581
4581
|
...ae(e)
|
|
4582
4582
|
});
|
|
4583
|
-
class
|
|
4583
|
+
class lr extends le {
|
|
4584
4584
|
innerType() {
|
|
4585
4585
|
return this._def.schema;
|
|
4586
4586
|
}
|
|
@@ -4607,7 +4607,7 @@ class cr extends le {
|
|
|
4607
4607
|
path: n.path,
|
|
4608
4608
|
parent: n
|
|
4609
4609
|
});
|
|
4610
|
-
return c.status === "aborted" ? X : c.status === "dirty" || t.value === "dirty" ?
|
|
4610
|
+
return c.status === "aborted" ? X : c.status === "dirty" || t.value === "dirty" ? Cr(c.value) : c;
|
|
4611
4611
|
});
|
|
4612
4612
|
{
|
|
4613
4613
|
if (t.value === "aborted")
|
|
@@ -4617,7 +4617,7 @@ class cr extends le {
|
|
|
4617
4617
|
path: n.path,
|
|
4618
4618
|
parent: n
|
|
4619
4619
|
});
|
|
4620
|
-
return o.status === "aborted" ? X : o.status === "dirty" || t.value === "dirty" ?
|
|
4620
|
+
return o.status === "aborted" ? X : o.status === "dirty" || t.value === "dirty" ? Cr(o.value) : o;
|
|
4621
4621
|
}
|
|
4622
4622
|
}
|
|
4623
4623
|
if (s.type === "refinement") {
|
|
@@ -4646,27 +4646,27 @@ class cr extends le {
|
|
|
4646
4646
|
path: n.path,
|
|
4647
4647
|
parent: n
|
|
4648
4648
|
});
|
|
4649
|
-
if (!
|
|
4649
|
+
if (!ar(a))
|
|
4650
4650
|
return X;
|
|
4651
4651
|
const o = s.transform(a.value, i);
|
|
4652
4652
|
if (o instanceof Promise)
|
|
4653
4653
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
4654
4654
|
return { status: t.value, value: o };
|
|
4655
4655
|
} else
|
|
4656
|
-
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((a) =>
|
|
4656
|
+
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((a) => ar(a) ? Promise.resolve(s.transform(a.value, i)).then((o) => ({
|
|
4657
4657
|
status: t.value,
|
|
4658
4658
|
value: o
|
|
4659
4659
|
})) : X);
|
|
4660
4660
|
fe.assertNever(s);
|
|
4661
4661
|
}
|
|
4662
4662
|
}
|
|
4663
|
-
|
|
4663
|
+
lr.create = (r, e, t) => new lr({
|
|
4664
4664
|
schema: r,
|
|
4665
4665
|
typeName: Q.ZodEffects,
|
|
4666
4666
|
effect: e,
|
|
4667
4667
|
...ae(t)
|
|
4668
4668
|
});
|
|
4669
|
-
|
|
4669
|
+
lr.createWithPreprocess = (r, e, t) => new lr({
|
|
4670
4670
|
schema: e,
|
|
4671
4671
|
effect: { type: "preprocess", transform: r },
|
|
4672
4672
|
typeName: Q.ZodEffects,
|
|
@@ -4685,7 +4685,7 @@ It.create = (r, e) => new It({
|
|
|
4685
4685
|
typeName: Q.ZodOptional,
|
|
4686
4686
|
...ae(e)
|
|
4687
4687
|
});
|
|
4688
|
-
class
|
|
4688
|
+
class ur extends le {
|
|
4689
4689
|
_parse(e) {
|
|
4690
4690
|
return this._getType(e) === V.null ? Qe(null) : this._def.innerType._parse(e);
|
|
4691
4691
|
}
|
|
@@ -4693,7 +4693,7 @@ class lr extends le {
|
|
|
4693
4693
|
return this._def.innerType;
|
|
4694
4694
|
}
|
|
4695
4695
|
}
|
|
4696
|
-
|
|
4696
|
+
ur.create = (r, e) => new ur({
|
|
4697
4697
|
innerType: r,
|
|
4698
4698
|
typeName: Q.ZodNullable,
|
|
4699
4699
|
...ae(e)
|
|
@@ -4801,7 +4801,7 @@ class Yo extends le {
|
|
|
4801
4801
|
path: n.path,
|
|
4802
4802
|
parent: n
|
|
4803
4803
|
});
|
|
4804
|
-
return i.status === "aborted" ? X : i.status === "dirty" ? (t.dirty(),
|
|
4804
|
+
return i.status === "aborted" ? X : i.status === "dirty" ? (t.dirty(), Cr(i.value)) : this._def.out._parseAsync({
|
|
4805
4805
|
data: i.value,
|
|
4806
4806
|
path: n.path,
|
|
4807
4807
|
parent: n
|
|
@@ -4833,7 +4833,7 @@ class Yo extends le {
|
|
|
4833
4833
|
}
|
|
4834
4834
|
class lo extends le {
|
|
4835
4835
|
_parse(e) {
|
|
4836
|
-
const t = this._def.innerType._parse(e), n = (s) => (
|
|
4836
|
+
const t = this._def.innerType._parse(e), n = (s) => (ar(s) && (s.value = Object.freeze(s.value)), s);
|
|
4837
4837
|
return hn(t) ? t.then((s) => n(s)) : n(t);
|
|
4838
4838
|
}
|
|
4839
4839
|
unwrap() {
|
|
@@ -4849,15 +4849,15 @@ var Q;
|
|
|
4849
4849
|
(function(r) {
|
|
4850
4850
|
r.ZodString = "ZodString", r.ZodNumber = "ZodNumber", r.ZodNaN = "ZodNaN", r.ZodBigInt = "ZodBigInt", r.ZodBoolean = "ZodBoolean", r.ZodDate = "ZodDate", r.ZodSymbol = "ZodSymbol", r.ZodUndefined = "ZodUndefined", r.ZodNull = "ZodNull", r.ZodAny = "ZodAny", r.ZodUnknown = "ZodUnknown", r.ZodNever = "ZodNever", r.ZodVoid = "ZodVoid", r.ZodArray = "ZodArray", r.ZodObject = "ZodObject", r.ZodUnion = "ZodUnion", r.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", r.ZodIntersection = "ZodIntersection", r.ZodTuple = "ZodTuple", r.ZodRecord = "ZodRecord", r.ZodMap = "ZodMap", r.ZodSet = "ZodSet", r.ZodFunction = "ZodFunction", r.ZodLazy = "ZodLazy", r.ZodLiteral = "ZodLiteral", r.ZodEnum = "ZodEnum", r.ZodEffects = "ZodEffects", r.ZodNativeEnum = "ZodNativeEnum", r.ZodOptional = "ZodOptional", r.ZodNullable = "ZodNullable", r.ZodDefault = "ZodDefault", r.ZodCatch = "ZodCatch", r.ZodPromise = "ZodPromise", r.ZodBranded = "ZodBranded", r.ZodPipeline = "ZodPipeline", r.ZodReadonly = "ZodReadonly";
|
|
4851
4851
|
})(Q || (Q = {}));
|
|
4852
|
-
const pt = yt.create, uo =
|
|
4852
|
+
const pt = yt.create, uo = or.create, jg = no.create, Ut = so.create;
|
|
4853
4853
|
Ft.create;
|
|
4854
4854
|
const Ln = at.create, sh = Ce.create, vn = pn.create;
|
|
4855
4855
|
yn.create;
|
|
4856
4856
|
Wt.create;
|
|
4857
|
-
const Jo = gn.create, fo = ao.create, ho =
|
|
4857
|
+
const Jo = gn.create, fo = ao.create, ho = cr.create;
|
|
4858
4858
|
_n.create;
|
|
4859
4859
|
It.create;
|
|
4860
|
-
|
|
4860
|
+
ur.create;
|
|
4861
4861
|
const on = () => Ut().refine((r) => r && (r.seconds !== void 0 && r.nanoseconds !== void 0 || r._seconds !== void 0 && r._nanoseconds !== void 0), {
|
|
4862
4862
|
message: "Value is not a valid timestamp"
|
|
4863
4863
|
}), vf = () => Ut().refine((r) => r && (r._methodName === "serverTimestamp" || r.constructor.name === "ServerTimestampTransform"), {
|
|
@@ -5231,7 +5231,7 @@ class $n extends Gr {
|
|
|
5231
5231
|
}
|
|
5232
5232
|
/** @override **/
|
|
5233
5233
|
formatOffset(e, t) {
|
|
5234
|
-
return
|
|
5234
|
+
return Mr(this.offset(e), t);
|
|
5235
5235
|
}
|
|
5236
5236
|
/** @override **/
|
|
5237
5237
|
offset(e) {
|
|
@@ -5376,7 +5376,7 @@ class _t extends Gr {
|
|
|
5376
5376
|
* @return {string}
|
|
5377
5377
|
*/
|
|
5378
5378
|
formatOffset(e, t) {
|
|
5379
|
-
return
|
|
5379
|
+
return Mr(this.offset(e), t);
|
|
5380
5380
|
}
|
|
5381
5381
|
/**
|
|
5382
5382
|
* Return the offset in minutes for this zone at the specified timestamp.
|
|
@@ -5391,7 +5391,7 @@ class _t extends Gr {
|
|
|
5391
5391
|
const n = Kg(this.name);
|
|
5392
5392
|
let [s, i, a, o, c, l, u] = n.formatToParts ? Qg(n, t) : Jg(n, t);
|
|
5393
5393
|
o === "BC" && (s = -Math.abs(s) + 1);
|
|
5394
|
-
const
|
|
5394
|
+
const h = Un({
|
|
5395
5395
|
year: s,
|
|
5396
5396
|
month: i,
|
|
5397
5397
|
day: a,
|
|
@@ -5400,9 +5400,9 @@ class _t extends Gr {
|
|
|
5400
5400
|
second: u,
|
|
5401
5401
|
millisecond: 0
|
|
5402
5402
|
});
|
|
5403
|
-
let
|
|
5404
|
-
const
|
|
5405
|
-
return
|
|
5403
|
+
let d = +t;
|
|
5404
|
+
const p = d % 1e3;
|
|
5405
|
+
return d -= p >= 0 ? p : 1e3 + p, (h - d) / (60 * 1e3);
|
|
5406
5406
|
}
|
|
5407
5407
|
/**
|
|
5408
5408
|
* Return whether this Zone is equal to another zone
|
|
@@ -5446,9 +5446,9 @@ function t_(r, e = {}) {
|
|
|
5446
5446
|
let i = _o.get(s);
|
|
5447
5447
|
return i === void 0 && (i = new Intl.RelativeTimeFormat(r, e), _o.set(s, i)), i;
|
|
5448
5448
|
}
|
|
5449
|
-
let
|
|
5449
|
+
let Ar = null;
|
|
5450
5450
|
function r_() {
|
|
5451
|
-
return
|
|
5451
|
+
return Ar || (Ar = new Intl.DateTimeFormat().resolvedOptions().locale, Ar);
|
|
5452
5452
|
}
|
|
5453
5453
|
const vo = /* @__PURE__ */ new Map();
|
|
5454
5454
|
function Rh(r) {
|
|
@@ -5579,9 +5579,9 @@ const Ch = {
|
|
|
5579
5579
|
minimalDays: 4,
|
|
5580
5580
|
weekend: [6, 7]
|
|
5581
5581
|
};
|
|
5582
|
-
class
|
|
5582
|
+
class me {
|
|
5583
5583
|
static fromOpts(e) {
|
|
5584
|
-
return
|
|
5584
|
+
return me.create(
|
|
5585
5585
|
e.locale,
|
|
5586
5586
|
e.numberingSystem,
|
|
5587
5587
|
e.outputCalendar,
|
|
@@ -5591,13 +5591,13 @@ class he {
|
|
|
5591
5591
|
}
|
|
5592
5592
|
static create(e, t, n, s, i = !1) {
|
|
5593
5593
|
const a = e || Ee.defaultLocale, o = a || (i ? "en-US" : r_()), c = t || Ee.defaultNumberingSystem, l = n || Ee.defaultOutputCalendar, u = Oo(s) || Ee.defaultWeekSettings;
|
|
5594
|
-
return new
|
|
5594
|
+
return new me(o, c, l, u, a);
|
|
5595
5595
|
}
|
|
5596
5596
|
static resetCache() {
|
|
5597
|
-
|
|
5597
|
+
Ar = null, po.clear(), go.clear(), _o.clear(), vo.clear(), wo.clear();
|
|
5598
5598
|
}
|
|
5599
5599
|
static fromObject({ locale: e, numberingSystem: t, outputCalendar: n, weekSettings: s } = {}) {
|
|
5600
|
-
return
|
|
5600
|
+
return me.create(e, t, n, s);
|
|
5601
5601
|
}
|
|
5602
5602
|
constructor(e, t, n, s, i) {
|
|
5603
5603
|
const [a, o, c] = s_(e);
|
|
@@ -5611,7 +5611,7 @@ class he {
|
|
|
5611
5611
|
return e && t ? "en" : "intl";
|
|
5612
5612
|
}
|
|
5613
5613
|
clone(e) {
|
|
5614
|
-
return !e || Object.getOwnPropertyNames(e).length === 0 ? this :
|
|
5614
|
+
return !e || Object.getOwnPropertyNames(e).length === 0 ? this : me.create(
|
|
5615
5615
|
e.locale || this.specifiedLocale,
|
|
5616
5616
|
e.numberingSystem || this.numberingSystem,
|
|
5617
5617
|
e.outputCalendar || this.outputCalendar,
|
|
@@ -5758,7 +5758,7 @@ class Pe extends Gr {
|
|
|
5758
5758
|
* @type {string}
|
|
5759
5759
|
*/
|
|
5760
5760
|
get name() {
|
|
5761
|
-
return this.fixed === 0 ? "UTC" : `UTC${
|
|
5761
|
+
return this.fixed === 0 ? "UTC" : `UTC${Mr(this.fixed, "narrow")}`;
|
|
5762
5762
|
}
|
|
5763
5763
|
/**
|
|
5764
5764
|
* The IANA name of this zone, i.e. `Etc/UTC` or `Etc/GMT+/-nn`
|
|
@@ -5767,7 +5767,7 @@ class Pe extends Gr {
|
|
|
5767
5767
|
* @type {string}
|
|
5768
5768
|
*/
|
|
5769
5769
|
get ianaName() {
|
|
5770
|
-
return this.fixed === 0 ? "Etc/UTC" : `Etc/GMT${
|
|
5770
|
+
return this.fixed === 0 ? "Etc/UTC" : `Etc/GMT${Mr(-this.fixed, "narrow")}`;
|
|
5771
5771
|
}
|
|
5772
5772
|
/**
|
|
5773
5773
|
* Returns the offset's common name at the specified timestamp.
|
|
@@ -5787,7 +5787,7 @@ class Pe extends Gr {
|
|
|
5787
5787
|
* @return {string}
|
|
5788
5788
|
*/
|
|
5789
5789
|
formatOffset(e, t) {
|
|
5790
|
-
return
|
|
5790
|
+
return Mr(this.fixed, t);
|
|
5791
5791
|
}
|
|
5792
5792
|
/**
|
|
5793
5793
|
* Returns whether the offset is known to be fixed for the whole year:
|
|
@@ -6083,7 +6083,7 @@ class Ee {
|
|
|
6083
6083
|
* @return {void}
|
|
6084
6084
|
*/
|
|
6085
6085
|
static resetCaches() {
|
|
6086
|
-
|
|
6086
|
+
me.resetCache(), _t.resetCache(), B.resetCache(), p_();
|
|
6087
6087
|
}
|
|
6088
6088
|
}
|
|
6089
6089
|
class nt {
|
|
@@ -6095,7 +6095,7 @@ class nt {
|
|
|
6095
6095
|
}
|
|
6096
6096
|
}
|
|
6097
6097
|
const Ah = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334], kh = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335];
|
|
6098
|
-
function
|
|
6098
|
+
function He(r, e) {
|
|
6099
6099
|
return new nt(
|
|
6100
6100
|
"unit out of range",
|
|
6101
6101
|
`you specified ${e} (of type ${typeof e}) as a ${r}, which is invalid`
|
|
@@ -6151,24 +6151,24 @@ function Nf(r, e) {
|
|
|
6151
6151
|
return { minDaysInFirstWeek: 4, startOfWeek: 1 };
|
|
6152
6152
|
}
|
|
6153
6153
|
function y_(r, e = 4, t = 1) {
|
|
6154
|
-
const n = jn(r.weekYear), s =
|
|
6154
|
+
const n = jn(r.weekYear), s = Ke(
|
|
6155
6155
|
r.weekNumber,
|
|
6156
6156
|
1,
|
|
6157
6157
|
Ur(r.weekYear, e, t)
|
|
6158
|
-
), i =
|
|
6159
|
-
return n ? s ? i ? !1 :
|
|
6158
|
+
), i = Ke(r.weekday, 1, 7);
|
|
6159
|
+
return n ? s ? i ? !1 : He("weekday", r.weekday) : He("week", r.weekNumber) : He("weekYear", r.weekYear);
|
|
6160
6160
|
}
|
|
6161
6161
|
function g_(r) {
|
|
6162
|
-
const e = jn(r.year), t =
|
|
6163
|
-
return e ? t ? !1 :
|
|
6162
|
+
const e = jn(r.year), t = Ke(r.ordinal, 1, rr(r.year));
|
|
6163
|
+
return e ? t ? !1 : He("ordinal", r.ordinal) : He("year", r.year);
|
|
6164
6164
|
}
|
|
6165
6165
|
function Nh(r) {
|
|
6166
|
-
const e = jn(r.year), t =
|
|
6167
|
-
return e ? t ? n ? !1 :
|
|
6166
|
+
const e = jn(r.year), t = Ke(r.month, 1, 12), n = Ke(r.day, 1, En(r.year, r.month));
|
|
6167
|
+
return e ? t ? n ? !1 : He("day", r.day) : He("month", r.month) : He("year", r.year);
|
|
6168
6168
|
}
|
|
6169
6169
|
function Fh(r) {
|
|
6170
|
-
const { hour: e, minute: t, second: n, millisecond: s } = r, i =
|
|
6171
|
-
return i ? a ? o ? c ? !1 :
|
|
6170
|
+
const { hour: e, minute: t, second: n, millisecond: s } = r, i = Ke(e, 0, 23) || e === 24 && t === 0 && n === 0 && s === 0, a = Ke(t, 0, 59), o = Ke(n, 0, 59), c = Ke(s, 0, 999);
|
|
6171
|
+
return i ? a ? o ? c ? !1 : He("millisecond", s) : He("second", n) : He("minute", t) : He("hour", e);
|
|
6172
6172
|
}
|
|
6173
6173
|
function J(r) {
|
|
6174
6174
|
return typeof r > "u";
|
|
@@ -6212,7 +6212,7 @@ function Ff(r, e, t) {
|
|
|
6212
6212
|
function b_(r, e) {
|
|
6213
6213
|
return e.reduce((t, n) => (t[n] = r[n], t), {});
|
|
6214
6214
|
}
|
|
6215
|
-
function
|
|
6215
|
+
function fr(r, e) {
|
|
6216
6216
|
return Object.prototype.hasOwnProperty.call(r, e);
|
|
6217
6217
|
}
|
|
6218
6218
|
function Oo(r) {
|
|
@@ -6220,7 +6220,7 @@ function Oo(r) {
|
|
|
6220
6220
|
return null;
|
|
6221
6221
|
if (typeof r != "object")
|
|
6222
6222
|
throw new Ne("Week settings must be an object");
|
|
6223
|
-
if (!
|
|
6223
|
+
if (!Ke(r.firstDay, 1, 7) || !Ke(r.minimalDays, 1, 7) || !Array.isArray(r.weekend) || r.weekend.some((e) => !Ke(e, 1, 7)))
|
|
6224
6224
|
throw new Ne("Invalid week settings");
|
|
6225
6225
|
return {
|
|
6226
6226
|
firstDay: r.firstDay,
|
|
@@ -6228,7 +6228,7 @@ function Oo(r) {
|
|
|
6228
6228
|
weekend: Array.from(r.weekend)
|
|
6229
6229
|
};
|
|
6230
6230
|
}
|
|
6231
|
-
function
|
|
6231
|
+
function Ke(r, e, t) {
|
|
6232
6232
|
return jn(r) && r >= e && r <= t;
|
|
6233
6233
|
}
|
|
6234
6234
|
function O_(r, e) {
|
|
@@ -6330,14 +6330,14 @@ function qh(r) {
|
|
|
6330
6330
|
function Sn(r, e) {
|
|
6331
6331
|
const t = {};
|
|
6332
6332
|
for (const n in r)
|
|
6333
|
-
if (
|
|
6333
|
+
if (fr(r, n)) {
|
|
6334
6334
|
const s = r[n];
|
|
6335
6335
|
if (s == null) continue;
|
|
6336
6336
|
t[e(n)] = qh(s);
|
|
6337
6337
|
}
|
|
6338
6338
|
return t;
|
|
6339
6339
|
}
|
|
6340
|
-
function
|
|
6340
|
+
function Mr(r, e) {
|
|
6341
6341
|
const t = Math.trunc(Math.abs(r / 60)), n = Math.trunc(Math.abs(r % 60)), s = r >= 0 ? "+" : "-";
|
|
6342
6342
|
switch (e) {
|
|
6343
6343
|
case "short":
|
|
@@ -6544,14 +6544,14 @@ class Fe {
|
|
|
6544
6544
|
return t > 0 && (s.padTo = t), n && (s.signDisplay = n), this.loc.numberFormatter(s).format(e);
|
|
6545
6545
|
}
|
|
6546
6546
|
formatDateTimeFromString(e, t) {
|
|
6547
|
-
const n = this.loc.listingMode() === "en", s = this.loc.outputCalendar && this.loc.outputCalendar !== "gregory", i = (
|
|
6548
|
-
|
|
6547
|
+
const n = this.loc.listingMode() === "en", s = this.loc.outputCalendar && this.loc.outputCalendar !== "gregory", i = (d, p) => this.loc.extract(e, d, p), a = (d) => e.isOffsetFixed && e.offset === 0 && d.allowZ ? "Z" : e.isValid ? e.zone.formatOffset(e.ts, d.format) : "", o = () => n ? k_(e) : i({ hour: "numeric", hourCycle: "h12" }, "dayperiod"), c = (d, p) => n ? x_(e, d) : i(p ? { month: d } : { month: d, day: "numeric" }, "month"), l = (d, p) => n ? I_(e, d) : i(
|
|
6548
|
+
p ? { weekday: d } : { weekday: d, month: "long", day: "numeric" },
|
|
6549
6549
|
"weekday"
|
|
6550
|
-
), u = (
|
|
6551
|
-
const
|
|
6552
|
-
return
|
|
6553
|
-
}, f = (
|
|
6554
|
-
switch (
|
|
6550
|
+
), u = (d) => {
|
|
6551
|
+
const p = Fe.macroTokenToFormatOpts(d);
|
|
6552
|
+
return p ? this.formatWithSystemDefault(e, p) : d;
|
|
6553
|
+
}, f = (d) => n ? N_(e, d) : i({ era: d }, "era"), h = (d) => {
|
|
6554
|
+
switch (d) {
|
|
6555
6555
|
// ms
|
|
6556
6556
|
case "S":
|
|
6557
6557
|
return this.num(e.millisecond);
|
|
@@ -6690,10 +6690,10 @@ class Fe {
|
|
|
6690
6690
|
case "x":
|
|
6691
6691
|
return this.num(e.ts);
|
|
6692
6692
|
default:
|
|
6693
|
-
return u(
|
|
6693
|
+
return u(d);
|
|
6694
6694
|
}
|
|
6695
6695
|
};
|
|
6696
|
-
return Mf(Fe.parseFormat(t),
|
|
6696
|
+
return Mf(Fe.parseFormat(t), h);
|
|
6697
6697
|
}
|
|
6698
6698
|
formatDurationFromString(e, t) {
|
|
6699
6699
|
const n = this.opts.signMode === "negativeLargestOnly" ? -1 : 1, s = (u) => {
|
|
@@ -6717,16 +6717,16 @@ class Fe {
|
|
|
6717
6717
|
default:
|
|
6718
6718
|
return null;
|
|
6719
6719
|
}
|
|
6720
|
-
}, i = (u, f) => (
|
|
6721
|
-
const
|
|
6722
|
-
if (
|
|
6723
|
-
const
|
|
6720
|
+
}, i = (u, f) => (h) => {
|
|
6721
|
+
const d = s(h);
|
|
6722
|
+
if (d) {
|
|
6723
|
+
const p = f.isNegativeDuration && d !== f.largestUnit ? n : 1;
|
|
6724
6724
|
let E;
|
|
6725
|
-
return this.opts.signMode === "negativeLargestOnly" &&
|
|
6725
|
+
return this.opts.signMode === "negativeLargestOnly" && d !== f.largestUnit ? E = "never" : this.opts.signMode === "all" ? E = "always" : E = "auto", this.num(u.get(d) * p, h.length, E);
|
|
6726
6726
|
} else
|
|
6727
|
-
return
|
|
6727
|
+
return h;
|
|
6728
6728
|
}, a = Fe.parseFormat(t), o = a.reduce(
|
|
6729
|
-
(u, { literal: f, val:
|
|
6729
|
+
(u, { literal: f, val: h }) => f ? u : u.concat(h),
|
|
6730
6730
|
[]
|
|
6731
6731
|
), c = e.shiftTo(...o.map(s).filter((u) => u)), l = {
|
|
6732
6732
|
isNegativeDuration: c < 0,
|
|
@@ -6738,11 +6738,11 @@ class Fe {
|
|
|
6738
6738
|
}
|
|
6739
6739
|
}
|
|
6740
6740
|
const Bh = /[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;
|
|
6741
|
-
function
|
|
6741
|
+
function pr(...r) {
|
|
6742
6742
|
const e = r.reduce((t, n) => t + n.source, "");
|
|
6743
6743
|
return RegExp(`^${e}$`);
|
|
6744
6744
|
}
|
|
6745
|
-
function
|
|
6745
|
+
function yr(...r) {
|
|
6746
6746
|
return (e) => r.reduce(
|
|
6747
6747
|
([t, n, s], i) => {
|
|
6748
6748
|
const [a, o, c] = i(e, s);
|
|
@@ -6751,7 +6751,7 @@ function pr(...r) {
|
|
|
6751
6751
|
[{}, null, 1]
|
|
6752
6752
|
).slice(0, 2);
|
|
6753
6753
|
}
|
|
6754
|
-
function
|
|
6754
|
+
function gr(r, ...e) {
|
|
6755
6755
|
if (r == null)
|
|
6756
6756
|
return [null, null];
|
|
6757
6757
|
for (const [t, n] of e) {
|
|
@@ -6784,7 +6784,7 @@ function W_(r, e) {
|
|
|
6784
6784
|
day: nr(r, e + 2, 1)
|
|
6785
6785
|
}, null, e + 3];
|
|
6786
6786
|
}
|
|
6787
|
-
function
|
|
6787
|
+
function _r(r, e) {
|
|
6788
6788
|
return [{
|
|
6789
6789
|
hours: nr(r, e, 0),
|
|
6790
6790
|
minutes: nr(r, e + 1, 0),
|
|
@@ -6802,17 +6802,17 @@ function Yr(r, e) {
|
|
|
6802
6802
|
}
|
|
6803
6803
|
const z_ = RegExp(`^T?${nc.source}$`), B_ = /^-?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)?)?)$/;
|
|
6804
6804
|
function Z_(r) {
|
|
6805
|
-
const [e, t, n, s, i, a, o, c, l] = r, u = e[0] === "-", f = c && c[0] === "-",
|
|
6805
|
+
const [e, t, n, s, i, a, o, c, l] = r, u = e[0] === "-", f = c && c[0] === "-", h = (d, p = !1) => d !== void 0 && (p || d && u) ? -d : d;
|
|
6806
6806
|
return [
|
|
6807
6807
|
{
|
|
6808
|
-
years:
|
|
6809
|
-
months:
|
|
6810
|
-
weeks:
|
|
6811
|
-
days:
|
|
6812
|
-
hours:
|
|
6813
|
-
minutes:
|
|
6814
|
-
seconds:
|
|
6815
|
-
milliseconds:
|
|
6808
|
+
years: h(qt(t)),
|
|
6809
|
+
months: h(qt(n)),
|
|
6810
|
+
weeks: h(qt(s)),
|
|
6811
|
+
days: h(qt(i)),
|
|
6812
|
+
hours: h(qt(a)),
|
|
6813
|
+
minutes: h(qt(o)),
|
|
6814
|
+
seconds: h(qt(c), c === "-0"),
|
|
6815
|
+
milliseconds: h(tc(l), f)
|
|
6816
6816
|
}
|
|
6817
6817
|
];
|
|
6818
6818
|
}
|
|
@@ -6852,9 +6852,9 @@ function K_(r) {
|
|
|
6852
6852
|
l,
|
|
6853
6853
|
u,
|
|
6854
6854
|
f
|
|
6855
|
-
] = r,
|
|
6856
|
-
let
|
|
6857
|
-
return c ?
|
|
6855
|
+
] = r, h = ic(e, s, n, t, i, a, o);
|
|
6856
|
+
let d;
|
|
6857
|
+
return c ? d = G_[c] : l ? d = 0 : d = Vn(u, f), [h, new Pe(d)];
|
|
6858
6858
|
}
|
|
6859
6859
|
function Y_(r) {
|
|
6860
6860
|
return r.replace(/\([^()]*\)|[\n\t]/g, " ").replace(/(\s\s+)/g, " ").trim();
|
|
@@ -6868,28 +6868,28 @@ function ev(r) {
|
|
|
6868
6868
|
const [, e, t, n, s, i, a, o] = r;
|
|
6869
6869
|
return [ic(e, o, t, n, s, i, a), Pe.utcInstance];
|
|
6870
6870
|
}
|
|
6871
|
-
const tv =
|
|
6871
|
+
const tv = pr(P_, sc), rv = pr(q_, sc), nv = pr(L_, sc), sv = pr(Hh), Yh = yr(
|
|
6872
6872
|
W_,
|
|
6873
|
-
|
|
6873
|
+
_r,
|
|
6874
6874
|
Kr,
|
|
6875
6875
|
Yr
|
|
6876
|
-
), iv =
|
|
6876
|
+
), iv = yr(
|
|
6877
6877
|
$_,
|
|
6878
|
-
|
|
6878
|
+
_r,
|
|
6879
6879
|
Kr,
|
|
6880
6880
|
Yr
|
|
6881
|
-
), av =
|
|
6881
|
+
), av = yr(
|
|
6882
6882
|
j_,
|
|
6883
|
-
|
|
6883
|
+
_r,
|
|
6884
6884
|
Kr,
|
|
6885
6885
|
Yr
|
|
6886
|
-
), ov =
|
|
6887
|
-
|
|
6886
|
+
), ov = yr(
|
|
6887
|
+
_r,
|
|
6888
6888
|
Kr,
|
|
6889
6889
|
Yr
|
|
6890
6890
|
);
|
|
6891
6891
|
function cv(r) {
|
|
6892
|
-
return
|
|
6892
|
+
return gr(
|
|
6893
6893
|
r,
|
|
6894
6894
|
[tv, Yh],
|
|
6895
6895
|
[rv, iv],
|
|
@@ -6898,10 +6898,10 @@ function cv(r) {
|
|
|
6898
6898
|
);
|
|
6899
6899
|
}
|
|
6900
6900
|
function lv(r) {
|
|
6901
|
-
return
|
|
6901
|
+
return gr(Y_(r), [H_, K_]);
|
|
6902
6902
|
}
|
|
6903
6903
|
function uv(r) {
|
|
6904
|
-
return
|
|
6904
|
+
return gr(
|
|
6905
6905
|
r,
|
|
6906
6906
|
[J_, Pf],
|
|
6907
6907
|
[Q_, Pf],
|
|
@@ -6909,19 +6909,19 @@ function uv(r) {
|
|
|
6909
6909
|
);
|
|
6910
6910
|
}
|
|
6911
6911
|
function fv(r) {
|
|
6912
|
-
return
|
|
6912
|
+
return gr(r, [B_, Z_]);
|
|
6913
6913
|
}
|
|
6914
|
-
const dv =
|
|
6914
|
+
const dv = yr(_r);
|
|
6915
6915
|
function hv(r) {
|
|
6916
|
-
return
|
|
6916
|
+
return gr(r, [z_, dv]);
|
|
6917
6917
|
}
|
|
6918
|
-
const mv =
|
|
6919
|
-
|
|
6918
|
+
const mv = pr(U_, V_), pv = pr(Kh), yv = yr(
|
|
6919
|
+
_r,
|
|
6920
6920
|
Kr,
|
|
6921
6921
|
Yr
|
|
6922
6922
|
);
|
|
6923
6923
|
function gv(r) {
|
|
6924
|
-
return
|
|
6924
|
+
return gr(
|
|
6925
6925
|
r,
|
|
6926
6926
|
[mv, Yh],
|
|
6927
6927
|
[pv, yv]
|
|
@@ -6973,25 +6973,25 @@ const qf = "Invalid Duration", Jh = {
|
|
|
6973
6973
|
milliseconds: 720 * 60 * 60 * 1e3
|
|
6974
6974
|
},
|
|
6975
6975
|
...Jh
|
|
6976
|
-
},
|
|
6976
|
+
}, Ze = 146097 / 400, Kt = 146097 / 4800, vv = {
|
|
6977
6977
|
years: {
|
|
6978
6978
|
quarters: 4,
|
|
6979
6979
|
months: 12,
|
|
6980
|
-
weeks:
|
|
6981
|
-
days:
|
|
6982
|
-
hours:
|
|
6983
|
-
minutes:
|
|
6984
|
-
seconds:
|
|
6985
|
-
milliseconds:
|
|
6980
|
+
weeks: Ze / 7,
|
|
6981
|
+
days: Ze,
|
|
6982
|
+
hours: Ze * 24,
|
|
6983
|
+
minutes: Ze * 24 * 60,
|
|
6984
|
+
seconds: Ze * 24 * 60 * 60,
|
|
6985
|
+
milliseconds: Ze * 24 * 60 * 60 * 1e3
|
|
6986
6986
|
},
|
|
6987
6987
|
quarters: {
|
|
6988
6988
|
months: 3,
|
|
6989
|
-
weeks:
|
|
6990
|
-
days:
|
|
6991
|
-
hours:
|
|
6992
|
-
minutes:
|
|
6993
|
-
seconds:
|
|
6994
|
-
milliseconds:
|
|
6989
|
+
weeks: Ze / 28,
|
|
6990
|
+
days: Ze / 4,
|
|
6991
|
+
hours: Ze * 24 / 4,
|
|
6992
|
+
minutes: Ze * 24 * 60 / 4,
|
|
6993
|
+
seconds: Ze * 24 * 60 * 60 / 4,
|
|
6994
|
+
milliseconds: Ze * 24 * 60 * 60 * 1e3 / 4
|
|
6995
6995
|
},
|
|
6996
6996
|
months: {
|
|
6997
6997
|
weeks: Kt / 7,
|
|
@@ -7061,7 +7061,7 @@ class ue {
|
|
|
7061
7061
|
constructor(e) {
|
|
7062
7062
|
const t = e.conversionAccuracy === "longterm" || !1;
|
|
7063
7063
|
let n = t ? vv : _v;
|
|
7064
|
-
e.matrix && (n = e.matrix), this.values = e.values, this.loc = e.loc ||
|
|
7064
|
+
e.matrix && (n = e.matrix), this.values = e.values, this.loc = e.loc || me.create(), this.conversionAccuracy = t ? "longterm" : "casual", this.invalid = e.invalid || null, this.matrix = n, this.isLuxonDuration = !0;
|
|
7065
7065
|
}
|
|
7066
7066
|
/**
|
|
7067
7067
|
* Create Duration from a number of milliseconds.
|
|
@@ -7102,7 +7102,7 @@ class ue {
|
|
|
7102
7102
|
);
|
|
7103
7103
|
return new ue({
|
|
7104
7104
|
values: Sn(e, ue.normalizeUnit),
|
|
7105
|
-
loc:
|
|
7105
|
+
loc: me.fromObject(t),
|
|
7106
7106
|
conversionAccuracy: t.conversionAccuracy,
|
|
7107
7107
|
matrix: t.matrix
|
|
7108
7108
|
});
|
|
@@ -7382,7 +7382,7 @@ class ue {
|
|
|
7382
7382
|
if (!this.isValid) return this;
|
|
7383
7383
|
const t = ue.fromDurationLike(e), n = {};
|
|
7384
7384
|
for (const s of Vt)
|
|
7385
|
-
(
|
|
7385
|
+
(fr(t.values, s) || fr(this.values, s)) && (n[s] = t.get(s) + this.get(s));
|
|
7386
7386
|
return ft(this, { values: n }, !0);
|
|
7387
7387
|
}
|
|
7388
7388
|
/**
|
|
@@ -7685,7 +7685,7 @@ class Oe {
|
|
|
7685
7685
|
* @return {Interval}
|
|
7686
7686
|
*/
|
|
7687
7687
|
static fromDateTimes(e, t) {
|
|
7688
|
-
const n =
|
|
7688
|
+
const n = Or(e), s = Or(t), i = bv(n, s);
|
|
7689
7689
|
return i ?? new Oe({
|
|
7690
7690
|
start: n,
|
|
7691
7691
|
end: s
|
|
@@ -7698,7 +7698,7 @@ class Oe {
|
|
|
7698
7698
|
* @return {Interval}
|
|
7699
7699
|
*/
|
|
7700
7700
|
static after(e, t) {
|
|
7701
|
-
const n = ue.fromDurationLike(t), s =
|
|
7701
|
+
const n = ue.fromDurationLike(t), s = Or(e);
|
|
7702
7702
|
return Oe.fromDateTimes(s, s.plus(n));
|
|
7703
7703
|
}
|
|
7704
7704
|
/**
|
|
@@ -7708,7 +7708,7 @@ class Oe {
|
|
|
7708
7708
|
* @return {Interval}
|
|
7709
7709
|
*/
|
|
7710
7710
|
static before(e, t) {
|
|
7711
|
-
const n = ue.fromDurationLike(t), s =
|
|
7711
|
+
const n = ue.fromDurationLike(t), s = Or(e);
|
|
7712
7712
|
return Oe.fromDateTimes(s.minus(n), s);
|
|
7713
7713
|
}
|
|
7714
7714
|
/**
|
|
@@ -7878,7 +7878,7 @@ class Oe {
|
|
|
7878
7878
|
*/
|
|
7879
7879
|
splitAt(...e) {
|
|
7880
7880
|
if (!this.isValid) return [];
|
|
7881
|
-
const t = e.map(
|
|
7881
|
+
const t = e.map(Or).filter((a) => this.contains(a)).sort((a, o) => a.toMillis() - o.toMillis()), n = [];
|
|
7882
7882
|
let { s } = this, i = 0;
|
|
7883
7883
|
for (; s < this.e; ) {
|
|
7884
7884
|
const a = t[i] || this.e, o = +a > +this.e ? this.e : a;
|
|
@@ -8160,7 +8160,7 @@ class rn {
|
|
|
8160
8160
|
* @returns {number} the start of the week, 1 for Monday through 7 for Sunday
|
|
8161
8161
|
*/
|
|
8162
8162
|
static getStartOfWeek({ locale: e = null, locObj: t = null } = {}) {
|
|
8163
|
-
return (t ||
|
|
8163
|
+
return (t || me.create(e)).getStartOfWeek();
|
|
8164
8164
|
}
|
|
8165
8165
|
/**
|
|
8166
8166
|
* Get the minimum number of days necessary in a week before it is considered part of the next year according
|
|
@@ -8171,7 +8171,7 @@ class rn {
|
|
|
8171
8171
|
* @returns {number}
|
|
8172
8172
|
*/
|
|
8173
8173
|
static getMinimumDaysInFirstWeek({ locale: e = null, locObj: t = null } = {}) {
|
|
8174
|
-
return (t ||
|
|
8174
|
+
return (t || me.create(e)).getMinDaysInFirstWeek();
|
|
8175
8175
|
}
|
|
8176
8176
|
/**
|
|
8177
8177
|
* Get the weekdays, which are considered the weekend according to the given locale
|
|
@@ -8181,7 +8181,7 @@ class rn {
|
|
|
8181
8181
|
* @returns {number[]} an array of weekdays, 1 for Monday through 7 for Sunday
|
|
8182
8182
|
*/
|
|
8183
8183
|
static getWeekendWeekdays({ locale: e = null, locObj: t = null } = {}) {
|
|
8184
|
-
return (t ||
|
|
8184
|
+
return (t || me.create(e)).getWeekendDays().slice();
|
|
8185
8185
|
}
|
|
8186
8186
|
/**
|
|
8187
8187
|
* Return an array of standalone month names.
|
|
@@ -8201,7 +8201,7 @@ class rn {
|
|
|
8201
8201
|
* @return {Array}
|
|
8202
8202
|
*/
|
|
8203
8203
|
static months(e = "long", { locale: t = null, numberingSystem: n = null, locObj: s = null, outputCalendar: i = "gregory" } = {}) {
|
|
8204
|
-
return (s ||
|
|
8204
|
+
return (s || me.create(t, n, i)).months(e);
|
|
8205
8205
|
}
|
|
8206
8206
|
/**
|
|
8207
8207
|
* Return an array of format month names.
|
|
@@ -8217,7 +8217,7 @@ class rn {
|
|
|
8217
8217
|
* @return {Array}
|
|
8218
8218
|
*/
|
|
8219
8219
|
static monthsFormat(e = "long", { locale: t = null, numberingSystem: n = null, locObj: s = null, outputCalendar: i = "gregory" } = {}) {
|
|
8220
|
-
return (s ||
|
|
8220
|
+
return (s || me.create(t, n, i)).months(e, !0);
|
|
8221
8221
|
}
|
|
8222
8222
|
/**
|
|
8223
8223
|
* Return an array of standalone week names.
|
|
@@ -8234,7 +8234,7 @@ class rn {
|
|
|
8234
8234
|
* @return {Array}
|
|
8235
8235
|
*/
|
|
8236
8236
|
static weekdays(e = "long", { locale: t = null, numberingSystem: n = null, locObj: s = null } = {}) {
|
|
8237
|
-
return (s ||
|
|
8237
|
+
return (s || me.create(t, n, null)).weekdays(e);
|
|
8238
8238
|
}
|
|
8239
8239
|
/**
|
|
8240
8240
|
* Return an array of format week names.
|
|
@@ -8249,7 +8249,7 @@ class rn {
|
|
|
8249
8249
|
* @return {Array}
|
|
8250
8250
|
*/
|
|
8251
8251
|
static weekdaysFormat(e = "long", { locale: t = null, numberingSystem: n = null, locObj: s = null } = {}) {
|
|
8252
|
-
return (s ||
|
|
8252
|
+
return (s || me.create(t, n, null)).weekdays(e, !0);
|
|
8253
8253
|
}
|
|
8254
8254
|
/**
|
|
8255
8255
|
* Return an array of meridiems.
|
|
@@ -8260,7 +8260,7 @@ class rn {
|
|
|
8260
8260
|
* @return {Array}
|
|
8261
8261
|
*/
|
|
8262
8262
|
static meridiems({ locale: e = null } = {}) {
|
|
8263
|
-
return
|
|
8263
|
+
return me.create(e).meridiems();
|
|
8264
8264
|
}
|
|
8265
8265
|
/**
|
|
8266
8266
|
* Return an array of eras, such as ['BC', 'AD']. The locale can be specified, but the calendar system is always Gregorian.
|
|
@@ -8273,7 +8273,7 @@ class rn {
|
|
|
8273
8273
|
* @return {Array}
|
|
8274
8274
|
*/
|
|
8275
8275
|
static eras(e = "short", { locale: t = null } = {}) {
|
|
8276
|
-
return
|
|
8276
|
+
return me.create(t, null, "gregory").eras(e);
|
|
8277
8277
|
}
|
|
8278
8278
|
/**
|
|
8279
8279
|
* Return the set of available features in this environment.
|
|
@@ -8347,10 +8347,10 @@ function Cv(r) {
|
|
|
8347
8347
|
return r.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
|
|
8348
8348
|
}
|
|
8349
8349
|
function Av(r, e) {
|
|
8350
|
-
const t = et(e), n = et(e, "{2}"), s = et(e, "{3}"), i = et(e, "{4}"), a = et(e, "{6}"), o = et(e, "{1,2}"), c = et(e, "{1,3}"), l = et(e, "{1,6}"), u = et(e, "{1,9}"), f = et(e, "{2,4}"),
|
|
8350
|
+
const t = et(e), n = et(e, "{2}"), s = et(e, "{3}"), i = et(e, "{4}"), a = et(e, "{6}"), o = et(e, "{1,2}"), c = et(e, "{1,3}"), l = et(e, "{1,6}"), u = et(e, "{1,9}"), f = et(e, "{2,4}"), h = et(e, "{4,6}"), d = (y) => ({ regex: RegExp(Cv(y.val)), deser: ([_]) => _, literal: !0 }), E = ((y) => {
|
|
8351
8351
|
if (r.literal)
|
|
8352
|
-
return
|
|
8353
|
-
switch (
|
|
8352
|
+
return d(y);
|
|
8353
|
+
switch (y.val) {
|
|
8354
8354
|
// era
|
|
8355
8355
|
case "G":
|
|
8356
8356
|
return tt(e.eras("short"), 0);
|
|
@@ -8364,7 +8364,7 @@ function Av(r, e) {
|
|
|
8364
8364
|
case "yyyy":
|
|
8365
8365
|
return de(i);
|
|
8366
8366
|
case "yyyyy":
|
|
8367
|
-
return de(
|
|
8367
|
+
return de(h);
|
|
8368
8368
|
case "yyyyyy":
|
|
8369
8369
|
return de(a);
|
|
8370
8370
|
// months
|
|
@@ -8465,7 +8465,7 @@ function Av(r, e) {
|
|
|
8465
8465
|
case " ":
|
|
8466
8466
|
return nn(/[^\S\n\r]/);
|
|
8467
8467
|
default:
|
|
8468
|
-
return
|
|
8468
|
+
return d(y);
|
|
8469
8469
|
}
|
|
8470
8470
|
})(r) || {
|
|
8471
8471
|
invalidReason: Sv
|
|
@@ -8542,7 +8542,7 @@ function Nv(r, e, t) {
|
|
|
8542
8542
|
const s = {};
|
|
8543
8543
|
let i = 1;
|
|
8544
8544
|
for (const a in t)
|
|
8545
|
-
if (
|
|
8545
|
+
if (fr(t, a)) {
|
|
8546
8546
|
const o = t[a], c = o.groups ? o.groups + 1 : 1;
|
|
8547
8547
|
!o.literal && o.token && (s[o.token.val[0]] = o.deser(n.slice(i, i + c))), i += c;
|
|
8548
8548
|
}
|
|
@@ -8613,7 +8613,7 @@ class rm {
|
|
|
8613
8613
|
explainFromTokens(e) {
|
|
8614
8614
|
if (this.isValid) {
|
|
8615
8615
|
const [t, n] = Nv(e, this.regex, this.handlers), [s, i, a] = n ? Fv(n) : [null, null, void 0];
|
|
8616
|
-
if (
|
|
8616
|
+
if (fr(n, "a") && fr(n, "H"))
|
|
8617
8617
|
throw new er(
|
|
8618
8618
|
"Can't include meridiem when specifying 24-hour format"
|
|
8619
8619
|
);
|
|
@@ -8651,7 +8651,7 @@ function sm(r, e) {
|
|
|
8651
8651
|
return s.map((a) => Iv(a, r, i));
|
|
8652
8652
|
}
|
|
8653
8653
|
const Ra = "Invalid DateTime", Wf = 864e13;
|
|
8654
|
-
function
|
|
8654
|
+
function kr(r) {
|
|
8655
8655
|
return new nt("unsupported zone", `the zone "${r.name}" is not supported`);
|
|
8656
8656
|
}
|
|
8657
8657
|
function Ca(r) {
|
|
@@ -8735,7 +8735,7 @@ function Jt(r, e, t, n, s, i) {
|
|
|
8735
8735
|
);
|
|
8736
8736
|
}
|
|
8737
8737
|
function an(r, e, t = !0) {
|
|
8738
|
-
return r.isValid ? Fe.create(
|
|
8738
|
+
return r.isValid ? Fe.create(me.create("en-US"), {
|
|
8739
8739
|
allowZ: t,
|
|
8740
8740
|
forceSimple: !0
|
|
8741
8741
|
}).formatDateTimeFromString(r, e) : null;
|
|
@@ -8846,17 +8846,17 @@ function Zf(r) {
|
|
|
8846
8846
|
}
|
|
8847
8847
|
}
|
|
8848
8848
|
function Uv(r) {
|
|
8849
|
-
if (
|
|
8850
|
-
return r.offset(
|
|
8849
|
+
if (Ir === void 0 && (Ir = Ee.now()), r.type !== "iana")
|
|
8850
|
+
return r.offset(Ir);
|
|
8851
8851
|
const e = r.name;
|
|
8852
8852
|
let t = So.get(e);
|
|
8853
|
-
return t === void 0 && (t = r.offset(
|
|
8853
|
+
return t === void 0 && (t = r.offset(Ir), So.set(e, t)), t;
|
|
8854
8854
|
}
|
|
8855
8855
|
function Gf(r, e) {
|
|
8856
8856
|
const t = kt(e.zone, Ee.defaultZone);
|
|
8857
8857
|
if (!t.isValid)
|
|
8858
|
-
return B.invalid(
|
|
8859
|
-
const n =
|
|
8858
|
+
return B.invalid(kr(t));
|
|
8859
|
+
const n = me.fromObject(e);
|
|
8860
8860
|
let s, i;
|
|
8861
8861
|
if (J(r.year))
|
|
8862
8862
|
s = Ee.now();
|
|
@@ -8886,7 +8886,7 @@ function Kf(r) {
|
|
|
8886
8886
|
let e = {}, t;
|
|
8887
8887
|
return r.length > 0 && typeof r[r.length - 1] == "object" ? (e = r[r.length - 1], t = Array.from(r).slice(0, r.length - 1)) : t = Array.from(r), [e, t];
|
|
8888
8888
|
}
|
|
8889
|
-
let
|
|
8889
|
+
let Ir;
|
|
8890
8890
|
const So = /* @__PURE__ */ new Map();
|
|
8891
8891
|
class B {
|
|
8892
8892
|
/**
|
|
@@ -8894,7 +8894,7 @@ class B {
|
|
|
8894
8894
|
*/
|
|
8895
8895
|
constructor(e) {
|
|
8896
8896
|
const t = e.zone || Ee.defaultZone;
|
|
8897
|
-
let n = e.invalid || (Number.isNaN(e.ts) ? new nt("invalid input") : null) || (t.isValid ? null :
|
|
8897
|
+
let n = e.invalid || (Number.isNaN(e.ts) ? new nt("invalid input") : null) || (t.isValid ? null : kr(t));
|
|
8898
8898
|
this.ts = J(e.ts) ? Ee.now() : e.ts;
|
|
8899
8899
|
let s = null, i = null;
|
|
8900
8900
|
if (!n)
|
|
@@ -8904,7 +8904,7 @@ class B {
|
|
|
8904
8904
|
const o = xt(e.o) && !e.old ? e.o : t.offset(this.ts);
|
|
8905
8905
|
s = sn(this.ts, o), n = Number.isNaN(s.year) ? new nt("invalid input") : null, s = n ? null : s, i = n ? null : o;
|
|
8906
8906
|
}
|
|
8907
|
-
this._zone = t, this.loc = e.loc ||
|
|
8907
|
+
this._zone = t, this.loc = e.loc || me.create(), this.invalid = n, this.weekData = null, this.localWeekData = null, this.c = s, this.o = i, this.isLuxonDateTime = !0;
|
|
8908
8908
|
}
|
|
8909
8909
|
// CONSTRUCT
|
|
8910
8910
|
/**
|
|
@@ -8986,8 +8986,8 @@ class B {
|
|
|
8986
8986
|
return s.isValid ? new B({
|
|
8987
8987
|
ts: n,
|
|
8988
8988
|
zone: s,
|
|
8989
|
-
loc:
|
|
8990
|
-
}) : B.invalid(
|
|
8989
|
+
loc: me.fromObject(t)
|
|
8990
|
+
}) : B.invalid(kr(s));
|
|
8991
8991
|
}
|
|
8992
8992
|
/**
|
|
8993
8993
|
* Create a DateTime from a number of milliseconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone.
|
|
@@ -9005,7 +9005,7 @@ class B {
|
|
|
9005
9005
|
return e < -Wf || e > Wf ? B.invalid("Timestamp out of range") : new B({
|
|
9006
9006
|
ts: e,
|
|
9007
9007
|
zone: kt(t.zone, Ee.defaultZone),
|
|
9008
|
-
loc:
|
|
9008
|
+
loc: me.fromObject(t)
|
|
9009
9009
|
});
|
|
9010
9010
|
throw new Ne(
|
|
9011
9011
|
`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`
|
|
@@ -9027,7 +9027,7 @@ class B {
|
|
|
9027
9027
|
return new B({
|
|
9028
9028
|
ts: e * 1e3,
|
|
9029
9029
|
zone: kt(t.zone, Ee.defaultZone),
|
|
9030
|
-
loc:
|
|
9030
|
+
loc: me.fromObject(t)
|
|
9031
9031
|
});
|
|
9032
9032
|
throw new Ne("fromSeconds requires a numerical input");
|
|
9033
9033
|
}
|
|
@@ -9068,35 +9068,35 @@ class B {
|
|
|
9068
9068
|
e = e || {};
|
|
9069
9069
|
const n = kt(t.zone, Ee.defaultZone);
|
|
9070
9070
|
if (!n.isValid)
|
|
9071
|
-
return B.invalid(
|
|
9072
|
-
const s =
|
|
9073
|
-
if ((
|
|
9071
|
+
return B.invalid(kr(n));
|
|
9072
|
+
const s = me.fromObject(t), i = Sn(e, Zf), { minDaysInFirstWeek: a, startOfWeek: o } = Nf(i, s), c = Ee.now(), l = J(t.specificOffset) ? n.offset(c) : t.specificOffset, u = !J(i.ordinal), f = !J(i.year), h = !J(i.month) || !J(i.day), d = f || h, p = i.weekYear || i.weekNumber;
|
|
9073
|
+
if ((d || u) && p)
|
|
9074
9074
|
throw new er(
|
|
9075
9075
|
"Can't mix weekYear/weekNumber units with year/month/day or ordinals"
|
|
9076
9076
|
);
|
|
9077
|
-
if (
|
|
9077
|
+
if (h && u)
|
|
9078
9078
|
throw new er("Can't mix ordinal dates with month/day");
|
|
9079
|
-
const E =
|
|
9080
|
-
let
|
|
9081
|
-
E ? (
|
|
9082
|
-
let
|
|
9083
|
-
for (const
|
|
9084
|
-
const k = i[
|
|
9085
|
-
J(k) ?
|
|
9086
|
-
}
|
|
9087
|
-
const
|
|
9088
|
-
if (
|
|
9089
|
-
return B.invalid(
|
|
9090
|
-
const
|
|
9079
|
+
const E = p || i.weekday && !d;
|
|
9080
|
+
let y, _, S = sn(c, l);
|
|
9081
|
+
E ? (y = $v, _ = qv, S = On(S, a, o)) : u ? (y = jv, _ = Lv, S = Sa(S)) : (y = ln, _ = am);
|
|
9082
|
+
let A = !1;
|
|
9083
|
+
for (const g of y) {
|
|
9084
|
+
const k = i[g];
|
|
9085
|
+
J(k) ? A ? i[g] = _[g] : i[g] = S[g] : A = !0;
|
|
9086
|
+
}
|
|
9087
|
+
const F = E ? y_(i, a, o) : u ? g_(i) : Nh(i), m = F || Fh(i);
|
|
9088
|
+
if (m)
|
|
9089
|
+
return B.invalid(m);
|
|
9090
|
+
const T = E ? If(i, a, o) : u ? xf(i) : i, [R, v] = cn(T, l, n), C = new B({
|
|
9091
9091
|
ts: R,
|
|
9092
9092
|
zone: n,
|
|
9093
|
-
o:
|
|
9093
|
+
o: v,
|
|
9094
9094
|
loc: s
|
|
9095
9095
|
});
|
|
9096
|
-
return i.weekday &&
|
|
9096
|
+
return i.weekday && d && e.weekday !== C.weekday ? B.invalid(
|
|
9097
9097
|
"mismatched weekday",
|
|
9098
|
-
`you can't specify both a weekday of ${i.weekday} and a date of ${
|
|
9099
|
-
) :
|
|
9098
|
+
`you can't specify both a weekday of ${i.weekday} and a date of ${C.toISO()}`
|
|
9099
|
+
) : C.isValid ? C : B.invalid(C.invalid);
|
|
9100
9100
|
}
|
|
9101
9101
|
/**
|
|
9102
9102
|
* Create a DateTime from an ISO 8601 string
|
|
@@ -9175,7 +9175,7 @@ class B {
|
|
|
9175
9175
|
static fromFormat(e, t, n = {}) {
|
|
9176
9176
|
if (J(e) || J(t))
|
|
9177
9177
|
throw new Ne("fromFormat requires an input string and a format");
|
|
9178
|
-
const { locale: s = null, numberingSystem: i = null } = n, a =
|
|
9178
|
+
const { locale: s = null, numberingSystem: i = null } = n, a = me.fromOpts({
|
|
9179
9179
|
locale: s,
|
|
9180
9180
|
numberingSystem: i,
|
|
9181
9181
|
defaultToEN: !0
|
|
@@ -9242,7 +9242,7 @@ class B {
|
|
|
9242
9242
|
* @returns {string}
|
|
9243
9243
|
*/
|
|
9244
9244
|
static parseFormatForOpts(e, t = {}) {
|
|
9245
|
-
const n = sm(e,
|
|
9245
|
+
const n = sm(e, me.fromObject(t));
|
|
9246
9246
|
return n ? n.map((s) => s ? s.val : null).join("") : null;
|
|
9247
9247
|
}
|
|
9248
9248
|
/**
|
|
@@ -9253,10 +9253,10 @@ class B {
|
|
|
9253
9253
|
* @returns {string}
|
|
9254
9254
|
*/
|
|
9255
9255
|
static expandFormat(e, t = {}) {
|
|
9256
|
-
return tm(Fe.parseFormat(e),
|
|
9256
|
+
return tm(Fe.parseFormat(e), me.fromObject(t)).map((s) => s.val).join("");
|
|
9257
9257
|
}
|
|
9258
9258
|
static resetCache() {
|
|
9259
|
-
|
|
9259
|
+
Ir = void 0, So.clear();
|
|
9260
9260
|
}
|
|
9261
9261
|
// INFO
|
|
9262
9262
|
/**
|
|
@@ -9664,7 +9664,7 @@ class B {
|
|
|
9664
9664
|
}
|
|
9665
9665
|
return Lt(this, { ts: s, zone: e });
|
|
9666
9666
|
} else
|
|
9667
|
-
return B.invalid(
|
|
9667
|
+
return B.invalid(kr(e));
|
|
9668
9668
|
}
|
|
9669
9669
|
/**
|
|
9670
9670
|
* "Set" the locale, numberingSystem, or outputCalendar. Returns a newly-constructed DateTime.
|
|
@@ -9713,8 +9713,8 @@ class B {
|
|
|
9713
9713
|
n,
|
|
9714
9714
|
s
|
|
9715
9715
|
) : J(t.ordinal) ? (f = { ...this.toObject(), ...t }, J(t.day) && (f.day = Math.min(En(f.year, f.month), f.day))) : f = xf({ ...Sa(this.c), ...t });
|
|
9716
|
-
const [
|
|
9717
|
-
return Lt(this, { ts:
|
|
9716
|
+
const [h, d] = cn(f, this.o, this.zone);
|
|
9717
|
+
return Lt(this, { ts: h, o: d });
|
|
9718
9718
|
}
|
|
9719
9719
|
/**
|
|
9720
9720
|
* Add a period of time to this DateTime and return the resulting DateTime
|
|
@@ -10241,7 +10241,7 @@ class B {
|
|
|
10241
10241
|
* @return {Object}
|
|
10242
10242
|
*/
|
|
10243
10243
|
static fromFormatExplain(e, t, n = {}) {
|
|
10244
|
-
const { locale: s = null, numberingSystem: i = null } = n, a =
|
|
10244
|
+
const { locale: s = null, numberingSystem: i = null } = n, a = me.fromOpts({
|
|
10245
10245
|
locale: s,
|
|
10246
10246
|
numberingSystem: i,
|
|
10247
10247
|
defaultToEN: !0
|
|
@@ -10267,7 +10267,7 @@ class B {
|
|
|
10267
10267
|
* @returns {TokenParser} - opaque object to be used
|
|
10268
10268
|
*/
|
|
10269
10269
|
static buildFormatParser(e, t = {}) {
|
|
10270
|
-
const { locale: n = null, numberingSystem: s = null } = t, i =
|
|
10270
|
+
const { locale: n = null, numberingSystem: s = null } = t, i = me.fromOpts({
|
|
10271
10271
|
locale: n,
|
|
10272
10272
|
numberingSystem: s,
|
|
10273
10273
|
defaultToEN: !0
|
|
@@ -10289,7 +10289,7 @@ class B {
|
|
|
10289
10289
|
throw new Ne(
|
|
10290
10290
|
"fromFormatParser requires an input string and a format parser"
|
|
10291
10291
|
);
|
|
10292
|
-
const { locale: s = null, numberingSystem: i = null } = n, a =
|
|
10292
|
+
const { locale: s = null, numberingSystem: i = null } = n, a = me.fromOpts({
|
|
10293
10293
|
locale: s,
|
|
10294
10294
|
numberingSystem: i,
|
|
10295
10295
|
defaultToEN: !0
|
|
@@ -10464,7 +10464,7 @@ class B {
|
|
|
10464
10464
|
return Th;
|
|
10465
10465
|
}
|
|
10466
10466
|
}
|
|
10467
|
-
function
|
|
10467
|
+
function Or(r) {
|
|
10468
10468
|
if (B.isDateTime(r))
|
|
10469
10469
|
return r;
|
|
10470
10470
|
if (r && r.valueOf && xt(r.valueOf()))
|
|
@@ -10486,37 +10486,37 @@ const Yf = async (r, e) => {
|
|
|
10486
10486
|
for (const o of n.fields)
|
|
10487
10487
|
await Yf(o.custom?.preValidate, s);
|
|
10488
10488
|
return Wg(r, t, i).parse(e), e;
|
|
10489
|
-
}, ac = (r, e, t, n, s, i, a, o, c, l, u, f,
|
|
10490
|
-
const { fields:
|
|
10491
|
-
|
|
10492
|
-
r !== "delete" && (typeof s[
|
|
10489
|
+
}, ac = (r, e, t, n, s, i, a, o, c, l, u, f, h, d, p, E, y, _, S, A, F) => {
|
|
10490
|
+
const { fields: m } = a;
|
|
10491
|
+
m.filter((v) => "unique" in v && v.unique).forEach((v) => {
|
|
10492
|
+
r !== "delete" && (typeof s[v.name] == "string" || typeof s[v.name] == "number") && e.set(d(v, s[v.name].toString().toLowerCase().replace(/\s/g, "---").replaceAll("/", "|||")), {
|
|
10493
10493
|
id: n,
|
|
10494
10494
|
Collection_Path: t
|
|
10495
10495
|
});
|
|
10496
|
-
}),
|
|
10497
|
-
if (cg(
|
|
10498
|
-
const
|
|
10499
|
-
s[
|
|
10500
|
-
s[k.name] !== void 0 && (_e(k) ?
|
|
10501
|
-
}), Object.keys(
|
|
10496
|
+
}), m.forEach((v) => {
|
|
10497
|
+
if (cg(v, a, i)) {
|
|
10498
|
+
const C = fg(v, a, i), g = {};
|
|
10499
|
+
s[v.name] !== void 0 && (g[v.name] = s[v.name], _e(v) && (g[`${v.name}_Array`] = s[`${v.name}_Array`])), C.forEach((k) => {
|
|
10500
|
+
s[k.name] !== void 0 && (_e(k) ? g[`${k.name}_Array`] = s[`${k.name}_Array`] : g[k.name] = s[k.name]);
|
|
10501
|
+
}), Object.keys(g).length > 0 && (r === "create" && (g.Collection_Path = t, g.Collection_Path_String = t.join("/"), e.set(h(v), g)), r === "update" && e.update(h(v), g), r === "delete" && e.delete(h(v)));
|
|
10502
10502
|
}
|
|
10503
10503
|
});
|
|
10504
|
-
const
|
|
10505
|
-
for (const
|
|
10506
|
-
const
|
|
10507
|
-
|
|
10508
|
-
delete
|
|
10509
|
-
}), Object.keys(
|
|
10504
|
+
const T = c[a.labels.collection];
|
|
10505
|
+
for (const v of T) {
|
|
10506
|
+
const C = dg(v, a), g = { ...s };
|
|
10507
|
+
C.forEach((k) => {
|
|
10508
|
+
delete g[k.name], delete g[`${k.name}_Array`], delete g[`${k.name}_Single`], delete g[`${k.name}_Lowercase`];
|
|
10509
|
+
}), Object.keys(g).length > 0 && (r === "create" && (g.Collection_Path ||= t, g.Collection_Path_String = t.join("/"), e.set(p(v.key), g)), r === "update" && e.update(p(v.key), g), r === "delete" && e.delete(p(v.key)));
|
|
10510
10510
|
}
|
|
10511
10511
|
if (r === "delete")
|
|
10512
10512
|
return;
|
|
10513
|
-
const R =
|
|
10513
|
+
const R = m.filter((v) => _e(v) && v.twoWay);
|
|
10514
10514
|
if (!o?.noTwoWay) {
|
|
10515
|
-
for (const
|
|
10515
|
+
for (const v of R)
|
|
10516
10516
|
throw new Error("VALIDATION_ERROR: batchSize is required");
|
|
10517
|
-
for (const
|
|
10517
|
+
for (const v of R)
|
|
10518
10518
|
throw new Error("VALIDATION_ERROR: batchSize is required");
|
|
10519
|
-
for (const
|
|
10519
|
+
for (const v of R)
|
|
10520
10520
|
throw new Error("VALIDATION_ERROR: batchSize is required");
|
|
10521
10521
|
}
|
|
10522
10522
|
};
|
|
@@ -10639,41 +10639,41 @@ var Ua, cd;
|
|
|
10639
10639
|
function Qv() {
|
|
10640
10640
|
if (cd) return Ua;
|
|
10641
10641
|
cd = 1;
|
|
10642
|
-
var r = zo(), e = Kv(), t = Yv(), n = Jv(), s = Bd(), i = "[object Boolean]", a = "[object Date]", o = "[object Map]", c = "[object Number]", l = "[object RegExp]", u = "[object Set]", f = "[object String]",
|
|
10643
|
-
function
|
|
10644
|
-
var I =
|
|
10645
|
-
switch (
|
|
10646
|
-
case
|
|
10647
|
-
return r(
|
|
10642
|
+
var r = zo(), e = Kv(), t = Yv(), n = Jv(), s = Bd(), i = "[object Boolean]", a = "[object Date]", o = "[object Map]", c = "[object Number]", l = "[object RegExp]", u = "[object Set]", f = "[object String]", h = "[object Symbol]", d = "[object ArrayBuffer]", p = "[object DataView]", E = "[object Float32Array]", y = "[object Float64Array]", _ = "[object Int8Array]", S = "[object Int16Array]", A = "[object Int32Array]", F = "[object Uint8Array]", m = "[object Uint8ClampedArray]", T = "[object Uint16Array]", R = "[object Uint32Array]";
|
|
10643
|
+
function v(C, g, k) {
|
|
10644
|
+
var I = C.constructor;
|
|
10645
|
+
switch (g) {
|
|
10646
|
+
case d:
|
|
10647
|
+
return r(C);
|
|
10648
10648
|
case i:
|
|
10649
10649
|
case a:
|
|
10650
|
-
return new I(+
|
|
10651
|
-
case
|
|
10652
|
-
return e(
|
|
10650
|
+
return new I(+C);
|
|
10651
|
+
case p:
|
|
10652
|
+
return e(C, k);
|
|
10653
10653
|
case E:
|
|
10654
|
-
case
|
|
10655
|
-
case
|
|
10654
|
+
case y:
|
|
10655
|
+
case _:
|
|
10656
10656
|
case S:
|
|
10657
|
+
case A:
|
|
10658
|
+
case F:
|
|
10659
|
+
case m:
|
|
10657
10660
|
case T:
|
|
10658
|
-
case P:
|
|
10659
|
-
case y:
|
|
10660
|
-
case C:
|
|
10661
10661
|
case R:
|
|
10662
|
-
return s(
|
|
10662
|
+
return s(C, k);
|
|
10663
10663
|
case o:
|
|
10664
10664
|
return new I();
|
|
10665
10665
|
case c:
|
|
10666
10666
|
case f:
|
|
10667
|
-
return new I(
|
|
10667
|
+
return new I(C);
|
|
10668
10668
|
case l:
|
|
10669
|
-
return t(
|
|
10669
|
+
return t(C);
|
|
10670
10670
|
case u:
|
|
10671
10671
|
return new I();
|
|
10672
|
-
case
|
|
10673
|
-
return n(
|
|
10672
|
+
case h:
|
|
10673
|
+
return n(C);
|
|
10674
10674
|
}
|
|
10675
10675
|
}
|
|
10676
|
-
return Ua =
|
|
10676
|
+
return Ua = v, Ua;
|
|
10677
10677
|
}
|
|
10678
10678
|
var Va, ld;
|
|
10679
10679
|
function Xv() {
|
|
@@ -10713,43 +10713,43 @@ var Za, hd;
|
|
|
10713
10713
|
function nw() {
|
|
10714
10714
|
if (hd) return Za;
|
|
10715
10715
|
hd = 1;
|
|
10716
|
-
var r = Mo(), e = Vv(), t = Zo(), n = Wv(), s = zv(), i = zd(), a = Zd(), o = Bv(), c = Zv(), l = jd(), u = Gv(), f = qn(),
|
|
10717
|
-
Z[
|
|
10718
|
-
function Te(H, ge, se, Xe, ut,
|
|
10719
|
-
var xe,
|
|
10720
|
-
if (se && (xe = ut ? se(H, Xe, ut,
|
|
10716
|
+
var r = Mo(), e = Vv(), t = Zo(), n = Wv(), s = zv(), i = zd(), a = Zd(), o = Bv(), c = Zv(), l = jd(), u = Gv(), f = qn(), h = Hv(), d = Qv(), p = Gd(), E = Dt(), y = Mn(), _ = ew(), S = wt(), A = rw(), F = Vo(), m = Br(), T = 1, R = 2, v = 4, C = "[object Arguments]", g = "[object Array]", k = "[object Boolean]", I = "[object Date]", b = "[object Error]", w = "[object Function]", O = "[object GeneratorFunction]", x = "[object Map]", P = "[object Number]", M = "[object Object]", q = "[object RegExp]", z = "[object Set]", ee = "[object String]", oe = "[object Symbol]", D = "[object WeakMap]", te = "[object ArrayBuffer]", ne = "[object DataView]", Me = "[object Float32Array]", Se = "[object Float64Array]", Le = "[object Int8Array]", Ot = "[object Int16Array]", G = "[object Int32Array]", K = "[object Uint8Array]", j = "[object Uint8ClampedArray]", Y = "[object Uint16Array]", U = "[object Uint32Array]", Z = {};
|
|
10717
|
+
Z[C] = Z[g] = Z[te] = Z[ne] = Z[k] = Z[I] = Z[Me] = Z[Se] = Z[Le] = Z[Ot] = Z[G] = Z[x] = Z[P] = Z[M] = Z[q] = Z[z] = Z[ee] = Z[oe] = Z[K] = Z[j] = Z[Y] = Z[U] = !0, Z[b] = Z[w] = Z[D] = !1;
|
|
10718
|
+
function Te(H, ge, se, Xe, ut, Be) {
|
|
10719
|
+
var xe, wr = ge & T, Re = ge & R, br = ge & v;
|
|
10720
|
+
if (se && (xe = ut ? se(H, Xe, ut, Be) : se(H)), xe !== void 0)
|
|
10721
10721
|
return xe;
|
|
10722
10722
|
if (!S(H))
|
|
10723
10723
|
return H;
|
|
10724
10724
|
var _c = E(H);
|
|
10725
10725
|
if (_c) {
|
|
10726
|
-
if (xe =
|
|
10726
|
+
if (xe = h(H), !wr)
|
|
10727
10727
|
return a(H, xe);
|
|
10728
10728
|
} else {
|
|
10729
10729
|
var Ht = f(H), vc = Ht == w || Ht == O;
|
|
10730
|
-
if (
|
|
10731
|
-
return i(H,
|
|
10732
|
-
if (Ht ==
|
|
10733
|
-
if (xe = Re || vc ? {} :
|
|
10730
|
+
if (y(H))
|
|
10731
|
+
return i(H, wr);
|
|
10732
|
+
if (Ht == M || Ht == C || vc && !ut) {
|
|
10733
|
+
if (xe = Re || vc ? {} : p(H), !wr)
|
|
10734
10734
|
return Re ? c(H, s(xe, H)) : o(H, n(xe, H));
|
|
10735
10735
|
} else {
|
|
10736
10736
|
if (!Z[Ht])
|
|
10737
10737
|
return ut ? H : {};
|
|
10738
|
-
xe =
|
|
10738
|
+
xe = d(H, Ht, wr);
|
|
10739
10739
|
}
|
|
10740
10740
|
}
|
|
10741
|
-
|
|
10742
|
-
var wc =
|
|
10741
|
+
Be || (Be = new r());
|
|
10742
|
+
var wc = Be.get(H);
|
|
10743
10743
|
if (wc)
|
|
10744
10744
|
return wc;
|
|
10745
|
-
|
|
10746
|
-
xe.add(Te(Et, ge, se, Et, H,
|
|
10747
|
-
}) :
|
|
10748
|
-
xe.set(Pt, Te(Et, ge, se, Pt, H,
|
|
10745
|
+
Be.set(H, xe), A(H) ? H.forEach(function(Et) {
|
|
10746
|
+
xe.add(Te(Et, ge, se, Et, H, Be));
|
|
10747
|
+
}) : _(H) && H.forEach(function(Et, Pt) {
|
|
10748
|
+
xe.set(Pt, Te(Et, ge, se, Pt, H, Be));
|
|
10749
10749
|
});
|
|
10750
|
-
var Im =
|
|
10750
|
+
var Im = br ? Re ? u : l : Re ? m : F, bc = _c ? void 0 : Im(H);
|
|
10751
10751
|
return e(bc || H, function(Et, Pt) {
|
|
10752
|
-
bc && (Pt = Et, Et = H[Pt]), t(xe, Pt, Te(Et, ge, se, Pt, H,
|
|
10752
|
+
bc && (Pt = Et, Et = H[Pt]), t(xe, Pt, Te(Et, ge, se, Pt, H, Be));
|
|
10753
10753
|
}), xe;
|
|
10754
10754
|
}
|
|
10755
10755
|
return Za = Te, Za;
|
|
@@ -10851,121 +10851,122 @@ const we = /* @__PURE__ */ In(iw), Nt = (r) => {
|
|
|
10851
10851
|
throw new Error("Email body is too long");
|
|
10852
10852
|
return e;
|
|
10853
10853
|
}, oc = (r, e, t) => {
|
|
10854
|
-
const n =
|
|
10854
|
+
const n = We(), s = Mt(), i = Ve(), a = De(), o = r.at(-1);
|
|
10855
10855
|
if (!o)
|
|
10856
10856
|
throw new Error("EMPTY_PATH");
|
|
10857
|
-
const c = i.collections[o], { labels: l, fields: u, preloadCache: f } = c,
|
|
10857
|
+
const c = i.collections[o], { labels: l, fields: u, preloadCache: f } = c, h = lt(o), d = a.collections?.[l.collection];
|
|
10858
10858
|
if (!a.Role)
|
|
10859
10859
|
throw new Error("PERMISSION_DENIED");
|
|
10860
|
-
const
|
|
10860
|
+
const p = d && vt("Read", d), E = kn(c, i, a), y = Rd(c, a), _ = xo(c, a), S = Cd(c, i, a), A = (w = []) => {
|
|
10861
10861
|
const O = [];
|
|
10862
|
-
if (
|
|
10863
|
-
|
|
10864
|
-
|
|
10862
|
+
if (p) {
|
|
10863
|
+
let x = he(qr(n, "tenants", s, "system_fields", l.collection, `${l.collection}-${e.key}`), ...w);
|
|
10864
|
+
t || (x = he(x, ye("Collection_Path_String", "==", r.join("/")))), O.push(x);
|
|
10865
|
+
} else if (E)
|
|
10865
10866
|
for (const x of E)
|
|
10866
|
-
O.push(
|
|
10867
|
+
O.push(he(qr(n, "tenants", s, "system_fields", l.collection, `${l.collection}-${x.field}`), ye("Collection_Path_String", "==", r.join("/")), ...w));
|
|
10867
10868
|
return O;
|
|
10868
|
-
},
|
|
10869
|
-
if (
|
|
10870
|
-
return
|
|
10871
|
-
let
|
|
10872
|
-
const
|
|
10873
|
-
w && (
|
|
10869
|
+
}, F = y.filter((w) => "operations" in w && w.operations ? w.operations.includes("Read") : !0);
|
|
10870
|
+
if (F.length === 0 && _.length === 0 && S.length === 0)
|
|
10871
|
+
return A();
|
|
10872
|
+
let m = 0;
|
|
10873
|
+
const T = (w) => {
|
|
10874
|
+
w && (m === 0 ? m = w : m *= w);
|
|
10874
10875
|
};
|
|
10875
|
-
if (
|
|
10876
|
-
for (const w of
|
|
10876
|
+
if (F) {
|
|
10877
|
+
for (const w of F)
|
|
10877
10878
|
if (w.type === "Record_Property") {
|
|
10878
10879
|
const O = w.roles.find((x) => x.role === a.Role);
|
|
10879
10880
|
if (!O)
|
|
10880
10881
|
throw new Error("PERMISSION_DENIED");
|
|
10881
|
-
|
|
10882
|
+
T(O.values?.length);
|
|
10882
10883
|
}
|
|
10883
10884
|
}
|
|
10884
|
-
f?.roles.includes(a.Role) && f.range &&
|
|
10885
|
-
const R =
|
|
10886
|
-
R && !f?.roles.includes(a.Role) &&
|
|
10887
|
-
const
|
|
10888
|
-
|
|
10885
|
+
f?.roles.includes(a.Role) && f.range && T(f.range.fields.length);
|
|
10886
|
+
const R = h.admin?.statusField;
|
|
10887
|
+
R && !f?.roles.includes(a.Role) && T(Math.max(R.active?.length || 0, R.archived?.length || 0));
|
|
10888
|
+
const v = m === 0 ? 30 : Math.max(1, Math.floor(30 / m)), C = [];
|
|
10889
|
+
F.filter((w) => w.type === "Record_Owner").forEach(() => C.push(ye("Created_By", "==", a.User_ID))), F.filter((w) => w.type === "Record_User").forEach((w) => {
|
|
10889
10890
|
if ("collectionField" in w) {
|
|
10890
10891
|
const O = re(u, w.collectionField);
|
|
10891
|
-
|
|
10892
|
+
C.push(ye(`${O.name}_Array`, "array-contains", a.Doc_ID));
|
|
10892
10893
|
}
|
|
10893
|
-
}),
|
|
10894
|
+
}), F.filter((w) => w.type === "Record_Property").forEach((w) => {
|
|
10894
10895
|
if ("propertyField" in w) {
|
|
10895
|
-
const O = w.roles.find((
|
|
10896
|
+
const O = w.roles.find((P) => P.role === a.Role);
|
|
10896
10897
|
if (!O)
|
|
10897
10898
|
throw new Error("PERMISSION_DENIED");
|
|
10898
10899
|
const x = re(u, w.propertyField);
|
|
10899
|
-
x.type === "Array" ?
|
|
10900
|
+
x.type === "Array" ? C.push(ye(x.name, "array-contains-any", O.values)) : C.push(ye(x.name, "in", O.values));
|
|
10900
10901
|
}
|
|
10901
10902
|
});
|
|
10902
|
-
const
|
|
10903
|
-
|
|
10904
|
-
const O =
|
|
10903
|
+
const g = [];
|
|
10904
|
+
_.filter((w) => w.type === "Individual").forEach((w) => {
|
|
10905
|
+
const O = d?.individualEntities, x = [];
|
|
10905
10906
|
if (O) {
|
|
10906
|
-
const
|
|
10907
|
-
for (let
|
|
10908
|
-
const q = O.slice(
|
|
10907
|
+
const P = w.singleQuery ? w.singleQuery : v;
|
|
10908
|
+
for (let M = 0; M < O.length; M += P) {
|
|
10909
|
+
const q = O.slice(M, M + P);
|
|
10909
10910
|
x.push(q);
|
|
10910
10911
|
}
|
|
10911
10912
|
if (!w.singleQuery)
|
|
10912
|
-
x.forEach((
|
|
10913
|
-
|
|
10913
|
+
x.forEach((M) => {
|
|
10914
|
+
g.push(...A(C.concat(ye("id", "in", M))));
|
|
10914
10915
|
});
|
|
10915
10916
|
else {
|
|
10916
|
-
if (O.length >
|
|
10917
|
+
if (O.length > P)
|
|
10917
10918
|
throw new Error(`INPUT_ERROR: Individual entity restriction with singleQuery set to true must not have more than ${w.singleQuery} entities`);
|
|
10918
|
-
|
|
10919
|
+
C.push(ye("id", "in", O));
|
|
10919
10920
|
}
|
|
10920
10921
|
}
|
|
10921
10922
|
}), S.filter((w) => w.parentFilter.type === "Individual").forEach((w) => {
|
|
10922
10923
|
const { parentFilter: O, parentRestriction: x } = w;
|
|
10923
10924
|
if ("collectionField" in O) {
|
|
10924
|
-
const
|
|
10925
|
-
if ("collection" in
|
|
10926
|
-
const
|
|
10927
|
-
if (!
|
|
10925
|
+
const P = re(u, O.collectionField);
|
|
10926
|
+
if ("collection" in P) {
|
|
10927
|
+
const M = a.collections?.[P.collection];
|
|
10928
|
+
if (!M)
|
|
10928
10929
|
throw new Error("PERMISSION_DENIED");
|
|
10929
|
-
const q =
|
|
10930
|
+
const q = M?.individualEntities, z = [];
|
|
10930
10931
|
if (q) {
|
|
10931
|
-
const ee = x.singleQuery ? x.singleQuery :
|
|
10932
|
+
const ee = x.singleQuery ? x.singleQuery : v;
|
|
10932
10933
|
for (let oe = 0; oe < q.length; oe += ee) {
|
|
10933
|
-
const
|
|
10934
|
-
z.push(
|
|
10934
|
+
const D = q.slice(oe, oe + ee);
|
|
10935
|
+
z.push(D);
|
|
10935
10936
|
}
|
|
10936
10937
|
if (!x.singleQuery)
|
|
10937
10938
|
z.forEach((oe) => {
|
|
10938
|
-
|
|
10939
|
+
g.push(...A(C.concat(ye(`${P.name}_Array`, "array-contains-any", oe))));
|
|
10939
10940
|
});
|
|
10940
10941
|
else {
|
|
10941
10942
|
if (q.length > ee)
|
|
10942
10943
|
throw new Error(`INPUT_ERROR: Individual entity parentFilter with singleQuery set to true must not have more than ${x.singleQuery} entities`);
|
|
10943
|
-
|
|
10944
|
+
C.push(ye(`${P.name}_Array`, "array-contains-any", q));
|
|
10944
10945
|
}
|
|
10945
10946
|
}
|
|
10946
10947
|
}
|
|
10947
10948
|
}
|
|
10948
10949
|
});
|
|
10949
10950
|
const k = [];
|
|
10950
|
-
|
|
10951
|
+
_.filter((w) => w.type === "Parent").forEach((w) => {
|
|
10951
10952
|
if ("collectionField" in w) {
|
|
10952
10953
|
const O = re(u, w.collectionField);
|
|
10953
10954
|
if ("collection" in O) {
|
|
10954
|
-
const x =
|
|
10955
|
+
const x = d?.parentEntities, P = [];
|
|
10955
10956
|
if (x) {
|
|
10956
|
-
const
|
|
10957
|
-
for (let q = 0; q < x.length; q +=
|
|
10958
|
-
const z = x.slice(q, q +
|
|
10959
|
-
|
|
10957
|
+
const M = w.singleQuery ? w.singleQuery : v;
|
|
10958
|
+
for (let q = 0; q < x.length; q += M) {
|
|
10959
|
+
const z = x.slice(q, q + M);
|
|
10960
|
+
P.push(z);
|
|
10960
10961
|
}
|
|
10961
10962
|
if (!w.singleQuery)
|
|
10962
|
-
|
|
10963
|
-
k.push(...
|
|
10963
|
+
P.forEach((q) => {
|
|
10964
|
+
k.push(...A(C.concat(ye(`${O.name}_Array`, "array-contains-any", q))));
|
|
10964
10965
|
});
|
|
10965
10966
|
else {
|
|
10966
|
-
if (x && x.length >
|
|
10967
|
+
if (x && x.length > M)
|
|
10967
10968
|
throw new Error(`INPUT_ERROR: Parent entity restriction with singleQuery set to true must not have more than ${w.singleQuery} entities`);
|
|
10968
|
-
|
|
10969
|
+
C.push(ye(`${O.name}_Array`, "array-contains-any", x));
|
|
10969
10970
|
}
|
|
10970
10971
|
}
|
|
10971
10972
|
}
|
|
@@ -10973,48 +10974,48 @@ const we = /* @__PURE__ */ In(iw), Nt = (r) => {
|
|
|
10973
10974
|
}), S.filter((w) => w.parentFilter.type === "Parent").forEach((w) => {
|
|
10974
10975
|
const { parentFilter: O, parentRestriction: x } = w;
|
|
10975
10976
|
if ("collectionField" in O && "parentCollectionField" in O) {
|
|
10976
|
-
const
|
|
10977
|
-
if ("collection" in
|
|
10978
|
-
const q = a.collections?.[
|
|
10977
|
+
const P = re(u, O.collectionField), M = re(u, O.parentCollectionField);
|
|
10978
|
+
if ("collection" in P && "collection" in M) {
|
|
10979
|
+
const q = a.collections?.[P.collection];
|
|
10979
10980
|
if (!q)
|
|
10980
10981
|
throw new Error("PERMISSION_DENIED");
|
|
10981
10982
|
const z = q.parentEntities, ee = [];
|
|
10982
10983
|
if (z) {
|
|
10983
|
-
const oe = x.singleQuery ? x.singleQuery :
|
|
10984
|
-
for (let
|
|
10985
|
-
const te = z.slice(
|
|
10984
|
+
const oe = x.singleQuery ? x.singleQuery : v;
|
|
10985
|
+
for (let D = 0; D < z.length; D += oe) {
|
|
10986
|
+
const te = z.slice(D, D + oe);
|
|
10986
10987
|
ee.push(te);
|
|
10987
10988
|
}
|
|
10988
10989
|
if (!x.singleQuery)
|
|
10989
|
-
ee.forEach((
|
|
10990
|
-
k.push(...
|
|
10990
|
+
ee.forEach((D) => {
|
|
10991
|
+
k.push(...A(C.concat(ye(`${M.name}_Array`, "array-contains-any", D))));
|
|
10991
10992
|
});
|
|
10992
10993
|
else {
|
|
10993
10994
|
if (z && z.length > oe)
|
|
10994
10995
|
throw new Error(`INPUT_ERROR: Parent entity parentFilter with singleQuery set to true must not have more than ${x.singleQuery} entities`);
|
|
10995
|
-
|
|
10996
|
+
C.push(ye(`${M.name}_Array`, "array-contains-any", z));
|
|
10996
10997
|
}
|
|
10997
10998
|
}
|
|
10998
10999
|
}
|
|
10999
11000
|
}
|
|
11000
11001
|
});
|
|
11001
11002
|
const I = [];
|
|
11002
|
-
k.length === 0 && (
|
|
11003
|
+
k.length === 0 && (_.filter((w) => w.type === "Parent_Property").forEach((w) => {
|
|
11003
11004
|
if ("collectionField" in w && "propertyField" in w) {
|
|
11004
11005
|
const O = re(u, w.collectionField), x = re(u, w.propertyField);
|
|
11005
11006
|
if ("collection" in O) {
|
|
11006
|
-
const
|
|
11007
|
-
Object.entries(
|
|
11007
|
+
const P = d?.parentPropertyEntities || {};
|
|
11008
|
+
Object.entries(P).forEach(([M, q]) => {
|
|
11008
11009
|
if (q.length > 0) {
|
|
11009
11010
|
const z = [];
|
|
11010
|
-
for (let ee = 0; ee < q.length; ee +=
|
|
11011
|
-
const oe = q.slice(ee, ee +
|
|
11011
|
+
for (let ee = 0; ee < q.length; ee += v) {
|
|
11012
|
+
const oe = q.slice(ee, ee + v);
|
|
11012
11013
|
z.push(oe);
|
|
11013
11014
|
}
|
|
11014
11015
|
z.forEach((ee) => {
|
|
11015
|
-
I.push(...
|
|
11016
|
+
I.push(...A(C.concat([
|
|
11016
11017
|
ye(`${O.name}_Array`, "array-contains-any", ee),
|
|
11017
|
-
ye(x.name, "==",
|
|
11018
|
+
ye(x.name, "==", M)
|
|
11018
11019
|
])));
|
|
11019
11020
|
});
|
|
11020
11021
|
}
|
|
@@ -11024,23 +11025,23 @@ const we = /* @__PURE__ */ In(iw), Nt = (r) => {
|
|
|
11024
11025
|
}), S.filter((w) => w.parentFilter.type === "Parent_Property").forEach((w) => {
|
|
11025
11026
|
const { parentFilter: O } = w;
|
|
11026
11027
|
if ("collectionField" in O && "parentCollectionField" in O && "parentPropertyField" in O) {
|
|
11027
|
-
const x = re(u, O.collectionField),
|
|
11028
|
-
if ("collection" in x && "collection" in
|
|
11028
|
+
const x = re(u, O.collectionField), P = re(u, O.parentCollectionField), M = re(u, O.parentPropertyField);
|
|
11029
|
+
if ("collection" in x && "collection" in P) {
|
|
11029
11030
|
const q = a.collections?.[x.collection];
|
|
11030
11031
|
if (!q)
|
|
11031
11032
|
throw new Error("PERMISSION_DENIED");
|
|
11032
11033
|
const z = q.parentPropertyEntities || {};
|
|
11033
11034
|
Object.entries(z).forEach(([ee, oe]) => {
|
|
11034
11035
|
if (oe.length > 0) {
|
|
11035
|
-
const
|
|
11036
|
-
for (let te = 0; te < oe.length; te +=
|
|
11037
|
-
const ne = oe.slice(te, te +
|
|
11038
|
-
|
|
11036
|
+
const D = [];
|
|
11037
|
+
for (let te = 0; te < oe.length; te += v) {
|
|
11038
|
+
const ne = oe.slice(te, te + v);
|
|
11039
|
+
D.push(ne);
|
|
11039
11040
|
}
|
|
11040
|
-
|
|
11041
|
-
I.push(...
|
|
11042
|
-
ye(`${
|
|
11043
|
-
ye(
|
|
11041
|
+
D.forEach((te) => {
|
|
11042
|
+
I.push(...A(C.concat([
|
|
11043
|
+
ye(`${P.name}_Array`, "array-contains-any", te),
|
|
11044
|
+
ye(M.name, "==", ee)
|
|
11044
11045
|
])));
|
|
11045
11046
|
});
|
|
11046
11047
|
}
|
|
@@ -11048,140 +11049,143 @@ const we = /* @__PURE__ */ In(iw), Nt = (r) => {
|
|
|
11048
11049
|
}
|
|
11049
11050
|
}
|
|
11050
11051
|
}));
|
|
11051
|
-
const b = [...
|
|
11052
|
-
return !
|
|
11053
|
-
}, fm = {},
|
|
11054
|
-
for (const s of Object.keys(
|
|
11055
|
-
delete
|
|
11052
|
+
const b = [...g, ...k, ...I];
|
|
11053
|
+
return !_.length && !S.length ? A(C) : b;
|
|
11054
|
+
}, fm = {}, xr = {}, Zw = async (r) => {
|
|
11055
|
+
for (const s of Object.keys(xr))
|
|
11056
|
+
delete xr[s];
|
|
11056
11057
|
for (const s of Object.keys(r || {}))
|
|
11057
|
-
|
|
11058
|
+
xr[s] = [], delete fm[s];
|
|
11058
11059
|
const e = await Ie(), t = await ie(e, ["global", "preload", "sync"]), n = await ie(e, ["global", "preload", "async"]);
|
|
11059
11060
|
if (n)
|
|
11060
11061
|
for (const s of n)
|
|
11061
|
-
r?.[s] &&
|
|
11062
|
+
r?.[s] && sr(s, r?.[s].constraints, r?.[s].range, r?.[s].orQueries, r);
|
|
11062
11063
|
if (t)
|
|
11063
11064
|
for (const s of t)
|
|
11064
|
-
r?.[s] && await
|
|
11065
|
+
r?.[s] && await sr(s, r?.[s].constraints, r?.[s].range, r?.[s].orQueries, r);
|
|
11065
11066
|
for (const s of Object.keys(r || {}))
|
|
11066
|
-
n.includes(s) || t.includes(s) || await
|
|
11067
|
-
return
|
|
11068
|
-
}, To = () => fm, lw = () =>
|
|
11069
|
-
const { labels:
|
|
11070
|
-
if (!
|
|
11067
|
+
n.includes(s) || t.includes(s) || await sr(s, r?.[s].constraints, r?.[s].range, r?.[s].orQueries, r);
|
|
11068
|
+
return xr;
|
|
11069
|
+
}, To = () => fm, lw = () => xr, uw = async (r, e, t, n, s) => {
|
|
11070
|
+
const { labels: i, preloadCache: a } = r, c = Jr()[i.collection], l = Ie(), u = lt(i.collection), f = De();
|
|
11071
|
+
if (!f?.Role)
|
|
11071
11072
|
throw new Error("PERMISSION_DENIED");
|
|
11072
|
-
if (!
|
|
11073
|
+
if (!a?.roles.includes(f.Role))
|
|
11073
11074
|
return;
|
|
11074
|
-
const
|
|
11075
|
-
|
|
11075
|
+
const h = lw();
|
|
11076
|
+
let d = i.collection;
|
|
11077
|
+
s && (d = s, h[d] ||= []), h[d] && h[d].forEach((y) => y()), await ie(l, ["global", "timezone"]), e ||= await ie(u, [
|
|
11076
11078
|
"collections",
|
|
11077
|
-
|
|
11079
|
+
i.collection,
|
|
11078
11080
|
"custom",
|
|
11079
11081
|
"preloadCacheConstraints"
|
|
11080
|
-
]), n ||= await ie(
|
|
11082
|
+
]), n ||= await ie(u, [
|
|
11081
11083
|
"collections",
|
|
11082
|
-
|
|
11084
|
+
i.collection,
|
|
11083
11085
|
"custom",
|
|
11084
11086
|
"preloadCacheOrQueries"
|
|
11085
|
-
]), t ||=
|
|
11086
|
-
const
|
|
11087
|
+
]), s || (t ||= a.range);
|
|
11088
|
+
const p = oc([i.collection], c, !!s).map((y) => {
|
|
11087
11089
|
if (t) {
|
|
11088
|
-
const { start:
|
|
11089
|
-
|
|
11090
|
-
}
|
|
11091
|
-
return n && (
|
|
11092
|
-
}),
|
|
11093
|
-
return new Promise((
|
|
11094
|
-
if (
|
|
11095
|
-
|
|
11090
|
+
const { start: _, end: S } = aw(t), A = t.fields.filter((m) => !t.ranges?.some((T) => T.includes(m))).map((m) => Xr(ye(m, ">=", _), ye(m, "<=", S))), F = t.ranges?.map((m) => Xr(ye(m[0], "<=", S), ye(m[1], ">=", _)));
|
|
11091
|
+
y = he(y, Rc(...A, ...F || []));
|
|
11092
|
+
}
|
|
11093
|
+
return n && (y = he(y, Xr(Rc(...n.map((_) => ye(..._)))))), e && (y = he(y, Xr(...e.map((_) => ye(..._))))), y;
|
|
11094
|
+
}), E = /* @__PURE__ */ new Map();
|
|
11095
|
+
return new Promise((y, _) => {
|
|
11096
|
+
if (p.length === 0) {
|
|
11097
|
+
y({});
|
|
11096
11098
|
return;
|
|
11097
11099
|
}
|
|
11098
|
-
|
|
11099
|
-
let
|
|
11100
|
-
const
|
|
11101
|
-
(!
|
|
11102
|
-
}, (
|
|
11103
|
-
console.error(
|
|
11100
|
+
p.forEach((S) => {
|
|
11101
|
+
let A = !1;
|
|
11102
|
+
const F = hr(S, { includeMetadataChanges: !0 }, (m) => {
|
|
11103
|
+
(!m.metadata.fromCache || A) && (A || (A = !0, E.set(S, !0), E.size === p.length && y({})));
|
|
11104
|
+
}, (m) => {
|
|
11105
|
+
console.error(`${d} - ${m.message}`), _(m);
|
|
11104
11106
|
});
|
|
11105
|
-
|
|
11107
|
+
h[d].push(F);
|
|
11106
11108
|
});
|
|
11107
11109
|
});
|
|
11108
|
-
},
|
|
11109
|
-
const
|
|
11110
|
-
if (!
|
|
11110
|
+
}, sr = async (r, e, t, n, s, i) => {
|
|
11111
|
+
const a = Ve(), o = De();
|
|
11112
|
+
if (!o?.Role)
|
|
11111
11113
|
throw new Error("PERMISSION_DENIED");
|
|
11112
|
-
const
|
|
11113
|
-
|
|
11114
|
+
const c = a.collections[r], { labels: l, preloadCache: u } = c, f = To();
|
|
11115
|
+
let h = l.collection;
|
|
11116
|
+
if (i && (h = i), f[h] === "Loading" || !u?.roles.includes(o.Role))
|
|
11114
11117
|
return;
|
|
11115
|
-
const
|
|
11116
|
-
if (!(
|
|
11117
|
-
|
|
11118
|
+
const d = o.collections?.[r];
|
|
11119
|
+
if (!(d && vt("Read", d) || kn(c, a, o).length > 0)) {
|
|
11120
|
+
f[h] = "Error";
|
|
11118
11121
|
return;
|
|
11119
11122
|
}
|
|
11120
|
-
|
|
11121
|
-
const
|
|
11122
|
-
document.dispatchEvent(
|
|
11123
|
+
f[h] = "Loading";
|
|
11124
|
+
const p = new Event(`stoker:loading:${r}`);
|
|
11125
|
+
document.dispatchEvent(p);
|
|
11123
11126
|
try {
|
|
11124
|
-
if (await uw(
|
|
11125
|
-
const
|
|
11126
|
-
for (const
|
|
11127
|
-
if (!s?.[
|
|
11128
|
-
if (!
|
|
11127
|
+
if (await uw(c, e, t, n, i), u?.relationCollections && !i && await ve(u.relationCollections)) {
|
|
11128
|
+
const _ = jt(c, a, o);
|
|
11129
|
+
for (const S of _)
|
|
11130
|
+
if (!s?.[S]) {
|
|
11131
|
+
if (!a.collections[S].preloadCache?.roles.includes(o.Role))
|
|
11129
11132
|
continue;
|
|
11130
|
-
const
|
|
11131
|
-
if (
|
|
11133
|
+
const F = To()[S];
|
|
11134
|
+
if (F === "Loading" || F === "Loaded" || F === "Error")
|
|
11132
11135
|
continue;
|
|
11133
|
-
|
|
11136
|
+
F || await sr(S, void 0, void 0, void 0, s);
|
|
11134
11137
|
}
|
|
11135
11138
|
}
|
|
11136
|
-
|
|
11137
|
-
const
|
|
11138
|
-
document.dispatchEvent(
|
|
11139
|
-
} catch (
|
|
11140
|
-
throw
|
|
11139
|
+
f[h] = "Loaded";
|
|
11140
|
+
const E = new Event(`stoker:loaded:${r}`);
|
|
11141
|
+
document.dispatchEvent(E);
|
|
11142
|
+
} catch (E) {
|
|
11143
|
+
throw f[h] = "Error", E;
|
|
11141
11144
|
}
|
|
11142
11145
|
};
|
|
11143
11146
|
let $t = null;
|
|
11144
11147
|
const fw = async (r, e) => {
|
|
11145
|
-
const t = [], n = Mt(), s =
|
|
11148
|
+
const t = [], n = Mt(), s = We(), i = Ie(), a = Ve();
|
|
11146
11149
|
if (!e.claims.doc)
|
|
11147
11150
|
throw new Error("User document ID not found in claims");
|
|
11148
|
-
let
|
|
11149
|
-
return await new Promise((
|
|
11150
|
-
const
|
|
11151
|
+
let o = !1, c = null;
|
|
11152
|
+
return await new Promise((u, f) => {
|
|
11153
|
+
const h = hr(ke(s, "tenants", n, "system_user_permissions", r.uid), (d) => {
|
|
11151
11154
|
if (d.exists()) {
|
|
11152
11155
|
if ($t = d.data(), $t.User_ID = d.id, !$t.Role)
|
|
11153
11156
|
throw new Error("PERMISSION_DENIED");
|
|
11154
|
-
if (!
|
|
11155
|
-
|
|
11157
|
+
if (!o)
|
|
11158
|
+
o = !0, u();
|
|
11156
11159
|
else {
|
|
11157
|
-
const
|
|
11158
|
-
if (document.dispatchEvent(
|
|
11160
|
+
const p = new Event("stoker:permissionsChange");
|
|
11161
|
+
if (document.dispatchEvent(p), i.auth.signOutOnPermissionsChange)
|
|
11159
11162
|
Em();
|
|
11160
11163
|
else {
|
|
11161
|
-
const
|
|
11162
|
-
if (
|
|
11163
|
-
for (const [
|
|
11164
|
-
|
|
11165
|
-
|
|
11166
|
-
!
|
|
11164
|
+
const E = $t.collections;
|
|
11165
|
+
if (E)
|
|
11166
|
+
for (const [y, _] of Object.entries(E))
|
|
11167
|
+
// eslint-disable-next-line security/detect-object-injection
|
|
11168
|
+
a.collections[y] && c && // eslint-disable-next-line security/detect-object-injection
|
|
11169
|
+
(!c.collections?.[y] || // eslint-disable-next-line security/detect-object-injection
|
|
11170
|
+
!_y(_, c.collections[y])) && sr(y);
|
|
11167
11171
|
}
|
|
11168
11172
|
}
|
|
11169
|
-
|
|
11173
|
+
c = $t;
|
|
11170
11174
|
} else
|
|
11171
|
-
|
|
11175
|
+
f(new Error("Permissions not found"));
|
|
11172
11176
|
}, (d) => {
|
|
11173
|
-
|
|
11177
|
+
f(new Error(`Error getting permissions for user ${r.uid}`, { cause: d }));
|
|
11174
11178
|
});
|
|
11175
|
-
t.push(
|
|
11179
|
+
t.push(h);
|
|
11176
11180
|
}), t;
|
|
11177
11181
|
}, De = () => $t, dw = () => {
|
|
11178
11182
|
$t = null;
|
|
11179
11183
|
}, cc = (r) => {
|
|
11180
11184
|
if (typeof r == "object")
|
|
11181
11185
|
for (const e in r)
|
|
11182
|
-
Object.prototype.hasOwnProperty.call(r, e) && (
|
|
11183
|
-
},
|
|
11184
|
-
const l = Mt(), { labels: u } = i, f = Ie(),
|
|
11186
|
+
Object.prototype.hasOwnProperty.call(r, e) && (ir(r[e]) ? r[e] = "_DELETE_FIELD" : cc(r[e]));
|
|
11187
|
+
}, Ye = async (r, e, t, n, s, i, a, o, c) => {
|
|
11188
|
+
const l = Mt(), { labels: u } = i, f = Ie(), h = gc(), d = await ie(f, ["global", "firebase", "writeLogTTL"]), p = {
|
|
11185
11189
|
operation: r,
|
|
11186
11190
|
collection: u.collection,
|
|
11187
11191
|
docId: s,
|
|
@@ -11195,49 +11199,49 @@ const fw = async (r, e) => {
|
|
|
11195
11199
|
Last_Write_Version: t.Last_Write_Version,
|
|
11196
11200
|
data: {}
|
|
11197
11201
|
};
|
|
11198
|
-
if (
|
|
11199
|
-
const S = /* @__PURE__ */ new Date(),
|
|
11200
|
-
|
|
11202
|
+
if (d) {
|
|
11203
|
+
const S = /* @__PURE__ */ new Date(), A = new Date((/* @__PURE__ */ new Date()).setDate(S.getDate() + d));
|
|
11204
|
+
p.TTL = Bt.fromDate(A);
|
|
11201
11205
|
}
|
|
11202
11206
|
const E = we(t);
|
|
11203
|
-
r !== "delete" && (
|
|
11204
|
-
const
|
|
11205
|
-
Gm(
|
|
11207
|
+
r !== "delete" && (p.data.data = E, e === "written" && cc(p.data.data)), r !== "delete" && e !== "written" && tr(E), r === "update" && (p.data.originalRecord = we(c)), r !== "delete" && ["started", "written"].includes(e) && (delete p.data.data.Saved_At, delete p.data.data.Last_Save_At), e === "failed" && (p.data.error = JSON.stringify(o));
|
|
11208
|
+
const y = t.Last_Write_At, _ = ke(h, "tenants", l, n.join("/"), s, "system_write_log", `${a}-${y.valueOf()}`);
|
|
11209
|
+
Gm(_, p).catch((S) => {
|
|
11206
11210
|
console.error(`Error saving "${e}" ${r} log entry for record ${s} in ${u.collection} collection.`, { cause: S });
|
|
11207
11211
|
});
|
|
11208
11212
|
}, lc = async (r, e, t, n, s) => {
|
|
11209
|
-
const i = Mt(), a =
|
|
11213
|
+
const i = Mt(), a = We(), o = n.labels.collection, c = n.fields.filter((u) => "unique" in u && u.unique), l = [];
|
|
11210
11214
|
if (!s.Role)
|
|
11211
11215
|
throw new Error("No role found in permissions");
|
|
11212
11216
|
if (await Promise.all(c.map(async (u) => {
|
|
11213
11217
|
if (!u.access || u.access.includes(s.Role)) {
|
|
11214
|
-
if (t[u.name] === void 0 ||
|
|
11218
|
+
if (t[u.name] === void 0 || ir(t[u.name]))
|
|
11215
11219
|
return;
|
|
11216
11220
|
const f = t[u.name].toString().toLowerCase().replace(/\s/g, "---").replaceAll("/", "|||");
|
|
11217
11221
|
if (!ow(f))
|
|
11218
11222
|
l.push(`${u.name} "${t[u.name]}" is invalid`);
|
|
11219
11223
|
else {
|
|
11220
|
-
const
|
|
11224
|
+
const h = await bd(ke(a, "tenants", i, "system_unique", o, `Unique-${o}-${u.name}`, f)).catch(() => {
|
|
11221
11225
|
});
|
|
11222
|
-
|
|
11226
|
+
h?.exists() && !(r === "update" && h.data().id === e) && l.push(`${u.name} "${t[u.name]}" already exists`);
|
|
11223
11227
|
}
|
|
11224
11228
|
}
|
|
11225
11229
|
})), l.length > 0)
|
|
11226
11230
|
throw new Error(l.join(", "));
|
|
11227
11231
|
}, dm = (r, e, t) => {
|
|
11228
|
-
const n =
|
|
11232
|
+
const n = We(), s = Mt(), i = Ve(), a = De(), o = r.at(-1);
|
|
11229
11233
|
if (!o)
|
|
11230
11234
|
throw new Error("EMPTY_PATH");
|
|
11231
11235
|
const c = i.collections[o], { labels: l } = c, u = a.collections?.[l.collection];
|
|
11232
11236
|
if (!a.Role)
|
|
11233
11237
|
throw new Error("PERMISSION_DENIED");
|
|
11234
|
-
const f = u && vt("Read", u),
|
|
11238
|
+
const f = u && vt("Read", u), h = kn(c, i, a), d = [];
|
|
11235
11239
|
if (f)
|
|
11236
|
-
|
|
11237
|
-
else if (
|
|
11238
|
-
for (const
|
|
11239
|
-
|
|
11240
|
-
return
|
|
11240
|
+
d.push(ke(n, "tenants", s, "system_fields", l.collection, `${l.collection}-${t.key}`, e));
|
|
11241
|
+
else if (h)
|
|
11242
|
+
for (const p of h)
|
|
11243
|
+
d.push(ke(n, "tenants", s, "system_fields", l.collection, `${l.collection}-${p.field}`, e));
|
|
11244
|
+
return d;
|
|
11241
11245
|
}, yd = (r) => r !== null && typeof r == "object" && !Array.isArray(r), hm = (r) => {
|
|
11242
11246
|
const e = (t) => {
|
|
11243
11247
|
Object.entries(t).forEach(([n, s]) => {
|
|
@@ -11246,7 +11250,7 @@ const fw = async (r, e) => {
|
|
|
11246
11250
|
};
|
|
11247
11251
|
e(r);
|
|
11248
11252
|
}, hw = async (r, e, t) => {
|
|
11249
|
-
const n = it(), s =
|
|
11253
|
+
const n = it(), s = ze(), i = Ue(n, s.STOKER_FB_FUNCTIONS_REGION), a = e?.map((u) => u[2] instanceof Date ? [u[0], u[1], u[2].toISOString()] : u), o = Je(i, "stoker-readapi");
|
|
11250
11254
|
let c;
|
|
11251
11255
|
if (!t?.pagination)
|
|
11252
11256
|
c = await o({
|
|
@@ -11262,8 +11266,8 @@ const fw = async (r, e) => {
|
|
|
11262
11266
|
options: t,
|
|
11263
11267
|
stream: !0
|
|
11264
11268
|
});
|
|
11265
|
-
for await (const
|
|
11266
|
-
console.log(
|
|
11269
|
+
for await (const h of u)
|
|
11270
|
+
console.log(h.data.result.docs.length);
|
|
11267
11271
|
c = { data: await f };
|
|
11268
11272
|
}
|
|
11269
11273
|
const l = c.data;
|
|
@@ -11274,25 +11278,25 @@ const fw = async (r, e) => {
|
|
|
11274
11278
|
const o = De();
|
|
11275
11279
|
if (!o)
|
|
11276
11280
|
throw new Error("PERMISSIONS_NOT_FOUND");
|
|
11277
|
-
const c = e.at(-2), l = Ad(n.collections[c], n, o).map((
|
|
11278
|
-
t.collections ? t.collections.forEach((
|
|
11279
|
-
if (!l.includes(
|
|
11280
|
-
throw new Error(`SCHEMA_ERROR: Collection ${
|
|
11281
|
+
const c = e.at(-2), l = Ad(n.collections[c], n, o).map((h) => h.labels.collection);
|
|
11282
|
+
t.collections ? t.collections.forEach((h) => {
|
|
11283
|
+
if (!l.includes(h))
|
|
11284
|
+
throw new Error(`SCHEMA_ERROR: Collection ${h} not found in subcollections of ${c}`);
|
|
11281
11285
|
}) : t.collections = l;
|
|
11282
|
-
const u = t.depth - 1, f = t.collections.map(async (
|
|
11283
|
-
const
|
|
11286
|
+
const u = t.depth - 1, f = t.collections.map(async (h) => {
|
|
11287
|
+
const d = await pm([...e, h], t.constraints || [], {
|
|
11284
11288
|
only: i,
|
|
11285
11289
|
pagination: t.limit,
|
|
11286
11290
|
noEmbeddingFields: a
|
|
11287
|
-
}).catch((
|
|
11288
|
-
throw
|
|
11291
|
+
}).catch((p) => {
|
|
11292
|
+
throw p.code === "permission-denied" && console.info(`PERMISSION_DENIED for subcollection ${h} for document at ${e.join("/")}`), p;
|
|
11289
11293
|
});
|
|
11290
|
-
r[
|
|
11294
|
+
r[h] = d.docs, s && await Promise.all(
|
|
11291
11295
|
// eslint-disable-next-line security/detect-object-injection
|
|
11292
|
-
r[
|
|
11296
|
+
r[h].map((p) => uc(p, [...e, h, p.id], s, n, i, a))
|
|
11293
11297
|
), u > 0 && await Promise.all(
|
|
11294
11298
|
// eslint-disable-next-line security/detect-object-injection
|
|
11295
|
-
r[
|
|
11299
|
+
r[h].map((p) => mm(p, [...e, h, p.id], { depth: u }, n, s, i, a))
|
|
11296
11300
|
);
|
|
11297
11301
|
});
|
|
11298
11302
|
await Promise.all(f);
|
|
@@ -11307,24 +11311,24 @@ const fw = async (r, e) => {
|
|
|
11307
11311
|
const f = r[u.name];
|
|
11308
11312
|
if (!f)
|
|
11309
11313
|
continue;
|
|
11310
|
-
const
|
|
11311
|
-
for (const
|
|
11312
|
-
const
|
|
11313
|
-
if (f[
|
|
11314
|
+
const h = Object.keys(f);
|
|
11315
|
+
for (const d of h) {
|
|
11316
|
+
const p = f[d], E = vr(p.Collection_Path, d, { only: s, noEmbeddingFields: i }).then((y) => {
|
|
11317
|
+
if (f[d] = y, c > 0)
|
|
11314
11318
|
return uc(
|
|
11315
11319
|
// eslint-disable-next-line security/detect-object-injection
|
|
11316
|
-
f[
|
|
11317
|
-
[...
|
|
11320
|
+
f[d],
|
|
11321
|
+
[...p.Collection_Path, d],
|
|
11318
11322
|
{ depth: c },
|
|
11319
11323
|
n,
|
|
11320
11324
|
s,
|
|
11321
11325
|
i
|
|
11322
11326
|
);
|
|
11323
|
-
}).catch((
|
|
11324
|
-
if (
|
|
11325
|
-
delete f[
|
|
11327
|
+
}).catch((y) => {
|
|
11328
|
+
if (y.message.includes("NOT_FOUND") || y.code === "permission-denied")
|
|
11329
|
+
delete f[d];
|
|
11326
11330
|
else
|
|
11327
|
-
throw
|
|
11331
|
+
throw y;
|
|
11328
11332
|
});
|
|
11329
11333
|
l.push(E);
|
|
11330
11334
|
}
|
|
@@ -11343,54 +11347,54 @@ const fw = async (r, e) => {
|
|
|
11343
11347
|
const n = r.at(-1);
|
|
11344
11348
|
if (!n)
|
|
11345
11349
|
throw new Error("EMPTY_PATH");
|
|
11346
|
-
const s =
|
|
11347
|
-
if (!
|
|
11350
|
+
const s = Ve(!0), a = Jr()[n], o = s.collections[n], { labels: c, access: l, preloadCache: u } = o, { serverReadOnly: f } = l, h = Ie(), d = Object.keys(s.collections).includes(n), p = h.disabledCollections?.includes(n);
|
|
11351
|
+
if (!d || p)
|
|
11348
11352
|
throw new Error("COLLECTION_NOT_FOUND");
|
|
11349
|
-
const E = await lt(c.collection),
|
|
11353
|
+
const E = await lt(c.collection), y = await ie(h, [
|
|
11350
11354
|
"global",
|
|
11351
11355
|
"firebase",
|
|
11352
11356
|
"serverTimestampOptions"
|
|
11353
|
-
]),
|
|
11354
|
-
if (!
|
|
11357
|
+
]), _ = De();
|
|
11358
|
+
if (!_?.Role)
|
|
11355
11359
|
throw new Error("PERMISSIONS_DENIED");
|
|
11356
|
-
if (f?.includes(
|
|
11360
|
+
if (f?.includes(_.Role))
|
|
11357
11361
|
return await hw(r, e, t);
|
|
11358
|
-
const S = oc(r, a
|
|
11362
|
+
const S = oc(r, a);
|
|
11359
11363
|
if (S.length === 0)
|
|
11360
11364
|
return { cursor: {}, pages: 0, docs: [] };
|
|
11361
|
-
let
|
|
11362
|
-
const
|
|
11365
|
+
let A = S.map((b) => he(b, ...e || []));
|
|
11366
|
+
const F = t?.pagination?.startAfter || t?.pagination?.endBefore || {
|
|
11363
11367
|
first: /* @__PURE__ */ new Map(),
|
|
11364
11368
|
last: /* @__PURE__ */ new Map()
|
|
11365
11369
|
};
|
|
11366
11370
|
if (t?.pagination) {
|
|
11367
11371
|
if (t.pagination.startAfter && t.pagination.endBefore)
|
|
11368
11372
|
throw new Error("INPUT_ERROR: startAfter and endBefore cannot be provided together");
|
|
11369
|
-
const b = t.pagination.startAfter || t.pagination.endBefore, w = Ud(
|
|
11373
|
+
const b = t.pagination.startAfter || t.pagination.endBefore, w = Ud(_.Role, o, s);
|
|
11370
11374
|
if (b && w !== !0)
|
|
11371
11375
|
throw new Error("INPUT_ERROR: Pagination is not allowed when using " + w);
|
|
11372
|
-
t.pagination.orderByField && t.pagination.orderByDirection ? t.pagination.startAfter || t.pagination.endBefore ? t.pagination.startAfter ?
|
|
11376
|
+
t.pagination.orderByField && t.pagination.orderByDirection ? t.pagination.startAfter || t.pagination.endBefore ? t.pagination.startAfter ? A = A.map((O, x) => he(O, rt(t.pagination.orderByField, t.pagination.orderByDirection), eo(F.last.get(x)), Xt(t.pagination.number))) : A = A.map((O, x) => he(O, rt(t.pagination.orderByField, t.pagination.orderByDirection), to(F.first.get(x)), Fr(t.pagination.number))) : A = A.map((O) => he(O, rt(t.pagination.orderByField, t.pagination.orderByDirection), Xt(t.pagination.number))) : !t.pagination.startAfter && !t.pagination.endBefore ? A = A.map((O) => he(O, Xt(t.pagination.number))) : t.pagination.startAfter ? A = A.map((O, x) => he(O, eo(F.last.get(x)), Xt(t.pagination.number))) : A = A.map((O, x) => he(O, to(F.first.get(x)), Fr(t.pagination.number)));
|
|
11373
11377
|
}
|
|
11374
|
-
const
|
|
11375
|
-
await ce("preOperation",
|
|
11376
|
-
const
|
|
11378
|
+
const m = { collection: c.collection };
|
|
11379
|
+
await ce("preOperation", h, E, ["read", void 0, void 0, m]), await ce("preRead", h, E, [m, A, !0, !1]);
|
|
11380
|
+
const v = /* @__PURE__ */ new Map(), C = A.map(async (b) => {
|
|
11377
11381
|
let w;
|
|
11378
11382
|
return t?.only === "cache" ? w = await Od(b) : t?.only === "server" ? w = await Hm(b) : w = await Km(b), w;
|
|
11379
|
-
}),
|
|
11380
|
-
for (const b of
|
|
11383
|
+
}), g = await Promise.all(C);
|
|
11384
|
+
for (const b of g) {
|
|
11381
11385
|
for (const w of b.docs) {
|
|
11382
|
-
|
|
11383
|
-
const O = w.data({ serverTimestamps:
|
|
11386
|
+
v.has(w.id) || v.set(w.id, {});
|
|
11387
|
+
const O = w.data({ serverTimestamps: y || "none" }), x = v.get(w.id);
|
|
11384
11388
|
x.id ||= w.id;
|
|
11385
|
-
const
|
|
11386
|
-
delete
|
|
11389
|
+
const P = { ...x, ...O };
|
|
11390
|
+
delete P.Collection_Path_String, v.set(w.id, P);
|
|
11387
11391
|
}
|
|
11388
|
-
|
|
11392
|
+
F.first.set(g.indexOf(b), b.docs[0]), F.last.set(g.indexOf(b), b.docs.at(-1) || b.docs[0]);
|
|
11389
11393
|
}
|
|
11390
11394
|
let k;
|
|
11391
|
-
if (t?.pagination && !u?.roles.includes(
|
|
11392
|
-
let b =
|
|
11393
|
-
t.pagination.orderByField && t.pagination.orderByDirection && (b =
|
|
11395
|
+
if (t?.pagination && !u?.roles.includes(_?.Role) && !f?.includes(_?.Role)) {
|
|
11396
|
+
let b = he(S[0], ...e || []);
|
|
11397
|
+
t.pagination.orderByField && t.pagination.orderByDirection && (b = he(b, rt(t.pagination.orderByField, t.pagination.orderByDirection)));
|
|
11394
11398
|
const w = await Ed(b).catch(() => {
|
|
11395
11399
|
});
|
|
11396
11400
|
if (w) {
|
|
@@ -11400,11 +11404,11 @@ const fw = async (r, e) => {
|
|
|
11400
11404
|
}
|
|
11401
11405
|
let I;
|
|
11402
11406
|
t?.noComputedFields || (I = await ve(E.admin?.retriever));
|
|
11403
|
-
for (const b of
|
|
11407
|
+
for (const b of v.values()) {
|
|
11404
11408
|
const w = [], O = [...b.Collection_Path, b.id];
|
|
11405
11409
|
t?.subcollections && w.push(mm(
|
|
11406
11410
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
11407
|
-
|
|
11411
|
+
v.get(b.id),
|
|
11408
11412
|
O,
|
|
11409
11413
|
we(t.subcollections),
|
|
11410
11414
|
s,
|
|
@@ -11421,7 +11425,7 @@ const fw = async (r, e) => {
|
|
|
11421
11425
|
return q;
|
|
11422
11426
|
})), w.push(uc(
|
|
11423
11427
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
11424
|
-
|
|
11428
|
+
v.get(b.id),
|
|
11425
11429
|
O,
|
|
11426
11430
|
we(t.relations),
|
|
11427
11431
|
s,
|
|
@@ -11434,12 +11438,12 @@ const fw = async (r, e) => {
|
|
|
11434
11438
|
b[q.name] = z;
|
|
11435
11439
|
})), t?.noEmbeddingFields && q.type === "Embedding" && delete b[q.name];
|
|
11436
11440
|
await Promise.all(x);
|
|
11437
|
-
const
|
|
11438
|
-
await ce("postOperation",
|
|
11441
|
+
const P = ["read", b, b.id, m];
|
|
11442
|
+
await ce("postOperation", h, E, P), await ce("postRead", h, E, [m, S, b, !1]);
|
|
11439
11443
|
}
|
|
11440
|
-
return { cursor:
|
|
11444
|
+
return { cursor: F, pages: k, docs: Array.from(v.values()) };
|
|
11441
11445
|
}, mw = async (r, e, t) => {
|
|
11442
|
-
const n = it(), s =
|
|
11446
|
+
const n = it(), s = ze(), i = Ue(n, s.STOKER_FB_FUNCTIONS_REGION), l = (await Je(i, "stoker-readapi")({
|
|
11443
11447
|
path: r,
|
|
11444
11448
|
id: e,
|
|
11445
11449
|
options: t
|
|
@@ -11455,17 +11459,17 @@ const fw = async (r, e) => {
|
|
|
11455
11459
|
throw new Error(`SCHEMA_ERROR: Collection ${f} not found in subcollections of ${o}`);
|
|
11456
11460
|
}) : t.collections = c;
|
|
11457
11461
|
const l = t.depth - 1, u = t.collections.map(async (f) => {
|
|
11458
|
-
const
|
|
11462
|
+
const h = await pm([...e, f], t.constraints || [], {
|
|
11459
11463
|
only: i,
|
|
11460
11464
|
relations: s,
|
|
11461
11465
|
pagination: t.limit
|
|
11462
|
-
}).catch((
|
|
11463
|
-
throw
|
|
11466
|
+
}).catch((d) => {
|
|
11467
|
+
throw d.code === "permission-denied" && console.info(`PERMISSION_DENIED for subcollection ${f} for document at ${e.join("/")}`), d;
|
|
11464
11468
|
});
|
|
11465
|
-
r[f] =
|
|
11469
|
+
r[f] = h.docs, l > 0 && await Promise.all(
|
|
11466
11470
|
// eslint-disable-next-line security/detect-object-injection
|
|
11467
|
-
r[f].map(async (
|
|
11468
|
-
await ym(
|
|
11471
|
+
r[f].map(async (d) => {
|
|
11472
|
+
await ym(d, [...e, f, d.id], { depth: l }, n, s, i);
|
|
11469
11473
|
})
|
|
11470
11474
|
);
|
|
11471
11475
|
});
|
|
@@ -11478,37 +11482,37 @@ const fw = async (r, e) => {
|
|
|
11478
11482
|
const l = t.depth - 1, u = [];
|
|
11479
11483
|
for (const f of t.fields)
|
|
11480
11484
|
if ("collection" in f) {
|
|
11481
|
-
const
|
|
11482
|
-
if (!
|
|
11485
|
+
const h = r[f.name];
|
|
11486
|
+
if (!h)
|
|
11483
11487
|
continue;
|
|
11484
|
-
for (const [
|
|
11485
|
-
const E =
|
|
11488
|
+
for (const [d, p] of Object.entries(h)) {
|
|
11489
|
+
const E = vr(p.Collection_Path, d, {
|
|
11486
11490
|
only: s,
|
|
11487
11491
|
noComputedFields: i,
|
|
11488
11492
|
noEmbeddingFields: a
|
|
11489
|
-
}).then((
|
|
11490
|
-
if (d
|
|
11493
|
+
}).then((y) => {
|
|
11494
|
+
if (h[d] = y, l > 0)
|
|
11491
11495
|
return gm(
|
|
11492
11496
|
// eslint-disable-next-line security/detect-object-injection
|
|
11493
|
-
d
|
|
11494
|
-
[...
|
|
11497
|
+
h[d],
|
|
11498
|
+
[...p.Collection_Path, d],
|
|
11495
11499
|
{ depth: l },
|
|
11496
11500
|
n,
|
|
11497
11501
|
s,
|
|
11498
11502
|
i,
|
|
11499
11503
|
a
|
|
11500
11504
|
);
|
|
11501
|
-
}).catch((
|
|
11502
|
-
if (
|
|
11503
|
-
delete d
|
|
11505
|
+
}).catch((y) => {
|
|
11506
|
+
if (y.message.includes("NOT_FOUND") || y.code === "permission-denied")
|
|
11507
|
+
delete h[d];
|
|
11504
11508
|
else
|
|
11505
|
-
throw
|
|
11509
|
+
throw y;
|
|
11506
11510
|
});
|
|
11507
11511
|
u.push(E);
|
|
11508
11512
|
}
|
|
11509
11513
|
}
|
|
11510
11514
|
await Promise.all(u);
|
|
11511
|
-
},
|
|
11515
|
+
}, vr = async (r, e, t) => {
|
|
11512
11516
|
if (t?.subcollections?.depth && t.subcollections.depth > 10)
|
|
11513
11517
|
throw new Error("INPUT_ERROR: Subcollections depth cannot exceed 10");
|
|
11514
11518
|
if (t?.relations?.depth && t.relations.depth > 10)
|
|
@@ -11516,34 +11520,34 @@ const fw = async (r, e) => {
|
|
|
11516
11520
|
const n = r.at(-1);
|
|
11517
11521
|
if (!n)
|
|
11518
11522
|
throw new Error("EMPTY_PATH");
|
|
11519
|
-
const s =
|
|
11523
|
+
const s = Ve(!0), a = Jr()[n], o = Ie(), c = Object.keys(s.collections).includes(n), l = o.disabledCollections?.includes(n);
|
|
11520
11524
|
if (!c || l)
|
|
11521
11525
|
throw new Error("COLLECTION_NOT_FOUND");
|
|
11522
11526
|
const u = await ie(o, [
|
|
11523
11527
|
"global",
|
|
11524
11528
|
"firebase",
|
|
11525
11529
|
"serverTimestampOptions"
|
|
11526
|
-
]), f = s.collections[n], { labels:
|
|
11527
|
-
if (!
|
|
11530
|
+
]), f = s.collections[n], { labels: h, access: d } = f, { serverReadOnly: p } = d, E = lt(h.collection), y = De();
|
|
11531
|
+
if (!y?.Role)
|
|
11528
11532
|
throw new Error("PERMISSIONS_DENIED");
|
|
11529
|
-
if (
|
|
11533
|
+
if (p?.includes(y.Role))
|
|
11530
11534
|
return await mw(r, e, t);
|
|
11531
|
-
const
|
|
11532
|
-
if (
|
|
11535
|
+
const _ = dm(r, e, a);
|
|
11536
|
+
if (_.length === 0)
|
|
11533
11537
|
throw new Error("PERMISSION_DENIED");
|
|
11534
|
-
const S = { collection:
|
|
11535
|
-
await ce("preOperation", o, E, ["read", void 0, e, S]), await ce("preRead", o, E, [S,
|
|
11536
|
-
let
|
|
11537
|
-
const
|
|
11538
|
+
const S = { collection: h.collection };
|
|
11539
|
+
await ce("preOperation", o, E, ["read", void 0, e, S]), await ce("preRead", o, E, [S, _, !1, !1]);
|
|
11540
|
+
let m = {};
|
|
11541
|
+
const T = _.map(async (I) => {
|
|
11538
11542
|
let b;
|
|
11539
11543
|
if (t?.only === "cache" ? b = await Ym(I) : t?.only === "server" ? b = await Jm(I) : b = await bd(I), !b.exists())
|
|
11540
|
-
throw new Error(`NOT_FOUND: Document with ID ${e} does not exist at location ${r?.join("/") ||
|
|
11544
|
+
throw new Error(`NOT_FOUND: Document with ID ${e} does not exist at location ${r?.join("/") || h.collection}`);
|
|
11541
11545
|
return { id: b.id, data: b.data({ serverTimestamps: u || "none" }) };
|
|
11542
|
-
}), R = await Promise.all(
|
|
11546
|
+
}), R = await Promise.all(T);
|
|
11543
11547
|
for (const I of R)
|
|
11544
|
-
|
|
11545
|
-
const
|
|
11546
|
-
if (t?.subcollections &&
|
|
11548
|
+
m.id ||= I.id, m = { ...m, ...I.data }, delete m.Collection_Path_String;
|
|
11549
|
+
const v = [], C = r ? [...r, e] : [h.collection, e];
|
|
11550
|
+
if (t?.subcollections && v.push(ym(m, C, we(t.subcollections), s, we(t?.relations), t?.only)), t?.relations && (t.relations.fields && (t.relations.fields = t.relations.fields.map((I) => {
|
|
11547
11551
|
if (typeof I == "string") {
|
|
11548
11552
|
const b = f.fields.find((w) => w.name === I);
|
|
11549
11553
|
if (b)
|
|
@@ -11551,13 +11555,13 @@ const fw = async (r, e) => {
|
|
|
11551
11555
|
throw new Error(`SCHEMA_ERROR: Field ${I} not found in collection ${n}`);
|
|
11552
11556
|
}
|
|
11553
11557
|
return I;
|
|
11554
|
-
})),
|
|
11558
|
+
})), v.push(gm(m, C, we(t.relations), s, t?.only, t?.noComputedFields, t?.noEmbeddingFields))), await Promise.all(v), !t?.noComputedFields)
|
|
11555
11559
|
for (const I of f.fields)
|
|
11556
|
-
I.type === "Computed" && (
|
|
11560
|
+
I.type === "Computed" && (m[I.name] = await I.formula(m));
|
|
11557
11561
|
if (t?.noEmbeddingFields)
|
|
11558
11562
|
for (const I of f.fields)
|
|
11559
|
-
I.type === "Embedding" && delete
|
|
11560
|
-
return await ce("postOperation", o, E, ["read",
|
|
11563
|
+
I.type === "Embedding" && delete m[I.name];
|
|
11564
|
+
return await ce("postOperation", o, E, ["read", m, e, S]), await ce("postRead", o, E, [S, _, m, !1]), m;
|
|
11561
11565
|
}, pw = (r) => r !== null && typeof r == "object", _m = (r) => {
|
|
11562
11566
|
const e = (t) => {
|
|
11563
11567
|
Object.entries(t).forEach(([n, s]) => {
|
|
@@ -11569,7 +11573,7 @@ const fw = async (r, e) => {
|
|
|
11569
11573
|
};
|
|
11570
11574
|
e(r);
|
|
11571
11575
|
}, yw = async (r, e, t, n) => {
|
|
11572
|
-
const s = it(), i =
|
|
11576
|
+
const s = it(), i = ze(), a = Ue(s, i.STOKER_FB_FUNCTIONS_REGION), o = Je(a, "stoker-writeapi", { timeout: 540 * 1e3 });
|
|
11573
11577
|
return _m(t), cc(t), (await o({
|
|
11574
11578
|
operation: "update",
|
|
11575
11579
|
path: r,
|
|
@@ -11578,32 +11582,32 @@ const fw = async (r, e) => {
|
|
|
11578
11582
|
user: n
|
|
11579
11583
|
})).data?.result;
|
|
11580
11584
|
}, fc = async (r, e, t, n, s, i) => {
|
|
11581
|
-
const a = Mt(), o =
|
|
11585
|
+
const a = Mt(), o = Ve(), c = Ve(!0), l = yc(), u = Ie(), f = dr(), h = We(), d = De();
|
|
11582
11586
|
if (r.length === 0)
|
|
11583
11587
|
throw new Error("EMPTY_PATH");
|
|
11584
|
-
const
|
|
11585
|
-
if (!E ||
|
|
11588
|
+
const p = r.at(-1), E = Object.keys(o.collections).includes(p), y = u.disabledCollections?.includes(p);
|
|
11589
|
+
if (!E || y)
|
|
11586
11590
|
throw new Error("COLLECTION_NOT_FOUND");
|
|
11587
|
-
const
|
|
11588
|
-
if (!
|
|
11591
|
+
const _ = o.collections[p], { labels: S, access: A, fields: F, enableWriteLog: m } = _, { serverWriteOnly: T } = A, R = lt(S.collection), v = await ie(u, ["global", "appName"]), C = s?.retry, g = f.currentUser;
|
|
11592
|
+
if (!g)
|
|
11589
11593
|
throw new Error("NOT_AUTHENTICATED");
|
|
11590
|
-
if (!
|
|
11594
|
+
if (!d)
|
|
11591
11595
|
throw new Error("PERMISSION_DENIED");
|
|
11592
11596
|
if (bm(e))
|
|
11593
11597
|
throw new Error("RECORD_BUSY");
|
|
11594
|
-
i =
|
|
11595
|
-
for (const
|
|
11596
|
-
|
|
11597
|
-
const k = Ao(
|
|
11598
|
+
i = C?.originalRecord || i || await vr(r, e, { noComputedFields: !0, noEmbeddingFields: !0 });
|
|
11599
|
+
for (const D of c.collections[p].fields)
|
|
11600
|
+
D.type === "Computed" && (delete t[D.name], delete i[D.name]);
|
|
11601
|
+
const k = Ao(h), I = { collection: S.collection }, b = _.auth && n?.operation === "create", w = _.auth && n?.operation === "delete", O = _.auth && !b && !w && (n?.operation === "update" || t.Role || t.Enabled !== void 0 || t.Name || t.Email || t.Photo_URL), x = await ie(R, [
|
|
11598
11602
|
"collections",
|
|
11599
11603
|
S.collection,
|
|
11600
11604
|
"custom",
|
|
11601
11605
|
"disableOfflineUpdate"
|
|
11602
|
-
]),
|
|
11603
|
-
if (zt() === "Offline" && (x ||
|
|
11606
|
+
]), P = () => {
|
|
11607
|
+
if (zt() === "Offline" && (x || T || _.auth && (b || O || w)))
|
|
11604
11608
|
throw new Error("CLIENT_OFFLINE");
|
|
11605
11609
|
};
|
|
11606
|
-
if (
|
|
11610
|
+
if (P(), T || b || O || w) {
|
|
11607
11611
|
if (b) {
|
|
11608
11612
|
if (!n.password)
|
|
11609
11613
|
throw new Error("VALIDATION_ERROR: Password is required");
|
|
@@ -11612,7 +11616,7 @@ const fw = async (r, e) => {
|
|
|
11612
11616
|
if (n.password !== n.passwordConfirm)
|
|
11613
11617
|
throw new Error("VALIDATION_ERROR: Passwords do not match");
|
|
11614
11618
|
if (!await ie(u, ["global", "firebase", "enableEmulators"])) {
|
|
11615
|
-
|
|
11619
|
+
P();
|
|
11616
11620
|
try {
|
|
11617
11621
|
const { isValid: Me } = await _d(f, n.password);
|
|
11618
11622
|
if (!Me)
|
|
@@ -11622,117 +11626,117 @@ const fw = async (r, e) => {
|
|
|
11622
11626
|
}
|
|
11623
11627
|
}
|
|
11624
11628
|
}
|
|
11625
|
-
const
|
|
11629
|
+
const D = [
|
|
11626
11630
|
"update",
|
|
11627
11631
|
{ ...i, ...t },
|
|
11628
11632
|
I,
|
|
11629
11633
|
k,
|
|
11630
11634
|
we(i)
|
|
11631
11635
|
];
|
|
11632
|
-
return await ce("preValidate", u, R,
|
|
11636
|
+
return await ce("preValidate", u, R, D), await yw(r, e, t, n ? { operation: n.operation, permissions: n.permissions, password: n.password } : void 0);
|
|
11633
11637
|
}
|
|
11634
11638
|
delete t.id;
|
|
11635
|
-
const
|
|
11636
|
-
for (const
|
|
11637
|
-
!_e(
|
|
11638
|
-
if (Nt(
|
|
11639
|
-
const
|
|
11639
|
+
const M = Ko("update", r, t, o, v, zt(), g.uid, Bt.now(), Lr(), !!C);
|
|
11640
|
+
for (const D of F)
|
|
11641
|
+
!_e(D) && ir(M[D.name]) && D.nullable && (M[D.name] = null);
|
|
11642
|
+
if (Nt(M), Nt(i), !C && m && Ye("update", "started", M, r, e, _, g.uid, void 0, i), !C) {
|
|
11643
|
+
const D = [
|
|
11640
11644
|
"update",
|
|
11641
|
-
|
|
11645
|
+
M,
|
|
11642
11646
|
e,
|
|
11643
11647
|
I,
|
|
11644
11648
|
k,
|
|
11645
11649
|
we(i)
|
|
11646
11650
|
];
|
|
11647
|
-
await ce("preOperation", u, R,
|
|
11648
|
-
const te = ["update",
|
|
11651
|
+
await ce("preOperation", u, R, D);
|
|
11652
|
+
const te = ["update", M, e, I, k, we(i)];
|
|
11649
11653
|
await ce("preWrite", u, R, te);
|
|
11650
11654
|
}
|
|
11651
|
-
if (Xd(
|
|
11655
|
+
if (Xd(_, M, o), eh(_, M), !C)
|
|
11652
11656
|
try {
|
|
11653
|
-
const
|
|
11654
|
-
tr(
|
|
11655
|
-
} catch (
|
|
11656
|
-
throw new Error(`VALIDATION_ERROR: ${
|
|
11657
|
+
const D = { ...i, ...M };
|
|
11658
|
+
tr(D), await om("update", D, _, R, ["update", D, I, k, we(i)], o), x && (P(), await lc("update", e, M, _, d));
|
|
11659
|
+
} catch (D) {
|
|
11660
|
+
throw new Error(`VALIDATION_ERROR: ${D.message}`);
|
|
11657
11661
|
}
|
|
11658
|
-
if (Oy(
|
|
11659
|
-
const
|
|
11660
|
-
return tr(
|
|
11662
|
+
if (Oy(M, i, e, _, o, g.uid, d), Nt(M), ac("update", k, r, e, M, o, _, s, l, Io, ko, Cn, (D) => ke(h, "tenants", a, "system_fields", S.collection, `${S.collection}-${D.name}`, e), (D, te) => ke(h, "tenants", a, "system_unique", S.collection, `Unique-${S.collection}-${D.name}`, te), (D) => ke(h, "tenants", a, "system_fields", S.collection, `${S.collection}-${D}`, e)), k.update(ke(h, "tenants", a, r.join("/"), e), M), !C && m && Ye("update", "written", M, r, e, _, g.uid, void 0, i), await dc("update", r, e, M, I, _, R, k, g.uid, m || !1, d, !!C, i), C?.type === "unique") {
|
|
11663
|
+
const D = { ...i, ...M };
|
|
11664
|
+
return tr(D), { id: e, ...D };
|
|
11661
11665
|
}
|
|
11662
|
-
|
|
11663
|
-
const q = ["update",
|
|
11666
|
+
m && Ye("update", "success", M, r, e, _, g.uid, void 0, i);
|
|
11667
|
+
const q = ["update", M, e, I, !!C, we(i)], z = [...q];
|
|
11664
11668
|
await ce("postWrite", u, R, q), await ce("postOperation", u, R, z);
|
|
11665
|
-
const ee = { ...i, ...
|
|
11669
|
+
const ee = { ...i, ...M };
|
|
11666
11670
|
return tr(ee), { id: e, ...ee };
|
|
11667
|
-
}, dc = async (r, e, t, n, s, i, a, o, c, l, u, f,
|
|
11668
|
-
const
|
|
11669
|
-
let
|
|
11670
|
-
const
|
|
11671
|
+
}, dc = async (r, e, t, n, s, i, a, o, c, l, u, f, h) => {
|
|
11672
|
+
const d = Ve(), p = Ie(), { labels: E } = i;
|
|
11673
|
+
let y = 0;
|
|
11674
|
+
const _ = async () => {
|
|
11671
11675
|
try {
|
|
11672
11676
|
await we(o).commit();
|
|
11673
11677
|
return;
|
|
11674
11678
|
} catch (S) {
|
|
11675
|
-
let
|
|
11676
|
-
const
|
|
11679
|
+
let A;
|
|
11680
|
+
const F = await ie(a, [
|
|
11677
11681
|
"collections",
|
|
11678
11682
|
E.collection,
|
|
11679
11683
|
"custom",
|
|
11680
11684
|
"autoCorrectUnique"
|
|
11681
11685
|
]);
|
|
11682
|
-
if (S.code === "unavailable" && await ve(
|
|
11686
|
+
if (S.code === "unavailable" && await ve(p.onIndexedDBConnectionLost), r !== "delete" && S.code === "permission-denied")
|
|
11683
11687
|
try {
|
|
11684
11688
|
await lc(r, t, n, i, u);
|
|
11685
|
-
} catch (
|
|
11686
|
-
const
|
|
11689
|
+
} catch (C) {
|
|
11690
|
+
const g = C.message.split(", "), k = [], I = [];
|
|
11687
11691
|
let b = !1;
|
|
11688
|
-
for (const w of
|
|
11689
|
-
const O = w.split(" ")[0], x =
|
|
11692
|
+
for (const w of g) {
|
|
11693
|
+
const O = w.split(" ")[0], x = d.collections[E.collection].fields.find((P) => P.name === O);
|
|
11690
11694
|
if (!x)
|
|
11691
11695
|
throw new Error(`SCHEMA_ERROR: Field ${O} not found in ${E.collection} schema`);
|
|
11692
11696
|
x.type === "Number" && k.push(w), x.type === "String" && I.push(w);
|
|
11693
11697
|
}
|
|
11694
|
-
if ((!
|
|
11698
|
+
if ((!F || k.length > 0) && (A = new Error(`VALIDATION_ERROR: ${g.join(", ")}`)), F && I.length > 0) {
|
|
11695
11699
|
for (const w of I) {
|
|
11696
11700
|
const O = w.split(" ")[0];
|
|
11697
|
-
if (
|
|
11701
|
+
if (d.collections[E.collection].fields.find((M) => M.name === O).type === "Number")
|
|
11698
11702
|
continue;
|
|
11699
|
-
let
|
|
11700
|
-
n[O].match(/ - DUPLICATE-\d+/) ? (
|
|
11703
|
+
let P = 1;
|
|
11704
|
+
n[O].match(/ - DUPLICATE-\d+/) ? (P = parseInt(
|
|
11701
11705
|
// eslint-disable-next-line security/detect-object-injection
|
|
11702
11706
|
n[O].match(/ - DUPLICATE-\d+/)[0].split("-")[2]
|
|
11703
11707
|
), n[O] = // eslint-disable-next-line security/detect-object-injection
|
|
11704
|
-
n[O].replace(/ - DUPLICATE-\d+/g, "") + ` - DUPLICATE-${
|
|
11708
|
+
n[O].replace(/ - DUPLICATE-\d+/g, "") + ` - DUPLICATE-${P + 1}`) : n[O] = n[O] + " - DUPLICATE-1", P < 10 ? b = !0 : A = new Error(g.map((M) => M.replace(/ - DUPLICATE-\d+/g, "")).join(", "));
|
|
11705
11709
|
}
|
|
11706
11710
|
if (b) {
|
|
11707
11711
|
r === "create" && await vm(e, n, void 0, { retry: { type: "unique", docId: t } }), r === "update" && await fc(e, t, n, void 0, {
|
|
11708
11712
|
retry: {
|
|
11709
11713
|
type: "unique",
|
|
11710
11714
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
11711
|
-
originalRecord:
|
|
11715
|
+
originalRecord: h
|
|
11712
11716
|
}
|
|
11713
11717
|
});
|
|
11714
11718
|
return;
|
|
11715
11719
|
}
|
|
11716
11720
|
}
|
|
11717
11721
|
}
|
|
11718
|
-
const
|
|
11722
|
+
const m = A || S, T = [
|
|
11719
11723
|
r,
|
|
11720
11724
|
n,
|
|
11721
11725
|
t,
|
|
11722
11726
|
s,
|
|
11723
|
-
|
|
11727
|
+
m,
|
|
11724
11728
|
o,
|
|
11725
11729
|
f,
|
|
11726
|
-
|
|
11727
|
-
r === "update" ?
|
|
11728
|
-
], R = S.code === "unavailable",
|
|
11729
|
-
if (
|
|
11730
|
+
y,
|
|
11731
|
+
r === "update" ? h : void 0
|
|
11732
|
+
], R = S.code === "unavailable", v = await ce("postWriteError", p, a, T);
|
|
11733
|
+
if (v?.resolved)
|
|
11730
11734
|
return;
|
|
11731
|
-
if (!R &&
|
|
11732
|
-
|
|
11735
|
+
if (!R && v?.retry) {
|
|
11736
|
+
y++, await _();
|
|
11733
11737
|
return;
|
|
11734
11738
|
} else
|
|
11735
|
-
l &&
|
|
11739
|
+
l && Ye(
|
|
11736
11740
|
r,
|
|
11737
11741
|
"failed",
|
|
11738
11742
|
n,
|
|
@@ -11740,16 +11744,16 @@ const fw = async (r, e) => {
|
|
|
11740
11744
|
t,
|
|
11741
11745
|
i,
|
|
11742
11746
|
c,
|
|
11743
|
-
|
|
11747
|
+
m,
|
|
11744
11748
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
11745
|
-
r === "update" ?
|
|
11749
|
+
r === "update" ? h : void 0
|
|
11746
11750
|
);
|
|
11747
|
-
throw
|
|
11751
|
+
throw m;
|
|
11748
11752
|
}
|
|
11749
11753
|
};
|
|
11750
|
-
await
|
|
11754
|
+
await _();
|
|
11751
11755
|
}, gw = async (r, e, t, n) => {
|
|
11752
|
-
const s = it(), i =
|
|
11756
|
+
const s = it(), i = ze(), a = Ue(s, i.STOKER_FB_FUNCTIONS_REGION), o = Je(a, "stoker-writeapi", { timeout: 540 * 1e3 });
|
|
11753
11757
|
return _m(e), (await o({
|
|
11754
11758
|
operation: "create",
|
|
11755
11759
|
path: r,
|
|
@@ -11758,30 +11762,30 @@ const fw = async (r, e) => {
|
|
|
11758
11762
|
id: n
|
|
11759
11763
|
})).data?.result;
|
|
11760
11764
|
}, vm = async (r, e, t, n, s, i) => {
|
|
11761
|
-
const a = Mt(), o =
|
|
11765
|
+
const a = Mt(), o = Ve(), c = yc(), l = Ie(), u = dr(), f = We(), h = De();
|
|
11762
11766
|
if (r.length === 0)
|
|
11763
11767
|
throw new Error("EMPTY_PATH");
|
|
11764
|
-
const
|
|
11765
|
-
if (!
|
|
11768
|
+
const d = r.at(-1), p = Object.keys(o.collections).includes(d), E = l.disabledCollections?.includes(d);
|
|
11769
|
+
if (!p || E)
|
|
11766
11770
|
throw new Error("COLLECTION_NOT_FOUND");
|
|
11767
|
-
const
|
|
11768
|
-
if (!
|
|
11771
|
+
const y = o.collections[d], { labels: _, access: S, enableWriteLog: A, softDelete: F } = y, { serverWriteOnly: m } = S, T = lt(_.collection), R = await ie(l, ["global", "appName"]), v = n?.retry, C = u.currentUser;
|
|
11772
|
+
if (!C)
|
|
11769
11773
|
throw new Error("NOT_AUTHENTICATED");
|
|
11770
|
-
if (!
|
|
11774
|
+
if (!h)
|
|
11771
11775
|
throw new Error("PERMISSION_DENIED");
|
|
11772
|
-
const
|
|
11776
|
+
const g = await ie(T, [
|
|
11773
11777
|
"collections",
|
|
11774
|
-
|
|
11778
|
+
_.collection,
|
|
11775
11779
|
"custom",
|
|
11776
11780
|
"disableOfflineCreate"
|
|
11777
11781
|
]), k = () => {
|
|
11778
|
-
if (zt() === "Offline" && (
|
|
11782
|
+
if (zt() === "Offline" && (g || m || y.auth && t))
|
|
11779
11783
|
throw new Error("CLIENT_OFFLINE");
|
|
11780
11784
|
};
|
|
11781
11785
|
k();
|
|
11782
|
-
const I = Ao(f), b =
|
|
11783
|
-
if (
|
|
11784
|
-
if (k(),
|
|
11786
|
+
const I = Ao(f), b = v?.docId || s || ke(qr(f, "tenants", a, _.collection)).id, w = { collection: _.collection };
|
|
11787
|
+
if (m || y.auth && t) {
|
|
11788
|
+
if (k(), y.auth && t) {
|
|
11785
11789
|
if (!t.password)
|
|
11786
11790
|
throw new Error("VALIDATION_ERROR: Password is required");
|
|
11787
11791
|
if (!t.passwordConfirm)
|
|
@@ -11799,92 +11803,92 @@ const fw = async (r, e) => {
|
|
|
11799
11803
|
}
|
|
11800
11804
|
}
|
|
11801
11805
|
}
|
|
11802
|
-
return await ce("preValidate", l,
|
|
11806
|
+
return await ce("preValidate", l, T, ["create", e, w, I]), i && i(), await gw(r, e, t ? { permissions: t.permissions, password: t.password } : void 0, b);
|
|
11803
11807
|
}
|
|
11804
11808
|
e.id = b;
|
|
11805
|
-
const O = Ko("create", r, e, o, R, zt(),
|
|
11806
|
-
if (
|
|
11809
|
+
const O = Ko("create", r, e, o, R, zt(), C.uid, Bt.now(), Lr(), !!v);
|
|
11810
|
+
if (F && (O[F.archivedField] = !1), Nt(O), !v && A && Ye("create", "started", O, r, b, y, C.uid), v || (await ce("preOperation", l, T, ["create", O, b, w, I]), await ce("preWrite", l, T, ["create", O, b, w, I])), Xd(y, O, o), eh(y, O), v || await hg(O, y, T, h.Role), !v)
|
|
11807
11811
|
try {
|
|
11808
|
-
await om("create", O,
|
|
11812
|
+
await om("create", O, y, T, ["create", O, w, I], o), g && (k(), await lc("create", b, O, y, h));
|
|
11809
11813
|
} catch (q) {
|
|
11810
11814
|
throw new Error(`VALIDATION_ERROR: ${q.message}`);
|
|
11811
11815
|
}
|
|
11812
|
-
if (i && i(), Nt(O), by(O, b,
|
|
11816
|
+
if (i && i(), Nt(O), by(O, b, y, o, C.uid, h), ac("create", I, r, b, O, o, y, n, c, Io, ko, Cn, (q) => ke(f, "tenants", a, "system_fields", _.collection, `${_.collection}-${q.name}`, b), (q, z) => ke(f, "tenants", a, "system_unique", _.collection, `Unique-${_.collection}-${q.name}`, z), (q) => ke(f, "tenants", a, "system_fields", _.collection, `${_.collection}-${q}`, b)), I.set(ke(f, "tenants", a, r.join("/"), b), O), !v && A && Ye("create", "written", O, r, b, y, C.uid), await dc("create", r, b, O, w, y, T, I, C.uid, A || !1, h, !!v), v?.type === "unique")
|
|
11813
11817
|
return { id: b, ...O };
|
|
11814
|
-
|
|
11815
|
-
const x = ["create", O, b, w, !!
|
|
11816
|
-
return await ce("postWrite", l,
|
|
11818
|
+
A && Ye("create", "success", O, r, b, y, C.uid);
|
|
11819
|
+
const x = ["create", O, b, w, !!v], P = [...x];
|
|
11820
|
+
return await ce("postWrite", l, T, x), await ce("postOperation", l, T, P), { id: b, ...O };
|
|
11817
11821
|
}, _w = async (r, e) => {
|
|
11818
|
-
const t = it(), n =
|
|
11822
|
+
const t = it(), n = ze(), s = Ue(t, n.STOKER_FB_FUNCTIONS_REGION);
|
|
11819
11823
|
return (await Je(s, "stoker-writeapi", { timeout: 540 * 1e3 })({
|
|
11820
11824
|
operation: "delete",
|
|
11821
11825
|
path: r,
|
|
11822
11826
|
id: e
|
|
11823
11827
|
})).data?.result;
|
|
11824
11828
|
}, vw = async (r, e, t) => {
|
|
11825
|
-
const n = Mt(), s =
|
|
11829
|
+
const n = Mt(), s = Ve(), i = yc(), a = dr(), o = We(), c = Ie(), l = De();
|
|
11826
11830
|
if (r.length === 0)
|
|
11827
11831
|
throw new Error("EMPTY_PATH");
|
|
11828
|
-
const u = r.at(-1), f = Object.keys(s.collections).includes(u),
|
|
11829
|
-
if (!f ||
|
|
11832
|
+
const u = r.at(-1), f = Object.keys(s.collections).includes(u), h = c.disabledCollections?.includes(u);
|
|
11833
|
+
if (!f || h)
|
|
11830
11834
|
throw new Error("COLLECTION_NOT_FOUND");
|
|
11831
|
-
const
|
|
11832
|
-
if (!
|
|
11835
|
+
const d = s.collections[u], { labels: p, access: E, enableWriteLog: y, softDelete: _ } = d, { serverWriteOnly: S } = E, A = lt(p.collection), F = await ie(c, ["global", "appName"]), m = t?.retry, T = a.currentUser;
|
|
11836
|
+
if (!T)
|
|
11833
11837
|
throw new Error("NOT_AUTHENTICATED");
|
|
11834
11838
|
if (!l)
|
|
11835
11839
|
throw new Error("PERMISSION_DENIED");
|
|
11836
|
-
if (
|
|
11840
|
+
if (_ && !d.auth)
|
|
11837
11841
|
return await fc(r, e, {
|
|
11838
|
-
[
|
|
11839
|
-
[
|
|
11842
|
+
[_.archivedField]: !0,
|
|
11843
|
+
[_.timestampField]: Lr()
|
|
11840
11844
|
});
|
|
11841
|
-
const R = await ie(
|
|
11845
|
+
const R = await ie(A, [
|
|
11842
11846
|
"collections",
|
|
11843
|
-
|
|
11847
|
+
p.collection,
|
|
11844
11848
|
"custom",
|
|
11845
11849
|
"disableOfflineDelete"
|
|
11846
11850
|
]);
|
|
11847
11851
|
if ((() => {
|
|
11848
|
-
if (zt() === "Offline" && (R || S ||
|
|
11852
|
+
if (zt() === "Offline" && (R || S || d.auth))
|
|
11849
11853
|
throw new Error("CLIENT_OFFLINE");
|
|
11850
11854
|
})(), bm(e))
|
|
11851
11855
|
throw new Error("RECORD_BUSY");
|
|
11852
|
-
let
|
|
11856
|
+
let C;
|
|
11853
11857
|
try {
|
|
11854
|
-
|
|
11855
|
-
} catch (
|
|
11856
|
-
throw
|
|
11858
|
+
C = await vr(r, e);
|
|
11859
|
+
} catch (P) {
|
|
11860
|
+
throw y && m?.record && P.message.indexOf("NOT_FOUND") !== -1 && await Ye("delete", "failed", m?.record, r, e, d, T.uid, P), P;
|
|
11857
11861
|
}
|
|
11858
|
-
if (S ||
|
|
11862
|
+
if (S || d.auth && C.User_ID)
|
|
11859
11863
|
return await _w(r, e);
|
|
11860
|
-
delete
|
|
11861
|
-
const
|
|
11862
|
-
Nt(I), !
|
|
11863
|
-
const w = ["delete", I, e, k, !!
|
|
11864
|
-
return await ce("postWrite", c,
|
|
11864
|
+
delete C.id;
|
|
11865
|
+
const g = Ao(o), k = { collection: p.collection }, I = Ko("delete", r, C, s, F, zt(), T.uid, Bt.now(), Lr(), !!m);
|
|
11866
|
+
Nt(I), !m && y && Ye("delete", "started", I, r, e, d, T.uid), m || (await ce("preOperation", c, A, ["delete", I, e, k, g]), await ce("preWrite", c, A, ["delete", I, e, k, g])), Nt(I), Ey(I, e, d, s, T.uid, l), ac("delete", g, r, e, I, s, d, t, i, Io, ko, Cn, (P) => ke(o, "tenants", n, "system_fields", p.collection, `${p.collection}-${P.name}`, e), (P, M) => ke(o, "tenants", n, "system_unique", p.collection, `Unique-${p.collection}-${P.name}`, M), (P) => ke(o, "tenants", n, "system_fields", p.collection, `${p.collection}-${P}`, e)), g.delete(ke(o, "tenants", n, r.join("/"), e)), !m && y && Ye("delete", "written", I, r, e, d, T.uid), await dc("delete", r, e, I, k, d, A, g, T.uid, y || !1, l, !!m), y && Ye("delete", "success", { ...I, ...m?.record || {} }, r, e, d, T.uid);
|
|
11867
|
+
const w = ["delete", I, e, k, !!m], O = [...w];
|
|
11868
|
+
return await ce("postWrite", c, A, w), await ce("postOperation", c, A, O), { id: e, ...I };
|
|
11865
11869
|
}, wm = (r) => {
|
|
11866
11870
|
if (typeof r == "object")
|
|
11867
11871
|
for (const e in r)
|
|
11868
11872
|
Object.prototype.hasOwnProperty.call(r, e) && (r[e] === "_DELETE_FIELD" ? r[e] = Cn() : wm(r[e]));
|
|
11869
11873
|
}, ww = async (r, e) => {
|
|
11870
|
-
const t = it(), n =
|
|
11874
|
+
const t = it(), n = ze(), s = Ue(t, n.STOKER_FB_FUNCTIONS_REGION);
|
|
11871
11875
|
return (await Je(s, r)(e)).data;
|
|
11872
11876
|
};
|
|
11873
11877
|
let mt = {};
|
|
11874
11878
|
const bw = async (r, e) => {
|
|
11875
|
-
const t =
|
|
11879
|
+
const t = dr(), n = gc(), s = t.currentUser;
|
|
11876
11880
|
if (s?.uid !== e.uid)
|
|
11877
11881
|
return;
|
|
11878
|
-
const i = await Od(
|
|
11882
|
+
const i = await Od(he(Qm(n, "system_write_log"), ye("status", "==", "written"), ye("user", "==", e.uid), rt("Last_Write_At", "asc")));
|
|
11879
11883
|
await new Promise((o) => setTimeout(o, 1e4));
|
|
11880
11884
|
const a = Om();
|
|
11881
11885
|
if (a?.version)
|
|
11882
11886
|
for (const o of i.docs) {
|
|
11883
11887
|
mt[o.id] ??= 0;
|
|
11884
|
-
const c = o.data(), { data: l, operation: u, docId: f, collection:
|
|
11885
|
-
await new Promise((
|
|
11888
|
+
const c = o.data(), { data: l, operation: u, docId: f, collection: h, Collection_Path: d, Last_Write_Version: p } = c;
|
|
11889
|
+
await new Promise((_) => setTimeout(_, 1e3));
|
|
11886
11890
|
const E = await ww("stoker-writelog", {
|
|
11887
|
-
path:
|
|
11891
|
+
path: d,
|
|
11888
11892
|
id: f,
|
|
11889
11893
|
log: o.id
|
|
11890
11894
|
});
|
|
@@ -11892,43 +11896,43 @@ const bw = async (r, e) => {
|
|
|
11892
11896
|
continue;
|
|
11893
11897
|
if (s?.uid !== e.uid)
|
|
11894
11898
|
return;
|
|
11895
|
-
if (a.force &&
|
|
11896
|
-
|
|
11899
|
+
if (a.force && p !== a.version) {
|
|
11900
|
+
Ye(
|
|
11897
11901
|
u,
|
|
11898
11902
|
"failed",
|
|
11899
11903
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
11900
11904
|
l.data,
|
|
11901
|
-
|
|
11905
|
+
d,
|
|
11902
11906
|
f,
|
|
11903
11907
|
// eslint-disable-next-line security/detect-object-injection
|
|
11904
|
-
r.collections[
|
|
11908
|
+
r.collections[h],
|
|
11905
11909
|
e.uid,
|
|
11906
|
-
`Version mismatch- write log version ${
|
|
11910
|
+
`Version mismatch- write log version ${p} not compatible with forced version ${a.version}`,
|
|
11907
11911
|
u === "update" ? l.originalRecord : void 0
|
|
11908
11912
|
);
|
|
11909
11913
|
continue;
|
|
11910
11914
|
}
|
|
11911
|
-
const
|
|
11912
|
-
if (
|
|
11913
|
-
if (localStorage.setItem(`stoker-retry-${f}`, Date.now().toString()), console.info(`Retrying pending ${u} operation: ${o.ref.path}`), u === "create" && (mt[f]++, await vm(
|
|
11915
|
+
const y = localStorage.getItem(`stoker-retry-${f}`);
|
|
11916
|
+
if (y !== "done" && !(y && Date.now() - parseInt(y) < 1e4)) {
|
|
11917
|
+
if (localStorage.setItem(`stoker-retry-${f}`, Date.now().toString()), console.info(`Retrying pending ${u} operation: ${o.ref.path}`), u === "create" && (mt[f]++, await vm(d, l.data, void 0, {
|
|
11914
11918
|
retry: {
|
|
11915
11919
|
type: "offline",
|
|
11916
11920
|
docId: f
|
|
11917
11921
|
}
|
|
11918
|
-
}).catch((
|
|
11919
|
-
console.error(
|
|
11922
|
+
}).catch((_) => {
|
|
11923
|
+
console.error(_);
|
|
11920
11924
|
}), mt[f]--, localStorage.setItem(`stoker-retry-${f}`, "done")), u === "update") {
|
|
11921
|
-
const
|
|
11922
|
-
S && l.data?.[S.archivedField] && l.data?.[S.archivedField] !== l.originalRecord?.[S.archivedField] && (l.data[S.timestampField] = Lr()), l.data && wm(l.data), mt[f]++, await fc(
|
|
11925
|
+
const _ = r.collections[h], { softDelete: S } = _;
|
|
11926
|
+
S && l.data?.[S.archivedField] && l.data?.[S.archivedField] !== l.originalRecord?.[S.archivedField] && (l.data[S.timestampField] = Lr()), l.data && wm(l.data), mt[f]++, await fc(d, f, l.data, void 0, {
|
|
11923
11927
|
retry: {
|
|
11924
11928
|
type: "offline",
|
|
11925
11929
|
originalRecord: l.originalRecord
|
|
11926
11930
|
}
|
|
11927
|
-
}).catch((
|
|
11928
|
-
console.error(
|
|
11931
|
+
}).catch((A) => {
|
|
11932
|
+
console.error(A);
|
|
11929
11933
|
}), mt[f]--, localStorage.setItem(`stoker-retry-${f}`, "done");
|
|
11930
11934
|
}
|
|
11931
|
-
u === "delete" && (mt[f]++, await vw(
|
|
11935
|
+
u === "delete" && (mt[f]++, await vw(d, f, {
|
|
11932
11936
|
retry: {
|
|
11933
11937
|
type: "offline",
|
|
11934
11938
|
record: {
|
|
@@ -11939,8 +11943,8 @@ const bw = async (r, e) => {
|
|
|
11939
11943
|
Last_Write_Version: c.Last_Write_Version
|
|
11940
11944
|
}
|
|
11941
11945
|
}
|
|
11942
|
-
}).catch((
|
|
11943
|
-
console.error(
|
|
11946
|
+
}).catch((_) => {
|
|
11947
|
+
console.error(_);
|
|
11944
11948
|
}), mt[f]--, localStorage.setItem(`stoker-retry-${f}`, "done"));
|
|
11945
11949
|
}
|
|
11946
11950
|
}
|
|
@@ -11950,7 +11954,7 @@ const bw = async (r, e) => {
|
|
|
11950
11954
|
let fn, Ka = 0;
|
|
11951
11955
|
const Ew = async () => {
|
|
11952
11956
|
const r = Am(), e = Ie();
|
|
11953
|
-
return
|
|
11957
|
+
return hr(ke(r, "system_deployment", "latest_deploy"), (n) => {
|
|
11954
11958
|
if (n.exists())
|
|
11955
11959
|
fn = n.data(), Ka++, Ka > 1 && (fn.refresh ? window.location.reload() : ve(e.onVersionUpdate, [fn, Ka]));
|
|
11956
11960
|
else
|
|
@@ -11962,7 +11966,7 @@ const Ew = async () => {
|
|
|
11962
11966
|
let Ro;
|
|
11963
11967
|
const Sw = async () => {
|
|
11964
11968
|
const r = Ie(), e = Am();
|
|
11965
|
-
|
|
11969
|
+
hr(ke(e, "system_deployment", "maintenance_mode"), (t) => {
|
|
11966
11970
|
if (t.exists())
|
|
11967
11971
|
Ro = t.data(), ve(r.onMaintenanceUpdate, [Ro.active ? "on" : "off"]);
|
|
11968
11972
|
else
|
|
@@ -11971,17 +11975,17 @@ const Sw = async () => {
|
|
|
11971
11975
|
throw new Error("Error getting maintenance status", { cause: t.message });
|
|
11972
11976
|
});
|
|
11973
11977
|
}, Tw = () => Ro;
|
|
11974
|
-
let
|
|
11978
|
+
let Nr, Er = null;
|
|
11975
11979
|
const Rw = () => {
|
|
11976
11980
|
const r = wd(), e = Ie();
|
|
11977
11981
|
let t = !1;
|
|
11978
11982
|
return zm(Bm(r, ".info/connected"), (s) => {
|
|
11979
|
-
s.val() === !0 ? (
|
|
11980
|
-
|
|
11983
|
+
s.val() === !0 ? (Er && (clearTimeout(Er), Er = null), Nr = "Online", ve(e.onConnectionStatusChange, [Nr, !t]), t || (t = !0)) : !Er && t && (Er = setTimeout(() => {
|
|
11984
|
+
Nr = "Offline", ve(e.onConnectionStatusChange, [Nr]);
|
|
11981
11985
|
}, 5e3));
|
|
11982
11986
|
});
|
|
11983
|
-
}, zt = () =>
|
|
11984
|
-
const r = Ie(), e =
|
|
11987
|
+
}, zt = () => Nr, Cw = () => navigator.onLine ? "Online" : "Offline", Em = async () => {
|
|
11988
|
+
const r = Ie(), e = dr(), t = e.currentUser;
|
|
11985
11989
|
if (r.preLogout && await ve(r.preLogout, [t]) === !1)
|
|
11986
11990
|
throw new Error("Operation cancelled by preLogout");
|
|
11987
11991
|
try {
|
|
@@ -12008,7 +12012,7 @@ const Ya = {
|
|
|
12008
12012
|
}, ht = {
|
|
12009
12013
|
main: {},
|
|
12010
12014
|
firestoreWrite: {}
|
|
12011
|
-
},
|
|
12015
|
+
}, Ge = {
|
|
12012
12016
|
main: {},
|
|
12013
12017
|
firestoreWrite: {},
|
|
12014
12018
|
maintenance: {}
|
|
@@ -12071,10 +12075,10 @@ const Ya = {
|
|
|
12071
12075
|
return ht.firestoreWrite;
|
|
12072
12076
|
},
|
|
12073
12077
|
getFirestoreWrite() {
|
|
12074
|
-
return
|
|
12078
|
+
return Ge.firestoreWrite;
|
|
12075
12079
|
},
|
|
12076
12080
|
getFirestoreMaintenance() {
|
|
12077
|
-
return
|
|
12081
|
+
return Ge.maintenance;
|
|
12078
12082
|
}
|
|
12079
12083
|
}, kw = () => {
|
|
12080
12084
|
hc = "", Pr = {}, mc = {}, pc = {}, $e = {}, og(), dw(), Ow();
|
|
@@ -12093,18 +12097,18 @@ const Gw = async (r, e, t, n) => {
|
|
|
12093
12097
|
const a = dp(dt);
|
|
12094
12098
|
Tt === "development" && (a.instrumentationEnabled = !1, a.dataCollectionEnabled = !1);
|
|
12095
12099
|
const o = ["firestoreWrite"];
|
|
12096
|
-
for (const
|
|
12097
|
-
Ya[`${
|
|
12100
|
+
for (const g of o)
|
|
12101
|
+
Ya[`${g}App`] = zn(s, g);
|
|
12098
12102
|
const { firestoreWriteApp: c } = Ya, l = zn(s, "maintenance");
|
|
12099
|
-
|
|
12103
|
+
Ge.maintenance = We(l);
|
|
12100
12104
|
const u = hp();
|
|
12101
12105
|
if (u.settings.minimumFetchIntervalMillis = 36e5, await mp(u), be.STOKER_FB_ENABLE_APP_CHECK === "true" && be.STOKER_FB_APP_CHECK_KEY) {
|
|
12102
12106
|
(Tt === "development" || window.location.hostname === "localhost") && (globalThis.FIREBASE_APPCHECK_DEBUG_TOKEN = !0);
|
|
12103
|
-
const
|
|
12107
|
+
const g = {
|
|
12104
12108
|
provider: new fp(be.STOKER_FB_APP_CHECK_KEY),
|
|
12105
12109
|
isTokenAutoRefreshEnabled: !0
|
|
12106
12110
|
};
|
|
12107
|
-
At.main = Gn(dt,
|
|
12111
|
+
At.main = Gn(dt, g), At.firestoreWrite = Gn(c, g), At.maintenance = Gn(l, g);
|
|
12108
12112
|
let k = !1;
|
|
12109
12113
|
const I = (b, w) => {
|
|
12110
12114
|
if (console.log(`App Check token error detected for ${w}`), !k)
|
|
@@ -12124,46 +12128,46 @@ const Gw = async (r, e, t, n) => {
|
|
|
12124
12128
|
"global",
|
|
12125
12129
|
"firebase",
|
|
12126
12130
|
"enableAnalytics"
|
|
12127
|
-
]),
|
|
12131
|
+
]), h = await ie(pe, [
|
|
12128
12132
|
"global",
|
|
12129
12133
|
"firebase",
|
|
12130
12134
|
"analyticsSettings"
|
|
12131
|
-
]),
|
|
12135
|
+
]), d = await ie(pe, [
|
|
12132
12136
|
"global",
|
|
12133
12137
|
"firebase",
|
|
12134
12138
|
"analyticsConsentSettings"
|
|
12135
|
-
]),
|
|
12139
|
+
]), p = await ie(pe, [
|
|
12136
12140
|
"global",
|
|
12137
12141
|
"firebase",
|
|
12138
12142
|
"enableEmulators"
|
|
12139
|
-
]), E = await ie(pe, ["global", "enableUserIDLogging"]),
|
|
12143
|
+
]), E = await ie(pe, ["global", "enableUserIDLogging"]), y = await ie(pe, [
|
|
12140
12144
|
"global",
|
|
12141
12145
|
"firebase",
|
|
12142
12146
|
"logLevel",
|
|
12143
12147
|
"dev"
|
|
12144
|
-
]),
|
|
12148
|
+
]), _ = await ie(pe, [
|
|
12145
12149
|
"global",
|
|
12146
12150
|
"firebase",
|
|
12147
12151
|
"logLevel",
|
|
12148
12152
|
"prod"
|
|
12149
|
-
]), S = await Fm().catch((
|
|
12150
|
-
throw new Error("Error checking analytics support.", { cause:
|
|
12153
|
+
]), S = await Fm().catch((g) => {
|
|
12154
|
+
throw new Error("Error checking analytics support.", { cause: g });
|
|
12151
12155
|
});
|
|
12152
|
-
Tt === "production" && f && S && Dm(dt,
|
|
12153
|
-
const
|
|
12156
|
+
Tt === "production" && f && S && Dm(dt, h || {}), d && Mm(d);
|
|
12157
|
+
const A = await ie(pe, [
|
|
12154
12158
|
"global",
|
|
12155
12159
|
"auth",
|
|
12156
12160
|
"authPersistenceType"
|
|
12157
|
-
]),
|
|
12161
|
+
]), m = {
|
|
12158
12162
|
popupRedirectResolver: void 0,
|
|
12159
|
-
persistence:
|
|
12163
|
+
persistence: A === "LOCAL" ? [Pm, qm, Ec] : A === "SESSION" ? [Ec, Sc] : [Sc]
|
|
12160
12164
|
};
|
|
12161
|
-
ht.main = Oc(dt,
|
|
12162
|
-
for (const
|
|
12163
|
-
ht[
|
|
12164
|
-
const { main:
|
|
12165
|
-
Lm(
|
|
12166
|
-
if (
|
|
12165
|
+
ht.main = Oc(dt, m);
|
|
12166
|
+
for (const g of o)
|
|
12167
|
+
ht[g] = Oc(Ya[`${g}App`], m);
|
|
12168
|
+
const { main: T } = ht;
|
|
12169
|
+
Lm(T, async (g) => {
|
|
12170
|
+
if (g && await ve(pe.preLogin, [g]) === !1)
|
|
12167
12171
|
throw new Error("Operation cancelled by preLogin");
|
|
12168
12172
|
});
|
|
12169
12173
|
const R = await ie(pe, [
|
|
@@ -12171,31 +12175,31 @@ const Gw = async (r, e, t, n) => {
|
|
|
12171
12175
|
"firebase",
|
|
12172
12176
|
"disableIndividualEmulators"
|
|
12173
12177
|
]);
|
|
12174
|
-
if (Tt === "development" &&
|
|
12178
|
+
if (Tt === "development" && p) {
|
|
12175
12179
|
if (!R?.includes("Auth")) {
|
|
12176
|
-
const
|
|
12180
|
+
const g = be.STOKER_FB_EMULATOR_AUTH_PORT ? parseInt(be.STOKER_FB_EMULATOR_AUTH_PORT) : 9099;
|
|
12177
12181
|
for (const k of Object.values(ht))
|
|
12178
|
-
$m(k, `http://localhost:${
|
|
12182
|
+
$m(k, `http://localhost:${g}`);
|
|
12179
12183
|
}
|
|
12180
12184
|
if (!R?.includes("Database")) {
|
|
12181
|
-
const
|
|
12182
|
-
Zm(wd(), "localhost",
|
|
12185
|
+
const g = be.STOKER_FB_EMULATOR_DATABASE_PORT ? parseInt(be.STOKER_FB_EMULATOR_DATABASE_PORT) : 9e3;
|
|
12186
|
+
Zm(wd(), "localhost", g);
|
|
12183
12187
|
}
|
|
12184
12188
|
if (!R?.includes("Firestore")) {
|
|
12185
|
-
const
|
|
12186
|
-
Cc(
|
|
12189
|
+
const g = be.STOKER_FB_EMULATOR_FIRESTORE_PORT ? parseInt(be.STOKER_FB_EMULATOR_FIRESTORE_PORT) : 8080;
|
|
12190
|
+
Cc(Ge.maintenance, "localhost", g);
|
|
12187
12191
|
}
|
|
12188
12192
|
if (!R?.includes("Storage")) {
|
|
12189
|
-
const
|
|
12190
|
-
cp(lp(), "localhost",
|
|
12193
|
+
const g = be.STOKER_FB_EMULATOR_STORAGE_PORT ? parseInt(be.STOKER_FB_EMULATOR_STORAGE_PORT) : 9199;
|
|
12194
|
+
cp(lp(), "localhost", g);
|
|
12191
12195
|
}
|
|
12192
12196
|
if (!R?.includes("Functions")) {
|
|
12193
|
-
const
|
|
12194
|
-
up(Ue(dt, be.STOKER_FB_FUNCTIONS_REGION), "localhost",
|
|
12197
|
+
const g = be.STOKER_FB_EMULATOR_FUNCTIONS_PORT ? parseInt(be.STOKER_FB_EMULATOR_FUNCTIONS_PORT) : 5001;
|
|
12198
|
+
up(Ue(dt, be.STOKER_FB_FUNCTIONS_REGION), "localhost", g);
|
|
12195
12199
|
}
|
|
12196
12200
|
}
|
|
12197
|
-
if (Ew(), Sw(), Rw(), Tt === "development" && (
|
|
12198
|
-
const
|
|
12201
|
+
if (Ew(), Sw(), Rw(), Tt === "development" && (y ? Qr(y) : Qr("debug")), Tt === "production" && (_ ? Qr(_) : Qr("error")), E) {
|
|
12202
|
+
const g = Bn(T, async (k) => {
|
|
12199
12203
|
if (k) {
|
|
12200
12204
|
const I = JSON.parse(be.STOKER_FB_WEB_APP_CONFIG);
|
|
12201
12205
|
Nm(() => {
|
|
@@ -12203,18 +12207,18 @@ const Gw = async (r, e, t, n) => {
|
|
|
12203
12207
|
});
|
|
12204
12208
|
}
|
|
12205
12209
|
});
|
|
12206
|
-
Rn.push(
|
|
12210
|
+
Rn.push(g);
|
|
12207
12211
|
}
|
|
12208
|
-
await Promise.all(Object.values(ht).map((
|
|
12209
|
-
throw new Error(`Error waiting for auth state in ${
|
|
12212
|
+
await Promise.all(Object.values(ht).map((g) => g.authStateReady().catch((k) => {
|
|
12213
|
+
throw new Error(`Error waiting for auth state in ${g.app.name}.`, { cause: k });
|
|
12210
12214
|
})));
|
|
12211
|
-
let
|
|
12212
|
-
for (const
|
|
12213
|
-
|
|
12214
|
-
let
|
|
12215
|
-
return Bn(
|
|
12216
|
-
if (
|
|
12217
|
-
$e =
|
|
12215
|
+
let v = !1;
|
|
12216
|
+
for (const g of Object.values(ht))
|
|
12217
|
+
g.currentUser || (v = !0);
|
|
12218
|
+
let C;
|
|
12219
|
+
return Bn(T, async (g) => {
|
|
12220
|
+
if (g) {
|
|
12221
|
+
$e = g;
|
|
12218
12222
|
const k = await jm($e), { claims: I } = k;
|
|
12219
12223
|
hc = I.tenant, Rm = {
|
|
12220
12224
|
...$e,
|
|
@@ -12229,9 +12233,9 @@ const Gw = async (r, e, t, n) => {
|
|
|
12229
12233
|
G && (Ot(), Le({}));
|
|
12230
12234
|
});
|
|
12231
12235
|
}));
|
|
12232
|
-
await Promise.all(b), gd || (Aw(pe), gd = !0),
|
|
12233
|
-
const w = await ie(pe, ["global", "auth", "tabManager"], [$e, I]), O = await ie(pe, ["global", "auth", "garbageCollectionStrategy"], [$e, I]), x = await ie(pe, ["global", "auth", "maxCacheSize"], [$e, I]) || -1,
|
|
12234
|
-
let
|
|
12236
|
+
await Promise.all(b), gd || (Aw(pe), gd = !0), C = await ie(pe, ["global", "auth", "offlinePersistenceType"], [$e, I]);
|
|
12237
|
+
const w = await ie(pe, ["global", "auth", "tabManager"], [$e, I]), O = await ie(pe, ["global", "auth", "garbageCollectionStrategy"], [$e, I]), x = await ie(pe, ["global", "auth", "maxCacheSize"], [$e, I]) || -1, P = await ie(pe, ["global", "auth", "maxWriteCacheSize"], [$e, I]);
|
|
12238
|
+
let M;
|
|
12235
12239
|
const q = {
|
|
12236
12240
|
localCache: Ac({
|
|
12237
12241
|
tabManager: w === "SINGLE" ? kc({ forceOwnership: !1 }) : Ic(),
|
|
@@ -12240,31 +12244,31 @@ const Gw = async (r, e, t, n) => {
|
|
|
12240
12244
|
}, z = {
|
|
12241
12245
|
localCache: Ac({
|
|
12242
12246
|
tabManager: w === "SINGLE" ? kc({ forceOwnership: !1 }) : Ic(),
|
|
12243
|
-
cacheSizeBytes:
|
|
12247
|
+
cacheSizeBytes: P || x
|
|
12244
12248
|
})
|
|
12245
12249
|
};
|
|
12246
12250
|
let ee;
|
|
12247
|
-
if (O === "EAGER" ? ee = Xm() : ee = ep({ cacheSizeBytes: x }),
|
|
12251
|
+
if (O === "EAGER" ? ee = Xm() : ee = ep({ cacheSizeBytes: x }), C === "ALL" ? M = q : M = {
|
|
12248
12252
|
localCache: tp({
|
|
12249
12253
|
garbageCollector: ee
|
|
12250
12254
|
})
|
|
12251
|
-
},
|
|
12255
|
+
}, Ge.main = Zn(dt, M), ["ALL", "WRITE"].includes(C) ? Ge.firestoreWrite = Zn(c, z) : Ge.firestoreWrite = Zn(c, M), Tt === "development" && p && !R?.includes("Firestore")) {
|
|
12252
12256
|
const Se = be.STOKER_FB_EMULATOR_FIRESTORE_PORT ? parseInt(be.STOKER_FB_EMULATOR_FIRESTORE_PORT) : 8080;
|
|
12253
|
-
for (const [Le, Ot] of Object.entries(
|
|
12257
|
+
for (const [Le, Ot] of Object.entries(Ge))
|
|
12254
12258
|
Le !== "maintenance" && Cc(Ot, "localhost", Se);
|
|
12255
12259
|
}
|
|
12256
|
-
if (
|
|
12257
|
-
const Se = rp(
|
|
12260
|
+
if (C === "ALL") {
|
|
12261
|
+
const Se = rp(Ge.main);
|
|
12258
12262
|
Se && np(Se);
|
|
12259
12263
|
}
|
|
12260
|
-
const
|
|
12264
|
+
const D = await Je(Ue(dt, be.STOKER_FB_FUNCTIONS_REGION), "stoker-schema")().catch((Se) => {
|
|
12261
12265
|
throw new Error("Error fetching schema.", { cause: Se });
|
|
12262
12266
|
});
|
|
12263
|
-
Pr =
|
|
12264
|
-
const te = Object.entries(
|
|
12265
|
-
mc = Object.fromEntries(te), pc =
|
|
12267
|
+
Pr = D.data.schema;
|
|
12268
|
+
const te = Object.entries(D.data.allRoleGroups).map(([Se, Le]) => [Se, new Set(Le)]);
|
|
12269
|
+
mc = Object.fromEntries(te), pc = D.data.currentUserRoleGroups, Tm = Sy(Object.keys(Pr.collections), e, "web", Co, n);
|
|
12266
12270
|
const ne = await fw($e, k);
|
|
12267
|
-
Rn.push(...ne),
|
|
12271
|
+
Rn.push(...ne), C === "WRITE" && bw(Pr, $e), await ve(pe.postLogin, [$e]);
|
|
12268
12272
|
const Me = new Event("stoker:ready");
|
|
12269
12273
|
document.dispatchEvent(Me);
|
|
12270
12274
|
} else if ($e) {
|
|
@@ -12282,27 +12286,27 @@ const Gw = async (r, e, t, n) => {
|
|
|
12282
12286
|
error: x
|
|
12283
12287
|
}), console.error(`Error signing out of ${O.app.name}.`);
|
|
12284
12288
|
});
|
|
12285
|
-
})), await Promise.all(Object.entries(
|
|
12286
|
-
O !== "maintenance" && Object.keys(x).length !== 0 && await sp(x).catch((
|
|
12289
|
+
})), await Promise.all(Object.entries(Ge).map(async ([O, x]) => {
|
|
12290
|
+
O !== "maintenance" && Object.keys(x).length !== 0 && await sp(x).catch((P) => {
|
|
12287
12291
|
console.error(`Error terminating ${x.app.name}.`), b.error = !0, b.instances.push({
|
|
12288
12292
|
instance: x.app.name,
|
|
12289
12293
|
code: "TERMINATE_APP",
|
|
12290
|
-
error:
|
|
12294
|
+
error: P
|
|
12291
12295
|
});
|
|
12292
12296
|
});
|
|
12293
12297
|
})), (await ie(pe, [
|
|
12294
12298
|
"global",
|
|
12295
12299
|
"auth",
|
|
12296
12300
|
"clearPersistenceOnSignOut"
|
|
12297
|
-
]) ?? !0) && (
|
|
12301
|
+
]) ?? !0) && (C === "ALL" && await xc(Ge.main).catch((O) => {
|
|
12298
12302
|
console.error('Error clearing indexedDB persistence in "[DEFAULT]".'), b.error = !0, b.instances.push({ instance: "[DEFAULT]", code: "CLEAR_CACHE", error: O });
|
|
12299
|
-
}), ["ALL", "WRITE"].includes(
|
|
12303
|
+
}), ["ALL", "WRITE"].includes(C) && await xc(Ge.firestoreWrite).catch((O) => {
|
|
12300
12304
|
console.error('Error clearing indexedDB persistence in "firestoreWrite".'), b.error = !0, b.instances.push({ instance: "firestoreWrite", code: "CLEAR_CACHE", error: O });
|
|
12301
12305
|
})), b.error ? console.info("Sign out operation completed with errors.") : console.info("Sign out operation completed successfully."), await ve(pe.postLogout, [b]);
|
|
12302
12306
|
}
|
|
12303
|
-
}),
|
|
12304
|
-
}, { getTenant: Mt, getEnv:
|
|
12305
|
-
const [n, s] = [
|
|
12307
|
+
}), v ? !1 : T.currentUser ? (E && console.info(`${T.currentUser.uid} successfully logged in.`), !0) : !1;
|
|
12308
|
+
}, { getTenant: Mt, getEnv: ze, getTimezone: Cm, getSchema: Ve, getCurrentUser: Hw, getCurrentUserRoleGroups: Jr, getAllRoleGroups: yc, getGlobalConfigModule: Ie, getCollectionConfigModule: lt, getAppCheck: Kw, getAppCheckFirestoreWrite: Yw, getFirestoreWriteAuth: Nw, getFirestoreWrite: gc, getFirestoreMaintenance: Am } = Co, Jw = async (r, e, t) => {
|
|
12309
|
+
const [n, s] = [dr(), Nw()], i = Ie();
|
|
12306
12310
|
if (!r || !e)
|
|
12307
12311
|
throw new Error("Email and password are required.");
|
|
12308
12312
|
try {
|
|
@@ -12324,12 +12328,12 @@ const Gw = async (r, e, t, n) => {
|
|
|
12324
12328
|
throw c;
|
|
12325
12329
|
}
|
|
12326
12330
|
if (!s.currentUser) {
|
|
12327
|
-
const c = it(), l =
|
|
12331
|
+
const c = it(), l = ze(), u = Ue(c, l.STOKER_FB_FUNCTIONS_REGION), f = Je(u, "stoker-customtoken");
|
|
12328
12332
|
try {
|
|
12329
|
-
const
|
|
12330
|
-
if (!
|
|
12333
|
+
const d = (await f()).data.customToken;
|
|
12334
|
+
if (!d)
|
|
12331
12335
|
throw new Error("The user is not authenticated.");
|
|
12332
|
-
await Wm(s,
|
|
12336
|
+
await Wm(s, d);
|
|
12333
12337
|
} catch {
|
|
12334
12338
|
throw n && n.currentUser && await vd(n), new Error("The user is not authenticated.");
|
|
12335
12339
|
}
|
|
@@ -12368,7 +12372,7 @@ const Gw = async (r, e, t, n) => {
|
|
|
12368
12372
|
} else
|
|
12369
12373
|
throw new Error("User must have an email address to enroll in multi-factor authentication.");
|
|
12370
12374
|
}, rb = async (r, e, t) => {
|
|
12371
|
-
const n = it(), s =
|
|
12375
|
+
const n = it(), s = ze(), i = Ue(n, s.STOKER_FB_FUNCTIONS_REGION);
|
|
12372
12376
|
await Je(i, "stoker-deletefolder")({
|
|
12373
12377
|
path: r || "",
|
|
12374
12378
|
id: e.id,
|
|
@@ -12376,7 +12380,7 @@ const Gw = async (r, e, t, n) => {
|
|
|
12376
12380
|
folderName: t
|
|
12377
12381
|
});
|
|
12378
12382
|
}, nb = async () => {
|
|
12379
|
-
const r = [
|
|
12383
|
+
const r = [We(), gc()];
|
|
12380
12384
|
for (const e of Object.values(r))
|
|
12381
12385
|
await ip(e).catch((t) => {
|
|
12382
12386
|
throw new Error(`Error waiting for pending writes in ${e.app.name}.`, { cause: t });
|
|
@@ -12388,85 +12392,85 @@ const Gw = async (r, e, t, n) => {
|
|
|
12388
12392
|
const a = De();
|
|
12389
12393
|
if (!a?.Role)
|
|
12390
12394
|
throw new Error("PERMISSIONS_NOT_FOUND");
|
|
12391
|
-
const o =
|
|
12395
|
+
const o = Ve(!0), l = Jr()[i], u = We(), f = o.collections[i];
|
|
12392
12396
|
if (!f)
|
|
12393
12397
|
throw new Error("COLLECTION_NOT_FOUND");
|
|
12394
|
-
const { labels:
|
|
12395
|
-
if (!E ||
|
|
12398
|
+
const { labels: h, preloadCache: d } = f, p = Ie(), E = Object.keys(o.collections).includes(i), y = p.disabledCollections?.includes(i);
|
|
12399
|
+
if (!E || y)
|
|
12396
12400
|
throw new Error("COLLECTION_NOT_FOUND");
|
|
12397
|
-
const
|
|
12401
|
+
const _ = lt(h.collection), S = await ie(p, [
|
|
12398
12402
|
"global",
|
|
12399
12403
|
"firebase",
|
|
12400
12404
|
"serverTimestampOptions"
|
|
12401
|
-
]),
|
|
12402
|
-
if (
|
|
12405
|
+
]), A = dm(r, e, l);
|
|
12406
|
+
if (A.length === 0)
|
|
12403
12407
|
throw new Error("PERMISSION_DENIED");
|
|
12404
|
-
const
|
|
12405
|
-
await ce("preOperation",
|
|
12406
|
-
const
|
|
12407
|
-
let
|
|
12408
|
+
const F = d?.roles?.includes(a.Role), m = { collection: h.collection };
|
|
12409
|
+
await ce("preOperation", p, _, ["read", void 0, e, m]), await ce("preRead", p, _, [m, A, !1, !0]);
|
|
12410
|
+
const v = /* @__PURE__ */ new Map(), C = [];
|
|
12411
|
+
let g = {};
|
|
12408
12412
|
const k = /* @__PURE__ */ new Map();
|
|
12409
|
-
typeof s?.relations == "object" && (s.relations.fields = s.relations.fields.map((
|
|
12410
|
-
if (typeof
|
|
12411
|
-
const
|
|
12412
|
-
if (
|
|
12413
|
-
return
|
|
12414
|
-
throw new Error(`SCHEMA_ERROR: Field ${
|
|
12415
|
-
}
|
|
12416
|
-
return
|
|
12413
|
+
typeof s?.relations == "object" && (s.relations.fields = s.relations.fields.map((P) => {
|
|
12414
|
+
if (typeof P == "string") {
|
|
12415
|
+
const M = f.fields.find((q) => q.name === P);
|
|
12416
|
+
if (M)
|
|
12417
|
+
return M;
|
|
12418
|
+
throw new Error(`SCHEMA_ERROR: Field ${P} not found in collection ${i}`);
|
|
12419
|
+
}
|
|
12420
|
+
return P;
|
|
12417
12421
|
}));
|
|
12418
12422
|
const I = () => {
|
|
12419
|
-
const
|
|
12420
|
-
if (
|
|
12421
|
-
if (um(
|
|
12422
|
-
const
|
|
12423
|
+
const P = Sd(u, async () => {
|
|
12424
|
+
if (P(), g) {
|
|
12425
|
+
if (um(g, k), !s?.noComputedFields) {
|
|
12426
|
+
const M = [];
|
|
12423
12427
|
for (const q of f.fields)
|
|
12424
|
-
q.type === "Computed" &&
|
|
12425
|
-
|
|
12428
|
+
q.type === "Computed" && M.push(ve(() => q.formula(g)).then((z) => {
|
|
12429
|
+
g && (g[q.name] = z);
|
|
12426
12430
|
}));
|
|
12427
|
-
await Promise.all(
|
|
12431
|
+
await Promise.all(M);
|
|
12428
12432
|
}
|
|
12429
12433
|
if (s?.noEmbeddingFields)
|
|
12430
|
-
for (const
|
|
12431
|
-
|
|
12434
|
+
for (const M of f.fields)
|
|
12435
|
+
M.type === "Embedding" && delete g[M.name];
|
|
12432
12436
|
}
|
|
12433
|
-
t(we(
|
|
12437
|
+
t(we(g));
|
|
12434
12438
|
});
|
|
12435
|
-
}, b = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Map(), O = (
|
|
12439
|
+
}, b = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Map(), O = (P) => typeof P == "object" ? P.fields.filter((q) => typeof q == "object" && _e(q) && jt(f, o, a).includes(q.collection)) : f.fields.filter((q) => _e(q) && jt(f, o, a).includes(q.collection)), x = (P) => new Promise((M) => {
|
|
12436
12440
|
if (!s?.relations) {
|
|
12437
|
-
|
|
12441
|
+
M({});
|
|
12438
12442
|
return;
|
|
12439
12443
|
}
|
|
12440
12444
|
const q = we(s.relations), z = /* @__PURE__ */ new Map(), ee = /* @__PURE__ */ new Map(), oe = O(q);
|
|
12441
|
-
for (const
|
|
12445
|
+
for (const D of oe)
|
|
12442
12446
|
for (const te of w.values())
|
|
12443
|
-
te.type ===
|
|
12444
|
-
!
|
|
12445
|
-
for (const
|
|
12446
|
-
if ("collection" in
|
|
12447
|
-
const te =
|
|
12447
|
+
te.type === D.type && te.field === D.name && // eslint-disable-next-line security/detect-object-injection
|
|
12448
|
+
!g[D.name][te.id] && (te.listener(), b.delete(`${D.name}_${te.id}`));
|
|
12449
|
+
for (const D of oe)
|
|
12450
|
+
if ("collection" in D) {
|
|
12451
|
+
const te = g[D.name];
|
|
12448
12452
|
if (!te)
|
|
12449
12453
|
continue;
|
|
12450
12454
|
for (const ne of Object.keys(te))
|
|
12451
|
-
te?.[ne].id || (z.set(`${
|
|
12455
|
+
te?.[ne].id || (z.set(`${D.name}_${ne}`, !1), b.has(`${D.name}_${ne}`) ? ee.set(`${D.name}_${ne}`, !0) : b.set(`${D.name}_${ne}`, !0));
|
|
12452
12456
|
}
|
|
12453
12457
|
if (z.size === 0)
|
|
12454
|
-
|
|
12458
|
+
M({});
|
|
12455
12459
|
else
|
|
12456
|
-
for (const
|
|
12457
|
-
if ("collection" in
|
|
12458
|
-
const te =
|
|
12460
|
+
for (const D of oe)
|
|
12461
|
+
if ("collection" in D) {
|
|
12462
|
+
const te = g[D.name];
|
|
12459
12463
|
if (!te)
|
|
12460
12464
|
continue;
|
|
12461
12465
|
for (const [ne, Me] of Object.entries(te))
|
|
12462
|
-
if (ee.has(`${
|
|
12466
|
+
if (ee.has(`${D.name}_${ne}`)) {
|
|
12463
12467
|
const Se = async () => {
|
|
12464
|
-
te[ne].id ? (z.set(`${
|
|
12468
|
+
te[ne].id ? (z.set(`${D.name}_${ne}`, !0), Array.from(z.values()).every((Le) => Le) && (M({}), I())) : setTimeout(Se, 100);
|
|
12465
12469
|
};
|
|
12466
12470
|
Se();
|
|
12467
12471
|
} else {
|
|
12468
|
-
const Se = o.collections[
|
|
12469
|
-
Ot?.includes(a.Role) ?
|
|
12472
|
+
const Se = o.collections[D.collection], { access: Le } = Se, { serverReadOnly: Ot } = Le;
|
|
12473
|
+
Ot?.includes(a.Role) ? vr([...Me.Collection_Path], ne, {
|
|
12470
12474
|
noComputedFields: s?.noComputedFields,
|
|
12471
12475
|
noEmbeddingFields: s?.noEmbeddingFields
|
|
12472
12476
|
}).then((K) => {
|
|
@@ -12475,22 +12479,22 @@ const Gw = async (r, e, t, n) => {
|
|
|
12475
12479
|
return;
|
|
12476
12480
|
}
|
|
12477
12481
|
if (!te?.[ne]) {
|
|
12478
|
-
z.set(`${
|
|
12482
|
+
z.set(`${D.name}_${ne}`, !0), b.delete(`${D.name}_${ne}`);
|
|
12479
12483
|
return;
|
|
12480
12484
|
}
|
|
12481
|
-
te[ne] = K, z.set(`${
|
|
12485
|
+
te[ne] = K, z.set(`${D.name}_${ne}`, !0), Array.from(z.values()).every((j) => j) && (M({}), I(), P.fromCache === !1 && (ce("postOperation", p, _, [
|
|
12482
12486
|
"read",
|
|
12483
|
-
|
|
12487
|
+
g,
|
|
12484
12488
|
e,
|
|
12485
|
-
|
|
12486
|
-
]), ce("postRead",
|
|
12487
|
-
|
|
12488
|
-
|
|
12489
|
-
|
|
12489
|
+
m
|
|
12490
|
+
]), ce("postRead", p, _, [
|
|
12491
|
+
m,
|
|
12492
|
+
A,
|
|
12493
|
+
g,
|
|
12490
12494
|
!0
|
|
12491
12495
|
])));
|
|
12492
12496
|
}).catch((K) => {
|
|
12493
|
-
delete te[ne], K.code !== "permission-denied" && n && n(new Error(`Error fetching relation document in collection ${
|
|
12497
|
+
delete te[ne], K.code !== "permission-denied" && n && n(new Error(`Error fetching relation document in collection ${D.collection} with ID ${e} at location ${Me.Collection_Path?.join("/")}`, {
|
|
12494
12498
|
cause: K
|
|
12495
12499
|
}));
|
|
12496
12500
|
}) : km(
|
|
@@ -12502,70 +12506,70 @@ const Gw = async (r, e, t, n) => {
|
|
|
12502
12506
|
return;
|
|
12503
12507
|
}
|
|
12504
12508
|
if (!te?.[ne]) {
|
|
12505
|
-
w.get(`${
|
|
12509
|
+
w.get(`${D.name}_${ne}`) && w.get(`${D.name}_${ne}`).listener(), z.set(`${D.name}_${ne}`, !0), b.delete(`${D.name}_${ne}`);
|
|
12506
12510
|
return;
|
|
12507
12511
|
}
|
|
12508
|
-
te[ne] = K, z.set(`${
|
|
12512
|
+
te[ne] = K, z.set(`${D.name}_${ne}`, !0), Array.from(z.values()).every((j) => j) && (M({}), I(), P.fromCache === !1 && (ce("postOperation", p, _, [
|
|
12509
12513
|
"read",
|
|
12510
|
-
|
|
12514
|
+
g,
|
|
12511
12515
|
e,
|
|
12512
|
-
|
|
12513
|
-
]), ce("postRead",
|
|
12514
|
-
|
|
12515
|
-
|
|
12516
|
-
|
|
12516
|
+
m
|
|
12517
|
+
]), ce("postRead", p, _, [
|
|
12518
|
+
m,
|
|
12519
|
+
A,
|
|
12520
|
+
g,
|
|
12517
12521
|
!0
|
|
12518
12522
|
])));
|
|
12519
12523
|
},
|
|
12520
12524
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12521
12525
|
(K) => {
|
|
12522
|
-
delete te[ne], K.code !== "permission-denied" && n && n(new Error(`Error fetching relation document in collection ${
|
|
12526
|
+
delete te[ne], K.code !== "permission-denied" && n && n(new Error(`Error fetching relation document in collection ${D.collection} with ID ${e} at location ${Me.Collection_Path?.join("/")}`, {
|
|
12523
12527
|
cause: K
|
|
12524
12528
|
}));
|
|
12525
12529
|
},
|
|
12526
12530
|
{ ...s, relations: !1 }
|
|
12527
12531
|
).then((K) => {
|
|
12528
12532
|
if (!te?.[ne]) {
|
|
12529
|
-
K(), b.delete(`${
|
|
12533
|
+
K(), b.delete(`${D.name}_${ne}`);
|
|
12530
12534
|
return;
|
|
12531
12535
|
}
|
|
12532
|
-
|
|
12536
|
+
C.push(K), w.set(`${D.name}_${ne}`, {
|
|
12533
12537
|
id: ne,
|
|
12534
|
-
type:
|
|
12535
|
-
field:
|
|
12538
|
+
type: D.type,
|
|
12539
|
+
field: D.name,
|
|
12536
12540
|
listener: K
|
|
12537
12541
|
});
|
|
12538
12542
|
});
|
|
12539
12543
|
}
|
|
12540
12544
|
}
|
|
12541
12545
|
});
|
|
12542
|
-
for (const
|
|
12543
|
-
const
|
|
12546
|
+
for (const P of A) {
|
|
12547
|
+
const M = hr(P, { source: s?.only || (F ? "cache" : "default") }, (q) => {
|
|
12544
12548
|
if (q.exists()) {
|
|
12545
12549
|
const z = q.data({ serverTimestamps: S || "none" });
|
|
12546
|
-
if (
|
|
12550
|
+
if (v.has(P.path) && s?.relations) {
|
|
12547
12551
|
const oe = O(s?.relations);
|
|
12548
|
-
for (const
|
|
12549
|
-
"collection" in
|
|
12552
|
+
for (const D of oe)
|
|
12553
|
+
"collection" in D && z[D.name] && (z[D.name] = g?.[D.name]);
|
|
12550
12554
|
}
|
|
12551
|
-
|
|
12552
|
-
const ee = k.get(
|
|
12553
|
-
lm(z, ee), k.set(
|
|
12554
|
-
I(), q.metadata.fromCache === !1 && (ce("postOperation",
|
|
12555
|
+
v.set(P.path, !0), g ||= {}, g.id ||= q.id, g = { ...g, ...z }, delete g.Collection_Path_String;
|
|
12556
|
+
const ee = k.get(P) || /* @__PURE__ */ new Set();
|
|
12557
|
+
lm(z, ee), k.set(P, ee), v.size === A.length && x(q.metadata).then(() => {
|
|
12558
|
+
I(), q.metadata.fromCache === !1 && (ce("postOperation", p, _, [
|
|
12555
12559
|
"read",
|
|
12556
|
-
|
|
12560
|
+
g,
|
|
12557
12561
|
e,
|
|
12558
|
-
|
|
12559
|
-
]), ce("postRead",
|
|
12562
|
+
m
|
|
12563
|
+
]), ce("postRead", p, _, [m, A, g, !0]));
|
|
12560
12564
|
});
|
|
12561
|
-
} else
|
|
12565
|
+
} else g && (g = void 0, I(), q.metadata.fromCache === !1 && (ce("postOperation", p, _, ["read", void 0, e, m]), ce("postRead", p, _, [m, A, void 0, !0])));
|
|
12562
12566
|
}, (q) => {
|
|
12563
|
-
n && n(q),
|
|
12567
|
+
n && n(q), C.forEach((z) => z());
|
|
12564
12568
|
});
|
|
12565
|
-
|
|
12569
|
+
C.push(M);
|
|
12566
12570
|
}
|
|
12567
12571
|
return () => {
|
|
12568
|
-
|
|
12572
|
+
C.forEach((P) => P());
|
|
12569
12573
|
};
|
|
12570
12574
|
}, Ja = (r) => {
|
|
12571
12575
|
const e = r.first.values().next().value?.id;
|
|
@@ -12590,25 +12594,25 @@ const Gw = async (r, e, t, n) => {
|
|
|
12590
12594
|
const a = De();
|
|
12591
12595
|
if (!a?.Role)
|
|
12592
12596
|
throw new Error("PERMISSION_DENIED");
|
|
12593
|
-
const o =
|
|
12594
|
-
if (!
|
|
12597
|
+
const o = Ve(!0), l = Jr()[i], u = We(), f = o.collections[i], { labels: h, preloadCache: d, access: p } = f, { serverReadOnly: E } = p, y = Ie(), _ = Object.keys(o.collections).includes(i), S = y.disabledCollections?.includes(i);
|
|
12598
|
+
if (!_ || S)
|
|
12595
12599
|
throw new Error("COLLECTION_NOT_FOUND");
|
|
12596
|
-
const
|
|
12600
|
+
const A = lt(h.collection), F = await ie(y, [
|
|
12597
12601
|
"global",
|
|
12598
12602
|
"firebase",
|
|
12599
12603
|
"serverTimestampOptions"
|
|
12600
|
-
]),
|
|
12604
|
+
]), m = d?.roles?.includes(a.Role);
|
|
12601
12605
|
if (s?.pagination?.number !== void 0) {
|
|
12602
12606
|
const G = s.pagination.number;
|
|
12603
12607
|
if (typeof G != "number" || !Number.isFinite(G) || !Number.isInteger(G) || G < 1)
|
|
12604
12608
|
throw new Error("INPUT_ERROR: Pagination number must be a positive finite integer");
|
|
12605
12609
|
}
|
|
12606
|
-
const
|
|
12607
|
-
if (
|
|
12610
|
+
const T = oc(r, l, !!s?.tempCache);
|
|
12611
|
+
if (T.length === 0)
|
|
12608
12612
|
return { pages: 0, count: 0, unsubscribe: () => {
|
|
12609
12613
|
} };
|
|
12610
|
-
let R =
|
|
12611
|
-
const
|
|
12614
|
+
let R = T.map((G) => he(G, ...e));
|
|
12615
|
+
const v = s?.pagination?.startAfter || s?.pagination?.endBefore || s?.pagination?.startAt || s?.pagination?.endAt || {
|
|
12612
12616
|
first: /* @__PURE__ */ new Map(),
|
|
12613
12617
|
last: /* @__PURE__ */ new Map()
|
|
12614
12618
|
};
|
|
@@ -12621,43 +12625,43 @@ const Gw = async (r, e, t, n) => {
|
|
|
12621
12625
|
s.pagination.startAfter || s.pagination.endBefore || s.pagination.startAt || s.pagination.endAt ? s.pagination.startAfter ? (Qa(s.pagination.startAfter), R = R.map((j, Y) => {
|
|
12622
12626
|
if (!s.pagination?.orderByField || !s.pagination.orderByDirection)
|
|
12623
12627
|
throw new Error("INPUT_ERROR: orderByField and orderByDirection must be provided when using startAfter");
|
|
12624
|
-
let U =
|
|
12625
|
-
return s.pagination.number && (U =
|
|
12628
|
+
let U = he(j, rt(s.pagination.orderByField, s.pagination.orderByDirection), eo(v.last.get(Y)));
|
|
12629
|
+
return s.pagination.number && (U = he(U, Xt(s.pagination.number))), U;
|
|
12626
12630
|
})) : s.pagination.endBefore ? (Ja(s.pagination.endBefore), R = R.map((j, Y) => {
|
|
12627
12631
|
if (!s.pagination?.orderByField || !s.pagination.orderByDirection)
|
|
12628
12632
|
throw new Error("INPUT_ERROR: orderByField and orderByDirection must be provided when using endBefore");
|
|
12629
|
-
let U =
|
|
12630
|
-
return s.pagination.number && (U =
|
|
12633
|
+
let U = he(j, rt(s.pagination.orderByField, s.pagination.orderByDirection), to(v.first.get(Y)));
|
|
12634
|
+
return s.pagination.number && (U = he(U, Fr(s.pagination.number))), U;
|
|
12631
12635
|
})) : s.pagination.startAt ? (Ja(s.pagination.startAt), R = R.map((j, Y) => {
|
|
12632
12636
|
if (!s.pagination?.orderByField || !s.pagination.orderByDirection)
|
|
12633
12637
|
throw new Error("INPUT_ERROR: orderByField and orderByDirection must be provided when using startAt");
|
|
12634
|
-
let U =
|
|
12635
|
-
return s.pagination.number && (U =
|
|
12638
|
+
let U = he(j, rt(s.pagination.orderByField, s.pagination.orderByDirection), ap(v.first.get(Y)));
|
|
12639
|
+
return s.pagination.number && (U = he(U, Fr(s.pagination.number))), U;
|
|
12636
12640
|
})) : s.pagination.endAt && (Qa(s.pagination.endAt), R = R.map((j, Y) => {
|
|
12637
12641
|
if (!s.pagination?.orderByField || !s.pagination.orderByDirection)
|
|
12638
12642
|
throw new Error("INPUT_ERROR: orderByField and orderByDirection must be provided when using endAt");
|
|
12639
|
-
let U =
|
|
12640
|
-
return s.pagination.number && (U =
|
|
12643
|
+
let U = he(j, rt(s.pagination.orderByField, s.pagination.orderByDirection), op(v.last.get(Y)));
|
|
12644
|
+
return s.pagination.number && (U = he(U, Fr(s.pagination.number))), U;
|
|
12641
12645
|
})) : R = R.map((j) => {
|
|
12642
|
-
let Y =
|
|
12643
|
-
return s.pagination?.orderByField && s.pagination.orderByDirection && (Y =
|
|
12646
|
+
let Y = he(j);
|
|
12647
|
+
return s.pagination?.orderByField && s.pagination.orderByDirection && (Y = he(j, rt(s.pagination.orderByField, s.pagination.orderByDirection))), s.pagination.number && (Y = he(Y, Xt(s.pagination.number))), Y;
|
|
12644
12648
|
});
|
|
12645
12649
|
}
|
|
12646
|
-
const
|
|
12647
|
-
await ce("preOperation",
|
|
12650
|
+
const C = { collection: h.collection };
|
|
12651
|
+
await ce("preOperation", y, A, ["read", void 0, void 0, C]), await ce("preRead", y, A, [C, R, !0, !0]);
|
|
12648
12652
|
let I = !0;
|
|
12649
|
-
const b = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Map(), O = [], x = /* @__PURE__ */ new Map(),
|
|
12653
|
+
const b = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Map(), O = [], x = /* @__PURE__ */ new Map(), P = /* @__PURE__ */ new Map(), M = /* @__PURE__ */ new Map(), q = (G, K, j) => {
|
|
12650
12654
|
const Y = [];
|
|
12651
12655
|
x.forEach((U) => {
|
|
12652
|
-
um(U,
|
|
12656
|
+
um(U, P.get(U.id));
|
|
12653
12657
|
for (const Z of f.fields)
|
|
12654
12658
|
Z.type === "Computed" && !s?.noComputedFields && Y.push(ve(Z.formula, [U, j]).then((Te) => {
|
|
12655
12659
|
U[Z.name] = Te;
|
|
12656
12660
|
})), s?.noEmbeddingFields && Z.type === "Embedding" && delete U[Z.name];
|
|
12657
12661
|
}), Promise.all(Y).then(() => {
|
|
12658
12662
|
t(Array.from(x.values()), G, K), K?.fromCache === !1 && x.forEach((U) => {
|
|
12659
|
-
const Z = ["read", U, U.id,
|
|
12660
|
-
ce("postOperation",
|
|
12663
|
+
const Z = ["read", U, U.id, C];
|
|
12664
|
+
ce("postOperation", y, A, Z), ce("postRead", y, A, [C, T, U, !0]);
|
|
12661
12665
|
});
|
|
12662
12666
|
});
|
|
12663
12667
|
}, z = (G, K) => {
|
|
@@ -12668,7 +12672,7 @@ const Gw = async (r, e, t, n) => {
|
|
|
12668
12672
|
}), b.size === R.length && j) {
|
|
12669
12673
|
I = !1;
|
|
12670
12674
|
const Y = Sd(u, () => {
|
|
12671
|
-
Y(), !s?.noComputedFields &&
|
|
12675
|
+
Y(), !s?.noComputedFields && A?.admin?.retriever ? ve(A.admin.retriever).then((U) => {
|
|
12672
12676
|
q(G, K, U);
|
|
12673
12677
|
}) : q(G, K);
|
|
12674
12678
|
});
|
|
@@ -12683,7 +12687,7 @@ const Gw = async (r, e, t, n) => {
|
|
|
12683
12687
|
}
|
|
12684
12688
|
return G;
|
|
12685
12689
|
}));
|
|
12686
|
-
const ee = {}, oe = {},
|
|
12690
|
+
const ee = {}, oe = {}, D = (G, K) => {
|
|
12687
12691
|
if (!G)
|
|
12688
12692
|
return;
|
|
12689
12693
|
const j = G.id;
|
|
@@ -12715,12 +12719,12 @@ const Gw = async (r, e, t, n) => {
|
|
|
12715
12719
|
for (const [se, Xe] of Object.entries(ge))
|
|
12716
12720
|
if (Te.has(se)) {
|
|
12717
12721
|
const ut = async () => {
|
|
12718
|
-
ge[se].id ? (Z.set(se, !0), Array.from(Z.values()).every((
|
|
12722
|
+
ge[se].id ? (Z.set(se, !0), Array.from(Z.values()).every((Be) => Be) && w.set(j, "loaded")) : setTimeout(ut, 100);
|
|
12719
12723
|
};
|
|
12720
12724
|
ut();
|
|
12721
12725
|
} else {
|
|
12722
|
-
const ut = o.collections[H.collection], { access:
|
|
12723
|
-
xe?.includes(a.Role) ?
|
|
12726
|
+
const ut = o.collections[H.collection], { access: Be } = ut, { serverReadOnly: xe } = Be;
|
|
12727
|
+
xe?.includes(a.Role) ? vr([...Xe.Collection_Path], se).then((Re) => {
|
|
12724
12728
|
if (!Re) {
|
|
12725
12729
|
delete ge[se];
|
|
12726
12730
|
return;
|
|
@@ -12729,7 +12733,7 @@ const Gw = async (r, e, t, n) => {
|
|
|
12729
12733
|
Z.set(se, !0), ee[j].delete(se);
|
|
12730
12734
|
return;
|
|
12731
12735
|
}
|
|
12732
|
-
ge[se] = Re, Z.set(se, !0), Array.from(Z.values()).every((
|
|
12736
|
+
ge[se] = Re, Z.set(se, !0), Array.from(Z.values()).every((br) => br) && (w.set(j, "loaded"), z(K));
|
|
12733
12737
|
}).catch((Re) => {
|
|
12734
12738
|
delete ge[se], Re.code !== "permission-denied" && n && n(new Error(`Error fetching relation document in collection ${H.collection} with ID ${j} at location ${Xe.Collection_Path?.join("/")}`, {
|
|
12735
12739
|
cause: Re
|
|
@@ -12746,7 +12750,7 @@ const Gw = async (r, e, t, n) => {
|
|
|
12746
12750
|
oe[j].has(se) && oe[j].get(se)?.listener(), Z.set(se, !0), ee[j].delete(se);
|
|
12747
12751
|
return;
|
|
12748
12752
|
}
|
|
12749
|
-
ge[se] = Re, Z.set(se, !0), Array.from(Z.values()).every((
|
|
12753
|
+
ge[se] = Re, Z.set(se, !0), Array.from(Z.values()).every((br) => br) && (w.set(j, "loaded"), z(K));
|
|
12750
12754
|
},
|
|
12751
12755
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12752
12756
|
(Re) => {
|
|
@@ -12779,23 +12783,24 @@ const Gw = async (r, e, t, n) => {
|
|
|
12779
12783
|
}
|
|
12780
12784
|
}, ne = (G, K, j) => {
|
|
12781
12785
|
const Y = j.data({
|
|
12782
|
-
serverTimestamps:
|
|
12786
|
+
serverTimestamps: F || "none"
|
|
12783
12787
|
});
|
|
12784
12788
|
K.id ||= j.id, K = { ...K, ...Y }, delete K.Collection_Path_String;
|
|
12785
|
-
const U =
|
|
12786
|
-
lm(Y, Z), U.set(G, Z),
|
|
12787
|
-
}, Me = s?.only === "cache" ||
|
|
12789
|
+
const U = P.get(j.id) || /* @__PURE__ */ new Map(), Z = U.get(G) || /* @__PURE__ */ new Set();
|
|
12790
|
+
lm(Y, Z), U.set(G, Z), P.set(j.id, U), x.set(j.id, K);
|
|
12791
|
+
}, Me = s?.only === "cache" || m;
|
|
12792
|
+
m && s?.tempCache && await sr(h.collection, s.tempCache?.constraints, void 0, void 0, void 0, s.tempCache?.label);
|
|
12788
12793
|
for (const G of R) {
|
|
12789
12794
|
let K = !0;
|
|
12790
|
-
const j =
|
|
12791
|
-
(Me || Y.metadata.fromCache === !1) && (b.set(G, !0),
|
|
12792
|
-
const Z = x.get(U.id) || {}, Te =
|
|
12793
|
-
|
|
12795
|
+
const j = hr(G, { source: Me ? "cache" : "default", includeMetadataChanges: !0 }, (Y) => {
|
|
12796
|
+
(Me || Y.metadata.fromCache === !1) && (b.set(G, !0), v.first.set(R.indexOf(G), Y.docs[0]), v.last.set(R.indexOf(G), Y.docs.at(-1) || Y.docs[0]), I && s?.relations || z(v, Y.metadata)), b.get(G) === !0 && (K ? (Y.docs.forEach((U) => {
|
|
12797
|
+
const Z = x.get(U.id) || {}, Te = M.get(U.id) || 0;
|
|
12798
|
+
M.set(U.id, Te + 1), ne(G, Z, U);
|
|
12794
12799
|
}), K = !1) : Y.docChanges().forEach((U) => {
|
|
12795
|
-
const Z = x.get(U.doc.id) || {}, Te =
|
|
12796
|
-
U.type === "added" &&
|
|
12797
|
-
}), b.size === R.length && s?.relations && (x.size === 0 && z(
|
|
12798
|
-
|
|
12800
|
+
const Z = x.get(U.doc.id) || {}, Te = M.get(U.doc.id) || 0;
|
|
12801
|
+
U.type === "added" && M.set(U.doc.id, Te + 1), U.type === "added" || U.type === "modified" ? ne(G, Z, U.doc) : U.type === "removed" && (M.set(U.doc.id, Te - 1), M.get(U.doc.id) === 0 && (x.delete(U.doc.id), b.size === R.length && s?.relations && (w.set(U.doc.id, "deleted"), te(U.doc.id))));
|
|
12802
|
+
}), b.size === R.length && s?.relations && (x.size === 0 && z(v, Y.metadata), x.forEach((U) => {
|
|
12803
|
+
D(U, v);
|
|
12799
12804
|
})));
|
|
12800
12805
|
}, (Y) => {
|
|
12801
12806
|
n && n(new Error(`Error fetching documents at location ${r.join("/")}`, { cause: Y })), O.forEach((U) => U());
|
|
@@ -12803,9 +12808,9 @@ const Gw = async (r, e, t, n) => {
|
|
|
12803
12808
|
O.push(j);
|
|
12804
12809
|
}
|
|
12805
12810
|
let Se, Le;
|
|
12806
|
-
if (s?.pagination && !
|
|
12807
|
-
let G =
|
|
12808
|
-
s.pagination.orderByField && s.pagination.orderByDirection && (G =
|
|
12811
|
+
if (s?.pagination && !d?.roles.includes(a.Role) && !E?.includes(a.Role)) {
|
|
12812
|
+
let G = he(T[0], ...e);
|
|
12813
|
+
s.pagination.orderByField && s.pagination.orderByDirection && (G = he(G, rt(s.pagination.orderByField, s.pagination.orderByDirection)));
|
|
12809
12814
|
const K = await Ed(G).catch(() => {
|
|
12810
12815
|
});
|
|
12811
12816
|
if (K) {
|
|
@@ -12815,17 +12820,17 @@ const Gw = async (r, e, t, n) => {
|
|
|
12815
12820
|
}
|
|
12816
12821
|
}
|
|
12817
12822
|
return { pages: Le, count: Se, unsubscribe: (G) => {
|
|
12818
|
-
G === "first" && Ja(
|
|
12823
|
+
G === "first" && Ja(v), G === "last" && Qa(v), O.forEach((K) => K());
|
|
12819
12824
|
} };
|
|
12820
12825
|
}, ib = async (r, e) => {
|
|
12821
|
-
const t = it(), n =
|
|
12826
|
+
const t = it(), n = ze(), s = Ue(t, n.STOKER_FB_FUNCTIONS_REGION);
|
|
12822
12827
|
return (await Je(s, "stoker-getfiles")({
|
|
12823
12828
|
collectionPath: e.Collection_Path,
|
|
12824
12829
|
id: e.id,
|
|
12825
12830
|
path: r
|
|
12826
12831
|
})).data.result;
|
|
12827
12832
|
}, Fw = async (r, e, t, n, s, i) => {
|
|
12828
|
-
const a = it(), o =
|
|
12833
|
+
const a = it(), o = ze(), c = Ue(a, o.STOKER_FB_FUNCTIONS_REGION);
|
|
12829
12834
|
await Je(c, "stoker-adminemail")({
|
|
12830
12835
|
subject: r,
|
|
12831
12836
|
text: e,
|
|
@@ -12835,34 +12840,34 @@ const Gw = async (r, e, t, n) => {
|
|
|
12835
12840
|
replyTo: i
|
|
12836
12841
|
});
|
|
12837
12842
|
}, ab = async (r, e, t, n, s, i, a, o, c) => {
|
|
12838
|
-
if (
|
|
12843
|
+
if (ze().MODE === "development") {
|
|
12839
12844
|
await Fw(e, t, n, s, i, a);
|
|
12840
12845
|
return;
|
|
12841
12846
|
}
|
|
12842
|
-
const f = Ha(r),
|
|
12843
|
-
if (
|
|
12847
|
+
const f = Ha(r), h = cw(e), d = t ? pd(t) : void 0, p = n ? pd(n) : void 0, E = s ? Ha(s) : void 0, y = i ? Ha(i) : void 0, _ = a ? Tn(a) : void 0, S = c ? Tn(c) : void 0, A = Array.isArray(f) ? f : [f];
|
|
12848
|
+
if (A.length === 0 || A.length === 1 && !A[0])
|
|
12844
12849
|
throw new Error("No valid email addresses provided");
|
|
12845
|
-
const
|
|
12846
|
-
if (
|
|
12847
|
-
const
|
|
12848
|
-
|
|
12850
|
+
const F = We(), m = { to: f, message: { subject: h } };
|
|
12851
|
+
if (d && (m.message.text = d), p && (m.message.html = p), E) {
|
|
12852
|
+
const T = Array.isArray(E) ? E : [E];
|
|
12853
|
+
T.length > 0 && T[0] && (m.cc = E);
|
|
12849
12854
|
}
|
|
12850
|
-
if (
|
|
12851
|
-
const
|
|
12852
|
-
|
|
12855
|
+
if (y) {
|
|
12856
|
+
const T = Array.isArray(y) ? y : [y];
|
|
12857
|
+
T.length > 0 && T[0] && (m.bcc = y);
|
|
12853
12858
|
}
|
|
12854
|
-
|
|
12859
|
+
_ && (m.replyTo = _), o && (m.message.attachments = o), S && (m.from = S), await Td(qr(F, "system_mail"), m);
|
|
12855
12860
|
}, Dw = async (r) => {
|
|
12856
|
-
const e = it(), t =
|
|
12861
|
+
const e = it(), t = ze(), n = Ue(e, t.STOKER_FB_FUNCTIONS_REGION);
|
|
12857
12862
|
await Je(n, "stoker-adminsms")({
|
|
12858
12863
|
body: r
|
|
12859
12864
|
});
|
|
12860
12865
|
}, ob = async (r, e) => {
|
|
12861
|
-
if (
|
|
12866
|
+
if (ze().MODE === "development") {
|
|
12862
12867
|
await Dw(e);
|
|
12863
12868
|
return;
|
|
12864
12869
|
}
|
|
12865
|
-
const s =
|
|
12870
|
+
const s = We(), i = { to: r, body: e };
|
|
12866
12871
|
await Td(qr(s, "system_messages"), i);
|
|
12867
12872
|
}, cb = (r) => {
|
|
12868
12873
|
const e = Cm();
|
|
@@ -12901,7 +12906,7 @@ export {
|
|
|
12901
12906
|
De as getCurrentUserPermissions,
|
|
12902
12907
|
Jr as getCurrentUserRoleGroups,
|
|
12903
12908
|
dm as getDocumentRefs,
|
|
12904
|
-
|
|
12909
|
+
ze as getEnv,
|
|
12905
12910
|
ib as getFiles,
|
|
12906
12911
|
Am as getFirestoreMaintenance,
|
|
12907
12912
|
gc as getFirestoreWrite,
|
|
@@ -12910,9 +12915,10 @@ export {
|
|
|
12910
12915
|
To as getLoadingState,
|
|
12911
12916
|
Tw as getMaintenanceInfo,
|
|
12912
12917
|
Cw as getNetworkStatus,
|
|
12913
|
-
|
|
12918
|
+
vr as getOne,
|
|
12914
12919
|
mw as getOneServer,
|
|
12915
|
-
|
|
12920
|
+
lw as getPreloadListeners,
|
|
12921
|
+
Ve as getSchema,
|
|
12916
12922
|
pm as getSome,
|
|
12917
12923
|
hw as getSomeServer,
|
|
12918
12924
|
Mt as getTenant,
|
|
@@ -12921,14 +12927,14 @@ export {
|
|
|
12921
12927
|
Om as getVersionInfo,
|
|
12922
12928
|
Wg as getZodSchema,
|
|
12923
12929
|
Gw as initializeStoker,
|
|
12924
|
-
|
|
12930
|
+
ir as isDeleteSentinel,
|
|
12925
12931
|
lb as keepTimezone,
|
|
12926
12932
|
tb as multiFactorEnroll,
|
|
12927
12933
|
eb as onStokerPermissionsChange,
|
|
12928
12934
|
Qw as onStokerReady,
|
|
12929
12935
|
Xw as onStokerSignOut,
|
|
12930
12936
|
Zw as preloadCache,
|
|
12931
|
-
|
|
12937
|
+
sr as preloadCollection,
|
|
12932
12938
|
ub as removeTimezone,
|
|
12933
12939
|
Fw as sendAdminEmail,
|
|
12934
12940
|
Dw as sendAdminSMS,
|