entropic-bond 1.51.2 → 1.51.4
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
|
}, {});
|
|
@@ -1150,7 +1152,8 @@ class fe extends D {
|
|
|
1150
1152
|
if (r)
|
|
1151
1153
|
return delete this._listener[r], this._listener[r] = t, {
|
|
1152
1154
|
uninstall: () => delete this._listener[r],
|
|
1153
|
-
nativeHandler: t
|
|
1155
|
+
nativeHandler: t,
|
|
1156
|
+
collectionPath: r
|
|
1154
1157
|
};
|
|
1155
1158
|
}
|
|
1156
1159
|
notifyChange(e, t, r) {
|
|
@@ -1191,7 +1194,7 @@ class fe extends D {
|
|
|
1191
1194
|
"<=": (a, u) => a <= u,
|
|
1192
1195
|
">": (a, u) => a > u,
|
|
1193
1196
|
">=": (a, u) => a >= u,
|
|
1194
|
-
containsAny: (a, u) => a == null ? void 0 : a.some((
|
|
1197
|
+
containsAny: (a, u) => a == null ? void 0 : a.some((P) => u == null ? void 0 : u.includes(P)),
|
|
1195
1198
|
contains: (a, u) => a == null ? void 0 : a.includes(u)
|
|
1196
1199
|
}, { property: s, value: n, operator: o } = t, [c, h] = this.retrieveValuesToCompare(e, s, n);
|
|
1197
1200
|
return r[o](c, h);
|
|
@@ -1218,12 +1221,12 @@ class fe extends D {
|
|
|
1218
1221
|
), t;
|
|
1219
1222
|
}
|
|
1220
1223
|
}
|
|
1221
|
-
const
|
|
1224
|
+
const v = class v {
|
|
1222
1225
|
static registerCloudStorage(e, t) {
|
|
1223
|
-
|
|
1226
|
+
v._cloudStorageFactoryMap[e] = t;
|
|
1224
1227
|
}
|
|
1225
1228
|
static createInstance(e) {
|
|
1226
|
-
const t =
|
|
1229
|
+
const t = v._cloudStorageFactoryMap[e];
|
|
1227
1230
|
if (!t)
|
|
1228
1231
|
throw new Error(`You should register the ${e} cloud storage provider prior to use it`);
|
|
1229
1232
|
return t();
|
|
@@ -1232,16 +1235,16 @@ const P = class P {
|
|
|
1232
1235
|
return this.__className;
|
|
1233
1236
|
}
|
|
1234
1237
|
static useCloudStorage(e) {
|
|
1235
|
-
|
|
1238
|
+
v._defaultCloudStorage = e;
|
|
1236
1239
|
}
|
|
1237
1240
|
static get defaultCloudStorage() {
|
|
1238
|
-
if (!
|
|
1241
|
+
if (!v._defaultCloudStorage)
|
|
1239
1242
|
throw new Error("You should define a default cloud storage provider prior to use it");
|
|
1240
|
-
return
|
|
1243
|
+
return v._defaultCloudStorage;
|
|
1241
1244
|
}
|
|
1242
1245
|
};
|
|
1243
|
-
|
|
1244
|
-
let w =
|
|
1246
|
+
v._cloudStorageFactoryMap = {};
|
|
1247
|
+
let w = v;
|
|
1245
1248
|
function Z(i, e) {
|
|
1246
1249
|
return w.registerCloudStorage(i, e), (t) => {
|
|
1247
1250
|
t.prototype.__className = i;
|
|
@@ -1692,13 +1695,13 @@ function ye(i) {
|
|
|
1692
1695
|
(e) => e.toUpperCase().replace("-", "").replace("_", "").replace(" ", "")
|
|
1693
1696
|
) : "";
|
|
1694
1697
|
}
|
|
1695
|
-
function
|
|
1698
|
+
function ve(i, e = "-") {
|
|
1696
1699
|
if (!i)
|
|
1697
1700
|
return "";
|
|
1698
1701
|
const t = i.slice(1).replace(/( |[A-Z])/g, (r) => r === " " ? "-" : e + r[0].toLowerCase());
|
|
1699
1702
|
return i[0].toLocaleLowerCase() + t.replace(/--/g, "-");
|
|
1700
1703
|
}
|
|
1701
|
-
function
|
|
1704
|
+
function Pe(i, e) {
|
|
1702
1705
|
return e.split(".").reduce((t, r) => t[r], i);
|
|
1703
1706
|
}
|
|
1704
1707
|
export {
|
|
@@ -1723,14 +1726,14 @@ export {
|
|
|
1723
1726
|
b as StoredFile,
|
|
1724
1727
|
re as StoredFileEvent,
|
|
1725
1728
|
ye as camelCase,
|
|
1726
|
-
|
|
1729
|
+
Pe as getDeepValue,
|
|
1727
1730
|
S as persistent,
|
|
1728
1731
|
_ as persistentParser,
|
|
1729
1732
|
oe as persistentPureReference,
|
|
1730
|
-
ae as
|
|
1733
|
+
ae as persistentPureReferenceWithCachedProps,
|
|
1731
1734
|
ie as persistentReference,
|
|
1732
1735
|
se as persistentReferenceAt,
|
|
1733
|
-
ne as
|
|
1736
|
+
ne as persistentReferenceWithCachedProps,
|
|
1734
1737
|
Z as registerCloudStorage,
|
|
1735
1738
|
ce as registerLegacyClassName,
|
|
1736
1739
|
H as registerPersistentClass,
|
|
@@ -1738,6 +1741,6 @@ export {
|
|
|
1738
1741
|
he as required,
|
|
1739
1742
|
le as requiredWithValidator,
|
|
1740
1743
|
ue as searchableArray,
|
|
1741
|
-
|
|
1744
|
+
ve as snakeCase
|
|
1742
1745
|
};
|
|
1743
1746
|
//# sourceMappingURL=entropic-bond.js.map
|