entropic-bond 1.59.2 → 1.59.3
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 +110 -115
- 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/package.json +8 -8
package/lib/entropic-bond.js
CHANGED
|
@@ -15,41 +15,36 @@ var e = class {
|
|
|
15
15
|
get subscribersCount() {
|
|
16
16
|
return this.subscribers.size;
|
|
17
17
|
}
|
|
18
|
-
}, t =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return (t[e[n + 0]] + t[e[n + 1]] + t[e[n + 2]] + t[e[n + 3]] + "-" + t[e[n + 4]] + t[e[n + 5]] + "-" + t[e[n + 6]] + t[e[n + 7]] + "-" + t[e[n + 8]] + t[e[n + 9]] + "-" + t[e[n + 10]] + t[e[n + 11]] + t[e[n + 12]] + t[e[n + 13]] + t[e[n + 14]] + t[e[n + 15]]).toLowerCase();
|
|
18
|
+
}, t = /* @__PURE__ */ new Uint8Array(16);
|
|
19
|
+
function n() {
|
|
20
|
+
return crypto.getRandomValues(t);
|
|
22
21
|
}
|
|
23
22
|
//#endregion
|
|
24
|
-
//#region node_modules/uuid/dist/
|
|
25
|
-
var r
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
r = crypto.getRandomValues.bind(crypto);
|
|
30
|
-
}
|
|
31
|
-
return r(i);
|
|
23
|
+
//#region node_modules/uuid/dist/stringify.js
|
|
24
|
+
var r = [];
|
|
25
|
+
for (let e = 0; e < 256; ++e) r.push((e + 256).toString(16).slice(1));
|
|
26
|
+
function i(e, t = 0) {
|
|
27
|
+
return (r[e[t + 0]] + r[e[t + 1]] + r[e[t + 2]] + r[e[t + 3]] + "-" + r[e[t + 4]] + r[e[t + 5]] + "-" + r[e[t + 6]] + r[e[t + 7]] + "-" + r[e[t + 8]] + r[e[t + 9]] + "-" + r[e[t + 10]] + r[e[t + 11]] + r[e[t + 12]] + r[e[t + 13]] + r[e[t + 14]] + r[e[t + 15]]).toLowerCase();
|
|
32
28
|
}
|
|
33
|
-
var o = { randomUUID: typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto) };
|
|
34
29
|
//#endregion
|
|
35
30
|
//#region node_modules/uuid/dist/v4.js
|
|
36
|
-
function
|
|
31
|
+
function a(e, t, n) {
|
|
32
|
+
return !t && !e && crypto.randomUUID ? crypto.randomUUID() : o(e, t, n);
|
|
33
|
+
}
|
|
34
|
+
function o(e, t, r) {
|
|
37
35
|
e ||= {};
|
|
38
|
-
let
|
|
39
|
-
if (
|
|
40
|
-
if (
|
|
36
|
+
let a = e.random ?? e.rng?.() ?? n();
|
|
37
|
+
if (a.length < 16) throw Error("Random bytes length must be >= 16");
|
|
38
|
+
if (a[6] = a[6] & 15 | 64, a[8] = a[8] & 63 | 128, t) {
|
|
41
39
|
if (r ||= 0, r < 0 || r + 16 > t.length) throw RangeError(`UUID byte range ${r}:${r + 15} is out of buffer bounds`);
|
|
42
|
-
for (let e = 0; e < 16; ++e) t[r + e] =
|
|
40
|
+
for (let e = 0; e < 16; ++e) t[r + e] = a[e];
|
|
43
41
|
return t;
|
|
44
42
|
}
|
|
45
|
-
return
|
|
46
|
-
}
|
|
47
|
-
function c(e, t, n) {
|
|
48
|
-
return o.randomUUID && !t && !e ? o.randomUUID() : s(e, t, n);
|
|
43
|
+
return i(a);
|
|
49
44
|
}
|
|
50
45
|
//#endregion
|
|
51
|
-
//#region \0@oxc-project+runtime@0.
|
|
52
|
-
function
|
|
46
|
+
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorate.js
|
|
47
|
+
function s(e, t, n, r) {
|
|
53
48
|
var i = arguments.length, a = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, o;
|
|
54
49
|
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") a = Reflect.decorate(e, t, n, r);
|
|
55
50
|
else for (var s = e.length - 1; s >= 0; s--) (o = e[s]) && (a = (i < 3 ? o(a) : i > 3 ? o(t, n, a) : o(t, n)) || a);
|
|
@@ -57,7 +52,7 @@ function l(e, t, n, r) {
|
|
|
57
52
|
}
|
|
58
53
|
//#endregion
|
|
59
54
|
//#region src/persistent/persistent.ts
|
|
60
|
-
var
|
|
55
|
+
var c = class e {
|
|
61
56
|
static registerFactory(e, t, n, r = !1) {
|
|
62
57
|
this._factoryMap[e] = {
|
|
63
58
|
factory: t,
|
|
@@ -87,7 +82,7 @@ var u = class e {
|
|
|
87
82
|
if (t instanceof e ? t = t.className : typeof t == "string" || (t = new t().className), !this._factoryMap[t]) throw Error(`You should register class ${t} prior to use.`);
|
|
88
83
|
return this._factoryMap[t].annotation;
|
|
89
84
|
}
|
|
90
|
-
constructor(e =
|
|
85
|
+
constructor(e = a()) {
|
|
91
86
|
this._id = e;
|
|
92
87
|
}
|
|
93
88
|
get className() {
|
|
@@ -240,24 +235,24 @@ var u = class e {
|
|
|
240
235
|
this._factoryMap = {};
|
|
241
236
|
}
|
|
242
237
|
};
|
|
243
|
-
|
|
244
|
-
function
|
|
245
|
-
return
|
|
238
|
+
s([l], c.prototype, "_id", void 0);
|
|
239
|
+
function l(e, t) {
|
|
240
|
+
return h()(e, t);
|
|
246
241
|
}
|
|
247
|
-
function
|
|
242
|
+
function u(e) {
|
|
248
243
|
return function(t, n) {
|
|
249
|
-
return
|
|
244
|
+
return h({
|
|
250
245
|
storeInCollection: e,
|
|
251
246
|
isReference: !0
|
|
252
247
|
})(t, n);
|
|
253
248
|
};
|
|
254
249
|
}
|
|
255
|
-
function
|
|
256
|
-
return
|
|
250
|
+
function d(e, t) {
|
|
251
|
+
return h({ isReference: !0 })(e, t);
|
|
257
252
|
}
|
|
258
|
-
function
|
|
253
|
+
function f(e, t, n, r) {
|
|
259
254
|
return function(i, a) {
|
|
260
|
-
return
|
|
255
|
+
return h({
|
|
261
256
|
isReference: !0,
|
|
262
257
|
storeInCollection: n,
|
|
263
258
|
typeName: t,
|
|
@@ -266,16 +261,16 @@ function m(e, t, n, r) {
|
|
|
266
261
|
})(i, a);
|
|
267
262
|
};
|
|
268
263
|
}
|
|
269
|
-
function
|
|
270
|
-
return
|
|
264
|
+
function p(e, t, n) {
|
|
265
|
+
return h({
|
|
271
266
|
isReference: !0,
|
|
272
267
|
isPureReference: !0,
|
|
273
268
|
storeInCollection: n
|
|
274
269
|
})(e, t);
|
|
275
270
|
}
|
|
276
|
-
function
|
|
271
|
+
function m(e, t, n, r) {
|
|
277
272
|
return function(i, a) {
|
|
278
|
-
return
|
|
273
|
+
return h({
|
|
279
274
|
isReference: !0,
|
|
280
275
|
isPureReference: !0,
|
|
281
276
|
storeInCollection: n,
|
|
@@ -285,7 +280,7 @@ function g(e, t, n, r) {
|
|
|
285
280
|
})(i, a);
|
|
286
281
|
};
|
|
287
282
|
}
|
|
288
|
-
function
|
|
283
|
+
function h(e) {
|
|
289
284
|
return function(t, n) {
|
|
290
285
|
Object.getOwnPropertyDescriptor(t, "_persistentProperties") || (t._persistentProperties ? t._persistentProperties = [...t._persistentProperties] : t._persistentProperties = []);
|
|
291
286
|
let r = t._persistentProperties.find((e) => e.name === n);
|
|
@@ -296,36 +291,36 @@ function _(e) {
|
|
|
296
291
|
});
|
|
297
292
|
};
|
|
298
293
|
}
|
|
299
|
-
function
|
|
294
|
+
function g(e, t) {
|
|
300
295
|
return (n) => {
|
|
301
|
-
|
|
296
|
+
c.registerFactory(e, n, t), n.prototype.__className = e;
|
|
302
297
|
};
|
|
303
298
|
}
|
|
304
|
-
function
|
|
299
|
+
function _(e) {
|
|
305
300
|
return (t) => {
|
|
306
|
-
|
|
301
|
+
c.registerFactory(e, t, void 0, !0);
|
|
307
302
|
};
|
|
308
303
|
}
|
|
309
|
-
function
|
|
310
|
-
return
|
|
304
|
+
function v(e, t) {
|
|
305
|
+
return h({ searchableArray: !0 })(e, t);
|
|
311
306
|
}
|
|
312
|
-
function
|
|
313
|
-
return
|
|
307
|
+
function y(e, t) {
|
|
308
|
+
return h({ validator: (e) => e != null })(e, t);
|
|
314
309
|
}
|
|
315
|
-
function
|
|
310
|
+
function b(e = (e) => e != null) {
|
|
316
311
|
return function(t, n) {
|
|
317
|
-
return
|
|
312
|
+
return h({ validator: e })(t, n);
|
|
318
313
|
};
|
|
319
314
|
}
|
|
320
|
-
function
|
|
315
|
+
function x(e) {
|
|
321
316
|
let t;
|
|
322
317
|
return t = typeof e == "function" ? new e().className : e, function(e, n) {
|
|
323
|
-
return
|
|
318
|
+
return h({ typeName: t })(e, n);
|
|
324
319
|
};
|
|
325
320
|
}
|
|
326
321
|
//#endregion
|
|
327
322
|
//#region src/persistent/entropic-component.ts
|
|
328
|
-
var
|
|
323
|
+
var S = class extends c {
|
|
329
324
|
constructor(...t) {
|
|
330
325
|
super(...t), this._onChange = new e();
|
|
331
326
|
}
|
|
@@ -350,7 +345,7 @@ var w = class extends u {
|
|
|
350
345
|
let r = "_" + String(e), i = this[r].length;
|
|
351
346
|
if (this[r] = this[r].filter((e) => !n(e, t)), i !== this[r].length) return this.notify({ [e]: this[e] }), t;
|
|
352
347
|
}
|
|
353
|
-
},
|
|
348
|
+
}, C = class e {
|
|
354
349
|
static {
|
|
355
350
|
this.error = {
|
|
356
351
|
persistentNeedForSubCollection: "The document parameter for a sub-collection should be a Persistent instace",
|
|
@@ -359,15 +354,15 @@ var w = class extends u {
|
|
|
359
354
|
}
|
|
360
355
|
constructor(t, n, r) {
|
|
361
356
|
if (r) {
|
|
362
|
-
if (!(n instanceof
|
|
357
|
+
if (!(n instanceof c)) throw Error(e.error.persistentNeedForSubCollection);
|
|
363
358
|
this.collectionName = `${n.className}/${n.id}/${r}`;
|
|
364
|
-
} else this.collectionName = n instanceof
|
|
359
|
+
} else this.collectionName = n instanceof c ? n.className : n;
|
|
365
360
|
this._stream = t;
|
|
366
361
|
}
|
|
367
362
|
findById(e, t) {
|
|
368
363
|
return new Promise((n, r) => {
|
|
369
364
|
this._stream.findById(e, this.collectionName).then((e) => {
|
|
370
|
-
e ? (t ? t.fromObject(e) : t =
|
|
365
|
+
e ? (t ? t.fromObject(e) : t = c.createInstance(e), n(t)) : n(void 0);
|
|
371
366
|
}).catch((e) => r(e));
|
|
372
367
|
});
|
|
373
368
|
}
|
|
@@ -383,11 +378,11 @@ var w = class extends u {
|
|
|
383
378
|
});
|
|
384
379
|
}
|
|
385
380
|
find() {
|
|
386
|
-
return new
|
|
381
|
+
return new w(this);
|
|
387
382
|
}
|
|
388
383
|
query(e = {}, t) {
|
|
389
384
|
if (t) {
|
|
390
|
-
let n = t instanceof
|
|
385
|
+
let n = t instanceof c ? t.className : t;
|
|
391
386
|
e.operations ||= [], e.operations.push({
|
|
392
387
|
property: "__className",
|
|
393
388
|
operator: "==",
|
|
@@ -403,32 +398,32 @@ var w = class extends u {
|
|
|
403
398
|
return this.mapToInstance(() => this._stream.next(e));
|
|
404
399
|
}
|
|
405
400
|
onDocumentChange(e, t) {
|
|
406
|
-
return this._stream.onDocumentChange(this.collectionName, e, (e) => t(
|
|
401
|
+
return this._stream.onDocumentChange(this.collectionName, e, (e) => t(D.toPersistentDocumentChange(e)));
|
|
407
402
|
}
|
|
408
403
|
onCollectionChange(e, t) {
|
|
409
|
-
return this._stream.onCollectionChange(this.preprocessQueryObject(e.getQueryObject()), this.collectionName, (e) => t(e.map((e) =>
|
|
404
|
+
return this._stream.onCollectionChange(this.preprocessQueryObject(e.getQueryObject()), this.collectionName, (e) => t(e.map((e) => D.toPersistentDocumentChange(e))));
|
|
410
405
|
}
|
|
411
406
|
onCollectionTemplateChange(e, t) {
|
|
412
|
-
return this._stream.onDocumentTemplateChange(e, (e) => t(
|
|
407
|
+
return this._stream.onDocumentTemplateChange(e, (e) => t(D.toPersistentDocumentChange(e)));
|
|
413
408
|
}
|
|
414
409
|
mapToInstance(e) {
|
|
415
410
|
return new Promise((t, n) => {
|
|
416
|
-
e().then((e) => t(e.map((e) =>
|
|
411
|
+
e().then((e) => t(e.map((e) => c.createInstance(e)))).catch((e) => n(e));
|
|
417
412
|
});
|
|
418
413
|
}
|
|
419
414
|
preprocessQueryObject(e) {
|
|
420
415
|
if (Object.values(e).length === 0) return e;
|
|
421
416
|
let t = e.operations?.map((e) => {
|
|
422
417
|
let t = e.value[0] ?? e.value;
|
|
423
|
-
return
|
|
424
|
-
property:
|
|
418
|
+
return D.isArrayOperator(e.operator) && t instanceof c ? {
|
|
419
|
+
property: c.searchableArrayNameFor(e.property),
|
|
425
420
|
operator: e.operator,
|
|
426
421
|
value: Array.isArray(e.value) ? e.value.map((e) => e.id) : t.id,
|
|
427
422
|
aggregate: e.aggregate
|
|
428
423
|
} : {
|
|
429
424
|
property: e.property,
|
|
430
425
|
operator: e.operator,
|
|
431
|
-
value: e.value instanceof
|
|
426
|
+
value: e.value instanceof c ? { id: e.value.id } : e.value,
|
|
432
427
|
aggregate: e.aggregate
|
|
433
428
|
};
|
|
434
429
|
}) ?? [];
|
|
@@ -437,12 +432,12 @@ var w = class extends u {
|
|
|
437
432
|
operations: t
|
|
438
433
|
};
|
|
439
434
|
}
|
|
440
|
-
},
|
|
435
|
+
}, w = class {
|
|
441
436
|
constructor(e) {
|
|
442
437
|
this.queryObject = { operations: [] }, this.model = e;
|
|
443
438
|
}
|
|
444
439
|
where(e, t, n, r) {
|
|
445
|
-
if (this.queryObject.operations?.at(-1)?.aggregate && !r) throw Error(
|
|
440
|
+
if (this.queryObject.operations?.at(-1)?.aggregate && !r) throw Error(C.error.invalidQueryOrder);
|
|
446
441
|
return this.queryObject.operations?.push({
|
|
447
442
|
property: e,
|
|
448
443
|
operator: t,
|
|
@@ -451,7 +446,7 @@ var w = class extends u {
|
|
|
451
446
|
}), this;
|
|
452
447
|
}
|
|
453
448
|
whereDeepProp(e, t, n, r) {
|
|
454
|
-
if (this.queryObject.operations?.at(-1)?.aggregate && !r) throw Error(
|
|
449
|
+
if (this.queryObject.operations?.at(-1)?.aggregate && !r) throw Error(C.error.invalidQueryOrder);
|
|
455
450
|
let i = e.split("."), a = {}, o = i.length > 1 ? a : n;
|
|
456
451
|
return i.slice(1).forEach((e, t) => {
|
|
457
452
|
a[e] = t < i.length - 2 ? {} : n, a = a[e];
|
|
@@ -475,7 +470,7 @@ var w = class extends u {
|
|
|
475
470
|
return this.whereDeepProp(e, t, n, !0);
|
|
476
471
|
}
|
|
477
472
|
instanceOf(e) {
|
|
478
|
-
let t = e instanceof
|
|
473
|
+
let t = e instanceof c ? e.className : e;
|
|
479
474
|
return this.queryObject.operations?.push({
|
|
480
475
|
property: "__className",
|
|
481
476
|
operator: "==",
|
|
@@ -509,7 +504,7 @@ var w = class extends u {
|
|
|
509
504
|
getQueryModel() {
|
|
510
505
|
return this.model;
|
|
511
506
|
}
|
|
512
|
-
},
|
|
507
|
+
}, T = class e {
|
|
513
508
|
constructor() {}
|
|
514
509
|
static {
|
|
515
510
|
this.error = { shouldBeRegistered: "You should register a data source before using the data Store." };
|
|
@@ -522,11 +517,11 @@ var w = class extends u {
|
|
|
522
517
|
}
|
|
523
518
|
static getModel(t) {
|
|
524
519
|
if (!e._dataSource) throw Error(this.error.shouldBeRegistered);
|
|
525
|
-
return new
|
|
520
|
+
return new C(e._dataSource, t);
|
|
526
521
|
}
|
|
527
522
|
static getModelForSubCollection(t, n) {
|
|
528
523
|
if (!e._dataSource) throw Error(this.error.shouldBeRegistered);
|
|
529
|
-
return new
|
|
524
|
+
return new C(e._dataSource, t, n);
|
|
530
525
|
}
|
|
531
526
|
static async populate(e) {
|
|
532
527
|
if (!e) return;
|
|
@@ -541,17 +536,17 @@ var w = class extends u {
|
|
|
541
536
|
static isPopulated(e) {
|
|
542
537
|
return Array.isArray(e) ? e.reduce((e, t) => e && t.__documentReference === void 0, !0) : e.__documentReference === void 0;
|
|
543
538
|
}
|
|
544
|
-
},
|
|
539
|
+
}, E = class e {
|
|
545
540
|
constructor(e) {
|
|
546
541
|
this._resolveCollectionPaths = () => {
|
|
547
542
|
throw Error("The method collectionsMatchingTemplate has not been implemented in the concrete data source");
|
|
548
543
|
}, this._disabledChangeListeners = /* @__PURE__ */ new Set(), this._collectionsToWatch = {}, e && (this._beforeUpdateDocument = e.beforeUpdateDocument, this._afterUpdateDocument = e.afterUpdateDocument, this._afterDocumentChange = e.afterDocumentChange, this._beforeDocumentChange = e.beforeDocumentChange, this._beforeQueryOwnerCollection = e.beforeQueryOwnerCollection), this.installUpdaters();
|
|
549
544
|
}
|
|
550
545
|
installUpdaters() {
|
|
551
|
-
let e =
|
|
546
|
+
let e = c.getSystemRegisteredReferencesWithCachedProps();
|
|
552
547
|
this._collectionsToWatch = {}, Object.entries(e).forEach(([e, t]) => {
|
|
553
548
|
t.forEach((t) => {
|
|
554
|
-
t.typeName && (Array.isArray(t.typeName) ? t.typeName : [t?.typeName ?? e]).map((e) =>
|
|
549
|
+
t.typeName && (Array.isArray(t.typeName) ? t.typeName : [t?.typeName ?? e]).map((e) => c.collectionPath(c.createInstance(e), t)).forEach((e) => {
|
|
555
550
|
this._collectionsToWatch[e] || (this._collectionsToWatch[e] = []), this._collectionsToWatch[e].find((e) => e.name === t.name && e.ownerClassName() === t.ownerClassName()) || this._collectionsToWatch[e].push(t);
|
|
556
551
|
});
|
|
557
552
|
});
|
|
@@ -583,13 +578,13 @@ var w = class extends u {
|
|
|
583
578
|
return n ? this.onDocumentChange(t, n) : Promise.resolve();
|
|
584
579
|
}
|
|
585
580
|
async onDocumentChange(t, n) {
|
|
586
|
-
let r =
|
|
581
|
+
let r = D.toPersistentDocumentChange(t);
|
|
587
582
|
this._beforeDocumentChange?.(r, n);
|
|
588
583
|
let i = {};
|
|
589
584
|
t.type !== "update" || !r.before || r.after?.id && this._disabledChangeListeners.has(r.after?.id) || (await Promise.all(n.map(async (t) => {
|
|
590
|
-
let n = e.ownerCollectionPath(
|
|
585
|
+
let n = e.ownerCollectionPath(c.createInstance(t.ownerClassName()), t, r.params), a = await this._resolveCollectionPaths(n);
|
|
591
586
|
await Promise.all(a.map(async (e) => {
|
|
592
|
-
let n =
|
|
587
|
+
let n = T.getModel(e), a = n.find(), o = !1;
|
|
593
588
|
t.cachedProps?.forEach((e) => {
|
|
594
589
|
r.before[e] !== r.after[e] && (o = !0);
|
|
595
590
|
}), o && (a = t.searchableArray ? a.where(t.name, "contains", r.before) : a.where(t.name, "==", r.before)), a = this._beforeQueryOwnerCollection?.(a) ?? a;
|
|
@@ -623,20 +618,20 @@ var w = class extends u {
|
|
|
623
618
|
let r;
|
|
624
619
|
return r = typeof t.ownerCollection == "function" ? t.ownerCollection(e, t, n) : t.ownerCollection ?? e.className, r;
|
|
625
620
|
}
|
|
626
|
-
},
|
|
621
|
+
}, D = class e {
|
|
627
622
|
constructor() {
|
|
628
623
|
this._cachedPropsUpdater = void 0;
|
|
629
624
|
}
|
|
630
625
|
installCachedPropsUpdater(e) {
|
|
631
|
-
return this._cachedPropsUpdater = new
|
|
626
|
+
return this._cachedPropsUpdater = new E(e), this._cachedPropsUpdater.resolveCollectionPaths = this.resolveCollectionPaths.bind(this), this._cachedPropsUpdater;
|
|
632
627
|
}
|
|
633
628
|
get cachedPropsUpdater() {
|
|
634
629
|
return this._cachedPropsUpdater;
|
|
635
630
|
}
|
|
636
631
|
static toPropertyPathOperations(t) {
|
|
637
632
|
return t ? t.map((t) => {
|
|
638
|
-
if (e.isArrayOperator(t.operator) && t.value[0] instanceof
|
|
639
|
-
property:
|
|
633
|
+
if (e.isArrayOperator(t.operator) && t.value[0] instanceof c) return {
|
|
634
|
+
property: c.searchableArrayNameFor(t.property),
|
|
640
635
|
operator: t.operator,
|
|
641
636
|
value: t.value.map((e) => e.id),
|
|
642
637
|
aggregate: t.aggregate
|
|
@@ -656,8 +651,8 @@ var w = class extends u {
|
|
|
656
651
|
static toPersistentDocumentChange(e) {
|
|
657
652
|
return {
|
|
658
653
|
...e,
|
|
659
|
-
before: e.before &&
|
|
660
|
-
after: e.after &&
|
|
654
|
+
before: e.before && c.createInstance(e.before),
|
|
655
|
+
after: e.after && c.createInstance(e.after)
|
|
661
656
|
};
|
|
662
657
|
}
|
|
663
658
|
static toPropertyPathValue(e) {
|
|
@@ -694,7 +689,7 @@ var w = class extends u {
|
|
|
694
689
|
}
|
|
695
690
|
return i;
|
|
696
691
|
}
|
|
697
|
-
},
|
|
692
|
+
}, O = class extends D {
|
|
698
693
|
constructor(e) {
|
|
699
694
|
super(), this._jsonRawData = {}, this._lastMatchingDocs = [], this._lastLimit = 0, this._cursor = 0, this._simulateDelay = 0, this._pendingPromises = [], this._documentListeners = {}, this._collectionListeners = {}, e && (this._jsonRawData = e);
|
|
700
695
|
}
|
|
@@ -763,7 +758,7 @@ var w = class extends u {
|
|
|
763
758
|
let i = this._documentListeners[n];
|
|
764
759
|
i ||= (this._documentListeners[n] = {}, this._documentListeners[n]);
|
|
765
760
|
let a = (r) => {
|
|
766
|
-
r.params =
|
|
761
|
+
r.params = D.extractTemplateParams(n, e), t(r);
|
|
767
762
|
}, o = Math.random().toString(36).substring(2, 9);
|
|
768
763
|
i[o] = a, r.push(() => delete i[o]);
|
|
769
764
|
}), () => r.forEach((e) => e());
|
|
@@ -848,9 +843,9 @@ var w = class extends u {
|
|
|
848
843
|
return Promise.resolve(this.collectionsMatchingTemplate(e));
|
|
849
844
|
}
|
|
850
845
|
collectionsMatchingTemplate(e) {
|
|
851
|
-
return Object.keys(this._jsonRawData).filter((t) =>
|
|
846
|
+
return Object.keys(this._jsonRawData).filter((t) => D.isStringMatchingTemplate(e, t));
|
|
852
847
|
}
|
|
853
|
-
},
|
|
848
|
+
}, k = class e {
|
|
854
849
|
static registerCloudStorage(t, n) {
|
|
855
850
|
e._cloudStorageFactoryMap[t] = n;
|
|
856
851
|
}
|
|
@@ -873,14 +868,14 @@ var w = class extends u {
|
|
|
873
868
|
this._cloudStorageFactoryMap = {};
|
|
874
869
|
}
|
|
875
870
|
};
|
|
876
|
-
function
|
|
877
|
-
return
|
|
871
|
+
function A(e, t) {
|
|
872
|
+
return k.registerCloudStorage(e, t), (t) => {
|
|
878
873
|
t.prototype.__className = e;
|
|
879
874
|
};
|
|
880
875
|
}
|
|
881
876
|
//#endregion
|
|
882
877
|
//#region src/cloud-storage/mock-cloud-storage.ts
|
|
883
|
-
var
|
|
878
|
+
var j = class extends k {
|
|
884
879
|
constructor(e = "") {
|
|
885
880
|
super(), this._simulateDelay = 0, this._pendingPromises = [], this.mockFileSystem = {}, this._pathToMockFiles = e;
|
|
886
881
|
}
|
|
@@ -915,19 +910,19 @@ var N = class extends j {
|
|
|
915
910
|
return delete this.mockFileSystem[e], this.resolveWithDelay();
|
|
916
911
|
}
|
|
917
912
|
};
|
|
918
|
-
|
|
913
|
+
j = s([A("MockCloudStorage", () => new j())], j);
|
|
919
914
|
//#endregion
|
|
920
915
|
//#region src/cloud-storage/stored-file.ts
|
|
921
|
-
var
|
|
916
|
+
var M = /* @__PURE__ */ function(e) {
|
|
922
917
|
return e[e.stored = 0] = "stored", e[e.pendingDataSet = 1] = "pendingDataSet", e[e.deleted = 2] = "deleted", e;
|
|
923
|
-
}({}),
|
|
918
|
+
}({}), N = class extends c {
|
|
924
919
|
constructor(...t) {
|
|
925
920
|
super(...t), this._onChange = new e();
|
|
926
921
|
}
|
|
927
922
|
async save({ data: e, fileName: t, progress: n, cloudStorageProvider: r } = {}) {
|
|
928
923
|
let i = e || this._pendingData;
|
|
929
|
-
i && (this._reference && await this.delete(), this.provider = r ||
|
|
930
|
-
event:
|
|
924
|
+
i && (this._reference && await this.delete(), this.provider = r || k.defaultCloudStorage, this._originalFileName = t || (i instanceof File ? i.name : void 0), this._reference = await this.provider.save(this.id, i, n), this._url = await this.provider.getUrl(this._reference), this._pendingData = void 0, this._onChange.notify({
|
|
925
|
+
event: 0,
|
|
931
926
|
storedFile: this
|
|
932
927
|
}));
|
|
933
928
|
}
|
|
@@ -937,7 +932,7 @@ var P = /* @__PURE__ */ function(e) {
|
|
|
937
932
|
async delete() {
|
|
938
933
|
if (!this._reference) throw Error("Cannot delete a not stored file");
|
|
939
934
|
await this.provider.delete(this._reference), this._reference = void 0, this._url = void 0, this._onChange.notify({
|
|
940
|
-
event:
|
|
935
|
+
event: 2,
|
|
941
936
|
storedFile: this
|
|
942
937
|
});
|
|
943
938
|
}
|
|
@@ -946,9 +941,9 @@ var P = /* @__PURE__ */ function(e) {
|
|
|
946
941
|
}
|
|
947
942
|
get provider() {
|
|
948
943
|
if (!this._provider) try {
|
|
949
|
-
this._provider =
|
|
944
|
+
this._provider = k.createInstance(this._cloudStorageProviderName);
|
|
950
945
|
} catch {
|
|
951
|
-
this._provider =
|
|
946
|
+
this._provider = k.defaultCloudStorage;
|
|
952
947
|
}
|
|
953
948
|
return this._provider;
|
|
954
949
|
}
|
|
@@ -960,7 +955,7 @@ var P = /* @__PURE__ */ function(e) {
|
|
|
960
955
|
}
|
|
961
956
|
setDataToStore(e) {
|
|
962
957
|
return this._pendingData = e, this._originalFileName = e instanceof File ? e.name : void 0, this._mimeType = e instanceof Blob ? e.type : void 0, this._onChange.notify({
|
|
963
|
-
event:
|
|
958
|
+
event: 1,
|
|
964
959
|
pendingData: e,
|
|
965
960
|
storedFile: this
|
|
966
961
|
}), this;
|
|
@@ -972,10 +967,10 @@ var P = /* @__PURE__ */ function(e) {
|
|
|
972
967
|
return this._onChange.subscribe(e);
|
|
973
968
|
}
|
|
974
969
|
};
|
|
975
|
-
|
|
970
|
+
s([l], N.prototype, "_reference", void 0), s([l], N.prototype, "_url", void 0), s([l], N.prototype, "_cloudStorageProviderName", void 0), s([l], N.prototype, "_originalFileName", void 0), s([l], N.prototype, "_mimeType", void 0), N = s([g("StoredFile")], N);
|
|
976
971
|
//#endregion
|
|
977
972
|
//#region src/auth/auth.ts
|
|
978
|
-
var
|
|
973
|
+
var P = class {}, F = class t extends P {
|
|
979
974
|
static {
|
|
980
975
|
this.error = { shouldBeRegistered: "You should register an auth service before using Auth." };
|
|
981
976
|
}
|
|
@@ -1025,7 +1020,7 @@ var I = class {}, L = class t extends I {
|
|
|
1025
1020
|
static {
|
|
1026
1021
|
this._instance = void 0;
|
|
1027
1022
|
}
|
|
1028
|
-
},
|
|
1023
|
+
}, I = class extends P {
|
|
1029
1024
|
constructor(...e) {
|
|
1030
1025
|
super(...e), this.pendingPromises = [], this._fakeRegisteredUsers = {};
|
|
1031
1026
|
}
|
|
@@ -1100,7 +1095,7 @@ var I = class {}, L = class t extends I {
|
|
|
1100
1095
|
creationDate: 0
|
|
1101
1096
|
};
|
|
1102
1097
|
}
|
|
1103
|
-
},
|
|
1098
|
+
}, L = class e {
|
|
1104
1099
|
constructor() {}
|
|
1105
1100
|
static {
|
|
1106
1101
|
this.error = { shouldBeRegistered: "You should register a cloud functions service with useCloudFunctionsService static method before using CloudFunctions." };
|
|
@@ -1123,12 +1118,12 @@ var I = class {}, L = class t extends I {
|
|
|
1123
1118
|
};
|
|
1124
1119
|
}
|
|
1125
1120
|
processParam(e) {
|
|
1126
|
-
if (e != null) return e instanceof
|
|
1121
|
+
if (e != null) return e instanceof c ? e.toObject() : Array.isArray(e) ? e.map((e) => this.processParam(e)) : typeof e == "object" ? Object.entries(e).reduce((e, [t, n]) => (e[t] = this.processParam(n), e), {}) : e;
|
|
1127
1122
|
}
|
|
1128
1123
|
processResult(e) {
|
|
1129
|
-
if (e != null) return e.__className ?
|
|
1124
|
+
if (e != null) return e.__className ? c.createInstance(e) : Array.isArray(e) ? e.map((e) => this.processResult(e)) : typeof e == "object" ? Object.entries(e).reduce((e, [t, n]) => (e[t] = this.processResult(n), e), {}) : e;
|
|
1130
1125
|
}
|
|
1131
|
-
},
|
|
1126
|
+
}, R = class {
|
|
1132
1127
|
constructor(e) {
|
|
1133
1128
|
this._registeredFunctions = e;
|
|
1134
1129
|
}
|
|
@@ -1140,7 +1135,7 @@ var I = class {}, L = class t extends I {
|
|
|
1140
1135
|
callFunction(e, t) {
|
|
1141
1136
|
return e(t);
|
|
1142
1137
|
}
|
|
1143
|
-
},
|
|
1138
|
+
}, z = class {}, B = class e extends z {
|
|
1144
1139
|
static {
|
|
1145
1140
|
this.error = { shouldBeRegistered: "You should register a Server Auth service before using the Server Auth." };
|
|
1146
1141
|
}
|
|
@@ -1169,7 +1164,7 @@ var I = class {}, L = class t extends I {
|
|
|
1169
1164
|
static {
|
|
1170
1165
|
this._instance = void 0;
|
|
1171
1166
|
}
|
|
1172
|
-
},
|
|
1167
|
+
}, V = class extends z {
|
|
1173
1168
|
constructor(e) {
|
|
1174
1169
|
super(), this._userCredentials = e;
|
|
1175
1170
|
}
|
|
@@ -1197,23 +1192,23 @@ var I = class {}, L = class t extends I {
|
|
|
1197
1192
|
};
|
|
1198
1193
|
//#endregion
|
|
1199
1194
|
//#region src/utils/utils.ts
|
|
1200
|
-
function
|
|
1195
|
+
function H(e, t) {
|
|
1201
1196
|
return e ? e.replace(/\${\s*(\w*)\s*}/g, function(e, n) {
|
|
1202
1197
|
return t[n] || "";
|
|
1203
1198
|
}) : "";
|
|
1204
1199
|
}
|
|
1205
|
-
function
|
|
1200
|
+
function U(e) {
|
|
1206
1201
|
return e ? e.replace(/([-_ ][\w])/g, (e) => e.toUpperCase().replace("-", "").replace("_", "").replace(" ", "")) : "";
|
|
1207
1202
|
}
|
|
1208
|
-
function
|
|
1203
|
+
function W(e, t = "-") {
|
|
1209
1204
|
if (!e) return "";
|
|
1210
1205
|
let n = e.slice(1).replace(/( |[A-Z])/g, (e) => e === " " ? "-" : t + e[0].toLowerCase());
|
|
1211
1206
|
return e[0].toLocaleLowerCase() + n.replace(/--/g, "-");
|
|
1212
1207
|
}
|
|
1213
|
-
function
|
|
1208
|
+
function G(e, t) {
|
|
1214
1209
|
return t.split(".").reduce((e, t) => e[t], e);
|
|
1215
1210
|
}
|
|
1216
1211
|
//#endregion
|
|
1217
|
-
export {
|
|
1212
|
+
export { F as Auth, I as AuthMock, P as AuthService, L as CloudFunctions, R as CloudFunctionsMock, k as CloudStorage, D as DataSource, S as EntropicComponent, O as JsonDataSource, j as MockCloudStorage, C as Model, e as Observable, c as Persistent, w as Query, B as ServerAuth, V as ServerAuthMock, z as ServerAuthService, T as Store, N as StoredFile, M as StoredFileEvent, U as camelCase, G as getDeepValue, l as persistent, h as persistentParser, p as persistentPureReference, m as persistentPureReferenceWithCachedProps, d as persistentReference, u as persistentReferenceAt, f as persistentReferenceWithCachedProps, A as registerCloudStorage, _ as registerLegacyClassName, g as registerPersistentClass, H as replaceValue, y as required, b as requiredWithValidator, v as searchableArray, W as snakeCase, x as typeName };
|
|
1218
1213
|
|
|
1219
1214
|
//# sourceMappingURL=entropic-bond.js.map
|