entropic-bond 1.55.2 → 1.55.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 +32 -31
- package/lib/entropic-bond.js.map +1 -1
- package/lib/entropic-bond.umd.cjs +1 -1
- package/lib/entropic-bond.umd.cjs.map +1 -1
- package/lib/store/cached-props-updater.d.ts +2 -2
- package/lib/store/data-source.d.ts +3 -3
- package/lib/store/json-data-source.d.ts +3 -2
- package/package.json +4 -11
package/lib/entropic-bond.js
CHANGED
|
@@ -942,7 +942,7 @@ class ee {
|
|
|
942
942
|
return this.queryObject;
|
|
943
943
|
}
|
|
944
944
|
}
|
|
945
|
-
const
|
|
945
|
+
const v = class v {
|
|
946
946
|
constructor() {
|
|
947
947
|
}
|
|
948
948
|
/**
|
|
@@ -958,7 +958,7 @@ const w = class w {
|
|
|
958
958
|
* @returns the data source
|
|
959
959
|
*/
|
|
960
960
|
static get dataSource() {
|
|
961
|
-
return
|
|
961
|
+
return v._dataSource;
|
|
962
962
|
}
|
|
963
963
|
/**
|
|
964
964
|
* Retrieves a model for a collection
|
|
@@ -966,8 +966,8 @@ const w = class w {
|
|
|
966
966
|
* @returns the model for the collection
|
|
967
967
|
*/
|
|
968
968
|
static getModel(e) {
|
|
969
|
-
if (!
|
|
970
|
-
return new R(
|
|
969
|
+
if (!v._dataSource) throw new Error(this.error.shouldBeRegistered);
|
|
970
|
+
return new R(v._dataSource, e);
|
|
971
971
|
}
|
|
972
972
|
/**
|
|
973
973
|
* Retrieves a model for a subcollection
|
|
@@ -976,8 +976,8 @@ const w = class w {
|
|
|
976
976
|
* @returns the model for the subcollection
|
|
977
977
|
*/
|
|
978
978
|
static getModelForSubCollection(e, t) {
|
|
979
|
-
if (!
|
|
980
|
-
return new R(
|
|
979
|
+
if (!v._dataSource) throw new Error(this.error.shouldBeRegistered);
|
|
980
|
+
return new R(v._dataSource, e, t);
|
|
981
981
|
}
|
|
982
982
|
/**
|
|
983
983
|
* Populates property references with actual data from the store.
|
|
@@ -1009,8 +1009,8 @@ const w = class w {
|
|
|
1009
1009
|
) : e.__documentReference === void 0;
|
|
1010
1010
|
}
|
|
1011
1011
|
};
|
|
1012
|
-
|
|
1013
|
-
let M =
|
|
1012
|
+
v.error = { shouldBeRegistered: "You should register a data source before using the data Store." };
|
|
1013
|
+
let M = v;
|
|
1014
1014
|
class k {
|
|
1015
1015
|
constructor(e) {
|
|
1016
1016
|
this.handlers = [], this.subscribeToDocumentChangeListener = () => {
|
|
@@ -1019,7 +1019,7 @@ class k {
|
|
|
1019
1019
|
throw new Error("The method collectionsMatchingTemplate has not been implemented in the concrete data source");
|
|
1020
1020
|
}, e && (this.beforeUpdate = e.beforeUpdateDocument, this.afterUpdate = e.afterUpdateDocument, this.onAllPropsUpdatedCallback = e.onAllPropsUpdated);
|
|
1021
1021
|
}
|
|
1022
|
-
|
|
1022
|
+
installUpdaters() {
|
|
1023
1023
|
const e = l.getSystemRegisteredReferencesWithCachedProps(), t = {};
|
|
1024
1024
|
return Object.entries(e).forEach(([r, s]) => {
|
|
1025
1025
|
s.forEach((n) => {
|
|
@@ -1028,14 +1028,14 @@ class k {
|
|
|
1028
1028
|
t[a] || (t[a] = []), t[a].push(n);
|
|
1029
1029
|
});
|
|
1030
1030
|
});
|
|
1031
|
-
}), this.handlers = [],
|
|
1032
|
-
const n =
|
|
1031
|
+
}), this.handlers = [], Object.entries(t).forEach(([r, s]) => {
|
|
1032
|
+
const n = this.subscribeToDocumentChangeListener(
|
|
1033
1033
|
r,
|
|
1034
1034
|
(o) => this.onDocumentChange(o, s)
|
|
1035
1035
|
);
|
|
1036
1036
|
if (n) this.handlers.push(n);
|
|
1037
1037
|
else throw new Error("The method documentChangeListener has not been implemented in the concrete data source");
|
|
1038
|
-
})
|
|
1038
|
+
}), this.handlers;
|
|
1039
1039
|
}
|
|
1040
1040
|
uninstallUpdaters() {
|
|
1041
1041
|
this.handlers.forEach((e) => e.uninstall()), this.handlers = [];
|
|
@@ -1095,8 +1095,8 @@ class b {
|
|
|
1095
1095
|
constructor() {
|
|
1096
1096
|
this._cachedPropsUpdater = void 0;
|
|
1097
1097
|
}
|
|
1098
|
-
|
|
1099
|
-
return this._cachedPropsUpdater = new k(e), this._cachedPropsUpdater.documentChangeListenerSubscriber = this.subscribeToDocumentChangeListener.bind(this), this._cachedPropsUpdater.collectionsMatchingTemplateFunction = this.
|
|
1098
|
+
installCachedPropsUpdater(e) {
|
|
1099
|
+
return this._cachedPropsUpdater = new k(e), this._cachedPropsUpdater.documentChangeListenerSubscriber = this.subscribeToDocumentChangeListener.bind(this), this._cachedPropsUpdater.collectionsMatchingTemplateFunction = this.resolveCollectionPaths.bind(this), this._cachedPropsUpdater.installUpdaters();
|
|
1100
1100
|
}
|
|
1101
1101
|
uninstallCachedPropsUpdater() {
|
|
1102
1102
|
this._cachedPropsUpdater?.uninstallUpdaters(), this._cachedPropsUpdater = void 0;
|
|
@@ -1267,8 +1267,8 @@ class ye extends b {
|
|
|
1267
1267
|
delete: e
|
|
1268
1268
|
} : this._simulateError = e, this);
|
|
1269
1269
|
}
|
|
1270
|
-
|
|
1271
|
-
const r =
|
|
1270
|
+
subscribeToDocumentChangeListener(e, t) {
|
|
1271
|
+
const r = this.collectionsMatchingTemplate(e), s = Math.random().toString(36).substring(2, 9);
|
|
1272
1272
|
return r.forEach((n) => {
|
|
1273
1273
|
let o = this._serverCollectionListeners[n];
|
|
1274
1274
|
o || (o = this._serverCollectionListeners[n] = {}), o[s] = (a) => {
|
|
@@ -1358,18 +1358,19 @@ class ye extends b {
|
|
|
1358
1358
|
() => this._pendingPromises = this._pendingPromises.filter((r) => r === t)
|
|
1359
1359
|
), t;
|
|
1360
1360
|
}
|
|
1361
|
+
resolveCollectionPaths(e) {
|
|
1362
|
+
return Promise.resolve(this.collectionsMatchingTemplate(e));
|
|
1363
|
+
}
|
|
1361
1364
|
collectionsMatchingTemplate(e) {
|
|
1362
|
-
return
|
|
1363
|
-
Object.keys(this._jsonRawData).filter((t) => b.isStringMatchingTemplate(e, t))
|
|
1364
|
-
);
|
|
1365
|
+
return Object.keys(this._jsonRawData).filter((t) => b.isStringMatchingTemplate(e, t));
|
|
1365
1366
|
}
|
|
1366
1367
|
}
|
|
1367
|
-
const
|
|
1368
|
+
const w = class w {
|
|
1368
1369
|
static registerCloudStorage(e, t) {
|
|
1369
|
-
|
|
1370
|
+
w._cloudStorageFactoryMap[e] = t;
|
|
1370
1371
|
}
|
|
1371
1372
|
static createInstance(e) {
|
|
1372
|
-
const t =
|
|
1373
|
+
const t = w._cloudStorageFactoryMap[e];
|
|
1373
1374
|
if (!t)
|
|
1374
1375
|
throw new Error(`You should register the ${e} cloud storage provider prior to use it`);
|
|
1375
1376
|
return t();
|
|
@@ -1378,16 +1379,16 @@ const v = class v {
|
|
|
1378
1379
|
return this.__className;
|
|
1379
1380
|
}
|
|
1380
1381
|
static useCloudStorage(e) {
|
|
1381
|
-
|
|
1382
|
+
w._defaultCloudStorage = e;
|
|
1382
1383
|
}
|
|
1383
1384
|
static get defaultCloudStorage() {
|
|
1384
|
-
if (!
|
|
1385
|
+
if (!w._defaultCloudStorage)
|
|
1385
1386
|
throw new Error("You should define a default cloud storage provider prior to use it");
|
|
1386
|
-
return
|
|
1387
|
+
return w._defaultCloudStorage;
|
|
1387
1388
|
}
|
|
1388
1389
|
};
|
|
1389
|
-
|
|
1390
|
-
let D =
|
|
1390
|
+
w._cloudStorageFactoryMap = {};
|
|
1391
|
+
let D = w;
|
|
1391
1392
|
function te(i, e) {
|
|
1392
1393
|
return D.registerCloudStorage(i, e), (t) => {
|
|
1393
1394
|
t.prototype.__className = i;
|
|
@@ -1791,7 +1792,7 @@ const m = class m extends B {
|
|
|
1791
1792
|
};
|
|
1792
1793
|
m.error = { shouldBeRegistered: "You should register a Server Auth service before using the Server Auth." }, m._instance = void 0;
|
|
1793
1794
|
let $ = m;
|
|
1794
|
-
class
|
|
1795
|
+
class ve extends B {
|
|
1795
1796
|
constructor(e) {
|
|
1796
1797
|
super(), this._userCredentials = e;
|
|
1797
1798
|
}
|
|
@@ -1817,7 +1818,7 @@ class we extends B {
|
|
|
1817
1818
|
return this._userCredentials;
|
|
1818
1819
|
}
|
|
1819
1820
|
}
|
|
1820
|
-
function
|
|
1821
|
+
function we(i, e) {
|
|
1821
1822
|
return i ? i.replace(/\${\s*(\w*)\s*}/g, function(t, r) {
|
|
1822
1823
|
return e[r] || "";
|
|
1823
1824
|
}) : "";
|
|
@@ -1852,7 +1853,7 @@ export {
|
|
|
1852
1853
|
l as Persistent,
|
|
1853
1854
|
ee as Query,
|
|
1854
1855
|
$ as ServerAuth,
|
|
1855
|
-
|
|
1856
|
+
ve as ServerAuthMock,
|
|
1856
1857
|
B as ServerAuthService,
|
|
1857
1858
|
M as Store,
|
|
1858
1859
|
S as StoredFile,
|
|
@@ -1869,7 +1870,7 @@ export {
|
|
|
1869
1870
|
te as registerCloudStorage,
|
|
1870
1871
|
de as registerLegacyClassName,
|
|
1871
1872
|
X as registerPersistentClass,
|
|
1872
|
-
|
|
1873
|
+
we as replaceValue,
|
|
1873
1874
|
pe as required,
|
|
1874
1875
|
me as requiredWithValidator,
|
|
1875
1876
|
fe as searchableArray,
|