entropic-bond 1.51.5 → 1.51.7

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.
@@ -43,25 +43,25 @@ class F {
43
43
  return this.subscribers.size;
44
44
  }
45
45
  }
46
- let j;
47
- const x = new Uint8Array(16);
46
+ let O;
47
+ const B = new Uint8Array(16);
48
48
  function L() {
49
- if (!j && (j = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !j))
49
+ if (!O && (O = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !O))
50
50
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
51
- return j(x);
51
+ return O(B);
52
52
  }
53
53
  const f = [];
54
54
  for (let i = 0; i < 256; ++i)
55
55
  f.push((i + 256).toString(16).slice(1));
56
- function B(i, e = 0) {
56
+ function W(i, e = 0) {
57
57
  return f[i[e + 0]] + f[i[e + 1]] + f[i[e + 2]] + f[i[e + 3]] + "-" + f[i[e + 4]] + f[i[e + 5]] + "-" + f[i[e + 6]] + f[i[e + 7]] + "-" + f[i[e + 8]] + f[i[e + 9]] + "-" + f[i[e + 10]] + f[i[e + 11]] + f[i[e + 12]] + f[i[e + 13]] + f[i[e + 14]] + f[i[e + 15]];
58
58
  }
59
- const W = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), I = {
60
- randomUUID: W
59
+ const Q = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), N = {
60
+ randomUUID: Q
61
61
  };
