@stoker-platform/web-client 0.5.44 → 0.5.46
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 +190 -161
- package/package.json +3 -3
package/dist/bundle.js
CHANGED
|
@@ -8,7 +8,7 @@ import { getFunctions as Ve, httpsCallable as Je, 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.46", gp = (r) => !!r.auth, ct = (r, e) => {
|
|
12
12
|
if (e?.operations)
|
|
13
13
|
return e.operations.includes(r);
|
|
14
14
|
}, An = (r, e) => e ? e.Role ? r.access?.includes(e.Role) : !1 : !0, yp = (r, e) => e ? !e.Role || r.restrictCreate === !0 ? !1 : typeof r.restrictCreate == "object" ? r.restrictCreate?.includes(e.Role) : !0 : !0, _p = (r, e) => e ? !e.Role || r.restrictUpdate === !0 ? !1 : typeof r.restrictUpdate == "object" ? r.restrictUpdate?.includes(e.Role) : !0 : !0, te = (r, e) => r.filter((t) => t.name === e)[0], _e = (r) => ["OneToOne", "OneToMany", "ManyToOne", "ManyToMany"].includes(r.type), Rd = (r, e) => {
|
|
@@ -1986,7 +1986,7 @@ const ay = /* @__PURE__ */ In(iy), Dr = {
|
|
|
1986
1986
|
for (const c of o)
|
|
1987
1987
|
if (_e(c) && c.collection === s.collection && c.dependencyFields)
|
|
1988
1988
|
for (const l of c.dependencyFields)
|
|
1989
|
-
l.field
|
|
1989
|
+
l.field === r.name && (i = !0);
|
|
1990
1990
|
}
|
|
1991
1991
|
return i;
|
|
1992
1992
|
}, Yd = (r, e) => {
|
|
@@ -2147,7 +2147,7 @@ const ay = /* @__PURE__ */ In(iy), Dr = {
|
|
|
2147
2147
|
}), s;
|
|
2148
2148
|
}, va = async (r, e, t) => {
|
|
2149
2149
|
if (e) {
|
|
2150
|
-
const n = await ve(e, t);
|
|
2150
|
+
const n = await ve(e, [t]);
|
|
2151
2151
|
if (n === !1)
|
|
2152
2152
|
throw new Error(`CANCELLED: Operation cancelled by ${r}`);
|
|
2153
2153
|
return n;
|
|
@@ -2160,7 +2160,7 @@ async function ae(r, e, t, n) {
|
|
|
2160
2160
|
if (r !== "setEmbedding" && (await va(r, e?.[r], n), r === "postWriteError"))
|
|
2161
2161
|
return s;
|
|
2162
2162
|
}
|
|
2163
|
-
const Ko = (r, e, t, n, s, i, a, o, c, l) => (r
|
|
2163
|
+
const Ko = (r, e, t, n, s, i, a, o, c, l) => (r === "create" && (t.Collection_Path = e, l || (t.Created_At = o), t.Saved_At = c, t.Created_By = a || "System"), t.Last_Write_App = s, l || (t.Last_Write_At = o), t.Last_Save_At = c, t.Last_Write_By = a || "System", t.Last_Write_Connection_Status = i, t.Last_Write_Version = n.version, t), Qd = (r, e) => {
|
|
2164
2164
|
const { access: t, queries: n } = r, { serverReadOnly: s } = t, i = /* @__PURE__ */ new Set();
|
|
2165
2165
|
if (n)
|
|
2166
2166
|
for (const a of n) {
|
|
@@ -4989,7 +4989,7 @@ class ah extends Gt {
|
|
|
4989
4989
|
super(`Invalid unit ${e}`);
|
|
4990
4990
|
}
|
|
4991
4991
|
}
|
|
4992
|
-
class
|
|
4992
|
+
class Fe extends Gt {
|
|
4993
4993
|
}
|
|
4994
4994
|
class St extends Gt {
|
|
4995
4995
|
constructor() {
|
|
@@ -6221,9 +6221,9 @@ function Oo(r) {
|
|
|
6221
6221
|
if (r == null)
|
|
6222
6222
|
return null;
|
|
6223
6223
|
if (typeof r != "object")
|
|
6224
|
-
throw new
|
|
6224
|
+
throw new Fe("Week settings must be an object");
|
|
6225
6225
|
if (!Ke(r.firstDay, 1, 7) || !Ke(r.minimalDays, 1, 7) || !Array.isArray(r.weekend) || r.weekend.some((e) => !Ke(e, 1, 7)))
|
|
6226
|
-
throw new
|
|
6226
|
+
throw new Fe("Invalid week settings");
|
|
6227
6227
|
return {
|
|
6228
6228
|
firstDay: r.firstDay,
|
|
6229
6229
|
minimalDays: r.minimalDays,
|
|
@@ -6326,7 +6326,7 @@ function Un(r, e) {
|
|
|
6326
6326
|
function qh(r) {
|
|
6327
6327
|
const e = Number(r);
|
|
6328
6328
|
if (typeof r == "boolean" || r === "" || !Number.isFinite(e))
|
|
6329
|
-
throw new
|
|
6329
|
+
throw new Fe(`Invalid unit value ${r}`);
|
|
6330
6330
|
return e;
|
|
6331
6331
|
}
|
|
6332
6332
|
function Sn(r, e) {
|
|
@@ -6499,9 +6499,9 @@ const D_ = {
|
|
|
6499
6499
|
FFF: Eh,
|
|
6500
6500
|
FFFF: Th
|
|
6501
6501
|
};
|
|
6502
|
-
class
|
|
6502
|
+
class De {
|
|
6503
6503
|
static create(e, t = {}) {
|
|
6504
|
-
return new
|
|
6504
|
+
return new De(e, t);
|
|
6505
6505
|
}
|
|
6506
6506
|
static parseFormat(e) {
|
|
6507
6507
|
let t = null, n = "", s = !1;
|
|
@@ -6550,7 +6550,7 @@ class Fe {
|
|
|
6550
6550
|
p ? { weekday: h } : { weekday: h, month: "long", day: "numeric" },
|
|
6551
6551
|
"weekday"
|
|
6552
6552
|
), u = (h) => {
|
|
6553
|
-
const p =
|
|
6553
|
+
const p = De.macroTokenToFormatOpts(h);
|
|
6554
6554
|
return p ? this.formatWithSystemDefault(e, p) : h;
|
|
6555
6555
|
}, f = (h) => n ? N_(e, h) : i({ era: h }, "era"), d = (h) => {
|
|
6556
6556
|
switch (h) {
|
|
@@ -6695,7 +6695,7 @@ class Fe {
|
|
|
6695
6695
|
return u(h);
|
|
6696
6696
|
}
|
|
6697
6697
|
};
|
|
6698
|
-
return Mf(
|
|
6698
|
+
return Mf(De.parseFormat(t), d);
|
|
6699
6699
|
}
|
|
6700
6700
|
formatDurationFromString(e, t) {
|
|
6701
6701
|
const n = this.opts.signMode === "negativeLargestOnly" ? -1 : 1, s = (u) => {
|
|
@@ -6727,7 +6727,7 @@ class Fe {
|
|
|
6727
6727
|
return this.opts.signMode === "negativeLargestOnly" && h !== f.largestUnit ? w = "never" : this.opts.signMode === "all" ? w = "always" : w = "auto", this.num(u.get(h) * p, d.length, w);
|
|
6728
6728
|
} else
|
|
6729
6729
|
return d;
|
|
6730
|
-
}, a =
|
|
6730
|
+
}, a = De.parseFormat(t), o = a.reduce(
|
|
6731
6731
|
(u, { literal: f, val: d }) => f ? u : u.concat(d),
|
|
6732
6732
|
[]
|
|
6733
6733
|
), c = e.shiftTo(...o.map(s).filter((u) => u)), l = {
|
|
@@ -7099,7 +7099,7 @@ class le {
|
|
|
7099
7099
|
*/
|
|
7100
7100
|
static fromObject(e, t = {}) {
|
|
7101
7101
|
if (e == null || typeof e != "object")
|
|
7102
|
-
throw new
|
|
7102
|
+
throw new Fe(
|
|
7103
7103
|
`Duration.fromObject: argument expected to be an object, got ${e === null ? "null" : typeof e}`
|
|
7104
7104
|
);
|
|
7105
7105
|
return new le({
|
|
@@ -7126,7 +7126,7 @@ class le {
|
|
|
7126
7126
|
return e;
|
|
7127
7127
|
if (typeof e == "object")
|
|
7128
7128
|
return le.fromObject(e);
|
|
7129
|
-
throw new
|
|
7129
|
+
throw new Fe(
|
|
7130
7130
|
`Unknown duration argument ${e} of type ${typeof e}`
|
|
7131
7131
|
);
|
|
7132
7132
|
}
|
|
@@ -7176,7 +7176,7 @@ class le {
|
|
|
7176
7176
|
*/
|
|
7177
7177
|
static invalid(e, t = null) {
|
|
7178
7178
|
if (!e)
|
|
7179
|
-
throw new
|
|
7179
|
+
throw new Fe("need to specify a reason the Duration is invalid");
|
|
7180
7180
|
const n = e instanceof nt ? e : new nt(e, t);
|
|
7181
7181
|
if (Ee.throwOnInvalid)
|
|
7182
7182
|
throw new Zy(n);
|
|
@@ -7263,7 +7263,7 @@ class le {
|
|
|
7263
7263
|
...t,
|
|
7264
7264
|
floor: t.round !== !1 && t.floor !== !1
|
|
7265
7265
|
};
|
|
7266
|
-
return this.isValid ?
|
|
7266
|
+
return this.isValid ? De.create(this.loc, n).formatDurationFromString(this, e) : qf;
|
|
7267
7267
|
}
|
|
7268
7268
|
/**
|
|
7269
7269
|
* Returns a string representation of a Duration with all units included.
|
|
@@ -7674,7 +7674,7 @@ class Oe {
|
|
|
7674
7674
|
*/
|
|
7675
7675
|
static invalid(e, t = null) {
|
|
7676
7676
|
if (!e)
|
|
7677
|
-
throw new
|
|
7677
|
+
throw new Fe("need to specify a reason the Interval is invalid");
|
|
7678
7678
|
const n = e instanceof nt ? e : new nt(e, t);
|
|
7679
7679
|
if (Ee.throwOnInvalid)
|
|
7680
7680
|
throw new By(n);
|
|
@@ -8049,7 +8049,7 @@ class Oe {
|
|
|
8049
8049
|
* @return {string}
|
|
8050
8050
|
*/
|
|
8051
8051
|
toLocaleString(e = bn, t = {}) {
|
|
8052
|
-
return this.isValid ?
|
|
8052
|
+
return this.isValid ? De.create(this.s.loc.clone(t), e).formatInterval(this) : Yt;
|
|
8053
8053
|
}
|
|
8054
8054
|
/**
|
|
8055
8055
|
* Returns an ISO 8601-compliant string representation of this Interval.
|
|
@@ -8599,7 +8599,7 @@ function Dv() {
|
|
|
8599
8599
|
function Mv(r, e) {
|
|
8600
8600
|
if (r.literal)
|
|
8601
8601
|
return r;
|
|
8602
|
-
const t =
|
|
8602
|
+
const t = De.macroTokenToFormatOpts(r.val), n = sm(t, e);
|
|
8603
8603
|
return n == null || n.includes(void 0) ? r : n;
|
|
8604
8604
|
}
|
|
8605
8605
|
function tm(r, e) {
|
|
@@ -8607,7 +8607,7 @@ function tm(r, e) {
|
|
|
8607
8607
|
}
|
|
8608
8608
|
class rm {
|
|
8609
8609
|
constructor(e, t) {
|
|
8610
|
-
if (this.locale = e, this.format = t, this.tokens = tm(
|
|
8610
|
+
if (this.locale = e, this.format = t, this.tokens = tm(De.parseFormat(t), e), this.units = this.tokens.map((n) => Av(n, e)), this.disqualifyingUnit = this.units.find((n) => n.invalidReason), !this.disqualifyingUnit) {
|
|
8611
8611
|
const [n, s] = xv(this.units);
|
|
8612
8612
|
this.regex = RegExp(n, "i"), this.handlers = s;
|
|
8613
8613
|
}
|
|
@@ -8649,7 +8649,7 @@ function Pv(r, e, t) {
|
|
|
8649
8649
|
function sm(r, e) {
|
|
8650
8650
|
if (!r)
|
|
8651
8651
|
return null;
|
|
8652
|
-
const n =
|
|
8652
|
+
const n = De.create(e, r).dtFormatter(Dv()), s = n.formatToParts(), i = n.resolvedOptions();
|
|
8653
8653
|
return s.map((a) => Iv(a, r, i));
|
|
8654
8654
|
}
|
|
8655
8655
|
const Ra = "Invalid DateTime", Wf = 864e13;
|
|
@@ -8737,7 +8737,7 @@ function Jt(r, e, t, n, s, i) {
|
|
|
8737
8737
|
);
|
|
8738
8738
|
}
|
|
8739
8739
|
function an(r, e, t = !0) {
|
|
8740
|
-
return r.isValid ?
|
|
8740
|
+
return r.isValid ? De.create(he.create("en-US"), {
|
|
8741
8741
|
allowZ: t,
|
|
8742
8742
|
forceSimple: !0
|
|
8743
8743
|
}).formatDateTimeFromString(r, e) : null;
|
|
@@ -9009,7 +9009,7 @@ class B {
|
|
|
9009
9009
|
zone: kt(t.zone, Ee.defaultZone),
|
|
9010
9010
|
loc: he.fromObject(t)
|
|
9011
9011
|
});
|
|
9012
|
-
throw new
|
|
9012
|
+
throw new Fe(
|
|
9013
9013
|
`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`
|
|
9014
9014
|
);
|
|
9015
9015
|
}
|
|
@@ -9031,7 +9031,7 @@ class B {
|
|
|
9031
9031
|
zone: kt(t.zone, Ee.defaultZone),
|
|
9032
9032
|
loc: he.fromObject(t)
|
|
9033
9033
|
});
|
|
9034
|
-
throw new
|
|
9034
|
+
throw new Fe("fromSeconds requires a numerical input");
|
|
9035
9035
|
}
|
|
9036
9036
|
/**
|
|
9037
9037
|
* Create a DateTime from a JavaScript object with keys like 'year' and 'hour' with reasonable defaults.
|
|
@@ -9176,7 +9176,7 @@ class B {
|
|
|
9176
9176
|
*/
|
|
9177
9177
|
static fromFormat(e, t, n = {}) {
|
|
9178
9178
|
if (J(e) || J(t))
|
|
9179
|
-
throw new
|
|
9179
|
+
throw new Fe("fromFormat requires an input string and a format");
|
|
9180
9180
|
const { locale: s = null, numberingSystem: i = null } = n, a = he.fromOpts({
|
|
9181
9181
|
locale: s,
|
|
9182
9182
|
numberingSystem: i,
|
|
@@ -9223,7 +9223,7 @@ class B {
|
|
|
9223
9223
|
*/
|
|
9224
9224
|
static invalid(e, t = null) {
|
|
9225
9225
|
if (!e)
|
|
9226
|
-
throw new
|
|
9226
|
+
throw new Fe("need to specify a reason the DateTime is invalid");
|
|
9227
9227
|
const n = e instanceof nt ? e : new nt(e, t);
|
|
9228
9228
|
if (Ee.throwOnInvalid)
|
|
9229
9229
|
throw new zy(n);
|
|
@@ -9255,7 +9255,7 @@ class B {
|
|
|
9255
9255
|
* @returns {string}
|
|
9256
9256
|
*/
|
|
9257
9257
|
static expandFormat(e, t = {}) {
|
|
9258
|
-
return tm(
|
|
9258
|
+
return tm(De.parseFormat(e), he.fromObject(t)).map((s) => s.val).join("");
|
|
9259
9259
|
}
|
|
9260
9260
|
static resetCache() {
|
|
9261
9261
|
Ir = void 0, So.clear();
|
|
@@ -9619,7 +9619,7 @@ class B {
|
|
|
9619
9619
|
* @return {Object}
|
|
9620
9620
|
*/
|
|
9621
9621
|
resolvedLocaleOptions(e = {}) {
|
|
9622
|
-
const { locale: t, numberingSystem: n, calendar: s } =
|
|
9622
|
+
const { locale: t, numberingSystem: n, calendar: s } = De.create(
|
|
9623
9623
|
this.loc.clone(e),
|
|
9624
9624
|
e
|
|
9625
9625
|
).resolvedOptions(this);
|
|
@@ -9825,7 +9825,7 @@ class B {
|
|
|
9825
9825
|
* @return {string}
|
|
9826
9826
|
*/
|
|
9827
9827
|
toFormat(e, t = {}) {
|
|
9828
|
-
return this.isValid ?
|
|
9828
|
+
return this.isValid ? De.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this, e) : Ra;
|
|
9829
9829
|
}
|
|
9830
9830
|
/**
|
|
9831
9831
|
* Returns a localized string representing this date. Accepts the same options as the Intl.DateTimeFormat constructor and any presets defined by Luxon, such as `DateTime.DATE_FULL` or `DateTime.TIME_SIMPLE`.
|
|
@@ -9847,7 +9847,7 @@ class B {
|
|
|
9847
9847
|
* @return {string}
|
|
9848
9848
|
*/
|
|
9849
9849
|
toLocaleString(e = bn, t = {}) {
|
|
9850
|
-
return this.isValid ?
|
|
9850
|
+
return this.isValid ? De.create(this.loc.clone(t), e).formatDateTime(this) : Ra;
|
|
9851
9851
|
}
|
|
9852
9852
|
/**
|
|
9853
9853
|
* Returns an array of format "parts", meaning individual tokens along with metadata. This is allows callers to post-process individual sections of the formatted output.
|
|
@@ -9863,7 +9863,7 @@ class B {
|
|
|
9863
9863
|
* //=> ]
|
|
9864
9864
|
*/
|
|
9865
9865
|
toLocaleParts(e = {}) {
|
|
9866
|
-
return this.isValid ?
|
|
9866
|
+
return this.isValid ? De.create(this.loc.clone(e), e).formatDateTimeParts(this) : [];
|
|
9867
9867
|
}
|
|
9868
9868
|
/**
|
|
9869
9869
|
* Returns an ISO 8601-compliant string representation of this DateTime
|
|
@@ -10221,7 +10221,7 @@ class B {
|
|
|
10221
10221
|
*/
|
|
10222
10222
|
static min(...e) {
|
|
10223
10223
|
if (!e.every(B.isDateTime))
|
|
10224
|
-
throw new
|
|
10224
|
+
throw new Fe("min requires all arguments be DateTimes");
|
|
10225
10225
|
return Ff(e, (t) => t.valueOf(), Math.min);
|
|
10226
10226
|
}
|
|
10227
10227
|
/**
|
|
@@ -10231,7 +10231,7 @@ class B {
|
|
|
10231
10231
|
*/
|
|
10232
10232
|
static max(...e) {
|
|
10233
10233
|
if (!e.every(B.isDateTime))
|
|
10234
|
-
throw new
|
|
10234
|
+
throw new Fe("max requires all arguments be DateTimes");
|
|
10235
10235
|
return Ff(e, (t) => t.valueOf(), Math.max);
|
|
10236
10236
|
}
|
|
10237
10237
|
// MISC
|
|
@@ -10288,7 +10288,7 @@ class B {
|
|
|
10288
10288
|
*/
|
|
10289
10289
|
static fromFormatParser(e, t, n = {}) {
|
|
10290
10290
|
if (J(e) || J(t))
|
|
10291
|
-
throw new
|
|
10291
|
+
throw new Fe(
|
|
10292
10292
|
"fromFormatParser requires an input string and a format parser"
|
|
10293
10293
|
);
|
|
10294
10294
|
const { locale: s = null, numberingSystem: i = null } = n, a = he.fromOpts({
|
|
@@ -10297,7 +10297,7 @@ class B {
|
|
|
10297
10297
|
defaultToEN: !0
|
|
10298
10298
|
});
|
|
10299
10299
|
if (!a.equals(t.locale))
|
|
10300
|
-
throw new
|
|
10300
|
+
throw new Fe(
|
|
10301
10301
|
`fromFormatParser called with a locale of ${a}, but the format parser was created for ${t.locale}`
|
|
10302
10302
|
);
|
|
10303
10303
|
const { result: o, zone: c, specificOffset: l, invalidReason: u } = t.explainFromTokens(e);
|
|
@@ -10473,13 +10473,13 @@ function Or(r) {
|
|
|
10473
10473
|
return B.fromJSDate(r);
|
|
10474
10474
|
if (r && typeof r == "object")
|
|
10475
10475
|
return B.fromObject(r);
|
|
10476
|
-
throw new
|
|
10476
|
+
throw new Fe(
|
|
10477
10477
|
`Unknown datetime argument: ${r}, of type ${typeof r}`
|
|
10478
10478
|
);
|
|
10479
10479
|
}
|
|
10480
10480
|
const Yf = async (r, e) => {
|
|
10481
10481
|
if (r) {
|
|
10482
|
-
const t = await ve(r, e);
|
|
10482
|
+
const t = await ve(r, [e]);
|
|
10483
10483
|
if (!t.valid)
|
|
10484
10484
|
throw new Error(t.message);
|
|
10485
10485
|
}
|
|
@@ -10715,44 +10715,44 @@ var Za, hd;
|
|
|
10715
10715
|
function nw() {
|
|
10716
10716
|
if (hd) return Za;
|
|
10717
10717
|
hd = 1;
|
|
10718
|
-
var r = Mo(), e = Uv(), t = Zo(), n = Wv(), s = zv(), i = zd(), a = Zd(), o = Bv(), c = Zv(), l = jd(), u = Gv(), f = qn(), d = Hv(), h = Qv(), p = Gd(), w = Dt(), _ = Mn(), b = ew(), T = wt(), C = rw(), I = Uo(), y = Br(), E = 1, S = 2, v = 4, x = "[object Arguments]", g = "[object Array]", O = "[object Boolean]", A = "[object Date]", m = "[object Error]", R = "[object Function]", k = "[object GeneratorFunction]", P = "[object Map]", N = "[object Number]", F = "[object Object]", U = "[object RegExp]", z = "[object Set]", ee = "[object String]", de = "[object Symbol]", M = "[object WeakMap]", oe = "[object ArrayBuffer]", ie = "[object DataView]",
|
|
10719
|
-
Z[x] = Z[g] = Z[oe] = Z[ie] = Z[O] = Z[A] = Z[
|
|
10718
|
+
var r = Mo(), e = Uv(), t = Zo(), n = Wv(), s = zv(), i = zd(), a = Zd(), o = Bv(), c = Zv(), l = jd(), u = Gv(), f = qn(), d = Hv(), h = Qv(), p = Gd(), w = Dt(), _ = Mn(), b = ew(), T = wt(), C = rw(), I = Uo(), y = Br(), E = 1, S = 2, v = 4, x = "[object Arguments]", g = "[object Array]", O = "[object Boolean]", A = "[object Date]", m = "[object Error]", R = "[object Function]", k = "[object GeneratorFunction]", P = "[object Map]", N = "[object Number]", F = "[object Object]", U = "[object RegExp]", z = "[object Set]", ee = "[object String]", de = "[object Symbol]", M = "[object WeakMap]", oe = "[object ArrayBuffer]", ie = "[object DataView]", xe = "[object Float32Array]", Se = "[object Float64Array]", Le = "[object Int8Array]", Ot = "[object Int16Array]", G = "[object Int32Array]", K = "[object Uint8Array]", $ = "[object Uint8ClampedArray]", Y = "[object Uint16Array]", j = "[object Uint32Array]", Z = {};
|
|
10719
|
+
Z[x] = Z[g] = Z[oe] = Z[ie] = Z[O] = Z[A] = Z[xe] = Z[Se] = Z[Le] = Z[Ot] = Z[G] = Z[P] = Z[N] = Z[F] = Z[U] = Z[z] = Z[ee] = Z[de] = Z[K] = Z[$] = Z[Y] = Z[j] = !0, Z[m] = Z[R] = Z[M] = !1;
|
|
10720
10720
|
function Te(H, ye, re, Xe, dt, Be) {
|
|
10721
|
-
var
|
|
10722
|
-
if (re && (
|
|
10723
|
-
return
|
|
10721
|
+
var Ne, wr = ye & E, Re = ye & S, br = ye & v;
|
|
10722
|
+
if (re && (Ne = dt ? re(H, Xe, dt, Be) : re(H)), Ne !== void 0)
|
|
10723
|
+
return Ne;
|
|
10724
10724
|
if (!T(H))
|
|
10725
10725
|
return H;
|
|
10726
10726
|
var _c = w(H);
|
|
10727
10727
|
if (_c) {
|
|
10728
|
-
if (
|
|
10729
|
-
return a(H,
|
|
10728
|
+
if (Ne = d(H), !wr)
|
|
10729
|
+
return a(H, Ne);
|
|
10730
10730
|
} else {
|
|
10731
10731
|
var Ht = f(H), vc = Ht == R || Ht == k;
|
|
10732
10732
|
if (_(H))
|
|
10733
10733
|
return i(H, wr);
|
|
10734
10734
|
if (Ht == F || Ht == x || vc && !dt) {
|
|
10735
|
-
if (
|
|
10736
|
-
return Re ? c(H, s(
|
|
10735
|
+
if (Ne = Re || vc ? {} : p(H), !wr)
|
|
10736
|
+
return Re ? c(H, s(Ne, H)) : o(H, n(Ne, H));
|
|
10737
10737
|
} else {
|
|
10738
10738
|
if (!Z[Ht])
|
|
10739
10739
|
return dt ? H : {};
|
|
10740
|
-
|
|
10740
|
+
Ne = h(H, Ht, wr);
|
|
10741
10741
|
}
|
|
10742
10742
|
}
|
|
10743
10743
|
Be || (Be = new r());
|
|
10744
10744
|
var wc = Be.get(H);
|
|
10745
10745
|
if (wc)
|
|
10746
10746
|
return wc;
|
|
10747
|
-
Be.set(H,
|
|
10748
|
-
|
|
10747
|
+
Be.set(H, Ne), C(H) ? H.forEach(function(Et) {
|
|
10748
|
+
Ne.add(Te(Et, ye, re, Et, H, Be));
|
|
10749
10749
|
}) : b(H) && H.forEach(function(Et, Pt) {
|
|
10750
|
-
|
|
10750
|
+
Ne.set(Pt, Te(Et, ye, re, Pt, H, Be));
|
|
10751
10751
|
});
|
|
10752
10752
|
var Im = br ? Re ? u : l : Re ? y : I, bc = _c ? void 0 : Im(H);
|
|
10753
10753
|
return e(bc || H, function(Et, Pt) {
|
|
10754
|
-
bc && (Pt = Et, Et = H[Pt]), t(
|
|
10755
|
-
}),
|
|
10754
|
+
bc && (Pt = Et, Et = H[Pt]), t(Ne, Pt, Te(Et, ye, re, Pt, H, Be));
|
|
10755
|
+
}), Ne;
|
|
10756
10756
|
}
|
|
10757
10757
|
return Za = Te, Za;
|
|
10758
10758
|
}
|
|
@@ -10853,7 +10853,7 @@ const we = /* @__PURE__ */ In(iw), Nt = (r) => {
|
|
|
10853
10853
|
throw new Error("Email body is too long");
|
|
10854
10854
|
return e;
|
|
10855
10855
|
}, oc = (r, e) => {
|
|
10856
|
-
const t = We(), n = Mt(), s = Ue(), i =
|
|
10856
|
+
const t = We(), n = Mt(), s = Ue(), i = Me(), a = r.at(-1);
|
|
10857
10857
|
if (!a)
|
|
10858
10858
|
throw new Error("EMPTY_PATH");
|
|
10859
10859
|
const o = s.collections[a], { labels: c, fields: l, preloadCache: u } = o, f = ft(a), d = i.collections?.[c.collection];
|
|
@@ -11068,7 +11068,7 @@ const we = /* @__PURE__ */ In(iw), Nt = (r) => {
|
|
|
11068
11068
|
n.includes(s) || t.includes(s) || await sr(s, r?.[s].constraints, r?.[s].range, r?.[s].orQueries, r);
|
|
11069
11069
|
return xr;
|
|
11070
11070
|
}, To = () => fm, lw = () => xr, uw = async (r, e, t, n, s) => {
|
|
11071
|
-
const { labels: i, preloadCache: a } = r, c = Jr()[i.collection], l = Ie(), u = ft(i.collection), f =
|
|
11071
|
+
const { labels: i, preloadCache: a } = r, c = Jr()[i.collection], l = Ie(), u = ft(i.collection), f = Me();
|
|
11072
11072
|
if (!f?.Role)
|
|
11073
11073
|
throw new Error("PERMISSION_DENIED");
|
|
11074
11074
|
if (!a?.roles.includes(f.Role))
|
|
@@ -11109,7 +11109,7 @@ const we = /* @__PURE__ */ In(iw), Nt = (r) => {
|
|
|
11109
11109
|
});
|
|
11110
11110
|
});
|
|
11111
11111
|
}, sr = async (r, e, t, n, s, i) => {
|
|
11112
|
-
const a = Ue(), o =
|
|
11112
|
+
const a = Ue(), o = Me();
|
|
11113
11113
|
if (!o?.Role)
|
|
11114
11114
|
throw new Error("PERMISSION_DENIED");
|
|
11115
11115
|
const c = a.collections[r], { labels: l, preloadCache: u } = c, f = To();
|
|
@@ -11179,7 +11179,7 @@ const fw = async (r, e) => {
|
|
|
11179
11179
|
});
|
|
11180
11180
|
t.push(d);
|
|
11181
11181
|
}), t;
|
|
11182
|
-
},
|
|
11182
|
+
}, Me = () => $t, dw = () => {
|
|
11183
11183
|
$t = null;
|
|
11184
11184
|
}, cc = (r) => {
|
|
11185
11185
|
if (typeof r == "object")
|
|
@@ -11230,7 +11230,7 @@ const fw = async (r, e) => {
|
|
|
11230
11230
|
})), l.length > 0)
|
|
11231
11231
|
throw new Error(l.join(", "));
|
|
11232
11232
|
}, dm = (r, e, t) => {
|
|
11233
|
-
const n = We(), s = Mt(), i = Ue(), a =
|
|
11233
|
+
const n = We(), s = Mt(), i = Ue(), a = Me(), o = r.at(-1);
|
|
11234
11234
|
if (!o)
|
|
11235
11235
|
throw new Error("EMPTY_PATH");
|
|
11236
11236
|
const c = i.collections[o], { labels: l } = c, u = a.collections?.[l.collection];
|
|
@@ -11276,7 +11276,7 @@ const fw = async (r, e) => {
|
|
|
11276
11276
|
hm(u);
|
|
11277
11277
|
return l?.result;
|
|
11278
11278
|
}, mm = async (r, e, t, n, s, i, a) => {
|
|
11279
|
-
const o =
|
|
11279
|
+
const o = Me();
|
|
11280
11280
|
if (!o)
|
|
11281
11281
|
throw new Error("PERMISSIONS_NOT_FOUND");
|
|
11282
11282
|
const c = e.at(-2), l = Ad(n.collections[c], n, o).map((d) => d.labels.collection);
|
|
@@ -11303,7 +11303,7 @@ const fw = async (r, e) => {
|
|
|
11303
11303
|
});
|
|
11304
11304
|
await Promise.all(f);
|
|
11305
11305
|
}, uc = async (r, e, t, n, s, i) => {
|
|
11306
|
-
if (!
|
|
11306
|
+
if (!Me())
|
|
11307
11307
|
throw new Error("PERMISSIONS_NOT_FOUND");
|
|
11308
11308
|
const o = e.at(-2);
|
|
11309
11309
|
t.fields ||= n.collections[o].fields.filter((u) => _e(u));
|
|
@@ -11356,7 +11356,7 @@ const fw = async (r, e) => {
|
|
|
11356
11356
|
"global",
|
|
11357
11357
|
"firebase",
|
|
11358
11358
|
"serverTimestampOptions"
|
|
11359
|
-
]), b =
|
|
11359
|
+
]), b = Me();
|
|
11360
11360
|
if (!b?.Role)
|
|
11361
11361
|
throw new Error("PERMISSIONS_DENIED");
|
|
11362
11362
|
if (f?.includes(b.Role))
|
|
@@ -11378,7 +11378,7 @@ const fw = async (r, e) => {
|
|
|
11378
11378
|
e.pagination.orderByField && e.pagination.orderByDirection ? e.pagination.startAfter || e.pagination.endBefore ? e.pagination.startAfter ? C = C.map((k, P) => me(k, rt(e.pagination.orderByField, e.pagination.orderByDirection), eo(I.last.get(P)), Xt(e.pagination.number))) : C = C.map((k, P) => me(k, rt(e.pagination.orderByField, e.pagination.orderByDirection), to(I.first.get(P)), Fr(e.pagination.number))) : C = C.map((k) => me(k, rt(e.pagination.orderByField, e.pagination.orderByDirection), Xt(e.pagination.number))) : !e.pagination.startAfter && !e.pagination.endBefore ? C = C.map((k) => me(k, Xt(e.pagination.number))) : e.pagination.startAfter ? C = C.map((k, P) => me(k, eo(I.last.get(P)), Xt(e.pagination.number))) : C = C.map((k, P) => me(k, to(I.first.get(P)), Fr(e.pagination.number)));
|
|
11379
11379
|
}
|
|
11380
11380
|
const y = { collection: c.collection };
|
|
11381
|
-
await ae("preOperation", d, w,
|
|
11381
|
+
await ae("preOperation", d, w, { operation: "read", context: y }), await ae("preRead", d, w, { context: y, refs: C, multiple: !0, listener: !1 });
|
|
11382
11382
|
const v = /* @__PURE__ */ new Map(), x = C.map(async (m) => {
|
|
11383
11383
|
let R;
|
|
11384
11384
|
return e?.only === "cache" ? R = await Od(m) : e?.only === "server" ? R = await Hm(m) : R = await Km(m), R;
|
|
@@ -11440,8 +11440,8 @@ const fw = async (r, e) => {
|
|
|
11440
11440
|
m[U.name] = z;
|
|
11441
11441
|
})), e?.noEmbeddingFields && U.type === "Embedding" && delete m[U.name];
|
|
11442
11442
|
await Promise.all(P);
|
|
11443
|
-
const N =
|
|
11444
|
-
await ae("postOperation", d, w, N), await ae("postRead", d, w,
|
|
11443
|
+
const N = { operation: "read", data: m, docId: m.id, context: y };
|
|
11444
|
+
await ae("postOperation", d, w, N), await ae("postRead", d, w, { context: y, refs: T, doc: m, listener: !1 });
|
|
11445
11445
|
}
|
|
11446
11446
|
return { cursor: I, pages: O, docs: Array.from(v.values()) };
|
|
11447
11447
|
}, mw = async (r, e, t) => {
|
|
@@ -11452,7 +11452,7 @@ const fw = async (r, e) => {
|
|
|
11452
11452
|
})).data.result;
|
|
11453
11453
|
return hm(l), l;
|
|
11454
11454
|
}, gm = async (r, e, t, n, s, i) => {
|
|
11455
|
-
const a =
|
|
11455
|
+
const a = Me();
|
|
11456
11456
|
if (!a)
|
|
11457
11457
|
throw new Error("PERMISSIONS_NOT_FOUND");
|
|
11458
11458
|
const o = e.at(-2), c = Ad(n.collections[o], n, a).map((f) => f.labels.collection);
|
|
@@ -11478,7 +11478,7 @@ const fw = async (r, e) => {
|
|
|
11478
11478
|
});
|
|
11479
11479
|
await Promise.all(u);
|
|
11480
11480
|
}, ym = async (r, e, t, n, s, i, a) => {
|
|
11481
|
-
if (!
|
|
11481
|
+
if (!Me())
|
|
11482
11482
|
throw new Error("PERMISSIONS_NOT_FOUND");
|
|
11483
11483
|
const c = e.at(-2);
|
|
11484
11484
|
t.fields ||= n.collections[c].fields.filter((f) => _e(f));
|
|
@@ -11530,7 +11530,7 @@ const fw = async (r, e) => {
|
|
|
11530
11530
|
"global",
|
|
11531
11531
|
"firebase",
|
|
11532
11532
|
"serverTimestampOptions"
|
|
11533
|
-
]), f = s.collections[n], { labels: d, access: h } = f, { serverReadOnly: p } = h, w = ft(d.collection), _ =
|
|
11533
|
+
]), f = s.collections[n], { labels: d, access: h } = f, { serverReadOnly: p } = h, w = ft(d.collection), _ = Me();
|
|
11534
11534
|
if (!_?.Role)
|
|
11535
11535
|
throw new Error("PERMISSIONS_DENIED");
|
|
11536
11536
|
if (p?.includes(_.Role))
|
|
@@ -11539,7 +11539,7 @@ const fw = async (r, e) => {
|
|
|
11539
11539
|
if (b.length === 0)
|
|
11540
11540
|
throw new Error("PERMISSION_DENIED");
|
|
11541
11541
|
const T = { collection: d.collection };
|
|
11542
|
-
await ae("preOperation", o, w,
|
|
11542
|
+
await ae("preOperation", o, w, { operation: "read", docId: e, context: T }), await ae("preRead", o, w, { context: T, refs: b, multiple: !1, listener: !1 });
|
|
11543
11543
|
let y = {};
|
|
11544
11544
|
const E = b.map(async (A) => {
|
|
11545
11545
|
let m;
|
|
@@ -11564,7 +11564,7 @@ const fw = async (r, e) => {
|
|
|
11564
11564
|
if (t?.noEmbeddingFields)
|
|
11565
11565
|
for (const A of f.fields)
|
|
11566
11566
|
A.type === "Embedding" && delete y[A.name];
|
|
11567
|
-
return await ae("postOperation", o, w,
|
|
11567
|
+
return await ae("postOperation", o, w, { operation: "read", data: y, docId: e, context: T }), await ae("postRead", o, w, { context: T, refs: b, doc: y, listener: !1 }), y;
|
|
11568
11568
|
}, pw = (r) => r !== null && typeof r == "object", _m = (r) => {
|
|
11569
11569
|
const e = (t) => {
|
|
11570
11570
|
Object.entries(t).forEach(([n, s]) => {
|
|
@@ -11585,7 +11585,7 @@ const fw = async (r, e) => {
|
|
|
11585
11585
|
user: n
|
|
11586
11586
|
})).data?.result;
|
|
11587
11587
|
}, fc = async (r, e, t, n) => {
|
|
11588
|
-
const s = n?.user, i = Mt(), a = Ue(), o = Ue(!0), c = gc(), l = Ie(), u = dr(), f = We(), d =
|
|
11588
|
+
const s = n?.user, i = Mt(), a = Ue(), o = Ue(!0), c = gc(), l = Ie(), u = dr(), f = We(), d = Me();
|
|
11589
11589
|
if (r.length === 0)
|
|
11590
11590
|
throw new Error("EMPTY_PATH");
|
|
11591
11591
|
const h = r.at(-1), p = Object.keys(a.collections).includes(h), w = l.disabledCollections?.includes(h);
|
|
@@ -11621,21 +11621,21 @@ const fw = async (r, e) => {
|
|
|
11621
11621
|
if (!await ne(l, ["global", "firebase", "enableEmulators"])) {
|
|
11622
11622
|
N();
|
|
11623
11623
|
try {
|
|
11624
|
-
const { isValid:
|
|
11625
|
-
if (!
|
|
11624
|
+
const { isValid: xe } = await _d(u, s.password);
|
|
11625
|
+
if (!xe)
|
|
11626
11626
|
throw new Error("Please create a stronger password");
|
|
11627
|
-
} catch (
|
|
11628
|
-
throw new Error(`VALIDATION_ERROR: ${
|
|
11627
|
+
} catch (xe) {
|
|
11628
|
+
throw new Error(`VALIDATION_ERROR: ${xe.message}`);
|
|
11629
11629
|
}
|
|
11630
11630
|
}
|
|
11631
11631
|
}
|
|
11632
|
-
const M =
|
|
11633
|
-
"update",
|
|
11634
|
-
{ ...g, ...t },
|
|
11635
|
-
A,
|
|
11636
|
-
O,
|
|
11637
|
-
we(g)
|
|
11638
|
-
|
|
11632
|
+
const M = {
|
|
11633
|
+
operation: "update",
|
|
11634
|
+
record: { ...g, ...t },
|
|
11635
|
+
context: A,
|
|
11636
|
+
batch: O,
|
|
11637
|
+
originalRecord: we(g)
|
|
11638
|
+
};
|
|
11639
11639
|
return await ae("preValidate", l, E, M), await gw(r, e, t, s ? { operation: s.operation, permissions: s.permissions, password: s.password } : void 0);
|
|
11640
11640
|
}
|
|
11641
11641
|
delete t.id;
|
|
@@ -11643,22 +11643,29 @@ const fw = async (r, e) => {
|
|
|
11643
11643
|
for (const M of C)
|
|
11644
11644
|
!_e(M) && ir(F[M.name]) && M.nullable && (F[M.name] = null);
|
|
11645
11645
|
if (Nt(F), Nt(g), !v && I && Ye("update", "started", F, r, e, _, x.uid, void 0, g), !v) {
|
|
11646
|
-
const M =
|
|
11647
|
-
"update",
|
|
11648
|
-
F,
|
|
11649
|
-
e,
|
|
11650
|
-
A,
|
|
11651
|
-
O,
|
|
11652
|
-
we(g)
|
|
11653
|
-
|
|
11646
|
+
const M = {
|
|
11647
|
+
operation: "update",
|
|
11648
|
+
data: F,
|
|
11649
|
+
docId: e,
|
|
11650
|
+
context: A,
|
|
11651
|
+
batch: O,
|
|
11652
|
+
originalRecord: we(g)
|
|
11653
|
+
};
|
|
11654
11654
|
await ae("preOperation", l, E, M);
|
|
11655
|
-
const oe =
|
|
11655
|
+
const oe = {
|
|
11656
|
+
operation: "update",
|
|
11657
|
+
data: F,
|
|
11658
|
+
docId: e,
|
|
11659
|
+
context: A,
|
|
11660
|
+
batch: O,
|
|
11661
|
+
originalRecord: we(g)
|
|
11662
|
+
};
|
|
11656
11663
|
await ae("preWrite", l, E, oe);
|
|
11657
11664
|
}
|
|
11658
11665
|
if (Xd(_, F, a), eh(_, F), !v)
|
|
11659
11666
|
try {
|
|
11660
11667
|
const M = { ...g, ...F };
|
|
11661
|
-
tr(M), await om("update", M, _, E,
|
|
11668
|
+
tr(M), await om("update", M, _, E, { operation: "update", record: M, context: A, batch: O, originalRecord: we(g) }, a), P && (N(), await lc("update", e, F, _, d));
|
|
11662
11669
|
} catch (M) {
|
|
11663
11670
|
throw new Error(`VALIDATION_ERROR: ${M.message}`);
|
|
11664
11671
|
}
|
|
@@ -11667,7 +11674,14 @@ const fw = async (r, e) => {
|
|
|
11667
11674
|
return tr(M), { id: e, ...M };
|
|
11668
11675
|
}
|
|
11669
11676
|
I && Ye("update", "success", F, r, e, _, x.uid, void 0, g);
|
|
11670
|
-
const U =
|
|
11677
|
+
const U = {
|
|
11678
|
+
operation: "update",
|
|
11679
|
+
data: F,
|
|
11680
|
+
docId: e,
|
|
11681
|
+
context: A,
|
|
11682
|
+
retry: !!v,
|
|
11683
|
+
originalRecord: we(g)
|
|
11684
|
+
}, z = { ...U };
|
|
11671
11685
|
await ae("postWrite", l, E, U), await ae("postOperation", l, E, z);
|
|
11672
11686
|
const ee = { ...g, ...F };
|
|
11673
11687
|
return tr(ee), { id: e, ...ee };
|
|
@@ -11722,17 +11736,17 @@ const fw = async (r, e) => {
|
|
|
11722
11736
|
}
|
|
11723
11737
|
}
|
|
11724
11738
|
}
|
|
11725
|
-
const y = C || T, E =
|
|
11726
|
-
r,
|
|
11727
|
-
n,
|
|
11728
|
-
t,
|
|
11729
|
-
s,
|
|
11730
|
-
y,
|
|
11731
|
-
o,
|
|
11732
|
-
f,
|
|
11733
|
-
_,
|
|
11734
|
-
r === "update" ? d : void 0
|
|
11735
|
-
|
|
11739
|
+
const y = C || T, E = {
|
|
11740
|
+
operation: r,
|
|
11741
|
+
data: n,
|
|
11742
|
+
docId: t,
|
|
11743
|
+
context: s,
|
|
11744
|
+
error: y,
|
|
11745
|
+
batch: o,
|
|
11746
|
+
retry: f,
|
|
11747
|
+
retries: _,
|
|
11748
|
+
originalRecord: r === "update" ? d : void 0
|
|
11749
|
+
}, S = T.code === "unavailable", v = await ae("postWriteError", p, a, E);
|
|
11736
11750
|
if (v?.resolved)
|
|
11737
11751
|
return;
|
|
11738
11752
|
if (!S && v?.retry) {
|
|
@@ -11765,7 +11779,7 @@ const fw = async (r, e) => {
|
|
|
11765
11779
|
id: n
|
|
11766
11780
|
})).data?.result;
|
|
11767
11781
|
}, vm = async (r, e, t) => {
|
|
11768
|
-
const n = t?.user, s = Mt(), i = Ue(), a = gc(), o = Ie(), c = dr(), l = We(), u =
|
|
11782
|
+
const n = t?.user, s = Mt(), i = Ue(), a = gc(), o = Ie(), c = dr(), l = We(), u = Me();
|
|
11769
11783
|
if (r.length === 0)
|
|
11770
11784
|
throw new Error("EMPTY_PATH");
|
|
11771
11785
|
const f = r.at(-1), d = Object.keys(i.collections).includes(f), h = o.disabledCollections?.includes(f);
|
|
@@ -11806,20 +11820,25 @@ const fw = async (r, e) => {
|
|
|
11806
11820
|
}
|
|
11807
11821
|
}
|
|
11808
11822
|
}
|
|
11809
|
-
return await ae("preValidate", o, I,
|
|
11823
|
+
return await ae("preValidate", o, I, {
|
|
11824
|
+
operation: "create",
|
|
11825
|
+
record: e,
|
|
11826
|
+
context: A,
|
|
11827
|
+
batch: g
|
|
11828
|
+
}), t?.onValid && t.onValid(), await yw(r, e, n ? { permissions: n.permissions, password: n.password } : void 0, O);
|
|
11810
11829
|
}
|
|
11811
11830
|
e.id = O;
|
|
11812
11831
|
const m = Ko("create", r, e, i, y, zt(), S.uid, Bt.now(), Lr(), !!E);
|
|
11813
|
-
if (T && (m[T.archivedField] = !1), Nt(m), !E && b && Ye("create", "started", m, r, O, p, S.uid), E || (await ae("preOperation", o, I,
|
|
11832
|
+
if (T && (m[T.archivedField] = !1), Nt(m), !E && b && Ye("create", "started", m, r, O, p, S.uid), E || (await ae("preOperation", o, I, { operation: "create", data: m, docId: O, context: A, batch: g }), await ae("preWrite", o, I, { operation: "create", data: m, docId: O, context: A, batch: g })), Xd(p, m, i), eh(p, m), E || await hy(m, p, I, u.Role), !E)
|
|
11814
11833
|
try {
|
|
11815
|
-
await om("create", m, p, I,
|
|
11834
|
+
await om("create", m, p, I, { operation: "create", record: m, context: A, batch: g }, i), v && (x(), await lc("create", O, m, p, u));
|
|
11816
11835
|
} catch (N) {
|
|
11817
11836
|
throw new Error(`VALIDATION_ERROR: ${N.message}`);
|
|
11818
11837
|
}
|
|
11819
11838
|
if (t?.onValid && t.onValid(), Nt(m), bg(m, O, p, i, S.uid, u), ac("create", g, r, O, m, i, p, t, a, Io, ko, Cn, (N) => ke(l, "tenants", s, "system_fields", w.collection, `${w.collection}-${N.name}`, O), (N, F) => ke(l, "tenants", s, "system_unique", w.collection, `Unique-${w.collection}-${N.name}`, F), (N) => ke(l, "tenants", s, "system_fields", w.collection, `${w.collection}-${N}`, O)), g.set(ke(l, "tenants", s, r.join("/"), O), m), !E && b && Ye("create", "written", m, r, O, p, S.uid), await dc("create", r, O, m, A, p, I, g, S.uid, b || !1, u, !!E), E?.type === "unique")
|
|
11820
11839
|
return { id: O, ...m };
|
|
11821
11840
|
b && Ye("create", "success", m, r, O, p, S.uid);
|
|
11822
|
-
const R =
|
|
11841
|
+
const R = { operation: "create", data: m, docId: O, context: A, retry: !!E }, k = { ...R };
|
|
11823
11842
|
return await ae("postWrite", o, I, R), await ae("postOperation", o, I, k), { id: O, ...m };
|
|
11824
11843
|
}, _w = async (r, e) => {
|
|
11825
11844
|
const t = it(), n = ze(), s = Ve(t, n.STOKER_FB_FUNCTIONS_REGION);
|
|
@@ -11829,7 +11848,7 @@ const fw = async (r, e) => {
|
|
|
11829
11848
|
id: e
|
|
11830
11849
|
})).data?.result;
|
|
11831
11850
|
}, vw = async (r, e, t) => {
|
|
11832
|
-
const n = Mt(), s = Ue(), i = gc(), a = dr(), o = We(), c = Ie(), l =
|
|
11851
|
+
const n = Mt(), s = Ue(), i = gc(), a = dr(), o = We(), c = Ie(), l = Me();
|
|
11833
11852
|
if (r.length === 0)
|
|
11834
11853
|
throw new Error("EMPTY_PATH");
|
|
11835
11854
|
const u = r.at(-1), f = Object.keys(s.collections).includes(u), d = c.disabledCollections?.includes(u);
|
|
@@ -11866,8 +11885,8 @@ const fw = async (r, e) => {
|
|
|
11866
11885
|
return await _w(r, e);
|
|
11867
11886
|
delete x.id;
|
|
11868
11887
|
const g = Ao(o), O = { collection: p.collection }, A = Ko("delete", r, x, s, I, zt(), E.uid, Bt.now(), Lr(), !!y);
|
|
11869
|
-
Nt(A), !y && _ && Ye("delete", "started", A, r, e, h, E.uid), y || (await ae("preOperation", c, C,
|
|
11870
|
-
const R =
|
|
11888
|
+
Nt(A), !y && _ && Ye("delete", "started", A, r, e, h, E.uid), y || (await ae("preOperation", c, C, { operation: "delete", data: A, docId: e, context: O, batch: g }), await ae("preWrite", c, C, { operation: "delete", data: A, docId: e, context: O, batch: g })), Nt(A), Eg(A, e, h, s, E.uid, l), ac("delete", g, r, e, A, s, h, t, i, Io, ko, Cn, (N) => ke(o, "tenants", n, "system_fields", p.collection, `${p.collection}-${N.name}`, e), (N, F) => ke(o, "tenants", n, "system_unique", p.collection, `Unique-${p.collection}-${N.name}`, F), (N) => ke(o, "tenants", n, "system_fields", p.collection, `${p.collection}-${N}`, e)), g.delete(ke(o, "tenants", n, r.join("/"), e)), !y && _ && Ye("delete", "written", A, r, e, h, E.uid), await dc("delete", r, e, A, O, h, C, g, E.uid, _ || !1, l, !!y), _ && Ye("delete", "success", { ...A, ...y?.record || {} }, r, e, h, E.uid);
|
|
11889
|
+
const R = { operation: "delete", data: A, docId: e, context: O, retry: !!y }, k = { ...R };
|
|
11871
11890
|
return await ae("postWrite", c, C, R), await ae("postOperation", c, C, k), { id: e, ...A };
|
|
11872
11891
|
}, wm = (r) => {
|
|
11873
11892
|
if (typeof r == "object")
|
|
@@ -12071,7 +12090,7 @@ const Ya = {
|
|
|
12071
12090
|
},
|
|
12072
12091
|
getVersionInfo: Om,
|
|
12073
12092
|
getMaintenanceInfo: Tw,
|
|
12074
|
-
getCurrentUserPermissions:
|
|
12093
|
+
getCurrentUserPermissions: Me,
|
|
12075
12094
|
getLoadingState: To,
|
|
12076
12095
|
getAppCheck() {
|
|
12077
12096
|
return At.main;
|
|
@@ -12277,8 +12296,8 @@ const Gw = async (r, e, t, n) => {
|
|
|
12277
12296
|
mc = Object.fromEntries(oe), pc = M.data.currentUserRoleGroups, Tm = Sg(Object.keys(Pr.collections), e, "web", Co, n);
|
|
12278
12297
|
const ie = await fw($e, O);
|
|
12279
12298
|
Rn.push(...ie), x === "WRITE" && bw(Pr, $e), await ve(pe.postLogin, [$e]);
|
|
12280
|
-
const
|
|
12281
|
-
document.dispatchEvent(
|
|
12299
|
+
const xe = new Event("stoker:ready");
|
|
12300
|
+
document.dispatchEvent(xe);
|
|
12282
12301
|
} else if ($e) {
|
|
12283
12302
|
kw(), Iw().forEach((k) => {
|
|
12284
12303
|
k();
|
|
@@ -12397,7 +12416,7 @@ const Gw = async (r, e, t, n) => {
|
|
|
12397
12416
|
const i = r.at(-1);
|
|
12398
12417
|
if (!i)
|
|
12399
12418
|
throw new Error("EMPTY_PATH");
|
|
12400
|
-
const a =
|
|
12419
|
+
const a = Me();
|
|
12401
12420
|
if (!a?.Role)
|
|
12402
12421
|
throw new Error("PERMISSIONS_NOT_FOUND");
|
|
12403
12422
|
const o = Ue(!0), l = Jr()[i], u = We(), f = o.collections[i];
|
|
@@ -12414,7 +12433,7 @@ const Gw = async (r, e, t, n) => {
|
|
|
12414
12433
|
if (C.length === 0)
|
|
12415
12434
|
throw new Error("PERMISSION_DENIED");
|
|
12416
12435
|
const I = h?.roles?.includes(a.Role), y = { collection: d.collection };
|
|
12417
|
-
await ae("preOperation", p, b,
|
|
12436
|
+
await ae("preOperation", p, b, { operation: "read", docId: e, context: y }), await ae("preRead", p, b, { context: y, refs: C, multiple: !1, listener: !0 });
|
|
12418
12437
|
const v = /* @__PURE__ */ new Map(), x = [];
|
|
12419
12438
|
let g = {};
|
|
12420
12439
|
const O = /* @__PURE__ */ new Map();
|
|
@@ -12470,7 +12489,7 @@ const Gw = async (r, e, t, n) => {
|
|
|
12470
12489
|
const oe = g[M.name];
|
|
12471
12490
|
if (!oe)
|
|
12472
12491
|
continue;
|
|
12473
|
-
for (const [ie,
|
|
12492
|
+
for (const [ie, xe] of Object.entries(oe))
|
|
12474
12493
|
if (ee.has(`${M.name}_${ie}`)) {
|
|
12475
12494
|
const Se = async () => {
|
|
12476
12495
|
oe[ie].id ? (z.set(`${M.name}_${ie}`, !0), Array.from(z.values()).every((Le) => Le) && (F({}), A())) : setTimeout(Se, 100);
|
|
@@ -12478,7 +12497,7 @@ const Gw = async (r, e, t, n) => {
|
|
|
12478
12497
|
Se();
|
|
12479
12498
|
} else {
|
|
12480
12499
|
const Se = o.collections[M.collection], { access: Le } = Se, { serverReadOnly: Ot } = Le;
|
|
12481
|
-
Ot?.includes(a.Role) ? vr([...
|
|
12500
|
+
Ot?.includes(a.Role) ? vr([...xe.Collection_Path], ie, {
|
|
12482
12501
|
noComputedFields: s?.noComputedFields,
|
|
12483
12502
|
noEmbeddingFields: s?.noEmbeddingFields
|
|
12484
12503
|
}).then((K) => {
|
|
@@ -12490,23 +12509,23 @@ const Gw = async (r, e, t, n) => {
|
|
|
12490
12509
|
z.set(`${M.name}_${ie}`, !0), m.delete(`${M.name}_${ie}`);
|
|
12491
12510
|
return;
|
|
12492
12511
|
}
|
|
12493
|
-
oe[ie] = K, z.set(`${M.name}_${ie}`, !0), Array.from(z.values()).every(($) => $) && (F({}), A(), N.fromCache === !1 && (ae("postOperation", p, b,
|
|
12494
|
-
"read",
|
|
12495
|
-
g,
|
|
12496
|
-
e,
|
|
12497
|
-
y
|
|
12498
|
-
|
|
12499
|
-
y,
|
|
12500
|
-
C,
|
|
12501
|
-
g,
|
|
12502
|
-
!0
|
|
12503
|
-
|
|
12512
|
+
oe[ie] = K, z.set(`${M.name}_${ie}`, !0), Array.from(z.values()).every(($) => $) && (F({}), A(), N.fromCache === !1 && (ae("postOperation", p, b, {
|
|
12513
|
+
operation: "read",
|
|
12514
|
+
data: g,
|
|
12515
|
+
docId: e,
|
|
12516
|
+
context: y
|
|
12517
|
+
}), ae("postRead", p, b, {
|
|
12518
|
+
context: y,
|
|
12519
|
+
refs: C,
|
|
12520
|
+
doc: g,
|
|
12521
|
+
listener: !0
|
|
12522
|
+
})));
|
|
12504
12523
|
}).catch((K) => {
|
|
12505
|
-
delete oe[ie], K.code !== "permission-denied" && n && n(new Error(`Error fetching relation document in collection ${M.collection} with ID ${e} at location ${
|
|
12524
|
+
delete oe[ie], K.code !== "permission-denied" && n && n(new Error(`Error fetching relation document in collection ${M.collection} with ID ${e} at location ${xe.Collection_Path?.join("/")}`, {
|
|
12506
12525
|
cause: K
|
|
12507
12526
|
}));
|
|
12508
12527
|
}) : km(
|
|
12509
|
-
[...
|
|
12528
|
+
[...xe.Collection_Path],
|
|
12510
12529
|
ie,
|
|
12511
12530
|
(K) => {
|
|
12512
12531
|
if (!K) {
|
|
@@ -12517,21 +12536,21 @@ const Gw = async (r, e, t, n) => {
|
|
|
12517
12536
|
R.get(`${M.name}_${ie}`) && R.get(`${M.name}_${ie}`).listener(), z.set(`${M.name}_${ie}`, !0), m.delete(`${M.name}_${ie}`);
|
|
12518
12537
|
return;
|
|
12519
12538
|
}
|
|
12520
|
-
oe[ie] = K, z.set(`${M.name}_${ie}`, !0), Array.from(z.values()).every(($) => $) && (F({}), A(), N.fromCache === !1 && (ae("postOperation", p, b,
|
|
12521
|
-
"read",
|
|
12522
|
-
g,
|
|
12523
|
-
e,
|
|
12524
|
-
y
|
|
12525
|
-
|
|
12526
|
-
y,
|
|
12527
|
-
C,
|
|
12528
|
-
g,
|
|
12529
|
-
!0
|
|
12530
|
-
|
|
12539
|
+
oe[ie] = K, z.set(`${M.name}_${ie}`, !0), Array.from(z.values()).every(($) => $) && (F({}), A(), N.fromCache === !1 && (ae("postOperation", p, b, {
|
|
12540
|
+
operation: "read",
|
|
12541
|
+
data: g,
|
|
12542
|
+
docId: e,
|
|
12543
|
+
context: y
|
|
12544
|
+
}), ae("postRead", p, b, {
|
|
12545
|
+
context: y,
|
|
12546
|
+
refs: C,
|
|
12547
|
+
doc: g,
|
|
12548
|
+
listener: !0
|
|
12549
|
+
})));
|
|
12531
12550
|
},
|
|
12532
12551
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12533
12552
|
(K) => {
|
|
12534
|
-
delete oe[ie], K.code !== "permission-denied" && n && n(new Error(`Error fetching relation document in collection ${M.collection} with ID ${e} at location ${
|
|
12553
|
+
delete oe[ie], K.code !== "permission-denied" && n && n(new Error(`Error fetching relation document in collection ${M.collection} with ID ${e} at location ${xe.Collection_Path?.join("/")}`, {
|
|
12535
12554
|
cause: K
|
|
12536
12555
|
}));
|
|
12537
12556
|
},
|
|
@@ -12563,14 +12582,19 @@ const Gw = async (r, e, t, n) => {
|
|
|
12563
12582
|
v.set(N.path, !0), g ||= {}, g.id ||= U.id, g = { ...g, ...z }, delete g.Collection_Path_String;
|
|
12564
12583
|
const ee = O.get(N) || /* @__PURE__ */ new Set();
|
|
12565
12584
|
lm(z, ee), O.set(N, ee), v.size === C.length && P(U.metadata).then(() => {
|
|
12566
|
-
A(), U.metadata.fromCache === !1 && (ae("postOperation", p, b,
|
|
12567
|
-
"read",
|
|
12568
|
-
g,
|
|
12569
|
-
e,
|
|
12570
|
-
y
|
|
12571
|
-
|
|
12585
|
+
A(), U.metadata.fromCache === !1 && (ae("postOperation", p, b, {
|
|
12586
|
+
operation: "read",
|
|
12587
|
+
data: g,
|
|
12588
|
+
docId: e,
|
|
12589
|
+
context: y
|
|
12590
|
+
}), ae("postRead", p, b, {
|
|
12591
|
+
context: y,
|
|
12592
|
+
refs: C,
|
|
12593
|
+
doc: g,
|
|
12594
|
+
listener: !0
|
|
12595
|
+
}));
|
|
12572
12596
|
});
|
|
12573
|
-
} else g && (g = void 0, A(), U.metadata.fromCache === !1 && (ae("postOperation", p, b,
|
|
12597
|
+
} else g && (g = void 0, A(), U.metadata.fromCache === !1 && (ae("postOperation", p, b, { operation: "read", docId: e, context: y }), ae("postRead", p, b, { context: y, refs: C, listener: !0 })));
|
|
12574
12598
|
}, (U) => {
|
|
12575
12599
|
n && n(U), x.forEach((z) => z());
|
|
12576
12600
|
});
|
|
@@ -12599,7 +12623,7 @@ const Gw = async (r, e, t, n) => {
|
|
|
12599
12623
|
const s = n?.constraints, i = r.at(-1);
|
|
12600
12624
|
if (!i)
|
|
12601
12625
|
throw new Error("EMPTY_PATH");
|
|
12602
|
-
const a =
|
|
12626
|
+
const a = Me();
|
|
12603
12627
|
if (!a?.Role)
|
|
12604
12628
|
throw new Error("PERMISSION_DENIED");
|
|
12605
12629
|
const o = Ue(!0), l = Jr()[i], u = We(), f = o.collections[i], { labels: d, preloadCache: h, access: p } = f, { serverReadOnly: w } = p, _ = Ie(), b = Object.keys(o.collections).includes(i), T = _.disabledCollections?.includes(i);
|
|
@@ -12656,7 +12680,7 @@ const Gw = async (r, e, t, n) => {
|
|
|
12656
12680
|
});
|
|
12657
12681
|
}
|
|
12658
12682
|
const x = { collection: d.collection };
|
|
12659
|
-
await ae("preOperation", _, C,
|
|
12683
|
+
await ae("preOperation", _, C, { operation: "read", context: x }), await ae("preRead", _, C, { context: x, refs: S, multiple: !0, listener: !0 });
|
|
12660
12684
|
let A = !0;
|
|
12661
12685
|
const m = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new Map(), k = [], P = /* @__PURE__ */ new Map(), N = /* @__PURE__ */ new Map(), F = /* @__PURE__ */ new Map(), U = (G, K, $) => {
|
|
12662
12686
|
const Y = [];
|
|
@@ -12667,9 +12691,14 @@ const Gw = async (r, e, t, n) => {
|
|
|
12667
12691
|
j[Z.name] = Te;
|
|
12668
12692
|
})), n?.noEmbeddingFields && Z.type === "Embedding" && delete j[Z.name];
|
|
12669
12693
|
}), Promise.all(Y).then(() => {
|
|
12670
|
-
e(Array.from(P.values()), G, K), K?.fromCache === !1 && P.forEach((j) => {
|
|
12671
|
-
const Z =
|
|
12672
|
-
|
|
12694
|
+
e(Array.from(P.values()), G, K), (xe || K?.fromCache === !1) && P.forEach((j) => {
|
|
12695
|
+
const Z = {
|
|
12696
|
+
operation: "read",
|
|
12697
|
+
data: j,
|
|
12698
|
+
docId: j.id,
|
|
12699
|
+
context: x
|
|
12700
|
+
};
|
|
12701
|
+
ae("postOperation", _, C, Z), ae("postRead", _, C, { context: x, refs: E, doc: j, listener: !0 });
|
|
12673
12702
|
});
|
|
12674
12703
|
});
|
|
12675
12704
|
}, z = (G, K) => {
|
|
@@ -12731,8 +12760,8 @@ const Gw = async (r, e, t, n) => {
|
|
|
12731
12760
|
};
|
|
12732
12761
|
dt();
|
|
12733
12762
|
} else {
|
|
12734
|
-
const dt = o.collections[H.collection], { access: Be } = dt, { serverReadOnly:
|
|
12735
|
-
|
|
12763
|
+
const dt = o.collections[H.collection], { access: Be } = dt, { serverReadOnly: Ne } = Be;
|
|
12764
|
+
Ne?.includes(a.Role) ? vr([...Xe.Collection_Path], re).then((Re) => {
|
|
12736
12765
|
if (!Re) {
|
|
12737
12766
|
delete ye[re];
|
|
12738
12767
|
return;
|
|
@@ -12796,12 +12825,12 @@ const Gw = async (r, e, t, n) => {
|
|
|
12796
12825
|
K.id ||= $.id, K = { ...K, ...Y }, delete K.Collection_Path_String;
|
|
12797
12826
|
const j = N.get($.id) || /* @__PURE__ */ new Map(), Z = j.get(G) || /* @__PURE__ */ new Set();
|
|
12798
12827
|
lm(Y, Z), j.set(G, Z), N.set($.id, j), P.set($.id, K);
|
|
12799
|
-
},
|
|
12828
|
+
}, xe = n?.only === "cache" || y;
|
|
12800
12829
|
y && n?.tempCache && await sr(d.collection, n.tempCache?.constraints, void 0, void 0, void 0, n.tempCache?.label);
|
|
12801
12830
|
for (const G of S) {
|
|
12802
12831
|
let K = !0;
|
|
12803
|
-
const $ = hr(G, { source:
|
|
12804
|
-
(
|
|
12832
|
+
const $ = hr(G, { source: xe ? "cache" : "default", includeMetadataChanges: !0 }, (Y) => {
|
|
12833
|
+
(xe || Y.metadata.fromCache === !1) && (m.set(G, !0), v.first.set(S.indexOf(G), Y.docs[0]), v.last.set(S.indexOf(G), Y.docs.at(-1) || Y.docs[0]), A && n?.relations || z(v, Y.metadata)), m.get(G) === !0 && (K ? (Y.docs.forEach((j) => {
|
|
12805
12834
|
const Z = P.get(j.id) || {}, Te = F.get(j.id) || 0;
|
|
12806
12835
|
F.set(j.id, Te + 1), ie(G, Z, j);
|
|
12807
12836
|
}), K = !1) : Y.docChanges().forEach((j) => {
|
|
@@ -12911,7 +12940,7 @@ export {
|
|
|
12911
12940
|
oc as getCollectionRefs,
|
|
12912
12941
|
zt as getConnectionStatus,
|
|
12913
12942
|
Hw as getCurrentUser,
|
|
12914
|
-
|
|
12943
|
+
Me as getCurrentUserPermissions,
|
|
12915
12944
|
Jr as getCurrentUserRoleGroups,
|
|
12916
12945
|
dm as getDocumentRefs,
|
|
12917
12946
|
ze as getEnv,
|
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.46",
|
|
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.29",
|
|
28
|
+
"@stoker-platform/utils": "0.5.38",
|
|
29
29
|
"@types/lodash": "^4.17.24",
|
|
30
30
|
"@types/luxon": "^3.7.1",
|
|
31
31
|
"firebase": "^12.11.0",
|