@stoker-platform/web-client 0.5.12 → 0.5.13
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 +300 -297
- package/dist/types/read/cache/preloadCollection.d.ts +2 -2
- package/package.json +1 -1
package/dist/bundle.js
CHANGED
|
@@ -8,7 +8,7 @@ import { getFunctions as $e, httpsCallable as Ye, connectFunctionsEmulator as up
|
|
|
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.12", yp = (r) => !!r.auth, vt = (r, e) => {
|
|
12
12
|
if (e?.operations)
|
|
13
13
|
return e.operations.includes(r);
|
|
14
14
|
}, Cn = (r, e) => e ? e.Role ? r.access?.includes(e.Role) : !1 : !0, gp = (r, e) => r.restrictCreate === !0 ? !1 : e && typeof r.restrictCreate == "object" ? e.Role ? r.restrictCreate?.includes(e.Role) : !1 : !0, _p = (r, e) => r.restrictUpdate === !0 ? !1 : e && typeof r.restrictUpdate == "object" ? e.Role ? r.restrictUpdate?.includes(e.Role) : !1 : !0, re = (r, e) => r.filter((t) => t.name === e)[0], ge = (r) => ["OneToOne", "OneToMany", "ManyToOne", "ManyToMany"].includes(r.type), Rd = (r, e) => {
|
|
@@ -76,8 +76,8 @@ const pp = "0.5.11", yp = (r) => !!r.auth, vt = (r, e) => {
|
|
|
76
76
|
}), u?.filter((y) => y.type === "Record_Property").forEach((y) => {
|
|
77
77
|
if ("operations" in y && y.operations && !y.operations.includes(r))
|
|
78
78
|
return;
|
|
79
|
-
const A = re(o, y.propertyField), R = y.roles.find((
|
|
80
|
-
A.type === "Array" ? R.values?.some((
|
|
79
|
+
const A = re(o, y.propertyField), R = y.roles.find((_) => _.role === s.Role);
|
|
80
|
+
A.type === "Array" ? R.values?.some((_) => i[A.name].includes(_)) || (l = !1) : R.values?.includes(i[A.name]) || (l = !1);
|
|
81
81
|
});
|
|
82
82
|
let h = !0, m = !1;
|
|
83
83
|
f?.filter((y) => y.type === "Individual").forEach(() => {
|
|
@@ -91,8 +91,8 @@ const pp = "0.5.11", yp = (r) => !!r.auth, vt = (r, e) => {
|
|
|
91
91
|
}), f?.filter((y) => y.type === "Parent_Property").forEach((y) => {
|
|
92
92
|
g = !0;
|
|
93
93
|
const A = re(o, y.collectionField), R = re(o, y.propertyField);
|
|
94
|
-
Object.entries(c?.parentPropertyEntities || {}).some((
|
|
95
|
-
const [C, p] =
|
|
94
|
+
Object.entries(c?.parentPropertyEntities || {}).some((_) => {
|
|
95
|
+
const [C, p] = _;
|
|
96
96
|
return C === i[R.name] && i[`${A.name}_Array`].some((k) => p.includes(k));
|
|
97
97
|
}) || (E = !1);
|
|
98
98
|
}), m && g) {
|
|
@@ -104,42 +104,42 @@ const pp = "0.5.11", yp = (r) => !!r.auth, vt = (r, e) => {
|
|
|
104
104
|
l = !1;
|
|
105
105
|
return;
|
|
106
106
|
}
|
|
107
|
-
let
|
|
107
|
+
let v = !0, S = !1;
|
|
108
108
|
d?.filter((y) => y.parentFilter.type === "Individual").forEach((y) => {
|
|
109
|
-
|
|
110
|
-
const { parentFilter: A } = y, R = re(o, A.collectionField),
|
|
111
|
-
if (!
|
|
109
|
+
S = !0;
|
|
110
|
+
const { parentFilter: A } = y, R = re(o, A.collectionField), _ = s.collections?.[R.collection];
|
|
111
|
+
if (!_) {
|
|
112
112
|
l = !1;
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
115
|
-
|
|
115
|
+
_.individualEntities?.some((C) => i[`${R.name}_Array`].includes(C)) || (v = !1);
|
|
116
116
|
});
|
|
117
|
-
let
|
|
117
|
+
let T = !0, P = !1;
|
|
118
118
|
if (d?.filter((y) => y.parentFilter.type === "Parent").forEach((y) => {
|
|
119
119
|
P = !0;
|
|
120
|
-
const { parentFilter: A } = y, R = re(o, A.collectionField),
|
|
120
|
+
const { parentFilter: A } = y, R = re(o, A.collectionField), _ = re(o, A.parentCollectionField), C = s.collections?.[R.collection];
|
|
121
121
|
if (!C) {
|
|
122
122
|
l = !1;
|
|
123
123
|
return;
|
|
124
124
|
}
|
|
125
|
-
C.parentEntities?.some((p) => i[`${
|
|
125
|
+
C.parentEntities?.some((p) => i[`${_.name}_Array`].includes(p)) || (T = !1);
|
|
126
126
|
}), d?.filter((y) => y.parentFilter.type === "Parent_Property").forEach((y) => {
|
|
127
127
|
P = !0;
|
|
128
|
-
const { parentFilter: A } = y, R = re(o, A.collectionField),
|
|
128
|
+
const { parentFilter: A } = y, R = re(o, A.collectionField), _ = re(o, A.parentPropertyField), C = re(o, A.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[
|
|
136
|
-
}) || (
|
|
137
|
-
}),
|
|
138
|
-
if (!(
|
|
135
|
+
return I === i[_.name] && i[`${C.name}_Array`].some((w) => b.includes(w));
|
|
136
|
+
}) || (T = !1);
|
|
137
|
+
}), S && P) {
|
|
138
|
+
if (!(v || T)) {
|
|
139
139
|
l = !1;
|
|
140
140
|
return;
|
|
141
141
|
}
|
|
142
|
-
} else if (!
|
|
142
|
+
} else if (!v || !T) {
|
|
143
143
|
l = !1;
|
|
144
144
|
return;
|
|
145
145
|
}
|
|
@@ -729,31 +729,31 @@ function xd() {
|
|
|
729
729
|
var E = f.get(a), g = f.get(o);
|
|
730
730
|
if (E && g)
|
|
731
731
|
return E == o && g == a;
|
|
732
|
-
var
|
|
733
|
-
for (f.set(a, o), f.set(o, a); ++
|
|
734
|
-
var P = a[
|
|
732
|
+
var v = -1, S = !0, T = c & s ? new r() : void 0;
|
|
733
|
+
for (f.set(a, o), f.set(o, a); ++v < h; ) {
|
|
734
|
+
var P = a[v], y = o[v];
|
|
735
735
|
if (l)
|
|
736
|
-
var A = d ? l(y, P,
|
|
736
|
+
var A = d ? l(y, P, v, o, a, f) : l(P, y, v, a, o, f);
|
|
737
737
|
if (A !== void 0) {
|
|
738
738
|
if (A)
|
|
739
739
|
continue;
|
|
740
|
-
|
|
740
|
+
S = !1;
|
|
741
741
|
break;
|
|
742
742
|
}
|
|
743
|
-
if (
|
|
744
|
-
if (!e(o, function(R,
|
|
745
|
-
if (!t(
|
|
746
|
-
return
|
|
743
|
+
if (T) {
|
|
744
|
+
if (!e(o, function(R, _) {
|
|
745
|
+
if (!t(T, _) && (P === R || u(P, R, c, l, f)))
|
|
746
|
+
return T.push(_);
|
|
747
747
|
})) {
|
|
748
|
-
|
|
748
|
+
S = !1;
|
|
749
749
|
break;
|
|
750
750
|
}
|
|
751
751
|
} else if (!(P === y || u(P, y, c, l, f))) {
|
|
752
|
-
|
|
752
|
+
S = !1;
|
|
753
753
|
break;
|
|
754
754
|
}
|
|
755
755
|
}
|
|
756
|
-
return f.delete(a), f.delete(o),
|
|
756
|
+
return f.delete(a), f.delete(o), S;
|
|
757
757
|
}
|
|
758
758
|
return zs = i, zs;
|
|
759
759
|
}
|
|
@@ -792,14 +792,14 @@ 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]", d = "[object Number]", h = "[object RegExp]", m = "[object Set]", E = "[object String]", g = "[object Symbol]",
|
|
796
|
-
function y(A, R,
|
|
797
|
-
switch (
|
|
798
|
-
case
|
|
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]", d = "[object Number]", h = "[object RegExp]", m = "[object Set]", E = "[object String]", g = "[object Symbol]", v = "[object ArrayBuffer]", S = "[object DataView]", T = r ? r.prototype : void 0, P = T ? T.valueOf : void 0;
|
|
796
|
+
function y(A, R, _, C, p, k, I) {
|
|
797
|
+
switch (_) {
|
|
798
|
+
case S:
|
|
799
799
|
if (A.byteLength != R.byteLength || A.byteOffset != R.byteOffset)
|
|
800
800
|
return !1;
|
|
801
801
|
A = A.buffer, R = R.buffer;
|
|
802
|
-
case
|
|
802
|
+
case v:
|
|
803
803
|
return !(A.byteLength != R.byteLength || !k(new e(A), new e(R)));
|
|
804
804
|
case c:
|
|
805
805
|
case l:
|
|
@@ -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]", d = "[object RegExp]", h = "[object Set]", m = "[object String]", E = "[object WeakMap]", g = "[object ArrayBuffer]",
|
|
979
|
-
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]", d = "[object RegExp]", h = "[object Set]", m = "[object String]", E = "[object WeakMap]", g = "[object ArrayBuffer]", v = "[object DataView]", S = "[object Float32Array]", T = "[object Float64Array]", P = "[object Int8Array]", y = "[object Int16Array]", A = "[object Int32Array]", R = "[object Uint8Array]", _ = "[object Uint8ClampedArray]", C = "[object Uint16Array]", p = "[object Uint32Array]", k = {};
|
|
979
|
+
k[S] = k[T] = k[P] = k[y] = k[A] = k[R] = k[_] = k[C] = k[p] = !0, k[n] = k[s] = k[g] = k[i] = k[v] = k[a] = k[o] = k[c] = k[l] = k[u] = k[f] = k[d] = k[h] = k[m] = k[E] = !1;
|
|
980
980
|
function I(b) {
|
|
981
981
|
return t(b) && e(b.length) && !!k[r(b)];
|
|
982
982
|
}
|
|
@@ -1021,13 +1021,13 @@ function Ld() {
|
|
|
1021
1021
|
Yl = 1;
|
|
1022
1022
|
var r = ny(), e = Pd(), t = Ft(), n = Mn(), s = qo(), i = jo(), a = Object.prototype, o = a.hasOwnProperty;
|
|
1023
1023
|
function c(l, u) {
|
|
1024
|
-
var f = t(l), d = !f && e(l), h = !f && !d && n(l), m = !f && !d && !h && i(l), E = f || d || h || m, g = E ? r(l.length, String) : [],
|
|
1025
|
-
for (var
|
|
1026
|
-
(u || o.call(l,
|
|
1027
|
-
(
|
|
1028
|
-
h && (
|
|
1029
|
-
m && (
|
|
1030
|
-
s(
|
|
1024
|
+
var f = t(l), d = !f && e(l), h = !f && !d && n(l), m = !f && !d && !h && i(l), E = f || d || h || m, g = E ? r(l.length, String) : [], v = g.length;
|
|
1025
|
+
for (var S in l)
|
|
1026
|
+
(u || o.call(l, S)) && !(E && // Safari 9 has enumerable `arguments.length` in strict mode.
|
|
1027
|
+
(S == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
|
|
1028
|
+
h && (S == "offset" || S == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
1029
|
+
m && (S == "buffer" || S == "byteLength" || S == "byteOffset") || // Skip index properties.
|
|
1030
|
+
s(S, v))) && g.push(S);
|
|
1031
1031
|
return g;
|
|
1032
1032
|
}
|
|
1033
1033
|
return fi = c, fi;
|
|
@@ -1116,25 +1116,25 @@ function ly() {
|
|
|
1116
1116
|
if (h != E && !f)
|
|
1117
1117
|
return !1;
|
|
1118
1118
|
for (var g = h; g--; ) {
|
|
1119
|
-
var
|
|
1120
|
-
if (!(f ?
|
|
1119
|
+
var v = d[g];
|
|
1120
|
+
if (!(f ? v in a : n.call(a, v)))
|
|
1121
1121
|
return !1;
|
|
1122
1122
|
}
|
|
1123
|
-
var
|
|
1124
|
-
if (
|
|
1125
|
-
return
|
|
1123
|
+
var S = u.get(i), T = u.get(a);
|
|
1124
|
+
if (S && T)
|
|
1125
|
+
return S == a && T == i;
|
|
1126
1126
|
var P = !0;
|
|
1127
1127
|
u.set(i, a), u.set(a, i);
|
|
1128
1128
|
for (var y = f; ++g < h; ) {
|
|
1129
|
-
|
|
1130
|
-
var A = i[
|
|
1129
|
+
v = d[g];
|
|
1130
|
+
var A = i[v], R = a[v];
|
|
1131
1131
|
if (c)
|
|
1132
|
-
var
|
|
1133
|
-
if (!(
|
|
1132
|
+
var _ = f ? c(R, A, v, a, i, u) : c(A, R, v, i, a, u);
|
|
1133
|
+
if (!(_ === void 0 ? A === R || l(A, R, o, c, u) : _)) {
|
|
1134
1134
|
P = !1;
|
|
1135
1135
|
break;
|
|
1136
1136
|
}
|
|
1137
|
-
y || (y =
|
|
1137
|
+
y || (y = v == "constructor");
|
|
1138
1138
|
}
|
|
1139
1139
|
if (P && !y) {
|
|
1140
1140
|
var C = i.constructor, p = a.constructor;
|
|
@@ -1176,9 +1176,9 @@ 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]", d = "[object DataView]", h = a(r), m = a(e), E = a(t), g = a(n),
|
|
1180
|
-
return (r &&
|
|
1181
|
-
var P = i(
|
|
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]", d = "[object DataView]", h = a(r), m = a(e), E = a(t), g = a(n), v = a(s), S = i;
|
|
1180
|
+
return (r && S(new r(new ArrayBuffer(1))) != d || 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), y = P == c ? T.constructor : void 0, A = y ? a(y) : "";
|
|
1182
1182
|
if (A)
|
|
1183
1183
|
switch (A) {
|
|
1184
1184
|
case h:
|
|
@@ -1189,36 +1189,36 @@ function qn() {
|
|
|
1189
1189
|
return l;
|
|
1190
1190
|
case g:
|
|
1191
1191
|
return u;
|
|
1192
|
-
case
|
|
1192
|
+
case v:
|
|
1193
1193
|
return f;
|
|
1194
1194
|
}
|
|
1195
1195
|
return P;
|
|
1196
|
-
}), Si =
|
|
1196
|
+
}), Si = S, Si;
|
|
1197
1197
|
}
|
|
1198
1198
|
var Ti, uu;
|
|
1199
1199
|
function my() {
|
|
1200
1200
|
if (uu) return Ti;
|
|
1201
1201
|
uu = 1;
|
|
1202
1202
|
var r = Mo(), e = xd(), t = ty(), n = ly(), s = qn(), i = Ft(), a = Mn(), o = jo(), c = 1, l = "[object Arguments]", u = "[object Array]", f = "[object Object]", d = Object.prototype, h = d.hasOwnProperty;
|
|
1203
|
-
function m(E, g,
|
|
1204
|
-
var y = i(E), A = i(g), R = y ? u : s(E),
|
|
1205
|
-
R = R == l ? f : R,
|
|
1206
|
-
var C = R == f, p =
|
|
1203
|
+
function m(E, g, v, S, T, P) {
|
|
1204
|
+
var y = i(E), A = i(g), R = y ? u : s(E), _ = A ? u : s(g);
|
|
1205
|
+
R = R == l ? f : R, _ = _ == l ? f : _;
|
|
1206
|
+
var C = R == f, p = _ == f, k = R == _;
|
|
1207
1207
|
if (k && a(E)) {
|
|
1208
1208
|
if (!a(g))
|
|
1209
1209
|
return !1;
|
|
1210
1210
|
y = !0, C = !1;
|
|
1211
1211
|
}
|
|
1212
1212
|
if (k && !C)
|
|
1213
|
-
return P || (P = new r()), y || o(E) ? e(E, g,
|
|
1214
|
-
if (!(
|
|
1213
|
+
return P || (P = new r()), y || o(E) ? e(E, g, v, S, T, P) : t(E, g, R, v, S, T, P);
|
|
1214
|
+
if (!(v & c)) {
|
|
1215
1215
|
var I = C && h.call(E, "__wrapped__"), b = p && h.call(g, "__wrapped__");
|
|
1216
1216
|
if (I || b) {
|
|
1217
1217
|
var w = I ? E.value() : E, O = b ? g.value() : g;
|
|
1218
|
-
return P || (P = new r()),
|
|
1218
|
+
return P || (P = new r()), T(w, O, v, S, P);
|
|
1219
1219
|
}
|
|
1220
1220
|
}
|
|
1221
|
-
return k ? (P || (P = new r()), n(E, g,
|
|
1221
|
+
return k ? (P || (P = new r()), n(E, g, v, S, T, P)) : !1;
|
|
1222
1222
|
}
|
|
1223
1223
|
return Ti = m, Ti;
|
|
1224
1224
|
}
|
|
@@ -1280,8 +1280,8 @@ const _y = /* @__PURE__ */ In(gy), vy = (r, e, t, n, s, i, a, o, c) => {
|
|
|
1280
1280
|
(!dn("Update", n, s, i, a, e) || // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
1281
1281
|
!dn("Update", n, s, i, a, h)) && (m = !1, E = "Authenticated user does not have Update access to this document");
|
|
1282
1282
|
for (const g of f) {
|
|
1283
|
-
const
|
|
1284
|
-
g.access && !Cn(g, a) &&
|
|
1283
|
+
const v = r[g.name];
|
|
1284
|
+
g.access && !Cn(g, a) && v !== void 0 && (E = `Authenticated user does not have access to field ${g.name}`, m = !1), v !== void 0 && !_p(g, a) && (E = `Authenticated user does not have Update access to field ${g.name}`, m = !1);
|
|
1285
1285
|
}
|
|
1286
1286
|
if (!m)
|
|
1287
1287
|
throw E && console.error(`PERMISSION_DENIED: ${E}`), new Error("PERMISSION_DENIED");
|
|
@@ -1590,18 +1590,18 @@ function Dy() {
|
|
|
1590
1590
|
if (Du) return Hi;
|
|
1591
1591
|
Du = 1;
|
|
1592
1592
|
var r = Wd(), e = zd(), t = Bd(), n = Zd(), s = Gd(), i = Pd(), a = Ft(), o = ky(), c = Mn(), l = No(), u = wt(), f = Iy(), d = jo(), h = Hd(), m = Fy();
|
|
1593
|
-
function E(g,
|
|
1594
|
-
var R = h(g,
|
|
1593
|
+
function E(g, v, S, T, P, y, A) {
|
|
1594
|
+
var R = h(g, S), _ = h(v, S), C = A.get(_);
|
|
1595
1595
|
if (C) {
|
|
1596
|
-
r(g,
|
|
1596
|
+
r(g, S, C);
|
|
1597
1597
|
return;
|
|
1598
1598
|
}
|
|
1599
|
-
var p = y ? y(R,
|
|
1599
|
+
var p = y ? y(R, _, S + "", g, v, A) : void 0, k = p === void 0;
|
|
1600
1600
|
if (k) {
|
|
1601
|
-
var I = a(
|
|
1602
|
-
p =
|
|
1601
|
+
var I = a(_), b = !I && c(_), w = !I && !b && d(_);
|
|
1602
|
+
p = _, I || b || w ? a(R) ? p = R : o(R) ? p = n(R) : b ? (k = !1, p = e(_, !0)) : w ? (k = !1, p = t(_, !0)) : p = [] : f(_) || i(_) ? (p = R, i(R) ? p = m(R) : (!u(R) || l(R)) && (p = s(_))) : k = !1;
|
|
1603
1603
|
}
|
|
1604
|
-
k && (A.set(
|
|
1604
|
+
k && (A.set(_, p), P(p, _, T, y, A), A.delete(_)), r(g, S, p);
|
|
1605
1605
|
}
|
|
1606
1606
|
return Hi = E, Hi;
|
|
1607
1607
|
}
|
|
@@ -8347,7 +8347,7 @@ function Av(r) {
|
|
|
8347
8347
|
return r.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
|
|
8348
8348
|
}
|
|
8349
8349
|
function Cv(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}"), d = et(e, "{4,6}"), h = (g) => ({ regex: RegExp(Av(g.val)), deser: ([
|
|
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}"), d = et(e, "{4,6}"), h = (g) => ({ regex: RegExp(Av(g.val)), deser: ([v]) => v, literal: !0 }), E = ((g) => {
|
|
8351
8351
|
if (r.literal)
|
|
8352
8352
|
return h(g);
|
|
8353
8353
|
switch (g.val) {
|
|
@@ -9077,20 +9077,20 @@ class Z {
|
|
|
9077
9077
|
if (d && u)
|
|
9078
9078
|
throw new er("Can't mix ordinal dates with month/day");
|
|
9079
9079
|
const E = m || i.weekday && !h;
|
|
9080
|
-
let g,
|
|
9081
|
-
E ? (g = $v,
|
|
9082
|
-
let
|
|
9080
|
+
let g, v, S = sn(c, l);
|
|
9081
|
+
E ? (g = $v, v = qv, S = On(S, a, o)) : u ? (g = jv, v = Lv, S = Sa(S)) : (g = ln, v = am);
|
|
9082
|
+
let T = !1;
|
|
9083
9083
|
for (const p of g) {
|
|
9084
9084
|
const k = i[p];
|
|
9085
|
-
X(k) ?
|
|
9085
|
+
X(k) ? T ? i[p] = v[p] : i[p] = S[p] : T = !0;
|
|
9086
9086
|
}
|
|
9087
9087
|
const P = E ? y_(i, a, o) : u ? g_(i) : Nh(i), y = P || Fh(i);
|
|
9088
9088
|
if (y)
|
|
9089
9089
|
return Z.invalid(y);
|
|
9090
|
-
const A = E ? If(i, a, o) : u ? xf(i) : i, [R,
|
|
9090
|
+
const A = E ? If(i, a, o) : u ? xf(i) : i, [R, _] = cn(A, l, n), C = new Z({
|
|
9091
9091
|
ts: R,
|
|
9092
9092
|
zone: n,
|
|
9093
|
-
o:
|
|
9093
|
+
o: _,
|
|
9094
9094
|
loc: s
|
|
9095
9095
|
});
|
|
9096
9096
|
return i.weekday && h && e.weekday !== C.weekday ? Z.invalid(
|
|
@@ -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, d, h, m, E, g,
|
|
10489
|
+
}, ac = (r, e, t, n, s, i, a, o, c, l, u, f, d, h, m, E, g, v, S, T, P) => {
|
|
10490
10490
|
const { fields: y } = a;
|
|
10491
|
-
y.filter((
|
|
10492
|
-
r !== "delete" && (typeof s[
|
|
10491
|
+
y.filter((_) => "unique" in _ && _.unique).forEach((_) => {
|
|
10492
|
+
r !== "delete" && (typeof s[_.name] == "string" || typeof s[_.name] == "number") && e.set(h(_, s[_.name].toString().toLowerCase().replace(/\s/g, "---").replaceAll("/", "|||")), {
|
|
10493
10493
|
id: n,
|
|
10494
10494
|
Collection_Path: t
|
|
10495
10495
|
});
|
|
10496
|
-
}), y.forEach((
|
|
10497
|
-
if (cg(
|
|
10498
|
-
const C = fg(
|
|
10499
|
-
s[
|
|
10496
|
+
}), y.forEach((_) => {
|
|
10497
|
+
if (cg(_, a, i)) {
|
|
10498
|
+
const C = fg(_, a, i), p = {};
|
|
10499
|
+
s[_.name] !== void 0 && (p[_.name] = s[_.name], ge(_) && (p[`${_.name}_Array`] = s[`${_.name}_Array`])), C.forEach((k) => {
|
|
10500
10500
|
s[k.name] !== void 0 && (ge(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(d(
|
|
10501
|
+
}), Object.keys(p).length > 0 && (r === "create" && (p.Collection_Path = t, p.Collection_Path_String = t.join("/"), e.set(d(_), p)), r === "update" && e.update(d(_), p), r === "delete" && e.delete(d(_)));
|
|
10502
10502
|
}
|
|
10503
10503
|
});
|
|
10504
10504
|
const A = c[a.labels.collection];
|
|
10505
|
-
for (const
|
|
10506
|
-
const C = dg(
|
|
10505
|
+
for (const _ of A) {
|
|
10506
|
+
const C = dg(_, a), p = { ...s };
|
|
10507
10507
|
C.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(_.key), p)), r === "update" && e.update(m(_.key), p), r === "delete" && e.delete(m(_.key)));
|
|
10510
10510
|
}
|
|
10511
10511
|
if (r === "delete")
|
|
10512
10512
|
return;
|
|
10513
|
-
const R = y.filter((
|
|
10513
|
+
const R = y.filter((_) => ge(_) && _.twoWay);
|
|
10514
10514
|
if (!o?.noTwoWay) {
|
|
10515
|
-
for (const
|
|
10515
|
+
for (const _ of R)
|
|
10516
10516
|
throw new Error("VALIDATION_ERROR: batchSize is required");
|
|
10517
|
-
for (const
|
|
10517
|
+
for (const _ of R)
|
|
10518
10518
|
throw new Error("VALIDATION_ERROR: batchSize is required");
|
|
10519
|
-
for (const
|
|
10519
|
+
for (const _ of R)
|
|
10520
10520
|
throw new Error("VALIDATION_ERROR: batchSize is required");
|
|
10521
10521
|
}
|
|
10522
10522
|
};
|
|
@@ -10639,8 +10639,8 @@ 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]", d = "[object Symbol]", h = "[object ArrayBuffer]", m = "[object DataView]", E = "[object Float32Array]", g = "[object Float64Array]",
|
|
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]", d = "[object Symbol]", h = "[object ArrayBuffer]", m = "[object DataView]", E = "[object Float32Array]", g = "[object Float64Array]", v = "[object Int8Array]", S = "[object Int16Array]", T = "[object Int32Array]", P = "[object Uint8Array]", y = "[object Uint8ClampedArray]", A = "[object Uint16Array]", R = "[object Uint32Array]";
|
|
10643
|
+
function _(C, p, k) {
|
|
10644
10644
|
var I = C.constructor;
|
|
10645
10645
|
switch (p) {
|
|
10646
10646
|
case h:
|
|
@@ -10652,9 +10652,9 @@ function Qv() {
|
|
|
10652
10652
|
return e(C, k);
|
|
10653
10653
|
case E:
|
|
10654
10654
|
case g:
|
|
10655
|
-
case
|
|
10656
|
-
case T:
|
|
10655
|
+
case v:
|
|
10657
10656
|
case S:
|
|
10657
|
+
case T:
|
|
10658
10658
|
case P:
|
|
10659
10659
|
case y:
|
|
10660
10660
|
case A:
|
|
@@ -10673,7 +10673,7 @@ function Qv() {
|
|
|
10673
10673
|
return n(C);
|
|
10674
10674
|
}
|
|
10675
10675
|
}
|
|
10676
|
-
return Ua =
|
|
10676
|
+
return Ua = _, Ua;
|
|
10677
10677
|
}
|
|
10678
10678
|
var Va, ld;
|
|
10679
10679
|
function Xv() {
|
|
@@ -10713,13 +10713,13 @@ 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(), d = Hv(), h = Qv(), m = Gd(), E = Ft(), g = Mn(),
|
|
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(), d = Hv(), h = Qv(), m = Gd(), E = Ft(), g = Mn(), v = ew(), S = wt(), T = rw(), P = Vo(), y = Br(), A = 1, R = 2, _ = 4, C = "[object Arguments]", p = "[object Array]", k = "[object Boolean]", I = "[object Date]", b = "[object Error]", w = "[object Function]", O = "[object GeneratorFunction]", x = "[object Map]", F = "[object Number]", M = "[object Object]", D = "[object RegExp]", Y = "[object Set]", J = "[object String]", W = "[object Symbol]", q = "[object WeakMap]", H = "[object ArrayBuffer]", Ie = "[object DataView]", Qe = "[object Float32Array]", Ee = "[object Float64Array]", Ve = "[object Int8Array]", Mt = "[object Int16Array]", j = "[object Int32Array]", ae = "[object Uint8Array]", z = "[object Uint8ClampedArray]", Q = "[object Uint16Array]", U = "[object Uint32Array]", G = {};
|
|
10717
10717
|
G[C] = G[p] = G[H] = G[Ie] = G[k] = G[I] = G[Qe] = G[Ee] = G[Ve] = G[Mt] = G[j] = G[x] = G[F] = G[M] = G[D] = G[Y] = G[J] = G[W] = G[ae] = G[z] = G[Q] = G[U] = !0, G[b] = G[w] = G[q] = !1;
|
|
10718
10718
|
function Se(K, ye, ne, Xe, ut, We) {
|
|
10719
|
-
var xe, vr = ye & A, Te = ye & R, wr = ye &
|
|
10719
|
+
var xe, vr = ye & A, Te = ye & R, wr = ye & _;
|
|
10720
10720
|
if (ne && (xe = ut ? ne(K, Xe, ut, We) : ne(K)), xe !== void 0)
|
|
10721
10721
|
return xe;
|
|
10722
|
-
if (!
|
|
10722
|
+
if (!S(K))
|
|
10723
10723
|
return K;
|
|
10724
10724
|
var _c = E(K);
|
|
10725
10725
|
if (_c) {
|
|
@@ -10742,9 +10742,9 @@ function nw() {
|
|
|
10742
10742
|
var wc = We.get(K);
|
|
10743
10743
|
if (wc)
|
|
10744
10744
|
return wc;
|
|
10745
|
-
We.set(K, xe),
|
|
10745
|
+
We.set(K, xe), T(K) ? K.forEach(function(Ot) {
|
|
10746
10746
|
xe.add(Se(Ot, ye, ne, Ot, K, We));
|
|
10747
|
-
}) :
|
|
10747
|
+
}) : v(K) && K.forEach(function(Ot, Pt) {
|
|
10748
10748
|
xe.set(Pt, Se(Ot, ye, ne, Pt, K, We));
|
|
10749
10749
|
});
|
|
10750
10750
|
var Im = wr ? Te ? u : l : Te ? y : P, bc = _c ? void 0 : Im(K);
|
|
@@ -10857,7 +10857,7 @@ const Oe = /* @__PURE__ */ In(iw), xt = (r) => {
|
|
|
10857
10857
|
const c = i.collections[o], { labels: l, fields: u, preloadCache: f } = c, d = lt(o), h = a.collections?.[l.collection];
|
|
10858
10858
|
if (!a.Role)
|
|
10859
10859
|
throw new Error("PERMISSION_DENIED");
|
|
10860
|
-
const m = h && vt("Read", h), E = kn(c, i, a), g = Rd(c, a),
|
|
10860
|
+
const m = h && vt("Read", h), E = kn(c, i, a), g = Rd(c, a), v = xo(c, a), S = Ad(c, i, a), T = (w = []) => {
|
|
10861
10861
|
const O = [];
|
|
10862
10862
|
if (m)
|
|
10863
10863
|
O.push(he(qr(n, "tenants", s, "system_fields", l.collection, `${l.collection}-${e.key}`), pe("Collection_Path_String", "==", r.join("/")), ...w));
|
|
@@ -10866,8 +10866,8 @@ const Oe = /* @__PURE__ */ In(iw), xt = (r) => {
|
|
|
10866
10866
|
O.push(he(qr(n, "tenants", s, "system_fields", l.collection, `${l.collection}-${x.field}`), pe("Collection_Path_String", "==", r.join("/")), ...w));
|
|
10867
10867
|
return O;
|
|
10868
10868
|
}, P = g.filter((w) => "operations" in w && w.operations ? w.operations.includes("Read") : !0);
|
|
10869
|
-
if (t || P.length === 0 &&
|
|
10870
|
-
return
|
|
10869
|
+
if (t || P.length === 0 && v.length === 0 && S.length === 0)
|
|
10870
|
+
return T();
|
|
10871
10871
|
let y = 0;
|
|
10872
10872
|
const A = (w) => {
|
|
10873
10873
|
w && (y === 0 ? y = w : y *= w);
|
|
@@ -10884,7 +10884,7 @@ const Oe = /* @__PURE__ */ In(iw), xt = (r) => {
|
|
|
10884
10884
|
f?.roles.includes(a.Role) && f.range && A(f.range.fields.length);
|
|
10885
10885
|
const R = d.admin?.statusField;
|
|
10886
10886
|
R && !f?.roles.includes(a.Role) && A(Math.max(R.active?.length || 0, R.archived?.length || 0));
|
|
10887
|
-
const
|
|
10887
|
+
const _ = y === 0 ? 30 : Math.max(1, Math.floor(30 / y)), C = [];
|
|
10888
10888
|
P.filter((w) => w.type === "Record_Owner").forEach(() => C.push(pe("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,17 +10900,17 @@ const Oe = /* @__PURE__ */ In(iw), xt = (r) => {
|
|
|
10900
10900
|
}
|
|
10901
10901
|
});
|
|
10902
10902
|
const p = [];
|
|
10903
|
-
|
|
10903
|
+
v.filter((w) => w.type === "Individual").forEach((w) => {
|
|
10904
10904
|
const O = h?.individualEntities, x = [];
|
|
10905
10905
|
if (O) {
|
|
10906
|
-
const F = w.singleQuery ? w.singleQuery :
|
|
10906
|
+
const F = w.singleQuery ? w.singleQuery : _;
|
|
10907
10907
|
for (let M = 0; M < O.length; M += F) {
|
|
10908
10908
|
const D = O.slice(M, M + F);
|
|
10909
10909
|
x.push(D);
|
|
10910
10910
|
}
|
|
10911
10911
|
if (!w.singleQuery)
|
|
10912
10912
|
x.forEach((M) => {
|
|
10913
|
-
p.push(...
|
|
10913
|
+
p.push(...T(C.concat(pe("id", "in", M))));
|
|
10914
10914
|
});
|
|
10915
10915
|
else {
|
|
10916
10916
|
if (O.length > F)
|
|
@@ -10918,7 +10918,7 @@ const Oe = /* @__PURE__ */ In(iw), xt = (r) => {
|
|
|
10918
10918
|
C.push(pe("id", "in", O));
|
|
10919
10919
|
}
|
|
10920
10920
|
}
|
|
10921
|
-
}),
|
|
10921
|
+
}), S.filter((w) => w.parentFilter.type === "Individual").forEach((w) => {
|
|
10922
10922
|
const { parentFilter: O, parentRestriction: x } = w;
|
|
10923
10923
|
if ("collectionField" in O) {
|
|
10924
10924
|
const F = re(u, O.collectionField);
|
|
@@ -10928,14 +10928,14 @@ const Oe = /* @__PURE__ */ In(iw), xt = (r) => {
|
|
|
10928
10928
|
throw new Error("PERMISSION_DENIED");
|
|
10929
10929
|
const D = M?.individualEntities, Y = [];
|
|
10930
10930
|
if (D) {
|
|
10931
|
-
const J = x.singleQuery ? x.singleQuery :
|
|
10931
|
+
const J = x.singleQuery ? x.singleQuery : _;
|
|
10932
10932
|
for (let W = 0; W < D.length; W += J) {
|
|
10933
10933
|
const q = D.slice(W, W + J);
|
|
10934
10934
|
Y.push(q);
|
|
10935
10935
|
}
|
|
10936
10936
|
if (!x.singleQuery)
|
|
10937
10937
|
Y.forEach((W) => {
|
|
10938
|
-
p.push(...
|
|
10938
|
+
p.push(...T(C.concat(pe(`${F.name}_Array`, "array-contains-any", W))));
|
|
10939
10939
|
});
|
|
10940
10940
|
else {
|
|
10941
10941
|
if (D.length > J)
|
|
@@ -10947,20 +10947,20 @@ const Oe = /* @__PURE__ */ In(iw), xt = (r) => {
|
|
|
10947
10947
|
}
|
|
10948
10948
|
});
|
|
10949
10949
|
const k = [];
|
|
10950
|
-
|
|
10950
|
+
v.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
10954
|
const x = h?.parentEntities, F = [];
|
|
10955
10955
|
if (x) {
|
|
10956
|
-
const M = w.singleQuery ? w.singleQuery :
|
|
10956
|
+
const M = w.singleQuery ? w.singleQuery : _;
|
|
10957
10957
|
for (let D = 0; D < x.length; D += M) {
|
|
10958
10958
|
const Y = x.slice(D, D + M);
|
|
10959
10959
|
F.push(Y);
|
|
10960
10960
|
}
|
|
10961
10961
|
if (!w.singleQuery)
|
|
10962
10962
|
F.forEach((D) => {
|
|
10963
|
-
k.push(...
|
|
10963
|
+
k.push(...T(C.concat(pe(`${O.name}_Array`, "array-contains-any", D))));
|
|
10964
10964
|
});
|
|
10965
10965
|
else {
|
|
10966
10966
|
if (x && x.length > M)
|
|
@@ -10970,7 +10970,7 @@ const Oe = /* @__PURE__ */ In(iw), xt = (r) => {
|
|
|
10970
10970
|
}
|
|
10971
10971
|
}
|
|
10972
10972
|
}
|
|
10973
|
-
}),
|
|
10973
|
+
}), S.filter((w) => w.parentFilter.type === "Parent").forEach((w) => {
|
|
10974
10974
|
const { parentFilter: O, parentRestriction: x } = w;
|
|
10975
10975
|
if ("collectionField" in O && "parentCollectionField" in O) {
|
|
10976
10976
|
const F = re(u, O.collectionField), M = re(u, O.parentCollectionField);
|
|
@@ -10980,14 +10980,14 @@ const Oe = /* @__PURE__ */ In(iw), xt = (r) => {
|
|
|
10980
10980
|
throw new Error("PERMISSION_DENIED");
|
|
10981
10981
|
const Y = D.parentEntities, J = [];
|
|
10982
10982
|
if (Y) {
|
|
10983
|
-
const W = x.singleQuery ? x.singleQuery :
|
|
10983
|
+
const W = x.singleQuery ? x.singleQuery : _;
|
|
10984
10984
|
for (let q = 0; q < Y.length; q += W) {
|
|
10985
10985
|
const H = Y.slice(q, q + W);
|
|
10986
10986
|
J.push(H);
|
|
10987
10987
|
}
|
|
10988
10988
|
if (!x.singleQuery)
|
|
10989
10989
|
J.forEach((q) => {
|
|
10990
|
-
k.push(...
|
|
10990
|
+
k.push(...T(C.concat(pe(`${M.name}_Array`, "array-contains-any", q))));
|
|
10991
10991
|
});
|
|
10992
10992
|
else {
|
|
10993
10993
|
if (Y && Y.length > W)
|
|
@@ -10999,7 +10999,7 @@ const Oe = /* @__PURE__ */ In(iw), xt = (r) => {
|
|
|
10999
10999
|
}
|
|
11000
11000
|
});
|
|
11001
11001
|
const I = [];
|
|
11002
|
-
k.length === 0 && (
|
|
11002
|
+
k.length === 0 && (v.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) {
|
|
@@ -11007,12 +11007,12 @@ const Oe = /* @__PURE__ */ In(iw), xt = (r) => {
|
|
|
11007
11007
|
Object.entries(F).forEach(([M, D]) => {
|
|
11008
11008
|
if (D.length > 0) {
|
|
11009
11009
|
const Y = [];
|
|
11010
|
-
for (let J = 0; J < D.length; J +=
|
|
11011
|
-
const W = D.slice(J, J +
|
|
11010
|
+
for (let J = 0; J < D.length; J += _) {
|
|
11011
|
+
const W = D.slice(J, J + _);
|
|
11012
11012
|
Y.push(W);
|
|
11013
11013
|
}
|
|
11014
11014
|
Y.forEach((J) => {
|
|
11015
|
-
I.push(...
|
|
11015
|
+
I.push(...T(C.concat([
|
|
11016
11016
|
pe(`${O.name}_Array`, "array-contains-any", J),
|
|
11017
11017
|
pe(x.name, "==", M)
|
|
11018
11018
|
])));
|
|
@@ -11021,7 +11021,7 @@ const Oe = /* @__PURE__ */ In(iw), xt = (r) => {
|
|
|
11021
11021
|
});
|
|
11022
11022
|
}
|
|
11023
11023
|
}
|
|
11024
|
-
}),
|
|
11024
|
+
}), S.filter((w) => w.parentFilter.type === "Parent_Property").forEach((w) => {
|
|
11025
11025
|
const { parentFilter: O } = w;
|
|
11026
11026
|
if ("collectionField" in O && "parentCollectionField" in O && "parentPropertyField" in O) {
|
|
11027
11027
|
const x = re(u, O.collectionField), F = re(u, O.parentCollectionField), M = re(u, O.parentPropertyField);
|
|
@@ -11033,12 +11033,12 @@ const Oe = /* @__PURE__ */ In(iw), xt = (r) => {
|
|
|
11033
11033
|
Object.entries(Y).forEach(([J, W]) => {
|
|
11034
11034
|
if (W.length > 0) {
|
|
11035
11035
|
const q = [];
|
|
11036
|
-
for (let H = 0; H < W.length; H +=
|
|
11037
|
-
const Ie = W.slice(H, H +
|
|
11036
|
+
for (let H = 0; H < W.length; H += _) {
|
|
11037
|
+
const Ie = W.slice(H, H + _);
|
|
11038
11038
|
q.push(Ie);
|
|
11039
11039
|
}
|
|
11040
11040
|
q.forEach((H) => {
|
|
11041
|
-
I.push(...
|
|
11041
|
+
I.push(...T(C.concat([
|
|
11042
11042
|
pe(`${F.name}_Array`, "array-contains-any", H),
|
|
11043
11043
|
pe(M.name, "==", J)
|
|
11044
11044
|
])));
|
|
@@ -11049,7 +11049,7 @@ const Oe = /* @__PURE__ */ In(iw), xt = (r) => {
|
|
|
11049
11049
|
}
|
|
11050
11050
|
}));
|
|
11051
11051
|
const b = [...p, ...k, ...I];
|
|
11052
|
-
return !
|
|
11052
|
+
return !v.length && !S.length ? T(C) : b;
|
|
11053
11053
|
}, fm = {}, Ir = {}, Zw = async (r) => {
|
|
11054
11054
|
for (const s of Object.keys(Ir))
|
|
11055
11055
|
delete Ir[s];
|
|
@@ -11058,12 +11058,12 @@ const Oe = /* @__PURE__ */ In(iw), xt = (r) => {
|
|
|
11058
11058
|
const e = await ke(), t = await se(e, ["global", "preload", "sync"]), n = await se(e, ["global", "preload", "async"]);
|
|
11059
11059
|
if (n)
|
|
11060
11060
|
for (const s of n)
|
|
11061
|
-
r?.[s] && Mr(s, r?.[s].constraints, r?.[s].range, r?.[s].orQueries);
|
|
11061
|
+
r?.[s] && Mr(s, r?.[s].constraints, r?.[s].range, r?.[s].orQueries, r);
|
|
11062
11062
|
if (t)
|
|
11063
11063
|
for (const s of t)
|
|
11064
|
-
r?.[s] && await Mr(s, r?.[s].constraints, r?.[s].range, r?.[s].orQueries);
|
|
11064
|
+
r?.[s] && await Mr(s, r?.[s].constraints, r?.[s].range, r?.[s].orQueries, r);
|
|
11065
11065
|
for (const s of Object.keys(r || {}))
|
|
11066
|
-
n.includes(s) || t.includes(s) || await Mr(s, r?.[s].constraints, r?.[s].range, r?.[s].orQueries);
|
|
11066
|
+
n.includes(s) || t.includes(s) || await Mr(s, r?.[s].constraints, r?.[s].range, r?.[s].orQueries, r);
|
|
11067
11067
|
return Ir;
|
|
11068
11068
|
}, To = () => fm, lw = () => Ir, uw = async (r, e, t, n) => {
|
|
11069
11069
|
const { labels: s, preloadCache: i } = r, o = Jr()[s.collection], c = ke(), l = lt(s.collection), u = De();
|
|
@@ -11085,8 +11085,8 @@ const Oe = /* @__PURE__ */ In(iw), xt = (r) => {
|
|
|
11085
11085
|
]), t ||= i.range;
|
|
11086
11086
|
const d = oc([s.collection], o).map((m) => {
|
|
11087
11087
|
if (t) {
|
|
11088
|
-
const { start: E, end: g } = aw(t),
|
|
11089
|
-
m = he(m, Rc(...
|
|
11088
|
+
const { start: E, end: g } = aw(t), v = t.fields.filter((T) => !t.ranges?.some((P) => P.includes(T))).map((T) => Xr(pe(T, ">=", E), pe(T, "<=", g))), S = t.ranges?.map((T) => Xr(pe(T[0], "<=", g), pe(T[1], ">=", E)));
|
|
11089
|
+
m = he(m, Rc(...v, ...S || []));
|
|
11090
11090
|
}
|
|
11091
11091
|
return n && (m = he(m, Xr(Rc(...n.map((E) => pe(...E)))))), e && (m = he(m, Xr(...e.map((E) => pe(...E))))), m;
|
|
11092
11092
|
}), h = /* @__PURE__ */ new Map();
|
|
@@ -11096,45 +11096,48 @@ const Oe = /* @__PURE__ */ In(iw), xt = (r) => {
|
|
|
11096
11096
|
return;
|
|
11097
11097
|
}
|
|
11098
11098
|
d.forEach((g) => {
|
|
11099
|
-
let
|
|
11100
|
-
const
|
|
11101
|
-
(!
|
|
11102
|
-
}, (
|
|
11103
|
-
console.error(
|
|
11099
|
+
let v = !1;
|
|
11100
|
+
const S = dr(g, { includeMetadataChanges: !0 }, (T) => {
|
|
11101
|
+
(!T.metadata.fromCache || v) && (v || (v = !0, h.set(g, !0), h.size === d.length && m({})));
|
|
11102
|
+
}, (T) => {
|
|
11103
|
+
console.error(T), E(T);
|
|
11104
11104
|
});
|
|
11105
|
-
f[s.collection].push(
|
|
11105
|
+
f[s.collection].push(S);
|
|
11106
11106
|
});
|
|
11107
11107
|
});
|
|
11108
|
-
}, Mr = async (r, e, t, n) => {
|
|
11109
|
-
const
|
|
11110
|
-
if (!
|
|
11108
|
+
}, Mr = async (r, e, t, n, s) => {
|
|
11109
|
+
const i = Ke(), a = De();
|
|
11110
|
+
if (!a?.Role)
|
|
11111
11111
|
throw new Error("PERMISSION_DENIED");
|
|
11112
|
-
const
|
|
11113
|
-
if (
|
|
11112
|
+
const o = i.collections[r], { labels: c, preloadCache: l } = o, u = To();
|
|
11113
|
+
if (u[c.collection] === "Loading" || !l?.roles.includes(a.Role))
|
|
11114
11114
|
return;
|
|
11115
|
-
const
|
|
11116
|
-
if (!(
|
|
11117
|
-
|
|
11115
|
+
const f = a.collections?.[r];
|
|
11116
|
+
if (!(f && vt("Read", f) || kn(o, i, a).length > 0)) {
|
|
11117
|
+
u[c.collection] = "Error";
|
|
11118
11118
|
return;
|
|
11119
11119
|
}
|
|
11120
|
-
|
|
11121
|
-
const
|
|
11122
|
-
document.dispatchEvent(
|
|
11120
|
+
u[c.collection] = "Loading";
|
|
11121
|
+
const d = new Event(`stoker:loading:${r}`);
|
|
11122
|
+
document.dispatchEvent(d);
|
|
11123
11123
|
try {
|
|
11124
|
-
if (await uw(
|
|
11125
|
-
const
|
|
11126
|
-
for (const
|
|
11127
|
-
if (!s
|
|
11128
|
-
|
|
11129
|
-
|
|
11130
|
-
|
|
11131
|
-
|
|
11124
|
+
if (await uw(o, e, t, n), l?.relationCollections && await _e(l.relationCollections)) {
|
|
11125
|
+
const E = jt(o, i, a);
|
|
11126
|
+
for (const g of E)
|
|
11127
|
+
if (!s?.[g]) {
|
|
11128
|
+
if (!i.collections[g].preloadCache?.roles.includes(a.Role))
|
|
11129
|
+
continue;
|
|
11130
|
+
const S = To()[g];
|
|
11131
|
+
if (S === "Loading" || S === "Loaded" || S === "Error")
|
|
11132
|
+
continue;
|
|
11133
|
+
S || await Mr(g, void 0, void 0, void 0, s);
|
|
11134
|
+
}
|
|
11132
11135
|
}
|
|
11133
|
-
|
|
11134
|
-
const
|
|
11135
|
-
document.dispatchEvent(
|
|
11136
|
-
} catch (
|
|
11137
|
-
throw
|
|
11136
|
+
u[c.collection] = "Loaded";
|
|
11137
|
+
const h = new Event(`stoker:loaded:${r}`);
|
|
11138
|
+
document.dispatchEvent(h);
|
|
11139
|
+
} catch (h) {
|
|
11140
|
+
throw u[c.collection] = "Error", h;
|
|
11138
11141
|
}
|
|
11139
11142
|
};
|
|
11140
11143
|
let $t = null;
|
|
@@ -11193,14 +11196,14 @@ const fw = async (r, e) => {
|
|
|
11193
11196
|
data: {}
|
|
11194
11197
|
};
|
|
11195
11198
|
if (h) {
|
|
11196
|
-
const
|
|
11197
|
-
m.TTL = Bt.fromDate(
|
|
11199
|
+
const S = /* @__PURE__ */ new Date(), T = new Date((/* @__PURE__ */ new Date()).setDate(S.getDate() + h));
|
|
11200
|
+
m.TTL = Bt.fromDate(T);
|
|
11198
11201
|
}
|
|
11199
11202
|
const E = Oe(t);
|
|
11200
11203
|
r !== "delete" && (m.data.data = E, e === "written" && cc(m.data.data)), r !== "delete" && e !== "written" && tr(E), r === "update" && (m.data.originalRecord = Oe(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));
|
|
11201
|
-
const g = t.Last_Write_At,
|
|
11202
|
-
Gm(
|
|
11203
|
-
console.error(`Error saving "${e}" ${r} log entry for record ${s} in ${u.collection} collection.`, { cause:
|
|
11204
|
+
const g = t.Last_Write_At, v = Ce(d, "tenants", l, n.join("/"), s, "system_write_log", `${a}-${g.valueOf()}`);
|
|
11205
|
+
Gm(v, m).catch((S) => {
|
|
11206
|
+
console.error(`Error saving "${e}" ${r} log entry for record ${s} in ${u.collection} collection.`, { cause: S });
|
|
11204
11207
|
});
|
|
11205
11208
|
}, lc = async (r, e, t, n, s) => {
|
|
11206
11209
|
const i = Dt(), a = je(), o = n.labels.collection, c = n.fields.filter((u) => "unique" in u && u.unique), l = [];
|
|
@@ -11347,15 +11350,15 @@ const fw = async (r, e) => {
|
|
|
11347
11350
|
"global",
|
|
11348
11351
|
"firebase",
|
|
11349
11352
|
"serverTimestampOptions"
|
|
11350
|
-
]),
|
|
11351
|
-
if (!
|
|
11353
|
+
]), v = De();
|
|
11354
|
+
if (!v?.Role)
|
|
11352
11355
|
throw new Error("PERMISSIONS_DENIED");
|
|
11353
|
-
if (f?.includes(
|
|
11356
|
+
if (f?.includes(v.Role))
|
|
11354
11357
|
return await hw(r, e, t);
|
|
11355
|
-
const
|
|
11356
|
-
if (
|
|
11358
|
+
const S = oc(r, a, t?.getAll);
|
|
11359
|
+
if (S.length === 0)
|
|
11357
11360
|
return { cursor: {}, pages: 0, docs: [] };
|
|
11358
|
-
let
|
|
11361
|
+
let T = S.map((b) => he(b, ...e || []));
|
|
11359
11362
|
const P = t?.pagination?.startAfter || t?.pagination?.endBefore || {
|
|
11360
11363
|
first: /* @__PURE__ */ new Map(),
|
|
11361
11364
|
last: /* @__PURE__ */ new Map()
|
|
@@ -11363,30 +11366,30 @@ const fw = async (r, e) => {
|
|
|
11363
11366
|
if (t?.pagination) {
|
|
11364
11367
|
if (t.pagination.startAfter && t.pagination.endBefore)
|
|
11365
11368
|
throw new Error("INPUT_ERROR: startAfter and endBefore cannot be provided together");
|
|
11366
|
-
const b = t.pagination.startAfter || t.pagination.endBefore, w = Ud(
|
|
11369
|
+
const b = t.pagination.startAfter || t.pagination.endBefore, w = Ud(v.Role, o, s);
|
|
11367
11370
|
if (b && w !== !0)
|
|
11368
11371
|
throw new Error("INPUT_ERROR: Pagination is not allowed when using " + w);
|
|
11369
|
-
t.pagination.orderByField && t.pagination.orderByDirection ? t.pagination.startAfter || t.pagination.endBefore ? t.pagination.startAfter ?
|
|
11372
|
+
t.pagination.orderByField && t.pagination.orderByDirection ? t.pagination.startAfter || t.pagination.endBefore ? t.pagination.startAfter ? T = T.map((O, x) => he(O, rt(t.pagination.orderByField, t.pagination.orderByDirection), eo(P.last.get(x)), Xt(t.pagination.number))) : T = T.map((O, x) => he(O, rt(t.pagination.orderByField, t.pagination.orderByDirection), to(P.first.get(x)), Nr(t.pagination.number))) : T = T.map((O) => he(O, rt(t.pagination.orderByField, t.pagination.orderByDirection), Xt(t.pagination.number))) : !t.pagination.startAfter && !t.pagination.endBefore ? T = T.map((O) => he(O, Xt(t.pagination.number))) : t.pagination.startAfter ? T = T.map((O, x) => he(O, eo(P.last.get(x)), Xt(t.pagination.number))) : T = T.map((O, x) => he(O, to(P.first.get(x)), Nr(t.pagination.number)));
|
|
11370
11373
|
}
|
|
11371
11374
|
const y = { collection: c.collection };
|
|
11372
|
-
await oe("preOperation", d, E, ["read", void 0, void 0, y]), await oe("preRead", d, E, [y,
|
|
11373
|
-
const
|
|
11375
|
+
await oe("preOperation", d, E, ["read", void 0, void 0, y]), await oe("preRead", d, E, [y, T, !0, !1]);
|
|
11376
|
+
const _ = /* @__PURE__ */ new Map(), C = T.map(async (b) => {
|
|
11374
11377
|
let w;
|
|
11375
11378
|
return t?.only === "cache" ? w = await Od(b) : t?.only === "server" ? w = await Hm(b) : w = await Km(b), w;
|
|
11376
11379
|
}), p = await Promise.all(C);
|
|
11377
11380
|
for (const b of p) {
|
|
11378
11381
|
for (const w of b.docs) {
|
|
11379
|
-
|
|
11380
|
-
const O = w.data({ serverTimestamps: g || "none" }), x =
|
|
11382
|
+
_.has(w.id) || _.set(w.id, {});
|
|
11383
|
+
const O = w.data({ serverTimestamps: g || "none" }), x = _.get(w.id);
|
|
11381
11384
|
x.id ||= w.id;
|
|
11382
11385
|
const F = { ...x, ...O };
|
|
11383
|
-
delete F.Collection_Path_String,
|
|
11386
|
+
delete F.Collection_Path_String, _.set(w.id, F);
|
|
11384
11387
|
}
|
|
11385
11388
|
P.first.set(p.indexOf(b), b.docs[0]), P.last.set(p.indexOf(b), b.docs.at(-1) || b.docs[0]);
|
|
11386
11389
|
}
|
|
11387
11390
|
let k;
|
|
11388
|
-
if (t?.pagination && !u?.roles.includes(
|
|
11389
|
-
let b = he(
|
|
11391
|
+
if (t?.pagination && !u?.roles.includes(v?.Role) && !f?.includes(v?.Role)) {
|
|
11392
|
+
let b = he(S[0], ...e || []);
|
|
11390
11393
|
t.pagination.orderByField && t.pagination.orderByDirection && (b = he(b, rt(t.pagination.orderByField, t.pagination.orderByDirection)));
|
|
11391
11394
|
const w = await Ed(b).catch(() => {
|
|
11392
11395
|
});
|
|
@@ -11397,11 +11400,11 @@ const fw = async (r, e) => {
|
|
|
11397
11400
|
}
|
|
11398
11401
|
let I;
|
|
11399
11402
|
t?.noComputedFields || (I = await _e(E.admin?.retriever));
|
|
11400
|
-
for (const b of
|
|
11403
|
+
for (const b of _.values()) {
|
|
11401
11404
|
const w = [], O = [...b.Collection_Path, b.id];
|
|
11402
11405
|
t?.subcollections && w.push(mm(
|
|
11403
11406
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
11404
|
-
|
|
11407
|
+
_.get(b.id),
|
|
11405
11408
|
O,
|
|
11406
11409
|
Oe(t.subcollections),
|
|
11407
11410
|
s,
|
|
@@ -11418,7 +11421,7 @@ const fw = async (r, e) => {
|
|
|
11418
11421
|
return D;
|
|
11419
11422
|
})), w.push(uc(
|
|
11420
11423
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
11421
|
-
|
|
11424
|
+
_.get(b.id),
|
|
11422
11425
|
O,
|
|
11423
11426
|
Oe(t.relations),
|
|
11424
11427
|
s,
|
|
@@ -11432,9 +11435,9 @@ const fw = async (r, e) => {
|
|
|
11432
11435
|
})), t?.noEmbeddingFields && D.type === "Embedding" && delete b[D.name];
|
|
11433
11436
|
await Promise.all(x);
|
|
11434
11437
|
const F = ["read", b, b.id, y];
|
|
11435
|
-
await oe("postOperation", d, E, F), await oe("postRead", d, E, [y,
|
|
11438
|
+
await oe("postOperation", d, E, F), await oe("postRead", d, E, [y, S, b, !1]);
|
|
11436
11439
|
}
|
|
11437
|
-
return { cursor: P, pages: k, docs: Array.from(
|
|
11440
|
+
return { cursor: P, pages: k, docs: Array.from(_.values()) };
|
|
11438
11441
|
}, mw = async (r, e, t) => {
|
|
11439
11442
|
const n = it(), s = Ue(), i = $e(n, s.STOKER_FB_FUNCTIONS_REGION), l = (await Ye(i, "stoker-readapi")({
|
|
11440
11443
|
path: r,
|
|
@@ -11525,13 +11528,13 @@ const fw = async (r, e) => {
|
|
|
11525
11528
|
throw new Error("PERMISSIONS_DENIED");
|
|
11526
11529
|
if (m?.includes(g.Role))
|
|
11527
11530
|
return await mw(r, e, t);
|
|
11528
|
-
const
|
|
11529
|
-
if (
|
|
11531
|
+
const v = dm(r, e, a);
|
|
11532
|
+
if (v.length === 0)
|
|
11530
11533
|
throw new Error("PERMISSION_DENIED");
|
|
11531
|
-
const
|
|
11532
|
-
await oe("preOperation", o, E, ["read", void 0, e,
|
|
11534
|
+
const S = { collection: d.collection };
|
|
11535
|
+
await oe("preOperation", o, E, ["read", void 0, e, S]), await oe("preRead", o, E, [S, v, !1, !1]);
|
|
11533
11536
|
let y = {};
|
|
11534
|
-
const A =
|
|
11537
|
+
const A = v.map(async (I) => {
|
|
11535
11538
|
let b;
|
|
11536
11539
|
if (t?.only === "cache" ? b = await Ym(I) : t?.only === "server" ? b = await Jm(I) : b = await bd(I), !b.exists())
|
|
11537
11540
|
throw new Error(`NOT_FOUND: Document with ID ${e} does not exist at location ${r?.join("/") || d.collection}`);
|
|
@@ -11539,8 +11542,8 @@ const fw = async (r, e) => {
|
|
|
11539
11542
|
}), R = await Promise.all(A);
|
|
11540
11543
|
for (const I of R)
|
|
11541
11544
|
y.id ||= I.id, y = { ...y, ...I.data }, delete y.Collection_Path_String;
|
|
11542
|
-
const
|
|
11543
|
-
if (t?.subcollections &&
|
|
11545
|
+
const _ = [], C = r ? [...r, e] : [d.collection, e];
|
|
11546
|
+
if (t?.subcollections && _.push(ym(y, C, Oe(t.subcollections), s, Oe(t?.relations), t?.only)), t?.relations && (t.relations.fields && (t.relations.fields = t.relations.fields.map((I) => {
|
|
11544
11547
|
if (typeof I == "string") {
|
|
11545
11548
|
const b = f.fields.find((w) => w.name === I);
|
|
11546
11549
|
if (b)
|
|
@@ -11548,13 +11551,13 @@ const fw = async (r, e) => {
|
|
|
11548
11551
|
throw new Error(`SCHEMA_ERROR: Field ${I} not found in collection ${n}`);
|
|
11549
11552
|
}
|
|
11550
11553
|
return I;
|
|
11551
|
-
})),
|
|
11554
|
+
})), _.push(gm(y, C, Oe(t.relations), s, t?.only, t?.noComputedFields, t?.noEmbeddingFields))), await Promise.all(_), !t?.noComputedFields)
|
|
11552
11555
|
for (const I of f.fields)
|
|
11553
11556
|
I.type === "Computed" && (y[I.name] = await I.formula(y));
|
|
11554
11557
|
if (t?.noEmbeddingFields)
|
|
11555
11558
|
for (const I of f.fields)
|
|
11556
11559
|
I.type === "Embedding" && delete y[I.name];
|
|
11557
|
-
return await oe("postOperation", o, E, ["read", y, e,
|
|
11560
|
+
return await oe("postOperation", o, E, ["read", y, e, S]), await oe("postRead", o, E, [S, v, y, !1]), y;
|
|
11558
11561
|
}, pw = (r) => r !== null && typeof r == "object", _m = (r) => {
|
|
11559
11562
|
const e = (t) => {
|
|
11560
11563
|
Object.entries(t).forEach(([n, s]) => {
|
|
@@ -11581,7 +11584,7 @@ const fw = async (r, e) => {
|
|
|
11581
11584
|
const m = r.at(-1), E = Object.keys(o.collections).includes(m), g = u.disabledCollections?.includes(m);
|
|
11582
11585
|
if (!E || g)
|
|
11583
11586
|
throw new Error("COLLECTION_NOT_FOUND");
|
|
11584
|
-
const
|
|
11587
|
+
const v = o.collections[m], { labels: S, access: T, fields: P, enableWriteLog: y } = v, { serverWriteOnly: A } = T, R = lt(S.collection), _ = await se(u, ["global", "appName"]), C = s?.retry, p = f.currentUser;
|
|
11585
11588
|
if (!p)
|
|
11586
11589
|
throw new Error("NOT_AUTHENTICATED");
|
|
11587
11590
|
if (!h)
|
|
@@ -11591,13 +11594,13 @@ const fw = async (r, e) => {
|
|
|
11591
11594
|
i = C?.originalRecord || i || await _r(r, e, { noComputedFields: !0, noEmbeddingFields: !0 });
|
|
11592
11595
|
for (const q of c.collections[m].fields)
|
|
11593
11596
|
q.type === "Computed" && (delete t[q.name], delete i[q.name]);
|
|
11594
|
-
const k = Co(d), I = { collection:
|
|
11597
|
+
const k = Co(d), I = { collection: S.collection }, b = v.auth && n?.operation === "create", w = v.auth && n?.operation === "delete", O = v.auth && !b && !w && (n?.operation === "update" || t.Role || t.Enabled !== void 0 || t.Name || t.Email || t.Photo_URL), x = await se(R, [
|
|
11595
11598
|
"collections",
|
|
11596
|
-
|
|
11599
|
+
S.collection,
|
|
11597
11600
|
"custom",
|
|
11598
11601
|
"disableOfflineUpdate"
|
|
11599
11602
|
]), F = () => {
|
|
11600
|
-
if (zt() === "Offline" && (x || A ||
|
|
11603
|
+
if (zt() === "Offline" && (x || A || v.auth && (b || O || w)))
|
|
11601
11604
|
throw new Error("CLIENT_OFFLINE");
|
|
11602
11605
|
};
|
|
11603
11606
|
if (F(), A || b || O || w) {
|
|
@@ -11622,10 +11625,10 @@ const fw = async (r, e) => {
|
|
|
11622
11625
|
return await yw(r, e, t, n ? { operation: n.operation, permissions: n.permissions, password: n.password } : void 0);
|
|
11623
11626
|
}
|
|
11624
11627
|
delete t.id;
|
|
11625
|
-
const M = Ko("update", r, t, o,
|
|
11628
|
+
const M = Ko("update", r, t, o, _, zt(), p.uid, Bt.now(), Lr(), !!C);
|
|
11626
11629
|
for (const q of P)
|
|
11627
11630
|
!ge(q) && sr(M[q.name]) && q.nullable && (M[q.name] = null);
|
|
11628
|
-
if (xt(M), xt(i), !C && y && He("update", "started", M, r, e,
|
|
11631
|
+
if (xt(M), xt(i), !C && y && He("update", "started", M, r, e, v, p.uid, void 0, i), !C) {
|
|
11629
11632
|
const q = [
|
|
11630
11633
|
"update",
|
|
11631
11634
|
M,
|
|
@@ -11638,18 +11641,18 @@ const fw = async (r, e) => {
|
|
|
11638
11641
|
const H = ["update", M, e, I, k, Oe(i)];
|
|
11639
11642
|
await oe("preWrite", u, R, H);
|
|
11640
11643
|
}
|
|
11641
|
-
if (Xd(
|
|
11644
|
+
if (Xd(v, M, o), eh(v, M), !C)
|
|
11642
11645
|
try {
|
|
11643
11646
|
const q = { ...i, ...M };
|
|
11644
|
-
tr(q), await om("update", q,
|
|
11647
|
+
tr(q), await om("update", q, v, R, ["update", q, I, k, Oe(i)], o), x && (F(), await lc("update", e, M, v, h));
|
|
11645
11648
|
} catch (q) {
|
|
11646
11649
|
throw new Error(`VALIDATION_ERROR: ${q.message}`);
|
|
11647
11650
|
}
|
|
11648
|
-
if (Oy(M, i, e,
|
|
11651
|
+
if (Oy(M, i, e, v, o, p.uid, h), xt(M), ac("update", k, r, e, M, o, v, s, l, Io, ko, An, (q) => Ce(d, "tenants", a, "system_fields", S.collection, `${S.collection}-${q.name}`, e), (q, H) => Ce(d, "tenants", a, "system_unique", S.collection, `Unique-${S.collection}-${q.name}`, H), (q) => Ce(d, "tenants", a, "system_fields", S.collection, `${S.collection}-${q}`, e)), k.update(Ce(d, "tenants", a, r.join("/"), e), M), !C && y && He("update", "written", M, r, e, v, p.uid, void 0, i), await dc("update", r, e, M, I, v, R, k, p.uid, y || !1, h, !!C, i), C?.type === "unique") {
|
|
11649
11652
|
const q = { ...i, ...M };
|
|
11650
11653
|
return tr(q), { id: e, ...q };
|
|
11651
11654
|
}
|
|
11652
|
-
y && He("update", "success", M, r, e,
|
|
11655
|
+
y && He("update", "success", M, r, e, v, p.uid, void 0, i);
|
|
11653
11656
|
const D = ["update", M, e, I, !!C, Oe(i)], Y = [...D];
|
|
11654
11657
|
await oe("postWrite", u, R, D), await oe("postOperation", u, R, Y);
|
|
11655
11658
|
const J = { ...i, ...M };
|
|
@@ -11657,19 +11660,19 @@ const fw = async (r, e) => {
|
|
|
11657
11660
|
}, dc = async (r, e, t, n, s, i, a, o, c, l, u, f, d) => {
|
|
11658
11661
|
const h = Ke(), m = ke(), { labels: E } = i;
|
|
11659
11662
|
let g = 0;
|
|
11660
|
-
const
|
|
11663
|
+
const v = async () => {
|
|
11661
11664
|
try {
|
|
11662
11665
|
await Oe(o).commit();
|
|
11663
11666
|
return;
|
|
11664
|
-
} catch (
|
|
11665
|
-
let
|
|
11667
|
+
} catch (S) {
|
|
11668
|
+
let T;
|
|
11666
11669
|
const P = await se(a, [
|
|
11667
11670
|
"collections",
|
|
11668
11671
|
E.collection,
|
|
11669
11672
|
"custom",
|
|
11670
11673
|
"autoCorrectUnique"
|
|
11671
11674
|
]);
|
|
11672
|
-
if (
|
|
11675
|
+
if (S.code === "unavailable" && await _e(m.onIndexedDBConnectionLost), r !== "delete" && S.code === "permission-denied")
|
|
11673
11676
|
try {
|
|
11674
11677
|
await lc(r, t, n, i, u);
|
|
11675
11678
|
} catch (C) {
|
|
@@ -11681,7 +11684,7 @@ const fw = async (r, e) => {
|
|
|
11681
11684
|
throw new Error(`SCHEMA_ERROR: Field ${O} not found in ${E.collection} schema`);
|
|
11682
11685
|
x.type === "Number" && k.push(w), x.type === "String" && I.push(w);
|
|
11683
11686
|
}
|
|
11684
|
-
if ((!P || k.length > 0) && (
|
|
11687
|
+
if ((!P || k.length > 0) && (T = new Error(`VALIDATION_ERROR: ${p.join(", ")}`)), P && I.length > 0) {
|
|
11685
11688
|
for (const w of I) {
|
|
11686
11689
|
const O = w.split(" ")[0];
|
|
11687
11690
|
if (h.collections[E.collection].fields.find((M) => M.name === O).type === "Number")
|
|
@@ -11691,7 +11694,7 @@ const fw = async (r, e) => {
|
|
|
11691
11694
|
// eslint-disable-next-line security/detect-object-injection
|
|
11692
11695
|
n[O].match(/ - DUPLICATE-\d+/)[0].split("-")[2]
|
|
11693
11696
|
), n[O] = // eslint-disable-next-line security/detect-object-injection
|
|
11694
|
-
n[O].replace(/ - DUPLICATE-\d+/g, "") + ` - DUPLICATE-${F + 1}`) : n[O] = n[O] + " - DUPLICATE-1", F < 10 ? b = !0 :
|
|
11697
|
+
n[O].replace(/ - DUPLICATE-\d+/g, "") + ` - DUPLICATE-${F + 1}`) : n[O] = n[O] + " - DUPLICATE-1", F < 10 ? b = !0 : T = new Error(p.map((M) => M.replace(/ - DUPLICATE-\d+/g, "")).join(", "));
|
|
11695
11698
|
}
|
|
11696
11699
|
if (b) {
|
|
11697
11700
|
r === "create" && await vm(e, n, void 0, { retry: { type: "unique", docId: t } }), r === "update" && await fc(e, t, n, void 0, {
|
|
@@ -11705,7 +11708,7 @@ const fw = async (r, e) => {
|
|
|
11705
11708
|
}
|
|
11706
11709
|
}
|
|
11707
11710
|
}
|
|
11708
|
-
const y =
|
|
11711
|
+
const y = T || S, A = [
|
|
11709
11712
|
r,
|
|
11710
11713
|
n,
|
|
11711
11714
|
t,
|
|
@@ -11714,11 +11717,11 @@ const fw = async (r, e) => {
|
|
|
11714
11717
|
f,
|
|
11715
11718
|
g,
|
|
11716
11719
|
r === "update" ? d : void 0
|
|
11717
|
-
], R =
|
|
11718
|
-
if (
|
|
11720
|
+
], R = S.code === "unavailable", _ = await oe("postWriteError", m, a, A);
|
|
11721
|
+
if (_?.resolved)
|
|
11719
11722
|
return;
|
|
11720
|
-
if (!R &&
|
|
11721
|
-
g++, await
|
|
11723
|
+
if (!R && _?.retry) {
|
|
11724
|
+
g++, await v();
|
|
11722
11725
|
return;
|
|
11723
11726
|
} else
|
|
11724
11727
|
l && He(
|
|
@@ -11736,7 +11739,7 @@ const fw = async (r, e) => {
|
|
|
11736
11739
|
throw y;
|
|
11737
11740
|
}
|
|
11738
11741
|
};
|
|
11739
|
-
await
|
|
11742
|
+
await v();
|
|
11740
11743
|
}, gw = async (r, e, t, n) => {
|
|
11741
11744
|
const s = it(), i = Ue(), a = $e(s, i.STOKER_FB_FUNCTIONS_REGION), o = Ye(a, "stoker-writeapi", { timeout: 540 * 1e3 });
|
|
11742
11745
|
return _m(e), (await o({
|
|
@@ -11753,14 +11756,14 @@ const fw = async (r, e) => {
|
|
|
11753
11756
|
const h = r.at(-1), m = Object.keys(o.collections).includes(h), E = l.disabledCollections?.includes(h);
|
|
11754
11757
|
if (!m || E)
|
|
11755
11758
|
throw new Error("COLLECTION_NOT_FOUND");
|
|
11756
|
-
const g = o.collections[h], { labels:
|
|
11759
|
+
const g = o.collections[h], { labels: v, access: S, enableWriteLog: T, softDelete: P } = g, { serverWriteOnly: y } = S, A = lt(v.collection), R = await se(l, ["global", "appName"]), _ = n?.retry, C = u.currentUser;
|
|
11757
11760
|
if (!C)
|
|
11758
11761
|
throw new Error("NOT_AUTHENTICATED");
|
|
11759
11762
|
if (!d)
|
|
11760
11763
|
throw new Error("PERMISSION_DENIED");
|
|
11761
11764
|
const p = await se(A, [
|
|
11762
11765
|
"collections",
|
|
11763
|
-
|
|
11766
|
+
v.collection,
|
|
11764
11767
|
"custom",
|
|
11765
11768
|
"disableOfflineCreate"
|
|
11766
11769
|
]), k = () => {
|
|
@@ -11768,7 +11771,7 @@ const fw = async (r, e) => {
|
|
|
11768
11771
|
throw new Error("CLIENT_OFFLINE");
|
|
11769
11772
|
};
|
|
11770
11773
|
k();
|
|
11771
|
-
const I = Co(f), b =
|
|
11774
|
+
const I = Co(f), b = _?.docId || s || Ce(qr(f, "tenants", a, v.collection)).id, w = { collection: v.collection };
|
|
11772
11775
|
if (y || g.auth && t) {
|
|
11773
11776
|
if (k(), g.auth && t) {
|
|
11774
11777
|
if (!t.password)
|
|
@@ -11791,17 +11794,17 @@ const fw = async (r, e) => {
|
|
|
11791
11794
|
return i && i(), await gw(r, e, t ? { permissions: t.permissions, password: t.password } : void 0, b);
|
|
11792
11795
|
}
|
|
11793
11796
|
e.id = b;
|
|
11794
|
-
const O = Ko("create", r, e, o, R, zt(), C.uid, Bt.now(), Lr(), !!
|
|
11795
|
-
if (P && (O[P.archivedField] = !1), xt(O), !
|
|
11797
|
+
const O = Ko("create", r, e, o, R, zt(), C.uid, Bt.now(), Lr(), !!_);
|
|
11798
|
+
if (P && (O[P.archivedField] = !1), xt(O), !_ && T && He("create", "started", O, r, b, g, C.uid), _ || (await oe("preOperation", l, A, ["create", O, b, w, I]), await oe("preWrite", l, A, ["create", O, b, w, I])), Xd(g, O, o), eh(g, O), _ || await hg(O, g, A, d.Role), !_)
|
|
11796
11799
|
try {
|
|
11797
11800
|
await om("create", O, g, A, ["create", O, w, I], o), p && (k(), await lc("create", b, O, g, d));
|
|
11798
11801
|
} catch (D) {
|
|
11799
11802
|
throw new Error(`VALIDATION_ERROR: ${D.message}`);
|
|
11800
11803
|
}
|
|
11801
|
-
if (i && i(), xt(O), by(O, b, g, o, C.uid, d), ac("create", I, r, b, O, o, g, n, c, Io, ko, An, (D) => Ce(f, "tenants", a, "system_fields",
|
|
11804
|
+
if (i && i(), xt(O), by(O, b, g, o, C.uid, d), ac("create", I, r, b, O, o, g, n, c, Io, ko, An, (D) => Ce(f, "tenants", a, "system_fields", v.collection, `${v.collection}-${D.name}`, b), (D, Y) => Ce(f, "tenants", a, "system_unique", v.collection, `Unique-${v.collection}-${D.name}`, Y), (D) => Ce(f, "tenants", a, "system_fields", v.collection, `${v.collection}-${D}`, b)), I.set(Ce(f, "tenants", a, r.join("/"), b), O), !_ && T && He("create", "written", O, r, b, g, C.uid), await dc("create", r, b, O, w, g, A, I, C.uid, T || !1, d, !!_), _?.type === "unique")
|
|
11802
11805
|
return { docId: b, record: O };
|
|
11803
|
-
|
|
11804
|
-
const x = ["create", O, b, w, !!
|
|
11806
|
+
T && He("create", "success", O, r, b, g, C.uid);
|
|
11807
|
+
const x = ["create", O, b, w, !!_], F = [...x];
|
|
11805
11808
|
return await oe("postWrite", l, A, x), await oe("postOperation", l, A, F), { id: b, ...O };
|
|
11806
11809
|
}, _w = async (r, e) => {
|
|
11807
11810
|
const t = it(), n = Ue(), s = $e(t, n.STOKER_FB_FUNCTIONS_REGION);
|
|
@@ -11817,24 +11820,24 @@ const fw = async (r, e) => {
|
|
|
11817
11820
|
const u = r.at(-1), f = Object.keys(s.collections).includes(u), d = c.disabledCollections?.includes(u);
|
|
11818
11821
|
if (!f || d)
|
|
11819
11822
|
throw new Error("COLLECTION_NOT_FOUND");
|
|
11820
|
-
const h = s.collections[u], { labels: m, access: E, enableWriteLog: g, softDelete:
|
|
11823
|
+
const h = s.collections[u], { labels: m, access: E, enableWriteLog: g, softDelete: v } = h, { serverWriteOnly: S } = E, T = lt(m.collection), P = await se(c, ["global", "appName"]), y = t?.retry, A = a.currentUser;
|
|
11821
11824
|
if (!A)
|
|
11822
11825
|
throw new Error("NOT_AUTHENTICATED");
|
|
11823
11826
|
if (!l)
|
|
11824
11827
|
throw new Error("PERMISSION_DENIED");
|
|
11825
|
-
if (
|
|
11828
|
+
if (v && !h.auth)
|
|
11826
11829
|
return await fc(r, e, {
|
|
11827
|
-
[
|
|
11828
|
-
[
|
|
11830
|
+
[v.archivedField]: !0,
|
|
11831
|
+
[v.timestampField]: Lr()
|
|
11829
11832
|
});
|
|
11830
|
-
const R = await se(
|
|
11833
|
+
const R = await se(T, [
|
|
11831
11834
|
"collections",
|
|
11832
11835
|
m.collection,
|
|
11833
11836
|
"custom",
|
|
11834
11837
|
"disableOfflineDelete"
|
|
11835
11838
|
]);
|
|
11836
11839
|
if ((() => {
|
|
11837
|
-
if (zt() === "Offline" && (R ||
|
|
11840
|
+
if (zt() === "Offline" && (R || S || h.auth))
|
|
11838
11841
|
throw new Error("CLIENT_OFFLINE");
|
|
11839
11842
|
})(), bm(e))
|
|
11840
11843
|
throw new Error("RECORD_BUSY");
|
|
@@ -11844,13 +11847,13 @@ const fw = async (r, e) => {
|
|
|
11844
11847
|
} catch (F) {
|
|
11845
11848
|
throw g && y?.record && F.message.indexOf("NOT_FOUND") !== -1 && await He("delete", "failed", y?.record, r, e, h, A.uid, F), F;
|
|
11846
11849
|
}
|
|
11847
|
-
if (
|
|
11850
|
+
if (S || h.auth && C.User_ID)
|
|
11848
11851
|
return await _w(r, e);
|
|
11849
11852
|
delete C.id;
|
|
11850
11853
|
const p = Co(o), k = { collection: m.collection }, I = Ko("delete", r, C, s, P, zt(), A.uid, Bt.now(), Lr(), !!y);
|
|
11851
|
-
xt(I), !y && g && He("delete", "started", I, r, e, h, A.uid), y || (await oe("preOperation", c,
|
|
11854
|
+
xt(I), !y && g && He("delete", "started", I, r, e, h, A.uid), y || (await oe("preOperation", c, T, ["delete", I, e, k, p]), await oe("preWrite", c, T, ["delete", I, e, k, p])), xt(I), Ey(I, e, h, s, A.uid, l), ac("delete", p, r, e, I, s, h, t, i, Io, ko, An, (F) => Ce(o, "tenants", n, "system_fields", m.collection, `${m.collection}-${F.name}`, e), (F, M) => Ce(o, "tenants", n, "system_unique", m.collection, `Unique-${m.collection}-${F.name}`, M), (F) => Ce(o, "tenants", n, "system_fields", m.collection, `${m.collection}-${F}`, e)), p.delete(Ce(o, "tenants", n, r.join("/"), e)), !y && g && He("delete", "written", I, r, e, h, A.uid), await dc("delete", r, e, I, k, h, T, p, A.uid, g || !1, l, !!y), g && He("delete", "success", { ...I, ...y?.record || {} }, r, e, h, A.uid);
|
|
11852
11855
|
const w = ["delete", I, e, k, !!y], O = [...w];
|
|
11853
|
-
return await oe("postWrite", c,
|
|
11856
|
+
return await oe("postWrite", c, T, w), await oe("postOperation", c, T, O), { id: e, ...I };
|
|
11854
11857
|
}, wm = (r) => {
|
|
11855
11858
|
if (typeof r == "object")
|
|
11856
11859
|
for (const e in r)
|
|
@@ -11871,7 +11874,7 @@ const bw = async (r, e) => {
|
|
|
11871
11874
|
for (const o of i.docs) {
|
|
11872
11875
|
mt[o.id] ??= 0;
|
|
11873
11876
|
const c = o.data(), { data: l, operation: u, docId: f, collection: d, Collection_Path: h, Last_Write_Version: m } = c;
|
|
11874
|
-
await new Promise((
|
|
11877
|
+
await new Promise((v) => setTimeout(v, 1e3));
|
|
11875
11878
|
const E = await ww("stoker-writelog", {
|
|
11876
11879
|
path: h,
|
|
11877
11880
|
id: f,
|
|
@@ -11904,17 +11907,17 @@ const bw = async (r, e) => {
|
|
|
11904
11907
|
type: "offline",
|
|
11905
11908
|
docId: f
|
|
11906
11909
|
}
|
|
11907
|
-
}).catch((
|
|
11908
|
-
console.error(
|
|
11910
|
+
}).catch((v) => {
|
|
11911
|
+
console.error(v);
|
|
11909
11912
|
}), mt[f]--, localStorage.setItem(`stoker-retry-${f}`, "done")), u === "update") {
|
|
11910
|
-
const
|
|
11911
|
-
|
|
11913
|
+
const v = r.collections[d], { softDelete: S } = v;
|
|
11914
|
+
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(h, f, l.data, void 0, {
|
|
11912
11915
|
retry: {
|
|
11913
11916
|
type: "offline",
|
|
11914
11917
|
originalRecord: l.originalRecord
|
|
11915
11918
|
}
|
|
11916
|
-
}).catch((
|
|
11917
|
-
console.error(
|
|
11919
|
+
}).catch((T) => {
|
|
11920
|
+
console.error(T);
|
|
11918
11921
|
}), mt[f]--, localStorage.setItem(`stoker-retry-${f}`, "done");
|
|
11919
11922
|
}
|
|
11920
11923
|
u === "delete" && (mt[f]++, await vw(h, f, {
|
|
@@ -11928,8 +11931,8 @@ const bw = async (r, e) => {
|
|
|
11928
11931
|
Last_Write_Version: c.Last_Write_Version
|
|
11929
11932
|
}
|
|
11930
11933
|
}
|
|
11931
|
-
}).catch((
|
|
11932
|
-
console.error(
|
|
11934
|
+
}).catch((v) => {
|
|
11935
|
+
console.error(v);
|
|
11933
11936
|
}), mt[f]--, localStorage.setItem(`stoker-retry-${f}`, "done"));
|
|
11934
11937
|
}
|
|
11935
11938
|
}
|
|
@@ -12130,22 +12133,22 @@ const Gw = async (r, e, t, n) => {
|
|
|
12130
12133
|
"firebase",
|
|
12131
12134
|
"logLevel",
|
|
12132
12135
|
"dev"
|
|
12133
|
-
]),
|
|
12136
|
+
]), v = await se(me, [
|
|
12134
12137
|
"global",
|
|
12135
12138
|
"firebase",
|
|
12136
12139
|
"logLevel",
|
|
12137
12140
|
"prod"
|
|
12138
|
-
]),
|
|
12141
|
+
]), S = await Fm().catch((p) => {
|
|
12139
12142
|
throw new Error("Error checking analytics support.", { cause: p });
|
|
12140
12143
|
});
|
|
12141
|
-
St === "production" && f &&
|
|
12142
|
-
const
|
|
12144
|
+
St === "production" && f && S && Dm(dt, d || {}), h && Mm(h);
|
|
12145
|
+
const T = await se(me, [
|
|
12143
12146
|
"global",
|
|
12144
12147
|
"auth",
|
|
12145
12148
|
"authPersistenceType"
|
|
12146
12149
|
]), y = {
|
|
12147
12150
|
popupRedirectResolver: void 0,
|
|
12148
|
-
persistence:
|
|
12151
|
+
persistence: T === "LOCAL" ? [Pm, qm, Ec] : T === "SESSION" ? [Ec, Sc] : [Sc]
|
|
12149
12152
|
};
|
|
12150
12153
|
ht.main = Oc(dt, y);
|
|
12151
12154
|
for (const p of o)
|
|
@@ -12183,7 +12186,7 @@ const Gw = async (r, e, t, n) => {
|
|
|
12183
12186
|
up($e(dt, ve.STOKER_FB_FUNCTIONS_REGION), "localhost", p);
|
|
12184
12187
|
}
|
|
12185
12188
|
}
|
|
12186
|
-
if (Ew(), Sw(), Rw(), St === "development" && (g ? Qr(g) : Qr("debug")), St === "production" && (
|
|
12189
|
+
if (Ew(), Sw(), Rw(), St === "development" && (g ? Qr(g) : Qr("debug")), St === "production" && (v ? Qr(v) : Qr("error")), E) {
|
|
12187
12190
|
const p = Bn(A, async (k) => {
|
|
12188
12191
|
if (k) {
|
|
12189
12192
|
const I = JSON.parse(ve.STOKER_FB_WEB_APP_CONFIG);
|
|
@@ -12197,9 +12200,9 @@ const Gw = async (r, e, t, n) => {
|
|
|
12197
12200
|
await Promise.all(Object.values(ht).map((p) => p.authStateReady().catch((k) => {
|
|
12198
12201
|
throw new Error(`Error waiting for auth state in ${p.app.name}.`, { cause: k });
|
|
12199
12202
|
})));
|
|
12200
|
-
let
|
|
12203
|
+
let _ = !1;
|
|
12201
12204
|
for (const p of Object.values(ht))
|
|
12202
|
-
p.currentUser || (
|
|
12205
|
+
p.currentUser || (_ = !0);
|
|
12203
12206
|
let C;
|
|
12204
12207
|
return Bn(A, async (p) => {
|
|
12205
12208
|
if (p) {
|
|
@@ -12289,7 +12292,7 @@ const Gw = async (r, e, t, n) => {
|
|
|
12289
12292
|
console.error('Error clearing indexedDB persistence in "firestoreWrite".'), b.error = !0, b.instances.push({ instance: "firestoreWrite", code: "CLEAR_CACHE", error: O });
|
|
12290
12293
|
})), b.error ? console.info("Sign out operation completed with errors.") : console.info("Sign out operation completed successfully."), await _e(me.postLogout, [b]);
|
|
12291
12294
|
}
|
|
12292
|
-
}),
|
|
12295
|
+
}), _ ? !1 : A.currentUser ? (E && console.info(`${A.currentUser.uid} successfully logged in.`), !0) : !1;
|
|
12293
12296
|
}, { getTenant: Dt, getEnv: Ue, getTimezone: Am, getSchema: Ke, getCurrentUser: Hw, getCurrentUserRoleGroups: Jr, getAllRoleGroups: yc, getGlobalConfigModule: ke, getCollectionConfigModule: lt, getAppCheck: Kw, getAppCheckFirestoreWrite: Yw, getFirestoreWriteAuth: Nw, getFirestoreWrite: gc, getFirestoreMaintenance: Cm } = Ao, Jw = async (r, e, t) => {
|
|
12294
12297
|
const [n, s] = [fr(), Nw()], i = ke();
|
|
12295
12298
|
if (!r || !e)
|
|
@@ -12383,16 +12386,16 @@ const Gw = async (r, e, t, n) => {
|
|
|
12383
12386
|
const { labels: d, preloadCache: h } = f, m = ke(), E = Object.keys(o.collections).includes(i), g = m.disabledCollections?.includes(i);
|
|
12384
12387
|
if (!E || g)
|
|
12385
12388
|
throw new Error("COLLECTION_NOT_FOUND");
|
|
12386
|
-
const
|
|
12389
|
+
const v = lt(d.collection), S = await se(m, [
|
|
12387
12390
|
"global",
|
|
12388
12391
|
"firebase",
|
|
12389
12392
|
"serverTimestampOptions"
|
|
12390
|
-
]),
|
|
12391
|
-
if (
|
|
12393
|
+
]), T = dm(r, e, l);
|
|
12394
|
+
if (T.length === 0)
|
|
12392
12395
|
throw new Error("PERMISSION_DENIED");
|
|
12393
12396
|
const P = h?.roles?.includes(a.Role), y = { collection: d.collection };
|
|
12394
|
-
await oe("preOperation", m,
|
|
12395
|
-
const
|
|
12397
|
+
await oe("preOperation", m, v, ["read", void 0, e, y]), await oe("preRead", m, v, [y, T, !1, !0]);
|
|
12398
|
+
const _ = /* @__PURE__ */ new Map(), C = [];
|
|
12396
12399
|
let p = {};
|
|
12397
12400
|
const k = /* @__PURE__ */ new Map();
|
|
12398
12401
|
typeof s?.relations == "object" && (s.relations.fields = s.relations.fields.map((F) => {
|
|
@@ -12467,14 +12470,14 @@ const Gw = async (r, e, t, n) => {
|
|
|
12467
12470
|
D.set(`${W.name}_${H}`, !0), b.delete(`${W.name}_${H}`);
|
|
12468
12471
|
return;
|
|
12469
12472
|
}
|
|
12470
|
-
q[H] = j, D.set(`${W.name}_${H}`, !0), Array.from(D.values()).every((ae) => ae) && (F({}), I(), oe("postOperation", m,
|
|
12473
|
+
q[H] = j, D.set(`${W.name}_${H}`, !0), Array.from(D.values()).every((ae) => ae) && (F({}), I(), oe("postOperation", m, v, [
|
|
12471
12474
|
"read",
|
|
12472
12475
|
p,
|
|
12473
12476
|
e,
|
|
12474
12477
|
y
|
|
12475
|
-
]), oe("postRead", m,
|
|
12478
|
+
]), oe("postRead", m, v, [
|
|
12476
12479
|
y,
|
|
12477
|
-
|
|
12480
|
+
T,
|
|
12478
12481
|
p,
|
|
12479
12482
|
!0
|
|
12480
12483
|
]));
|
|
@@ -12494,14 +12497,14 @@ const Gw = async (r, e, t, n) => {
|
|
|
12494
12497
|
w.get(`${W.name}_${H}`) && w.get(`${W.name}_${H}`).listener(), D.set(`${W.name}_${H}`, !0), b.delete(`${W.name}_${H}`);
|
|
12495
12498
|
return;
|
|
12496
12499
|
}
|
|
12497
|
-
q[H] = j, D.set(`${W.name}_${H}`, !0), Array.from(D.values()).every((ae) => ae) && (F({}), I(), oe("postOperation", m,
|
|
12500
|
+
q[H] = j, D.set(`${W.name}_${H}`, !0), Array.from(D.values()).every((ae) => ae) && (F({}), I(), oe("postOperation", m, v, [
|
|
12498
12501
|
"read",
|
|
12499
12502
|
p,
|
|
12500
12503
|
e,
|
|
12501
12504
|
y
|
|
12502
|
-
]), oe("postRead", m,
|
|
12505
|
+
]), oe("postRead", m, v, [
|
|
12503
12506
|
y,
|
|
12504
|
-
|
|
12507
|
+
T,
|
|
12505
12508
|
p,
|
|
12506
12509
|
!0
|
|
12507
12510
|
]));
|
|
@@ -12528,26 +12531,26 @@ const Gw = async (r, e, t, n) => {
|
|
|
12528
12531
|
}
|
|
12529
12532
|
}
|
|
12530
12533
|
});
|
|
12531
|
-
for (const F of
|
|
12534
|
+
for (const F of T) {
|
|
12532
12535
|
const M = dr(F, { source: s?.only || (P ? "cache" : "default") }, (D) => {
|
|
12533
12536
|
if (D.exists()) {
|
|
12534
|
-
const Y = D.data({ serverTimestamps:
|
|
12535
|
-
if (
|
|
12537
|
+
const Y = D.data({ serverTimestamps: S || "none" });
|
|
12538
|
+
if (_.has(F.path) && s?.relations) {
|
|
12536
12539
|
const W = O(s?.relations);
|
|
12537
12540
|
for (const q of W)
|
|
12538
12541
|
"collection" in q && Y[q.name] && (Y[q.name] = p?.[q.name]);
|
|
12539
12542
|
}
|
|
12540
|
-
|
|
12543
|
+
_.set(F.path, !0), p ||= {}, p.id ||= D.id, p = { ...p, ...Y }, delete p.Collection_Path_String;
|
|
12541
12544
|
const J = k.get(F) || /* @__PURE__ */ new Set();
|
|
12542
|
-
lm(Y, J), k.set(F, J),
|
|
12543
|
-
I(), oe("postOperation", m,
|
|
12545
|
+
lm(Y, J), k.set(F, J), _.size === T.length && x().then(() => {
|
|
12546
|
+
I(), oe("postOperation", m, v, [
|
|
12544
12547
|
"read",
|
|
12545
12548
|
p,
|
|
12546
12549
|
e,
|
|
12547
12550
|
y
|
|
12548
|
-
]), oe("postRead", m,
|
|
12551
|
+
]), oe("postRead", m, v, [y, T, p, !0]);
|
|
12549
12552
|
});
|
|
12550
|
-
} else p && (p = void 0, I(), oe("postOperation", m,
|
|
12553
|
+
} else p && (p = void 0, I(), oe("postOperation", m, v, ["read", void 0, e, y]), oe("postRead", m, v, [y, T, void 0, !0]));
|
|
12551
12554
|
}, (D) => {
|
|
12552
12555
|
n && n(D), C.forEach((Y) => Y());
|
|
12553
12556
|
});
|
|
@@ -12579,10 +12582,10 @@ const Gw = async (r, e, t, n) => {
|
|
|
12579
12582
|
const a = De();
|
|
12580
12583
|
if (!a?.Role)
|
|
12581
12584
|
throw new Error("PERMISSION_DENIED");
|
|
12582
|
-
const o = Ke(!0), l = Jr()[i], u = je(), f = o.collections[i], { labels: d, preloadCache: h, access: m } = f, { serverReadOnly: E } = m, g = ke(),
|
|
12583
|
-
if (!
|
|
12585
|
+
const o = Ke(!0), l = Jr()[i], u = je(), f = o.collections[i], { labels: d, preloadCache: h, access: m } = f, { serverReadOnly: E } = m, g = ke(), v = Object.keys(o.collections).includes(i), S = g.disabledCollections?.includes(i);
|
|
12586
|
+
if (!v || S)
|
|
12584
12587
|
throw new Error("COLLECTION_NOT_FOUND");
|
|
12585
|
-
const
|
|
12588
|
+
const T = lt(d.collection), P = await se(g, [
|
|
12586
12589
|
"global",
|
|
12587
12590
|
"firebase",
|
|
12588
12591
|
"serverTimestampOptions"
|
|
@@ -12597,7 +12600,7 @@ const Gw = async (r, e, t, n) => {
|
|
|
12597
12600
|
return { pages: 0, count: 0, unsubscribe: () => {
|
|
12598
12601
|
} };
|
|
12599
12602
|
let R = A.map((j) => he(j, ...e));
|
|
12600
|
-
const
|
|
12603
|
+
const _ = s?.pagination?.startAfter || s?.pagination?.endBefore || s?.pagination?.startAt || s?.pagination?.endAt || {
|
|
12601
12604
|
first: /* @__PURE__ */ new Map(),
|
|
12602
12605
|
last: /* @__PURE__ */ new Map()
|
|
12603
12606
|
};
|
|
@@ -12610,22 +12613,22 @@ const Gw = async (r, e, t, n) => {
|
|
|
12610
12613
|
s.pagination.startAfter || s.pagination.endBefore || s.pagination.startAt || s.pagination.endAt ? s.pagination.startAfter ? (Qa(s.pagination.startAfter), R = R.map((z, Q) => {
|
|
12611
12614
|
if (!s.pagination?.orderByField || !s.pagination.orderByDirection)
|
|
12612
12615
|
throw new Error("INPUT_ERROR: orderByField and orderByDirection must be provided when using startAfter");
|
|
12613
|
-
let U = he(z, rt(s.pagination.orderByField, s.pagination.orderByDirection), eo(
|
|
12616
|
+
let U = he(z, rt(s.pagination.orderByField, s.pagination.orderByDirection), eo(_.last.get(Q)));
|
|
12614
12617
|
return s.pagination.number && (U = he(U, Xt(s.pagination.number))), U;
|
|
12615
12618
|
})) : s.pagination.endBefore ? (Ja(s.pagination.endBefore), R = R.map((z, Q) => {
|
|
12616
12619
|
if (!s.pagination?.orderByField || !s.pagination.orderByDirection)
|
|
12617
12620
|
throw new Error("INPUT_ERROR: orderByField and orderByDirection must be provided when using endBefore");
|
|
12618
|
-
let U = he(z, rt(s.pagination.orderByField, s.pagination.orderByDirection), to(
|
|
12621
|
+
let U = he(z, rt(s.pagination.orderByField, s.pagination.orderByDirection), to(_.first.get(Q)));
|
|
12619
12622
|
return s.pagination.number && (U = he(U, Nr(s.pagination.number))), U;
|
|
12620
12623
|
})) : s.pagination.startAt ? (Ja(s.pagination.startAt), R = R.map((z, Q) => {
|
|
12621
12624
|
if (!s.pagination?.orderByField || !s.pagination.orderByDirection)
|
|
12622
12625
|
throw new Error("INPUT_ERROR: orderByField and orderByDirection must be provided when using startAt");
|
|
12623
|
-
let U = he(z, rt(s.pagination.orderByField, s.pagination.orderByDirection), ap(
|
|
12626
|
+
let U = he(z, rt(s.pagination.orderByField, s.pagination.orderByDirection), ap(_.first.get(Q)));
|
|
12624
12627
|
return s.pagination.number && (U = he(U, Nr(s.pagination.number))), U;
|
|
12625
12628
|
})) : s.pagination.endAt && (Qa(s.pagination.endAt), R = R.map((z, Q) => {
|
|
12626
12629
|
if (!s.pagination?.orderByField || !s.pagination.orderByDirection)
|
|
12627
12630
|
throw new Error("INPUT_ERROR: orderByField and orderByDirection must be provided when using endAt");
|
|
12628
|
-
let U = he(z, rt(s.pagination.orderByField, s.pagination.orderByDirection), op(
|
|
12631
|
+
let U = he(z, rt(s.pagination.orderByField, s.pagination.orderByDirection), op(_.last.get(Q)));
|
|
12629
12632
|
return s.pagination.number && (U = he(U, Nr(s.pagination.number))), U;
|
|
12630
12633
|
})) : R = R.map((z) => {
|
|
12631
12634
|
let Q = he(z);
|
|
@@ -12633,7 +12636,7 @@ const Gw = async (r, e, t, n) => {
|
|
|
12633
12636
|
});
|
|
12634
12637
|
}
|
|
12635
12638
|
const C = { collection: d.collection };
|
|
12636
|
-
await oe("preOperation", g,
|
|
12639
|
+
await oe("preOperation", g, T, ["read", void 0, void 0, C]), await oe("preRead", g, T, [C, R, !0, !0]);
|
|
12637
12640
|
let I = !0;
|
|
12638
12641
|
const b = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Map(), O = [], x = /* @__PURE__ */ new Map(), F = /* @__PURE__ */ new Map(), M = /* @__PURE__ */ new Map(), D = (j, ae, z) => {
|
|
12639
12642
|
const Q = [];
|
|
@@ -12646,7 +12649,7 @@ const Gw = async (r, e, t, n) => {
|
|
|
12646
12649
|
}), Promise.all(Q).then(() => {
|
|
12647
12650
|
t(Array.from(x.values()), j, ae), x.forEach((U) => {
|
|
12648
12651
|
const G = ["read", U, U.id, C];
|
|
12649
|
-
oe("postOperation", g,
|
|
12652
|
+
oe("postOperation", g, T, G), oe("postRead", g, T, [C, A, U, !0]);
|
|
12650
12653
|
});
|
|
12651
12654
|
});
|
|
12652
12655
|
}, Y = (j, ae) => {
|
|
@@ -12657,7 +12660,7 @@ const Gw = async (r, e, t, n) => {
|
|
|
12657
12660
|
}), b.size === R.length && z) {
|
|
12658
12661
|
I = !1;
|
|
12659
12662
|
const Q = Sd(u, () => {
|
|
12660
|
-
Q(), !s?.noComputedFields &&
|
|
12663
|
+
Q(), !s?.noComputedFields && T?.admin?.retriever ? _e(T.admin.retriever).then((U) => {
|
|
12661
12664
|
D(j, ae, U);
|
|
12662
12665
|
}) : D(j, ae);
|
|
12663
12666
|
});
|
|
@@ -12777,14 +12780,14 @@ const Gw = async (r, e, t, n) => {
|
|
|
12777
12780
|
for (const j of R) {
|
|
12778
12781
|
let ae = !0;
|
|
12779
12782
|
const z = dr(j, { source: Qe ? "cache" : "default", includeMetadataChanges: !0 }, (Q) => {
|
|
12780
|
-
(Qe || Q.metadata.fromCache === !1) && (b.set(j, !0),
|
|
12783
|
+
(Qe || Q.metadata.fromCache === !1) && (b.set(j, !0), _.first.set(R.indexOf(j), Q.docs[0]), _.last.set(R.indexOf(j), Q.docs.at(-1) || Q.docs[0]), I && s?.relations || Y(_, Q.metadata)), b.get(j) === !0 && (ae ? (Q.docs.forEach((U) => {
|
|
12781
12784
|
const G = x.get(U.id) || {}, Se = M.get(U.id) || 0;
|
|
12782
12785
|
M.set(U.id, Se + 1), Ie(j, G, U);
|
|
12783
12786
|
}), ae = !1) : Q.docChanges().forEach((U) => {
|
|
12784
12787
|
const G = x.get(U.doc.id) || {}, Se = M.get(U.doc.id) || 0;
|
|
12785
12788
|
U.type === "added" && M.set(U.doc.id, Se + 1), U.type === "added" || U.type === "modified" ? Ie(j, G, U.doc) : U.type === "removed" && (M.set(U.doc.id, Se - 1), M.get(U.doc.id) === 0 && (x.delete(U.doc.id), b.size === R.length && s?.relations && (w.set(U.doc.id, "deleted"), H(U.doc.id))));
|
|
12786
|
-
}), b.size === R.length && s?.relations && (x.size === 0 && Y(
|
|
12787
|
-
q(U,
|
|
12789
|
+
}), b.size === R.length && s?.relations && (x.size === 0 && Y(_, Q.metadata), x.forEach((U) => {
|
|
12790
|
+
q(U, _);
|
|
12788
12791
|
})));
|
|
12789
12792
|
}, (Q) => {
|
|
12790
12793
|
n && n(new Error(`Error fetching documents at location ${r.join("/")}`, { cause: Q })), O.forEach((U) => U());
|
|
@@ -12804,7 +12807,7 @@ const Gw = async (r, e, t, n) => {
|
|
|
12804
12807
|
}
|
|
12805
12808
|
}
|
|
12806
12809
|
return { pages: Ve, count: Ee, unsubscribe: (j) => {
|
|
12807
|
-
j === "first" && Ja(
|
|
12810
|
+
j === "first" && Ja(_), j === "last" && Qa(_), O.forEach((ae) => ae());
|
|
12808
12811
|
} };
|
|
12809
12812
|
}, ib = async (r, e) => {
|
|
12810
12813
|
const t = it(), n = Ue(), s = $e(t, n.STOKER_FB_FUNCTIONS_REGION);
|
|
@@ -12828,8 +12831,8 @@ const Gw = async (r, e, t, n) => {
|
|
|
12828
12831
|
await Fw(e, t, n, s, i, a);
|
|
12829
12832
|
return;
|
|
12830
12833
|
}
|
|
12831
|
-
const f = Ha(r), d = cw(e), h = t ? pd(t) : void 0, m = n ? pd(n) : void 0, E = s ? Ha(s) : void 0, g = i ? Ha(i) : void 0,
|
|
12832
|
-
if (
|
|
12834
|
+
const f = Ha(r), d = cw(e), h = t ? pd(t) : void 0, m = n ? pd(n) : void 0, E = s ? Ha(s) : void 0, g = i ? Ha(i) : void 0, v = a ? Tn(a) : void 0, S = c ? Tn(c) : void 0, T = Array.isArray(f) ? f : [f];
|
|
12835
|
+
if (T.length === 0 || T.length === 1 && !T[0])
|
|
12833
12836
|
throw new Error("No valid email addresses provided");
|
|
12834
12837
|
const P = je(), y = { to: f, message: { subject: d } };
|
|
12835
12838
|
if (h && (y.message.text = h), m && (y.message.html = m), E) {
|
|
@@ -12840,7 +12843,7 @@ const Gw = async (r, e, t, n) => {
|
|
|
12840
12843
|
const A = Array.isArray(g) ? g : [g];
|
|
12841
12844
|
A.length > 0 && A[0] && (y.bcc = g);
|
|
12842
12845
|
}
|
|
12843
|
-
|
|
12846
|
+
v && (y.replyTo = v), o && (y.message.attachments = o), S && (y.from = S), await Td(qr(P, "system_mail"), y);
|
|
12844
12847
|
}, Dw = async (r) => {
|
|
12845
12848
|
const e = it(), t = Ue(), n = $e(e, t.STOKER_FB_FUNCTIONS_REGION);
|
|
12846
12849
|
await Ye(n, "stoker-adminsms")({
|