@stoker-platform/node-client 0.5.25 → 0.5.27

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
@@ -96,8 +96,8 @@ const jn = (n) => !!n.auth, Re = (n, e) => {
96
96
  p = !0;
97
97
  const N = W(o, _.collectionField), C = W(o, _.propertyField);
98
98
  Object.entries(l?.parentPropertyEntities || {}).some((L) => {
99
- const [I, y] = L;
100
- return I === i[C.name] && i[`${N.name}_Array`].some((k) => y.includes(k));
99
+ const [D, y] = L;
100
+ return D === i[C.name] && i[`${N.name}_Array`].some((k) => y.includes(k));
101
101
  }) || (v = !1);
102
102
  }), h && p) {
103
103
  if (!(f || v)) {
@@ -116,27 +116,27 @@ const jn = (n) => !!n.auth, Re = (n, e) => {
116
116
  c = !1;
117
117
  return;
118
118
  }
119
- L.individualEntities?.some((I) => i[`${C.name}_Array`].includes(I)) || (E = !1);
119
+ L.individualEntities?.some((D) => i[`${C.name}_Array`].includes(D)) || (E = !1);
120
120
  });
121
121
  let R = !0, x = !1;
122
122
  if (d?.filter((_) => _.parentFilter.type === "Parent").forEach((_) => {
123
123
  x = !0;
124
- const { parentFilter: N } = _, C = W(o, N.collectionField), L = W(o, N.parentCollectionField), I = r.collections?.[C.collection];
125
- if (!I) {
124
+ const { parentFilter: N } = _, C = W(o, N.collectionField), L = W(o, N.parentCollectionField), D = r.collections?.[C.collection];
125
+ if (!D) {
126
126
  c = !1;
127
127
  return;
128
128
  }
129
- I.parentEntities?.some((y) => i[`${L.name}_Array`].includes(y)) || (R = !1);
129
+ D.parentEntities?.some((y) => i[`${L.name}_Array`].includes(y)) || (R = !1);
130
130
  }), d?.filter((_) => _.parentFilter.type === "Parent_Property").forEach((_) => {
131
131
  x = !0;
132
- const { parentFilter: N } = _, C = W(o, N.collectionField), L = W(o, N.parentPropertyField), I = W(o, N.parentCollectionField), y = r.collections?.[C.collection];
132
+ const { parentFilter: N } = _, C = W(o, N.collectionField), L = W(o, N.parentPropertyField), D = W(o, N.parentCollectionField), y = r.collections?.[C.collection];
133
133
  if (!y) {
134
134
  c = !1;
135
135
  return;
136
136
  }
137
137
  Object.entries(y.parentPropertyEntities || {}).some((k) => {
138
138
  const [w, B] = k;
139
- return w === i[L.name] && i[`${I.name}_Array`].some((g) => B.includes(g));
139
+ return w === i[L.name] && i[`${D.name}_Array`].some((g) => B.includes(g));
140
140
  }) || (R = !1);
141
141
  }), O && x) {
142
142
  if (!(E || R)) {
@@ -528,7 +528,7 @@ const jn = (n) => !!n.auth, Re = (n, e) => {
528
528
  i[a] = l;
529
529
  }
530
530
  return i;
531
- }, De = (n, e) => e.fields.filter((t) => t.name === n.name)[0], Qn = {
531
+ }, Ie = (n, e) => e.fields.filter((t) => t.name === n.name)[0], Qn = {
532
532
  global: {},
533
533
  collections: {}
534
534
  }, zt = (n, e) => n && typeof n == "function" ? e ? n(...e) : n() : n, re = async (n, e) => {
@@ -1173,7 +1173,7 @@ class Oe {
1173
1173
  }
1174
1174
  const Y = Object.freeze({
1175
1175
  status: "aborted"
1176
- }), qt = (n) => ({ status: "dirty", value: n }), Ce = (n) => ({ status: "valid", value: n }), ir = (n) => n.status === "aborted", or = (n) => n.status === "dirty", It = (n) => n.status === "valid", Nn = (n) => typeof Promise < "u" && n instanceof Promise;
1176
+ }), qt = (n) => ({ status: "dirty", value: n }), Ce = (n) => ({ status: "valid", value: n }), ir = (n) => n.status === "aborted", or = (n) => n.status === "dirty", Dt = (n) => n.status === "valid", Nn = (n) => typeof Promise < "u" && n instanceof Promise;
1177
1177
  var Z;
1178
1178
  (function(n) {
1179
1179
  n.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, n.toString = (e) => typeof e == "string" ? e : e?.message;
@@ -1187,7 +1187,7 @@ class Ze {
1187
1187
  }
1188
1188
  }
1189
1189
  const ar = (n, e) => {
1190
- if (It(e))
1190
+ if (Dt(e))
1191
1191
  return { success: !0, data: e.value };
1192
1192
  if (!n.common.issues.length)
1193
1193
  throw new Error("Validation failed but no issues detected.");
@@ -1288,7 +1288,7 @@ class X {
1288
1288
  if (!this["~standard"].async)
1289
1289
  try {
1290
1290
  const s = this._parseSync({ data: e, path: [], parent: t });
1291
- return It(s) ? {
1291
+ return Dt(s) ? {
1292
1292
  value: s.value
1293
1293
  } : {
1294
1294
  issues: t.common.issues
@@ -1299,7 +1299,7 @@ class X {
1299
1299
  async: !0
1300
1300
  };
1301
1301
  }
1302
- return this._parseAsync({ data: e, path: [], parent: t }).then((s) => It(s) ? {
1302
+ return this._parseAsync({ data: e, path: [], parent: t }).then((s) => Dt(s) ? {
1303
1303
  value: s.value
1304
1304
  } : {
1305
1305
  issues: t.common.issues
@@ -1372,10 +1372,10 @@ class X {
1372
1372
  return Cn.create(this, this._def);
1373
1373
  }
1374
1374
  or(e) {
1375
- return In.create([this, e], this._def);
1375
+ return Dn.create([this, e], this._def);
1376
1376
  }
1377
1377
  and(e) {
1378
- return Dn.create(this, e, this._def);
1378
+ return In.create(this, e, this._def);
1379
1379
  }
1380
1380
  transform(e) {
1381
1381
  return new Ct({
@@ -1853,7 +1853,7 @@ function Na(n, e) {
1853
1853
  const t = (n.toString().split(".")[1] || "").length, s = (e.toString().split(".")[1] || "").length, r = t > s ? t : s, i = Number.parseInt(n.toFixed(r).replace(".", "")), a = Number.parseInt(e.toFixed(r).replace(".", ""));
1854
1854
  return i % a / 10 ** r;
1855
1855
  }
1856
- class Dt extends X {
1856
+ class It extends X {
1857
1857
  constructor() {
1858
1858
  super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
1859
1859
  }
@@ -1911,7 +1911,7 @@ class Dt extends X {
1911
1911
  return this.setLimit("max", e, !1, Z.toString(t));
1912
1912
  }
1913
1913
  setLimit(e, t, s, r) {
1914
- return new Dt({
1914
+ return new It({
1915
1915
  ...this._def,
1916
1916
  checks: [
1917
1917
  ...this._def.checks,
@@ -1925,7 +1925,7 @@ class Dt extends X {
1925
1925
  });
1926
1926
  }
1927
1927
  _addCheck(e) {
1928
- return new Dt({
1928
+ return new It({
1929
1929
  ...this._def,
1930
1930
  checks: [...this._def.checks, e]
1931
1931
  });
@@ -2019,7 +2019,7 @@ class Dt extends X {
2019
2019
  return Number.isFinite(t) && Number.isFinite(e);
2020
2020
  }
2021
2021
  }
2022
- Dt.create = (n) => new Dt({
2022
+ It.create = (n) => new It({
2023
2023
  checks: [],
2024
2024
  typeName: G.ZodNumber,
2025
2025
  coerce: n?.coerce || !1,
@@ -2736,7 +2736,7 @@ de.lazycreate = (n, e) => new de({
2736
2736
  typeName: G.ZodObject,
2737
2737
  ...J(e)
2738
2738
  });
2739
- class In extends X {
2739
+ class Dn extends X {
2740
2740
  _parse(e) {
2741
2741
  const { ctx: t } = this._processInputParams(e), s = this._def.options;
2742
2742
  function r(i) {
@@ -2804,7 +2804,7 @@ class In extends X {
2804
2804
  return this._def.options;
2805
2805
  }
2806
2806
  }
2807
- In.create = (n, e) => new In({
2807
+ Dn.create = (n, e) => new Dn({
2808
2808
  options: n,
2809
2809
  typeName: G.ZodUnion,
2810
2810
  ...J(e)
@@ -2835,7 +2835,7 @@ function Es(n, e) {
2835
2835
  return { valid: !0, data: r };
2836
2836
  } else return t === U.date && s === U.date && +n == +e ? { valid: !0, data: n } : { valid: !1 };
2837
2837
  }
2838
- class Dn extends X {
2838
+ class In extends X {
2839
2839
  _parse(e) {
2840
2840
  const { status: t, ctx: s } = this._processInputParams(e), r = (i, a) => {
2841
2841
  if (ir(i) || ir(a))
@@ -2867,7 +2867,7 @@ class Dn extends X {
2867
2867
  }));
2868
2868
  }
2869
2869
  }
2870
- Dn.create = (n, e, t) => new Dn({
2870
+ In.create = (n, e, t) => new In({
2871
2871
  left: n,
2872
2872
  right: e,
2873
2873
  typeName: G.ZodIntersection,
@@ -3293,14 +3293,14 @@ class Ct extends X {
3293
3293
  path: s.path,
3294
3294
  parent: s
3295
3295
  });
3296
- if (!It(a))
3296
+ if (!Dt(a))
3297
3297
  return Y;
3298
3298
  const o = r.transform(a.value, i);
3299
3299
  if (o instanceof Promise)
3300
3300
  throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
3301
3301
  return { status: t.value, value: o };
3302
3302
  } else
3303
- return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((a) => It(a) ? Promise.resolve(r.transform(a.value, i)).then((o) => ({
3303
+ return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((a) => Dt(a) ? Promise.resolve(r.transform(a.value, i)).then((o) => ({
3304
3304
  status: t.value,
3305
3305
  value: o
3306
3306
  })) : Y);
@@ -3480,7 +3480,7 @@ class Us extends X {
3480
3480
  }
3481
3481
  class bs extends X {
3482
3482
  _parse(e) {
3483
- const t = this._def.innerType._parse(e), s = (r) => (It(r) && (r.value = Object.freeze(r.value)), r);
3483
+ const t = this._def.innerType._parse(e), s = (r) => (Dt(r) && (r.value = Object.freeze(r.value)), r);
3484
3484
  return Nn(t) ? t.then((r) => s(r)) : s(t);
3485
3485
  }
3486
3486
  unwrap() {
@@ -3496,10 +3496,10 @@ var G;
3496
3496
  (function(n) {
3497
3497
  n.ZodString = "ZodString", n.ZodNumber = "ZodNumber", n.ZodNaN = "ZodNaN", n.ZodBigInt = "ZodBigInt", n.ZodBoolean = "ZodBoolean", n.ZodDate = "ZodDate", n.ZodSymbol = "ZodSymbol", n.ZodUndefined = "ZodUndefined", n.ZodNull = "ZodNull", n.ZodAny = "ZodAny", n.ZodUnknown = "ZodUnknown", n.ZodNever = "ZodNever", n.ZodVoid = "ZodVoid", n.ZodArray = "ZodArray", n.ZodObject = "ZodObject", n.ZodUnion = "ZodUnion", n.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", n.ZodIntersection = "ZodIntersection", n.ZodTuple = "ZodTuple", n.ZodRecord = "ZodRecord", n.ZodMap = "ZodMap", n.ZodSet = "ZodSet", n.ZodFunction = "ZodFunction", n.ZodLazy = "ZodLazy", n.ZodLiteral = "ZodLiteral", n.ZodEnum = "ZodEnum", n.ZodEffects = "ZodEffects", n.ZodNativeEnum = "ZodNativeEnum", n.ZodOptional = "ZodOptional", n.ZodNullable = "ZodNullable", n.ZodDefault = "ZodDefault", n.ZodCatch = "ZodCatch", n.ZodPromise = "ZodPromise", n.ZodBranded = "ZodBranded", n.ZodPipeline = "ZodPipeline", n.ZodReadonly = "ZodReadonly";
3498
3498
  })(G || (G = {}));
3499
- const Se = Be.create, ht = Dt.create, Qt = gs.create, ts = ws.create, ge = _s.create;
3499
+ const Se = Be.create, ht = It.create, Qt = gs.create, ts = ws.create, ge = _s.create;
3500
3500
  ot.create;
3501
- const _t = We.create, je = de.create, ke = In.create;
3502
- Dn.create;
3501
+ const _t = We.create, je = de.create, ke = Dn.create;
3502
+ In.create;
3503
3503
  yt.create;
3504
3504
  const sn = An.create, be = vs.create, $n = At.create;
3505
3505
  Cn.create;
@@ -3526,10 +3526,10 @@ const wn = () => ge().refine((n) => n && (n.seconds !== void 0 && n.nanoseconds
3526
3526
  Collection_Path: _t(Se()),
3527
3527
  ...t
3528
3528
  });
3529
- }, Ia = (n, e) => {
3529
+ }, Da = (n, e) => {
3530
3530
  let t = sn(yi(n, e));
3531
3531
  return n.required || (t = t.optional()), t;
3532
- }, Da = (n) => {
3532
+ }, Ia = (n) => {
3533
3533
  let e = _t(ke([Se().length(20), Se().length(28)]));
3534
3534
  return ["OneToOne", "OneToMany"].includes(n.type) ? e = e.max(1) : (n.min && (e = e.min(n.min)), n.max && (e = e.max(n.max)), n.length && (e = e.length(n.length))), n.required ? e = e.nonempty() : e = e.optional(), e;
3535
3535
  }, Mn = (n, e, t) => {
@@ -3597,7 +3597,7 @@ const wn = () => ge().refine((n) => n && (n.seconds !== void 0 && n.nanoseconds
3597
3597
  n === "create" && (s.Saved_At = yr()), n === "update" && (s.Saved_At = wn(), s.Collection_Path = s.Collection_Path.optional(), s.id = s.id.optional(), s.Created_At = s.Created_At.optional(), s.Saved_At = s.Saved_At.optional(), s.Created_By = s.Created_By.optional());
3598
3598
  const r = ft(e, e.fields), i = Array.from(r).map((l) => l.name);
3599
3599
  e.fields.forEach((l) => {
3600
- K(l) ? (s[l.name] = Ia(l, t), s[`${l.name}_Array`] = Da(l), i.includes(l.name) && (s[`${l.name}_Single`] = yi(l, t), l.required || (s[`${l.name}_Single`] = s[`${l.name}_Single`].optional())), l.length && (s[l.name] = s[l.name].refine((c) => l.length && c && Object.keys(c).length === l.length, {
3600
+ K(l) ? (s[l.name] = Da(l, t), s[`${l.name}_Array`] = Ia(l), i.includes(l.name) && (s[`${l.name}_Single`] = yi(l, t), l.required || (s[`${l.name}_Single`] = s[`${l.name}_Single`].optional())), l.length && (s[l.name] = s[l.name].refine((c) => l.length && c && Object.keys(c).length === l.length, {
3601
3601
  message: `Value must contain ${l.length} item(s)`
3602
3602
  })), l.min && (s[l.name] = s[l.name].refine((c) => l.min && c && Object.keys(c).length >= l.min, {
3603
3603
  message: `Value must contain at least ${l.min} item(s)`
@@ -3707,14 +3707,14 @@ const M = "numeric", Le = "short", Te = "long", Fn = {
3707
3707
  day: M,
3708
3708
  hour: M,
3709
3709
  minute: M
3710
- }, Ii = {
3710
+ }, Di = {
3711
3711
  year: M,
3712
3712
  month: M,
3713
3713
  day: M,
3714
3714
  hour: M,
3715
3715
  minute: M,
3716
3716
  second: M
3717
- }, Di = {
3717
+ }, Ii = {
3718
3718
  year: M,
3719
3719
  month: Le,
3720
3720
  day: M,
@@ -4097,17 +4097,17 @@ let Bt = null;
4097
4097
  function qa() {
4098
4098
  return Bt || (Bt = new Intl.DateTimeFormat().resolvedOptions().locale, Bt);
4099
4099
  }
4100
- const Is = /* @__PURE__ */ new Map();
4100
+ const Ds = /* @__PURE__ */ new Map();
4101
4101
  function Pi(n) {
4102
- let e = Is.get(n);
4103
- return e === void 0 && (e = new Intl.DateTimeFormat(n).resolvedOptions(), Is.set(n, e)), e;
4102
+ let e = Ds.get(n);
4103
+ return e === void 0 && (e = new Intl.DateTimeFormat(n).resolvedOptions(), Ds.set(n, e)), e;
4104
4104
  }
4105
- const Ds = /* @__PURE__ */ new Map();
4105
+ const Is = /* @__PURE__ */ new Map();
4106
4106
  function Ba(n) {
4107
- let e = Ds.get(n);
4107
+ let e = Is.get(n);
4108
4108
  if (!e) {
4109
4109
  const t = new Intl.Locale(n);
4110
- e = "getWeekInfo" in t ? t.getWeekInfo() : t.weekInfo, "minimalDays" in e || (e = { ...Li, ...e }), Ds.set(n, e);
4110
+ e = "getWeekInfo" in t ? t.getWeekInfo() : t.weekInfo, "minimalDays" in e || (e = { ...Li, ...e }), Is.set(n, e);
4111
4111
  }
4112
4112
  return e;
4113
4113
  }
@@ -4241,7 +4241,7 @@ class se {
4241
4241
  return new se(o, l, c, u, a);
4242
4242
  }
4243
4243
  static resetCache() {
4244
- Bt = null, Ts.clear(), Ns.clear(), xs.clear(), Is.clear(), Ds.clear();
4244
+ Bt = null, Ts.clear(), Ns.clear(), xs.clear(), Ds.clear(), Is.clear();
4245
4245
  }
4246
4246
  static fromObject({ locale: e, numberingSystem: t, outputCalendar: s, weekSettings: r } = {}) {
4247
4247
  return se.create(e, t, s, r);
@@ -4798,23 +4798,23 @@ function xr(n, e) {
4798
4798
  return { minDaysInFirstWeek: 4, startOfWeek: 1 };
4799
4799
  }
4800
4800
  function il(n, e = 4, t = 1) {
4801
- const s = Bn(n.weekYear), r = Ie(
4801
+ const s = Bn(n.weekYear), r = De(
4802
4802
  n.weekNumber,
4803
4803
  1,
4804
4804
  tn(n.weekYear, e, t)
4805
- ), i = Ie(n.weekday, 1, 7);
4805
+ ), i = De(n.weekday, 1, 7);
4806
4806
  return s ? r ? i ? !1 : xe("weekday", n.weekday) : xe("week", n.weekNumber) : xe("weekYear", n.weekYear);
4807
4807
  }
4808
4808
  function ol(n) {
4809
- const e = Bn(n.year), t = Ie(n.ordinal, 1, Nt(n.year));
4809
+ const e = Bn(n.year), t = De(n.ordinal, 1, Nt(n.year));
4810
4810
  return e ? t ? !1 : xe("ordinal", n.ordinal) : xe("year", n.year);
4811
4811
  }
4812
4812
  function Zi(n) {
4813
- const e = Bn(n.year), t = Ie(n.month, 1, 12), s = Ie(n.day, 1, Ln(n.year, n.month));
4813
+ const e = Bn(n.year), t = De(n.month, 1, 12), s = De(n.day, 1, Ln(n.year, n.month));
4814
4814
  return e ? t ? s ? !1 : xe("day", n.day) : xe("month", n.month) : xe("year", n.year);
4815
4815
  }
4816
4816
  function zi(n) {
4817
- const { hour: e, minute: t, second: s, millisecond: r } = n, i = Ie(e, 0, 23) || e === 24 && t === 0 && s === 0 && r === 0, a = Ie(t, 0, 59), o = Ie(s, 0, 59), l = Ie(r, 0, 999);
4817
+ const { hour: e, minute: t, second: s, millisecond: r } = n, i = De(e, 0, 23) || e === 24 && t === 0 && s === 0 && r === 0, a = De(t, 0, 59), o = De(s, 0, 59), l = De(r, 0, 999);
4818
4818
  return i ? a ? o ? l ? !1 : xe("millisecond", r) : xe("second", s) : xe("minute", t) : xe("hour", e);
4819
4819
  }
4820
4820
  function H(n) {
@@ -4849,7 +4849,7 @@ function Bi() {
4849
4849
  function cl(n) {
4850
4850
  return Array.isArray(n) ? n : [n];
4851
4851
  }
4852
- function Ir(n, e, t) {
4852
+ function Dr(n, e, t) {
4853
4853
  if (n.length !== 0)
4854
4854
  return n.reduce((s, r) => {
4855
4855
  const i = [e(r), r];
@@ -4867,7 +4867,7 @@ function Cs(n) {
4867
4867
  return null;
4868
4868
  if (typeof n != "object")
4869
4869
  throw new we("Week settings must be an object");
4870
- if (!Ie(n.firstDay, 1, 7) || !Ie(n.minimalDays, 1, 7) || !Array.isArray(n.weekend) || n.weekend.some((e) => !Ie(e, 1, 7)))
4870
+ if (!De(n.firstDay, 1, 7) || !De(n.minimalDays, 1, 7) || !Array.isArray(n.weekend) || n.weekend.some((e) => !De(e, 1, 7)))
4871
4871
  throw new we("Invalid week settings");
4872
4872
  return {
4873
4873
  firstDay: n.firstDay,
@@ -4875,7 +4875,7 @@ function Cs(n) {
4875
4875
  weekend: Array.from(n.weekend)
4876
4876
  };
4877
4877
  }
4878
- function Ie(n, e, t) {
4878
+ function De(n, e, t) {
4879
4879
  return Bn(n) && n >= e && n <= t;
4880
4880
  }
4881
4881
  function dl(n, e) {
@@ -4939,11 +4939,11 @@ function Hn(n) {
4939
4939
  );
4940
4940
  return n.year < 100 && n.year >= 0 && (e = new Date(e), e.setUTCFullYear(n.year, n.month - 1, n.day)), +e;
4941
4941
  }
4942
- function Dr(n, e, t) {
4942
+ function Ir(n, e, t) {
4943
4943
  return -Zs(js(n, 1, e), t) + e - 1;
4944
4944
  }
4945
4945
  function tn(n, e = 4, t = 1) {
4946
- const s = Dr(n, e, t), r = Dr(n + 1, e, t);
4946
+ const s = Ir(n, e, t), r = Ir(n + 1, e, t);
4947
4947
  return (Nt(n) - s + r) / 7;
4948
4948
  }
4949
4949
  function $s(n) {
@@ -5136,10 +5136,10 @@ const kl = {
5136
5136
  TTT: Ri,
5137
5137
  TTTT: Ni,
5138
5138
  f: xi,
5139
- ff: Di,
5139
+ ff: Ii,
5140
5140
  fff: Ci,
5141
5141
  ffff: Mi,
5142
- F: Ii,
5142
+ F: Di,
5143
5143
  FF: Ai,
5144
5144
  FFF: $i,
5145
5145
  FFFF: Fi
@@ -5417,9 +5417,9 @@ function so(...n) {
5417
5417
  return [s, null, t + r];
5418
5418
  };
5419
5419
  }
5420
- const ro = /(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/, bl = `(?:${ro.source}?(?:\\[(${no.source})\\])?)?`, Bs = /(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/, io = RegExp(`${Bs.source}${bl}`), Hs = RegExp(`(?:[Tt]${io.source})?`), Sl = /([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/, Tl = /(\d{4})-?W(\d\d)(?:-?(\d))?/, Rl = /(\d{4})-?(\d{3})/, Nl = so("weekYear", "weekNumber", "weekDay"), xl = so("year", "ordinal"), Il = /(\d{4})-(\d\d)-(\d\d)/, oo = RegExp(
5420
+ const ro = /(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/, bl = `(?:${ro.source}?(?:\\[(${no.source})\\])?)?`, Bs = /(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/, io = RegExp(`${Bs.source}${bl}`), Hs = RegExp(`(?:[Tt]${io.source})?`), Sl = /([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/, Tl = /(\d{4})-?W(\d\d)(?:-?(\d))?/, Rl = /(\d{4})-?(\d{3})/, Nl = so("weekYear", "weekNumber", "weekDay"), xl = so("year", "ordinal"), Dl = /(\d{4})-(\d\d)-(\d\d)/, oo = RegExp(
5421
5421
  `${Bs.source} ?(?:${ro.source}|(${no.source}))?`
5422
- ), Dl = RegExp(`(?: ${oo.source})?`);
5422
+ ), Il = RegExp(`(?: ${oo.source})?`);
5423
5423
  function xt(n, e, t) {
5424
5424
  const s = n[e];
5425
5425
  return H(s) ? t : et(s);
@@ -5562,7 +5562,7 @@ const tc = Lt(Ut);
5562
5562
  function nc(n) {
5563
5563
  return Vt(n, [Cl, tc]);
5564
5564
  }
5565
- const sc = Pt(Il, Dl), rc = Pt(oo), ic = Lt(
5565
+ const sc = Pt(Dl, Il), rc = Pt(oo), ic = Lt(
5566
5566
  Ut,
5567
5567
  an,
5568
5568
  ln
@@ -7492,7 +7492,7 @@ function Zr(n) {
7492
7492
  return vn(n);
7493
7493
  }
7494
7494
  }
7495
- function Ic(n) {
7495
+ function Dc(n) {
7496
7496
  if (Gt === void 0 && (Gt = le.now()), n.type !== "iana")
7497
7497
  return n.offset(Gt);
7498
7498
  const e = n.name;
@@ -7513,7 +7513,7 @@ function zr(n, e) {
7513
7513
  const a = Zi(n) || zi(n);
7514
7514
  if (a)
7515
7515
  return V.invalid(a);
7516
- const o = Ic(t);
7516
+ const o = Dc(t);
7517
7517
  [r, i] = _n(n, o, t);
7518
7518
  }
7519
7519
  return new V({ ts: r, zone: t, loc: s, o: i });
@@ -7734,16 +7734,16 @@ class V {
7734
7734
  const x = v ? il(i, a, o) : u ? ol(i) : Zi(i), _ = x || zi(i);
7735
7735
  if (_)
7736
7736
  return V.invalid(_);
7737
- const N = v ? Rr(i, a, o) : u ? Nr(i) : i, [C, L] = _n(N, c, s), I = new V({
7737
+ const N = v ? Rr(i, a, o) : u ? Nr(i) : i, [C, L] = _n(N, c, s), D = new V({
7738
7738
  ts: C,
7739
7739
  zone: s,
7740
7740
  o: L,
7741
7741
  loc: r
7742
7742
  });
7743
- return i.weekday && f && e.weekday !== I.weekday ? V.invalid(
7743
+ return i.weekday && f && e.weekday !== D.weekday ? V.invalid(
7744
7744
  "mismatched weekday",
7745
- `you can't specify both a weekday of ${i.weekday} and a date of ${I.toISO()}`
7746
- ) : I.isValid ? I : V.invalid(I.invalid);
7745
+ `you can't specify both a weekday of ${i.weekday} and a date of ${D.toISO()}`
7746
+ ) : D.isValid ? D : V.invalid(D.invalid);
7747
7747
  }
7748
7748
  /**
7749
7749
  * Create a DateTime from an ISO 8601 string
@@ -8867,7 +8867,7 @@ class V {
8867
8867
  static min(...e) {
8868
8868
  if (!e.every(V.isDateTime))
8869
8869
  throw new we("min requires all arguments be DateTimes");
8870
- return Ir(e, (t) => t.valueOf(), Math.min);
8870
+ return Dr(e, (t) => t.valueOf(), Math.min);
8871
8871
  }
8872
8872
  /**
8873
8873
  * Return the max of several date times
@@ -8877,7 +8877,7 @@ class V {
8877
8877
  static max(...e) {
8878
8878
  if (!e.every(V.isDateTime))
8879
8879
  throw new we("max requires all arguments be DateTimes");
8880
- return Ir(e, (t) => t.valueOf(), Math.max);
8880
+ return Dr(e, (t) => t.valueOf(), Math.max);
8881
8881
  }
8882
8882
  // MISC
8883
8883
  /**
@@ -9059,14 +9059,14 @@ class V {
9059
9059
  * @type {Object}
9060
9060
  */
9061
9061
  static get DATETIME_SHORT_WITH_SECONDS() {
9062
- return Ii;
9062
+ return Di;
9063
9063
  }
9064
9064
  /**
9065
9065
  * {@link DateTime#toLocaleString} format like 'Oct 14, 1983, 9:30 AM'. Only 12-hour if the locale is.
9066
9066
  * @type {Object}
9067
9067
  */
9068
9068
  static get DATETIME_MED() {
9069
- return Di;
9069
+ return Ii;
9070
9070
  }
9071
9071
  /**
9072
9072
  * {@link DateTime#toLocaleString} format like 'Oct 14, 1983, 9:30:33 AM'. Only 12-hour if the locale is.
@@ -9122,7 +9122,7 @@ function Zt(n) {
9122
9122
  `Unknown datetime argument: ${n}, of type ${typeof n}`
9123
9123
  );
9124
9124
  }
9125
- const Dc = (n, e) => {
9125
+ const Ic = (n, e) => {
9126
9126
  const t = {};
9127
9127
  if (n.includeFields) {
9128
9128
  const s = e.collections[n.collection];
@@ -9138,9 +9138,9 @@ const Dc = (n, e) => {
9138
9138
  ...t
9139
9139
  });
9140
9140
  }, Ac = (n, e, t, s) => {
9141
- let r = je({}).catchall(Dc(n, e)), i;
9141
+ let r = je({}).catchall(Ic(n, e)), i;
9142
9142
  if (!s && t) {
9143
- const a = De(n, t);
9143
+ const a = Ie(n, t);
9144
9144
  i = zt(a.admin?.skipFormRequiredValidation);
9145
9145
  }
9146
9146
  return (!n.required || i) && (r = r.optional()), r;
@@ -9153,7 +9153,7 @@ const Dc = (n, e) => {
9153
9153
  ` || "";
9154
9154
  let i, a, o;
9155
9155
  if (!t && e) {
9156
- const l = De(n, e);
9156
+ const l = Ie(n, e);
9157
9157
  i = l.admin?.condition?.form !== void 0 && !zt(l.admin.condition.form), a = zt(l.admin?.skipFormRequiredValidation), o = zt(l.admin?.image);
9158
9158
  }
9159
9159
  switch (n.type) {
@@ -9237,7 +9237,7 @@ const Dc = (n, e) => {
9237
9237
  if (n) {
9238
9238
  const t = await re(n, e);
9239
9239
  if (!t.valid)
9240
- throw new Error(`VALIDATION_ERROR: ${t.message}`);
9240
+ throw new Error(t.message);
9241
9241
  }
9242
9242
  }, nn = async (n, e, t, s, r, i) => {
9243
9243
  await Hr(s.custom?.preValidate, r);
@@ -9287,13 +9287,13 @@ const Dc = (n, e) => {
9287
9287
  });
9288
9288
  const S = l[k.labels.collection];
9289
9289
  for (const $ of S)
9290
- $.fields.some((D) => D.name === w.name) && K(w) && e.update(E(y, $.key, B), T);
9290
+ $.fields.some((I) => I.name === w.name) && K(w) && e.update(E(y, $.key, B), T);
9291
9291
  };
9292
9292
  if (n === "delete")
9293
9293
  return;
9294
- const I = _.filter((y) => K(y) && y.twoWay);
9294
+ const D = _.filter((y) => K(y) && y.twoWay);
9295
9295
  if (!o?.noTwoWay) {
9296
- for (const y of I) {
9296
+ for (const y of D) {
9297
9297
  if (!x)
9298
9298
  throw new Error("VALIDATION_ERROR: batchSize is required");
9299
9299
  const k = i.collections[y.collection], w = W(k.fields, y.twoWay), B = ft(k, k.fields), g = Array.from(B).map((T) => T.name);
@@ -9306,24 +9306,24 @@ const Dc = (n, e) => {
9306
9306
  continue;
9307
9307
  const $ = { ...O, ...r };
9308
9308
  nt($);
9309
- const D = {};
9309
+ const I = {};
9310
9310
  w.includeFields && w.includeFields.forEach((F) => {
9311
9311
  if ($[F] !== void 0) {
9312
- D[F] = $[F];
9312
+ I[F] = $[F];
9313
9313
  const z = W(a.fields, F);
9314
- wt(a, [z]).size === 1 && (D[`${F}_Lowercase`] = $[`${F}_Lowercase`]);
9314
+ wt(a, [z]).size === 1 && (I[`${F}_Lowercase`] = $[`${F}_Lowercase`]);
9315
9315
  }
9316
9316
  });
9317
9317
  const j = {
9318
9318
  [`${y.twoWay}.${s}`]: {
9319
9319
  Collection_Path: t,
9320
- ...D
9320
+ ...I
9321
9321
  },
9322
9322
  [`${y.twoWay}_Array`]: c(s)
9323
9323
  };
9324
9324
  g.includes(w.name) && (j[`${y.twoWay}_Single`] = {
9325
9325
  Collection_Path: t,
9326
- ...D
9326
+ ...I
9327
9327
  });
9328
9328
  const q = Sn(r);
9329
9329
  e.update(v(S.Collection_Path, T), {
@@ -9332,7 +9332,7 @@ const Dc = (n, e) => {
9332
9332
  }), x.size++, ct(w, k, i) && (e.update(p(y, w.name, T), {
9333
9333
  [`${w.name}.${s}`]: {
9334
9334
  Collection_Path: t,
9335
- ...D
9335
+ ...I
9336
9336
  },
9337
9337
  [`${w.name}_Array`]: c(s)
9338
9338
  }), x.size++), k.fields.forEach((F) => {
@@ -9356,7 +9356,7 @@ const Dc = (n, e) => {
9356
9356
  throw new Error(`SCHEMA_ERROR: Invalid field type: ${w.type}`);
9357
9357
  }
9358
9358
  x && x.size > 500 && console.error(new Error(`VALIDATION_ERROR: ${x.size} operations in the Firestore transaction has exceeded the recommended limit of 500. This is likely due to a large number of two way updates, roles, dependencies on the collection, unique field checks, entity restrictions (in permissions when dealing with user collections) or relation hierarchy checks.`));
9359
- for (const y of I) {
9359
+ for (const y of D) {
9360
9360
  if (!x)
9361
9361
  throw new Error("VALIDATION_ERROR: batchSize is required");
9362
9362
  const k = i.collections[y.collection], w = W(k.fields, y.twoWay);
@@ -9369,7 +9369,7 @@ const Dc = (n, e) => {
9369
9369
  } else
9370
9370
  throw new Error(`SCHEMA_ERROR: Invalid field type: ${w.type}`);
9371
9371
  }
9372
- for (const y of I) {
9372
+ for (const y of D) {
9373
9373
  if (!x)
9374
9374
  throw new Error("VALIDATION_ERROR: batchSize is required");
9375
9375
  const k = i.collections[y.collection], w = W(k.fields, y.twoWay);
@@ -9544,7 +9544,7 @@ const Rt = {
9544
9544
  for (const i of Object.values(r.collections))
9545
9545
  for (const a of i.fields)
9546
9546
  if (a.type === "Computed") {
9547
- const o = De(a, Qe(i.labels.collection, r));
9547
+ const o = Ie(a, Qe(i.labels.collection, r));
9548
9548
  o.formula && (a.formula = o.formula);
9549
9549
  }
9550
9550
  } else
@@ -9576,15 +9576,15 @@ const Rt = {
9576
9576
  throw new Error("PERMISSION_DENIED");
9577
9577
  if (h) {
9578
9578
  let $ = i.collection("tenants").doc(n).collection("system_fields").doc(l.collection).collection(`${l.collection}-${S.key}`).where("Collection_Path_String", "==", e.join("/"));
9579
- g.forEach((D) => {
9580
- $ = $.where(...D);
9579
+ g.forEach((I) => {
9580
+ $ = $.where(...I);
9581
9581
  }), T.push($);
9582
9582
  } else if (v)
9583
9583
  for (const $ of v) {
9584
- let D = i.collection("tenants").doc(n).collection("system_fields").doc(l.collection).collection(`${l.collection}-${$.field}`).where("Collection_Path_String", "==", e.join("/"));
9584
+ let I = i.collection("tenants").doc(n).collection("system_fields").doc(l.collection).collection(`${l.collection}-${$.field}`).where("Collection_Path_String", "==", e.join("/"));
9585
9585
  g.forEach((j) => {
9586
- D = D.where(...j);
9587
- }), T.push(D);
9586
+ I = I.where(...j);
9587
+ }), T.push(I);
9588
9588
  }
9589
9589
  return T;
9590
9590
  }, x = p.filter((g) => "operations" in g && g.operations ? g.operations.includes("Read") : !0);
@@ -9606,11 +9606,11 @@ const Rt = {
9606
9606
  u?.roles.includes(r.Role) && u.range && N(u.range.fields.length);
9607
9607
  const C = m.admin?.statusField;
9608
9608
  C && !u?.roles.includes(r.Role) && N(Math.max(C.active?.length || 0, C.archived?.length || 0));
9609
- const L = _ === 0 ? 30 : Math.max(1, Math.floor(30 / _)), I = [];
9610
- x.filter((g) => g.type === "Record_Owner").forEach(() => I.push(["Created_By", "==", s])), x.filter((g) => g.type === "Record_User").forEach((g) => {
9609
+ const L = _ === 0 ? 30 : Math.max(1, Math.floor(30 / _)), D = [];
9610
+ x.filter((g) => g.type === "Record_Owner").forEach(() => D.push(["Created_By", "==", s])), x.filter((g) => g.type === "Record_User").forEach((g) => {
9611
9611
  if ("collectionField" in g) {
9612
9612
  const T = W(c, g.collectionField);
9613
- I.push([`${T.name}_Array`, "array-contains", r.Doc_ID]);
9613
+ D.push([`${T.name}_Array`, "array-contains", r.Doc_ID]);
9614
9614
  }
9615
9615
  }), x.filter((g) => g.type === "Record_Property").forEach((g) => {
9616
9616
  if ("propertyField" in g) {
@@ -9618,7 +9618,7 @@ const Rt = {
9618
9618
  if (!T)
9619
9619
  throw new Error("PERMISSION_DENIED");
9620
9620
  const S = W(c, g.propertyField);
9621
- S.type === "Array" ? I.push([`${S.name}_Array`, "array-contains-any", T.values]) : I.push([S.name, "in", T.values]);
9621
+ S.type === "Array" ? D.push([`${S.name}_Array`, "array-contains-any", T.values]) : D.push([S.name, "in", T.values]);
9622
9622
  }
9623
9623
  });
9624
9624
  const y = [];
@@ -9626,18 +9626,18 @@ const Rt = {
9626
9626
  const T = f?.individualEntities, S = [];
9627
9627
  if (T) {
9628
9628
  const $ = g.singleQuery ? g.singleQuery : L;
9629
- for (let D = 0; D < T.length; D += $) {
9630
- const j = T.slice(D, D + $);
9629
+ for (let I = 0; I < T.length; I += $) {
9630
+ const j = T.slice(I, I + $);
9631
9631
  S.push(j);
9632
9632
  }
9633
9633
  if (!g.singleQuery)
9634
- S.forEach((D) => {
9635
- y.push(...R(I.concat([["id", "in", D]])));
9634
+ S.forEach((I) => {
9635
+ y.push(...R(D.concat([["id", "in", I]])));
9636
9636
  });
9637
9637
  else {
9638
9638
  if (T.length > $)
9639
9639
  throw new Error(`INPUT_ERROR: Individual entity restriction with singleQuery set to true must not have more than ${g.singleQuery} entities`);
9640
- I.push(["id", "in", T]);
9640
+ D.push(["id", "in", T]);
9641
9641
  }
9642
9642
  }
9643
9643
  }), O.filter((g) => g.parentFilter.type === "Individual").forEach((g) => {
@@ -9645,10 +9645,10 @@ const Rt = {
9645
9645
  if ("collectionField" in T) {
9646
9646
  const $ = W(c, T.collectionField);
9647
9647
  if ("collection" in $) {
9648
- const D = r.collections?.[$.collection];
9649
- if (!D)
9648
+ const I = r.collections?.[$.collection];
9649
+ if (!I)
9650
9650
  throw new Error("PERMISSION_DENIED");
9651
- const j = D.individualEntities, q = [];
9651
+ const j = I.individualEntities, q = [];
9652
9652
  if (j) {
9653
9653
  const b = S.singleQuery ? S.singleQuery : L;
9654
9654
  for (let F = 0; F < j.length; F += b) {
@@ -9657,12 +9657,12 @@ const Rt = {
9657
9657
  }
9658
9658
  if (!S.singleQuery)
9659
9659
  q.forEach((F) => {
9660
- y.push(...R(I.concat([[`${$.name}_Array`, "array-contains-any", F]])));
9660
+ y.push(...R(D.concat([[`${$.name}_Array`, "array-contains-any", F]])));
9661
9661
  });
9662
9662
  else {
9663
9663
  if (j.length > b)
9664
9664
  throw new Error(`INPUT_ERROR: Individual entity parentFilter with singleQuery set to true must not have more than ${S.singleQuery} entities`);
9665
- I.push([`${$.name}_Array`, "array-contains-any", j]);
9665
+ D.push([`${$.name}_Array`, "array-contains-any", j]);
9666
9666
  }
9667
9667
  }
9668
9668
  }
@@ -9675,19 +9675,19 @@ const Rt = {
9675
9675
  if ("collection" in T) {
9676
9676
  const S = f?.parentEntities, $ = [];
9677
9677
  if (S) {
9678
- const D = g.singleQuery ? g.singleQuery : L;
9679
- for (let j = 0; j < S.length; j += D) {
9680
- const q = S.slice(j, j + D);
9678
+ const I = g.singleQuery ? g.singleQuery : L;
9679
+ for (let j = 0; j < S.length; j += I) {
9680
+ const q = S.slice(j, j + I);
9681
9681
  $.push(q);
9682
9682
  }
9683
9683
  if (!g.singleQuery)
9684
9684
  $.forEach((j) => {
9685
- k.push(...R(I.concat([[`${T.name}_Array`, "array-contains-any", j]])));
9685
+ k.push(...R(D.concat([[`${T.name}_Array`, "array-contains-any", j]])));
9686
9686
  });
9687
9687
  else {
9688
- if (S && S.length > D)
9688
+ if (S && S.length > I)
9689
9689
  throw new Error(`INPUT_ERROR: Parent entity restriction with singleQuery set to true must not have more than ${g.singleQuery} entities`);
9690
- I.push([`${T.name}_Array`, "array-contains-any", S]);
9690
+ D.push([`${T.name}_Array`, "array-contains-any", S]);
9691
9691
  }
9692
9692
  }
9693
9693
  }
@@ -9695,8 +9695,8 @@ const Rt = {
9695
9695
  }), O.filter((g) => g.parentFilter.type === "Parent").forEach((g) => {
9696
9696
  const { parentFilter: T, parentRestriction: S } = g;
9697
9697
  if ("collectionField" in T && "parentCollectionField" in T) {
9698
- const $ = W(c, T.collectionField), D = W(c, T.parentCollectionField);
9699
- if ("collection" in $ && "collection" in D) {
9698
+ const $ = W(c, T.collectionField), I = W(c, T.parentCollectionField);
9699
+ if ("collection" in $ && "collection" in I) {
9700
9700
  const j = r.collections?.[$.collection];
9701
9701
  if (!j)
9702
9702
  throw new Error("PERMISSION_DENIED");
@@ -9709,15 +9709,15 @@ const Rt = {
9709
9709
  }
9710
9710
  if (!S.singleQuery)
9711
9711
  b.forEach((z) => {
9712
- k.push(...R(I.concat([
9713
- [`${D.name}_Array`, "array-contains-any", z]
9712
+ k.push(...R(D.concat([
9713
+ [`${I.name}_Array`, "array-contains-any", z]
9714
9714
  ])));
9715
9715
  });
9716
9716
  else {
9717
9717
  if (q && q.length > F)
9718
9718
  throw new Error(`INPUT_ERROR: Profile_Parent entity parentFilter with singleQuery set to true must not have more than ${S.singleQuery} entities`);
9719
- I.push([
9720
- `${D.name}_Array`,
9719
+ D.push([
9720
+ `${I.name}_Array`,
9721
9721
  "array-contains-any",
9722
9722
  q
9723
9723
  ]);
@@ -9732,7 +9732,7 @@ const Rt = {
9732
9732
  const T = W(c, g.collectionField), S = W(c, g.propertyField);
9733
9733
  if ("collection" in T) {
9734
9734
  const $ = f?.parentPropertyEntities || {};
9735
- Object.entries($).forEach(([D, j]) => {
9735
+ Object.entries($).forEach(([I, j]) => {
9736
9736
  if (j.length > 0) {
9737
9737
  const q = [];
9738
9738
  for (let b = 0; b < j.length; b += L) {
@@ -9740,9 +9740,9 @@ const Rt = {
9740
9740
  q.push(F);
9741
9741
  }
9742
9742
  q.forEach((b) => {
9743
- w.push(...R(I.concat([
9743
+ w.push(...R(D.concat([
9744
9744
  [`${T.name}_Array`, "array-contains-any", b],
9745
- [S.name, "==", D]
9745
+ [S.name, "==", I]
9746
9746
  ])));
9747
9747
  });
9748
9748
  }
@@ -9752,7 +9752,7 @@ const Rt = {
9752
9752
  }), O.filter((g) => g.parentFilter.type === "Parent_Property").forEach((g) => {
9753
9753
  const { parentFilter: T } = g;
9754
9754
  if ("collectionField" in T && "parentCollectionField" in T && "parentPropertyField" in T) {
9755
- const S = W(c, T.collectionField), $ = W(c, T.parentCollectionField), D = W(c, T.parentPropertyField);
9755
+ const S = W(c, T.collectionField), $ = W(c, T.parentCollectionField), I = W(c, T.parentPropertyField);
9756
9756
  if ("collection" in S && "collection" in $) {
9757
9757
  const j = r.collections?.[S.collection];
9758
9758
  if (!j)
@@ -9766,13 +9766,13 @@ const Rt = {
9766
9766
  z.push(oe);
9767
9767
  }
9768
9768
  z.forEach((Q) => {
9769
- w.push(...R(I.concat([
9769
+ w.push(...R(D.concat([
9770
9770
  [
9771
9771
  `${$.name}_Array`,
9772
9772
  "array-contains-any",
9773
9773
  Q
9774
9774
  ],
9775
- [D.name, "==", b]
9775
+ [I.name, "==", b]
9776
9776
  ])));
9777
9777
  });
9778
9778
  }
@@ -9781,7 +9781,7 @@ const Rt = {
9781
9781
  }
9782
9782
  }));
9783
9783
  const B = [...y, ...k, ...w];
9784
- return !E.length && !O.length ? R(I) : B;
9784
+ return !E.length && !O.length ? R(D) : B;
9785
9785
  } else
9786
9786
  throw new Error("PERMISSION_DENIED");
9787
9787
  else return [d];
@@ -9934,14 +9934,14 @@ const Rt = {
9934
9934
  o.has(T.id) || o.set(T.id, {});
9935
9935
  const S = T.data(), $ = o.get(T.id);
9936
9936
  $.id ||= T.id;
9937
- const D = { ...$, ...S };
9938
- delete D.Collection_Path_String, o.set(T.id, D);
9937
+ const I = { ...$, ...S };
9938
+ delete I.Collection_Path_String, o.set(T.id, I);
9939
9939
  }
9940
9940
  a.first.set(w.indexOf(g), g.docs[0]), a.last.set(w.indexOf(g), g.docs.at(-1) || g.docs[0]);
9941
9941
  }
9942
9942
  if (t?.pagination) {
9943
9943
  let g = C[0];
9944
- e && (g = e.reduce((D, [j, q, b]) => D.where(j, q, b), g)), t.pagination.orderByField && t.pagination.orderByDirection && (g = g.orderBy(t.pagination.orderByField, t.pagination.orderByDirection));
9944
+ e && (g = e.reduce((I, [j, q, b]) => I.where(j, q, b), g)), t.pagination.orderByField && t.pagination.orderByDirection && (g = g.orderBy(t.pagination.orderByField, t.pagination.orderByDirection));
9945
9945
  const S = (await g.count().get()).data().count, $ = t.pagination.number;
9946
9946
  i = $ > 0 ? Math.ceil(S / $) : 0;
9947
9947
  }
@@ -9984,7 +9984,7 @@ const Rt = {
9984
9984
  const $ = [];
9985
9985
  for (const q of x.fields) {
9986
9986
  if (q.type === "Computed" && !t?.noComputedFields) {
9987
- const b = De(q, N);
9987
+ const b = Ie(q, N);
9988
9988
  if (!b.formula)
9989
9989
  continue;
9990
9990
  $.push(re(b.formula, [g, B]).then((F) => {
@@ -10000,12 +10000,12 @@ const Rt = {
10000
10000
  continue;
10001
10001
  }
10002
10002
  for (const F of x.fields) {
10003
- const z = !F.access || F.access.includes(q), Q = De(F, N), oe = Q?.custom?.serverAccess?.read !== void 0 ? await re(Q.custom.serverAccess.read, [q, g]) : !0;
10003
+ const z = !F.access || F.access.includes(q), Q = Ie(F, N), oe = Q?.custom?.serverAccess?.read !== void 0 ? await re(Q.custom.serverAccess.read, [q, g]) : !0;
10004
10004
  (!z || !oe) && (K(F) ? (delete o.get(g.id)[F.name], delete o.get(g.id)[`${F.name}_Array`], delete o.get(g.id)[`${F.name}_Single`]) : delete o.get(g.id)[F.name]);
10005
10005
  }
10006
10006
  }
10007
- const D = ["read", g, g.id, L];
10008
- await ie("postOperation", p, N, D), await ie("postRead", p, N, [L, C, g, !1]);
10007
+ const I = ["read", g, g.id, L];
10008
+ await ie("postOperation", p, N, I), await ie("postRead", p, N, [L, C, g, !1]);
10009
10009
  }
10010
10010
  t?.user && await Jo(Array.from(o.values()), x, h, t.user, v);
10011
10011
  };
@@ -10128,7 +10128,7 @@ const Rt = {
10128
10128
  const w = [], B = n ? [...n, e] : [R.collection, e];
10129
10129
  if (t?.subcollections && w.push(No(s, o, i, B, t.subcollections, d, void 0, t.user)), t?.relations && (t.relations.fields && (t.relations.fields = t.relations.fields.map((S) => {
10130
10130
  if (typeof S == "string") {
10131
- const $ = O.fields.find((D) => D.name === S);
10131
+ const $ = O.fields.find((I) => I.name === S);
10132
10132
  if ($)
10133
10133
  return $;
10134
10134
  throw new Error(`SCHEMA_ERROR: Field ${S} not found in collection ${v}`);
@@ -10137,7 +10137,7 @@ const Rt = {
10137
10137
  })), w.push(xo(s, o, i, B, d, t.relations, t.user, t.noComputedFields, t.noEmbeddingFields))), await Promise.all(w), !t?.noComputedFields) {
10138
10138
  for (const S of O.fields)
10139
10139
  if (S.type === "Computed") {
10140
- const $ = De(S, x);
10140
+ const $ = Ie(S, x);
10141
10141
  if (!$.formula)
10142
10142
  continue;
10143
10143
  i[S.name] = await $.formula(i);
@@ -10150,9 +10150,9 @@ const Rt = {
10150
10150
  const S = f.Role;
10151
10151
  if (!(x.custom?.serverAccess?.read !== void 0 ? await re(x.custom?.serverAccess?.read, [S, i]) : !0))
10152
10152
  throw new Error("PERMISSION_DENIED");
10153
- for (const D of O.fields) {
10154
- const j = !D.access || D.access.includes(S), q = De(D, x), b = q?.custom?.serverAccess?.read !== void 0 ? await re(q.custom.serverAccess.read, [S, i]) : !0;
10155
- (!j || !b) && (K(D) ? (delete i[D.name], delete i[`${D.name}_Array`], delete i[`${D.name}_Single`]) : delete i[D.name]);
10153
+ for (const I of O.fields) {
10154
+ const j = !I.access || I.access.includes(S), q = Ie(I, x), b = q?.custom?.serverAccess?.read !== void 0 ? await re(q.custom.serverAccess.read, [S, i]) : !0;
10155
+ (!j || !b) && (K(I) ? (delete i[I.name], delete i[`${I.name}_Array`], delete i[`${I.name}_Single`]) : delete i[I.name]);
10156
10156
  }
10157
10157
  }
10158
10158
  await ie("postOperation", h, x, ["read", i, e, C]), await ie("postRead", h, x, [C, N, i, !1]), t?.user && await Yo(i, O, d, t.user, f);
@@ -10160,13 +10160,13 @@ const Rt = {
10160
10160
  return t?.providedTransaction ? await a(t.providedTransaction) : await r.runTransaction(async (o) => {
10161
10161
  await a(o);
10162
10162
  }, { readOnly: !0 }), i;
10163
- }, Io = async (n, e, t, s, r, i, a, o) => {
10163
+ }, Do = async (n, e, t, s, r, i, a, o) => {
10164
10164
  const l = ce(), c = Qe(r.labels.collection, i), u = r.labels.collection, m = r.fields.filter((f) => "unique" in f && f.unique), d = [];
10165
10165
  if (await Promise.all(m.map(async (f) => {
10166
10166
  {
10167
10167
  if (s[f.name] === void 0 || Fe(s[f.name]))
10168
10168
  return;
10169
- De(f, c);
10169
+ Ie(f, c);
10170
10170
  const h = s[f.name].toString().toLowerCase().replace(/\s/g, "---").replaceAll("/", "|||");
10171
10171
  if (!Js(h))
10172
10172
  d.push(`${f.name} "${s[f.name]}" is invalid`);
@@ -10223,7 +10223,7 @@ ${i}`);
10223
10223
  })()
10224
10224
  ]), r.length > 0)
10225
10225
  throw new Error(r.join(", "));
10226
- }, Do = async (n, e, t, s, r, i, a, o, l) => {
10226
+ }, Io = async (n, e, t, s, r, i, a, o, l) => {
10227
10227
  const c = ce(), u = ko(), m = process.env.ADMIN_EMAIL;
10228
10228
  if (u === "development" || process.env.FIRESTORE_EMULATOR_HOST)
10229
10229
  if (m)
@@ -10300,7 +10300,7 @@ ${i}`);
10300
10300
  if (f) {
10301
10301
  const h = `https://${o.app.options.projectId}.firebaseapp.com/__/auth/action${f}`, v = await re(t.appName), p = t?.mail?.emailVerification && t.mail.emailVerification(h, v);
10302
10302
  try {
10303
- await Do(r.Email, p?.subject || "Please verify your email address", void 0, p?.html || `Please verify your email address by clicking the link:
10303
+ await Io(r.Email, p?.subject || "Please verify your email address", void 0, p?.html || `Please verify your email address by clicking the link:
10304
10304
  </br>
10305
10305
  </br>
10306
10306
  <a href="${h}">${h}</a>`);
@@ -10392,10 +10392,10 @@ ${i}`);
10392
10392
  for (const N of _) {
10393
10393
  const [C, L] = N;
10394
10394
  if (n === "Create" || !m?.[E.name]?.[C]) {
10395
- let I;
10395
+ let D;
10396
10396
  const y = p.get(E.collection)?.[C];
10397
10397
  if (y)
10398
- I = y;
10398
+ D = y;
10399
10399
  else {
10400
10400
  l.size++, l && l.size > 500 && console.error(new Error(`VALIDATION_ERROR: ${l.size} operations in the Firestore transaction has exceeded the limit of 500. This is likely due to a large number of two way updates, unique field checks, entity restrictions (in permissions when dealing with user collections) or relation hierarchy checks.`));
10401
10401
  const w = Ae(f, L.Collection_Path, e), B = await o.get(w.doc(C));
@@ -10407,18 +10407,18 @@ ${i}`);
10407
10407
  v.set(E.collection, {
10408
10408
  ...v.get(E.collection) || {},
10409
10409
  [C]: g
10410
- }), I = ye({ ...g, ...Sn(s) });
10410
+ }), D = ye({ ...g, ...Sn(s) });
10411
10411
  }
10412
10412
  const k = {
10413
- ...I[R.name],
10413
+ ...D[R.name],
10414
10414
  [t]: {
10415
10415
  Collection_Path: s.Collection_Path,
10416
10416
  ...Pc(i, s, R)
10417
10417
  }
10418
10418
  };
10419
- I[R.name] = k, I[`${R.name}_Array`] ||= [], I[`${R.name}_Array`].push(t), x.size === 1 && (I[`${R.name}_Single`] = k), p.set(E.collection, {
10419
+ D[R.name] = k, D[`${R.name}_Array`] ||= [], D[`${R.name}_Array`].push(t), x.size === 1 && (D[`${R.name}_Single`] = k), p.set(E.collection, {
10420
10420
  ...p.get(E.collection) || {},
10421
- [C]: I
10421
+ [C]: D
10422
10422
  });
10423
10423
  }
10424
10424
  }
@@ -10428,10 +10428,10 @@ ${i}`);
10428
10428
  for (const N of _) {
10429
10429
  const [C, L] = N;
10430
10430
  if (!s[E.name]?.[C]) {
10431
- let I;
10431
+ let D;
10432
10432
  const y = p.get(E.collection)?.[C];
10433
10433
  if (y)
10434
- I = y;
10434
+ D = y;
10435
10435
  else {
10436
10436
  l.size++, l && l.size > 500 && console.error(new Error(`VALIDATION_ERROR: ${l.size} operations in the Firestore transaction has exceeded the limit of 500. This is likely due to a large number of two way updates, unique field checks, entity restrictions (in permissions when dealing with user collections) or relation hierarchy checks.`));
10437
10437
  const k = Ae(f, L.Collection_Path, e), w = await o.get(k.doc(C));
@@ -10443,11 +10443,11 @@ ${i}`);
10443
10443
  v.set(E.collection, {
10444
10444
  ...v.get(E.collection) || {},
10445
10445
  [C]: B
10446
- }), I = ye({ ...B, ...Sn(s) });
10446
+ }), D = ye({ ...B, ...Sn(s) });
10447
10447
  }
10448
- I[R.name][t] && delete I[R.name][t], Array.isArray(I[`${R.name}_Array`]) && (I[`${R.name}_Array`] = I[`${R.name}_Array`].filter((k) => k !== t)), x.size === 1 && delete I[`${R.name}_Single`], p.set(E.collection, {
10448
+ D[R.name][t] && delete D[R.name][t], Array.isArray(D[`${R.name}_Array`]) && (D[`${R.name}_Array`] = D[`${R.name}_Array`].filter((k) => k !== t)), x.size === 1 && delete D[`${R.name}_Single`], p.set(E.collection, {
10449
10449
  ...p.get(E.collection) || {},
10450
- [C]: I
10450
+ [C]: D
10451
10451
  });
10452
10452
  }
10453
10453
  }
@@ -10458,21 +10458,21 @@ ${i}`);
10458
10458
  for (const [_, N] of Object.entries(O)) {
10459
10459
  const { addedFields: C, removedFields: L } = Lc(n, _, E, i, s, m);
10460
10460
  if (c && u) {
10461
- for (const I of C) {
10462
- const y = W(R.fields, I.twoWay);
10461
+ for (const D of C) {
10462
+ const y = W(R.fields, D.twoWay);
10463
10463
  if (!tr(R, y, u)) {
10464
- gn(I, r, _);
10464
+ gn(D, r, _);
10465
10465
  continue;
10466
10466
  }
10467
10467
  }
10468
- for (const I of L) {
10469
- const y = W(R.fields, I.twoWay), k = ft(R, [y]);
10468
+ for (const D of L) {
10469
+ const y = W(R.fields, D.twoWay), k = ft(R, [y]);
10470
10470
  if (!tr(R, y, u)) {
10471
10471
  ms(
10472
- I,
10472
+ D,
10473
10473
  r,
10474
10474
  // eslint-disable-next-line security/detect-object-injection
10475
- m?.[I.name]?.[_],
10475
+ m?.[D.name]?.[_],
10476
10476
  _,
10477
10477
  k.size === 1
10478
10478
  );
@@ -10488,30 +10488,30 @@ ${i}`);
10488
10488
  // eslint-disable-next-line security/detect-object-injection
10489
10489
  v.get(E)?.[_]
10490
10490
  )) {
10491
- for (const I of C)
10492
- gn(I, r, _);
10493
- for (const I of L) {
10494
- const y = W(R.fields, I.twoWay), k = ft(R, [y]);
10491
+ for (const D of C)
10492
+ gn(D, r, _);
10493
+ for (const D of L) {
10494
+ const y = W(R.fields, D.twoWay), k = ft(R, [y]);
10495
10495
  ms(
10496
- I,
10496
+ D,
10497
10497
  r,
10498
10498
  // eslint-disable-next-line security/detect-object-injection
10499
- m?.[I.name]?.[_],
10499
+ m?.[D.name]?.[_],
10500
10500
  _,
10501
10501
  k.size === 1
10502
10502
  );
10503
10503
  }
10504
10504
  }
10505
10505
  if (!it("Update", R, a, c, u, N)) {
10506
- for (const I of C)
10507
- gn(I, r, _);
10508
- for (const I of L) {
10509
- const y = W(R.fields, I.twoWay), k = ft(R, [y]);
10506
+ for (const D of C)
10507
+ gn(D, r, _);
10508
+ for (const D of L) {
10509
+ const y = W(R.fields, D.twoWay), k = ft(R, [y]);
10510
10510
  ms(
10511
- I,
10511
+ D,
10512
10512
  r,
10513
10513
  // eslint-disable-next-line security/detect-object-injection
10514
- m?.[I.name]?.[_],
10514
+ m?.[D.name]?.[_],
10515
10515
  _,
10516
10516
  k.size === 1
10517
10517
  );
@@ -10520,11 +10520,11 @@ ${i}`);
10520
10520
  }
10521
10521
  try {
10522
10522
  await nn("update", N, R, x, ["update", N, {}, void 0, N], a);
10523
- } catch (I) {
10524
- throw new Error(`VALIDATION_ERROR: Two way relation update would invalidate record ${_} in ${E}: ${I.message}`);
10523
+ } catch (D) {
10524
+ throw new Error(`VALIDATION_ERROR: Two way relation update would invalidate record ${_} in ${E}: ${D.message}`);
10525
10525
  }
10526
- for (const I of C) {
10527
- const y = W(R.fields, I.twoWay);
10526
+ for (const D of C) {
10527
+ const y = W(R.fields, D.twoWay);
10528
10528
  ["OneToOne", "OneToMany"].includes(y.type) && K(y) && y.enforceHierarchy && await Qr(e, R, y, N, o, l, !0);
10529
10529
  }
10530
10530
  }
@@ -10645,7 +10645,7 @@ ${i}`);
10645
10645
  const f = c.collections[u], { labels: h, fields: v, enableWriteLog: p, softDelete: E } = f, O = Qe(h.collection, c), R = await re(l.appName), x = ce(), _ = gt(), C = (s ? await _.getUser(s) : void 0)?.customClaims?.role;
10646
10646
  let L;
10647
10647
  s && await Ks(n, f);
10648
- const I = Ae(x, n, o), y = a || I.doc().id;
10648
+ const D = Ae(x, n, o), y = a || D.doc().id;
10649
10649
  i = i || {}, i.collection = h.collection, e.id = y, Co(e), Xs(e);
10650
10650
  const k = Vs("create", n, e, c, R, "Online", s || "System", lt.now(), me.serverTimestamp());
10651
10651
  r?.createdAt && (k.Created_At = r.createdAt), r?.createdBy && (k.Created_By = r.createdBy);
@@ -10654,36 +10654,36 @@ ${i}`);
10654
10654
  try {
10655
10655
  if (f.auth && t && !t.password)
10656
10656
  throw new Error("Password is required");
10657
- r?.providedTransaction || (await Io("create", o, y, k, f, c), await nn("create", k, f, O, ["create", k, i], c));
10658
- } catch (D) {
10659
- throw new Error(`VALIDATION_ERROR: ${D.message}`);
10657
+ r?.providedTransaction || (await Do("create", o, y, k, f, c), await nn("create", k, f, O, ["create", k, i], c));
10658
+ } catch (I) {
10659
+ throw new Error(`VALIDATION_ERROR: ${I.message}`);
10660
10660
  }
10661
10661
  Ue(k), e.id = y, E && (k[E.archivedField] = !1), Tn(f, k, c), Rn(f, k);
10662
10662
  try {
10663
10663
  Mo("create", k, w), Fo("create", f, k), await nn("create", k, f, O, ["create", k, i], c);
10664
- } catch (D) {
10665
- throw new Error(`VALIDATION_ERROR: ${D.message}`);
10664
+ } catch (I) {
10665
+ throw new Error(`VALIDATION_ERROR: ${I.message}`);
10666
10666
  }
10667
10667
  if (s) {
10668
- const D = C;
10669
- if (!D)
10668
+ const I = C;
10669
+ if (!I)
10670
10670
  throw new Error("USER_ERROR");
10671
- if (!(O.custom?.serverAccess?.create !== void 0 ? await re(O.custom.serverAccess.create, [D, k]) : !0))
10671
+ if (!(O.custom?.serverAccess?.create !== void 0 ? await re(O.custom.serverAccess.create, [I, k]) : !0))
10672
10672
  throw new Error("PERMISSION_DENIED");
10673
10673
  for (const q of f.fields) {
10674
10674
  if (!(q.name in k))
10675
10675
  continue;
10676
- const b = De(q, O);
10677
- if (b?.custom?.serverAccess?.create !== void 0 && !await re(b.custom.serverAccess.create, [D, k]))
10676
+ const b = Ie(q, O);
10677
+ if (b?.custom?.serverAccess?.create !== void 0 && !await re(b.custom.serverAccess.create, [I, k]))
10678
10678
  throw new Error("PERMISSION_DENIED");
10679
10679
  }
10680
10680
  }
10681
10681
  t && (t.permissions ||= {}, t.permissions.Role ||= k.Role, t.permissions.Enabled ||= k.Enabled);
10682
- const T = async (D, j) => {
10682
+ const T = async (I, j) => {
10683
10683
  const [q, b, F, z] = await Promise.all([
10684
- r?.providedTransaction ? Promise.resolve({}) : D.get(x.collection("system_deployment").doc("latest_deploy")),
10685
- r?.providedTransaction ? Promise.resolve({}) : D.get(x.collection("system_deployment").doc("maintenance_mode")),
10686
- s ? D.get(x.collection("tenants").doc(o).collection("system_user_permissions").doc(s)) : Promise.resolve({}),
10684
+ r?.providedTransaction ? Promise.resolve({}) : I.get(x.collection("system_deployment").doc("latest_deploy")),
10685
+ r?.providedTransaction ? Promise.resolve({}) : I.get(x.collection("system_deployment").doc("maintenance_mode")),
10686
+ s ? I.get(x.collection("tenants").doc(o).collection("system_user_permissions").doc(s)) : Promise.resolve({}),
10687
10687
  r?.providedSchema ? Promise.resolve(r.providedSchema) : Ye()
10688
10688
  ]);
10689
10689
  if (j && (j.size += 3), !r?.providedTransaction) {
@@ -10710,7 +10710,7 @@ ${i}`);
10710
10710
  if (!s || !ue.access || ue.access.includes(L.Role)) {
10711
10711
  if (!e[ue.name])
10712
10712
  return;
10713
- const he = De(ue, O);
10713
+ const he = Ie(ue, O);
10714
10714
  if (!(s && he?.custom?.serverAccess?.read !== void 0 ? await re(he.custom.serverAccess.read, [
10715
10715
  L?.Role,
10716
10716
  k
@@ -10720,7 +10720,7 @@ ${i}`);
10720
10720
  if (Js(pe)) {
10721
10721
  if (j && j.size++, j && j.size > 500)
10722
10722
  throw new Error("VALIDATION_ERROR: The number of operations in the Firestore transaction has exceeded the limit of 500. This is likely due to a large number of unique field checks.");
10723
- if ((await D.get(x.collection("tenants").doc(o).collection("system_unique").doc(h.collection).collection(`Unique-${h.collection}-${ue.name}`).doc(pe)))?.exists)
10723
+ if ((await I.get(x.collection("tenants").doc(o).collection("system_unique").doc(h.collection).collection(`Unique-${h.collection}-${ue.name}`).doc(pe)))?.exists)
10724
10724
  throw new Error(`VALIDATION_ERROR: ${ue.name} "${k[ue.name]}" already exists`);
10725
10725
  } else
10726
10726
  throw new Error(`VALIDATION_ERROR: ${ue.name} "${k[ue.name]}" is invalid`);
@@ -10728,13 +10728,13 @@ ${i}`);
10728
10728
  });
10729
10729
  await Promise.all(oe);
10730
10730
  }
10731
- nr(k, y, f, c, s, L, t?.permissions), t?.permissions && s && L && await Po(D, t.permissions, s, L, c), nr(k, y, f, c, s, L, t?.permissions);
10731
+ nr(k, y, f, c, s, L, t?.permissions), t?.permissions && s && L && await Po(I, t.permissions, s, L, c), nr(k, y, f, c, s, L, t?.permissions);
10732
10732
  };
10733
10733
  if (f.auth && t) {
10734
10734
  await x.runTransaction(async (j) => {
10735
10735
  await T(j);
10736
10736
  }, { maxAttempts: 10 });
10737
- const D = await Ao(
10737
+ const I = await Ao(
10738
10738
  o,
10739
10739
  y,
10740
10740
  l,
@@ -10744,14 +10744,14 @@ ${i}`);
10744
10744
  t.permissions,
10745
10745
  t.password
10746
10746
  );
10747
- k.User_ID = D;
10747
+ k.User_ID = I;
10748
10748
  }
10749
- const S = async (D) => {
10749
+ const S = async (I) => {
10750
10750
  try {
10751
10751
  const j = { size: 1 };
10752
- await T(D, j), r?.noTwoWay || await $o("Create", o, y, k, k, f, c, D, j, s, L);
10752
+ await T(I, j), r?.noTwoWay || await $o("Create", o, y, k, k, f, c, I, j, s, L);
10753
10753
  const q = Ls(c);
10754
- Ys("create", D, n, y, k, c, f, r, q, me.arrayUnion, me.arrayRemove, me.delete, (b) => x.collection("tenants").doc(o).collection("system_fields").doc(h.collection).collection(`${h.collection}-${b.name}`).doc(y), (b, F) => x.collection("tenants").doc(o).collection("system_unique").doc(h.collection).collection(`Unique-${h.collection}-${b.name}`).doc(F), (b) => x.collection("tenants").doc(o).collection("system_fields").doc(h.collection).collection(`${h.collection}-${b}`).doc(y), (b, F) => Ae(x, b, o).doc(F), (b, F, z) => x.collection("tenants").doc(o).collection("system_fields").doc(b.collection).collection(`${b.collection}-${F}`).doc(z), (b, F, z) => x.collection("tenants").doc(o).collection("system_fields").doc(b.collection).collection(`${b.collection}-${F.replaceAll(" ", "-")}`).doc(z), void 0, void 0, j), D.set(I.doc(y), k);
10754
+ Ys("create", I, n, y, k, c, f, r, q, me.arrayUnion, me.arrayRemove, me.delete, (b) => x.collection("tenants").doc(o).collection("system_fields").doc(h.collection).collection(`${h.collection}-${b.name}`).doc(y), (b, F) => x.collection("tenants").doc(o).collection("system_unique").doc(h.collection).collection(`Unique-${h.collection}-${b.name}`).doc(F), (b) => x.collection("tenants").doc(o).collection("system_fields").doc(h.collection).collection(`${h.collection}-${b}`).doc(y), (b, F) => Ae(x, b, o).doc(F), (b, F, z) => x.collection("tenants").doc(o).collection("system_fields").doc(b.collection).collection(`${b.collection}-${F}`).doc(z), (b, F, z) => x.collection("tenants").doc(o).collection("system_fields").doc(b.collection).collection(`${b.collection}-${F.replaceAll(" ", "-")}`).doc(z), void 0, void 0, j), I.set(D.doc(y), k);
10755
10755
  } catch (j) {
10756
10756
  if (r?.providedTransaction)
10757
10757
  throw j;
@@ -10764,11 +10764,11 @@ ${i}`);
10764
10764
  }
10765
10765
  }
10766
10766
  };
10767
- if (r?.providedTransaction ? await S(r.providedTransaction) : await x.runTransaction(async (D) => {
10768
- await S(D);
10767
+ if (r?.providedTransaction ? await S(r.providedTransaction) : await x.runTransaction(async (I) => {
10768
+ await S(I);
10769
10769
  }, { maxAttempts: 10 }), !r?.providedTransaction) {
10770
- const D = ["create", k, y, i], j = [...D];
10771
- await ie("postWrite", l, O, D), await ie("postOperation", l, O, j);
10770
+ const I = ["create", k, y, i], j = [...I];
10771
+ await ie("postWrite", l, O, I), await ie("postOperation", l, O, j);
10772
10772
  }
10773
10773
  return { id: y, ...k };
10774
10774
  }, Jt = async (n, e, t, s) => {
@@ -10861,7 +10861,7 @@ ${i}`);
10861
10861
  if (O) {
10862
10862
  const R = `https://${m.app.options.projectId}.firebaseapp.com/__/auth/action${O}`, x = await re(s.appName), _ = s?.mail?.emailVerification && s.mail.emailVerification(R, x);
10863
10863
  try {
10864
- await Do(i.Email, _?.subject || "Please verify your email address", void 0, _?.html || `Please verify your email address by clicking the link:
10864
+ await Io(i.Email, _?.subject || "Please verify your email address", void 0, _?.html || `Please verify your email address by clicking the link:
10865
10865
  </br>
10866
10866
  </br>
10867
10867
  <a href="${R}">${R}</a>`);
@@ -10940,7 +10940,7 @@ ${i}`);
10940
10940
  throw new Error("VALIDATION_ERROR: User operations are only permitted for auth collections");
10941
10941
  if (s?.operation === "delete" && s.permissions)
10942
10942
  throw new Error("VALIDATION_ERROR: Permissions are not allowed for delete operations");
10943
- const L = h.auth && s?.operation === "create", I = h.auth && s?.operation === "delete", y = h.auth && !L && !I && (s?.operation === "update" || t.Role || t.Enabled !== void 0 || t.Name || t.Email || t.Photo_URL), k = (b) => b.User_ID && (h.auth && !L && !I && s?.operation === "update" || t.Role && t.Role !== b.Role || t.Enabled !== void 0 && t.Enabled !== b.Enabled || t.Name && t.Name !== b.Name || t.Email && t.Email !== b.Email || t.Photo_URL && t.Photo_URL !== b.Photo_URL);
10943
+ const L = h.auth && s?.operation === "create", D = h.auth && s?.operation === "delete", y = h.auth && !L && !D && (s?.operation === "update" || t.Role || t.Enabled !== void 0 || t.Name || t.Email || t.Photo_URL), k = (b) => b.User_ID && (h.auth && !L && !D && s?.operation === "update" || t.Role && t.Role !== b.Role || t.Enabled !== void 0 && t.Enabled !== b.Enabled || t.Name && t.Name !== b.Name || t.Email && t.Email !== b.Email || t.Photo_URL && t.Photo_URL !== b.Photo_URL);
10944
10944
  delete t.id, Co(t), Xs(t);
10945
10945
  const w = Vs("update", n, t, u, R, "Online", r || "System", lt.now(), me.serverTimestamp()), B = ye(w);
10946
10946
  for (const b of p)
@@ -10962,7 +10962,7 @@ ${i}`);
10962
10962
  throw new Error("Password is required");
10963
10963
  if (!i?.providedTransaction) {
10964
10964
  const b = { ...o, ...w };
10965
- await Io("update", l, e, b, h, u), nt(b), await nn("update", b, h, O, ["update", w, a, void 0, ye(o)], u);
10965
+ await Do("update", l, e, b, h, u), nt(b), await nn("update", b, h, O, ["update", w, a, void 0, ye(o)], u);
10966
10966
  }
10967
10967
  } catch (b) {
10968
10968
  throw new Error(`VALIDATION_ERROR: ${b.message}`);
@@ -11011,7 +11011,7 @@ ${i}`);
11011
11011
  if (!N.Enabled)
11012
11012
  throw new Error("PERMISSION_DENIED");
11013
11013
  }
11014
- if (z && (z.size += So(l, n, e, u, N).length), L && o.User_ID || I && !o.User_ID)
11014
+ if (z && (z.size += So(l, n, e, u, N).length), L && o.User_ID || D && !o.User_ID)
11015
11015
  throw new Error("USER_ERROR");
11016
11016
  if (k(o)) {
11017
11017
  const pe = await b.get(_.collection("tenants").doc(l).collection("system_user_permissions").doc(o.User_ID));
@@ -11029,7 +11029,7 @@ ${i}`);
11029
11029
  if (!r || !Ee.access || Ee.access.includes(N.Role)) {
11030
11030
  if (w[Ee.name] === void 0 || Fe(w[Ee.name]))
11031
11031
  return;
11032
- const jt = De(Ee, O), un = { ...o, ...w };
11032
+ const jt = Ie(Ee, O), un = { ...o, ...w };
11033
11033
  if (!(r && jt?.custom?.serverAccess?.read !== void 0 ? await re(jt.custom.serverAccess.read, [
11034
11034
  N?.Role,
11035
11035
  un
@@ -11053,7 +11053,7 @@ ${i}`);
11053
11053
  if (!(O.custom?.serverAccess?.update !== void 0 ? await re(O.custom.serverAccess.update, [pe, vt, o]) : !0))
11054
11054
  throw new Error("PERMISSION_DENIED");
11055
11055
  for (const jt of h.fields) {
11056
- const un = De(jt, O);
11056
+ const un = Ie(jt, O);
11057
11057
  if (Object.prototype.hasOwnProperty.call(w, jt.name) && un?.custom?.serverAccess?.update !== void 0 && !await re(un.custom.serverAccess.update, [
11058
11058
  pe,
11059
11059
  vt,
@@ -11062,12 +11062,12 @@ ${i}`);
11062
11062
  throw new Error("PERMISSION_DENIED");
11063
11063
  }
11064
11064
  }
11065
- sr(w, o, e, h, u, r, N, s?.operation ? s.operation : y ? "update" : void 0, s?.permissions, S), s?.permissions && r && N && await Po(b, s.permissions, r, N, u, S, z), sr(w, o, e, h, u, r, N, s?.operation ? s.operation : y ? "update" : void 0, s?.permissions, S), F && (L || k(o) || I) && await jc(b, e, o.User_ID);
11065
+ sr(w, o, e, h, u, r, N, s?.operation ? s.operation : y ? "update" : void 0, s?.permissions, S), s?.permissions && r && N && await Po(b, s.permissions, r, N, u, S, z), sr(w, o, e, h, u, r, N, s?.operation ? s.operation : y ? "update" : void 0, s?.permissions, S), F && (L || k(o) || D) && await jc(b, e, o.User_ID);
11066
11066
  };
11067
- (L || y || I) && await _.runTransaction(async (b) => {
11067
+ (L || y || D) && await _.runTransaction(async (b) => {
11068
11068
  await $(b, !0);
11069
11069
  }, { maxAttempts: 10 });
11070
- const D = async (b, F) => {
11070
+ const I = async (b, F) => {
11071
11071
  if (!o)
11072
11072
  throw new Error("NOT_FOUND");
11073
11073
  try {
@@ -11094,16 +11094,16 @@ ${i}`);
11094
11094
  if (E && (await new Promise((ue) => {
11095
11095
  setTimeout(ue, 250);
11096
11096
  }), await Ft("update", oe?.resolved ? "success" : "failed", w, l, n, e, h, oe?.resolved ? void 0 : z, o)), !oe?.resolved)
11097
- throw L && await cn(o), k(o) && await Jt(o.User_ID, F, S, "USER_ERROR"), I && await _.collection("tenants").doc(l).collection(v.collection).doc(e).update({ User_ID: me.delete() }), z;
11097
+ throw L && await cn(o), k(o) && await Jt(o.User_ID, F, S, "USER_ERROR"), D && await _.collection("tenants").doc(l).collection(v.collection).doc(e).update({ User_ID: me.delete() }), z;
11098
11098
  }
11099
11099
  }
11100
- (L || k(o) || I) && await Gr(Kr, [e, o.User_ID]).catch(() => {
11100
+ (L || k(o) || D) && await Gr(Kr, [e, o.User_ID]).catch(() => {
11101
11101
  throw new Error("USER_ERROR");
11102
11102
  });
11103
11103
  };
11104
11104
  try {
11105
11105
  let b;
11106
- if (L || k(o) || I) {
11106
+ if (L || k(o) || D) {
11107
11107
  if (k(o)) {
11108
11108
  b = await x.getUser(o.User_ID);
11109
11109
  const Q = b.customClaims;
@@ -11113,13 +11113,13 @@ ${i}`);
11113
11113
  const F = { ...o, ...w };
11114
11114
  nt(F);
11115
11115
  const z = await Wc(s?.operation || "update", l, e, c, v.collection, F, o, b, s?.permissions, S, s?.password);
11116
- L && (w.User_ID = z), I && (w.User_ID = me.delete());
11116
+ L && (w.User_ID = z), D && (w.User_ID = me.delete());
11117
11117
  }
11118
- i?.providedTransaction ? await D(i.providedTransaction, b) : await _.runTransaction(async (F) => {
11119
- await D(F, b);
11118
+ i?.providedTransaction ? await I(i.providedTransaction, b) : await _.runTransaction(async (F) => {
11119
+ await I(F, b);
11120
11120
  }, { maxAttempts: 10 });
11121
11121
  } catch (b) {
11122
- throw (L || k(o) || I) && await Gr(Kr, [e, o.User_ID]).catch(() => {
11122
+ throw (L || k(o) || D) && await Gr(Kr, [e, o.User_ID]).catch(() => {
11123
11123
  throw new Error("USER_ERROR");
11124
11124
  }), b;
11125
11125
  }
@@ -11157,7 +11157,7 @@ ${i}`);
11157
11157
  const C = Sn(N);
11158
11158
  Ue(N), h && await Ft("delete", "started", N, i, n, e, m), await ie("preOperation", a, p, ["delete", N, e, r]), await ie("preWrite", a, p, ["delete", N, e, r]), Ue(N);
11159
11159
  const y = async (g) => {
11160
- const [T, S, $, D] = await Promise.all([
11160
+ const [T, S, $, I] = await Promise.all([
11161
11161
  g.get(O.collection("system_deployment").doc("maintenance_mode")),
11162
11162
  at([d.collection], e, { user: t, providedTransaction: g }),
11163
11163
  t ? g.get(O.collection("tenants").doc(i).collection("system_user_permissions").doc(t)) : Promise.resolve({}),
@@ -11169,7 +11169,7 @@ ${i}`);
11169
11169
  throw new Error("MAINTENANCE_MODE");
11170
11170
  if (!S)
11171
11171
  throw new Error("NOT_FOUND");
11172
- if (N = { ...S, ...C }, o = D, t) {
11172
+ if (N = { ...S, ...C }, o = I, t) {
11173
11173
  if (!$?.exists)
11174
11174
  throw new Error("PERMISSION_DENIED");
11175
11175
  if (R = $.data(), !R.Role)
@@ -11191,7 +11191,7 @@ ${i}`);
11191
11191
  await O.runTransaction(async (g) => {
11192
11192
  await y(g);
11193
11193
  const T = Ls(o);
11194
- Ys("delete", g, n, e, N, o, m, s, T, me.arrayUnion, me.arrayRemove, me.delete, (S) => O.collection("tenants").doc(i).collection("system_fields").doc(d.collection).collection(`${d.collection}-${S.name}`).doc(e), (S, $) => O.collection("tenants").doc(i).collection("system_unique").doc(d.collection).collection(`Unique-${d.collection}-${S.name}`).doc($), (S) => O.collection("tenants").doc(i).collection("system_fields").doc(d.collection).collection(`${d.collection}-${S}`).doc(e), (S, $) => Ae(O, S, i).doc($), (S, $, D) => O.collection("tenants").doc(i).collection("system_fields").doc(S.collection).collection(`${S.collection}-${$}`).doc(D), (S, $, D) => O.collection("tenants").doc(i).collection("system_fields").doc(S.collection).collection(`${S.collection}-${$.replaceAll(" ", "-")}`).doc(D)), g.delete(x.doc(e));
11194
+ Ys("delete", g, n, e, N, o, m, s, T, me.arrayUnion, me.arrayRemove, me.delete, (S) => O.collection("tenants").doc(i).collection("system_fields").doc(d.collection).collection(`${d.collection}-${S.name}`).doc(e), (S, $) => O.collection("tenants").doc(i).collection("system_unique").doc(d.collection).collection(`Unique-${d.collection}-${S.name}`).doc($), (S) => O.collection("tenants").doc(i).collection("system_fields").doc(d.collection).collection(`${d.collection}-${S}`).doc(e), (S, $) => Ae(O, S, i).doc($), (S, $, I) => O.collection("tenants").doc(i).collection("system_fields").doc(S.collection).collection(`${S.collection}-${$}`).doc(I), (S, $, I) => O.collection("tenants").doc(i).collection("system_fields").doc(S.collection).collection(`${S.collection}-${$.replaceAll(" ", "-")}`).doc(I)), g.delete(x.doc(e));
11195
11195
  }, { maxAttempts: 10 });
11196
11196
  } catch (g) {
11197
11197
  const S = await ie("postWriteError", a, p, ["delete", N, e, r, g]);
@@ -11270,7 +11270,7 @@ export {
11270
11270
  wu as keepTimezone,
11271
11271
  _u as removeTimezone,
11272
11272
  lu as runChildProcess,
11273
- Do as sendMail,
11273
+ Io as sendMail,
11274
11274
  mu as sendMessage,
11275
11275
  pu as serializeTimestamps,
11276
11276
  iu as setTenant,