@stoker-platform/node-client 0.5.89 → 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.cjs +6 -6
- package/dist/bundle.js +106 -98
- package/package.json +1 -1
package/dist/bundle.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import Je from "lodash/isEqual.js";
|
|
2
2
|
import Ko from "lodash/merge.js";
|
|
3
3
|
import Xo from "lodash/set.js";
|
|
4
|
-
import
|
|
4
|
+
import ye from "lodash/cloneDeep.js";
|
|
5
5
|
import { getApp as Hs, initializeApp as fi, applicationDefault as hi } from "firebase-admin/app";
|
|
6
|
-
import { getFirestore as ea, Timestamp as ht, FieldValue as
|
|
6
|
+
import { getFirestore as ea, Timestamp as ht, FieldValue as ge } from "firebase-admin/firestore";
|
|
7
7
|
import { pathToFileURL as mi } from "node:url";
|
|
8
8
|
import ta from "cross-spawn";
|
|
9
9
|
import { getDatabase as pi } from "firebase-admin/database";
|
|
@@ -2508,13 +2508,13 @@ ze.create = (t, e) => new ze({
|
|
|
2508
2508
|
...X(e)
|
|
2509
2509
|
});
|
|
2510
2510
|
function Dt(t) {
|
|
2511
|
-
if (t instanceof
|
|
2511
|
+
if (t instanceof me) {
|
|
2512
2512
|
const e = {};
|
|
2513
2513
|
for (const n in t.shape) {
|
|
2514
2514
|
const s = t.shape[n];
|
|
2515
2515
|
e[n] = ct.create(Dt(s));
|
|
2516
2516
|
}
|
|
2517
|
-
return new
|
|
2517
|
+
return new me({
|
|
2518
2518
|
...t._def,
|
|
2519
2519
|
shape: () => e
|
|
2520
2520
|
});
|
|
@@ -2523,7 +2523,7 @@ function Dt(t) {
|
|
|
2523
2523
|
type: Dt(t.element)
|
|
2524
2524
|
}) : t instanceof ct ? ct.create(Dt(t.unwrap())) : t instanceof Wt ? Wt.create(Dt(t.unwrap())) : t instanceof bt ? bt.create(t.items.map((e) => Dt(e))) : t;
|
|
2525
2525
|
}
|
|
2526
|
-
class
|
|
2526
|
+
class me extends te {
|
|
2527
2527
|
constructor() {
|
|
2528
2528
|
super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
|
|
2529
2529
|
}
|
|
@@ -2600,7 +2600,7 @@ class pe extends te {
|
|
|
2600
2600
|
return this._def.shape();
|
|
2601
2601
|
}
|
|
2602
2602
|
strict(e) {
|
|
2603
|
-
return q.errToObj, new
|
|
2603
|
+
return q.errToObj, new me({
|
|
2604
2604
|
...this._def,
|
|
2605
2605
|
unknownKeys: "strict",
|
|
2606
2606
|
...e !== void 0 ? {
|
|
@@ -2616,13 +2616,13 @@ class pe extends te {
|
|
|
2616
2616
|
});
|
|
2617
2617
|
}
|
|
2618
2618
|
strip() {
|
|
2619
|
-
return new
|
|
2619
|
+
return new me({
|
|
2620
2620
|
...this._def,
|
|
2621
2621
|
unknownKeys: "strip"
|
|
2622
2622
|
});
|
|
2623
2623
|
}
|
|
2624
2624
|
passthrough() {
|
|
2625
|
-
return new
|
|
2625
|
+
return new me({
|
|
2626
2626
|
...this._def,
|
|
2627
2627
|
unknownKeys: "passthrough"
|
|
2628
2628
|
});
|
|
@@ -2645,7 +2645,7 @@ class pe extends te {
|
|
|
2645
2645
|
// }) as any;
|
|
2646
2646
|
// };
|
|
2647
2647
|
extend(e) {
|
|
2648
|
-
return new
|
|
2648
|
+
return new me({
|
|
2649
2649
|
...this._def,
|
|
2650
2650
|
shape: () => ({
|
|
2651
2651
|
...this._def.shape(),
|
|
@@ -2659,7 +2659,7 @@ class pe extends te {
|
|
|
2659
2659
|
* upgrade if you are experiencing issues.
|
|
2660
2660
|
*/
|
|
2661
2661
|
merge(e) {
|
|
2662
|
-
return new
|
|
2662
|
+
return new me({
|
|
2663
2663
|
unknownKeys: e._def.unknownKeys,
|
|
2664
2664
|
catchall: e._def.catchall,
|
|
2665
2665
|
shape: () => ({
|
|
@@ -2729,7 +2729,7 @@ class pe extends te {
|
|
|
2729
2729
|
// return merged;
|
|
2730
2730
|
// }
|
|
2731
2731
|
catchall(e) {
|
|
2732
|
-
return new
|
|
2732
|
+
return new me({
|
|
2733
2733
|
...this._def,
|
|
2734
2734
|
catchall: e
|
|
2735
2735
|
});
|
|
@@ -2738,7 +2738,7 @@ class pe extends te {
|
|
|
2738
2738
|
const n = {};
|
|
2739
2739
|
for (const s of se.objectKeys(e))
|
|
2740
2740
|
e[s] && this.shape[s] && (n[s] = this.shape[s]);
|
|
2741
|
-
return new
|
|
2741
|
+
return new me({
|
|
2742
2742
|
...this._def,
|
|
2743
2743
|
shape: () => n
|
|
2744
2744
|
});
|
|
@@ -2747,7 +2747,7 @@ class pe extends te {
|
|
|
2747
2747
|
const n = {};
|
|
2748
2748
|
for (const s of se.objectKeys(this.shape))
|
|
2749
2749
|
e[s] || (n[s] = this.shape[s]);
|
|
2750
|
-
return new
|
|
2750
|
+
return new me({
|
|
2751
2751
|
...this._def,
|
|
2752
2752
|
shape: () => n
|
|
2753
2753
|
});
|
|
@@ -2764,7 +2764,7 @@ class pe extends te {
|
|
|
2764
2764
|
const r = this.shape[s];
|
|
2765
2765
|
e && !e[s] ? n[s] = r : n[s] = r.optional();
|
|
2766
2766
|
}
|
|
2767
|
-
return new
|
|
2767
|
+
return new me({
|
|
2768
2768
|
...this._def,
|
|
2769
2769
|
shape: () => n
|
|
2770
2770
|
});
|
|
@@ -2780,7 +2780,7 @@ class pe extends te {
|
|
|
2780
2780
|
i = i._def.innerType;
|
|
2781
2781
|
n[s] = i;
|
|
2782
2782
|
}
|
|
2783
|
-
return new
|
|
2783
|
+
return new me({
|
|
2784
2784
|
...this._def,
|
|
2785
2785
|
shape: () => n
|
|
2786
2786
|
});
|
|
@@ -2789,21 +2789,21 @@ class pe extends te {
|
|
|
2789
2789
|
return Si(se.objectKeys(this.shape));
|
|
2790
2790
|
}
|
|
2791
2791
|
}
|
|
2792
|
-
|
|
2792
|
+
me.create = (t, e) => new me({
|
|
2793
2793
|
shape: () => t,
|
|
2794
2794
|
unknownKeys: "strip",
|
|
2795
2795
|
catchall: ft.create(),
|
|
2796
2796
|
typeName: Y.ZodObject,
|
|
2797
2797
|
...X(e)
|
|
2798
2798
|
});
|
|
2799
|
-
|
|
2799
|
+
me.strictCreate = (t, e) => new me({
|
|
2800
2800
|
shape: () => t,
|
|
2801
2801
|
unknownKeys: "strict",
|
|
2802
2802
|
catchall: ft.create(),
|
|
2803
2803
|
typeName: Y.ZodObject,
|
|
2804
2804
|
...X(e)
|
|
2805
2805
|
});
|
|
2806
|
-
|
|
2806
|
+
me.lazycreate = (t, e) => new me({
|
|
2807
2807
|
shape: t,
|
|
2808
2808
|
unknownKeys: "strip",
|
|
2809
2809
|
catchall: ft.create(),
|
|
@@ -3570,25 +3570,25 @@ var Y;
|
|
|
3570
3570
|
(function(t) {
|
|
3571
3571
|
t.ZodString = "ZodString", t.ZodNumber = "ZodNumber", t.ZodNaN = "ZodNaN", t.ZodBigInt = "ZodBigInt", t.ZodBoolean = "ZodBoolean", t.ZodDate = "ZodDate", t.ZodSymbol = "ZodSymbol", t.ZodUndefined = "ZodUndefined", t.ZodNull = "ZodNull", t.ZodAny = "ZodAny", t.ZodUnknown = "ZodUnknown", t.ZodNever = "ZodNever", t.ZodVoid = "ZodVoid", t.ZodArray = "ZodArray", t.ZodObject = "ZodObject", t.ZodUnion = "ZodUnion", t.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", t.ZodIntersection = "ZodIntersection", t.ZodTuple = "ZodTuple", t.ZodRecord = "ZodRecord", t.ZodMap = "ZodMap", t.ZodSet = "ZodSet", t.ZodFunction = "ZodFunction", t.ZodLazy = "ZodLazy", t.ZodLiteral = "ZodLiteral", t.ZodEnum = "ZodEnum", t.ZodEffects = "ZodEffects", t.ZodNativeEnum = "ZodNativeEnum", t.ZodOptional = "ZodOptional", t.ZodNullable = "ZodNullable", t.ZodDefault = "ZodDefault", t.ZodCatch = "ZodCatch", t.ZodPromise = "ZodPromise", t.ZodBranded = "ZodBranded", t.ZodPipeline = "ZodPipeline", t.ZodReadonly = "ZodReadonly";
|
|
3572
3572
|
})(Y || (Y = {}));
|
|
3573
|
-
const xe = Ke.create, Ot = Lt.create, on = Is.create, fs = xs.create,
|
|
3573
|
+
const xe = Ke.create, Ot = Lt.create, on = Is.create, fs = xs.create, we = Ns.create;
|
|
3574
3574
|
ft.create;
|
|
3575
|
-
const St = ze.create, qe =
|
|
3575
|
+
const St = ze.create, qe = me.create, Se = Un.create;
|
|
3576
3576
|
Wn.create;
|
|
3577
3577
|
bt.create;
|
|
3578
3578
|
const mn = jn.create, Ie = Ds.create, zn = Vt.create;
|
|
3579
3579
|
Zn.create;
|
|
3580
3580
|
ct.create;
|
|
3581
3581
|
Wt.create;
|
|
3582
|
-
const xn = () =>
|
|
3582
|
+
const xn = () => we().refine((t) => t && (t.seconds !== void 0 && t.nanoseconds !== void 0 || t._seconds !== void 0 && t._nanoseconds !== void 0), {
|
|
3583
3583
|
message: "Value is not a valid timestamp"
|
|
3584
|
-
}), xr = () =>
|
|
3584
|
+
}), xr = () => we().refine((t) => t && (t._methodName === "serverTimestamp" || t.constructor.name === "ServerTimestampTransform"), {
|
|
3585
3585
|
message: "Value is not a valid server timestamp"
|
|
3586
3586
|
}), Ii = (t, e, n) => {
|
|
3587
3587
|
const s = {};
|
|
3588
3588
|
if (t.includeFields) {
|
|
3589
3589
|
const i = e.collections[t.collection];
|
|
3590
3590
|
if (!i)
|
|
3591
|
-
return mn(
|
|
3591
|
+
return mn(we());
|
|
3592
3592
|
t.includeFields.forEach((o) => {
|
|
3593
3593
|
const a = i.fields.find((c) => c.name === o);
|
|
3594
3594
|
if (!a)
|
|
@@ -3630,7 +3630,7 @@ const xn = () => _e().refine((t) => t && (t.seconds !== void 0 && t.nanoseconds
|
|
|
3630
3630
|
})));
|
|
3631
3631
|
break;
|
|
3632
3632
|
case "Timestamp":
|
|
3633
|
-
e.name === r ? i =
|
|
3633
|
+
e.name === r ? i = we().refine((o) => o && (o._methodName === "serverTimestamp" || o.constructor.name === "ServerTimestampTransform" || o.seconds !== void 0 && o.nanoseconds !== void 0 || o._seconds !== void 0 && o._nanoseconds !== void 0), {
|
|
3634
3634
|
message: "Value is not a valid timestamp"
|
|
3635
3635
|
}) : (i = xn(), e.min && (i = i.refine((o) => o.toMillis() >= e.min, {
|
|
3636
3636
|
message: `Value is less than the minimum allowed value of ${e.min}`
|
|
@@ -3639,7 +3639,7 @@ const xn = () => _e().refine((t) => t && (t.seconds !== void 0 && t.nanoseconds
|
|
|
3639
3639
|
})));
|
|
3640
3640
|
break;
|
|
3641
3641
|
case "Array":
|
|
3642
|
-
i = St(
|
|
3642
|
+
i = St(we()), e.length && (i = i.length(e.length)), e.minlength ? i = i.min(e.minlength) : e.required && (i = i.nonempty()), e.maxlength && (i = i.max(e.maxlength)), e.values && (i = i.refine((o) => {
|
|
3643
3643
|
let a = !0;
|
|
3644
3644
|
return o.forEach((l) => {
|
|
3645
3645
|
e.values && !e.values.includes(l) && (a = !1);
|
|
@@ -3647,12 +3647,12 @@ const xn = () => _e().refine((t) => t && (t.seconds !== void 0 && t.nanoseconds
|
|
|
3647
3647
|
}, { message: "Value is not an allowed value" }));
|
|
3648
3648
|
break;
|
|
3649
3649
|
case "Map":
|
|
3650
|
-
i = mn(
|
|
3650
|
+
i = mn(we()), e.required && (i = i.refine((o) => o && typeof o == "object" && Object.keys(o).length > 0, {
|
|
3651
3651
|
message: "Value must have at least one object property"
|
|
3652
3652
|
}));
|
|
3653
3653
|
break;
|
|
3654
3654
|
case "Embedding":
|
|
3655
|
-
i =
|
|
3655
|
+
i = we();
|
|
3656
3656
|
break;
|
|
3657
3657
|
}
|
|
3658
3658
|
return !ee(e) && e.nullable && (i = i.nullable()), e.required || (i = i.optional()), i;
|
|
@@ -4245,7 +4245,7 @@ class yl {
|
|
|
4245
4245
|
return this.inf.format(n);
|
|
4246
4246
|
} else {
|
|
4247
4247
|
const n = this.floor ? Math.floor(e) : rr(e, 3);
|
|
4248
|
-
return
|
|
4248
|
+
return pe(n, this.padTo);
|
|
4249
4249
|
}
|
|
4250
4250
|
}
|
|
4251
4251
|
}
|
|
@@ -4956,7 +4956,7 @@ function $e(t, e, n) {
|
|
|
4956
4956
|
function xl(t, e) {
|
|
4957
4957
|
return t - e * Math.floor(t / e);
|
|
4958
4958
|
}
|
|
4959
|
-
function
|
|
4959
|
+
function pe(t, e = 2) {
|
|
4960
4960
|
const n = t < 0;
|
|
4961
4961
|
let s;
|
|
4962
4962
|
return n ? s = "-" + ("" + -t).padStart(e, "0") : s = ("" + t).padStart(e, "0"), s;
|
|
@@ -5063,11 +5063,11 @@ function an(t, e) {
|
|
|
5063
5063
|
const n = Math.trunc(Math.abs(t / 60)), s = Math.trunc(Math.abs(t % 60)), r = t >= 0 ? "+" : "-";
|
|
5064
5064
|
switch (e) {
|
|
5065
5065
|
case "short":
|
|
5066
|
-
return `${r}${
|
|
5066
|
+
return `${r}${pe(n, 2)}:${pe(s, 2)}`;
|
|
5067
5067
|
case "narrow":
|
|
5068
5068
|
return `${r}${n}${s > 0 ? `:${s}` : ""}`;
|
|
5069
5069
|
case "techie":
|
|
5070
|
-
return `${r}${
|
|
5070
|
+
return `${r}${pe(n, 2)}${pe(s, 2)}`;
|
|
5071
5071
|
default:
|
|
5072
5072
|
throw new RangeError(`Value format ${e} is out of range for property format`);
|
|
5073
5073
|
}
|
|
@@ -5261,7 +5261,7 @@ class ve {
|
|
|
5261
5261
|
}
|
|
5262
5262
|
num(e, n = 0, s = void 0) {
|
|
5263
5263
|
if (this.opts.forceSimple)
|
|
5264
|
-
return
|
|
5264
|
+
return pe(e, n);
|
|
5265
5265
|
const r = { ...this.opts };
|
|
5266
5266
|
return n > 0 && (r.padTo = n), s && (r.signDisplay = s), this.loc.numberFormatter(r).format(e);
|
|
5267
5267
|
}
|
|
@@ -7465,12 +7465,12 @@ function Sn(t, e, n = !0) {
|
|
|
7465
7465
|
function vs(t, e, n) {
|
|
7466
7466
|
const s = t.c.year > 9999 || t.c.year < 0;
|
|
7467
7467
|
let r = "";
|
|
7468
|
-
if (s && t.c.year >= 0 && (r += "+"), r +=
|
|
7468
|
+
if (s && t.c.year >= 0 && (r += "+"), r += pe(t.c.year, s ? 6 : 4), n === "year") return r;
|
|
7469
7469
|
if (e) {
|
|
7470
|
-
if (r += "-", r +=
|
|
7470
|
+
if (r += "-", r += pe(t.c.month), n === "month") return r;
|
|
7471
7471
|
r += "-";
|
|
7472
|
-
} else if (r +=
|
|
7473
|
-
return r +=
|
|
7472
|
+
} else if (r += pe(t.c.month), n === "month") return r;
|
|
7473
|
+
return r += pe(t.c.day), r;
|
|
7474
7474
|
}
|
|
7475
7475
|
function ti(t, e, n, s, r, i, o) {
|
|
7476
7476
|
let a = !n || t.c.millisecond !== 0 || t.c.second !== 0, l = "";
|
|
@@ -7480,18 +7480,18 @@ function ti(t, e, n, s, r, i, o) {
|
|
|
7480
7480
|
case "year":
|
|
7481
7481
|
break;
|
|
7482
7482
|
default:
|
|
7483
|
-
if (l +=
|
|
7483
|
+
if (l += pe(t.c.hour), o === "hour") break;
|
|
7484
7484
|
if (e) {
|
|
7485
|
-
if (l += ":", l +=
|
|
7486
|
-
a && (l += ":", l +=
|
|
7485
|
+
if (l += ":", l += pe(t.c.minute), o === "minute") break;
|
|
7486
|
+
a && (l += ":", l += pe(t.c.second));
|
|
7487
7487
|
} else {
|
|
7488
|
-
if (l +=
|
|
7489
|
-
a && (l +=
|
|
7488
|
+
if (l += pe(t.c.minute), o === "minute") break;
|
|
7489
|
+
a && (l += pe(t.c.second));
|
|
7490
7490
|
}
|
|
7491
7491
|
if (o === "second") break;
|
|
7492
|
-
a && (!s || t.c.millisecond !== 0) && (l += ".", l +=
|
|
7492
|
+
a && (!s || t.c.millisecond !== 0) && (l += ".", l += pe(t.c.millisecond, 3));
|
|
7493
7493
|
}
|
|
7494
|
-
return r && (t.isOffsetFixed && t.offset === 0 && !i ? l += "Z" : t.o < 0 ? (l += "-", l +=
|
|
7494
|
+
return r && (t.isOffsetFixed && t.offset === 0 && !i ? l += "Z" : t.o < 0 ? (l += "-", l += pe(Math.trunc(-t.o / 60)), l += ":", l += pe(Math.trunc(-t.o % 60))) : (l += "+", l += pe(Math.trunc(t.o / 60)), l += ":", l += pe(Math.trunc(t.o % 60)))), i && (l += "[" + t.zone.ianaName + "]"), l;
|
|
7495
7495
|
}
|
|
7496
7496
|
const No = {
|
|
7497
7497
|
month: 1,
|
|
@@ -9202,10 +9202,10 @@ const Yc = (t, e) => {
|
|
|
9202
9202
|
if (t.includeFields) {
|
|
9203
9203
|
const s = e.collections[t.collection];
|
|
9204
9204
|
if (!s)
|
|
9205
|
-
return mn(
|
|
9205
|
+
return mn(we());
|
|
9206
9206
|
t.includeFields.forEach((r) => {
|
|
9207
9207
|
const i = s.fields.find((o) => o.name === r);
|
|
9208
|
-
i ? n[r] = Ao(i)?.nullable() : n[r] =
|
|
9208
|
+
i ? n[r] = Ao(i)?.nullable() : n[r] = we();
|
|
9209
9209
|
});
|
|
9210
9210
|
}
|
|
9211
9211
|
return qe({
|
|
@@ -9219,7 +9219,7 @@ const Yc = (t, e) => {
|
|
|
9219
9219
|
i = Qt(o.admin?.skipFormRequiredValidation);
|
|
9220
9220
|
}
|
|
9221
9221
|
return (!t.required || i) && (r = r.optional()), r;
|
|
9222
|
-
}, Qc = () =>
|
|
9222
|
+
}, Qc = () => we().refine((t) => t === null || t && (t.seconds !== void 0 && t.nanoseconds !== void 0 || t._seconds !== void 0 && t._nanoseconds !== void 0), {
|
|
9223
9223
|
message: "Must be a valid date"
|
|
9224
9224
|
}), Ao = (t, e, n) => {
|
|
9225
9225
|
let s;
|
|
@@ -9270,7 +9270,7 @@ const Yc = (t, e) => {
|
|
|
9270
9270
|
})));
|
|
9271
9271
|
break;
|
|
9272
9272
|
case "Array":
|
|
9273
|
-
s = St(
|
|
9273
|
+
s = St(we()), t.length && (s = s.length(t.length, `Must contain ${t.length} item(s)`)), t.minlength ? s = s.min(t.minlength, `Must contain at least ${t.minlength} item(s)`) : t.required && !i && (s = s.nonempty("Must contain at least one item")), t.maxlength && (s = s.max(t.maxlength, `Must contain at most ${t.maxlength} item(s)`)), t.values ? (n || (s = s.refine((l) => {
|
|
9274
9274
|
let c = !0;
|
|
9275
9275
|
return l.forEach((d) => {
|
|
9276
9276
|
t.values && !t.values.includes(d) && (c = !1);
|
|
@@ -9278,12 +9278,12 @@ const Yc = (t, e) => {
|
|
|
9278
9278
|
}, { message: `Must only contain the following values: ${t.values.join(", ")}` })), s = s.describe(`${r}Must only contain the following values: ${t.values.join(", ")}`)) : r && (s = s.describe(r.trim())), t.nullable && (s = s.nullable());
|
|
9279
9279
|
break;
|
|
9280
9280
|
case "Map":
|
|
9281
|
-
t.required && !i ? n ? s = qe({}).catchall(
|
|
9281
|
+
t.required && !i ? n ? s = qe({}).catchall(we()).describe(`${r}Must be an object. Must contain at least one object property.`) : s = mn(we()).refine((l) => l && typeof l == "object" && Object.keys(l).length > 0, {
|
|
9282
9282
|
message: "Must not be an empty value"
|
|
9283
|
-
}) : s = qe({}).catchall(
|
|
9283
|
+
}) : s = qe({}).catchall(we()).describe(`${r}Must be an object`);
|
|
9284
9284
|
break;
|
|
9285
9285
|
case "Computed":
|
|
9286
|
-
s =
|
|
9286
|
+
s = we();
|
|
9287
9287
|
}
|
|
9288
9288
|
return (!t.required || i || o) && (s = s.optional()), s;
|
|
9289
9289
|
}, bu = (t, e, n, s, r) => {
|
|
@@ -9300,9 +9300,9 @@ const Yc = (t, e) => {
|
|
|
9300
9300
|
a[`auth-${c.labels.collection}`] = on().optional(), a[`operations-${c.labels.collection}`] = St(Se([Ie("Read"), Ie("Create"), Ie("Update"), Ie("Delete")])).optional(), a[`restrict-${c.labels.collection}`] = on().optional(), c.access.attributeRestrictions?.forEach((d) => {
|
|
9301
9301
|
a[`attribute-${c.labels.collection}-${d.type}`] = on().optional();
|
|
9302
9302
|
}), c.access.entityRestrictions?.restrictions?.forEach((d) => {
|
|
9303
|
-
if (d.type === "Individual" && (a[`accessible-${c.labels.collection}-${c.labels.collection}`] = qe({}).catchall(
|
|
9303
|
+
if (d.type === "Individual" && (a[`accessible-${c.labels.collection}-${c.labels.collection}`] = qe({}).catchall(we()).optional()), d.type === "Parent" || d.type === "Parent_Property") {
|
|
9304
9304
|
const h = V(c.fields, d.collectionField);
|
|
9305
|
-
a[`accessible-${c.labels.collection}-${h.collection}`] = qe({}).catchall(
|
|
9305
|
+
a[`accessible-${c.labels.collection}-${h.collection}`] = qe({}).catchall(we()).optional();
|
|
9306
9306
|
}
|
|
9307
9307
|
});
|
|
9308
9308
|
}));
|
|
@@ -9584,13 +9584,13 @@ const Ft = {
|
|
|
9584
9584
|
return Fo;
|
|
9585
9585
|
},
|
|
9586
9586
|
getGlobalConfigModule() {
|
|
9587
|
-
return
|
|
9587
|
+
return ye(nn);
|
|
9588
9588
|
},
|
|
9589
9589
|
getCustomizationFile(t, e) {
|
|
9590
9590
|
if (!Object.keys(e.collections).includes(t))
|
|
9591
9591
|
throw new Error("PERMISSION_DENIED");
|
|
9592
9592
|
const n = pa([t], $o, "node", Ft);
|
|
9593
|
-
return
|
|
9593
|
+
return ye(n?.[t]);
|
|
9594
9594
|
},
|
|
9595
9595
|
getVersionInfo() {
|
|
9596
9596
|
return Fn;
|
|
@@ -10107,9 +10107,9 @@ const Ft = {
|
|
|
10107
10107
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
10108
10108
|
a.get(y.id),
|
|
10109
10109
|
T,
|
|
10110
|
-
|
|
10110
|
+
ye(e.subcollections),
|
|
10111
10111
|
R,
|
|
10112
|
-
|
|
10112
|
+
ye(e?.relations),
|
|
10113
10113
|
void 0,
|
|
10114
10114
|
e.userId,
|
|
10115
10115
|
e.transactional ? c : void 0,
|
|
@@ -10127,7 +10127,7 @@ const Ft = {
|
|
|
10127
10127
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
10128
10128
|
a.get(y.id),
|
|
10129
10129
|
T,
|
|
10130
|
-
|
|
10130
|
+
ye(e.relations),
|
|
10131
10131
|
R,
|
|
10132
10132
|
void 0,
|
|
10133
10133
|
e.userId,
|
|
@@ -10346,8 +10346,8 @@ const Ft = {
|
|
|
10346
10346
|
const E = /* @__PURE__ */ new Date(), w = new Date((/* @__PURE__ */ new Date()).setDate(E.getDate() + u));
|
|
10347
10347
|
f.TTL = ht.fromDate(w);
|
|
10348
10348
|
}
|
|
10349
|
-
const g =
|
|
10350
|
-
Qe(g), t !== "delete" && (f.data.data =
|
|
10349
|
+
const g = ye(n);
|
|
10350
|
+
Qe(g), t !== "delete" && (f.data.data = ye(g)), t === "update" && (f.data.originalRecord = ye(l)), t !== "delete" && ["started", "written"].includes(e) && (delete f.data.data.Saved_At, delete f.data.data.Last_Save_At), e === "failed" && (f.data.error = JSON.stringify(a));
|
|
10351
10351
|
const R = Me(d, r, s), m = n.Last_Write_At;
|
|
10352
10352
|
await R.doc(i).collection("system_write_log").doc(`${n.Last_Write_By}-${m.valueOf()}`).set(f);
|
|
10353
10353
|
}, _n = async (t) => {
|
|
@@ -10407,9 +10407,9 @@ function su(t) {
|
|
|
10407
10407
|
}
|
|
10408
10408
|
const qo = async (t, e, n, s, r, i, o) => {
|
|
10409
10409
|
const a = Rt(), l = he(), { labels: c, fields: d } = s;
|
|
10410
|
-
if (
|
|
10410
|
+
if (ke(r.Email) || !r.Email)
|
|
10411
10411
|
throw new Error("VALIDATION_ERROR: Email field is required");
|
|
10412
|
-
if (
|
|
10412
|
+
if (ke(r.Role) || !r.Role)
|
|
10413
10413
|
throw new Error("VALIDATION_ERROR: Role field is required");
|
|
10414
10414
|
if (r.Enabled === void 0 || r.Enabled === null || ke(r.Enabled))
|
|
10415
10415
|
throw new Error("VALIDATION_ERROR: Enabled field is required");
|
|
@@ -10513,7 +10513,7 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
10513
10513
|
}, fr = (t) => {
|
|
10514
10514
|
if (typeof t == "object")
|
|
10515
10515
|
for (const e in t)
|
|
10516
|
-
Object.prototype.hasOwnProperty.call(t, e) && (t[e] === "_DELETE_FIELD" ? t[e] =
|
|
10516
|
+
Object.prototype.hasOwnProperty.call(t, e) && (t[e] === "_DELETE_FIELD" ? t[e] = ge.delete() : fr(t[e]));
|
|
10517
10517
|
}, ru = (t, e, n) => {
|
|
10518
10518
|
if (ee(n) && n.includeFields) {
|
|
10519
10519
|
const s = {};
|
|
@@ -10580,7 +10580,7 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
10580
10580
|
m.set(w.collection, {
|
|
10581
10581
|
...m.get(w.collection) || {},
|
|
10582
10582
|
[O]: y
|
|
10583
|
-
}), S =
|
|
10583
|
+
}), S = ye({ ...y, ...Mn(s) });
|
|
10584
10584
|
}
|
|
10585
10585
|
const C = {
|
|
10586
10586
|
...S[k.name],
|
|
@@ -10616,7 +10616,7 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
10616
10616
|
m.set(w.collection, {
|
|
10617
10617
|
...m.get(w.collection) || {},
|
|
10618
10618
|
[O]: P
|
|
10619
|
-
}), S =
|
|
10619
|
+
}), S = ye({ ...P, ...Mn(s) });
|
|
10620
10620
|
}
|
|
10621
10621
|
S[k.name][n] && delete S[k.name][n], Array.isArray(S[`${k.name}_Array`]) && (S[`${k.name}_Array`] = S[`${k.name}_Array`].filter((C) => C !== n)), v.size === 1 && delete S[`${k.name}_Single`], E.set(w.collection, {
|
|
10622
10622
|
...E.get(w.collection) || {},
|
|
@@ -10721,12 +10721,12 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
10721
10721
|
const i = r?.archivedField, o = r?.timestampField;
|
|
10722
10722
|
if (n[i] === !0)
|
|
10723
10723
|
if (t === "create")
|
|
10724
|
-
n[o] =
|
|
10724
|
+
n[o] = ge.serverTimestamp();
|
|
10725
10725
|
else {
|
|
10726
10726
|
if (!s)
|
|
10727
10727
|
throw new Error("Original record is required for update");
|
|
10728
10728
|
if (!s[i])
|
|
10729
|
-
n[o] =
|
|
10729
|
+
n[o] = ge.serverTimestamp();
|
|
10730
10730
|
else if (n[o] && n[o]?.valueOf() !== s[o]?.valueOf())
|
|
10731
10731
|
throw new Error("Soft delete timestamp cannot be changed");
|
|
10732
10732
|
}
|
|
@@ -10822,15 +10822,23 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
10822
10822
|
s && await dr(t, u);
|
|
10823
10823
|
const H = Me(x, t, o), S = n?.id || H.doc().id;
|
|
10824
10824
|
i = i || {}, i.collection = f.collection, e.id = S, Bo(e), fr(e);
|
|
10825
|
-
const p = Ks("create", t, e, l, w, "Online", s || "System", ht.now(),
|
|
10825
|
+
const p = Ks("create", t, e, l, w, "Online", s || "System", ht.now(), ge.serverTimestamp());
|
|
10826
10826
|
n?.createdAt && (p.Created_At = n.createdAt), n?.createdBy && (p.Created_By = n.createdBy);
|
|
10827
|
-
const C =
|
|
10827
|
+
const C = ye(p);
|
|
10828
10828
|
m && (p[m.archivedField] = !1), Ze(e), vt(u, p, l), R && !n?.providedTransaction && await Zt("create", "started", p, o, t, S, u), await ue("preOperation", a, E, { operation: "create", data: p, recordId: S, context: i }), await ue("preWrite", a, E, { operation: "create", data: p, recordId: S, context: i }), vt(u, p, l), Pn(u, p);
|
|
10829
10829
|
const _ = (s ? await x.collection("tenants").doc(o).collection("system_user_permissions").doc(s).get() : void 0)?.data();
|
|
10830
10830
|
await va(p, u, E, _, v?.customClaims || {}), Ze(p);
|
|
10831
10831
|
try {
|
|
10832
|
-
if (u.auth && r
|
|
10833
|
-
|
|
10832
|
+
if (u.auth && r) {
|
|
10833
|
+
if (!r.password)
|
|
10834
|
+
throw new Error("Password is required");
|
|
10835
|
+
if (!p.Role)
|
|
10836
|
+
throw new Error("Role field is required");
|
|
10837
|
+
if (!p.Email)
|
|
10838
|
+
throw new Error("Email field is required");
|
|
10839
|
+
if (p.Enabled === void 0 || p.Enabled === null)
|
|
10840
|
+
throw new Error("Enabled field is required");
|
|
10841
|
+
}
|
|
10834
10842
|
n?.providedTransaction || await fn("create", p, u, E, { operation: "create", data: p, context: i }, l);
|
|
10835
10843
|
} catch (D) {
|
|
10836
10844
|
throw new Error(`VALIDATION_ERROR: ${D.message}`);
|
|
@@ -10930,7 +10938,7 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
10930
10938
|
const M = { size: 1 };
|
|
10931
10939
|
await T(D, M), n?.noTwoWay || await Ho("Create", o, S, p, p, u, l, D, M, s, W, void 0, O);
|
|
10932
10940
|
const J = Qs(l);
|
|
10933
|
-
lr("create", D, t, S, p, l, u, n, J,
|
|
10941
|
+
lr("create", D, t, S, p, l, u, n, J, ge.arrayUnion, ge.arrayRemove, ge.delete, (z) => x.collection("tenants").doc(o).collection("system_fields").doc(f.collection).collection(`${f.collection}-${z.name}`).doc(S), (z, b) => x.collection("tenants").doc(o).collection("system_unique").doc(f.collection).collection(`Unique-${f.collection}-${z.name}`).doc(b), (z) => x.collection("tenants").doc(o).collection("system_fields").doc(f.collection).collection(`${f.collection}-${z}`).doc(S), (z, b) => Me(x, z, o).doc(b), (z, b, B) => x.collection("tenants").doc(o).collection("system_fields").doc(z.collection).collection(`${z.collection}-${b}`).doc(B), (z, b, B) => x.collection("tenants").doc(o).collection("system_fields").doc(z.collection).collection(`${z.collection}-${b.replaceAll(" ", "-")}`).doc(B), void 0, void 0, M), D.set(H.doc(S), p);
|
|
10934
10942
|
} catch (M) {
|
|
10935
10943
|
if (n?.providedTransaction)
|
|
10936
10944
|
throw M;
|
|
@@ -11148,7 +11156,7 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
11148
11156
|
(B) => n[B.name] !== void 0 && n[B.name] !== b[B.name]
|
|
11149
11157
|
));
|
|
11150
11158
|
delete n.id, Bo(n), fr(n);
|
|
11151
|
-
const y = Ks("update", t, n, c, w, "Online", r || "System", ht.now(),
|
|
11159
|
+
const y = Ks("update", t, n, c, w, "Online", r || "System", ht.now(), ge.serverTimestamp()), _ = ye(y);
|
|
11152
11160
|
for (const b of R)
|
|
11153
11161
|
!ee(b) && ke(y[b.name]) && b.nullable && (y[b.name] = null);
|
|
11154
11162
|
Ze(y), Ze(O), vt(f, y, c), vt(f, O, c), m && !s?.providedTransaction && await Zt("update", "started", y, a, t, e, f, void 0, O);
|
|
@@ -11157,7 +11165,7 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
11157
11165
|
data: y,
|
|
11158
11166
|
recordId: e,
|
|
11159
11167
|
context: o,
|
|
11160
|
-
originalRecord:
|
|
11168
|
+
originalRecord: ye(O)
|
|
11161
11169
|
};
|
|
11162
11170
|
await ue("preOperation", l, E, T);
|
|
11163
11171
|
const U = {
|
|
@@ -11165,7 +11173,7 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
11165
11173
|
data: y,
|
|
11166
11174
|
recordId: e,
|
|
11167
11175
|
context: o,
|
|
11168
|
-
originalRecord:
|
|
11176
|
+
originalRecord: ye(O)
|
|
11169
11177
|
};
|
|
11170
11178
|
await ue("preWrite", l, E, U), vt(f, y, c), Pn(f, y), Ze(y);
|
|
11171
11179
|
try {
|
|
@@ -11173,7 +11181,7 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
11173
11181
|
throw new Error("Password is required");
|
|
11174
11182
|
if (!s?.providedTransaction) {
|
|
11175
11183
|
const b = { ...H, ...y };
|
|
11176
|
-
Qe(b), await fn("update", b, f, E, { operation: "update", data: y, context: o, originalRecord:
|
|
11184
|
+
Qe(b), await fn("update", b, f, E, { operation: "update", data: y, context: o, originalRecord: ye(O) }, c);
|
|
11177
11185
|
}
|
|
11178
11186
|
} catch (b) {
|
|
11179
11187
|
throw new Error(`VALIDATION_ERROR: ${b.message}`);
|
|
@@ -11183,7 +11191,7 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
11183
11191
|
!ee(b) && ke(y[b.name]) && b.nullable && (y[b.name] = null);
|
|
11184
11192
|
try {
|
|
11185
11193
|
const b = { ...H, ...y };
|
|
11186
|
-
Qe(b), Yo("update", f, y, O), Go("update", y, _), await fn("update", b, f, E, { operation: "update", data: y, context: o, originalRecord:
|
|
11194
|
+
Qe(b), Yo("update", f, y, O), Go("update", y, _), await fn("update", b, f, E, { operation: "update", data: y, context: o, originalRecord: ye(O) }, c);
|
|
11187
11195
|
} catch (b) {
|
|
11188
11196
|
throw new Error(`VALIDATION_ERROR: ${b.message}`);
|
|
11189
11197
|
}
|
|
@@ -11205,8 +11213,8 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
11205
11213
|
if (K && (K.size += 3), !s?.providedTransaction) {
|
|
11206
11214
|
if (!le.exists)
|
|
11207
11215
|
throw new Error("VERSION_ERROR");
|
|
11208
|
-
const
|
|
11209
|
-
if (
|
|
11216
|
+
const _e = le.data();
|
|
11217
|
+
if (_e.force && y.Last_Write_At.valueOf() < _e.time.valueOf())
|
|
11210
11218
|
throw new Error("VERSION_ERROR");
|
|
11211
11219
|
if (!Te.exists)
|
|
11212
11220
|
throw new Error("MAINTENANCE_MODE");
|
|
@@ -11227,12 +11235,12 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
11227
11235
|
if (K && (K.size += Lo(a, t, e, c, v, N).length), p && O.User_ID || C && !O.User_ID)
|
|
11228
11236
|
throw new Error("USER_ERROR");
|
|
11229
11237
|
if (P(O)) {
|
|
11230
|
-
const
|
|
11231
|
-
if (K && K.size++, !
|
|
11238
|
+
const _e = await b.get(k.collection("tenants").doc(a).collection("system_user_permissions").doc(O.User_ID));
|
|
11239
|
+
if (K && K.size++, !_e?.exists)
|
|
11232
11240
|
throw new Error("PERMISSION_DENIED");
|
|
11233
|
-
F =
|
|
11241
|
+
F = _e.data();
|
|
11234
11242
|
const pt = i?.permissions && Object.keys(i.permissions).length > 0 ? i.permissions : void 0;
|
|
11235
|
-
if (y.Role && y.Role !== O.Role && !pt && (i ||= { operation: "update", permissions: {} }, i.permissions =
|
|
11243
|
+
if (y.Role && y.Role !== O.Role && !pt && (i ||= { operation: "update", permissions: {} }, i.permissions = ye(F), i.permissions.Role = y.Role), i?.permissions) {
|
|
11236
11244
|
if (i.permissions.Role ||= y.Role || O.Role, i.permissions.Enabled ??= y.Enabled ?? O.Enabled, ke(i.permissions.Role) || !i.permissions.Role)
|
|
11237
11245
|
throw new Error("VALIDATION_ERROR: Role field is required");
|
|
11238
11246
|
if (ke(i.permissions.Enabled) || i.permissions.Enabled === void 0 || i.permissions.Enabled === null)
|
|
@@ -11240,12 +11248,12 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
11240
11248
|
}
|
|
11241
11249
|
}
|
|
11242
11250
|
if (p) {
|
|
11243
|
-
const
|
|
11244
|
-
if (Qe(
|
|
11251
|
+
const _e = { ...O, ...y };
|
|
11252
|
+
if (Qe(_e), !_e.Role)
|
|
11245
11253
|
throw new Error("VALIDATION_ERROR: Role field is required");
|
|
11246
|
-
if (
|
|
11254
|
+
if (_e.Enabled === void 0 || _e.Enabled === null)
|
|
11247
11255
|
throw new Error("VALIDATION_ERROR: Enabled field is required");
|
|
11248
|
-
if (
|
|
11256
|
+
if (!_e.Email)
|
|
11249
11257
|
throw new Error("VALIDATION_ERROR: Email field is required");
|
|
11250
11258
|
}
|
|
11251
11259
|
if (!s?.providedTransaction) {
|
|
@@ -11273,13 +11281,13 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
11273
11281
|
await Promise.all(pt);
|
|
11274
11282
|
}
|
|
11275
11283
|
if (r && v?.Role) {
|
|
11276
|
-
const
|
|
11277
|
-
if (!(E.custom?.serverAccess?.update !== void 0 ? await ae(E.custom.serverAccess.update, [
|
|
11284
|
+
const _e = v.Role, pt = { ...O, ...y };
|
|
11285
|
+
if (!(E.custom?.serverAccess?.update !== void 0 ? await ae(E.custom.serverAccess.update, [_e, pt, O]) : !0))
|
|
11278
11286
|
throw new Error("PERMISSION_DENIED");
|
|
11279
11287
|
for (const Yt of f.fields) {
|
|
11280
11288
|
const En = We(Yt, E);
|
|
11281
11289
|
if (Object.prototype.hasOwnProperty.call(y, Yt.name) && En?.custom?.serverAccess?.update !== void 0 && !await ae(En.custom.serverAccess.update, [
|
|
11282
|
-
|
|
11290
|
+
_e,
|
|
11283
11291
|
pt,
|
|
11284
11292
|
O
|
|
11285
11293
|
]))
|
|
@@ -11300,7 +11308,7 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
11300
11308
|
let Te;
|
|
11301
11309
|
!s?.noTwoWay && !s?.providedTransaction && (Te = await Ho("Update", a, e, le, y, f, c, b, K, r, v, O, N));
|
|
11302
11310
|
const oe = Qs(c);
|
|
11303
|
-
lr("update", b, t, e, y, c, f, s, oe,
|
|
11311
|
+
lr("update", b, t, e, y, c, f, s, oe, ge.arrayUnion, ge.arrayRemove, ge.delete, (ce) => k.collection("tenants").doc(a).collection("system_fields").doc(g.collection).collection(`${g.collection}-${ce.name}`).doc(e), (ce, De) => k.collection("tenants").doc(a).collection("system_unique").doc(g.collection).collection(`Unique-${g.collection}-${ce.name}`).doc(De), (ce) => k.collection("tenants").doc(a).collection("system_fields").doc(g.collection).collection(`${g.collection}-${ce}`).doc(e), (ce, De) => Me(k, ce, a).doc(De), (ce, De, Ge) => k.collection("tenants").doc(a).collection("system_fields").doc(ce.collection).collection(`${ce.collection}-${De}`).doc(Ge), (ce, De, Ge) => k.collection("tenants").doc(a).collection("system_fields").doc(ce.collection).collection(`${ce.collection}-${De.replaceAll(" ", "-")}`).doc(Ge), O, Te, K), b.update(W.doc(e), y);
|
|
11304
11312
|
} catch (K) {
|
|
11305
11313
|
if (s?.providedTransaction)
|
|
11306
11314
|
throw K;
|
|
@@ -11311,12 +11319,12 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
11311
11319
|
recordId: e,
|
|
11312
11320
|
context: o,
|
|
11313
11321
|
error: K,
|
|
11314
|
-
originalRecord:
|
|
11322
|
+
originalRecord: ye(O)
|
|
11315
11323
|
}, Te = await ue("postWriteError", l, E, le);
|
|
11316
11324
|
if (m && (await new Promise((oe) => {
|
|
11317
11325
|
setTimeout(oe, 250);
|
|
11318
11326
|
}), await Zt("update", Te?.resolved ? "success" : "failed", y, a, t, e, f, Te?.resolved ? void 0 : K, O)), !Te?.resolved)
|
|
11319
|
-
throw p && await _n(O), P(O) && await sn(O.User_ID, B, F, "USER_ERROR"), C && await k.collection("tenants").doc(a).collection(g.collection).doc(e).update({ User_ID:
|
|
11327
|
+
throw p && await _n(O), P(O) && await sn(O.User_ID, B, F, "USER_ERROR"), C && await k.collection("tenants").doc(a).collection(g.collection).doc(e).update({ User_ID: ge.delete() }), K;
|
|
11320
11328
|
}
|
|
11321
11329
|
}
|
|
11322
11330
|
(p || P(O) || C) && await ai(di, [e, O.User_ID]).catch(() => {
|
|
@@ -11335,7 +11343,7 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
11335
11343
|
const B = { ...O, ...y };
|
|
11336
11344
|
Qe(B);
|
|
11337
11345
|
const K = await lu(i?.operation || "update", a, e, l, f, B, O, b, i?.permissions, F, i?.password);
|
|
11338
|
-
p && (y.User_ID = K), C && (y.User_ID =
|
|
11346
|
+
p && (y.User_ID = K), C && (y.User_ID = ge.delete());
|
|
11339
11347
|
}
|
|
11340
11348
|
s?.providedTransaction ? await M(s.providedTransaction, b) : await k.runTransaction(async (B) => {
|
|
11341
11349
|
await M(B, b);
|
|
@@ -11351,7 +11359,7 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
11351
11359
|
data: y,
|
|
11352
11360
|
recordId: e,
|
|
11353
11361
|
context: o,
|
|
11354
|
-
originalRecord:
|
|
11362
|
+
originalRecord: ye(O)
|
|
11355
11363
|
}, B = { ...b };
|
|
11356
11364
|
await ue("postWrite", l, E, b), await ue("postOperation", l, E, B);
|
|
11357
11365
|
}
|
|
@@ -11369,14 +11377,14 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
11369
11377
|
throw new Error("COLLECTION_NOT_FOUND");
|
|
11370
11378
|
const h = a.collections[l], { labels: u, auth: f, enableWriteLog: g, softDelete: R } = h, m = mt(u.collection, a), E = await ae(o.appName);
|
|
11371
11379
|
if (R && !f && !n?.force)
|
|
11372
|
-
return await uu(t, e, { [R.archivedField]: !0, [R.timestampField]:
|
|
11380
|
+
return await uu(t, e, { [R.archivedField]: !0, [R.timestampField]: ge.serverTimestamp() }, { userId: s });
|
|
11373
11381
|
const w = he();
|
|
11374
11382
|
let x;
|
|
11375
11383
|
s && await dr(t, h);
|
|
11376
11384
|
const k = Me(w, t, i);
|
|
11377
11385
|
r = r || {}, r.collection = u.collection;
|
|
11378
11386
|
const v = await Xe(t, e, { userId: s });
|
|
11379
|
-
let N = Ks("delete", t, v, a, E, "Online", s || "System", ht.now(),
|
|
11387
|
+
let N = Ks("delete", t, v, a, E, "Online", s || "System", ht.now(), ge.serverTimestamp());
|
|
11380
11388
|
const W = Mn(N);
|
|
11381
11389
|
Ze(N), g && await Zt("delete", "started", N, i, t, e, h), await ue("preOperation", o, m, { operation: "delete", data: N, recordId: e, context: r }), await ue("preWrite", o, m, { operation: "delete", data: N, recordId: e, context: r }), Ze(N);
|
|
11382
11390
|
const S = async (P) => {
|
|
@@ -11414,7 +11422,7 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
11414
11422
|
await w.runTransaction(async (P) => {
|
|
11415
11423
|
await S(P);
|
|
11416
11424
|
const y = Qs(a);
|
|
11417
|
-
lr("delete", P, t, e, N, a, h, n, y,
|
|
11425
|
+
lr("delete", P, t, e, N, a, h, n, y, ge.arrayUnion, ge.arrayRemove, ge.delete, (_) => w.collection("tenants").doc(i).collection("system_fields").doc(u.collection).collection(`${u.collection}-${_.name}`).doc(e), (_, T) => w.collection("tenants").doc(i).collection("system_unique").doc(u.collection).collection(`Unique-${u.collection}-${_.name}`).doc(T), (_) => w.collection("tenants").doc(i).collection("system_fields").doc(u.collection).collection(`${u.collection}-${_}`).doc(e), (_, T) => Me(w, _, i).doc(T), (_, T, U) => w.collection("tenants").doc(i).collection("system_fields").doc(_.collection).collection(`${_.collection}-${T}`).doc(U), (_, T, U) => w.collection("tenants").doc(i).collection("system_fields").doc(_.collection).collection(`${_.collection}-${T.replaceAll(" ", "-")}`).doc(U)), P.delete(k.doc(e));
|
|
11418
11426
|
}, { maxAttempts: 10 });
|
|
11419
11427
|
} catch (P) {
|
|
11420
11428
|
const _ = await ue("postWriteError", o, m, {
|
|
@@ -11427,7 +11435,7 @@ const qo = async (t, e, n, s, r, i, o) => {
|
|
|
11427
11435
|
if (g && (await new Promise((T) => {
|
|
11428
11436
|
setTimeout(T, 250);
|
|
11429
11437
|
}), await Zt("delete", _?.resolved ? "success" : "failed", N, i, t, e, h, _?.resolved ? void 0 : P)), !_?.resolved)
|
|
11430
|
-
throw h.auth && N.User_ID && await w.collection("tenants").doc(i).collection(u.collection).doc(e).update({ User_ID:
|
|
11438
|
+
throw h.auth && N.User_ID && await w.collection("tenants").doc(i).collection(u.collection).doc(e).update({ User_ID: ge.delete() }), P;
|
|
11431
11439
|
}
|
|
11432
11440
|
const p = { operation: "delete", data: N, recordId: e, context: r }, C = { ...p };
|
|
11433
11441
|
return await ue("postWrite", o, m, p), await ue("postOperation", o, m, C), { id: e, ...N };
|