entropic-bond 1.53.4 → 1.53.6
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 +78 -61
- package/lib/entropic-bond.js.map +1 -1
- package/lib/entropic-bond.umd.cjs +2 -2
- package/lib/entropic-bond.umd.cjs.map +1 -1
- package/lib/server-auth/server-auth-mock.d.ts +0 -1
- package/lib/server-auth/server-auth.d.ts +0 -2
- package/lib/store/data-source.d.ts +12 -7
- package/lib/store/json-data-source.d.ts +7 -2
- package/lib/store/model.d.ts +5 -1
- package/package.json +1 -1
package/lib/entropic-bond.js
CHANGED
|
@@ -56,12 +56,12 @@ function Y() {
|
|
|
56
56
|
return j(q);
|
|
57
57
|
}
|
|
58
58
|
var z = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
59
|
-
const
|
|
59
|
+
const M = {
|
|
60
60
|
randomUUID: z
|
|
61
61
|
};
|
|
62
62
|
function H(i, e, t) {
|
|
63
|
-
if (
|
|
64
|
-
return
|
|
63
|
+
if (M.randomUUID && !e && !i)
|
|
64
|
+
return M.randomUUID();
|
|
65
65
|
i = i || {};
|
|
66
66
|
var r = i.random || (i.rng || Y)();
|
|
67
67
|
if (r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, e) {
|
|
@@ -77,7 +77,7 @@ var J = Object.defineProperty, Z = Object.getOwnPropertyDescriptor, G = (i, e, t
|
|
|
77
77
|
(o = i[n]) && (s = (r ? o(e, t, s) : o(s)) || s);
|
|
78
78
|
return r && s && J(e, t, s), s;
|
|
79
79
|
}, d;
|
|
80
|
-
const
|
|
80
|
+
const T = (d = class {
|
|
81
81
|
/**
|
|
82
82
|
* Registers a class to be used by the persistence engine.
|
|
83
83
|
* @param className the name of the class to be registered
|
|
@@ -387,10 +387,10 @@ const x = (d = class {
|
|
|
387
387
|
}
|
|
388
388
|
}, d._factoryMap = {}, d);
|
|
389
389
|
G([
|
|
390
|
-
|
|
391
|
-
],
|
|
392
|
-
let l =
|
|
393
|
-
function
|
|
390
|
+
O
|
|
391
|
+
], T.prototype, "_id", 2);
|
|
392
|
+
let l = T;
|
|
393
|
+
function O(i, e) {
|
|
394
394
|
return y()(i, e);
|
|
395
395
|
}
|
|
396
396
|
function ae(i) {
|
|
@@ -636,6 +636,12 @@ const E = class E {
|
|
|
636
636
|
next(e) {
|
|
637
637
|
return this.mapToInstance(() => this._stream.next(e));
|
|
638
638
|
}
|
|
639
|
+
onDocumentChange(e, t, r) {
|
|
640
|
+
return this._stream.onDocumentChange(e, t, r);
|
|
641
|
+
}
|
|
642
|
+
onCollectionChange(e, t) {
|
|
643
|
+
return this._stream.onCollectionChange(e.getQueryObject(), this.collectionName, t);
|
|
644
|
+
}
|
|
639
645
|
// /**
|
|
640
646
|
// * Get the previous bunch of documents matching the last query
|
|
641
647
|
// * @param limit the max amount of documents to retrieve. If not set, uses the
|
|
@@ -688,7 +694,7 @@ E.error = {
|
|
|
688
694
|
persistentNeedForSubCollection: "The document parameter for a sub-collection should be a Persistent instace",
|
|
689
695
|
invalidQueryOrder: "Cannot add where calls after or calls"
|
|
690
696
|
};
|
|
691
|
-
let
|
|
697
|
+
let D = E;
|
|
692
698
|
class X {
|
|
693
699
|
constructor(e) {
|
|
694
700
|
this.queryObject = { operations: [] }, this.model = e;
|
|
@@ -715,7 +721,7 @@ class X {
|
|
|
715
721
|
where(e, t, r, s) {
|
|
716
722
|
var n, o, c;
|
|
717
723
|
if ((o = (n = this.queryObject.operations) == null ? void 0 : n.at(-1)) != null && o.aggregate && !s)
|
|
718
|
-
throw new Error(
|
|
724
|
+
throw new Error(D.error.invalidQueryOrder);
|
|
719
725
|
return (c = this.queryObject.operations) == null || c.push({
|
|
720
726
|
property: e,
|
|
721
727
|
operator: t,
|
|
@@ -750,11 +756,11 @@ class X {
|
|
|
750
756
|
whereDeepProp(e, t, r, s) {
|
|
751
757
|
var h, a, u;
|
|
752
758
|
if ((a = (h = this.queryObject.operations) == null ? void 0 : h.at(-1)) != null && a.aggregate && !s)
|
|
753
|
-
throw new Error(
|
|
759
|
+
throw new Error(D.error.invalidQueryOrder);
|
|
754
760
|
const n = e.split(".");
|
|
755
761
|
let o = {}, c = n.length > 1 ? o : r;
|
|
756
|
-
return n.slice(1).forEach((g,
|
|
757
|
-
o[g] =
|
|
762
|
+
return n.slice(1).forEach((g, R) => {
|
|
763
|
+
o[g] = R < n.length - 2 ? {} : r, o = o[g];
|
|
758
764
|
}), (u = this.queryObject.operations) == null || u.push({
|
|
759
765
|
property: n[0],
|
|
760
766
|
operator: t,
|
|
@@ -911,6 +917,9 @@ class X {
|
|
|
911
917
|
count() {
|
|
912
918
|
return this.model.count(this.queryObject);
|
|
913
919
|
}
|
|
920
|
+
getQueryObject() {
|
|
921
|
+
return this.queryObject;
|
|
922
|
+
}
|
|
914
923
|
}
|
|
915
924
|
const v = class v {
|
|
916
925
|
constructor() {
|
|
@@ -938,7 +947,7 @@ const v = class v {
|
|
|
938
947
|
static getModel(e) {
|
|
939
948
|
if (!v._dataSource)
|
|
940
949
|
throw new Error(this.error.shouldBeRegistered);
|
|
941
|
-
return new
|
|
950
|
+
return new D(v._dataSource, e);
|
|
942
951
|
}
|
|
943
952
|
/**
|
|
944
953
|
* Retrieves a model for a subcollection
|
|
@@ -949,7 +958,7 @@ const v = class v {
|
|
|
949
958
|
static getModelForSubCollection(e, t) {
|
|
950
959
|
if (!v._dataSource)
|
|
951
960
|
throw new Error(this.error.shouldBeRegistered);
|
|
952
|
-
return new
|
|
961
|
+
return new D(v._dataSource, e, t);
|
|
953
962
|
}
|
|
954
963
|
/**
|
|
955
964
|
* Populates property references with actual data from the store.
|
|
@@ -1073,10 +1082,10 @@ class C {
|
|
|
1073
1082
|
return Promise.all([
|
|
1074
1083
|
o.map(async (a) => {
|
|
1075
1084
|
var u, g;
|
|
1076
|
-
(g = (u = r.prop.cachedPropsConfig) == null ? void 0 : u.cachedProps) == null || g.forEach(async (
|
|
1077
|
-
var
|
|
1078
|
-
const W = e.before[
|
|
1079
|
-
W !== N && (a[`_${r.prop.name}`][`_${
|
|
1085
|
+
(g = (u = r.prop.cachedPropsConfig) == null ? void 0 : u.cachedProps) == null || g.forEach(async (R) => {
|
|
1086
|
+
var $;
|
|
1087
|
+
const W = e.before[R], N = e.after[R];
|
|
1088
|
+
W !== N && (a[`_${r.prop.name}`][`_${R}`] = N, await s.save(a), ($ = this.onUpdate) == null || $.call(this, a, r.prop));
|
|
1080
1089
|
});
|
|
1081
1090
|
})
|
|
1082
1091
|
]);
|
|
@@ -1088,7 +1097,7 @@ class _e extends C {
|
|
|
1088
1097
|
* @param jsonRawData the JSON object to be used as data store
|
|
1089
1098
|
*/
|
|
1090
1099
|
constructor(e) {
|
|
1091
|
-
super(), this._jsonRawData = {}, this._lastMatchingDocs = [], this._lastLimit = 0, this._cursor = 0, this._simulateDelay = 0, this._pendingPromises = [], this.
|
|
1100
|
+
super(), this._jsonRawData = {}, this._lastMatchingDocs = [], this._lastLimit = 0, this._cursor = 0, this._simulateDelay = 0, this._pendingPromises = [], this._documentListeners = {}, this._collectionListeners = {}, this._serverCollectionListeners = {}, e && (this._jsonRawData = e);
|
|
1092
1101
|
}
|
|
1093
1102
|
/**
|
|
1094
1103
|
* Set the JSON object to initialize the data store. Use to set the it after
|
|
@@ -1147,6 +1156,16 @@ class _e extends C {
|
|
|
1147
1156
|
Object.keys(this._jsonRawData[t] ?? {}).length
|
|
1148
1157
|
);
|
|
1149
1158
|
}
|
|
1159
|
+
onCollectionChange(e, t, r) {
|
|
1160
|
+
return this._collectionListeners[t] = (s) => {
|
|
1161
|
+
this.retrieveQueryDocs([s.before.toObject()], e.operations).length > 0 && r(s);
|
|
1162
|
+
}, () => delete this._serverCollectionListeners[t];
|
|
1163
|
+
}
|
|
1164
|
+
onDocumentChange(e, t, r) {
|
|
1165
|
+
return this._documentListeners[e] = (s) => {
|
|
1166
|
+
s.after.id === t && r(s);
|
|
1167
|
+
}, () => delete this._serverCollectionListeners[e];
|
|
1168
|
+
}
|
|
1150
1169
|
/**
|
|
1151
1170
|
* @returns the raw data store data as a JSON object
|
|
1152
1171
|
*/
|
|
@@ -1172,19 +1191,22 @@ class _e extends C {
|
|
|
1172
1191
|
} : this._simulateError = e, this);
|
|
1173
1192
|
}
|
|
1174
1193
|
subscribeToDocumentChangeListerner(e, t) {
|
|
1175
|
-
return delete this.
|
|
1176
|
-
uninstall: () => delete this.
|
|
1194
|
+
return delete this._serverCollectionListeners[e], this._serverCollectionListeners[e] = t, {
|
|
1195
|
+
uninstall: () => delete this._serverCollectionListeners[e],
|
|
1177
1196
|
nativeHandler: t,
|
|
1178
1197
|
collectionPath: e
|
|
1179
1198
|
};
|
|
1180
1199
|
}
|
|
1181
1200
|
notifyChange(e, t, r) {
|
|
1182
|
-
|
|
1183
|
-
s
|
|
1201
|
+
var n, o, c, h, a, u;
|
|
1202
|
+
const s = {
|
|
1184
1203
|
before: r,
|
|
1185
1204
|
after: t,
|
|
1186
|
-
collectionPath: e
|
|
1187
|
-
|
|
1205
|
+
collectionPath: e,
|
|
1206
|
+
params: {},
|
|
1207
|
+
type: r ? "update" : "create"
|
|
1208
|
+
};
|
|
1209
|
+
(o = (n = this._serverCollectionListeners)[e]) == null || o.call(n, s), (h = (c = this._documentListeners)[e]) == null || h.call(c, s), (u = (a = this._collectionListeners)[e]) == null || u.call(a, s);
|
|
1188
1210
|
}
|
|
1189
1211
|
decCursor(e) {
|
|
1190
1212
|
return this._cursor -= e, this._cursor < 0 ? (this._cursor = 0, !0) : !1;
|
|
@@ -1330,7 +1352,7 @@ let A = class extends w {
|
|
|
1330
1352
|
A = se([
|
|
1331
1353
|
ee("MockCloudStorage", () => new A())
|
|
1332
1354
|
], A);
|
|
1333
|
-
var ie = Object.defineProperty, ne = Object.getOwnPropertyDescriptor,
|
|
1355
|
+
var ie = Object.defineProperty, ne = Object.getOwnPropertyDescriptor, S = (i, e, t, r) => {
|
|
1334
1356
|
for (var s = r > 1 ? void 0 : r ? ne(e, t) : e, n = i.length - 1, o; n >= 0; n--)
|
|
1335
1357
|
(o = i[n]) && (s = (r ? o(e, t, s) : o(s)) || s);
|
|
1336
1358
|
return r && s && ie(e, t, s), s;
|
|
@@ -1383,27 +1405,27 @@ let b = class extends l {
|
|
|
1383
1405
|
return this._onChange.subscribe(i);
|
|
1384
1406
|
}
|
|
1385
1407
|
};
|
|
1386
|
-
|
|
1387
|
-
|
|
1408
|
+
S([
|
|
1409
|
+
O
|
|
1388
1410
|
], b.prototype, "_reference", 2);
|
|
1389
|
-
|
|
1390
|
-
|
|
1411
|
+
S([
|
|
1412
|
+
O
|
|
1391
1413
|
], b.prototype, "_url", 2);
|
|
1392
|
-
|
|
1393
|
-
|
|
1414
|
+
S([
|
|
1415
|
+
O
|
|
1394
1416
|
], b.prototype, "_cloudStorageProviderName", 2);
|
|
1395
|
-
|
|
1396
|
-
|
|
1417
|
+
S([
|
|
1418
|
+
O
|
|
1397
1419
|
], b.prototype, "_originalFileName", 2);
|
|
1398
|
-
|
|
1399
|
-
|
|
1420
|
+
S([
|
|
1421
|
+
O
|
|
1400
1422
|
], b.prototype, "_mimeType", 2);
|
|
1401
|
-
b =
|
|
1423
|
+
b = S([
|
|
1402
1424
|
K("StoredFile")
|
|
1403
1425
|
], b);
|
|
1404
|
-
class
|
|
1426
|
+
class x {
|
|
1405
1427
|
}
|
|
1406
|
-
const p = class p extends
|
|
1428
|
+
const p = class p extends x {
|
|
1407
1429
|
constructor() {
|
|
1408
1430
|
if (super(), this._onAuthStateChange = new I(), !p._authService)
|
|
1409
1431
|
throw new Error(p.error.shouldBeRegistered);
|
|
@@ -1530,8 +1552,8 @@ const p = class p extends B {
|
|
|
1530
1552
|
}
|
|
1531
1553
|
};
|
|
1532
1554
|
p.error = { shouldBeRegistered: "You should register an auth service before using Auth." }, p._instance = void 0;
|
|
1533
|
-
let
|
|
1534
|
-
class ye extends
|
|
1555
|
+
let V = p;
|
|
1556
|
+
class ye extends x {
|
|
1535
1557
|
constructor() {
|
|
1536
1558
|
super(...arguments), this.pendingPromises = [], this._fakeRegisteredUsers = {};
|
|
1537
1559
|
}
|
|
@@ -1636,7 +1658,7 @@ const _ = class _ {
|
|
|
1636
1658
|
}
|
|
1637
1659
|
};
|
|
1638
1660
|
_.error = { shouldBeRegistered: "You should register a cloud functions service with useCloudFunctionsService static method before using CloudFunctions." };
|
|
1639
|
-
let
|
|
1661
|
+
let L = _;
|
|
1640
1662
|
class ve {
|
|
1641
1663
|
constructor(e) {
|
|
1642
1664
|
this._registeredFunctions = e;
|
|
@@ -1651,9 +1673,9 @@ class ve {
|
|
|
1651
1673
|
return e(t);
|
|
1652
1674
|
}
|
|
1653
1675
|
}
|
|
1654
|
-
class
|
|
1676
|
+
class B {
|
|
1655
1677
|
}
|
|
1656
|
-
const m = class m extends
|
|
1678
|
+
const m = class m extends B {
|
|
1657
1679
|
constructor() {
|
|
1658
1680
|
super();
|
|
1659
1681
|
}
|
|
@@ -1677,13 +1699,10 @@ const m = class m extends L {
|
|
|
1677
1699
|
deleteUser(e) {
|
|
1678
1700
|
return m._authService.deleteUser(e);
|
|
1679
1701
|
}
|
|
1680
|
-
notifyUserChanges() {
|
|
1681
|
-
m._authService.notifyUserChanges();
|
|
1682
|
-
}
|
|
1683
1702
|
};
|
|
1684
1703
|
m.error = { shouldBeRegistered: "You should register a Server Auth service before using the Server Auth." }, m._instance = void 0;
|
|
1685
|
-
let
|
|
1686
|
-
class Pe extends
|
|
1704
|
+
let k = m;
|
|
1705
|
+
class Pe extends B {
|
|
1687
1706
|
constructor(e) {
|
|
1688
1707
|
super(), this._userCredentials = e;
|
|
1689
1708
|
}
|
|
@@ -1709,8 +1728,6 @@ class Pe extends L {
|
|
|
1709
1728
|
get userCredentials() {
|
|
1710
1729
|
return this._userCredentials;
|
|
1711
1730
|
}
|
|
1712
|
-
notifyUserChanges() {
|
|
1713
|
-
}
|
|
1714
1731
|
}
|
|
1715
1732
|
function we(i, e) {
|
|
1716
1733
|
return i ? i.replace(/\${\s*(\w*)\s*}/g, function(t, r) {
|
|
@@ -1729,33 +1746,33 @@ function Ce(i, e = "-") {
|
|
|
1729
1746
|
const t = i.slice(1).replace(/( |[A-Z])/g, (r) => r === " " ? "-" : e + r[0].toLowerCase());
|
|
1730
1747
|
return i[0].toLocaleLowerCase() + t.replace(/--/g, "-");
|
|
1731
1748
|
}
|
|
1732
|
-
function
|
|
1749
|
+
function De(i, e) {
|
|
1733
1750
|
return e.split(".").reduce((t, r) => t[r], i);
|
|
1734
1751
|
}
|
|
1735
1752
|
export {
|
|
1736
|
-
|
|
1753
|
+
V as Auth,
|
|
1737
1754
|
ye as AuthMock,
|
|
1738
|
-
|
|
1739
|
-
|
|
1755
|
+
x as AuthService,
|
|
1756
|
+
L as CloudFunctions,
|
|
1740
1757
|
ve as CloudFunctionsMock,
|
|
1741
1758
|
w as CloudStorage,
|
|
1742
1759
|
C as DataSource,
|
|
1743
1760
|
ge as EntropicComponent,
|
|
1744
1761
|
_e as JsonDataSource,
|
|
1745
1762
|
A as MockCloudStorage,
|
|
1746
|
-
|
|
1763
|
+
D as Model,
|
|
1747
1764
|
I as Observable,
|
|
1748
1765
|
l as Persistent,
|
|
1749
1766
|
X as Query,
|
|
1750
|
-
|
|
1767
|
+
k as ServerAuth,
|
|
1751
1768
|
Pe as ServerAuthMock,
|
|
1752
|
-
|
|
1769
|
+
B as ServerAuthService,
|
|
1753
1770
|
F as Store,
|
|
1754
1771
|
b as StoredFile,
|
|
1755
1772
|
oe as StoredFileEvent,
|
|
1756
1773
|
be as camelCase,
|
|
1757
|
-
|
|
1758
|
-
|
|
1774
|
+
De as getDeepValue,
|
|
1775
|
+
O as persistent,
|
|
1759
1776
|
y as persistentParser,
|
|
1760
1777
|
he as persistentPureReference,
|
|
1761
1778
|
le as persistentPureReferenceWithCachedProps,
|