entropic-bond 1.53.21 → 1.53.22
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
|
@@ -46,18 +46,18 @@ class U {
|
|
|
46
46
|
const f = [];
|
|
47
47
|
for (let i = 0; i < 256; ++i)
|
|
48
48
|
f.push((i + 256).toString(16).slice(1));
|
|
49
|
-
function
|
|
49
|
+
function $(i, e = 0) {
|
|
50
50
|
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]]).toLowerCase();
|
|
51
51
|
}
|
|
52
|
-
let
|
|
52
|
+
let R;
|
|
53
53
|
const T = new Uint8Array(16);
|
|
54
54
|
function x() {
|
|
55
|
-
if (!
|
|
55
|
+
if (!R) {
|
|
56
56
|
if (typeof crypto > "u" || !crypto.getRandomValues)
|
|
57
57
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
58
|
-
|
|
58
|
+
R = crypto.getRandomValues.bind(crypto);
|
|
59
59
|
}
|
|
60
|
-
return
|
|
60
|
+
return R(T);
|
|
61
61
|
}
|
|
62
62
|
const B = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), A = { randomUUID: B };
|
|
63
63
|
function Q(i, e, t) {
|
|
@@ -65,7 +65,7 @@ function Q(i, e, t) {
|
|
|
65
65
|
const r = i.random ?? i.rng?.() ?? x();
|
|
66
66
|
if (r.length < 16)
|
|
67
67
|
throw new Error("Random bytes length must be >= 16");
|
|
68
|
-
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128,
|
|
68
|
+
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, $(r);
|
|
69
69
|
}
|
|
70
70
|
function W(i, e, t) {
|
|
71
71
|
return A.randomUUID && !i ? A.randomUUID() : Q(i);
|
|
@@ -75,7 +75,7 @@ var q = Object.defineProperty, Y = (i, e, t, r) => {
|
|
|
75
75
|
(o = i[n]) && (s = o(e, t, s) || s);
|
|
76
76
|
return s && q(e, t, s), s;
|
|
77
77
|
}, l;
|
|
78
|
-
const
|
|
78
|
+
const L = (l = class {
|
|
79
79
|
/**
|
|
80
80
|
* Registers a class to be used by the persistence engine.
|
|
81
81
|
* @param className the name of the class to be registered
|
|
@@ -379,8 +379,8 @@ const k = (l = class {
|
|
|
379
379
|
}, l._factoryMap = {}, l);
|
|
380
380
|
Y([
|
|
381
381
|
S
|
|
382
|
-
],
|
|
383
|
-
let u =
|
|
382
|
+
], L.prototype, "_id");
|
|
383
|
+
let u = L;
|
|
384
384
|
function S(i, e) {
|
|
385
385
|
return _()(i, e);
|
|
386
386
|
}
|
|
@@ -537,10 +537,10 @@ class he extends u {
|
|
|
537
537
|
return this.notify({ [e]: this[e] }), t;
|
|
538
538
|
}
|
|
539
539
|
}
|
|
540
|
-
const
|
|
540
|
+
const j = class j {
|
|
541
541
|
constructor(e, t, r) {
|
|
542
542
|
if (r) {
|
|
543
|
-
if (!(t instanceof u)) throw new Error(
|
|
543
|
+
if (!(t instanceof u)) throw new Error(j.error.persistentNeedForSubCollection);
|
|
544
544
|
this.collectionName = `${t.className}/${t.id}/${r}`;
|
|
545
545
|
} else
|
|
546
546
|
this.collectionName = t instanceof u ? t.className : t;
|
|
@@ -698,11 +698,11 @@ const R = class R {
|
|
|
698
698
|
};
|
|
699
699
|
}
|
|
700
700
|
};
|
|
701
|
-
|
|
701
|
+
j.error = {
|
|
702
702
|
persistentNeedForSubCollection: "The document parameter for a sub-collection should be a Persistent instace",
|
|
703
703
|
invalidQueryOrder: "Cannot add where calls after or calls"
|
|
704
704
|
};
|
|
705
|
-
let C =
|
|
705
|
+
let C = j;
|
|
706
706
|
class H {
|
|
707
707
|
constructor(e) {
|
|
708
708
|
this.queryObject = { operations: [] }, this.model = e;
|
|
@@ -1119,7 +1119,7 @@ class le extends w {
|
|
|
1119
1119
|
return Object.entries(e).forEach(([t, r]) => {
|
|
1120
1120
|
this._jsonRawData[t] || (this._jsonRawData[t] = {}), r?.forEach((s) => {
|
|
1121
1121
|
const n = this._jsonRawData[t][s.id];
|
|
1122
|
-
this._jsonRawData[t][s.id] = s,
|
|
1122
|
+
this._jsonRawData[t][s.id] = s, this.notifyChange(t, s, n);
|
|
1123
1123
|
});
|
|
1124
1124
|
}), this.resolveWithDelay();
|
|
1125
1125
|
}
|
|
@@ -1144,21 +1144,27 @@ class le extends w {
|
|
|
1144
1144
|
);
|
|
1145
1145
|
}
|
|
1146
1146
|
onCollectionChange(e, t, r) {
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1147
|
+
let s = this._collectionListeners[t];
|
|
1148
|
+
s || (this._collectionListeners[t] = {}, s = this._collectionListeners[t]);
|
|
1149
|
+
const n = (a) => {
|
|
1150
|
+
if (!a.after) return;
|
|
1151
|
+
const c = this.retrieveQueryDocs([a.after], e.operations);
|
|
1152
|
+
c.length > 0 && r(c.map((h) => ({
|
|
1151
1153
|
before: void 0,
|
|
1152
|
-
after:
|
|
1153
|
-
type:
|
|
1154
|
-
params:
|
|
1154
|
+
after: h,
|
|
1155
|
+
type: a.type,
|
|
1156
|
+
params: a.params
|
|
1155
1157
|
})));
|
|
1156
|
-
}, ()
|
|
1158
|
+
}, o = Math.random().toString(36).substring(2, 9);
|
|
1159
|
+
return s[o] = n, () => delete s[o];
|
|
1157
1160
|
}
|
|
1158
1161
|
onDocumentChange(e, t, r) {
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
+
let s = this._documentListeners[e];
|
|
1163
|
+
s || (this._documentListeners[e] = {}, s = this._documentListeners[e]);
|
|
1164
|
+
const n = (a) => {
|
|
1165
|
+
a.after && a.after.id === t && r(a);
|
|
1166
|
+
}, o = Math.random().toString(36).substring(2, 9);
|
|
1167
|
+
return s[o] = n, () => delete s[o];
|
|
1162
1168
|
}
|
|
1163
1169
|
/**
|
|
1164
1170
|
* @returns the raw data store data as a JSON object
|
|
@@ -1199,7 +1205,7 @@ class le extends w {
|
|
|
1199
1205
|
params: {},
|
|
1200
1206
|
type: r ? "update" : "create"
|
|
1201
1207
|
};
|
|
1202
|
-
this._serverCollectionListeners[e]?.(s), this._documentListeners[e]
|
|
1208
|
+
this._serverCollectionListeners[e]?.(s), Object.values(this._documentListeners[e] ?? {}).forEach((n) => n(s)), Object.values(this._collectionListeners[e] ?? {}).forEach((n) => n(s));
|
|
1203
1209
|
}
|
|
1204
1210
|
decCursor(e) {
|
|
1205
1211
|
return this._cursor -= e, this._cursor < 0 ? (this._cursor = 0, !0) : !1;
|
|
@@ -1232,7 +1238,7 @@ class le extends w {
|
|
|
1232
1238
|
"<=": (h, d) => h <= d,
|
|
1233
1239
|
">": (h, d) => h > d,
|
|
1234
1240
|
">=": (h, d) => h >= d,
|
|
1235
|
-
containsAny: (h, d) => h?.some((
|
|
1241
|
+
containsAny: (h, d) => h?.some((V) => d?.includes(V)),
|
|
1236
1242
|
contains: (h, d) => h?.includes(d)
|
|
1237
1243
|
}, { property: s, value: n, operator: o } = t, [a, c] = this.retrieveValuesToCompare(e, s, n);
|
|
1238
1244
|
return r[o](a, c);
|
|
@@ -1292,7 +1298,7 @@ var Z = Object.getOwnPropertyDescriptor, G = (i, e, t, r) => {
|
|
|
1292
1298
|
(o = i[n]) && (s = o(s) || s);
|
|
1293
1299
|
return s;
|
|
1294
1300
|
};
|
|
1295
|
-
let
|
|
1301
|
+
let D = class extends P {
|
|
1296
1302
|
constructor(i = "") {
|
|
1297
1303
|
super(), this._simulateDelay = 0, this._pendingPromises = [], this.mockFileSystem = {}, this._pathToMockFiles = i;
|
|
1298
1304
|
}
|
|
@@ -1340,9 +1346,9 @@ let j = class extends P {
|
|
|
1340
1346
|
return delete this.mockFileSystem[i], this.resolveWithDelay();
|
|
1341
1347
|
}
|
|
1342
1348
|
};
|
|
1343
|
-
|
|
1344
|
-
J("MockCloudStorage", () => new
|
|
1345
|
-
],
|
|
1349
|
+
D = G([
|
|
1350
|
+
J("MockCloudStorage", () => new D())
|
|
1351
|
+
], D);
|
|
1346
1352
|
var K = Object.defineProperty, X = Object.getOwnPropertyDescriptor, O = (i, e, t, r) => {
|
|
1347
1353
|
for (var s = r > 1 ? void 0 : r ? X(e, t) : e, n = i.length - 1, o; n >= 0; n--)
|
|
1348
1354
|
(o = i[n]) && (s = (r ? o(e, t, s) : o(s)) || s);
|
|
@@ -1413,9 +1419,9 @@ O([
|
|
|
1413
1419
|
b = O([
|
|
1414
1420
|
z("StoredFile")
|
|
1415
1421
|
], b);
|
|
1416
|
-
class
|
|
1422
|
+
class N {
|
|
1417
1423
|
}
|
|
1418
|
-
const p = class p extends
|
|
1424
|
+
const p = class p extends N {
|
|
1419
1425
|
constructor() {
|
|
1420
1426
|
if (super(), this._onAuthStateChange = new U(), !p._authService) throw new Error(p.error.shouldBeRegistered);
|
|
1421
1427
|
p._authService.onAuthStateChange(
|
|
@@ -1542,7 +1548,7 @@ const p = class p extends L {
|
|
|
1542
1548
|
};
|
|
1543
1549
|
p.error = { shouldBeRegistered: "You should register an auth service before using Auth." }, p._instance = void 0;
|
|
1544
1550
|
let F = p;
|
|
1545
|
-
class de extends
|
|
1551
|
+
class de extends N {
|
|
1546
1552
|
constructor() {
|
|
1547
1553
|
super(...arguments), this.pendingPromises = [], this._fakeRegisteredUsers = {};
|
|
1548
1554
|
}
|
|
@@ -1657,9 +1663,9 @@ class fe {
|
|
|
1657
1663
|
return e(t);
|
|
1658
1664
|
}
|
|
1659
1665
|
}
|
|
1660
|
-
class
|
|
1666
|
+
class M {
|
|
1661
1667
|
}
|
|
1662
|
-
const m = class m extends
|
|
1668
|
+
const m = class m extends M {
|
|
1663
1669
|
constructor() {
|
|
1664
1670
|
super();
|
|
1665
1671
|
}
|
|
@@ -1684,8 +1690,8 @@ const m = class m extends V {
|
|
|
1684
1690
|
}
|
|
1685
1691
|
};
|
|
1686
1692
|
m.error = { shouldBeRegistered: "You should register a Server Auth service before using the Server Auth." }, m._instance = void 0;
|
|
1687
|
-
let
|
|
1688
|
-
class pe extends
|
|
1693
|
+
let k = m;
|
|
1694
|
+
class pe extends M {
|
|
1689
1695
|
constructor(e) {
|
|
1690
1696
|
super(), this._userCredentials = e;
|
|
1691
1697
|
}
|
|
@@ -1733,21 +1739,21 @@ function ye(i, e) {
|
|
|
1733
1739
|
export {
|
|
1734
1740
|
F as Auth,
|
|
1735
1741
|
de as AuthMock,
|
|
1736
|
-
|
|
1742
|
+
N as AuthService,
|
|
1737
1743
|
I as CloudFunctions,
|
|
1738
1744
|
fe as CloudFunctionsMock,
|
|
1739
1745
|
P as CloudStorage,
|
|
1740
1746
|
w as DataSource,
|
|
1741
1747
|
he as EntropicComponent,
|
|
1742
1748
|
le as JsonDataSource,
|
|
1743
|
-
|
|
1749
|
+
D as MockCloudStorage,
|
|
1744
1750
|
C as Model,
|
|
1745
1751
|
U as Observable,
|
|
1746
1752
|
u as Persistent,
|
|
1747
1753
|
H as Query,
|
|
1748
|
-
|
|
1754
|
+
k as ServerAuth,
|
|
1749
1755
|
pe as ServerAuthMock,
|
|
1750
|
-
|
|
1756
|
+
M as ServerAuthService,
|
|
1751
1757
|
E as Store,
|
|
1752
1758
|
b as StoredFile,
|
|
1753
1759
|
ee as StoredFileEvent,
|