@stoker-platform/web-client 0.5.88 → 0.5.90
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 +93 -93
- package/package.json +3 -3
package/dist/bundle.js
CHANGED
|
@@ -8,10 +8,10 @@ import { getFunctions as Ue, httpsCallable as Je, connectFunctionsEmulator as mp
|
|
|
8
8
|
import { ReCaptchaEnterpriseProvider as pp, initializeAppCheck as Yn, onTokenChanged as Jn } from "firebase/app-check";
|
|
9
9
|
import { getPerformance as gp } from "firebase/performance";
|
|
10
10
|
import { getRemoteConfig as yp, fetchAndActivate as _p } from "firebase/remote-config";
|
|
11
|
-
const vp = "0.5.
|
|
11
|
+
const vp = "0.5.89", wp = (t) => !!t.auth, ct = (t, e) => {
|
|
12
12
|
if (e?.operations)
|
|
13
13
|
return e.operations.includes(t);
|
|
14
|
-
}, Nn = (t, e) => e ? e.Role ? t.access?.includes(e.Role) : !1 : !0, bp = (t, e) => e ? !e.Role || t.restrictCreate === !0 ? !1 : typeof t.restrictCreate == "object" ? t.restrictCreate?.includes(e.Role) : !0 : !0, Op = (t, e) => e ? !e.Role || t.restrictUpdate === !0 ? !1 : typeof t.restrictUpdate == "object" ? t.restrictUpdate?.includes(e.Role) : !0 : !0, te = (t, e) => t.filter((r) => r.name === e)[0],
|
|
14
|
+
}, Nn = (t, e) => e ? e.Role ? t.access?.includes(e.Role) : !1 : !0, bp = (t, e) => e ? !e.Role || t.restrictCreate === !0 ? !1 : typeof t.restrictCreate == "object" ? t.restrictCreate?.includes(e.Role) : !0 : !0, Op = (t, e) => e ? !e.Role || t.restrictUpdate === !0 ? !1 : typeof t.restrictUpdate == "object" ? t.restrictUpdate?.includes(e.Role) : !0 : !0, te = (t, e) => t.filter((r) => r.name === e)[0], we = (t) => ["OneToOne", "OneToMany", "ManyToOne", "ManyToMany"].includes(t.type), xd = (t, e) => {
|
|
15
15
|
const r = {
|
|
16
16
|
Record_Owner: "recordOwner",
|
|
17
17
|
Record_User: "recordUser",
|
|
@@ -36,7 +36,7 @@ const vp = "0.5.87", wp = (t) => !!t.auth, ct = (t, e) => {
|
|
|
36
36
|
if (!a.roles.some((h) => h.role === r.Role))
|
|
37
37
|
return;
|
|
38
38
|
const o = a.collectionField, c = te(t.fields, o);
|
|
39
|
-
if (!
|
|
39
|
+
if (!we(c))
|
|
40
40
|
throw new Error("PERMISSION_DENIED");
|
|
41
41
|
const l = r.collections?.[c.collection], f = e.collections[c.collection].access.entityRestrictions;
|
|
42
42
|
if (!f)
|
|
@@ -53,7 +53,7 @@ const vp = "0.5.87", wp = (t) => !!t.auth, ct = (t, e) => {
|
|
|
53
53
|
for (const a of n) {
|
|
54
54
|
const { fields: o } = a;
|
|
55
55
|
for (const c of o)
|
|
56
|
-
if (!(c.access && !Nn(c, r)) && r.Role &&
|
|
56
|
+
if (!(c.access && !Nn(c, r)) && r.Role && we(c) && c.collection === s.collection && c.dependencyFields)
|
|
57
57
|
for (const l of c.dependencyFields)
|
|
58
58
|
!i.find((f) => f.field === l.field) && l.roles.includes(r.Role) && i.push(l);
|
|
59
59
|
}
|
|
@@ -155,7 +155,7 @@ const vp = "0.5.87", wp = (t) => !!t.auth, ct = (t, e) => {
|
|
|
155
155
|
}, $t = (t, e, r) => {
|
|
156
156
|
const n = [];
|
|
157
157
|
for (const s of t.fields)
|
|
158
|
-
if (
|
|
158
|
+
if (we(s)) {
|
|
159
159
|
if (s.access && (!r || !Nn(s, r)) || !e.collections[s.collection])
|
|
160
160
|
continue;
|
|
161
161
|
const a = r?.collections?.[s.collection];
|
|
@@ -1305,7 +1305,7 @@ const Og = /* @__PURE__ */ Dn(bg), Eg = (t, e, r, n, s, i, a, o, c) => {
|
|
|
1305
1305
|
if (!i.roles.some((l) => l.role === t))
|
|
1306
1306
|
continue;
|
|
1307
1307
|
const a = te(e.fields, i.collectionField);
|
|
1308
|
-
if (!
|
|
1308
|
+
if (!we(a))
|
|
1309
1309
|
throw new Error("PERMISSION_DENIED");
|
|
1310
1310
|
const c = r.collections[a.collection].access.entityRestrictions?.restrictions?.find((l) => l.type === i.type && l.roles.some((u) => u.role === t));
|
|
1311
1311
|
if (!c)
|
|
@@ -1937,7 +1937,7 @@ const uy = /* @__PURE__ */ Dn(ly), Pr = {
|
|
|
1937
1937
|
collections: {}
|
|
1938
1938
|
}, fy = () => {
|
|
1939
1939
|
Pr.global = {}, Pr.collections = {};
|
|
1940
|
-
},
|
|
1940
|
+
}, be = async (t, e) => {
|
|
1941
1941
|
let r = t;
|
|
1942
1942
|
return t && (typeof t == "function" || typeof t.then == "function") && (e ? r = await t(...e) : r = await t()), r;
|
|
1943
1943
|
}, ne = async (t, e, r, n) => {
|
|
@@ -1964,7 +1964,7 @@ const uy = /* @__PURE__ */ Dn(ly), Pr = {
|
|
|
1964
1964
|
o = o[u];
|
|
1965
1965
|
}
|
|
1966
1966
|
let l;
|
|
1967
|
-
if (c && (l = await
|
|
1967
|
+
if (c && (l = await be(o, r)), l) {
|
|
1968
1968
|
let u = Pr;
|
|
1969
1969
|
const f = {};
|
|
1970
1970
|
for (let d = 0; d < e.length; d++) {
|
|
@@ -1984,7 +1984,7 @@ const uy = /* @__PURE__ */ Dn(ly), Pr = {
|
|
|
1984
1984
|
for (const a of n) {
|
|
1985
1985
|
const { fields: o } = a;
|
|
1986
1986
|
for (const c of o)
|
|
1987
|
-
if (
|
|
1987
|
+
if (we(c) && c.collection === s.collection && c.dependencyFields)
|
|
1988
1988
|
for (const l of c.dependencyFields)
|
|
1989
1989
|
l.field === t.name && (i = !0);
|
|
1990
1990
|
}
|
|
@@ -1994,7 +1994,7 @@ const uy = /* @__PURE__ */ Dn(ly), Pr = {
|
|
|
1994
1994
|
return r.forEach((i) => {
|
|
1995
1995
|
const { labels: a, fields: o } = i;
|
|
1996
1996
|
o.forEach((c) => {
|
|
1997
|
-
|
|
1997
|
+
we(c) && c.collection === n.collection && c.dependencyFields && c.dependencyFields.forEach((l) => {
|
|
1998
1998
|
s[l.field] ||= {}, s[l.field][a.collection] ||= [], s[l.field][a.collection] = s[l.field][a.collection].concat(l.roles), s[l.field][a.collection] = [
|
|
1999
1999
|
...new Set(s[l.field][a.collection])
|
|
2000
2000
|
];
|
|
@@ -2128,7 +2128,7 @@ const uy = /* @__PURE__ */ Dn(ly), Pr = {
|
|
|
2128
2128
|
if (Object.values(o).forEach((c) => {
|
|
2129
2129
|
Object.keys(c).forEach((l) => {
|
|
2130
2130
|
r.collections[l].fields.forEach((f) => {
|
|
2131
|
-
|
|
2131
|
+
we(f) && f.collection === e.labels.collection && f.dependencyFields?.some((d) => d.field === t.name) && f.constraints && f.constraints.forEach((d) => {
|
|
2132
2132
|
a.push(d[0]);
|
|
2133
2133
|
});
|
|
2134
2134
|
});
|
|
@@ -2147,7 +2147,7 @@ const uy = /* @__PURE__ */ Dn(ly), Pr = {
|
|
|
2147
2147
|
}), s;
|
|
2148
2148
|
}, Oa = async (t, e, r) => {
|
|
2149
2149
|
if (e) {
|
|
2150
|
-
const n = await
|
|
2150
|
+
const n = await be(e, [r]);
|
|
2151
2151
|
if (n === !1)
|
|
2152
2152
|
throw new Error(`CANCELLED: Operation cancelled by ${t}`);
|
|
2153
2153
|
return n;
|
|
@@ -2165,10 +2165,10 @@ const Qo = (t, e, r, n, s, i, a, o, c, l) => (t === "create" && (r.Collection_Pa
|
|
|
2165
2165
|
if (n)
|
|
2166
2166
|
for (const a of n) {
|
|
2167
2167
|
const o = te(e, a.field);
|
|
2168
|
-
e.find((c) => c.name === a.field) &&
|
|
2168
|
+
e.find((c) => c.name === a.field) && we(o) && ["OneToOne", "OneToMany"].includes(o.type) && i.add(o);
|
|
2169
2169
|
}
|
|
2170
2170
|
return e.forEach((a) => {
|
|
2171
|
-
|
|
2171
|
+
we(a) && ["OneToOne", "OneToMany"].includes(a.type) && a.sorting && (typeof a.sorting == "boolean" || !a.sorting.roles?.every((o) => s?.includes(o))) && i.add(a);
|
|
2172
2172
|
}), i;
|
|
2173
2173
|
}, Hr = (t, e) => {
|
|
2174
2174
|
const { access: r, recordTitleField: n } = t, { serverReadOnly: s } = r, i = /* @__PURE__ */ new Set();
|
|
@@ -2186,7 +2186,7 @@ const Qo = (t, e, r, n, s, i, a, o, c, l) => (t === "create" && (r.Collection_Pa
|
|
|
2186
2186
|
}, Mr = (t, e, r) => {
|
|
2187
2187
|
const { fields: n } = t;
|
|
2188
2188
|
n.forEach((i) => {
|
|
2189
|
-
if (
|
|
2189
|
+
if (we(i))
|
|
2190
2190
|
if (e[i.name]) {
|
|
2191
2191
|
if (ar(e[i.name]))
|
|
2192
2192
|
e[`${i.name}_Array`] = e[i.name];
|
|
@@ -2222,10 +2222,10 @@ const Qo = (t, e, r, n, s, i, a, o, c, l) => (t === "create" && (r.Collection_Pa
|
|
|
2222
2222
|
const { fields: s } = e;
|
|
2223
2223
|
for (const i of r.fields) {
|
|
2224
2224
|
const a = te(s, i.name);
|
|
2225
|
-
i.custom?.initialValue !== void 0 && !(n && a.access && !a.access.includes(n)) && (t[i.name] = await
|
|
2225
|
+
i.custom?.initialValue !== void 0 && !(n && a.access && !a.access.includes(n)) && (t[i.name] = await be(i.custom.initialValue, [t]), Hr(e, [a]).size === 1 && (t[`${i.name}_Lowercase`] = t[i.name].toLowerCase()));
|
|
2226
2226
|
}
|
|
2227
2227
|
for (const i of s)
|
|
2228
|
-
n && i.access && !i.access.includes(n) || ("autoIncrement" in i && i.autoIncrement && !t[i.name] && (t[i.name] = "Pending"), !
|
|
2228
|
+
n && i.access && !i.access.includes(n) || ("autoIncrement" in i && i.autoIncrement && !t[i.name] && (t[i.name] = "Pending"), !we(i) && i.nullable && t[i.name] === void 0 && (t[i.name] = null));
|
|
2229
2229
|
};
|
|
2230
2230
|
var fe;
|
|
2231
2231
|
(function(t) {
|
|
@@ -4946,7 +4946,7 @@ const un = () => jt().refine((t) => t && (t.seconds !== void 0 && t.nanoseconds
|
|
|
4946
4946
|
i = jt();
|
|
4947
4947
|
break;
|
|
4948
4948
|
}
|
|
4949
|
-
return !
|
|
4949
|
+
return !we(e) && e.nullable && (i = i.nullable()), e.required || (i = i.optional()), i;
|
|
4950
4950
|
}, Hy = (t, e, r) => {
|
|
4951
4951
|
const n = {
|
|
4952
4952
|
Collection_Path: Un(at()),
|
|
@@ -4963,7 +4963,7 @@ const un = () => jt().refine((t) => t && (t.seconds !== void 0 && t.nanoseconds
|
|
|
4963
4963
|
t === "create" && (n.Saved_At = Of()), t === "update" && (n.Saved_At = un(), n.Collection_Path = n.Collection_Path.optional(), n.id = n.id.optional(), n.Created_At = n.Created_At.optional(), n.Saved_At = n.Saved_At.optional(), n.Created_By = n.Created_By.optional());
|
|
4964
4964
|
const s = nh(e, e.fields), i = Array.from(s).map((c) => c.name);
|
|
4965
4965
|
e.fields.forEach((c) => {
|
|
4966
|
-
|
|
4966
|
+
we(c) ? (n[c.name] = Zy(c, r), n[`${c.name}_Array`] = Gy(c), i.includes(c.name) && (n[`${c.name}_Single`] = lh(c, r, !0), c.required || (n[`${c.name}_Single`] = n[`${c.name}_Single`].optional())), c.length && (n[c.name] = n[c.name].refine((l) => c.length && l && Object.keys(l).length === c.length, {
|
|
4967
4967
|
message: `Value must contain ${c.length} item(s)`
|
|
4968
4968
|
})), c.min && (n[c.name] = n[c.name].refine((l) => c.min && l && Object.keys(l).length >= c.min, {
|
|
4969
4969
|
message: `Value must contain at least ${c.min} item(s)`
|
|
@@ -10490,7 +10490,7 @@ function Er(t) {
|
|
|
10490
10490
|
}
|
|
10491
10491
|
const Xf = async (t, e) => {
|
|
10492
10492
|
if (t) {
|
|
10493
|
-
const r = await
|
|
10493
|
+
const r = await be(t, [e]);
|
|
10494
10494
|
if (!r.valid)
|
|
10495
10495
|
throw new Error(r.message);
|
|
10496
10496
|
}
|
|
@@ -10509,8 +10509,8 @@ const Xf = async (t, e) => {
|
|
|
10509
10509
|
}), y.forEach((_) => {
|
|
10510
10510
|
if (dy(_, a, i)) {
|
|
10511
10511
|
const N = py(_, a, i), v = {};
|
|
10512
|
-
s[_.name] !== void 0 && (v[_.name] = s[_.name],
|
|
10513
|
-
s[w.name] !== void 0 && (
|
|
10512
|
+
s[_.name] !== void 0 && (v[_.name] = s[_.name], we(_) && (v[`${_.name}_Array`] = s[`${_.name}_Array`])), N.forEach((w) => {
|
|
10513
|
+
s[w.name] !== void 0 && (we(w) ? v[`${w.name}_Array`] = s[`${w.name}_Array`] : v[w.name] = s[w.name]);
|
|
10514
10514
|
}), Object.keys(v).length > 0 && (t === "create" && (v.Collection_Path = r, v.Collection_Path_String = r.join("/"), e.set(d(_), v)), t === "update" && e.update(d(_), v), t === "delete" && e.delete(d(_)));
|
|
10515
10515
|
}
|
|
10516
10516
|
});
|
|
@@ -10523,7 +10523,7 @@ const Xf = async (t, e) => {
|
|
|
10523
10523
|
}
|
|
10524
10524
|
if (t === "delete")
|
|
10525
10525
|
return;
|
|
10526
|
-
const R = y.filter((_) =>
|
|
10526
|
+
const R = y.filter((_) => we(_) && _.twoWay);
|
|
10527
10527
|
if (!o?.noTwoWay) {
|
|
10528
10528
|
for (const _ of R)
|
|
10529
10529
|
throw new Error("VALIDATION_ERROR: batchSize is required");
|
|
@@ -10778,7 +10778,7 @@ function lw() {
|
|
|
10778
10778
|
return Ya = n, Ya;
|
|
10779
10779
|
}
|
|
10780
10780
|
var uw = lw();
|
|
10781
|
-
const
|
|
10781
|
+
const ve = /* @__PURE__ */ Dn(uw), xt = (t) => {
|
|
10782
10782
|
for (const e in t)
|
|
10783
10783
|
Object.prototype.hasOwnProperty.call(t, e) && (t[e] === void 0 ? delete t[e] : typeof t[e] == "object" && t[e] !== null && xt(t[e]));
|
|
10784
10784
|
}, fw = (t, e) => {
|
|
@@ -11136,7 +11136,7 @@ const Oe = /* @__PURE__ */ Dn(uw), xt = (t) => {
|
|
|
11136
11136
|
const p = new Event(`stoker:loading:${t}`);
|
|
11137
11137
|
document.dispatchEvent(p);
|
|
11138
11138
|
try {
|
|
11139
|
-
if (await gw(c, e, r, n, i), u?.relationCollections && !i && await
|
|
11139
|
+
if (await gw(c, e, r, n, i), u?.relationCollections && !i && await be(u.relationCollections)) {
|
|
11140
11140
|
const O = $t(c, a, o);
|
|
11141
11141
|
for (const S of O)
|
|
11142
11142
|
if (!s?.[S]) {
|
|
@@ -11215,8 +11215,8 @@ const yw = async (t, e) => {
|
|
|
11215
11215
|
const S = /* @__PURE__ */ new Date(), C = new Date((/* @__PURE__ */ new Date()).setDate(S.getDate() + h));
|
|
11216
11216
|
p.TTL = zt.fromDate(C);
|
|
11217
11217
|
}
|
|
11218
|
-
const b =
|
|
11219
|
-
t !== "delete" && (p.data.data = b, e === "written" && fc(p.data.data)), t !== "delete" && e !== "written" && rr(b), t === "update" && (p.data.originalRecord =
|
|
11218
|
+
const b = ve(r);
|
|
11219
|
+
t !== "delete" && (p.data.data = b, e === "written" && fc(p.data.data)), t !== "delete" && e !== "written" && rr(b), t === "update" && (p.data.originalRecord = ve(c)), t !== "delete" && ["started", "written"].includes(e) && (delete p.data.data.Saved_At, delete p.data.data.Last_Save_At), e === "failed" && (p.data.error = JSON.stringify(o));
|
|
11220
11220
|
const g = r.Last_Write_At, O = Ae(d, "tenants", l, n.join("/"), s, "system_write_log", `${a}-${g.valueOf()}`);
|
|
11221
11221
|
Jm(O, p).catch((S) => {
|
|
11222
11222
|
console.error(`Error saving "${e}" ${t} log entry for record ${s} in ${u.collection} collection.`, { cause: S });
|
|
@@ -11317,7 +11317,7 @@ const yw = async (t, e) => {
|
|
|
11317
11317
|
if (!Pe())
|
|
11318
11318
|
throw new Error("PERMISSIONS_NOT_FOUND");
|
|
11319
11319
|
const o = e.at(-2);
|
|
11320
|
-
r.fields ||= n.collections[o].fields.filter((u) =>
|
|
11320
|
+
r.fields ||= n.collections[o].fields.filter((u) => we(u));
|
|
11321
11321
|
const c = r.depth - 1, l = [];
|
|
11322
11322
|
for (const u of r.fields)
|
|
11323
11323
|
if ("collection" in u) {
|
|
@@ -11416,16 +11416,16 @@ const yw = async (t, e) => {
|
|
|
11416
11416
|
}
|
|
11417
11417
|
}
|
|
11418
11418
|
let I;
|
|
11419
|
-
e?.noComputedFields || (I = await
|
|
11419
|
+
e?.noComputedFields || (I = await be(b.admin?.retriever));
|
|
11420
11420
|
for (const m of _.values()) {
|
|
11421
11421
|
const T = [], A = [...m.Collection_Path, m.id];
|
|
11422
11422
|
e?.subcollections && T.push(_m(
|
|
11423
11423
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
11424
11424
|
_.get(m.id),
|
|
11425
11425
|
A,
|
|
11426
|
-
|
|
11426
|
+
ve(e.subcollections),
|
|
11427
11427
|
s,
|
|
11428
|
-
|
|
11428
|
+
ve(e?.relations),
|
|
11429
11429
|
e?.only,
|
|
11430
11430
|
e?.noEmbeddingFields
|
|
11431
11431
|
)), e?.relations && (e.relations.fields && (e.relations.fields = e.relations.fields.map((F) => {
|
|
@@ -11440,14 +11440,14 @@ const yw = async (t, e) => {
|
|
|
11440
11440
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
11441
11441
|
_.get(m.id),
|
|
11442
11442
|
A,
|
|
11443
|
-
|
|
11443
|
+
ve(e.relations),
|
|
11444
11444
|
s,
|
|
11445
11445
|
e?.only,
|
|
11446
11446
|
e?.noEmbeddingFields
|
|
11447
11447
|
))), await Promise.all(T);
|
|
11448
11448
|
const L = [];
|
|
11449
11449
|
for (const F of o.fields)
|
|
11450
|
-
F.type === "Computed" && !e?.noComputedFields && L.push(
|
|
11450
|
+
F.type === "Computed" && !e?.noComputedFields && L.push(be(F.formula, [m, I]).then((Z) => {
|
|
11451
11451
|
m[F.name] = Z;
|
|
11452
11452
|
})), e?.noEmbeddingFields && F.type === "Embedding" && delete m[F.name];
|
|
11453
11453
|
await Promise.all(L);
|
|
@@ -11492,7 +11492,7 @@ const yw = async (t, e) => {
|
|
|
11492
11492
|
if (!Pe())
|
|
11493
11493
|
throw new Error("PERMISSIONS_NOT_FOUND");
|
|
11494
11494
|
const c = e.at(-2);
|
|
11495
|
-
r.fields ||= n.collections[c].fields.filter((f) =>
|
|
11495
|
+
r.fields ||= n.collections[c].fields.filter((f) => we(f));
|
|
11496
11496
|
const l = r.depth - 1, u = [];
|
|
11497
11497
|
for (const f of r.fields)
|
|
11498
11498
|
if ("collection" in f) {
|
|
@@ -11561,7 +11561,7 @@ const yw = async (t, e) => {
|
|
|
11561
11561
|
for (const I of R)
|
|
11562
11562
|
y.id ||= I.id, y = { ...y, ...I.data }, delete y.Collection_Path_String;
|
|
11563
11563
|
const _ = [], N = t ? [...t, e] : [d.collection, e];
|
|
11564
|
-
if (r?.subcollections && _.push(wm(y, N,
|
|
11564
|
+
if (r?.subcollections && _.push(wm(y, N, ve(r.subcollections), s, ve(r?.relations), r?.only)), r?.relations && (r.relations.fields && (r.relations.fields = r.relations.fields.map((I) => {
|
|
11565
11565
|
if (typeof I == "string") {
|
|
11566
11566
|
const m = f.fields.find((T) => T.name === I);
|
|
11567
11567
|
if (m)
|
|
@@ -11569,7 +11569,7 @@ const yw = async (t, e) => {
|
|
|
11569
11569
|
throw new Error(`SCHEMA_ERROR: Field ${I} not found in collection ${n}`);
|
|
11570
11570
|
}
|
|
11571
11571
|
return I;
|
|
11572
|
-
})), _.push(bm(y, N,
|
|
11572
|
+
})), _.push(bm(y, N, ve(r.relations), s, r?.only, r?.noComputedFields, r?.noEmbeddingFields))), await Promise.all(_), !r?.noComputedFields)
|
|
11573
11573
|
for (const I of f.fields)
|
|
11574
11574
|
I.type === "Computed" && (y[I.name] = await I.formula(y));
|
|
11575
11575
|
if (r?.noEmbeddingFields)
|
|
@@ -11587,12 +11587,12 @@ const yw = async (t, e) => {
|
|
|
11587
11587
|
};
|
|
11588
11588
|
e(t);
|
|
11589
11589
|
}, Ow = async (t, e, r, n) => {
|
|
11590
|
-
const s = it(), i = Be(), a = Ue(s, i.STOKER_FB_FUNCTIONS_REGION), o = Je(a, "stoker-writeapi", { timeout: 540 * 1e3 });
|
|
11591
|
-
return Om(
|
|
11590
|
+
const s = it(), i = Be(), a = Ue(s, i.STOKER_FB_FUNCTIONS_REGION), o = Je(a, "stoker-writeapi", { timeout: 540 * 1e3 }), c = ve(r);
|
|
11591
|
+
return Om(c), fc(c), (await o({
|
|
11592
11592
|
operation: "update",
|
|
11593
11593
|
path: t,
|
|
11594
11594
|
id: e,
|
|
11595
|
-
record:
|
|
11595
|
+
record: c,
|
|
11596
11596
|
user: n
|
|
11597
11597
|
})).data?.result;
|
|
11598
11598
|
}, mc = async (t, e, r, n) => {
|
|
@@ -11645,14 +11645,14 @@ const yw = async (t, e) => {
|
|
|
11645
11645
|
record: { ...v, ...r },
|
|
11646
11646
|
context: I,
|
|
11647
11647
|
batch: w,
|
|
11648
|
-
originalRecord:
|
|
11648
|
+
originalRecord: ve(v)
|
|
11649
11649
|
};
|
|
11650
11650
|
return await ie("preValidate", l, E, V), await Ow(t, e, r, s ? { operation: s.operation, permissions: s.permissions, password: s.password } : void 0);
|
|
11651
11651
|
}
|
|
11652
11652
|
delete r.id;
|
|
11653
11653
|
const F = Qo("update", t, r, a, R, Wt(), N.uid, zt.now(), jr(), !!_);
|
|
11654
11654
|
for (const V of C)
|
|
11655
|
-
!
|
|
11655
|
+
!we(V) && ar(F[V.name]) && V.nullable && (F[V.name] = null);
|
|
11656
11656
|
if (xt(F), xt(v), Mr(g, F, a), Mr(g, v, a), !_ && x && Ye("update", "started", F, t, e, g, N.uid, void 0, v), !_) {
|
|
11657
11657
|
const V = {
|
|
11658
11658
|
operation: "update",
|
|
@@ -11660,7 +11660,7 @@ const yw = async (t, e) => {
|
|
|
11660
11660
|
recordId: e,
|
|
11661
11661
|
context: I,
|
|
11662
11662
|
batch: w,
|
|
11663
|
-
originalRecord:
|
|
11663
|
+
originalRecord: ve(v)
|
|
11664
11664
|
};
|
|
11665
11665
|
await ie("preOperation", l, E, V);
|
|
11666
11666
|
const K = {
|
|
@@ -11669,14 +11669,14 @@ const yw = async (t, e) => {
|
|
|
11669
11669
|
recordId: e,
|
|
11670
11670
|
context: I,
|
|
11671
11671
|
batch: w,
|
|
11672
|
-
originalRecord:
|
|
11672
|
+
originalRecord: ve(v)
|
|
11673
11673
|
};
|
|
11674
11674
|
await ie("preWrite", l, E, K);
|
|
11675
11675
|
}
|
|
11676
11676
|
if (Mr(g, F, a), sh(g, F), !_)
|
|
11677
11677
|
try {
|
|
11678
11678
|
const V = { ...v, ...F };
|
|
11679
|
-
rr(V), await fm("update", V, g, E, { operation: "update", record: V, context: I, batch: w, originalRecord:
|
|
11679
|
+
rr(V), await fm("update", V, g, E, { operation: "update", record: V, context: I, batch: w, originalRecord: ve(v) }, a), k && (M(), await dc("update", e, F, g, d));
|
|
11680
11680
|
} catch (V) {
|
|
11681
11681
|
throw new Error(`VALIDATION_ERROR: ${V.message}`);
|
|
11682
11682
|
}
|
|
@@ -11691,7 +11691,7 @@ const yw = async (t, e) => {
|
|
|
11691
11691
|
recordId: e,
|
|
11692
11692
|
context: I,
|
|
11693
11693
|
retry: !!_,
|
|
11694
|
-
originalRecord:
|
|
11694
|
+
originalRecord: ve(v)
|
|
11695
11695
|
}, re = { ...Z };
|
|
11696
11696
|
await ie("postWrite", l, E, Z), await ie("postOperation", l, E, re);
|
|
11697
11697
|
const oe = { ...v, ...F };
|
|
@@ -11701,7 +11701,7 @@ const yw = async (t, e) => {
|
|
|
11701
11701
|
let g = 0;
|
|
11702
11702
|
const O = async () => {
|
|
11703
11703
|
try {
|
|
11704
|
-
await
|
|
11704
|
+
await ve(o).commit();
|
|
11705
11705
|
return;
|
|
11706
11706
|
} catch (S) {
|
|
11707
11707
|
let C;
|
|
@@ -11711,7 +11711,7 @@ const yw = async (t, e) => {
|
|
|
11711
11711
|
"custom",
|
|
11712
11712
|
"autoCorrectUnique"
|
|
11713
11713
|
]);
|
|
11714
|
-
if (S.code === "unavailable" && await
|
|
11714
|
+
if (S.code === "unavailable" && await be(p.onIndexedDBConnectionLost), t !== "delete" && S.code === "permission-denied")
|
|
11715
11715
|
try {
|
|
11716
11716
|
await dc(t, r, n, i, u);
|
|
11717
11717
|
} catch (N) {
|
|
@@ -11781,11 +11781,11 @@ const yw = async (t, e) => {
|
|
|
11781
11781
|
};
|
|
11782
11782
|
await O();
|
|
11783
11783
|
}, Ew = async (t, e, r, n) => {
|
|
11784
|
-
const s = it(), i = Be(), a = Ue(s, i.STOKER_FB_FUNCTIONS_REGION), o = Je(a, "stoker-writeapi", { timeout: 540 * 1e3 });
|
|
11785
|
-
return Om(
|
|
11784
|
+
const s = it(), i = Be(), a = Ue(s, i.STOKER_FB_FUNCTIONS_REGION), o = Je(a, "stoker-writeapi", { timeout: 540 * 1e3 }), c = ve(e);
|
|
11785
|
+
return Om(c), (await o({
|
|
11786
11786
|
operation: "create",
|
|
11787
11787
|
path: t,
|
|
11788
|
-
record:
|
|
11788
|
+
record: c,
|
|
11789
11789
|
user: r,
|
|
11790
11790
|
id: n
|
|
11791
11791
|
})).data?.result;
|
|
@@ -12024,7 +12024,7 @@ let mn, Qa = 0;
|
|
|
12024
12024
|
const kw = async () => {
|
|
12025
12025
|
const t = Nm(), e = Ie();
|
|
12026
12026
|
return mr(Ae(t, "system_deployment", "latest_deploy"), (n) => {
|
|
12027
|
-
n.exists() ? (mn = n.data(), Qa++, Qa > 1 && (mn.refresh ? window.location.reload() :
|
|
12027
|
+
n.exists() ? (mn = n.data(), Qa++, Qa > 1 && (mn.refresh ? window.location.reload() : be(e.onVersionUpdate, [mn, Qa]))) : console.error("Version info not found");
|
|
12028
12028
|
}, (n) => {
|
|
12029
12029
|
console.error("Error getting version info", { cause: n.message });
|
|
12030
12030
|
});
|
|
@@ -12033,7 +12033,7 @@ let ko;
|
|
|
12033
12033
|
const Iw = async () => {
|
|
12034
12034
|
const t = Ie(), e = Nm();
|
|
12035
12035
|
mr(Ae(e, "system_deployment", "maintenance_mode"), (r) => {
|
|
12036
|
-
r.exists() ? (ko = r.data(),
|
|
12036
|
+
r.exists() ? (ko = r.data(), be(t.onMaintenanceUpdate, [ko.active ? "on" : "off"])) : console.error("Maintenance status not found");
|
|
12037
12037
|
}, (r) => {
|
|
12038
12038
|
console.error("Error getting maintenance status", { cause: r.message });
|
|
12039
12039
|
});
|
|
@@ -12043,24 +12043,24 @@ const Nw = () => {
|
|
|
12043
12043
|
const t = Td(), e = Ie();
|
|
12044
12044
|
let r = !1;
|
|
12045
12045
|
return Hm(Km(t, ".info/connected"), (s) => {
|
|
12046
|
-
s.val() === !0 ? (Sr && (clearTimeout(Sr), Sr = null), Fr = "Online",
|
|
12047
|
-
Fr = "Offline",
|
|
12046
|
+
s.val() === !0 ? (Sr && (clearTimeout(Sr), Sr = null), Fr = "Online", be(e.onConnectionStatusChange, [Fr, !r]), r || (r = !0)) : !Sr && r && (Sr = setTimeout(() => {
|
|
12047
|
+
Fr = "Offline", be(e.onConnectionStatusChange, [Fr]);
|
|
12048
12048
|
}, 5e3));
|
|
12049
12049
|
});
|
|
12050
12050
|
}, Wt = () => Fr ?? "Online", Fw = () => navigator.onLine ? "Online" : "Offline", Cm = async () => {
|
|
12051
12051
|
const t = Ie(), e = hr(), r = e.currentUser;
|
|
12052
|
-
if (t.preLogout && await
|
|
12052
|
+
if (t.preLogout && await be(t.preLogout, [r]) === !1)
|
|
12053
12053
|
throw new Error("Operation cancelled by preLogout");
|
|
12054
12054
|
try {
|
|
12055
12055
|
e.signOut();
|
|
12056
12056
|
} catch (n) {
|
|
12057
12057
|
console.error(n);
|
|
12058
12058
|
const s = { error: !0, instances: [{ instance: "[DEFAULT]", code: "SIGN_OUT", error: n }] };
|
|
12059
|
-
await
|
|
12059
|
+
await be(t.postLogout, [s]);
|
|
12060
12060
|
}
|
|
12061
12061
|
}, Dw = (t) => {
|
|
12062
12062
|
const e = (s) => {
|
|
12063
|
-
typeof s == "string" && s.includes("Could not reach Cloud Firestore backend. Backend didn't respond within 10 seconds.") && (console.warn("Slow Firestore Connection Detected"),
|
|
12063
|
+
typeof s == "string" && s.includes("Could not reach Cloud Firestore backend. Backend didn't respond within 10 seconds.") && (console.warn("Slow Firestore Connection Detected"), be(t.onFirestoreSlowConnection)), typeof s == "string" && s.includes("Using maximum backoff delay to prevent overloading the backend.") && (console.warn("Firestore Load Failure Detected"), be(t.onFirestoreLoadFailure)), typeof s == "string" && s.includes("The user's credential is no longer valid. The user must sign in again.") && (console.warn("User Credential Expired"), Cm()), typeof s == "string" && s.includes("Connection to Indexed Database server lost. Refresh the page to try again") && (console.warn("Indexed Database Connection Lost"), be(t.onIndexedDBConnectionLost));
|
|
12064
12064
|
}, r = console.error.bind(console);
|
|
12065
12065
|
let n = !1;
|
|
12066
12066
|
console.error = (...s) => {
|
|
@@ -12090,7 +12090,7 @@ const Pw = (t, e) => {
|
|
|
12090
12090
|
const t = navigator.userAgent;
|
|
12091
12091
|
return /iPad|iPhone|iPod/.test(t) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1 ? { experimentalForceLongPolling: !0 } : /Safari/i.test(t) && !/Chrome|Chromium|CriOS|EdgiOS|Edg\/|OPR|FxiOS/i.test(t) ? { experimentalForceLongPolling: !0 } : {};
|
|
12092
12092
|
};
|
|
12093
|
-
let ht, gc, St, Am, ge, km, Lr, yc, _c, je, Im, In = [],
|
|
12093
|
+
let ht, gc, St, Am, ge, km, Lr, yc, _c, je, Im, In = [], Oe;
|
|
12094
12094
|
const Xa = {
|
|
12095
12095
|
firestoreWriteApp: {}
|
|
12096
12096
|
}, mt = {
|
|
@@ -12109,7 +12109,7 @@ const Xa = {
|
|
|
12109
12109
|
return gc;
|
|
12110
12110
|
},
|
|
12111
12111
|
getEnv() {
|
|
12112
|
-
return
|
|
12112
|
+
return Oe;
|
|
12113
12113
|
},
|
|
12114
12114
|
getTimezone() {
|
|
12115
12115
|
return Am;
|
|
@@ -12117,7 +12117,7 @@ const Xa = {
|
|
|
12117
12117
|
getConnectionStatus: Wt,
|
|
12118
12118
|
getNetworkStatus: Fw,
|
|
12119
12119
|
getSchema(t = !1) {
|
|
12120
|
-
const e =
|
|
12120
|
+
const e = ve(Lr);
|
|
12121
12121
|
if (t) {
|
|
12122
12122
|
for (const r of Object.values(e.collections))
|
|
12123
12123
|
for (const n of r.fields)
|
|
@@ -12134,16 +12134,16 @@ const Xa = {
|
|
|
12134
12134
|
return Im;
|
|
12135
12135
|
},
|
|
12136
12136
|
getCurrentUserRoleGroups() {
|
|
12137
|
-
return
|
|
12137
|
+
return ve(_c);
|
|
12138
12138
|
},
|
|
12139
12139
|
getAllRoleGroups() {
|
|
12140
|
-
return
|
|
12140
|
+
return ve(yc);
|
|
12141
12141
|
},
|
|
12142
12142
|
getGlobalConfigModule() {
|
|
12143
|
-
return
|
|
12143
|
+
return ve(ge);
|
|
12144
12144
|
},
|
|
12145
12145
|
getCollectionConfigModule(t) {
|
|
12146
|
-
return
|
|
12146
|
+
return ve(km[t]);
|
|
12147
12147
|
},
|
|
12148
12148
|
getVersionInfo: Rm,
|
|
12149
12149
|
getMaintenanceInfo: xw,
|
|
@@ -12172,11 +12172,11 @@ const Xa = {
|
|
|
12172
12172
|
};
|
|
12173
12173
|
let bd = !1, Od = 0;
|
|
12174
12174
|
const tb = async (t, e, r, n) => {
|
|
12175
|
-
if (
|
|
12175
|
+
if (Oe = r, ht)
|
|
12176
12176
|
return console.error("Stoker is already initialized."), !0;
|
|
12177
|
-
Pm("stoker-client", vp, "web"), St =
|
|
12178
|
-
const s = JSON.parse(
|
|
12179
|
-
Pw(
|
|
12177
|
+
Pm("stoker-client", vp, "web"), St = Oe.MODE, ge = t.default({ sdk: "web", utils: Io, context: n }), Am = await ne(ge, ["global", "timezone"]), ne(ge, ["global", "roles"]), ne(ge, ["global", "appName"]), ne(ge, ["global", "auth", "enableMultiFactorAuth"]);
|
|
12178
|
+
const s = JSON.parse(Oe.STOKER_FB_WEB_APP_CONFIG);
|
|
12179
|
+
Pw(Oe.STOKER_FB_FIRESTORE_EDITION, s.projectId);
|
|
12180
12180
|
const i = Mw(), a = await ne(ge, ["global", "firebase", "GDPRSettings"]);
|
|
12181
12181
|
ht = Hn(s, {
|
|
12182
12182
|
automaticDataCollectionEnabled: a || !0
|
|
@@ -12189,10 +12189,10 @@ const tb = async (t, e, r, n) => {
|
|
|
12189
12189
|
const { firestoreWriteApp: l } = Xa, u = Hn(s, "maintenance");
|
|
12190
12190
|
Ge.maintenance = rn(u, wd(), i);
|
|
12191
12191
|
const f = yp();
|
|
12192
|
-
if (f.settings.minimumFetchIntervalMillis = 36e5, await _p(f),
|
|
12192
|
+
if (f.settings.minimumFetchIntervalMillis = 36e5, await _p(f), Oe.STOKER_FB_ENABLE_APP_CHECK === "true" && Oe.STOKER_FB_APP_CHECK_KEY) {
|
|
12193
12193
|
(St === "development" || window.location.hostname === "localhost") && (globalThis.FIREBASE_APPCHECK_DEBUG_TOKEN = !0);
|
|
12194
12194
|
const w = {
|
|
12195
|
-
provider: new pp(
|
|
12195
|
+
provider: new pp(Oe.STOKER_FB_APP_CHECK_KEY),
|
|
12196
12196
|
isTokenAutoRefreshEnabled: !0
|
|
12197
12197
|
};
|
|
12198
12198
|
Ct.main = Yn(ht, w), Ct.firestoreWrite = Yn(l, w), Ct.maintenance = Yn(u, w);
|
|
@@ -12200,7 +12200,7 @@ const tb = async (t, e, r, n) => {
|
|
|
12200
12200
|
const m = (T, A) => {
|
|
12201
12201
|
if (console.log(`App Check token error detected for ${A}`), !I)
|
|
12202
12202
|
if (I = !0, ge.onAppCheckTokenFailure)
|
|
12203
|
-
|
|
12203
|
+
be(ge.onAppCheckTokenFailure, [T]);
|
|
12204
12204
|
else {
|
|
12205
12205
|
const L = sessionStorage.getItem("stoker-app-check-reload");
|
|
12206
12206
|
!L || new Date(L).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.");
|
|
@@ -12254,7 +12254,7 @@ const tb = async (t, e, r, n) => {
|
|
|
12254
12254
|
mt[w] = Sc(Xa[`${w}App`], E);
|
|
12255
12255
|
const { main: R } = mt;
|
|
12256
12256
|
Um(R, async (w) => {
|
|
12257
|
-
if (w && await
|
|
12257
|
+
if (w && await be(ge.preLogin, [w]) === !1)
|
|
12258
12258
|
throw new Error("Operation cancelled by preLogin");
|
|
12259
12259
|
});
|
|
12260
12260
|
const _ = await ne(ge, [
|
|
@@ -12264,31 +12264,31 @@ const tb = async (t, e, r, n) => {
|
|
|
12264
12264
|
]);
|
|
12265
12265
|
if (St === "development" && b) {
|
|
12266
12266
|
if (!_?.includes("Auth")) {
|
|
12267
|
-
const w =
|
|
12267
|
+
const w = Oe.STOKER_FB_EMULATOR_AUTH_PORT ? parseInt(Oe.STOKER_FB_EMULATOR_AUTH_PORT) : 9099;
|
|
12268
12268
|
for (const I of Object.values(mt))
|
|
12269
12269
|
Wm(I, `http://localhost:${w}`);
|
|
12270
12270
|
}
|
|
12271
12271
|
if (!_?.includes("Database")) {
|
|
12272
|
-
const w =
|
|
12272
|
+
const w = Oe.STOKER_FB_EMULATOR_DATABASE_PORT ? parseInt(Oe.STOKER_FB_EMULATOR_DATABASE_PORT) : 9e3;
|
|
12273
12273
|
Ym(Td(), "localhost", w);
|
|
12274
12274
|
}
|
|
12275
12275
|
if (!_?.includes("Firestore")) {
|
|
12276
|
-
const w =
|
|
12276
|
+
const w = Oe.STOKER_FB_EMULATOR_FIRESTORE_PORT ? parseInt(Oe.STOKER_FB_EMULATOR_FIRESTORE_PORT) : 8080;
|
|
12277
12277
|
Ic(Ge.maintenance, "localhost", w);
|
|
12278
12278
|
}
|
|
12279
12279
|
if (!_?.includes("Storage")) {
|
|
12280
|
-
const w =
|
|
12280
|
+
const w = Oe.STOKER_FB_EMULATOR_STORAGE_PORT ? parseInt(Oe.STOKER_FB_EMULATOR_STORAGE_PORT) : 9199;
|
|
12281
12281
|
dp(hp(), "localhost", w);
|
|
12282
12282
|
}
|
|
12283
12283
|
if (!_?.includes("Functions")) {
|
|
12284
|
-
const w =
|
|
12285
|
-
mp(Ue(ht,
|
|
12284
|
+
const w = Oe.STOKER_FB_EMULATOR_FUNCTIONS_PORT ? parseInt(Oe.STOKER_FB_EMULATOR_FUNCTIONS_PORT) : 5001;
|
|
12285
|
+
mp(Ue(ht, Oe.STOKER_FB_FUNCTIONS_REGION), "localhost", w);
|
|
12286
12286
|
}
|
|
12287
12287
|
}
|
|
12288
12288
|
if (kw(), Iw(), Nw(), St === "development" && (O ? en(O) : en("debug")), St === "production" && (S ? en(S) : en("error")), g) {
|
|
12289
12289
|
const w = Kn(R, async (I) => {
|
|
12290
12290
|
if (I) {
|
|
12291
|
-
const m = JSON.parse(
|
|
12291
|
+
const m = JSON.parse(Oe.STOKER_FB_WEB_APP_CONFIG);
|
|
12292
12292
|
Mm(() => {
|
|
12293
12293
|
console.log(`Tenant - ${m.projectId} - User - ${I.uid}`);
|
|
12294
12294
|
});
|
|
@@ -12359,7 +12359,7 @@ const tb = async (t, e, r, n) => {
|
|
|
12359
12359
|
...re,
|
|
12360
12360
|
...K
|
|
12361
12361
|
}, i), St === "development" && b && !_?.includes("Firestore")) {
|
|
12362
|
-
const q =
|
|
12362
|
+
const q = Oe.STOKER_FB_EMULATOR_FIRESTORE_PORT ? parseInt(Oe.STOKER_FB_EMULATOR_FIRESTORE_PORT) : 8080;
|
|
12363
12363
|
for (const [Y, U] of Object.entries(Ge))
|
|
12364
12364
|
Y !== "maintenance" && Ic(U, "localhost", q);
|
|
12365
12365
|
}
|
|
@@ -12367,7 +12367,7 @@ const tb = async (t, e, r, n) => {
|
|
|
12367
12367
|
const q = ap(Ge.main);
|
|
12368
12368
|
q && op(q);
|
|
12369
12369
|
}
|
|
12370
|
-
const Te = await Je(Ue(ht,
|
|
12370
|
+
const Te = await Je(Ue(ht, Oe.STOKER_FB_FUNCTIONS_REGION), "stoker-schema")().catch((q) => {
|
|
12371
12371
|
throw new Error("Error fetching schema.", { cause: q });
|
|
12372
12372
|
});
|
|
12373
12373
|
if (m())
|
|
@@ -12376,7 +12376,7 @@ const tb = async (t, e, r, n) => {
|
|
|
12376
12376
|
const Xe = Object.entries(Te.data.allRoleGroups).map(([q, Y]) => [q, new Set(Y)]);
|
|
12377
12377
|
yc = Object.fromEntries(Xe), _c = Te.data.currentUserRoleGroups, km = Ag(Object.keys(Lr.collections), e, "web", Io, n);
|
|
12378
12378
|
const bt = await yw(je, T);
|
|
12379
|
-
if (m() || (In.push(...bt), v === "WRITE" && Cw(Lr, je), await
|
|
12379
|
+
if (m() || (In.push(...bt), v === "WRITE" && Cw(Lr, je), await be(ge.postLogin, [je]), m()))
|
|
12380
12380
|
return;
|
|
12381
12381
|
const br = new Event("stoker:ready");
|
|
12382
12382
|
document.dispatchEvent(br);
|
|
@@ -12411,7 +12411,7 @@ const tb = async (t, e, r, n) => {
|
|
|
12411
12411
|
console.error('Error clearing indexedDB persistence in "[DEFAULT]".'), L.error = !0, L.instances.push({ instance: "[DEFAULT]", code: "CLEAR_CACHE", error: M });
|
|
12412
12412
|
}), ["ALL", "WRITE"].includes(v) && await Dc(Ge.firestoreWrite).catch((M) => {
|
|
12413
12413
|
console.error('Error clearing indexedDB persistence in "firestoreWrite".'), L.error = !0, L.instances.push({ instance: "firestoreWrite", code: "CLEAR_CACHE", error: M });
|
|
12414
|
-
})), L.error ? console.info("Sign out operation completed with errors.") : console.info("Sign out operation completed successfully."), await
|
|
12414
|
+
})), L.error ? console.info("Sign out operation completed with errors.") : console.info("Sign out operation completed successfully."), await be(ge.postLogout, [L]);
|
|
12415
12415
|
}
|
|
12416
12416
|
}), N ? !1 : R.currentUser ? (g && console.info(`${R.currentUser.uid} successfully logged in.`), !0) : !1;
|
|
12417
12417
|
}, { getTenant: Dt, getEnv: Be, getTimezone: xm, getSchema: We, getCurrentUser: rb, getCurrentUserRoleGroups: Xr, getAllRoleGroups: vc, getGlobalConfigModule: Ie, getCollectionConfigModule: ft, getAppCheck: nb, getAppCheckFirestoreWrite: sb, getFirestoreWriteAuth: jw, getFirestoreWrite: wc, getFirestoreMaintenance: Nm } = Io, ib = async (t, e, r) => {
|
|
@@ -12449,7 +12449,7 @@ const tb = async (t, e, r, n) => {
|
|
|
12449
12449
|
}
|
|
12450
12450
|
console.info(`${a} successfully logged in.`);
|
|
12451
12451
|
} catch (a) {
|
|
12452
|
-
throw await
|
|
12452
|
+
throw await be(i.postLogin, [null, a]), a;
|
|
12453
12453
|
}
|
|
12454
12454
|
}, ab = (t) => (document.addEventListener("stoker:ready", t), () => {
|
|
12455
12455
|
document.removeEventListener("stoker:ready", t);
|
|
@@ -12534,7 +12534,7 @@ const tb = async (t, e, r, n) => {
|
|
|
12534
12534
|
if (mm(v, w), !s?.noComputedFields) {
|
|
12535
12535
|
const M = [];
|
|
12536
12536
|
for (const F of f.fields)
|
|
12537
|
-
F.type === "Computed" && M.push(
|
|
12537
|
+
F.type === "Computed" && M.push(be(() => F.formula(v)).then((Z) => {
|
|
12538
12538
|
v && (v[F.name] = Z);
|
|
12539
12539
|
}));
|
|
12540
12540
|
await Promise.all(M);
|
|
@@ -12543,14 +12543,14 @@ const tb = async (t, e, r, n) => {
|
|
|
12543
12543
|
for (const M of f.fields)
|
|
12544
12544
|
M.type === "Embedding" && delete v[M.name];
|
|
12545
12545
|
}
|
|
12546
|
-
r(
|
|
12546
|
+
r(ve(v));
|
|
12547
12547
|
});
|
|
12548
|
-
}, m = /* @__PURE__ */ new Map(), T = /* @__PURE__ */ new Map(), A = (k) => typeof k == "object" ? k.fields.filter((F) => typeof F == "object" &&
|
|
12548
|
+
}, m = /* @__PURE__ */ new Map(), T = /* @__PURE__ */ new Map(), A = (k) => typeof k == "object" ? k.fields.filter((F) => typeof F == "object" && we(F) && $t(f, o, a).includes(F.collection)) : f.fields.filter((F) => we(F) && $t(f, o, a).includes(F.collection)), L = (k) => new Promise((M) => {
|
|
12549
12549
|
if (!s?.relations) {
|
|
12550
12550
|
M({});
|
|
12551
12551
|
return;
|
|
12552
12552
|
}
|
|
12553
|
-
const F =
|
|
12553
|
+
const F = ve(s.relations), Z = /* @__PURE__ */ new Map(), re = /* @__PURE__ */ new Map(), oe = A(F);
|
|
12554
12554
|
for (const z of oe)
|
|
12555
12555
|
for (const V of T.values())
|
|
12556
12556
|
V.type === z.type && V.field === z.name && // eslint-disable-next-line security/detect-object-injection
|
|
@@ -12780,7 +12780,7 @@ const tb = async (t, e, r, n) => {
|
|
|
12780
12780
|
k.forEach((D) => {
|
|
12781
12781
|
mm(D, M.get(D.id));
|
|
12782
12782
|
for (const ue of f.fields)
|
|
12783
|
-
ue.type === "Computed" && !n?.noComputedFields && H.push(
|
|
12783
|
+
ue.type === "Computed" && !n?.noComputedFields && H.push(be(ue.formula, [D, U]).then((X) => {
|
|
12784
12784
|
D[ue.name] = X;
|
|
12785
12785
|
})), n?.noEmbeddingFields && ue.type === "Embedding" && delete D[ue.name];
|
|
12786
12786
|
}), Promise.all(H).then(() => {
|
|
@@ -12802,7 +12802,7 @@ const tb = async (t, e, r, n) => {
|
|
|
12802
12802
|
}), T.size === _.length && U) {
|
|
12803
12803
|
m = !1;
|
|
12804
12804
|
const H = kd(u, () => {
|
|
12805
|
-
H(), !n?.noComputedFields && C?.admin?.retriever ?
|
|
12805
|
+
H(), !n?.noComputedFields && C?.admin?.retriever ? be(C.admin.retriever).then((D) => {
|
|
12806
12806
|
Z(q, Y, D);
|
|
12807
12807
|
}) : Z(q, Y);
|
|
12808
12808
|
});
|
|
@@ -12822,7 +12822,7 @@ const tb = async (t, e, r, n) => {
|
|
|
12822
12822
|
return;
|
|
12823
12823
|
const U = q.id;
|
|
12824
12824
|
A.set(U, "loading"), z[U] ||= /* @__PURE__ */ new Map();
|
|
12825
|
-
const H =
|
|
12825
|
+
const H = ve(n?.relations), D = typeof H == "object" ? H.fields.filter((pe) => typeof pe == "object" && we(pe) && $t(f, o, a).includes(pe.collection)) : f.fields.filter((pe) => we(pe) && $t(f, o, a).includes(pe.collection)), ue = /* @__PURE__ */ new Map(), X = /* @__PURE__ */ new Map();
|
|
12826
12826
|
oe[U] ||= /* @__PURE__ */ new Map();
|
|
12827
12827
|
for (const pe of D)
|
|
12828
12828
|
for (const _e of z[U].entries()) {
|
|
@@ -12904,7 +12904,7 @@ const tb = async (t, e, r, n) => {
|
|
|
12904
12904
|
}
|
|
12905
12905
|
}
|
|
12906
12906
|
}, K = (q) => {
|
|
12907
|
-
const Y =
|
|
12907
|
+
const Y = ve(n?.relations), U = typeof Y == "object" ? Y.fields.filter((H) => typeof H == "object" && we(H) && $t(f, o, a).includes(H.collection)) : f.fields.filter((H) => we(H) && $t(f, o, a).includes(H.collection));
|
|
12908
12908
|
for (const H of U)
|
|
12909
12909
|
if (z[q])
|
|
12910
12910
|
for (const D of z[q].entries()) {
|
|
@@ -13081,7 +13081,7 @@ export {
|
|
|
13081
13081
|
Cm as signOut,
|
|
13082
13082
|
db as subscribeMany,
|
|
13083
13083
|
Fm as subscribeOne,
|
|
13084
|
-
|
|
13084
|
+
be as tryPromise,
|
|
13085
13085
|
mc as updateRecord,
|
|
13086
13086
|
Ow as updateRecordServer,
|
|
13087
13087
|
fb as waitForPendingWrites
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stoker-platform/web-client",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.90",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"files": [
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"test": "echo \"Error: no test specified\""
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@stoker-platform/types": "0.5.
|
|
28
|
-
"@stoker-platform/utils": "0.5.
|
|
27
|
+
"@stoker-platform/types": "0.5.63",
|
|
28
|
+
"@stoker-platform/utils": "0.5.76",
|
|
29
29
|
"@types/lodash": "^4.17.24",
|
|
30
30
|
"@types/luxon": "^3.7.1",
|
|
31
31
|
"firebase": "^12.14.0",
|