entropic-bond 1.53.5 → 1.53.7
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 +205 -165
- 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/store/data-source.d.ts +12 -7
- package/lib/store/json-data-source.d.ts +7 -2
- package/lib/store/model.d.ts +6 -1
- package/package.json +1 -1
package/lib/entropic-bond.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class N {
|
|
2
2
|
constructor() {
|
|
3
3
|
this.subscribers = /* @__PURE__ */ new Set();
|
|
4
4
|
}
|
|
@@ -44,40 +44,40 @@ class I {
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
var f = [];
|
|
47
|
-
for (var
|
|
48
|
-
f.push((
|
|
49
|
-
function
|
|
47
|
+
for (var A = 0; A < 256; ++A)
|
|
48
|
+
f.push((A + 256).toString(16).slice(1));
|
|
49
|
+
function Y(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
|
-
var
|
|
53
|
-
function
|
|
54
|
-
if (!
|
|
52
|
+
var E, z = new Uint8Array(16);
|
|
53
|
+
function H() {
|
|
54
|
+
if (!E && (E = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !E))
|
|
55
55
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
56
|
-
return
|
|
56
|
+
return E(z);
|
|
57
57
|
}
|
|
58
|
-
var
|
|
59
|
-
const
|
|
60
|
-
randomUUID:
|
|
58
|
+
var J = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
59
|
+
const k = {
|
|
60
|
+
randomUUID: J
|
|
61
61
|
};
|
|
62
|
-
function
|
|
63
|
-
if (
|
|
64
|
-
return
|
|
62
|
+
function Z(i, e, t) {
|
|
63
|
+
if (k.randomUUID && !e && !i)
|
|
64
|
+
return k.randomUUID();
|
|
65
65
|
i = i || {};
|
|
66
|
-
var r = i.random || (i.rng ||
|
|
66
|
+
var r = i.random || (i.rng || H)();
|
|
67
67
|
if (r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, e) {
|
|
68
68
|
t = t || 0;
|
|
69
69
|
for (var s = 0; s < 16; ++s)
|
|
70
70
|
e[t + s] = r[s];
|
|
71
71
|
return e;
|
|
72
72
|
}
|
|
73
|
-
return
|
|
73
|
+
return Y(r);
|
|
74
74
|
}
|
|
75
|
-
var
|
|
76
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
75
|
+
var G = Object.defineProperty, K = Object.getOwnPropertyDescriptor, X = (i, e, t, r) => {
|
|
76
|
+
for (var s = r > 1 ? void 0 : r ? K(e, t) : e, n = i.length - 1, o; n >= 0; n--)
|
|
77
77
|
(o = i[n]) && (s = (r ? o(e, t, s) : o(s)) || s);
|
|
78
|
-
return r && s &&
|
|
78
|
+
return r && s && G(e, t, s), s;
|
|
79
79
|
}, d;
|
|
80
|
-
const
|
|
80
|
+
const W = (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
|
|
@@ -139,7 +139,7 @@ const x = (d = class {
|
|
|
139
139
|
* Returns a new instance of Persistent class.
|
|
140
140
|
* @param className the initial id of this instance. If not provided, a new id will be generated
|
|
141
141
|
*/
|
|
142
|
-
constructor(e =
|
|
142
|
+
constructor(e = Z()) {
|
|
143
143
|
this._id = e;
|
|
144
144
|
}
|
|
145
145
|
/**
|
|
@@ -386,14 +386,14 @@ const x = (d = class {
|
|
|
386
386
|
}, {});
|
|
387
387
|
}
|
|
388
388
|
}, d._factoryMap = {}, d);
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
],
|
|
392
|
-
let l =
|
|
393
|
-
function
|
|
389
|
+
X([
|
|
390
|
+
j
|
|
391
|
+
], W.prototype, "_id", 2);
|
|
392
|
+
let l = W;
|
|
393
|
+
function j(i, e) {
|
|
394
394
|
return y()(i, e);
|
|
395
395
|
}
|
|
396
|
-
function
|
|
396
|
+
function ue(i) {
|
|
397
397
|
return function(e, t) {
|
|
398
398
|
return y({
|
|
399
399
|
storeInCollection: i,
|
|
@@ -401,10 +401,10 @@ function ae(i) {
|
|
|
401
401
|
})(e, t);
|
|
402
402
|
};
|
|
403
403
|
}
|
|
404
|
-
function
|
|
404
|
+
function he(i, e) {
|
|
405
405
|
return y({ isReference: !0 })(i, e);
|
|
406
406
|
}
|
|
407
|
-
function
|
|
407
|
+
function le(i, e, t) {
|
|
408
408
|
const r = Array.isArray(i) ? { cachedProps: i } : i;
|
|
409
409
|
return function(s, n) {
|
|
410
410
|
return y({
|
|
@@ -415,10 +415,10 @@ function ue(i, e, t) {
|
|
|
415
415
|
})(s, n);
|
|
416
416
|
};
|
|
417
417
|
}
|
|
418
|
-
function
|
|
418
|
+
function de(i, e, t) {
|
|
419
419
|
return y({ isReference: !0, isPureReference: !0, storeInCollection: t })(i, e);
|
|
420
420
|
}
|
|
421
|
-
function
|
|
421
|
+
function fe(i, e, t) {
|
|
422
422
|
return function(r, s) {
|
|
423
423
|
const n = Array.isArray(i) ? { cachedProps: i } : i;
|
|
424
424
|
return y({
|
|
@@ -440,30 +440,30 @@ function y(i) {
|
|
|
440
440
|
});
|
|
441
441
|
};
|
|
442
442
|
}
|
|
443
|
-
function
|
|
443
|
+
function ee(i, e) {
|
|
444
444
|
return (t) => {
|
|
445
445
|
l.registerFactory(i, t, e), t.prototype.__className = i;
|
|
446
446
|
};
|
|
447
447
|
}
|
|
448
|
-
function
|
|
448
|
+
function pe(i) {
|
|
449
449
|
return (e) => {
|
|
450
450
|
l.registerFactory(i, e);
|
|
451
451
|
};
|
|
452
452
|
}
|
|
453
|
-
function
|
|
453
|
+
function me(i, e) {
|
|
454
454
|
return y({ searchableArray: !0 })(i, e);
|
|
455
455
|
}
|
|
456
|
-
function
|
|
456
|
+
function ge(i, e) {
|
|
457
457
|
return y({ validator: (t) => t != null })(i, e);
|
|
458
458
|
}
|
|
459
|
-
function
|
|
459
|
+
function _e(i = (e) => e != null) {
|
|
460
460
|
return function(e, t) {
|
|
461
461
|
return y({ validator: i })(e, t);
|
|
462
462
|
};
|
|
463
463
|
}
|
|
464
|
-
class
|
|
464
|
+
class ye extends l {
|
|
465
465
|
constructor() {
|
|
466
|
-
super(...arguments), this._onChange = new
|
|
466
|
+
super(...arguments), this._onChange = new N();
|
|
467
467
|
}
|
|
468
468
|
/**
|
|
469
469
|
* Subscribes a listener callback function. Every time a property is changed,
|
|
@@ -546,11 +546,11 @@ class ge extends l {
|
|
|
546
546
|
return this.notify({ [e]: this[e] }), t;
|
|
547
547
|
}
|
|
548
548
|
}
|
|
549
|
-
const
|
|
549
|
+
const U = class U {
|
|
550
550
|
constructor(e, t, r) {
|
|
551
551
|
if (r) {
|
|
552
552
|
if (!(t instanceof l))
|
|
553
|
-
throw new Error(
|
|
553
|
+
throw new Error(U.error.persistentNeedForSubCollection);
|
|
554
554
|
this.collectionName = `${t.className}/${t.id}/${r}`;
|
|
555
555
|
} else
|
|
556
556
|
this.collectionName = t instanceof l ? t.className : t;
|
|
@@ -599,7 +599,7 @@ const E = class E {
|
|
|
599
599
|
* @returns a Query object
|
|
600
600
|
*/
|
|
601
601
|
find() {
|
|
602
|
-
return new
|
|
602
|
+
return new te(this);
|
|
603
603
|
}
|
|
604
604
|
/**
|
|
605
605
|
* Define the search conditions. You pass query operations and how the query
|
|
@@ -636,6 +636,27 @@ 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(
|
|
641
|
+
e,
|
|
642
|
+
t,
|
|
643
|
+
(s) => r(this.toPersistentChangeObject(s))
|
|
644
|
+
);
|
|
645
|
+
}
|
|
646
|
+
onCollectionChange(e, t) {
|
|
647
|
+
return this._stream.onCollectionChange(
|
|
648
|
+
e.getQueryObject(),
|
|
649
|
+
this.collectionName,
|
|
650
|
+
(r) => t(this.toPersistentChangeObject(r))
|
|
651
|
+
);
|
|
652
|
+
}
|
|
653
|
+
toPersistentChangeObject(e) {
|
|
654
|
+
return {
|
|
655
|
+
...e,
|
|
656
|
+
before: e.before && l.createInstance(e.before),
|
|
657
|
+
after: e.after && l.createInstance(e.after)
|
|
658
|
+
};
|
|
659
|
+
}
|
|
639
660
|
// /**
|
|
640
661
|
// * Get the previous bunch of documents matching the last query
|
|
641
662
|
// * @param limit the max amount of documents to retrieve. If not set, uses the
|
|
@@ -666,7 +687,7 @@ const E = class E {
|
|
|
666
687
|
return e;
|
|
667
688
|
const t = ((r = e.operations) == null ? void 0 : r.map((s) => {
|
|
668
689
|
const n = s.value[0] ?? s.value;
|
|
669
|
-
return
|
|
690
|
+
return O.isArrayOperator(s.operator) && n instanceof l ? {
|
|
670
691
|
property: l.searchableArrayNameFor(s.property),
|
|
671
692
|
operator: s.operator,
|
|
672
693
|
value: Array.isArray(s.value) ? s.value.map((o) => o.id) : n.id,
|
|
@@ -684,12 +705,12 @@ const E = class E {
|
|
|
684
705
|
};
|
|
685
706
|
}
|
|
686
707
|
};
|
|
687
|
-
|
|
708
|
+
U.error = {
|
|
688
709
|
persistentNeedForSubCollection: "The document parameter for a sub-collection should be a Persistent instace",
|
|
689
710
|
invalidQueryOrder: "Cannot add where calls after or calls"
|
|
690
711
|
};
|
|
691
|
-
let
|
|
692
|
-
class
|
|
712
|
+
let D = U;
|
|
713
|
+
class te {
|
|
693
714
|
constructor(e) {
|
|
694
715
|
this.queryObject = { operations: [] }, this.model = e;
|
|
695
716
|
}
|
|
@@ -715,7 +736,7 @@ class X {
|
|
|
715
736
|
where(e, t, r, s) {
|
|
716
737
|
var n, o, c;
|
|
717
738
|
if ((o = (n = this.queryObject.operations) == null ? void 0 : n.at(-1)) != null && o.aggregate && !s)
|
|
718
|
-
throw new Error(
|
|
739
|
+
throw new Error(D.error.invalidQueryOrder);
|
|
719
740
|
return (c = this.queryObject.operations) == null || c.push({
|
|
720
741
|
property: e,
|
|
721
742
|
operator: t,
|
|
@@ -750,11 +771,11 @@ class X {
|
|
|
750
771
|
whereDeepProp(e, t, r, s) {
|
|
751
772
|
var h, a, u;
|
|
752
773
|
if ((a = (h = this.queryObject.operations) == null ? void 0 : h.at(-1)) != null && a.aggregate && !s)
|
|
753
|
-
throw new Error(
|
|
774
|
+
throw new Error(D.error.invalidQueryOrder);
|
|
754
775
|
const n = e.split(".");
|
|
755
776
|
let o = {}, c = n.length > 1 ? o : r;
|
|
756
|
-
return n.slice(1).forEach((g,
|
|
757
|
-
o[g] =
|
|
777
|
+
return n.slice(1).forEach((g, v) => {
|
|
778
|
+
o[g] = v < n.length - 2 ? {} : r, o = o[g];
|
|
758
779
|
}), (u = this.queryObject.operations) == null || u.push({
|
|
759
780
|
property: n[0],
|
|
760
781
|
operator: t,
|
|
@@ -911,8 +932,11 @@ class X {
|
|
|
911
932
|
count() {
|
|
912
933
|
return this.model.count(this.queryObject);
|
|
913
934
|
}
|
|
935
|
+
getQueryObject() {
|
|
936
|
+
return this.queryObject;
|
|
937
|
+
}
|
|
914
938
|
}
|
|
915
|
-
const
|
|
939
|
+
const P = class P {
|
|
916
940
|
constructor() {
|
|
917
941
|
}
|
|
918
942
|
/**
|
|
@@ -928,7 +952,7 @@ const v = class v {
|
|
|
928
952
|
* @returns the data source
|
|
929
953
|
*/
|
|
930
954
|
static get dataSource() {
|
|
931
|
-
return
|
|
955
|
+
return P._dataSource;
|
|
932
956
|
}
|
|
933
957
|
/**
|
|
934
958
|
* Retrieves a model for a collection
|
|
@@ -936,9 +960,9 @@ const v = class v {
|
|
|
936
960
|
* @returns the model for the collection
|
|
937
961
|
*/
|
|
938
962
|
static getModel(e) {
|
|
939
|
-
if (!
|
|
963
|
+
if (!P._dataSource)
|
|
940
964
|
throw new Error(this.error.shouldBeRegistered);
|
|
941
|
-
return new
|
|
965
|
+
return new D(P._dataSource, e);
|
|
942
966
|
}
|
|
943
967
|
/**
|
|
944
968
|
* Retrieves a model for a subcollection
|
|
@@ -947,9 +971,9 @@ const v = class v {
|
|
|
947
971
|
* @returns the model for the subcollection
|
|
948
972
|
*/
|
|
949
973
|
static getModelForSubCollection(e, t) {
|
|
950
|
-
if (!
|
|
974
|
+
if (!P._dataSource)
|
|
951
975
|
throw new Error(this.error.shouldBeRegistered);
|
|
952
|
-
return new
|
|
976
|
+
return new D(P._dataSource, e, t);
|
|
953
977
|
}
|
|
954
978
|
/**
|
|
955
979
|
* Populates property references with actual data from the store.
|
|
@@ -983,11 +1007,11 @@ const v = class v {
|
|
|
983
1007
|
) : e.__documentReference === void 0;
|
|
984
1008
|
}
|
|
985
1009
|
};
|
|
986
|
-
|
|
987
|
-
let
|
|
988
|
-
class
|
|
1010
|
+
P.error = { shouldBeRegistered: "You should register a data source before using the data Store." };
|
|
1011
|
+
let I = P;
|
|
1012
|
+
class O {
|
|
989
1013
|
installCachedPropsUpdaters(e = {}) {
|
|
990
|
-
|
|
1014
|
+
O.onUpdate = e.onUpdate;
|
|
991
1015
|
const t = l.getSystemRegisteredReferencesWithCachedProps(), r = {};
|
|
992
1016
|
Object.entries(t).forEach(([n, o]) => {
|
|
993
1017
|
o.forEach((c) => {
|
|
@@ -1000,7 +1024,7 @@ class C {
|
|
|
1000
1024
|
});
|
|
1001
1025
|
const s = [];
|
|
1002
1026
|
return Object.entries(r).forEach(([n, o]) => {
|
|
1003
|
-
const c = this.subscribeToDocumentChangeListerner(n, (h) =>
|
|
1027
|
+
const c = this.subscribeToDocumentChangeListerner(n, (h) => O.onDocumentChange(h, o));
|
|
1004
1028
|
if (c)
|
|
1005
1029
|
s.push(c);
|
|
1006
1030
|
else if (e.noThrowOnNonImplementedListener)
|
|
@@ -1033,7 +1057,7 @@ class C {
|
|
|
1033
1057
|
*/
|
|
1034
1058
|
static toPropertyPathOperations(e) {
|
|
1035
1059
|
return e ? e.map((t) => {
|
|
1036
|
-
if (
|
|
1060
|
+
if (O.isArrayOperator(t.operator) && t.value[0] instanceof l)
|
|
1037
1061
|
return {
|
|
1038
1062
|
property: l.searchableArrayNameFor(t.property),
|
|
1039
1063
|
operator: t.operator,
|
|
@@ -1063,32 +1087,33 @@ class C {
|
|
|
1063
1087
|
if (e.before)
|
|
1064
1088
|
return t.map(async (r) => {
|
|
1065
1089
|
var c, h;
|
|
1066
|
-
const s =
|
|
1090
|
+
const s = I.getModel(r.collectionPropOwner);
|
|
1067
1091
|
let n = s.find();
|
|
1068
1092
|
(h = (c = r.prop.cachedPropsConfig) == null ? void 0 : c.cachedProps) == null || h.forEach((a) => {
|
|
1069
|
-
|
|
1093
|
+
var v, R;
|
|
1094
|
+
const u = (v = e.before) == null ? void 0 : v[a], g = (R = e.after) == null ? void 0 : R[a];
|
|
1070
1095
|
u !== g && (n = n.orDeepProp(`${r.prop.name}.${a}`, "==", u));
|
|
1071
1096
|
});
|
|
1072
1097
|
const o = await n.get();
|
|
1073
1098
|
return Promise.all([
|
|
1074
1099
|
o.map(async (a) => {
|
|
1075
1100
|
var u, g;
|
|
1076
|
-
(g = (u = r.prop.cachedPropsConfig) == null ? void 0 : u.cachedProps) == null || g.forEach(async (
|
|
1077
|
-
var V;
|
|
1078
|
-
const
|
|
1079
|
-
|
|
1101
|
+
(g = (u = r.prop.cachedPropsConfig) == null ? void 0 : u.cachedProps) == null || g.forEach(async (v) => {
|
|
1102
|
+
var M, V, L;
|
|
1103
|
+
const R = (M = e.before) == null ? void 0 : M[v], $ = (V = e.after) == null ? void 0 : V[v];
|
|
1104
|
+
R !== $ && (a[`_${r.prop.name}`][`_${v}`] = $, await s.save(a), (L = this.onUpdate) == null || L.call(this, a, r.prop));
|
|
1080
1105
|
});
|
|
1081
1106
|
})
|
|
1082
1107
|
]);
|
|
1083
1108
|
});
|
|
1084
1109
|
}
|
|
1085
1110
|
}
|
|
1086
|
-
class
|
|
1111
|
+
class ve extends O {
|
|
1087
1112
|
/**
|
|
1088
1113
|
* @param jsonRawData the JSON object to be used as data store
|
|
1089
1114
|
*/
|
|
1090
1115
|
constructor(e) {
|
|
1091
|
-
super(), this._jsonRawData = {}, this._lastMatchingDocs = [], this._lastLimit = 0, this._cursor = 0, this._simulateDelay = 0, this._pendingPromises = [], this.
|
|
1116
|
+
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
1117
|
}
|
|
1093
1118
|
/**
|
|
1094
1119
|
* Set the JSON object to initialize the data store. Use to set the it after
|
|
@@ -1119,7 +1144,7 @@ class _e extends C {
|
|
|
1119
1144
|
return Object.entries(e).forEach(([r, s]) => {
|
|
1120
1145
|
this._jsonRawData[r] || (this._jsonRawData[r] = {}), s == null || s.forEach((n) => {
|
|
1121
1146
|
const o = this._jsonRawData[r][n.id];
|
|
1122
|
-
this._jsonRawData[r][n.id] = n, o && this.notifyChange(r,
|
|
1147
|
+
this._jsonRawData[r][n.id] = n, o && this.notifyChange(r, n, o);
|
|
1123
1148
|
});
|
|
1124
1149
|
}), this.resolveWithDelay();
|
|
1125
1150
|
}
|
|
@@ -1147,6 +1172,18 @@ class _e extends C {
|
|
|
1147
1172
|
Object.keys(this._jsonRawData[t] ?? {}).length
|
|
1148
1173
|
);
|
|
1149
1174
|
}
|
|
1175
|
+
onCollectionChange(e, t, r) {
|
|
1176
|
+
return this._collectionListeners[t] = (s) => {
|
|
1177
|
+
if (!s.after)
|
|
1178
|
+
return;
|
|
1179
|
+
this.retrieveQueryDocs([s.after], e.operations).length > 0 && r(s);
|
|
1180
|
+
}, () => delete this._serverCollectionListeners[t];
|
|
1181
|
+
}
|
|
1182
|
+
onDocumentChange(e, t, r) {
|
|
1183
|
+
return this._documentListeners[e] = (s) => {
|
|
1184
|
+
s.after && s.after.id === t && r(s);
|
|
1185
|
+
}, () => delete this._serverCollectionListeners[e];
|
|
1186
|
+
}
|
|
1150
1187
|
/**
|
|
1151
1188
|
* @returns the raw data store data as a JSON object
|
|
1152
1189
|
*/
|
|
@@ -1172,19 +1209,22 @@ class _e extends C {
|
|
|
1172
1209
|
} : this._simulateError = e, this);
|
|
1173
1210
|
}
|
|
1174
1211
|
subscribeToDocumentChangeListerner(e, t) {
|
|
1175
|
-
return delete this.
|
|
1176
|
-
uninstall: () => delete this.
|
|
1212
|
+
return delete this._serverCollectionListeners[e], this._serverCollectionListeners[e] = t, {
|
|
1213
|
+
uninstall: () => delete this._serverCollectionListeners[e],
|
|
1177
1214
|
nativeHandler: t,
|
|
1178
1215
|
collectionPath: e
|
|
1179
1216
|
};
|
|
1180
1217
|
}
|
|
1181
1218
|
notifyChange(e, t, r) {
|
|
1182
|
-
|
|
1183
|
-
s
|
|
1219
|
+
var n, o, c, h, a, u;
|
|
1220
|
+
const s = {
|
|
1184
1221
|
before: r,
|
|
1185
1222
|
after: t,
|
|
1186
|
-
collectionPath: e
|
|
1187
|
-
|
|
1223
|
+
collectionPath: e,
|
|
1224
|
+
params: {},
|
|
1225
|
+
type: r ? "update" : "create"
|
|
1226
|
+
};
|
|
1227
|
+
(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
1228
|
}
|
|
1189
1229
|
decCursor(e) {
|
|
1190
1230
|
return this._cursor -= e, this._cursor < 0 ? (this._cursor = 0, !0) : !1;
|
|
@@ -1244,12 +1284,12 @@ class _e extends C {
|
|
|
1244
1284
|
), t;
|
|
1245
1285
|
}
|
|
1246
1286
|
}
|
|
1247
|
-
const
|
|
1287
|
+
const b = class b {
|
|
1248
1288
|
static registerCloudStorage(e, t) {
|
|
1249
|
-
|
|
1289
|
+
b._cloudStorageFactoryMap[e] = t;
|
|
1250
1290
|
}
|
|
1251
1291
|
static createInstance(e) {
|
|
1252
|
-
const t =
|
|
1292
|
+
const t = b._cloudStorageFactoryMap[e];
|
|
1253
1293
|
if (!t)
|
|
1254
1294
|
throw new Error(`You should register the ${e} cloud storage provider prior to use it`);
|
|
1255
1295
|
return t();
|
|
@@ -1258,27 +1298,27 @@ const P = class P {
|
|
|
1258
1298
|
return this.__className;
|
|
1259
1299
|
}
|
|
1260
1300
|
static useCloudStorage(e) {
|
|
1261
|
-
|
|
1301
|
+
b._defaultCloudStorage = e;
|
|
1262
1302
|
}
|
|
1263
1303
|
static get defaultCloudStorage() {
|
|
1264
|
-
if (!
|
|
1304
|
+
if (!b._defaultCloudStorage)
|
|
1265
1305
|
throw new Error("You should define a default cloud storage provider prior to use it");
|
|
1266
|
-
return
|
|
1306
|
+
return b._defaultCloudStorage;
|
|
1267
1307
|
}
|
|
1268
1308
|
};
|
|
1269
|
-
|
|
1270
|
-
let w =
|
|
1271
|
-
function
|
|
1309
|
+
b._cloudStorageFactoryMap = {};
|
|
1310
|
+
let w = b;
|
|
1311
|
+
function re(i, e) {
|
|
1272
1312
|
return w.registerCloudStorage(i, e), (t) => {
|
|
1273
1313
|
t.prototype.__className = i;
|
|
1274
1314
|
};
|
|
1275
1315
|
}
|
|
1276
|
-
var
|
|
1277
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
1316
|
+
var se = Object.defineProperty, ie = Object.getOwnPropertyDescriptor, ne = (i, e, t, r) => {
|
|
1317
|
+
for (var s = r > 1 ? void 0 : r ? ie(e, t) : e, n = i.length - 1, o; n >= 0; n--)
|
|
1278
1318
|
(o = i[n]) && (s = (r ? o(e, t, s) : o(s)) || s);
|
|
1279
|
-
return r && s &&
|
|
1319
|
+
return r && s && se(e, t, s), s;
|
|
1280
1320
|
};
|
|
1281
|
-
let
|
|
1321
|
+
let F = class extends w {
|
|
1282
1322
|
constructor(i = "") {
|
|
1283
1323
|
super(), this._simulateDelay = 0, this._pendingPromises = [], this.mockFileSystem = {}, this._pathToMockFiles = i;
|
|
1284
1324
|
}
|
|
@@ -1327,17 +1367,17 @@ let A = class extends w {
|
|
|
1327
1367
|
return delete this.mockFileSystem[i], this.resolveWithDelay();
|
|
1328
1368
|
}
|
|
1329
1369
|
};
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
],
|
|
1333
|
-
var
|
|
1334
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
1370
|
+
F = ne([
|
|
1371
|
+
re("MockCloudStorage", () => new F())
|
|
1372
|
+
], F);
|
|
1373
|
+
var oe = Object.defineProperty, ae = Object.getOwnPropertyDescriptor, S = (i, e, t, r) => {
|
|
1374
|
+
for (var s = r > 1 ? void 0 : r ? ae(e, t) : e, n = i.length - 1, o; n >= 0; n--)
|
|
1335
1375
|
(o = i[n]) && (s = (r ? o(e, t, s) : o(s)) || s);
|
|
1336
|
-
return r && s &&
|
|
1337
|
-
},
|
|
1338
|
-
let
|
|
1376
|
+
return r && s && oe(e, t, s), s;
|
|
1377
|
+
}, ce = /* @__PURE__ */ ((i) => (i[i.stored = 0] = "stored", i[i.pendingDataSet = 1] = "pendingDataSet", i[i.deleted = 2] = "deleted", i))(ce || {});
|
|
1378
|
+
let C = class extends l {
|
|
1339
1379
|
constructor() {
|
|
1340
|
-
super(...arguments), this._onChange = new
|
|
1380
|
+
super(...arguments), this._onChange = new N();
|
|
1341
1381
|
}
|
|
1342
1382
|
async save({ data: i, fileName: e, progress: t, cloudStorageProvider: r } = {}) {
|
|
1343
1383
|
const s = i || this._pendingData;
|
|
@@ -1383,29 +1423,29 @@ let b = class extends l {
|
|
|
1383
1423
|
return this._onChange.subscribe(i);
|
|
1384
1424
|
}
|
|
1385
1425
|
};
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
],
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
],
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
],
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
],
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
],
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
],
|
|
1404
|
-
class
|
|
1426
|
+
S([
|
|
1427
|
+
j
|
|
1428
|
+
], C.prototype, "_reference", 2);
|
|
1429
|
+
S([
|
|
1430
|
+
j
|
|
1431
|
+
], C.prototype, "_url", 2);
|
|
1432
|
+
S([
|
|
1433
|
+
j
|
|
1434
|
+
], C.prototype, "_cloudStorageProviderName", 2);
|
|
1435
|
+
S([
|
|
1436
|
+
j
|
|
1437
|
+
], C.prototype, "_originalFileName", 2);
|
|
1438
|
+
S([
|
|
1439
|
+
j
|
|
1440
|
+
], C.prototype, "_mimeType", 2);
|
|
1441
|
+
C = S([
|
|
1442
|
+
ee("StoredFile")
|
|
1443
|
+
], C);
|
|
1444
|
+
class Q {
|
|
1405
1445
|
}
|
|
1406
|
-
const p = class p extends
|
|
1446
|
+
const p = class p extends Q {
|
|
1407
1447
|
constructor() {
|
|
1408
|
-
if (super(), this._onAuthStateChange = new
|
|
1448
|
+
if (super(), this._onAuthStateChange = new N(), !p._authService)
|
|
1409
1449
|
throw new Error(p.error.shouldBeRegistered);
|
|
1410
1450
|
p._authService.onAuthStateChange(
|
|
1411
1451
|
(e) => this.authStateChanged(e)
|
|
@@ -1530,8 +1570,8 @@ const p = class p extends B {
|
|
|
1530
1570
|
}
|
|
1531
1571
|
};
|
|
1532
1572
|
p.error = { shouldBeRegistered: "You should register an auth service before using Auth." }, p._instance = void 0;
|
|
1533
|
-
let
|
|
1534
|
-
class
|
|
1573
|
+
let T = p;
|
|
1574
|
+
class Pe extends Q {
|
|
1535
1575
|
constructor() {
|
|
1536
1576
|
super(...arguments), this.pendingPromises = [], this._fakeRegisteredUsers = {};
|
|
1537
1577
|
}
|
|
@@ -1636,8 +1676,8 @@ const _ = class _ {
|
|
|
1636
1676
|
}
|
|
1637
1677
|
};
|
|
1638
1678
|
_.error = { shouldBeRegistered: "You should register a cloud functions service with useCloudFunctionsService static method before using CloudFunctions." };
|
|
1639
|
-
let
|
|
1640
|
-
class
|
|
1679
|
+
let x = _;
|
|
1680
|
+
class be {
|
|
1641
1681
|
constructor(e) {
|
|
1642
1682
|
this._registeredFunctions = e;
|
|
1643
1683
|
}
|
|
@@ -1651,9 +1691,9 @@ class ve {
|
|
|
1651
1691
|
return e(t);
|
|
1652
1692
|
}
|
|
1653
1693
|
}
|
|
1654
|
-
class
|
|
1694
|
+
class q {
|
|
1655
1695
|
}
|
|
1656
|
-
const m = class m extends
|
|
1696
|
+
const m = class m extends q {
|
|
1657
1697
|
constructor() {
|
|
1658
1698
|
super();
|
|
1659
1699
|
}
|
|
@@ -1679,8 +1719,8 @@ const m = class m extends L {
|
|
|
1679
1719
|
}
|
|
1680
1720
|
};
|
|
1681
1721
|
m.error = { shouldBeRegistered: "You should register a Server Auth service before using the Server Auth." }, m._instance = void 0;
|
|
1682
|
-
let
|
|
1683
|
-
class
|
|
1722
|
+
let B = m;
|
|
1723
|
+
class we extends q {
|
|
1684
1724
|
constructor(e) {
|
|
1685
1725
|
super(), this._userCredentials = e;
|
|
1686
1726
|
}
|
|
@@ -1707,63 +1747,63 @@ class Pe extends L {
|
|
|
1707
1747
|
return this._userCredentials;
|
|
1708
1748
|
}
|
|
1709
1749
|
}
|
|
1710
|
-
function
|
|
1750
|
+
function Ce(i, e) {
|
|
1711
1751
|
return i ? i.replace(/\${\s*(\w*)\s*}/g, function(t, r) {
|
|
1712
1752
|
return e[r] || "";
|
|
1713
1753
|
}) : "";
|
|
1714
1754
|
}
|
|
1715
|
-
function
|
|
1755
|
+
function Oe(i) {
|
|
1716
1756
|
return i ? i.replace(
|
|
1717
1757
|
/([-_ ][\w])/g,
|
|
1718
1758
|
(e) => e.toUpperCase().replace("-", "").replace("_", "").replace(" ", "")
|
|
1719
1759
|
) : "";
|
|
1720
1760
|
}
|
|
1721
|
-
function
|
|
1761
|
+
function De(i, e = "-") {
|
|
1722
1762
|
if (!i)
|
|
1723
1763
|
return "";
|
|
1724
1764
|
const t = i.slice(1).replace(/( |[A-Z])/g, (r) => r === " " ? "-" : e + r[0].toLowerCase());
|
|
1725
1765
|
return i[0].toLocaleLowerCase() + t.replace(/--/g, "-");
|
|
1726
1766
|
}
|
|
1727
|
-
function
|
|
1767
|
+
function je(i, e) {
|
|
1728
1768
|
return e.split(".").reduce((t, r) => t[r], i);
|
|
1729
1769
|
}
|
|
1730
1770
|
export {
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1771
|
+
T as Auth,
|
|
1772
|
+
Pe as AuthMock,
|
|
1773
|
+
Q as AuthService,
|
|
1774
|
+
x as CloudFunctions,
|
|
1775
|
+
be as CloudFunctionsMock,
|
|
1736
1776
|
w as CloudStorage,
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1777
|
+
O as DataSource,
|
|
1778
|
+
ye as EntropicComponent,
|
|
1779
|
+
ve as JsonDataSource,
|
|
1780
|
+
F as MockCloudStorage,
|
|
1781
|
+
D as Model,
|
|
1782
|
+
N as Observable,
|
|
1743
1783
|
l as Persistent,
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1784
|
+
te as Query,
|
|
1785
|
+
B as ServerAuth,
|
|
1786
|
+
we as ServerAuthMock,
|
|
1787
|
+
q as ServerAuthService,
|
|
1788
|
+
I as Store,
|
|
1789
|
+
C as StoredFile,
|
|
1790
|
+
ce as StoredFileEvent,
|
|
1791
|
+
Oe as camelCase,
|
|
1792
|
+
je as getDeepValue,
|
|
1793
|
+
j as persistent,
|
|
1754
1794
|
y as persistentParser,
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1795
|
+
de as persistentPureReference,
|
|
1796
|
+
fe as persistentPureReferenceWithCachedProps,
|
|
1797
|
+
he as persistentReference,
|
|
1798
|
+
ue as persistentReferenceAt,
|
|
1799
|
+
le as persistentReferenceWithCachedProps,
|
|
1800
|
+
re as registerCloudStorage,
|
|
1801
|
+
pe as registerLegacyClassName,
|
|
1802
|
+
ee as registerPersistentClass,
|
|
1803
|
+
Ce as replaceValue,
|
|
1804
|
+
ge as required,
|
|
1805
|
+
_e as requiredWithValidator,
|
|
1806
|
+
me as searchableArray,
|
|
1807
|
+
De as snakeCase
|
|
1768
1808
|
};
|
|
1769
1809
|
//# sourceMappingURL=entropic-bond.js.map
|