entropic-bond 1.51.4 → 1.51.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
CHANGED
|
@@ -43,41 +43,41 @@ class F {
|
|
|
43
43
|
return this.subscribers.size;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
let
|
|
46
|
+
let R;
|
|
47
47
|
const x = new Uint8Array(16);
|
|
48
|
-
function
|
|
49
|
-
if (!
|
|
48
|
+
function L() {
|
|
49
|
+
if (!R && (R = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !R))
|
|
50
50
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
51
|
-
return
|
|
51
|
+
return R(x);
|
|
52
52
|
}
|
|
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--)
|
|
77
77
|
(o = i[n]) && (s = (r ? o(e, t, s) : o(s)) || s);
|
|
78
78
|
return r && s && q(e, t, s), s;
|
|
79
|
-
},
|
|
80
|
-
const k = (
|
|
79
|
+
}, l;
|
|
80
|
+
const k = (l = 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
|
|
@@ -131,7 +131,7 @@ const k = (d = class {
|
|
|
131
131
|
* @see registerFactory
|
|
132
132
|
*/
|
|
133
133
|
static annotations(e) {
|
|
134
|
-
if (e instanceof
|
|
134
|
+
if (e instanceof l ? e = e.className : typeof e == "string" || (e = new e().className), !this._factoryMap[e])
|
|
135
135
|
throw new Error(`You should register class ${e} prior to use.`);
|
|
136
136
|
return this._factoryMap[e].annotation;
|
|
137
137
|
}
|
|
@@ -272,7 +272,7 @@ const k = (d = class {
|
|
|
272
272
|
throw new Error("You should register this class prior to streaming it.");
|
|
273
273
|
return this._persistentProperties.forEach((r) => {
|
|
274
274
|
const s = this[r.name], n = this.removeUnderscore(r);
|
|
275
|
-
s != null && (r.isReference ? t[n] = this.toReferenceObj(r, e) : t[n] = this.toDeepObj(s, e), r.searchableArray && (t[
|
|
275
|
+
s != null && (r.isReference ? t[n] = this.toReferenceObj(r, e) : t[n] = this.toDeepObj(s, e), r.searchableArray && (t[l.searchableArrayNameFor(n)] = s.map((o) => o.id)));
|
|
276
276
|
}), t.__className = this.className, t;
|
|
277
277
|
}
|
|
278
278
|
static searchableArrayNameFor(e) {
|
|
@@ -284,11 +284,11 @@ const k = (d = class {
|
|
|
284
284
|
if (Array.isArray(e))
|
|
285
285
|
return e.map((t) => this.fromDeepObject(t));
|
|
286
286
|
if (e.__documentReference) {
|
|
287
|
-
const t = e, r =
|
|
287
|
+
const t = e, r = l.createInstance(t);
|
|
288
288
|
return r.__documentReference = e.__documentReference, r;
|
|
289
289
|
}
|
|
290
290
|
if (e.__className)
|
|
291
|
-
return
|
|
291
|
+
return l.createInstance(e);
|
|
292
292
|
if (typeof e == "object") {
|
|
293
293
|
const t = {};
|
|
294
294
|
return Object.entries(e).forEach(
|
|
@@ -303,7 +303,7 @@ const k = (d = class {
|
|
|
303
303
|
return e.map((r) => this.toDeepObj(r, t));
|
|
304
304
|
if (e.__documentReference)
|
|
305
305
|
return e;
|
|
306
|
-
if (e instanceof
|
|
306
|
+
if (e instanceof l)
|
|
307
307
|
return e.toObj(t);
|
|
308
308
|
if (typeof e == "object") {
|
|
309
309
|
const r = {};
|
|
@@ -320,7 +320,7 @@ const k = (d = class {
|
|
|
320
320
|
}
|
|
321
321
|
toReferenceObj(e, t) {
|
|
322
322
|
const r = this[e.name];
|
|
323
|
-
return Array.isArray(r) ? r.map((s) => (e.isPureReference || this.pushDocument(t,
|
|
323
|
+
return Array.isArray(r) ? r.map((s) => (e.isPureReference || this.pushDocument(t, l.collectionPath(s, e), s), this.buildRefObject(s, l.collectionPath(s, e), e.cachedProps))) : (e.isPureReference || this.pushDocument(t, l.collectionPath(r, e), r), this.buildRefObject(r, l.collectionPath(r, e), e.cachedProps));
|
|
324
324
|
}
|
|
325
325
|
buildRefObject(e, t, r) {
|
|
326
326
|
const s = r == null ? void 0 : r.reduce((n, o) => (e[o] !== void 0 && (n[o] = e[o]), n), {});
|
|
@@ -344,14 +344,14 @@ const k = (d = class {
|
|
|
344
344
|
return e.name.slice(1);
|
|
345
345
|
}
|
|
346
346
|
static createReference(e) {
|
|
347
|
-
const t =
|
|
347
|
+
const t = l.createInstance(e);
|
|
348
348
|
return t.__documentReference = e.__documentReference || { storedInCollection: t.className }, t;
|
|
349
349
|
}
|
|
350
350
|
static createInstance(e) {
|
|
351
351
|
if (typeof e == "string")
|
|
352
|
-
return new (
|
|
352
|
+
return new (l.classFactory(e))();
|
|
353
353
|
try {
|
|
354
|
-
return new (
|
|
354
|
+
return new (l.classFactory(e.__className))().fromObject(e);
|
|
355
355
|
} catch (t) {
|
|
356
356
|
const r = Object.entries(e).filter(([s, n]) => n != null && typeof n != "function").map(([s, n]) => `${s}: ${n}`).join(`,
|
|
357
357
|
`);
|
|
@@ -364,13 +364,25 @@ const k = (d = class {
|
|
|
364
364
|
}
|
|
365
365
|
}
|
|
366
366
|
static propInfo(e, t) {
|
|
367
|
-
return
|
|
367
|
+
return l.createInstance(e).getPropInfo(t);
|
|
368
368
|
}
|
|
369
|
-
|
|
369
|
+
/**
|
|
370
|
+
* Retrieves a collection of references with the properties that are stored in the reference object
|
|
371
|
+
* @returns the references collection
|
|
372
|
+
*/
|
|
373
|
+
static getSystemRegisteredReferencesWithCachedProps() {
|
|
374
|
+
return l.registeredClasses().reduce((r, s) => {
|
|
375
|
+
const o = l.createInstance(s).getPersistentProperties().filter(
|
|
376
|
+
(a) => a.cachedProps
|
|
377
|
+
);
|
|
378
|
+
return o.length > 0 && (r[s] = o), r;
|
|
379
|
+
}, {});
|
|
380
|
+
}
|
|
381
|
+
}, l._factoryMap = {}, l);
|
|
370
382
|
z([
|
|
371
383
|
S
|
|
372
384
|
], k.prototype, "_id", 2);
|
|
373
|
-
let
|
|
385
|
+
let d = k;
|
|
374
386
|
function S(i, e) {
|
|
375
387
|
return _()(i, e);
|
|
376
388
|
}
|
|
@@ -419,12 +431,12 @@ function _(i) {
|
|
|
419
431
|
}
|
|
420
432
|
function H(i, e) {
|
|
421
433
|
return (t) => {
|
|
422
|
-
|
|
434
|
+
d.registerFactory(i, t, e), t.prototype.__className = i;
|
|
423
435
|
};
|
|
424
436
|
}
|
|
425
437
|
function ce(i) {
|
|
426
438
|
return (e) => {
|
|
427
|
-
|
|
439
|
+
d.registerFactory(i, e);
|
|
428
440
|
};
|
|
429
441
|
}
|
|
430
442
|
function ue(i, e) {
|
|
@@ -438,7 +450,7 @@ function le(i = (e) => e != null) {
|
|
|
438
450
|
return _({ validator: i })(e, t);
|
|
439
451
|
};
|
|
440
452
|
}
|
|
441
|
-
class de extends
|
|
453
|
+
class de extends d {
|
|
442
454
|
constructor() {
|
|
443
455
|
super(...arguments), this._onChange = new F();
|
|
444
456
|
}
|
|
@@ -523,14 +535,14 @@ class de extends l {
|
|
|
523
535
|
return this.notify({ [e]: this[e] }), t;
|
|
524
536
|
}
|
|
525
537
|
}
|
|
526
|
-
const
|
|
538
|
+
const j = class j {
|
|
527
539
|
constructor(e, t, r) {
|
|
528
540
|
if (r) {
|
|
529
|
-
if (!(t instanceof
|
|
530
|
-
throw new Error(
|
|
541
|
+
if (!(t instanceof d))
|
|
542
|
+
throw new Error(j.error.persistentNeedForSubCollection);
|
|
531
543
|
this.collectionName = `${t.className}/${t.id}/${r}`;
|
|
532
544
|
} else
|
|
533
|
-
this.collectionName = t instanceof
|
|
545
|
+
this.collectionName = t instanceof d ? t.className : t;
|
|
534
546
|
this._stream = e;
|
|
535
547
|
}
|
|
536
548
|
/**
|
|
@@ -545,7 +557,7 @@ const E = class E {
|
|
|
545
557
|
findById(e, t) {
|
|
546
558
|
return new Promise((r, s) => {
|
|
547
559
|
this._stream.findById(e, this.collectionName).then((n) => {
|
|
548
|
-
n ? (t ? t.fromObject(n) : t =
|
|
560
|
+
n ? (t ? t.fromObject(n) : t = d.createInstance(n), r(t)) : r(void 0);
|
|
549
561
|
}).catch((n) => s(n));
|
|
550
562
|
});
|
|
551
563
|
}
|
|
@@ -587,7 +599,7 @@ const E = class E {
|
|
|
587
599
|
*/
|
|
588
600
|
query(e = {}, t) {
|
|
589
601
|
if (t) {
|
|
590
|
-
const r = t instanceof
|
|
602
|
+
const r = t instanceof d ? t.className : t;
|
|
591
603
|
e.operations || (e.operations = []), e.operations.push(
|
|
592
604
|
{ property: "__className", operator: "==", value: r }
|
|
593
605
|
);
|
|
@@ -625,7 +637,7 @@ const E = class E {
|
|
|
625
637
|
mapToInstance(e) {
|
|
626
638
|
return new Promise((t, r) => {
|
|
627
639
|
e().then((s) => t(
|
|
628
|
-
s.map((n) =>
|
|
640
|
+
s.map((n) => d.createInstance(n))
|
|
629
641
|
)).catch((s) => r(s));
|
|
630
642
|
});
|
|
631
643
|
}
|
|
@@ -643,15 +655,15 @@ const E = class E {
|
|
|
643
655
|
return e;
|
|
644
656
|
const t = ((r = e.operations) == null ? void 0 : r.map((s) => {
|
|
645
657
|
const n = s.value[0] ?? s.value;
|
|
646
|
-
return
|
|
647
|
-
property:
|
|
658
|
+
return E.isArrayOperator(s.operator) && n instanceof d ? {
|
|
659
|
+
property: d.searchableArrayNameFor(s.property),
|
|
648
660
|
operator: s.operator,
|
|
649
661
|
value: Array.isArray(s.value) ? s.value.map((o) => o.id) : n.id,
|
|
650
662
|
aggregate: s.aggregate
|
|
651
663
|
} : {
|
|
652
664
|
property: s.property,
|
|
653
665
|
operator: s.operator,
|
|
654
|
-
value: s.value instanceof
|
|
666
|
+
value: s.value instanceof d ? { id: s.value.id } : s.value,
|
|
655
667
|
aggregate: s.aggregate
|
|
656
668
|
};
|
|
657
669
|
})) ?? [];
|
|
@@ -661,11 +673,11 @@ const E = class E {
|
|
|
661
673
|
};
|
|
662
674
|
}
|
|
663
675
|
};
|
|
664
|
-
|
|
676
|
+
j.error = {
|
|
665
677
|
persistentNeedForSubCollection: "The document parameter for a sub-collection should be a Persistent instace",
|
|
666
678
|
invalidQueryOrder: "Cannot add where calls after or calls"
|
|
667
679
|
};
|
|
668
|
-
let C =
|
|
680
|
+
let C = j;
|
|
669
681
|
class J {
|
|
670
682
|
constructor(e) {
|
|
671
683
|
this.queryObject = { operations: [] }, this.model = e;
|
|
@@ -690,10 +702,10 @@ class J {
|
|
|
690
702
|
* @see orDeepProp
|
|
691
703
|
*/
|
|
692
704
|
where(e, t, r, s) {
|
|
693
|
-
var n, o,
|
|
705
|
+
var n, o, a;
|
|
694
706
|
if ((o = (n = this.queryObject.operations) == null ? void 0 : n.at(-1)) != null && o.aggregate && !s)
|
|
695
707
|
throw new Error(C.error.invalidQueryOrder);
|
|
696
|
-
return (
|
|
708
|
+
return (a = this.queryObject.operations) == null || a.push({
|
|
697
709
|
property: e,
|
|
698
710
|
operator: t,
|
|
699
711
|
value: r,
|
|
@@ -725,17 +737,17 @@ class J {
|
|
|
725
737
|
* @see orDeepProp
|
|
726
738
|
*/
|
|
727
739
|
whereDeepProp(e, t, r, s) {
|
|
728
|
-
var h,
|
|
729
|
-
if ((
|
|
740
|
+
var h, c, u;
|
|
741
|
+
if ((c = (h = this.queryObject.operations) == null ? void 0 : h.at(-1)) != null && c.aggregate && !s)
|
|
730
742
|
throw new Error(C.error.invalidQueryOrder);
|
|
731
743
|
const n = e.split(".");
|
|
732
|
-
let o = {},
|
|
744
|
+
let o = {}, a = n.length > 1 ? o : r;
|
|
733
745
|
return n.slice(1).forEach((P, O) => {
|
|
734
746
|
o[P] = O < n.length - 2 ? {} : r, o = o[P];
|
|
735
747
|
}), (u = this.queryObject.operations) == null || u.push({
|
|
736
748
|
property: n[0],
|
|
737
749
|
operator: t,
|
|
738
|
-
value:
|
|
750
|
+
value: a,
|
|
739
751
|
aggregate: s
|
|
740
752
|
}), this;
|
|
741
753
|
}
|
|
@@ -822,7 +834,7 @@ class J {
|
|
|
822
834
|
*/
|
|
823
835
|
instanceOf(e) {
|
|
824
836
|
var r;
|
|
825
|
-
const t = e instanceof
|
|
837
|
+
const t = e instanceof d ? e.className : e;
|
|
826
838
|
return (r = this.queryObject.operations) == null || r.push({
|
|
827
839
|
property: "__className",
|
|
828
840
|
operator: "==",
|
|
@@ -962,21 +974,21 @@ const y = class y {
|
|
|
962
974
|
};
|
|
963
975
|
y.error = { shouldBeRegistered: "You should register a data source before using the data Store." };
|
|
964
976
|
let A = y;
|
|
965
|
-
class
|
|
966
|
-
installCachedPropsUpdaters(e
|
|
967
|
-
this.onUpdate = e;
|
|
968
|
-
const
|
|
969
|
-
return Object.entries(
|
|
970
|
-
|
|
971
|
-
if (!
|
|
977
|
+
class E {
|
|
978
|
+
installCachedPropsUpdaters(e = {}) {
|
|
979
|
+
this.onUpdate = e.onUpdate;
|
|
980
|
+
const t = [], r = d.getSystemRegisteredReferencesWithCachedProps();
|
|
981
|
+
return Object.entries(r).forEach(([s, n]) => {
|
|
982
|
+
n.forEach((o) => {
|
|
983
|
+
if (!o.storeInCollection)
|
|
972
984
|
return;
|
|
973
|
-
|
|
974
|
-
if (h)
|
|
975
|
-
|
|
976
|
-
else if (
|
|
985
|
+
let a;
|
|
986
|
+
if (e.documentChangeListerner ? a = e.documentChangeListerner(o, (h) => this.onDocumentChange(h, o, s)) : a = this.subscribeToDocumentChangeListerner(o, (h) => this.onDocumentChange(h, o, s)), a)
|
|
987
|
+
t.push(a);
|
|
988
|
+
else if (e.noThrowOnNonImplementedListener)
|
|
977
989
|
throw new Error("The method documentChangeListerner has not been implemented in the concrete data source");
|
|
978
990
|
});
|
|
979
|
-
}),
|
|
991
|
+
}), t;
|
|
980
992
|
}
|
|
981
993
|
/**
|
|
982
994
|
* Installs a document change listener
|
|
@@ -1003,9 +1015,9 @@ class D {
|
|
|
1003
1015
|
*/
|
|
1004
1016
|
static toPropertyPathOperations(e) {
|
|
1005
1017
|
return e ? e.map((t) => {
|
|
1006
|
-
if (
|
|
1018
|
+
if (E.isArrayOperator(t.operator) && t.value[0] instanceof d)
|
|
1007
1019
|
return {
|
|
1008
|
-
property:
|
|
1020
|
+
property: d.searchableArrayNameFor(t.property),
|
|
1009
1021
|
operator: t.operator,
|
|
1010
1022
|
value: t.value.map((o) => o.id),
|
|
1011
1023
|
aggregate: t.aggregate
|
|
@@ -1034,32 +1046,24 @@ class D {
|
|
|
1034
1046
|
return;
|
|
1035
1047
|
const s = A.getModel(r);
|
|
1036
1048
|
let n = s.find();
|
|
1037
|
-
t.cachedProps.forEach((
|
|
1038
|
-
const h = e.before[
|
|
1039
|
-
h !==
|
|
1049
|
+
t.cachedProps.forEach((a) => {
|
|
1050
|
+
const h = e.before[a], c = e.after[a];
|
|
1051
|
+
h !== c && (n = n.orDeepProp(`${t.name}.${a}`, "==", h));
|
|
1040
1052
|
});
|
|
1041
1053
|
const o = await n.get();
|
|
1042
1054
|
return Promise.all([
|
|
1043
|
-
o.map(async (
|
|
1055
|
+
o.map(async (a) => {
|
|
1044
1056
|
var h;
|
|
1045
|
-
(h = t.cachedProps) == null || h.forEach(async (
|
|
1057
|
+
(h = t.cachedProps) == null || h.forEach(async (c) => {
|
|
1046
1058
|
var O;
|
|
1047
|
-
const u = e.before[
|
|
1048
|
-
u !== P && (
|
|
1059
|
+
const u = e.before[c], P = e.after[c];
|
|
1060
|
+
u !== P && (a[`_${t.name}`][`_${c}`] = P, await s.save(a), (O = this.onUpdate) == null || O.call(this, a, t, r));
|
|
1049
1061
|
});
|
|
1050
1062
|
})
|
|
1051
1063
|
]);
|
|
1052
1064
|
}
|
|
1053
|
-
static getSystemRegisteredReferencesWithStoredProps() {
|
|
1054
|
-
return l.registeredClasses().reduce((r, s) => {
|
|
1055
|
-
const o = l.createInstance(s).getPersistentProperties().filter(
|
|
1056
|
-
(c) => c.cachedProps
|
|
1057
|
-
);
|
|
1058
|
-
return o.length > 0 && (r[s] = o), r;
|
|
1059
|
-
}, {});
|
|
1060
|
-
}
|
|
1061
1065
|
}
|
|
1062
|
-
class fe extends
|
|
1066
|
+
class fe extends E {
|
|
1063
1067
|
/**
|
|
1064
1068
|
* @param jsonRawData the JSON object to be used as data store
|
|
1065
1069
|
*/
|
|
@@ -1105,7 +1109,7 @@ class fe extends D {
|
|
|
1105
1109
|
throw new Error(this._simulateError.find);
|
|
1106
1110
|
const r = Object.values(this._jsonRawData[t] || {});
|
|
1107
1111
|
return e ? (this._lastLimit = e.limit || 0, this._cursor = 0, this._lastMatchingDocs = Object.entries(e).reduce(
|
|
1108
|
-
(n, [o,
|
|
1112
|
+
(n, [o, a]) => this.queryProcessor(n, o, a),
|
|
1109
1113
|
Object.values(r)
|
|
1110
1114
|
), this.resolveWithDelay(this._lastMatchingDocs.slice(0, e.limit))) : this.resolveWithDelay(r);
|
|
1111
1115
|
}
|
|
@@ -1148,7 +1152,7 @@ class fe extends D {
|
|
|
1148
1152
|
} : this._simulateError = e, this);
|
|
1149
1153
|
}
|
|
1150
1154
|
subscribeToDocumentChangeListerner(e, t) {
|
|
1151
|
-
const r =
|
|
1155
|
+
const r = d.collectionPath(void 0, e);
|
|
1152
1156
|
if (r)
|
|
1153
1157
|
return delete this._listener[r], this._listener[r] = t, {
|
|
1154
1158
|
uninstall: () => delete this._listener[r],
|
|
@@ -1171,13 +1175,13 @@ class fe extends D {
|
|
|
1171
1175
|
limit: (n) => e,
|
|
1172
1176
|
//.slice( 0, limit ),
|
|
1173
1177
|
operations: (n) => this.retrieveQueryDocs(e, n),
|
|
1174
|
-
sort: ({ order: n, propertyName: o }) => e.sort((
|
|
1178
|
+
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
1179
|
}[t](r);
|
|
1176
1180
|
}
|
|
1177
1181
|
retrieveQueryDocs(e, t) {
|
|
1178
1182
|
return t.reduce((r, s, n) => {
|
|
1179
1183
|
if (s.aggregate) {
|
|
1180
|
-
const o = e.filter((
|
|
1184
|
+
const o = e.filter((a) => this.isQueryMatched(a, s));
|
|
1181
1185
|
return n === 0 ? o : r.concat(o);
|
|
1182
1186
|
} else
|
|
1183
1187
|
return r.filter((o) => this.isQueryMatched(o, s));
|
|
@@ -1188,22 +1192,22 @@ class fe extends D {
|
|
|
1188
1192
|
}
|
|
1189
1193
|
isQueryMatched(e, t) {
|
|
1190
1194
|
const r = {
|
|
1191
|
-
"==": (
|
|
1192
|
-
"!=": (
|
|
1193
|
-
"<": (
|
|
1194
|
-
"<=": (
|
|
1195
|
-
">": (
|
|
1196
|
-
">=": (
|
|
1197
|
-
containsAny: (
|
|
1198
|
-
contains: (
|
|
1199
|
-
}, { property: s, value: n, operator: o } = t, [
|
|
1200
|
-
return r[o](
|
|
1195
|
+
"==": (c, u) => c === u,
|
|
1196
|
+
"!=": (c, u) => c !== u,
|
|
1197
|
+
"<": (c, u) => c < u,
|
|
1198
|
+
"<=": (c, u) => c <= u,
|
|
1199
|
+
">": (c, u) => c > u,
|
|
1200
|
+
">=": (c, u) => c >= u,
|
|
1201
|
+
containsAny: (c, u) => c == null ? void 0 : c.some((P) => u == null ? void 0 : u.includes(P)),
|
|
1202
|
+
contains: (c, u) => c == null ? void 0 : c.includes(u)
|
|
1203
|
+
}, { property: s, value: n, operator: o } = t, [a, h] = this.retrieveValuesToCompare(e, s, n);
|
|
1204
|
+
return r[o](a, h);
|
|
1201
1205
|
}
|
|
1202
1206
|
retrieveValuesToCompare(e, t, r) {
|
|
1203
1207
|
const s = e[t];
|
|
1204
1208
|
if (s && typeof r == "object" && !Array.isArray(r)) {
|
|
1205
|
-
const
|
|
1206
|
-
var [n, o] = this.retrieveValuesToCompare(s,
|
|
1209
|
+
const a = Object.keys(r)[0];
|
|
1210
|
+
var [n, o] = this.retrieveValuesToCompare(s, a, r == null ? void 0 : r[a]);
|
|
1207
1211
|
}
|
|
1208
1212
|
return [n || s, o || r];
|
|
1209
1213
|
}
|
|
@@ -1307,12 +1311,12 @@ let U = class extends w {
|
|
|
1307
1311
|
U = X([
|
|
1308
1312
|
Z("MockCloudStorage", () => new U())
|
|
1309
1313
|
], U);
|
|
1310
|
-
var ee = Object.defineProperty, te = Object.getOwnPropertyDescriptor,
|
|
1314
|
+
var ee = Object.defineProperty, te = Object.getOwnPropertyDescriptor, D = (i, e, t, r) => {
|
|
1311
1315
|
for (var s = r > 1 ? void 0 : r ? te(e, t) : e, n = i.length - 1, o; n >= 0; n--)
|
|
1312
1316
|
(o = i[n]) && (s = (r ? o(e, t, s) : o(s)) || s);
|
|
1313
1317
|
return r && s && ee(e, t, s), s;
|
|
1314
1318
|
}, re = /* @__PURE__ */ ((i) => (i[i.stored = 0] = "stored", i[i.pendingDataSet = 1] = "pendingDataSet", i[i.deleted = 2] = "deleted", i))(re || {});
|
|
1315
|
-
let b = class extends
|
|
1319
|
+
let b = class extends d {
|
|
1316
1320
|
constructor() {
|
|
1317
1321
|
super(...arguments), this._onChange = new F();
|
|
1318
1322
|
}
|
|
@@ -1360,22 +1364,22 @@ let b = class extends l {
|
|
|
1360
1364
|
return this._onChange.subscribe(i);
|
|
1361
1365
|
}
|
|
1362
1366
|
};
|
|
1363
|
-
|
|
1367
|
+
D([
|
|
1364
1368
|
S
|
|
1365
1369
|
], b.prototype, "_reference", 2);
|
|
1366
|
-
|
|
1370
|
+
D([
|
|
1367
1371
|
S
|
|
1368
1372
|
], b.prototype, "_url", 2);
|
|
1369
|
-
|
|
1373
|
+
D([
|
|
1370
1374
|
S
|
|
1371
1375
|
], b.prototype, "_cloudStorageProviderName", 2);
|
|
1372
|
-
|
|
1376
|
+
D([
|
|
1373
1377
|
S
|
|
1374
1378
|
], b.prototype, "_originalFileName", 2);
|
|
1375
|
-
|
|
1379
|
+
D([
|
|
1376
1380
|
S
|
|
1377
1381
|
], b.prototype, "_mimeType", 2);
|
|
1378
|
-
b =
|
|
1382
|
+
b = D([
|
|
1379
1383
|
H("StoredFile")
|
|
1380
1384
|
], b);
|
|
1381
1385
|
class M {
|
|
@@ -1513,9 +1517,9 @@ class pe extends M {
|
|
|
1513
1517
|
super(...arguments), this.pendingPromises = [], this._fakeRegisteredUsers = {};
|
|
1514
1518
|
}
|
|
1515
1519
|
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,
|
|
1520
|
+
const { verificationLink: t, email: r, password: s, authProvider: n } = e, o = new Promise(async (a, h) => {
|
|
1521
|
+
var c, u;
|
|
1522
|
+
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
1523
|
});
|
|
1520
1524
|
return this.pendingPromises.push(o), o;
|
|
1521
1525
|
}
|
|
@@ -1605,11 +1609,11 @@ const g = class g {
|
|
|
1605
1609
|
}
|
|
1606
1610
|
processParam(e) {
|
|
1607
1611
|
if (e != null)
|
|
1608
|
-
return e instanceof
|
|
1612
|
+
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;
|
|
1609
1613
|
}
|
|
1610
1614
|
processResult(e) {
|
|
1611
1615
|
if (e != null)
|
|
1612
|
-
return e.__className ?
|
|
1616
|
+
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;
|
|
1613
1617
|
}
|
|
1614
1618
|
};
|
|
1615
1619
|
g.error = { shouldBeRegistered: "You should register a cloud functions service with useCloudFunctionsService static method before using CloudFunctions." };
|
|
@@ -1711,13 +1715,13 @@ export {
|
|
|
1711
1715
|
V as CloudFunctions,
|
|
1712
1716
|
me as CloudFunctionsMock,
|
|
1713
1717
|
w as CloudStorage,
|
|
1714
|
-
|
|
1718
|
+
E as DataSource,
|
|
1715
1719
|
de as EntropicComponent,
|
|
1716
1720
|
fe as JsonDataSource,
|
|
1717
1721
|
U as MockCloudStorage,
|
|
1718
1722
|
C as Model,
|
|
1719
1723
|
F as Observable,
|
|
1720
|
-
|
|
1724
|
+
d as Persistent,
|
|
1721
1725
|
J as Query,
|
|
1722
1726
|
$ as ServerAuth,
|
|
1723
1727
|
ge as ServerAuthMock,
|