entropic-bond 1.53.12 → 1.53.14
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/lib/entropic-bond.js
CHANGED
|
@@ -59,11 +59,11 @@ function z() {
|
|
|
59
59
|
}
|
|
60
60
|
return U(Y);
|
|
61
61
|
}
|
|
62
|
-
const H = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto),
|
|
62
|
+
const H = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), V = { randomUUID: H };
|
|
63
63
|
function J(i, e, t) {
|
|
64
64
|
var s;
|
|
65
|
-
if (
|
|
66
|
-
return
|
|
65
|
+
if (V.randomUUID && !i)
|
|
66
|
+
return V.randomUUID();
|
|
67
67
|
i = i || {};
|
|
68
68
|
const r = i.random ?? ((s = i.rng) == null ? void 0 : s.call(i)) ?? z();
|
|
69
69
|
if (r.length < 16)
|
|
@@ -82,8 +82,8 @@ const B = (d = class {
|
|
|
82
82
|
* @param factory the constructor of the registered class
|
|
83
83
|
* @param annotation an annotation associated with the class
|
|
84
84
|
*/
|
|
85
|
-
static registerFactory(e, t, r) {
|
|
86
|
-
this._factoryMap[e] = { factory: t, annotation: r };
|
|
85
|
+
static registerFactory(e, t, r, s = !1) {
|
|
86
|
+
this._factoryMap[e] = { factory: t, annotation: r, isLegacy: s };
|
|
87
87
|
}
|
|
88
88
|
/**
|
|
89
89
|
* Returns the constructor of a registered class
|
|
@@ -107,6 +107,15 @@ const B = (d = class {
|
|
|
107
107
|
* @see classFactory
|
|
108
108
|
*/
|
|
109
109
|
static registeredClasses() {
|
|
110
|
+
return Object.entries(this._factoryMap).filter(([, e]) => !e.isLegacy).map(([e]) => e);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Returns the names of all registered classes, including legacy names
|
|
114
|
+
* @returns the names of all registered classes, including legacy names
|
|
115
|
+
* @see registerFactory
|
|
116
|
+
* @see classFactory
|
|
117
|
+
*/
|
|
118
|
+
static registeredClassesAndLegacyNames() {
|
|
110
119
|
return Object.keys(this._factoryMap);
|
|
111
120
|
}
|
|
112
121
|
/**
|
|
@@ -117,7 +126,7 @@ const B = (d = class {
|
|
|
117
126
|
* @see classFactory
|
|
118
127
|
*/
|
|
119
128
|
static classesExtending(e) {
|
|
120
|
-
return Object.entries(this._factoryMap).filter(([, t]) => new t.factory() instanceof e).map(([t]) => t);
|
|
129
|
+
return Object.entries(this._factoryMap).filter(([, t]) => new t.factory() instanceof e && !t.isLegacy).map(([t]) => t);
|
|
121
130
|
}
|
|
122
131
|
/**
|
|
123
132
|
* Returns the annotation associated with a registered class
|
|
@@ -261,7 +270,7 @@ const B = (d = class {
|
|
|
261
270
|
if (!this._persistentProperties) return {};
|
|
262
271
|
this.beforeSerialize();
|
|
263
272
|
const t = {};
|
|
264
|
-
if (!this.className) throw new Error(
|
|
273
|
+
if (!this.className) throw new Error(`You should register \`${this.constructor.name || this.toString() || "this"}\` class prior to streaming it.`);
|
|
265
274
|
return this._persistentProperties.forEach((r) => {
|
|
266
275
|
const s = this[r.name], n = this.removeUnderscore(r);
|
|
267
276
|
s != null && (r.isReference ? t[n] = this.toReferenceObj(r, e) : t[n] = this.toDeepObj(s, e), r.searchableArray && (t[d.searchableArrayNameFor(n)] = s.map((o) => o.id)));
|
|
@@ -364,7 +373,7 @@ const B = (d = class {
|
|
|
364
373
|
* @returns the references collection
|
|
365
374
|
*/
|
|
366
375
|
static getSystemRegisteredReferencesWithCachedProps() {
|
|
367
|
-
return d.
|
|
376
|
+
return d.registeredClassesAndLegacyNames().reduce((r, s) => {
|
|
368
377
|
const o = d.createInstance(s).getPersistentProperties().filter(
|
|
369
378
|
(c) => {
|
|
370
379
|
var h;
|
|
@@ -376,10 +385,10 @@ const B = (d = class {
|
|
|
376
385
|
}
|
|
377
386
|
}, d._factoryMap = {}, d);
|
|
378
387
|
G([
|
|
379
|
-
|
|
388
|
+
R
|
|
380
389
|
], B.prototype, "_id");
|
|
381
390
|
let l = B;
|
|
382
|
-
function
|
|
391
|
+
function R(i, e) {
|
|
383
392
|
return y()(i, e);
|
|
384
393
|
}
|
|
385
394
|
function oe(i) {
|
|
@@ -436,7 +445,7 @@ function K(i, e) {
|
|
|
436
445
|
}
|
|
437
446
|
function le(i) {
|
|
438
447
|
return (e) => {
|
|
439
|
-
l.registerFactory(i, e);
|
|
448
|
+
l.registerFactory(i, e, void 0, !0);
|
|
440
449
|
};
|
|
441
450
|
}
|
|
442
451
|
function de(i, e) {
|
|
@@ -674,7 +683,7 @@ const E = class E {
|
|
|
674
683
|
if (Object.values(e).length === 0) return e;
|
|
675
684
|
const t = ((r = e.operations) == null ? void 0 : r.map((s) => {
|
|
676
685
|
const n = s.value[0] ?? s.value;
|
|
677
|
-
return
|
|
686
|
+
return S.isArrayOperator(s.operator) && n instanceof l ? {
|
|
678
687
|
property: l.searchableArrayNameFor(s.property),
|
|
679
688
|
operator: s.operator,
|
|
680
689
|
value: Array.isArray(s.value) ? s.value.map((o) => o.id) : n.id,
|
|
@@ -696,7 +705,7 @@ E.error = {
|
|
|
696
705
|
persistentNeedForSubCollection: "The document parameter for a sub-collection should be a Persistent instace",
|
|
697
706
|
invalidQueryOrder: "Cannot add where calls after or calls"
|
|
698
707
|
};
|
|
699
|
-
let
|
|
708
|
+
let O = E;
|
|
700
709
|
class X {
|
|
701
710
|
constructor(e) {
|
|
702
711
|
this.queryObject = { operations: [] }, this.model = e;
|
|
@@ -722,7 +731,7 @@ class X {
|
|
|
722
731
|
*/
|
|
723
732
|
where(e, t, r, s) {
|
|
724
733
|
var n, o, c;
|
|
725
|
-
if ((o = (n = this.queryObject.operations) == null ? void 0 : n.at(-1)) != null && o.aggregate && !s) throw new Error(
|
|
734
|
+
if ((o = (n = this.queryObject.operations) == null ? void 0 : n.at(-1)) != null && o.aggregate && !s) throw new Error(O.error.invalidQueryOrder);
|
|
726
735
|
return (c = this.queryObject.operations) == null || c.push({
|
|
727
736
|
property: e,
|
|
728
737
|
operator: t,
|
|
@@ -756,7 +765,7 @@ class X {
|
|
|
756
765
|
*/
|
|
757
766
|
whereDeepProp(e, t, r, s) {
|
|
758
767
|
var h, a, u;
|
|
759
|
-
if ((a = (h = this.queryObject.operations) == null ? void 0 : h.at(-1)) != null && a.aggregate && !s) throw new Error(
|
|
768
|
+
if ((a = (h = this.queryObject.operations) == null ? void 0 : h.at(-1)) != null && a.aggregate && !s) throw new Error(O.error.invalidQueryOrder);
|
|
760
769
|
const n = e.split(".");
|
|
761
770
|
let o = {}, c = n.length > 1 ? o : r;
|
|
762
771
|
return n.slice(1).forEach((g, v) => {
|
|
@@ -946,7 +955,7 @@ const P = class P {
|
|
|
946
955
|
*/
|
|
947
956
|
static getModel(e) {
|
|
948
957
|
if (!P._dataSource) throw new Error(this.error.shouldBeRegistered);
|
|
949
|
-
return new
|
|
958
|
+
return new O(P._dataSource, e);
|
|
950
959
|
}
|
|
951
960
|
/**
|
|
952
961
|
* Retrieves a model for a subcollection
|
|
@@ -956,7 +965,7 @@ const P = class P {
|
|
|
956
965
|
*/
|
|
957
966
|
static getModelForSubCollection(e, t) {
|
|
958
967
|
if (!P._dataSource) throw new Error(this.error.shouldBeRegistered);
|
|
959
|
-
return new
|
|
968
|
+
return new O(P._dataSource, e, t);
|
|
960
969
|
}
|
|
961
970
|
/**
|
|
962
971
|
* Populates property references with actual data from the store.
|
|
@@ -990,9 +999,9 @@ const P = class P {
|
|
|
990
999
|
};
|
|
991
1000
|
P.error = { shouldBeRegistered: "You should register a data source before using the data Store." };
|
|
992
1001
|
let F = P;
|
|
993
|
-
class
|
|
1002
|
+
class S {
|
|
994
1003
|
installCachedPropsUpdaters(e = {}) {
|
|
995
|
-
|
|
1004
|
+
S.onUpdate = e.onUpdate;
|
|
996
1005
|
const t = l.getSystemRegisteredReferencesWithCachedProps(), r = {};
|
|
997
1006
|
Object.entries(t).forEach(([n, o]) => {
|
|
998
1007
|
o.forEach((c) => {
|
|
@@ -1005,7 +1014,7 @@ class R {
|
|
|
1005
1014
|
});
|
|
1006
1015
|
const s = [];
|
|
1007
1016
|
return Object.entries(r).forEach(([n, o]) => {
|
|
1008
|
-
const c = this.subscribeToDocumentChangeListerner(n, (h) =>
|
|
1017
|
+
const c = this.subscribeToDocumentChangeListerner(n, (h) => S.processDocumentChange(h, o));
|
|
1009
1018
|
if (c)
|
|
1010
1019
|
s.push(c);
|
|
1011
1020
|
else if (e.noThrowOnNonImplementedListener) throw new Error("The method documentChangeListerner has not been implemented in the concrete data source");
|
|
@@ -1037,7 +1046,7 @@ class R {
|
|
|
1037
1046
|
*/
|
|
1038
1047
|
static toPropertyPathOperations(e) {
|
|
1039
1048
|
return e ? e.map((t) => {
|
|
1040
|
-
if (
|
|
1049
|
+
if (S.isArrayOperator(t.operator) && t.value[0] instanceof l)
|
|
1041
1050
|
return {
|
|
1042
1051
|
property: l.searchableArrayNameFor(t.property),
|
|
1043
1052
|
operator: t.operator,
|
|
@@ -1079,16 +1088,16 @@ class R {
|
|
|
1079
1088
|
o.map(async (a) => {
|
|
1080
1089
|
var u, g;
|
|
1081
1090
|
(g = (u = r.prop.cachedPropsConfig) == null ? void 0 : u.cachedProps) == null || g.forEach(async (v) => {
|
|
1082
|
-
var
|
|
1083
|
-
const j = (
|
|
1084
|
-
j !==
|
|
1091
|
+
var k, L, M;
|
|
1092
|
+
const j = (k = e.before) == null ? void 0 : k[v], N = (L = e.after) == null ? void 0 : L[v];
|
|
1093
|
+
j !== N && (a[`_${r.prop.name}`][`_${v}`] = N, await s.save(a), (M = this.onUpdate) == null || M.call(this, a, r.prop));
|
|
1085
1094
|
});
|
|
1086
1095
|
})
|
|
1087
1096
|
]);
|
|
1088
1097
|
});
|
|
1089
1098
|
}
|
|
1090
1099
|
}
|
|
1091
|
-
class ge extends
|
|
1100
|
+
class ge extends S {
|
|
1092
1101
|
/**
|
|
1093
1102
|
* @param jsonRawData the JSON object to be used as data store
|
|
1094
1103
|
*/
|
|
@@ -1343,7 +1352,7 @@ let A = class extends w {
|
|
|
1343
1352
|
A = re([
|
|
1344
1353
|
ee("MockCloudStorage", () => new A())
|
|
1345
1354
|
], A);
|
|
1346
|
-
var se = Object.defineProperty, ie = Object.getOwnPropertyDescriptor,
|
|
1355
|
+
var se = Object.defineProperty, ie = Object.getOwnPropertyDescriptor, D = (i, e, t, r) => {
|
|
1347
1356
|
for (var s = r > 1 ? void 0 : r ? ie(e, t) : e, n = i.length - 1, o; n >= 0; n--)
|
|
1348
1357
|
(o = i[n]) && (s = (r ? o(e, t, s) : o(s)) || s);
|
|
1349
1358
|
return r && s && se(e, t, s), s;
|
|
@@ -1395,22 +1404,22 @@ let C = class extends l {
|
|
|
1395
1404
|
return this._onChange.subscribe(i);
|
|
1396
1405
|
}
|
|
1397
1406
|
};
|
|
1398
|
-
|
|
1399
|
-
|
|
1407
|
+
D([
|
|
1408
|
+
R
|
|
1400
1409
|
], C.prototype, "_reference", 2);
|
|
1401
|
-
|
|
1402
|
-
|
|
1410
|
+
D([
|
|
1411
|
+
R
|
|
1403
1412
|
], C.prototype, "_url", 2);
|
|
1404
|
-
|
|
1405
|
-
|
|
1413
|
+
D([
|
|
1414
|
+
R
|
|
1406
1415
|
], C.prototype, "_cloudStorageProviderName", 2);
|
|
1407
|
-
|
|
1408
|
-
|
|
1416
|
+
D([
|
|
1417
|
+
R
|
|
1409
1418
|
], C.prototype, "_originalFileName", 2);
|
|
1410
|
-
|
|
1411
|
-
|
|
1419
|
+
D([
|
|
1420
|
+
R
|
|
1412
1421
|
], C.prototype, "_mimeType", 2);
|
|
1413
|
-
C =
|
|
1422
|
+
C = D([
|
|
1414
1423
|
K("StoredFile")
|
|
1415
1424
|
], C);
|
|
1416
1425
|
class W {
|
|
@@ -1739,11 +1748,11 @@ export {
|
|
|
1739
1748
|
T as CloudFunctions,
|
|
1740
1749
|
ye as CloudFunctionsMock,
|
|
1741
1750
|
w as CloudStorage,
|
|
1742
|
-
|
|
1751
|
+
S as DataSource,
|
|
1743
1752
|
me as EntropicComponent,
|
|
1744
1753
|
ge as JsonDataSource,
|
|
1745
1754
|
A as MockCloudStorage,
|
|
1746
|
-
|
|
1755
|
+
O as Model,
|
|
1747
1756
|
I as Observable,
|
|
1748
1757
|
l as Persistent,
|
|
1749
1758
|
X as Query,
|
|
@@ -1755,7 +1764,7 @@ export {
|
|
|
1755
1764
|
ne as StoredFileEvent,
|
|
1756
1765
|
be as camelCase,
|
|
1757
1766
|
Ce as getDeepValue,
|
|
1758
|
-
|
|
1767
|
+
R as persistent,
|
|
1759
1768
|
y as persistentParser,
|
|
1760
1769
|
ue as persistentPureReference,
|
|
1761
1770
|
he as persistentPureReferenceWithCachedProps,
|