entropic-bond 1.53.23 → 1.54.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 U {
1
+ class A {
2
2
  constructor() {
3
3
  this.subscribers = /* @__PURE__ */ new Set();
4
4
  }
@@ -46,34 +46,34 @@ class U {
46
46
  const f = [];
47
47
  for (let i = 0; i < 256; ++i)
48
48
  f.push((i + 256).toString(16).slice(1));
49
- function $(i, e = 0) {
49
+ function B(i, e = 0) {
50
50
  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]]).toLowerCase();
51
51
  }
52
52
  let R;
53
- const T = new Uint8Array(16);
54
- function x() {
53
+ const Q = new Uint8Array(16);
54
+ function W() {
55
55
  if (!R) {
56
56
  if (typeof crypto > "u" || !crypto.getRandomValues)
57
57
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
58
58
  R = crypto.getRandomValues.bind(crypto);
59
59
  }
60
- return R(T);
60
+ return R(Q);
61
61
  }
62
- const B = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), A = { randomUUID: B };
63
- function Q(i, e, t) {
62
+ const q = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), F = { randomUUID: q };
63
+ function Y(i, e, t) {
64
64
  i = i || {};
65
- const r = i.random ?? i.rng?.() ?? x();
65
+ const r = i.random ?? i.rng?.() ?? W();
66
66
  if (r.length < 16)
67
67
  throw new Error("Random bytes length must be >= 16");
68
- return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, $(r);
68
+ return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, B(r);
69
69
  }
70
- function W(i, e, t) {
71
- return A.randomUUID && !i ? A.randomUUID() : Q(i);
70
+ function z(i, e, t) {
71
+ return F.randomUUID && !i ? F.randomUUID() : Y(i);
72
72
  }
73
- var q = Object.defineProperty, Y = (i, e, t, r) => {
73
+ var H = Object.defineProperty, J = (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
- return s && q(e, t, s), s;
76
+ return s && H(e, t, s), s;
77
77
  }, l;
78
78
  const L = (l = class {
79
79
  /**
@@ -143,14 +143,14 @@ const L = (l = class {
143
143
  * Returns a new instance of Persistent class.
144
144
  * @param className the initial id of this instance. If not provided, a new id will be generated
145
145
  */
146
- constructor(e = W()) {
146
+ constructor(e = z()) {
147
147
  this._id = e;
148
148
  }
149
149
  /**
150
150
  * Gets the class name of this instance.
151
151
  */
152
152
  get className() {
153
- return this.__className;
153
+ return this.__className ?? this.constructor.name;
154
154
  }
155
155
  /**
156
156
  * Sets the id of this instance.
@@ -186,7 +186,8 @@ const L = (l = class {
186
186
  getPersistentProperties() {
187
187
  return this._persistentProperties ? this._persistentProperties.map((e) => ({
188
188
  ...e,
189
- name: e.name.slice(1)
189
+ name: e.name.slice(1),
190
+ ownerClassName: e._target.className === "_Persistent" ? "Persistent" : e._target.className
190
191
  })) : [];
191
192
  }
192
193
  /**
@@ -270,7 +271,7 @@ const L = (l = class {
270
271
  if (!this._persistentProperties) return {};
271
272
  this.beforeSerialize();
272
273
  const t = {};
273
- if (!this.className) throw new Error(`You should register \`${this.constructor.name || this.toString() || "this"}\` class prior to streaming it.`);
274
+ if (!this.className || !l.registeredClasses().includes(this.className)) throw new Error(`You should register \`${this.constructor.name || this.toString() || "this"}\` class prior to streaming it.`);
274
275
  return this._persistentProperties.forEach((r) => {
275
276
  const s = this[r.name], n = this.removeUnderscore(r);
276
277
  s != null && (r.isReference ? t[n] = this.toReferenceObj(r, e) : t[n] = this.toDeepObj(s, e), r.searchableArray && (t[l.searchableArrayNameFor(n)] = s.map((o) => o.id)));
@@ -315,11 +316,11 @@ const L = (l = class {
315
316
  }
316
317
  static collectionPath(e, t) {
317
318
  let r;
318
- return typeof t.storeInCollection == "function" ? r = t.storeInCollection(e, t) : r = t.storeInCollection ?? e.className, r;
319
+ return t = t || e._target, typeof e.storeInCollection == "function" ? r = e.storeInCollection(t, e) : r = e.storeInCollection ?? t.className, r;
319
320
  }
320
321
  toReferenceObj(e, t) {
321
322
  const r = this[e.name];
322
- return Array.isArray(r) ? r.map((s) => (e.isPureReference || this.pushDocument(t, l.collectionPath(s, e), s), this.buildRefObject(s, l.collectionPath(s, e), e.cachedPropsConfig?.cachedProps))) : (e.isPureReference || this.pushDocument(t, l.collectionPath(r, e), r), this.buildRefObject(r, l.collectionPath(r, e), e.cachedPropsConfig?.cachedProps));
323
+ return Array.isArray(r) ? r.map((s) => (e.isPureReference || this.pushDocument(t, l.collectionPath(e, s), s), this.buildRefObject(s, l.collectionPath(e, s), e.cachedPropsConfig?.cachedProps))) : (e.isPureReference || this.pushDocument(t, l.collectionPath(e, r), r), this.buildRefObject(r, l.collectionPath(e, r), e.cachedPropsConfig?.cachedProps));
323
324
  }
324
325
  buildRefObject(e, t, r) {
325
326
  const s = r?.reduce((n, o) => (e[o] !== void 0 && (n[o] = e[o]), n), {});
@@ -377,14 +378,14 @@ const L = (l = class {
377
378
  }, {});
378
379
  }
379
380
  }, l._factoryMap = {}, l);
380
- Y([
381
+ J([
381
382
  S
382
383
  ], L.prototype, "_id");
383
384
  let u = L;
384
385
  function S(i, e) {
385
386
  return _()(i, e);
386
387
  }
387
- function te(i) {
388
+ function ie(i) {
388
389
  return function(e, t) {
389
390
  return _({
390
391
  storeInCollection: i,
@@ -392,10 +393,10 @@ function te(i) {
392
393
  })(e, t);
393
394
  };
394
395
  }
395
- function re(i, e) {
396
+ function ne(i, e) {
396
397
  return _({ isReference: !0 })(i, e);
397
398
  }
398
- function se(i, e, t) {
399
+ function oe(i, e, t) {
399
400
  const r = Array.isArray(i) ? { cachedProps: i } : i;
400
401
  return function(s, n) {
401
402
  return _({
@@ -406,10 +407,10 @@ function se(i, e, t) {
406
407
  })(s, n);
407
408
  };
408
409
  }
409
- function ie(i, e, t) {
410
+ function ae(i, e, t) {
410
411
  return _({ isReference: !0, isPureReference: !0, storeInCollection: t })(i, e);
411
412
  }
412
- function ne(i, e, t) {
413
+ function ce(i, e, t) {
413
414
  return function(r, s) {
414
415
  const n = Array.isArray(i) ? { cachedProps: i } : i;
415
416
  return _({
@@ -427,34 +428,35 @@ function _(i) {
427
428
  const r = e._persistentProperties.find((s) => s.name === t);
428
429
  r ? Object.assign(r, i) : e._persistentProperties.push({
429
430
  name: t,
431
+ _target: e,
430
432
  ...i
431
433
  });
432
434
  };
433
435
  }
434
- function z(i, e) {
436
+ function Z(i, e) {
435
437
  return (t) => {
436
- u.registerFactory(i, t, e), t.prototype.__className = i;
438
+ i || (i = t.name), u.registerFactory(i, t, e), t.prototype.__className = i;
437
439
  };
438
440
  }
439
- function oe(i) {
441
+ function ue(i) {
440
442
  return (e) => {
441
443
  u.registerFactory(i, e, void 0, !0);
442
444
  };
443
445
  }
444
- function ae(i, e) {
446
+ function he(i, e) {
445
447
  return _({ searchableArray: !0 })(i, e);
446
448
  }
447
- function ce(i, e) {
449
+ function le(i, e) {
448
450
  return _({ validator: (t) => t != null })(i, e);
449
451
  }
450
- function ue(i = (e) => e != null) {
452
+ function de(i = (e) => e != null) {
451
453
  return function(e, t) {
452
454
  return _({ validator: i })(e, t);
453
455
  };
454
456
  }
455
- class he extends u {
457
+ class fe extends u {
456
458
  constructor() {
457
- super(...arguments), this._onChange = new U();
459
+ super(...arguments), this._onChange = new A();
458
460
  }
459
461
  /**
460
462
  * Subscribes a listener callback function. Every time a property is changed,
@@ -589,7 +591,7 @@ const j = class j {
589
591
  * @returns a Query object
590
592
  */
591
593
  find() {
592
- return new H(this);
594
+ return new G(this);
593
595
  }
594
596
  /**
595
597
  * Define the search conditions. You pass query operations and how the query
@@ -703,7 +705,7 @@ j.error = {
703
705
  invalidQueryOrder: "Cannot add where calls after or calls"
704
706
  };
705
707
  let C = j;
706
- class H {
708
+ class G {
707
709
  constructor(e) {
708
710
  this.queryObject = { operations: [] }, this.model = e;
709
711
  }
@@ -992,14 +994,14 @@ const y = class y {
992
994
  }
993
995
  };
994
996
  y.error = { shouldBeRegistered: "You should register a data source before using the data Store." };
995
- let E = y;
997
+ let U = y;
996
998
  class w {
997
999
  installCachedPropsUpdaters(e = {}) {
998
1000
  w.onUpdate = e.onUpdate;
999
1001
  const t = u.getSystemRegisteredReferencesWithCachedProps(), r = {};
1000
1002
  Object.entries(t).forEach(([n, o]) => {
1001
1003
  o.forEach((a) => {
1002
- const c = u.collectionPath(u.createInstance(n), a);
1004
+ const c = u.collectionPath(a, u.createInstance(n));
1003
1005
  r[c] || (r[c] = []), r[c].push({
1004
1006
  prop: a,
1005
1007
  collectionPropOwner: n
@@ -1069,7 +1071,7 @@ class w {
1069
1071
  static async processDocumentChange(e, t) {
1070
1072
  if (e.before)
1071
1073
  return t.map(async (r) => {
1072
- const s = E.getModel(r.collectionPropOwner);
1074
+ const s = U.getModel(r.collectionPropOwner);
1073
1075
  let n = s.find();
1074
1076
  r.prop.cachedPropsConfig?.cachedProps?.forEach((a) => {
1075
1077
  const c = e.before?.[a], h = e.after?.[a];
@@ -1087,7 +1089,7 @@ class w {
1087
1089
  });
1088
1090
  }
1089
1091
  }
1090
- class le extends w {
1092
+ class pe extends w {
1091
1093
  /**
1092
1094
  * @param jsonRawData the JSON object to be used as data store
1093
1095
  */
@@ -1148,10 +1150,12 @@ class le extends w {
1148
1150
  s || (this._collectionListeners[t] = {}, s = this._collectionListeners[t]);
1149
1151
  const n = (a) => {
1150
1152
  if (!a.after) return;
1151
- const c = this.retrieveQueryDocs([a.before ?? a.after], e.operations);
1152
- c.length > 0 && r(c.map((h) => ({
1153
+ const c = [a.after];
1154
+ a.before && c.push(a.before);
1155
+ const d = this.retrieveQueryDocs(c, e.operations).filter((D, $, T) => $ === T.findIndex((x) => x.id === D.id));
1156
+ d.length > 0 && r(d.map((D) => ({
1153
1157
  before: void 0,
1154
- after: h,
1158
+ after: D,
1155
1159
  type: a.type,
1156
1160
  params: a.params
1157
1161
  })));
@@ -1238,7 +1242,7 @@ class le extends w {
1238
1242
  "<=": (h, d) => h <= d,
1239
1243
  ">": (h, d) => h > d,
1240
1244
  ">=": (h, d) => h >= d,
1241
- containsAny: (h, d) => h?.some((V) => d?.includes(V)),
1245
+ containsAny: (h, d) => h?.some((D) => d?.includes(D)),
1242
1246
  contains: (h, d) => h?.includes(d)
1243
1247
  }, { property: s, value: n, operator: o } = t, [a, c] = this.retrieveValuesToCompare(e, s, n);
1244
1248
  return r[o](a, c);
@@ -1288,17 +1292,17 @@ const v = class v {
1288
1292
  };
1289
1293
  v._cloudStorageFactoryMap = {};
1290
1294
  let P = v;
1291
- function J(i, e) {
1295
+ function K(i, e) {
1292
1296
  return P.registerCloudStorage(i, e), (t) => {
1293
1297
  t.prototype.__className = i;
1294
1298
  };
1295
1299
  }
1296
- var Z = Object.getOwnPropertyDescriptor, G = (i, e, t, r) => {
1297
- for (var s = r > 1 ? void 0 : r ? Z(e, t) : e, n = i.length - 1, o; n >= 0; n--)
1300
+ var X = Object.getOwnPropertyDescriptor, ee = (i, e, t, r) => {
1301
+ for (var s = r > 1 ? void 0 : r ? X(e, t) : e, n = i.length - 1, o; n >= 0; n--)
1298
1302
  (o = i[n]) && (s = o(s) || s);
1299
1303
  return s;
1300
1304
  };
1301
- let D = class extends P {
1305
+ let E = class extends P {
1302
1306
  constructor(i = "") {
1303
1307
  super(), this._simulateDelay = 0, this._pendingPromises = [], this.mockFileSystem = {}, this._pathToMockFiles = i;
1304
1308
  }
@@ -1346,17 +1350,17 @@ let D = class extends P {
1346
1350
  return delete this.mockFileSystem[i], this.resolveWithDelay();
1347
1351
  }
1348
1352
  };
1349
- D = G([
1350
- J("MockCloudStorage", () => new D())
1351
- ], D);
1352
- var K = Object.defineProperty, X = Object.getOwnPropertyDescriptor, O = (i, e, t, r) => {
1353
- for (var s = r > 1 ? void 0 : r ? X(e, t) : e, n = i.length - 1, o; n >= 0; n--)
1353
+ E = ee([
1354
+ K("MockCloudStorage", () => new E())
1355
+ ], E);
1356
+ var te = Object.defineProperty, re = Object.getOwnPropertyDescriptor, O = (i, e, t, r) => {
1357
+ for (var s = r > 1 ? void 0 : r ? re(e, t) : e, n = i.length - 1, o; n >= 0; n--)
1354
1358
  (o = i[n]) && (s = (r ? o(e, t, s) : o(s)) || s);
1355
- return r && s && K(e, t, s), s;
1356
- }, ee = /* @__PURE__ */ ((i) => (i[i.stored = 0] = "stored", i[i.pendingDataSet = 1] = "pendingDataSet", i[i.deleted = 2] = "deleted", i))(ee || {});
1359
+ return r && s && te(e, t, s), s;
1360
+ }, se = /* @__PURE__ */ ((i) => (i[i.stored = 0] = "stored", i[i.pendingDataSet = 1] = "pendingDataSet", i[i.deleted = 2] = "deleted", i))(se || {});
1357
1361
  let b = class extends u {
1358
1362
  constructor() {
1359
- super(...arguments), this._onChange = new U();
1363
+ super(...arguments), this._onChange = new A();
1360
1364
  }
1361
1365
  async save({ data: i, fileName: e, progress: t, cloudStorageProvider: r } = {}) {
1362
1366
  const s = i || this._pendingData;
@@ -1417,13 +1421,13 @@ O([
1417
1421
  S
1418
1422
  ], b.prototype, "_mimeType", 2);
1419
1423
  b = O([
1420
- z("StoredFile")
1424
+ Z("StoredFile")
1421
1425
  ], b);
1422
- class N {
1426
+ class M {
1423
1427
  }
1424
- const p = class p extends N {
1428
+ const p = class p extends M {
1425
1429
  constructor() {
1426
- if (super(), this._onAuthStateChange = new U(), !p._authService) throw new Error(p.error.shouldBeRegistered);
1430
+ if (super(), this._onAuthStateChange = new A(), !p._authService) throw new Error(p.error.shouldBeRegistered);
1427
1431
  p._authService.onAuthStateChange(
1428
1432
  (e) => this.authStateChanged(e)
1429
1433
  );
@@ -1547,8 +1551,8 @@ const p = class p extends N {
1547
1551
  }
1548
1552
  };
1549
1553
  p.error = { shouldBeRegistered: "You should register an auth service before using Auth." }, p._instance = void 0;
1550
- let F = p;
1551
- class de extends N {
1554
+ let I = p;
1555
+ class me extends M {
1552
1556
  constructor() {
1553
1557
  super(...arguments), this.pendingPromises = [], this._fakeRegisteredUsers = {};
1554
1558
  }
@@ -1649,8 +1653,8 @@ const g = class g {
1649
1653
  }
1650
1654
  };
1651
1655
  g.error = { shouldBeRegistered: "You should register a cloud functions service with useCloudFunctionsService static method before using CloudFunctions." };
1652
- let I = g;
1653
- class fe {
1656
+ let N = g;
1657
+ class ge {
1654
1658
  constructor(e) {
1655
1659
  this._registeredFunctions = e;
1656
1660
  }
@@ -1663,9 +1667,9 @@ class fe {
1663
1667
  return e(t);
1664
1668
  }
1665
1669
  }
1666
- class M {
1670
+ class V {
1667
1671
  }
1668
- const m = class m extends M {
1672
+ const m = class m extends V {
1669
1673
  constructor() {
1670
1674
  super();
1671
1675
  }
@@ -1691,7 +1695,7 @@ const m = class m extends M {
1691
1695
  };
1692
1696
  m.error = { shouldBeRegistered: "You should register a Server Auth service before using the Server Auth." }, m._instance = void 0;
1693
1697
  let k = m;
1694
- class pe extends M {
1698
+ class _e extends V {
1695
1699
  constructor(e) {
1696
1700
  super(), this._userCredentials = e;
1697
1701
  }
@@ -1717,62 +1721,62 @@ class pe extends M {
1717
1721
  return this._userCredentials;
1718
1722
  }
1719
1723
  }
1720
- function me(i, e) {
1724
+ function ye(i, e) {
1721
1725
  return i ? i.replace(/\${\s*(\w*)\s*}/g, function(t, r) {
1722
1726
  return e[r] || "";
1723
1727
  }) : "";
1724
1728
  }
1725
- function ge(i) {
1729
+ function ve(i) {
1726
1730
  return i ? i.replace(
1727
1731
  /([-_ ][\w])/g,
1728
1732
  (e) => e.toUpperCase().replace("-", "").replace("_", "").replace(" ", "")
1729
1733
  ) : "";
1730
1734
  }
1731
- function _e(i, e = "-") {
1735
+ function Pe(i, e = "-") {
1732
1736
  if (!i) return "";
1733
1737
  const t = i.slice(1).replace(/( |[A-Z])/g, (r) => r === " " ? "-" : e + r[0].toLowerCase());
1734
1738
  return i[0].toLocaleLowerCase() + t.replace(/--/g, "-");
1735
1739
  }
1736
- function ye(i, e) {
1740
+ function be(i, e) {
1737
1741
  return e.split(".").reduce((t, r) => t[r], i);
1738
1742
  }
1739
1743
  export {
1740
- F as Auth,
1741
- de as AuthMock,
1742
- N as AuthService,
1743
- I as CloudFunctions,
1744
- fe as CloudFunctionsMock,
1744
+ I as Auth,
1745
+ me as AuthMock,
1746
+ M as AuthService,
1747
+ N as CloudFunctions,
1748
+ ge as CloudFunctionsMock,
1745
1749
  P as CloudStorage,
1746
1750
  w as DataSource,
1747
- he as EntropicComponent,
1748
- le as JsonDataSource,
1749
- D as MockCloudStorage,
1751
+ fe as EntropicComponent,
1752
+ pe as JsonDataSource,
1753
+ E as MockCloudStorage,
1750
1754
  C as Model,
1751
- U as Observable,
1755
+ A as Observable,
1752
1756
  u as Persistent,
1753
- H as Query,
1757
+ G as Query,
1754
1758
  k as ServerAuth,
1755
- pe as ServerAuthMock,
1756
- M as ServerAuthService,
1757
- E as Store,
1759
+ _e as ServerAuthMock,
1760
+ V as ServerAuthService,
1761
+ U as Store,
1758
1762
  b as StoredFile,
1759
- ee as StoredFileEvent,
1760
- ge as camelCase,
1761
- ye as getDeepValue,
1763
+ se as StoredFileEvent,
1764
+ ve as camelCase,
1765
+ be as getDeepValue,
1762
1766
  S as persistent,
1763
1767
  _ as persistentParser,
1764
- ie as persistentPureReference,
1765
- ne as persistentPureReferenceWithCachedProps,
1766
- re as persistentReference,
1767
- te as persistentReferenceAt,
1768
- se as persistentReferenceWithCachedProps,
1769
- J as registerCloudStorage,
1770
- oe as registerLegacyClassName,
1771
- z as registerPersistentClass,
1772
- me as replaceValue,
1773
- ce as required,
1774
- ue as requiredWithValidator,
1775
- ae as searchableArray,
1776
- _e as snakeCase
1768
+ ae as persistentPureReference,
1769
+ ce as persistentPureReferenceWithCachedProps,
1770
+ ne as persistentReference,
1771
+ ie as persistentReferenceAt,
1772
+ oe as persistentReferenceWithCachedProps,
1773
+ K as registerCloudStorage,
1774
+ ue as registerLegacyClassName,
1775
+ Z as registerPersistentClass,
1776
+ ye as replaceValue,
1777
+ le as required,
1778
+ de as requiredWithValidator,
1779
+ he as searchableArray,
1780
+ Pe as snakeCase
1777
1781
  };
1778
1782
  //# sourceMappingURL=entropic-bond.js.map