entropic-bond 1.51.4 → 1.51.5
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
|
@@ -45,7 +45,7 @@ class F {
|
|
|
45
45
|
}
|
|
46
46
|
let j;
|
|
47
47
|
const x = new Uint8Array(16);
|
|
48
|
-
function
|
|
48
|
+
function L() {
|
|
49
49
|
if (!j && (j = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !j))
|
|
50
50
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
51
51
|
return j(x);
|
|
@@ -53,24 +53,24 @@ function B() {
|
|
|
53
53
|
const f = [];
|
|
54
54
|
for (let i = 0; i < 256; ++i)
|
|
55
55
|
f.push((i + 256).toString(16).slice(1));
|
|
56
|
-
function
|
|
56
|
+
function B(i, e = 0) {
|
|
57
57
|
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]];
|
|
58
58
|
}
|
|
59
|
-
const
|
|
60
|
-
randomUUID:
|
|
59
|
+
const W = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), I = {
|
|
60
|
+
randomUUID: W
|
|
61
61
|
};
|
|
62
62
|
function Q(i, e, t) {
|
|
63
63
|
if (I.randomUUID && !e && !i)
|
|
64
64
|
return I.randomUUID();
|
|
65
65
|
i = i || {};
|
|
66
|
-
const r = i.random || (i.rng ||
|
|
66
|
+
const r = i.random || (i.rng || L)();
|
|
67
67
|
if (r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, e) {
|
|
68
68
|
t = t || 0;
|
|
69
69
|
for (let s = 0; s < 16; ++s)
|
|
70
70
|
e[t + s] = r[s];
|
|
71
71
|
return e;
|
|
72
72
|
}
|
|
73
|
-
return
|
|
73
|
+
return B(r);
|
|
74
74
|
}
|
|
75
75
|
var q = Object.defineProperty, Y = Object.getOwnPropertyDescriptor, z = (i, e, t, r) => {
|
|
76
76
|
for (var s = r > 1 ? void 0 : r ? Y(e, t) : e, n = i.length - 1, o; n >= 0; n--)
|
|
@@ -643,7 +643,7 @@ const E = class E {
|
|
|
643
643
|
return e;
|
|
644
644
|
const t = ((r = e.operations) == null ? void 0 : r.map((s) => {
|
|
645
645
|
const n = s.value[0] ?? s.value;
|
|
646
|
-
return
|
|
646
|
+
return O.isArrayOperator(s.operator) && n instanceof l ? {
|
|
647
647
|
property: l.searchableArrayNameFor(s.property),
|
|
648
648
|
operator: s.operator,
|
|
649
649
|
value: Array.isArray(s.value) ? s.value.map((o) => o.id) : n.id,
|
|
@@ -690,10 +690,10 @@ class J {
|
|
|
690
690
|
* @see orDeepProp
|
|
691
691
|
*/
|
|
692
692
|
where(e, t, r, s) {
|
|
693
|
-
var n, o,
|
|
693
|
+
var n, o, a;
|
|
694
694
|
if ((o = (n = this.queryObject.operations) == null ? void 0 : n.at(-1)) != null && o.aggregate && !s)
|
|
695
695
|
throw new Error(C.error.invalidQueryOrder);
|
|
696
|
-
return (
|
|
696
|
+
return (a = this.queryObject.operations) == null || a.push({
|
|
697
697
|
property: e,
|
|
698
698
|
operator: t,
|
|
699
699
|
value: r,
|
|
@@ -725,17 +725,17 @@ class J {
|
|
|
725
725
|
* @see orDeepProp
|
|
726
726
|
*/
|
|
727
727
|
whereDeepProp(e, t, r, s) {
|
|
728
|
-
var h,
|
|
729
|
-
if ((
|
|
728
|
+
var h, c, u;
|
|
729
|
+
if ((c = (h = this.queryObject.operations) == null ? void 0 : h.at(-1)) != null && c.aggregate && !s)
|
|
730
730
|
throw new Error(C.error.invalidQueryOrder);
|
|
731
731
|
const n = e.split(".");
|
|
732
|
-
let o = {},
|
|
733
|
-
return n.slice(1).forEach((P,
|
|
734
|
-
o[P] =
|
|
732
|
+
let o = {}, a = n.length > 1 ? o : r;
|
|
733
|
+
return n.slice(1).forEach((P, R) => {
|
|
734
|
+
o[P] = R < 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,
|
|
738
|
-
value:
|
|
738
|
+
value: a,
|
|
739
739
|
aggregate: s
|
|
740
740
|
}), this;
|
|
741
741
|
}
|
|
@@ -962,21 +962,21 @@ const y = class y {
|
|
|
962
962
|
};
|
|
963
963
|
y.error = { shouldBeRegistered: "You should register a data source before using the data Store." };
|
|
964
964
|
let A = y;
|
|
965
|
-
class
|
|
966
|
-
installCachedPropsUpdaters(e
|
|
967
|
-
this.onUpdate = e;
|
|
968
|
-
const
|
|
969
|
-
return Object.entries(
|
|
970
|
-
|
|
971
|
-
if (!
|
|
965
|
+
class O {
|
|
966
|
+
installCachedPropsUpdaters(e = {}) {
|
|
967
|
+
this.onUpdate = e.onUpdate;
|
|
968
|
+
const t = [], r = O.getSystemRegisteredReferencesWithStoredProps();
|
|
969
|
+
return Object.entries(r).forEach(([s, n]) => {
|
|
970
|
+
n.forEach((o) => {
|
|
971
|
+
if (!o.storeInCollection)
|
|
972
972
|
return;
|
|
973
|
-
|
|
974
|
-
if (h)
|
|
975
|
-
|
|
976
|
-
else if (
|
|
973
|
+
let a;
|
|
974
|
+
if (e.documentChangeListerner ? a = e.documentChangeListerner(o, (h) => this.onDocumentChange(h, o, s)) : a = this.subscribeToDocumentChangeListerner(o, (h) => this.onDocumentChange(h, o, s)), a)
|
|
975
|
+
t.push(a);
|
|
976
|
+
else if (e.noThrowOnNonImplementedListener)
|
|
977
977
|
throw new Error("The method documentChangeListerner has not been implemented in the concrete data source");
|
|
978
978
|
});
|
|
979
|
-
}),
|
|
979
|
+
}), t;
|
|
980
980
|
}
|
|
981
981
|
/**
|
|
982
982
|
* Installs a document change listener
|
|
@@ -1003,7 +1003,7 @@ class D {
|
|
|
1003
1003
|
*/
|
|
1004
1004
|
static toPropertyPathOperations(e) {
|
|
1005
1005
|
return e ? e.map((t) => {
|
|
1006
|
-
if (
|
|
1006
|
+
if (O.isArrayOperator(t.operator) && t.value[0] instanceof l)
|
|
1007
1007
|
return {
|
|
1008
1008
|
property: l.searchableArrayNameFor(t.property),
|
|
1009
1009
|
operator: t.operator,
|
|
@@ -1034,18 +1034,18 @@ class D {
|
|
|
1034
1034
|
return;
|
|
1035
1035
|
const s = A.getModel(r);
|
|
1036
1036
|
let n = s.find();
|
|
1037
|
-
t.cachedProps.forEach((
|
|
1038
|
-
const h = e.before[
|
|
1039
|
-
h !==
|
|
1037
|
+
t.cachedProps.forEach((a) => {
|
|
1038
|
+
const h = e.before[a], c = e.after[a];
|
|
1039
|
+
h !== c && (n = n.orDeepProp(`${t.name}.${a}`, "==", h));
|
|
1040
1040
|
});
|
|
1041
1041
|
const o = await n.get();
|
|
1042
1042
|
return Promise.all([
|
|
1043
|
-
o.map(async (
|
|
1043
|
+
o.map(async (a) => {
|
|
1044
1044
|
var h;
|
|
1045
|
-
(h = t.cachedProps) == null || h.forEach(async (
|
|
1046
|
-
var
|
|
1047
|
-
const u = e.before[
|
|
1048
|
-
u !== P && (
|
|
1045
|
+
(h = t.cachedProps) == null || h.forEach(async (c) => {
|
|
1046
|
+
var R;
|
|
1047
|
+
const u = e.before[c], P = e.after[c];
|
|
1048
|
+
u !== P && (a[`_${t.name}`][`_${c}`] = P, await s.save(a), (R = this.onUpdate) == null || R.call(this, a, t, r));
|
|
1049
1049
|
});
|
|
1050
1050
|
})
|
|
1051
1051
|
]);
|
|
@@ -1053,13 +1053,13 @@ class D {
|
|
|
1053
1053
|
static getSystemRegisteredReferencesWithStoredProps() {
|
|
1054
1054
|
return l.registeredClasses().reduce((r, s) => {
|
|
1055
1055
|
const o = l.createInstance(s).getPersistentProperties().filter(
|
|
1056
|
-
(
|
|
1056
|
+
(a) => a.cachedProps
|
|
1057
1057
|
);
|
|
1058
1058
|
return o.length > 0 && (r[s] = o), r;
|
|
1059
1059
|
}, {});
|
|
1060
1060
|
}
|
|
1061
1061
|
}
|
|
1062
|
-
class fe extends
|
|
1062
|
+
class fe extends O {
|
|
1063
1063
|
/**
|
|
1064
1064
|
* @param jsonRawData the JSON object to be used as data store
|
|
1065
1065
|
*/
|
|
@@ -1105,7 +1105,7 @@ class fe extends D {
|
|
|
1105
1105
|
throw new Error(this._simulateError.find);
|
|
1106
1106
|
const r = Object.values(this._jsonRawData[t] || {});
|
|
1107
1107
|
return e ? (this._lastLimit = e.limit || 0, this._cursor = 0, this._lastMatchingDocs = Object.entries(e).reduce(
|
|
1108
|
-
(n, [o,
|
|
1108
|
+
(n, [o, a]) => this.queryProcessor(n, o, a),
|
|
1109
1109
|
Object.values(r)
|
|
1110
1110
|
), this.resolveWithDelay(this._lastMatchingDocs.slice(0, e.limit))) : this.resolveWithDelay(r);
|
|
1111
1111
|
}
|
|
@@ -1171,13 +1171,13 @@ class fe extends D {
|
|
|
1171
1171
|
limit: (n) => e,
|
|
1172
1172
|
//.slice( 0, limit ),
|
|
1173
1173
|
operations: (n) => this.retrieveQueryDocs(e, n),
|
|
1174
|
-
sort: ({ order: n, propertyName: o }) => e.sort((
|
|
1174
|
+
sort: ({ order: n, propertyName: o }) => e.sort((a, h) => n === "asc" ? this.deepValue(a, o) > this.deepValue(h, o) ? 1 : -1 : this.deepValue(a, o) < this.deepValue(h, o) ? 1 : -1)
|
|
1175
1175
|
}[t](r);
|
|
1176
1176
|
}
|
|
1177
1177
|
retrieveQueryDocs(e, t) {
|
|
1178
1178
|
return t.reduce((r, s, n) => {
|
|
1179
1179
|
if (s.aggregate) {
|
|
1180
|
-
const o = e.filter((
|
|
1180
|
+
const o = e.filter((a) => this.isQueryMatched(a, s));
|
|
1181
1181
|
return n === 0 ? o : r.concat(o);
|
|
1182
1182
|
} else
|
|
1183
1183
|
return r.filter((o) => this.isQueryMatched(o, s));
|
|
@@ -1188,22 +1188,22 @@ class fe extends D {
|
|
|
1188
1188
|
}
|
|
1189
1189
|
isQueryMatched(e, t) {
|
|
1190
1190
|
const r = {
|
|
1191
|
-
"==": (
|
|
1192
|
-
"!=": (
|
|
1193
|
-
"<": (
|
|
1194
|
-
"<=": (
|
|
1195
|
-
">": (
|
|
1196
|
-
">=": (
|
|
1197
|
-
containsAny: (
|
|
1198
|
-
contains: (
|
|
1199
|
-
}, { property: s, value: n, operator: o } = t, [
|
|
1200
|
-
return r[o](
|
|
1191
|
+
"==": (c, u) => c === u,
|
|
1192
|
+
"!=": (c, u) => c !== u,
|
|
1193
|
+
"<": (c, u) => c < u,
|
|
1194
|
+
"<=": (c, u) => c <= u,
|
|
1195
|
+
">": (c, u) => c > u,
|
|
1196
|
+
">=": (c, u) => c >= u,
|
|
1197
|
+
containsAny: (c, u) => c == null ? void 0 : c.some((P) => u == null ? void 0 : u.includes(P)),
|
|
1198
|
+
contains: (c, u) => c == null ? void 0 : c.includes(u)
|
|
1199
|
+
}, { property: s, value: n, operator: o } = t, [a, h] = this.retrieveValuesToCompare(e, s, n);
|
|
1200
|
+
return r[o](a, h);
|
|
1201
1201
|
}
|
|
1202
1202
|
retrieveValuesToCompare(e, t, r) {
|
|
1203
1203
|
const s = e[t];
|
|
1204
1204
|
if (s && typeof r == "object" && !Array.isArray(r)) {
|
|
1205
|
-
const
|
|
1206
|
-
var [n, o] = this.retrieveValuesToCompare(s,
|
|
1205
|
+
const a = Object.keys(r)[0];
|
|
1206
|
+
var [n, o] = this.retrieveValuesToCompare(s, a, r == null ? void 0 : r[a]);
|
|
1207
1207
|
}
|
|
1208
1208
|
return [n || s, o || r];
|
|
1209
1209
|
}
|
|
@@ -1307,7 +1307,7 @@ let U = class extends w {
|
|
|
1307
1307
|
U = X([
|
|
1308
1308
|
Z("MockCloudStorage", () => new U())
|
|
1309
1309
|
], U);
|
|
1310
|
-
var ee = Object.defineProperty, te = Object.getOwnPropertyDescriptor,
|
|
1310
|
+
var ee = Object.defineProperty, te = Object.getOwnPropertyDescriptor, D = (i, e, t, r) => {
|
|
1311
1311
|
for (var s = r > 1 ? void 0 : r ? te(e, t) : e, n = i.length - 1, o; n >= 0; n--)
|
|
1312
1312
|
(o = i[n]) && (s = (r ? o(e, t, s) : o(s)) || s);
|
|
1313
1313
|
return r && s && ee(e, t, s), s;
|
|
@@ -1360,22 +1360,22 @@ let b = class extends l {
|
|
|
1360
1360
|
return this._onChange.subscribe(i);
|
|
1361
1361
|
}
|
|
1362
1362
|
};
|
|
1363
|
-
|
|
1363
|
+
D([
|
|
1364
1364
|
S
|
|
1365
1365
|
], b.prototype, "_reference", 2);
|
|
1366
|
-
|
|
1366
|
+
D([
|
|
1367
1367
|
S
|
|
1368
1368
|
], b.prototype, "_url", 2);
|
|
1369
|
-
|
|
1369
|
+
D([
|
|
1370
1370
|
S
|
|
1371
1371
|
], b.prototype, "_cloudStorageProviderName", 2);
|
|
1372
|
-
|
|
1372
|
+
D([
|
|
1373
1373
|
S
|
|
1374
1374
|
], b.prototype, "_originalFileName", 2);
|
|
1375
|
-
|
|
1375
|
+
D([
|
|
1376
1376
|
S
|
|
1377
1377
|
], b.prototype, "_mimeType", 2);
|
|
1378
|
-
b =
|
|
1378
|
+
b = D([
|
|
1379
1379
|
H("StoredFile")
|
|
1380
1380
|
], b);
|
|
1381
1381
|
class M {
|
|
@@ -1513,9 +1513,9 @@ class pe extends M {
|
|
|
1513
1513
|
super(...arguments), this.pendingPromises = [], this._fakeRegisteredUsers = {};
|
|
1514
1514
|
}
|
|
1515
1515
|
signUp(e) {
|
|
1516
|
-
const { verificationLink: t, email: r, password: s, authProvider: n } = e, o = new Promise(async (
|
|
1517
|
-
var
|
|
1518
|
-
n === "email" && (r || h({ code: "missingEmail", message: "missingEmail" }), s || h({ code: "missingPassword", message: "missingPassword" })), s !== "fail" && r !== "fail" ? (this._loggedUser = this.userCredentials(e), this._fakeRegisteredUsers[this._loggedUser.id] = this._loggedUser,
|
|
1516
|
+
const { verificationLink: t, email: r, password: s, authProvider: n } = e, o = new Promise(async (a, h) => {
|
|
1517
|
+
var c, u;
|
|
1518
|
+
n === "email" && (r || h({ code: "missingEmail", message: "missingEmail" }), s || h({ code: "missingPassword", message: "missingPassword" })), s !== "fail" && r !== "fail" ? (this._loggedUser = this.userCredentials(e), this._fakeRegisteredUsers[this._loggedUser.id] = this._loggedUser, a(this._loggedUser), (c = this.notifyChange) == null || c.call(this, this._loggedUser)) : (h({ code: "userNotFound", message: t || "Test auth error" }), (u = this.notifyChange) == null || u.call(this, void 0));
|
|
1519
1519
|
});
|
|
1520
1520
|
return this.pendingPromises.push(o), o;
|
|
1521
1521
|
}
|
|
@@ -1711,7 +1711,7 @@ export {
|
|
|
1711
1711
|
V as CloudFunctions,
|
|
1712
1712
|
me as CloudFunctionsMock,
|
|
1713
1713
|
w as CloudStorage,
|
|
1714
|
-
|
|
1714
|
+
O as DataSource,
|
|
1715
1715
|
de as EntropicComponent,
|
|
1716
1716
|
fe as JsonDataSource,
|
|
1717
1717
|
U as MockCloudStorage,
|