@stoker-platform/web-client 0.5.34 → 0.5.36
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 +605 -603
- package/package.json +3 -3
package/dist/bundle.js
CHANGED
|
@@ -2,13 +2,13 @@ import { getApp as it, registerVersion as xm, initializeApp as zn, setLogLevel a
|
|
|
2
2
|
import { isSupported as Fm, initializeAnalytics as Dm, setConsent as Mm } from "firebase/analytics";
|
|
3
3
|
import { getAuth as fr, 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 me, collection as qr, and as Xr, or as Rc, onSnapshot as dr, 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 Nr, 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.35", 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.33", 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.33", 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((m) => m.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.33", 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((g) => g.type === "Record_Owner").forEach((g) => {
|
|
70
|
+
"operations" in g && g.operations && !g.operations.includes(r) || i.Created_By !== n && (l = !1);
|
|
71
|
+
}), u?.filter((g) => g.type === "Record_User").forEach((g) => {
|
|
72
|
+
if ("operations" in g && g.operations && !g.operations.includes(r))
|
|
73
73
|
return;
|
|
74
|
-
const C = re(o,
|
|
74
|
+
const C = re(o, g.collectionField);
|
|
75
75
|
i[`${C.name}_Array`]?.includes(s.Doc_ID) || (l = !1);
|
|
76
|
-
}), u?.filter((
|
|
77
|
-
if ("operations" in
|
|
76
|
+
}), u?.filter((g) => g.type === "Record_Property").forEach((g) => {
|
|
77
|
+
if ("operations" in g && g.operations && !g.operations.includes(r))
|
|
78
78
|
return;
|
|
79
|
-
const C = re(o,
|
|
80
|
-
C.type === "Array" ? R.values?.some((
|
|
79
|
+
const C = re(o, g.propertyField), R = g.roles.find((v) => v.role === s.Role);
|
|
80
|
+
C.type === "Array" ? R.values?.some((v) => i[C.name].includes(v)) || (l = !1) : R.values?.includes(i[C.name]) || (l = !1);
|
|
81
81
|
});
|
|
82
|
-
let
|
|
83
|
-
f?.filter((
|
|
84
|
-
m = !0, c?.individualEntities?.includes(i.id) || (
|
|
82
|
+
let d = !0, m = !1;
|
|
83
|
+
f?.filter((g) => g.type === "Individual").forEach(() => {
|
|
84
|
+
m = !0, c?.individualEntities?.includes(i.id) || (d = !1);
|
|
85
85
|
});
|
|
86
|
-
let E = !0,
|
|
87
|
-
if (f?.filter((
|
|
88
|
-
|
|
89
|
-
const C = re(o,
|
|
86
|
+
let E = !0, y = !1;
|
|
87
|
+
if (f?.filter((g) => g.type === "Parent").forEach((g) => {
|
|
88
|
+
y = !0;
|
|
89
|
+
const C = re(o, g.collectionField);
|
|
90
90
|
c?.parentEntities?.some((R) => i[`${C.name}_Array`].includes(R)) || (E = !1);
|
|
91
|
-
}), f?.filter((
|
|
92
|
-
|
|
93
|
-
const C = re(o,
|
|
94
|
-
Object.entries(c?.parentPropertyEntities || {}).some((
|
|
95
|
-
const [A, p] =
|
|
91
|
+
}), f?.filter((g) => g.type === "Parent_Property").forEach((g) => {
|
|
92
|
+
y = !0;
|
|
93
|
+
const C = re(o, g.collectionField), R = re(o, g.propertyField);
|
|
94
|
+
Object.entries(c?.parentPropertyEntities || {}).some((v) => {
|
|
95
|
+
const [A, p] = v;
|
|
96
96
|
return A === i[R.name] && i[`${C.name}_Array`].some((k) => p.includes(k));
|
|
97
97
|
}) || (E = !1);
|
|
98
|
-
}), m &&
|
|
99
|
-
if (!(
|
|
98
|
+
}), m && 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((g) => g.parentFilter.type === "Individual").forEach((g) => {
|
|
109
109
|
S = !0;
|
|
110
|
-
const { parentFilter: C } =
|
|
111
|
-
if (!
|
|
110
|
+
const { parentFilter: C } = g, R = re(o, C.collectionField), v = s.collections?.[R.collection];
|
|
111
|
+
if (!v) {
|
|
112
112
|
l = !1;
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
115
|
-
|
|
115
|
+
v.individualEntities?.some((A) => i[`${R.name}_Array`].includes(A)) || (_ = !1);
|
|
116
116
|
});
|
|
117
117
|
let T = !0, P = !1;
|
|
118
|
-
if (
|
|
118
|
+
if (h?.filter((g) => g.parentFilter.type === "Parent").forEach((g) => {
|
|
119
119
|
P = !0;
|
|
120
|
-
const { parentFilter: C } =
|
|
120
|
+
const { parentFilter: C } = g, R = re(o, C.collectionField), v = re(o, C.parentCollectionField), A = s.collections?.[R.collection];
|
|
121
121
|
if (!A) {
|
|
122
122
|
l = !1;
|
|
123
123
|
return;
|
|
124
124
|
}
|
|
125
|
-
A.parentEntities?.some((p) => i[`${
|
|
126
|
-
}),
|
|
125
|
+
A.parentEntities?.some((p) => i[`${v.name}_Array`].includes(p)) || (T = !1);
|
|
126
|
+
}), h?.filter((g) => g.parentFilter.type === "Parent_Property").forEach((g) => {
|
|
127
127
|
P = !0;
|
|
128
|
-
const { parentFilter: C } =
|
|
128
|
+
const { parentFilter: C } = g, R = re(o, C.collectionField), v = re(o, C.parentPropertyField), A = re(o, C.parentCollectionField), p = s.collections?.[R.collection];
|
|
129
129
|
if (!p) {
|
|
130
130
|
l = !1;
|
|
131
131
|
return;
|
|
132
132
|
}
|
|
133
133
|
Object.entries(p.parentPropertyEntities || {}).some((k) => {
|
|
134
134
|
const [I, b] = k;
|
|
135
|
-
return I === i[
|
|
135
|
+
return I === i[v.name] && i[`${A.name}_Array`].some((w) => b.includes(w));
|
|
136
136
|
}) || (T = !1);
|
|
137
137
|
}), S && P) {
|
|
138
|
-
if (!(
|
|
138
|
+
if (!(_ || T)) {
|
|
139
139
|
l = !1;
|
|
140
140
|
return;
|
|
141
141
|
}
|
|
142
|
-
} else if (!
|
|
142
|
+
} else if (!_ || !T) {
|
|
143
143
|
l = !1;
|
|
144
144
|
return;
|
|
145
145
|
}
|
|
@@ -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,17 +723,17 @@ 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, m = o.length;
|
|
727
|
+
if (d != m && !(h && m > 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 P = a[
|
|
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, T = c & s ? new r() : void 0;
|
|
733
|
+
for (f.set(a, o), f.set(o, a); ++_ < d; ) {
|
|
734
|
+
var P = a[_], g = o[_];
|
|
735
735
|
if (l)
|
|
736
|
-
var C =
|
|
736
|
+
var C = h ? l(g, P, _, o, a, f) : l(P, g, _, a, o, f);
|
|
737
737
|
if (C !== void 0) {
|
|
738
738
|
if (C)
|
|
739
739
|
continue;
|
|
@@ -741,14 +741,14 @@ function xd() {
|
|
|
741
741
|
break;
|
|
742
742
|
}
|
|
743
743
|
if (T) {
|
|
744
|
-
if (!e(o, function(R,
|
|
745
|
-
if (!t(T,
|
|
746
|
-
return T.push(
|
|
744
|
+
if (!e(o, function(R, v) {
|
|
745
|
+
if (!t(T, v) && (P === R || u(P, R, c, l, f)))
|
|
746
|
+
return T.push(v);
|
|
747
747
|
})) {
|
|
748
748
|
S = !1;
|
|
749
749
|
break;
|
|
750
750
|
}
|
|
751
|
-
} else if (!(P ===
|
|
751
|
+
} else if (!(P === g || u(P, g, c, l, f))) {
|
|
752
752
|
S = !1;
|
|
753
753
|
break;
|
|
754
754
|
}
|
|
@@ -792,22 +792,22 @@ 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]", m = "[object Set]", E = "[object String]", y = "[object Symbol]", _ = "[object ArrayBuffer]", S = "[object DataView]", T = r ? r.prototype : void 0, P = T ? T.valueOf : void 0;
|
|
796
|
+
function g(C, R, v, A, p, k, I) {
|
|
797
|
+
switch (v) {
|
|
798
798
|
case S:
|
|
799
799
|
if (C.byteLength != R.byteLength || C.byteOffset != R.byteOffset)
|
|
800
800
|
return !1;
|
|
801
801
|
C = C.buffer, R = R.buffer;
|
|
802
|
-
case
|
|
802
|
+
case _:
|
|
803
803
|
return !(C.byteLength != R.byteLength || !k(new e(C), new e(R)));
|
|
804
804
|
case c:
|
|
805
805
|
case l:
|
|
806
|
-
case
|
|
806
|
+
case h:
|
|
807
807
|
return t(+C, +R);
|
|
808
808
|
case u:
|
|
809
809
|
return C.name == R.name && C.message == R.message;
|
|
810
|
-
case
|
|
810
|
+
case d:
|
|
811
811
|
case E:
|
|
812
812
|
return C == R + "";
|
|
813
813
|
case f:
|
|
@@ -822,13 +822,13 @@ function ty() {
|
|
|
822
822
|
A |= o, I.set(C, R);
|
|
823
823
|
var x = n(b(C), b(R), A, p, k, I);
|
|
824
824
|
return I.delete(C), x;
|
|
825
|
-
case
|
|
825
|
+
case y:
|
|
826
826
|
if (P)
|
|
827
827
|
return P.call(C) == P.call(R);
|
|
828
828
|
}
|
|
829
829
|
return !1;
|
|
830
830
|
}
|
|
831
|
-
return Hs =
|
|
831
|
+
return Hs = g, Hs;
|
|
832
832
|
}
|
|
833
833
|
var Ks, Nl;
|
|
834
834
|
function Fd() {
|
|
@@ -975,8 +975,8 @@ var ci, Zl;
|
|
|
975
975
|
function ay() {
|
|
976
976
|
if (Zl) return ci;
|
|
977
977
|
Zl = 1;
|
|
978
|
-
var r = hr(), 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]",
|
|
979
|
-
k[S] = k[T] = k[P] = k[
|
|
978
|
+
var r = hr(), 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]", m = "[object String]", E = "[object WeakMap]", y = "[object ArrayBuffer]", _ = "[object DataView]", S = "[object Float32Array]", T = "[object Float64Array]", P = "[object Int8Array]", g = "[object Int16Array]", C = "[object Int32Array]", R = "[object Uint8Array]", v = "[object Uint8ClampedArray]", A = "[object Uint16Array]", p = "[object Uint32Array]", k = {};
|
|
979
|
+
k[S] = k[T] = k[P] = k[g] = k[C] = k[R] = k[v] = k[A] = k[p] = !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[m] = k[E] = !1;
|
|
980
980
|
function I(b) {
|
|
981
981
|
return t(b) && e(b.length) && !!k[r(b)];
|
|
982
982
|
}
|
|
@@ -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), m = !f && !h && !d && i(l), E = f || h || d || m, 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
|
-
|
|
1028
|
+
d && (S == "offset" || S == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
1029
1029
|
m && (S == "buffer" || S == "byteLength" || S == "byteOffset") || // Skip index properties.
|
|
1030
|
-
s(S,
|
|
1031
|
-
return
|
|
1030
|
+
s(S, _))) && y.push(S);
|
|
1031
|
+
return y;
|
|
1032
1032
|
}
|
|
1033
1033
|
return fi = c, fi;
|
|
1034
1034
|
}
|
|
@@ -1112,12 +1112,12 @@ 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, m = r(a), E = m.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
1123
|
var S = u.get(i), T = u.get(a);
|
|
@@ -1125,18 +1125,18 @@ function ly() {
|
|
|
1125
1125
|
return S == a && T == i;
|
|
1126
1126
|
var P = !0;
|
|
1127
1127
|
u.set(i, a), u.set(a, i);
|
|
1128
|
-
for (var
|
|
1129
|
-
|
|
1130
|
-
var C = i[
|
|
1128
|
+
for (var g = f; ++y < d; ) {
|
|
1129
|
+
_ = h[y];
|
|
1130
|
+
var C = i[_], R = a[_];
|
|
1131
1131
|
if (c)
|
|
1132
|
-
var
|
|
1133
|
-
if (!(
|
|
1132
|
+
var v = f ? c(R, C, _, a, i, u) : c(C, R, _, i, a, u);
|
|
1133
|
+
if (!(v === void 0 ? C === R || l(C, R, o, c, u) : v)) {
|
|
1134
1134
|
P = !1;
|
|
1135
1135
|
break;
|
|
1136
1136
|
}
|
|
1137
|
-
|
|
1137
|
+
g || (g = _ == "constructor");
|
|
1138
1138
|
}
|
|
1139
|
-
if (P && !
|
|
1139
|
+
if (P && !g) {
|
|
1140
1140
|
var A = i.constructor, p = a.constructor;
|
|
1141
1141
|
A != p && "constructor" in i && "constructor" in a && !(typeof A == "function" && A instanceof A && typeof p == "function" && p instanceof p) && (P = !1);
|
|
1142
1142
|
}
|
|
@@ -1176,20 +1176,20 @@ 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 = hr(), a = Id(), o = "[object Map]", c = "[object Object]", l = "[object Promise]", u = "[object Set]", f = "[object WeakMap]",
|
|
1180
|
-
return (r && S(new r(new ArrayBuffer(1))) !=
|
|
1181
|
-
var P = i(T),
|
|
1179
|
+
var r = uy(), e = Fo(), t = fy(), n = dy(), s = hy(), i = hr(), a = Id(), o = "[object Map]", c = "[object Object]", l = "[object Promise]", u = "[object Set]", f = "[object WeakMap]", h = "[object DataView]", d = a(r), m = 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(T) {
|
|
1181
|
+
var P = i(T), g = P == c ? T.constructor : void 0, C = g ? a(g) : "";
|
|
1182
1182
|
if (C)
|
|
1183
1183
|
switch (C) {
|
|
1184
|
-
case
|
|
1185
|
-
return
|
|
1184
|
+
case d:
|
|
1185
|
+
return h;
|
|
1186
1186
|
case m:
|
|
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
1195
|
return P;
|
|
@@ -1199,26 +1199,26 @@ 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 m(E,
|
|
1204
|
-
var
|
|
1205
|
-
R = R == l ? f : R,
|
|
1206
|
-
var A = R == f, p =
|
|
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 m(E, y, _, S, T, P) {
|
|
1204
|
+
var g = i(E), C = i(y), R = g ? u : s(E), v = C ? u : s(y);
|
|
1205
|
+
R = R == l ? f : R, v = v == l ? f : v;
|
|
1206
|
+
var A = R == f, p = v == f, k = R == v;
|
|
1207
1207
|
if (k && a(E)) {
|
|
1208
|
-
if (!a(
|
|
1208
|
+
if (!a(y))
|
|
1209
1209
|
return !1;
|
|
1210
|
-
|
|
1210
|
+
g = !0, A = !1;
|
|
1211
1211
|
}
|
|
1212
1212
|
if (k && !A)
|
|
1213
|
-
return P || (P = new r()),
|
|
1214
|
-
if (!(
|
|
1215
|
-
var I = A &&
|
|
1213
|
+
return P || (P = new r()), g || o(E) ? e(E, y, _, S, T, P) : t(E, y, R, _, S, T, P);
|
|
1214
|
+
if (!(_ & c)) {
|
|
1215
|
+
var I = A && d.call(E, "__wrapped__"), b = p && d.call(y, "__wrapped__");
|
|
1216
1216
|
if (I || b) {
|
|
1217
|
-
var w = I ? E.value() : E, O = b ?
|
|
1218
|
-
return P || (P = new r()), T(w, O,
|
|
1217
|
+
var w = I ? E.value() : E, O = b ? y.value() : y;
|
|
1218
|
+
return P || (P = new r()), T(w, O, _, S, P);
|
|
1219
1219
|
}
|
|
1220
1220
|
}
|
|
1221
|
-
return k ? (P || (P = new r()), n(E,
|
|
1221
|
+
return k ? (P || (P = new r()), n(E, y, _, S, T, P)) : !1;
|
|
1222
1222
|
}
|
|
1223
1223
|
return Ti = m, Ti;
|
|
1224
1224
|
}
|
|
@@ -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
|
|
1248
|
+
let f = !0, h = "";
|
|
1249
|
+
const d = u?.filter((m) => n === m.userRole);
|
|
1250
|
+
return d?.length && !d.some((m) => m.recordRole === s) ? (h = `User ${n} does not have write access to record with role ${s}`, f = !1, f) : (u?.forEach((m) => {
|
|
1251
1251
|
n === m.userRole && m.recordRole;
|
|
1252
|
-
}),
|
|
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,8 +1262,8 @@ 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");
|
|
@@ -1271,17 +1271,17 @@ const _y = /* @__PURE__ */ In(gy), vy = (r, e, t, n, s, i, a, o, c) => {
|
|
|
1271
1271
|
for (const e in r)
|
|
1272
1272
|
Object.prototype.hasOwnProperty.call(r, e) && (sr(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(
|
|
1274
|
+
const { labels: u, fields: f } = n, h = a?.collections?.[u.collection], d = { ...e, ...r };
|
|
1275
|
+
tr(d);
|
|
1276
1276
|
let m = !0, E = "";
|
|
1277
|
-
if (i && !
|
|
1277
|
+
if (i && !h)
|
|
1278
1278
|
throw new Error("PERMISSION_DENIED");
|
|
1279
|
-
i && !vt("Update",
|
|
1279
|
+
i && !vt("Update", h) && (m = !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)) && (m = !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}`, m = !1), _ !== void 0 && !_p(y, a) && (E = `Authenticated user does not have Update access to field ${y.name}`, m = !1);
|
|
1285
1285
|
}
|
|
1286
1286
|
if (!m)
|
|
1287
1287
|
throw E && console.error(`PERMISSION_DENIED: ${E}`), new Error("PERMISSION_DENIED");
|
|
@@ -1398,8 +1398,8 @@ 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
|
})(Tr, Tr.exports)), Tr.exports;
|
|
@@ -1495,8 +1495,8 @@ function Iy() {
|
|
|
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 =
|
|
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(), m = Fy();
|
|
1593
|
+
function E(y, _, S, T, P, g, C) {
|
|
1594
|
+
var R = d(y, S), v = d(_, S), A = C.get(v);
|
|
1595
1595
|
if (A) {
|
|
1596
|
-
r(
|
|
1596
|
+
r(y, S, A);
|
|
1597
1597
|
return;
|
|
1598
1598
|
}
|
|
1599
|
-
var p =
|
|
1599
|
+
var p = g ? g(R, v, S + "", y, _, C) : void 0, k = p === void 0;
|
|
1600
1600
|
if (k) {
|
|
1601
|
-
var I = a(
|
|
1602
|
-
p =
|
|
1601
|
+
var I = a(v), b = !I && c(v), w = !I && !b && h(v);
|
|
1602
|
+
p = v, I || b || w ? a(R) ? p = R : o(R) ? p = n(R) : b ? (k = !1, p = e(v, !0)) : w ? (k = !1, p = t(v, !0)) : p = [] : f(v) || i(v) ? (p = R, i(R) ? p = m(R) : (!u(R) || l(R)) && (p = s(v))) : k = !1;
|
|
1603
1603
|
}
|
|
1604
|
-
k && (C.set(
|
|
1604
|
+
k && (C.set(v, p), P(p, v, T, g, C), C.delete(v)), r(y, S, p);
|
|
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, m, u, o, f,
|
|
1613
|
+
function o(c, l, u, f, h) {
|
|
1614
|
+
c !== l && t(l, function(d, m) {
|
|
1615
|
+
if (h || (h = new r()), s(d))
|
|
1616
|
+
n(c, l, m, u, o, f, h);
|
|
1617
1617
|
else {
|
|
1618
|
-
var E = f ? f(a(c, m),
|
|
1619
|
-
E === void 0 && (E =
|
|
1618
|
+
var E = f ? f(a(c, m), d, m + "", c, l, h) : void 0;
|
|
1619
|
+
E === void 0 && (E = d), e(c, m, E);
|
|
1620
1620
|
}
|
|
1621
1621
|
}, i);
|
|
1622
1622
|
}
|
|
@@ -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,
|
|
1909
|
+
for (var u = -1, f = o.length, h = f - 1, d = a; d != null && ++u < f; ) {
|
|
1910
1910
|
var m = s(o[u]), E = c;
|
|
1911
1911
|
if (m === "__proto__" || m === "constructor" || m === "prototype")
|
|
1912
1912
|
return a;
|
|
1913
|
-
if (u !=
|
|
1914
|
-
var
|
|
1915
|
-
E = l ? l(
|
|
1913
|
+
if (u != h) {
|
|
1914
|
+
var y = d[m];
|
|
1915
|
+
E = l ? l(y, m, d) : void 0, E === void 0 && (E = n(y) ? y : t(o[u + 1]) ? [] : {});
|
|
1916
1916
|
}
|
|
1917
|
-
r(
|
|
1917
|
+
r(d, m, E), d = d[m];
|
|
1918
1918
|
}
|
|
1919
1919
|
return a;
|
|
1920
1920
|
}
|
|
@@ -1966,12 +1966,12 @@ const ag = /* @__PURE__ */ In(ig), Fr = {
|
|
|
1966
1966
|
if (c && (l = await ve(o, t)), l) {
|
|
1967
1967
|
let u = Fr;
|
|
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
1977
|
Gy(Fr, f);
|
|
@@ -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
|
});
|
|
@@ -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
|
}
|
|
@@ -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 m =
|
|
5405
|
-
return
|
|
5403
|
+
let d = +t;
|
|
5404
|
+
const m = d % 1e3;
|
|
5405
|
+
return d -= m >= 0 ? m : 1e3 + m, (h - d) / (60 * 1e3);
|
|
5406
5406
|
}
|
|
5407
5407
|
/**
|
|
5408
5408
|
* Return whether this Zone is equal to another zone
|
|
@@ -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";
|
|
@@ -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) {
|
|
@@ -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
|
-
m ? { weekday:
|
|
6547
|
+
const n = this.loc.listingMode() === "en", s = this.loc.outputCalendar && this.loc.outputCalendar !== "gregory", i = (d, m) => this.loc.extract(e, d, m), 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, m) => n ? x_(e, d) : i(m ? { month: d } : { month: d, day: "numeric" }, "month"), l = (d, m) => n ? I_(e, d) : i(
|
|
6548
|
+
m ? { weekday: d } : { weekday: d, month: "long", day: "numeric" },
|
|
6549
6549
|
"weekday"
|
|
6550
|
-
), u = (
|
|
6551
|
-
const m = Fe.macroTokenToFormatOpts(
|
|
6552
|
-
return m ? this.formatWithSystemDefault(e, m) :
|
|
6553
|
-
}, f = (
|
|
6554
|
-
switch (
|
|
6550
|
+
), u = (d) => {
|
|
6551
|
+
const m = Fe.macroTokenToFormatOpts(d);
|
|
6552
|
+
return m ? this.formatWithSystemDefault(e, m) : 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 m = f.isNegativeDuration &&
|
|
6720
|
+
}, i = (u, f) => (h) => {
|
|
6721
|
+
const d = s(h);
|
|
6722
|
+
if (d) {
|
|
6723
|
+
const m = 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) * m, 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,
|
|
@@ -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, m = !1) => d !== void 0 && (m || 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();
|
|
@@ -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,
|
|
@@ -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
|
|
@@ -9069,31 +9069,31 @@ class B {
|
|
|
9069
9069
|
const n = kt(t.zone, Ee.defaultZone);
|
|
9070
9070
|
if (!n.isValid)
|
|
9071
9071
|
return B.invalid(Ar(n));
|
|
9072
|
-
const s = he.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),
|
|
9073
|
-
if ((
|
|
9072
|
+
const s = he.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, m = i.weekYear || i.weekNumber;
|
|
9073
|
+
if ((d || u) && m)
|
|
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 = m || i.weekday && !
|
|
9080
|
-
let
|
|
9081
|
-
E ? (
|
|
9079
|
+
const E = m || 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
9082
|
let T = !1;
|
|
9083
|
-
for (const p of
|
|
9083
|
+
for (const p of y) {
|
|
9084
9084
|
const k = i[p];
|
|
9085
|
-
J(k) ? T ? i[p] =
|
|
9085
|
+
J(k) ? T ? i[p] = _[p] : i[p] = S[p] : T = !0;
|
|
9086
9086
|
}
|
|
9087
|
-
const P = E ? y_(i, a, o) : u ? g_(i) : Nh(i),
|
|
9088
|
-
if (
|
|
9089
|
-
return B.invalid(
|
|
9090
|
-
const C = E ? If(i, a, o) : u ? xf(i) : i, [R,
|
|
9087
|
+
const P = E ? y_(i, a, o) : u ? g_(i) : Nh(i), g = P || Fh(i);
|
|
9088
|
+
if (g)
|
|
9089
|
+
return B.invalid(g);
|
|
9090
|
+
const C = E ? If(i, a, o) : u ? xf(i) : i, [R, v] = cn(C, l, n), A = 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 !== A.weekday ? B.invalid(
|
|
9097
9097
|
"mismatched weekday",
|
|
9098
9098
|
`you can't specify both a weekday of ${i.weekday} and a date of ${A.toISO()}`
|
|
9099
9099
|
) : A.isValid ? A : B.invalid(A.invalid);
|
|
@@ -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
|
|
@@ -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, m, E, y, _, S, T, P) => {
|
|
10490
|
+
const { fields: g } = a;
|
|
10491
|
+
g.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 A = fg(
|
|
10499
|
-
s[
|
|
10496
|
+
}), g.forEach((v) => {
|
|
10497
|
+
if (cg(v, a, i)) {
|
|
10498
|
+
const A = fg(v, a, i), p = {};
|
|
10499
|
+
s[v.name] !== void 0 && (p[v.name] = s[v.name], _e(v) && (p[`${v.name}_Array`] = s[`${v.name}_Array`])), A.forEach((k) => {
|
|
10500
10500
|
s[k.name] !== void 0 && (_e(k) ? p[`${k.name}_Array`] = s[`${k.name}_Array`] : p[k.name] = s[k.name]);
|
|
10501
|
-
}), Object.keys(p).length > 0 && (r === "create" && (p.Collection_Path = t, p.Collection_Path_String = t.join("/"), e.set(
|
|
10501
|
+
}), Object.keys(p).length > 0 && (r === "create" && (p.Collection_Path = t, p.Collection_Path_String = t.join("/"), e.set(h(v), p)), r === "update" && e.update(h(v), p), r === "delete" && e.delete(h(v)));
|
|
10502
10502
|
}
|
|
10503
10503
|
});
|
|
10504
10504
|
const C = c[a.labels.collection];
|
|
10505
|
-
for (const
|
|
10506
|
-
const A = dg(
|
|
10505
|
+
for (const v of C) {
|
|
10506
|
+
const A = dg(v, a), p = { ...s };
|
|
10507
10507
|
A.forEach((k) => {
|
|
10508
10508
|
delete p[k.name], delete p[`${k.name}_Array`], delete p[`${k.name}_Single`], delete p[`${k.name}_Lowercase`];
|
|
10509
|
-
}), Object.keys(p).length > 0 && (r === "create" && (p.Collection_Path ||= t, p.Collection_Path_String = t.join("/"), e.set(m(
|
|
10509
|
+
}), Object.keys(p).length > 0 && (r === "create" && (p.Collection_Path ||= t, p.Collection_Path_String = t.join("/"), e.set(m(v.key), p)), r === "update" && e.update(m(v.key), p), r === "delete" && e.delete(m(v.key)));
|
|
10510
10510
|
}
|
|
10511
10511
|
if (r === "delete")
|
|
10512
10512
|
return;
|
|
10513
|
-
const R =
|
|
10513
|
+
const R = g.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,11 +10639,11 @@ 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
|
|
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]", m = "[object DataView]", E = "[object Float32Array]", y = "[object Float64Array]", _ = "[object Int8Array]", S = "[object Int16Array]", T = "[object Int32Array]", P = "[object Uint8Array]", g = "[object Uint8ClampedArray]", C = "[object Uint16Array]", R = "[object Uint32Array]";
|
|
10643
|
+
function v(A, p, k) {
|
|
10644
10644
|
var I = A.constructor;
|
|
10645
10645
|
switch (p) {
|
|
10646
|
-
case
|
|
10646
|
+
case d:
|
|
10647
10647
|
return r(A);
|
|
10648
10648
|
case i:
|
|
10649
10649
|
case a:
|
|
@@ -10651,12 +10651,12 @@ function Qv() {
|
|
|
10651
10651
|
case m:
|
|
10652
10652
|
return e(A, k);
|
|
10653
10653
|
case E:
|
|
10654
|
-
case
|
|
10655
|
-
case
|
|
10654
|
+
case y:
|
|
10655
|
+
case _:
|
|
10656
10656
|
case S:
|
|
10657
10657
|
case T:
|
|
10658
10658
|
case P:
|
|
10659
|
-
case
|
|
10659
|
+
case g:
|
|
10660
10660
|
case C:
|
|
10661
10661
|
case R:
|
|
10662
10662
|
return s(A, k);
|
|
@@ -10669,11 +10669,11 @@ function Qv() {
|
|
|
10669
10669
|
return t(A);
|
|
10670
10670
|
case u:
|
|
10671
10671
|
return new I();
|
|
10672
|
-
case
|
|
10672
|
+
case h:
|
|
10673
10673
|
return n(A);
|
|
10674
10674
|
}
|
|
10675
10675
|
}
|
|
10676
|
-
return Ua =
|
|
10676
|
+
return Ua = v, Ua;
|
|
10677
10677
|
}
|
|
10678
10678
|
var Va, ld;
|
|
10679
10679
|
function Xv() {
|
|
@@ -10713,21 +10713,21 @@ 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(),
|
|
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(), m = Gd(), E = Dt(), y = Mn(), _ = ew(), S = wt(), T = rw(), P = Vo(), g = Br(), C = 1, R = 2, v = 4, A = "[object Arguments]", p = "[object Array]", k = "[object Boolean]", I = "[object Date]", b = "[object Error]", w = "[object Function]", O = "[object GeneratorFunction]", x = "[object Map]", M = "[object Number]", D = "[object Object]", q = "[object RegExp]", z = "[object Set]", ee = "[object String]", oe = "[object Symbol]", F = "[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
10717
|
Z[A] = Z[p] = Z[te] = Z[ne] = Z[k] = Z[I] = Z[Me] = Z[Se] = Z[Le] = Z[Ot] = Z[G] = Z[x] = Z[M] = Z[D] = Z[q] = Z[z] = Z[ee] = Z[oe] = Z[K] = Z[j] = Z[Y] = Z[U] = !0, Z[b] = Z[w] = Z[F] = !1;
|
|
10718
|
-
function Te(H, ge, se, Xe, ut,
|
|
10719
|
-
var xe, vr = ge & C, Re = ge & R, wr = ge &
|
|
10720
|
-
if (se && (xe = ut ? se(H, Xe, ut,
|
|
10718
|
+
function Te(H, ge, se, Xe, ut, Be) {
|
|
10719
|
+
var xe, vr = ge & C, Re = ge & R, wr = 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), !vr)
|
|
10727
10727
|
return a(H, xe);
|
|
10728
10728
|
} else {
|
|
10729
10729
|
var Ht = f(H), vc = Ht == w || Ht == O;
|
|
10730
|
-
if (
|
|
10730
|
+
if (y(H))
|
|
10731
10731
|
return i(H, vr);
|
|
10732
10732
|
if (Ht == D || Ht == A || vc && !ut) {
|
|
10733
10733
|
if (xe = Re || vc ? {} : m(H), !vr)
|
|
@@ -10735,21 +10735,21 @@ function nw() {
|
|
|
10735
10735
|
} else {
|
|
10736
10736
|
if (!Z[Ht])
|
|
10737
10737
|
return ut ? H : {};
|
|
10738
|
-
xe =
|
|
10738
|
+
xe = d(H, Ht, vr);
|
|
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), T(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 = wr ? Re ? u : l : Re ?
|
|
10750
|
+
var Im = wr ? Re ? u : l : Re ? g : P, 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,13 +10851,13 @@ 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 m =
|
|
10860
|
+
const m = d && vt("Read", d), E = kn(c, i, a), y = Rd(c, a), _ = xo(c, a), S = Cd(c, i, a), T = (w = []) => {
|
|
10861
10861
|
const O = [];
|
|
10862
10862
|
if (m)
|
|
10863
10863
|
O.push(me(qr(n, "tenants", s, "system_fields", l.collection, `${l.collection}-${e.key}`), ye("Collection_Path_String", "==", r.join("/")), ...w));
|
|
@@ -10865,12 +10865,12 @@ const we = /* @__PURE__ */ In(iw), Nt = (r) => {
|
|
|
10865
10865
|
for (const x of E)
|
|
10866
10866
|
O.push(me(qr(n, "tenants", s, "system_fields", l.collection, `${l.collection}-${x.field}`), ye("Collection_Path_String", "==", r.join("/")), ...w));
|
|
10867
10867
|
return O;
|
|
10868
|
-
}, P =
|
|
10869
|
-
if (t || P.length === 0 &&
|
|
10868
|
+
}, P = y.filter((w) => "operations" in w && w.operations ? w.operations.includes("Read") : !0);
|
|
10869
|
+
if (t || P.length === 0 && _.length === 0 && S.length === 0)
|
|
10870
10870
|
return T();
|
|
10871
|
-
let
|
|
10871
|
+
let g = 0;
|
|
10872
10872
|
const C = (w) => {
|
|
10873
|
-
w && (
|
|
10873
|
+
w && (g === 0 ? g = w : g *= w);
|
|
10874
10874
|
};
|
|
10875
10875
|
if (P) {
|
|
10876
10876
|
for (const w of P)
|
|
@@ -10882,9 +10882,9 @@ const we = /* @__PURE__ */ In(iw), Nt = (r) => {
|
|
|
10882
10882
|
}
|
|
10883
10883
|
}
|
|
10884
10884
|
f?.roles.includes(a.Role) && f.range && C(f.range.fields.length);
|
|
10885
|
-
const R =
|
|
10885
|
+
const R = h.admin?.statusField;
|
|
10886
10886
|
R && !f?.roles.includes(a.Role) && C(Math.max(R.active?.length || 0, R.archived?.length || 0));
|
|
10887
|
-
const
|
|
10887
|
+
const v = g === 0 ? 30 : Math.max(1, Math.floor(30 / g)), A = [];
|
|
10888
10888
|
P.filter((w) => w.type === "Record_Owner").forEach(() => A.push(ye("Created_By", "==", a.User_ID))), P.filter((w) => w.type === "Record_User").forEach((w) => {
|
|
10889
10889
|
if ("collectionField" in w) {
|
|
10890
10890
|
const O = re(u, w.collectionField);
|
|
@@ -10900,10 +10900,10 @@ const we = /* @__PURE__ */ In(iw), Nt = (r) => {
|
|
|
10900
10900
|
}
|
|
10901
10901
|
});
|
|
10902
10902
|
const p = [];
|
|
10903
|
-
|
|
10904
|
-
const O =
|
|
10903
|
+
_.filter((w) => w.type === "Individual").forEach((w) => {
|
|
10904
|
+
const O = d?.individualEntities, x = [];
|
|
10905
10905
|
if (O) {
|
|
10906
|
-
const M = w.singleQuery ? w.singleQuery :
|
|
10906
|
+
const M = w.singleQuery ? w.singleQuery : v;
|
|
10907
10907
|
for (let D = 0; D < O.length; D += M) {
|
|
10908
10908
|
const q = O.slice(D, D + M);
|
|
10909
10909
|
x.push(q);
|
|
@@ -10928,7 +10928,7 @@ const we = /* @__PURE__ */ In(iw), Nt = (r) => {
|
|
|
10928
10928
|
throw new Error("PERMISSION_DENIED");
|
|
10929
10929
|
const q = D?.individualEntities, z = [];
|
|
10930
10930
|
if (q) {
|
|
10931
|
-
const ee = x.singleQuery ? x.singleQuery :
|
|
10931
|
+
const ee = x.singleQuery ? x.singleQuery : v;
|
|
10932
10932
|
for (let oe = 0; oe < q.length; oe += ee) {
|
|
10933
10933
|
const F = q.slice(oe, oe + ee);
|
|
10934
10934
|
z.push(F);
|
|
@@ -10947,13 +10947,13 @@ const we = /* @__PURE__ */ In(iw), Nt = (r) => {
|
|
|
10947
10947
|
}
|
|
10948
10948
|
});
|
|
10949
10949
|
const k = [];
|
|
10950
|
-
|
|
10950
|
+
_.filter((w) => w.type === "Parent").forEach((w) => {
|
|
10951
10951
|
if ("collectionField" in w) {
|
|
10952
10952
|
const O = re(u, w.collectionField);
|
|
10953
10953
|
if ("collection" in O) {
|
|
10954
|
-
const x =
|
|
10954
|
+
const x = d?.parentEntities, M = [];
|
|
10955
10955
|
if (x) {
|
|
10956
|
-
const D = w.singleQuery ? w.singleQuery :
|
|
10956
|
+
const D = w.singleQuery ? w.singleQuery : v;
|
|
10957
10957
|
for (let q = 0; q < x.length; q += D) {
|
|
10958
10958
|
const z = x.slice(q, q + D);
|
|
10959
10959
|
M.push(z);
|
|
@@ -10980,7 +10980,7 @@ const we = /* @__PURE__ */ In(iw), Nt = (r) => {
|
|
|
10980
10980
|
throw new Error("PERMISSION_DENIED");
|
|
10981
10981
|
const z = q.parentEntities, ee = [];
|
|
10982
10982
|
if (z) {
|
|
10983
|
-
const oe = x.singleQuery ? x.singleQuery :
|
|
10983
|
+
const oe = x.singleQuery ? x.singleQuery : v;
|
|
10984
10984
|
for (let F = 0; F < z.length; F += oe) {
|
|
10985
10985
|
const te = z.slice(F, F + oe);
|
|
10986
10986
|
ee.push(te);
|
|
@@ -10999,16 +10999,16 @@ const we = /* @__PURE__ */ In(iw), Nt = (r) => {
|
|
|
10999
10999
|
}
|
|
11000
11000
|
});
|
|
11001
11001
|
const I = [];
|
|
11002
|
-
k.length === 0 && (
|
|
11002
|
+
k.length === 0 && (_.filter((w) => w.type === "Parent_Property").forEach((w) => {
|
|
11003
11003
|
if ("collectionField" in w && "propertyField" in w) {
|
|
11004
11004
|
const O = re(u, w.collectionField), x = re(u, w.propertyField);
|
|
11005
11005
|
if ("collection" in O) {
|
|
11006
|
-
const M =
|
|
11006
|
+
const M = d?.parentPropertyEntities || {};
|
|
11007
11007
|
Object.entries(M).forEach(([D, q]) => {
|
|
11008
11008
|
if (q.length > 0) {
|
|
11009
11009
|
const z = [];
|
|
11010
|
-
for (let ee = 0; ee < q.length; ee +=
|
|
11011
|
-
const oe = q.slice(ee, ee +
|
|
11010
|
+
for (let ee = 0; ee < q.length; ee += v) {
|
|
11011
|
+
const oe = q.slice(ee, ee + v);
|
|
11012
11012
|
z.push(oe);
|
|
11013
11013
|
}
|
|
11014
11014
|
z.forEach((ee) => {
|
|
@@ -11033,8 +11033,8 @@ const we = /* @__PURE__ */ In(iw), Nt = (r) => {
|
|
|
11033
11033
|
Object.entries(z).forEach(([ee, oe]) => {
|
|
11034
11034
|
if (oe.length > 0) {
|
|
11035
11035
|
const F = [];
|
|
11036
|
-
for (let te = 0; te < oe.length; te +=
|
|
11037
|
-
const ne = oe.slice(te, te +
|
|
11036
|
+
for (let te = 0; te < oe.length; te += v) {
|
|
11037
|
+
const ne = oe.slice(te, te + v);
|
|
11038
11038
|
F.push(ne);
|
|
11039
11039
|
}
|
|
11040
11040
|
F.forEach((te) => {
|
|
@@ -11049,7 +11049,7 @@ const we = /* @__PURE__ */ In(iw), Nt = (r) => {
|
|
|
11049
11049
|
}
|
|
11050
11050
|
}));
|
|
11051
11051
|
const b = [...p, ...k, ...I];
|
|
11052
|
-
return !
|
|
11052
|
+
return !_.length && !S.length ? T(A) : b;
|
|
11053
11053
|
}, fm = {}, Ir = {}, Zw = async (r) => {
|
|
11054
11054
|
for (const s of Object.keys(Ir))
|
|
11055
11055
|
delete Ir[s];
|
|
@@ -11083,22 +11083,22 @@ const we = /* @__PURE__ */ In(iw), Nt = (r) => {
|
|
|
11083
11083
|
"custom",
|
|
11084
11084
|
"preloadCacheOrQueries"
|
|
11085
11085
|
]), t ||= i.range;
|
|
11086
|
-
const
|
|
11086
|
+
const h = oc([s.collection], o).map((m) => {
|
|
11087
11087
|
if (t) {
|
|
11088
|
-
const { start: E, end:
|
|
11089
|
-
m = me(m, Rc(...
|
|
11088
|
+
const { start: E, end: y } = aw(t), _ = t.fields.filter((T) => !t.ranges?.some((P) => P.includes(T))).map((T) => Xr(ye(T, ">=", E), ye(T, "<=", y))), S = t.ranges?.map((T) => Xr(ye(T[0], "<=", y), ye(T[1], ">=", E)));
|
|
11089
|
+
m = me(m, Rc(..._, ...S || []));
|
|
11090
11090
|
}
|
|
11091
11091
|
return n && (m = me(m, Xr(Rc(...n.map((E) => ye(...E)))))), e && (m = me(m, Xr(...e.map((E) => ye(...E))))), m;
|
|
11092
|
-
}),
|
|
11092
|
+
}), d = /* @__PURE__ */ new Map();
|
|
11093
11093
|
return new Promise((m, E) => {
|
|
11094
|
-
if (
|
|
11094
|
+
if (h.length === 0) {
|
|
11095
11095
|
m({});
|
|
11096
11096
|
return;
|
|
11097
11097
|
}
|
|
11098
|
-
|
|
11099
|
-
let
|
|
11100
|
-
const S = dr(
|
|
11101
|
-
(!T.metadata.fromCache ||
|
|
11098
|
+
h.forEach((y) => {
|
|
11099
|
+
let _ = !1;
|
|
11100
|
+
const S = dr(y, { includeMetadataChanges: !0 }, (T) => {
|
|
11101
|
+
(!T.metadata.fromCache || _) && (_ || (_ = !0, d.set(y, !0), d.size === h.length && m({})));
|
|
11102
11102
|
}, (T) => {
|
|
11103
11103
|
console.error(T), E(T);
|
|
11104
11104
|
});
|
|
@@ -11106,7 +11106,7 @@ const we = /* @__PURE__ */ In(iw), Nt = (r) => {
|
|
|
11106
11106
|
});
|
|
11107
11107
|
});
|
|
11108
11108
|
}, Mr = async (r, e, t, n, s) => {
|
|
11109
|
-
const i =
|
|
11109
|
+
const i = Ve(), a = De();
|
|
11110
11110
|
if (!a?.Role)
|
|
11111
11111
|
throw new Error("PERMISSION_DENIED");
|
|
11112
11112
|
const o = i.collections[r], { labels: c, preloadCache: l } = o, u = To();
|
|
@@ -11118,61 +11118,62 @@ const we = /* @__PURE__ */ In(iw), Nt = (r) => {
|
|
|
11118
11118
|
return;
|
|
11119
11119
|
}
|
|
11120
11120
|
u[c.collection] = "Loading";
|
|
11121
|
-
const
|
|
11122
|
-
document.dispatchEvent(
|
|
11121
|
+
const h = new Event(`stoker:loading:${r}`);
|
|
11122
|
+
document.dispatchEvent(h);
|
|
11123
11123
|
try {
|
|
11124
11124
|
if (await uw(o, e, t, n), l?.relationCollections && await ve(l.relationCollections)) {
|
|
11125
11125
|
const E = jt(o, i, a);
|
|
11126
|
-
for (const
|
|
11127
|
-
if (!s?.[
|
|
11128
|
-
if (!i.collections[
|
|
11126
|
+
for (const y of E)
|
|
11127
|
+
if (!s?.[y]) {
|
|
11128
|
+
if (!i.collections[y].preloadCache?.roles.includes(a.Role))
|
|
11129
11129
|
continue;
|
|
11130
|
-
const S = To()[
|
|
11130
|
+
const S = To()[y];
|
|
11131
11131
|
if (S === "Loading" || S === "Loaded" || S === "Error")
|
|
11132
11132
|
continue;
|
|
11133
|
-
S || await Mr(
|
|
11133
|
+
S || await Mr(y, void 0, void 0, void 0, s);
|
|
11134
11134
|
}
|
|
11135
11135
|
}
|
|
11136
11136
|
u[c.collection] = "Loaded";
|
|
11137
|
-
const
|
|
11138
|
-
document.dispatchEvent(
|
|
11139
|
-
} catch (
|
|
11140
|
-
throw u[c.collection] = "Error",
|
|
11137
|
+
const d = new Event(`stoker:loaded:${r}`);
|
|
11138
|
+
document.dispatchEvent(d);
|
|
11139
|
+
} catch (d) {
|
|
11140
|
+
throw u[c.collection] = "Error", d;
|
|
11141
11141
|
}
|
|
11142
11142
|
};
|
|
11143
11143
|
let $t = null;
|
|
11144
11144
|
const fw = async (r, e) => {
|
|
11145
|
-
const t = [], n = Mt(), s =
|
|
11145
|
+
const t = [], n = Mt(), s = We(), i = Ie(), a = Ve();
|
|
11146
11146
|
if (!e.claims.doc)
|
|
11147
11147
|
throw new Error("User document ID not found in claims");
|
|
11148
|
-
let
|
|
11149
|
-
return await new Promise((
|
|
11150
|
-
const
|
|
11148
|
+
let o = !1, c = null;
|
|
11149
|
+
return await new Promise((u, f) => {
|
|
11150
|
+
const h = dr(ke(s, "tenants", n, "system_user_permissions", r.uid), (d) => {
|
|
11151
11151
|
if (d.exists()) {
|
|
11152
11152
|
if ($t = d.data(), $t.User_ID = d.id, !$t.Role)
|
|
11153
11153
|
throw new Error("PERMISSION_DENIED");
|
|
11154
|
-
if (!
|
|
11155
|
-
|
|
11154
|
+
if (!o)
|
|
11155
|
+
o = !0, u();
|
|
11156
11156
|
else {
|
|
11157
|
-
const
|
|
11158
|
-
if (document.dispatchEvent(
|
|
11157
|
+
const m = new Event("stoker:permissionsChange");
|
|
11158
|
+
if (document.dispatchEvent(m), i.auth.signOutOnPermissionsChange)
|
|
11159
11159
|
Em();
|
|
11160
11160
|
else {
|
|
11161
|
-
const
|
|
11162
|
-
if (
|
|
11163
|
-
for (const [
|
|
11164
|
-
|
|
11165
|
-
|
|
11166
|
-
!
|
|
11161
|
+
const E = $t.collections;
|
|
11162
|
+
if (E)
|
|
11163
|
+
for (const [y, _] of Object.entries(E))
|
|
11164
|
+
// eslint-disable-next-line security/detect-object-injection
|
|
11165
|
+
a.collections[y] && c && // eslint-disable-next-line security/detect-object-injection
|
|
11166
|
+
(!c.collections?.[y] || // eslint-disable-next-line security/detect-object-injection
|
|
11167
|
+
!_y(_, c.collections[y])) && Mr(y);
|
|
11167
11168
|
}
|
|
11168
11169
|
}
|
|
11169
|
-
|
|
11170
|
+
c = $t;
|
|
11170
11171
|
} else
|
|
11171
|
-
|
|
11172
|
+
f(new Error("Permissions not found"));
|
|
11172
11173
|
}, (d) => {
|
|
11173
|
-
|
|
11174
|
+
f(new Error(`Error getting permissions for user ${r.uid}`, { cause: d }));
|
|
11174
11175
|
});
|
|
11175
|
-
t.push(
|
|
11176
|
+
t.push(h);
|
|
11176
11177
|
}), t;
|
|
11177
11178
|
}, De = () => $t, dw = () => {
|
|
11178
11179
|
$t = null;
|
|
@@ -11180,8 +11181,8 @@ const fw = async (r, e) => {
|
|
|
11180
11181
|
if (typeof r == "object")
|
|
11181
11182
|
for (const e in r)
|
|
11182
11183
|
Object.prototype.hasOwnProperty.call(r, e) && (sr(r[e]) ? r[e] = "_DELETE_FIELD" : cc(r[e]));
|
|
11183
|
-
},
|
|
11184
|
-
const l = Mt(), { labels: u } = i, f = Ie(),
|
|
11184
|
+
}, Ye = async (r, e, t, n, s, i, a, o, c) => {
|
|
11185
|
+
const l = Mt(), { labels: u } = i, f = Ie(), h = gc(), d = await ie(f, ["global", "firebase", "writeLogTTL"]), m = {
|
|
11185
11186
|
operation: r,
|
|
11186
11187
|
collection: u.collection,
|
|
11187
11188
|
docId: s,
|
|
@@ -11195,18 +11196,18 @@ const fw = async (r, e) => {
|
|
|
11195
11196
|
Last_Write_Version: t.Last_Write_Version,
|
|
11196
11197
|
data: {}
|
|
11197
11198
|
};
|
|
11198
|
-
if (
|
|
11199
|
-
const S = /* @__PURE__ */ new Date(), T = new Date((/* @__PURE__ */ new Date()).setDate(S.getDate() +
|
|
11199
|
+
if (d) {
|
|
11200
|
+
const S = /* @__PURE__ */ new Date(), T = new Date((/* @__PURE__ */ new Date()).setDate(S.getDate() + d));
|
|
11200
11201
|
m.TTL = Bt.fromDate(T);
|
|
11201
11202
|
}
|
|
11202
11203
|
const E = we(t);
|
|
11203
11204
|
r !== "delete" && (m.data.data = E, e === "written" && cc(m.data.data)), r !== "delete" && e !== "written" && tr(E), r === "update" && (m.data.originalRecord = we(c)), r !== "delete" && ["started", "written"].includes(e) && (delete m.data.data.Saved_At, delete m.data.data.Last_Save_At), e === "failed" && (m.data.error = JSON.stringify(o));
|
|
11204
|
-
const
|
|
11205
|
-
Gm(
|
|
11205
|
+
const y = t.Last_Write_At, _ = ke(h, "tenants", l, n.join("/"), s, "system_write_log", `${a}-${y.valueOf()}`);
|
|
11206
|
+
Gm(_, m).catch((S) => {
|
|
11206
11207
|
console.error(`Error saving "${e}" ${r} log entry for record ${s} in ${u.collection} collection.`, { cause: S });
|
|
11207
11208
|
});
|
|
11208
11209
|
}, lc = async (r, e, t, n, s) => {
|
|
11209
|
-
const i = Mt(), a =
|
|
11210
|
+
const i = Mt(), a = We(), o = n.labels.collection, c = n.fields.filter((u) => "unique" in u && u.unique), l = [];
|
|
11210
11211
|
if (!s.Role)
|
|
11211
11212
|
throw new Error("No role found in permissions");
|
|
11212
11213
|
if (await Promise.all(c.map(async (u) => {
|
|
@@ -11217,27 +11218,27 @@ const fw = async (r, e) => {
|
|
|
11217
11218
|
if (!ow(f))
|
|
11218
11219
|
l.push(`${u.name} "${t[u.name]}" is invalid`);
|
|
11219
11220
|
else {
|
|
11220
|
-
const
|
|
11221
|
+
const h = await bd(ke(a, "tenants", i, "system_unique", o, `Unique-${o}-${u.name}`, f)).catch(() => {
|
|
11221
11222
|
});
|
|
11222
|
-
|
|
11223
|
+
h?.exists() && !(r === "update" && h.data().id === e) && l.push(`${u.name} "${t[u.name]}" already exists`);
|
|
11223
11224
|
}
|
|
11224
11225
|
}
|
|
11225
11226
|
})), l.length > 0)
|
|
11226
11227
|
throw new Error(l.join(", "));
|
|
11227
11228
|
}, dm = (r, e, t) => {
|
|
11228
|
-
const n =
|
|
11229
|
+
const n = We(), s = Mt(), i = Ve(), a = De(), o = r.at(-1);
|
|
11229
11230
|
if (!o)
|
|
11230
11231
|
throw new Error("EMPTY_PATH");
|
|
11231
11232
|
const c = i.collections[o], { labels: l } = c, u = a.collections?.[l.collection];
|
|
11232
11233
|
if (!a.Role)
|
|
11233
11234
|
throw new Error("PERMISSION_DENIED");
|
|
11234
|
-
const f = u && vt("Read", u),
|
|
11235
|
+
const f = u && vt("Read", u), h = kn(c, i, a), d = [];
|
|
11235
11236
|
if (f)
|
|
11236
|
-
|
|
11237
|
-
else if (
|
|
11238
|
-
for (const m of
|
|
11239
|
-
|
|
11240
|
-
return
|
|
11237
|
+
d.push(ke(n, "tenants", s, "system_fields", l.collection, `${l.collection}-${t.key}`, e));
|
|
11238
|
+
else if (h)
|
|
11239
|
+
for (const m of h)
|
|
11240
|
+
d.push(ke(n, "tenants", s, "system_fields", l.collection, `${l.collection}-${m.field}`, e));
|
|
11241
|
+
return d;
|
|
11241
11242
|
}, yd = (r) => r !== null && typeof r == "object" && !Array.isArray(r), hm = (r) => {
|
|
11242
11243
|
const e = (t) => {
|
|
11243
11244
|
Object.entries(t).forEach(([n, s]) => {
|
|
@@ -11246,7 +11247,7 @@ const fw = async (r, e) => {
|
|
|
11246
11247
|
};
|
|
11247
11248
|
e(r);
|
|
11248
11249
|
}, hw = async (r, e, t) => {
|
|
11249
|
-
const n = it(), s =
|
|
11250
|
+
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
11251
|
let c;
|
|
11251
11252
|
if (!t?.pagination)
|
|
11252
11253
|
c = await o({
|
|
@@ -11262,8 +11263,8 @@ const fw = async (r, e) => {
|
|
|
11262
11263
|
options: t,
|
|
11263
11264
|
stream: !0
|
|
11264
11265
|
});
|
|
11265
|
-
for await (const
|
|
11266
|
-
console.log(
|
|
11266
|
+
for await (const h of u)
|
|
11267
|
+
console.log(h.data.result.docs.length);
|
|
11267
11268
|
c = { data: await f };
|
|
11268
11269
|
}
|
|
11269
11270
|
const l = c.data;
|
|
@@ -11274,25 +11275,25 @@ const fw = async (r, e) => {
|
|
|
11274
11275
|
const o = De();
|
|
11275
11276
|
if (!o)
|
|
11276
11277
|
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 ${
|
|
11278
|
+
const c = e.at(-2), l = Ad(n.collections[c], n, o).map((h) => h.labels.collection);
|
|
11279
|
+
t.collections ? t.collections.forEach((h) => {
|
|
11280
|
+
if (!l.includes(h))
|
|
11281
|
+
throw new Error(`SCHEMA_ERROR: Collection ${h} not found in subcollections of ${c}`);
|
|
11281
11282
|
}) : t.collections = l;
|
|
11282
|
-
const u = t.depth - 1, f = t.collections.map(async (
|
|
11283
|
-
const
|
|
11283
|
+
const u = t.depth - 1, f = t.collections.map(async (h) => {
|
|
11284
|
+
const d = await pm([...e, h], t.constraints || [], {
|
|
11284
11285
|
only: i,
|
|
11285
11286
|
pagination: t.limit,
|
|
11286
11287
|
noEmbeddingFields: a
|
|
11287
11288
|
}).catch((m) => {
|
|
11288
|
-
throw m.code === "permission-denied" && console.info(`PERMISSION_DENIED for subcollection ${
|
|
11289
|
+
throw m.code === "permission-denied" && console.info(`PERMISSION_DENIED for subcollection ${h} for document at ${e.join("/")}`), m;
|
|
11289
11290
|
});
|
|
11290
|
-
r[
|
|
11291
|
+
r[h] = d.docs, s && await Promise.all(
|
|
11291
11292
|
// eslint-disable-next-line security/detect-object-injection
|
|
11292
|
-
r[
|
|
11293
|
+
r[h].map((m) => uc(m, [...e, h, m.id], s, n, i, a))
|
|
11293
11294
|
), u > 0 && await Promise.all(
|
|
11294
11295
|
// eslint-disable-next-line security/detect-object-injection
|
|
11295
|
-
r[
|
|
11296
|
+
r[h].map((m) => mm(m, [...e, h, m.id], { depth: u }, n, s, i, a))
|
|
11296
11297
|
);
|
|
11297
11298
|
});
|
|
11298
11299
|
await Promise.all(f);
|
|
@@ -11307,24 +11308,24 @@ const fw = async (r, e) => {
|
|
|
11307
11308
|
const f = r[u.name];
|
|
11308
11309
|
if (!f)
|
|
11309
11310
|
continue;
|
|
11310
|
-
const
|
|
11311
|
-
for (const
|
|
11312
|
-
const m = f[
|
|
11313
|
-
if (f[
|
|
11311
|
+
const h = Object.keys(f);
|
|
11312
|
+
for (const d of h) {
|
|
11313
|
+
const m = f[d], E = _r(m.Collection_Path, d, { only: s, noEmbeddingFields: i }).then((y) => {
|
|
11314
|
+
if (f[d] = y, c > 0)
|
|
11314
11315
|
return uc(
|
|
11315
11316
|
// eslint-disable-next-line security/detect-object-injection
|
|
11316
|
-
f[
|
|
11317
|
-
[...m.Collection_Path,
|
|
11317
|
+
f[d],
|
|
11318
|
+
[...m.Collection_Path, d],
|
|
11318
11319
|
{ depth: c },
|
|
11319
11320
|
n,
|
|
11320
11321
|
s,
|
|
11321
11322
|
i
|
|
11322
11323
|
);
|
|
11323
|
-
}).catch((
|
|
11324
|
-
if (
|
|
11325
|
-
delete f[
|
|
11324
|
+
}).catch((y) => {
|
|
11325
|
+
if (y.message.includes("NOT_FOUND") || y.code === "permission-denied")
|
|
11326
|
+
delete f[d];
|
|
11326
11327
|
else
|
|
11327
|
-
throw
|
|
11328
|
+
throw y;
|
|
11328
11329
|
});
|
|
11329
11330
|
l.push(E);
|
|
11330
11331
|
}
|
|
@@ -11343,17 +11344,17 @@ const fw = async (r, e) => {
|
|
|
11343
11344
|
const n = r.at(-1);
|
|
11344
11345
|
if (!n)
|
|
11345
11346
|
throw new Error("EMPTY_PATH");
|
|
11346
|
-
const s =
|
|
11347
|
-
if (!
|
|
11347
|
+
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), m = h.disabledCollections?.includes(n);
|
|
11348
|
+
if (!d || m)
|
|
11348
11349
|
throw new Error("COLLECTION_NOT_FOUND");
|
|
11349
|
-
const E = await lt(c.collection),
|
|
11350
|
+
const E = await lt(c.collection), y = await ie(h, [
|
|
11350
11351
|
"global",
|
|
11351
11352
|
"firebase",
|
|
11352
11353
|
"serverTimestampOptions"
|
|
11353
|
-
]),
|
|
11354
|
-
if (!
|
|
11354
|
+
]), _ = De();
|
|
11355
|
+
if (!_?.Role)
|
|
11355
11356
|
throw new Error("PERMISSIONS_DENIED");
|
|
11356
|
-
if (f?.includes(
|
|
11357
|
+
if (f?.includes(_.Role))
|
|
11357
11358
|
return await hw(r, e, t);
|
|
11358
11359
|
const S = oc(r, a, t?.getAll);
|
|
11359
11360
|
if (S.length === 0)
|
|
@@ -11366,29 +11367,29 @@ const fw = async (r, e) => {
|
|
|
11366
11367
|
if (t?.pagination) {
|
|
11367
11368
|
if (t.pagination.startAfter && t.pagination.endBefore)
|
|
11368
11369
|
throw new Error("INPUT_ERROR: startAfter and endBefore cannot be provided together");
|
|
11369
|
-
const b = t.pagination.startAfter || t.pagination.endBefore, w = Ud(
|
|
11370
|
+
const b = t.pagination.startAfter || t.pagination.endBefore, w = Ud(_.Role, o, s);
|
|
11370
11371
|
if (b && w !== !0)
|
|
11371
11372
|
throw new Error("INPUT_ERROR: Pagination is not allowed when using " + w);
|
|
11372
11373
|
t.pagination.orderByField && t.pagination.orderByDirection ? t.pagination.startAfter || t.pagination.endBefore ? t.pagination.startAfter ? T = T.map((O, x) => me(O, rt(t.pagination.orderByField, t.pagination.orderByDirection), eo(P.last.get(x)), Xt(t.pagination.number))) : T = T.map((O, x) => me(O, rt(t.pagination.orderByField, t.pagination.orderByDirection), to(P.first.get(x)), Nr(t.pagination.number))) : T = T.map((O) => me(O, rt(t.pagination.orderByField, t.pagination.orderByDirection), Xt(t.pagination.number))) : !t.pagination.startAfter && !t.pagination.endBefore ? T = T.map((O) => me(O, Xt(t.pagination.number))) : t.pagination.startAfter ? T = T.map((O, x) => me(O, eo(P.last.get(x)), Xt(t.pagination.number))) : T = T.map((O, x) => me(O, to(P.first.get(x)), Nr(t.pagination.number)));
|
|
11373
11374
|
}
|
|
11374
|
-
const
|
|
11375
|
-
await ce("preOperation",
|
|
11376
|
-
const
|
|
11375
|
+
const g = { collection: c.collection };
|
|
11376
|
+
await ce("preOperation", h, E, ["read", void 0, void 0, g]), await ce("preRead", h, E, [g, T, !0, !1]);
|
|
11377
|
+
const v = /* @__PURE__ */ new Map(), A = T.map(async (b) => {
|
|
11377
11378
|
let w;
|
|
11378
11379
|
return t?.only === "cache" ? w = await Od(b) : t?.only === "server" ? w = await Hm(b) : w = await Km(b), w;
|
|
11379
11380
|
}), p = await Promise.all(A);
|
|
11380
11381
|
for (const b of p) {
|
|
11381
11382
|
for (const w of b.docs) {
|
|
11382
|
-
|
|
11383
|
-
const O = w.data({ serverTimestamps:
|
|
11383
|
+
v.has(w.id) || v.set(w.id, {});
|
|
11384
|
+
const O = w.data({ serverTimestamps: y || "none" }), x = v.get(w.id);
|
|
11384
11385
|
x.id ||= w.id;
|
|
11385
11386
|
const M = { ...x, ...O };
|
|
11386
|
-
delete M.Collection_Path_String,
|
|
11387
|
+
delete M.Collection_Path_String, v.set(w.id, M);
|
|
11387
11388
|
}
|
|
11388
11389
|
P.first.set(p.indexOf(b), b.docs[0]), P.last.set(p.indexOf(b), b.docs.at(-1) || b.docs[0]);
|
|
11389
11390
|
}
|
|
11390
11391
|
let k;
|
|
11391
|
-
if (t?.pagination && !u?.roles.includes(
|
|
11392
|
+
if (t?.pagination && !u?.roles.includes(_?.Role) && !f?.includes(_?.Role)) {
|
|
11392
11393
|
let b = me(S[0], ...e || []);
|
|
11393
11394
|
t.pagination.orderByField && t.pagination.orderByDirection && (b = me(b, rt(t.pagination.orderByField, t.pagination.orderByDirection)));
|
|
11394
11395
|
const w = await Ed(b).catch(() => {
|
|
@@ -11400,11 +11401,11 @@ const fw = async (r, e) => {
|
|
|
11400
11401
|
}
|
|
11401
11402
|
let I;
|
|
11402
11403
|
t?.noComputedFields || (I = await ve(E.admin?.retriever));
|
|
11403
|
-
for (const b of
|
|
11404
|
+
for (const b of v.values()) {
|
|
11404
11405
|
const w = [], O = [...b.Collection_Path, b.id];
|
|
11405
11406
|
t?.subcollections && w.push(mm(
|
|
11406
11407
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
11407
|
-
|
|
11408
|
+
v.get(b.id),
|
|
11408
11409
|
O,
|
|
11409
11410
|
we(t.subcollections),
|
|
11410
11411
|
s,
|
|
@@ -11421,7 +11422,7 @@ const fw = async (r, e) => {
|
|
|
11421
11422
|
return q;
|
|
11422
11423
|
})), w.push(uc(
|
|
11423
11424
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
11424
|
-
|
|
11425
|
+
v.get(b.id),
|
|
11425
11426
|
O,
|
|
11426
11427
|
we(t.relations),
|
|
11427
11428
|
s,
|
|
@@ -11434,12 +11435,12 @@ const fw = async (r, e) => {
|
|
|
11434
11435
|
b[q.name] = z;
|
|
11435
11436
|
})), t?.noEmbeddingFields && q.type === "Embedding" && delete b[q.name];
|
|
11436
11437
|
await Promise.all(x);
|
|
11437
|
-
const M = ["read", b, b.id,
|
|
11438
|
-
await ce("postOperation",
|
|
11438
|
+
const M = ["read", b, b.id, g];
|
|
11439
|
+
await ce("postOperation", h, E, M), await ce("postRead", h, E, [g, S, b, !1]);
|
|
11439
11440
|
}
|
|
11440
|
-
return { cursor: P, pages: k, docs: Array.from(
|
|
11441
|
+
return { cursor: P, pages: k, docs: Array.from(v.values()) };
|
|
11441
11442
|
}, mw = async (r, e, t) => {
|
|
11442
|
-
const n = it(), s =
|
|
11443
|
+
const n = it(), s = ze(), i = Ue(n, s.STOKER_FB_FUNCTIONS_REGION), l = (await Je(i, "stoker-readapi")({
|
|
11443
11444
|
path: r,
|
|
11444
11445
|
id: e,
|
|
11445
11446
|
options: t
|
|
@@ -11455,17 +11456,17 @@ const fw = async (r, e) => {
|
|
|
11455
11456
|
throw new Error(`SCHEMA_ERROR: Collection ${f} not found in subcollections of ${o}`);
|
|
11456
11457
|
}) : t.collections = c;
|
|
11457
11458
|
const l = t.depth - 1, u = t.collections.map(async (f) => {
|
|
11458
|
-
const
|
|
11459
|
+
const h = await pm([...e, f], t.constraints || [], {
|
|
11459
11460
|
only: i,
|
|
11460
11461
|
relations: s,
|
|
11461
11462
|
pagination: t.limit
|
|
11462
|
-
}).catch((
|
|
11463
|
-
throw
|
|
11463
|
+
}).catch((d) => {
|
|
11464
|
+
throw d.code === "permission-denied" && console.info(`PERMISSION_DENIED for subcollection ${f} for document at ${e.join("/")}`), d;
|
|
11464
11465
|
});
|
|
11465
|
-
r[f] =
|
|
11466
|
+
r[f] = h.docs, l > 0 && await Promise.all(
|
|
11466
11467
|
// eslint-disable-next-line security/detect-object-injection
|
|
11467
|
-
r[f].map(async (
|
|
11468
|
-
await ym(
|
|
11468
|
+
r[f].map(async (d) => {
|
|
11469
|
+
await ym(d, [...e, f, d.id], { depth: l }, n, s, i);
|
|
11469
11470
|
})
|
|
11470
11471
|
);
|
|
11471
11472
|
});
|
|
@@ -11478,31 +11479,31 @@ const fw = async (r, e) => {
|
|
|
11478
11479
|
const l = t.depth - 1, u = [];
|
|
11479
11480
|
for (const f of t.fields)
|
|
11480
11481
|
if ("collection" in f) {
|
|
11481
|
-
const
|
|
11482
|
-
if (!
|
|
11482
|
+
const h = r[f.name];
|
|
11483
|
+
if (!h)
|
|
11483
11484
|
continue;
|
|
11484
|
-
for (const [
|
|
11485
|
-
const E = _r(m.Collection_Path,
|
|
11485
|
+
for (const [d, m] of Object.entries(h)) {
|
|
11486
|
+
const E = _r(m.Collection_Path, d, {
|
|
11486
11487
|
only: s,
|
|
11487
11488
|
noComputedFields: i,
|
|
11488
11489
|
noEmbeddingFields: a
|
|
11489
|
-
}).then((
|
|
11490
|
-
if (d
|
|
11490
|
+
}).then((y) => {
|
|
11491
|
+
if (h[d] = y, l > 0)
|
|
11491
11492
|
return gm(
|
|
11492
11493
|
// eslint-disable-next-line security/detect-object-injection
|
|
11493
|
-
d
|
|
11494
|
-
[...m.Collection_Path,
|
|
11494
|
+
h[d],
|
|
11495
|
+
[...m.Collection_Path, d],
|
|
11495
11496
|
{ depth: l },
|
|
11496
11497
|
n,
|
|
11497
11498
|
s,
|
|
11498
11499
|
i,
|
|
11499
11500
|
a
|
|
11500
11501
|
);
|
|
11501
|
-
}).catch((
|
|
11502
|
-
if (
|
|
11503
|
-
delete d
|
|
11502
|
+
}).catch((y) => {
|
|
11503
|
+
if (y.message.includes("NOT_FOUND") || y.code === "permission-denied")
|
|
11504
|
+
delete h[d];
|
|
11504
11505
|
else
|
|
11505
|
-
throw
|
|
11506
|
+
throw y;
|
|
11506
11507
|
});
|
|
11507
11508
|
u.push(E);
|
|
11508
11509
|
}
|
|
@@ -11516,34 +11517,34 @@ const fw = async (r, e) => {
|
|
|
11516
11517
|
const n = r.at(-1);
|
|
11517
11518
|
if (!n)
|
|
11518
11519
|
throw new Error("EMPTY_PATH");
|
|
11519
|
-
const s =
|
|
11520
|
+
const s = Ve(!0), a = Jr()[n], o = Ie(), c = Object.keys(s.collections).includes(n), l = o.disabledCollections?.includes(n);
|
|
11520
11521
|
if (!c || l)
|
|
11521
11522
|
throw new Error("COLLECTION_NOT_FOUND");
|
|
11522
11523
|
const u = await ie(o, [
|
|
11523
11524
|
"global",
|
|
11524
11525
|
"firebase",
|
|
11525
11526
|
"serverTimestampOptions"
|
|
11526
|
-
]), f = s.collections[n], { labels:
|
|
11527
|
-
if (!
|
|
11527
|
+
]), f = s.collections[n], { labels: h, access: d } = f, { serverReadOnly: m } = d, E = lt(h.collection), y = De();
|
|
11528
|
+
if (!y?.Role)
|
|
11528
11529
|
throw new Error("PERMISSIONS_DENIED");
|
|
11529
|
-
if (m?.includes(
|
|
11530
|
+
if (m?.includes(y.Role))
|
|
11530
11531
|
return await mw(r, e, t);
|
|
11531
|
-
const
|
|
11532
|
-
if (
|
|
11532
|
+
const _ = dm(r, e, a);
|
|
11533
|
+
if (_.length === 0)
|
|
11533
11534
|
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 C =
|
|
11535
|
+
const S = { collection: h.collection };
|
|
11536
|
+
await ce("preOperation", o, E, ["read", void 0, e, S]), await ce("preRead", o, E, [S, _, !1, !1]);
|
|
11537
|
+
let g = {};
|
|
11538
|
+
const C = _.map(async (I) => {
|
|
11538
11539
|
let b;
|
|
11539
11540
|
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("/") ||
|
|
11541
|
+
throw new Error(`NOT_FOUND: Document with ID ${e} does not exist at location ${r?.join("/") || h.collection}`);
|
|
11541
11542
|
return { id: b.id, data: b.data({ serverTimestamps: u || "none" }) };
|
|
11542
11543
|
}), R = await Promise.all(C);
|
|
11543
11544
|
for (const I of R)
|
|
11544
|
-
|
|
11545
|
-
const
|
|
11546
|
-
if (t?.subcollections &&
|
|
11545
|
+
g.id ||= I.id, g = { ...g, ...I.data }, delete g.Collection_Path_String;
|
|
11546
|
+
const v = [], A = r ? [...r, e] : [h.collection, e];
|
|
11547
|
+
if (t?.subcollections && v.push(ym(g, A, we(t.subcollections), s, we(t?.relations), t?.only)), t?.relations && (t.relations.fields && (t.relations.fields = t.relations.fields.map((I) => {
|
|
11547
11548
|
if (typeof I == "string") {
|
|
11548
11549
|
const b = f.fields.find((w) => w.name === I);
|
|
11549
11550
|
if (b)
|
|
@@ -11551,13 +11552,13 @@ const fw = async (r, e) => {
|
|
|
11551
11552
|
throw new Error(`SCHEMA_ERROR: Field ${I} not found in collection ${n}`);
|
|
11552
11553
|
}
|
|
11553
11554
|
return I;
|
|
11554
|
-
})),
|
|
11555
|
+
})), v.push(gm(g, A, we(t.relations), s, t?.only, t?.noComputedFields, t?.noEmbeddingFields))), await Promise.all(v), !t?.noComputedFields)
|
|
11555
11556
|
for (const I of f.fields)
|
|
11556
|
-
I.type === "Computed" && (
|
|
11557
|
+
I.type === "Computed" && (g[I.name] = await I.formula(g));
|
|
11557
11558
|
if (t?.noEmbeddingFields)
|
|
11558
11559
|
for (const I of f.fields)
|
|
11559
|
-
I.type === "Embedding" && delete
|
|
11560
|
-
return await ce("postOperation", o, E, ["read",
|
|
11560
|
+
I.type === "Embedding" && delete g[I.name];
|
|
11561
|
+
return await ce("postOperation", o, E, ["read", g, e, S]), await ce("postRead", o, E, [S, _, g, !1]), g;
|
|
11561
11562
|
}, pw = (r) => r !== null && typeof r == "object", _m = (r) => {
|
|
11562
11563
|
const e = (t) => {
|
|
11563
11564
|
Object.entries(t).forEach(([n, s]) => {
|
|
@@ -11569,7 +11570,7 @@ const fw = async (r, e) => {
|
|
|
11569
11570
|
};
|
|
11570
11571
|
e(r);
|
|
11571
11572
|
}, yw = async (r, e, t, n) => {
|
|
11572
|
-
const s = it(), i =
|
|
11573
|
+
const s = it(), i = ze(), a = Ue(s, i.STOKER_FB_FUNCTIONS_REGION), o = Je(a, "stoker-writeapi", { timeout: 540 * 1e3 });
|
|
11573
11574
|
return _m(t), cc(t), (await o({
|
|
11574
11575
|
operation: "update",
|
|
11575
11576
|
path: r,
|
|
@@ -11578,29 +11579,29 @@ const fw = async (r, e) => {
|
|
|
11578
11579
|
user: n
|
|
11579
11580
|
})).data?.result;
|
|
11580
11581
|
}, fc = async (r, e, t, n, s, i) => {
|
|
11581
|
-
const a = Mt(), o =
|
|
11582
|
+
const a = Mt(), o = Ve(), c = Ve(!0), l = yc(), u = Ie(), f = fr(), h = We(), d = De();
|
|
11582
11583
|
if (r.length === 0)
|
|
11583
11584
|
throw new Error("EMPTY_PATH");
|
|
11584
|
-
const m = r.at(-1), E = Object.keys(o.collections).includes(m),
|
|
11585
|
-
if (!E ||
|
|
11585
|
+
const m = r.at(-1), E = Object.keys(o.collections).includes(m), y = u.disabledCollections?.includes(m);
|
|
11586
|
+
if (!E || y)
|
|
11586
11587
|
throw new Error("COLLECTION_NOT_FOUND");
|
|
11587
|
-
const
|
|
11588
|
+
const _ = o.collections[m], { labels: S, access: T, fields: P, enableWriteLog: g } = _, { serverWriteOnly: C } = T, R = lt(S.collection), v = await ie(u, ["global", "appName"]), A = s?.retry, p = f.currentUser;
|
|
11588
11589
|
if (!p)
|
|
11589
11590
|
throw new Error("NOT_AUTHENTICATED");
|
|
11590
|
-
if (!
|
|
11591
|
+
if (!d)
|
|
11591
11592
|
throw new Error("PERMISSION_DENIED");
|
|
11592
11593
|
if (bm(e))
|
|
11593
11594
|
throw new Error("RECORD_BUSY");
|
|
11594
11595
|
i = A?.originalRecord || i || await _r(r, e, { noComputedFields: !0, noEmbeddingFields: !0 });
|
|
11595
11596
|
for (const F of c.collections[m].fields)
|
|
11596
11597
|
F.type === "Computed" && (delete t[F.name], delete i[F.name]);
|
|
11597
|
-
const k = Ao(
|
|
11598
|
+
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
11599
|
"collections",
|
|
11599
11600
|
S.collection,
|
|
11600
11601
|
"custom",
|
|
11601
11602
|
"disableOfflineUpdate"
|
|
11602
11603
|
]), M = () => {
|
|
11603
|
-
if (zt() === "Offline" && (x || C ||
|
|
11604
|
+
if (zt() === "Offline" && (x || C || _.auth && (b || O || w)))
|
|
11604
11605
|
throw new Error("CLIENT_OFFLINE");
|
|
11605
11606
|
};
|
|
11606
11607
|
if (M(), C || b || O || w) {
|
|
@@ -11632,10 +11633,10 @@ const fw = async (r, e) => {
|
|
|
11632
11633
|
return await ce("preValidate", u, R, F), await yw(r, e, t, n ? { operation: n.operation, permissions: n.permissions, password: n.password } : void 0);
|
|
11633
11634
|
}
|
|
11634
11635
|
delete t.id;
|
|
11635
|
-
const D = Ko("update", r, t, o,
|
|
11636
|
+
const D = Ko("update", r, t, o, v, zt(), p.uid, Bt.now(), Lr(), !!A);
|
|
11636
11637
|
for (const F of P)
|
|
11637
11638
|
!_e(F) && sr(D[F.name]) && F.nullable && (D[F.name] = null);
|
|
11638
|
-
if (Nt(D), Nt(i), !A &&
|
|
11639
|
+
if (Nt(D), Nt(i), !A && g && Ye("update", "started", D, r, e, _, p.uid, void 0, i), !A) {
|
|
11639
11640
|
const F = [
|
|
11640
11641
|
"update",
|
|
11641
11642
|
D,
|
|
@@ -11648,26 +11649,26 @@ const fw = async (r, e) => {
|
|
|
11648
11649
|
const te = ["update", D, e, I, k, we(i)];
|
|
11649
11650
|
await ce("preWrite", u, R, te);
|
|
11650
11651
|
}
|
|
11651
|
-
if (Xd(
|
|
11652
|
+
if (Xd(_, D, o), eh(_, D), !A)
|
|
11652
11653
|
try {
|
|
11653
11654
|
const F = { ...i, ...D };
|
|
11654
|
-
tr(F), await om("update", F,
|
|
11655
|
+
tr(F), await om("update", F, _, R, ["update", F, I, k, we(i)], o), x && (M(), await lc("update", e, D, _, d));
|
|
11655
11656
|
} catch (F) {
|
|
11656
11657
|
throw new Error(`VALIDATION_ERROR: ${F.message}`);
|
|
11657
11658
|
}
|
|
11658
|
-
if (Oy(D, i, e,
|
|
11659
|
+
if (Oy(D, i, e, _, o, p.uid, d), Nt(D), ac("update", k, r, e, D, o, _, s, l, Io, ko, Cn, (F) => ke(h, "tenants", a, "system_fields", S.collection, `${S.collection}-${F.name}`, e), (F, te) => ke(h, "tenants", a, "system_unique", S.collection, `Unique-${S.collection}-${F.name}`, te), (F) => ke(h, "tenants", a, "system_fields", S.collection, `${S.collection}-${F}`, e)), k.update(ke(h, "tenants", a, r.join("/"), e), D), !A && g && Ye("update", "written", D, r, e, _, p.uid, void 0, i), await dc("update", r, e, D, I, _, R, k, p.uid, g || !1, d, !!A, i), A?.type === "unique") {
|
|
11659
11660
|
const F = { ...i, ...D };
|
|
11660
11661
|
return tr(F), { id: e, ...F };
|
|
11661
11662
|
}
|
|
11662
|
-
|
|
11663
|
+
g && Ye("update", "success", D, r, e, _, p.uid, void 0, i);
|
|
11663
11664
|
const q = ["update", D, e, I, !!A, we(i)], z = [...q];
|
|
11664
11665
|
await ce("postWrite", u, R, q), await ce("postOperation", u, R, z);
|
|
11665
11666
|
const ee = { ...i, ...D };
|
|
11666
11667
|
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
|
|
11668
|
+
}, dc = async (r, e, t, n, s, i, a, o, c, l, u, f, h) => {
|
|
11669
|
+
const d = Ve(), m = Ie(), { labels: E } = i;
|
|
11670
|
+
let y = 0;
|
|
11671
|
+
const _ = async () => {
|
|
11671
11672
|
try {
|
|
11672
11673
|
await we(o).commit();
|
|
11673
11674
|
return;
|
|
@@ -11686,7 +11687,7 @@ const fw = async (r, e) => {
|
|
|
11686
11687
|
const p = A.message.split(", "), k = [], I = [];
|
|
11687
11688
|
let b = !1;
|
|
11688
11689
|
for (const w of p) {
|
|
11689
|
-
const O = w.split(" ")[0], x =
|
|
11690
|
+
const O = w.split(" ")[0], x = d.collections[E.collection].fields.find((M) => M.name === O);
|
|
11690
11691
|
if (!x)
|
|
11691
11692
|
throw new Error(`SCHEMA_ERROR: Field ${O} not found in ${E.collection} schema`);
|
|
11692
11693
|
x.type === "Number" && k.push(w), x.type === "String" && I.push(w);
|
|
@@ -11694,7 +11695,7 @@ const fw = async (r, e) => {
|
|
|
11694
11695
|
if ((!P || k.length > 0) && (T = new Error(`VALIDATION_ERROR: ${p.join(", ")}`)), P && I.length > 0) {
|
|
11695
11696
|
for (const w of I) {
|
|
11696
11697
|
const O = w.split(" ")[0];
|
|
11697
|
-
if (
|
|
11698
|
+
if (d.collections[E.collection].fields.find((D) => D.name === O).type === "Number")
|
|
11698
11699
|
continue;
|
|
11699
11700
|
let M = 1;
|
|
11700
11701
|
n[O].match(/ - DUPLICATE-\d+/) ? (M = parseInt(
|
|
@@ -11708,30 +11709,31 @@ const fw = async (r, e) => {
|
|
|
11708
11709
|
retry: {
|
|
11709
11710
|
type: "unique",
|
|
11710
11711
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
11711
|
-
originalRecord:
|
|
11712
|
+
originalRecord: h
|
|
11712
11713
|
}
|
|
11713
11714
|
});
|
|
11714
11715
|
return;
|
|
11715
11716
|
}
|
|
11716
11717
|
}
|
|
11717
11718
|
}
|
|
11718
|
-
const
|
|
11719
|
+
const g = T || S, C = [
|
|
11719
11720
|
r,
|
|
11720
11721
|
n,
|
|
11721
11722
|
t,
|
|
11722
11723
|
s,
|
|
11723
|
-
y,
|
|
11724
|
-
f,
|
|
11725
11724
|
g,
|
|
11726
|
-
|
|
11727
|
-
|
|
11728
|
-
|
|
11725
|
+
o,
|
|
11726
|
+
f,
|
|
11727
|
+
y,
|
|
11728
|
+
r === "update" ? h : void 0
|
|
11729
|
+
], R = S.code === "unavailable", v = await ce("postWriteError", m, a, C);
|
|
11730
|
+
if (v?.resolved)
|
|
11729
11731
|
return;
|
|
11730
|
-
if (!R &&
|
|
11731
|
-
|
|
11732
|
+
if (!R && v?.retry) {
|
|
11733
|
+
y++, await _();
|
|
11732
11734
|
return;
|
|
11733
11735
|
} else
|
|
11734
|
-
l &&
|
|
11736
|
+
l && Ye(
|
|
11735
11737
|
r,
|
|
11736
11738
|
"failed",
|
|
11737
11739
|
n,
|
|
@@ -11739,16 +11741,16 @@ const fw = async (r, e) => {
|
|
|
11739
11741
|
t,
|
|
11740
11742
|
i,
|
|
11741
11743
|
c,
|
|
11742
|
-
|
|
11744
|
+
g,
|
|
11743
11745
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
11744
|
-
r === "update" ?
|
|
11746
|
+
r === "update" ? h : void 0
|
|
11745
11747
|
);
|
|
11746
|
-
throw
|
|
11748
|
+
throw g;
|
|
11747
11749
|
}
|
|
11748
11750
|
};
|
|
11749
|
-
await
|
|
11751
|
+
await _();
|
|
11750
11752
|
}, gw = async (r, e, t, n) => {
|
|
11751
|
-
const s = it(), i =
|
|
11753
|
+
const s = it(), i = ze(), a = Ue(s, i.STOKER_FB_FUNCTIONS_REGION), o = Je(a, "stoker-writeapi", { timeout: 540 * 1e3 });
|
|
11752
11754
|
return _m(e), (await o({
|
|
11753
11755
|
operation: "create",
|
|
11754
11756
|
path: r,
|
|
@@ -11757,30 +11759,30 @@ const fw = async (r, e) => {
|
|
|
11757
11759
|
id: n
|
|
11758
11760
|
})).data?.result;
|
|
11759
11761
|
}, vm = async (r, e, t, n, s, i) => {
|
|
11760
|
-
const a = Mt(), o =
|
|
11762
|
+
const a = Mt(), o = Ve(), c = yc(), l = Ie(), u = fr(), f = We(), h = De();
|
|
11761
11763
|
if (r.length === 0)
|
|
11762
11764
|
throw new Error("EMPTY_PATH");
|
|
11763
|
-
const
|
|
11765
|
+
const d = r.at(-1), m = Object.keys(o.collections).includes(d), E = l.disabledCollections?.includes(d);
|
|
11764
11766
|
if (!m || E)
|
|
11765
11767
|
throw new Error("COLLECTION_NOT_FOUND");
|
|
11766
|
-
const
|
|
11768
|
+
const y = o.collections[d], { labels: _, access: S, enableWriteLog: T, softDelete: P } = y, { serverWriteOnly: g } = S, C = lt(_.collection), R = await ie(l, ["global", "appName"]), v = n?.retry, A = u.currentUser;
|
|
11767
11769
|
if (!A)
|
|
11768
11770
|
throw new Error("NOT_AUTHENTICATED");
|
|
11769
|
-
if (!
|
|
11771
|
+
if (!h)
|
|
11770
11772
|
throw new Error("PERMISSION_DENIED");
|
|
11771
11773
|
const p = await ie(C, [
|
|
11772
11774
|
"collections",
|
|
11773
|
-
|
|
11775
|
+
_.collection,
|
|
11774
11776
|
"custom",
|
|
11775
11777
|
"disableOfflineCreate"
|
|
11776
11778
|
]), k = () => {
|
|
11777
|
-
if (zt() === "Offline" && (p ||
|
|
11779
|
+
if (zt() === "Offline" && (p || g || y.auth && t))
|
|
11778
11780
|
throw new Error("CLIENT_OFFLINE");
|
|
11779
11781
|
};
|
|
11780
11782
|
k();
|
|
11781
|
-
const I = Ao(f), b =
|
|
11782
|
-
if (
|
|
11783
|
-
if (k(),
|
|
11783
|
+
const I = Ao(f), b = v?.docId || s || ke(qr(f, "tenants", a, _.collection)).id, w = { collection: _.collection };
|
|
11784
|
+
if (g || y.auth && t) {
|
|
11785
|
+
if (k(), y.auth && t) {
|
|
11784
11786
|
if (!t.password)
|
|
11785
11787
|
throw new Error("VALIDATION_ERROR: Password is required");
|
|
11786
11788
|
if (!t.passwordConfirm)
|
|
@@ -11801,41 +11803,41 @@ const fw = async (r, e) => {
|
|
|
11801
11803
|
return await ce("preValidate", l, C, ["create", e, w, I]), i && i(), await gw(r, e, t ? { permissions: t.permissions, password: t.password } : void 0, b);
|
|
11802
11804
|
}
|
|
11803
11805
|
e.id = b;
|
|
11804
|
-
const O = Ko("create", r, e, o, R, zt(), A.uid, Bt.now(), Lr(), !!
|
|
11805
|
-
if (P && (O[P.archivedField] = !1), Nt(O), !
|
|
11806
|
+
const O = Ko("create", r, e, o, R, zt(), A.uid, Bt.now(), Lr(), !!v);
|
|
11807
|
+
if (P && (O[P.archivedField] = !1), Nt(O), !v && T && Ye("create", "started", O, r, b, y, A.uid), v || (await ce("preOperation", l, C, ["create", O, b, w, I]), await ce("preWrite", l, C, ["create", O, b, w, I])), Xd(y, O, o), eh(y, O), v || await hg(O, y, C, h.Role), !v)
|
|
11806
11808
|
try {
|
|
11807
|
-
await om("create", O,
|
|
11809
|
+
await om("create", O, y, C, ["create", O, w, I], o), p && (k(), await lc("create", b, O, y, h));
|
|
11808
11810
|
} catch (q) {
|
|
11809
11811
|
throw new Error(`VALIDATION_ERROR: ${q.message}`);
|
|
11810
11812
|
}
|
|
11811
|
-
if (i && i(), Nt(O), by(O, b,
|
|
11813
|
+
if (i && i(), Nt(O), by(O, b, y, o, A.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 && T && Ye("create", "written", O, r, b, y, A.uid), await dc("create", r, b, O, w, y, C, I, A.uid, T || !1, h, !!v), v?.type === "unique")
|
|
11812
11814
|
return { id: b, ...O };
|
|
11813
|
-
T &&
|
|
11814
|
-
const x = ["create", O, b, w, !!
|
|
11815
|
+
T && Ye("create", "success", O, r, b, y, A.uid);
|
|
11816
|
+
const x = ["create", O, b, w, !!v], M = [...x];
|
|
11815
11817
|
return await ce("postWrite", l, C, x), await ce("postOperation", l, C, M), { id: b, ...O };
|
|
11816
11818
|
}, _w = async (r, e) => {
|
|
11817
|
-
const t = it(), n =
|
|
11819
|
+
const t = it(), n = ze(), s = Ue(t, n.STOKER_FB_FUNCTIONS_REGION);
|
|
11818
11820
|
return (await Je(s, "stoker-writeapi", { timeout: 540 * 1e3 })({
|
|
11819
11821
|
operation: "delete",
|
|
11820
11822
|
path: r,
|
|
11821
11823
|
id: e
|
|
11822
11824
|
})).data?.result;
|
|
11823
11825
|
}, vw = async (r, e, t) => {
|
|
11824
|
-
const n = Mt(), s =
|
|
11826
|
+
const n = Mt(), s = Ve(), i = yc(), a = fr(), o = We(), c = Ie(), l = De();
|
|
11825
11827
|
if (r.length === 0)
|
|
11826
11828
|
throw new Error("EMPTY_PATH");
|
|
11827
|
-
const u = r.at(-1), f = Object.keys(s.collections).includes(u),
|
|
11828
|
-
if (!f ||
|
|
11829
|
+
const u = r.at(-1), f = Object.keys(s.collections).includes(u), h = c.disabledCollections?.includes(u);
|
|
11830
|
+
if (!f || h)
|
|
11829
11831
|
throw new Error("COLLECTION_NOT_FOUND");
|
|
11830
|
-
const
|
|
11832
|
+
const d = s.collections[u], { labels: m, access: E, enableWriteLog: y, softDelete: _ } = d, { serverWriteOnly: S } = E, T = lt(m.collection), P = await ie(c, ["global", "appName"]), g = t?.retry, C = a.currentUser;
|
|
11831
11833
|
if (!C)
|
|
11832
11834
|
throw new Error("NOT_AUTHENTICATED");
|
|
11833
11835
|
if (!l)
|
|
11834
11836
|
throw new Error("PERMISSION_DENIED");
|
|
11835
|
-
if (
|
|
11837
|
+
if (_ && !d.auth)
|
|
11836
11838
|
return await fc(r, e, {
|
|
11837
|
-
[
|
|
11838
|
-
[
|
|
11839
|
+
[_.archivedField]: !0,
|
|
11840
|
+
[_.timestampField]: Lr()
|
|
11839
11841
|
});
|
|
11840
11842
|
const R = await ie(T, [
|
|
11841
11843
|
"collections",
|
|
@@ -11844,7 +11846,7 @@ const fw = async (r, e) => {
|
|
|
11844
11846
|
"disableOfflineDelete"
|
|
11845
11847
|
]);
|
|
11846
11848
|
if ((() => {
|
|
11847
|
-
if (zt() === "Offline" && (R || S ||
|
|
11849
|
+
if (zt() === "Offline" && (R || S || d.auth))
|
|
11848
11850
|
throw new Error("CLIENT_OFFLINE");
|
|
11849
11851
|
})(), bm(e))
|
|
11850
11852
|
throw new Error("RECORD_BUSY");
|
|
@@ -11852,21 +11854,21 @@ const fw = async (r, e) => {
|
|
|
11852
11854
|
try {
|
|
11853
11855
|
A = await _r(r, e);
|
|
11854
11856
|
} catch (M) {
|
|
11855
|
-
throw
|
|
11857
|
+
throw y && g?.record && M.message.indexOf("NOT_FOUND") !== -1 && await Ye("delete", "failed", g?.record, r, e, d, C.uid, M), M;
|
|
11856
11858
|
}
|
|
11857
|
-
if (S ||
|
|
11859
|
+
if (S || d.auth && A.User_ID)
|
|
11858
11860
|
return await _w(r, e);
|
|
11859
11861
|
delete A.id;
|
|
11860
|
-
const p = Ao(o), k = { collection: m.collection }, I = Ko("delete", r, A, s, P, zt(), C.uid, Bt.now(), Lr(), !!
|
|
11861
|
-
Nt(I), !
|
|
11862
|
-
const w = ["delete", I, e, k, !!
|
|
11862
|
+
const p = Ao(o), k = { collection: m.collection }, I = Ko("delete", r, A, s, P, zt(), C.uid, Bt.now(), Lr(), !!g);
|
|
11863
|
+
Nt(I), !g && y && Ye("delete", "started", I, r, e, d, C.uid), g || (await ce("preOperation", c, T, ["delete", I, e, k, p]), await ce("preWrite", c, T, ["delete", I, e, k, p])), Nt(I), Ey(I, e, d, s, C.uid, l), ac("delete", p, r, e, I, s, d, t, i, Io, ko, Cn, (M) => ke(o, "tenants", n, "system_fields", m.collection, `${m.collection}-${M.name}`, e), (M, D) => ke(o, "tenants", n, "system_unique", m.collection, `Unique-${m.collection}-${M.name}`, D), (M) => ke(o, "tenants", n, "system_fields", m.collection, `${m.collection}-${M}`, e)), p.delete(ke(o, "tenants", n, r.join("/"), e)), !g && y && Ye("delete", "written", I, r, e, d, C.uid), await dc("delete", r, e, I, k, d, T, p, C.uid, y || !1, l, !!g), y && Ye("delete", "success", { ...I, ...g?.record || {} }, r, e, d, C.uid);
|
|
11864
|
+
const w = ["delete", I, e, k, !!g], O = [...w];
|
|
11863
11865
|
return await ce("postWrite", c, T, w), await ce("postOperation", c, T, O), { id: e, ...I };
|
|
11864
11866
|
}, wm = (r) => {
|
|
11865
11867
|
if (typeof r == "object")
|
|
11866
11868
|
for (const e in r)
|
|
11867
11869
|
Object.prototype.hasOwnProperty.call(r, e) && (r[e] === "_DELETE_FIELD" ? r[e] = Cn() : wm(r[e]));
|
|
11868
11870
|
}, ww = async (r, e) => {
|
|
11869
|
-
const t = it(), n =
|
|
11871
|
+
const t = it(), n = ze(), s = Ue(t, n.STOKER_FB_FUNCTIONS_REGION);
|
|
11870
11872
|
return (await Je(s, r)(e)).data;
|
|
11871
11873
|
};
|
|
11872
11874
|
let mt = {};
|
|
@@ -11880,10 +11882,10 @@ const bw = async (r, e) => {
|
|
|
11880
11882
|
if (a?.version)
|
|
11881
11883
|
for (const o of i.docs) {
|
|
11882
11884
|
mt[o.id] ??= 0;
|
|
11883
|
-
const c = o.data(), { data: l, operation: u, docId: f, collection:
|
|
11884
|
-
await new Promise((
|
|
11885
|
+
const c = o.data(), { data: l, operation: u, docId: f, collection: h, Collection_Path: d, Last_Write_Version: m } = c;
|
|
11886
|
+
await new Promise((_) => setTimeout(_, 1e3));
|
|
11885
11887
|
const E = await ww("stoker-writelog", {
|
|
11886
|
-
path:
|
|
11888
|
+
path: d,
|
|
11887
11889
|
id: f,
|
|
11888
11890
|
log: o.id
|
|
11889
11891
|
});
|
|
@@ -11892,33 +11894,33 @@ const bw = async (r, e) => {
|
|
|
11892
11894
|
if (s?.uid !== e.uid)
|
|
11893
11895
|
return;
|
|
11894
11896
|
if (a.force && m !== a.version) {
|
|
11895
|
-
|
|
11897
|
+
Ye(
|
|
11896
11898
|
u,
|
|
11897
11899
|
"failed",
|
|
11898
11900
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
11899
11901
|
l.data,
|
|
11900
|
-
|
|
11902
|
+
d,
|
|
11901
11903
|
f,
|
|
11902
11904
|
// eslint-disable-next-line security/detect-object-injection
|
|
11903
|
-
r.collections[
|
|
11905
|
+
r.collections[h],
|
|
11904
11906
|
e.uid,
|
|
11905
11907
|
`Version mismatch- write log version ${m} not compatible with forced version ${a.version}`,
|
|
11906
11908
|
u === "update" ? l.originalRecord : void 0
|
|
11907
11909
|
);
|
|
11908
11910
|
continue;
|
|
11909
11911
|
}
|
|
11910
|
-
const
|
|
11911
|
-
if (
|
|
11912
|
-
if (localStorage.setItem(`stoker-retry-${f}`, Date.now().toString()), console.info(`Retrying pending ${u} operation: ${o.ref.path}`), u === "create" && (mt[f]++, await vm(
|
|
11912
|
+
const y = localStorage.getItem(`stoker-retry-${f}`);
|
|
11913
|
+
if (y !== "done" && !(y && Date.now() - parseInt(y) < 1e4)) {
|
|
11914
|
+
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, {
|
|
11913
11915
|
retry: {
|
|
11914
11916
|
type: "offline",
|
|
11915
11917
|
docId: f
|
|
11916
11918
|
}
|
|
11917
|
-
}).catch((
|
|
11918
|
-
console.error(
|
|
11919
|
+
}).catch((_) => {
|
|
11920
|
+
console.error(_);
|
|
11919
11921
|
}), mt[f]--, localStorage.setItem(`stoker-retry-${f}`, "done")), u === "update") {
|
|
11920
|
-
const
|
|
11921
|
-
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(
|
|
11922
|
+
const _ = r.collections[h], { softDelete: S } = _;
|
|
11923
|
+
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, {
|
|
11922
11924
|
retry: {
|
|
11923
11925
|
type: "offline",
|
|
11924
11926
|
originalRecord: l.originalRecord
|
|
@@ -11927,7 +11929,7 @@ const bw = async (r, e) => {
|
|
|
11927
11929
|
console.error(T);
|
|
11928
11930
|
}), mt[f]--, localStorage.setItem(`stoker-retry-${f}`, "done");
|
|
11929
11931
|
}
|
|
11930
|
-
u === "delete" && (mt[f]++, await vw(
|
|
11932
|
+
u === "delete" && (mt[f]++, await vw(d, f, {
|
|
11931
11933
|
retry: {
|
|
11932
11934
|
type: "offline",
|
|
11933
11935
|
record: {
|
|
@@ -11938,8 +11940,8 @@ const bw = async (r, e) => {
|
|
|
11938
11940
|
Last_Write_Version: c.Last_Write_Version
|
|
11939
11941
|
}
|
|
11940
11942
|
}
|
|
11941
|
-
}).catch((
|
|
11942
|
-
console.error(
|
|
11943
|
+
}).catch((_) => {
|
|
11944
|
+
console.error(_);
|
|
11943
11945
|
}), mt[f]--, localStorage.setItem(`stoker-retry-${f}`, "done"));
|
|
11944
11946
|
}
|
|
11945
11947
|
}
|
|
@@ -12007,7 +12009,7 @@ const Ya = {
|
|
|
12007
12009
|
}, ht = {
|
|
12008
12010
|
main: {},
|
|
12009
12011
|
firestoreWrite: {}
|
|
12010
|
-
},
|
|
12012
|
+
}, Ge = {
|
|
12011
12013
|
main: {},
|
|
12012
12014
|
firestoreWrite: {},
|
|
12013
12015
|
maintenance: {}
|
|
@@ -12070,10 +12072,10 @@ const Ya = {
|
|
|
12070
12072
|
return ht.firestoreWrite;
|
|
12071
12073
|
},
|
|
12072
12074
|
getFirestoreWrite() {
|
|
12073
|
-
return
|
|
12075
|
+
return Ge.firestoreWrite;
|
|
12074
12076
|
},
|
|
12075
12077
|
getFirestoreMaintenance() {
|
|
12076
|
-
return
|
|
12078
|
+
return Ge.maintenance;
|
|
12077
12079
|
}
|
|
12078
12080
|
}, kw = () => {
|
|
12079
12081
|
hc = "", Pr = {}, mc = {}, pc = {}, $e = {}, og(), dw(), Ow();
|
|
@@ -12095,7 +12097,7 @@ const Gw = async (r, e, t, n) => {
|
|
|
12095
12097
|
for (const p of o)
|
|
12096
12098
|
Ya[`${p}App`] = zn(s, p);
|
|
12097
12099
|
const { firestoreWriteApp: c } = Ya, l = zn(s, "maintenance");
|
|
12098
|
-
|
|
12100
|
+
Ge.maintenance = We(l);
|
|
12099
12101
|
const u = hp();
|
|
12100
12102
|
if (u.settings.minimumFetchIntervalMillis = 36e5, await mp(u), be.STOKER_FB_ENABLE_APP_CHECK === "true" && be.STOKER_FB_APP_CHECK_KEY) {
|
|
12101
12103
|
(Tt === "development" || window.location.hostname === "localhost") && (globalThis.FIREBASE_APPCHECK_DEBUG_TOKEN = !0);
|
|
@@ -12123,11 +12125,11 @@ const Gw = async (r, e, t, n) => {
|
|
|
12123
12125
|
"global",
|
|
12124
12126
|
"firebase",
|
|
12125
12127
|
"enableAnalytics"
|
|
12126
|
-
]),
|
|
12128
|
+
]), h = await ie(pe, [
|
|
12127
12129
|
"global",
|
|
12128
12130
|
"firebase",
|
|
12129
12131
|
"analyticsSettings"
|
|
12130
|
-
]),
|
|
12132
|
+
]), d = await ie(pe, [
|
|
12131
12133
|
"global",
|
|
12132
12134
|
"firebase",
|
|
12133
12135
|
"analyticsConsentSettings"
|
|
@@ -12135,12 +12137,12 @@ const Gw = async (r, e, t, n) => {
|
|
|
12135
12137
|
"global",
|
|
12136
12138
|
"firebase",
|
|
12137
12139
|
"enableEmulators"
|
|
12138
|
-
]), E = await ie(pe, ["global", "enableUserIDLogging"]),
|
|
12140
|
+
]), E = await ie(pe, ["global", "enableUserIDLogging"]), y = await ie(pe, [
|
|
12139
12141
|
"global",
|
|
12140
12142
|
"firebase",
|
|
12141
12143
|
"logLevel",
|
|
12142
12144
|
"dev"
|
|
12143
|
-
]),
|
|
12145
|
+
]), _ = await ie(pe, [
|
|
12144
12146
|
"global",
|
|
12145
12147
|
"firebase",
|
|
12146
12148
|
"logLevel",
|
|
@@ -12148,18 +12150,18 @@ const Gw = async (r, e, t, n) => {
|
|
|
12148
12150
|
]), S = await Fm().catch((p) => {
|
|
12149
12151
|
throw new Error("Error checking analytics support.", { cause: p });
|
|
12150
12152
|
});
|
|
12151
|
-
Tt === "production" && f && S && Dm(dt,
|
|
12153
|
+
Tt === "production" && f && S && Dm(dt, h || {}), d && Mm(d);
|
|
12152
12154
|
const T = await ie(pe, [
|
|
12153
12155
|
"global",
|
|
12154
12156
|
"auth",
|
|
12155
12157
|
"authPersistenceType"
|
|
12156
|
-
]),
|
|
12158
|
+
]), g = {
|
|
12157
12159
|
popupRedirectResolver: void 0,
|
|
12158
12160
|
persistence: T === "LOCAL" ? [Pm, qm, Ec] : T === "SESSION" ? [Ec, Sc] : [Sc]
|
|
12159
12161
|
};
|
|
12160
|
-
ht.main = Oc(dt,
|
|
12162
|
+
ht.main = Oc(dt, g);
|
|
12161
12163
|
for (const p of o)
|
|
12162
|
-
ht[p] = Oc(Ya[`${p}App`],
|
|
12164
|
+
ht[p] = Oc(Ya[`${p}App`], g);
|
|
12163
12165
|
const { main: C } = ht;
|
|
12164
12166
|
Lm(C, async (p) => {
|
|
12165
12167
|
if (p && await ve(pe.preLogin, [p]) === !1)
|
|
@@ -12182,7 +12184,7 @@ const Gw = async (r, e, t, n) => {
|
|
|
12182
12184
|
}
|
|
12183
12185
|
if (!R?.includes("Firestore")) {
|
|
12184
12186
|
const p = be.STOKER_FB_EMULATOR_FIRESTORE_PORT ? parseInt(be.STOKER_FB_EMULATOR_FIRESTORE_PORT) : 8080;
|
|
12185
|
-
Cc(
|
|
12187
|
+
Cc(Ge.maintenance, "localhost", p);
|
|
12186
12188
|
}
|
|
12187
12189
|
if (!R?.includes("Storage")) {
|
|
12188
12190
|
const p = be.STOKER_FB_EMULATOR_STORAGE_PORT ? parseInt(be.STOKER_FB_EMULATOR_STORAGE_PORT) : 9199;
|
|
@@ -12193,7 +12195,7 @@ const Gw = async (r, e, t, n) => {
|
|
|
12193
12195
|
up(Ue(dt, be.STOKER_FB_FUNCTIONS_REGION), "localhost", p);
|
|
12194
12196
|
}
|
|
12195
12197
|
}
|
|
12196
|
-
if (Ew(), Sw(), Rw(), Tt === "development" && (
|
|
12198
|
+
if (Ew(), Sw(), Rw(), Tt === "development" && (y ? Qr(y) : Qr("debug")), Tt === "production" && (_ ? Qr(_) : Qr("error")), E) {
|
|
12197
12199
|
const p = Bn(C, async (k) => {
|
|
12198
12200
|
if (k) {
|
|
12199
12201
|
const I = JSON.parse(be.STOKER_FB_WEB_APP_CONFIG);
|
|
@@ -12207,9 +12209,9 @@ const Gw = async (r, e, t, n) => {
|
|
|
12207
12209
|
await Promise.all(Object.values(ht).map((p) => p.authStateReady().catch((k) => {
|
|
12208
12210
|
throw new Error(`Error waiting for auth state in ${p.app.name}.`, { cause: k });
|
|
12209
12211
|
})));
|
|
12210
|
-
let
|
|
12212
|
+
let v = !1;
|
|
12211
12213
|
for (const p of Object.values(ht))
|
|
12212
|
-
p.currentUser || (
|
|
12214
|
+
p.currentUser || (v = !0);
|
|
12213
12215
|
let A;
|
|
12214
12216
|
return Bn(C, async (p) => {
|
|
12215
12217
|
if (p) {
|
|
@@ -12247,13 +12249,13 @@ const Gw = async (r, e, t, n) => {
|
|
|
12247
12249
|
localCache: tp({
|
|
12248
12250
|
garbageCollector: ee
|
|
12249
12251
|
})
|
|
12250
|
-
},
|
|
12252
|
+
}, Ge.main = Zn(dt, D), ["ALL", "WRITE"].includes(A) ? Ge.firestoreWrite = Zn(c, z) : Ge.firestoreWrite = Zn(c, D), Tt === "development" && m && !R?.includes("Firestore")) {
|
|
12251
12253
|
const Se = be.STOKER_FB_EMULATOR_FIRESTORE_PORT ? parseInt(be.STOKER_FB_EMULATOR_FIRESTORE_PORT) : 8080;
|
|
12252
|
-
for (const [Le, Ot] of Object.entries(
|
|
12254
|
+
for (const [Le, Ot] of Object.entries(Ge))
|
|
12253
12255
|
Le !== "maintenance" && Cc(Ot, "localhost", Se);
|
|
12254
12256
|
}
|
|
12255
12257
|
if (A === "ALL") {
|
|
12256
|
-
const Se = rp(
|
|
12258
|
+
const Se = rp(Ge.main);
|
|
12257
12259
|
Se && np(Se);
|
|
12258
12260
|
}
|
|
12259
12261
|
const F = await Je(Ue(dt, be.STOKER_FB_FUNCTIONS_REGION), "stoker-schema")().catch((Se) => {
|
|
@@ -12281,7 +12283,7 @@ const Gw = async (r, e, t, n) => {
|
|
|
12281
12283
|
error: x
|
|
12282
12284
|
}), console.error(`Error signing out of ${O.app.name}.`);
|
|
12283
12285
|
});
|
|
12284
|
-
})), await Promise.all(Object.entries(
|
|
12286
|
+
})), await Promise.all(Object.entries(Ge).map(async ([O, x]) => {
|
|
12285
12287
|
O !== "maintenance" && Object.keys(x).length !== 0 && await sp(x).catch((M) => {
|
|
12286
12288
|
console.error(`Error terminating ${x.app.name}.`), b.error = !0, b.instances.push({
|
|
12287
12289
|
instance: x.app.name,
|
|
@@ -12293,14 +12295,14 @@ const Gw = async (r, e, t, n) => {
|
|
|
12293
12295
|
"global",
|
|
12294
12296
|
"auth",
|
|
12295
12297
|
"clearPersistenceOnSignOut"
|
|
12296
|
-
]) ?? !0) && (A === "ALL" && await xc(
|
|
12298
|
+
]) ?? !0) && (A === "ALL" && await xc(Ge.main).catch((O) => {
|
|
12297
12299
|
console.error('Error clearing indexedDB persistence in "[DEFAULT]".'), b.error = !0, b.instances.push({ instance: "[DEFAULT]", code: "CLEAR_CACHE", error: O });
|
|
12298
|
-
}), ["ALL", "WRITE"].includes(A) && await xc(
|
|
12300
|
+
}), ["ALL", "WRITE"].includes(A) && await xc(Ge.firestoreWrite).catch((O) => {
|
|
12299
12301
|
console.error('Error clearing indexedDB persistence in "firestoreWrite".'), b.error = !0, b.instances.push({ instance: "firestoreWrite", code: "CLEAR_CACHE", error: O });
|
|
12300
12302
|
})), b.error ? console.info("Sign out operation completed with errors.") : console.info("Sign out operation completed successfully."), await ve(pe.postLogout, [b]);
|
|
12301
12303
|
}
|
|
12302
|
-
}),
|
|
12303
|
-
}, { getTenant: Mt, getEnv:
|
|
12304
|
+
}), v ? !1 : C.currentUser ? (E && console.info(`${C.currentUser.uid} successfully logged in.`), !0) : !1;
|
|
12305
|
+
}, { 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) => {
|
|
12304
12306
|
const [n, s] = [fr(), Nw()], i = Ie();
|
|
12305
12307
|
if (!r || !e)
|
|
12306
12308
|
throw new Error("Email and password are required.");
|
|
@@ -12323,12 +12325,12 @@ const Gw = async (r, e, t, n) => {
|
|
|
12323
12325
|
throw c;
|
|
12324
12326
|
}
|
|
12325
12327
|
if (!s.currentUser) {
|
|
12326
|
-
const c = it(), l =
|
|
12328
|
+
const c = it(), l = ze(), u = Ue(c, l.STOKER_FB_FUNCTIONS_REGION), f = Je(u, "stoker-customtoken");
|
|
12327
12329
|
try {
|
|
12328
|
-
const
|
|
12329
|
-
if (!
|
|
12330
|
+
const d = (await f()).data.customToken;
|
|
12331
|
+
if (!d)
|
|
12330
12332
|
throw new Error("The user is not authenticated.");
|
|
12331
|
-
await Wm(s,
|
|
12333
|
+
await Wm(s, d);
|
|
12332
12334
|
} catch {
|
|
12333
12335
|
throw n && n.currentUser && await vd(n), new Error("The user is not authenticated.");
|
|
12334
12336
|
}
|
|
@@ -12367,7 +12369,7 @@ const Gw = async (r, e, t, n) => {
|
|
|
12367
12369
|
} else
|
|
12368
12370
|
throw new Error("User must have an email address to enroll in multi-factor authentication.");
|
|
12369
12371
|
}, rb = async (r, e, t) => {
|
|
12370
|
-
const n = it(), s =
|
|
12372
|
+
const n = it(), s = ze(), i = Ue(n, s.STOKER_FB_FUNCTIONS_REGION);
|
|
12371
12373
|
await Je(i, "stoker-deletefolder")({
|
|
12372
12374
|
path: r || "",
|
|
12373
12375
|
id: e.id,
|
|
@@ -12375,7 +12377,7 @@ const Gw = async (r, e, t, n) => {
|
|
|
12375
12377
|
folderName: t
|
|
12376
12378
|
});
|
|
12377
12379
|
}, nb = async () => {
|
|
12378
|
-
const r = [
|
|
12380
|
+
const r = [We(), gc()];
|
|
12379
12381
|
for (const e of Object.values(r))
|
|
12380
12382
|
await ip(e).catch((t) => {
|
|
12381
12383
|
throw new Error(`Error waiting for pending writes in ${e.app.name}.`, { cause: t });
|
|
@@ -12387,22 +12389,22 @@ const Gw = async (r, e, t, n) => {
|
|
|
12387
12389
|
const a = De();
|
|
12388
12390
|
if (!a?.Role)
|
|
12389
12391
|
throw new Error("PERMISSIONS_NOT_FOUND");
|
|
12390
|
-
const o =
|
|
12392
|
+
const o = Ve(!0), l = Jr()[i], u = We(), f = o.collections[i];
|
|
12391
12393
|
if (!f)
|
|
12392
12394
|
throw new Error("COLLECTION_NOT_FOUND");
|
|
12393
|
-
const { labels:
|
|
12394
|
-
if (!E ||
|
|
12395
|
+
const { labels: h, preloadCache: d } = f, m = Ie(), E = Object.keys(o.collections).includes(i), y = m.disabledCollections?.includes(i);
|
|
12396
|
+
if (!E || y)
|
|
12395
12397
|
throw new Error("COLLECTION_NOT_FOUND");
|
|
12396
|
-
const
|
|
12398
|
+
const _ = lt(h.collection), S = await ie(m, [
|
|
12397
12399
|
"global",
|
|
12398
12400
|
"firebase",
|
|
12399
12401
|
"serverTimestampOptions"
|
|
12400
12402
|
]), T = dm(r, e, l);
|
|
12401
12403
|
if (T.length === 0)
|
|
12402
12404
|
throw new Error("PERMISSION_DENIED");
|
|
12403
|
-
const P =
|
|
12404
|
-
await ce("preOperation", m,
|
|
12405
|
-
const
|
|
12405
|
+
const P = d?.roles?.includes(a.Role), g = { collection: h.collection };
|
|
12406
|
+
await ce("preOperation", m, _, ["read", void 0, e, g]), await ce("preRead", m, _, [g, T, !1, !0]);
|
|
12407
|
+
const v = /* @__PURE__ */ new Map(), A = [];
|
|
12406
12408
|
let p = {};
|
|
12407
12409
|
const k = /* @__PURE__ */ new Map();
|
|
12408
12410
|
typeof s?.relations == "object" && (s.relations.fields = s.relations.fields.map((M) => {
|
|
@@ -12477,13 +12479,13 @@ const Gw = async (r, e, t, n) => {
|
|
|
12477
12479
|
z.set(`${F.name}_${ne}`, !0), b.delete(`${F.name}_${ne}`);
|
|
12478
12480
|
return;
|
|
12479
12481
|
}
|
|
12480
|
-
te[ne] = K, z.set(`${F.name}_${ne}`, !0), Array.from(z.values()).every((j) => j) && (D({}), I(), M.fromCache === !1 && (ce("postOperation", m,
|
|
12482
|
+
te[ne] = K, z.set(`${F.name}_${ne}`, !0), Array.from(z.values()).every((j) => j) && (D({}), I(), M.fromCache === !1 && (ce("postOperation", m, _, [
|
|
12481
12483
|
"read",
|
|
12482
12484
|
p,
|
|
12483
12485
|
e,
|
|
12484
|
-
|
|
12485
|
-
]), ce("postRead", m,
|
|
12486
|
-
|
|
12486
|
+
g
|
|
12487
|
+
]), ce("postRead", m, _, [
|
|
12488
|
+
g,
|
|
12487
12489
|
T,
|
|
12488
12490
|
p,
|
|
12489
12491
|
!0
|
|
@@ -12504,13 +12506,13 @@ const Gw = async (r, e, t, n) => {
|
|
|
12504
12506
|
w.get(`${F.name}_${ne}`) && w.get(`${F.name}_${ne}`).listener(), z.set(`${F.name}_${ne}`, !0), b.delete(`${F.name}_${ne}`);
|
|
12505
12507
|
return;
|
|
12506
12508
|
}
|
|
12507
|
-
te[ne] = K, z.set(`${F.name}_${ne}`, !0), Array.from(z.values()).every((j) => j) && (D({}), I(), M.fromCache === !1 && (ce("postOperation", m,
|
|
12509
|
+
te[ne] = K, z.set(`${F.name}_${ne}`, !0), Array.from(z.values()).every((j) => j) && (D({}), I(), M.fromCache === !1 && (ce("postOperation", m, _, [
|
|
12508
12510
|
"read",
|
|
12509
12511
|
p,
|
|
12510
12512
|
e,
|
|
12511
|
-
|
|
12512
|
-
]), ce("postRead", m,
|
|
12513
|
-
|
|
12513
|
+
g
|
|
12514
|
+
]), ce("postRead", m, _, [
|
|
12515
|
+
g,
|
|
12514
12516
|
T,
|
|
12515
12517
|
p,
|
|
12516
12518
|
!0
|
|
@@ -12542,22 +12544,22 @@ const Gw = async (r, e, t, n) => {
|
|
|
12542
12544
|
const D = dr(M, { source: s?.only || (P ? "cache" : "default") }, (q) => {
|
|
12543
12545
|
if (q.exists()) {
|
|
12544
12546
|
const z = q.data({ serverTimestamps: S || "none" });
|
|
12545
|
-
if (
|
|
12547
|
+
if (v.has(M.path) && s?.relations) {
|
|
12546
12548
|
const oe = O(s?.relations);
|
|
12547
12549
|
for (const F of oe)
|
|
12548
12550
|
"collection" in F && z[F.name] && (z[F.name] = p?.[F.name]);
|
|
12549
12551
|
}
|
|
12550
|
-
|
|
12552
|
+
v.set(M.path, !0), p ||= {}, p.id ||= q.id, p = { ...p, ...z }, delete p.Collection_Path_String;
|
|
12551
12553
|
const ee = k.get(M) || /* @__PURE__ */ new Set();
|
|
12552
|
-
lm(z, ee), k.set(M, ee),
|
|
12553
|
-
I(), q.metadata.fromCache === !1 && (ce("postOperation", m,
|
|
12554
|
+
lm(z, ee), k.set(M, ee), v.size === T.length && x(q.metadata).then(() => {
|
|
12555
|
+
I(), q.metadata.fromCache === !1 && (ce("postOperation", m, _, [
|
|
12554
12556
|
"read",
|
|
12555
12557
|
p,
|
|
12556
12558
|
e,
|
|
12557
|
-
|
|
12558
|
-
]), ce("postRead", m,
|
|
12559
|
+
g
|
|
12560
|
+
]), ce("postRead", m, _, [g, T, p, !0]));
|
|
12559
12561
|
});
|
|
12560
|
-
} else p && (p = void 0, I(), q.metadata.fromCache === !1 && (ce("postOperation", m,
|
|
12562
|
+
} else p && (p = void 0, I(), q.metadata.fromCache === !1 && (ce("postOperation", m, _, ["read", void 0, e, g]), ce("postRead", m, _, [g, T, void 0, !0])));
|
|
12561
12563
|
}, (q) => {
|
|
12562
12564
|
n && n(q), A.forEach((z) => z());
|
|
12563
12565
|
});
|
|
@@ -12589,14 +12591,14 @@ const Gw = async (r, e, t, n) => {
|
|
|
12589
12591
|
const a = De();
|
|
12590
12592
|
if (!a?.Role)
|
|
12591
12593
|
throw new Error("PERMISSION_DENIED");
|
|
12592
|
-
const o =
|
|
12593
|
-
if (!
|
|
12594
|
+
const o = Ve(!0), l = Jr()[i], u = We(), f = o.collections[i], { labels: h, preloadCache: d, access: m } = f, { serverReadOnly: E } = m, y = Ie(), _ = Object.keys(o.collections).includes(i), S = y.disabledCollections?.includes(i);
|
|
12595
|
+
if (!_ || S)
|
|
12594
12596
|
throw new Error("COLLECTION_NOT_FOUND");
|
|
12595
|
-
const T = lt(
|
|
12597
|
+
const T = lt(h.collection), P = await ie(y, [
|
|
12596
12598
|
"global",
|
|
12597
12599
|
"firebase",
|
|
12598
12600
|
"serverTimestampOptions"
|
|
12599
|
-
]),
|
|
12601
|
+
]), g = d?.roles?.includes(a.Role);
|
|
12600
12602
|
if (s?.pagination?.number !== void 0) {
|
|
12601
12603
|
const G = s.pagination.number;
|
|
12602
12604
|
if (typeof G != "number" || !Number.isFinite(G) || !Number.isInteger(G) || G < 1)
|
|
@@ -12607,7 +12609,7 @@ const Gw = async (r, e, t, n) => {
|
|
|
12607
12609
|
return { pages: 0, count: 0, unsubscribe: () => {
|
|
12608
12610
|
} };
|
|
12609
12611
|
let R = C.map((G) => me(G, ...e));
|
|
12610
|
-
const
|
|
12612
|
+
const v = s?.pagination?.startAfter || s?.pagination?.endBefore || s?.pagination?.startAt || s?.pagination?.endAt || {
|
|
12611
12613
|
first: /* @__PURE__ */ new Map(),
|
|
12612
12614
|
last: /* @__PURE__ */ new Map()
|
|
12613
12615
|
};
|
|
@@ -12620,30 +12622,30 @@ const Gw = async (r, e, t, n) => {
|
|
|
12620
12622
|
s.pagination.startAfter || s.pagination.endBefore || s.pagination.startAt || s.pagination.endAt ? s.pagination.startAfter ? (Qa(s.pagination.startAfter), R = R.map((j, Y) => {
|
|
12621
12623
|
if (!s.pagination?.orderByField || !s.pagination.orderByDirection)
|
|
12622
12624
|
throw new Error("INPUT_ERROR: orderByField and orderByDirection must be provided when using startAfter");
|
|
12623
|
-
let U = me(j, rt(s.pagination.orderByField, s.pagination.orderByDirection), eo(
|
|
12625
|
+
let U = me(j, rt(s.pagination.orderByField, s.pagination.orderByDirection), eo(v.last.get(Y)));
|
|
12624
12626
|
return s.pagination.number && (U = me(U, Xt(s.pagination.number))), U;
|
|
12625
12627
|
})) : s.pagination.endBefore ? (Ja(s.pagination.endBefore), R = R.map((j, Y) => {
|
|
12626
12628
|
if (!s.pagination?.orderByField || !s.pagination.orderByDirection)
|
|
12627
12629
|
throw new Error("INPUT_ERROR: orderByField and orderByDirection must be provided when using endBefore");
|
|
12628
|
-
let U = me(j, rt(s.pagination.orderByField, s.pagination.orderByDirection), to(
|
|
12630
|
+
let U = me(j, rt(s.pagination.orderByField, s.pagination.orderByDirection), to(v.first.get(Y)));
|
|
12629
12631
|
return s.pagination.number && (U = me(U, Nr(s.pagination.number))), U;
|
|
12630
12632
|
})) : s.pagination.startAt ? (Ja(s.pagination.startAt), R = R.map((j, Y) => {
|
|
12631
12633
|
if (!s.pagination?.orderByField || !s.pagination.orderByDirection)
|
|
12632
12634
|
throw new Error("INPUT_ERROR: orderByField and orderByDirection must be provided when using startAt");
|
|
12633
|
-
let U = me(j, rt(s.pagination.orderByField, s.pagination.orderByDirection), ap(
|
|
12635
|
+
let U = me(j, rt(s.pagination.orderByField, s.pagination.orderByDirection), ap(v.first.get(Y)));
|
|
12634
12636
|
return s.pagination.number && (U = me(U, Nr(s.pagination.number))), U;
|
|
12635
12637
|
})) : s.pagination.endAt && (Qa(s.pagination.endAt), R = R.map((j, Y) => {
|
|
12636
12638
|
if (!s.pagination?.orderByField || !s.pagination.orderByDirection)
|
|
12637
12639
|
throw new Error("INPUT_ERROR: orderByField and orderByDirection must be provided when using endAt");
|
|
12638
|
-
let U = me(j, rt(s.pagination.orderByField, s.pagination.orderByDirection), op(
|
|
12640
|
+
let U = me(j, rt(s.pagination.orderByField, s.pagination.orderByDirection), op(v.last.get(Y)));
|
|
12639
12641
|
return s.pagination.number && (U = me(U, Nr(s.pagination.number))), U;
|
|
12640
12642
|
})) : R = R.map((j) => {
|
|
12641
12643
|
let Y = me(j);
|
|
12642
12644
|
return s.pagination?.orderByField && s.pagination.orderByDirection && (Y = me(j, rt(s.pagination.orderByField, s.pagination.orderByDirection))), s.pagination.number && (Y = me(Y, Xt(s.pagination.number))), Y;
|
|
12643
12645
|
});
|
|
12644
12646
|
}
|
|
12645
|
-
const A = { collection:
|
|
12646
|
-
await ce("preOperation",
|
|
12647
|
+
const A = { collection: h.collection };
|
|
12648
|
+
await ce("preOperation", y, T, ["read", void 0, void 0, A]), await ce("preRead", y, T, [A, R, !0, !0]);
|
|
12647
12649
|
let I = !0;
|
|
12648
12650
|
const b = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Map(), O = [], x = /* @__PURE__ */ new Map(), M = /* @__PURE__ */ new Map(), D = /* @__PURE__ */ new Map(), q = (G, K, j) => {
|
|
12649
12651
|
const Y = [];
|
|
@@ -12656,7 +12658,7 @@ const Gw = async (r, e, t, n) => {
|
|
|
12656
12658
|
}), Promise.all(Y).then(() => {
|
|
12657
12659
|
t(Array.from(x.values()), G, K), K?.fromCache === !1 && x.forEach((U) => {
|
|
12658
12660
|
const Z = ["read", U, U.id, A];
|
|
12659
|
-
ce("postOperation",
|
|
12661
|
+
ce("postOperation", y, T, Z), ce("postRead", y, T, [A, C, U, !0]);
|
|
12660
12662
|
});
|
|
12661
12663
|
});
|
|
12662
12664
|
}, z = (G, K) => {
|
|
@@ -12714,11 +12716,11 @@ const Gw = async (r, e, t, n) => {
|
|
|
12714
12716
|
for (const [se, Xe] of Object.entries(ge))
|
|
12715
12717
|
if (Te.has(se)) {
|
|
12716
12718
|
const ut = async () => {
|
|
12717
|
-
ge[se].id ? (Z.set(se, !0), Array.from(Z.values()).every((
|
|
12719
|
+
ge[se].id ? (Z.set(se, !0), Array.from(Z.values()).every((Be) => Be) && w.set(j, "loaded")) : setTimeout(ut, 100);
|
|
12718
12720
|
};
|
|
12719
12721
|
ut();
|
|
12720
12722
|
} else {
|
|
12721
|
-
const ut = o.collections[H.collection], { access:
|
|
12723
|
+
const ut = o.collections[H.collection], { access: Be } = ut, { serverReadOnly: xe } = Be;
|
|
12722
12724
|
xe?.includes(a.Role) ? _r([...Xe.Collection_Path], se).then((Re) => {
|
|
12723
12725
|
if (!Re) {
|
|
12724
12726
|
delete ge[se];
|
|
@@ -12783,18 +12785,18 @@ const Gw = async (r, e, t, n) => {
|
|
|
12783
12785
|
K.id ||= j.id, K = { ...K, ...Y }, delete K.Collection_Path_String;
|
|
12784
12786
|
const U = M.get(j.id) || /* @__PURE__ */ new Map(), Z = U.get(G) || /* @__PURE__ */ new Set();
|
|
12785
12787
|
lm(Y, Z), U.set(G, Z), M.set(j.id, U), x.set(j.id, K);
|
|
12786
|
-
}, Me = s?.only === "cache" ||
|
|
12788
|
+
}, Me = s?.only === "cache" || g;
|
|
12787
12789
|
for (const G of R) {
|
|
12788
12790
|
let K = !0;
|
|
12789
12791
|
const j = dr(G, { source: Me ? "cache" : "default", includeMetadataChanges: !0 }, (Y) => {
|
|
12790
|
-
(Me || Y.metadata.fromCache === !1) && (b.set(G, !0),
|
|
12792
|
+
(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) => {
|
|
12791
12793
|
const Z = x.get(U.id) || {}, Te = D.get(U.id) || 0;
|
|
12792
12794
|
D.set(U.id, Te + 1), ne(G, Z, U);
|
|
12793
12795
|
}), K = !1) : Y.docChanges().forEach((U) => {
|
|
12794
12796
|
const Z = x.get(U.doc.id) || {}, Te = D.get(U.doc.id) || 0;
|
|
12795
12797
|
U.type === "added" && D.set(U.doc.id, Te + 1), U.type === "added" || U.type === "modified" ? ne(G, Z, U.doc) : U.type === "removed" && (D.set(U.doc.id, Te - 1), D.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))));
|
|
12796
|
-
}), b.size === R.length && s?.relations && (x.size === 0 && z(
|
|
12797
|
-
F(U,
|
|
12798
|
+
}), b.size === R.length && s?.relations && (x.size === 0 && z(v, Y.metadata), x.forEach((U) => {
|
|
12799
|
+
F(U, v);
|
|
12798
12800
|
})));
|
|
12799
12801
|
}, (Y) => {
|
|
12800
12802
|
n && n(new Error(`Error fetching documents at location ${r.join("/")}`, { cause: Y })), O.forEach((U) => U());
|
|
@@ -12802,7 +12804,7 @@ const Gw = async (r, e, t, n) => {
|
|
|
12802
12804
|
O.push(j);
|
|
12803
12805
|
}
|
|
12804
12806
|
let Se, Le;
|
|
12805
|
-
if (s?.pagination && !
|
|
12807
|
+
if (s?.pagination && !d?.roles.includes(a.Role) && !E?.includes(a.Role)) {
|
|
12806
12808
|
let G = me(C[0], ...e);
|
|
12807
12809
|
s.pagination.orderByField && s.pagination.orderByDirection && (G = me(G, rt(s.pagination.orderByField, s.pagination.orderByDirection)));
|
|
12808
12810
|
const K = await Ed(G).catch(() => {
|
|
@@ -12814,17 +12816,17 @@ const Gw = async (r, e, t, n) => {
|
|
|
12814
12816
|
}
|
|
12815
12817
|
}
|
|
12816
12818
|
return { pages: Le, count: Se, unsubscribe: (G) => {
|
|
12817
|
-
G === "first" && Ja(
|
|
12819
|
+
G === "first" && Ja(v), G === "last" && Qa(v), O.forEach((K) => K());
|
|
12818
12820
|
} };
|
|
12819
12821
|
}, ib = async (r, e) => {
|
|
12820
|
-
const t = it(), n =
|
|
12822
|
+
const t = it(), n = ze(), s = Ue(t, n.STOKER_FB_FUNCTIONS_REGION);
|
|
12821
12823
|
return (await Je(s, "stoker-getfiles")({
|
|
12822
12824
|
collectionPath: e.Collection_Path,
|
|
12823
12825
|
id: e.id,
|
|
12824
12826
|
path: r
|
|
12825
12827
|
})).data.result;
|
|
12826
12828
|
}, Fw = async (r, e, t, n, s, i) => {
|
|
12827
|
-
const a = it(), o =
|
|
12829
|
+
const a = it(), o = ze(), c = Ue(a, o.STOKER_FB_FUNCTIONS_REGION);
|
|
12828
12830
|
await Je(c, "stoker-adminemail")({
|
|
12829
12831
|
subject: r,
|
|
12830
12832
|
text: e,
|
|
@@ -12834,34 +12836,34 @@ const Gw = async (r, e, t, n) => {
|
|
|
12834
12836
|
replyTo: i
|
|
12835
12837
|
});
|
|
12836
12838
|
}, ab = async (r, e, t, n, s, i, a, o, c) => {
|
|
12837
|
-
if (
|
|
12839
|
+
if (ze().MODE === "development") {
|
|
12838
12840
|
await Fw(e, t, n, s, i, a);
|
|
12839
12841
|
return;
|
|
12840
12842
|
}
|
|
12841
|
-
const f = Ha(r),
|
|
12843
|
+
const f = Ha(r), h = cw(e), d = t ? pd(t) : void 0, m = 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, T = Array.isArray(f) ? f : [f];
|
|
12842
12844
|
if (T.length === 0 || T.length === 1 && !T[0])
|
|
12843
12845
|
throw new Error("No valid email addresses provided");
|
|
12844
|
-
const P =
|
|
12845
|
-
if (
|
|
12846
|
+
const P = We(), g = { to: f, message: { subject: h } };
|
|
12847
|
+
if (d && (g.message.text = d), m && (g.message.html = m), E) {
|
|
12846
12848
|
const C = Array.isArray(E) ? E : [E];
|
|
12847
|
-
C.length > 0 && C[0] && (
|
|
12849
|
+
C.length > 0 && C[0] && (g.cc = E);
|
|
12848
12850
|
}
|
|
12849
|
-
if (
|
|
12850
|
-
const C = Array.isArray(
|
|
12851
|
-
C.length > 0 && C[0] && (
|
|
12851
|
+
if (y) {
|
|
12852
|
+
const C = Array.isArray(y) ? y : [y];
|
|
12853
|
+
C.length > 0 && C[0] && (g.bcc = y);
|
|
12852
12854
|
}
|
|
12853
|
-
|
|
12855
|
+
_ && (g.replyTo = _), o && (g.message.attachments = o), S && (g.from = S), await Td(qr(P, "system_mail"), g);
|
|
12854
12856
|
}, Dw = async (r) => {
|
|
12855
|
-
const e = it(), t =
|
|
12857
|
+
const e = it(), t = ze(), n = Ue(e, t.STOKER_FB_FUNCTIONS_REGION);
|
|
12856
12858
|
await Je(n, "stoker-adminsms")({
|
|
12857
12859
|
body: r
|
|
12858
12860
|
});
|
|
12859
12861
|
}, ob = async (r, e) => {
|
|
12860
|
-
if (
|
|
12862
|
+
if (ze().MODE === "development") {
|
|
12861
12863
|
await Dw(e);
|
|
12862
12864
|
return;
|
|
12863
12865
|
}
|
|
12864
|
-
const s =
|
|
12866
|
+
const s = We(), i = { to: r, body: e };
|
|
12865
12867
|
await Td(qr(s, "system_messages"), i);
|
|
12866
12868
|
}, cb = (r) => {
|
|
12867
12869
|
const e = Cm();
|
|
@@ -12900,7 +12902,7 @@ export {
|
|
|
12900
12902
|
De as getCurrentUserPermissions,
|
|
12901
12903
|
Jr as getCurrentUserRoleGroups,
|
|
12902
12904
|
dm as getDocumentRefs,
|
|
12903
|
-
|
|
12905
|
+
ze as getEnv,
|
|
12904
12906
|
ib as getFiles,
|
|
12905
12907
|
Am as getFirestoreMaintenance,
|
|
12906
12908
|
gc as getFirestoreWrite,
|
|
@@ -12911,7 +12913,7 @@ export {
|
|
|
12911
12913
|
Cw as getNetworkStatus,
|
|
12912
12914
|
_r as getOne,
|
|
12913
12915
|
mw as getOneServer,
|
|
12914
|
-
|
|
12916
|
+
Ve as getSchema,
|
|
12915
12917
|
pm as getSome,
|
|
12916
12918
|
hw as getSomeServer,
|
|
12917
12919
|
Mt as getTenant,
|