62
- function Q(i, e, t) {
63
- if (I.randomUUID && !e && !i)
64
- return I.randomUUID();
62
+ function q(i, e, t) {
63
+ if (N.randomUUID && !e && !i)
64
+ return N.randomUUID();
65
65
  i = i || {};
66
66
  const r = i.random || (i.rng || L)();
67
67
  if (r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, e) {
@@ -70,14 +70,14 @@ function Q(i, e, t) {
70
70
  e[t + s] = r[s];
71
71
  return e;
72
72
  }
73
- return B(r);
73
+ return W(r);
74
74
  }
75
- var q = Object.defineProperty, Y = Object.getOwnPropertyDescriptor, z = (i, e, t, r) => {
76
- for (var s = r > 1 ? void 0 : r ? Y(e, t) : e, n = i.length - 1, o; n >= 0; n--)
75
+ var Y = Object.defineProperty, z = Object.getOwnPropertyDescriptor, H = (i, e, t, r) => {
76
+ for (var s = r > 1 ? void 0 : r ? z(e, t) : e, n = i.length - 1, o; n >= 0; n--)
77
77
  (o = i[n]) && (s = (r ? o(e, t, s) : o(s)) || s);
78
- return r && s && q(e, t, s), s;
78
+ return r && s && Y(e, t, s), s;
79
79
  }, d;
80
- const k = (d = class {
80
+ const M = (d = class {
81
81
  /**
82
82
  * Registers a class to be used by the persistence engine.
83
83
  * @param className the name of the class to be registered
@@ -139,7 +139,7 @@ const k = (d = class {
139
139
  * Returns a new instance of Persistent class.
140
140
  * @param className the initial id of this instance. If not provided, a new id will be generated
141
141
  */
142
- constructor(e = Q()) {
142
+ constructor(e = q()) {
143
143
  this._id = e;
144
144
  }
145
145
  /**
@@ -366,15 +366,27 @@ const k = (d = class {
366
366
  static propInfo(e, t) {
367
367
  return d.createInstance(e).getPropInfo(t);
368
368
  }
369
+ /**
370
+ * Retrieves a collection of references with the properties that are stored in the reference object
371
+ * @returns the references collection
372
+ */
373
+ static getSystemRegisteredReferencesWithCachedProps() {
374
+ return d.registeredClasses().reduce((r, s) => {
375
+ const o = d.createInstance(s).getPersistentProperties().filter(
376
+ (c) => c.cachedProps
377
+ );
378
+ return o.length > 0 && (r[s] = o), r;
379
+ }, {});
380
+ }
369
381
  }, d._factoryMap = {}, d);
370
- z([
382
+ H([
371
383
  S
372
- ], k.prototype, "_id", 2);
373
- let l = k;
384
+ ], M.prototype, "_id", 2);
385
+ let l = M;
374
386
  function S(i, e) {
375
387
  return _()(i, e);
376
388
  }
377
- function se(i) {
389
+ function ie(i) {
378
390
  return function(e, t) {
379
391
  return _({
380
392
  storeInCollection: i,
@@ -382,10 +394,10 @@ function se(i) {
382
394
  })(e, t);
383
395
  };
384
396
  }
385
- function ie(i, e) {
397
+ function ne(i, e) {
386
398
  return _({ isReference: !0 })(i, e);
387
399
  }
388
- function ne(i, e) {
400
+ function oe(i, e) {
389
401
  return function(t, r) {
390
402
  return _({
391
403
  isReference: !0,
@@ -394,10 +406,10 @@ function ne(i, e) {
394
406
  })(t, r);
395
407
  };
396
408
  }
397
- function oe(i, e, t) {
409
+ function ae(i, e, t) {
398
410
  return _({ isReference: !0, isPureReference: !0, storeInCollection: t })(i, e);
399
411
  }
400
- function ae(i, e) {
412
+ function ce(i, e) {
401
413
  return function(t, r) {
402
414
  return _({
403
415
  isReference: !0,
@@ -417,28 +429,28 @@ function _(i) {
417
429
  });
418
430
  };
419
431
  }
420
- function H(i, e) {
432
+ function J(i, e) {
421
433
  return (t) => {
422
434
  l.registerFactory(i, t, e), t.prototype.__className = i;
423
435
  };
424
436
  }
425
- function ce(i) {
437
+ function ue(i) {
426
438
  return (e) => {
427
439
  l.registerFactory(i, e);
428
440
  };
429
441
  }
430
- function ue(i, e) {
442
+ function he(i, e) {
431
443
  return _({ searchableArray: !0 })(i, e);
432
444
  }
433
- function he(i, e) {
445
+ function le(i, e) {
434
446
  return _({ validator: (t) => t != null })(i, e);
435
447
  }
436
- function le(i = (e) => e != null) {
448
+ function de(i = (e) => e != null) {
437
449
  return function(e, t) {
438
450
  return _({ validator: i })(e, t);
439
451
  };
440
452
  }
441
- class de extends l {
453
+ class fe extends l {
442
454
  constructor() {
443
455
  super(...arguments), this._onChange = new F();
444
456
  }
@@ -523,11 +535,11 @@ class de extends l {
523
535
  return this.notify({ [e]: this[e] }), t;
524
536
  }
525
537
  }
526
- const E = class E {
538
+ const j = class j {
527
539
  constructor(e, t, r) {
528
540
  if (r) {
529
541
  if (!(t instanceof l))
530
- throw new Error(E.error.persistentNeedForSubCollection);
542
+ throw new Error(j.error.persistentNeedForSubCollection);
531
543
  this.collectionName = `${t.className}/${t.id}/${r}`;
532
544
  } else
533
545
  this.collectionName = t instanceof l ? t.className : t;
@@ -576,7 +588,7 @@ const E = class E {
576
588
  * @returns a Query object
577
589
  */
578
590
  find() {
579
- return new J(this);
591
+ return new Z(this);
580
592
  }
581
593
  /**
582
594
  * Define the search conditions. You pass query operations and how the query
@@ -643,7 +655,7 @@ const E = class E {
643
655
  return e;
644
656
  const t = ((r = e.operations) == null ? void 0 : r.map((s) => {
645
657
  const n = s.value[0] ?? s.value;
646
- return O.isArrayOperator(s.operator) && n instanceof l ? {
658
+ return E.isArrayOperator(s.operator) && n instanceof l ? {
647
659
  property: l.searchableArrayNameFor(s.property),
648
660
  operator: s.operator,
649
661
  value: Array.isArray(s.value) ? s.value.map((o) => o.id) : n.id,
@@ -661,12 +673,12 @@ const E = class E {
661
673
  };
662
674
  }
663
675
  };
664
- E.error = {
676
+ j.error = {
665
677
  persistentNeedForSubCollection: "The document parameter for a sub-collection should be a Persistent instace",
666
678
  invalidQueryOrder: "Cannot add where calls after or calls"
667
679
  };
668
- let C = E;
669
- class J {
680
+ let C = j;
681
+ class Z {
670
682
  constructor(e) {
671
683
  this.queryObject = { operations: [] }, this.model = e;
672
684
  }
@@ -690,10 +702,10 @@ class J {
690
702
  * @see orDeepProp
691
703
  */
692
704
  where(e, t, r, s) {
693
- var n, o, a;
705
+ var n, o, c;
694
706
  if ((o = (n = this.queryObject.operations) == null ? void 0 : n.at(-1)) != null && o.aggregate && !s)
695
707
  throw new Error(C.error.invalidQueryOrder);
696
- return (a = this.queryObject.operations) == null || a.push({
708
+ return (c = this.queryObject.operations) == null || c.push({
697
709
  property: e,
698
710
  operator: t,
699
711
  value: r,
@@ -725,17 +737,17 @@ class J {
725
737
  * @see orDeepProp
726
738
  */
727
739
  whereDeepProp(e, t, r, s) {
728
- var h, c, u;
729
- if ((c = (h = this.queryObject.operations) == null ? void 0 : h.at(-1)) != null && c.aggregate && !s)
740
+ var h, a, u;
741
+ if ((a = (h = this.queryObject.operations) == null ? void 0 : h.at(-1)) != null && a.aggregate && !s)
730
742
  throw new Error(C.error.invalidQueryOrder);
731
743
  const n = e.split(".");
732
- let o = {}, a = n.length > 1 ? o : r;
733
- return n.slice(1).forEach((P, R) => {
734
- o[P] = R < n.length - 2 ? {} : r, o = o[P];
744
+ let o = {}, c = n.length > 1 ? o : r;
745
+ return n.slice(1).forEach((b, R) => {
746
+ o[b] = R < n.length - 2 ? {} : r, o = o[b];
735
747
  }), (u = this.queryObject.operations) == null || u.push({
736
748
  property: n[0],
737
749
  operator: t,
738
- value: a,
750
+ value: c,
739
751
  aggregate: s
740
752
  }), this;
741
753
  }
@@ -962,32 +974,39 @@ const y = class y {
962
974
  };
963
975
  y.error = { shouldBeRegistered: "You should register a data source before using the data Store." };
964
976
  let A = y;
965
- class O {
977
+ class E {
966
978
  installCachedPropsUpdaters(e = {}) {
967
979
  this.onUpdate = e.onUpdate;
968
- const t = [], r = O.getSystemRegisteredReferencesWithStoredProps();
969
- return Object.entries(r).forEach(([s, n]) => {
970
- n.forEach((o) => {
971
- if (!o.storeInCollection)
972
- return;
973
- let a;
974
- if (e.documentChangeListerner ? a = e.documentChangeListerner(o, (h) => this.onDocumentChange(h, o, s)) : a = this.subscribeToDocumentChangeListerner(o, (h) => this.onDocumentChange(h, o, s)), a)
975
- t.push(a);
976
- else if (e.noThrowOnNonImplementedListener)
977
- throw new Error("The method documentChangeListerner has not been implemented in the concrete data source");
980
+ const t = l.getSystemRegisteredReferencesWithCachedProps(), r = {};
981
+ Object.entries(t).forEach(([n, o]) => {
982
+ o.forEach((c) => {
983
+ const h = l.collectionPath(l.createInstance(n), c);
984
+ r[h] || (r[h] = []), r[h].push({
985
+ prop: c,
986
+ collectionPropOwner: n
987
+ });
978
988
  });
979
- }), t;
989
+ });
990
+ const s = [];
991
+ return Object.entries(r).forEach(([n, o]) => {
992
+ const c = this.subscribeToDocumentChangeListerner(n, o, (h) => this.onDocumentChange(h, o));
993
+ if (c)
994
+ s.push(c);
995
+ else if (e.noThrowOnNonImplementedListener)
996
+ throw new Error("The method documentChangeListerner has not been implemented in the concrete data source");
997
+ }), s;
980
998
  }
981
999
  /**
982
1000
  * Installs a document change listener
983
1001
  * Implement the required logic to install a listener that will be called
984
1002
  * when a document is changed in your concrete the data source
985
- * @param prop the property that has a reference to a persistent object
1003
+ * @param collectionNameToListen the name of the collection to be watched
1004
+ * @param props the properties to be watched in the collection
986
1005
  * @param listener the listener to be called when a document is changed
987
1006
  * @returns a function that uninstalls the listener. If the returned value is undefined
988
1007
  * the method documentChangeListerner has not been implemented in the concrete data source
989
1008
  */
990
- subscribeToDocumentChangeListerner(e, t) {
1009
+ subscribeToDocumentChangeListerner(e, t, r) {
991
1010
  }
992
1011
  /**
993
1012
  * Utility method to convert a query object to a property path query object
@@ -1003,7 +1022,7 @@ class O {
1003
1022
  */
1004
1023
  static toPropertyPathOperations(e) {
1005
1024
  return e ? e.map((t) => {
1006
- if (O.isArrayOperator(t.operator) && t.value[0] instanceof l)
1025
+ if (E.isArrayOperator(t.operator) && t.value[0] instanceof l)
1007
1026
  return {
1008
1027
  property: l.searchableArrayNameFor(t.property),
1009
1028
  operator: t.operator,
@@ -1029,37 +1048,31 @@ class O {
1029
1048
  } else
1030
1049
  return [void 0, e];
1031
1050
  }
1032
- async onDocumentChange(e, t, r) {
1033
- if (!e.before || !t.cachedProps)
1034
- return;
1035
- const s = A.getModel(r);
1036
- let n = s.find();
1037
- t.cachedProps.forEach((a) => {
1038
- const h = e.before[a], c = e.after[a];
1039
- h !== c && (n = n.orDeepProp(`${t.name}.${a}`, "==", h));
1040
- });
1041
- const o = await n.get();
1042
- return Promise.all([
1043
- o.map(async (a) => {
1044
- var h;
1045
- (h = t.cachedProps) == null || h.forEach(async (c) => {
1046
- var R;
1047
- const u = e.before[c], P = e.after[c];
1048
- u !== P && (a[`_${t.name}`][`_${c}`] = P, await s.save(a), (R = this.onUpdate) == null || R.call(this, a, t, r));
1051
+ async onDocumentChange(e, t) {
1052
+ if (e.before)
1053
+ return t.map(async (r) => {
1054
+ var c;
1055
+ const s = A.getModel(r.collectionPropOwner);
1056
+ let n = s.find();
1057
+ (c = r.prop.cachedProps) == null || c.forEach((h) => {
1058
+ const a = e.before[h], u = e.after[h];
1059
+ a !== u && (n = n.orDeepProp(`${r.prop.name}.${h}`, "==", a));
1049
1060
  });
1050
- })
1051
- ]);
1052
- }
1053
- static getSystemRegisteredReferencesWithStoredProps() {
1054
- return l.registeredClasses().reduce((r, s) => {
1055
- const o = l.createInstance(s).getPersistentProperties().filter(
1056
- (a) => a.cachedProps
1057
- );
1058
- return o.length > 0 && (r[s] = o), r;
1059
- }, {});
1061
+ const o = await n.get();
1062
+ return Promise.all([
1063
+ o.map(async (h) => {
1064
+ var a;
1065
+ (a = r.prop.cachedProps) == null || a.forEach(async (u) => {
1066
+ var I;
1067
+ const b = e.before[u], R = e.after[u];
1068
+ b !== R && (h[`_${r.prop.name}`][`_${u}`] = R, await s.save(h), (I = this.onUpdate) == null || I.call(this, h, r.prop, e.collectionPath));
1069
+ });
1070
+ })
1071
+ ]);
1072
+ });
1060
1073
  }
1061
1074
  }
1062
- class fe extends O {
1075
+ class pe extends E {
1063
1076
  /**
1064
1077
  * @param jsonRawData the JSON object to be used as data store
1065
1078
  */
@@ -1095,7 +1108,7 @@ class fe extends O {
1095
1108
  return Object.entries(e).forEach(([r, s]) => {
1096
1109
  this._jsonRawData[r] || (this._jsonRawData[r] = {}), s == null || s.forEach((n) => {
1097
1110
  const o = this._jsonRawData[r][n.id];
1098
- this._jsonRawData[r][n.id] = n, this.notifyChange(r, n, o);
1111
+ this._jsonRawData[r][n.id] = n, o && this.notifyChange(r, l.createInstance(n), l.createInstance(o));
1099
1112
  });
1100
1113
  }), this.resolveWithDelay();
1101
1114
  }
@@ -1105,7 +1118,7 @@ class fe extends O {
1105
1118
  throw new Error(this._simulateError.find);
1106
1119
  const r = Object.values(this._jsonRawData[t] || {});
1107
1120
  return e ? (this._lastLimit = e.limit || 0, this._cursor = 0, this._lastMatchingDocs = Object.entries(e).reduce(
1108
- (n, [o, a]) => this.queryProcessor(n, o, a),
1121
+ (n, [o, c]) => this.queryProcessor(n, o, c),
1109
1122
  Object.values(r)
1110
1123
  ), this.resolveWithDelay(this._lastMatchingDocs.slice(0, e.limit))) : this.resolveWithDelay(r);
1111
1124
  }
@@ -1147,20 +1160,19 @@ class fe extends O {
1147
1160
  delete: e
1148
1161
  } : this._simulateError = e, this);
1149
1162
  }
1150
- subscribeToDocumentChangeListerner(e, t) {
1151
- const r = l.collectionPath(void 0, e);
1152
- if (r)
1153
- return delete this._listener[r], this._listener[r] = t, {
1154
- uninstall: () => delete this._listener[r],
1155
- nativeHandler: t,
1156
- collectionPath: r
1157
- };
1163
+ subscribeToDocumentChangeListerner(e, t, r) {
1164
+ return delete this._listener[e], this._listener[e] = r, {
1165
+ uninstall: () => delete this._listener[e],
1166
+ nativeHandler: r,
1167
+ collectionPath: e
1168
+ };
1158
1169
  }
1159
1170
  notifyChange(e, t, r) {
1160
1171
  const s = this._listener[e];
1161
1172
  s && s({
1162
1173
  before: r,
1163
- after: t
1174
+ after: t,
1175
+ collectionPath: e
1164
1176
  });
1165
1177
  }
1166
1178
  decCursor(e) {
@@ -1171,13 +1183,13 @@ class fe extends O {
1171
1183
  limit: (n) => e,
1172
1184
  //.slice( 0, limit ),
1173
1185
  operations: (n) => this.retrieveQueryDocs(e, n),
1174
- sort: ({ order: n, propertyName: o }) => e.sort((a, h) => n === "asc" ? this.deepValue(a, o) > this.deepValue(h, o) ? 1 : -1 : this.deepValue(a, o) < this.deepValue(h, o) ? 1 : -1)
1186
+ sort: ({ order: n, propertyName: o }) => e.sort((c, h) => n === "asc" ? this.deepValue(c, o) > this.deepValue(h, o) ? 1 : -1 : this.deepValue(c, o) < this.deepValue(h, o) ? 1 : -1)
1175
1187
  }[t](r);
1176
1188
  }
1177
1189
  retrieveQueryDocs(e, t) {
1178
1190
  return t.reduce((r, s, n) => {
1179
1191
  if (s.aggregate) {
1180
- const o = e.filter((a) => this.isQueryMatched(a, s));
1192
+ const o = e.filter((c) => this.isQueryMatched(c, s));
1181
1193
  return n === 0 ? o : r.concat(o);
1182
1194
  } else
1183
1195
  return r.filter((o) => this.isQueryMatched(o, s));
@@ -1188,22 +1200,22 @@ class fe extends O {
1188
1200
  }
1189
1201
  isQueryMatched(e, t) {
1190
1202
  const r = {
1191
- "==": (c, u) => c === u,
1192
- "!=": (c, u) => c !== u,
1193
- "<": (c, u) => c < u,
1194
- "<=": (c, u) => c <= u,
1195
- ">": (c, u) => c > u,
1196
- ">=": (c, u) => c >= u,
1197
- containsAny: (c, u) => c == null ? void 0 : c.some((P) => u == null ? void 0 : u.includes(P)),
1198
- contains: (c, u) => c == null ? void 0 : c.includes(u)
1199
- }, { property: s, value: n, operator: o } = t, [a, h] = this.retrieveValuesToCompare(e, s, n);
1200
- return r[o](a, h);
1203
+ "==": (a, u) => a === u,
1204
+ "!=": (a, u) => a !== u,
1205
+ "<": (a, u) => a < u,
1206
+ "<=": (a, u) => a <= u,
1207
+ ">": (a, u) => a > u,
1208
+ ">=": (a, u) => a >= u,
1209
+ containsAny: (a, u) => a == null ? void 0 : a.some((b) => u == null ? void 0 : u.includes(b)),
1210
+ contains: (a, u) => a == null ? void 0 : a.includes(u)
1211
+ }, { property: s, value: n, operator: o } = t, [c, h] = this.retrieveValuesToCompare(e, s, n);
1212
+ return r[o](c, h);
1201
1213
  }
1202
1214
  retrieveValuesToCompare(e, t, r) {
1203
1215
  const s = e[t];
1204
1216
  if (s && typeof r == "object" && !Array.isArray(r)) {
1205
- const a = Object.keys(r)[0];
1206
- var [n, o] = this.retrieveValuesToCompare(s, a, r == null ? void 0 : r[a]);
1217
+ const c = Object.keys(r)[0];
1218
+ var [n, o] = this.retrieveValuesToCompare(s, c, r == null ? void 0 : r[c]);
1207
1219
  }
1208
1220
  return [n || s, o || r];
1209
1221
  }
@@ -1221,12 +1233,12 @@ class fe extends O {
1221
1233
  ), t;
1222
1234
  }
1223
1235
  }
1224
- const v = class v {
1236
+ const P = class P {
1225
1237
  static registerCloudStorage(e, t) {
1226
- v._cloudStorageFactoryMap[e] = t;
1238
+ P._cloudStorageFactoryMap[e] = t;
1227
1239
  }
1228
1240
  static createInstance(e) {
1229
- const t = v._cloudStorageFactoryMap[e];
1241
+ const t = P._cloudStorageFactoryMap[e];
1230
1242
  if (!t)
1231
1243
  throw new Error(`You should register the ${e} cloud storage provider prior to use it`);
1232
1244
  return t();
@@ -1235,27 +1247,27 @@ const v = class v {
1235
1247
  return this.__className;
1236
1248
  }
1237
1249
  static useCloudStorage(e) {
1238
- v._defaultCloudStorage = e;
1250
+ P._defaultCloudStorage = e;
1239
1251
  }
1240
1252
  static get defaultCloudStorage() {
1241
- if (!v._defaultCloudStorage)
1253
+ if (!P._defaultCloudStorage)
1242
1254
  throw new Error("You should define a default cloud storage provider prior to use it");
1243
- return v._defaultCloudStorage;
1255
+ return P._defaultCloudStorage;
1244
1256
  }
1245
1257
  };
1246
- v._cloudStorageFactoryMap = {};
1247
- let w = v;
1248
- function Z(i, e) {
1249
- return w.registerCloudStorage(i, e), (t) => {
1258
+ P._cloudStorageFactoryMap = {};
1259
+ let v = P;
1260
+ function G(i, e) {
1261
+ return v.registerCloudStorage(i, e), (t) => {
1250
1262
  t.prototype.__className = i;
1251
1263
  };
1252
1264
  }
1253
- var G = Object.defineProperty, K = Object.getOwnPropertyDescriptor, X = (i, e, t, r) => {
1254
- for (var s = r > 1 ? void 0 : r ? K(e, t) : e, n = i.length - 1, o; n >= 0; n--)
1265
+ var K = Object.defineProperty, X = Object.getOwnPropertyDescriptor, ee = (i, e, t, r) => {
1266
+ for (var s = r > 1 ? void 0 : r ? X(e, t) : e, n = i.length - 1, o; n >= 0; n--)
1255
1267
  (o = i[n]) && (s = (r ? o(e, t, s) : o(s)) || s);
1256
- return r && s && G(e, t, s), s;
1268
+ return r && s && K(e, t, s), s;
1257
1269
  };
1258
- let U = class extends w {
1270
+ let U = class extends v {
1259
1271
  constructor(i = "") {
1260
1272
  super(), this._simulateDelay = 0, this._pendingPromises = [], this.mockFileSystem = {}, this._pathToMockFiles = i;
1261
1273
  }
@@ -1304,21 +1316,21 @@ let U = class extends w {
1304
1316
  return delete this.mockFileSystem[i], this.resolveWithDelay();
1305
1317
  }
1306
1318
  };
1307
- U = X([
1308
- Z("MockCloudStorage", () => new U())
1319
+ U = ee([
1320
+ G("MockCloudStorage", () => new U())
1309
1321
  ], U);
1310
- var ee = Object.defineProperty, te = Object.getOwnPropertyDescriptor, D = (i, e, t, r) => {
1311
- for (var s = r > 1 ? void 0 : r ? te(e, t) : e, n = i.length - 1, o; n >= 0; n--)
1322
+ var te = Object.defineProperty, re = Object.getOwnPropertyDescriptor, D = (i, e, t, r) => {
1323
+ for (var s = r > 1 ? void 0 : r ? re(e, t) : e, n = i.length - 1, o; n >= 0; n--)
1312
1324
  (o = i[n]) && (s = (r ? o(e, t, s) : o(s)) || s);
1313
- return r && s && ee(e, t, s), s;
1314
- }, re = /* @__PURE__ */ ((i) => (i[i.stored = 0] = "stored", i[i.pendingDataSet = 1] = "pendingDataSet", i[i.deleted = 2] = "deleted", i))(re || {});
1315
- let b = class extends l {
1325
+ return r && s && te(e, t, s), s;
1326
+ }, se = /* @__PURE__ */ ((i) => (i[i.stored = 0] = "stored", i[i.pendingDataSet = 1] = "pendingDataSet", i[i.deleted = 2] = "deleted", i))(se || {});
1327
+ let w = class extends l {
1316
1328
  constructor() {
1317
1329
  super(...arguments), this._onChange = new F();
1318
1330
  }
1319
1331
  async save({ data: i, fileName: e, progress: t, cloudStorageProvider: r } = {}) {
1320
1332
  const s = i || this._pendingData;
1321
- 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 }));
1333
+ s && (this._reference && await this.delete(), this.provider = r || v.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 }));
1322
1334
  }
1323
1335
  uploadControl() {
1324
1336
  return this.provider.uploadControl();
@@ -1334,9 +1346,9 @@ let b = class extends l {
1334
1346
  get provider() {
1335
1347
  if (!this._provider)
1336
1348
  try {
1337
- this._provider = w.createInstance(this._cloudStorageProviderName);
1349
+ this._provider = v.createInstance(this._cloudStorageProviderName);
1338
1350
  } catch {
1339
- this._provider = w.defaultCloudStorage;
1351
+ this._provider = v.defaultCloudStorage;
1340
1352
  }
1341
1353
  return this._provider;
1342
1354
  }
@@ -1362,25 +1374,25 @@ let b = class extends l {
1362
1374
  };
1363
1375
  D([
1364
1376
  S
1365
- ], b.prototype, "_reference", 2);
1377
+ ], w.prototype, "_reference", 2);
1366
1378
  D([
1367
1379
  S
1368
- ], b.prototype, "_url", 2);
1380
+ ], w.prototype, "_url", 2);
1369
1381
  D([
1370
1382
  S
1371
- ], b.prototype, "_cloudStorageProviderName", 2);
1383
+ ], w.prototype, "_cloudStorageProviderName", 2);
1372
1384
  D([
1373
1385
  S
1374
- ], b.prototype, "_originalFileName", 2);
1386
+ ], w.prototype, "_originalFileName", 2);
1375
1387
  D([
1376
1388
  S
1377
- ], b.prototype, "_mimeType", 2);
1378
- b = D([
1379
- H("StoredFile")
1380
- ], b);
1381
- class M {
1389
+ ], w.prototype, "_mimeType", 2);
1390
+ w = D([
1391
+ J("StoredFile")
1392
+ ], w);
1393
+ class T {
1382
1394
  }
1383
- const p = class p extends M {
1395
+ const p = class p extends T {
1384
1396
  constructor() {
1385
1397
  if (super(), this._onAuthStateChange = new F(), !p._authService)
1386
1398
  throw new Error(p.error.shouldBeRegistered);
@@ -1507,15 +1519,15 @@ const p = class p extends M {
1507
1519
  }
1508
1520
  };
1509
1521
  p.error = { shouldBeRegistered: "You should register an auth service before using Auth." }, p._instance = void 0;
1510
- let N = p;
1511
- class pe extends M {
1522
+ let V = p;
1523
+ class me extends T {
1512
1524
  constructor() {
1513
1525
  super(...arguments), this.pendingPromises = [], this._fakeRegisteredUsers = {};
1514
1526
  }
1515
1527
  signUp(e) {
1516
- const { verificationLink: t, email: r, password: s, authProvider: n } = e, o = new Promise(async (a, h) => {
1517
- var c, u;
1518
- n === "email" && (r || h({ code: "missingEmail", message: "missingEmail" }), s || h({ code: "missingPassword", message: "missingPassword" })), s !== "fail" && r !== "fail" ? (this._loggedUser = this.userCredentials(e), this._fakeRegisteredUsers[this._loggedUser.id] = this._loggedUser, a(this._loggedUser), (c = this.notifyChange) == null || c.call(this, this._loggedUser)) : (h({ code: "userNotFound", message: t || "Test auth error" }), (u = this.notifyChange) == null || u.call(this, void 0));
1528
+ const { verificationLink: t, email: r, password: s, authProvider: n } = e, o = new Promise(async (c, h) => {
1529
+ var a, u;
1530
+ n === "email" && (r || h({ code: "missingEmail", message: "missingEmail" }), s || h({ code: "missingPassword", message: "missingPassword" })), s !== "fail" && r !== "fail" ? (this._loggedUser = this.userCredentials(e), this._fakeRegisteredUsers[this._loggedUser.id] = this._loggedUser, c(this._loggedUser), (a = this.notifyChange) == null || a.call(this, this._loggedUser)) : (h({ code: "userNotFound", message: t || "Test auth error" }), (u = this.notifyChange) == null || u.call(this, void 0));
1519
1531
  });
1520
1532
  return this.pendingPromises.push(o), o;
1521
1533
  }
@@ -1613,8 +1625,8 @@ const g = class g {
1613
1625
  }
1614
1626
  };
1615
1627
  g.error = { shouldBeRegistered: "You should register a cloud functions service with useCloudFunctionsService static method before using CloudFunctions." };
1616
- let V = g;
1617
- class me {
1628
+ let $ = g;
1629
+ class ge {
1618
1630
  constructor(e) {
1619
1631
  this._registeredFunctions = e;
1620
1632
  }
@@ -1628,9 +1640,9 @@ class me {
1628
1640
  return e(t);
1629
1641
  }
1630
1642
  }
1631
- class T {
1643
+ class x {
1632
1644
  }
1633
- const m = class m extends T {
1645
+ const m = class m extends x {
1634
1646
  constructor() {
1635
1647
  super();
1636
1648
  }
@@ -1656,8 +1668,8 @@ const m = class m extends T {
1656
1668
  }
1657
1669
  };
1658
1670
  m.error = { shouldBeRegistered: "You should register a Server Auth service before using the Server Auth." }, m._instance = void 0;
1659
- let $ = m;
1660
- class ge extends T {
1671
+ let k = m;
1672
+ class _e extends x {
1661
1673
  constructor(e) {
1662
1674
  super(), this._userCredentials = e;
1663
1675
  }
@@ -1684,12 +1696,12 @@ class ge extends T {
1684
1696
  return this._userCredentials;
1685
1697
  }
1686
1698
  }
1687
- function _e(i, e) {
1699
+ function ye(i, e) {
1688
1700
  return i ? i.replace(/\${\s*(\w*)\s*}/g, function(t, r) {
1689
1701
  return e[r] || "";
1690
1702
  }) : "";
1691
1703
  }
1692
- function ye(i) {
1704
+ function Pe(i) {
1693
1705
  return i ? i.replace(
1694
1706
  /([-_ ][\w])/g,
1695
1707
  (e) => e.toUpperCase().replace("-", "").replace("_", "").replace(" ", "")
@@ -1701,46 +1713,46 @@ function ve(i, e = "-") {
1701
1713
  const t = i.slice(1).replace(/( |[A-Z])/g, (r) => r === " " ? "-" : e + r[0].toLowerCase());
1702
1714
  return i[0].toLocaleLowerCase() + t.replace(/--/g, "-");
1703
1715
  }
1704
- function Pe(i, e) {
1716
+ function we(i, e) {
1705
1717
  return e.split(".").reduce((t, r) => t[r], i);
1706
1718
  }
1707
1719
  export {
1708
- N as Auth,
1709
- pe as AuthMock,
1710
- M as AuthService,
1711
- V as CloudFunctions,
1712
- me as CloudFunctionsMock,
1713
- w as CloudStorage,
1714
- O as DataSource,
1715
- de as EntropicComponent,
1716
- fe as JsonDataSource,
1720
+ V as Auth,
1721
+ me as AuthMock,
1722
+ T as AuthService,
1723
+ $ as CloudFunctions,
1724
+ ge as CloudFunctionsMock,
1725
+ v as CloudStorage,
1726
+ E as DataSource,
1727
+ fe as EntropicComponent,
1728
+ pe as JsonDataSource,
1717
1729
  U as MockCloudStorage,
1718
1730
  C as Model,
1719
1731
  F as Observable,
1720
1732
  l as Persistent,
1721
- J as Query,
1722
- $ as ServerAuth,
1723
- ge as ServerAuthMock,
1724
- T as ServerAuthService,
1733
+ Z as Query,
1734
+ k as ServerAuth,
1735
+ _e as ServerAuthMock,
1736
+ x as ServerAuthService,
1725
1737
  A as Store,
1726
- b as StoredFile,
1727
- re as StoredFileEvent,
1728
- ye as camelCase,
1729
- Pe as getDeepValue,
1738
+ w as StoredFile,
1739
+ se as StoredFileEvent,
1740
+ Pe as camelCase,
1741
+ we as getDeepValue,
1730
1742
  S as persistent,
1731
1743
  _ as persistentParser,
1732
- oe as persistentPureReference,
1733
- ae as persistentPureReferenceWithCachedProps,
1734
- ie as persistentReference,
1735
- se as persistentReferenceAt,
1736
- ne as persistentReferenceWithCachedProps,
1737
- Z as registerCloudStorage,
1738
- ce as registerLegacyClassName,
1739
- H as registerPersistentClass,
1740
- _e as replaceValue,
1741
- he as required,
1742
- le as requiredWithValidator,
1743
- ue as searchableArray,
1744
+ ae as persistentPureReference,
1745
+ ce as persistentPureReferenceWithCachedProps,
1746
+ ne as persistentReference,
1747
+ ie as persistentReferenceAt,
1748
+ oe as persistentReferenceWithCachedProps,
1749
+ G as registerCloudStorage,
1750
+ ue as registerLegacyClassName,
1751
+ J as registerPersistentClass,
1752
+ ye as replaceValue,
1753
+ le as required,
1754
+ de as requiredWithValidator,
1755
+ he as searchableArray,
1744
1756
  ve as snakeCase
1745
1757
  };
1746
1758
  //# sourceMappingURL=entropic-bond.js.map