entropic-bond 1.57.0 → 1.58.0

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.
@@ -1,4 +1,4 @@
1
- class I {
1
+ class L {
2
2
  constructor() {
3
3
  this.subscribers = /* @__PURE__ */ new Set();
4
4
  }
@@ -59,7 +59,7 @@ function J() {
59
59
  }
60
60
  return F(z);
61
61
  }
62
- const H = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), M = { randomUUID: H };
62
+ const H = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), k = { randomUUID: H };
63
63
  function Z(i, e, t) {
64
64
  i = i || {};
65
65
  const r = i.random ?? i.rng?.() ?? J();
@@ -68,14 +68,14 @@ function Z(i, e, t) {
68
68
  return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, Y(r);
69
69
  }
70
70
  function G(i, e, t) {
71
- return M.randomUUID && !i ? M.randomUUID() : Z(i);
71
+ return k.randomUUID && !i ? k.randomUUID() : Z(i);
72
72
  }
73
73
  var K = Object.defineProperty, X = (i, e, t, r) => {
74
74
  for (var s = void 0, n = i.length - 1, o; n >= 0; n--)
75
75
  (o = i[n]) && (s = o(e, t, s) || s);
76
76
  return s && K(e, t, s), s;
77
77
  }, l;
78
- const W = (l = class {
78
+ const x = (l = class {
79
79
  /**
80
80
  * Registers a class to be used by the persistence engine.
81
81
  * @param className the name of the class to be registered
@@ -399,21 +399,21 @@ const W = (l = class {
399
399
  }, l._factoryMap = {}, l);
400
400
  X([
401
401
  j
402
- ], W.prototype, "_id");
403
- let d = W;
402
+ ], x.prototype, "_id");
403
+ let d = x;
404
404
  function j(i, e) {
405
- return _()(i, e);
405
+ return y()(i, e);
406
406
  }
407
407
  function ce(i) {
408
408
  return function(e, t) {
409
- return _({
409
+ return y({
410
410
  storeInCollection: i,
411
411
  isReference: !0
412
412
  })(e, t);
413
413
  };
414
414
  }
415
415
  function ue(i, e) {
416
- return _({ isReference: !0 })(i, e);
416
+ return y({ isReference: !0 })(i, e);
417
417
  }
418
418
  function he(i, e, t, r) {
419
419
  return function(s, n) {
@@ -424,15 +424,15 @@ function he(i, e, t, r) {
424
424
  cachedProps: i,
425
425
  ownerCollection: r ?? s.className
426
426
  };
427
- return _(o)(s, n);
427
+ return y(o)(s, n);
428
428
  };
429
429
  }
430
430
  function le(i, e, t) {
431
- return _({ isReference: !0, isPureReference: !0, storeInCollection: t })(i, e);
431
+ return y({ isReference: !0, isPureReference: !0, storeInCollection: t })(i, e);
432
432
  }
433
433
  function de(i, e, t, r) {
434
434
  return function(s, n) {
435
- return _({
435
+ return y({
436
436
  isReference: !0,
437
437
  isPureReference: !0,
438
438
  storeInCollection: t,
@@ -442,7 +442,7 @@ function de(i, e, t, r) {
442
442
  })(s, n);
443
443
  };
444
444
  }
445
- function _(i) {
445
+ function y(i) {
446
446
  return function(e, t) {
447
447
  Object.getOwnPropertyDescriptor(e, "_persistentProperties") || (e._persistentProperties ? e._persistentProperties = [...e._persistentProperties] : e._persistentProperties = []);
448
448
  const r = e._persistentProperties.find((s) => s.name === t);
@@ -464,25 +464,25 @@ function fe(i) {
464
464
  };
465
465
  }
466
466
  function me(i, e) {
467
- return _({ searchableArray: !0 })(i, e);
467
+ return y({ searchableArray: !0 })(i, e);
468
468
  }
469
469
  function pe(i, e) {
470
- return _({ validator: (t) => t != null })(i, e);
470
+ return y({ validator: (t) => t != null })(i, e);
471
471
  }
472
472
  function ge(i = (e) => e != null) {
473
473
  return function(e, t) {
474
- return _({ validator: i })(e, t);
474
+ return y({ validator: i })(e, t);
475
475
  };
476
476
  }
477
477
  function _e(i) {
478
478
  let e;
479
479
  return typeof i == "function" ? e = new i().className : e = i, function(t, r) {
480
- return _({ typeName: e })(t, r);
480
+ return y({ typeName: e })(t, r);
481
481
  };
482
482
  }
483
483
  class ye extends d {
484
484
  constructor() {
485
- super(...arguments), this._onChange = new I();
485
+ super(...arguments), this._onChange = new L();
486
486
  }
487
487
  /**
488
488
  * Subscribes a listener callback function. Every time a property is changed,
@@ -565,10 +565,10 @@ class ye extends d {
565
565
  return this.notify({ [e]: this[e] }), t;
566
566
  }
567
567
  }
568
- const N = class N {
568
+ const A = class A {
569
569
  constructor(e, t, r) {
570
570
  if (r) {
571
- if (!(t instanceof d)) throw new Error(N.error.persistentNeedForSubCollection);
571
+ if (!(t instanceof d)) throw new Error(A.error.persistentNeedForSubCollection);
572
572
  this.collectionName = `${t.className}/${t.id}/${r}`;
573
573
  } else
574
574
  this.collectionName = t instanceof d ? t.className : t;
@@ -658,7 +658,7 @@ const N = class N {
658
658
  return this._stream.onDocumentChange(
659
659
  this.collectionName,
660
660
  e,
661
- (r) => t(w.toPersistentDocumentChange(r))
661
+ (r) => t(_.toPersistentDocumentChange(r))
662
662
  );
663
663
  }
664
664
  onCollectionChange(e, t) {
@@ -666,10 +666,16 @@ const N = class N {
666
666
  this.preprocessQueryObject(e.getQueryObject()),
667
667
  this.collectionName,
668
668
  (r) => t(r.map(
669
- (s) => w.toPersistentDocumentChange(s)
669
+ (s) => _.toPersistentDocumentChange(s)
670
670
  ))
671
671
  );
672
672
  }
673
+ onCollectionTemplateChange(e, t) {
674
+ return this._stream.onDocumentTemplateChange(
675
+ e,
676
+ (r) => t(_.toPersistentDocumentChange(r))
677
+ );
678
+ }
673
679
  // /**
674
680
  // * Get the previous bunch of documents matching the last query
675
681
  // * @param limit the max amount of documents to retrieve. If not set, uses the
@@ -698,7 +704,7 @@ const N = class N {
698
704
  if (Object.values(e).length === 0) return e;
699
705
  const t = e.operations?.map((r) => {
700
706
  const s = r.value[0] ?? r.value;
701
- return w.isArrayOperator(r.operator) && s instanceof d ? {
707
+ return _.isArrayOperator(r.operator) && s instanceof d ? {
702
708
  property: d.searchableArrayNameFor(r.property),
703
709
  operator: r.operator,
704
710
  value: Array.isArray(r.value) ? r.value.map((n) => n.id) : s.id,
@@ -716,11 +722,11 @@ const N = class N {
716
722
  };
717
723
  }
718
724
  };
719
- N.error = {
725
+ A.error = {
720
726
  persistentNeedForSubCollection: "The document parameter for a sub-collection should be a Persistent instace",
721
727
  invalidQueryOrder: "Cannot add where calls after or calls"
722
728
  };
723
- let R = N;
729
+ let R = A;
724
730
  class te {
725
731
  constructor(e) {
726
732
  this.queryObject = { operations: [] }, this.model = e;
@@ -781,8 +787,8 @@ class te {
781
787
  if (this.queryObject.operations?.at(-1)?.aggregate && !s) throw new Error(R.error.invalidQueryOrder);
782
788
  const n = e.split(".");
783
789
  let o = {}, a = n.length > 1 ? o : r;
784
- return n.slice(1).forEach((u, h) => {
785
- o[u] = h < n.length - 2 ? {} : r, o = o[u];
790
+ return n.slice(1).forEach((c, h) => {
791
+ o[c] = h < n.length - 2 ? {} : r, o = o[c];
786
792
  }), this.queryObject.operations?.push({
787
793
  property: n[0],
788
794
  operator: t,
@@ -945,7 +951,7 @@ class te {
945
951
  return this.model;
946
952
  }
947
953
  }
948
- const P = class P {
954
+ const C = class C {
949
955
  constructor() {
950
956
  }
951
957
  /**
@@ -961,7 +967,7 @@ const P = class P {
961
967
  * @returns the data source
962
968
  */
963
969
  static get dataSource() {
964
- return P._dataSource;
970
+ return C._dataSource;
965
971
  }
966
972
  /**
967
973
  * Retrieves a model for a collection
@@ -969,8 +975,8 @@ const P = class P {
969
975
  * @returns the model for the collection
970
976
  */
971
977
  static getModel(e) {
972
- if (!P._dataSource) throw new Error(this.error.shouldBeRegistered);
973
- return new R(P._dataSource, e);
978
+ if (!C._dataSource) throw new Error(this.error.shouldBeRegistered);
979
+ return new R(C._dataSource, e);
974
980
  }
975
981
  /**
976
982
  * Retrieves a model for a subcollection
@@ -979,8 +985,8 @@ const P = class P {
979
985
  * @returns the model for the subcollection
980
986
  */
981
987
  static getModelForSubCollection(e, t) {
982
- if (!P._dataSource) throw new Error(this.error.shouldBeRegistered);
983
- return new R(P._dataSource, e, t);
988
+ if (!C._dataSource) throw new Error(this.error.shouldBeRegistered);
989
+ return new R(C._dataSource, e, t);
984
990
  }
985
991
  /**
986
992
  * Populates property references with actual data from the store.
@@ -1012,9 +1018,9 @@ const P = class P {
1012
1018
  ) : e.__documentReference === void 0;
1013
1019
  }
1014
1020
  };
1015
- P.error = { shouldBeRegistered: "You should register a data source before using the data Store." };
1016
- let k = P;
1017
- class L {
1021
+ C.error = { shouldBeRegistered: "You should register a data source before using the data Store." };
1022
+ let W = C;
1023
+ class M {
1018
1024
  constructor(e) {
1019
1025
  this._resolveCollectionPaths = () => {
1020
1026
  throw new Error("The method collectionsMatchingTemplate has not been implemented in the concrete data source");
@@ -1026,7 +1032,7 @@ class L {
1026
1032
  r.forEach((s) => {
1027
1033
  if (!s.typeName) return;
1028
1034
  (Array.isArray(s.typeName) ? s.typeName : [s?.typeName ?? t]).map((o) => d.collectionPath(d.createInstance(o), s)).forEach((o) => {
1029
- this._collectionsToWatch[o] || (this._collectionsToWatch[o] = []), this._collectionsToWatch[o].find((u) => u.name === s.name && u.ownerClassName() === s.ownerClassName()) || this._collectionsToWatch[o].push(s);
1035
+ this._collectionsToWatch[o] || (this._collectionsToWatch[o] = []), this._collectionsToWatch[o].find((c) => c.name === s.name && c.ownerClassName() === s.ownerClassName()) || this._collectionsToWatch[o].push(s);
1030
1036
  });
1031
1037
  });
1032
1038
  });
@@ -1074,24 +1080,23 @@ class L {
1074
1080
  }
1075
1081
  updateProps(e, t) {
1076
1082
  const r = this._collectionsToWatch[e];
1077
- if (r)
1078
- return this.onDocumentChange(t, r);
1083
+ return r ? this.onDocumentChange(t, r) : Promise.resolve();
1079
1084
  }
1080
1085
  async onDocumentChange(e, t) {
1081
- const r = w.toPersistentDocumentChange(e);
1086
+ const r = _.toPersistentDocumentChange(e);
1082
1087
  this._beforeDocumentChange?.(r, t);
1083
1088
  const s = {};
1084
- r.before && (r.after?.id && this._disabledChangeListeners.has(r.after?.id) || (await Promise.all(t.map(async (n) => {
1085
- const o = L.ownerCollectionPath(d.createInstance(n.ownerClassName()), n, r.params), a = await this._resolveCollectionPaths(o);
1086
- await Promise.all(a.map(async (u) => {
1087
- const h = k.getModel(u);
1088
- let c = h.find(), b = !1;
1089
+ e.type !== "update" || !r.before || r.after?.id && this._disabledChangeListeners.has(r.after?.id) || (await Promise.all(t.map(async (n) => {
1090
+ const o = M.ownerCollectionPath(d.createInstance(n.ownerClassName()), n, r.params), a = await this._resolveCollectionPaths(o);
1091
+ await Promise.all(a.map(async (c) => {
1092
+ const h = W.getModel(c);
1093
+ let u = h.find(), b = !1;
1089
1094
  n.cachedProps?.forEach((f) => {
1090
1095
  const S = r.before[f], O = r.after[f];
1091
1096
  S !== O && (b = !0);
1092
- }), b && (n.searchableArray ? c = c.where(n.name, "contains", r.before) : c = c.where(n.name, "==", r.before)), c = this._beforeQueryOwnerCollection?.(c) ?? c;
1093
- const E = await c.get();
1094
- return s[u] = {
1097
+ }), b && (n.searchableArray ? u = u.where(n.name, "contains", r.before) : u = u.where(n.name, "==", r.before)), u = this._beforeQueryOwnerCollection?.(u) ?? u;
1098
+ const E = await u.get();
1099
+ return s[c] = {
1095
1100
  totalDocumentsToUpdate: E.length,
1096
1101
  updatedDocuments: [],
1097
1102
  documentsToUpdate: E.map((f) => f.name ?? f.id)
@@ -1099,20 +1104,20 @@ class L {
1099
1104
  E.map(async (f) => {
1100
1105
  let S = !1;
1101
1106
  if (n.cachedProps?.forEach((O) => {
1102
- const A = r.before[O], q = r.after[O];
1103
- A !== q && (S = !0);
1107
+ const N = r.before[O], q = r.after[O];
1108
+ N !== q && (S = !0);
1104
1109
  }), S) {
1105
1110
  if (n.searchableArray) {
1106
- const O = f[n.name].findIndex((A) => A.id === r.before.id);
1111
+ const O = f[n.name].findIndex((N) => N.id === r.before.id);
1107
1112
  f[n.name][O] = r.after;
1108
1113
  } else
1109
1114
  f[`_${n.name}`] = r.after;
1110
- this._beforeUpdate?.(f, n), this.disableChangeListener(f), await h.save(f), this.enableChangeListener(f), s[u]?.updatedDocuments.push(f.id), this._afterUpdate?.(f, n);
1115
+ this._beforeUpdate?.(f, n), this.disableChangeListener(f), await h.save(f), this.enableChangeListener(f), s[c]?.updatedDocuments.push(f.id), this._afterUpdate?.(f, n);
1111
1116
  } else return Promise.resolve();
1112
1117
  })
1113
1118
  ]);
1114
1119
  }));
1115
- })), this._afterDocumentChange?.(s, t)));
1120
+ })), this._afterDocumentChange?.(s, t));
1116
1121
  }
1117
1122
  disableChangeListener(e) {
1118
1123
  this._disabledChangeListeners.add(e.id);
@@ -1125,12 +1130,12 @@ class L {
1125
1130
  return typeof t.ownerCollection == "function" ? s = t.ownerCollection(e, t, r) : s = t.ownerCollection ?? e.className, s;
1126
1131
  }
1127
1132
  }
1128
- class w {
1133
+ class _ {
1129
1134
  constructor() {
1130
1135
  this._cachedPropsUpdater = void 0;
1131
1136
  }
1132
1137
  installCachedPropsUpdater(e) {
1133
- return this._cachedPropsUpdater = new L(e), this._cachedPropsUpdater.resolveCollectionPaths = this.resolveCollectionPaths.bind(this), this._cachedPropsUpdater;
1138
+ return this._cachedPropsUpdater = new M(e), this._cachedPropsUpdater.resolveCollectionPaths = this.resolveCollectionPaths.bind(this), this._cachedPropsUpdater;
1134
1139
  }
1135
1140
  get cachedPropsUpdater() {
1136
1141
  return this._cachedPropsUpdater;
@@ -1149,7 +1154,7 @@ class w {
1149
1154
  */
1150
1155
  static toPropertyPathOperations(e) {
1151
1156
  return e ? e.map((t) => {
1152
- if (w.isArrayOperator(t.operator) && t.value[0] instanceof d)
1157
+ if (_.isArrayOperator(t.operator) && t.value[0] instanceof d)
1153
1158
  return {
1154
1159
  property: d.searchableArrayNameFor(t.property),
1155
1160
  operator: t.operator,
@@ -1183,22 +1188,43 @@ class w {
1183
1188
  return [void 0, e];
1184
1189
  }
1185
1190
  static isStringMatchingTemplate(e, t) {
1186
- const s = e.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&").replace(/\\\$\\\{[^}]+\\\}/g, "([^/]+)").replace(/\\\{[^}]+\\\}/g, "([^/]+)");
1187
- return new RegExp("^" + s + "$").test(t);
1191
+ const r = e.split("/"), s = t.split("/");
1192
+ if (s.length > r.length) return !1;
1193
+ for (let n = 0; n < s.length; n++) {
1194
+ const o = r[n], a = s[n];
1195
+ if (!(o.startsWith("{") && o.endsWith("}") || o.startsWith("${") && o.endsWith("}")) && o !== a) return !1;
1196
+ }
1197
+ for (let n = s.length; n < r.length; n++) {
1198
+ const o = r[n];
1199
+ if (!(o.startsWith("{") && o.endsWith("}") || o.startsWith("${") && o.endsWith("}"))) return !1;
1200
+ }
1201
+ return !0;
1188
1202
  }
1189
1203
  static extractTemplateParams(e, t) {
1190
- const r = [], n = t.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&").replace(/\\\{([^}]+)\\\}/g, (h, c) => (r.push(c), "([^/]+)")), o = new RegExp("^" + n + "$"), a = e.match(o), u = {};
1191
- return a && r.forEach((h, c) => {
1192
- u[h] = a[c + 1];
1193
- }), u;
1204
+ const r = t.split("/"), s = e.split("/"), n = {};
1205
+ if (s.length > r.length) return n;
1206
+ for (let o = 0; o < s.length; o++) {
1207
+ const a = r[o], c = s[o];
1208
+ if (a.startsWith("{") && a.endsWith("}"))
1209
+ n[a.slice(1, -1)] = c;
1210
+ else if (a.startsWith("${") && a.endsWith("}"))
1211
+ n[a.slice(2, -1)] = c;
1212
+ else if (a !== c)
1213
+ return {};
1214
+ }
1215
+ for (let o = s.length; o < r.length; o++) {
1216
+ const a = r[o];
1217
+ if (!(a.startsWith("{") && a.endsWith("}") || a.startsWith("${") && a.endsWith("}"))) return {};
1218
+ }
1219
+ return n;
1194
1220
  }
1195
1221
  }
1196
- class be extends w {
1222
+ class Pe extends _ {
1197
1223
  /**
1198
1224
  * @param jsonRawData the JSON object to be used as data store
1199
1225
  */
1200
1226
  constructor(e) {
1201
- super(), this._jsonRawData = {}, this._lastMatchingDocs = [], this._lastLimit = 0, this._cursor = 0, this._simulateDelay = 0, this._pendingPromises = [], this._documentListeners = {}, this._collectionListeners = {}, this._serverCollectionListeners = {}, e && (this._jsonRawData = e);
1227
+ super(), this._jsonRawData = {}, this._lastMatchingDocs = [], this._lastLimit = 0, this._cursor = 0, this._simulateDelay = 0, this._pendingPromises = [], this._documentListeners = {}, this._collectionListeners = {}, e && (this._jsonRawData = e);
1202
1228
  }
1203
1229
  /**
1204
1230
  * Set the JSON object to initialize the data store. Use to set the it after
@@ -1254,10 +1280,10 @@ class be extends w {
1254
1280
  s || (this._collectionListeners[t] = {}, s = this._collectionListeners[t]);
1255
1281
  const n = (a) => {
1256
1282
  if (!a.after) return;
1257
- const u = [a.after];
1258
- a.before && u.push(a.before);
1259
- const c = this.retrieveQueryDocs(u, e.operations).filter((b, E, f) => E === f.findIndex((S) => S.id === b.id));
1260
- c.length > 0 && r(c.map((b) => ({
1283
+ const c = [a.after];
1284
+ a.before && c.push(a.before);
1285
+ const u = this.retrieveQueryDocs(c, e.operations).filter((b, E, f) => E === f.findIndex((S) => S.id === b.id));
1286
+ u.length > 0 && r(u.map((b) => ({
1261
1287
  before: a.before,
1262
1288
  after: b,
1263
1289
  type: a.type,
@@ -1274,6 +1300,17 @@ class be extends w {
1274
1300
  }, o = Math.random().toString(36).substring(2, 9);
1275
1301
  return s[o] = n, () => delete s[o];
1276
1302
  }
1303
+ onDocumentTemplateChange(e, t) {
1304
+ const r = this.collectionsMatchingTemplate(e), s = [];
1305
+ return r.forEach((n) => {
1306
+ let o = this._documentListeners[n];
1307
+ o || (this._documentListeners[n] = {}, o = this._documentListeners[n]);
1308
+ const a = (h) => {
1309
+ h.params = _.extractTemplateParams(n, e), t(h);
1310
+ }, c = Math.random().toString(36).substring(2, 9);
1311
+ o[c] = a, s.push(() => delete o[c]);
1312
+ }), () => s.forEach((n) => n());
1313
+ }
1277
1314
  /**
1278
1315
  * @returns the raw data store data as a JSON object
1279
1316
  */
@@ -1306,7 +1343,7 @@ class be extends w {
1306
1343
  params: {},
1307
1344
  type: r ? "update" : "create"
1308
1345
  };
1309
- Object.values(this._serverCollectionListeners[e] ?? {}).forEach((n) => n(s)), Object.values(this._documentListeners[e] ?? {}).forEach((n) => n(s)), Object.values(this._collectionListeners[e] ?? {}).forEach((n) => n(s));
1346
+ Object.values(this._documentListeners[e] ?? {}).forEach((n) => n(s)), Object.values(this._collectionListeners[e] ?? {}).forEach((n) => n(s));
1310
1347
  }
1311
1348
  decCursor(e) {
1312
1349
  return this._cursor -= e, this._cursor < 0 ? (this._cursor = 0, !0) : !1;
@@ -1316,7 +1353,7 @@ class be extends w {
1316
1353
  limit: (n) => e,
1317
1354
  //.slice( 0, limit ),
1318
1355
  operations: (n) => this.retrieveQueryDocs(e, n),
1319
- sort: ({ order: n, propertyName: o }) => e.sort((a, u) => n === "asc" ? this.deepValue(a, o) > this.deepValue(u, o) ? 1 : -1 : this.deepValue(a, o) < this.deepValue(u, o) ? 1 : -1)
1356
+ sort: ({ order: n, propertyName: o }) => e.sort((a, c) => n === "asc" ? this.deepValue(a, o) > this.deepValue(c, o) ? 1 : -1 : this.deepValue(a, o) < this.deepValue(c, o) ? 1 : -1)
1320
1357
  }[t](r);
1321
1358
  }
1322
1359
  retrieveQueryDocs(e, t) {
@@ -1333,16 +1370,16 @@ class be extends w {
1333
1370
  }
1334
1371
  isQueryMatched(e, t) {
1335
1372
  const r = {
1336
- "==": (h, c) => h === c,
1337
- "!=": (h, c) => h !== c,
1338
- "<": (h, c) => h < c,
1339
- "<=": (h, c) => h <= c,
1340
- ">": (h, c) => h > c,
1341
- ">=": (h, c) => h >= c,
1342
- containsAny: (h, c) => h?.some((b) => c?.includes(b)),
1343
- contains: (h, c) => h?.includes(c)
1344
- }, { property: s, value: n, operator: o } = t, [a, u] = this.retrieveValuesToCompare(e, s, n);
1345
- return r[o](a, u);
1373
+ "==": (h, u) => h === u,
1374
+ "!=": (h, u) => h !== u,
1375
+ "<": (h, u) => h < u,
1376
+ "<=": (h, u) => h <= u,
1377
+ ">": (h, u) => h > u,
1378
+ ">=": (h, u) => h >= u,
1379
+ containsAny: (h, u) => h?.some((b) => u?.includes(b)),
1380
+ contains: (h, u) => h?.includes(u)
1381
+ }, { property: s, value: n, operator: o } = t, [a, c] = this.retrieveValuesToCompare(e, s, n);
1382
+ return r[o](a, c);
1346
1383
  }
1347
1384
  retrieveValuesToCompare(e, t, r) {
1348
1385
  const s = e[t];
@@ -1368,7 +1405,7 @@ class be extends w {
1368
1405
  return Promise.resolve(this.collectionsMatchingTemplate(e));
1369
1406
  }
1370
1407
  collectionsMatchingTemplate(e) {
1371
- return Object.keys(this._jsonRawData).filter((t) => w.isStringMatchingTemplate(e, t));
1408
+ return Object.keys(this._jsonRawData).filter((t) => _.isStringMatchingTemplate(e, t));
1372
1409
  }
1373
1410
  }
1374
1411
  const v = class v {
@@ -1394,9 +1431,9 @@ const v = class v {
1394
1431
  }
1395
1432
  };
1396
1433
  v._cloudStorageFactoryMap = {};
1397
- let C = v;
1434
+ let w = v;
1398
1435
  function re(i, e) {
1399
- return C.registerCloudStorage(i, e), (t) => {
1436
+ return w.registerCloudStorage(i, e), (t) => {
1400
1437
  t.prototype.__className = i;
1401
1438
  };
1402
1439
  }
@@ -1405,7 +1442,7 @@ var se = Object.getOwnPropertyDescriptor, ie = (i, e, t, r) => {
1405
1442
  (o = i[n]) && (s = o(s) || s);
1406
1443
  return s;
1407
1444
  };
1408
- let T = class extends C {
1445
+ let T = class extends w {
1409
1446
  constructor(i = "") {
1410
1447
  super(), this._simulateDelay = 0, this._pendingPromises = [], this.mockFileSystem = {}, this._pathToMockFiles = i;
1411
1448
  }
@@ -1463,11 +1500,11 @@ var ne = Object.defineProperty, oe = Object.getOwnPropertyDescriptor, U = (i, e,
1463
1500
  }, ae = /* @__PURE__ */ ((i) => (i[i.stored = 0] = "stored", i[i.pendingDataSet = 1] = "pendingDataSet", i[i.deleted = 2] = "deleted", i))(ae || {});
1464
1501
  let D = class extends d {
1465
1502
  constructor() {
1466
- super(...arguments), this._onChange = new I();
1503
+ super(...arguments), this._onChange = new L();
1467
1504
  }
1468
1505
  async save({ data: i, fileName: e, progress: t, cloudStorageProvider: r } = {}) {
1469
1506
  const s = i || this._pendingData;
1470
- s && (this._reference && await this.delete(), this.provider = r || C.defaultCloudStorage, this._originalFileName = e || (s instanceof File ? s.name : void 0), this._reference = await this.provider.save(this.id, s, t), this._url = await this.provider.getUrl(this._reference), this._pendingData = void 0, this._onChange.notify({ event: 0, storedFile: this }));
1507
+ s && (this._reference && await this.delete(), this.provider = r || w.defaultCloudStorage, this._originalFileName = e || (s instanceof File ? s.name : void 0), this._reference = await this.provider.save(this.id, s, t), this._url = await this.provider.getUrl(this._reference), this._pendingData = void 0, this._onChange.notify({ event: 0, storedFile: this }));
1471
1508
  }
1472
1509
  uploadControl() {
1473
1510
  return this.provider.uploadControl();
@@ -1482,9 +1519,9 @@ let D = class extends d {
1482
1519
  get provider() {
1483
1520
  if (!this._provider)
1484
1521
  try {
1485
- this._provider = C.createInstance(this._cloudStorageProviderName);
1522
+ this._provider = w.createInstance(this._cloudStorageProviderName);
1486
1523
  } catch {
1487
- this._provider = C.defaultCloudStorage;
1524
+ this._provider = w.defaultCloudStorage;
1488
1525
  }
1489
1526
  return this._provider;
1490
1527
  }
@@ -1530,7 +1567,7 @@ class Q {
1530
1567
  }
1531
1568
  const p = class p extends Q {
1532
1569
  constructor() {
1533
- if (super(), this._onAuthStateChange = new I(), !p._authService) throw new Error(p.error.shouldBeRegistered);
1570
+ if (super(), this._onAuthStateChange = new L(), !p._authService) throw new Error(p.error.shouldBeRegistered);
1534
1571
  p._authService.onAuthStateChange(
1535
1572
  (e) => this.authStateChanged(e)
1536
1573
  );
@@ -1654,14 +1691,14 @@ const p = class p extends Q {
1654
1691
  }
1655
1692
  };
1656
1693
  p.error = { shouldBeRegistered: "You should register an auth service before using Auth." }, p._instance = void 0;
1657
- let x = p;
1658
- class Pe extends Q {
1694
+ let I = p;
1695
+ class be extends Q {
1659
1696
  constructor() {
1660
1697
  super(...arguments), this.pendingPromises = [], this._fakeRegisteredUsers = {};
1661
1698
  }
1662
1699
  signUp(e) {
1663
- const { verificationLink: t, email: r, password: s, authProvider: n } = e, o = new Promise(async (a, u) => {
1664
- n === "email" && (r || u({ code: "missingEmail", message: "missingEmail" }), s || u({ code: "missingPassword", message: "missingPassword" })), s !== "fail" && r !== "fail" ? (this._loggedUser = this.userCredentials(e), this._fakeRegisteredUsers[this._loggedUser.id] = this._loggedUser, a(this._loggedUser), this.notifyChange?.(this._loggedUser)) : (u({ code: "userNotFound", message: t || "Test auth error" }), this.notifyChange?.(void 0));
1700
+ const { verificationLink: t, email: r, password: s, authProvider: n } = e, o = new Promise(async (a, c) => {
1701
+ n === "email" && (r || c({ code: "missingEmail", message: "missingEmail" }), s || c({ code: "missingPassword", message: "missingPassword" })), s !== "fail" && r !== "fail" ? (this._loggedUser = this.userCredentials(e), this._fakeRegisteredUsers[this._loggedUser.id] = this._loggedUser, a(this._loggedUser), this.notifyChange?.(this._loggedUser)) : (c({ code: "userNotFound", message: t || "Test auth error" }), this.notifyChange?.(void 0));
1665
1702
  });
1666
1703
  return this.pendingPromises.push(o), o;
1667
1704
  }
@@ -1726,21 +1763,21 @@ class Pe extends Q {
1726
1763
  };
1727
1764
  }
1728
1765
  }
1729
- const y = class y {
1766
+ const P = class P {
1730
1767
  constructor() {
1731
1768
  }
1732
1769
  static useCloudFunctionsService(e) {
1733
1770
  this._cloudFunctionsService != e && (this._cloudFunctionsService = e);
1734
1771
  }
1735
1772
  static get instance() {
1736
- if (!this._cloudFunctionsService) throw new Error(y.error.shouldBeRegistered);
1737
- return y._instance || (y._instance = new y());
1773
+ if (!this._cloudFunctionsService) throw new Error(P.error.shouldBeRegistered);
1774
+ return P._instance || (P._instance = new P());
1738
1775
  }
1739
1776
  getRawFunction(e) {
1740
- return y._cloudFunctionsService.retrieveFunction(e);
1777
+ return P._cloudFunctionsService.retrieveFunction(e);
1741
1778
  }
1742
1779
  getFunction(e) {
1743
- const t = y._cloudFunctionsService.callFunction, r = this.getRawFunction(e);
1780
+ const t = P._cloudFunctionsService.callFunction, r = this.getRawFunction(e);
1744
1781
  return async (s) => {
1745
1782
  const n = await t(r, this.processParam(s));
1746
1783
  return this.processResult(n);
@@ -1755,9 +1792,9 @@ const y = class y {
1755
1792
  return e.__className ? d.createInstance(e) : Array.isArray(e) ? e.map((t) => this.processResult(t)) : typeof e == "object" ? Object.entries(e).reduce((t, [r, s]) => (t[r] = this.processResult(s), t), {}) : e;
1756
1793
  }
1757
1794
  };
1758
- y.error = { shouldBeRegistered: "You should register a cloud functions service with useCloudFunctionsService static method before using CloudFunctions." };
1759
- let $ = y;
1760
- class ve {
1795
+ P.error = { shouldBeRegistered: "You should register a cloud functions service with useCloudFunctionsService static method before using CloudFunctions." };
1796
+ let V = P;
1797
+ class Ce {
1761
1798
  constructor(e) {
1762
1799
  this._registeredFunctions = e;
1763
1800
  }
@@ -1797,8 +1834,8 @@ const g = class g extends B {
1797
1834
  }
1798
1835
  };
1799
1836
  g.error = { shouldBeRegistered: "You should register a Server Auth service before using the Server Auth." }, g._instance = void 0;
1800
- let V = g;
1801
- class we extends B {
1837
+ let $ = g;
1838
+ class ve extends B {
1802
1839
  constructor(e) {
1803
1840
  super(), this._userCredentials = e;
1804
1841
  }
@@ -1824,7 +1861,7 @@ class we extends B {
1824
1861
  return this._userCredentials;
1825
1862
  }
1826
1863
  }
1827
- function Ce(i, e) {
1864
+ function we(i, e) {
1828
1865
  return i ? i.replace(/\${\s*(\w*)\s*}/g, function(t, r) {
1829
1866
  return e[r] || "";
1830
1867
  }) : "";
@@ -1844,30 +1881,30 @@ function Oe(i, e) {
1844
1881
  return e.split(".").reduce((t, r) => t[r], i);
1845
1882
  }
1846
1883
  export {
1847
- x as Auth,
1848
- Pe as AuthMock,
1884
+ I as Auth,
1885
+ be as AuthMock,
1849
1886
  Q as AuthService,
1850
- $ as CloudFunctions,
1851
- ve as CloudFunctionsMock,
1852
- C as CloudStorage,
1853
- w as DataSource,
1887
+ V as CloudFunctions,
1888
+ Ce as CloudFunctionsMock,
1889
+ w as CloudStorage,
1890
+ _ as DataSource,
1854
1891
  ye as EntropicComponent,
1855
- be as JsonDataSource,
1892
+ Pe as JsonDataSource,
1856
1893
  T as MockCloudStorage,
1857
1894
  R as Model,
1858
- I as Observable,
1895
+ L as Observable,
1859
1896
  d as Persistent,
1860
1897
  te as Query,
1861
- V as ServerAuth,
1862
- we as ServerAuthMock,
1898
+ $ as ServerAuth,
1899
+ ve as ServerAuthMock,
1863
1900
  B as ServerAuthService,
1864
- k as Store,
1901
+ W as Store,
1865
1902
  D as StoredFile,
1866
1903
  ae as StoredFileEvent,
1867
1904
  De as camelCase,
1868
1905
  Oe as getDeepValue,
1869
1906
  j as persistent,
1870
- _ as persistentParser,
1907
+ y as persistentParser,
1871
1908
  le as persistentPureReference,
1872
1909
  de as persistentPureReferenceWithCachedProps,
1873
1910
  ue as persistentReference,
@@ -1876,7 +1913,7 @@ export {
1876
1913
  re as registerCloudStorage,
1877
1914
  fe as registerLegacyClassName,
1878
1915
  ee as registerPersistentClass,
1879
- Ce as replaceValue,
1916
+ we as replaceValue,
1880
1917
  pe as required,
1881
1918
  ge as requiredWithValidator,
1882
1919
  me as searchableArray,