entropic-bond 1.56.4 → 1.57.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 +108 -148
- 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/cached-props-updater.d.ts +7 -12
- package/lib/store/data-source.d.ts +1 -13
- package/lib/store/json-data-source.d.ts +1 -2
- package/package.json +1 -1
package/lib/entropic-bond.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class I {
|
|
2
2
|
constructor() {
|
|
3
3
|
this.subscribers = /* @__PURE__ */ new Set();
|
|
4
4
|
}
|
|
@@ -49,33 +49,33 @@ for (let i = 0; i < 256; ++i)
|
|
|
49
49
|
function Y(i, e = 0) {
|
|
50
50
|
return (m[i[e + 0]] + m[i[e + 1]] + m[i[e + 2]] + m[i[e + 3]] + "-" + m[i[e + 4]] + m[i[e + 5]] + "-" + m[i[e + 6]] + m[i[e + 7]] + "-" + m[i[e + 8]] + m[i[e + 9]] + "-" + m[i[e + 10]] + m[i[e + 11]] + m[i[e + 12]] + m[i[e + 13]] + m[i[e + 14]] + m[i[e + 15]]).toLowerCase();
|
|
51
51
|
}
|
|
52
|
-
let
|
|
52
|
+
let F;
|
|
53
53
|
const z = new Uint8Array(16);
|
|
54
|
-
function
|
|
55
|
-
if (!
|
|
54
|
+
function J() {
|
|
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
|
|
62
|
+
const H = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), M = { randomUUID: H };
|
|
63
63
|
function Z(i, e, t) {
|
|
64
64
|
i = i || {};
|
|
65
|
-
const r = i.random ?? i.rng?.() ??
|
|
65
|
+
const r = i.random ?? i.rng?.() ?? J();
|
|
66
66
|
if (r.length < 16)
|
|
67
67
|
throw new Error("Random bytes length must be >= 16");
|
|
68
68
|
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, Y(r);
|
|
69
69
|
}
|
|
70
70
|
function G(i, e, t) {
|
|
71
|
-
return
|
|
71
|
+
return M.randomUUID && !i ? M.randomUUID() : Z(i);
|
|
72
72
|
}
|
|
73
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
76
|
return s && K(e, t, s), s;
|
|
77
77
|
}, l;
|
|
78
|
-
const
|
|
78
|
+
const W = (l = 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
|
|
@@ -399,8 +399,8 @@ const Q = (l = class {
|
|
|
399
399
|
}, l._factoryMap = {}, l);
|
|
400
400
|
X([
|
|
401
401
|
j
|
|
402
|
-
],
|
|
403
|
-
let d =
|
|
402
|
+
], W.prototype, "_id");
|
|
403
|
+
let d = W;
|
|
404
404
|
function j(i, e) {
|
|
405
405
|
return _()(i, e);
|
|
406
406
|
}
|
|
@@ -482,7 +482,7 @@ function _e(i) {
|
|
|
482
482
|
}
|
|
483
483
|
class ye extends d {
|
|
484
484
|
constructor() {
|
|
485
|
-
super(...arguments), this._onChange = new
|
|
485
|
+
super(...arguments), this._onChange = new I();
|
|
486
486
|
}
|
|
487
487
|
/**
|
|
488
488
|
* Subscribes a listener callback function. Every time a property is changed,
|
|
@@ -565,10 +565,10 @@ class ye extends d {
|
|
|
565
565
|
return this.notify({ [e]: this[e] }), t;
|
|
566
566
|
}
|
|
567
567
|
}
|
|
568
|
-
const
|
|
568
|
+
const N = class N {
|
|
569
569
|
constructor(e, t, r) {
|
|
570
570
|
if (r) {
|
|
571
|
-
if (!(t instanceof d)) throw new Error(
|
|
571
|
+
if (!(t instanceof d)) throw new Error(N.error.persistentNeedForSubCollection);
|
|
572
572
|
this.collectionName = `${t.className}/${t.id}/${r}`;
|
|
573
573
|
} else
|
|
574
574
|
this.collectionName = t instanceof d ? t.className : t;
|
|
@@ -658,7 +658,7 @@ const A = class A {
|
|
|
658
658
|
return this._stream.onDocumentChange(
|
|
659
659
|
this.collectionName,
|
|
660
660
|
e,
|
|
661
|
-
(r) => t(
|
|
661
|
+
(r) => t(w.toPersistentDocumentChange(r))
|
|
662
662
|
);
|
|
663
663
|
}
|
|
664
664
|
onCollectionChange(e, t) {
|
|
@@ -666,7 +666,7 @@ const A = class A {
|
|
|
666
666
|
this.preprocessQueryObject(e.getQueryObject()),
|
|
667
667
|
this.collectionName,
|
|
668
668
|
(r) => t(r.map(
|
|
669
|
-
(s) =>
|
|
669
|
+
(s) => w.toPersistentDocumentChange(s)
|
|
670
670
|
))
|
|
671
671
|
);
|
|
672
672
|
}
|
|
@@ -698,7 +698,7 @@ const A = class A {
|
|
|
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
|
|
701
|
+
return w.isArrayOperator(r.operator) && s instanceof d ? {
|
|
702
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,
|
|
@@ -716,11 +716,11 @@ const A = class A {
|
|
|
716
716
|
};
|
|
717
717
|
}
|
|
718
718
|
};
|
|
719
|
-
|
|
719
|
+
N.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 =
|
|
723
|
+
let R = N;
|
|
724
724
|
class te {
|
|
725
725
|
constructor(e) {
|
|
726
726
|
this.queryObject = { operations: [] }, this.model = e;
|
|
@@ -781,8 +781,8 @@ class te {
|
|
|
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((u, h) => {
|
|
785
|
+
o[u] = h < n.length - 2 ? {} : r, o = o[u];
|
|
786
786
|
}), this.queryObject.operations?.push({
|
|
787
787
|
property: n[0],
|
|
788
788
|
operator: t,
|
|
@@ -1013,36 +1013,23 @@ const P = class P {
|
|
|
1013
1013
|
}
|
|
1014
1014
|
};
|
|
1015
1015
|
P.error = { shouldBeRegistered: "You should register a data source before using the data Store." };
|
|
1016
|
-
let
|
|
1017
|
-
class
|
|
1016
|
+
let k = P;
|
|
1017
|
+
class L {
|
|
1018
1018
|
constructor(e) {
|
|
1019
|
-
this.
|
|
1020
|
-
throw new Error("The method subscribeToDocumentChangeListener has not been implemented in the concrete data source");
|
|
1021
|
-
}, this._resolveCollectionPaths = () => {
|
|
1019
|
+
this._resolveCollectionPaths = () => {
|
|
1022
1020
|
throw new Error("The method collectionsMatchingTemplate has not been implemented in the concrete data source");
|
|
1023
|
-
}, this._disabledChangeListeners = /* @__PURE__ */ new Set(), e && (this._beforeUpdate = e.beforeUpdateDocument, this._afterUpdate = e.afterUpdateDocument, this._afterDocumentChange = e.afterDocumentChange, this._beforeQueryOwnerCollection = e.beforeQueryOwnerCollection);
|
|
1021
|
+
}, this._disabledChangeListeners = /* @__PURE__ */ new Set(), this._collectionsToWatch = {}, e && (this._beforeUpdate = e.beforeUpdateDocument, this._afterUpdate = e.afterUpdateDocument, this._afterDocumentChange = e.afterDocumentChange, this._beforeDocumentChange = e.beforeDocumentChange, this._beforeQueryOwnerCollection = e.beforeQueryOwnerCollection), this.installUpdaters();
|
|
1024
1022
|
}
|
|
1025
1023
|
installUpdaters() {
|
|
1026
|
-
const e = d.getSystemRegisteredReferencesWithCachedProps()
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
if (!
|
|
1030
|
-
(Array.isArray(
|
|
1031
|
-
|
|
1024
|
+
const e = d.getSystemRegisteredReferencesWithCachedProps();
|
|
1025
|
+
this._collectionsToWatch = {}, Object.entries(e).forEach(([t, r]) => {
|
|
1026
|
+
r.forEach((s) => {
|
|
1027
|
+
if (!s.typeName) return;
|
|
1028
|
+
(Array.isArray(s.typeName) ? s.typeName : [s?.typeName ?? t]).map((o) => d.collectionPath(d.createInstance(o), s)).forEach((o) => {
|
|
1029
|
+
this._collectionsToWatch[o] || (this._collectionsToWatch[o] = []), this._collectionsToWatch[o].find((u) => u.name === s.name && u.ownerClassName() === s.ownerClassName()) || this._collectionsToWatch[o].push(s);
|
|
1032
1030
|
});
|
|
1033
1031
|
});
|
|
1034
|
-
})
|
|
1035
|
-
const n = this._subscribeToDocumentChangeListener(
|
|
1036
|
-
r,
|
|
1037
|
-
(o) => this.onDocumentChange(o, s)
|
|
1038
|
-
);
|
|
1039
|
-
if (n) n.props = s, this.handlers.push(n);
|
|
1040
|
-
else
|
|
1041
|
-
throw new Error("The method documentChangeListener has not been implemented in the concrete data source");
|
|
1042
|
-
}), this.handlers;
|
|
1043
|
-
}
|
|
1044
|
-
uninstallUpdaters() {
|
|
1045
|
-
this.handlers.forEach((e) => e.uninstall()), this.handlers = [];
|
|
1032
|
+
});
|
|
1046
1033
|
}
|
|
1047
1034
|
/**
|
|
1048
1035
|
* Set a callback to be executed before updating each document that has a cached prop to update.
|
|
@@ -1076,34 +1063,35 @@ class I {
|
|
|
1076
1063
|
set afterUpdateDocument(e) {
|
|
1077
1064
|
this._afterUpdate = e;
|
|
1078
1065
|
}
|
|
1079
|
-
/**
|
|
1080
|
-
* Set a subscriber for handling document change events.
|
|
1081
|
-
* @param subscriber The subscriber to be used for handling document change events.
|
|
1082
|
-
*/
|
|
1083
|
-
set documentChangeListenerSubscriber(e) {
|
|
1084
|
-
this._subscribeToDocumentChangeListener = e;
|
|
1085
|
-
}
|
|
1086
1066
|
set beforeQueryOwnerCollection(e) {
|
|
1087
1067
|
this._beforeQueryOwnerCollection = e;
|
|
1088
1068
|
}
|
|
1089
1069
|
set resolveCollectionPaths(e) {
|
|
1090
1070
|
this._resolveCollectionPaths = e;
|
|
1091
1071
|
}
|
|
1072
|
+
get collectionsToWatch() {
|
|
1073
|
+
return this._collectionsToWatch;
|
|
1074
|
+
}
|
|
1075
|
+
updateProps(e, t) {
|
|
1076
|
+
const r = this._collectionsToWatch[e];
|
|
1077
|
+
if (r)
|
|
1078
|
+
return this.onDocumentChange(t, r);
|
|
1079
|
+
}
|
|
1092
1080
|
async onDocumentChange(e, t) {
|
|
1093
|
-
const r =
|
|
1081
|
+
const r = w.toPersistentDocumentChange(e);
|
|
1094
1082
|
this._beforeDocumentChange?.(r, t);
|
|
1095
1083
|
const s = {};
|
|
1096
1084
|
r.before && (r.after?.id && this._disabledChangeListeners.has(r.after?.id) || (await Promise.all(t.map(async (n) => {
|
|
1097
|
-
const o =
|
|
1098
|
-
await Promise.all(a.map(async (
|
|
1099
|
-
const
|
|
1100
|
-
let c =
|
|
1085
|
+
const o = L.ownerCollectionPath(d.createInstance(n.ownerClassName()), n, r.params), a = await this._resolveCollectionPaths(o);
|
|
1086
|
+
await Promise.all(a.map(async (u) => {
|
|
1087
|
+
const h = k.getModel(u);
|
|
1088
|
+
let c = h.find(), b = !1;
|
|
1101
1089
|
n.cachedProps?.forEach((f) => {
|
|
1102
1090
|
const S = r.before[f], O = r.after[f];
|
|
1103
|
-
S !== O && (
|
|
1104
|
-
}),
|
|
1091
|
+
S !== O && (b = !0);
|
|
1092
|
+
}), b && (n.searchableArray ? c = c.where(n.name, "contains", r.before) : c = c.where(n.name, "==", r.before)), c = this._beforeQueryOwnerCollection?.(c) ?? c;
|
|
1105
1093
|
const E = await c.get();
|
|
1106
|
-
return s[
|
|
1094
|
+
return s[u] = {
|
|
1107
1095
|
totalDocumentsToUpdate: E.length,
|
|
1108
1096
|
updatedDocuments: [],
|
|
1109
1097
|
documentsToUpdate: E.map((f) => f.name ?? f.id)
|
|
@@ -1111,16 +1099,16 @@ class I {
|
|
|
1111
1099
|
E.map(async (f) => {
|
|
1112
1100
|
let S = !1;
|
|
1113
1101
|
if (n.cachedProps?.forEach((O) => {
|
|
1114
|
-
const
|
|
1115
|
-
|
|
1102
|
+
const A = r.before[O], q = r.after[O];
|
|
1103
|
+
A !== q && (S = !0);
|
|
1116
1104
|
}), S) {
|
|
1117
1105
|
if (n.searchableArray) {
|
|
1118
|
-
const O = f[n.name].findIndex((
|
|
1106
|
+
const O = f[n.name].findIndex((A) => A.id === r.before.id);
|
|
1119
1107
|
f[n.name][O] = r.after;
|
|
1120
1108
|
} else
|
|
1121
1109
|
f[`_${n.name}`] = r.after;
|
|
1122
|
-
this._beforeUpdate?.(f, n), this.disableChangeListener(f), await
|
|
1123
|
-
} else
|
|
1110
|
+
this._beforeUpdate?.(f, n), this.disableChangeListener(f), await h.save(f), this.enableChangeListener(f), s[u]?.updatedDocuments.push(f.id), this._afterUpdate?.(f, n);
|
|
1111
|
+
} else return Promise.resolve();
|
|
1124
1112
|
})
|
|
1125
1113
|
]);
|
|
1126
1114
|
}));
|
|
@@ -1137,15 +1125,12 @@ class I {
|
|
|
1137
1125
|
return typeof t.ownerCollection == "function" ? s = t.ownerCollection(e, t, r) : s = t.ownerCollection ?? e.className, s;
|
|
1138
1126
|
}
|
|
1139
1127
|
}
|
|
1140
|
-
class
|
|
1128
|
+
class w {
|
|
1141
1129
|
constructor() {
|
|
1142
1130
|
this._cachedPropsUpdater = void 0;
|
|
1143
1131
|
}
|
|
1144
1132
|
installCachedPropsUpdater(e) {
|
|
1145
|
-
return this._cachedPropsUpdater = new
|
|
1146
|
-
}
|
|
1147
|
-
uninstallCachedPropsUpdater() {
|
|
1148
|
-
this._cachedPropsUpdater?.uninstallUpdaters(), this._cachedPropsUpdater = void 0;
|
|
1133
|
+
return this._cachedPropsUpdater = new L(e), this._cachedPropsUpdater.resolveCollectionPaths = this.resolveCollectionPaths.bind(this), this._cachedPropsUpdater;
|
|
1149
1134
|
}
|
|
1150
1135
|
get cachedPropsUpdater() {
|
|
1151
1136
|
return this._cachedPropsUpdater;
|
|
@@ -1164,7 +1149,7 @@ class b {
|
|
|
1164
1149
|
*/
|
|
1165
1150
|
static toPropertyPathOperations(e) {
|
|
1166
1151
|
return e ? e.map((t) => {
|
|
1167
|
-
if (
|
|
1152
|
+
if (w.isArrayOperator(t.operator) && t.value[0] instanceof d)
|
|
1168
1153
|
return {
|
|
1169
1154
|
property: d.searchableArrayNameFor(t.property),
|
|
1170
1155
|
operator: t.operator,
|
|
@@ -1202,13 +1187,13 @@ class b {
|
|
|
1202
1187
|
return new RegExp("^" + s + "$").test(t);
|
|
1203
1188
|
}
|
|
1204
1189
|
static extractTemplateParams(e, t) {
|
|
1205
|
-
const r = [], n = t.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&").replace(/\\\{([^}]+)\\\}/g, (
|
|
1206
|
-
return a && r.forEach((
|
|
1207
|
-
h
|
|
1208
|
-
}),
|
|
1190
|
+
const r = [], n = t.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&").replace(/\\\{([^}]+)\\\}/g, (h, c) => (r.push(c), "([^/]+)")), o = new RegExp("^" + n + "$"), a = e.match(o), u = {};
|
|
1191
|
+
return a && r.forEach((h, c) => {
|
|
1192
|
+
u[h] = a[c + 1];
|
|
1193
|
+
}), u;
|
|
1209
1194
|
}
|
|
1210
1195
|
}
|
|
1211
|
-
class be extends
|
|
1196
|
+
class be extends w {
|
|
1212
1197
|
/**
|
|
1213
1198
|
* @param jsonRawData the JSON object to be used as data store
|
|
1214
1199
|
*/
|
|
@@ -1269,12 +1254,12 @@ class be extends b {
|
|
|
1269
1254
|
s || (this._collectionListeners[t] = {}, s = this._collectionListeners[t]);
|
|
1270
1255
|
const n = (a) => {
|
|
1271
1256
|
if (!a.after) return;
|
|
1272
|
-
const
|
|
1273
|
-
a.before &&
|
|
1274
|
-
const c = this.retrieveQueryDocs(
|
|
1275
|
-
c.length > 0 && r(c.map((
|
|
1257
|
+
const u = [a.after];
|
|
1258
|
+
a.before && u.push(a.before);
|
|
1259
|
+
const c = this.retrieveQueryDocs(u, e.operations).filter((b, E, f) => E === f.findIndex((S) => S.id === b.id));
|
|
1260
|
+
c.length > 0 && r(c.map((b) => ({
|
|
1276
1261
|
before: a.before,
|
|
1277
|
-
after:
|
|
1262
|
+
after: b,
|
|
1278
1263
|
type: a.type,
|
|
1279
1264
|
params: a.params
|
|
1280
1265
|
})));
|
|
@@ -1313,31 +1298,6 @@ class be extends b {
|
|
|
1313
1298
|
delete: e
|
|
1314
1299
|
} : this._simulateError = e, this);
|
|
1315
1300
|
}
|
|
1316
|
-
subscribeToDocumentChangeListener(e, t) {
|
|
1317
|
-
const r = this.collectionsMatchingTemplate(e), s = Math.random().toString(36).substring(2, 9);
|
|
1318
|
-
return r.forEach((n) => {
|
|
1319
|
-
let o = this._serverCollectionListeners[n];
|
|
1320
|
-
o || (o = this._serverCollectionListeners[n] = {}), o[s] = (a) => {
|
|
1321
|
-
const h = b.extractTemplateParams(n, e);
|
|
1322
|
-
t({
|
|
1323
|
-
...a,
|
|
1324
|
-
before: a.before,
|
|
1325
|
-
after: a.after,
|
|
1326
|
-
collectionPath: n,
|
|
1327
|
-
params: {
|
|
1328
|
-
...a.params,
|
|
1329
|
-
...h
|
|
1330
|
-
}
|
|
1331
|
-
});
|
|
1332
|
-
};
|
|
1333
|
-
}), {
|
|
1334
|
-
uninstall: () => {
|
|
1335
|
-
r.forEach((n) => delete this._serverCollectionListeners[n]?.[s]);
|
|
1336
|
-
},
|
|
1337
|
-
nativeHandler: void 0,
|
|
1338
|
-
collectionPath: e
|
|
1339
|
-
};
|
|
1340
|
-
}
|
|
1341
1301
|
notifyChange(e, t, r) {
|
|
1342
1302
|
const s = {
|
|
1343
1303
|
before: r,
|
|
@@ -1356,7 +1316,7 @@ class be extends b {
|
|
|
1356
1316
|
limit: (n) => e,
|
|
1357
1317
|
//.slice( 0, limit ),
|
|
1358
1318
|
operations: (n) => this.retrieveQueryDocs(e, n),
|
|
1359
|
-
sort: ({ order: n, propertyName: o }) => e.sort((a,
|
|
1319
|
+
sort: ({ order: n, propertyName: o }) => e.sort((a, u) => n === "asc" ? this.deepValue(a, o) > this.deepValue(u, o) ? 1 : -1 : this.deepValue(a, o) < this.deepValue(u, o) ? 1 : -1)
|
|
1360
1320
|
}[t](r);
|
|
1361
1321
|
}
|
|
1362
1322
|
retrieveQueryDocs(e, t) {
|
|
@@ -1373,16 +1333,16 @@ class be extends b {
|
|
|
1373
1333
|
}
|
|
1374
1334
|
isQueryMatched(e, t) {
|
|
1375
1335
|
const r = {
|
|
1376
|
-
"==": (
|
|
1377
|
-
"!=": (
|
|
1378
|
-
"<": (
|
|
1379
|
-
"<=": (
|
|
1380
|
-
">": (
|
|
1381
|
-
">=": (
|
|
1382
|
-
containsAny: (
|
|
1383
|
-
contains: (
|
|
1384
|
-
}, { property: s, value: n, operator: o } = t, [a,
|
|
1385
|
-
return r[o](a,
|
|
1336
|
+
"==": (h, c) => h === c,
|
|
1337
|
+
"!=": (h, c) => h !== c,
|
|
1338
|
+
"<": (h, c) => h < c,
|
|
1339
|
+
"<=": (h, c) => h <= c,
|
|
1340
|
+
">": (h, c) => h > c,
|
|
1341
|
+
">=": (h, c) => h >= c,
|
|
1342
|
+
containsAny: (h, c) => h?.some((b) => c?.includes(b)),
|
|
1343
|
+
contains: (h, c) => h?.includes(c)
|
|
1344
|
+
}, { property: s, value: n, operator: o } = t, [a, u] = this.retrieveValuesToCompare(e, s, n);
|
|
1345
|
+
return r[o](a, u);
|
|
1386
1346
|
}
|
|
1387
1347
|
retrieveValuesToCompare(e, t, r) {
|
|
1388
1348
|
const s = e[t];
|
|
@@ -1408,7 +1368,7 @@ class be extends b {
|
|
|
1408
1368
|
return Promise.resolve(this.collectionsMatchingTemplate(e));
|
|
1409
1369
|
}
|
|
1410
1370
|
collectionsMatchingTemplate(e) {
|
|
1411
|
-
return Object.keys(this._jsonRawData).filter((t) =>
|
|
1371
|
+
return Object.keys(this._jsonRawData).filter((t) => w.isStringMatchingTemplate(e, t));
|
|
1412
1372
|
}
|
|
1413
1373
|
}
|
|
1414
1374
|
const v = class v {
|
|
@@ -1434,9 +1394,9 @@ const v = class v {
|
|
|
1434
1394
|
}
|
|
1435
1395
|
};
|
|
1436
1396
|
v._cloudStorageFactoryMap = {};
|
|
1437
|
-
let
|
|
1397
|
+
let C = v;
|
|
1438
1398
|
function re(i, e) {
|
|
1439
|
-
return
|
|
1399
|
+
return C.registerCloudStorage(i, e), (t) => {
|
|
1440
1400
|
t.prototype.__className = i;
|
|
1441
1401
|
};
|
|
1442
1402
|
}
|
|
@@ -1445,7 +1405,7 @@ var se = Object.getOwnPropertyDescriptor, ie = (i, e, t, r) => {
|
|
|
1445
1405
|
(o = i[n]) && (s = o(s) || s);
|
|
1446
1406
|
return s;
|
|
1447
1407
|
};
|
|
1448
|
-
let
|
|
1408
|
+
let T = class extends C {
|
|
1449
1409
|
constructor(i = "") {
|
|
1450
1410
|
super(), this._simulateDelay = 0, this._pendingPromises = [], this.mockFileSystem = {}, this._pathToMockFiles = i;
|
|
1451
1411
|
}
|
|
@@ -1493,9 +1453,9 @@ let F = class extends w {
|
|
|
1493
1453
|
return delete this.mockFileSystem[i], this.resolveWithDelay();
|
|
1494
1454
|
}
|
|
1495
1455
|
};
|
|
1496
|
-
|
|
1497
|
-
re("MockCloudStorage", () => new
|
|
1498
|
-
],
|
|
1456
|
+
T = ie([
|
|
1457
|
+
re("MockCloudStorage", () => new T())
|
|
1458
|
+
], T);
|
|
1499
1459
|
var ne = Object.defineProperty, oe = Object.getOwnPropertyDescriptor, U = (i, e, t, r) => {
|
|
1500
1460
|
for (var s = r > 1 ? void 0 : r ? oe(e, t) : e, n = i.length - 1, o; n >= 0; n--)
|
|
1501
1461
|
(o = i[n]) && (s = (r ? o(e, t, s) : o(s)) || s);
|
|
@@ -1503,11 +1463,11 @@ var ne = Object.defineProperty, oe = Object.getOwnPropertyDescriptor, U = (i, e,
|
|
|
1503
1463
|
}, ae = /* @__PURE__ */ ((i) => (i[i.stored = 0] = "stored", i[i.pendingDataSet = 1] = "pendingDataSet", i[i.deleted = 2] = "deleted", i))(ae || {});
|
|
1504
1464
|
let D = class extends d {
|
|
1505
1465
|
constructor() {
|
|
1506
|
-
super(...arguments), this._onChange = new
|
|
1466
|
+
super(...arguments), this._onChange = new I();
|
|
1507
1467
|
}
|
|
1508
1468
|
async save({ data: i, fileName: e, progress: t, cloudStorageProvider: r } = {}) {
|
|
1509
1469
|
const s = i || this._pendingData;
|
|
1510
|
-
s && (this._reference && await this.delete(), this.provider = r ||
|
|
1470
|
+
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 }));
|
|
1511
1471
|
}
|
|
1512
1472
|
uploadControl() {
|
|
1513
1473
|
return this.provider.uploadControl();
|
|
@@ -1522,9 +1482,9 @@ let D = class extends d {
|
|
|
1522
1482
|
get provider() {
|
|
1523
1483
|
if (!this._provider)
|
|
1524
1484
|
try {
|
|
1525
|
-
this._provider =
|
|
1485
|
+
this._provider = C.createInstance(this._cloudStorageProviderName);
|
|
1526
1486
|
} catch {
|
|
1527
|
-
this._provider =
|
|
1487
|
+
this._provider = C.defaultCloudStorage;
|
|
1528
1488
|
}
|
|
1529
1489
|
return this._provider;
|
|
1530
1490
|
}
|
|
@@ -1566,11 +1526,11 @@ U([
|
|
|
1566
1526
|
D = U([
|
|
1567
1527
|
ee("StoredFile")
|
|
1568
1528
|
], D);
|
|
1569
|
-
class
|
|
1529
|
+
class Q {
|
|
1570
1530
|
}
|
|
1571
|
-
const p = class p extends
|
|
1531
|
+
const p = class p extends Q {
|
|
1572
1532
|
constructor() {
|
|
1573
|
-
if (super(), this._onAuthStateChange = new
|
|
1533
|
+
if (super(), this._onAuthStateChange = new I(), !p._authService) throw new Error(p.error.shouldBeRegistered);
|
|
1574
1534
|
p._authService.onAuthStateChange(
|
|
1575
1535
|
(e) => this.authStateChanged(e)
|
|
1576
1536
|
);
|
|
@@ -1695,13 +1655,13 @@ const p = class p extends W {
|
|
|
1695
1655
|
};
|
|
1696
1656
|
p.error = { shouldBeRegistered: "You should register an auth service before using Auth." }, p._instance = void 0;
|
|
1697
1657
|
let x = p;
|
|
1698
|
-
class
|
|
1658
|
+
class Pe extends Q {
|
|
1699
1659
|
constructor() {
|
|
1700
1660
|
super(...arguments), this.pendingPromises = [], this._fakeRegisteredUsers = {};
|
|
1701
1661
|
}
|
|
1702
1662
|
signUp(e) {
|
|
1703
|
-
const { verificationLink: t, email: r, password: s, authProvider: n } = e, o = new Promise(async (a,
|
|
1704
|
-
n === "email" && (r ||
|
|
1663
|
+
const { verificationLink: t, email: r, password: s, authProvider: n } = e, o = new Promise(async (a, u) => {
|
|
1664
|
+
n === "email" && (r || u({ code: "missingEmail", message: "missingEmail" }), s || u({ 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)) : (u({ code: "userNotFound", message: t || "Test auth error" }), this.notifyChange?.(void 0));
|
|
1705
1665
|
});
|
|
1706
1666
|
return this.pendingPromises.push(o), o;
|
|
1707
1667
|
}
|
|
@@ -1797,7 +1757,7 @@ const y = class y {
|
|
|
1797
1757
|
};
|
|
1798
1758
|
y.error = { shouldBeRegistered: "You should register a cloud functions service with useCloudFunctionsService static method before using CloudFunctions." };
|
|
1799
1759
|
let $ = y;
|
|
1800
|
-
class
|
|
1760
|
+
class ve {
|
|
1801
1761
|
constructor(e) {
|
|
1802
1762
|
this._registeredFunctions = e;
|
|
1803
1763
|
}
|
|
@@ -1838,7 +1798,7 @@ const g = class g extends B {
|
|
|
1838
1798
|
};
|
|
1839
1799
|
g.error = { shouldBeRegistered: "You should register a Server Auth service before using the Server Auth." }, g._instance = void 0;
|
|
1840
1800
|
let V = g;
|
|
1841
|
-
class
|
|
1801
|
+
class we extends B {
|
|
1842
1802
|
constructor(e) {
|
|
1843
1803
|
super(), this._userCredentials = e;
|
|
1844
1804
|
}
|
|
@@ -1864,7 +1824,7 @@ class ve extends B {
|
|
|
1864
1824
|
return this._userCredentials;
|
|
1865
1825
|
}
|
|
1866
1826
|
}
|
|
1867
|
-
function
|
|
1827
|
+
function Ce(i, e) {
|
|
1868
1828
|
return i ? i.replace(/\${\s*(\w*)\s*}/g, function(t, r) {
|
|
1869
1829
|
return e[r] || "";
|
|
1870
1830
|
}) : "";
|
|
@@ -1885,23 +1845,23 @@ function Oe(i, e) {
|
|
|
1885
1845
|
}
|
|
1886
1846
|
export {
|
|
1887
1847
|
x as Auth,
|
|
1888
|
-
|
|
1889
|
-
|
|
1848
|
+
Pe as AuthMock,
|
|
1849
|
+
Q as AuthService,
|
|
1890
1850
|
$ as CloudFunctions,
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1851
|
+
ve as CloudFunctionsMock,
|
|
1852
|
+
C as CloudStorage,
|
|
1853
|
+
w as DataSource,
|
|
1894
1854
|
ye as EntropicComponent,
|
|
1895
1855
|
be as JsonDataSource,
|
|
1896
|
-
|
|
1856
|
+
T as MockCloudStorage,
|
|
1897
1857
|
R as Model,
|
|
1898
|
-
|
|
1858
|
+
I as Observable,
|
|
1899
1859
|
d as Persistent,
|
|
1900
1860
|
te as Query,
|
|
1901
1861
|
V as ServerAuth,
|
|
1902
|
-
|
|
1862
|
+
we as ServerAuthMock,
|
|
1903
1863
|
B as ServerAuthService,
|
|
1904
|
-
|
|
1864
|
+
k as Store,
|
|
1905
1865
|
D as StoredFile,
|
|
1906
1866
|
ae as StoredFileEvent,
|
|
1907
1867
|
De as camelCase,
|
|
@@ -1916,7 +1876,7 @@ export {
|
|
|
1916
1876
|
re as registerCloudStorage,
|
|
1917
1877
|
fe as registerLegacyClassName,
|
|
1918
1878
|
ee as registerPersistentClass,
|
|
1919
|
-
|
|
1879
|
+
Ce as replaceValue,
|
|
1920
1880
|
pe as required,
|
|
1921
1881
|
ge as requiredWithValidator,
|
|
1922
1882
|
me as searchableArray,
|