entropic-bond 1.55.5 → 1.56.0
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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class L {
|
|
2
2
|
constructor() {
|
|
3
3
|
this.subscribers = /* @__PURE__ */ new Set();
|
|
4
4
|
}
|
|
@@ -46,36 +46,36 @@ class I {
|
|
|
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 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
|
-
let
|
|
53
|
-
const
|
|
54
|
-
function
|
|
55
|
-
if (!
|
|
52
|
+
let F;
|
|
53
|
+
const z = new Uint8Array(16);
|
|
54
|
+
function H() {
|
|
55
|
+
if (!F) {
|
|
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
|
+
F = crypto.getRandomValues.bind(crypto);
|
|
59
59
|
}
|
|
60
|
-
return
|
|
60
|
+
return F(z);
|
|
61
61
|
}
|
|
62
|
-
const
|
|
63
|
-
function
|
|
62
|
+
const J = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), T = { randomUUID: J };
|
|
63
|
+
function Z(i, e, t) {
|
|
64
64
|
i = i || {};
|
|
65
|
-
const r = i.random ?? i.rng?.() ??
|
|
65
|
+
const r = i.random ?? i.rng?.() ?? H();
|
|
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, Y(r);
|
|
69
69
|
}
|
|
70
|
-
function
|
|
71
|
-
return
|
|
70
|
+
function G(i, e, t) {
|
|
71
|
+
return T.randomUUID && !i ? T.randomUUID() : Z(i);
|
|
72
72
|
}
|
|
73
|
-
var
|
|
73
|
+
var K = Object.defineProperty, X = (i, e, t, r) => {
|
|
74
74
|
for (var s = void 0, n = i.length - 1, o; n >= 0; n--)
|
|
75
75
|
(o = i[n]) && (s = o(e, t, s) || s);
|
|
76
|
-
return s &&
|
|
76
|
+
return s && K(e, t, s), s;
|
|
77
77
|
}, h;
|
|
78
|
-
const
|
|
78
|
+
const Q = (h = 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
|
|
@@ -143,7 +143,7 @@ const V = (h = class {
|
|
|
143
143
|
* Returns a new instance of Persistent class.
|
|
144
144
|
* @param className the initial id of this instance. If not provided, a new id will be generated
|
|
145
145
|
*/
|
|
146
|
-
constructor(e =
|
|
146
|
+
constructor(e = G()) {
|
|
147
147
|
this._id = e;
|
|
148
148
|
}
|
|
149
149
|
/**
|
|
@@ -397,14 +397,14 @@ const V = (h = class {
|
|
|
397
397
|
}, {});
|
|
398
398
|
}
|
|
399
399
|
}, h._factoryMap = {}, h);
|
|
400
|
-
|
|
400
|
+
X([
|
|
401
401
|
U
|
|
402
|
-
],
|
|
403
|
-
let
|
|
402
|
+
], Q.prototype, "_id");
|
|
403
|
+
let d = Q;
|
|
404
404
|
function U(i, e) {
|
|
405
405
|
return _()(i, e);
|
|
406
406
|
}
|
|
407
|
-
function
|
|
407
|
+
function ce(i) {
|
|
408
408
|
return function(e, t) {
|
|
409
409
|
return _({
|
|
410
410
|
storeInCollection: i,
|
|
@@ -412,10 +412,10 @@ function ae(i) {
|
|
|
412
412
|
})(e, t);
|
|
413
413
|
};
|
|
414
414
|
}
|
|
415
|
-
function
|
|
415
|
+
function ue(i, e) {
|
|
416
416
|
return _({ isReference: !0 })(i, e);
|
|
417
417
|
}
|
|
418
|
-
function
|
|
418
|
+
function he(i, e, t, r) {
|
|
419
419
|
return function(s, n) {
|
|
420
420
|
const o = {
|
|
421
421
|
isReference: !0,
|
|
@@ -427,10 +427,10 @@ function ue(i, e, t, r) {
|
|
|
427
427
|
return _(o)(s, n);
|
|
428
428
|
};
|
|
429
429
|
}
|
|
430
|
-
function
|
|
430
|
+
function le(i, e, t) {
|
|
431
431
|
return _({ isReference: !0, isPureReference: !0, storeInCollection: t })(i, e);
|
|
432
432
|
}
|
|
433
|
-
function
|
|
433
|
+
function de(i, e, t, r) {
|
|
434
434
|
return function(s, n) {
|
|
435
435
|
return _({
|
|
436
436
|
isReference: !0,
|
|
@@ -453,36 +453,36 @@ function _(i) {
|
|
|
453
453
|
});
|
|
454
454
|
};
|
|
455
455
|
}
|
|
456
|
-
function
|
|
456
|
+
function ee(i, e) {
|
|
457
457
|
return (t) => {
|
|
458
|
-
|
|
458
|
+
d.registerFactory(i, t, e), t.prototype.__className = i;
|
|
459
459
|
};
|
|
460
460
|
}
|
|
461
|
-
function
|
|
461
|
+
function fe(i) {
|
|
462
462
|
return (e) => {
|
|
463
|
-
|
|
463
|
+
d.registerFactory(i, e, void 0, !0);
|
|
464
464
|
};
|
|
465
465
|
}
|
|
466
|
-
function
|
|
466
|
+
function pe(i, e) {
|
|
467
467
|
return _({ searchableArray: !0 })(i, e);
|
|
468
468
|
}
|
|
469
|
-
function
|
|
469
|
+
function me(i, e) {
|
|
470
470
|
return _({ validator: (t) => t != null })(i, e);
|
|
471
471
|
}
|
|
472
|
-
function
|
|
472
|
+
function ge(i = (e) => e != null) {
|
|
473
473
|
return function(e, t) {
|
|
474
474
|
return _({ validator: i })(e, t);
|
|
475
475
|
};
|
|
476
476
|
}
|
|
477
|
-
function
|
|
477
|
+
function _e(i) {
|
|
478
478
|
let e;
|
|
479
479
|
return typeof i == "function" ? e = new i().className : e = i, function(t, r) {
|
|
480
480
|
return _({ typeName: e })(t, r);
|
|
481
481
|
};
|
|
482
482
|
}
|
|
483
|
-
class
|
|
483
|
+
class ye extends d {
|
|
484
484
|
constructor() {
|
|
485
|
-
super(...arguments), this._onChange = new
|
|
485
|
+
super(...arguments), this._onChange = new L();
|
|
486
486
|
}
|
|
487
487
|
/**
|
|
488
488
|
* Subscribes a listener callback function. Every time a property is changed,
|
|
@@ -565,13 +565,13 @@ class _e extends l {
|
|
|
565
565
|
return this.notify({ [e]: this[e] }), t;
|
|
566
566
|
}
|
|
567
567
|
}
|
|
568
|
-
const
|
|
568
|
+
const A = class A {
|
|
569
569
|
constructor(e, t, r) {
|
|
570
570
|
if (r) {
|
|
571
|
-
if (!(t instanceof
|
|
571
|
+
if (!(t instanceof d)) throw new Error(A.error.persistentNeedForSubCollection);
|
|
572
572
|
this.collectionName = `${t.className}/${t.id}/${r}`;
|
|
573
573
|
} else
|
|
574
|
-
this.collectionName = t instanceof
|
|
574
|
+
this.collectionName = t instanceof d ? t.className : t;
|
|
575
575
|
this._stream = e;
|
|
576
576
|
}
|
|
577
577
|
/**
|
|
@@ -586,7 +586,7 @@ const E = class E {
|
|
|
586
586
|
findById(e, t) {
|
|
587
587
|
return new Promise((r, s) => {
|
|
588
588
|
this._stream.findById(e, this.collectionName).then((n) => {
|
|
589
|
-
n ? (t ? t.fromObject(n) : t =
|
|
589
|
+
n ? (t ? t.fromObject(n) : t = d.createInstance(n), r(t)) : r(void 0);
|
|
590
590
|
}).catch((n) => s(n));
|
|
591
591
|
});
|
|
592
592
|
}
|
|
@@ -617,7 +617,7 @@ const E = class E {
|
|
|
617
617
|
* @returns a Query object
|
|
618
618
|
*/
|
|
619
619
|
find() {
|
|
620
|
-
return new
|
|
620
|
+
return new te(this);
|
|
621
621
|
}
|
|
622
622
|
/**
|
|
623
623
|
* Define the search conditions. You pass query operations and how the query
|
|
@@ -628,7 +628,7 @@ const E = class E {
|
|
|
628
628
|
*/
|
|
629
629
|
query(e = {}, t) {
|
|
630
630
|
if (t) {
|
|
631
|
-
const r = t instanceof
|
|
631
|
+
const r = t instanceof d ? t.className : t;
|
|
632
632
|
e.operations || (e.operations = []), e.operations.push(
|
|
633
633
|
{ property: "__className", operator: "==", value: r }
|
|
634
634
|
);
|
|
@@ -682,7 +682,7 @@ const E = class E {
|
|
|
682
682
|
mapToInstance(e) {
|
|
683
683
|
return new Promise((t, r) => {
|
|
684
684
|
e().then((s) => t(
|
|
685
|
-
s.map((n) =>
|
|
685
|
+
s.map((n) => d.createInstance(n))
|
|
686
686
|
)).catch((s) => r(s));
|
|
687
687
|
});
|
|
688
688
|
}
|
|
@@ -698,15 +698,15 @@ const E = class E {
|
|
|
698
698
|
if (Object.values(e).length === 0) return e;
|
|
699
699
|
const t = e.operations?.map((r) => {
|
|
700
700
|
const s = r.value[0] ?? r.value;
|
|
701
|
-
return b.isArrayOperator(r.operator) && s instanceof
|
|
702
|
-
property:
|
|
701
|
+
return b.isArrayOperator(r.operator) && s instanceof d ? {
|
|
702
|
+
property: d.searchableArrayNameFor(r.property),
|
|
703
703
|
operator: r.operator,
|
|
704
704
|
value: Array.isArray(r.value) ? r.value.map((n) => n.id) : s.id,
|
|
705
705
|
aggregate: r.aggregate
|
|
706
706
|
} : {
|
|
707
707
|
property: r.property,
|
|
708
708
|
operator: r.operator,
|
|
709
|
-
value: r.value instanceof
|
|
709
|
+
value: r.value instanceof d ? { id: r.value.id } : r.value,
|
|
710
710
|
aggregate: r.aggregate
|
|
711
711
|
};
|
|
712
712
|
}) ?? [];
|
|
@@ -716,12 +716,12 @@ const E = class E {
|
|
|
716
716
|
};
|
|
717
717
|
}
|
|
718
718
|
};
|
|
719
|
-
|
|
719
|
+
A.error = {
|
|
720
720
|
persistentNeedForSubCollection: "The document parameter for a sub-collection should be a Persistent instace",
|
|
721
721
|
invalidQueryOrder: "Cannot add where calls after or calls"
|
|
722
722
|
};
|
|
723
|
-
let R =
|
|
724
|
-
class
|
|
723
|
+
let R = A;
|
|
724
|
+
class te {
|
|
725
725
|
constructor(e) {
|
|
726
726
|
this.queryObject = { operations: [] }, this.model = e;
|
|
727
727
|
}
|
|
@@ -781,8 +781,8 @@ class ee {
|
|
|
781
781
|
if (this.queryObject.operations?.at(-1)?.aggregate && !s) throw new Error(R.error.invalidQueryOrder);
|
|
782
782
|
const n = e.split(".");
|
|
783
783
|
let o = {}, a = n.length > 1 ? o : r;
|
|
784
|
-
return n.slice(1).forEach((
|
|
785
|
-
o[
|
|
784
|
+
return n.slice(1).forEach((l, u) => {
|
|
785
|
+
o[l] = u < n.length - 2 ? {} : r, o = o[l];
|
|
786
786
|
}), this.queryObject.operations?.push({
|
|
787
787
|
property: n[0],
|
|
788
788
|
operator: t,
|
|
@@ -872,7 +872,7 @@ class ee {
|
|
|
872
872
|
* query.instanceOf( Person ).where( 'age', '>', 18 )
|
|
873
873
|
*/
|
|
874
874
|
instanceOf(e) {
|
|
875
|
-
const t = e instanceof
|
|
875
|
+
const t = e instanceof d ? e.className : e;
|
|
876
876
|
return this.queryObject.operations?.push({
|
|
877
877
|
property: "__className",
|
|
878
878
|
operator: "==",
|
|
@@ -941,6 +941,9 @@ class ee {
|
|
|
941
941
|
getQueryObject() {
|
|
942
942
|
return this.queryObject;
|
|
943
943
|
}
|
|
944
|
+
getQueryModel() {
|
|
945
|
+
return this.model;
|
|
946
|
+
}
|
|
944
947
|
}
|
|
945
948
|
const v = class v {
|
|
946
949
|
constructor() {
|
|
@@ -1010,21 +1013,21 @@ const v = class v {
|
|
|
1010
1013
|
}
|
|
1011
1014
|
};
|
|
1012
1015
|
v.error = { shouldBeRegistered: "You should register a data source before using the data Store." };
|
|
1013
|
-
let
|
|
1014
|
-
class
|
|
1016
|
+
let I = v;
|
|
1017
|
+
class M {
|
|
1015
1018
|
constructor(e) {
|
|
1016
1019
|
this.handlers = [], this.subscribeToDocumentChangeListener = () => {
|
|
1017
1020
|
throw new Error("The method subscribeToDocumentChangeListener has not been implemented in the concrete data source");
|
|
1018
1021
|
}, this._resolveCollectionPaths = () => {
|
|
1019
1022
|
throw new Error("The method collectionsMatchingTemplate has not been implemented in the concrete data source");
|
|
1020
|
-
}, e && (this.beforeUpdate = e.beforeUpdateDocument, this.afterUpdate = e.afterUpdateDocument, this.onAllPropsUpdatedCallback = e.onAllPropsUpdated);
|
|
1023
|
+
}, e && (this.beforeUpdate = e.beforeUpdateDocument, this.afterUpdate = e.afterUpdateDocument, this.onAllPropsUpdatedCallback = e.onAllPropsUpdated, this._beforeQueryOwnerCollection = e.beforeQueryOwnerCollection);
|
|
1021
1024
|
}
|
|
1022
1025
|
installUpdaters() {
|
|
1023
|
-
const e =
|
|
1026
|
+
const e = d.getSystemRegisteredReferencesWithCachedProps(), t = {};
|
|
1024
1027
|
return Object.entries(e).forEach(([r, s]) => {
|
|
1025
1028
|
s.forEach((n) => {
|
|
1026
1029
|
if (!n.typeName) return;
|
|
1027
|
-
(Array.isArray(n.typeName) ? n.typeName : [n?.typeName ?? r]).map((a) =>
|
|
1030
|
+
(Array.isArray(n.typeName) ? n.typeName : [n?.typeName ?? r]).map((a) => d.collectionPath(d.createInstance(a), n)).forEach((a) => {
|
|
1028
1031
|
t[a] || (t[a] = []), t[a].push(n);
|
|
1029
1032
|
});
|
|
1030
1033
|
});
|
|
@@ -1052,39 +1055,45 @@ class L {
|
|
|
1052
1055
|
set documentChangeListenerSubscriber(e) {
|
|
1053
1056
|
this.subscribeToDocumentChangeListener = e;
|
|
1054
1057
|
}
|
|
1058
|
+
set beforeQueryOwnerCollection(e) {
|
|
1059
|
+
this._beforeQueryOwnerCollection = e;
|
|
1060
|
+
}
|
|
1055
1061
|
set resolveCollectionPaths(e) {
|
|
1056
1062
|
this._resolveCollectionPaths = e;
|
|
1057
1063
|
}
|
|
1058
1064
|
async onDocumentChange(e, t) {
|
|
1059
|
-
const r = b.toPersistentDocumentChange(e);
|
|
1060
|
-
r.before && (await Promise.all(t.map(async (
|
|
1061
|
-
const
|
|
1062
|
-
await Promise.all(
|
|
1063
|
-
const
|
|
1064
|
-
let c =
|
|
1065
|
-
|
|
1066
|
-
const
|
|
1067
|
-
|
|
1068
|
-
}),
|
|
1069
|
-
const
|
|
1070
|
-
return
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1065
|
+
const r = b.toPersistentDocumentChange(e), s = {};
|
|
1066
|
+
r.before && (await Promise.all(t.map(async (n) => {
|
|
1067
|
+
const o = M.ownerCollectionPath(d.createInstance(n.ownerClassName()), n, r.params), a = await this._resolveCollectionPaths(o);
|
|
1068
|
+
await Promise.all(a.map(async (l) => {
|
|
1069
|
+
const u = I.getModel(l);
|
|
1070
|
+
let c = u.find(), P = !1;
|
|
1071
|
+
n.cachedProps?.forEach((g) => {
|
|
1072
|
+
const S = r.before[g], O = r.after[g];
|
|
1073
|
+
S !== O && (P = !0);
|
|
1074
|
+
}), P && (n.searchableArray ? c = c.where(n.name, "contains", r.before) : c = c.where(n.name, "==", r.before)), c = this._beforeQueryOwnerCollection?.(c) ?? c;
|
|
1075
|
+
const E = await c.get();
|
|
1076
|
+
return s[l] = {
|
|
1077
|
+
totalDocumentsToUpdate: E.length,
|
|
1078
|
+
updatedDocuments: []
|
|
1079
|
+
}, Promise.all([
|
|
1080
|
+
E.map(async (g) => {
|
|
1081
|
+
let S = !1;
|
|
1082
|
+
if (n.cachedProps?.forEach((O) => {
|
|
1083
|
+
const N = r.before[O], q = r.after[O];
|
|
1084
|
+
N !== q && (S = !0);
|
|
1085
|
+
}), S) {
|
|
1086
|
+
if (n.searchableArray) {
|
|
1087
|
+
const O = g[n.name].findIndex((N) => N.id === r.before.id);
|
|
1088
|
+
g[n.name][O] = r.after;
|
|
1080
1089
|
} else
|
|
1081
|
-
g[`_${
|
|
1082
|
-
this.beforeUpdate?.(g,
|
|
1090
|
+
g[`_${n.name}`] = r.after;
|
|
1091
|
+
this.beforeUpdate?.(g, n), await u.save(g), s[l]?.updatedDocuments.push(g.id), this.afterUpdate?.(g, n);
|
|
1083
1092
|
} else await Promise.resolve();
|
|
1084
1093
|
})
|
|
1085
1094
|
]);
|
|
1086
1095
|
}));
|
|
1087
|
-
})), this.onAllPropsUpdatedCallback?.());
|
|
1096
|
+
})), this.onAllPropsUpdatedCallback?.(s, t));
|
|
1088
1097
|
}
|
|
1089
1098
|
static ownerCollectionPath(e, t, r) {
|
|
1090
1099
|
let s;
|
|
@@ -1096,7 +1105,7 @@ class b {
|
|
|
1096
1105
|
this._cachedPropsUpdater = void 0;
|
|
1097
1106
|
}
|
|
1098
1107
|
installCachedPropsUpdater(e) {
|
|
1099
|
-
return this._cachedPropsUpdater = new
|
|
1108
|
+
return this._cachedPropsUpdater = new M(e), this._cachedPropsUpdater.documentChangeListenerSubscriber = this.subscribeToDocumentChangeListener.bind(this), this._cachedPropsUpdater.resolveCollectionPaths = this.resolveCollectionPaths.bind(this), this._cachedPropsUpdater.installUpdaters();
|
|
1100
1109
|
}
|
|
1101
1110
|
uninstallCachedPropsUpdater() {
|
|
1102
1111
|
this._cachedPropsUpdater?.uninstallUpdaters(), this._cachedPropsUpdater = void 0;
|
|
@@ -1118,9 +1127,9 @@ class b {
|
|
|
1118
1127
|
*/
|
|
1119
1128
|
static toPropertyPathOperations(e) {
|
|
1120
1129
|
return e ? e.map((t) => {
|
|
1121
|
-
if (b.isArrayOperator(t.operator) && t.value[0] instanceof
|
|
1130
|
+
if (b.isArrayOperator(t.operator) && t.value[0] instanceof d)
|
|
1122
1131
|
return {
|
|
1123
|
-
property:
|
|
1132
|
+
property: d.searchableArrayNameFor(t.property),
|
|
1124
1133
|
operator: t.operator,
|
|
1125
1134
|
value: t.value.map((o) => o.id),
|
|
1126
1135
|
aggregate: t.aggregate
|
|
@@ -1140,8 +1149,8 @@ class b {
|
|
|
1140
1149
|
static toPersistentDocumentChange(e) {
|
|
1141
1150
|
return {
|
|
1142
1151
|
...e,
|
|
1143
|
-
before: e.before &&
|
|
1144
|
-
after: e.after &&
|
|
1152
|
+
before: e.before && d.createInstance(e.before),
|
|
1153
|
+
after: e.after && d.createInstance(e.after)
|
|
1145
1154
|
};
|
|
1146
1155
|
}
|
|
1147
1156
|
static toPropertyPathValue(e) {
|
|
@@ -1156,13 +1165,13 @@ class b {
|
|
|
1156
1165
|
return new RegExp("^" + s + "$").test(t);
|
|
1157
1166
|
}
|
|
1158
1167
|
static extractTemplateParams(e, t) {
|
|
1159
|
-
const r = [], n = t.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&").replace(/\\\{([^}]+)\\\}/g, (
|
|
1160
|
-
return a && r.forEach((
|
|
1161
|
-
|
|
1162
|
-
}),
|
|
1168
|
+
const r = [], n = t.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&").replace(/\\\{([^}]+)\\\}/g, (u, c) => (r.push(c), "([^/]+)")), o = new RegExp("^" + n + "$"), a = e.match(o), l = {};
|
|
1169
|
+
return a && r.forEach((u, c) => {
|
|
1170
|
+
l[u] = a[c + 1];
|
|
1171
|
+
}), l;
|
|
1163
1172
|
}
|
|
1164
1173
|
}
|
|
1165
|
-
class
|
|
1174
|
+
class be extends b {
|
|
1166
1175
|
/**
|
|
1167
1176
|
* @param jsonRawData the JSON object to be used as data store
|
|
1168
1177
|
*/
|
|
@@ -1223,12 +1232,12 @@ class ye extends b {
|
|
|
1223
1232
|
s || (this._collectionListeners[t] = {}, s = this._collectionListeners[t]);
|
|
1224
1233
|
const n = (a) => {
|
|
1225
1234
|
if (!a.after) return;
|
|
1226
|
-
const
|
|
1227
|
-
a.before &&
|
|
1228
|
-
const
|
|
1229
|
-
|
|
1235
|
+
const l = [a.after];
|
|
1236
|
+
a.before && l.push(a.before);
|
|
1237
|
+
const c = this.retrieveQueryDocs(l, e.operations).filter((P, E, g) => E === g.findIndex((S) => S.id === P.id));
|
|
1238
|
+
c.length > 0 && r(c.map((P) => ({
|
|
1230
1239
|
before: a.before,
|
|
1231
|
-
after:
|
|
1240
|
+
after: P,
|
|
1232
1241
|
type: a.type,
|
|
1233
1242
|
params: a.params
|
|
1234
1243
|
})));
|
|
@@ -1272,7 +1281,7 @@ class ye extends b {
|
|
|
1272
1281
|
return r.forEach((n) => {
|
|
1273
1282
|
let o = this._serverCollectionListeners[n];
|
|
1274
1283
|
o || (o = this._serverCollectionListeners[n] = {}), o[s] = (a) => {
|
|
1275
|
-
const
|
|
1284
|
+
const l = b.extractTemplateParams(n, e);
|
|
1276
1285
|
t({
|
|
1277
1286
|
...a,
|
|
1278
1287
|
before: a.before,
|
|
@@ -1280,7 +1289,7 @@ class ye extends b {
|
|
|
1280
1289
|
collectionPath: n,
|
|
1281
1290
|
params: {
|
|
1282
1291
|
...a.params,
|
|
1283
|
-
...
|
|
1292
|
+
...l
|
|
1284
1293
|
}
|
|
1285
1294
|
});
|
|
1286
1295
|
};
|
|
@@ -1310,7 +1319,7 @@ class ye extends b {
|
|
|
1310
1319
|
limit: (n) => e,
|
|
1311
1320
|
//.slice( 0, limit ),
|
|
1312
1321
|
operations: (n) => this.retrieveQueryDocs(e, n),
|
|
1313
|
-
sort: ({ order: n, propertyName: o }) => e.sort((a,
|
|
1322
|
+
sort: ({ order: n, propertyName: o }) => e.sort((a, l) => n === "asc" ? this.deepValue(a, o) > this.deepValue(l, o) ? 1 : -1 : this.deepValue(a, o) < this.deepValue(l, o) ? 1 : -1)
|
|
1314
1323
|
}[t](r);
|
|
1315
1324
|
}
|
|
1316
1325
|
retrieveQueryDocs(e, t) {
|
|
@@ -1327,16 +1336,16 @@ class ye extends b {
|
|
|
1327
1336
|
}
|
|
1328
1337
|
isQueryMatched(e, t) {
|
|
1329
1338
|
const r = {
|
|
1330
|
-
"==": (
|
|
1331
|
-
"!=": (
|
|
1332
|
-
"<": (
|
|
1333
|
-
"<=": (
|
|
1334
|
-
">": (
|
|
1335
|
-
">=": (
|
|
1336
|
-
containsAny: (
|
|
1337
|
-
contains: (
|
|
1338
|
-
}, { property: s, value: n, operator: o } = t, [a,
|
|
1339
|
-
return r[o](a,
|
|
1339
|
+
"==": (u, c) => u === c,
|
|
1340
|
+
"!=": (u, c) => u !== c,
|
|
1341
|
+
"<": (u, c) => u < c,
|
|
1342
|
+
"<=": (u, c) => u <= c,
|
|
1343
|
+
">": (u, c) => u > c,
|
|
1344
|
+
">=": (u, c) => u >= c,
|
|
1345
|
+
containsAny: (u, c) => u?.some((P) => c?.includes(P)),
|
|
1346
|
+
contains: (u, c) => u?.includes(c)
|
|
1347
|
+
}, { property: s, value: n, operator: o } = t, [a, l] = this.retrieveValuesToCompare(e, s, n);
|
|
1348
|
+
return r[o](a, l);
|
|
1340
1349
|
}
|
|
1341
1350
|
retrieveValuesToCompare(e, t, r) {
|
|
1342
1351
|
const s = e[t];
|
|
@@ -1388,18 +1397,18 @@ const w = class w {
|
|
|
1388
1397
|
}
|
|
1389
1398
|
};
|
|
1390
1399
|
w._cloudStorageFactoryMap = {};
|
|
1391
|
-
let
|
|
1392
|
-
function
|
|
1393
|
-
return
|
|
1400
|
+
let C = w;
|
|
1401
|
+
function re(i, e) {
|
|
1402
|
+
return C.registerCloudStorage(i, e), (t) => {
|
|
1394
1403
|
t.prototype.__className = i;
|
|
1395
1404
|
};
|
|
1396
1405
|
}
|
|
1397
|
-
var
|
|
1398
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
1406
|
+
var se = Object.getOwnPropertyDescriptor, ie = (i, e, t, r) => {
|
|
1407
|
+
for (var s = r > 1 ? void 0 : r ? se(e, t) : e, n = i.length - 1, o; n >= 0; n--)
|
|
1399
1408
|
(o = i[n]) && (s = o(s) || s);
|
|
1400
1409
|
return s;
|
|
1401
1410
|
};
|
|
1402
|
-
let
|
|
1411
|
+
let k = class extends C {
|
|
1403
1412
|
constructor(i = "") {
|
|
1404
1413
|
super(), this._simulateDelay = 0, this._pendingPromises = [], this.mockFileSystem = {}, this._pathToMockFiles = i;
|
|
1405
1414
|
}
|
|
@@ -1447,21 +1456,21 @@ let F = class extends D {
|
|
|
1447
1456
|
return delete this.mockFileSystem[i], this.resolveWithDelay();
|
|
1448
1457
|
}
|
|
1449
1458
|
};
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
],
|
|
1453
|
-
var
|
|
1454
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
1459
|
+
k = ie([
|
|
1460
|
+
re("MockCloudStorage", () => new k())
|
|
1461
|
+
], k);
|
|
1462
|
+
var ne = Object.defineProperty, oe = Object.getOwnPropertyDescriptor, j = (i, e, t, r) => {
|
|
1463
|
+
for (var s = r > 1 ? void 0 : r ? oe(e, t) : e, n = i.length - 1, o; n >= 0; n--)
|
|
1455
1464
|
(o = i[n]) && (s = (r ? o(e, t, s) : o(s)) || s);
|
|
1456
|
-
return r && s &&
|
|
1457
|
-
},
|
|
1458
|
-
let
|
|
1465
|
+
return r && s && ne(e, t, s), s;
|
|
1466
|
+
}, ae = /* @__PURE__ */ ((i) => (i[i.stored = 0] = "stored", i[i.pendingDataSet = 1] = "pendingDataSet", i[i.deleted = 2] = "deleted", i))(ae || {});
|
|
1467
|
+
let D = class extends d {
|
|
1459
1468
|
constructor() {
|
|
1460
|
-
super(...arguments), this._onChange = new
|
|
1469
|
+
super(...arguments), this._onChange = new L();
|
|
1461
1470
|
}
|
|
1462
1471
|
async save({ data: i, fileName: e, progress: t, cloudStorageProvider: r } = {}) {
|
|
1463
1472
|
const s = i || this._pendingData;
|
|
1464
|
-
s && (this._reference && await this.delete(), this.provider = r ||
|
|
1473
|
+
s && (this._reference && await this.delete(), this.provider = r || C.defaultCloudStorage, this._originalFileName = e || (s instanceof File ? s.name : void 0), this._reference = await this.provider.save(this.id, s, t), this._url = await this.provider.getUrl(this._reference), this._pendingData = void 0, this._onChange.notify({ event: 0, storedFile: this }));
|
|
1465
1474
|
}
|
|
1466
1475
|
uploadControl() {
|
|
1467
1476
|
return this.provider.uploadControl();
|
|
@@ -1476,9 +1485,9 @@ let S = class extends l {
|
|
|
1476
1485
|
get provider() {
|
|
1477
1486
|
if (!this._provider)
|
|
1478
1487
|
try {
|
|
1479
|
-
this._provider =
|
|
1488
|
+
this._provider = C.createInstance(this._cloudStorageProviderName);
|
|
1480
1489
|
} catch {
|
|
1481
|
-
this._provider =
|
|
1490
|
+
this._provider = C.defaultCloudStorage;
|
|
1482
1491
|
}
|
|
1483
1492
|
return this._provider;
|
|
1484
1493
|
}
|
|
@@ -1504,27 +1513,27 @@ let S = class extends l {
|
|
|
1504
1513
|
};
|
|
1505
1514
|
j([
|
|
1506
1515
|
U
|
|
1507
|
-
],
|
|
1516
|
+
], D.prototype, "_reference", 2);
|
|
1508
1517
|
j([
|
|
1509
1518
|
U
|
|
1510
|
-
],
|
|
1519
|
+
], D.prototype, "_url", 2);
|
|
1511
1520
|
j([
|
|
1512
1521
|
U
|
|
1513
|
-
],
|
|
1522
|
+
], D.prototype, "_cloudStorageProviderName", 2);
|
|
1514
1523
|
j([
|
|
1515
1524
|
U
|
|
1516
|
-
],
|
|
1525
|
+
], D.prototype, "_originalFileName", 2);
|
|
1517
1526
|
j([
|
|
1518
1527
|
U
|
|
1519
|
-
],
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
],
|
|
1528
|
+
], D.prototype, "_mimeType", 2);
|
|
1529
|
+
D = j([
|
|
1530
|
+
ee("StoredFile")
|
|
1531
|
+
], D);
|
|
1523
1532
|
class W {
|
|
1524
1533
|
}
|
|
1525
1534
|
const p = class p extends W {
|
|
1526
1535
|
constructor() {
|
|
1527
|
-
if (super(), this._onAuthStateChange = new
|
|
1536
|
+
if (super(), this._onAuthStateChange = new L(), !p._authService) throw new Error(p.error.shouldBeRegistered);
|
|
1528
1537
|
p._authService.onAuthStateChange(
|
|
1529
1538
|
(e) => this.authStateChanged(e)
|
|
1530
1539
|
);
|
|
@@ -1648,14 +1657,14 @@ const p = class p extends W {
|
|
|
1648
1657
|
}
|
|
1649
1658
|
};
|
|
1650
1659
|
p.error = { shouldBeRegistered: "You should register an auth service before using Auth." }, p._instance = void 0;
|
|
1651
|
-
let
|
|
1652
|
-
class
|
|
1660
|
+
let x = p;
|
|
1661
|
+
class Pe extends W {
|
|
1653
1662
|
constructor() {
|
|
1654
1663
|
super(...arguments), this.pendingPromises = [], this._fakeRegisteredUsers = {};
|
|
1655
1664
|
}
|
|
1656
1665
|
signUp(e) {
|
|
1657
|
-
const { verificationLink: t, email: r, password: s, authProvider: n } = e, o = new Promise(async (a,
|
|
1658
|
-
n === "email" && (r ||
|
|
1666
|
+
const { verificationLink: t, email: r, password: s, authProvider: n } = e, o = new Promise(async (a, l) => {
|
|
1667
|
+
n === "email" && (r || l({ code: "missingEmail", message: "missingEmail" }), s || l({ code: "missingPassword", message: "missingPassword" })), s !== "fail" && r !== "fail" ? (this._loggedUser = this.userCredentials(e), this._fakeRegisteredUsers[this._loggedUser.id] = this._loggedUser, a(this._loggedUser), this.notifyChange?.(this._loggedUser)) : (l({ code: "userNotFound", message: t || "Test auth error" }), this.notifyChange?.(void 0));
|
|
1659
1668
|
});
|
|
1660
1669
|
return this.pendingPromises.push(o), o;
|
|
1661
1670
|
}
|
|
@@ -1742,16 +1751,16 @@ const y = class y {
|
|
|
1742
1751
|
}
|
|
1743
1752
|
processParam(e) {
|
|
1744
1753
|
if (e != null)
|
|
1745
|
-
return e instanceof
|
|
1754
|
+
return e instanceof d ? e.toObject() : Array.isArray(e) ? e.map((t) => this.processParam(t)) : typeof e == "object" ? Object.entries(e).reduce((t, [r, s]) => (t[r] = this.processParam(s), t), {}) : e;
|
|
1746
1755
|
}
|
|
1747
1756
|
processResult(e) {
|
|
1748
1757
|
if (e != null)
|
|
1749
|
-
return e.__className ?
|
|
1758
|
+
return e.__className ? d.createInstance(e) : Array.isArray(e) ? e.map((t) => this.processResult(t)) : typeof e == "object" ? Object.entries(e).reduce((t, [r, s]) => (t[r] = this.processResult(s), t), {}) : e;
|
|
1750
1759
|
}
|
|
1751
1760
|
};
|
|
1752
1761
|
y.error = { shouldBeRegistered: "You should register a cloud functions service with useCloudFunctionsService static method before using CloudFunctions." };
|
|
1753
|
-
let
|
|
1754
|
-
class
|
|
1762
|
+
let $ = y;
|
|
1763
|
+
class ve {
|
|
1755
1764
|
constructor(e) {
|
|
1756
1765
|
this._registeredFunctions = e;
|
|
1757
1766
|
}
|
|
@@ -1791,8 +1800,8 @@ const m = class m extends B {
|
|
|
1791
1800
|
}
|
|
1792
1801
|
};
|
|
1793
1802
|
m.error = { shouldBeRegistered: "You should register a Server Auth service before using the Server Auth." }, m._instance = void 0;
|
|
1794
|
-
let
|
|
1795
|
-
class
|
|
1803
|
+
let V = m;
|
|
1804
|
+
class we extends B {
|
|
1796
1805
|
constructor(e) {
|
|
1797
1806
|
super(), this._userCredentials = e;
|
|
1798
1807
|
}
|
|
@@ -1818,63 +1827,63 @@ class ve extends B {
|
|
|
1818
1827
|
return this._userCredentials;
|
|
1819
1828
|
}
|
|
1820
1829
|
}
|
|
1821
|
-
function
|
|
1830
|
+
function Ce(i, e) {
|
|
1822
1831
|
return i ? i.replace(/\${\s*(\w*)\s*}/g, function(t, r) {
|
|
1823
1832
|
return e[r] || "";
|
|
1824
1833
|
}) : "";
|
|
1825
1834
|
}
|
|
1826
|
-
function
|
|
1835
|
+
function De(i) {
|
|
1827
1836
|
return i ? i.replace(
|
|
1828
1837
|
/([-_ ][\w])/g,
|
|
1829
1838
|
(e) => e.toUpperCase().replace("-", "").replace("_", "").replace(" ", "")
|
|
1830
1839
|
) : "";
|
|
1831
1840
|
}
|
|
1832
|
-
function
|
|
1841
|
+
function Se(i, e = "-") {
|
|
1833
1842
|
if (!i) return "";
|
|
1834
1843
|
const t = i.slice(1).replace(/( |[A-Z])/g, (r) => r === " " ? "-" : e + r[0].toLowerCase());
|
|
1835
1844
|
return i[0].toLocaleLowerCase() + t.replace(/--/g, "-");
|
|
1836
1845
|
}
|
|
1837
|
-
function
|
|
1846
|
+
function Oe(i, e) {
|
|
1838
1847
|
return e.split(".").reduce((t, r) => t[r], i);
|
|
1839
1848
|
}
|
|
1840
1849
|
export {
|
|
1841
|
-
|
|
1842
|
-
|
|
1850
|
+
x as Auth,
|
|
1851
|
+
Pe as AuthMock,
|
|
1843
1852
|
W as AuthService,
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1853
|
+
$ as CloudFunctions,
|
|
1854
|
+
ve as CloudFunctionsMock,
|
|
1855
|
+
C as CloudStorage,
|
|
1847
1856
|
b as DataSource,
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1857
|
+
ye as EntropicComponent,
|
|
1858
|
+
be as JsonDataSource,
|
|
1859
|
+
k as MockCloudStorage,
|
|
1851
1860
|
R as Model,
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1861
|
+
L as Observable,
|
|
1862
|
+
d as Persistent,
|
|
1863
|
+
te as Query,
|
|
1864
|
+
V as ServerAuth,
|
|
1865
|
+
we as ServerAuthMock,
|
|
1857
1866
|
B as ServerAuthService,
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1867
|
+
I as Store,
|
|
1868
|
+
D as StoredFile,
|
|
1869
|
+
ae as StoredFileEvent,
|
|
1870
|
+
De as camelCase,
|
|
1871
|
+
Oe as getDeepValue,
|
|
1863
1872
|
U as persistent,
|
|
1864
1873
|
_ as persistentParser,
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1874
|
+
le as persistentPureReference,
|
|
1875
|
+
de as persistentPureReferenceWithCachedProps,
|
|
1876
|
+
ue as persistentReference,
|
|
1877
|
+
ce as persistentReferenceAt,
|
|
1878
|
+
he as persistentReferenceWithCachedProps,
|
|
1879
|
+
re as registerCloudStorage,
|
|
1880
|
+
fe as registerLegacyClassName,
|
|
1881
|
+
ee as registerPersistentClass,
|
|
1882
|
+
Ce as replaceValue,
|
|
1883
|
+
me as required,
|
|
1884
|
+
ge as requiredWithValidator,
|
|
1885
|
+
pe as searchableArray,
|
|
1886
|
+
Se as snakeCase,
|
|
1887
|
+
_e as typeName
|
|
1879
1888
|
};
|
|
1880
1889
|
//# sourceMappingURL=entropic-bond.js.map
|