entropic-bond 1.53.11 → 1.53.13
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
|
@@ -59,28 +59,21 @@ function z() {
|
|
|
59
59
|
}
|
|
60
60
|
return U(Y);
|
|
61
61
|
}
|
|
62
|
-
const H = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto),
|
|
62
|
+
const H = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), $ = { randomUUID: H };
|
|
63
63
|
function J(i, e, t) {
|
|
64
64
|
var s;
|
|
65
|
-
if (
|
|
66
|
-
return
|
|
65
|
+
if ($.randomUUID && !i)
|
|
66
|
+
return $.randomUUID();
|
|
67
67
|
i = i || {};
|
|
68
68
|
const r = i.random ?? ((s = i.rng) == null ? void 0 : s.call(i)) ?? z();
|
|
69
69
|
if (r.length < 16)
|
|
70
70
|
throw new Error("Random bytes length must be >= 16");
|
|
71
|
-
|
|
72
|
-
if (t = t || 0, t < 0 || t + 16 > e.length)
|
|
73
|
-
throw new RangeError(`UUID byte range ${t}:${t + 15} is out of buffer bounds`);
|
|
74
|
-
for (let n = 0; n < 16; ++n)
|
|
75
|
-
e[t + n] = r[n];
|
|
76
|
-
return e;
|
|
77
|
-
}
|
|
78
|
-
return q(r);
|
|
71
|
+
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, q(r);
|
|
79
72
|
}
|
|
80
|
-
var Z = Object.defineProperty, G =
|
|
81
|
-
for (var s =
|
|
82
|
-
(o = i[n]) && (s =
|
|
83
|
-
return
|
|
73
|
+
var Z = Object.defineProperty, G = (i, e, t, r) => {
|
|
74
|
+
for (var s = void 0, n = i.length - 1, o; n >= 0; n--)
|
|
75
|
+
(o = i[n]) && (s = o(e, t, s) || s);
|
|
76
|
+
return s && Z(e, t, s), s;
|
|
84
77
|
}, d;
|
|
85
78
|
const B = (d = class {
|
|
86
79
|
/**
|
|
@@ -103,10 +96,8 @@ const B = (d = class {
|
|
|
103
96
|
* @see annotations
|
|
104
97
|
*/
|
|
105
98
|
static classFactory(e) {
|
|
106
|
-
if (!e)
|
|
107
|
-
|
|
108
|
-
if (!this._factoryMap[e])
|
|
109
|
-
throw new Error(`You should register class ${e} prior to use.`);
|
|
99
|
+
if (!e) throw new Error("You should provide a class name.");
|
|
100
|
+
if (!this._factoryMap[e]) throw new Error(`You should register class ${e} prior to use.`);
|
|
110
101
|
return this._factoryMap[e].factory;
|
|
111
102
|
}
|
|
112
103
|
/**
|
|
@@ -136,8 +127,7 @@ const B = (d = class {
|
|
|
136
127
|
* @see registerFactory
|
|
137
128
|
*/
|
|
138
129
|
static annotations(e) {
|
|
139
|
-
if (e instanceof d ? e = e.className : typeof e == "string" || (e = new e().className), !this._factoryMap[e])
|
|
140
|
-
throw new Error(`You should register class ${e} prior to use.`);
|
|
130
|
+
if (e instanceof d ? e = e.className : typeof e == "string" || (e = new e().className), !this._factoryMap[e]) throw new Error(`You should register class ${e} prior to use.`);
|
|
141
131
|
return this._factoryMap[e].annotation;
|
|
142
132
|
}
|
|
143
133
|
/**
|
|
@@ -197,8 +187,7 @@ const B = (d = class {
|
|
|
197
187
|
*/
|
|
198
188
|
getPropInfo(e) {
|
|
199
189
|
const t = this.getPersistentProperties().find((r) => r.name === e);
|
|
200
|
-
if (!t)
|
|
201
|
-
throw new Error(`Property "${e}" has not been registered.`);
|
|
190
|
+
if (!t) throw new Error(`Property "${e}" has not been registered.`);
|
|
202
191
|
return t;
|
|
203
192
|
}
|
|
204
193
|
/**
|
|
@@ -269,12 +258,10 @@ const B = (d = class {
|
|
|
269
258
|
};
|
|
270
259
|
}
|
|
271
260
|
toObj(e) {
|
|
272
|
-
if (!this._persistentProperties)
|
|
273
|
-
return {};
|
|
261
|
+
if (!this._persistentProperties) return {};
|
|
274
262
|
this.beforeSerialize();
|
|
275
263
|
const t = {};
|
|
276
|
-
if (!this.className)
|
|
277
|
-
throw new Error("You should register this class prior to streaming it.");
|
|
264
|
+
if (!this.className) throw new Error(`You should register \`${this.constructor.name || this.toString() || "this"}\` class prior to streaming it.`);
|
|
278
265
|
return this._persistentProperties.forEach((r) => {
|
|
279
266
|
const s = this[r.name], n = this.removeUnderscore(r);
|
|
280
267
|
s != null && (r.isReference ? t[n] = this.toReferenceObj(r, e) : t[n] = this.toDeepObj(s, e), r.searchableArray && (t[d.searchableArrayNameFor(n)] = s.map((o) => o.id)));
|
|
@@ -284,8 +271,7 @@ const B = (d = class {
|
|
|
284
271
|
return `__${e}_searchable`;
|
|
285
272
|
}
|
|
286
273
|
fromDeepObject(e) {
|
|
287
|
-
if (e == null)
|
|
288
|
-
return e;
|
|
274
|
+
if (e == null) return e;
|
|
289
275
|
if (Array.isArray(e))
|
|
290
276
|
return e.map((t) => this.fromDeepObject(t));
|
|
291
277
|
if (e.__documentReference) {
|
|
@@ -306,8 +292,7 @@ const B = (d = class {
|
|
|
306
292
|
if (e != null) {
|
|
307
293
|
if (Array.isArray(e))
|
|
308
294
|
return e.map((r) => this.toDeepObj(r, t));
|
|
309
|
-
if (e.__documentReference)
|
|
310
|
-
return e;
|
|
295
|
+
if (e.__documentReference) return e;
|
|
311
296
|
if (e instanceof d)
|
|
312
297
|
return e.toObj(t);
|
|
313
298
|
if (typeof e == "object") {
|
|
@@ -343,8 +328,7 @@ const B = (d = class {
|
|
|
343
328
|
};
|
|
344
329
|
}
|
|
345
330
|
pushDocument(e, t, r) {
|
|
346
|
-
if ("__documentReference" in r && r.__documentReference)
|
|
347
|
-
return;
|
|
331
|
+
if ("__documentReference" in r && r.__documentReference) return;
|
|
348
332
|
e[t] || (e[t] = []);
|
|
349
333
|
const s = this.toDeepObj(r, e);
|
|
350
334
|
e[t].push(s);
|
|
@@ -391,14 +375,14 @@ const B = (d = class {
|
|
|
391
375
|
}, {});
|
|
392
376
|
}
|
|
393
377
|
}, d._factoryMap = {}, d);
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
], B.prototype, "_id"
|
|
378
|
+
G([
|
|
379
|
+
D
|
|
380
|
+
], B.prototype, "_id");
|
|
397
381
|
let l = B;
|
|
398
|
-
function
|
|
382
|
+
function D(i, e) {
|
|
399
383
|
return y()(i, e);
|
|
400
384
|
}
|
|
401
|
-
function
|
|
385
|
+
function oe(i) {
|
|
402
386
|
return function(e, t) {
|
|
403
387
|
return y({
|
|
404
388
|
storeInCollection: i,
|
|
@@ -406,10 +390,10 @@ function ce(i) {
|
|
|
406
390
|
})(e, t);
|
|
407
391
|
};
|
|
408
392
|
}
|
|
409
|
-
function
|
|
393
|
+
function ae(i, e) {
|
|
410
394
|
return y({ isReference: !0 })(i, e);
|
|
411
395
|
}
|
|
412
|
-
function
|
|
396
|
+
function ce(i, e, t) {
|
|
413
397
|
const r = Array.isArray(i) ? { cachedProps: i } : i;
|
|
414
398
|
return function(s, n) {
|
|
415
399
|
return y({
|
|
@@ -420,10 +404,10 @@ function he(i, e, t) {
|
|
|
420
404
|
})(s, n);
|
|
421
405
|
};
|
|
422
406
|
}
|
|
423
|
-
function
|
|
407
|
+
function ue(i, e, t) {
|
|
424
408
|
return y({ isReference: !0, isPureReference: !0, storeInCollection: t })(i, e);
|
|
425
409
|
}
|
|
426
|
-
function
|
|
410
|
+
function he(i, e, t) {
|
|
427
411
|
return function(r, s) {
|
|
428
412
|
const n = Array.isArray(i) ? { cachedProps: i } : i;
|
|
429
413
|
return y({
|
|
@@ -445,28 +429,28 @@ function y(i) {
|
|
|
445
429
|
});
|
|
446
430
|
};
|
|
447
431
|
}
|
|
448
|
-
function
|
|
432
|
+
function K(i, e) {
|
|
449
433
|
return (t) => {
|
|
450
434
|
l.registerFactory(i, t, e), t.prototype.__className = i;
|
|
451
435
|
};
|
|
452
436
|
}
|
|
453
|
-
function
|
|
437
|
+
function le(i) {
|
|
454
438
|
return (e) => {
|
|
455
439
|
l.registerFactory(i, e);
|
|
456
440
|
};
|
|
457
441
|
}
|
|
458
|
-
function
|
|
442
|
+
function de(i, e) {
|
|
459
443
|
return y({ searchableArray: !0 })(i, e);
|
|
460
444
|
}
|
|
461
|
-
function
|
|
445
|
+
function fe(i, e) {
|
|
462
446
|
return y({ validator: (t) => t != null })(i, e);
|
|
463
447
|
}
|
|
464
|
-
function
|
|
448
|
+
function pe(i = (e) => e != null) {
|
|
465
449
|
return function(e, t) {
|
|
466
450
|
return y({ validator: i })(e, t);
|
|
467
451
|
};
|
|
468
452
|
}
|
|
469
|
-
class
|
|
453
|
+
class me extends l {
|
|
470
454
|
constructor() {
|
|
471
455
|
super(...arguments), this._onChange = new I();
|
|
472
456
|
}
|
|
@@ -554,8 +538,7 @@ class _e extends l {
|
|
|
554
538
|
const E = class E {
|
|
555
539
|
constructor(e, t, r) {
|
|
556
540
|
if (r) {
|
|
557
|
-
if (!(t instanceof l))
|
|
558
|
-
throw new Error(E.error.persistentNeedForSubCollection);
|
|
541
|
+
if (!(t instanceof l)) throw new Error(E.error.persistentNeedForSubCollection);
|
|
559
542
|
this.collectionName = `${t.className}/${t.id}/${r}`;
|
|
560
543
|
} else
|
|
561
544
|
this.collectionName = t instanceof l ? t.className : t;
|
|
@@ -604,7 +587,7 @@ const E = class E {
|
|
|
604
587
|
* @returns a Query object
|
|
605
588
|
*/
|
|
606
589
|
find() {
|
|
607
|
-
return new
|
|
590
|
+
return new X(this);
|
|
608
591
|
}
|
|
609
592
|
/**
|
|
610
593
|
* Define the search conditions. You pass query operations and how the query
|
|
@@ -688,11 +671,10 @@ const E = class E {
|
|
|
688
671
|
*/
|
|
689
672
|
preprocessQueryObject(e) {
|
|
690
673
|
var r;
|
|
691
|
-
if (Object.values(e).length === 0)
|
|
692
|
-
return e;
|
|
674
|
+
if (Object.values(e).length === 0) return e;
|
|
693
675
|
const t = ((r = e.operations) == null ? void 0 : r.map((s) => {
|
|
694
676
|
const n = s.value[0] ?? s.value;
|
|
695
|
-
return
|
|
677
|
+
return S.isArrayOperator(s.operator) && n instanceof l ? {
|
|
696
678
|
property: l.searchableArrayNameFor(s.property),
|
|
697
679
|
operator: s.operator,
|
|
698
680
|
value: Array.isArray(s.value) ? s.value.map((o) => o.id) : n.id,
|
|
@@ -714,8 +696,8 @@ E.error = {
|
|
|
714
696
|
persistentNeedForSubCollection: "The document parameter for a sub-collection should be a Persistent instace",
|
|
715
697
|
invalidQueryOrder: "Cannot add where calls after or calls"
|
|
716
698
|
};
|
|
717
|
-
let
|
|
718
|
-
class
|
|
699
|
+
let R = E;
|
|
700
|
+
class X {
|
|
719
701
|
constructor(e) {
|
|
720
702
|
this.queryObject = { operations: [] }, this.model = e;
|
|
721
703
|
}
|
|
@@ -740,8 +722,7 @@ class ee {
|
|
|
740
722
|
*/
|
|
741
723
|
where(e, t, r, s) {
|
|
742
724
|
var n, o, c;
|
|
743
|
-
if ((o = (n = this.queryObject.operations) == null ? void 0 : n.at(-1)) != null && o.aggregate && !s)
|
|
744
|
-
throw new Error(D.error.invalidQueryOrder);
|
|
725
|
+
if ((o = (n = this.queryObject.operations) == null ? void 0 : n.at(-1)) != null && o.aggregate && !s) throw new Error(R.error.invalidQueryOrder);
|
|
745
726
|
return (c = this.queryObject.operations) == null || c.push({
|
|
746
727
|
property: e,
|
|
747
728
|
operator: t,
|
|
@@ -775,8 +756,7 @@ class ee {
|
|
|
775
756
|
*/
|
|
776
757
|
whereDeepProp(e, t, r, s) {
|
|
777
758
|
var h, a, u;
|
|
778
|
-
if ((a = (h = this.queryObject.operations) == null ? void 0 : h.at(-1)) != null && a.aggregate && !s)
|
|
779
|
-
throw new Error(D.error.invalidQueryOrder);
|
|
759
|
+
if ((a = (h = this.queryObject.operations) == null ? void 0 : h.at(-1)) != null && a.aggregate && !s) throw new Error(R.error.invalidQueryOrder);
|
|
780
760
|
const n = e.split(".");
|
|
781
761
|
let o = {}, c = n.length > 1 ? o : r;
|
|
782
762
|
return n.slice(1).forEach((g, v) => {
|
|
@@ -965,9 +945,8 @@ const P = class P {
|
|
|
965
945
|
* @returns the model for the collection
|
|
966
946
|
*/
|
|
967
947
|
static getModel(e) {
|
|
968
|
-
if (!P._dataSource)
|
|
969
|
-
|
|
970
|
-
return new D(P._dataSource, e);
|
|
948
|
+
if (!P._dataSource) throw new Error(this.error.shouldBeRegistered);
|
|
949
|
+
return new R(P._dataSource, e);
|
|
971
950
|
}
|
|
972
951
|
/**
|
|
973
952
|
* Retrieves a model for a subcollection
|
|
@@ -976,9 +955,8 @@ const P = class P {
|
|
|
976
955
|
* @returns the model for the subcollection
|
|
977
956
|
*/
|
|
978
957
|
static getModelForSubCollection(e, t) {
|
|
979
|
-
if (!P._dataSource)
|
|
980
|
-
|
|
981
|
-
return new D(P._dataSource, e, t);
|
|
958
|
+
if (!P._dataSource) throw new Error(this.error.shouldBeRegistered);
|
|
959
|
+
return new R(P._dataSource, e, t);
|
|
982
960
|
}
|
|
983
961
|
/**
|
|
984
962
|
* Populates property references with actual data from the store.
|
|
@@ -987,12 +965,10 @@ const P = class P {
|
|
|
987
965
|
* @returns the populated instance
|
|
988
966
|
*/
|
|
989
967
|
static async populate(e) {
|
|
990
|
-
if (!e)
|
|
991
|
-
return;
|
|
968
|
+
if (!e) return;
|
|
992
969
|
const t = async (r) => {
|
|
993
970
|
const s = r;
|
|
994
|
-
if (!s.__documentReference)
|
|
995
|
-
return r;
|
|
971
|
+
if (!s.__documentReference) return r;
|
|
996
972
|
const o = await this.getModel(s.__documentReference.storedInCollection).findById(s.id, r);
|
|
997
973
|
return o && (o.__documentReference = void 0), o;
|
|
998
974
|
};
|
|
@@ -1014,9 +990,9 @@ const P = class P {
|
|
|
1014
990
|
};
|
|
1015
991
|
P.error = { shouldBeRegistered: "You should register a data source before using the data Store." };
|
|
1016
992
|
let F = P;
|
|
1017
|
-
class
|
|
993
|
+
class S {
|
|
1018
994
|
installCachedPropsUpdaters(e = {}) {
|
|
1019
|
-
|
|
995
|
+
S.onUpdate = e.onUpdate;
|
|
1020
996
|
const t = l.getSystemRegisteredReferencesWithCachedProps(), r = {};
|
|
1021
997
|
Object.entries(t).forEach(([n, o]) => {
|
|
1022
998
|
o.forEach((c) => {
|
|
@@ -1029,11 +1005,10 @@ class O {
|
|
|
1029
1005
|
});
|
|
1030
1006
|
const s = [];
|
|
1031
1007
|
return Object.entries(r).forEach(([n, o]) => {
|
|
1032
|
-
const c = this.subscribeToDocumentChangeListerner(n, (h) =>
|
|
1008
|
+
const c = this.subscribeToDocumentChangeListerner(n, (h) => S.processDocumentChange(h, o));
|
|
1033
1009
|
if (c)
|
|
1034
1010
|
s.push(c);
|
|
1035
|
-
else if (e.noThrowOnNonImplementedListener)
|
|
1036
|
-
throw new Error("The method documentChangeListerner has not been implemented in the concrete data source");
|
|
1011
|
+
else if (e.noThrowOnNonImplementedListener) throw new Error("The method documentChangeListerner has not been implemented in the concrete data source");
|
|
1037
1012
|
}), s;
|
|
1038
1013
|
}
|
|
1039
1014
|
/**
|
|
@@ -1062,7 +1037,7 @@ class O {
|
|
|
1062
1037
|
*/
|
|
1063
1038
|
static toPropertyPathOperations(e) {
|
|
1064
1039
|
return e ? e.map((t) => {
|
|
1065
|
-
if (
|
|
1040
|
+
if (S.isArrayOperator(t.operator) && t.value[0] instanceof l)
|
|
1066
1041
|
return {
|
|
1067
1042
|
property: l.searchableArrayNameFor(t.property),
|
|
1068
1043
|
operator: t.operator,
|
|
@@ -1088,15 +1063,15 @@ class O {
|
|
|
1088
1063
|
} else
|
|
1089
1064
|
return [void 0, e];
|
|
1090
1065
|
}
|
|
1091
|
-
static async
|
|
1066
|
+
static async processDocumentChange(e, t) {
|
|
1092
1067
|
if (e.before)
|
|
1093
1068
|
return t.map(async (r) => {
|
|
1094
1069
|
var c, h;
|
|
1095
1070
|
const s = F.getModel(r.collectionPropOwner);
|
|
1096
1071
|
let n = s.find();
|
|
1097
1072
|
(h = (c = r.prop.cachedPropsConfig) == null ? void 0 : c.cachedProps) == null || h.forEach((a) => {
|
|
1098
|
-
var v,
|
|
1099
|
-
const u = (v = e.before) == null ? void 0 : v[a], g = (
|
|
1073
|
+
var v, j;
|
|
1074
|
+
const u = (v = e.before) == null ? void 0 : v[a], g = (j = e.after) == null ? void 0 : j[a];
|
|
1100
1075
|
u !== g && (n = n.orDeepProp(`${r.prop.name}.${a}`, "==", u));
|
|
1101
1076
|
});
|
|
1102
1077
|
const o = await n.get();
|
|
@@ -1104,16 +1079,16 @@ class O {
|
|
|
1104
1079
|
o.map(async (a) => {
|
|
1105
1080
|
var u, g;
|
|
1106
1081
|
(g = (u = r.prop.cachedPropsConfig) == null ? void 0 : u.cachedProps) == null || g.forEach(async (v) => {
|
|
1107
|
-
var
|
|
1108
|
-
const
|
|
1109
|
-
|
|
1082
|
+
var N, M, V;
|
|
1083
|
+
const j = (N = e.before) == null ? void 0 : N[v], k = (M = e.after) == null ? void 0 : M[v];
|
|
1084
|
+
j !== k && (a[`_${r.prop.name}`][`_${v}`] = k, await s.save(a), (V = this.onUpdate) == null || V.call(this, a, r.prop));
|
|
1110
1085
|
});
|
|
1111
1086
|
})
|
|
1112
1087
|
]);
|
|
1113
1088
|
});
|
|
1114
1089
|
}
|
|
1115
1090
|
}
|
|
1116
|
-
class
|
|
1091
|
+
class ge extends S {
|
|
1117
1092
|
/**
|
|
1118
1093
|
* @param jsonRawData the JSON object to be used as data store
|
|
1119
1094
|
*/
|
|
@@ -1138,14 +1113,12 @@ class ye extends O {
|
|
|
1138
1113
|
}
|
|
1139
1114
|
findById(e, t) {
|
|
1140
1115
|
var r, s;
|
|
1141
|
-
if ((r = this._simulateError) != null && r.findById)
|
|
1142
|
-
throw new Error(this._simulateError.findById);
|
|
1116
|
+
if ((r = this._simulateError) != null && r.findById) throw new Error(this._simulateError.findById);
|
|
1143
1117
|
return this.resolveWithDelay((s = this._jsonRawData[t]) == null ? void 0 : s[e]);
|
|
1144
1118
|
}
|
|
1145
1119
|
save(e) {
|
|
1146
1120
|
var t;
|
|
1147
|
-
if ((t = this._simulateError) != null && t.store)
|
|
1148
|
-
throw new Error(this._simulateError.store);
|
|
1121
|
+
if ((t = this._simulateError) != null && t.store) throw new Error(this._simulateError.store);
|
|
1149
1122
|
return Object.entries(e).forEach(([r, s]) => {
|
|
1150
1123
|
this._jsonRawData[r] || (this._jsonRawData[r] = {}), s == null || s.forEach((n) => {
|
|
1151
1124
|
const o = this._jsonRawData[r][n.id];
|
|
@@ -1155,8 +1128,7 @@ class ye extends O {
|
|
|
1155
1128
|
}
|
|
1156
1129
|
find(e, t) {
|
|
1157
1130
|
var s;
|
|
1158
|
-
if ((s = this._simulateError) != null && s.find)
|
|
1159
|
-
throw new Error(this._simulateError.find);
|
|
1131
|
+
if ((s = this._simulateError) != null && s.find) throw new Error(this._simulateError.find);
|
|
1160
1132
|
const r = Object.values(this._jsonRawData[t] || {});
|
|
1161
1133
|
return e ? (this._lastLimit = e.limit || 0, this._cursor = 0, this._lastMatchingDocs = Object.entries(e).reduce(
|
|
1162
1134
|
(n, [o, c]) => this.queryProcessor(n, o, c),
|
|
@@ -1165,8 +1137,7 @@ class ye extends O {
|
|
|
1165
1137
|
}
|
|
1166
1138
|
delete(e, t) {
|
|
1167
1139
|
var r;
|
|
1168
|
-
if ((r = this._simulateError) != null && r.delete)
|
|
1169
|
-
throw new Error(this._simulateError.delete);
|
|
1140
|
+
if ((r = this._simulateError) != null && r.delete) throw new Error(this._simulateError.delete);
|
|
1170
1141
|
return delete this._jsonRawData[t][e], this.resolveWithDelay();
|
|
1171
1142
|
}
|
|
1172
1143
|
next(e) {
|
|
@@ -1179,8 +1150,7 @@ class ye extends O {
|
|
|
1179
1150
|
}
|
|
1180
1151
|
onCollectionChange(e, t, r) {
|
|
1181
1152
|
return this._collectionListeners[t] = (s) => {
|
|
1182
|
-
if (!s.after)
|
|
1183
|
-
return;
|
|
1153
|
+
if (!s.after) return;
|
|
1184
1154
|
this.retrieveQueryDocs([s.after], e.operations).length > 0 && r(s);
|
|
1185
1155
|
}, () => delete this._serverCollectionListeners[t];
|
|
1186
1156
|
}
|
|
@@ -1276,8 +1246,7 @@ class ye extends O {
|
|
|
1276
1246
|
return [n || s, o || r];
|
|
1277
1247
|
}
|
|
1278
1248
|
resolveWithDelay(e) {
|
|
1279
|
-
if (this._simulateDelay <= 0)
|
|
1280
|
-
return Promise.resolve(e);
|
|
1249
|
+
if (this._simulateDelay <= 0) return Promise.resolve(e);
|
|
1281
1250
|
const t = new Promise((r) => {
|
|
1282
1251
|
setTimeout(
|
|
1283
1252
|
() => r(e),
|
|
@@ -1313,15 +1282,15 @@ const b = class b {
|
|
|
1313
1282
|
};
|
|
1314
1283
|
b._cloudStorageFactoryMap = {};
|
|
1315
1284
|
let w = b;
|
|
1316
|
-
function
|
|
1285
|
+
function ee(i, e) {
|
|
1317
1286
|
return w.registerCloudStorage(i, e), (t) => {
|
|
1318
1287
|
t.prototype.__className = i;
|
|
1319
1288
|
};
|
|
1320
1289
|
}
|
|
1321
|
-
var
|
|
1322
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
1323
|
-
(o = i[n]) && (s =
|
|
1324
|
-
return
|
|
1290
|
+
var te = Object.getOwnPropertyDescriptor, re = (i, e, t, r) => {
|
|
1291
|
+
for (var s = r > 1 ? void 0 : r ? te(e, t) : e, n = i.length - 1, o; n >= 0; n--)
|
|
1292
|
+
(o = i[n]) && (s = o(s) || s);
|
|
1293
|
+
return s;
|
|
1325
1294
|
};
|
|
1326
1295
|
let A = class extends w {
|
|
1327
1296
|
constructor(i = "") {
|
|
@@ -1336,8 +1305,7 @@ let A = class extends w {
|
|
|
1336
1305
|
return this._simulateDelay = i, this;
|
|
1337
1306
|
}
|
|
1338
1307
|
resolveWithDelay(i) {
|
|
1339
|
-
if (this._simulateDelay <= 0)
|
|
1340
|
-
return Promise.resolve(i);
|
|
1308
|
+
if (this._simulateDelay <= 0) return Promise.resolve(i);
|
|
1341
1309
|
const e = new Promise((t) => {
|
|
1342
1310
|
setTimeout(
|
|
1343
1311
|
() => t(i),
|
|
@@ -1372,14 +1340,14 @@ let A = class extends w {
|
|
|
1372
1340
|
return delete this.mockFileSystem[i], this.resolveWithDelay();
|
|
1373
1341
|
}
|
|
1374
1342
|
};
|
|
1375
|
-
A =
|
|
1376
|
-
|
|
1343
|
+
A = re([
|
|
1344
|
+
ee("MockCloudStorage", () => new A())
|
|
1377
1345
|
], A);
|
|
1378
|
-
var
|
|
1379
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
1346
|
+
var se = Object.defineProperty, ie = Object.getOwnPropertyDescriptor, O = (i, e, t, r) => {
|
|
1347
|
+
for (var s = r > 1 ? void 0 : r ? ie(e, t) : e, n = i.length - 1, o; n >= 0; n--)
|
|
1380
1348
|
(o = i[n]) && (s = (r ? o(e, t, s) : o(s)) || s);
|
|
1381
|
-
return r && s &&
|
|
1382
|
-
},
|
|
1349
|
+
return r && s && se(e, t, s), s;
|
|
1350
|
+
}, ne = /* @__PURE__ */ ((i) => (i[i.stored = 0] = "stored", i[i.pendingDataSet = 1] = "pendingDataSet", i[i.deleted = 2] = "deleted", i))(ne || {});
|
|
1383
1351
|
let C = class extends l {
|
|
1384
1352
|
constructor() {
|
|
1385
1353
|
super(...arguments), this._onChange = new I();
|
|
@@ -1392,8 +1360,7 @@ let C = class extends l {
|
|
|
1392
1360
|
return this.provider.uploadControl();
|
|
1393
1361
|
}
|
|
1394
1362
|
async delete() {
|
|
1395
|
-
if (!this._reference)
|
|
1396
|
-
throw new Error("Cannot delete a not stored file");
|
|
1363
|
+
if (!this._reference) throw new Error("Cannot delete a not stored file");
|
|
1397
1364
|
await this.provider.delete(this._reference), this._reference = void 0, this._url = void 0, this._onChange.notify({ event: 2, storedFile: this });
|
|
1398
1365
|
}
|
|
1399
1366
|
set provider(i) {
|
|
@@ -1428,30 +1395,29 @@ let C = class extends l {
|
|
|
1428
1395
|
return this._onChange.subscribe(i);
|
|
1429
1396
|
}
|
|
1430
1397
|
};
|
|
1431
|
-
|
|
1432
|
-
|
|
1398
|
+
O([
|
|
1399
|
+
D
|
|
1433
1400
|
], C.prototype, "_reference", 2);
|
|
1434
|
-
|
|
1435
|
-
|
|
1401
|
+
O([
|
|
1402
|
+
D
|
|
1436
1403
|
], C.prototype, "_url", 2);
|
|
1437
|
-
|
|
1438
|
-
|
|
1404
|
+
O([
|
|
1405
|
+
D
|
|
1439
1406
|
], C.prototype, "_cloudStorageProviderName", 2);
|
|
1440
|
-
|
|
1441
|
-
|
|
1407
|
+
O([
|
|
1408
|
+
D
|
|
1442
1409
|
], C.prototype, "_originalFileName", 2);
|
|
1443
|
-
|
|
1444
|
-
|
|
1410
|
+
O([
|
|
1411
|
+
D
|
|
1445
1412
|
], C.prototype, "_mimeType", 2);
|
|
1446
|
-
C =
|
|
1447
|
-
|
|
1413
|
+
C = O([
|
|
1414
|
+
K("StoredFile")
|
|
1448
1415
|
], C);
|
|
1449
1416
|
class W {
|
|
1450
1417
|
}
|
|
1451
1418
|
const p = class p extends W {
|
|
1452
1419
|
constructor() {
|
|
1453
|
-
if (super(), this._onAuthStateChange = new I(), !p._authService)
|
|
1454
|
-
throw new Error(p.error.shouldBeRegistered);
|
|
1420
|
+
if (super(), this._onAuthStateChange = new I(), !p._authService) throw new Error(p.error.shouldBeRegistered);
|
|
1455
1421
|
p._authService.onAuthStateChange(
|
|
1456
1422
|
(e) => this.authStateChanged(e)
|
|
1457
1423
|
);
|
|
@@ -1575,8 +1541,8 @@ const p = class p extends W {
|
|
|
1575
1541
|
}
|
|
1576
1542
|
};
|
|
1577
1543
|
p.error = { shouldBeRegistered: "You should register an auth service before using Auth." }, p._instance = void 0;
|
|
1578
|
-
let
|
|
1579
|
-
class
|
|
1544
|
+
let L = p;
|
|
1545
|
+
class _e extends W {
|
|
1580
1546
|
constructor() {
|
|
1581
1547
|
super(...arguments), this.pendingPromises = [], this._fakeRegisteredUsers = {};
|
|
1582
1548
|
}
|
|
@@ -1626,8 +1592,7 @@ class ve extends W {
|
|
|
1626
1592
|
await Promise.all(this.pendingPromises), this.pendingPromises = [];
|
|
1627
1593
|
}
|
|
1628
1594
|
fakeRegisteredUser(e) {
|
|
1629
|
-
if (this._fakeRegisteredUsers[e.id])
|
|
1630
|
-
throw new Error(`User with id ${e.id} already exists in fake user list`);
|
|
1595
|
+
if (this._fakeRegisteredUsers[e.id]) throw new Error(`User with id ${e.id} already exists in fake user list`);
|
|
1631
1596
|
return this._fakeRegisteredUsers[e.id] = e, this;
|
|
1632
1597
|
}
|
|
1633
1598
|
get fakeRegisteredUsers() {
|
|
@@ -1657,8 +1622,7 @@ const _ = class _ {
|
|
|
1657
1622
|
this._cloudFunctionsService != e && (this._cloudFunctionsService = e);
|
|
1658
1623
|
}
|
|
1659
1624
|
static get instance() {
|
|
1660
|
-
if (!this._cloudFunctionsService)
|
|
1661
|
-
throw new Error(_.error.shouldBeRegistered);
|
|
1625
|
+
if (!this._cloudFunctionsService) throw new Error(_.error.shouldBeRegistered);
|
|
1662
1626
|
return _._instance || (_._instance = new _());
|
|
1663
1627
|
}
|
|
1664
1628
|
getRawFunction(e) {
|
|
@@ -1682,14 +1646,13 @@ const _ = class _ {
|
|
|
1682
1646
|
};
|
|
1683
1647
|
_.error = { shouldBeRegistered: "You should register a cloud functions service with useCloudFunctionsService static method before using CloudFunctions." };
|
|
1684
1648
|
let T = _;
|
|
1685
|
-
class
|
|
1649
|
+
class ye {
|
|
1686
1650
|
constructor(e) {
|
|
1687
1651
|
this._registeredFunctions = e;
|
|
1688
1652
|
}
|
|
1689
1653
|
retrieveFunction(e) {
|
|
1690
1654
|
const t = this._registeredFunctions[e];
|
|
1691
|
-
if (!t)
|
|
1692
|
-
throw new Error(`Cloud function ${e} is not registered.`);
|
|
1655
|
+
if (!t) throw new Error(`Cloud function ${e} is not registered.`);
|
|
1693
1656
|
return t;
|
|
1694
1657
|
}
|
|
1695
1658
|
callFunction(e, t) {
|
|
@@ -1706,8 +1669,7 @@ const m = class m extends Q {
|
|
|
1706
1669
|
m._authService != e && (m._authService = e, this._instance = void 0);
|
|
1707
1670
|
}
|
|
1708
1671
|
static get instance() {
|
|
1709
|
-
if (!m._authService)
|
|
1710
|
-
throw new Error(m.error.shouldBeRegistered);
|
|
1672
|
+
if (!m._authService) throw new Error(m.error.shouldBeRegistered);
|
|
1711
1673
|
return this._instance || (this._instance = new m());
|
|
1712
1674
|
}
|
|
1713
1675
|
getUser(e) {
|
|
@@ -1725,7 +1687,7 @@ const m = class m extends Q {
|
|
|
1725
1687
|
};
|
|
1726
1688
|
m.error = { shouldBeRegistered: "You should register a Server Auth service before using the Server Auth." }, m._instance = void 0;
|
|
1727
1689
|
let x = m;
|
|
1728
|
-
class
|
|
1690
|
+
class ve extends Q {
|
|
1729
1691
|
constructor(e) {
|
|
1730
1692
|
super(), this._userCredentials = e;
|
|
1731
1693
|
}
|
|
@@ -1734,8 +1696,7 @@ class be extends Q {
|
|
|
1734
1696
|
}
|
|
1735
1697
|
setCustomCredentials(e, t) {
|
|
1736
1698
|
const r = this._userCredentials[e];
|
|
1737
|
-
if (!r)
|
|
1738
|
-
throw new Error(`User ${e} not found in the auth system`);
|
|
1699
|
+
if (!r) throw new Error(`User ${e} not found in the auth system`);
|
|
1739
1700
|
return r.customData = { ...t }, Promise.resolve();
|
|
1740
1701
|
}
|
|
1741
1702
|
updateUser(e, t) {
|
|
@@ -1752,63 +1713,62 @@ class be extends Q {
|
|
|
1752
1713
|
return this._userCredentials;
|
|
1753
1714
|
}
|
|
1754
1715
|
}
|
|
1755
|
-
function
|
|
1716
|
+
function Pe(i, e) {
|
|
1756
1717
|
return i ? i.replace(/\${\s*(\w*)\s*}/g, function(t, r) {
|
|
1757
1718
|
return e[r] || "";
|
|
1758
1719
|
}) : "";
|
|
1759
1720
|
}
|
|
1760
|
-
function
|
|
1721
|
+
function be(i) {
|
|
1761
1722
|
return i ? i.replace(
|
|
1762
1723
|
/([-_ ][\w])/g,
|
|
1763
1724
|
(e) => e.toUpperCase().replace("-", "").replace("_", "").replace(" ", "")
|
|
1764
1725
|
) : "";
|
|
1765
1726
|
}
|
|
1766
|
-
function
|
|
1767
|
-
if (!i)
|
|
1768
|
-
return "";
|
|
1727
|
+
function we(i, e = "-") {
|
|
1728
|
+
if (!i) return "";
|
|
1769
1729
|
const t = i.slice(1).replace(/( |[A-Z])/g, (r) => r === " " ? "-" : e + r[0].toLowerCase());
|
|
1770
1730
|
return i[0].toLocaleLowerCase() + t.replace(/--/g, "-");
|
|
1771
1731
|
}
|
|
1772
|
-
function
|
|
1732
|
+
function Ce(i, e) {
|
|
1773
1733
|
return e.split(".").reduce((t, r) => t[r], i);
|
|
1774
1734
|
}
|
|
1775
1735
|
export {
|
|
1776
|
-
|
|
1777
|
-
|
|
1736
|
+
L as Auth,
|
|
1737
|
+
_e as AuthMock,
|
|
1778
1738
|
W as AuthService,
|
|
1779
1739
|
T as CloudFunctions,
|
|
1780
|
-
|
|
1740
|
+
ye as CloudFunctionsMock,
|
|
1781
1741
|
w as CloudStorage,
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1742
|
+
S as DataSource,
|
|
1743
|
+
me as EntropicComponent,
|
|
1744
|
+
ge as JsonDataSource,
|
|
1785
1745
|
A as MockCloudStorage,
|
|
1786
|
-
|
|
1746
|
+
R as Model,
|
|
1787
1747
|
I as Observable,
|
|
1788
1748
|
l as Persistent,
|
|
1789
|
-
|
|
1749
|
+
X as Query,
|
|
1790
1750
|
x as ServerAuth,
|
|
1791
|
-
|
|
1751
|
+
ve as ServerAuthMock,
|
|
1792
1752
|
Q as ServerAuthService,
|
|
1793
1753
|
F as Store,
|
|
1794
1754
|
C as StoredFile,
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1755
|
+
ne as StoredFileEvent,
|
|
1756
|
+
be as camelCase,
|
|
1757
|
+
Ce as getDeepValue,
|
|
1758
|
+
D as persistent,
|
|
1799
1759
|
y as persistentParser,
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1760
|
+
ue as persistentPureReference,
|
|
1761
|
+
he as persistentPureReferenceWithCachedProps,
|
|
1762
|
+
ae as persistentReference,
|
|
1763
|
+
oe as persistentReferenceAt,
|
|
1764
|
+
ce as persistentReferenceWithCachedProps,
|
|
1765
|
+
ee as registerCloudStorage,
|
|
1766
|
+
le as registerLegacyClassName,
|
|
1767
|
+
K as registerPersistentClass,
|
|
1768
|
+
Pe as replaceValue,
|
|
1769
|
+
fe as required,
|
|
1770
|
+
pe as requiredWithValidator,
|
|
1771
|
+
de as searchableArray,
|
|
1772
|
+
we as snakeCase
|
|
1813
1773
|
};
|
|
1814
1774
|
//# sourceMappingURL=entropic-bond.js.map
|