@stoker-platform/web-client 0.5.9 → 0.5.11
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 +877 -877
- package/package.json +3 -3
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.11", 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) => {
|
|
@@ -58,92 +58,92 @@ const pp = "0.5.8", yp = (r) => !!r.auth, vt = (r, e) => {
|
|
|
58
58
|
!i.find((f) => f.field === l.field) && l.roles.includes(t.Role) && i.push(l);
|
|
59
59
|
}
|
|
60
60
|
return i;
|
|
61
|
-
}, vp = (r, e, t, n, s, i) => {
|
|
62
|
-
const { fields:
|
|
63
|
-
let
|
|
64
|
-
if (!
|
|
65
|
-
|
|
61
|
+
}, vp = (r, e, t, n, s, i, a) => {
|
|
62
|
+
const { fields: o } = e, c = s.collections?.[e.labels.collection];
|
|
63
|
+
let l = !0;
|
|
64
|
+
if (!c) {
|
|
65
|
+
l = !1;
|
|
66
66
|
return;
|
|
67
67
|
}
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
"operations" in
|
|
71
|
-
}),
|
|
72
|
-
if ("operations" in
|
|
68
|
+
const u = Rd(e, s), f = xo(e, s), d = Ad(e, t, s);
|
|
69
|
+
u?.filter((y) => y.type === "Record_Owner").forEach((y) => {
|
|
70
|
+
"operations" in y && y.operations && !y.operations.includes(r) || i.Created_By !== n && (l = !1);
|
|
71
|
+
}), u?.filter((y) => y.type === "Record_User").forEach((y) => {
|
|
72
|
+
if ("operations" in y && y.operations && !y.operations.includes(r))
|
|
73
73
|
return;
|
|
74
|
-
const
|
|
75
|
-
i[`${
|
|
76
|
-
}),
|
|
77
|
-
if ("operations" in
|
|
74
|
+
const A = re(o, y.collectionField);
|
|
75
|
+
i[`${A.name}_Array`]?.includes(s.Doc_ID) || (l = !1);
|
|
76
|
+
}), u?.filter((y) => y.type === "Record_Property").forEach((y) => {
|
|
77
|
+
if ("operations" in y && y.operations && !y.operations.includes(r))
|
|
78
78
|
return;
|
|
79
|
-
const
|
|
80
|
-
|
|
79
|
+
const A = re(o, y.propertyField), R = y.roles.find((v) => v.role === s.Role);
|
|
80
|
+
A.type === "Array" ? R.values?.some((v) => i[A.name].includes(v)) || (l = !1) : R.values?.includes(i[A.name]) || (l = !1);
|
|
81
81
|
});
|
|
82
|
-
let
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
let h = !0, m = !1;
|
|
83
|
+
f?.filter((y) => y.type === "Individual").forEach(() => {
|
|
84
|
+
m = !0, c?.individualEntities?.includes(i.id) || (h = !1);
|
|
85
85
|
});
|
|
86
|
-
let
|
|
87
|
-
if (
|
|
88
|
-
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
}),
|
|
92
|
-
|
|
93
|
-
const
|
|
94
|
-
Object.entries(
|
|
95
|
-
const [
|
|
96
|
-
return
|
|
97
|
-
}) || (
|
|
98
|
-
}),
|
|
99
|
-
if (!(
|
|
100
|
-
|
|
86
|
+
let E = !0, g = !1;
|
|
87
|
+
if (f?.filter((y) => y.type === "Parent").forEach((y) => {
|
|
88
|
+
g = !0;
|
|
89
|
+
const A = re(o, y.collectionField);
|
|
90
|
+
c?.parentEntities?.some((R) => i[`${A.name}_Array`].includes(R)) || (E = !1);
|
|
91
|
+
}), f?.filter((y) => y.type === "Parent_Property").forEach((y) => {
|
|
92
|
+
g = !0;
|
|
93
|
+
const A = re(o, y.collectionField), R = re(o, y.propertyField);
|
|
94
|
+
Object.entries(c?.parentPropertyEntities || {}).some((v) => {
|
|
95
|
+
const [C, p] = v;
|
|
96
|
+
return C === i[R.name] && i[`${A.name}_Array`].some((k) => p.includes(k));
|
|
97
|
+
}) || (E = !1);
|
|
98
|
+
}), m && g) {
|
|
99
|
+
if (!(h || E)) {
|
|
100
|
+
l = !1;
|
|
101
101
|
return;
|
|
102
102
|
}
|
|
103
|
-
} else if (!
|
|
104
|
-
|
|
103
|
+
} else if (!h || !E) {
|
|
104
|
+
l = !1;
|
|
105
105
|
return;
|
|
106
106
|
}
|
|
107
|
-
let
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
const { parentFilter:
|
|
111
|
-
if (!
|
|
112
|
-
|
|
107
|
+
let _ = !0, T = !1;
|
|
108
|
+
d?.filter((y) => y.parentFilter.type === "Individual").forEach((y) => {
|
|
109
|
+
T = !0;
|
|
110
|
+
const { parentFilter: A } = y, R = re(o, A.collectionField), v = s.collections?.[R.collection];
|
|
111
|
+
if (!v) {
|
|
112
|
+
l = !1;
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
115
|
-
|
|
115
|
+
v.individualEntities?.some((C) => i[`${R.name}_Array`].includes(C)) || (_ = !1);
|
|
116
116
|
});
|
|
117
|
-
let
|
|
118
|
-
if (
|
|
119
|
-
|
|
120
|
-
const { parentFilter:
|
|
121
|
-
if (!
|
|
122
|
-
|
|
117
|
+
let S = !0, P = !1;
|
|
118
|
+
if (d?.filter((y) => y.parentFilter.type === "Parent").forEach((y) => {
|
|
119
|
+
P = !0;
|
|
120
|
+
const { parentFilter: A } = y, R = re(o, A.collectionField), v = re(o, A.parentCollectionField), C = s.collections?.[R.collection];
|
|
121
|
+
if (!C) {
|
|
122
|
+
l = !1;
|
|
123
123
|
return;
|
|
124
124
|
}
|
|
125
|
-
|
|
126
|
-
}),
|
|
127
|
-
|
|
128
|
-
const { parentFilter:
|
|
129
|
-
if (!
|
|
130
|
-
|
|
125
|
+
C.parentEntities?.some((p) => i[`${v.name}_Array`].includes(p)) || (S = !1);
|
|
126
|
+
}), d?.filter((y) => y.parentFilter.type === "Parent_Property").forEach((y) => {
|
|
127
|
+
P = !0;
|
|
128
|
+
const { parentFilter: A } = y, R = re(o, A.collectionField), v = re(o, A.parentPropertyField), C = re(o, A.parentCollectionField), p = s.collections?.[R.collection];
|
|
129
|
+
if (!p) {
|
|
130
|
+
l = !1;
|
|
131
131
|
return;
|
|
132
132
|
}
|
|
133
|
-
Object.entries(
|
|
134
|
-
const [
|
|
135
|
-
return
|
|
136
|
-
}) || (
|
|
137
|
-
}),
|
|
138
|
-
if (!(
|
|
139
|
-
|
|
133
|
+
Object.entries(p.parentPropertyEntities || {}).some((k) => {
|
|
134
|
+
const [I, b] = k;
|
|
135
|
+
return I === i[v.name] && i[`${C.name}_Array`].some((w) => b.includes(w));
|
|
136
|
+
}) || (S = !1);
|
|
137
|
+
}), T && P) {
|
|
138
|
+
if (!(_ || S)) {
|
|
139
|
+
l = !1;
|
|
140
140
|
return;
|
|
141
141
|
}
|
|
142
|
-
} else if (!
|
|
143
|
-
|
|
142
|
+
} else if (!_ || !S) {
|
|
143
|
+
l = !1;
|
|
144
144
|
return;
|
|
145
145
|
}
|
|
146
|
-
return
|
|
146
|
+
return l;
|
|
147
147
|
}, dn = (r, e, t, n, s, i) => {
|
|
148
148
|
const { labels: a } = e, o = s.collections?.[a.collection];
|
|
149
149
|
let c = !0;
|
|
@@ -726,29 +726,29 @@ function xd() {
|
|
|
726
726
|
var d = c & n, h = a.length, m = o.length;
|
|
727
727
|
if (h != m && !(d && m > h))
|
|
728
728
|
return !1;
|
|
729
|
-
var
|
|
730
|
-
if (
|
|
731
|
-
return
|
|
732
|
-
var
|
|
733
|
-
for (f.set(a, o), f.set(o, a); ++
|
|
734
|
-
var
|
|
729
|
+
var E = f.get(a), g = f.get(o);
|
|
730
|
+
if (E && g)
|
|
731
|
+
return E == o && g == a;
|
|
732
|
+
var _ = -1, T = !0, S = c & s ? new r() : void 0;
|
|
733
|
+
for (f.set(a, o), f.set(o, a); ++_ < h; ) {
|
|
734
|
+
var P = a[_], y = o[_];
|
|
735
735
|
if (l)
|
|
736
|
-
var
|
|
737
|
-
if (
|
|
738
|
-
if (
|
|
736
|
+
var A = d ? l(y, P, _, o, a, f) : l(P, y, _, a, o, f);
|
|
737
|
+
if (A !== void 0) {
|
|
738
|
+
if (A)
|
|
739
739
|
continue;
|
|
740
740
|
T = !1;
|
|
741
741
|
break;
|
|
742
742
|
}
|
|
743
|
-
if (
|
|
744
|
-
if (!e(o, function(
|
|
745
|
-
if (!t(
|
|
746
|
-
return
|
|
743
|
+
if (S) {
|
|
744
|
+
if (!e(o, function(R, v) {
|
|
745
|
+
if (!t(S, v) && (P === R || u(P, R, c, l, f)))
|
|
746
|
+
return S.push(v);
|
|
747
747
|
})) {
|
|
748
748
|
T = !1;
|
|
749
749
|
break;
|
|
750
750
|
}
|
|
751
|
-
} else if (!(
|
|
751
|
+
} else if (!(P === y || u(P, y, c, l, f))) {
|
|
752
752
|
T = !1;
|
|
753
753
|
break;
|
|
754
754
|
}
|
|
@@ -792,43 +792,43 @@ var Hs, xl;
|
|
|
792
792
|
function ty() {
|
|
793
793
|
if (xl) return Hs;
|
|
794
794
|
xl = 1;
|
|
795
|
-
var r = Wr(), e = Nd(), t = Vr(), n = xd(), s = Xp(), i = ey(), a = 1, o = 2, c = "[object Boolean]", l = "[object Date]", u = "[object Error]", f = "[object Map]", d = "[object Number]", h = "[object RegExp]", m = "[object Set]",
|
|
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]", d = "[object Number]", h = "[object RegExp]", m = "[object Set]", E = "[object String]", g = "[object Symbol]", _ = "[object ArrayBuffer]", T = "[object DataView]", S = r ? r.prototype : void 0, P = S ? S.valueOf : void 0;
|
|
796
|
+
function y(A, R, v, C, p, k, I) {
|
|
797
|
+
switch (v) {
|
|
798
798
|
case T:
|
|
799
|
-
if (
|
|
799
|
+
if (A.byteLength != R.byteLength || A.byteOffset != R.byteOffset)
|
|
800
800
|
return !1;
|
|
801
|
-
|
|
802
|
-
case
|
|
803
|
-
return !(
|
|
801
|
+
A = A.buffer, R = R.buffer;
|
|
802
|
+
case _:
|
|
803
|
+
return !(A.byteLength != R.byteLength || !k(new e(A), new e(R)));
|
|
804
804
|
case c:
|
|
805
805
|
case l:
|
|
806
806
|
case d:
|
|
807
|
-
return t(+
|
|
807
|
+
return t(+A, +R);
|
|
808
808
|
case u:
|
|
809
|
-
return
|
|
809
|
+
return A.name == R.name && A.message == R.message;
|
|
810
810
|
case h:
|
|
811
|
-
case
|
|
812
|
-
return
|
|
811
|
+
case E:
|
|
812
|
+
return A == R + "";
|
|
813
813
|
case f:
|
|
814
|
-
var
|
|
814
|
+
var b = s;
|
|
815
815
|
case m:
|
|
816
|
-
var
|
|
817
|
-
if (
|
|
816
|
+
var w = C & a;
|
|
817
|
+
if (b || (b = i), A.size != R.size && !w)
|
|
818
818
|
return !1;
|
|
819
|
-
var
|
|
820
|
-
if (
|
|
821
|
-
return
|
|
822
|
-
C |= o,
|
|
823
|
-
var
|
|
824
|
-
return
|
|
825
|
-
case
|
|
826
|
-
if (
|
|
827
|
-
return
|
|
819
|
+
var O = I.get(A);
|
|
820
|
+
if (O)
|
|
821
|
+
return O == R;
|
|
822
|
+
C |= o, I.set(A, R);
|
|
823
|
+
var x = n(b(A), b(R), C, p, k, I);
|
|
824
|
+
return I.delete(A), x;
|
|
825
|
+
case g:
|
|
826
|
+
if (P)
|
|
827
|
+
return P.call(A) == P.call(R);
|
|
828
828
|
}
|
|
829
829
|
return !1;
|
|
830
830
|
}
|
|
831
|
-
return Hs =
|
|
831
|
+
return Hs = y, Hs;
|
|
832
832
|
}
|
|
833
833
|
var Ks, Nl;
|
|
834
834
|
function Fd() {
|
|
@@ -975,12 +975,12 @@ 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]",
|
|
979
|
-
k[T] = k[
|
|
980
|
-
function
|
|
981
|
-
return t(
|
|
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]", _ = "[object DataView]", T = "[object Float32Array]", S = "[object Float64Array]", P = "[object Int8Array]", y = "[object Int16Array]", A = "[object Int32Array]", R = "[object Uint8Array]", v = "[object Uint8ClampedArray]", C = "[object Uint16Array]", p = "[object Uint32Array]", k = {};
|
|
979
|
+
k[T] = k[S] = k[P] = k[y] = k[A] = k[R] = k[v] = k[C] = k[p] = !0, k[n] = k[s] = k[g] = k[i] = k[_] = k[a] = k[o] = k[c] = k[l] = k[u] = k[f] = k[d] = k[h] = k[m] = k[E] = !1;
|
|
980
|
+
function I(b) {
|
|
981
|
+
return t(b) && e(b.length) && !!k[r(b)];
|
|
982
982
|
}
|
|
983
|
-
return ci =
|
|
983
|
+
return ci = I, ci;
|
|
984
984
|
}
|
|
985
985
|
var li, Gl;
|
|
986
986
|
function Lo() {
|
|
@@ -1021,14 +1021,14 @@ 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),
|
|
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) : [], _ = g.length;
|
|
1025
1025
|
for (var T in l)
|
|
1026
|
-
(u || o.call(l, T)) && !(
|
|
1026
|
+
(u || o.call(l, T)) && !(E && // Safari 9 has enumerable `arguments.length` in strict mode.
|
|
1027
1027
|
(T == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
|
|
1028
1028
|
h && (T == "offset" || T == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
1029
1029
|
m && (T == "buffer" || T == "byteLength" || T == "byteOffset") || // Skip index properties.
|
|
1030
|
-
s(T,
|
|
1031
|
-
return
|
|
1030
|
+
s(T, _))) && g.push(T);
|
|
1031
|
+
return g;
|
|
1032
1032
|
}
|
|
1033
1033
|
return fi = c, fi;
|
|
1034
1034
|
}
|
|
@@ -1112,35 +1112,35 @@ function ly() {
|
|
|
1112
1112
|
su = 1;
|
|
1113
1113
|
var r = jd(), e = 1, t = Object.prototype, n = t.hasOwnProperty;
|
|
1114
1114
|
function s(i, a, o, c, l, u) {
|
|
1115
|
-
var f = o & e, d = r(i), h = d.length, m = r(a),
|
|
1116
|
-
if (h !=
|
|
1115
|
+
var f = o & e, d = r(i), h = d.length, m = r(a), E = m.length;
|
|
1116
|
+
if (h != E && !f)
|
|
1117
1117
|
return !1;
|
|
1118
|
-
for (var
|
|
1119
|
-
var
|
|
1120
|
-
if (!(f ?
|
|
1118
|
+
for (var g = h; g--; ) {
|
|
1119
|
+
var _ = d[g];
|
|
1120
|
+
if (!(f ? _ in a : n.call(a, _)))
|
|
1121
1121
|
return !1;
|
|
1122
1122
|
}
|
|
1123
|
-
var T = u.get(i),
|
|
1124
|
-
if (T &&
|
|
1125
|
-
return T == a &&
|
|
1126
|
-
var
|
|
1123
|
+
var T = u.get(i), S = u.get(a);
|
|
1124
|
+
if (T && S)
|
|
1125
|
+
return T == a && S == i;
|
|
1126
|
+
var P = !0;
|
|
1127
1127
|
u.set(i, a), u.set(a, i);
|
|
1128
|
-
for (var
|
|
1129
|
-
|
|
1130
|
-
var
|
|
1128
|
+
for (var y = f; ++g < h; ) {
|
|
1129
|
+
_ = d[g];
|
|
1130
|
+
var A = i[_], R = a[_];
|
|
1131
1131
|
if (c)
|
|
1132
|
-
var
|
|
1133
|
-
if (!(
|
|
1134
|
-
|
|
1132
|
+
var v = f ? c(R, A, _, a, i, u) : c(A, R, _, i, a, u);
|
|
1133
|
+
if (!(v === void 0 ? A === R || l(A, R, o, c, u) : v)) {
|
|
1134
|
+
P = !1;
|
|
1135
1135
|
break;
|
|
1136
1136
|
}
|
|
1137
|
-
|
|
1137
|
+
y || (y = _ == "constructor");
|
|
1138
1138
|
}
|
|
1139
|
-
if (
|
|
1139
|
+
if (P && !y) {
|
|
1140
1140
|
var C = i.constructor, p = a.constructor;
|
|
1141
|
-
C != p && "constructor" in i && "constructor" in a && !(typeof C == "function" && C instanceof C && typeof p == "function" && p instanceof p) && (
|
|
1141
|
+
C != p && "constructor" in i && "constructor" in a && !(typeof C == "function" && C instanceof C && typeof p == "function" && p instanceof p) && (P = !1);
|
|
1142
1142
|
}
|
|
1143
|
-
return u.delete(i), u.delete(a),
|
|
1143
|
+
return u.delete(i), u.delete(a), P;
|
|
1144
1144
|
}
|
|
1145
1145
|
return vi = s, vi;
|
|
1146
1146
|
}
|
|
@@ -1176,23 +1176,23 @@ 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),
|
|
1180
|
-
return (r && T(new r(new ArrayBuffer(1))) != d || e && T(new e()) != o || t && T(t.resolve()) != l || n && T(new n()) != u || s && T(new s()) != f) && (T = function(
|
|
1181
|
-
var
|
|
1182
|
-
if (
|
|
1183
|
-
switch (
|
|
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), _ = a(s), T = i;
|
|
1180
|
+
return (r && T(new r(new ArrayBuffer(1))) != d || e && T(new e()) != o || t && T(t.resolve()) != l || n && T(new n()) != u || s && T(new s()) != f) && (T = function(S) {
|
|
1181
|
+
var P = i(S), y = P == c ? S.constructor : void 0, A = y ? a(y) : "";
|
|
1182
|
+
if (A)
|
|
1183
|
+
switch (A) {
|
|
1184
1184
|
case h:
|
|
1185
1185
|
return d;
|
|
1186
1186
|
case m:
|
|
1187
1187
|
return o;
|
|
1188
|
-
case
|
|
1188
|
+
case E:
|
|
1189
1189
|
return l;
|
|
1190
|
-
case y:
|
|
1191
|
-
return u;
|
|
1192
1190
|
case g:
|
|
1191
|
+
return u;
|
|
1192
|
+
case _:
|
|
1193
1193
|
return f;
|
|
1194
1194
|
}
|
|
1195
|
-
return
|
|
1195
|
+
return P;
|
|
1196
1196
|
}), Si = T, Si;
|
|
1197
1197
|
}
|
|
1198
1198
|
var Ti, uu;
|
|
@@ -1200,25 +1200,25 @@ 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(
|
|
1204
|
-
var
|
|
1205
|
-
|
|
1206
|
-
var C =
|
|
1207
|
-
if (k && a(
|
|
1208
|
-
if (!a(
|
|
1203
|
+
function m(E, g, _, T, S, P) {
|
|
1204
|
+
var y = i(E), A = i(g), R = y ? u : s(E), v = A ? u : s(g);
|
|
1205
|
+
R = R == l ? f : R, v = v == l ? f : v;
|
|
1206
|
+
var C = R == f, p = v == f, k = R == v;
|
|
1207
|
+
if (k && a(E)) {
|
|
1208
|
+
if (!a(g))
|
|
1209
1209
|
return !1;
|
|
1210
|
-
|
|
1210
|
+
y = !0, C = !1;
|
|
1211
1211
|
}
|
|
1212
1212
|
if (k && !C)
|
|
1213
|
-
return
|
|
1214
|
-
if (!(
|
|
1215
|
-
var
|
|
1216
|
-
if (
|
|
1217
|
-
var
|
|
1218
|
-
return
|
|
1213
|
+
return P || (P = new r()), y || o(E) ? e(E, g, _, T, S, P) : t(E, g, R, _, T, S, P);
|
|
1214
|
+
if (!(_ & c)) {
|
|
1215
|
+
var I = C && h.call(E, "__wrapped__"), b = p && h.call(g, "__wrapped__");
|
|
1216
|
+
if (I || b) {
|
|
1217
|
+
var w = I ? E.value() : E, O = b ? g.value() : g;
|
|
1218
|
+
return P || (P = new r()), S(w, O, _, T, P);
|
|
1219
1219
|
}
|
|
1220
1220
|
}
|
|
1221
|
-
return k ? (
|
|
1221
|
+
return k ? (P || (P = new r()), n(E, g, _, T, S, P)) : !1;
|
|
1222
1222
|
}
|
|
1223
1223
|
return Ti = m, Ti;
|
|
1224
1224
|
}
|
|
@@ -1273,18 +1273,18 @@ const _y = /* @__PURE__ */ In(gy), vy = (r, e, t, n, s, i, a, o, c) => {
|
|
|
1273
1273
|
}, Oy = (r, e, t, n, s, i, a, o, c, l) => {
|
|
1274
1274
|
const { labels: u, fields: f } = n, d = a?.collections?.[u.collection], h = { ...e, ...r };
|
|
1275
1275
|
tr(h);
|
|
1276
|
-
let m = !0,
|
|
1276
|
+
let m = !0, E = "";
|
|
1277
1277
|
if (i && !d)
|
|
1278
1278
|
throw new Error("PERMISSION_DENIED");
|
|
1279
|
-
i && !vt("Update", d) && (m = !1,
|
|
1279
|
+
i && !vt("Update", d) && (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, h)) && (m = !1,
|
|
1282
|
-
for (const
|
|
1283
|
-
const
|
|
1284
|
-
|
|
1281
|
+
!dn("Update", n, s, i, a, h)) && (m = !1, E = "Authenticated user does not have Update access to this document");
|
|
1282
|
+
for (const g of f) {
|
|
1283
|
+
const _ = r[g.name];
|
|
1284
|
+
g.access && !Cn(g, a) && _ !== void 0 && (E = `Authenticated user does not have access to field ${g.name}`, m = !1), _ !== 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
|
-
throw
|
|
1287
|
+
throw E && console.error(`PERMISSION_DENIED: ${E}`), new Error("PERMISSION_DENIED");
|
|
1288
1288
|
}, Ey = (r, e, t, n, s, i) => {
|
|
1289
1289
|
const { labels: a } = t, o = i.collections?.[a.collection];
|
|
1290
1290
|
let c = !0;
|
|
@@ -1590,20 +1590,20 @@ 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
|
|
1594
|
-
var
|
|
1593
|
+
function E(g, _, T, S, P, y, A) {
|
|
1594
|
+
var R = h(g, T), v = h(_, T), C = A.get(v);
|
|
1595
1595
|
if (C) {
|
|
1596
|
-
r(
|
|
1596
|
+
r(g, T, C);
|
|
1597
1597
|
return;
|
|
1598
1598
|
}
|
|
1599
|
-
var p =
|
|
1599
|
+
var p = y ? y(R, v, T + "", g, _, A) : void 0, k = p === void 0;
|
|
1600
1600
|
if (k) {
|
|
1601
|
-
var
|
|
1602
|
-
p =
|
|
1601
|
+
var I = a(v), b = !I && c(v), w = !I && !b && d(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 && (
|
|
1604
|
+
k && (A.set(v, p), P(p, v, S, y, A), A.delete(v)), r(g, T, p);
|
|
1605
1605
|
}
|
|
1606
|
-
return Hi =
|
|
1606
|
+
return Hi = E, Hi;
|
|
1607
1607
|
}
|
|
1608
1608
|
var Ki, Mu;
|
|
1609
1609
|
function My() {
|
|
@@ -1615,8 +1615,8 @@ function My() {
|
|
|
1615
1615
|
if (d || (d = new r()), s(h))
|
|
1616
1616
|
n(c, l, m, u, o, f, d);
|
|
1617
1617
|
else {
|
|
1618
|
-
var
|
|
1619
|
-
|
|
1618
|
+
var E = f ? f(a(c, m), h, m + "", c, l, d) : void 0;
|
|
1619
|
+
E === void 0 && (E = h), e(c, m, E);
|
|
1620
1620
|
}
|
|
1621
1621
|
}, i);
|
|
1622
1622
|
}
|
|
@@ -1907,14 +1907,14 @@ function ng() {
|
|
|
1907
1907
|
return a;
|
|
1908
1908
|
o = e(o, a);
|
|
1909
1909
|
for (var u = -1, f = o.length, d = f - 1, h = a; h != null && ++u < f; ) {
|
|
1910
|
-
var m = s(o[u]),
|
|
1910
|
+
var m = s(o[u]), E = c;
|
|
1911
1911
|
if (m === "__proto__" || m === "constructor" || m === "prototype")
|
|
1912
1912
|
return a;
|
|
1913
1913
|
if (u != d) {
|
|
1914
|
-
var
|
|
1915
|
-
|
|
1914
|
+
var g = h[m];
|
|
1915
|
+
E = l ? l(g, m, h) : void 0, E === void 0 && (E = n(g) ? g : t(o[u + 1]) ? [] : {});
|
|
1916
1916
|
}
|
|
1917
|
-
r(h, m,
|
|
1917
|
+
r(h, m, E), h = h[m];
|
|
1918
1918
|
}
|
|
1919
1919
|
return a;
|
|
1920
1920
|
}
|
|
@@ -2302,7 +2302,7 @@ const V = ue.arrayToEnum([
|
|
|
2302
2302
|
default:
|
|
2303
2303
|
return V.unknown;
|
|
2304
2304
|
}
|
|
2305
|
-
},
|
|
2305
|
+
}, N = ue.arrayToEnum([
|
|
2306
2306
|
"invalid_type",
|
|
2307
2307
|
"invalid_literal",
|
|
2308
2308
|
"custom",
|
|
@@ -2387,52 +2387,52 @@ gt.create = (r) => new gt(r);
|
|
|
2387
2387
|
const ro = (r, e) => {
|
|
2388
2388
|
let t;
|
|
2389
2389
|
switch (r.code) {
|
|
2390
|
-
case
|
|
2390
|
+
case N.invalid_type:
|
|
2391
2391
|
r.received === V.undefined ? t = "Required" : t = `Expected ${r.expected}, received ${r.received}`;
|
|
2392
2392
|
break;
|
|
2393
|
-
case
|
|
2393
|
+
case N.invalid_literal:
|
|
2394
2394
|
t = `Invalid literal value, expected ${JSON.stringify(r.expected, ue.jsonStringifyReplacer)}`;
|
|
2395
2395
|
break;
|
|
2396
|
-
case
|
|
2396
|
+
case N.unrecognized_keys:
|
|
2397
2397
|
t = `Unrecognized key(s) in object: ${ue.joinValues(r.keys, ", ")}`;
|
|
2398
2398
|
break;
|
|
2399
|
-
case
|
|
2399
|
+
case N.invalid_union:
|
|
2400
2400
|
t = "Invalid input";
|
|
2401
2401
|
break;
|
|
2402
|
-
case
|
|
2402
|
+
case N.invalid_union_discriminator:
|
|
2403
2403
|
t = `Invalid discriminator value. Expected ${ue.joinValues(r.options)}`;
|
|
2404
2404
|
break;
|
|
2405
|
-
case
|
|
2405
|
+
case N.invalid_enum_value:
|
|
2406
2406
|
t = `Invalid enum value. Expected ${ue.joinValues(r.options)}, received '${r.received}'`;
|
|
2407
2407
|
break;
|
|
2408
|
-
case
|
|
2408
|
+
case N.invalid_arguments:
|
|
2409
2409
|
t = "Invalid function arguments";
|
|
2410
2410
|
break;
|
|
2411
|
-
case
|
|
2411
|
+
case N.invalid_return_type:
|
|
2412
2412
|
t = "Invalid function return type";
|
|
2413
2413
|
break;
|
|
2414
|
-
case
|
|
2414
|
+
case N.invalid_date:
|
|
2415
2415
|
t = "Invalid date";
|
|
2416
2416
|
break;
|
|
2417
|
-
case
|
|
2417
|
+
case N.invalid_string:
|
|
2418
2418
|
typeof r.validation == "object" ? "includes" in r.validation ? (t = `Invalid input: must include "${r.validation.includes}"`, typeof r.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${r.validation.position}`)) : "startsWith" in r.validation ? t = `Invalid input: must start with "${r.validation.startsWith}"` : "endsWith" in r.validation ? t = `Invalid input: must end with "${r.validation.endsWith}"` : ue.assertNever(r.validation) : r.validation !== "regex" ? t = `Invalid ${r.validation}` : t = "Invalid";
|
|
2419
2419
|
break;
|
|
2420
|
-
case
|
|
2420
|
+
case N.too_small:
|
|
2421
2421
|
r.type === "array" ? t = `Array must contain ${r.exact ? "exactly" : r.inclusive ? "at least" : "more than"} ${r.minimum} element(s)` : r.type === "string" ? t = `String must contain ${r.exact ? "exactly" : r.inclusive ? "at least" : "over"} ${r.minimum} character(s)` : r.type === "number" ? t = `Number must be ${r.exact ? "exactly equal to " : r.inclusive ? "greater than or equal to " : "greater than "}${r.minimum}` : r.type === "bigint" ? t = `Number must be ${r.exact ? "exactly equal to " : r.inclusive ? "greater than or equal to " : "greater than "}${r.minimum}` : r.type === "date" ? t = `Date must be ${r.exact ? "exactly equal to " : r.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(r.minimum))}` : t = "Invalid input";
|
|
2422
2422
|
break;
|
|
2423
|
-
case
|
|
2423
|
+
case N.too_big:
|
|
2424
2424
|
r.type === "array" ? t = `Array must contain ${r.exact ? "exactly" : r.inclusive ? "at most" : "less than"} ${r.maximum} element(s)` : r.type === "string" ? t = `String must contain ${r.exact ? "exactly" : r.inclusive ? "at most" : "under"} ${r.maximum} character(s)` : r.type === "number" ? t = `Number must be ${r.exact ? "exactly" : r.inclusive ? "less than or equal to" : "less than"} ${r.maximum}` : r.type === "bigint" ? t = `BigInt must be ${r.exact ? "exactly" : r.inclusive ? "less than or equal to" : "less than"} ${r.maximum}` : r.type === "date" ? t = `Date must be ${r.exact ? "exactly" : r.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(r.maximum))}` : t = "Invalid input";
|
|
2425
2425
|
break;
|
|
2426
|
-
case
|
|
2426
|
+
case N.custom:
|
|
2427
2427
|
t = "Invalid input";
|
|
2428
2428
|
break;
|
|
2429
|
-
case
|
|
2429
|
+
case N.invalid_intersection_types:
|
|
2430
2430
|
t = "Intersection results could not be merged";
|
|
2431
2431
|
break;
|
|
2432
|
-
case
|
|
2432
|
+
case N.not_multiple_of:
|
|
2433
2433
|
t = `Number must be a multiple of ${r.multipleOf}`;
|
|
2434
2434
|
break;
|
|
2435
|
-
case
|
|
2435
|
+
case N.not_finite:
|
|
2436
2436
|
t = "Number must be finite";
|
|
2437
2437
|
break;
|
|
2438
2438
|
default:
|
|
@@ -2683,7 +2683,7 @@ class ce {
|
|
|
2683
2683
|
const n = (s) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(s) : t;
|
|
2684
2684
|
return this._refinement((s, i) => {
|
|
2685
2685
|
const a = e(s), o = () => i.addIssue({
|
|
2686
|
-
code:
|
|
2686
|
+
code: N.custom,
|
|
2687
2687
|
...n(s)
|
|
2688
2688
|
});
|
|
2689
2689
|
return typeof Promise < "u" && a instanceof Promise ? a.then((c) => c ? !0 : (o(), !1)) : a ? !0 : (o(), !1);
|
|
@@ -2824,7 +2824,7 @@ class yt extends ce {
|
|
|
2824
2824
|
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== V.string) {
|
|
2825
2825
|
const i = this._getOrReturnCtx(e);
|
|
2826
2826
|
return $(i, {
|
|
2827
|
-
code:
|
|
2827
|
+
code: N.invalid_type,
|
|
2828
2828
|
expected: V.string,
|
|
2829
2829
|
received: i.parsedType
|
|
2830
2830
|
}), te;
|
|
@@ -2834,7 +2834,7 @@ class yt extends ce {
|
|
|
2834
2834
|
for (const i of this._def.checks)
|
|
2835
2835
|
if (i.kind === "min")
|
|
2836
2836
|
e.data.length < i.value && (s = this._getOrReturnCtx(e, s), $(s, {
|
|
2837
|
-
code:
|
|
2837
|
+
code: N.too_small,
|
|
2838
2838
|
minimum: i.value,
|
|
2839
2839
|
type: "string",
|
|
2840
2840
|
inclusive: !0,
|
|
@@ -2843,7 +2843,7 @@ class yt extends ce {
|
|
|
2843
2843
|
}), n.dirty());
|
|
2844
2844
|
else if (i.kind === "max")
|
|
2845
2845
|
e.data.length > i.value && (s = this._getOrReturnCtx(e, s), $(s, {
|
|
2846
|
-
code:
|
|
2846
|
+
code: N.too_big,
|
|
2847
2847
|
maximum: i.value,
|
|
2848
2848
|
type: "string",
|
|
2849
2849
|
inclusive: !0,
|
|
@@ -2853,14 +2853,14 @@ class yt extends ce {
|
|
|
2853
2853
|
else if (i.kind === "length") {
|
|
2854
2854
|
const a = e.data.length > i.value, o = e.data.length < i.value;
|
|
2855
2855
|
(a || o) && (s = this._getOrReturnCtx(e, s), a ? $(s, {
|
|
2856
|
-
code:
|
|
2856
|
+
code: N.too_big,
|
|
2857
2857
|
maximum: i.value,
|
|
2858
2858
|
type: "string",
|
|
2859
2859
|
inclusive: !0,
|
|
2860
2860
|
exact: !0,
|
|
2861
2861
|
message: i.message
|
|
2862
2862
|
}) : o && $(s, {
|
|
2863
|
-
code:
|
|
2863
|
+
code: N.too_small,
|
|
2864
2864
|
minimum: i.value,
|
|
2865
2865
|
type: "string",
|
|
2866
2866
|
inclusive: !0,
|
|
@@ -2870,43 +2870,43 @@ class yt extends ce {
|
|
|
2870
2870
|
} else if (i.kind === "email")
|
|
2871
2871
|
Sg.test(e.data) || (s = this._getOrReturnCtx(e, s), $(s, {
|
|
2872
2872
|
validation: "email",
|
|
2873
|
-
code:
|
|
2873
|
+
code: N.invalid_string,
|
|
2874
2874
|
message: i.message
|
|
2875
2875
|
}), n.dirty());
|
|
2876
2876
|
else if (i.kind === "emoji")
|
|
2877
2877
|
wa || (wa = new RegExp(Tg, "u")), wa.test(e.data) || (s = this._getOrReturnCtx(e, s), $(s, {
|
|
2878
2878
|
validation: "emoji",
|
|
2879
|
-
code:
|
|
2879
|
+
code: N.invalid_string,
|
|
2880
2880
|
message: i.message
|
|
2881
2881
|
}), n.dirty());
|
|
2882
2882
|
else if (i.kind === "uuid")
|
|
2883
2883
|
wg.test(e.data) || (s = this._getOrReturnCtx(e, s), $(s, {
|
|
2884
2884
|
validation: "uuid",
|
|
2885
|
-
code:
|
|
2885
|
+
code: N.invalid_string,
|
|
2886
2886
|
message: i.message
|
|
2887
2887
|
}), n.dirty());
|
|
2888
2888
|
else if (i.kind === "nanoid")
|
|
2889
2889
|
bg.test(e.data) || (s = this._getOrReturnCtx(e, s), $(s, {
|
|
2890
2890
|
validation: "nanoid",
|
|
2891
|
-
code:
|
|
2891
|
+
code: N.invalid_string,
|
|
2892
2892
|
message: i.message
|
|
2893
2893
|
}), n.dirty());
|
|
2894
2894
|
else if (i.kind === "cuid")
|
|
2895
2895
|
gg.test(e.data) || (s = this._getOrReturnCtx(e, s), $(s, {
|
|
2896
2896
|
validation: "cuid",
|
|
2897
|
-
code:
|
|
2897
|
+
code: N.invalid_string,
|
|
2898
2898
|
message: i.message
|
|
2899
2899
|
}), n.dirty());
|
|
2900
2900
|
else if (i.kind === "cuid2")
|
|
2901
2901
|
_g.test(e.data) || (s = this._getOrReturnCtx(e, s), $(s, {
|
|
2902
2902
|
validation: "cuid2",
|
|
2903
|
-
code:
|
|
2903
|
+
code: N.invalid_string,
|
|
2904
2904
|
message: i.message
|
|
2905
2905
|
}), n.dirty());
|
|
2906
2906
|
else if (i.kind === "ulid")
|
|
2907
2907
|
vg.test(e.data) || (s = this._getOrReturnCtx(e, s), $(s, {
|
|
2908
2908
|
validation: "ulid",
|
|
2909
|
-
code:
|
|
2909
|
+
code: N.invalid_string,
|
|
2910
2910
|
message: i.message
|
|
2911
2911
|
}), n.dirty());
|
|
2912
2912
|
else if (i.kind === "url")
|
|
@@ -2915,61 +2915,61 @@ class yt extends ce {
|
|
|
2915
2915
|
} catch {
|
|
2916
2916
|
s = this._getOrReturnCtx(e, s), $(s, {
|
|
2917
2917
|
validation: "url",
|
|
2918
|
-
code:
|
|
2918
|
+
code: N.invalid_string,
|
|
2919
2919
|
message: i.message
|
|
2920
2920
|
}), n.dirty();
|
|
2921
2921
|
}
|
|
2922
2922
|
else i.kind === "regex" ? (i.regex.lastIndex = 0, i.regex.test(e.data) || (s = this._getOrReturnCtx(e, s), $(s, {
|
|
2923
2923
|
validation: "regex",
|
|
2924
|
-
code:
|
|
2924
|
+
code: N.invalid_string,
|
|
2925
2925
|
message: i.message
|
|
2926
2926
|
}), n.dirty())) : i.kind === "trim" ? e.data = e.data.trim() : i.kind === "includes" ? e.data.includes(i.value, i.position) || (s = this._getOrReturnCtx(e, s), $(s, {
|
|
2927
|
-
code:
|
|
2927
|
+
code: N.invalid_string,
|
|
2928
2928
|
validation: { includes: i.value, position: i.position },
|
|
2929
2929
|
message: i.message
|
|
2930
2930
|
}), n.dirty()) : i.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : i.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : i.kind === "startsWith" ? e.data.startsWith(i.value) || (s = this._getOrReturnCtx(e, s), $(s, {
|
|
2931
|
-
code:
|
|
2931
|
+
code: N.invalid_string,
|
|
2932
2932
|
validation: { startsWith: i.value },
|
|
2933
2933
|
message: i.message
|
|
2934
2934
|
}), n.dirty()) : i.kind === "endsWith" ? e.data.endsWith(i.value) || (s = this._getOrReturnCtx(e, s), $(s, {
|
|
2935
|
-
code:
|
|
2935
|
+
code: N.invalid_string,
|
|
2936
2936
|
validation: { endsWith: i.value },
|
|
2937
2937
|
message: i.message
|
|
2938
2938
|
}), n.dirty()) : i.kind === "datetime" ? Dg(i).test(e.data) || (s = this._getOrReturnCtx(e, s), $(s, {
|
|
2939
|
-
code:
|
|
2939
|
+
code: N.invalid_string,
|
|
2940
2940
|
validation: "datetime",
|
|
2941
2941
|
message: i.message
|
|
2942
2942
|
}), n.dirty()) : i.kind === "date" ? Ng.test(e.data) || (s = this._getOrReturnCtx(e, s), $(s, {
|
|
2943
|
-
code:
|
|
2943
|
+
code: N.invalid_string,
|
|
2944
2944
|
validation: "date",
|
|
2945
2945
|
message: i.message
|
|
2946
2946
|
}), n.dirty()) : i.kind === "time" ? Fg(i).test(e.data) || (s = this._getOrReturnCtx(e, s), $(s, {
|
|
2947
|
-
code:
|
|
2947
|
+
code: N.invalid_string,
|
|
2948
2948
|
validation: "time",
|
|
2949
2949
|
message: i.message
|
|
2950
2950
|
}), n.dirty()) : i.kind === "duration" ? Eg.test(e.data) || (s = this._getOrReturnCtx(e, s), $(s, {
|
|
2951
2951
|
validation: "duration",
|
|
2952
|
-
code:
|
|
2952
|
+
code: N.invalid_string,
|
|
2953
2953
|
message: i.message
|
|
2954
2954
|
}), n.dirty()) : i.kind === "ip" ? Mg(e.data, i.version) || (s = this._getOrReturnCtx(e, s), $(s, {
|
|
2955
2955
|
validation: "ip",
|
|
2956
|
-
code:
|
|
2956
|
+
code: N.invalid_string,
|
|
2957
2957
|
message: i.message
|
|
2958
2958
|
}), n.dirty()) : i.kind === "jwt" ? Pg(e.data, i.alg) || (s = this._getOrReturnCtx(e, s), $(s, {
|
|
2959
2959
|
validation: "jwt",
|
|
2960
|
-
code:
|
|
2960
|
+
code: N.invalid_string,
|
|
2961
2961
|
message: i.message
|
|
2962
2962
|
}), n.dirty()) : i.kind === "cidr" ? qg(e.data, i.version) || (s = this._getOrReturnCtx(e, s), $(s, {
|
|
2963
2963
|
validation: "cidr",
|
|
2964
|
-
code:
|
|
2964
|
+
code: N.invalid_string,
|
|
2965
2965
|
message: i.message
|
|
2966
2966
|
}), n.dirty()) : i.kind === "base64" ? Ig.test(e.data) || (s = this._getOrReturnCtx(e, s), $(s, {
|
|
2967
2967
|
validation: "base64",
|
|
2968
|
-
code:
|
|
2968
|
+
code: N.invalid_string,
|
|
2969
2969
|
message: i.message
|
|
2970
2970
|
}), n.dirty()) : i.kind === "base64url" ? xg.test(e.data) || (s = this._getOrReturnCtx(e, s), $(s, {
|
|
2971
2971
|
validation: "base64url",
|
|
2972
|
-
code:
|
|
2972
|
+
code: N.invalid_string,
|
|
2973
2973
|
message: i.message
|
|
2974
2974
|
}), n.dirty()) : ue.assertNever(i);
|
|
2975
2975
|
return { status: n.value, value: e.data };
|
|
@@ -2977,7 +2977,7 @@ class yt extends ce {
|
|
|
2977
2977
|
_regex(e, t, n) {
|
|
2978
2978
|
return this.refinement((s) => e.test(s), {
|
|
2979
2979
|
validation: t,
|
|
2980
|
-
code:
|
|
2980
|
+
code: N.invalid_string,
|
|
2981
2981
|
...B.errToObj(n)
|
|
2982
2982
|
});
|
|
2983
2983
|
}
|
|
@@ -3214,7 +3214,7 @@ class ar extends ce {
|
|
|
3214
3214
|
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== V.number) {
|
|
3215
3215
|
const i = this._getOrReturnCtx(e);
|
|
3216
3216
|
return $(i, {
|
|
3217
|
-
code:
|
|
3217
|
+
code: N.invalid_type,
|
|
3218
3218
|
expected: V.number,
|
|
3219
3219
|
received: i.parsedType
|
|
3220
3220
|
}), te;
|
|
@@ -3223,30 +3223,30 @@ class ar extends ce {
|
|
|
3223
3223
|
const s = new Pe();
|
|
3224
3224
|
for (const i of this._def.checks)
|
|
3225
3225
|
i.kind === "int" ? ue.isInteger(e.data) || (n = this._getOrReturnCtx(e, n), $(n, {
|
|
3226
|
-
code:
|
|
3226
|
+
code: N.invalid_type,
|
|
3227
3227
|
expected: "integer",
|
|
3228
3228
|
received: "float",
|
|
3229
3229
|
message: i.message
|
|
3230
3230
|
}), s.dirty()) : i.kind === "min" ? (i.inclusive ? e.data < i.value : e.data <= i.value) && (n = this._getOrReturnCtx(e, n), $(n, {
|
|
3231
|
-
code:
|
|
3231
|
+
code: N.too_small,
|
|
3232
3232
|
minimum: i.value,
|
|
3233
3233
|
type: "number",
|
|
3234
3234
|
inclusive: i.inclusive,
|
|
3235
3235
|
exact: !1,
|
|
3236
3236
|
message: i.message
|
|
3237
3237
|
}), s.dirty()) : i.kind === "max" ? (i.inclusive ? e.data > i.value : e.data >= i.value) && (n = this._getOrReturnCtx(e, n), $(n, {
|
|
3238
|
-
code:
|
|
3238
|
+
code: N.too_big,
|
|
3239
3239
|
maximum: i.value,
|
|
3240
3240
|
type: "number",
|
|
3241
3241
|
inclusive: i.inclusive,
|
|
3242
3242
|
exact: !1,
|
|
3243
3243
|
message: i.message
|
|
3244
3244
|
}), s.dirty()) : i.kind === "multipleOf" ? Lg(e.data, i.value) !== 0 && (n = this._getOrReturnCtx(e, n), $(n, {
|
|
3245
|
-
code:
|
|
3245
|
+
code: N.not_multiple_of,
|
|
3246
3246
|
multipleOf: i.value,
|
|
3247
3247
|
message: i.message
|
|
3248
3248
|
}), s.dirty()) : i.kind === "finite" ? Number.isFinite(e.data) || (n = this._getOrReturnCtx(e, n), $(n, {
|
|
3249
|
-
code:
|
|
3249
|
+
code: N.not_finite,
|
|
3250
3250
|
message: i.message
|
|
3251
3251
|
}), s.dirty()) : ue.assertNever(i);
|
|
3252
3252
|
return { status: s.value, value: e.data };
|
|
@@ -3395,19 +3395,19 @@ class $r extends ce {
|
|
|
3395
3395
|
const s = new Pe();
|
|
3396
3396
|
for (const i of this._def.checks)
|
|
3397
3397
|
i.kind === "min" ? (i.inclusive ? e.data < i.value : e.data <= i.value) && (n = this._getOrReturnCtx(e, n), $(n, {
|
|
3398
|
-
code:
|
|
3398
|
+
code: N.too_small,
|
|
3399
3399
|
type: "bigint",
|
|
3400
3400
|
minimum: i.value,
|
|
3401
3401
|
inclusive: i.inclusive,
|
|
3402
3402
|
message: i.message
|
|
3403
3403
|
}), s.dirty()) : i.kind === "max" ? (i.inclusive ? e.data > i.value : e.data >= i.value) && (n = this._getOrReturnCtx(e, n), $(n, {
|
|
3404
|
-
code:
|
|
3404
|
+
code: N.too_big,
|
|
3405
3405
|
type: "bigint",
|
|
3406
3406
|
maximum: i.value,
|
|
3407
3407
|
inclusive: i.inclusive,
|
|
3408
3408
|
message: i.message
|
|
3409
3409
|
}), s.dirty()) : i.kind === "multipleOf" ? e.data % i.value !== BigInt(0) && (n = this._getOrReturnCtx(e, n), $(n, {
|
|
3410
|
-
code:
|
|
3410
|
+
code: N.not_multiple_of,
|
|
3411
3411
|
multipleOf: i.value,
|
|
3412
3412
|
message: i.message
|
|
3413
3413
|
}), s.dirty()) : ue.assertNever(i);
|
|
@@ -3416,7 +3416,7 @@ class $r extends ce {
|
|
|
3416
3416
|
_getInvalidInput(e) {
|
|
3417
3417
|
const t = this._getOrReturnCtx(e);
|
|
3418
3418
|
return $(t, {
|
|
3419
|
-
code:
|
|
3419
|
+
code: N.invalid_type,
|
|
3420
3420
|
expected: V.bigint,
|
|
3421
3421
|
received: t.parsedType
|
|
3422
3422
|
}), te;
|
|
@@ -3516,7 +3516,7 @@ class no extends ce {
|
|
|
3516
3516
|
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== V.boolean) {
|
|
3517
3517
|
const n = this._getOrReturnCtx(e);
|
|
3518
3518
|
return $(n, {
|
|
3519
|
-
code:
|
|
3519
|
+
code: N.invalid_type,
|
|
3520
3520
|
expected: V.boolean,
|
|
3521
3521
|
received: n.parsedType
|
|
3522
3522
|
}), te;
|
|
@@ -3534,7 +3534,7 @@ class mn extends ce {
|
|
|
3534
3534
|
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== V.date) {
|
|
3535
3535
|
const i = this._getOrReturnCtx(e);
|
|
3536
3536
|
return $(i, {
|
|
3537
|
-
code:
|
|
3537
|
+
code: N.invalid_type,
|
|
3538
3538
|
expected: V.date,
|
|
3539
3539
|
received: i.parsedType
|
|
3540
3540
|
}), te;
|
|
@@ -3542,21 +3542,21 @@ class mn extends ce {
|
|
|
3542
3542
|
if (Number.isNaN(e.data.getTime())) {
|
|
3543
3543
|
const i = this._getOrReturnCtx(e);
|
|
3544
3544
|
return $(i, {
|
|
3545
|
-
code:
|
|
3545
|
+
code: N.invalid_date
|
|
3546
3546
|
}), te;
|
|
3547
3547
|
}
|
|
3548
3548
|
const n = new Pe();
|
|
3549
3549
|
let s;
|
|
3550
3550
|
for (const i of this._def.checks)
|
|
3551
3551
|
i.kind === "min" ? e.data.getTime() < i.value && (s = this._getOrReturnCtx(e, s), $(s, {
|
|
3552
|
-
code:
|
|
3552
|
+
code: N.too_small,
|
|
3553
3553
|
message: i.message,
|
|
3554
3554
|
inclusive: !0,
|
|
3555
3555
|
exact: !1,
|
|
3556
3556
|
minimum: i.value,
|
|
3557
3557
|
type: "date"
|
|
3558
3558
|
}), n.dirty()) : i.kind === "max" ? e.data.getTime() > i.value && (s = this._getOrReturnCtx(e, s), $(s, {
|
|
3559
|
-
code:
|
|
3559
|
+
code: N.too_big,
|
|
3560
3560
|
message: i.message,
|
|
3561
3561
|
inclusive: !0,
|
|
3562
3562
|
exact: !1,
|
|
@@ -3612,7 +3612,7 @@ class uf extends ce {
|
|
|
3612
3612
|
if (this._getType(e) !== V.symbol) {
|
|
3613
3613
|
const n = this._getOrReturnCtx(e);
|
|
3614
3614
|
return $(n, {
|
|
3615
|
-
code:
|
|
3615
|
+
code: N.invalid_type,
|
|
3616
3616
|
expected: V.symbol,
|
|
3617
3617
|
received: n.parsedType
|
|
3618
3618
|
}), te;
|
|
@@ -3629,7 +3629,7 @@ class ff extends ce {
|
|
|
3629
3629
|
if (this._getType(e) !== V.undefined) {
|
|
3630
3630
|
const n = this._getOrReturnCtx(e);
|
|
3631
3631
|
return $(n, {
|
|
3632
|
-
code:
|
|
3632
|
+
code: N.invalid_type,
|
|
3633
3633
|
expected: V.undefined,
|
|
3634
3634
|
received: n.parsedType
|
|
3635
3635
|
}), te;
|
|
@@ -3646,7 +3646,7 @@ class df extends ce {
|
|
|
3646
3646
|
if (this._getType(e) !== V.null) {
|
|
3647
3647
|
const n = this._getOrReturnCtx(e);
|
|
3648
3648
|
return $(n, {
|
|
3649
|
-
code:
|
|
3649
|
+
code: N.invalid_type,
|
|
3650
3650
|
expected: V.null,
|
|
3651
3651
|
received: n.parsedType
|
|
3652
3652
|
}), te;
|
|
@@ -3686,7 +3686,7 @@ class Nt extends ce {
|
|
|
3686
3686
|
_parse(e) {
|
|
3687
3687
|
const t = this._getOrReturnCtx(e);
|
|
3688
3688
|
return $(t, {
|
|
3689
|
-
code:
|
|
3689
|
+
code: N.invalid_type,
|
|
3690
3690
|
expected: V.never,
|
|
3691
3691
|
received: t.parsedType
|
|
3692
3692
|
}), te;
|
|
@@ -3701,7 +3701,7 @@ class mf extends ce {
|
|
|
3701
3701
|
if (this._getType(e) !== V.undefined) {
|
|
3702
3702
|
const n = this._getOrReturnCtx(e);
|
|
3703
3703
|
return $(n, {
|
|
3704
|
-
code:
|
|
3704
|
+
code: N.invalid_type,
|
|
3705
3705
|
expected: V.void,
|
|
3706
3706
|
received: n.parsedType
|
|
3707
3707
|
}), te;
|
|
@@ -3718,14 +3718,14 @@ class at extends ce {
|
|
|
3718
3718
|
const { ctx: t, status: n } = this._processInputParams(e), s = this._def;
|
|
3719
3719
|
if (t.parsedType !== V.array)
|
|
3720
3720
|
return $(t, {
|
|
3721
|
-
code:
|
|
3721
|
+
code: N.invalid_type,
|
|
3722
3722
|
expected: V.array,
|
|
3723
3723
|
received: t.parsedType
|
|
3724
3724
|
}), te;
|
|
3725
3725
|
if (s.exactLength !== null) {
|
|
3726
3726
|
const a = t.data.length > s.exactLength.value, o = t.data.length < s.exactLength.value;
|
|
3727
3727
|
(a || o) && ($(t, {
|
|
3728
|
-
code: a ?
|
|
3728
|
+
code: a ? N.too_big : N.too_small,
|
|
3729
3729
|
minimum: o ? s.exactLength.value : void 0,
|
|
3730
3730
|
maximum: a ? s.exactLength.value : void 0,
|
|
3731
3731
|
type: "array",
|
|
@@ -3735,14 +3735,14 @@ class at extends ce {
|
|
|
3735
3735
|
}), n.dirty());
|
|
3736
3736
|
}
|
|
3737
3737
|
if (s.minLength !== null && t.data.length < s.minLength.value && ($(t, {
|
|
3738
|
-
code:
|
|
3738
|
+
code: N.too_small,
|
|
3739
3739
|
minimum: s.minLength.value,
|
|
3740
3740
|
type: "array",
|
|
3741
3741
|
inclusive: !0,
|
|
3742
3742
|
exact: !1,
|
|
3743
3743
|
message: s.minLength.message
|
|
3744
3744
|
}), n.dirty()), s.maxLength !== null && t.data.length > s.maxLength.value && ($(t, {
|
|
3745
|
-
code:
|
|
3745
|
+
code: N.too_big,
|
|
3746
3746
|
maximum: s.maxLength.value,
|
|
3747
3747
|
type: "array",
|
|
3748
3748
|
inclusive: !0,
|
|
@@ -3816,7 +3816,7 @@ class Re extends ce {
|
|
|
3816
3816
|
if (this._getType(e) !== V.object) {
|
|
3817
3817
|
const l = this._getOrReturnCtx(e);
|
|
3818
3818
|
return $(l, {
|
|
3819
|
-
code:
|
|
3819
|
+
code: N.invalid_type,
|
|
3820
3820
|
expected: V.object,
|
|
3821
3821
|
received: l.parsedType
|
|
3822
3822
|
}), te;
|
|
@@ -3844,7 +3844,7 @@ class Re extends ce {
|
|
|
3844
3844
|
});
|
|
3845
3845
|
else if (l === "strict")
|
|
3846
3846
|
o.length > 0 && ($(s, {
|
|
3847
|
-
code:
|
|
3847
|
+
code: N.unrecognized_keys,
|
|
3848
3848
|
keys: o
|
|
3849
3849
|
}), n.dirty());
|
|
3850
3850
|
else if (l !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
@@ -4101,7 +4101,7 @@ class pn extends ce {
|
|
|
4101
4101
|
return t.common.issues.push(...o.ctx.common.issues), o.result;
|
|
4102
4102
|
const a = i.map((o) => new gt(o.ctx.common.issues));
|
|
4103
4103
|
return $(t, {
|
|
4104
|
-
code:
|
|
4104
|
+
code: N.invalid_union,
|
|
4105
4105
|
unionErrors: a
|
|
4106
4106
|
}), te;
|
|
4107
4107
|
}
|
|
@@ -4148,7 +4148,7 @@ class pn extends ce {
|
|
|
4148
4148
|
return t.common.issues.push(...i.ctx.common.issues), i.result;
|
|
4149
4149
|
const o = a.map((c) => new gt(c));
|
|
4150
4150
|
return $(t, {
|
|
4151
|
-
code:
|
|
4151
|
+
code: N.invalid_union,
|
|
4152
4152
|
unionErrors: o
|
|
4153
4153
|
}), te;
|
|
4154
4154
|
}
|
|
@@ -4195,7 +4195,7 @@ class yn extends ce {
|
|
|
4195
4195
|
return te;
|
|
4196
4196
|
const o = io(i.value, a.value);
|
|
4197
4197
|
return o.valid ? ((cf(i) || cf(a)) && t.dirty(), { status: t.value, value: o.data }) : ($(n, {
|
|
4198
|
-
code:
|
|
4198
|
+
code: N.invalid_intersection_types
|
|
4199
4199
|
}), te);
|
|
4200
4200
|
};
|
|
4201
4201
|
return n.common.async ? Promise.all([
|
|
@@ -4231,20 +4231,20 @@ class Wt extends ce {
|
|
|
4231
4231
|
const { status: t, ctx: n } = this._processInputParams(e);
|
|
4232
4232
|
if (n.parsedType !== V.array)
|
|
4233
4233
|
return $(n, {
|
|
4234
|
-
code:
|
|
4234
|
+
code: N.invalid_type,
|
|
4235
4235
|
expected: V.array,
|
|
4236
4236
|
received: n.parsedType
|
|
4237
4237
|
}), te;
|
|
4238
4238
|
if (n.data.length < this._def.items.length)
|
|
4239
4239
|
return $(n, {
|
|
4240
|
-
code:
|
|
4240
|
+
code: N.too_small,
|
|
4241
4241
|
minimum: this._def.items.length,
|
|
4242
4242
|
inclusive: !0,
|
|
4243
4243
|
exact: !1,
|
|
4244
4244
|
type: "array"
|
|
4245
4245
|
}), te;
|
|
4246
4246
|
!this._def.rest && n.data.length > this._def.items.length && ($(n, {
|
|
4247
|
-
code:
|
|
4247
|
+
code: N.too_big,
|
|
4248
4248
|
maximum: this._def.items.length,
|
|
4249
4249
|
inclusive: !0,
|
|
4250
4250
|
exact: !1,
|
|
@@ -4287,7 +4287,7 @@ class gn extends ce {
|
|
|
4287
4287
|
const { status: t, ctx: n } = this._processInputParams(e);
|
|
4288
4288
|
if (n.parsedType !== V.object)
|
|
4289
4289
|
return $(n, {
|
|
4290
|
-
code:
|
|
4290
|
+
code: N.invalid_type,
|
|
4291
4291
|
expected: V.object,
|
|
4292
4292
|
received: n.parsedType
|
|
4293
4293
|
}), te;
|
|
@@ -4328,7 +4328,7 @@ class pf extends ce {
|
|
|
4328
4328
|
const { status: t, ctx: n } = this._processInputParams(e);
|
|
4329
4329
|
if (n.parsedType !== V.map)
|
|
4330
4330
|
return $(n, {
|
|
4331
|
-
code:
|
|
4331
|
+
code: N.invalid_type,
|
|
4332
4332
|
expected: V.map,
|
|
4333
4333
|
received: n.parsedType
|
|
4334
4334
|
}), te;
|
|
@@ -4370,20 +4370,20 @@ class jr extends ce {
|
|
|
4370
4370
|
const { status: t, ctx: n } = this._processInputParams(e);
|
|
4371
4371
|
if (n.parsedType !== V.set)
|
|
4372
4372
|
return $(n, {
|
|
4373
|
-
code:
|
|
4373
|
+
code: N.invalid_type,
|
|
4374
4374
|
expected: V.set,
|
|
4375
4375
|
received: n.parsedType
|
|
4376
4376
|
}), te;
|
|
4377
4377
|
const s = this._def;
|
|
4378
4378
|
s.minSize !== null && n.data.size < s.minSize.value && ($(n, {
|
|
4379
|
-
code:
|
|
4379
|
+
code: N.too_small,
|
|
4380
4380
|
minimum: s.minSize.value,
|
|
4381
4381
|
type: "set",
|
|
4382
4382
|
inclusive: !0,
|
|
4383
4383
|
exact: !1,
|
|
4384
4384
|
message: s.minSize.message
|
|
4385
4385
|
}), t.dirty()), s.maxSize !== null && n.data.size > s.maxSize.value && ($(n, {
|
|
4386
|
-
code:
|
|
4386
|
+
code: N.too_big,
|
|
4387
4387
|
maximum: s.maxSize.value,
|
|
4388
4388
|
type: "set",
|
|
4389
4389
|
inclusive: !0,
|
|
@@ -4449,7 +4449,7 @@ class ao extends ce {
|
|
|
4449
4449
|
const t = this._getOrReturnCtx(e);
|
|
4450
4450
|
return $(t, {
|
|
4451
4451
|
received: t.data,
|
|
4452
|
-
code:
|
|
4452
|
+
code: N.invalid_literal,
|
|
4453
4453
|
expected: this._def.value
|
|
4454
4454
|
}), te;
|
|
4455
4455
|
}
|
|
@@ -4478,14 +4478,14 @@ class or extends ce {
|
|
|
4478
4478
|
return $(t, {
|
|
4479
4479
|
expected: ue.joinValues(n),
|
|
4480
4480
|
received: t.parsedType,
|
|
4481
|
-
code:
|
|
4481
|
+
code: N.invalid_type
|
|
4482
4482
|
}), te;
|
|
4483
4483
|
}
|
|
4484
4484
|
if (this._cache || (this._cache = new Set(this._def.values)), !this._cache.has(e.data)) {
|
|
4485
4485
|
const t = this._getOrReturnCtx(e), n = this._def.values;
|
|
4486
4486
|
return $(t, {
|
|
4487
4487
|
received: t.data,
|
|
4488
|
-
code:
|
|
4488
|
+
code: N.invalid_enum_value,
|
|
4489
4489
|
options: n
|
|
4490
4490
|
}), te;
|
|
4491
4491
|
}
|
|
@@ -4534,14 +4534,14 @@ class gf extends ce {
|
|
|
4534
4534
|
return $(n, {
|
|
4535
4535
|
expected: ue.joinValues(s),
|
|
4536
4536
|
received: n.parsedType,
|
|
4537
|
-
code:
|
|
4537
|
+
code: N.invalid_type
|
|
4538
4538
|
}), te;
|
|
4539
4539
|
}
|
|
4540
4540
|
if (this._cache || (this._cache = new Set(ue.getValidEnumValues(this._def.values))), !this._cache.has(e.data)) {
|
|
4541
4541
|
const s = ue.objectValues(t);
|
|
4542
4542
|
return $(n, {
|
|
4543
4543
|
received: n.data,
|
|
4544
|
-
code:
|
|
4544
|
+
code: N.invalid_enum_value,
|
|
4545
4545
|
options: s
|
|
4546
4546
|
}), te;
|
|
4547
4547
|
}
|
|
@@ -4564,7 +4564,7 @@ class _n extends ce {
|
|
|
4564
4564
|
const { ctx: t } = this._processInputParams(e);
|
|
4565
4565
|
if (t.parsedType !== V.promise && t.common.async === !1)
|
|
4566
4566
|
return $(t, {
|
|
4567
|
-
code:
|
|
4567
|
+
code: N.invalid_type,
|
|
4568
4568
|
expected: V.promise,
|
|
4569
4569
|
received: t.parsedType
|
|
4570
4570
|
}), te;
|
|
@@ -4766,7 +4766,7 @@ class _f extends ce {
|
|
|
4766
4766
|
if (this._getType(e) !== V.nan) {
|
|
4767
4767
|
const n = this._getOrReturnCtx(e);
|
|
4768
4768
|
return $(n, {
|
|
4769
|
-
code:
|
|
4769
|
+
code: N.invalid_type,
|
|
4770
4770
|
expected: V.nan,
|
|
4771
4771
|
received: n.parsedType
|
|
4772
4772
|
}), te;
|
|
@@ -6721,8 +6721,8 @@ class Fe {
|
|
|
6721
6721
|
const h = s(d);
|
|
6722
6722
|
if (h) {
|
|
6723
6723
|
const m = f.isNegativeDuration && h !== f.largestUnit ? n : 1;
|
|
6724
|
-
let
|
|
6725
|
-
return this.opts.signMode === "negativeLargestOnly" && h !== f.largestUnit ?
|
|
6724
|
+
let E;
|
|
6725
|
+
return this.opts.signMode === "negativeLargestOnly" && h !== f.largestUnit ? E = "never" : this.opts.signMode === "all" ? E = "always" : E = "auto", this.num(u.get(h) * m, d.length, E);
|
|
6726
6726
|
} else
|
|
6727
6727
|
return d;
|
|
6728
6728
|
}, a = Fe.parseFormat(t), o = a.reduce(
|
|
@@ -8347,10 +8347,10 @@ 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 = (
|
|
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: ([_]) => _, literal: !0 }), E = ((g) => {
|
|
8351
8351
|
if (r.literal)
|
|
8352
|
-
return h(
|
|
8353
|
-
switch (
|
|
8352
|
+
return h(g);
|
|
8353
|
+
switch (g.val) {
|
|
8354
8354
|
// era
|
|
8355
8355
|
case "G":
|
|
8356
8356
|
return tt(e.eras("short"), 0);
|
|
@@ -8465,12 +8465,12 @@ function Cv(r, e) {
|
|
|
8465
8465
|
case " ":
|
|
8466
8466
|
return nn(/[^\S\n\r]/);
|
|
8467
8467
|
default:
|
|
8468
|
-
return h(
|
|
8468
|
+
return h(g);
|
|
8469
8469
|
}
|
|
8470
8470
|
})(r) || {
|
|
8471
8471
|
invalidReason: Sv
|
|
8472
8472
|
};
|
|
8473
|
-
return
|
|
8473
|
+
return E.token = r, E;
|
|
8474
8474
|
}
|
|
8475
8475
|
const kv = {
|
|
8476
8476
|
year: {
|
|
@@ -9076,21 +9076,21 @@ class Z {
|
|
|
9076
9076
|
);
|
|
9077
9077
|
if (d && u)
|
|
9078
9078
|
throw new er("Can't mix ordinal dates with month/day");
|
|
9079
|
-
const
|
|
9080
|
-
let
|
|
9081
|
-
|
|
9082
|
-
let
|
|
9083
|
-
for (const p of
|
|
9079
|
+
const E = m || i.weekday && !h;
|
|
9080
|
+
let g, _, T = sn(c, l);
|
|
9081
|
+
E ? (g = $v, _ = qv, T = On(T, a, o)) : u ? (g = jv, _ = Lv, T = Sa(T)) : (g = ln, _ = am);
|
|
9082
|
+
let S = !1;
|
|
9083
|
+
for (const p of g) {
|
|
9084
9084
|
const k = i[p];
|
|
9085
|
-
X(k) ?
|
|
9085
|
+
X(k) ? S ? i[p] = _[p] : i[p] = T[p] : S = !0;
|
|
9086
9086
|
}
|
|
9087
|
-
const
|
|
9088
|
-
if (
|
|
9089
|
-
return Z.invalid(
|
|
9090
|
-
const
|
|
9091
|
-
ts:
|
|
9087
|
+
const P = E ? y_(i, a, o) : u ? g_(i) : Nh(i), y = P || Fh(i);
|
|
9088
|
+
if (y)
|
|
9089
|
+
return Z.invalid(y);
|
|
9090
|
+
const A = E ? If(i, a, o) : u ? xf(i) : i, [R, v] = cn(A, l, n), C = new Z({
|
|
9091
|
+
ts: R,
|
|
9092
9092
|
zone: n,
|
|
9093
|
-
o:
|
|
9093
|
+
o: v,
|
|
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,
|
|
10490
|
-
const { fields:
|
|
10491
|
-
|
|
10492
|
-
r !== "delete" && (typeof s[
|
|
10489
|
+
}, ac = (r, e, t, n, s, i, a, o, c, l, u, f, d, h, m, E, g, _, T, S, P) => {
|
|
10490
|
+
const { fields: y } = a;
|
|
10491
|
+
y.filter((v) => "unique" in v && v.unique).forEach((v) => {
|
|
10492
|
+
r !== "delete" && (typeof s[v.name] == "string" || typeof s[v.name] == "number") && e.set(h(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 C = fg(
|
|
10499
|
-
s[
|
|
10496
|
+
}), y.forEach((v) => {
|
|
10497
|
+
if (cg(v, a, i)) {
|
|
10498
|
+
const C = fg(v, a, i), p = {};
|
|
10499
|
+
s[v.name] !== void 0 && (p[v.name] = s[v.name], ge(v) && (p[`${v.name}_Array`] = s[`${v.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(v), p)), r === "update" && e.update(d(v), p), r === "delete" && e.delete(d(v)));
|
|
10502
10502
|
}
|
|
10503
10503
|
});
|
|
10504
|
-
const
|
|
10505
|
-
for (const
|
|
10506
|
-
const C = dg(
|
|
10504
|
+
const A = c[a.labels.collection];
|
|
10505
|
+
for (const v of A) {
|
|
10506
|
+
const C = dg(v, 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(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
|
|
10513
|
+
const R = y.filter((v) => ge(v) && v.twoWay);
|
|
10514
10514
|
if (!o?.noTwoWay) {
|
|
10515
|
-
for (const
|
|
10515
|
+
for (const v of R)
|
|
10516
10516
|
throw new Error("VALIDATION_ERROR: batchSize is required");
|
|
10517
|
-
for (const
|
|
10517
|
+
for (const v of R)
|
|
10518
10518
|
throw new Error("VALIDATION_ERROR: batchSize is required");
|
|
10519
|
-
for (const
|
|
10519
|
+
for (const v of R)
|
|
10520
10520
|
throw new Error("VALIDATION_ERROR: batchSize is required");
|
|
10521
10521
|
}
|
|
10522
10522
|
};
|
|
@@ -10639,41 +10639,41 @@ var Ua, cd;
|
|
|
10639
10639
|
function Qv() {
|
|
10640
10640
|
if (cd) return Ua;
|
|
10641
10641
|
cd = 1;
|
|
10642
|
-
var r = zo(), e = Kv(), t = Yv(), n = Jv(), s = Bd(), i = "[object Boolean]", a = "[object Date]", o = "[object Map]", c = "[object Number]", l = "[object RegExp]", u = "[object Set]", f = "[object String]", d = "[object Symbol]", h = "[object ArrayBuffer]", m = "[object DataView]",
|
|
10643
|
-
function
|
|
10644
|
-
var
|
|
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]", _ = "[object Int8Array]", T = "[object Int16Array]", S = "[object Int32Array]", P = "[object Uint8Array]", y = "[object Uint8ClampedArray]", A = "[object Uint16Array]", R = "[object Uint32Array]";
|
|
10643
|
+
function v(C, p, k) {
|
|
10644
|
+
var I = C.constructor;
|
|
10645
10645
|
switch (p) {
|
|
10646
10646
|
case h:
|
|
10647
10647
|
return r(C);
|
|
10648
10648
|
case i:
|
|
10649
10649
|
case a:
|
|
10650
|
-
return new
|
|
10650
|
+
return new I(+C);
|
|
10651
10651
|
case m:
|
|
10652
10652
|
return e(C, k);
|
|
10653
|
-
case
|
|
10654
|
-
case y:
|
|
10653
|
+
case E:
|
|
10655
10654
|
case g:
|
|
10655
|
+
case _:
|
|
10656
10656
|
case T:
|
|
10657
|
-
case R:
|
|
10658
10657
|
case S:
|
|
10659
|
-
case
|
|
10660
|
-
case
|
|
10658
|
+
case P:
|
|
10659
|
+
case y:
|
|
10661
10660
|
case A:
|
|
10661
|
+
case R:
|
|
10662
10662
|
return s(C, k);
|
|
10663
10663
|
case o:
|
|
10664
|
-
return new
|
|
10664
|
+
return new I();
|
|
10665
10665
|
case c:
|
|
10666
10666
|
case f:
|
|
10667
|
-
return new
|
|
10667
|
+
return new I(C);
|
|
10668
10668
|
case l:
|
|
10669
10669
|
return t(C);
|
|
10670
10670
|
case u:
|
|
10671
|
-
return new
|
|
10671
|
+
return new I();
|
|
10672
10672
|
case d:
|
|
10673
10673
|
return n(C);
|
|
10674
10674
|
}
|
|
10675
10675
|
}
|
|
10676
|
-
return Ua =
|
|
10676
|
+
return Ua = v, Ua;
|
|
10677
10677
|
}
|
|
10678
10678
|
var Va, ld;
|
|
10679
10679
|
function Xv() {
|
|
@@ -10713,23 +10713,23 @@ 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(),
|
|
10717
|
-
G[C] = G[p] = G[H] = G[Ie] = G[k] = G[
|
|
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(), _ = ew(), T = wt(), S = rw(), P = Vo(), y = Br(), A = 1, R = 2, v = 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
|
+
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 &
|
|
10719
|
+
var xe, vr = ye & A, Te = ye & R, wr = ye & v;
|
|
10720
10720
|
if (ne && (xe = ut ? ne(K, Xe, ut, We) : ne(K)), xe !== void 0)
|
|
10721
10721
|
return xe;
|
|
10722
10722
|
if (!T(K))
|
|
10723
10723
|
return K;
|
|
10724
|
-
var _c =
|
|
10724
|
+
var _c = E(K);
|
|
10725
10725
|
if (_c) {
|
|
10726
10726
|
if (xe = d(K), !vr)
|
|
10727
10727
|
return a(K, xe);
|
|
10728
10728
|
} else {
|
|
10729
|
-
var Ht = f(K), vc = Ht ==
|
|
10730
|
-
if (
|
|
10729
|
+
var Ht = f(K), vc = Ht == w || Ht == O;
|
|
10730
|
+
if (g(K))
|
|
10731
10731
|
return i(K, vr);
|
|
10732
|
-
if (Ht ==
|
|
10732
|
+
if (Ht == M || Ht == C || vc && !ut) {
|
|
10733
10733
|
if (xe = Te || vc ? {} : m(K), !vr)
|
|
10734
10734
|
return Te ? c(K, s(xe, K)) : o(K, n(xe, K));
|
|
10735
10735
|
} else {
|
|
@@ -10742,12 +10742,12 @@ 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), S(K) ? K.forEach(function(Ot) {
|
|
10746
10746
|
xe.add(Se(Ot, ye, ne, Ot, K, We));
|
|
10747
|
-
}) :
|
|
10747
|
+
}) : _(K) && K.forEach(function(Ot, Pt) {
|
|
10748
10748
|
xe.set(Pt, Se(Ot, ye, ne, Pt, K, We));
|
|
10749
10749
|
});
|
|
10750
|
-
var Im = wr ? Te ? u : l : Te ?
|
|
10750
|
+
var Im = wr ? Te ? u : l : Te ? y : P, bc = _c ? void 0 : Im(K);
|
|
10751
10751
|
return e(bc || K, function(Ot, Pt) {
|
|
10752
10752
|
bc && (Pt = Ot, Ot = K[Pt]), t(xe, Pt, Se(Ot, ye, ne, Pt, K, We));
|
|
10753
10753
|
}), xe;
|
|
@@ -10857,190 +10857,190 @@ 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),
|
|
10861
|
-
const
|
|
10860
|
+
const m = h && vt("Read", h), E = kn(c, i, a), g = Rd(c, a), _ = xo(c, a), T = Ad(c, i, a), S = (w = []) => {
|
|
10861
|
+
const O = [];
|
|
10862
10862
|
if (m)
|
|
10863
|
-
|
|
10864
|
-
else if (
|
|
10865
|
-
for (const
|
|
10866
|
-
|
|
10867
|
-
return
|
|
10868
|
-
},
|
|
10869
|
-
if (t ||
|
|
10870
|
-
return
|
|
10871
|
-
let
|
|
10872
|
-
const
|
|
10873
|
-
|
|
10863
|
+
O.push(he(qr(n, "tenants", s, "system_fields", l.collection, `${l.collection}-${e.key}`), pe("Collection_Path_String", "==", r.join("/")), ...w));
|
|
10864
|
+
else if (E)
|
|
10865
|
+
for (const x of E)
|
|
10866
|
+
O.push(he(qr(n, "tenants", s, "system_fields", l.collection, `${l.collection}-${x.field}`), pe("Collection_Path_String", "==", r.join("/")), ...w));
|
|
10867
|
+
return O;
|
|
10868
|
+
}, P = g.filter((w) => "operations" in w && w.operations ? w.operations.includes("Read") : !0);
|
|
10869
|
+
if (t || P.length === 0 && _.length === 0 && T.length === 0)
|
|
10870
|
+
return S();
|
|
10871
|
+
let y = 0;
|
|
10872
|
+
const A = (w) => {
|
|
10873
|
+
w && (y === 0 ? y = w : y *= w);
|
|
10874
10874
|
};
|
|
10875
|
-
if (
|
|
10876
|
-
for (const
|
|
10877
|
-
if (
|
|
10878
|
-
const
|
|
10879
|
-
if (!
|
|
10875
|
+
if (P) {
|
|
10876
|
+
for (const w of P)
|
|
10877
|
+
if (w.type === "Record_Property") {
|
|
10878
|
+
const O = w.roles.find((x) => x.role === a.Role);
|
|
10879
|
+
if (!O)
|
|
10880
10880
|
throw new Error("PERMISSION_DENIED");
|
|
10881
|
-
|
|
10881
|
+
A(O.values?.length);
|
|
10882
10882
|
}
|
|
10883
10883
|
}
|
|
10884
|
-
f?.roles.includes(a.Role) && f.range &&
|
|
10885
|
-
const
|
|
10886
|
-
|
|
10887
|
-
const
|
|
10888
|
-
|
|
10889
|
-
if ("collectionField" in
|
|
10890
|
-
const
|
|
10891
|
-
C.push(pe(`${
|
|
10892
|
-
}
|
|
10893
|
-
}),
|
|
10894
|
-
if ("propertyField" in
|
|
10895
|
-
const
|
|
10896
|
-
if (!
|
|
10884
|
+
f?.roles.includes(a.Role) && f.range && A(f.range.fields.length);
|
|
10885
|
+
const R = d.admin?.statusField;
|
|
10886
|
+
R && !f?.roles.includes(a.Role) && A(Math.max(R.active?.length || 0, R.archived?.length || 0));
|
|
10887
|
+
const v = y === 0 ? 30 : Math.max(1, Math.floor(30 / y)), C = [];
|
|
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
|
+
if ("collectionField" in w) {
|
|
10890
|
+
const O = re(u, w.collectionField);
|
|
10891
|
+
C.push(pe(`${O.name}_Array`, "array-contains", a.Doc_ID));
|
|
10892
|
+
}
|
|
10893
|
+
}), P.filter((w) => w.type === "Record_Property").forEach((w) => {
|
|
10894
|
+
if ("propertyField" in w) {
|
|
10895
|
+
const O = w.roles.find((F) => F.role === a.Role);
|
|
10896
|
+
if (!O)
|
|
10897
10897
|
throw new Error("PERMISSION_DENIED");
|
|
10898
|
-
const
|
|
10899
|
-
|
|
10898
|
+
const x = re(u, w.propertyField);
|
|
10899
|
+
x.type === "Array" ? C.push(pe(x.name, "array-contains-any", O.values)) : C.push(pe(x.name, "in", O.values));
|
|
10900
10900
|
}
|
|
10901
10901
|
});
|
|
10902
10902
|
const p = [];
|
|
10903
|
-
|
|
10904
|
-
const
|
|
10905
|
-
if (
|
|
10906
|
-
const
|
|
10907
|
-
for (let
|
|
10908
|
-
const
|
|
10909
|
-
|
|
10903
|
+
_.filter((w) => w.type === "Individual").forEach((w) => {
|
|
10904
|
+
const O = h?.individualEntities, x = [];
|
|
10905
|
+
if (O) {
|
|
10906
|
+
const F = w.singleQuery ? w.singleQuery : v;
|
|
10907
|
+
for (let M = 0; M < O.length; M += F) {
|
|
10908
|
+
const D = O.slice(M, M + F);
|
|
10909
|
+
x.push(D);
|
|
10910
10910
|
}
|
|
10911
|
-
if (!
|
|
10912
|
-
|
|
10913
|
-
p.push(...
|
|
10911
|
+
if (!w.singleQuery)
|
|
10912
|
+
x.forEach((M) => {
|
|
10913
|
+
p.push(...S(C.concat(pe("id", "in", M))));
|
|
10914
10914
|
});
|
|
10915
10915
|
else {
|
|
10916
|
-
if (
|
|
10917
|
-
throw new Error(`INPUT_ERROR: Individual entity restriction with singleQuery set to true must not have more than ${
|
|
10918
|
-
C.push(pe("id", "in",
|
|
10916
|
+
if (O.length > F)
|
|
10917
|
+
throw new Error(`INPUT_ERROR: Individual entity restriction with singleQuery set to true must not have more than ${w.singleQuery} entities`);
|
|
10918
|
+
C.push(pe("id", "in", O));
|
|
10919
10919
|
}
|
|
10920
10920
|
}
|
|
10921
|
-
}), T.filter((
|
|
10922
|
-
const { parentFilter:
|
|
10923
|
-
if ("collectionField" in
|
|
10924
|
-
const
|
|
10925
|
-
if ("collection" in
|
|
10926
|
-
const
|
|
10927
|
-
if (!
|
|
10921
|
+
}), T.filter((w) => w.parentFilter.type === "Individual").forEach((w) => {
|
|
10922
|
+
const { parentFilter: O, parentRestriction: x } = w;
|
|
10923
|
+
if ("collectionField" in O) {
|
|
10924
|
+
const F = re(u, O.collectionField);
|
|
10925
|
+
if ("collection" in F) {
|
|
10926
|
+
const M = a.collections?.[F.collection];
|
|
10927
|
+
if (!M)
|
|
10928
10928
|
throw new Error("PERMISSION_DENIED");
|
|
10929
|
-
const
|
|
10930
|
-
if (
|
|
10931
|
-
const J =
|
|
10932
|
-
for (let W = 0; W <
|
|
10933
|
-
const q =
|
|
10929
|
+
const D = M?.individualEntities, Y = [];
|
|
10930
|
+
if (D) {
|
|
10931
|
+
const J = x.singleQuery ? x.singleQuery : v;
|
|
10932
|
+
for (let W = 0; W < D.length; W += J) {
|
|
10933
|
+
const q = D.slice(W, W + J);
|
|
10934
10934
|
Y.push(q);
|
|
10935
10935
|
}
|
|
10936
|
-
if (!
|
|
10936
|
+
if (!x.singleQuery)
|
|
10937
10937
|
Y.forEach((W) => {
|
|
10938
|
-
p.push(...
|
|
10938
|
+
p.push(...S(C.concat(pe(`${F.name}_Array`, "array-contains-any", W))));
|
|
10939
10939
|
});
|
|
10940
10940
|
else {
|
|
10941
|
-
if (
|
|
10942
|
-
throw new Error(`INPUT_ERROR: Individual entity parentFilter with singleQuery set to true must not have more than ${
|
|
10943
|
-
C.push(pe(`${
|
|
10941
|
+
if (D.length > J)
|
|
10942
|
+
throw new Error(`INPUT_ERROR: Individual entity parentFilter with singleQuery set to true must not have more than ${x.singleQuery} entities`);
|
|
10943
|
+
C.push(pe(`${F.name}_Array`, "array-contains-any", D));
|
|
10944
10944
|
}
|
|
10945
10945
|
}
|
|
10946
10946
|
}
|
|
10947
10947
|
}
|
|
10948
10948
|
});
|
|
10949
10949
|
const k = [];
|
|
10950
|
-
|
|
10951
|
-
if ("collectionField" in
|
|
10952
|
-
const
|
|
10953
|
-
if ("collection" in
|
|
10954
|
-
const
|
|
10955
|
-
if (
|
|
10956
|
-
const
|
|
10957
|
-
for (let
|
|
10958
|
-
const Y =
|
|
10959
|
-
|
|
10950
|
+
_.filter((w) => w.type === "Parent").forEach((w) => {
|
|
10951
|
+
if ("collectionField" in w) {
|
|
10952
|
+
const O = re(u, w.collectionField);
|
|
10953
|
+
if ("collection" in O) {
|
|
10954
|
+
const x = h?.parentEntities, F = [];
|
|
10955
|
+
if (x) {
|
|
10956
|
+
const M = w.singleQuery ? w.singleQuery : v;
|
|
10957
|
+
for (let D = 0; D < x.length; D += M) {
|
|
10958
|
+
const Y = x.slice(D, D + M);
|
|
10959
|
+
F.push(Y);
|
|
10960
10960
|
}
|
|
10961
|
-
if (!
|
|
10962
|
-
|
|
10963
|
-
k.push(...
|
|
10961
|
+
if (!w.singleQuery)
|
|
10962
|
+
F.forEach((D) => {
|
|
10963
|
+
k.push(...S(C.concat(pe(`${O.name}_Array`, "array-contains-any", D))));
|
|
10964
10964
|
});
|
|
10965
10965
|
else {
|
|
10966
|
-
if (
|
|
10967
|
-
throw new Error(`INPUT_ERROR: Parent entity restriction with singleQuery set to true must not have more than ${
|
|
10968
|
-
C.push(pe(`${
|
|
10966
|
+
if (x && x.length > M)
|
|
10967
|
+
throw new Error(`INPUT_ERROR: Parent entity restriction with singleQuery set to true must not have more than ${w.singleQuery} entities`);
|
|
10968
|
+
C.push(pe(`${O.name}_Array`, "array-contains-any", x));
|
|
10969
10969
|
}
|
|
10970
10970
|
}
|
|
10971
10971
|
}
|
|
10972
10972
|
}
|
|
10973
|
-
}), T.filter((
|
|
10974
|
-
const { parentFilter:
|
|
10975
|
-
if ("collectionField" in
|
|
10976
|
-
const
|
|
10977
|
-
if ("collection" in
|
|
10978
|
-
const
|
|
10979
|
-
if (!
|
|
10973
|
+
}), T.filter((w) => w.parentFilter.type === "Parent").forEach((w) => {
|
|
10974
|
+
const { parentFilter: O, parentRestriction: x } = w;
|
|
10975
|
+
if ("collectionField" in O && "parentCollectionField" in O) {
|
|
10976
|
+
const F = re(u, O.collectionField), M = re(u, O.parentCollectionField);
|
|
10977
|
+
if ("collection" in F && "collection" in M) {
|
|
10978
|
+
const D = a.collections?.[F.collection];
|
|
10979
|
+
if (!D)
|
|
10980
10980
|
throw new Error("PERMISSION_DENIED");
|
|
10981
|
-
const Y =
|
|
10981
|
+
const Y = D.parentEntities, J = [];
|
|
10982
10982
|
if (Y) {
|
|
10983
|
-
const W =
|
|
10983
|
+
const W = x.singleQuery ? x.singleQuery : v;
|
|
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
|
-
if (!
|
|
10988
|
+
if (!x.singleQuery)
|
|
10989
10989
|
J.forEach((q) => {
|
|
10990
|
-
k.push(...
|
|
10990
|
+
k.push(...S(C.concat(pe(`${M.name}_Array`, "array-contains-any", q))));
|
|
10991
10991
|
});
|
|
10992
10992
|
else {
|
|
10993
10993
|
if (Y && Y.length > W)
|
|
10994
|
-
throw new Error(`INPUT_ERROR: Parent entity parentFilter with singleQuery set to true must not have more than ${
|
|
10995
|
-
C.push(pe(`${
|
|
10994
|
+
throw new Error(`INPUT_ERROR: Parent entity parentFilter with singleQuery set to true must not have more than ${x.singleQuery} entities`);
|
|
10995
|
+
C.push(pe(`${M.name}_Array`, "array-contains-any", Y));
|
|
10996
10996
|
}
|
|
10997
10997
|
}
|
|
10998
10998
|
}
|
|
10999
10999
|
}
|
|
11000
11000
|
});
|
|
11001
|
-
const
|
|
11002
|
-
k.length === 0 && (
|
|
11003
|
-
if ("collectionField" in
|
|
11004
|
-
const
|
|
11005
|
-
if ("collection" in
|
|
11006
|
-
const
|
|
11007
|
-
Object.entries(
|
|
11008
|
-
if (
|
|
11001
|
+
const I = [];
|
|
11002
|
+
k.length === 0 && (_.filter((w) => w.type === "Parent_Property").forEach((w) => {
|
|
11003
|
+
if ("collectionField" in w && "propertyField" in w) {
|
|
11004
|
+
const O = re(u, w.collectionField), x = re(u, w.propertyField);
|
|
11005
|
+
if ("collection" in O) {
|
|
11006
|
+
const F = h?.parentPropertyEntities || {};
|
|
11007
|
+
Object.entries(F).forEach(([M, D]) => {
|
|
11008
|
+
if (D.length > 0) {
|
|
11009
11009
|
const Y = [];
|
|
11010
|
-
for (let J = 0; J <
|
|
11011
|
-
const W =
|
|
11010
|
+
for (let J = 0; J < D.length; J += v) {
|
|
11011
|
+
const W = D.slice(J, J + v);
|
|
11012
11012
|
Y.push(W);
|
|
11013
11013
|
}
|
|
11014
11014
|
Y.forEach((J) => {
|
|
11015
|
-
|
|
11016
|
-
pe(`${
|
|
11017
|
-
pe(
|
|
11015
|
+
I.push(...S(C.concat([
|
|
11016
|
+
pe(`${O.name}_Array`, "array-contains-any", J),
|
|
11017
|
+
pe(x.name, "==", M)
|
|
11018
11018
|
])));
|
|
11019
11019
|
});
|
|
11020
11020
|
}
|
|
11021
11021
|
});
|
|
11022
11022
|
}
|
|
11023
11023
|
}
|
|
11024
|
-
}), T.filter((
|
|
11025
|
-
const { parentFilter:
|
|
11026
|
-
if ("collectionField" in
|
|
11027
|
-
const
|
|
11028
|
-
if ("collection" in
|
|
11029
|
-
const
|
|
11030
|
-
if (!
|
|
11024
|
+
}), T.filter((w) => w.parentFilter.type === "Parent_Property").forEach((w) => {
|
|
11025
|
+
const { parentFilter: O } = w;
|
|
11026
|
+
if ("collectionField" in O && "parentCollectionField" in O && "parentPropertyField" in O) {
|
|
11027
|
+
const x = re(u, O.collectionField), F = re(u, O.parentCollectionField), M = re(u, O.parentPropertyField);
|
|
11028
|
+
if ("collection" in x && "collection" in F) {
|
|
11029
|
+
const D = a.collections?.[x.collection];
|
|
11030
|
+
if (!D)
|
|
11031
11031
|
throw new Error("PERMISSION_DENIED");
|
|
11032
|
-
const Y =
|
|
11032
|
+
const Y = D.parentPropertyEntities || {};
|
|
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 += v) {
|
|
11037
|
+
const Ie = W.slice(H, H + v);
|
|
11038
11038
|
q.push(Ie);
|
|
11039
11039
|
}
|
|
11040
11040
|
q.forEach((H) => {
|
|
11041
|
-
|
|
11042
|
-
pe(`${
|
|
11043
|
-
pe(
|
|
11041
|
+
I.push(...S(C.concat([
|
|
11042
|
+
pe(`${F.name}_Array`, "array-contains-any", H),
|
|
11043
|
+
pe(M.name, "==", J)
|
|
11044
11044
|
])));
|
|
11045
11045
|
});
|
|
11046
11046
|
}
|
|
@@ -11048,8 +11048,8 @@ const Oe = /* @__PURE__ */ In(iw), xt = (r) => {
|
|
|
11048
11048
|
}
|
|
11049
11049
|
}
|
|
11050
11050
|
}));
|
|
11051
|
-
const
|
|
11052
|
-
return !
|
|
11051
|
+
const b = [...p, ...k, ...I];
|
|
11052
|
+
return !_.length && !T.length ? S(C) : b;
|
|
11053
11053
|
}, fm = {}, Ir = {}, Zw = async (r) => {
|
|
11054
11054
|
for (const s of Object.keys(Ir))
|
|
11055
11055
|
delete Ir[s];
|
|
@@ -11085,22 +11085,22 @@ 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:
|
|
11089
|
-
m = he(m, Rc(...
|
|
11088
|
+
const { start: E, end: g } = aw(t), _ = t.fields.filter((S) => !t.ranges?.some((P) => P.includes(S))).map((S) => Xr(pe(S, ">=", E), pe(S, "<=", g))), T = t.ranges?.map((S) => Xr(pe(S[0], "<=", g), pe(S[1], ">=", E)));
|
|
11089
|
+
m = he(m, Rc(..._, ...T || []));
|
|
11090
11090
|
}
|
|
11091
|
-
return n && (m = he(m, Xr(Rc(...n.map((
|
|
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();
|
|
11093
|
-
return new Promise((m,
|
|
11093
|
+
return new Promise((m, E) => {
|
|
11094
11094
|
if (d.length === 0) {
|
|
11095
11095
|
m({});
|
|
11096
11096
|
return;
|
|
11097
11097
|
}
|
|
11098
|
-
d.forEach((
|
|
11099
|
-
let
|
|
11100
|
-
const T = dr(
|
|
11101
|
-
(!
|
|
11102
|
-
}, (
|
|
11103
|
-
console.error(
|
|
11098
|
+
d.forEach((g) => {
|
|
11099
|
+
let _ = !1;
|
|
11100
|
+
const T = dr(g, { includeMetadataChanges: !0 }, (S) => {
|
|
11101
|
+
(!S.metadata.fromCache || _) && (_ || (_ = !0, h.set(g, !0), h.size === d.length && m({})));
|
|
11102
|
+
}, (S) => {
|
|
11103
|
+
console.error(S), E(S);
|
|
11104
11104
|
});
|
|
11105
11105
|
f[s.collection].push(T);
|
|
11106
11106
|
});
|
|
@@ -11123,11 +11123,11 @@ const Oe = /* @__PURE__ */ In(iw), xt = (r) => {
|
|
|
11123
11123
|
try {
|
|
11124
11124
|
if (await uw(a, e, t, n), c?.relationCollections && await _e(c.relationCollections)) {
|
|
11125
11125
|
const m = jt(a, s, i);
|
|
11126
|
-
for (const
|
|
11127
|
-
if (!s.collections[
|
|
11126
|
+
for (const E of m) {
|
|
11127
|
+
if (!s.collections[E].preloadCache?.roles.includes(i.Role))
|
|
11128
11128
|
continue;
|
|
11129
|
-
const
|
|
11130
|
-
|
|
11129
|
+
const _ = To()[E];
|
|
11130
|
+
_ === "Loading" || _ === "Loaded" || _ === "Error" || _ || await Mr(E);
|
|
11131
11131
|
}
|
|
11132
11132
|
}
|
|
11133
11133
|
l[o.collection] = "Loaded";
|
|
@@ -11157,10 +11157,10 @@ const fw = async (r, e) => {
|
|
|
11157
11157
|
else {
|
|
11158
11158
|
const m = $t.collections;
|
|
11159
11159
|
if (m)
|
|
11160
|
-
for (const [
|
|
11160
|
+
for (const [E, g] of Object.entries(m))
|
|
11161
11161
|
o && // eslint-disable-next-line security/detect-object-injection
|
|
11162
|
-
(!o.collections?.[
|
|
11163
|
-
!_y(
|
|
11162
|
+
(!o.collections?.[E] || // eslint-disable-next-line security/detect-object-injection
|
|
11163
|
+
!_y(g, o.collections[E])) && Mr(E);
|
|
11164
11164
|
}
|
|
11165
11165
|
}
|
|
11166
11166
|
o = $t;
|
|
@@ -11193,13 +11193,13 @@ const fw = async (r, e) => {
|
|
|
11193
11193
|
data: {}
|
|
11194
11194
|
};
|
|
11195
11195
|
if (h) {
|
|
11196
|
-
const T = /* @__PURE__ */ new Date(),
|
|
11197
|
-
m.TTL = Bt.fromDate(
|
|
11196
|
+
const T = /* @__PURE__ */ new Date(), S = new Date((/* @__PURE__ */ new Date()).setDate(T.getDate() + h));
|
|
11197
|
+
m.TTL = Bt.fromDate(S);
|
|
11198
11198
|
}
|
|
11199
|
-
const
|
|
11200
|
-
r !== "delete" && (m.data.data =
|
|
11201
|
-
const
|
|
11202
|
-
Gm(
|
|
11199
|
+
const E = Oe(t);
|
|
11200
|
+
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, _ = Ce(d, "tenants", l, n.join("/"), s, "system_write_log", `${a}-${g.valueOf()}`);
|
|
11202
|
+
Gm(_, m).catch((T) => {
|
|
11203
11203
|
console.error(`Error saving "${e}" ${r} log entry for record ${s} in ${u.collection} collection.`, { cause: T });
|
|
11204
11204
|
});
|
|
11205
11205
|
}, lc = async (r, e, t, n, s) => {
|
|
@@ -11306,8 +11306,8 @@ const fw = async (r, e) => {
|
|
|
11306
11306
|
continue;
|
|
11307
11307
|
const d = Object.keys(f);
|
|
11308
11308
|
for (const h of d) {
|
|
11309
|
-
const m = f[h],
|
|
11310
|
-
if (f[h] =
|
|
11309
|
+
const m = f[h], E = _r(m.Collection_Path, h, { only: s, noEmbeddingFields: i }).then((g) => {
|
|
11310
|
+
if (f[h] = g, c > 0)
|
|
11311
11311
|
return uc(
|
|
11312
11312
|
// eslint-disable-next-line security/detect-object-injection
|
|
11313
11313
|
f[h],
|
|
@@ -11317,13 +11317,13 @@ const fw = async (r, e) => {
|
|
|
11317
11317
|
s,
|
|
11318
11318
|
i
|
|
11319
11319
|
);
|
|
11320
|
-
}).catch((
|
|
11321
|
-
if (
|
|
11320
|
+
}).catch((g) => {
|
|
11321
|
+
if (g.message.includes("NOT_FOUND") || g.code === "permission-denied")
|
|
11322
11322
|
delete f[h];
|
|
11323
11323
|
else
|
|
11324
|
-
throw
|
|
11324
|
+
throw g;
|
|
11325
11325
|
});
|
|
11326
|
-
l.push(
|
|
11326
|
+
l.push(E);
|
|
11327
11327
|
}
|
|
11328
11328
|
}
|
|
11329
11329
|
await Promise.all(l);
|
|
@@ -11333,8 +11333,8 @@ const fw = async (r, e) => {
|
|
|
11333
11333
|
if (t?.relations?.depth && t.relations.depth > 10)
|
|
11334
11334
|
throw new Error("INPUT_ERROR: Relations depth cannot exceed 10");
|
|
11335
11335
|
if (t?.pagination?.number !== void 0) {
|
|
11336
|
-
const
|
|
11337
|
-
if (typeof
|
|
11336
|
+
const b = t.pagination.number;
|
|
11337
|
+
if (typeof b != "number" || !Number.isFinite(b) || !Number.isInteger(b) || b < 1)
|
|
11338
11338
|
throw new Error("INPUT_ERROR: Pagination number must be a positive finite integer");
|
|
11339
11339
|
}
|
|
11340
11340
|
const n = r.at(-1);
|
|
@@ -11343,98 +11343,98 @@ const fw = async (r, e) => {
|
|
|
11343
11343
|
const s = Ke(!0), a = Jr()[n], o = s.collections[n], { labels: c, access: l, preloadCache: u } = o, { serverReadOnly: f } = l, d = ke(), h = Object.keys(s.collections).includes(n), m = d.disabledCollections?.includes(n);
|
|
11344
11344
|
if (!h || m)
|
|
11345
11345
|
throw new Error("COLLECTION_NOT_FOUND");
|
|
11346
|
-
const
|
|
11346
|
+
const E = await lt(c.collection), g = await se(d, [
|
|
11347
11347
|
"global",
|
|
11348
11348
|
"firebase",
|
|
11349
11349
|
"serverTimestampOptions"
|
|
11350
|
-
]),
|
|
11351
|
-
if (!
|
|
11350
|
+
]), _ = De();
|
|
11351
|
+
if (!_?.Role)
|
|
11352
11352
|
throw new Error("PERMISSIONS_DENIED");
|
|
11353
|
-
if (f?.includes(
|
|
11353
|
+
if (f?.includes(_.Role))
|
|
11354
11354
|
return await hw(r, e, t);
|
|
11355
11355
|
const T = oc(r, a, t?.getAll);
|
|
11356
11356
|
if (T.length === 0)
|
|
11357
11357
|
return { cursor: {}, pages: 0, docs: [] };
|
|
11358
|
-
let
|
|
11359
|
-
const
|
|
11358
|
+
let S = T.map((b) => he(b, ...e || []));
|
|
11359
|
+
const P = t?.pagination?.startAfter || t?.pagination?.endBefore || {
|
|
11360
11360
|
first: /* @__PURE__ */ new Map(),
|
|
11361
11361
|
last: /* @__PURE__ */ new Map()
|
|
11362
11362
|
};
|
|
11363
11363
|
if (t?.pagination) {
|
|
11364
11364
|
if (t.pagination.startAfter && t.pagination.endBefore)
|
|
11365
11365
|
throw new Error("INPUT_ERROR: startAfter and endBefore cannot be provided together");
|
|
11366
|
-
const
|
|
11367
|
-
if (
|
|
11368
|
-
throw new Error("INPUT_ERROR: Pagination is not allowed when using " +
|
|
11369
|
-
t.pagination.orderByField && t.pagination.orderByDirection ? t.pagination.startAfter || t.pagination.endBefore ? t.pagination.startAfter ?
|
|
11370
|
-
}
|
|
11371
|
-
const
|
|
11372
|
-
await oe("preOperation", d,
|
|
11373
|
-
const
|
|
11374
|
-
let
|
|
11375
|
-
return t?.only === "cache" ?
|
|
11366
|
+
const b = t.pagination.startAfter || t.pagination.endBefore, w = Ud(_.Role, o, s);
|
|
11367
|
+
if (b && w !== !0)
|
|
11368
|
+
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 ? S = S.map((O, x) => he(O, rt(t.pagination.orderByField, t.pagination.orderByDirection), eo(P.last.get(x)), Xt(t.pagination.number))) : S = S.map((O, x) => he(O, rt(t.pagination.orderByField, t.pagination.orderByDirection), to(P.first.get(x)), Nr(t.pagination.number))) : S = S.map((O) => he(O, rt(t.pagination.orderByField, t.pagination.orderByDirection), Xt(t.pagination.number))) : !t.pagination.startAfter && !t.pagination.endBefore ? S = S.map((O) => he(O, Xt(t.pagination.number))) : t.pagination.startAfter ? S = S.map((O, x) => he(O, eo(P.last.get(x)), Xt(t.pagination.number))) : S = S.map((O, x) => he(O, to(P.first.get(x)), Nr(t.pagination.number)));
|
|
11370
|
+
}
|
|
11371
|
+
const y = { collection: c.collection };
|
|
11372
|
+
await oe("preOperation", d, E, ["read", void 0, void 0, y]), await oe("preRead", d, E, [y, S, !0, !1]);
|
|
11373
|
+
const v = /* @__PURE__ */ new Map(), C = S.map(async (b) => {
|
|
11374
|
+
let w;
|
|
11375
|
+
return t?.only === "cache" ? w = await Od(b) : t?.only === "server" ? w = await Hm(b) : w = await Km(b), w;
|
|
11376
11376
|
}), p = await Promise.all(C);
|
|
11377
|
-
for (const
|
|
11378
|
-
for (const
|
|
11379
|
-
|
|
11380
|
-
const
|
|
11381
|
-
|
|
11382
|
-
const
|
|
11383
|
-
delete
|
|
11377
|
+
for (const b of p) {
|
|
11378
|
+
for (const w of b.docs) {
|
|
11379
|
+
v.has(w.id) || v.set(w.id, {});
|
|
11380
|
+
const O = w.data({ serverTimestamps: g || "none" }), x = v.get(w.id);
|
|
11381
|
+
x.id ||= w.id;
|
|
11382
|
+
const F = { ...x, ...O };
|
|
11383
|
+
delete F.Collection_Path_String, v.set(w.id, F);
|
|
11384
11384
|
}
|
|
11385
|
-
|
|
11385
|
+
P.first.set(p.indexOf(b), b.docs[0]), P.last.set(p.indexOf(b), b.docs.at(-1) || b.docs[0]);
|
|
11386
11386
|
}
|
|
11387
11387
|
let k;
|
|
11388
|
-
if (t?.pagination && !u?.roles.includes(
|
|
11389
|
-
let
|
|
11390
|
-
t.pagination.orderByField && t.pagination.orderByDirection && (
|
|
11391
|
-
const
|
|
11388
|
+
if (t?.pagination && !u?.roles.includes(_?.Role) && !f?.includes(_?.Role)) {
|
|
11389
|
+
let b = he(T[0], ...e || []);
|
|
11390
|
+
t.pagination.orderByField && t.pagination.orderByDirection && (b = he(b, rt(t.pagination.orderByField, t.pagination.orderByDirection)));
|
|
11391
|
+
const w = await Ed(b).catch(() => {
|
|
11392
11392
|
});
|
|
11393
|
-
if (
|
|
11394
|
-
const
|
|
11395
|
-
k =
|
|
11393
|
+
if (w) {
|
|
11394
|
+
const O = w.data().count, x = t.pagination.number;
|
|
11395
|
+
k = x > 0 ? Math.floor(O / x) : 0;
|
|
11396
11396
|
}
|
|
11397
11397
|
}
|
|
11398
|
-
let
|
|
11399
|
-
t?.noComputedFields || (
|
|
11400
|
-
for (const
|
|
11401
|
-
const
|
|
11402
|
-
t?.subcollections &&
|
|
11398
|
+
let I;
|
|
11399
|
+
t?.noComputedFields || (I = await _e(E.admin?.retriever));
|
|
11400
|
+
for (const b of v.values()) {
|
|
11401
|
+
const w = [], O = [...b.Collection_Path, b.id];
|
|
11402
|
+
t?.subcollections && w.push(mm(
|
|
11403
11403
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
11404
|
-
|
|
11405
|
-
|
|
11404
|
+
v.get(b.id),
|
|
11405
|
+
O,
|
|
11406
11406
|
Oe(t.subcollections),
|
|
11407
11407
|
s,
|
|
11408
11408
|
Oe(t?.relations),
|
|
11409
11409
|
t?.only,
|
|
11410
11410
|
t?.noEmbeddingFields
|
|
11411
|
-
)), t?.relations && (t.relations.fields && (t.relations.fields = t.relations.fields.map((
|
|
11412
|
-
if (typeof
|
|
11413
|
-
const Y = o.fields.find((J) => J.name ===
|
|
11411
|
+
)), t?.relations && (t.relations.fields && (t.relations.fields = t.relations.fields.map((D) => {
|
|
11412
|
+
if (typeof D == "string") {
|
|
11413
|
+
const Y = o.fields.find((J) => J.name === D);
|
|
11414
11414
|
if (Y)
|
|
11415
11415
|
return Y;
|
|
11416
|
-
throw new Error(`SCHEMA_ERROR: Field ${
|
|
11416
|
+
throw new Error(`SCHEMA_ERROR: Field ${D} not found in collection ${n}`);
|
|
11417
11417
|
}
|
|
11418
|
-
return
|
|
11419
|
-
})),
|
|
11418
|
+
return D;
|
|
11419
|
+
})), w.push(uc(
|
|
11420
11420
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
11421
|
-
|
|
11422
|
-
|
|
11421
|
+
v.get(b.id),
|
|
11422
|
+
O,
|
|
11423
11423
|
Oe(t.relations),
|
|
11424
11424
|
s,
|
|
11425
11425
|
t?.only,
|
|
11426
11426
|
t?.noEmbeddingFields
|
|
11427
|
-
))), await Promise.all(
|
|
11428
|
-
const
|
|
11429
|
-
for (const
|
|
11430
|
-
|
|
11431
|
-
|
|
11432
|
-
})), t?.noEmbeddingFields &&
|
|
11433
|
-
await Promise.all(
|
|
11434
|
-
const
|
|
11435
|
-
await oe("postOperation", d,
|
|
11436
|
-
}
|
|
11437
|
-
return { cursor:
|
|
11427
|
+
))), await Promise.all(w);
|
|
11428
|
+
const x = [];
|
|
11429
|
+
for (const D of o.fields)
|
|
11430
|
+
D.type === "Computed" && !t?.noComputedFields && x.push(_e(D.formula, [b, I]).then((Y) => {
|
|
11431
|
+
b[D.name] = Y;
|
|
11432
|
+
})), t?.noEmbeddingFields && D.type === "Embedding" && delete b[D.name];
|
|
11433
|
+
await Promise.all(x);
|
|
11434
|
+
const F = ["read", b, b.id, y];
|
|
11435
|
+
await oe("postOperation", d, E, F), await oe("postRead", d, E, [y, T, b, !1]);
|
|
11436
|
+
}
|
|
11437
|
+
return { cursor: P, pages: k, docs: Array.from(v.values()) };
|
|
11438
11438
|
}, mw = async (r, e, t) => {
|
|
11439
11439
|
const n = it(), s = Ue(), i = $e(n, s.STOKER_FB_FUNCTIONS_REGION), l = (await Ye(i, "stoker-readapi")({
|
|
11440
11440
|
path: r,
|
|
@@ -11479,12 +11479,12 @@ const fw = async (r, e) => {
|
|
|
11479
11479
|
if (!d)
|
|
11480
11480
|
continue;
|
|
11481
11481
|
for (const [h, m] of Object.entries(d)) {
|
|
11482
|
-
const
|
|
11482
|
+
const E = _r(m.Collection_Path, h, {
|
|
11483
11483
|
only: s,
|
|
11484
11484
|
noComputedFields: i,
|
|
11485
11485
|
noEmbeddingFields: a
|
|
11486
|
-
}).then((
|
|
11487
|
-
if (d[h] =
|
|
11486
|
+
}).then((g) => {
|
|
11487
|
+
if (d[h] = g, l > 0)
|
|
11488
11488
|
return gm(
|
|
11489
11489
|
// eslint-disable-next-line security/detect-object-injection
|
|
11490
11490
|
d[h],
|
|
@@ -11495,13 +11495,13 @@ const fw = async (r, e) => {
|
|
|
11495
11495
|
i,
|
|
11496
11496
|
a
|
|
11497
11497
|
);
|
|
11498
|
-
}).catch((
|
|
11499
|
-
if (
|
|
11498
|
+
}).catch((g) => {
|
|
11499
|
+
if (g.message.includes("NOT_FOUND") || g.code === "permission-denied")
|
|
11500
11500
|
delete d[h];
|
|
11501
11501
|
else
|
|
11502
|
-
throw
|
|
11502
|
+
throw g;
|
|
11503
11503
|
});
|
|
11504
|
-
u.push(
|
|
11504
|
+
u.push(E);
|
|
11505
11505
|
}
|
|
11506
11506
|
}
|
|
11507
11507
|
await Promise.all(u);
|
|
@@ -11520,41 +11520,41 @@ const fw = async (r, e) => {
|
|
|
11520
11520
|
"global",
|
|
11521
11521
|
"firebase",
|
|
11522
11522
|
"serverTimestampOptions"
|
|
11523
|
-
]), f = s.collections[n], { labels: d, access: h } = f, { serverReadOnly: m } = h,
|
|
11524
|
-
if (!
|
|
11523
|
+
]), f = s.collections[n], { labels: d, access: h } = f, { serverReadOnly: m } = h, E = lt(d.collection), g = De();
|
|
11524
|
+
if (!g?.Role)
|
|
11525
11525
|
throw new Error("PERMISSIONS_DENIED");
|
|
11526
|
-
if (m?.includes(
|
|
11526
|
+
if (m?.includes(g.Role))
|
|
11527
11527
|
return await mw(r, e, t);
|
|
11528
|
-
const
|
|
11529
|
-
if (
|
|
11528
|
+
const _ = dm(r, e, a);
|
|
11529
|
+
if (_.length === 0)
|
|
11530
11530
|
throw new Error("PERMISSION_DENIED");
|
|
11531
11531
|
const T = { collection: d.collection };
|
|
11532
|
-
await oe("preOperation", o,
|
|
11533
|
-
let
|
|
11534
|
-
const
|
|
11535
|
-
let
|
|
11536
|
-
if (t?.only === "cache" ?
|
|
11532
|
+
await oe("preOperation", o, E, ["read", void 0, e, T]), await oe("preRead", o, E, [T, _, !1, !1]);
|
|
11533
|
+
let y = {};
|
|
11534
|
+
const A = _.map(async (I) => {
|
|
11535
|
+
let b;
|
|
11536
|
+
if (t?.only === "cache" ? b = await Ym(I) : t?.only === "server" ? b = await Jm(I) : b = await bd(I), !b.exists())
|
|
11537
11537
|
throw new Error(`NOT_FOUND: Document with ID ${e} does not exist at location ${r?.join("/") || d.collection}`);
|
|
11538
|
-
return { id:
|
|
11539
|
-
}),
|
|
11540
|
-
for (const
|
|
11541
|
-
|
|
11542
|
-
const
|
|
11543
|
-
if (t?.subcollections &&
|
|
11544
|
-
if (typeof
|
|
11545
|
-
const
|
|
11546
|
-
if (
|
|
11547
|
-
return
|
|
11548
|
-
throw new Error(`SCHEMA_ERROR: Field ${
|
|
11549
|
-
}
|
|
11550
|
-
return
|
|
11551
|
-
})),
|
|
11552
|
-
for (const
|
|
11553
|
-
|
|
11538
|
+
return { id: b.id, data: b.data({ serverTimestamps: u || "none" }) };
|
|
11539
|
+
}), R = await Promise.all(A);
|
|
11540
|
+
for (const I of R)
|
|
11541
|
+
y.id ||= I.id, y = { ...y, ...I.data }, delete y.Collection_Path_String;
|
|
11542
|
+
const v = [], C = r ? [...r, e] : [d.collection, e];
|
|
11543
|
+
if (t?.subcollections && v.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
|
+
if (typeof I == "string") {
|
|
11545
|
+
const b = f.fields.find((w) => w.name === I);
|
|
11546
|
+
if (b)
|
|
11547
|
+
return b;
|
|
11548
|
+
throw new Error(`SCHEMA_ERROR: Field ${I} not found in collection ${n}`);
|
|
11549
|
+
}
|
|
11550
|
+
return I;
|
|
11551
|
+
})), v.push(gm(y, C, Oe(t.relations), s, t?.only, t?.noComputedFields, t?.noEmbeddingFields))), await Promise.all(v), !t?.noComputedFields)
|
|
11552
|
+
for (const I of f.fields)
|
|
11553
|
+
I.type === "Computed" && (y[I.name] = await I.formula(y));
|
|
11554
11554
|
if (t?.noEmbeddingFields)
|
|
11555
|
-
for (const
|
|
11556
|
-
|
|
11557
|
-
return await oe("postOperation", o,
|
|
11555
|
+
for (const I of f.fields)
|
|
11556
|
+
I.type === "Embedding" && delete y[I.name];
|
|
11557
|
+
return await oe("postOperation", o, E, ["read", y, e, T]), await oe("postRead", o, E, [T, _, y, !1]), y;
|
|
11558
11558
|
}, pw = (r) => r !== null && typeof r == "object", _m = (r) => {
|
|
11559
11559
|
const e = (t) => {
|
|
11560
11560
|
Object.entries(t).forEach(([n, s]) => {
|
|
@@ -11578,10 +11578,10 @@ const fw = async (r, e) => {
|
|
|
11578
11578
|
const a = Dt(), o = Ke(), c = Ke(!0), l = yc(), u = ke(), f = fr(), d = je(), h = De();
|
|
11579
11579
|
if (r.length === 0)
|
|
11580
11580
|
throw new Error("EMPTY_PATH");
|
|
11581
|
-
const m = r.at(-1),
|
|
11582
|
-
if (!
|
|
11581
|
+
const m = r.at(-1), E = Object.keys(o.collections).includes(m), g = u.disabledCollections?.includes(m);
|
|
11582
|
+
if (!E || g)
|
|
11583
11583
|
throw new Error("COLLECTION_NOT_FOUND");
|
|
11584
|
-
const
|
|
11584
|
+
const _ = o.collections[m], { labels: T, access: S, fields: P, enableWriteLog: y } = _, { serverWriteOnly: A } = S, R = lt(T.collection), v = await se(u, ["global", "appName"]), C = s?.retry, p = f.currentUser;
|
|
11585
11585
|
if (!p)
|
|
11586
11586
|
throw new Error("NOT_AUTHENTICATED");
|
|
11587
11587
|
if (!h)
|
|
@@ -11591,17 +11591,17 @@ const fw = async (r, e) => {
|
|
|
11591
11591
|
i = C?.originalRecord || i || await _r(r, e, { noComputedFields: !0, noEmbeddingFields: !0 });
|
|
11592
11592
|
for (const q of c.collections[m].fields)
|
|
11593
11593
|
q.type === "Computed" && (delete t[q.name], delete i[q.name]);
|
|
11594
|
-
const k = Co(d),
|
|
11594
|
+
const k = Co(d), I = { collection: T.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 se(R, [
|
|
11595
11595
|
"collections",
|
|
11596
11596
|
T.collection,
|
|
11597
11597
|
"custom",
|
|
11598
11598
|
"disableOfflineUpdate"
|
|
11599
|
-
]),
|
|
11600
|
-
if (zt() === "Offline" && (
|
|
11599
|
+
]), F = () => {
|
|
11600
|
+
if (zt() === "Offline" && (x || A || _.auth && (b || O || w)))
|
|
11601
11601
|
throw new Error("CLIENT_OFFLINE");
|
|
11602
11602
|
};
|
|
11603
|
-
if (
|
|
11604
|
-
if (
|
|
11603
|
+
if (F(), A || b || O || w) {
|
|
11604
|
+
if (b) {
|
|
11605
11605
|
if (!n.password)
|
|
11606
11606
|
throw new Error("VALIDATION_ERROR: Password is required");
|
|
11607
11607
|
if (!n.passwordConfirm)
|
|
@@ -11609,7 +11609,7 @@ const fw = async (r, e) => {
|
|
|
11609
11609
|
if (n.password !== n.passwordConfirm)
|
|
11610
11610
|
throw new Error("VALIDATION_ERROR: Passwords do not match");
|
|
11611
11611
|
if (!await se(u, ["global", "firebase", "enableEmulators"])) {
|
|
11612
|
-
|
|
11612
|
+
F();
|
|
11613
11613
|
try {
|
|
11614
11614
|
const { isValid: Ie } = await _d(f, n.password);
|
|
11615
11615
|
if (!Ie)
|
|
@@ -11622,50 +11622,50 @@ const fw = async (r, e) => {
|
|
|
11622
11622
|
return await yw(r, e, t, n ? { operation: n.operation, permissions: n.permissions, password: n.password } : void 0);
|
|
11623
11623
|
}
|
|
11624
11624
|
delete t.id;
|
|
11625
|
-
const
|
|
11626
|
-
for (const q of
|
|
11627
|
-
!ge(q) && sr(
|
|
11628
|
-
if (xt(
|
|
11625
|
+
const M = Ko("update", r, t, o, v, zt(), p.uid, Bt.now(), Lr(), !!C);
|
|
11626
|
+
for (const q of P)
|
|
11627
|
+
!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, _, p.uid, void 0, i), !C) {
|
|
11629
11629
|
const q = [
|
|
11630
11630
|
"update",
|
|
11631
|
-
|
|
11631
|
+
M,
|
|
11632
11632
|
e,
|
|
11633
|
-
|
|
11633
|
+
I,
|
|
11634
11634
|
k,
|
|
11635
11635
|
Oe(i)
|
|
11636
11636
|
];
|
|
11637
|
-
await oe("preOperation", u,
|
|
11638
|
-
const H = ["update",
|
|
11639
|
-
await oe("preWrite", u,
|
|
11637
|
+
await oe("preOperation", u, R, q);
|
|
11638
|
+
const H = ["update", M, e, I, k, Oe(i)];
|
|
11639
|
+
await oe("preWrite", u, R, H);
|
|
11640
11640
|
}
|
|
11641
|
-
if (Xd(
|
|
11641
|
+
if (Xd(_, M, o), eh(_, M), !C)
|
|
11642
11642
|
try {
|
|
11643
|
-
const q = { ...i, ...
|
|
11644
|
-
tr(q), await om("update", q,
|
|
11643
|
+
const q = { ...i, ...M };
|
|
11644
|
+
tr(q), await om("update", q, _, R, ["update", q, I, k, Oe(i)], o), x && (F(), await lc("update", e, M, _, h));
|
|
11645
11645
|
} catch (q) {
|
|
11646
11646
|
throw new Error(`VALIDATION_ERROR: ${q.message}`);
|
|
11647
11647
|
}
|
|
11648
|
-
if (Oy(
|
|
11649
|
-
const q = { ...i, ...
|
|
11648
|
+
if (Oy(M, i, e, _, o, p.uid, h), xt(M), ac("update", k, r, e, M, o, _, s, l, Io, ko, An, (q) => Ce(d, "tenants", a, "system_fields", T.collection, `${T.collection}-${q.name}`, e), (q, H) => Ce(d, "tenants", a, "system_unique", T.collection, `Unique-${T.collection}-${q.name}`, H), (q) => Ce(d, "tenants", a, "system_fields", T.collection, `${T.collection}-${q}`, e)), k.update(Ce(d, "tenants", a, r.join("/"), e), M), !C && y && He("update", "written", M, r, e, _, p.uid, void 0, i), await dc("update", r, e, M, I, _, R, k, p.uid, y || !1, h, !!C, i), C?.type === "unique") {
|
|
11649
|
+
const q = { ...i, ...M };
|
|
11650
11650
|
return tr(q), { id: e, ...q };
|
|
11651
11651
|
}
|
|
11652
|
-
|
|
11653
|
-
const
|
|
11654
|
-
await oe("postWrite", u,
|
|
11655
|
-
const J = { ...i, ...
|
|
11652
|
+
y && He("update", "success", M, r, e, _, p.uid, void 0, i);
|
|
11653
|
+
const D = ["update", M, e, I, !!C, Oe(i)], Y = [...D];
|
|
11654
|
+
await oe("postWrite", u, R, D), await oe("postOperation", u, R, Y);
|
|
11655
|
+
const J = { ...i, ...M };
|
|
11656
11656
|
return tr(J), { id: e, ...J };
|
|
11657
11657
|
}, dc = async (r, e, t, n, s, i, a, o, c, l, u, f, d) => {
|
|
11658
|
-
const h = Ke(), m = ke(), { labels:
|
|
11659
|
-
let
|
|
11660
|
-
const
|
|
11658
|
+
const h = Ke(), m = ke(), { labels: E } = i;
|
|
11659
|
+
let g = 0;
|
|
11660
|
+
const _ = async () => {
|
|
11661
11661
|
try {
|
|
11662
11662
|
await Oe(o).commit();
|
|
11663
11663
|
return;
|
|
11664
11664
|
} catch (T) {
|
|
11665
|
-
let
|
|
11666
|
-
const
|
|
11665
|
+
let S;
|
|
11666
|
+
const P = await se(a, [
|
|
11667
11667
|
"collections",
|
|
11668
|
-
|
|
11668
|
+
E.collection,
|
|
11669
11669
|
"custom",
|
|
11670
11670
|
"autoCorrectUnique"
|
|
11671
11671
|
]);
|
|
@@ -11673,27 +11673,27 @@ const fw = async (r, e) => {
|
|
|
11673
11673
|
try {
|
|
11674
11674
|
await lc(r, t, n, i, u);
|
|
11675
11675
|
} catch (C) {
|
|
11676
|
-
const p = C.message.split(", "), k = [],
|
|
11677
|
-
let
|
|
11678
|
-
for (const
|
|
11679
|
-
const
|
|
11680
|
-
if (!
|
|
11681
|
-
throw new Error(`SCHEMA_ERROR: Field ${
|
|
11682
|
-
|
|
11676
|
+
const p = C.message.split(", "), k = [], I = [];
|
|
11677
|
+
let b = !1;
|
|
11678
|
+
for (const w of p) {
|
|
11679
|
+
const O = w.split(" ")[0], x = h.collections[E.collection].fields.find((F) => F.name === O);
|
|
11680
|
+
if (!x)
|
|
11681
|
+
throw new Error(`SCHEMA_ERROR: Field ${O} not found in ${E.collection} schema`);
|
|
11682
|
+
x.type === "Number" && k.push(w), x.type === "String" && I.push(w);
|
|
11683
11683
|
}
|
|
11684
|
-
if ((!
|
|
11685
|
-
for (const
|
|
11686
|
-
const
|
|
11687
|
-
if (h.collections[
|
|
11684
|
+
if ((!P || k.length > 0) && (S = new Error(`VALIDATION_ERROR: ${p.join(", ")}`)), P && I.length > 0) {
|
|
11685
|
+
for (const w of I) {
|
|
11686
|
+
const O = w.split(" ")[0];
|
|
11687
|
+
if (h.collections[E.collection].fields.find((M) => M.name === O).type === "Number")
|
|
11688
11688
|
continue;
|
|
11689
|
-
let
|
|
11690
|
-
n[
|
|
11689
|
+
let F = 1;
|
|
11690
|
+
n[O].match(/ - DUPLICATE-\d+/) ? (F = parseInt(
|
|
11691
11691
|
// eslint-disable-next-line security/detect-object-injection
|
|
11692
|
-
n[
|
|
11693
|
-
), n[
|
|
11694
|
-
n[
|
|
11692
|
+
n[O].match(/ - DUPLICATE-\d+/)[0].split("-")[2]
|
|
11693
|
+
), 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 : S = new Error(p.map((M) => M.replace(/ - DUPLICATE-\d+/g, "")).join(", "));
|
|
11695
11695
|
}
|
|
11696
|
-
if (
|
|
11696
|
+
if (b) {
|
|
11697
11697
|
r === "create" && await vm(e, n, void 0, { retry: { type: "unique", docId: t } }), r === "update" && await fc(e, t, n, void 0, {
|
|
11698
11698
|
retry: {
|
|
11699
11699
|
type: "unique",
|
|
@@ -11705,20 +11705,20 @@ const fw = async (r, e) => {
|
|
|
11705
11705
|
}
|
|
11706
11706
|
}
|
|
11707
11707
|
}
|
|
11708
|
-
const
|
|
11708
|
+
const y = S || T, A = [
|
|
11709
11709
|
r,
|
|
11710
11710
|
n,
|
|
11711
11711
|
t,
|
|
11712
11712
|
s,
|
|
11713
|
-
E,
|
|
11714
|
-
f,
|
|
11715
11713
|
y,
|
|
11714
|
+
f,
|
|
11715
|
+
g,
|
|
11716
11716
|
r === "update" ? d : void 0
|
|
11717
|
-
],
|
|
11718
|
-
if (
|
|
11717
|
+
], R = T.code === "unavailable", v = await oe("postWriteError", m, a, A);
|
|
11718
|
+
if (v?.resolved)
|
|
11719
11719
|
return;
|
|
11720
|
-
if (!
|
|
11721
|
-
|
|
11720
|
+
if (!R && v?.retry) {
|
|
11721
|
+
g++, await _();
|
|
11722
11722
|
return;
|
|
11723
11723
|
} else
|
|
11724
11724
|
l && He(
|
|
@@ -11729,14 +11729,14 @@ const fw = async (r, e) => {
|
|
|
11729
11729
|
t,
|
|
11730
11730
|
i,
|
|
11731
11731
|
c,
|
|
11732
|
-
|
|
11732
|
+
y,
|
|
11733
11733
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
11734
11734
|
r === "update" ? d : void 0
|
|
11735
11735
|
);
|
|
11736
|
-
throw
|
|
11736
|
+
throw y;
|
|
11737
11737
|
}
|
|
11738
11738
|
};
|
|
11739
|
-
await
|
|
11739
|
+
await _();
|
|
11740
11740
|
}, gw = async (r, e, t, n) => {
|
|
11741
11741
|
const s = it(), i = Ue(), a = $e(s, i.STOKER_FB_FUNCTIONS_REGION), o = Ye(a, "stoker-writeapi", { timeout: 540 * 1e3 });
|
|
11742
11742
|
return _m(e), (await o({
|
|
@@ -11750,27 +11750,27 @@ const fw = async (r, e) => {
|
|
|
11750
11750
|
const a = Dt(), o = Ke(), c = yc(), l = ke(), u = fr(), f = je(), d = De();
|
|
11751
11751
|
if (r.length === 0)
|
|
11752
11752
|
throw new Error("EMPTY_PATH");
|
|
11753
|
-
const h = r.at(-1), m = Object.keys(o.collections).includes(h),
|
|
11754
|
-
if (!m ||
|
|
11753
|
+
const h = r.at(-1), m = Object.keys(o.collections).includes(h), E = l.disabledCollections?.includes(h);
|
|
11754
|
+
if (!m || E)
|
|
11755
11755
|
throw new Error("COLLECTION_NOT_FOUND");
|
|
11756
|
-
const
|
|
11756
|
+
const g = o.collections[h], { labels: _, access: T, enableWriteLog: S, softDelete: P } = g, { serverWriteOnly: y } = T, A = lt(_.collection), R = await se(l, ["global", "appName"]), v = n?.retry, C = u.currentUser;
|
|
11757
11757
|
if (!C)
|
|
11758
11758
|
throw new Error("NOT_AUTHENTICATED");
|
|
11759
11759
|
if (!d)
|
|
11760
11760
|
throw new Error("PERMISSION_DENIED");
|
|
11761
|
-
const p = await se(
|
|
11761
|
+
const p = await se(A, [
|
|
11762
11762
|
"collections",
|
|
11763
|
-
|
|
11763
|
+
_.collection,
|
|
11764
11764
|
"custom",
|
|
11765
11765
|
"disableOfflineCreate"
|
|
11766
11766
|
]), k = () => {
|
|
11767
|
-
if (zt() === "Offline" && (p ||
|
|
11767
|
+
if (zt() === "Offline" && (p || y || g.auth && t))
|
|
11768
11768
|
throw new Error("CLIENT_OFFLINE");
|
|
11769
11769
|
};
|
|
11770
11770
|
k();
|
|
11771
|
-
const
|
|
11772
|
-
if (
|
|
11773
|
-
if (k(),
|
|
11771
|
+
const I = Co(f), b = v?.docId || s || Ce(qr(f, "tenants", a, _.collection)).id, w = { collection: _.collection };
|
|
11772
|
+
if (y || g.auth && t) {
|
|
11773
|
+
if (k(), g.auth && t) {
|
|
11774
11774
|
if (!t.password)
|
|
11775
11775
|
throw new Error("VALIDATION_ERROR: Password is required");
|
|
11776
11776
|
if (!t.passwordConfirm)
|
|
@@ -11788,21 +11788,21 @@ const fw = async (r, e) => {
|
|
|
11788
11788
|
}
|
|
11789
11789
|
}
|
|
11790
11790
|
}
|
|
11791
|
-
return i && i(), await gw(r, e, t ? { permissions: t.permissions, password: t.password } : void 0,
|
|
11791
|
+
return i && i(), await gw(r, e, t ? { permissions: t.permissions, password: t.password } : void 0, b);
|
|
11792
11792
|
}
|
|
11793
|
-
e.id =
|
|
11794
|
-
const
|
|
11795
|
-
if (
|
|
11793
|
+
e.id = b;
|
|
11794
|
+
const O = Ko("create", r, e, o, R, zt(), C.uid, Bt.now(), Lr(), !!v);
|
|
11795
|
+
if (P && (O[P.archivedField] = !1), xt(O), !v && S && He("create", "started", O, r, b, g, C.uid), v || (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), v || await hg(O, g, A, d.Role), !v)
|
|
11796
11796
|
try {
|
|
11797
|
-
await om("create",
|
|
11798
|
-
} catch (
|
|
11799
|
-
throw new Error(`VALIDATION_ERROR: ${
|
|
11800
|
-
}
|
|
11801
|
-
if (i && i(), xt(
|
|
11802
|
-
return { docId:
|
|
11803
|
-
|
|
11804
|
-
const
|
|
11805
|
-
return await oe("postWrite", l,
|
|
11797
|
+
await om("create", O, g, A, ["create", O, w, I], o), p && (k(), await lc("create", b, O, g, d));
|
|
11798
|
+
} catch (D) {
|
|
11799
|
+
throw new Error(`VALIDATION_ERROR: ${D.message}`);
|
|
11800
|
+
}
|
|
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", _.collection, `${_.collection}-${D.name}`, b), (D, Y) => Ce(f, "tenants", a, "system_unique", _.collection, `Unique-${_.collection}-${D.name}`, Y), (D) => Ce(f, "tenants", a, "system_fields", _.collection, `${_.collection}-${D}`, b)), I.set(Ce(f, "tenants", a, r.join("/"), b), O), !v && S && He("create", "written", O, r, b, g, C.uid), await dc("create", r, b, O, w, g, A, I, C.uid, S || !1, d, !!v), v?.type === "unique")
|
|
11802
|
+
return { docId: b, record: O };
|
|
11803
|
+
S && He("create", "success", O, r, b, g, C.uid);
|
|
11804
|
+
const x = ["create", O, b, w, !!v], F = [...x];
|
|
11805
|
+
return await oe("postWrite", l, A, x), await oe("postOperation", l, A, F), { id: b, ...O };
|
|
11806
11806
|
}, _w = async (r, e) => {
|
|
11807
11807
|
const t = it(), n = Ue(), s = $e(t, n.STOKER_FB_FUNCTIONS_REGION);
|
|
11808
11808
|
return (await Ye(s, "stoker-writeapi", { timeout: 540 * 1e3 })({
|
|
@@ -11817,40 +11817,40 @@ const fw = async (r, e) => {
|
|
|
11817
11817
|
const u = r.at(-1), f = Object.keys(s.collections).includes(u), d = c.disabledCollections?.includes(u);
|
|
11818
11818
|
if (!f || d)
|
|
11819
11819
|
throw new Error("COLLECTION_NOT_FOUND");
|
|
11820
|
-
const h = s.collections[u], { labels: m, access:
|
|
11821
|
-
if (!
|
|
11820
|
+
const h = s.collections[u], { labels: m, access: E, enableWriteLog: g, softDelete: _ } = h, { serverWriteOnly: T } = E, S = lt(m.collection), P = await se(c, ["global", "appName"]), y = t?.retry, A = a.currentUser;
|
|
11821
|
+
if (!A)
|
|
11822
11822
|
throw new Error("NOT_AUTHENTICATED");
|
|
11823
11823
|
if (!l)
|
|
11824
11824
|
throw new Error("PERMISSION_DENIED");
|
|
11825
|
-
if (
|
|
11825
|
+
if (_ && !h.auth)
|
|
11826
11826
|
return await fc(r, e, {
|
|
11827
|
-
[
|
|
11828
|
-
[
|
|
11827
|
+
[_.archivedField]: !0,
|
|
11828
|
+
[_.timestampField]: Lr()
|
|
11829
11829
|
});
|
|
11830
|
-
const
|
|
11830
|
+
const R = await se(S, [
|
|
11831
11831
|
"collections",
|
|
11832
11832
|
m.collection,
|
|
11833
11833
|
"custom",
|
|
11834
11834
|
"disableOfflineDelete"
|
|
11835
11835
|
]);
|
|
11836
11836
|
if ((() => {
|
|
11837
|
-
if (zt() === "Offline" && (
|
|
11837
|
+
if (zt() === "Offline" && (R || T || h.auth))
|
|
11838
11838
|
throw new Error("CLIENT_OFFLINE");
|
|
11839
11839
|
})(), bm(e))
|
|
11840
11840
|
throw new Error("RECORD_BUSY");
|
|
11841
11841
|
let C;
|
|
11842
11842
|
try {
|
|
11843
11843
|
C = await _r(r, e);
|
|
11844
|
-
} catch (
|
|
11845
|
-
throw
|
|
11844
|
+
} catch (F) {
|
|
11845
|
+
throw g && y?.record && F.message.indexOf("NOT_FOUND") !== -1 && await He("delete", "failed", y?.record, r, e, h, A.uid, F), F;
|
|
11846
11846
|
}
|
|
11847
11847
|
if (T || h.auth && C.User_ID)
|
|
11848
11848
|
return await _w(r, e);
|
|
11849
11849
|
delete C.id;
|
|
11850
|
-
const p = Co(o), k = { collection: m.collection },
|
|
11851
|
-
xt(
|
|
11852
|
-
const
|
|
11853
|
-
return await oe("postWrite", c,
|
|
11850
|
+
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, S, ["delete", I, e, k, p]), await oe("preWrite", c, S, ["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, S, p, A.uid, g || !1, l, !!y), g && He("delete", "success", { ...I, ...y?.record || {} }, r, e, h, A.uid);
|
|
11852
|
+
const w = ["delete", I, e, k, !!y], O = [...w];
|
|
11853
|
+
return await oe("postWrite", c, S, w), await oe("postOperation", c, S, O), { id: e, ...I };
|
|
11854
11854
|
}, wm = (r) => {
|
|
11855
11855
|
if (typeof r == "object")
|
|
11856
11856
|
for (const e in r)
|
|
@@ -11871,13 +11871,13 @@ const bw = async (r, e) => {
|
|
|
11871
11871
|
for (const o of i.docs) {
|
|
11872
11872
|
mt[o.id] ??= 0;
|
|
11873
11873
|
const c = o.data(), { data: l, operation: u, docId: f, collection: d, Collection_Path: h, Last_Write_Version: m } = c;
|
|
11874
|
-
await new Promise((
|
|
11875
|
-
const
|
|
11874
|
+
await new Promise((_) => setTimeout(_, 1e3));
|
|
11875
|
+
const E = await ww("stoker-writelog", {
|
|
11876
11876
|
path: h,
|
|
11877
11877
|
id: f,
|
|
11878
11878
|
log: o.id
|
|
11879
11879
|
});
|
|
11880
|
-
if (!
|
|
11880
|
+
if (!E || E.status !== "written")
|
|
11881
11881
|
continue;
|
|
11882
11882
|
if (s?.uid !== e.uid)
|
|
11883
11883
|
return;
|
|
@@ -11897,24 +11897,24 @@ const bw = async (r, e) => {
|
|
|
11897
11897
|
);
|
|
11898
11898
|
continue;
|
|
11899
11899
|
}
|
|
11900
|
-
const
|
|
11901
|
-
if (
|
|
11900
|
+
const g = localStorage.getItem(`stoker-retry-${f}`);
|
|
11901
|
+
if (g !== "done" && !(g && Date.now() - parseInt(g) < 1e4)) {
|
|
11902
11902
|
if (localStorage.setItem(`stoker-retry-${f}`, Date.now().toString()), console.info(`Retrying pending ${u} operation: ${o.ref.path}`), u === "create" && (mt[f]++, await vm(h, l.data, void 0, {
|
|
11903
11903
|
retry: {
|
|
11904
11904
|
type: "offline",
|
|
11905
11905
|
docId: f
|
|
11906
11906
|
}
|
|
11907
|
-
}).catch((
|
|
11908
|
-
console.error(
|
|
11907
|
+
}).catch((_) => {
|
|
11908
|
+
console.error(_);
|
|
11909
11909
|
}), mt[f]--, localStorage.setItem(`stoker-retry-${f}`, "done")), u === "update") {
|
|
11910
|
-
const
|
|
11910
|
+
const _ = r.collections[d], { softDelete: T } = _;
|
|
11911
11911
|
T && l.data?.[T.archivedField] && l.data?.[T.archivedField] !== l.originalRecord?.[T.archivedField] && (l.data[T.timestampField] = Lr()), l.data && wm(l.data), mt[f]++, await fc(h, f, l.data, void 0, {
|
|
11912
11912
|
retry: {
|
|
11913
11913
|
type: "offline",
|
|
11914
11914
|
originalRecord: l.originalRecord
|
|
11915
11915
|
}
|
|
11916
|
-
}).catch((
|
|
11917
|
-
console.error(
|
|
11916
|
+
}).catch((S) => {
|
|
11917
|
+
console.error(S);
|
|
11918
11918
|
}), mt[f]--, localStorage.setItem(`stoker-retry-${f}`, "done");
|
|
11919
11919
|
}
|
|
11920
11920
|
u === "delete" && (mt[f]++, await vw(h, f, {
|
|
@@ -11928,8 +11928,8 @@ const bw = async (r, e) => {
|
|
|
11928
11928
|
Last_Write_Version: c.Last_Write_Version
|
|
11929
11929
|
}
|
|
11930
11930
|
}
|
|
11931
|
-
}).catch((
|
|
11932
|
-
console.error(
|
|
11931
|
+
}).catch((_) => {
|
|
11932
|
+
console.error(_);
|
|
11933
11933
|
}), mt[f]--, localStorage.setItem(`stoker-retry-${f}`, "done"));
|
|
11934
11934
|
}
|
|
11935
11935
|
}
|
|
@@ -12095,19 +12095,19 @@ const Gw = async (r, e, t, n) => {
|
|
|
12095
12095
|
};
|
|
12096
12096
|
At.main = Gn(dt, p), At.firestoreWrite = Gn(c, p), At.maintenance = Gn(l, p);
|
|
12097
12097
|
let k = !1;
|
|
12098
|
-
const
|
|
12099
|
-
if (console.log(`App Check token error detected for ${
|
|
12098
|
+
const I = (b, w) => {
|
|
12099
|
+
if (console.log(`App Check token error detected for ${w}`), !k)
|
|
12100
12100
|
if (k = !0, me.onAppCheckTokenFailure)
|
|
12101
|
-
_e(me.onAppCheckTokenFailure, [
|
|
12101
|
+
_e(me.onAppCheckTokenFailure, [b]);
|
|
12102
12102
|
else {
|
|
12103
|
-
const
|
|
12104
|
-
!
|
|
12103
|
+
const O = sessionStorage.getItem("stoker-app-check-reload");
|
|
12104
|
+
!O || new Date(O).getTime() < Date.now() - 3e5 ? (sessionStorage.setItem("stoker-app-check-reload", (/* @__PURE__ */ new Date()).toISOString()), window.location.reload()) : alert("For security reasons, please close this tab and wait a while before restarting it.");
|
|
12105
12105
|
}
|
|
12106
12106
|
};
|
|
12107
12107
|
Hn(At.main, () => {
|
|
12108
|
-
}, (
|
|
12109
|
-
}, (
|
|
12110
|
-
}, (
|
|
12108
|
+
}, (b) => I(b, "main")), Hn(At.firestoreWrite, () => {
|
|
12109
|
+
}, (b) => I(b, "firestoreWrite")), Hn(At.maintenance, () => {
|
|
12110
|
+
}, (b) => I(b, "maintenance"));
|
|
12111
12111
|
}
|
|
12112
12112
|
const f = await se(me, [
|
|
12113
12113
|
"global",
|
|
@@ -12125,12 +12125,12 @@ const Gw = async (r, e, t, n) => {
|
|
|
12125
12125
|
"global",
|
|
12126
12126
|
"firebase",
|
|
12127
12127
|
"enableEmulators"
|
|
12128
|
-
]),
|
|
12128
|
+
]), E = await se(me, ["global", "enableUserIDLogging"]), g = await se(me, [
|
|
12129
12129
|
"global",
|
|
12130
12130
|
"firebase",
|
|
12131
12131
|
"logLevel",
|
|
12132
12132
|
"dev"
|
|
12133
|
-
]),
|
|
12133
|
+
]), _ = await se(me, [
|
|
12134
12134
|
"global",
|
|
12135
12135
|
"firebase",
|
|
12136
12136
|
"logLevel",
|
|
@@ -12139,56 +12139,56 @@ const Gw = async (r, e, t, n) => {
|
|
|
12139
12139
|
throw new Error("Error checking analytics support.", { cause: p });
|
|
12140
12140
|
});
|
|
12141
12141
|
St === "production" && f && T && Dm(dt, d || {}), h && Mm(h);
|
|
12142
|
-
const
|
|
12142
|
+
const S = await se(me, [
|
|
12143
12143
|
"global",
|
|
12144
12144
|
"auth",
|
|
12145
12145
|
"authPersistenceType"
|
|
12146
|
-
]),
|
|
12146
|
+
]), y = {
|
|
12147
12147
|
popupRedirectResolver: void 0,
|
|
12148
|
-
persistence:
|
|
12148
|
+
persistence: S === "LOCAL" ? [Pm, qm, Ec] : S === "SESSION" ? [Ec, Sc] : [Sc]
|
|
12149
12149
|
};
|
|
12150
|
-
ht.main = Oc(dt,
|
|
12150
|
+
ht.main = Oc(dt, y);
|
|
12151
12151
|
for (const p of o)
|
|
12152
|
-
ht[p] = Oc(Ya[`${p}App`],
|
|
12153
|
-
const { main:
|
|
12154
|
-
Lm(
|
|
12152
|
+
ht[p] = Oc(Ya[`${p}App`], y);
|
|
12153
|
+
const { main: A } = ht;
|
|
12154
|
+
Lm(A, async (p) => {
|
|
12155
12155
|
if (p && await _e(me.preLogin, [p]) === !1)
|
|
12156
12156
|
throw new Error("Operation cancelled by preLogin");
|
|
12157
12157
|
});
|
|
12158
|
-
const
|
|
12158
|
+
const R = await se(me, [
|
|
12159
12159
|
"global",
|
|
12160
12160
|
"firebase",
|
|
12161
12161
|
"disableIndividualEmulators"
|
|
12162
12162
|
]);
|
|
12163
12163
|
if (St === "development" && m) {
|
|
12164
|
-
if (!
|
|
12164
|
+
if (!R?.includes("Auth")) {
|
|
12165
12165
|
const p = ve.STOKER_FB_EMULATOR_AUTH_PORT ? parseInt(ve.STOKER_FB_EMULATOR_AUTH_PORT) : 9099;
|
|
12166
12166
|
for (const k of Object.values(ht))
|
|
12167
12167
|
$m(k, `http://localhost:${p}`);
|
|
12168
12168
|
}
|
|
12169
|
-
if (!
|
|
12169
|
+
if (!R?.includes("Database")) {
|
|
12170
12170
|
const p = ve.STOKER_FB_EMULATOR_DATABASE_PORT ? parseInt(ve.STOKER_FB_EMULATOR_DATABASE_PORT) : 9e3;
|
|
12171
12171
|
Zm(wd(), "localhost", p);
|
|
12172
12172
|
}
|
|
12173
|
-
if (!
|
|
12173
|
+
if (!R?.includes("Firestore")) {
|
|
12174
12174
|
const p = ve.STOKER_FB_EMULATOR_FIRESTORE_PORT ? parseInt(ve.STOKER_FB_EMULATOR_FIRESTORE_PORT) : 8080;
|
|
12175
12175
|
Ac(Be.maintenance, "localhost", p);
|
|
12176
12176
|
}
|
|
12177
|
-
if (!
|
|
12177
|
+
if (!R?.includes("Storage")) {
|
|
12178
12178
|
const p = ve.STOKER_FB_EMULATOR_STORAGE_PORT ? parseInt(ve.STOKER_FB_EMULATOR_STORAGE_PORT) : 9199;
|
|
12179
12179
|
cp(lp(), "localhost", p);
|
|
12180
12180
|
}
|
|
12181
|
-
if (!
|
|
12181
|
+
if (!R?.includes("Functions")) {
|
|
12182
12182
|
const p = ve.STOKER_FB_EMULATOR_FUNCTIONS_PORT ? parseInt(ve.STOKER_FB_EMULATOR_FUNCTIONS_PORT) : 5001;
|
|
12183
12183
|
up($e(dt, ve.STOKER_FB_FUNCTIONS_REGION), "localhost", p);
|
|
12184
12184
|
}
|
|
12185
12185
|
}
|
|
12186
|
-
if (Ew(), Sw(), Rw(), St === "development" && (
|
|
12187
|
-
const p = Bn(
|
|
12186
|
+
if (Ew(), Sw(), Rw(), St === "development" && (g ? Qr(g) : Qr("debug")), St === "production" && (_ ? Qr(_) : Qr("error")), E) {
|
|
12187
|
+
const p = Bn(A, async (k) => {
|
|
12188
12188
|
if (k) {
|
|
12189
|
-
const
|
|
12189
|
+
const I = JSON.parse(ve.STOKER_FB_WEB_APP_CONFIG);
|
|
12190
12190
|
Nm(() => {
|
|
12191
|
-
console.log(`Tenant - ${
|
|
12191
|
+
console.log(`Tenant - ${I.projectId} - User - ${k.uid}`);
|
|
12192
12192
|
});
|
|
12193
12193
|
}
|
|
12194
12194
|
});
|
|
@@ -12197,47 +12197,47 @@ const Gw = async (r, e, t, n) => {
|
|
|
12197
12197
|
await Promise.all(Object.values(ht).map((p) => p.authStateReady().catch((k) => {
|
|
12198
12198
|
throw new Error(`Error waiting for auth state in ${p.app.name}.`, { cause: k });
|
|
12199
12199
|
})));
|
|
12200
|
-
let
|
|
12200
|
+
let v = !1;
|
|
12201
12201
|
for (const p of Object.values(ht))
|
|
12202
|
-
p.currentUser || (
|
|
12202
|
+
p.currentUser || (v = !0);
|
|
12203
12203
|
let C;
|
|
12204
|
-
return Bn(
|
|
12204
|
+
return Bn(A, async (p) => {
|
|
12205
12205
|
if (p) {
|
|
12206
12206
|
qe = p;
|
|
12207
|
-
const k = await jm(qe), { claims:
|
|
12208
|
-
hc =
|
|
12207
|
+
const k = await jm(qe), { claims: I } = k;
|
|
12208
|
+
hc = I.tenant, Rm = {
|
|
12209
12209
|
...qe,
|
|
12210
12210
|
token: {
|
|
12211
|
-
claims:
|
|
12211
|
+
claims: I
|
|
12212
12212
|
}
|
|
12213
12213
|
};
|
|
12214
|
-
const
|
|
12214
|
+
const b = [];
|
|
12215
12215
|
for (const Ee of Object.values(ht))
|
|
12216
|
-
|
|
12216
|
+
b.push(new Promise((Ve) => {
|
|
12217
12217
|
const Mt = Bn(Ee, async (j) => {
|
|
12218
12218
|
j && (Mt(), Ve({}));
|
|
12219
12219
|
});
|
|
12220
12220
|
}));
|
|
12221
|
-
await Promise.all(
|
|
12222
|
-
const
|
|
12223
|
-
let
|
|
12224
|
-
const
|
|
12221
|
+
await Promise.all(b), gd || (Cw(me), gd = !0), C = await se(me, ["global", "auth", "offlinePersistenceType"], [qe, I]);
|
|
12222
|
+
const w = await se(me, ["global", "auth", "tabManager"], [qe, I]), O = await se(me, ["global", "auth", "garbageCollectionStrategy"], [qe, I]), x = await se(me, ["global", "auth", "maxCacheSize"], [qe, I]) || -1, F = await se(me, ["global", "auth", "maxWriteCacheSize"], [qe, I]);
|
|
12223
|
+
let M;
|
|
12224
|
+
const D = {
|
|
12225
12225
|
localCache: Cc({
|
|
12226
|
-
tabManager:
|
|
12227
|
-
cacheSizeBytes:
|
|
12226
|
+
tabManager: w === "SINGLE" ? kc({ forceOwnership: !1 }) : Ic(),
|
|
12227
|
+
cacheSizeBytes: x
|
|
12228
12228
|
})
|
|
12229
12229
|
}, Y = {
|
|
12230
12230
|
localCache: Cc({
|
|
12231
|
-
tabManager:
|
|
12232
|
-
cacheSizeBytes:
|
|
12231
|
+
tabManager: w === "SINGLE" ? kc({ forceOwnership: !1 }) : Ic(),
|
|
12232
|
+
cacheSizeBytes: F || x
|
|
12233
12233
|
})
|
|
12234
12234
|
};
|
|
12235
12235
|
let J;
|
|
12236
|
-
if (
|
|
12236
|
+
if (O === "EAGER" ? J = Xm() : J = ep({ cacheSizeBytes: x }), C === "ALL" ? M = D : M = {
|
|
12237
12237
|
localCache: tp({
|
|
12238
12238
|
garbageCollector: J
|
|
12239
12239
|
})
|
|
12240
|
-
}, Be.main = Zn(dt,
|
|
12240
|
+
}, Be.main = Zn(dt, M), ["ALL", "WRITE"].includes(C) ? Be.firestoreWrite = Zn(c, Y) : Be.firestoreWrite = Zn(c, M), St === "development" && m && !R?.includes("Firestore")) {
|
|
12241
12241
|
const Ee = ve.STOKER_FB_EMULATOR_FIRESTORE_PORT ? parseInt(ve.STOKER_FB_EMULATOR_FIRESTORE_PORT) : 8080;
|
|
12242
12242
|
for (const [Ve, Mt] of Object.entries(Be))
|
|
12243
12243
|
Ve !== "maintenance" && Ac(Mt, "localhost", Ee);
|
|
@@ -12257,39 +12257,39 @@ const Gw = async (r, e, t, n) => {
|
|
|
12257
12257
|
const Qe = new Event("stoker:ready");
|
|
12258
12258
|
document.dispatchEvent(Qe);
|
|
12259
12259
|
} else if (qe) {
|
|
12260
|
-
kw(), Iw().forEach((
|
|
12261
|
-
|
|
12260
|
+
kw(), Iw().forEach((O) => {
|
|
12261
|
+
O();
|
|
12262
12262
|
}), xw();
|
|
12263
|
-
const
|
|
12264
|
-
document.dispatchEvent(
|
|
12265
|
-
const
|
|
12266
|
-
await Promise.all(Object.values(ht).map(async (
|
|
12267
|
-
|
|
12268
|
-
|
|
12269
|
-
instance:
|
|
12263
|
+
const I = new Event("stoker:signOut");
|
|
12264
|
+
document.dispatchEvent(I);
|
|
12265
|
+
const b = { error: !1, instances: [] };
|
|
12266
|
+
await Promise.all(Object.values(ht).map(async (O) => {
|
|
12267
|
+
O.currentUser && await vd(O).catch((x) => {
|
|
12268
|
+
b.error = !0, b.instances.push({
|
|
12269
|
+
instance: O.app.name,
|
|
12270
12270
|
code: "SIGN_OUT",
|
|
12271
|
-
error:
|
|
12272
|
-
}), console.error(`Error signing out of ${
|
|
12271
|
+
error: x
|
|
12272
|
+
}), console.error(`Error signing out of ${O.app.name}.`);
|
|
12273
12273
|
});
|
|
12274
|
-
})), await Promise.all(Object.entries(Be).map(async ([
|
|
12275
|
-
|
|
12276
|
-
console.error(`Error terminating ${
|
|
12277
|
-
instance:
|
|
12274
|
+
})), await Promise.all(Object.entries(Be).map(async ([O, x]) => {
|
|
12275
|
+
O !== "maintenance" && Object.keys(x).length !== 0 && await sp(x).catch((F) => {
|
|
12276
|
+
console.error(`Error terminating ${x.app.name}.`), b.error = !0, b.instances.push({
|
|
12277
|
+
instance: x.app.name,
|
|
12278
12278
|
code: "TERMINATE_APP",
|
|
12279
|
-
error:
|
|
12279
|
+
error: F
|
|
12280
12280
|
});
|
|
12281
12281
|
});
|
|
12282
12282
|
})), (await se(me, [
|
|
12283
12283
|
"global",
|
|
12284
12284
|
"auth",
|
|
12285
12285
|
"clearPersistenceOnSignOut"
|
|
12286
|
-
]) ?? !0) && (C === "ALL" && await xc(Be.main).catch((
|
|
12287
|
-
console.error('Error clearing indexedDB persistence in "[DEFAULT]".'),
|
|
12288
|
-
}), ["ALL", "WRITE"].includes(C) && await xc(Be.firestoreWrite).catch((
|
|
12289
|
-
console.error('Error clearing indexedDB persistence in "firestoreWrite".'),
|
|
12290
|
-
})),
|
|
12286
|
+
]) ?? !0) && (C === "ALL" && await xc(Be.main).catch((O) => {
|
|
12287
|
+
console.error('Error clearing indexedDB persistence in "[DEFAULT]".'), b.error = !0, b.instances.push({ instance: "[DEFAULT]", code: "CLEAR_CACHE", error: O });
|
|
12288
|
+
}), ["ALL", "WRITE"].includes(C) && await xc(Be.firestoreWrite).catch((O) => {
|
|
12289
|
+
console.error('Error clearing indexedDB persistence in "firestoreWrite".'), b.error = !0, b.instances.push({ instance: "firestoreWrite", code: "CLEAR_CACHE", error: O });
|
|
12290
|
+
})), b.error ? console.info("Sign out operation completed with errors.") : console.info("Sign out operation completed successfully."), await _e(me.postLogout, [b]);
|
|
12291
12291
|
}
|
|
12292
|
-
}),
|
|
12292
|
+
}), v ? !1 : A.currentUser ? (E && console.info(`${A.currentUser.uid} successfully logged in.`), !0) : !1;
|
|
12293
12293
|
}, { 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
12294
|
const [n, s] = [fr(), Nw()], i = ke();
|
|
12295
12295
|
if (!r || !e)
|
|
@@ -12380,67 +12380,67 @@ const Gw = async (r, e, t, n) => {
|
|
|
12380
12380
|
const o = Ke(!0), l = Jr()[i], u = je(), f = o.collections[i];
|
|
12381
12381
|
if (!f)
|
|
12382
12382
|
throw new Error("COLLECTION_NOT_FOUND");
|
|
12383
|
-
const { labels: d, preloadCache: h } = f, m = ke(),
|
|
12384
|
-
if (!
|
|
12383
|
+
const { labels: d, preloadCache: h } = f, m = ke(), E = Object.keys(o.collections).includes(i), g = m.disabledCollections?.includes(i);
|
|
12384
|
+
if (!E || g)
|
|
12385
12385
|
throw new Error("COLLECTION_NOT_FOUND");
|
|
12386
|
-
const
|
|
12386
|
+
const _ = lt(d.collection), T = await se(m, [
|
|
12387
12387
|
"global",
|
|
12388
12388
|
"firebase",
|
|
12389
12389
|
"serverTimestampOptions"
|
|
12390
|
-
]),
|
|
12391
|
-
if (
|
|
12390
|
+
]), S = dm(r, e, l);
|
|
12391
|
+
if (S.length === 0)
|
|
12392
12392
|
throw new Error("PERMISSION_DENIED");
|
|
12393
|
-
const
|
|
12394
|
-
await oe("preOperation", m,
|
|
12395
|
-
const
|
|
12393
|
+
const P = h?.roles?.includes(a.Role), y = { collection: d.collection };
|
|
12394
|
+
await oe("preOperation", m, _, ["read", void 0, e, y]), await oe("preRead", m, _, [y, S, !1, !0]);
|
|
12395
|
+
const v = /* @__PURE__ */ new Map(), C = [];
|
|
12396
12396
|
let p = {};
|
|
12397
12397
|
const k = /* @__PURE__ */ new Map();
|
|
12398
|
-
typeof s?.relations == "object" && (s.relations.fields = s.relations.fields.map((
|
|
12399
|
-
if (typeof
|
|
12400
|
-
const
|
|
12401
|
-
if (
|
|
12402
|
-
return
|
|
12403
|
-
throw new Error(`SCHEMA_ERROR: Field ${
|
|
12404
|
-
}
|
|
12405
|
-
return
|
|
12398
|
+
typeof s?.relations == "object" && (s.relations.fields = s.relations.fields.map((F) => {
|
|
12399
|
+
if (typeof F == "string") {
|
|
12400
|
+
const M = f.fields.find((D) => D.name === F);
|
|
12401
|
+
if (M)
|
|
12402
|
+
return M;
|
|
12403
|
+
throw new Error(`SCHEMA_ERROR: Field ${F} not found in collection ${i}`);
|
|
12404
|
+
}
|
|
12405
|
+
return F;
|
|
12406
12406
|
}));
|
|
12407
|
-
const
|
|
12408
|
-
const
|
|
12409
|
-
if (
|
|
12407
|
+
const I = () => {
|
|
12408
|
+
const F = Sd(u, async () => {
|
|
12409
|
+
if (F(), p) {
|
|
12410
12410
|
if (um(p, k), !s?.noComputedFields) {
|
|
12411
|
-
const
|
|
12412
|
-
for (const
|
|
12413
|
-
|
|
12414
|
-
p && (p[
|
|
12411
|
+
const M = [];
|
|
12412
|
+
for (const D of f.fields)
|
|
12413
|
+
D.type === "Computed" && M.push(_e(() => D.formula(p)).then((Y) => {
|
|
12414
|
+
p && (p[D.name] = Y);
|
|
12415
12415
|
}));
|
|
12416
|
-
await Promise.all(
|
|
12416
|
+
await Promise.all(M);
|
|
12417
12417
|
}
|
|
12418
12418
|
if (s?.noEmbeddingFields)
|
|
12419
|
-
for (const
|
|
12420
|
-
|
|
12419
|
+
for (const M of f.fields)
|
|
12420
|
+
M.type === "Embedding" && delete p[M.name];
|
|
12421
12421
|
}
|
|
12422
12422
|
t(Oe(p));
|
|
12423
12423
|
});
|
|
12424
|
-
},
|
|
12424
|
+
}, b = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Map(), O = (F) => typeof F == "object" ? F.fields.filter((D) => typeof D == "object" && ge(D) && jt(f, o, a).includes(D.collection)) : f.fields.filter((D) => ge(D) && jt(f, o, a).includes(D.collection)), x = () => new Promise((F) => {
|
|
12425
12425
|
if (!s?.relations) {
|
|
12426
|
-
|
|
12426
|
+
F({});
|
|
12427
12427
|
return;
|
|
12428
12428
|
}
|
|
12429
|
-
const
|
|
12429
|
+
const M = Oe(s.relations), D = /* @__PURE__ */ new Map(), Y = /* @__PURE__ */ new Map(), J = O(M);
|
|
12430
12430
|
for (const W of J)
|
|
12431
|
-
for (const q of
|
|
12431
|
+
for (const q of w.values())
|
|
12432
12432
|
q.type === W.type && q.field === W.name && // eslint-disable-next-line security/detect-object-injection
|
|
12433
|
-
!p[W.name][q.id] && (q.listener(),
|
|
12433
|
+
!p[W.name][q.id] && (q.listener(), b.delete(`${W.name}_${q.id}`));
|
|
12434
12434
|
for (const W of J)
|
|
12435
12435
|
if ("collection" in W) {
|
|
12436
12436
|
const q = p[W.name];
|
|
12437
12437
|
if (!q)
|
|
12438
12438
|
continue;
|
|
12439
12439
|
for (const H of Object.keys(q))
|
|
12440
|
-
q?.[H].id || (
|
|
12440
|
+
q?.[H].id || (D.set(`${W.name}_${H}`, !1), b.has(`${W.name}_${H}`) ? Y.set(`${W.name}_${H}`, !0) : b.set(`${W.name}_${H}`, !0));
|
|
12441
12441
|
}
|
|
12442
|
-
if (
|
|
12443
|
-
|
|
12442
|
+
if (D.size === 0)
|
|
12443
|
+
F({});
|
|
12444
12444
|
else
|
|
12445
12445
|
for (const W of J)
|
|
12446
12446
|
if ("collection" in W) {
|
|
@@ -12450,7 +12450,7 @@ const Gw = async (r, e, t, n) => {
|
|
|
12450
12450
|
for (const [H, Ie] of Object.entries(q))
|
|
12451
12451
|
if (Y.has(`${W.name}_${H}`)) {
|
|
12452
12452
|
const Qe = async () => {
|
|
12453
|
-
q[H].id ? (
|
|
12453
|
+
q[H].id ? (D.set(`${W.name}_${H}`, !0), Array.from(D.values()).every((Ee) => Ee) && (F({}), I())) : setTimeout(Qe, 100);
|
|
12454
12454
|
};
|
|
12455
12455
|
Qe();
|
|
12456
12456
|
} else {
|
|
@@ -12464,17 +12464,17 @@ const Gw = async (r, e, t, n) => {
|
|
|
12464
12464
|
return;
|
|
12465
12465
|
}
|
|
12466
12466
|
if (!q?.[H]) {
|
|
12467
|
-
|
|
12467
|
+
D.set(`${W.name}_${H}`, !0), b.delete(`${W.name}_${H}`);
|
|
12468
12468
|
return;
|
|
12469
12469
|
}
|
|
12470
|
-
q[H] = j,
|
|
12470
|
+
q[H] = j, D.set(`${W.name}_${H}`, !0), Array.from(D.values()).every((ae) => ae) && (F({}), I(), oe("postOperation", m, _, [
|
|
12471
12471
|
"read",
|
|
12472
12472
|
p,
|
|
12473
12473
|
e,
|
|
12474
|
-
|
|
12475
|
-
]), oe("postRead", m,
|
|
12476
|
-
|
|
12477
|
-
|
|
12474
|
+
y
|
|
12475
|
+
]), oe("postRead", m, _, [
|
|
12476
|
+
y,
|
|
12477
|
+
S,
|
|
12478
12478
|
p,
|
|
12479
12479
|
!0
|
|
12480
12480
|
]));
|
|
@@ -12491,17 +12491,17 @@ const Gw = async (r, e, t, n) => {
|
|
|
12491
12491
|
return;
|
|
12492
12492
|
}
|
|
12493
12493
|
if (!q?.[H]) {
|
|
12494
|
-
|
|
12494
|
+
w.get(`${W.name}_${H}`) && w.get(`${W.name}_${H}`).listener(), D.set(`${W.name}_${H}`, !0), b.delete(`${W.name}_${H}`);
|
|
12495
12495
|
return;
|
|
12496
12496
|
}
|
|
12497
|
-
q[H] = j,
|
|
12497
|
+
q[H] = j, D.set(`${W.name}_${H}`, !0), Array.from(D.values()).every((ae) => ae) && (F({}), I(), oe("postOperation", m, _, [
|
|
12498
12498
|
"read",
|
|
12499
12499
|
p,
|
|
12500
12500
|
e,
|
|
12501
|
-
|
|
12502
|
-
]), oe("postRead", m,
|
|
12503
|
-
|
|
12504
|
-
|
|
12501
|
+
y
|
|
12502
|
+
]), oe("postRead", m, _, [
|
|
12503
|
+
y,
|
|
12504
|
+
S,
|
|
12505
12505
|
p,
|
|
12506
12506
|
!0
|
|
12507
12507
|
]));
|
|
@@ -12515,10 +12515,10 @@ const Gw = async (r, e, t, n) => {
|
|
|
12515
12515
|
{ ...s, relations: !1 }
|
|
12516
12516
|
).then((j) => {
|
|
12517
12517
|
if (!q?.[H]) {
|
|
12518
|
-
j(),
|
|
12518
|
+
j(), b.delete(`${W.name}_${H}`);
|
|
12519
12519
|
return;
|
|
12520
12520
|
}
|
|
12521
|
-
C.push(j),
|
|
12521
|
+
C.push(j), w.set(`${W.name}_${H}`, {
|
|
12522
12522
|
id: H,
|
|
12523
12523
|
type: W.type,
|
|
12524
12524
|
field: W.name,
|
|
@@ -12528,33 +12528,33 @@ const Gw = async (r, e, t, n) => {
|
|
|
12528
12528
|
}
|
|
12529
12529
|
}
|
|
12530
12530
|
});
|
|
12531
|
-
for (const
|
|
12532
|
-
const
|
|
12533
|
-
if (
|
|
12534
|
-
const Y =
|
|
12535
|
-
if (
|
|
12536
|
-
const W =
|
|
12531
|
+
for (const F of S) {
|
|
12532
|
+
const M = dr(F, { source: s?.only || (P ? "cache" : "default") }, (D) => {
|
|
12533
|
+
if (D.exists()) {
|
|
12534
|
+
const Y = D.data({ serverTimestamps: T || "none" });
|
|
12535
|
+
if (v.has(F.path) && s?.relations) {
|
|
12536
|
+
const W = O(s?.relations);
|
|
12537
12537
|
for (const q of W)
|
|
12538
12538
|
"collection" in q && Y[q.name] && (Y[q.name] = p?.[q.name]);
|
|
12539
12539
|
}
|
|
12540
|
-
|
|
12541
|
-
const J = k.get(
|
|
12542
|
-
lm(Y, J), k.set(
|
|
12543
|
-
|
|
12540
|
+
v.set(F.path, !0), p ||= {}, p.id ||= D.id, p = { ...p, ...Y }, delete p.Collection_Path_String;
|
|
12541
|
+
const J = k.get(F) || /* @__PURE__ */ new Set();
|
|
12542
|
+
lm(Y, J), k.set(F, J), v.size === S.length && x().then(() => {
|
|
12543
|
+
I(), oe("postOperation", m, _, [
|
|
12544
12544
|
"read",
|
|
12545
12545
|
p,
|
|
12546
12546
|
e,
|
|
12547
|
-
|
|
12548
|
-
]), oe("postRead", m,
|
|
12547
|
+
y
|
|
12548
|
+
]), oe("postRead", m, _, [y, S, p, !0]);
|
|
12549
12549
|
});
|
|
12550
|
-
} else p && (p = void 0,
|
|
12551
|
-
}, (
|
|
12552
|
-
n && n(
|
|
12550
|
+
} else p && (p = void 0, I(), oe("postOperation", m, _, ["read", void 0, e, y]), oe("postRead", m, _, [y, S, void 0, !0]));
|
|
12551
|
+
}, (D) => {
|
|
12552
|
+
n && n(D), C.forEach((Y) => Y());
|
|
12553
12553
|
});
|
|
12554
|
-
C.push(
|
|
12554
|
+
C.push(M);
|
|
12555
12555
|
}
|
|
12556
12556
|
return () => {
|
|
12557
|
-
C.forEach((
|
|
12557
|
+
C.forEach((F) => F());
|
|
12558
12558
|
};
|
|
12559
12559
|
}, Ja = (r) => {
|
|
12560
12560
|
const e = r.first.values().next().value?.id;
|
|
@@ -12579,25 +12579,25 @@ const Gw = async (r, e, t, n) => {
|
|
|
12579
12579
|
const a = De();
|
|
12580
12580
|
if (!a?.Role)
|
|
12581
12581
|
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:
|
|
12583
|
-
if (!
|
|
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(), _ = Object.keys(o.collections).includes(i), T = g.disabledCollections?.includes(i);
|
|
12583
|
+
if (!_ || T)
|
|
12584
12584
|
throw new Error("COLLECTION_NOT_FOUND");
|
|
12585
|
-
const
|
|
12585
|
+
const S = lt(d.collection), P = await se(g, [
|
|
12586
12586
|
"global",
|
|
12587
12587
|
"firebase",
|
|
12588
12588
|
"serverTimestampOptions"
|
|
12589
|
-
]),
|
|
12589
|
+
]), y = h?.roles?.includes(a.Role);
|
|
12590
12590
|
if (s?.pagination?.number !== void 0) {
|
|
12591
12591
|
const j = s.pagination.number;
|
|
12592
12592
|
if (typeof j != "number" || !Number.isFinite(j) || !Number.isInteger(j) || j < 1)
|
|
12593
12593
|
throw new Error("INPUT_ERROR: Pagination number must be a positive finite integer");
|
|
12594
12594
|
}
|
|
12595
|
-
const
|
|
12596
|
-
if (
|
|
12595
|
+
const A = oc(r, l, s?.getAll);
|
|
12596
|
+
if (A.length === 0)
|
|
12597
12597
|
return { pages: 0, count: 0, unsubscribe: () => {
|
|
12598
12598
|
} };
|
|
12599
|
-
let
|
|
12600
|
-
const
|
|
12599
|
+
let R = A.map((j) => he(j, ...e));
|
|
12600
|
+
const v = s?.pagination?.startAfter || s?.pagination?.endBefore || s?.pagination?.startAt || s?.pagination?.endAt || {
|
|
12601
12601
|
first: /* @__PURE__ */ new Map(),
|
|
12602
12602
|
last: /* @__PURE__ */ new Map()
|
|
12603
12603
|
};
|
|
@@ -12607,59 +12607,59 @@ const Gw = async (r, e, t, n) => {
|
|
|
12607
12607
|
const j = s.pagination.startAfter || s.pagination.endBefore || s.pagination.startAt || s.pagination.endAt, ae = Ud(a.Role, f, o);
|
|
12608
12608
|
if (j && ae !== !0)
|
|
12609
12609
|
throw new Error("INPUT_ERROR: Pagination is not allowed when using " + ae);
|
|
12610
|
-
s.pagination.startAfter || s.pagination.endBefore || s.pagination.startAt || s.pagination.endAt ? s.pagination.startAfter ? (Qa(s.pagination.startAfter),
|
|
12610
|
+
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
12611
|
if (!s.pagination?.orderByField || !s.pagination.orderByDirection)
|
|
12612
12612
|
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(
|
|
12613
|
+
let U = he(z, rt(s.pagination.orderByField, s.pagination.orderByDirection), eo(v.last.get(Q)));
|
|
12614
12614
|
return s.pagination.number && (U = he(U, Xt(s.pagination.number))), U;
|
|
12615
|
-
})) : s.pagination.endBefore ? (Ja(s.pagination.endBefore),
|
|
12615
|
+
})) : s.pagination.endBefore ? (Ja(s.pagination.endBefore), R = R.map((z, Q) => {
|
|
12616
12616
|
if (!s.pagination?.orderByField || !s.pagination.orderByDirection)
|
|
12617
12617
|
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(
|
|
12618
|
+
let U = he(z, rt(s.pagination.orderByField, s.pagination.orderByDirection), to(v.first.get(Q)));
|
|
12619
12619
|
return s.pagination.number && (U = he(U, Nr(s.pagination.number))), U;
|
|
12620
|
-
})) : s.pagination.startAt ? (Ja(s.pagination.startAt),
|
|
12620
|
+
})) : s.pagination.startAt ? (Ja(s.pagination.startAt), R = R.map((z, Q) => {
|
|
12621
12621
|
if (!s.pagination?.orderByField || !s.pagination.orderByDirection)
|
|
12622
12622
|
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(
|
|
12623
|
+
let U = he(z, rt(s.pagination.orderByField, s.pagination.orderByDirection), ap(v.first.get(Q)));
|
|
12624
12624
|
return s.pagination.number && (U = he(U, Nr(s.pagination.number))), U;
|
|
12625
|
-
})) : s.pagination.endAt && (Qa(s.pagination.endAt),
|
|
12625
|
+
})) : s.pagination.endAt && (Qa(s.pagination.endAt), R = R.map((z, Q) => {
|
|
12626
12626
|
if (!s.pagination?.orderByField || !s.pagination.orderByDirection)
|
|
12627
12627
|
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(
|
|
12628
|
+
let U = he(z, rt(s.pagination.orderByField, s.pagination.orderByDirection), op(v.last.get(Q)));
|
|
12629
12629
|
return s.pagination.number && (U = he(U, Nr(s.pagination.number))), U;
|
|
12630
|
-
})) :
|
|
12630
|
+
})) : R = R.map((z) => {
|
|
12631
12631
|
let Q = he(z);
|
|
12632
12632
|
return s.pagination?.orderByField && s.pagination.orderByDirection && (Q = he(z, rt(s.pagination.orderByField, s.pagination.orderByDirection))), s.pagination.number && (Q = he(Q, Xt(s.pagination.number))), Q;
|
|
12633
12633
|
});
|
|
12634
12634
|
}
|
|
12635
12635
|
const C = { collection: d.collection };
|
|
12636
|
-
await oe("preOperation",
|
|
12637
|
-
let
|
|
12638
|
-
const
|
|
12636
|
+
await oe("preOperation", g, S, ["read", void 0, void 0, C]), await oe("preRead", g, S, [C, R, !0, !0]);
|
|
12637
|
+
let I = !0;
|
|
12638
|
+
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
12639
|
const Q = [];
|
|
12640
|
-
|
|
12641
|
-
um(U,
|
|
12640
|
+
x.forEach((U) => {
|
|
12641
|
+
um(U, F.get(U.id));
|
|
12642
12642
|
for (const G of f.fields)
|
|
12643
12643
|
G.type === "Computed" && !s?.noComputedFields && Q.push(_e(G.formula, [U, z]).then((Se) => {
|
|
12644
12644
|
U[G.name] = Se;
|
|
12645
12645
|
})), s?.noEmbeddingFields && G.type === "Embedding" && delete U[G.name];
|
|
12646
12646
|
}), Promise.all(Q).then(() => {
|
|
12647
|
-
t(Array.from(
|
|
12647
|
+
t(Array.from(x.values()), j, ae), x.forEach((U) => {
|
|
12648
12648
|
const G = ["read", U, U.id, C];
|
|
12649
|
-
oe("postOperation",
|
|
12649
|
+
oe("postOperation", g, S, G), oe("postRead", g, S, [C, A, U, !0]);
|
|
12650
12650
|
});
|
|
12651
12651
|
});
|
|
12652
12652
|
}, Y = (j, ae) => {
|
|
12653
12653
|
let z = !0;
|
|
12654
|
-
if (s?.relations &&
|
|
12655
|
-
const U =
|
|
12654
|
+
if (s?.relations && x.forEach((Q) => {
|
|
12655
|
+
const U = w.get(Q.id);
|
|
12656
12656
|
U === "loaded" || U === "deleted" || (z = !1);
|
|
12657
|
-
}),
|
|
12658
|
-
|
|
12657
|
+
}), b.size === R.length && z) {
|
|
12658
|
+
I = !1;
|
|
12659
12659
|
const Q = Sd(u, () => {
|
|
12660
|
-
Q(), !s?.noComputedFields &&
|
|
12661
|
-
|
|
12662
|
-
}) :
|
|
12660
|
+
Q(), !s?.noComputedFields && S?.admin?.retriever ? _e(S.admin.retriever).then((U) => {
|
|
12661
|
+
D(j, ae, U);
|
|
12662
|
+
}) : D(j, ae);
|
|
12663
12663
|
});
|
|
12664
12664
|
}
|
|
12665
12665
|
};
|
|
@@ -12676,13 +12676,13 @@ const Gw = async (r, e, t, n) => {
|
|
|
12676
12676
|
if (!j)
|
|
12677
12677
|
return;
|
|
12678
12678
|
const z = j.id;
|
|
12679
|
-
|
|
12679
|
+
w.set(z, "loading"), W[z] ||= /* @__PURE__ */ new Map();
|
|
12680
12680
|
const Q = Oe(s?.relations), U = typeof Q == "object" ? Q.fields.filter((K) => typeof K == "object" && ge(K) && jt(f, o, a).includes(K.collection)) : f.fields.filter((K) => ge(K) && jt(f, o, a).includes(K.collection)), G = /* @__PURE__ */ new Map(), Se = /* @__PURE__ */ new Map();
|
|
12681
12681
|
J[z] ||= /* @__PURE__ */ new Map();
|
|
12682
12682
|
for (const K of U)
|
|
12683
12683
|
for (const ye of W[z].entries()) {
|
|
12684
12684
|
const [ne, Xe] = ye;
|
|
12685
|
-
Xe.doc === z && Xe.type === K.type && Xe.field === K.name && (!
|
|
12685
|
+
Xe.doc === z && Xe.type === K.type && Xe.field === K.name && (!x.has(z) || // eslint-disable-next-line security/detect-object-injection
|
|
12686
12686
|
!j[K.name][ne]) && (Xe.listener(), J[z].delete(ne));
|
|
12687
12687
|
}
|
|
12688
12688
|
for (const K of U)
|
|
@@ -12694,7 +12694,7 @@ const Gw = async (r, e, t, n) => {
|
|
|
12694
12694
|
!ye?.[ne].id && !J[z].has(ne) && (G.set(ne, !1), J[z].has(ne) ? Se.set(ne, !0) : J[z].set(ne, !0));
|
|
12695
12695
|
}
|
|
12696
12696
|
if (G.size === 0)
|
|
12697
|
-
|
|
12697
|
+
w.set(z, "loaded"), Y(ae);
|
|
12698
12698
|
else
|
|
12699
12699
|
for (const K of U)
|
|
12700
12700
|
if ("collection" in K) {
|
|
@@ -12704,7 +12704,7 @@ const Gw = async (r, e, t, n) => {
|
|
|
12704
12704
|
for (const [ne, Xe] of Object.entries(ye))
|
|
12705
12705
|
if (Se.has(ne)) {
|
|
12706
12706
|
const ut = async () => {
|
|
12707
|
-
ye[ne].id ? (G.set(ne, !0), Array.from(G.values()).every((We) => We) &&
|
|
12707
|
+
ye[ne].id ? (G.set(ne, !0), Array.from(G.values()).every((We) => We) && w.set(z, "loaded")) : setTimeout(ut, 100);
|
|
12708
12708
|
};
|
|
12709
12709
|
ut();
|
|
12710
12710
|
} else {
|
|
@@ -12714,11 +12714,11 @@ const Gw = async (r, e, t, n) => {
|
|
|
12714
12714
|
delete ye[ne];
|
|
12715
12715
|
return;
|
|
12716
12716
|
}
|
|
12717
|
-
if (!
|
|
12717
|
+
if (!x.has(z) || !ye?.[ne]) {
|
|
12718
12718
|
G.set(ne, !0), J[z].delete(ne);
|
|
12719
12719
|
return;
|
|
12720
12720
|
}
|
|
12721
|
-
ye[ne] = Te, G.set(ne, !0), Array.from(G.values()).every((wr) => wr) && (
|
|
12721
|
+
ye[ne] = Te, G.set(ne, !0), Array.from(G.values()).every((wr) => wr) && (w.set(z, "loaded"), Y(ae));
|
|
12722
12722
|
}).catch((Te) => {
|
|
12723
12723
|
delete ye[ne], Te.code !== "permission-denied" && n && n(new Error(`Error fetching relation document in collection ${K.collection} with ID ${z} at location ${Xe.Collection_Path?.join("/")}`, {
|
|
12724
12724
|
cause: Te
|
|
@@ -12731,11 +12731,11 @@ const Gw = async (r, e, t, n) => {
|
|
|
12731
12731
|
delete ye[ne];
|
|
12732
12732
|
return;
|
|
12733
12733
|
}
|
|
12734
|
-
if (!
|
|
12734
|
+
if (!x.has(z) || !ye?.[ne]) {
|
|
12735
12735
|
W[z].has(ne) && W[z].get(ne)?.listener(), G.set(ne, !0), J[z].delete(ne);
|
|
12736
12736
|
return;
|
|
12737
12737
|
}
|
|
12738
|
-
ye[ne] = Te, G.set(ne, !0), Array.from(G.values()).every((wr) => wr) && (
|
|
12738
|
+
ye[ne] = Te, G.set(ne, !0), Array.from(G.values()).every((wr) => wr) && (w.set(z, "loaded"), Y(ae));
|
|
12739
12739
|
},
|
|
12740
12740
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12741
12741
|
(Te) => {
|
|
@@ -12745,11 +12745,11 @@ const Gw = async (r, e, t, n) => {
|
|
|
12745
12745
|
},
|
|
12746
12746
|
{ ...s, relations: !1 }
|
|
12747
12747
|
).then((Te) => {
|
|
12748
|
-
if (!
|
|
12748
|
+
if (!x.has(z) || !ye?.[ne]) {
|
|
12749
12749
|
Te(), J[z].delete(ne);
|
|
12750
12750
|
return;
|
|
12751
12751
|
}
|
|
12752
|
-
|
|
12752
|
+
O.push(Te), W[z].set(ne, {
|
|
12753
12753
|
doc: z,
|
|
12754
12754
|
type: K.type,
|
|
12755
12755
|
field: K.name,
|
|
@@ -12768,32 +12768,32 @@ const Gw = async (r, e, t, n) => {
|
|
|
12768
12768
|
}
|
|
12769
12769
|
}, Ie = (j, ae, z) => {
|
|
12770
12770
|
const Q = z.data({
|
|
12771
|
-
serverTimestamps:
|
|
12771
|
+
serverTimestamps: P || "none"
|
|
12772
12772
|
});
|
|
12773
12773
|
ae.id ||= z.id, ae = { ...ae, ...Q }, delete ae.Collection_Path_String;
|
|
12774
|
-
const U =
|
|
12775
|
-
lm(Q, G), U.set(j, G),
|
|
12776
|
-
}, Qe = s?.only === "cache" ||
|
|
12777
|
-
for (const j of
|
|
12774
|
+
const U = F.get(z.id) || /* @__PURE__ */ new Map(), G = U.get(j) || /* @__PURE__ */ new Set();
|
|
12775
|
+
lm(Q, G), U.set(j, G), F.set(z.id, U), x.set(z.id, ae);
|
|
12776
|
+
}, Qe = s?.only === "cache" || y;
|
|
12777
|
+
for (const j of R) {
|
|
12778
12778
|
let ae = !0;
|
|
12779
12779
|
const z = dr(j, { source: Qe ? "cache" : "default", includeMetadataChanges: !0 }, (Q) => {
|
|
12780
|
-
(Qe || Q.metadata.fromCache === !1) && (
|
|
12781
|
-
const G =
|
|
12782
|
-
|
|
12780
|
+
(Qe || Q.metadata.fromCache === !1) && (b.set(j, !0), v.first.set(R.indexOf(j), Q.docs[0]), v.last.set(R.indexOf(j), Q.docs.at(-1) || Q.docs[0]), I && s?.relations || Y(v, Q.metadata)), b.get(j) === !0 && (ae ? (Q.docs.forEach((U) => {
|
|
12781
|
+
const G = x.get(U.id) || {}, Se = M.get(U.id) || 0;
|
|
12782
|
+
M.set(U.id, Se + 1), Ie(j, G, U);
|
|
12783
12783
|
}), ae = !1) : Q.docChanges().forEach((U) => {
|
|
12784
|
-
const G =
|
|
12785
|
-
U.type === "added" &&
|
|
12786
|
-
}),
|
|
12787
|
-
q(U,
|
|
12784
|
+
const G = x.get(U.doc.id) || {}, Se = M.get(U.doc.id) || 0;
|
|
12785
|
+
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(v, Q.metadata), x.forEach((U) => {
|
|
12787
|
+
q(U, v);
|
|
12788
12788
|
})));
|
|
12789
12789
|
}, (Q) => {
|
|
12790
|
-
n && n(new Error(`Error fetching documents at location ${r.join("/")}`, { cause: Q })),
|
|
12790
|
+
n && n(new Error(`Error fetching documents at location ${r.join("/")}`, { cause: Q })), O.forEach((U) => U());
|
|
12791
12791
|
});
|
|
12792
|
-
|
|
12792
|
+
O.push(z);
|
|
12793
12793
|
}
|
|
12794
12794
|
let Ee, Ve;
|
|
12795
|
-
if (s?.pagination && !h?.roles.includes(a.Role) && !
|
|
12796
|
-
let j = he(
|
|
12795
|
+
if (s?.pagination && !h?.roles.includes(a.Role) && !E?.includes(a.Role)) {
|
|
12796
|
+
let j = he(A[0], ...e);
|
|
12797
12797
|
s.pagination.orderByField && s.pagination.orderByDirection && (j = he(j, rt(s.pagination.orderByField, s.pagination.orderByDirection)));
|
|
12798
12798
|
const ae = await Ed(j).catch(() => {
|
|
12799
12799
|
});
|
|
@@ -12804,7 +12804,7 @@ const Gw = async (r, e, t, n) => {
|
|
|
12804
12804
|
}
|
|
12805
12805
|
}
|
|
12806
12806
|
return { pages: Ve, count: Ee, unsubscribe: (j) => {
|
|
12807
|
-
j === "first" && Ja(
|
|
12807
|
+
j === "first" && Ja(v), j === "last" && Qa(v), O.forEach((ae) => ae());
|
|
12808
12808
|
} };
|
|
12809
12809
|
}, ib = async (r, e) => {
|
|
12810
12810
|
const t = it(), n = Ue(), s = $e(t, n.STOKER_FB_FUNCTIONS_REGION);
|
|
@@ -12828,19 +12828,19 @@ const Gw = async (r, e, t, n) => {
|
|
|
12828
12828
|
await Fw(e, t, n, s, i, a);
|
|
12829
12829
|
return;
|
|
12830
12830
|
}
|
|
12831
|
-
const f = Ha(r), d = cw(e), h = t ? pd(t) : void 0, m = n ? pd(n) : void 0,
|
|
12832
|
-
if (
|
|
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, _ = a ? Tn(a) : void 0, T = c ? Tn(c) : void 0, S = Array.isArray(f) ? f : [f];
|
|
12832
|
+
if (S.length === 0 || S.length === 1 && !S[0])
|
|
12833
12833
|
throw new Error("No valid email addresses provided");
|
|
12834
|
-
const
|
|
12835
|
-
if (h && (
|
|
12836
|
-
const
|
|
12837
|
-
|
|
12834
|
+
const P = je(), y = { to: f, message: { subject: d } };
|
|
12835
|
+
if (h && (y.message.text = h), m && (y.message.html = m), E) {
|
|
12836
|
+
const A = Array.isArray(E) ? E : [E];
|
|
12837
|
+
A.length > 0 && A[0] && (y.cc = E);
|
|
12838
12838
|
}
|
|
12839
|
-
if (
|
|
12840
|
-
const
|
|
12841
|
-
|
|
12839
|
+
if (g) {
|
|
12840
|
+
const A = Array.isArray(g) ? g : [g];
|
|
12841
|
+
A.length > 0 && A[0] && (y.bcc = g);
|
|
12842
12842
|
}
|
|
12843
|
-
|
|
12843
|
+
_ && (y.replyTo = _), o && (y.message.attachments = o), T && (y.from = T), await Td(qr(P, "system_mail"), y);
|
|
12844
12844
|
}, Dw = async (r) => {
|
|
12845
12845
|
const e = it(), t = Ue(), n = $e(e, t.STOKER_FB_FUNCTIONS_REGION);
|
|
12846
12846
|
await Ye(n, "stoker-adminsms")({
|