@stoker-platform/node-client 0.5.89 → 0.5.91

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 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 ge from "lodash/cloneDeep.js";
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 we } from "firebase-admin/firestore";
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";
@@ -281,10 +281,15 @@ const Kn = (t) => !!t && !Array.isArray(t), ln = (t, e) => t.access ? Kn(t.acces
281
281
  }, aa = (t, e, n) => {
282
282
  let s = !0, r = "";
283
283
  Object.values(t.collections).filter((i) => i.auth).forEach((i) => {
284
- if (e.collections?.[i.labels.collection]?.auth && !i.access.auth?.includes(e.Role)) {
284
+ const o = e.collections?.[i.labels.collection], a = i.access.auth, l = e.Role;
285
+ if (o?.auth && !a?.roles.includes(l)) {
285
286
  r = "Record cannot have auth access to collection", s = !1;
286
287
  return;
287
288
  }
289
+ if (a?.roles.includes(l) && !a.assignable?.includes(l) && !o?.auth) {
290
+ r = "Record is missing required auth access to collection", s = !1;
291
+ return;
292
+ }
288
293
  });
289
294
  for (const i of Object.values(t.collections)) {
290
295
  const { labels: o, access: a, fields: l } = i, { operations: c, attributeRestrictions: d, entityRestrictions: h } = a, u = c.assignable, f = e.collections?.[o.collection], g = ["read", "create", "update", "delete"];
@@ -2508,13 +2513,13 @@ ze.create = (t, e) => new ze({
2508
2513
  ...X(e)
2509
2514
  });
2510
2515
  function Dt(t) {
2511
- if (t instanceof pe) {
2516
+ if (t instanceof me) {
2512
2517
  const e = {};
2513
2518
  for (const n in t.shape) {
2514
2519
  const s = t.shape[n];
2515
2520
  e[n] = ct.create(Dt(s));
2516
2521
  }
2517
- return new pe({
2522
+ return new me({
2518
2523
  ...t._def,
2519
2524
  shape: () => e
2520
2525
  });
@@ -2523,7 +2528,7 @@ function Dt(t) {
2523
2528
  type: Dt(t.element)
2524
2529
  }) : 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
2530
  }
2526
- class pe extends te {
2531
+ class me extends te {
2527
2532
  constructor() {
2528
2533
  super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
2529
2534
  }
@@ -2600,7 +2605,7 @@ class pe extends te {
2600
2605
  return this._def.shape();
2601
2606
  }
2602
2607
  strict(e) {
2603
- return q.errToObj, new pe({
2608
+ return q.errToObj, new me({
2604
2609
  ...this._def,
2605
2610
  unknownKeys: "strict",
2606
2611
  ...e !== void 0 ? {
@@ -2616,13 +2621,13 @@ class pe extends te {
2616
2621
  });
2617
2622
  }
2618
2623
  strip() {
2619
- return new pe({
2624
+ return new me({
2620
2625
  ...this._def,
2621
2626
  unknownKeys: "strip"
2622
2627
  });
2623
2628
  }
2624
2629
  passthrough() {
2625
- return new pe({
2630
+ return new me({
2626
2631
  ...this._def,
2627
2632
  unknownKeys: "passthrough"
2628
2633
  });
@@ -2645,7 +2650,7 @@ class pe extends te {
2645
2650
  // }) as any;
2646
2651
  // };
2647
2652
  extend(e) {
2648
- return new pe({
2653
+ return new me({
2649
2654
  ...this._def,
2650
2655
  shape: () => ({
2651
2656
  ...this._def.shape(),
@@ -2659,7 +2664,7 @@ class pe extends te {
2659
2664
  * upgrade if you are experiencing issues.
2660
2665
  */
2661
2666
  merge(e) {
2662
- return new pe({
2667
+ return new me({
2663
2668
  unknownKeys: e._def.unknownKeys,
2664
2669
  catchall: e._def.catchall,
2665
2670
  shape: () => ({
@@ -2729,7 +2734,7 @@ class pe extends te {
2729
2734
  // return merged;
2730
2735
  // }
2731
2736
  catchall(e) {
2732
- return new pe({
2737
+ return new me({
2733
2738
  ...this._def,
2734
2739
  catchall: e
2735
2740
  });
@@ -2738,7 +2743,7 @@ class pe extends te {
2738
2743
  const n = {};
2739
2744
  for (const s of se.objectKeys(e))
2740
2745
  e[s] && this.shape[s] && (n[s] = this.shape[s]);
2741
- return new pe({
2746
+ return new me({
2742
2747
  ...this._def,
2743
2748
  shape: () => n
2744
2749
  });
@@ -2747,7 +2752,7 @@ class pe extends te {
2747
2752
  const n = {};
2748
2753
  for (const s of se.objectKeys(this.shape))
2749
2754
  e[s] || (n[s] = this.shape[s]);
2750
- return new pe({
2755
+ return new me({
2751
2756
  ...this._def,
2752
2757
  shape: () => n
2753
2758
  });
@@ -2764,7 +2769,7 @@ class pe extends te {
2764
2769
  const r = this.shape[s];
2765
2770
  e && !e[s] ? n[s] = r : n[s] = r.optional();
2766
2771
  }
2767
- return new pe({
2772
+ return new me({
2768
2773
  ...this._def,
2769
2774
  shape: () => n
2770
2775
  });
@@ -2780,7 +2785,7 @@ class pe extends te {
2780
2785
  i = i._def.innerType;
2781
2786
  n[s] = i;
2782
2787
  }
2783
- return new pe({
2788
+ return new me({
2784
2789
  ...this._def,
2785
2790
  shape: () => n
2786
2791
  });
@@ -2789,21 +2794,21 @@ class pe extends te {
2789
2794
  return Si(se.objectKeys(this.shape));
2790
2795
  }
2791
2796
  }
2792
- pe.create = (t, e) => new pe({
2797
+ me.create = (t, e) => new me({
2793
2798
  shape: () => t,
2794
2799
  unknownKeys: "strip",
2795
2800
  catchall: ft.create(),
2796
2801
  typeName: Y.ZodObject,
2797
2802
  ...X(e)
2798
2803
  });
2799
- pe.strictCreate = (t, e) => new pe({
2804
+ me.strictCreate = (t, e) => new me({
2800
2805
  shape: () => t,
2801
2806
  unknownKeys: "strict",
2802
2807
  catchall: ft.create(),
2803
2808
  typeName: Y.ZodObject,
2804
2809
  ...X(e)
2805
2810
  });
2806
- pe.lazycreate = (t, e) => new pe({
2811
+ me.lazycreate = (t, e) => new me({
2807
2812
  shape: t,
2808
2813
  unknownKeys: "strip",
2809
2814
  catchall: ft.create(),
@@ -3570,25 +3575,25 @@ var Y;
3570
3575
  (function(t) {
3571
3576
  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
3577
  })(Y || (Y = {}));
3573
- const xe = Ke.create, Ot = Lt.create, on = Is.create, fs = xs.create, _e = Ns.create;
3578
+ const xe = Ke.create, Ot = Lt.create, on = Is.create, fs = xs.create, we = Ns.create;
3574
3579
  ft.create;
3575
- const St = ze.create, qe = pe.create, Se = Un.create;
3580
+ const St = ze.create, qe = me.create, Se = Un.create;
3576
3581
  Wn.create;
3577
3582
  bt.create;
3578
3583
  const mn = jn.create, Ie = Ds.create, zn = Vt.create;
3579
3584
  Zn.create;
3580
3585
  ct.create;
3581
3586
  Wt.create;
3582
- const xn = () => _e().refine((t) => t && (t.seconds !== void 0 && t.nanoseconds !== void 0 || t._seconds !== void 0 && t._nanoseconds !== void 0), {
3587
+ const xn = () => we().refine((t) => t && (t.seconds !== void 0 && t.nanoseconds !== void 0 || t._seconds !== void 0 && t._nanoseconds !== void 0), {
3583
3588
  message: "Value is not a valid timestamp"
3584
- }), xr = () => _e().refine((t) => t && (t._methodName === "serverTimestamp" || t.constructor.name === "ServerTimestampTransform"), {
3589
+ }), xr = () => we().refine((t) => t && (t._methodName === "serverTimestamp" || t.constructor.name === "ServerTimestampTransform"), {
3585
3590
  message: "Value is not a valid server timestamp"
3586
3591
  }), Ii = (t, e, n) => {
3587
3592
  const s = {};
3588
3593
  if (t.includeFields) {
3589
3594
  const i = e.collections[t.collection];
3590
3595
  if (!i)
3591
- return mn(_e());
3596
+ return mn(we());
3592
3597
  t.includeFields.forEach((o) => {
3593
3598
  const a = i.fields.find((c) => c.name === o);
3594
3599
  if (!a)
@@ -3630,7 +3635,7 @@ const xn = () => _e().refine((t) => t && (t.seconds !== void 0 && t.nanoseconds
3630
3635
  })));
3631
3636
  break;
3632
3637
  case "Timestamp":
3633
- e.name === r ? i = _e().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), {
3638
+ 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
3639
  message: "Value is not a valid timestamp"
3635
3640
  }) : (i = xn(), e.min && (i = i.refine((o) => o.toMillis() >= e.min, {
3636
3641
  message: `Value is less than the minimum allowed value of ${e.min}`
@@ -3639,7 +3644,7 @@ const xn = () => _e().refine((t) => t && (t.seconds !== void 0 && t.nanoseconds
3639
3644
  })));
3640
3645
  break;
3641
3646
  case "Array":
3642
- i = St(_e()), 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) => {
3647
+ 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
3648
  let a = !0;
3644
3649
  return o.forEach((l) => {
3645
3650
  e.values && !e.values.includes(l) && (a = !1);
@@ -3647,12 +3652,12 @@ const xn = () => _e().refine((t) => t && (t.seconds !== void 0 && t.nanoseconds
3647
3652
  }, { message: "Value is not an allowed value" }));
3648
3653
  break;
3649
3654
  case "Map":
3650
- i = mn(_e()), e.required && (i = i.refine((o) => o && typeof o == "object" && Object.keys(o).length > 0, {
3655
+ i = mn(we()), e.required && (i = i.refine((o) => o && typeof o == "object" && Object.keys(o).length > 0, {
3651
3656
  message: "Value must have at least one object property"
3652
3657
  }));
3653
3658
  break;
3654
3659
  case "Embedding":
3655
- i = _e();
3660
+ i = we();
3656
3661
  break;
3657
3662
  }
3658
3663
  return !ee(e) && e.nullable && (i = i.nullable()), e.required || (i = i.optional()), i;
@@ -4245,7 +4250,7 @@ class yl {
4245
4250
  return this.inf.format(n);
4246
4251
  } else {
4247
4252
  const n = this.floor ? Math.floor(e) : rr(e, 3);
4248
- return ye(n, this.padTo);
4253
+ return pe(n, this.padTo);
4249
4254
  }
4250
4255
  }
4251
4256
  }
@@ -4956,7 +4961,7 @@ function $e(t, e, n) {
4956
4961
  function xl(t, e) {
4957
4962
  return t - e * Math.floor(t / e);
4958
4963
  }
4959
- function ye(t, e = 2) {
4964
+ function pe(t, e = 2) {
4960
4965
  const n = t < 0;
4961
4966
  let s;
4962
4967
  return n ? s = "-" + ("" + -t).padStart(e, "0") : s = ("" + t).padStart(e, "0"), s;
@@ -5063,11 +5068,11 @@ function an(t, e) {
5063
5068
  const n = Math.trunc(Math.abs(t / 60)), s = Math.trunc(Math.abs(t % 60)), r = t >= 0 ? "+" : "-";
5064
5069
  switch (e) {
5065
5070
  case "short":
5066
- return `${r}${ye(n, 2)}:${ye(s, 2)}`;
5071
+ return `${r}${pe(n, 2)}:${pe(s, 2)}`;
5067
5072
  case "narrow":
5068
5073
  return `${r}${n}${s > 0 ? `:${s}` : ""}`;
5069
5074
  case "techie":
5070
- return `${r}${ye(n, 2)}${ye(s, 2)}`;
5075
+ return `${r}${pe(n, 2)}${pe(s, 2)}`;
5071
5076
  default:
5072
5077
  throw new RangeError(`Value format ${e} is out of range for property format`);
5073
5078
  }
@@ -5261,7 +5266,7 @@ class ve {
5261
5266
  }
5262
5267
  num(e, n = 0, s = void 0) {
5263
5268
  if (this.opts.forceSimple)
5264
- return ye(e, n);
5269
+ return pe(e, n);
5265
5270
  const r = { ...this.opts };
5266
5271
  return n > 0 && (r.padTo = n), s && (r.signDisplay = s), this.loc.numberFormatter(r).format(e);
5267
5272
  }
@@ -7465,12 +7470,12 @@ function Sn(t, e, n = !0) {
7465
7470
  function vs(t, e, n) {
7466
7471
  const s = t.c.year > 9999 || t.c.year < 0;
7467
7472
  let r = "";
7468
- if (s && t.c.year >= 0 && (r += "+"), r += ye(t.c.year, s ? 6 : 4), n === "year") return r;
7473
+ if (s && t.c.year >= 0 && (r += "+"), r += pe(t.c.year, s ? 6 : 4), n === "year") return r;
7469
7474
  if (e) {
7470
- if (r += "-", r += ye(t.c.month), n === "month") return r;
7475
+ if (r += "-", r += pe(t.c.month), n === "month") return r;
7471
7476
  r += "-";
7472
- } else if (r += ye(t.c.month), n === "month") return r;
7473
- return r += ye(t.c.day), r;
7477
+ } else if (r += pe(t.c.month), n === "month") return r;
7478
+ return r += pe(t.c.day), r;
7474
7479
  }
7475
7480
  function ti(t, e, n, s, r, i, o) {
7476
7481
  let a = !n || t.c.millisecond !== 0 || t.c.second !== 0, l = "";
@@ -7480,18 +7485,18 @@ function ti(t, e, n, s, r, i, o) {
7480
7485
  case "year":
7481
7486
  break;
7482
7487
  default:
7483
- if (l += ye(t.c.hour), o === "hour") break;
7488
+ if (l += pe(t.c.hour), o === "hour") break;
7484
7489
  if (e) {
7485
- if (l += ":", l += ye(t.c.minute), o === "minute") break;
7486
- a && (l += ":", l += ye(t.c.second));
7490
+ if (l += ":", l += pe(t.c.minute), o === "minute") break;
7491
+ a && (l += ":", l += pe(t.c.second));
7487
7492
  } else {
7488
- if (l += ye(t.c.minute), o === "minute") break;
7489
- a && (l += ye(t.c.second));
7493
+ if (l += pe(t.c.minute), o === "minute") break;
7494
+ a && (l += pe(t.c.second));
7490
7495
  }
7491
7496
  if (o === "second") break;
7492
- a && (!s || t.c.millisecond !== 0) && (l += ".", l += ye(t.c.millisecond, 3));
7497
+ a && (!s || t.c.millisecond !== 0) && (l += ".", l += pe(t.c.millisecond, 3));
7493
7498
  }
7494
- return r && (t.isOffsetFixed && t.offset === 0 && !i ? l += "Z" : t.o < 0 ? (l += "-", l += ye(Math.trunc(-t.o / 60)), l += ":", l += ye(Math.trunc(-t.o % 60))) : (l += "+", l += ye(Math.trunc(t.o / 60)), l += ":", l += ye(Math.trunc(t.o % 60)))), i && (l += "[" + t.zone.ianaName + "]"), l;
7499
+ 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
7500
  }
7496
7501
  const No = {
7497
7502
  month: 1,
@@ -9202,10 +9207,10 @@ const Yc = (t, e) => {
9202
9207
  if (t.includeFields) {
9203
9208
  const s = e.collections[t.collection];
9204
9209
  if (!s)
9205
- return mn(_e());
9210
+ return mn(we());
9206
9211
  t.includeFields.forEach((r) => {
9207
9212
  const i = s.fields.find((o) => o.name === r);
9208
- i ? n[r] = Ao(i)?.nullable() : n[r] = _e();
9213
+ i ? n[r] = Ao(i)?.nullable() : n[r] = we();
9209
9214
  });
9210
9215
  }
9211
9216
  return qe({
@@ -9219,7 +9224,7 @@ const Yc = (t, e) => {
9219
9224
  i = Qt(o.admin?.skipFormRequiredValidation);
9220
9225
  }
9221
9226
  return (!t.required || i) && (r = r.optional()), r;
9222
- }, Qc = () => _e().refine((t) => t === null || t && (t.seconds !== void 0 && t.nanoseconds !== void 0 || t._seconds !== void 0 && t._nanoseconds !== void 0), {
9227
+ }, Qc = () => we().refine((t) => t === null || t && (t.seconds !== void 0 && t.nanoseconds !== void 0 || t._seconds !== void 0 && t._nanoseconds !== void 0), {
9223
9228
  message: "Must be a valid date"
9224
9229
  }), Ao = (t, e, n) => {
9225
9230
  let s;
@@ -9270,7 +9275,7 @@ const Yc = (t, e) => {
9270
9275
  })));
9271
9276
  break;
9272
9277
  case "Array":
9273
- s = St(_e()), 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) => {
9278
+ 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
9279
  let c = !0;
9275
9280
  return l.forEach((d) => {
9276
9281
  t.values && !t.values.includes(d) && (c = !1);
@@ -9278,12 +9283,12 @@ const Yc = (t, e) => {
9278
9283
  }, { 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
9284
  break;
9280
9285
  case "Map":
9281
- t.required && !i ? n ? s = qe({}).catchall(_e()).describe(`${r}Must be an object. Must contain at least one object property.`) : s = mn(_e()).refine((l) => l && typeof l == "object" && Object.keys(l).length > 0, {
9286
+ 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
9287
  message: "Must not be an empty value"
9283
- }) : s = qe({}).catchall(_e()).describe(`${r}Must be an object`);
9288
+ }) : s = qe({}).catchall(we()).describe(`${r}Must be an object`);
9284
9289
  break;
9285
9290
  case "Computed":
9286
- s = _e();
9291
+ s = we();
9287
9292
  }
9288
9293
  return (!t.required || i || o) && (s = s.optional()), s;
9289
9294
  }, bu = (t, e, n, s, r) => {
@@ -9300,9 +9305,9 @@ const Yc = (t, e) => {
9300
9305
  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
9306
  a[`attribute-${c.labels.collection}-${d.type}`] = on().optional();
9302
9307
  }), c.access.entityRestrictions?.restrictions?.forEach((d) => {
9303
- if (d.type === "Individual" && (a[`accessible-${c.labels.collection}-${c.labels.collection}`] = qe({}).catchall(_e()).optional()), d.type === "Parent" || d.type === "Parent_Property") {
9308
+ if (d.type === "Individual" && (a[`accessible-${c.labels.collection}-${c.labels.collection}`] = qe({}).catchall(we()).optional()), d.type === "Parent" || d.type === "Parent_Property") {
9304
9309
  const h = V(c.fields, d.collectionField);
9305
- a[`accessible-${c.labels.collection}-${h.collection}`] = qe({}).catchall(_e()).optional();
9310
+ a[`accessible-${c.labels.collection}-${h.collection}`] = qe({}).catchall(we()).optional();
9306
9311
  }
9307
9312
  });
9308
9313
  }));
@@ -9584,13 +9589,13 @@ const Ft = {
9584
9589
  return Fo;
9585
9590
  },
9586
9591
  getGlobalConfigModule() {
9587
- return ge(nn);
9592
+ return ye(nn);
9588
9593
  },
9589
9594
  getCustomizationFile(t, e) {
9590
9595
  if (!Object.keys(e.collections).includes(t))
9591
9596
  throw new Error("PERMISSION_DENIED");
9592
9597
  const n = pa([t], $o, "node", Ft);
9593
- return ge(n?.[t]);
9598
+ return ye(n?.[t]);
9594
9599
  },
9595
9600
  getVersionInfo() {
9596
9601
  return Fn;
@@ -10107,9 +10112,9 @@ const Ft = {
10107
10112
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
10108
10113
  a.get(y.id),
10109
10114
  T,
10110
- ge(e.subcollections),
10115
+ ye(e.subcollections),
10111
10116
  R,
10112
- ge(e?.relations),
10117
+ ye(e?.relations),
10113
10118
  void 0,
10114
10119
  e.userId,
10115
10120
  e.transactional ? c : void 0,
@@ -10127,7 +10132,7 @@ const Ft = {
10127
10132
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
10128
10133
  a.get(y.id),
10129
10134
  T,
10130
- ge(e.relations),
10135
+ ye(e.relations),
10131
10136
  R,
10132
10137
  void 0,
10133
10138
  e.userId,
@@ -10346,8 +10351,8 @@ const Ft = {
10346
10351
  const E = /* @__PURE__ */ new Date(), w = new Date((/* @__PURE__ */ new Date()).setDate(E.getDate() + u));
10347
10352
  f.TTL = ht.fromDate(w);
10348
10353
  }
10349
- const g = ge(n);
10350
- Qe(g), t !== "delete" && (f.data.data = ge(g)), t === "update" && (f.data.originalRecord = ge(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));
10354
+ const g = ye(n);
10355
+ 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
10356
  const R = Me(d, r, s), m = n.Last_Write_At;
10352
10357
  await R.doc(i).collection("system_write_log").doc(`${n.Last_Write_By}-${m.valueOf()}`).set(f);
10353
10358
  }, _n = async (t) => {
@@ -10407,9 +10412,9 @@ function su(t) {
10407
10412
  }
10408
10413
  const qo = async (t, e, n, s, r, i, o) => {
10409
10414
  const a = Rt(), l = he(), { labels: c, fields: d } = s;
10410
- if (r.Email === void 0 || r.Email === null || ke(r.Email) || r.Email === "")
10415
+ if (ke(r.Email) || !r.Email)
10411
10416
  throw new Error("VALIDATION_ERROR: Email field is required");
10412
- if (r.Role === void 0 || r.Role === null || ke(r.Role) || r.Role === "")
10417
+ if (ke(r.Role) || !r.Role)
10413
10418
  throw new Error("VALIDATION_ERROR: Role field is required");
10414
10419
  if (r.Enabled === void 0 || r.Enabled === null || ke(r.Enabled))
10415
10420
  throw new Error("VALIDATION_ERROR: Enabled field is required");
@@ -10513,7 +10518,7 @@ const qo = async (t, e, n, s, r, i, o) => {
10513
10518
  }, fr = (t) => {
10514
10519
  if (typeof t == "object")
10515
10520
  for (const e in t)
10516
- Object.prototype.hasOwnProperty.call(t, e) && (t[e] === "_DELETE_FIELD" ? t[e] = we.delete() : fr(t[e]));
10521
+ Object.prototype.hasOwnProperty.call(t, e) && (t[e] === "_DELETE_FIELD" ? t[e] = ge.delete() : fr(t[e]));
10517
10522
  }, ru = (t, e, n) => {
10518
10523
  if (ee(n) && n.includeFields) {
10519
10524
  const s = {};
@@ -10580,7 +10585,7 @@ const qo = async (t, e, n, s, r, i, o) => {
10580
10585
  m.set(w.collection, {
10581
10586
  ...m.get(w.collection) || {},
10582
10587
  [O]: y
10583
- }), S = ge({ ...y, ...Mn(s) });
10588
+ }), S = ye({ ...y, ...Mn(s) });
10584
10589
  }
10585
10590
  const C = {
10586
10591
  ...S[k.name],
@@ -10616,7 +10621,7 @@ const qo = async (t, e, n, s, r, i, o) => {
10616
10621
  m.set(w.collection, {
10617
10622
  ...m.get(w.collection) || {},
10618
10623
  [O]: P
10619
- }), S = ge({ ...P, ...Mn(s) });
10624
+ }), S = ye({ ...P, ...Mn(s) });
10620
10625
  }
10621
10626
  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
10627
  ...E.get(w.collection) || {},
@@ -10721,12 +10726,12 @@ const qo = async (t, e, n, s, r, i, o) => {
10721
10726
  const i = r?.archivedField, o = r?.timestampField;
10722
10727
  if (n[i] === !0)
10723
10728
  if (t === "create")
10724
- n[o] = we.serverTimestamp();
10729
+ n[o] = ge.serverTimestamp();
10725
10730
  else {
10726
10731
  if (!s)
10727
10732
  throw new Error("Original record is required for update");
10728
10733
  if (!s[i])
10729
- n[o] = we.serverTimestamp();
10734
+ n[o] = ge.serverTimestamp();
10730
10735
  else if (n[o] && n[o]?.valueOf() !== s[o]?.valueOf())
10731
10736
  throw new Error("Soft delete timestamp cannot be changed");
10732
10737
  }
@@ -10822,15 +10827,23 @@ const qo = async (t, e, n, s, r, i, o) => {
10822
10827
  s && await dr(t, u);
10823
10828
  const H = Me(x, t, o), S = n?.id || H.doc().id;
10824
10829
  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(), we.serverTimestamp());
10830
+ const p = Ks("create", t, e, l, w, "Online", s || "System", ht.now(), ge.serverTimestamp());
10826
10831
  n?.createdAt && (p.Created_At = n.createdAt), n?.createdBy && (p.Created_By = n.createdBy);
10827
- const C = ge(p);
10832
+ const C = ye(p);
10828
10833
  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
10834
  const _ = (s ? await x.collection("tenants").doc(o).collection("system_user_permissions").doc(s).get() : void 0)?.data();
10830
10835
  await va(p, u, E, _, v?.customClaims || {}), Ze(p);
10831
10836
  try {
10832
- if (u.auth && r && !r.password)
10833
- throw new Error("Password is required");
10837
+ if (u.auth && r) {
10838
+ if (!r.password)
10839
+ throw new Error("Password is required");
10840
+ if (!p.Role)
10841
+ throw new Error("Role field is required");
10842
+ if (!p.Email)
10843
+ throw new Error("Email field is required");
10844
+ if (p.Enabled === void 0 || p.Enabled === null)
10845
+ throw new Error("Enabled field is required");
10846
+ }
10834
10847
  n?.providedTransaction || await fn("create", p, u, E, { operation: "create", data: p, context: i }, l);
10835
10848
  } catch (D) {
10836
10849
  throw new Error(`VALIDATION_ERROR: ${D.message}`);
@@ -10930,7 +10943,7 @@ const qo = async (t, e, n, s, r, i, o) => {
10930
10943
  const M = { size: 1 };
10931
10944
  await T(D, M), n?.noTwoWay || await Ho("Create", o, S, p, p, u, l, D, M, s, W, void 0, O);
10932
10945
  const J = Qs(l);
10933
- lr("create", D, t, S, p, l, u, n, J, we.arrayUnion, we.arrayRemove, we.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);
10946
+ 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
10947
  } catch (M) {
10935
10948
  if (n?.providedTransaction)
10936
10949
  throw M;
@@ -11148,7 +11161,7 @@ const qo = async (t, e, n, s, r, i, o) => {
11148
11161
  (B) => n[B.name] !== void 0 && n[B.name] !== b[B.name]
11149
11162
  ));
11150
11163
  delete n.id, Bo(n), fr(n);
11151
- const y = Ks("update", t, n, c, w, "Online", r || "System", ht.now(), we.serverTimestamp()), _ = ge(y);
11164
+ const y = Ks("update", t, n, c, w, "Online", r || "System", ht.now(), ge.serverTimestamp()), _ = ye(y);
11152
11165
  for (const b of R)
11153
11166
  !ee(b) && ke(y[b.name]) && b.nullable && (y[b.name] = null);
11154
11167
  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 +11170,7 @@ const qo = async (t, e, n, s, r, i, o) => {
11157
11170
  data: y,
11158
11171
  recordId: e,
11159
11172
  context: o,
11160
- originalRecord: ge(O)
11173
+ originalRecord: ye(O)
11161
11174
  };
11162
11175
  await ue("preOperation", l, E, T);
11163
11176
  const U = {
@@ -11165,7 +11178,7 @@ const qo = async (t, e, n, s, r, i, o) => {
11165
11178
  data: y,
11166
11179
  recordId: e,
11167
11180
  context: o,
11168
- originalRecord: ge(O)
11181
+ originalRecord: ye(O)
11169
11182
  };
11170
11183
  await ue("preWrite", l, E, U), vt(f, y, c), Pn(f, y), Ze(y);
11171
11184
  try {
@@ -11173,7 +11186,7 @@ const qo = async (t, e, n, s, r, i, o) => {
11173
11186
  throw new Error("Password is required");
11174
11187
  if (!s?.providedTransaction) {
11175
11188
  const b = { ...H, ...y };
11176
- Qe(b), await fn("update", b, f, E, { operation: "update", data: y, context: o, originalRecord: ge(O) }, c);
11189
+ Qe(b), await fn("update", b, f, E, { operation: "update", data: y, context: o, originalRecord: ye(O) }, c);
11177
11190
  }
11178
11191
  } catch (b) {
11179
11192
  throw new Error(`VALIDATION_ERROR: ${b.message}`);
@@ -11183,7 +11196,7 @@ const qo = async (t, e, n, s, r, i, o) => {
11183
11196
  !ee(b) && ke(y[b.name]) && b.nullable && (y[b.name] = null);
11184
11197
  try {
11185
11198
  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: ge(O) }, c);
11199
+ 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
11200
  } catch (b) {
11188
11201
  throw new Error(`VALIDATION_ERROR: ${b.message}`);
11189
11202
  }
@@ -11205,8 +11218,8 @@ const qo = async (t, e, n, s, r, i, o) => {
11205
11218
  if (K && (K.size += 3), !s?.providedTransaction) {
11206
11219
  if (!le.exists)
11207
11220
  throw new Error("VERSION_ERROR");
11208
- const me = le.data();
11209
- if (me.force && y.Last_Write_At.valueOf() < me.time.valueOf())
11221
+ const _e = le.data();
11222
+ if (_e.force && y.Last_Write_At.valueOf() < _e.time.valueOf())
11210
11223
  throw new Error("VERSION_ERROR");
11211
11224
  if (!Te.exists)
11212
11225
  throw new Error("MAINTENANCE_MODE");
@@ -11227,12 +11240,12 @@ const qo = async (t, e, n, s, r, i, o) => {
11227
11240
  if (K && (K.size += Lo(a, t, e, c, v, N).length), p && O.User_ID || C && !O.User_ID)
11228
11241
  throw new Error("USER_ERROR");
11229
11242
  if (P(O)) {
11230
- const me = await b.get(k.collection("tenants").doc(a).collection("system_user_permissions").doc(O.User_ID));
11231
- if (K && K.size++, !me?.exists)
11243
+ const _e = await b.get(k.collection("tenants").doc(a).collection("system_user_permissions").doc(O.User_ID));
11244
+ if (K && K.size++, !_e?.exists)
11232
11245
  throw new Error("PERMISSION_DENIED");
11233
- F = me.data();
11246
+ F = _e.data();
11234
11247
  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 = ge(F), i.permissions.Role = y.Role), i?.permissions) {
11248
+ if (y.Role && y.Role !== O.Role && !pt && (i ||= { operation: "update", permissions: {} }, i.permissions = ye(F), i.permissions.Role = y.Role), i?.permissions) {
11236
11249
  if (i.permissions.Role ||= y.Role || O.Role, i.permissions.Enabled ??= y.Enabled ?? O.Enabled, ke(i.permissions.Role) || !i.permissions.Role)
11237
11250
  throw new Error("VALIDATION_ERROR: Role field is required");
11238
11251
  if (ke(i.permissions.Enabled) || i.permissions.Enabled === void 0 || i.permissions.Enabled === null)
@@ -11240,12 +11253,12 @@ const qo = async (t, e, n, s, r, i, o) => {
11240
11253
  }
11241
11254
  }
11242
11255
  if (p) {
11243
- const me = { ...O, ...y };
11244
- if (Qe(me), me.Role === void 0 || me.Role === null || me.Role === "")
11256
+ const _e = { ...O, ...y };
11257
+ if (Qe(_e), !_e.Role)
11245
11258
  throw new Error("VALIDATION_ERROR: Role field is required");
11246
- if (me.Enabled === void 0 || me.Enabled === null)
11259
+ if (_e.Enabled === void 0 || _e.Enabled === null)
11247
11260
  throw new Error("VALIDATION_ERROR: Enabled field is required");
11248
- if (me.Email === void 0 || me.Email === null || me.Email === "")
11261
+ if (!_e.Email)
11249
11262
  throw new Error("VALIDATION_ERROR: Email field is required");
11250
11263
  }
11251
11264
  if (!s?.providedTransaction) {
@@ -11273,13 +11286,13 @@ const qo = async (t, e, n, s, r, i, o) => {
11273
11286
  await Promise.all(pt);
11274
11287
  }
11275
11288
  if (r && v?.Role) {
11276
- const me = v.Role, pt = { ...O, ...y };
11277
- if (!(E.custom?.serverAccess?.update !== void 0 ? await ae(E.custom.serverAccess.update, [me, pt, O]) : !0))
11289
+ const _e = v.Role, pt = { ...O, ...y };
11290
+ if (!(E.custom?.serverAccess?.update !== void 0 ? await ae(E.custom.serverAccess.update, [_e, pt, O]) : !0))
11278
11291
  throw new Error("PERMISSION_DENIED");
11279
11292
  for (const Yt of f.fields) {
11280
11293
  const En = We(Yt, E);
11281
11294
  if (Object.prototype.hasOwnProperty.call(y, Yt.name) && En?.custom?.serverAccess?.update !== void 0 && !await ae(En.custom.serverAccess.update, [
11282
- me,
11295
+ _e,
11283
11296
  pt,
11284
11297
  O
11285
11298
  ]))
@@ -11300,7 +11313,7 @@ const qo = async (t, e, n, s, r, i, o) => {
11300
11313
  let Te;
11301
11314
  !s?.noTwoWay && !s?.providedTransaction && (Te = await Ho("Update", a, e, le, y, f, c, b, K, r, v, O, N));
11302
11315
  const oe = Qs(c);
11303
- lr("update", b, t, e, y, c, f, s, oe, we.arrayUnion, we.arrayRemove, we.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);
11316
+ 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
11317
  } catch (K) {
11305
11318
  if (s?.providedTransaction)
11306
11319
  throw K;
@@ -11311,12 +11324,12 @@ const qo = async (t, e, n, s, r, i, o) => {
11311
11324
  recordId: e,
11312
11325
  context: o,
11313
11326
  error: K,
11314
- originalRecord: ge(O)
11327
+ originalRecord: ye(O)
11315
11328
  }, Te = await ue("postWriteError", l, E, le);
11316
11329
  if (m && (await new Promise((oe) => {
11317
11330
  setTimeout(oe, 250);
11318
11331
  }), 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: we.delete() }), K;
11332
+ 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
11333
  }
11321
11334
  }
11322
11335
  (p || P(O) || C) && await ai(di, [e, O.User_ID]).catch(() => {
@@ -11335,7 +11348,7 @@ const qo = async (t, e, n, s, r, i, o) => {
11335
11348
  const B = { ...O, ...y };
11336
11349
  Qe(B);
11337
11350
  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 = we.delete());
11351
+ p && (y.User_ID = K), C && (y.User_ID = ge.delete());
11339
11352
  }
11340
11353
  s?.providedTransaction ? await M(s.providedTransaction, b) : await k.runTransaction(async (B) => {
11341
11354
  await M(B, b);
@@ -11351,7 +11364,7 @@ const qo = async (t, e, n, s, r, i, o) => {
11351
11364
  data: y,
11352
11365
  recordId: e,
11353
11366
  context: o,
11354
- originalRecord: ge(O)
11367
+ originalRecord: ye(O)
11355
11368
  }, B = { ...b };
11356
11369
  await ue("postWrite", l, E, b), await ue("postOperation", l, E, B);
11357
11370
  }
@@ -11369,14 +11382,14 @@ const qo = async (t, e, n, s, r, i, o) => {
11369
11382
  throw new Error("COLLECTION_NOT_FOUND");
11370
11383
  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
11384
  if (R && !f && !n?.force)
11372
- return await uu(t, e, { [R.archivedField]: !0, [R.timestampField]: we.serverTimestamp() }, { userId: s });
11385
+ return await uu(t, e, { [R.archivedField]: !0, [R.timestampField]: ge.serverTimestamp() }, { userId: s });
11373
11386
  const w = he();
11374
11387
  let x;
11375
11388
  s && await dr(t, h);
11376
11389
  const k = Me(w, t, i);
11377
11390
  r = r || {}, r.collection = u.collection;
11378
11391
  const v = await Xe(t, e, { userId: s });
11379
- let N = Ks("delete", t, v, a, E, "Online", s || "System", ht.now(), we.serverTimestamp());
11392
+ let N = Ks("delete", t, v, a, E, "Online", s || "System", ht.now(), ge.serverTimestamp());
11380
11393
  const W = Mn(N);
11381
11394
  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
11395
  const S = async (P) => {
@@ -11414,7 +11427,7 @@ const qo = async (t, e, n, s, r, i, o) => {
11414
11427
  await w.runTransaction(async (P) => {
11415
11428
  await S(P);
11416
11429
  const y = Qs(a);
11417
- lr("delete", P, t, e, N, a, h, n, y, we.arrayUnion, we.arrayRemove, we.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));
11430
+ 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
11431
  }, { maxAttempts: 10 });
11419
11432
  } catch (P) {
11420
11433
  const _ = await ue("postWriteError", o, m, {
@@ -11427,7 +11440,7 @@ const qo = async (t, e, n, s, r, i, o) => {
11427
11440
  if (g && (await new Promise((T) => {
11428
11441
  setTimeout(T, 250);
11429
11442
  }), 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: we.delete() }), P;
11443
+ throw h.auth && N.User_ID && await w.collection("tenants").doc(i).collection(u.collection).doc(e).update({ User_ID: ge.delete() }), P;
11431
11444
  }
11432
11445
  const p = { operation: "delete", data: N, recordId: e, context: r }, C = { ...p };
11433
11446
  return await ue("postWrite", o, m, p), await ue("postOperation", o, m, C), { id: e, ...N };