entropic-bond 1.51.2 → 1.51.3
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
|
@@ -320,7 +320,7 @@ const k = (d = class {
|
|
|
320
320
|
}
|
|
321
321
|
toReferenceObj(e, t) {
|
|
322
322
|
const r = this[e.name];
|
|
323
|
-
return Array.isArray(r) ? r.map((s) => (e.isPureReference || this.pushDocument(t, d.collectionPath(s, e), s), this.buildRefObject(s, d.collectionPath(s, e), e.
|
|
323
|
+
return Array.isArray(r) ? r.map((s) => (e.isPureReference || this.pushDocument(t, d.collectionPath(s, e), s), this.buildRefObject(s, d.collectionPath(s, e), e.cachedProps))) : (e.isPureReference || this.pushDocument(t, d.collectionPath(r, e), r), this.buildRefObject(r, d.collectionPath(r, e), e.cachedProps));
|
|
324
324
|
}
|
|
325
325
|
buildRefObject(e, t, r) {
|
|
326
326
|
const s = r == null ? void 0 : r.reduce((n, o) => (e[o] !== void 0 && (n[o] = e[o]), n), {});
|
|
@@ -389,7 +389,7 @@ function ne(i, e) {
|
|
|
389
389
|
return function(t, r) {
|
|
390
390
|
return _({
|
|
391
391
|
isReference: !0,
|
|
392
|
-
|
|
392
|
+
cachedProps: i,
|
|
393
393
|
storeInCollection: e
|
|
394
394
|
})(t, r);
|
|
395
395
|
};
|
|
@@ -402,7 +402,7 @@ function ae(i, e) {
|
|
|
402
402
|
return _({
|
|
403
403
|
isReference: !0,
|
|
404
404
|
isPureReference: !0,
|
|
405
|
-
|
|
405
|
+
cachedProps: i,
|
|
406
406
|
storeInCollection: e
|
|
407
407
|
})(t, r);
|
|
408
408
|
};
|
|
@@ -730,8 +730,8 @@ class J {
|
|
|
730
730
|
throw new Error(C.error.invalidQueryOrder);
|
|
731
731
|
const n = e.split(".");
|
|
732
732
|
let o = {}, c = n.length > 1 ? o : r;
|
|
733
|
-
return n.slice(1).forEach((
|
|
734
|
-
o[
|
|
733
|
+
return n.slice(1).forEach((P, O) => {
|
|
734
|
+
o[P] = O < n.length - 2 ? {} : r, o = o[P];
|
|
735
735
|
}), (u = this.queryObject.operations) == null || u.push({
|
|
736
736
|
property: n[0],
|
|
737
737
|
operator: t,
|
|
@@ -963,11 +963,13 @@ const y = class y {
|
|
|
963
963
|
y.error = { shouldBeRegistered: "You should register a data source before using the data Store." };
|
|
964
964
|
let A = y;
|
|
965
965
|
class D {
|
|
966
|
-
|
|
966
|
+
installCachedPropsUpdaters(e, t = !0) {
|
|
967
967
|
this.onUpdate = e;
|
|
968
968
|
const r = [], s = D.getSystemRegisteredReferencesWithStoredProps();
|
|
969
969
|
return Object.entries(s).forEach(([n, o]) => {
|
|
970
970
|
o.forEach((c) => {
|
|
971
|
+
if (!c.storeInCollection)
|
|
972
|
+
return;
|
|
971
973
|
const h = this.subscribeToDocumentChangeListerner(c, (a) => this.onDocumentChange(a, c, n));
|
|
972
974
|
if (h)
|
|
973
975
|
r.push(h);
|
|
@@ -1028,11 +1030,11 @@ class D {
|
|
|
1028
1030
|
return [void 0, e];
|
|
1029
1031
|
}
|
|
1030
1032
|
async onDocumentChange(e, t, r) {
|
|
1031
|
-
if (!e.before || !t.
|
|
1033
|
+
if (!e.before || !t.cachedProps)
|
|
1032
1034
|
return;
|
|
1033
1035
|
const s = A.getModel(r);
|
|
1034
1036
|
let n = s.find();
|
|
1035
|
-
t.
|
|
1037
|
+
t.cachedProps.forEach((c) => {
|
|
1036
1038
|
const h = e.before[c], a = e.after[c];
|
|
1037
1039
|
h !== a && (n = n.orDeepProp(`${t.name}.${c}`, "==", h));
|
|
1038
1040
|
});
|
|
@@ -1040,10 +1042,10 @@ class D {
|
|
|
1040
1042
|
return Promise.all([
|
|
1041
1043
|
o.map(async (c) => {
|
|
1042
1044
|
var h;
|
|
1043
|
-
(h = t.
|
|
1045
|
+
(h = t.cachedProps) == null || h.forEach(async (a) => {
|
|
1044
1046
|
var O;
|
|
1045
|
-
const u = e.before[a],
|
|
1046
|
-
u !==
|
|
1047
|
+
const u = e.before[a], P = e.after[a];
|
|
1048
|
+
u !== P && (c[`_${t.name}`][`_${a}`] = P, await s.save(c), (O = this.onUpdate) == null || O.call(this, c));
|
|
1047
1049
|
});
|
|
1048
1050
|
})
|
|
1049
1051
|
]);
|
|
@@ -1051,7 +1053,7 @@ class D {
|
|
|
1051
1053
|
static getSystemRegisteredReferencesWithStoredProps() {
|
|
1052
1054
|
return l.registeredClasses().reduce((r, s) => {
|
|
1053
1055
|
const o = l.createInstance(s).getPersistentProperties().filter(
|
|
1054
|
-
(c) => c.
|
|
1056
|
+
(c) => c.cachedProps
|
|
1055
1057
|
);
|
|
1056
1058
|
return o.length > 0 && (r[s] = o), r;
|
|
1057
1059
|
}, {});
|
|
@@ -1191,7 +1193,7 @@ class fe extends D {
|
|
|
1191
1193
|
"<=": (a, u) => a <= u,
|
|
1192
1194
|
">": (a, u) => a > u,
|
|
1193
1195
|
">=": (a, u) => a >= u,
|
|
1194
|
-
containsAny: (a, u) => a == null ? void 0 : a.some((
|
|
1196
|
+
containsAny: (a, u) => a == null ? void 0 : a.some((P) => u == null ? void 0 : u.includes(P)),
|
|
1195
1197
|
contains: (a, u) => a == null ? void 0 : a.includes(u)
|
|
1196
1198
|
}, { property: s, value: n, operator: o } = t, [c, h] = this.retrieveValuesToCompare(e, s, n);
|
|
1197
1199
|
return r[o](c, h);
|
|
@@ -1218,12 +1220,12 @@ class fe extends D {
|
|
|
1218
1220
|
), t;
|
|
1219
1221
|
}
|
|
1220
1222
|
}
|
|
1221
|
-
const
|
|
1223
|
+
const v = class v {
|
|
1222
1224
|
static registerCloudStorage(e, t) {
|
|
1223
|
-
|
|
1225
|
+
v._cloudStorageFactoryMap[e] = t;
|
|
1224
1226
|
}
|
|
1225
1227
|
static createInstance(e) {
|
|
1226
|
-
const t =
|
|
1228
|
+
const t = v._cloudStorageFactoryMap[e];
|
|
1227
1229
|
if (!t)
|
|
1228
1230
|
throw new Error(`You should register the ${e} cloud storage provider prior to use it`);
|
|
1229
1231
|
return t();
|
|
@@ -1232,16 +1234,16 @@ const P = class P {
|
|
|
1232
1234
|
return this.__className;
|
|
1233
1235
|
}
|
|
1234
1236
|
static useCloudStorage(e) {
|
|
1235
|
-
|
|
1237
|
+
v._defaultCloudStorage = e;
|
|
1236
1238
|
}
|
|
1237
1239
|
static get defaultCloudStorage() {
|
|
1238
|
-
if (!
|
|
1240
|
+
if (!v._defaultCloudStorage)
|
|
1239
1241
|
throw new Error("You should define a default cloud storage provider prior to use it");
|
|
1240
|
-
return
|
|
1242
|
+
return v._defaultCloudStorage;
|
|
1241
1243
|
}
|
|
1242
1244
|
};
|
|
1243
|
-
|
|
1244
|
-
let w =
|
|
1245
|
+
v._cloudStorageFactoryMap = {};
|
|
1246
|
+
let w = v;
|
|
1245
1247
|
function Z(i, e) {
|
|
1246
1248
|
return w.registerCloudStorage(i, e), (t) => {
|
|
1247
1249
|
t.prototype.__className = i;
|
|
@@ -1692,13 +1694,13 @@ function ye(i) {
|
|
|
1692
1694
|
(e) => e.toUpperCase().replace("-", "").replace("_", "").replace(" ", "")
|
|
1693
1695
|
) : "";
|
|
1694
1696
|
}
|
|
1695
|
-
function
|
|
1697
|
+
function ve(i, e = "-") {
|
|
1696
1698
|
if (!i)
|
|
1697
1699
|
return "";
|
|
1698
1700
|
const t = i.slice(1).replace(/( |[A-Z])/g, (r) => r === " " ? "-" : e + r[0].toLowerCase());
|
|
1699
1701
|
return i[0].toLocaleLowerCase() + t.replace(/--/g, "-");
|
|
1700
1702
|
}
|
|
1701
|
-
function
|
|
1703
|
+
function Pe(i, e) {
|
|
1702
1704
|
return e.split(".").reduce((t, r) => t[r], i);
|
|
1703
1705
|
}
|
|
1704
1706
|
export {
|
|
@@ -1723,14 +1725,14 @@ export {
|
|
|
1723
1725
|
b as StoredFile,
|
|
1724
1726
|
re as StoredFileEvent,
|
|
1725
1727
|
ye as camelCase,
|
|
1726
|
-
|
|
1728
|
+
Pe as getDeepValue,
|
|
1727
1729
|
S as persistent,
|
|
1728
1730
|
_ as persistentParser,
|
|
1729
1731
|
oe as persistentPureReference,
|
|
1730
|
-
ae as
|
|
1732
|
+
ae as persistentPureReferenceWithCachedProps,
|
|
1731
1733
|
ie as persistentReference,
|
|
1732
1734
|
se as persistentReferenceAt,
|
|
1733
|
-
ne as
|
|
1735
|
+
ne as persistentReferenceWithCachedProps,
|
|
1734
1736
|
Z as registerCloudStorage,
|
|
1735
1737
|
ce as registerLegacyClassName,
|
|
1736
1738
|
H as registerPersistentClass,
|
|
@@ -1738,6 +1740,6 @@ export {
|
|
|
1738
1740
|
he as required,
|
|
1739
1741
|
le as requiredWithValidator,
|
|
1740
1742
|
ue as searchableArray,
|
|
1741
|
-
|
|
1743
|
+
ve as snakeCase
|
|
1742
1744
|
};
|
|
1743
1745
|
//# sourceMappingURL=entropic-bond.js.map
|