@instantdb/react 0.22.92-experimental.drewh-explorer-docs.20352512274.1 → 0.22.92
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/dist/standalone/index.js +827 -827
- package/dist/standalone/index.umd.cjs +1 -1
- package/package.json +4 -4
package/dist/standalone/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import oi, { useRef as ot, useCallback as we, useSyncExternalStore as en, useEffect as ke, useMemo as tn, useState as
|
|
1
|
+
import oi, { useRef as ot, useCallback as we, useSyncExternalStore as en, useEffect as ke, useMemo as tn, useState as ui, createElement as Os } from "react";
|
|
2
2
|
function B(t) {
|
|
3
3
|
if (typeof t == "number")
|
|
4
4
|
return (Math.abs(t * 2654435761) >>> 0).toString(16);
|
|
@@ -41,7 +41,7 @@ const L = {
|
|
|
41
41
|
Remove: "remove",
|
|
42
42
|
Replace: "replace",
|
|
43
43
|
Add: "add"
|
|
44
|
-
},
|
|
44
|
+
}, ai = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), Es = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), vt = Symbol.iterator, ne = {
|
|
45
45
|
mutable: "mutable",
|
|
46
46
|
immutable: "immutable"
|
|
47
47
|
}, In = {};
|
|
@@ -73,14 +73,14 @@ function je(t) {
|
|
|
73
73
|
return !!j(t);
|
|
74
74
|
}
|
|
75
75
|
function j(t) {
|
|
76
|
-
return typeof t != "object" ? null : t == null ? void 0 : t[
|
|
76
|
+
return typeof t != "object" ? null : t == null ? void 0 : t[ai];
|
|
77
77
|
}
|
|
78
78
|
function Rn(t) {
|
|
79
79
|
var e;
|
|
80
80
|
const n = j(t);
|
|
81
81
|
return n ? (e = n.copy) !== null && e !== void 0 ? e : n.original : t;
|
|
82
82
|
}
|
|
83
|
-
function
|
|
83
|
+
function ue(t, e) {
|
|
84
84
|
if (!t || typeof t != "object")
|
|
85
85
|
return !1;
|
|
86
86
|
let n;
|
|
@@ -112,7 +112,7 @@ function Ce(t) {
|
|
|
112
112
|
function _e(t, e) {
|
|
113
113
|
return Ce(t) === 2 ? t.get(e) : t[e];
|
|
114
114
|
}
|
|
115
|
-
function
|
|
115
|
+
function at(t, e, n) {
|
|
116
116
|
Ce(t) === 2 ? t.set(e, n) : t[e] = n;
|
|
117
117
|
}
|
|
118
118
|
function Qt(t, e) {
|
|
@@ -197,7 +197,7 @@ function Q(t) {
|
|
|
197
197
|
t.copy || (t.copy = di(t.original, t.options));
|
|
198
198
|
}
|
|
199
199
|
function Ye(t) {
|
|
200
|
-
if (!
|
|
200
|
+
if (!ue(t))
|
|
201
201
|
return Rn(t);
|
|
202
202
|
if (Array.isArray(t))
|
|
203
203
|
return t.map(Ye);
|
|
@@ -240,13 +240,13 @@ function Re(t, e, n, r, i) {
|
|
|
240
240
|
n = n ?? /* @__PURE__ */ new WeakMap(), r = r ?? [], i = i ?? [];
|
|
241
241
|
const o = n.has(t) ? n.get(t) : t;
|
|
242
242
|
if (r.length > 0) {
|
|
243
|
-
const
|
|
244
|
-
if (o && typeof o == "object" &&
|
|
245
|
-
throw r[0] === o ? new Error("Forbids circular reference") : new Error(`Forbids circular reference: ~/${i.slice(0,
|
|
246
|
-
if (typeof
|
|
247
|
-
return `[${
|
|
243
|
+
const u = r.indexOf(o);
|
|
244
|
+
if (o && typeof o == "object" && u !== -1)
|
|
245
|
+
throw r[0] === o ? new Error("Forbids circular reference") : new Error(`Forbids circular reference: ~/${i.slice(0, u).map((a, d) => {
|
|
246
|
+
if (typeof a == "symbol")
|
|
247
|
+
return `[${a.toString()}]`;
|
|
248
248
|
const c = r[d];
|
|
249
|
-
return typeof
|
|
249
|
+
return typeof a == "object" && (c instanceof Map || c instanceof Set) ? Array.from(c.keys()).indexOf(a) : a;
|
|
250
250
|
}).join("/")}`);
|
|
251
251
|
r.push(o), i.push(e);
|
|
252
252
|
} else
|
|
@@ -258,25 +258,25 @@ function Re(t, e, n, r, i) {
|
|
|
258
258
|
}
|
|
259
259
|
switch (Ce(t)) {
|
|
260
260
|
case 2:
|
|
261
|
-
for (const [
|
|
262
|
-
Re(
|
|
261
|
+
for (const [u, a] of t)
|
|
262
|
+
Re(u, u, n, r, i), Re(a, u, n, r, i);
|
|
263
263
|
t.set = t.clear = t.delete = br;
|
|
264
264
|
break;
|
|
265
265
|
case 3:
|
|
266
|
-
for (const
|
|
267
|
-
Re(
|
|
266
|
+
for (const u of t)
|
|
267
|
+
Re(u, u, n, r, i);
|
|
268
268
|
t.add = t.clear = t.delete = br;
|
|
269
269
|
break;
|
|
270
270
|
case 1:
|
|
271
271
|
Object.freeze(t);
|
|
272
272
|
let o = 0;
|
|
273
|
-
for (const
|
|
274
|
-
Re(
|
|
273
|
+
for (const u of t)
|
|
274
|
+
Re(u, o, n, r, i), o += 1;
|
|
275
275
|
break;
|
|
276
276
|
default:
|
|
277
|
-
Object.freeze(t), Object.keys(t).forEach((
|
|
278
|
-
const
|
|
279
|
-
Re(
|
|
277
|
+
Object.freeze(t), Object.keys(t).forEach((u) => {
|
|
278
|
+
const a = t[u];
|
|
279
|
+
Re(a, u, n, r, i);
|
|
280
280
|
});
|
|
281
281
|
}
|
|
282
282
|
r.pop(), i.pop();
|
|
@@ -295,22 +295,22 @@ function xn(t, e) {
|
|
|
295
295
|
t.forEach((r, i) => e(i, r, t));
|
|
296
296
|
}
|
|
297
297
|
function fi(t, e, n) {
|
|
298
|
-
if (je(t) || !
|
|
298
|
+
if (je(t) || !ue(t, n) || e.has(t) || Object.isFrozen(t))
|
|
299
299
|
return;
|
|
300
300
|
const r = t instanceof Set, i = r ? /* @__PURE__ */ new Map() : void 0;
|
|
301
301
|
if (e.add(t), xn(t, (s, o) => {
|
|
302
|
-
var
|
|
302
|
+
var u;
|
|
303
303
|
if (je(o)) {
|
|
304
|
-
const
|
|
305
|
-
Q(
|
|
306
|
-
const d = !((
|
|
307
|
-
|
|
304
|
+
const a = j(o);
|
|
305
|
+
Q(a);
|
|
306
|
+
const d = !((u = a.assignedMap) === null || u === void 0) && u.size || a.operated ? a.copy : a.original;
|
|
307
|
+
at(r ? i : t, s, d);
|
|
308
308
|
} else
|
|
309
309
|
fi(o, e, n);
|
|
310
310
|
}), i) {
|
|
311
311
|
const s = t, o = Array.from(s);
|
|
312
|
-
s.clear(), o.forEach((
|
|
313
|
-
s.add(i.has(
|
|
312
|
+
s.clear(), o.forEach((u) => {
|
|
313
|
+
s.add(i.has(u) ? i.get(u) : u);
|
|
314
314
|
});
|
|
315
315
|
}
|
|
316
316
|
}
|
|
@@ -335,28 +335,28 @@ function sn(t, e, n, r) {
|
|
|
335
335
|
function $n(t, e, n, r) {
|
|
336
336
|
const i = j(n);
|
|
337
337
|
i && (i.callbacks || (i.callbacks = []), i.callbacks.push((s, o) => {
|
|
338
|
-
var
|
|
339
|
-
const
|
|
340
|
-
if (be(_e(
|
|
338
|
+
var u;
|
|
339
|
+
const a = t.type === 3 ? t.setMap : t.copy;
|
|
340
|
+
if (be(_e(a, e), n)) {
|
|
341
341
|
let d = i.original;
|
|
342
|
-
i.copy && (d = i.copy), rn(t), sn(t, r, s, o), t.options.enableAutoFreeze && (t.options.updatedValues = (
|
|
342
|
+
i.copy && (d = i.copy), rn(t), sn(t, r, s, o), t.options.enableAutoFreeze && (t.options.updatedValues = (u = t.options.updatedValues) !== null && u !== void 0 ? u : /* @__PURE__ */ new WeakMap(), t.options.updatedValues.set(d, i.original)), at(a, e, d);
|
|
343
343
|
}
|
|
344
|
-
}), t.options.enableAutoFreeze && i.finalities !== t.finalities && (t.options.enableAutoFreeze = !1)),
|
|
344
|
+
}), t.options.enableAutoFreeze && i.finalities !== t.finalities && (t.options.enableAutoFreeze = !1)), ue(n, t.options) && t.finalities.draft.push(() => {
|
|
345
345
|
const s = t.type === 3 ? t.setMap : t.copy;
|
|
346
346
|
be(_e(s, e), n) && Cs(t, e);
|
|
347
347
|
});
|
|
348
348
|
}
|
|
349
349
|
function Is(t, e, n, r, i) {
|
|
350
|
-
let { original: s, assignedMap: o, options:
|
|
351
|
-
|
|
350
|
+
let { original: s, assignedMap: o, options: u } = t, a = t.copy;
|
|
351
|
+
a.length < s.length && ([s, a] = [a, s], [n, r] = [r, n]);
|
|
352
352
|
for (let d = 0; d < s.length; d += 1)
|
|
353
|
-
if (o.get(d.toString()) &&
|
|
353
|
+
if (o.get(d.toString()) && a[d] !== s[d]) {
|
|
354
354
|
const c = e.concat([d]), f = Ee(c, i);
|
|
355
355
|
n.push({
|
|
356
356
|
op: L.Replace,
|
|
357
357
|
path: f,
|
|
358
358
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
359
|
-
value: St(
|
|
359
|
+
value: St(a[d])
|
|
360
360
|
}), r.push({
|
|
361
361
|
op: L.Replace,
|
|
362
362
|
path: f,
|
|
@@ -364,17 +364,17 @@ function Is(t, e, n, r, i) {
|
|
|
364
364
|
value: St(s[d])
|
|
365
365
|
});
|
|
366
366
|
}
|
|
367
|
-
for (let d = s.length; d <
|
|
367
|
+
for (let d = s.length; d < a.length; d += 1) {
|
|
368
368
|
const c = e.concat([d]), f = Ee(c, i);
|
|
369
369
|
n.push({
|
|
370
370
|
op: L.Add,
|
|
371
371
|
path: f,
|
|
372
372
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
373
|
-
value: St(
|
|
373
|
+
value: St(a[d])
|
|
374
374
|
});
|
|
375
375
|
}
|
|
376
|
-
if (s.length <
|
|
377
|
-
const { arrayLengthAssignment: d = !0 } =
|
|
376
|
+
if (s.length < a.length) {
|
|
377
|
+
const { arrayLengthAssignment: d = !0 } = u.enablePatches;
|
|
378
378
|
if (d) {
|
|
379
379
|
const c = e.concat(["length"]), f = Ee(c, i);
|
|
380
380
|
r.push({
|
|
@@ -383,7 +383,7 @@ function Is(t, e, n, r, i) {
|
|
|
383
383
|
value: s.length
|
|
384
384
|
});
|
|
385
385
|
} else
|
|
386
|
-
for (let c =
|
|
386
|
+
for (let c = a.length; s.length < c; c -= 1) {
|
|
387
387
|
const f = e.concat([c - 1]), l = Ee(f, i);
|
|
388
388
|
r.push({
|
|
389
389
|
op: L.Remove,
|
|
@@ -393,47 +393,47 @@ function Is(t, e, n, r, i) {
|
|
|
393
393
|
}
|
|
394
394
|
}
|
|
395
395
|
function Ps({ original: t, copy: e, assignedMap: n }, r, i, s, o) {
|
|
396
|
-
n.forEach((
|
|
397
|
-
const d = _e(t,
|
|
396
|
+
n.forEach((u, a) => {
|
|
397
|
+
const d = _e(t, a), c = St(_e(e, a)), f = u ? tt(t, a) ? L.Replace : L.Add : L.Remove;
|
|
398
398
|
if (be(d, c) && f === L.Replace)
|
|
399
399
|
return;
|
|
400
|
-
const l = r.concat(
|
|
400
|
+
const l = r.concat(a), p = Ee(l, o);
|
|
401
401
|
i.push(f === L.Remove ? { op: f, path: p } : { op: f, path: p, value: c }), s.push(f === L.Add ? { op: L.Remove, path: p } : f === L.Remove ? { op: L.Add, path: p, value: d } : { op: L.Replace, path: p, value: d });
|
|
402
402
|
});
|
|
403
403
|
}
|
|
404
404
|
function Ms({ original: t, copy: e }, n, r, i, s) {
|
|
405
405
|
let o = 0;
|
|
406
|
-
t.forEach((
|
|
407
|
-
if (!e.has(
|
|
408
|
-
const
|
|
406
|
+
t.forEach((u) => {
|
|
407
|
+
if (!e.has(u)) {
|
|
408
|
+
const a = n.concat([o]), d = Ee(a, s);
|
|
409
409
|
r.push({
|
|
410
410
|
op: L.Remove,
|
|
411
411
|
path: d,
|
|
412
|
-
value:
|
|
412
|
+
value: u
|
|
413
413
|
}), i.unshift({
|
|
414
414
|
op: L.Add,
|
|
415
415
|
path: d,
|
|
416
|
-
value:
|
|
416
|
+
value: u
|
|
417
417
|
});
|
|
418
418
|
}
|
|
419
419
|
o += 1;
|
|
420
|
-
}), o = 0, e.forEach((
|
|
421
|
-
if (!t.has(
|
|
422
|
-
const
|
|
420
|
+
}), o = 0, e.forEach((u) => {
|
|
421
|
+
if (!t.has(u)) {
|
|
422
|
+
const a = n.concat([o]), d = Ee(a, s);
|
|
423
423
|
r.push({
|
|
424
424
|
op: L.Add,
|
|
425
425
|
path: d,
|
|
426
|
-
value:
|
|
426
|
+
value: u
|
|
427
427
|
}), i.unshift({
|
|
428
428
|
op: L.Remove,
|
|
429
429
|
path: d,
|
|
430
|
-
value:
|
|
430
|
+
value: u
|
|
431
431
|
});
|
|
432
432
|
}
|
|
433
433
|
o += 1;
|
|
434
434
|
});
|
|
435
435
|
}
|
|
436
|
-
function
|
|
436
|
+
function ut(t, e, n, r) {
|
|
437
437
|
const { pathAsArray: i = !0 } = t.options.enablePatches;
|
|
438
438
|
switch (t.type) {
|
|
439
439
|
case 0:
|
|
@@ -446,7 +446,7 @@ function at(t, e, n, r) {
|
|
|
446
446
|
}
|
|
447
447
|
}
|
|
448
448
|
const jt = (t, e, n = !1) => {
|
|
449
|
-
if (typeof t == "object" && t !== null && (!
|
|
449
|
+
if (typeof t == "object" && t !== null && (!ue(t, e) || n))
|
|
450
450
|
throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.");
|
|
451
451
|
}, on = {
|
|
452
452
|
get size() {
|
|
@@ -457,7 +457,7 @@ const jt = (t, e, n = !1) => {
|
|
|
457
457
|
},
|
|
458
458
|
set(t, e) {
|
|
459
459
|
const n = j(this), r = te(n);
|
|
460
|
-
return (!r.has(t) || !be(r.get(t), e)) && (Q(n), fe(n), n.assignedMap.set(t, !0), n.copy.set(t, e), $n(n, t, e,
|
|
460
|
+
return (!r.has(t) || !be(r.get(t), e)) && (Q(n), fe(n), n.assignedMap.set(t, !0), n.copy.set(t, e), $n(n, t, e, ut)), this;
|
|
461
461
|
},
|
|
462
462
|
delete(t) {
|
|
463
463
|
if (!this.has(t))
|
|
@@ -483,7 +483,7 @@ const jt = (t, e, n = !1) => {
|
|
|
483
483
|
get(t) {
|
|
484
484
|
var e, n;
|
|
485
485
|
const r = j(this), i = te(r).get(t), s = ((n = (e = r.options).mark) === null || n === void 0 ? void 0 : n.call(e, i, ne)) === ne.mutable;
|
|
486
|
-
if (r.options.strict && jt(i, r.options, s), s || r.finalized || !
|
|
486
|
+
if (r.options.strict && jt(i, r.options, s), s || r.finalized || !ue(i, r.options) || i !== r.original.get(t))
|
|
487
487
|
return i;
|
|
488
488
|
const o = In.createDraft({
|
|
489
489
|
original: i,
|
|
@@ -535,9 +535,9 @@ const jt = (t, e, n = !1) => {
|
|
|
535
535
|
if (s.done)
|
|
536
536
|
return s;
|
|
537
537
|
const o = s.value;
|
|
538
|
-
let
|
|
539
|
-
const
|
|
540
|
-
if (t.options.strict && jt(o, t.options, d), !d && !
|
|
538
|
+
let u = t.setMap.get(o);
|
|
539
|
+
const a = j(u), d = ((i = (r = t.options).mark) === null || i === void 0 ? void 0 : i.call(r, u, ne)) === ne.mutable;
|
|
540
|
+
if (t.options.strict && jt(o, t.options, d), !d && !a && ue(o, t.options) && !t.finalized && t.original.has(o)) {
|
|
541
541
|
const c = In.createDraft({
|
|
542
542
|
original: o,
|
|
543
543
|
parentDraft: t,
|
|
@@ -545,11 +545,11 @@ const jt = (t, e, n = !1) => {
|
|
|
545
545
|
finalities: t.finalities,
|
|
546
546
|
options: t.options
|
|
547
547
|
});
|
|
548
|
-
t.setMap.set(o, c),
|
|
549
|
-
} else
|
|
548
|
+
t.setMap.set(o, c), u = c;
|
|
549
|
+
} else a && (u = a.proxy);
|
|
550
550
|
return {
|
|
551
551
|
done: !1,
|
|
552
|
-
value: n ?
|
|
552
|
+
value: n ? u : [u, u]
|
|
553
553
|
};
|
|
554
554
|
}, Ct = {
|
|
555
555
|
get size() {
|
|
@@ -565,7 +565,7 @@ const jt = (t, e, n = !1) => {
|
|
|
565
565
|
},
|
|
566
566
|
add(t) {
|
|
567
567
|
const e = j(this);
|
|
568
|
-
return this.has(t) || (Q(e), fe(e), e.assignedMap.set(t, !0), e.setMap.set(t, t), $n(e, t, t,
|
|
568
|
+
return this.has(t) || (Q(e), fe(e), e.assignedMap.set(t, !0), e.setMap.set(t, t), $n(e, t, t, ut)), this;
|
|
569
569
|
},
|
|
570
570
|
delete(t) {
|
|
571
571
|
if (!this.has(t))
|
|
@@ -646,7 +646,7 @@ const xs = Reflect.ownKeys(Ct), li = /* @__PURE__ */ new WeakSet(), hi = {
|
|
|
646
646
|
const s = (r = t.copy) === null || r === void 0 ? void 0 : r[e];
|
|
647
647
|
if (s && li.has(s))
|
|
648
648
|
return s;
|
|
649
|
-
if (e ===
|
|
649
|
+
if (e === ai)
|
|
650
650
|
return t;
|
|
651
651
|
let o;
|
|
652
652
|
if (t.options.mark) {
|
|
@@ -654,32 +654,32 @@ const xs = Reflect.ownKeys(Ct), li = /* @__PURE__ */ new WeakSet(), hi = {
|
|
|
654
654
|
if (o = t.options.mark(d, ne), o === ne.mutable)
|
|
655
655
|
return t.options.strict && jt(d, t.options, !0), d;
|
|
656
656
|
}
|
|
657
|
-
const
|
|
658
|
-
if (
|
|
657
|
+
const u = te(t);
|
|
658
|
+
if (u instanceof Map && Rs.includes(e)) {
|
|
659
659
|
if (e === "size")
|
|
660
660
|
return Object.getOwnPropertyDescriptor(on, "size").get.call(t.proxy);
|
|
661
661
|
const d = on[e];
|
|
662
662
|
if (d)
|
|
663
663
|
return d.bind(t.proxy);
|
|
664
664
|
}
|
|
665
|
-
if (
|
|
665
|
+
if (u instanceof Set && xs.includes(e)) {
|
|
666
666
|
if (e === "size")
|
|
667
667
|
return Object.getOwnPropertyDescriptor(Ct, "size").get.call(t.proxy);
|
|
668
668
|
const d = Ct[e];
|
|
669
669
|
if (d)
|
|
670
670
|
return d.bind(t.proxy);
|
|
671
671
|
}
|
|
672
|
-
if (!tt(
|
|
673
|
-
const d = yr(
|
|
672
|
+
if (!tt(u, e)) {
|
|
673
|
+
const d = yr(u, e);
|
|
674
674
|
return d ? "value" in d ? d.value : (
|
|
675
675
|
// !case: support for getter
|
|
676
676
|
(i = d.get) === null || i === void 0 ? void 0 : i.call(t.proxy)
|
|
677
677
|
) : void 0;
|
|
678
678
|
}
|
|
679
|
-
const
|
|
680
|
-
if (t.options.strict && jt(
|
|
681
|
-
return
|
|
682
|
-
if (
|
|
679
|
+
const a = u[e];
|
|
680
|
+
if (t.options.strict && jt(a, t.options), t.finalized || !ue(a, t.options))
|
|
681
|
+
return a;
|
|
682
|
+
if (a === Qt(t.original, e)) {
|
|
683
683
|
if (Q(t), t.copy[e] = Dn({
|
|
684
684
|
original: t.original[e],
|
|
685
685
|
parentDraft: t,
|
|
@@ -692,7 +692,7 @@ const xs = Reflect.ownKeys(Ct), li = /* @__PURE__ */ new WeakSet(), hi = {
|
|
|
692
692
|
}
|
|
693
693
|
return t.copy[e];
|
|
694
694
|
}
|
|
695
|
-
return
|
|
695
|
+
return a;
|
|
696
696
|
},
|
|
697
697
|
set(t, e, n) {
|
|
698
698
|
var r;
|
|
@@ -704,8 +704,8 @@ const xs = Reflect.ownKeys(Ct), li = /* @__PURE__ */ new WeakSet(), hi = {
|
|
|
704
704
|
const s = yr(te(t), e);
|
|
705
705
|
if (s != null && s.set)
|
|
706
706
|
return s.set.call(t.proxy, n), !0;
|
|
707
|
-
const o = Qt(te(t), e),
|
|
708
|
-
return
|
|
707
|
+
const o = Qt(te(t), e), u = j(o);
|
|
708
|
+
return u && be(u.original, n) ? (t.copy[e] = n, t.assignedMap = (r = t.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), t.assignedMap.set(e, !1), !0) : (be(n, o) && (n !== void 0 || tt(t.original, e)) || (Q(t), fe(t), tt(t.original, e) && be(n, t.original[e]) ? t.assignedMap.delete(e) : t.assignedMap.set(e, !0), t.copy[e] = n, $n(t, e, n, ut)), !0);
|
|
709
709
|
},
|
|
710
710
|
has(t, e) {
|
|
711
711
|
return e in te(t);
|
|
@@ -737,7 +737,7 @@ const xs = Reflect.ownKeys(Ct), li = /* @__PURE__ */ new WeakSet(), hi = {
|
|
|
737
737
|
}
|
|
738
738
|
};
|
|
739
739
|
function Dn(t) {
|
|
740
|
-
const { original: e, parentDraft: n, key: r, finalities: i, options: s } = t, o = Ce(e),
|
|
740
|
+
const { original: e, parentDraft: n, key: r, finalities: i, options: s } = t, o = Ce(e), u = {
|
|
741
741
|
type: o,
|
|
742
742
|
finalized: !1,
|
|
743
743
|
parent: n,
|
|
@@ -749,43 +749,43 @@ function Dn(t) {
|
|
|
749
749
|
// Mapping of draft Set items to their corresponding draft values.
|
|
750
750
|
setMap: o === 3 ? new Map(e.entries()) : void 0
|
|
751
751
|
};
|
|
752
|
-
(r || "key" in t) && (
|
|
753
|
-
const { proxy:
|
|
754
|
-
if (i.revoke.push(d), li.add(
|
|
752
|
+
(r || "key" in t) && (u.key = r);
|
|
753
|
+
const { proxy: a, revoke: d } = Proxy.revocable(o === 1 ? Object.assign([], u) : u, hi);
|
|
754
|
+
if (i.revoke.push(d), li.add(a), u.proxy = a, n) {
|
|
755
755
|
const c = n;
|
|
756
756
|
c.finalities.draft.push((f, l) => {
|
|
757
757
|
var p, y;
|
|
758
|
-
const b = j(
|
|
758
|
+
const b = j(a);
|
|
759
759
|
let _ = c.type === 3 ? c.setMap : c.copy;
|
|
760
760
|
const T = _e(_, r), g = j(T);
|
|
761
761
|
if (g) {
|
|
762
762
|
let m = g.original;
|
|
763
|
-
g.operated && (m = Rn(T)), rn(g), sn(g,
|
|
763
|
+
g.operated && (m = Rn(T)), rn(g), sn(g, ut, f, l), c.options.enableAutoFreeze && (c.options.updatedValues = (p = c.options.updatedValues) !== null && p !== void 0 ? p : /* @__PURE__ */ new WeakMap(), c.options.updatedValues.set(m, g.original)), at(_, r, m);
|
|
764
764
|
}
|
|
765
765
|
(y = b.callbacks) === null || y === void 0 || y.forEach((m) => {
|
|
766
766
|
m(f, l);
|
|
767
767
|
});
|
|
768
768
|
});
|
|
769
769
|
} else {
|
|
770
|
-
const c = j(
|
|
770
|
+
const c = j(a);
|
|
771
771
|
c.finalities.draft.push((f, l) => {
|
|
772
|
-
rn(c), sn(c,
|
|
772
|
+
rn(c), sn(c, ut, f, l);
|
|
773
773
|
});
|
|
774
774
|
}
|
|
775
|
-
return
|
|
775
|
+
return a;
|
|
776
776
|
}
|
|
777
777
|
In.createDraft = Dn;
|
|
778
778
|
function $s(t, e, n, r, i) {
|
|
779
779
|
var s;
|
|
780
|
-
const o = j(t),
|
|
780
|
+
const o = j(t), u = (s = o == null ? void 0 : o.original) !== null && s !== void 0 ? s : t, a = !!e.length;
|
|
781
781
|
if (o != null && o.operated)
|
|
782
782
|
for (; o.finalities.draft.length > 0; )
|
|
783
783
|
o.finalities.draft.pop()(n, r);
|
|
784
|
-
const d =
|
|
784
|
+
const d = a ? e[0] : o ? o.operated ? o.copy : o.original : t;
|
|
785
785
|
return o && nn(o), i && Re(d, d, o == null ? void 0 : o.options.updatedValues), [
|
|
786
786
|
d,
|
|
787
|
-
n &&
|
|
788
|
-
r &&
|
|
787
|
+
n && a ? [{ op: L.Replace, path: [], value: e[0] }] : n,
|
|
788
|
+
r && a ? [{ op: L.Replace, path: [], value: u }] : r
|
|
789
789
|
];
|
|
790
790
|
}
|
|
791
791
|
function Ds(t, e) {
|
|
@@ -797,39 +797,39 @@ function Ds(t, e) {
|
|
|
797
797
|
};
|
|
798
798
|
let i, s;
|
|
799
799
|
e.enablePatches && (i = [], s = []);
|
|
800
|
-
const
|
|
800
|
+
const u = ((n = e.mark) === null || n === void 0 ? void 0 : n.call(e, t, ne)) === ne.mutable || !ue(t, e) ? t : Dn({
|
|
801
801
|
original: t,
|
|
802
802
|
parentDraft: null,
|
|
803
803
|
finalities: r,
|
|
804
804
|
options: e
|
|
805
805
|
});
|
|
806
806
|
return [
|
|
807
|
-
|
|
808
|
-
(
|
|
809
|
-
const [d, c, f] = $s(
|
|
807
|
+
u,
|
|
808
|
+
(a = []) => {
|
|
809
|
+
const [d, c, f] = $s(u, a, i, s, e.enableAutoFreeze);
|
|
810
810
|
return e.enablePatches ? [d, c, f] : d;
|
|
811
811
|
}
|
|
812
812
|
];
|
|
813
813
|
}
|
|
814
|
-
function
|
|
814
|
+
function un(t) {
|
|
815
815
|
const { rootDraft: e, value: n, useRawReturn: r = !1, isRoot: i = !0 } = t;
|
|
816
|
-
xn(n, (s, o,
|
|
817
|
-
const
|
|
818
|
-
if (
|
|
816
|
+
xn(n, (s, o, u) => {
|
|
817
|
+
const a = j(o);
|
|
818
|
+
if (a && e && a.finalities === e.finalities) {
|
|
819
819
|
t.isContainDraft = !0;
|
|
820
|
-
const d =
|
|
821
|
-
if (
|
|
822
|
-
const c = Array.from(
|
|
823
|
-
|
|
820
|
+
const d = a.original;
|
|
821
|
+
if (u instanceof Set) {
|
|
822
|
+
const c = Array.from(u);
|
|
823
|
+
u.clear(), c.forEach((f) => u.add(s === f ? d : f));
|
|
824
824
|
} else
|
|
825
|
-
|
|
826
|
-
} else typeof o == "object" && o !== null && (t.value = o, t.isRoot = !1,
|
|
825
|
+
at(u, s, d);
|
|
826
|
+
} else typeof o == "object" && o !== null && (t.value = o, t.isRoot = !1, un(t));
|
|
827
827
|
}), i && (t.isContainDraft || console.warn("The return value does not contain any draft, please use 'rawReturn()' to wrap the return value to improve performance."), r && console.warn("The return value contains drafts, please don't use 'rawReturn()' to wrap the return value."));
|
|
828
828
|
}
|
|
829
829
|
function pi(t) {
|
|
830
830
|
var e;
|
|
831
831
|
const n = j(t);
|
|
832
|
-
if (!
|
|
832
|
+
if (!ue(t, n == null ? void 0 : n.options))
|
|
833
833
|
return t;
|
|
834
834
|
const r = Ce(t);
|
|
835
835
|
if (n && !n.operated)
|
|
@@ -847,11 +847,11 @@ function pi(t) {
|
|
|
847
847
|
}
|
|
848
848
|
} else
|
|
849
849
|
i = t;
|
|
850
|
-
if (xn(i, (o,
|
|
851
|
-
if (n && be(_e(n.original, o),
|
|
850
|
+
if (xn(i, (o, u) => {
|
|
851
|
+
if (n && be(_e(n.original, o), u))
|
|
852
852
|
return;
|
|
853
|
-
const
|
|
854
|
-
|
|
853
|
+
const a = pi(u);
|
|
854
|
+
a !== u && (i === t && s(), at(i, o, a));
|
|
855
855
|
}), r === 3) {
|
|
856
856
|
const o = (e = n == null ? void 0 : n.original) !== null && e !== void 0 ? e : i;
|
|
857
857
|
return Pn(o) ? new Set(i) : new (Object.getPrototypeOf(o)).constructor(i);
|
|
@@ -864,17 +864,17 @@ function gr(t) {
|
|
|
864
864
|
return pi(t);
|
|
865
865
|
}
|
|
866
866
|
const Us = (t) => function e(n, r, i) {
|
|
867
|
-
var s, o,
|
|
867
|
+
var s, o, u;
|
|
868
868
|
if (typeof n == "function" && typeof r != "function")
|
|
869
869
|
return function(S, ...C) {
|
|
870
870
|
return e(S, ($) => n.call(this, $, ...C), r);
|
|
871
871
|
};
|
|
872
|
-
const
|
|
872
|
+
const a = n, d = r;
|
|
873
873
|
let c = i;
|
|
874
874
|
if (typeof r != "function" && (c = r), c !== void 0 && Object.prototype.toString.call(c) !== "[object Object]")
|
|
875
875
|
throw new Error(`Invalid options: ${c}, 'options' should be an object.`);
|
|
876
876
|
c = Object.assign(Object.assign({}, t), c);
|
|
877
|
-
const f = je(
|
|
877
|
+
const f = je(a) ? gr(a) : a, l = Array.isArray(c.mark) ? (S, C) => {
|
|
878
878
|
for (const $ of c.mark) {
|
|
879
879
|
if (typeof $ != "function")
|
|
880
880
|
throw new Error(`Invalid mark: ${$}, 'mark' should be a function.`);
|
|
@@ -883,16 +883,16 @@ const Us = (t) => function e(n, r, i) {
|
|
|
883
883
|
return D;
|
|
884
884
|
}
|
|
885
885
|
} : c.mark, p = (s = c.enablePatches) !== null && s !== void 0 ? s : !1, y = (o = c.strict) !== null && o !== void 0 ? o : !1, _ = {
|
|
886
|
-
enableAutoFreeze: (
|
|
886
|
+
enableAutoFreeze: (u = c.enableAutoFreeze) !== null && u !== void 0 ? u : !1,
|
|
887
887
|
mark: l,
|
|
888
888
|
strict: y,
|
|
889
889
|
enablePatches: p
|
|
890
890
|
};
|
|
891
|
-
if (!
|
|
891
|
+
if (!ue(f, _) && typeof f == "object" && f !== null)
|
|
892
892
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
893
893
|
const [T, g] = Ds(f, _);
|
|
894
894
|
if (typeof r != "function") {
|
|
895
|
-
if (!
|
|
895
|
+
if (!ue(f, _))
|
|
896
896
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
897
897
|
return [T, g];
|
|
898
898
|
}
|
|
@@ -910,14 +910,14 @@ const Us = (t) => function e(n, r, i) {
|
|
|
910
910
|
const D = S == null ? void 0 : S[Es];
|
|
911
911
|
if (D) {
|
|
912
912
|
const Ve = D[0];
|
|
913
|
-
return _.strict && typeof S == "object" && S !== null &&
|
|
913
|
+
return _.strict && typeof S == "object" && S !== null && un({
|
|
914
914
|
rootDraft: C,
|
|
915
915
|
value: S,
|
|
916
916
|
useRawReturn: !0
|
|
917
917
|
}), g([Ve]);
|
|
918
918
|
}
|
|
919
919
|
if (S !== void 0)
|
|
920
|
-
return typeof S == "object" && S !== null &&
|
|
920
|
+
return typeof S == "object" && S !== null && un({ rootDraft: C, value: S }), g([S]);
|
|
921
921
|
}
|
|
922
922
|
if (S === T || S === void 0)
|
|
923
923
|
return g([]);
|
|
@@ -1246,7 +1246,7 @@ function Hs(t) {
|
|
|
1246
1246
|
function Ys(t) {
|
|
1247
1247
|
const e = /^(\d+)-(\d{1,2})-(\d{1,2})([ T])(.+)$/, n = t.match(e);
|
|
1248
1248
|
if (n) {
|
|
1249
|
-
const [, r, i, s, o,
|
|
1249
|
+
const [, r, i, s, o, u] = n, a = i.padStart(2, "0"), d = s.padStart(2, "0"), c = `${r}-${a}-${d}T${u}`;
|
|
1250
1250
|
return new Date(c);
|
|
1251
1251
|
}
|
|
1252
1252
|
return null;
|
|
@@ -1255,8 +1255,8 @@ function Js(t) {
|
|
|
1255
1255
|
const [e, n] = t.split(", "), [r, i, s] = e.split("/").map(Number), o = n.match(/(\d{1,2}):(\d{2}):(\d{2}) (AM|PM)/);
|
|
1256
1256
|
if (!o)
|
|
1257
1257
|
throw new Error(`Unable to parse time from: ${t}`);
|
|
1258
|
-
let [,
|
|
1259
|
-
return
|
|
1258
|
+
let [, u, a, d, c] = o;
|
|
1259
|
+
return u = Number(u), a = Number(a), d = Number(d), c === "PM" && u !== 12 ? u += 12 : c === "AM" && u === 12 && (u = 0), new Date(Date.UTC(s, r - 1, i, u, a, d));
|
|
1260
1260
|
}
|
|
1261
1261
|
function Zs(t) {
|
|
1262
1262
|
switch (t) {
|
|
@@ -1299,7 +1299,7 @@ function to(t, e) {
|
|
|
1299
1299
|
return null;
|
|
1300
1300
|
}
|
|
1301
1301
|
}
|
|
1302
|
-
function
|
|
1302
|
+
function an(t) {
|
|
1303
1303
|
for (const e of eo) {
|
|
1304
1304
|
const n = to(e, t);
|
|
1305
1305
|
if (n)
|
|
@@ -1310,7 +1310,7 @@ function un(t) {
|
|
|
1310
1310
|
function no(t) {
|
|
1311
1311
|
try {
|
|
1312
1312
|
const e = JSON.parse(t);
|
|
1313
|
-
return typeof e == "string" ?
|
|
1313
|
+
return typeof e == "string" ? an(e) : null;
|
|
1314
1314
|
} catch {
|
|
1315
1315
|
return null;
|
|
1316
1316
|
}
|
|
@@ -1322,7 +1322,7 @@ function xt(t) {
|
|
|
1322
1322
|
if (t instanceof Date)
|
|
1323
1323
|
return t;
|
|
1324
1324
|
if (typeof t == "string") {
|
|
1325
|
-
const e =
|
|
1325
|
+
const e = an(t) || no(t) || an(t.trim());
|
|
1326
1326
|
if (!e)
|
|
1327
1327
|
throw new Error(`Unable to parse \`${t}\` as a date.`);
|
|
1328
1328
|
return e;
|
|
@@ -1427,21 +1427,21 @@ function Z(t, e, n) {
|
|
|
1427
1427
|
const i = e.length - 1;
|
|
1428
1428
|
for (let s = 0; s < i; s++) {
|
|
1429
1429
|
const o = e[s];
|
|
1430
|
-
let
|
|
1431
|
-
|
|
1430
|
+
let u = r.get(o);
|
|
1431
|
+
u === void 0 && (u = /* @__PURE__ */ new Map(), r.set(o, u)), r = u;
|
|
1432
1432
|
}
|
|
1433
1433
|
i > -1 && r.set(e[i], n);
|
|
1434
1434
|
}
|
|
1435
1435
|
function gi(t, e, n) {
|
|
1436
1436
|
const r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
|
|
1437
1437
|
for (const o of e) {
|
|
1438
|
-
let [
|
|
1439
|
-
const c = t.getAttr(
|
|
1438
|
+
let [u, a, d] = o;
|
|
1439
|
+
const c = t.getAttr(a);
|
|
1440
1440
|
if (!c) {
|
|
1441
|
-
console.warn("no such attr",
|
|
1441
|
+
console.warn("no such attr", a, u);
|
|
1442
1442
|
continue;
|
|
1443
1443
|
}
|
|
1444
|
-
c["checked-data-type"] === "date" && n && (d = xt(d), o[2] = d), Ln(c) && Z(s, [d,
|
|
1444
|
+
c["checked-data-type"] === "date" && n && (d = xt(d), o[2] = d), Ln(c) && Z(s, [d, a, u], o), Z(r, [u, a, d], o), Z(i, [a, u, d], o);
|
|
1445
1445
|
}
|
|
1446
1446
|
return { eav: r, aev: i, vae: s };
|
|
1447
1447
|
}
|
|
@@ -1473,65 +1473,65 @@ function ct(t, e) {
|
|
|
1473
1473
|
var n, r;
|
|
1474
1474
|
let i;
|
|
1475
1475
|
if (Array.isArray(e[0])) {
|
|
1476
|
-
const [o,
|
|
1477
|
-
if (!
|
|
1476
|
+
const [o, u] = e[0], a = t.aev.get(o);
|
|
1477
|
+
if (!a)
|
|
1478
1478
|
return null;
|
|
1479
|
-
i = (n = X(
|
|
1479
|
+
i = (n = X(a, 2).find((c) => c[2] === u)) === null || n === void 0 ? void 0 : n[0];
|
|
1480
1480
|
} else
|
|
1481
1481
|
i = e[0];
|
|
1482
1482
|
if (!i)
|
|
1483
1483
|
return null;
|
|
1484
1484
|
const s = e[2];
|
|
1485
1485
|
if (Array.isArray(s) && s.length === 2 && t.aev.get(s[0])) {
|
|
1486
|
-
const [o,
|
|
1487
|
-
if (!
|
|
1486
|
+
const [o, u] = s, a = t.aev.get(o);
|
|
1487
|
+
if (!a)
|
|
1488
1488
|
return null;
|
|
1489
|
-
const c = (r = X(
|
|
1489
|
+
const c = (r = X(a, 2).find((b) => b[2] === u)) === null || r === void 0 ? void 0 : r[0];
|
|
1490
1490
|
if (!c)
|
|
1491
1491
|
return null;
|
|
1492
1492
|
const [f, l, p, ...y] = e;
|
|
1493
1493
|
return [i, l, c, ...y];
|
|
1494
1494
|
} else {
|
|
1495
|
-
const [o, ...
|
|
1496
|
-
return [i, ...
|
|
1495
|
+
const [o, ...u] = e;
|
|
1496
|
+
return [i, ...u];
|
|
1497
1497
|
}
|
|
1498
1498
|
}
|
|
1499
1499
|
function vi(t, e, n) {
|
|
1500
1500
|
const r = ct(t, n);
|
|
1501
1501
|
if (!r)
|
|
1502
1502
|
return;
|
|
1503
|
-
const [i, s, o] = r,
|
|
1504
|
-
|
|
1503
|
+
const [i, s, o] = r, u = e.getAttr(s);
|
|
1504
|
+
u && (oe(t.eav, [i, s, o]), oe(t.aev, [s, i, o]), Ln(u) && oe(t.vae, [o, s, i]));
|
|
1505
1505
|
}
|
|
1506
1506
|
let so = 0;
|
|
1507
1507
|
function Si(t, e, n) {
|
|
1508
1508
|
const [r, i, s] = n;
|
|
1509
1509
|
let o;
|
|
1510
|
-
const
|
|
1511
|
-
return
|
|
1510
|
+
const u = We(t.eav, [r, i, s]);
|
|
1511
|
+
return u && (o = u[3]), o || Date.now() * 10 + so++;
|
|
1512
1512
|
}
|
|
1513
1513
|
function Oi(t, e, n) {
|
|
1514
1514
|
var r;
|
|
1515
1515
|
const i = ct(t, n);
|
|
1516
1516
|
if (!i)
|
|
1517
1517
|
return;
|
|
1518
|
-
let [s, o,
|
|
1519
|
-
const
|
|
1520
|
-
if (!
|
|
1518
|
+
let [s, o, u] = i;
|
|
1519
|
+
const a = e.getAttr(o);
|
|
1520
|
+
if (!a)
|
|
1521
1521
|
return;
|
|
1522
|
-
|
|
1523
|
-
const d = We(t.eav, [s, o,
|
|
1524
|
-
ro(
|
|
1522
|
+
a["checked-data-type"] === "date" && t.useDateObjects && (u = xt(u));
|
|
1523
|
+
const d = We(t.eav, [s, o, u]), c = (r = d == null ? void 0 : d[3]) !== null && r !== void 0 ? r : Si(t, a, i), f = [s, o, u, c];
|
|
1524
|
+
ro(a) ? (Z(t.eav, [s, o], /* @__PURE__ */ new Map([[u, f]])), Z(t.aev, [o, s], /* @__PURE__ */ new Map([[u, f]]))) : (Z(t.eav, [s, o, u], f), Z(t.aev, [o, s, u], f)), Ln(a) && Z(t.vae, [u, o, s], f);
|
|
1525
1525
|
}
|
|
1526
1526
|
function oo(t, e, n) {
|
|
1527
1527
|
var r;
|
|
1528
1528
|
const i = ct(t, n);
|
|
1529
1529
|
if (!i)
|
|
1530
1530
|
return;
|
|
1531
|
-
const [s, o,
|
|
1532
|
-
if (!
|
|
1531
|
+
const [s, o, u] = i, a = e.getAttr(o);
|
|
1532
|
+
if (!a)
|
|
1533
1533
|
return;
|
|
1534
|
-
if (!Fn(
|
|
1534
|
+
if (!Fn(a))
|
|
1535
1535
|
throw new Error("merge operation is not supported for links");
|
|
1536
1536
|
const d = We(t.eav, [s, o]);
|
|
1537
1537
|
if (!d)
|
|
@@ -1539,20 +1539,20 @@ function oo(t, e, n) {
|
|
|
1539
1539
|
const c = (r = d.values().next()) === null || r === void 0 ? void 0 : r.value;
|
|
1540
1540
|
if (!c)
|
|
1541
1541
|
return;
|
|
1542
|
-
const f = c[2], l = bi(f,
|
|
1542
|
+
const f = c[2], l = bi(f, u), p = [
|
|
1543
1543
|
s,
|
|
1544
1544
|
o,
|
|
1545
1545
|
l,
|
|
1546
|
-
Si(t,
|
|
1546
|
+
Si(t, a, c)
|
|
1547
1547
|
];
|
|
1548
1548
|
Z(t.eav, [s, o], /* @__PURE__ */ new Map([[l, p]])), Z(t.aev, [o, s], /* @__PURE__ */ new Map([[l, p]]));
|
|
1549
1549
|
}
|
|
1550
1550
|
function cn(t, e, n) {
|
|
1551
1551
|
var r, i;
|
|
1552
|
-
const [s, o] = n,
|
|
1553
|
-
if (!
|
|
1552
|
+
const [s, o] = n, u = ct(t, [s]);
|
|
1553
|
+
if (!u)
|
|
1554
1554
|
return;
|
|
1555
|
-
const [
|
|
1555
|
+
const [a] = u, d = t.eav.get(a);
|
|
1556
1556
|
if (d) {
|
|
1557
1557
|
for (const f of d.keys()) {
|
|
1558
1558
|
const l = e.getAttr(f);
|
|
@@ -1563,16 +1563,16 @@ function cn(t, e, n) {
|
|
|
1563
1563
|
// the store that didn't set `etype` in deleteEntity
|
|
1564
1564
|
(!o || // If we don't know about the attr, let's just get rid of it
|
|
1565
1565
|
!l || // Make sure it matches the etype
|
|
1566
|
-
((r = l["forward-identity"]) === null || r === void 0 ? void 0 : r[1]) === o) && (oe(t.aev, [f,
|
|
1566
|
+
((r = l["forward-identity"]) === null || r === void 0 ? void 0 : r[1]) === o) && (oe(t.aev, [f, a]), oe(t.eav, [a, f]));
|
|
1567
1567
|
}
|
|
1568
|
-
d.size === 0 && oe(t.eav, [
|
|
1568
|
+
d.size === 0 && oe(t.eav, [a]);
|
|
1569
1569
|
}
|
|
1570
|
-
const c = t.vae.get(
|
|
1570
|
+
const c = t.vae.get(a) && X(t.vae.get(a), 2);
|
|
1571
1571
|
c && c.forEach((f) => {
|
|
1572
1572
|
var l, p, y;
|
|
1573
1573
|
const [b, _, T] = f, g = e.getAttr(_);
|
|
1574
1574
|
(!o || !g || ((l = g["reverse-identity"]) === null || l === void 0 ? void 0 : l[1]) === o) && (oe(t.eav, [b, _, T]), oe(t.aev, [_, b, T]), oe(t.vae, [T, _, b])), g && g["on-delete"] === "cascade" && ((p = g["reverse-identity"]) === null || p === void 0 ? void 0 : p[1]) === o && cn(t, e, [b, (y = g["forward-identity"]) === null || y === void 0 ? void 0 : y[1]]);
|
|
1575
|
-
}), ((i = t.vae.get(
|
|
1575
|
+
}), ((i = t.vae.get(a)) === null || i === void 0 ? void 0 : i.size) === 0 && oe(t.vae, [a]);
|
|
1576
1576
|
}
|
|
1577
1577
|
function Ei(t, e, n) {
|
|
1578
1578
|
const r = gi(e, n, t.useDateObjects);
|
|
@@ -1580,13 +1580,13 @@ function Ei(t, e, n) {
|
|
|
1580
1580
|
t[i] = r[i];
|
|
1581
1581
|
});
|
|
1582
1582
|
}
|
|
1583
|
-
function
|
|
1583
|
+
function uo(t, [e]) {
|
|
1584
1584
|
t.addAttr(e);
|
|
1585
1585
|
}
|
|
1586
1586
|
function Ai(t) {
|
|
1587
1587
|
return X(t.eav, 3);
|
|
1588
1588
|
}
|
|
1589
|
-
function
|
|
1589
|
+
function ao(t, e, [n]) {
|
|
1590
1590
|
if (!e.getAttr(n))
|
|
1591
1591
|
return;
|
|
1592
1592
|
const r = Ai(t).filter(([i, s]) => s !== n);
|
|
@@ -1611,10 +1611,10 @@ function fo(t, e, n) {
|
|
|
1611
1611
|
cn(t, e, i);
|
|
1612
1612
|
break;
|
|
1613
1613
|
case "add-attr":
|
|
1614
|
-
|
|
1614
|
+
uo(e, i);
|
|
1615
1615
|
break;
|
|
1616
1616
|
case "delete-attr":
|
|
1617
|
-
|
|
1617
|
+
ao(t, e, i);
|
|
1618
1618
|
break;
|
|
1619
1619
|
case "update-attr":
|
|
1620
1620
|
co(t, e, i);
|
|
@@ -1648,17 +1648,17 @@ function gt(t, e, n) {
|
|
|
1648
1648
|
return i;
|
|
1649
1649
|
}
|
|
1650
1650
|
if (n != null && n.hasOwnProperty("$isNull")) {
|
|
1651
|
-
const { attrId: o, isNull:
|
|
1652
|
-
if (
|
|
1651
|
+
const { attrId: o, isNull: u, reverse: a } = n.$isNull;
|
|
1652
|
+
if (a)
|
|
1653
1653
|
for (const d of e.keys()) {
|
|
1654
1654
|
const c = t.vae.get(d), f = !c || !c.get(o);
|
|
1655
|
-
(
|
|
1655
|
+
(u ? f : !f) && i.push(e.get(d));
|
|
1656
1656
|
}
|
|
1657
1657
|
else {
|
|
1658
1658
|
const d = t.aev.get(o);
|
|
1659
1659
|
for (const c of e.keys()) {
|
|
1660
1660
|
const f = !d || ((r = d.get(c)) === null || r === void 0 ? void 0 : r.get(null)) || !d.get(c);
|
|
1661
|
-
(
|
|
1661
|
+
(u ? f : !f) && i.push(e.get(c));
|
|
1662
1662
|
}
|
|
1663
1663
|
}
|
|
1664
1664
|
return i;
|
|
@@ -1667,8 +1667,8 @@ function gt(t, e, n) {
|
|
|
1667
1667
|
return X(e, 1).filter(n.$op);
|
|
1668
1668
|
const s = n.in || n.$in || [n];
|
|
1669
1669
|
for (const o of s) {
|
|
1670
|
-
const
|
|
1671
|
-
|
|
1670
|
+
const u = e.get(o);
|
|
1671
|
+
u && i.push(u);
|
|
1672
1672
|
}
|
|
1673
1673
|
return i;
|
|
1674
1674
|
}
|
|
@@ -1680,46 +1680,46 @@ function ho(t, [e, n, r]) {
|
|
|
1680
1680
|
var i, s;
|
|
1681
1681
|
switch (lo(e, n, r)) {
|
|
1682
1682
|
case "e": {
|
|
1683
|
-
const
|
|
1684
|
-
return X(
|
|
1683
|
+
const u = t.eav.get(e);
|
|
1684
|
+
return X(u, 2);
|
|
1685
1685
|
}
|
|
1686
1686
|
case "ea": {
|
|
1687
|
-
const
|
|
1688
|
-
return X(
|
|
1687
|
+
const u = (i = t.eav.get(e)) === null || i === void 0 ? void 0 : i.get(n);
|
|
1688
|
+
return X(u, 1);
|
|
1689
1689
|
}
|
|
1690
1690
|
case "eav": {
|
|
1691
|
-
const
|
|
1692
|
-
return
|
|
1691
|
+
const u = (s = t.eav.get(e)) === null || s === void 0 ? void 0 : s.get(n);
|
|
1692
|
+
return u ? gt(t, u, r) : [];
|
|
1693
1693
|
}
|
|
1694
1694
|
case "ev": {
|
|
1695
|
-
const
|
|
1696
|
-
if (!
|
|
1695
|
+
const u = t.eav.get(e);
|
|
1696
|
+
if (!u)
|
|
1697
1697
|
return [];
|
|
1698
|
-
const
|
|
1699
|
-
for (const d of
|
|
1700
|
-
|
|
1701
|
-
return
|
|
1698
|
+
const a = [];
|
|
1699
|
+
for (const d of u.values())
|
|
1700
|
+
a.push(...gt(t, d, r));
|
|
1701
|
+
return a;
|
|
1702
1702
|
}
|
|
1703
1703
|
case "a": {
|
|
1704
|
-
const
|
|
1705
|
-
return X(
|
|
1704
|
+
const u = t.aev.get(n);
|
|
1705
|
+
return X(u, 2);
|
|
1706
1706
|
}
|
|
1707
1707
|
case "av": {
|
|
1708
|
-
const
|
|
1709
|
-
if (!
|
|
1708
|
+
const u = t.aev.get(n);
|
|
1709
|
+
if (!u)
|
|
1710
1710
|
return [];
|
|
1711
|
-
const u = [];
|
|
1712
|
-
for (const d of a.values())
|
|
1713
|
-
u.push(...gt(t, d, r));
|
|
1714
|
-
return u;
|
|
1715
|
-
}
|
|
1716
|
-
case "v": {
|
|
1717
1711
|
const a = [];
|
|
1718
|
-
for (const
|
|
1719
|
-
|
|
1720
|
-
a.push(...gt(t, d, r));
|
|
1712
|
+
for (const d of u.values())
|
|
1713
|
+
a.push(...gt(t, d, r));
|
|
1721
1714
|
return a;
|
|
1722
1715
|
}
|
|
1716
|
+
case "v": {
|
|
1717
|
+
const u = [];
|
|
1718
|
+
for (const a of t.eav.values())
|
|
1719
|
+
for (const d of a.values())
|
|
1720
|
+
u.push(...gt(t, d, r));
|
|
1721
|
+
return u;
|
|
1722
|
+
}
|
|
1723
1723
|
default:
|
|
1724
1724
|
return X(t.eav, 3);
|
|
1725
1725
|
}
|
|
@@ -1730,8 +1730,8 @@ function po(t, e, n) {
|
|
|
1730
1730
|
if (!e)
|
|
1731
1731
|
return i;
|
|
1732
1732
|
for (const [s, o] of e.entries()) {
|
|
1733
|
-
const
|
|
1734
|
-
for (const d of
|
|
1733
|
+
const u = (r = t.eav.get(n)) === null || r === void 0 ? void 0 : r.get(o.id), a = X(u, 1);
|
|
1734
|
+
for (const d of a)
|
|
1735
1735
|
i[s] = d[2];
|
|
1736
1736
|
}
|
|
1737
1737
|
return i;
|
|
@@ -1761,10 +1761,10 @@ function bo(t, e, n) {
|
|
|
1761
1761
|
return We(t.eav, [i, s]);
|
|
1762
1762
|
}
|
|
1763
1763
|
function _o(t, e, n) {
|
|
1764
|
-
const r = n.filter(([i, s, o,
|
|
1764
|
+
const r = n.filter(([i, s, o, u, a]) => {
|
|
1765
1765
|
if (i !== "add-triple" && i !== "deep-merge-triple")
|
|
1766
1766
|
return !0;
|
|
1767
|
-
const d =
|
|
1767
|
+
const d = a == null ? void 0 : a.mode;
|
|
1768
1768
|
if (d !== "create" && d !== "update")
|
|
1769
1769
|
return !0;
|
|
1770
1770
|
let c = !1;
|
|
@@ -1950,23 +1950,23 @@ function qo(t, e, n) {
|
|
|
1950
1950
|
return t.map((r) => r === e ? n : r);
|
|
1951
1951
|
}
|
|
1952
1952
|
function Ci(t, e, n, r, i) {
|
|
1953
|
-
const s = K(e, n, i), o = Ie(e, n, i),
|
|
1954
|
-
if (!
|
|
1953
|
+
const s = K(e, n, i), o = Ie(e, n, i), u = s || o;
|
|
1954
|
+
if (!u)
|
|
1955
1955
|
throw new Ke(`Could not find attr for ${[n, i]}`);
|
|
1956
|
-
if (
|
|
1957
|
-
throw new Error(`Attr ${
|
|
1958
|
-
const [
|
|
1956
|
+
if (u["value-type"] !== "ref")
|
|
1957
|
+
throw new Error(`Attr ${u.id} is not a ref`);
|
|
1958
|
+
const [a, d] = u["forward-identity"], [c, f] = u["reverse-identity"], l = r + 1, p = s ? [
|
|
1959
1959
|
t(d, r),
|
|
1960
|
-
|
|
1960
|
+
u.id,
|
|
1961
1961
|
t(f, l),
|
|
1962
1962
|
nt("time")
|
|
1963
1963
|
] : [
|
|
1964
1964
|
t(d, l),
|
|
1965
|
-
|
|
1965
|
+
u.id,
|
|
1966
1966
|
t(f, r),
|
|
1967
1967
|
nt("time")
|
|
1968
1968
|
];
|
|
1969
|
-
return [s ? f : d, l, p,
|
|
1969
|
+
return [s ? f : d, l, p, u, !!s];
|
|
1970
1970
|
}
|
|
1971
1971
|
function Ar(t, e) {
|
|
1972
1972
|
if (typeof e != "string")
|
|
@@ -2039,8 +2039,8 @@ function Wo(t, e) {
|
|
|
2039
2039
|
return e;
|
|
2040
2040
|
}
|
|
2041
2041
|
function zo(t, e, n, r, i, s) {
|
|
2042
|
-
const o = K(e, n, i),
|
|
2043
|
-
if (!
|
|
2042
|
+
const o = K(e, n, i), u = Ie(e, n, i), a = o || u;
|
|
2043
|
+
if (!a)
|
|
2044
2044
|
throw new Ke(`No attr for etype = ${n} label = ${i}`);
|
|
2045
2045
|
if (s != null && s.hasOwnProperty("$isNull")) {
|
|
2046
2046
|
const d = K(e, n, "id");
|
|
@@ -2049,26 +2049,26 @@ function zo(t, e, n, r, i, s) {
|
|
|
2049
2049
|
return [
|
|
2050
2050
|
t(n, r),
|
|
2051
2051
|
d.id,
|
|
2052
|
-
{ $isNull: { attrId:
|
|
2052
|
+
{ $isNull: { attrId: a.id, isNull: s.$isNull, reverse: !o } },
|
|
2053
2053
|
nt("time")
|
|
2054
2054
|
];
|
|
2055
2055
|
}
|
|
2056
2056
|
return o ? [
|
|
2057
2057
|
t(n, r),
|
|
2058
|
-
|
|
2059
|
-
Wo(
|
|
2058
|
+
a.id,
|
|
2059
|
+
Wo(a, s),
|
|
2060
2060
|
nt("time")
|
|
2061
|
-
] : [s,
|
|
2061
|
+
] : [s, a.id, t(n, r), nt("time")];
|
|
2062
2062
|
}
|
|
2063
2063
|
function Vo(t, e, n, r, i) {
|
|
2064
|
-
const [s, o,
|
|
2065
|
-
const [c, f, l] =
|
|
2064
|
+
const [s, o, u] = i.reduce((a, d) => {
|
|
2065
|
+
const [c, f, l] = a, [p, y, b] = Ci(t, e, c, f, d);
|
|
2066
2066
|
return [p, y, [...l, b]];
|
|
2067
2067
|
}, [n, r, []]);
|
|
2068
|
-
return [s, o,
|
|
2068
|
+
return [s, o, u];
|
|
2069
2069
|
}
|
|
2070
2070
|
function fn(t, e, n, r, i, s) {
|
|
2071
|
-
const o = i.slice(0, i.length - 1),
|
|
2071
|
+
const o = i.slice(0, i.length - 1), u = i[i.length - 1], [a, d, c] = Vo(t, e, n, r, o), f = zo(t, e, a, d, u, s);
|
|
2072
2072
|
return c.concat([f]);
|
|
2073
2073
|
}
|
|
2074
2074
|
function Bo(t, e) {
|
|
@@ -2087,11 +2087,11 @@ function Ho(t, e, n) {
|
|
|
2087
2087
|
};
|
|
2088
2088
|
}
|
|
2089
2089
|
function kr(t, e, n, r, i, s) {
|
|
2090
|
-
const o = t(r, i),
|
|
2090
|
+
const o = t(r, i), u = s.map((a, d) => {
|
|
2091
2091
|
const c = Ho(t, o, d);
|
|
2092
|
-
return Ii(c, n, r, i,
|
|
2092
|
+
return Ii(c, n, r, i, a);
|
|
2093
2093
|
});
|
|
2094
|
-
return { [e]: { patterns:
|
|
2094
|
+
return { [e]: { patterns: u, joinSym: o } };
|
|
2095
2095
|
}
|
|
2096
2096
|
function Yo(t) {
|
|
2097
2097
|
const e = [];
|
|
@@ -2112,26 +2112,26 @@ function Ii(t, e, n, r, i) {
|
|
|
2112
2112
|
return kr(t, "and", e, n, r, o);
|
|
2113
2113
|
if (s === "$entityIdStartsWith")
|
|
2114
2114
|
return [];
|
|
2115
|
-
const
|
|
2115
|
+
const u = s.split(".");
|
|
2116
2116
|
if (o != null && o.hasOwnProperty("$ne") && (o = Object.assign(Object.assign({}, o), { $not: o.$ne }), delete o.$ne), o != null && o.hasOwnProperty("$not")) {
|
|
2117
|
-
const
|
|
2117
|
+
const a = fn(t, e, n, r, u, o), d = jr(t, e, n, r, u);
|
|
2118
2118
|
return [
|
|
2119
2119
|
{
|
|
2120
2120
|
or: {
|
|
2121
|
-
patterns: [
|
|
2121
|
+
patterns: [a, ...d],
|
|
2122
2122
|
joinSym: t(n, r)
|
|
2123
2123
|
}
|
|
2124
2124
|
}
|
|
2125
2125
|
];
|
|
2126
2126
|
}
|
|
2127
|
-
return o != null && o.hasOwnProperty("$isNull") && o.$isNull === !0 &&
|
|
2127
|
+
return o != null && o.hasOwnProperty("$isNull") && o.$isNull === !0 && u.length > 1 ? [
|
|
2128
2128
|
{
|
|
2129
2129
|
or: {
|
|
2130
|
-
patterns: jr(t, e, n, r,
|
|
2130
|
+
patterns: jr(t, e, n, r, u),
|
|
2131
2131
|
joinSym: t(n, r)
|
|
2132
2132
|
}
|
|
2133
2133
|
}
|
|
2134
|
-
] : fn(t, e, n, r,
|
|
2134
|
+
] : fn(t, e, n, r, u, o);
|
|
2135
2135
|
});
|
|
2136
2136
|
}
|
|
2137
2137
|
function Jo(t, e, n, r) {
|
|
@@ -2142,13 +2142,13 @@ function Zo(t, e, n) {
|
|
|
2142
2142
|
return [t(e, n), t("time", n)];
|
|
2143
2143
|
}
|
|
2144
2144
|
function Xo(t, e, n, r, i, s) {
|
|
2145
|
-
const [o,
|
|
2146
|
-
return [o,
|
|
2145
|
+
const [o, u, a, d, c] = Ci(t, e, n, r, i), f = qo(a, t(n, r), s);
|
|
2146
|
+
return [o, u, f, d, c];
|
|
2147
2147
|
}
|
|
2148
|
-
function
|
|
2149
|
-
const
|
|
2150
|
-
return
|
|
2151
|
-
return
|
|
2148
|
+
function eu(t, e, n, { etype: r, level: i, form: s }, o) {
|
|
2149
|
+
const u = Object.keys(s).filter((a) => a !== "$");
|
|
2150
|
+
return u.length ? Object.entries(o).map(function([d, c]) {
|
|
2151
|
+
return u.map(function(p) {
|
|
2152
2152
|
var y, b, _;
|
|
2153
2153
|
const T = !!(e.cardinalityInference && (!((_ = (b = (y = n.linkIndex) === null || y === void 0 ? void 0 : y[r]) === null || b === void 0 ? void 0 : b[p]) === null || _ === void 0) && _.isSingular));
|
|
2154
2154
|
try {
|
|
@@ -2169,11 +2169,11 @@ function ea(t, e, n, { etype: r, level: i, form: s }, o) {
|
|
|
2169
2169
|
}, c);
|
|
2170
2170
|
}) : Object.values(o);
|
|
2171
2171
|
}
|
|
2172
|
-
function
|
|
2172
|
+
function tu(t, e, n) {
|
|
2173
2173
|
return n === "string" ? Lo(t, e) : t > e ? 1 : -1;
|
|
2174
2174
|
}
|
|
2175
2175
|
function Ze(t, e, n, r, i) {
|
|
2176
|
-
return e === r || e == null && r == null ? $o(t, n) : r == null ? 1 : e == null ? -1 :
|
|
2176
|
+
return e === r || e == null && r == null ? $o(t, n) : r == null ? 1 : e == null ? -1 : tu(e, r, i);
|
|
2177
2177
|
}
|
|
2178
2178
|
function Pt([t, e], [n, r], i) {
|
|
2179
2179
|
return Ze(t, e, n, r, i);
|
|
@@ -2181,49 +2181,49 @@ function Pt([t, e], [n, r], i) {
|
|
|
2181
2181
|
function ln(t) {
|
|
2182
2182
|
return t == null ? t : new Date(t).getTime();
|
|
2183
2183
|
}
|
|
2184
|
-
function
|
|
2184
|
+
function nu(t, e, n, r) {
|
|
2185
2185
|
var i;
|
|
2186
|
-
const [s, o,
|
|
2186
|
+
const [s, o, u, a] = t, d = n === "desc" ? 1 : -1;
|
|
2187
2187
|
if (((i = e["forward-identity"]) === null || i === void 0 ? void 0 : i[2]) === "id")
|
|
2188
|
-
return Pt(r, [s,
|
|
2189
|
-
const [c, f] = r, l = e["checked-data-type"], p = l === "date" ? ln(f) : f, y = l === "date" ? ln(
|
|
2188
|
+
return Pt(r, [s, a], null) === d;
|
|
2189
|
+
const [c, f] = r, l = e["checked-data-type"], p = l === "date" ? ln(f) : f, y = l === "date" ? ln(u) : u;
|
|
2190
2190
|
return Pt([c, p], [s, y], l) === d;
|
|
2191
2191
|
}
|
|
2192
|
-
function
|
|
2192
|
+
function ru(t, e) {
|
|
2193
2193
|
const n = e[1];
|
|
2194
2194
|
return t.getAttr(n);
|
|
2195
2195
|
}
|
|
2196
|
-
function
|
|
2196
|
+
function iu(t, e, n) {
|
|
2197
2197
|
const r = Object.keys(n)[0];
|
|
2198
2198
|
return K(t, e, r);
|
|
2199
2199
|
}
|
|
2200
|
-
function
|
|
2200
|
+
function su(t, e, n, r) {
|
|
2201
2201
|
if (n)
|
|
2202
|
-
return
|
|
2202
|
+
return ru(t, n);
|
|
2203
2203
|
if (r)
|
|
2204
|
-
return
|
|
2204
|
+
return iu(t, e, r);
|
|
2205
2205
|
}
|
|
2206
|
-
function
|
|
2206
|
+
function ou(t, e, n) {
|
|
2207
2207
|
var r, i;
|
|
2208
2208
|
if (!Array.isArray(n.fields))
|
|
2209
2209
|
return yo(t, e);
|
|
2210
2210
|
const s = /* @__PURE__ */ new Map();
|
|
2211
2211
|
for (const o of n.fields) {
|
|
2212
|
-
const
|
|
2213
|
-
|
|
2212
|
+
const u = K(t, e, o), a = (r = u == null ? void 0 : u["forward-identity"]) === null || r === void 0 ? void 0 : r[2];
|
|
2213
|
+
a && Fn(u) && s.set(a, u);
|
|
2214
2214
|
}
|
|
2215
2215
|
if (!s.has("id")) {
|
|
2216
|
-
const o = K(t, e, "id"),
|
|
2217
|
-
|
|
2216
|
+
const o = K(t, e, "id"), u = (i = o == null ? void 0 : o["forward-identity"]) === null || i === void 0 ? void 0 : i[2];
|
|
2217
|
+
u && s.set(u, o);
|
|
2218
2218
|
}
|
|
2219
2219
|
return s;
|
|
2220
2220
|
}
|
|
2221
|
-
function
|
|
2222
|
-
var o,
|
|
2223
|
-
const
|
|
2221
|
+
function uu(t, e, { etype: n, pageInfo: r, dq: i, form: s }) {
|
|
2222
|
+
var o, u;
|
|
2223
|
+
const a = (o = s == null ? void 0 : s.$) === null || o === void 0 ? void 0 : o.order, d = Pi(s), c = au(s);
|
|
2224
2224
|
let f = Ao(t, i);
|
|
2225
|
-
const l = r == null ? void 0 : r["start-cursor"], p =
|
|
2226
|
-
if (p && ((
|
|
2225
|
+
const l = r == null ? void 0 : r["start-cursor"], p = su(e, n, l, a);
|
|
2226
|
+
if (p && ((u = p == null ? void 0 : p["forward-identity"]) === null || u === void 0 ? void 0 : u[2]) !== "id") {
|
|
2227
2227
|
const _ = p["checked-data-type"] === "date", T = p.id;
|
|
2228
2228
|
f = f.map(([g]) => {
|
|
2229
2229
|
var m, O, S, C, $;
|
|
@@ -2237,17 +2237,17 @@ function aa(t, e, { etype: n, pageInfo: r, dq: i, form: s }) {
|
|
|
2237
2237
|
return Pt(g, T, p == null ? void 0 : p["checked-data-type"]);
|
|
2238
2238
|
});
|
|
2239
2239
|
let y = {};
|
|
2240
|
-
const b =
|
|
2240
|
+
const b = ou(e, n, i);
|
|
2241
2241
|
for (const _ of f) {
|
|
2242
2242
|
const [T] = _;
|
|
2243
|
-
if (y[T] || !d && l && p &&
|
|
2243
|
+
if (y[T] || !d && l && p && nu(l, p, c, _))
|
|
2244
2244
|
continue;
|
|
2245
2245
|
const g = po(t, b, T);
|
|
2246
2246
|
g && (y[T] = g);
|
|
2247
2247
|
}
|
|
2248
2248
|
return y;
|
|
2249
2249
|
}
|
|
2250
|
-
function
|
|
2250
|
+
function au(t) {
|
|
2251
2251
|
var e;
|
|
2252
2252
|
const n = (e = t.$) === null || e === void 0 ? void 0 : e.order;
|
|
2253
2253
|
return n && n[Object.keys(n)[0]] || "asc";
|
|
@@ -2257,11 +2257,11 @@ function Pi(t) {
|
|
|
2257
2257
|
const i = (e = t.$) === null || e === void 0 ? void 0 : e.offset, s = (n = t.$) === null || n === void 0 ? void 0 : n.before, o = (r = t.$) === null || r === void 0 ? void 0 : r.after;
|
|
2258
2258
|
return !i && !s && !o;
|
|
2259
2259
|
}
|
|
2260
|
-
function
|
|
2261
|
-
var
|
|
2260
|
+
function cu(t, e, { etype: n, level: r, form: i, join: s, pageInfo: o }) {
|
|
2261
|
+
var u, a, d, c, f;
|
|
2262
2262
|
if (!Pi(i) && (!o || !o["start-cursor"]))
|
|
2263
2263
|
return [];
|
|
2264
|
-
const l = Bo(Jo(e, n, r, (
|
|
2264
|
+
const l = Bo(Jo(e, n, r, (u = i.$) === null || u === void 0 ? void 0 : u.where), s), p = Zo($t, n, r), y = (a = i.$) === null || a === void 0 ? void 0 : a.fields, b = uu(t, e, {
|
|
2265
2265
|
etype: n,
|
|
2266
2266
|
pageInfo: o,
|
|
2267
2267
|
form: i,
|
|
@@ -2274,9 +2274,9 @@ function ca(t, e, { etype: n, level: r, form: i, join: s, pageInfo: o }) {
|
|
|
2274
2274
|
}
|
|
2275
2275
|
return b;
|
|
2276
2276
|
}
|
|
2277
|
-
function
|
|
2277
|
+
function du(t, e, n) {
|
|
2278
2278
|
try {
|
|
2279
|
-
return
|
|
2279
|
+
return cu(t, e, n);
|
|
2280
2280
|
} catch (r) {
|
|
2281
2281
|
if (r instanceof Ke)
|
|
2282
2282
|
return {};
|
|
@@ -2284,10 +2284,10 @@ function da(t, e, n) {
|
|
|
2284
2284
|
}
|
|
2285
2285
|
}
|
|
2286
2286
|
function Mi(t, e, n) {
|
|
2287
|
-
const r =
|
|
2288
|
-
return
|
|
2287
|
+
const r = du(t, e, n);
|
|
2288
|
+
return eu($t, t, e, n, r);
|
|
2289
2289
|
}
|
|
2290
|
-
function
|
|
2290
|
+
function fu(t) {
|
|
2291
2291
|
const e = {};
|
|
2292
2292
|
for (const [n, r] of Object.entries(t))
|
|
2293
2293
|
e[n] = {
|
|
@@ -2299,17 +2299,17 @@ function fa(t) {
|
|
|
2299
2299
|
return e;
|
|
2300
2300
|
}
|
|
2301
2301
|
function Ri({ store: t, attrsStore: e, pageInfo: n, aggregate: r }, i) {
|
|
2302
|
-
const o = { data: Object.keys(i).reduce(function(
|
|
2303
|
-
return r != null && r[d] || d === "$$ruleParams" || (
|
|
2302
|
+
const o = { data: Object.keys(i).reduce(function(a, d) {
|
|
2303
|
+
return r != null && r[d] || d === "$$ruleParams" || (a[d] = Mi(t, e, {
|
|
2304
2304
|
etype: d,
|
|
2305
2305
|
form: i[d],
|
|
2306
2306
|
level: 0,
|
|
2307
2307
|
pageInfo: n == null ? void 0 : n[d]
|
|
2308
|
-
})),
|
|
2308
|
+
})), a;
|
|
2309
2309
|
}, {}) };
|
|
2310
|
-
return n && (o.pageInfo =
|
|
2310
|
+
return n && (o.pageInfo = fu(n)), r && (o.aggregate = r), o;
|
|
2311
2311
|
}
|
|
2312
|
-
function
|
|
2312
|
+
function lu() {
|
|
2313
2313
|
const e = {
|
|
2314
2314
|
__etype: 1,
|
|
2315
2315
|
__ops: 1,
|
|
@@ -2323,7 +2323,7 @@ function la() {
|
|
|
2323
2323
|
};
|
|
2324
2324
|
return new Set(Object.keys(e));
|
|
2325
2325
|
}
|
|
2326
|
-
const
|
|
2326
|
+
const hu = lu();
|
|
2327
2327
|
function hn(t, e, n) {
|
|
2328
2328
|
const r = {
|
|
2329
2329
|
__etype: t,
|
|
@@ -2335,10 +2335,10 @@ function hn(t, e, n) {
|
|
|
2335
2335
|
return n;
|
|
2336
2336
|
if (s === "__etype")
|
|
2337
2337
|
return t;
|
|
2338
|
-
if (
|
|
2339
|
-
return (o,
|
|
2338
|
+
if (hu.has(s))
|
|
2339
|
+
return (o, u) => hn(t, e, [
|
|
2340
2340
|
...n,
|
|
2341
|
-
|
|
2341
|
+
u ? [s, t, e, o, u] : [s, t, e, o]
|
|
2342
2342
|
]);
|
|
2343
2343
|
}
|
|
2344
2344
|
});
|
|
@@ -2353,7 +2353,7 @@ function xi(t) {
|
|
|
2353
2353
|
const [e, n, ...r] = t.split("__");
|
|
2354
2354
|
return [n, JSON.parse(r.join("__"))];
|
|
2355
2355
|
}
|
|
2356
|
-
function
|
|
2356
|
+
function pu(t) {
|
|
2357
2357
|
return new Proxy({
|
|
2358
2358
|
__etype: t
|
|
2359
2359
|
}, {
|
|
@@ -2368,23 +2368,23 @@ function pa(t) {
|
|
|
2368
2368
|
function Kn() {
|
|
2369
2369
|
return new Proxy({}, {
|
|
2370
2370
|
get(t, e) {
|
|
2371
|
-
return
|
|
2371
|
+
return pu(e);
|
|
2372
2372
|
}
|
|
2373
2373
|
});
|
|
2374
2374
|
}
|
|
2375
2375
|
const Lc = Kn();
|
|
2376
|
-
function
|
|
2376
|
+
function yu(t) {
|
|
2377
2377
|
return t.__ops;
|
|
2378
2378
|
}
|
|
2379
|
-
function
|
|
2379
|
+
function bu(t, e) {
|
|
2380
2380
|
const { attrIdMap: n, refSwapAttrIds: r } = t, i = [];
|
|
2381
2381
|
for (const o of e) {
|
|
2382
|
-
const
|
|
2383
|
-
if (
|
|
2384
|
-
i.push(
|
|
2382
|
+
const u = n[o];
|
|
2383
|
+
if (u)
|
|
2384
|
+
i.push(u);
|
|
2385
2385
|
else if (Array.isArray(o) && o.length == 2 && n[o[0]]) {
|
|
2386
|
-
const [
|
|
2387
|
-
i.push([n[
|
|
2386
|
+
const [a, d] = o;
|
|
2387
|
+
i.push([n[a], d]);
|
|
2388
2388
|
} else
|
|
2389
2389
|
i.push(o);
|
|
2390
2390
|
}
|
|
@@ -2395,7 +2395,7 @@ function ba(t, e) {
|
|
|
2395
2395
|
}
|
|
2396
2396
|
return i;
|
|
2397
2397
|
}
|
|
2398
|
-
function
|
|
2398
|
+
function _u(t) {
|
|
2399
2399
|
if (Array.isArray(t))
|
|
2400
2400
|
return t;
|
|
2401
2401
|
const e = Object.entries(t);
|
|
@@ -2403,7 +2403,7 @@ function _a(t) {
|
|
|
2403
2403
|
throw new Error("lookup must be an object with a single unique attr and value.");
|
|
2404
2404
|
return e[0];
|
|
2405
2405
|
}
|
|
2406
|
-
function
|
|
2406
|
+
function gu(t, e, n) {
|
|
2407
2407
|
return n.indexOf(".") !== -1 && // attr names can have `.` in them, so use the attr we find with a `.`
|
|
2408
2408
|
// before assuming it's a ref lookup.
|
|
2409
2409
|
!K(t, e, n);
|
|
@@ -2414,8 +2414,8 @@ function pn(t) {
|
|
|
2414
2414
|
throw new Error(`${t} is not a valid lookup attribute.`);
|
|
2415
2415
|
return e;
|
|
2416
2416
|
}
|
|
2417
|
-
function
|
|
2418
|
-
if (!
|
|
2417
|
+
function wu(t, e, n) {
|
|
2418
|
+
if (!gu(t, e, n))
|
|
2419
2419
|
return K(t, e, n);
|
|
2420
2420
|
const r = pn(n), i = K(t, e, r) || Ie(t, e, r);
|
|
2421
2421
|
if (i && i["value-type"] !== "ref")
|
|
@@ -2423,13 +2423,13 @@ function wa(t, e, n) {
|
|
|
2423
2423
|
return i;
|
|
2424
2424
|
}
|
|
2425
2425
|
function yn(t) {
|
|
2426
|
-
return typeof t == "string" && !Mt(t) ? null : typeof t == "string" && Mt(t) ? xi(t) :
|
|
2426
|
+
return typeof t == "string" && !Mt(t) ? null : typeof t == "string" && Mt(t) ? xi(t) : _u(t);
|
|
2427
2427
|
}
|
|
2428
2428
|
function ee(t, e, n) {
|
|
2429
2429
|
const r = yn(n);
|
|
2430
2430
|
if (r === null)
|
|
2431
2431
|
return n;
|
|
2432
|
-
const [i, s] = r, o =
|
|
2432
|
+
const [i, s] = r, o = wu(t, e, i);
|
|
2433
2433
|
if (!o || !o["unique?"])
|
|
2434
2434
|
throw new Error(`${i} is not a unique attribute.`);
|
|
2435
2435
|
return [o.id, s];
|
|
@@ -2444,16 +2444,16 @@ function $i(t, e, n, r) {
|
|
|
2444
2444
|
s
|
|
2445
2445
|
]].concat(r) : r;
|
|
2446
2446
|
}
|
|
2447
|
-
function
|
|
2447
|
+
function Tu({ attrsStore: t }, [e, n, r]) {
|
|
2448
2448
|
const i = Object.entries(r).flatMap(([s, o]) => {
|
|
2449
|
-
const
|
|
2450
|
-
return
|
|
2449
|
+
const u = Array.isArray(o) ? o : [o], a = K(t, e, s), d = Ie(t, e, s);
|
|
2450
|
+
return u.map((c) => a ? [
|
|
2451
2451
|
"add-triple",
|
|
2452
2452
|
ee(t, e, n),
|
|
2453
|
-
|
|
2453
|
+
a.id,
|
|
2454
2454
|
// Uses `!` because if we get here, we should have created the attr if it doesn't
|
|
2455
2455
|
// already exist
|
|
2456
|
-
ee(t,
|
|
2456
|
+
ee(t, a["reverse-identity"][1], c)
|
|
2457
2457
|
] : [
|
|
2458
2458
|
"add-triple",
|
|
2459
2459
|
// Uses `!` because if we get here, we should have created the attr if it doesn't
|
|
@@ -2465,16 +2465,16 @@ function Ta({ attrsStore: t }, [e, n, r]) {
|
|
|
2465
2465
|
});
|
|
2466
2466
|
return $i(t, e, n, i);
|
|
2467
2467
|
}
|
|
2468
|
-
function
|
|
2468
|
+
function mu({ attrsStore: t }, [e, n, r]) {
|
|
2469
2469
|
const i = Object.entries(r).flatMap(([s, o]) => {
|
|
2470
|
-
const
|
|
2471
|
-
return
|
|
2470
|
+
const u = Array.isArray(o) ? o : [o], a = K(t, e, s), d = Ie(t, e, s);
|
|
2471
|
+
return u.map((c) => a ? [
|
|
2472
2472
|
"retract-triple",
|
|
2473
2473
|
ee(t, e, n),
|
|
2474
|
-
|
|
2474
|
+
a.id,
|
|
2475
2475
|
// Uses `!` because if we get here, we should have created the attr if it doesn't
|
|
2476
2476
|
// already exist
|
|
2477
|
-
ee(t,
|
|
2477
|
+
ee(t, a["reverse-identity"][1], c)
|
|
2478
2478
|
] : [
|
|
2479
2479
|
"retract-triple",
|
|
2480
2480
|
// Uses `!` because if we get here, we should have created the attr if it doesn't
|
|
@@ -2486,14 +2486,14 @@ function ma({ attrsStore: t }, [e, n, r]) {
|
|
|
2486
2486
|
});
|
|
2487
2487
|
return $i(t, e, n, i);
|
|
2488
2488
|
}
|
|
2489
|
-
function
|
|
2489
|
+
function vu(t, e, n, r) {
|
|
2490
2490
|
var i;
|
|
2491
2491
|
if (Array.isArray(r)) {
|
|
2492
2492
|
const [s, o] = r;
|
|
2493
|
-
for (const
|
|
2494
|
-
const
|
|
2495
|
-
if (
|
|
2496
|
-
for (const [d, c, f] of X(
|
|
2493
|
+
for (const u of t || []) {
|
|
2494
|
+
const a = u == null ? void 0 : u.aev.get(s);
|
|
2495
|
+
if (a) {
|
|
2496
|
+
for (const [d, c, f] of X(a, 2))
|
|
2497
2497
|
if (f === o)
|
|
2498
2498
|
return !0;
|
|
2499
2499
|
}
|
|
@@ -2502,45 +2502,45 @@ function va(t, e, n, r) {
|
|
|
2502
2502
|
for (const s of t || []) {
|
|
2503
2503
|
const o = s == null ? void 0 : s.eav.get(r);
|
|
2504
2504
|
if (o) {
|
|
2505
|
-
for (const
|
|
2506
|
-
if (((i = e.getAttr(
|
|
2505
|
+
for (const u of o.keys())
|
|
2506
|
+
if (((i = e.getAttr(u)) === null || i === void 0 ? void 0 : i["forward-identity"][1]) == n)
|
|
2507
2507
|
return !0;
|
|
2508
2508
|
}
|
|
2509
2509
|
}
|
|
2510
2510
|
return !1;
|
|
2511
2511
|
}
|
|
2512
2512
|
function Di({ stores: t, attrsStore: e }, [n, r, i, s]) {
|
|
2513
|
-
return (s == null ? void 0 : s.upsert) === !1 ? { mode: "update" } : (s == null ? void 0 : s.upsert) === !0 ? null :
|
|
2513
|
+
return (s == null ? void 0 : s.upsert) === !1 ? { mode: "update" } : (s == null ? void 0 : s.upsert) === !0 ? null : vu(t, e, n, r) ? { mode: "update" } : null;
|
|
2514
2514
|
}
|
|
2515
|
-
function
|
|
2516
|
-
const { attrsStore: n } = t, [r, i, s, o] = e,
|
|
2517
|
-
return [["id",
|
|
2515
|
+
function Su(t, e) {
|
|
2516
|
+
const { attrsStore: n } = t, [r, i, s, o] = e, u = Un(s), a = ee(n, r, i);
|
|
2517
|
+
return [["id", a]].concat(Object.entries(u)).map(([c, f]) => {
|
|
2518
2518
|
const l = K(n, r, c);
|
|
2519
|
-
return l["checked-data-type"] === "date" && t.useDateObjects && (f = xt(f)), ["add-triple",
|
|
2519
|
+
return l["checked-data-type"] === "date" && t.useDateObjects && (f = xt(f)), ["add-triple", a, l.id, f, { mode: "create" }];
|
|
2520
2520
|
});
|
|
2521
2521
|
}
|
|
2522
|
-
function
|
|
2523
|
-
const { attrsStore: n } = t, [r, i, s, o] = e,
|
|
2524
|
-
return [["id",
|
|
2522
|
+
function Ou(t, e) {
|
|
2523
|
+
const { attrsStore: n } = t, [r, i, s, o] = e, u = Un(s), a = ee(n, r, i), d = Di(t, [r, a, s, o]);
|
|
2524
|
+
return [["id", a]].concat(Object.entries(u)).map(([f, l]) => {
|
|
2525
2525
|
const p = K(n, r, f);
|
|
2526
2526
|
return p["checked-data-type"] === "date" && t.useDateObjects && (l = xt(l)), [
|
|
2527
2527
|
"add-triple",
|
|
2528
|
-
|
|
2528
|
+
a,
|
|
2529
2529
|
p.id,
|
|
2530
2530
|
l,
|
|
2531
2531
|
...d ? [d] : []
|
|
2532
2532
|
];
|
|
2533
2533
|
});
|
|
2534
2534
|
}
|
|
2535
|
-
function
|
|
2535
|
+
function Eu({ attrsStore: t }, [e, n]) {
|
|
2536
2536
|
return [["delete-entity", ee(t, e, n), e]];
|
|
2537
2537
|
}
|
|
2538
|
-
function
|
|
2539
|
-
const { attrsStore: n } = t, [r, i, s, o] = e,
|
|
2538
|
+
function Au(t, e) {
|
|
2539
|
+
const { attrsStore: n } = t, [r, i, s, o] = e, u = Un(s), a = ee(n, r, i), d = Di(t, [r, a, s, o]), c = Object.entries(u).map(([l, p]) => {
|
|
2540
2540
|
const y = K(n, r, l);
|
|
2541
2541
|
return [
|
|
2542
2542
|
"deep-merge-triple",
|
|
2543
|
-
|
|
2543
|
+
a,
|
|
2544
2544
|
y.id,
|
|
2545
2545
|
p,
|
|
2546
2546
|
...d ? [d] : []
|
|
@@ -2548,44 +2548,44 @@ function Aa(t, e) {
|
|
|
2548
2548
|
});
|
|
2549
2549
|
return [[
|
|
2550
2550
|
"add-triple",
|
|
2551
|
-
|
|
2551
|
+
a,
|
|
2552
2552
|
K(n, r, "id").id,
|
|
2553
|
-
|
|
2553
|
+
a,
|
|
2554
2554
|
...d ? [d] : []
|
|
2555
2555
|
]].concat(c);
|
|
2556
2556
|
}
|
|
2557
|
-
function
|
|
2557
|
+
function ku({ attrsStore: t }, [e, n, r]) {
|
|
2558
2558
|
return [["rule-params", ee(t, e, n), e, r]];
|
|
2559
2559
|
}
|
|
2560
|
-
function
|
|
2560
|
+
function ju(t) {
|
|
2561
2561
|
const [e, n, r, i, s] = t;
|
|
2562
2562
|
if (!i)
|
|
2563
2563
|
return t;
|
|
2564
2564
|
const o = Object.assign({}, i);
|
|
2565
2565
|
return delete o.id, [e, n, r, o, ...s ? [s] : []];
|
|
2566
2566
|
}
|
|
2567
|
-
function
|
|
2568
|
-
const [n, ...r] =
|
|
2567
|
+
function Cu(t, e) {
|
|
2568
|
+
const [n, ...r] = ju(e);
|
|
2569
2569
|
switch (n) {
|
|
2570
2570
|
case "merge":
|
|
2571
|
-
return
|
|
2571
|
+
return Au(t, r);
|
|
2572
2572
|
case "create":
|
|
2573
|
-
return
|
|
2573
|
+
return Su(t, r);
|
|
2574
2574
|
case "update":
|
|
2575
|
-
return
|
|
2575
|
+
return Ou(t, r);
|
|
2576
2576
|
case "link":
|
|
2577
|
-
return
|
|
2577
|
+
return Tu(t, r);
|
|
2578
2578
|
case "unlink":
|
|
2579
|
-
return
|
|
2579
|
+
return mu(t, r);
|
|
2580
2580
|
case "delete":
|
|
2581
|
-
return
|
|
2581
|
+
return Eu(t, r);
|
|
2582
2582
|
case "ruleParams":
|
|
2583
|
-
return
|
|
2583
|
+
return ku(t, r);
|
|
2584
2584
|
default:
|
|
2585
2585
|
throw new Error(`unsupported action ${n}`);
|
|
2586
2586
|
}
|
|
2587
2587
|
}
|
|
2588
|
-
function
|
|
2588
|
+
function Iu(t) {
|
|
2589
2589
|
switch (t) {
|
|
2590
2590
|
case "string":
|
|
2591
2591
|
case "date":
|
|
@@ -2596,29 +2596,29 @@ function Ia(t) {
|
|
|
2596
2596
|
return;
|
|
2597
2597
|
}
|
|
2598
2598
|
}
|
|
2599
|
-
function
|
|
2599
|
+
function Pu(t, e, n) {
|
|
2600
2600
|
var r, i;
|
|
2601
2601
|
const s = (i = (r = t.entities[e]) === null || r === void 0 ? void 0 : r.attrs) === null || i === void 0 ? void 0 : i[n];
|
|
2602
2602
|
if (n === "id")
|
|
2603
2603
|
return null;
|
|
2604
2604
|
if (!s)
|
|
2605
2605
|
throw new Error(`${e}.${n} does not exist in your schema`);
|
|
2606
|
-
const { unique: o, indexed:
|
|
2606
|
+
const { unique: o, indexed: u } = s == null ? void 0 : s.config, a = Iu(s == null ? void 0 : s.valueType);
|
|
2607
2607
|
return {
|
|
2608
|
-
"index?":
|
|
2608
|
+
"index?": u,
|
|
2609
2609
|
"unique?": o,
|
|
2610
|
-
"checked-data-type":
|
|
2610
|
+
"checked-data-type": a
|
|
2611
2611
|
};
|
|
2612
2612
|
}
|
|
2613
2613
|
function wt(t, e, n, r) {
|
|
2614
|
-
const i = t ?
|
|
2615
|
-
return Object.assign(Object.assign({ id: s, "forward-identity":
|
|
2614
|
+
const i = t ? Pu(t, e, n) : null, s = W(), u = [W(), e, n];
|
|
2615
|
+
return Object.assign(Object.assign({ id: s, "forward-identity": u, "value-type": "blob", cardinality: "one", "unique?": !1, "index?": !1, isUnsynced: !0 }, i || {}), r || {});
|
|
2616
2616
|
}
|
|
2617
|
-
function
|
|
2617
|
+
function Mu(t, e, n) {
|
|
2618
2618
|
return Object.values(t.links).find((s) => s.forward.on === e && s.forward.label === n || s.reverse.on === e && s.reverse.label === n);
|
|
2619
2619
|
}
|
|
2620
|
-
function
|
|
2621
|
-
const r =
|
|
2620
|
+
function Ru(t, e, n) {
|
|
2621
|
+
const r = Mu(t, e, n);
|
|
2622
2622
|
if (!r)
|
|
2623
2623
|
throw new Error(`Couldn't find the link ${e}.${n} in your schema`);
|
|
2624
2624
|
const { forward: i, reverse: s } = r;
|
|
@@ -2632,13 +2632,13 @@ function Ra(t, e, n) {
|
|
|
2632
2632
|
};
|
|
2633
2633
|
}
|
|
2634
2634
|
function Cr(t, e, n, r) {
|
|
2635
|
-
const i = t ?
|
|
2635
|
+
const i = t ? Ru(t, e, n) : null, s = W(), o = [W(), e, n], u = [W(), n, e];
|
|
2636
2636
|
return Object.assign(Object.assign({
|
|
2637
2637
|
id: s,
|
|
2638
2638
|
// @ts-ignore: ts thinks it's any[]
|
|
2639
2639
|
"forward-identity": o,
|
|
2640
2640
|
// @ts-ignore: ts thinks it's any[]
|
|
2641
|
-
"reverse-identity":
|
|
2641
|
+
"reverse-identity": u,
|
|
2642
2642
|
"value-type": "ref",
|
|
2643
2643
|
// @ts-ignore: ts thinks it's type string
|
|
2644
2644
|
cardinality: "many",
|
|
@@ -2647,7 +2647,7 @@ function Cr(t, e, n, r) {
|
|
|
2647
2647
|
isUnsynced: !0
|
|
2648
2648
|
}, i || {}), r || {});
|
|
2649
2649
|
}
|
|
2650
|
-
const
|
|
2650
|
+
const xu = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink"]), $u = /* @__PURE__ */ new Set(["link", "unlink"]), Du = /* @__PURE__ */ new Set(["create", "update", "merge"]), Uu = /* @__PURE__ */ new Set([
|
|
2651
2651
|
"link",
|
|
2652
2652
|
"unlink",
|
|
2653
2653
|
"create",
|
|
@@ -2655,30 +2655,30 @@ const xa = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink
|
|
|
2655
2655
|
"merge",
|
|
2656
2656
|
"delete",
|
|
2657
2657
|
"ruleParams"
|
|
2658
|
-
]), bn = { "unique?": !0, "index?": !0 },
|
|
2659
|
-
function
|
|
2658
|
+
]), bn = { "unique?": !0, "index?": !0 }, Lu = Object.assign(Object.assign({}, bn), { cardinality: "one" });
|
|
2659
|
+
function Fu(t) {
|
|
2660
2660
|
const e = [], [n, r, i, s] = t;
|
|
2661
|
-
if (!
|
|
2661
|
+
if (!Uu.has(n))
|
|
2662
2662
|
return e;
|
|
2663
2663
|
const o = yn(i);
|
|
2664
2664
|
if (o && e.push({ etype: r, lookupPair: o }), n === "link")
|
|
2665
|
-
for (const [
|
|
2666
|
-
const d = Array.isArray(
|
|
2665
|
+
for (const [u, a] of Object.entries(s)) {
|
|
2666
|
+
const d = Array.isArray(a) ? a : [a];
|
|
2667
2667
|
for (const c of d) {
|
|
2668
2668
|
const f = yn(c);
|
|
2669
2669
|
f && e.push({
|
|
2670
2670
|
etype: r,
|
|
2671
2671
|
lookupPair: f,
|
|
2672
|
-
linkLabel:
|
|
2672
|
+
linkLabel: u
|
|
2673
2673
|
});
|
|
2674
2674
|
}
|
|
2675
2675
|
}
|
|
2676
2676
|
return e;
|
|
2677
2677
|
}
|
|
2678
|
-
function
|
|
2678
|
+
function Nu({ attrsStore: t, schema: e }, n) {
|
|
2679
2679
|
var r, i;
|
|
2680
|
-
const s = /* @__PURE__ */ new Set(), o = [],
|
|
2681
|
-
function
|
|
2680
|
+
const s = /* @__PURE__ */ new Set(), o = [], u = [];
|
|
2681
|
+
function a(y, b) {
|
|
2682
2682
|
return K(t, y, b) || o.find((_) => _["forward-identity"][1] === y && _["forward-identity"][2] === b);
|
|
2683
2683
|
}
|
|
2684
2684
|
function d(y, b) {
|
|
@@ -2688,49 +2688,49 @@ function Na({ attrsStore: t, schema: e }, n) {
|
|
|
2688
2688
|
});
|
|
2689
2689
|
}
|
|
2690
2690
|
function c(y) {
|
|
2691
|
-
o.push(y),
|
|
2691
|
+
o.push(y), u.push(["add-attr", y]), s.add(y.id);
|
|
2692
2692
|
}
|
|
2693
2693
|
function f(y) {
|
|
2694
|
-
y && "isUnsynced" in y && y.isUnsynced && !s.has(y.id) && (o.push(y),
|
|
2694
|
+
y && "isUnsynced" in y && y.isUnsynced && !s.has(y.id) && (o.push(y), u.push(["add-attr", y]), s.add(y.id));
|
|
2695
2695
|
}
|
|
2696
2696
|
function l(y, b) {
|
|
2697
2697
|
return b.indexOf(".") !== -1 && // attr names can have `.` in them, so use the attr we find with a `.`
|
|
2698
2698
|
// before assuming it's a ref lookup.
|
|
2699
|
-
!
|
|
2699
|
+
!a(y, b);
|
|
2700
2700
|
}
|
|
2701
2701
|
function p(y, b) {
|
|
2702
|
-
const _ =
|
|
2703
|
-
f(_), f(T), !_ && !T && c(Cr(e, y, b,
|
|
2702
|
+
const _ = a(y, b), T = d(y, b);
|
|
2703
|
+
f(_), f(T), !_ && !T && c(Cr(e, y, b, Lu));
|
|
2704
2704
|
}
|
|
2705
2705
|
for (const y of n)
|
|
2706
|
-
for (const { etype: b, lookupPair: _, linkLabel: T } of
|
|
2706
|
+
for (const { etype: b, lookupPair: _, linkLabel: T } of Fu(y)) {
|
|
2707
2707
|
const g = _[0];
|
|
2708
2708
|
if (T) {
|
|
2709
2709
|
p(b, T);
|
|
2710
|
-
const m =
|
|
2710
|
+
const m = a(b, T), O = d(b, T);
|
|
2711
2711
|
f(m), f(O);
|
|
2712
2712
|
const S = ((r = m == null ? void 0 : m["reverse-identity"]) === null || r === void 0 ? void 0 : r[1]) || ((i = O == null ? void 0 : O["forward-identity"]) === null || i === void 0 ? void 0 : i[1]) || T;
|
|
2713
2713
|
if (l(S, g))
|
|
2714
2714
|
p(S, pn(g));
|
|
2715
2715
|
else {
|
|
2716
|
-
const C =
|
|
2716
|
+
const C = a(S, g);
|
|
2717
2717
|
C || c(wt(e, S, g, bn)), f(C);
|
|
2718
2718
|
}
|
|
2719
2719
|
} else if (l(b, g))
|
|
2720
2720
|
p(b, pn(g));
|
|
2721
2721
|
else {
|
|
2722
|
-
const m =
|
|
2722
|
+
const m = a(b, g);
|
|
2723
2723
|
m || c(wt(e, b, g, bn)), f(m);
|
|
2724
2724
|
}
|
|
2725
2725
|
}
|
|
2726
2726
|
for (const y of n) {
|
|
2727
2727
|
const [b, _, T, g] = y;
|
|
2728
|
-
if (
|
|
2729
|
-
const m =
|
|
2728
|
+
if (xu.has(b)) {
|
|
2729
|
+
const m = a(_, "id");
|
|
2730
2730
|
f(m), m || c(wt(e, _, "id", { "unique?": !0 }));
|
|
2731
2731
|
for (const O of Object.keys(g)) {
|
|
2732
|
-
const S =
|
|
2733
|
-
if (f(S),
|
|
2732
|
+
const S = a(_, O);
|
|
2733
|
+
if (f(S), Du.has(b) && (S || c(wt(e, _, O, O === "id" ? { "unique?": !0 } : null))), $u.has(b)) {
|
|
2734
2734
|
const C = d(_, O);
|
|
2735
2735
|
!S && !C && c(Cr(e, _, O)), f(C);
|
|
2736
2736
|
}
|
|
@@ -2741,13 +2741,13 @@ function Na({ attrsStore: t, schema: e }, n) {
|
|
|
2741
2741
|
const y = Object.assign({}, t.attrs);
|
|
2742
2742
|
for (const b of o)
|
|
2743
2743
|
y[b.id] = b;
|
|
2744
|
-
return [new Ae(y, t.linkIndex),
|
|
2744
|
+
return [new Ae(y, t.linkIndex), u];
|
|
2745
2745
|
}
|
|
2746
|
-
return [t,
|
|
2746
|
+
return [t, u];
|
|
2747
2747
|
}
|
|
2748
|
-
function
|
|
2749
|
-
const r = (Array.isArray(e) ? e : [e]).flatMap((
|
|
2750
|
-
return [...s, ...
|
|
2748
|
+
function Ku(t, e) {
|
|
2749
|
+
const r = (Array.isArray(e) ? e : [e]).flatMap((a) => yu(a)), [i, s] = Nu(t, r), o = Object.assign(Object.assign({}, t), { attrsStore: i }), u = r.flatMap((a) => Cu(o, a));
|
|
2750
|
+
return [...s, ...u];
|
|
2751
2751
|
}
|
|
2752
2752
|
var de = function(t, e, n, r) {
|
|
2753
2753
|
function i(s) {
|
|
@@ -2756,14 +2756,14 @@ var de = function(t, e, n, r) {
|
|
|
2756
2756
|
});
|
|
2757
2757
|
}
|
|
2758
2758
|
return new (n || (n = Promise))(function(s, o) {
|
|
2759
|
-
function
|
|
2759
|
+
function u(c) {
|
|
2760
2760
|
try {
|
|
2761
2761
|
d(r.next(c));
|
|
2762
2762
|
} catch (f) {
|
|
2763
2763
|
o(f);
|
|
2764
2764
|
}
|
|
2765
2765
|
}
|
|
2766
|
-
function
|
|
2766
|
+
function a(c) {
|
|
2767
2767
|
try {
|
|
2768
2768
|
d(r.throw(c));
|
|
2769
2769
|
} catch (f) {
|
|
@@ -2771,7 +2771,7 @@ var de = function(t, e, n, r) {
|
|
|
2771
2771
|
}
|
|
2772
2772
|
}
|
|
2773
2773
|
function d(c) {
|
|
2774
|
-
c.done ? s(c.value) : i(c.value).then(
|
|
2774
|
+
c.done ? s(c.value) : i(c.value).then(u, a);
|
|
2775
2775
|
}
|
|
2776
2776
|
d((r = r.apply(t, e || [])).next());
|
|
2777
2777
|
});
|
|
@@ -2780,7 +2780,7 @@ function Ir(t, e) {
|
|
|
2780
2780
|
typeof requestIdleCallback > "u" ? t() : requestIdleCallback(t, { timeout: e });
|
|
2781
2781
|
}
|
|
2782
2782
|
const rt = "__meta";
|
|
2783
|
-
class
|
|
2783
|
+
class qu {
|
|
2784
2784
|
constructor(e, n) {
|
|
2785
2785
|
}
|
|
2786
2786
|
}
|
|
@@ -2804,8 +2804,8 @@ class _n {
|
|
|
2804
2804
|
this._meta.loadingPromise = i;
|
|
2805
2805
|
const s = yield i;
|
|
2806
2806
|
this._meta.isLoading = !1, this._meta.error = null, this._meta.loadingPromise = null, this._meta.attempts = 0;
|
|
2807
|
-
const o = (n = (e = this._meta.value) === null || e === void 0 ? void 0 : e.objects) !== null && n !== void 0 ? n : {},
|
|
2808
|
-
this._meta.value = Object.assign(Object.assign({},
|
|
2807
|
+
const o = (n = (e = this._meta.value) === null || e === void 0 ? void 0 : e.objects) !== null && n !== void 0 ? n : {}, u = s ?? {}, a = (r = u.objects) !== null && r !== void 0 ? r : {};
|
|
2808
|
+
this._meta.value = Object.assign(Object.assign({}, u), { objects: Object.assign(Object.assign({}, o), a) });
|
|
2809
2809
|
} catch (i) {
|
|
2810
2810
|
this._meta.error = i, this._meta.attempts++, this._meta.loadingPromise = null;
|
|
2811
2811
|
}
|
|
@@ -2827,7 +2827,7 @@ class _n {
|
|
|
2827
2827
|
if (!n)
|
|
2828
2828
|
return;
|
|
2829
2829
|
const r = Object.entries(n.objects);
|
|
2830
|
-
r.sort(([i, s], [o,
|
|
2830
|
+
r.sort(([i, s], [o, u]) => u.updatedAt - s.updatedAt);
|
|
2831
2831
|
for (const [i] of r.slice(0, e))
|
|
2832
2832
|
this._loadKey(i);
|
|
2833
2833
|
});
|
|
@@ -2889,16 +2889,16 @@ class _n {
|
|
|
2889
2889
|
const o = this._meta.value;
|
|
2890
2890
|
if (!o)
|
|
2891
2891
|
return Promise.resolve(0);
|
|
2892
|
-
const
|
|
2892
|
+
const u = [], a = [];
|
|
2893
2893
|
for (const p of this._pendingSaveKeys)
|
|
2894
|
-
p in this.currentValue ?
|
|
2895
|
-
for (const p of
|
|
2894
|
+
p in this.currentValue ? a.push(p) : (u.push(p), delete o.objects[p]);
|
|
2895
|
+
for (const p of u) {
|
|
2896
2896
|
const y = this._persister.removeItem(p);
|
|
2897
2897
|
i.push(y.then(() => 1)), this._loadedKeys.delete(p), this._pendingSaveKeys.delete(p);
|
|
2898
2898
|
}
|
|
2899
2899
|
const d = [], c = [[rt, o]], f = (n = o.objects) !== null && n !== void 0 ? n : {};
|
|
2900
2900
|
o.objects = f;
|
|
2901
|
-
for (const p of
|
|
2901
|
+
for (const p of a)
|
|
2902
2902
|
if (this._loadedKeys.has(p)) {
|
|
2903
2903
|
const y = this.serialize(p, this.currentValue[p]);
|
|
2904
2904
|
c.push([p, y]);
|
|
@@ -2955,11 +2955,11 @@ class _n {
|
|
|
2955
2955
|
const o = Date.now();
|
|
2956
2956
|
for (const [l, p] of Object.entries(r.objects))
|
|
2957
2957
|
!n.has(l) && p.updatedAt < o - this._gcOpts.maxAgeMs && (i.push(this._persister.removeItem(l)), delete r.objects[l], s.removed.push(l), s.removedOldCount++);
|
|
2958
|
-
const
|
|
2959
|
-
|
|
2960
|
-
const
|
|
2961
|
-
if (
|
|
2962
|
-
for (const [l] of
|
|
2958
|
+
const u = Object.entries(r.objects);
|
|
2959
|
+
u.sort(([l, p], [y, b]) => p.updatedAt - b.updatedAt);
|
|
2960
|
+
const a = u.filter(([l]) => !n.has(l));
|
|
2961
|
+
if (u.length > this._gcOpts.maxEntries)
|
|
2962
|
+
for (const [l] of a.slice(0, u.length - this._gcOpts.maxEntries))
|
|
2963
2963
|
i.push(this._persister.removeItem(l)), delete r.objects[l], s.removed.push(l), s.removedThresholdCount++;
|
|
2964
2964
|
const d = Object.entries(r.objects);
|
|
2965
2965
|
d.sort(([l, p], [y, b]) => p.updatedAt - b.updatedAt);
|
|
@@ -3032,14 +3032,14 @@ var ye = function(t, e, n, r) {
|
|
|
3032
3032
|
});
|
|
3033
3033
|
}
|
|
3034
3034
|
return new (n || (n = Promise))(function(s, o) {
|
|
3035
|
-
function
|
|
3035
|
+
function u(c) {
|
|
3036
3036
|
try {
|
|
3037
3037
|
d(r.next(c));
|
|
3038
3038
|
} catch (f) {
|
|
3039
3039
|
o(f);
|
|
3040
3040
|
}
|
|
3041
3041
|
}
|
|
3042
|
-
function
|
|
3042
|
+
function a(c) {
|
|
3043
3043
|
try {
|
|
3044
3044
|
d(r.throw(c));
|
|
3045
3045
|
} catch (f) {
|
|
@@ -3047,18 +3047,18 @@ var ye = function(t, e, n, r) {
|
|
|
3047
3047
|
}
|
|
3048
3048
|
}
|
|
3049
3049
|
function d(c) {
|
|
3050
|
-
c.done ? s(c.value) : i(c.value).then(
|
|
3050
|
+
c.done ? s(c.value) : i(c.value).then(u, a);
|
|
3051
3051
|
}
|
|
3052
3052
|
d((r = r.apply(t, e || [])).next());
|
|
3053
3053
|
});
|
|
3054
3054
|
};
|
|
3055
|
-
const
|
|
3056
|
-
function
|
|
3055
|
+
const Wu = 6, zu = ["kv", "querySubs", "syncSubs"];
|
|
3056
|
+
function Vu(t) {
|
|
3057
3057
|
return function(n) {
|
|
3058
3058
|
console.error("Error in IndexedDB event", { source: t, event: n });
|
|
3059
3059
|
};
|
|
3060
3060
|
}
|
|
3061
|
-
function
|
|
3061
|
+
function Bu(t) {
|
|
3062
3062
|
return ye(this, void 0, void 0, function* () {
|
|
3063
3063
|
return new Promise((e) => {
|
|
3064
3064
|
const n = indexedDB.open(t);
|
|
@@ -3074,7 +3074,7 @@ function Ba(t) {
|
|
|
3074
3074
|
});
|
|
3075
3075
|
});
|
|
3076
3076
|
}
|
|
3077
|
-
function
|
|
3077
|
+
function Gu(t, e, n) {
|
|
3078
3078
|
return ye(this, void 0, void 0, function* () {
|
|
3079
3079
|
const r = (
|
|
3080
3080
|
// Backwards compatibility for older versions where we JSON.stringified before storing
|
|
@@ -3084,7 +3084,7 @@ function Ga(t, e, n) {
|
|
|
3084
3084
|
return;
|
|
3085
3085
|
const i = /* @__PURE__ */ new Set();
|
|
3086
3086
|
return new Promise((s, o) => {
|
|
3087
|
-
var
|
|
3087
|
+
var u, a, d, c;
|
|
3088
3088
|
const f = {};
|
|
3089
3089
|
for (const [y, b] of Object.entries(r)) {
|
|
3090
3090
|
const _ = typeof b == "string" ? JSON.parse(b) : b;
|
|
@@ -3092,7 +3092,7 @@ function Ga(t, e, n) {
|
|
|
3092
3092
|
const g = {
|
|
3093
3093
|
createdAt: _.lastAccessed,
|
|
3094
3094
|
updatedAt: _.lastAccessed,
|
|
3095
|
-
size: (c = (d = (
|
|
3095
|
+
size: (c = (d = (a = (u = _.result) === null || u === void 0 ? void 0 : u.store) === null || a === void 0 ? void 0 : a.triples) === null || d === void 0 ? void 0 : d.length) !== null && c !== void 0 ? c : 0
|
|
3096
3096
|
};
|
|
3097
3097
|
f[y] = g;
|
|
3098
3098
|
}
|
|
@@ -3118,9 +3118,9 @@ function Pr(t, e, n) {
|
|
|
3118
3118
|
});
|
|
3119
3119
|
});
|
|
3120
3120
|
}
|
|
3121
|
-
function
|
|
3121
|
+
function Qu(t, e) {
|
|
3122
3122
|
return ye(this, void 0, void 0, function* () {
|
|
3123
|
-
const n = yield
|
|
3123
|
+
const n = yield Bu(`instant_${t}_5`);
|
|
3124
3124
|
if (!n)
|
|
3125
3125
|
return;
|
|
3126
3126
|
const r = yield new Promise((c, f) => {
|
|
@@ -3139,36 +3139,36 @@ function Qa(t, e) {
|
|
|
3139
3139
|
}, y.onerror = (_) => {
|
|
3140
3140
|
f(_);
|
|
3141
3141
|
};
|
|
3142
|
-
}), i = e.transaction(["kv", "querySubs"], "readwrite"), s = i.objectStore("kv"), o = i.objectStore("querySubs"),
|
|
3142
|
+
}), i = e.transaction(["kv", "querySubs"], "readwrite"), s = i.objectStore("kv"), o = i.objectStore("querySubs"), u = [], a = { objects: {} };
|
|
3143
3143
|
for (const [c, f] of r)
|
|
3144
3144
|
switch (c) {
|
|
3145
3145
|
case "querySubs": {
|
|
3146
|
-
const l =
|
|
3147
|
-
|
|
3146
|
+
const l = Gu(c, f, o);
|
|
3147
|
+
u.push(l);
|
|
3148
3148
|
break;
|
|
3149
3149
|
}
|
|
3150
3150
|
default: {
|
|
3151
3151
|
const l = Pr(c, f, s);
|
|
3152
|
-
|
|
3152
|
+
u.push(l);
|
|
3153
3153
|
const p = {
|
|
3154
3154
|
createdAt: Date.now(),
|
|
3155
3155
|
updatedAt: Date.now(),
|
|
3156
3156
|
size: 0
|
|
3157
3157
|
};
|
|
3158
|
-
|
|
3158
|
+
a.objects[c] = p;
|
|
3159
3159
|
break;
|
|
3160
3160
|
}
|
|
3161
3161
|
}
|
|
3162
|
-
const d = Pr(rt,
|
|
3163
|
-
|
|
3162
|
+
const d = Pr(rt, a, s);
|
|
3163
|
+
u.push(d), yield Promise.all(u), yield new Promise((c, f) => {
|
|
3164
3164
|
i.oncomplete = (l) => c(l), i.onerror = (l) => f(l), i.onabort = (l) => f(l);
|
|
3165
3165
|
});
|
|
3166
3166
|
});
|
|
3167
3167
|
}
|
|
3168
3168
|
const Mr = /* @__PURE__ */ new Map();
|
|
3169
|
-
class Ui extends
|
|
3169
|
+
class Ui extends qu {
|
|
3170
3170
|
constructor(e, n) {
|
|
3171
|
-
super(e, n), this.dbName = `instant_${e}_${
|
|
3171
|
+
super(e, n), this.dbName = `instant_${e}_${Wu}`, this._storeName = n, this._appId = e, this._dbPromise = this._init();
|
|
3172
3172
|
}
|
|
3173
3173
|
_init() {
|
|
3174
3174
|
return new Promise((e, n) => {
|
|
@@ -3177,15 +3177,15 @@ class Ui extends qa {
|
|
|
3177
3177
|
i.onerror = (s) => {
|
|
3178
3178
|
n(s);
|
|
3179
3179
|
}, i.onsuccess = (s) => {
|
|
3180
|
-
const
|
|
3180
|
+
const u = s.target.result;
|
|
3181
3181
|
if (r) {
|
|
3182
|
-
const
|
|
3183
|
-
|
|
3182
|
+
const a = Qu(this._appId, u).catch((d) => {
|
|
3183
|
+
Vu("Error upgrading store from version 5 to 6.")(d);
|
|
3184
3184
|
});
|
|
3185
|
-
Mr.set(this.dbName,
|
|
3185
|
+
Mr.set(this.dbName, a), a.then(() => e(u)).catch(() => e(u));
|
|
3186
3186
|
} else {
|
|
3187
|
-
const
|
|
3188
|
-
|
|
3187
|
+
const a = Mr.get(this.dbName);
|
|
3188
|
+
a ? a.then(() => e(u)).catch(() => e(u)) : e(u);
|
|
3189
3189
|
}
|
|
3190
3190
|
}, i.onupgradeneeded = (s) => {
|
|
3191
3191
|
r = !0, this._upgradeStore(s);
|
|
@@ -3194,18 +3194,18 @@ class Ui extends qa {
|
|
|
3194
3194
|
}
|
|
3195
3195
|
_upgradeStore(e) {
|
|
3196
3196
|
const r = e.target.result;
|
|
3197
|
-
for (const i of
|
|
3197
|
+
for (const i of zu)
|
|
3198
3198
|
r.objectStoreNames.contains(i) || r.createObjectStore(i);
|
|
3199
3199
|
}
|
|
3200
3200
|
getItem(e) {
|
|
3201
3201
|
return ye(this, void 0, void 0, function* () {
|
|
3202
3202
|
const n = yield this._dbPromise;
|
|
3203
3203
|
return new Promise((r, i) => {
|
|
3204
|
-
const
|
|
3205
|
-
|
|
3206
|
-
i(
|
|
3207
|
-
},
|
|
3208
|
-
|
|
3204
|
+
const u = n.transaction([this._storeName], "readonly").objectStore(this._storeName).get(e);
|
|
3205
|
+
u.onerror = (a) => {
|
|
3206
|
+
i(a);
|
|
3207
|
+
}, u.onsuccess = (a) => {
|
|
3208
|
+
u.result ? r(u.result) : r(null);
|
|
3209
3209
|
};
|
|
3210
3210
|
});
|
|
3211
3211
|
});
|
|
@@ -3214,10 +3214,10 @@ class Ui extends qa {
|
|
|
3214
3214
|
return ye(this, void 0, void 0, function* () {
|
|
3215
3215
|
const r = yield this._dbPromise;
|
|
3216
3216
|
return new Promise((i, s) => {
|
|
3217
|
-
const
|
|
3218
|
-
|
|
3217
|
+
const a = r.transaction([this._storeName], "readwrite").objectStore(this._storeName).put(n, e);
|
|
3218
|
+
a.onerror = (d) => {
|
|
3219
3219
|
s(d);
|
|
3220
|
-
},
|
|
3220
|
+
}, a.onsuccess = (d) => {
|
|
3221
3221
|
i();
|
|
3222
3222
|
};
|
|
3223
3223
|
});
|
|
@@ -3228,16 +3228,16 @@ class Ui extends qa {
|
|
|
3228
3228
|
return ye(this, void 0, void 0, function* () {
|
|
3229
3229
|
const n = yield this._dbPromise;
|
|
3230
3230
|
return new Promise((r, i) => {
|
|
3231
|
-
const s = n.transaction([this._storeName], "readwrite"), o = s.objectStore(this._storeName),
|
|
3232
|
-
for (const [
|
|
3233
|
-
const c = o.put(d,
|
|
3234
|
-
|
|
3231
|
+
const s = n.transaction([this._storeName], "readwrite"), o = s.objectStore(this._storeName), u = /* @__PURE__ */ new Set();
|
|
3232
|
+
for (const [a, d] of e) {
|
|
3233
|
+
const c = o.put(d, a);
|
|
3234
|
+
u.add(c);
|
|
3235
3235
|
}
|
|
3236
|
-
for (const
|
|
3237
|
-
|
|
3236
|
+
for (const a of u)
|
|
3237
|
+
a.onerror = (d) => {
|
|
3238
3238
|
s.abort(), i(d);
|
|
3239
|
-
},
|
|
3240
|
-
|
|
3239
|
+
}, a.onsuccess = (d) => {
|
|
3240
|
+
u.delete(a), u.size === 0 && r();
|
|
3241
3241
|
};
|
|
3242
3242
|
});
|
|
3243
3243
|
});
|
|
@@ -3246,10 +3246,10 @@ class Ui extends qa {
|
|
|
3246
3246
|
return ye(this, void 0, void 0, function* () {
|
|
3247
3247
|
const n = yield this._dbPromise;
|
|
3248
3248
|
return new Promise((r, i) => {
|
|
3249
|
-
const
|
|
3250
|
-
|
|
3251
|
-
i(
|
|
3252
|
-
},
|
|
3249
|
+
const u = n.transaction([this._storeName], "readwrite").objectStore(this._storeName).delete(e);
|
|
3250
|
+
u.onerror = (a) => {
|
|
3251
|
+
i(a);
|
|
3252
|
+
}, u.onsuccess = (a) => {
|
|
3253
3253
|
r();
|
|
3254
3254
|
};
|
|
3255
3255
|
});
|
|
@@ -3260,30 +3260,30 @@ class Ui extends qa {
|
|
|
3260
3260
|
const e = yield this._dbPromise;
|
|
3261
3261
|
return new Promise((n, r) => {
|
|
3262
3262
|
const o = e.transaction([this._storeName], "readonly").objectStore(this._storeName).getAllKeys();
|
|
3263
|
-
o.onerror = (
|
|
3264
|
-
r(
|
|
3265
|
-
}, o.onsuccess = (
|
|
3266
|
-
n(o.result.filter((
|
|
3263
|
+
o.onerror = (u) => {
|
|
3264
|
+
r(u);
|
|
3265
|
+
}, o.onsuccess = (u) => {
|
|
3266
|
+
n(o.result.filter((a) => typeof a == "string"));
|
|
3267
3267
|
};
|
|
3268
3268
|
});
|
|
3269
3269
|
});
|
|
3270
3270
|
}
|
|
3271
3271
|
}
|
|
3272
|
-
var
|
|
3272
|
+
var Hu = function(t, e, n, r) {
|
|
3273
3273
|
function i(s) {
|
|
3274
3274
|
return s instanceof n ? s : new n(function(o) {
|
|
3275
3275
|
o(s);
|
|
3276
3276
|
});
|
|
3277
3277
|
}
|
|
3278
3278
|
return new (n || (n = Promise))(function(s, o) {
|
|
3279
|
-
function
|
|
3279
|
+
function u(c) {
|
|
3280
3280
|
try {
|
|
3281
3281
|
d(r.next(c));
|
|
3282
3282
|
} catch (f) {
|
|
3283
3283
|
o(f);
|
|
3284
3284
|
}
|
|
3285
3285
|
}
|
|
3286
|
-
function
|
|
3286
|
+
function a(c) {
|
|
3287
3287
|
try {
|
|
3288
3288
|
d(r.throw(c));
|
|
3289
3289
|
} catch (f) {
|
|
@@ -3291,14 +3291,14 @@ var Ha = function(t, e, n, r) {
|
|
|
3291
3291
|
}
|
|
3292
3292
|
}
|
|
3293
3293
|
function d(c) {
|
|
3294
|
-
c.done ? s(c.value) : i(c.value).then(
|
|
3294
|
+
c.done ? s(c.value) : i(c.value).then(u, a);
|
|
3295
3295
|
}
|
|
3296
3296
|
d((r = r.apply(t, e || [])).next());
|
|
3297
3297
|
});
|
|
3298
3298
|
};
|
|
3299
3299
|
class Li {
|
|
3300
3300
|
static getIsOnline() {
|
|
3301
|
-
return
|
|
3301
|
+
return Hu(this, void 0, void 0, function* () {
|
|
3302
3302
|
return navigator.onLine;
|
|
3303
3303
|
});
|
|
3304
3304
|
}
|
|
@@ -3323,21 +3323,21 @@ class qe extends Error {
|
|
|
3323
3323
|
return "InstantError";
|
|
3324
3324
|
}
|
|
3325
3325
|
}
|
|
3326
|
-
var
|
|
3326
|
+
var Yu = function(t, e, n, r) {
|
|
3327
3327
|
function i(s) {
|
|
3328
3328
|
return s instanceof n ? s : new n(function(o) {
|
|
3329
3329
|
o(s);
|
|
3330
3330
|
});
|
|
3331
3331
|
}
|
|
3332
3332
|
return new (n || (n = Promise))(function(s, o) {
|
|
3333
|
-
function
|
|
3333
|
+
function u(c) {
|
|
3334
3334
|
try {
|
|
3335
3335
|
d(r.next(c));
|
|
3336
3336
|
} catch (f) {
|
|
3337
3337
|
o(f);
|
|
3338
3338
|
}
|
|
3339
3339
|
}
|
|
3340
|
-
function
|
|
3340
|
+
function a(c) {
|
|
3341
3341
|
try {
|
|
3342
3342
|
d(r.throw(c));
|
|
3343
3343
|
} catch (f) {
|
|
@@ -3345,7 +3345,7 @@ var Ya = function(t, e, n, r) {
|
|
|
3345
3345
|
}
|
|
3346
3346
|
}
|
|
3347
3347
|
function d(c) {
|
|
3348
|
-
c.done ? s(c.value) : i(c.value).then(
|
|
3348
|
+
c.done ? s(c.value) : i(c.value).then(u, a);
|
|
3349
3349
|
}
|
|
3350
3350
|
d((r = r.apply(t, e || [])).next());
|
|
3351
3351
|
});
|
|
@@ -3362,8 +3362,8 @@ class Dt extends qe {
|
|
|
3362
3362
|
return "InstantAPIError";
|
|
3363
3363
|
}
|
|
3364
3364
|
}
|
|
3365
|
-
function
|
|
3366
|
-
return
|
|
3365
|
+
function ae(t, e) {
|
|
3366
|
+
return Yu(this, void 0, void 0, function* () {
|
|
3367
3367
|
const n = yield fetch(t, e), r = yield n.json();
|
|
3368
3368
|
return n.status === 200 ? Promise.resolve(r) : Promise.reject(new Dt({ status: n.status, body: r }));
|
|
3369
3369
|
});
|
|
@@ -3375,14 +3375,14 @@ var ze = function(t, e, n, r) {
|
|
|
3375
3375
|
});
|
|
3376
3376
|
}
|
|
3377
3377
|
return new (n || (n = Promise))(function(s, o) {
|
|
3378
|
-
function
|
|
3378
|
+
function u(c) {
|
|
3379
3379
|
try {
|
|
3380
3380
|
d(r.next(c));
|
|
3381
3381
|
} catch (f) {
|
|
3382
3382
|
o(f);
|
|
3383
3383
|
}
|
|
3384
3384
|
}
|
|
3385
|
-
function
|
|
3385
|
+
function a(c) {
|
|
3386
3386
|
try {
|
|
3387
3387
|
d(r.throw(c));
|
|
3388
3388
|
} catch (f) {
|
|
@@ -3390,21 +3390,21 @@ var ze = function(t, e, n, r) {
|
|
|
3390
3390
|
}
|
|
3391
3391
|
}
|
|
3392
3392
|
function d(c) {
|
|
3393
|
-
c.done ? s(c.value) : i(c.value).then(
|
|
3393
|
+
c.done ? s(c.value) : i(c.value).then(u, a);
|
|
3394
3394
|
}
|
|
3395
3395
|
d((r = r.apply(t, e || [])).next());
|
|
3396
3396
|
});
|
|
3397
3397
|
};
|
|
3398
|
-
function
|
|
3399
|
-
return
|
|
3398
|
+
function Ju({ apiURI: t, appId: e, email: n }) {
|
|
3399
|
+
return ae(`${t}/runtime/auth/send_magic_code`, {
|
|
3400
3400
|
method: "POST",
|
|
3401
3401
|
headers: { "content-type": "application/json" },
|
|
3402
3402
|
body: JSON.stringify({ "app-id": e, email: n })
|
|
3403
3403
|
});
|
|
3404
3404
|
}
|
|
3405
|
-
function
|
|
3405
|
+
function Zu(t) {
|
|
3406
3406
|
return ze(this, arguments, void 0, function* ({ apiURI: e, appId: n, email: r, code: i, refreshToken: s }) {
|
|
3407
|
-
return yield
|
|
3407
|
+
return yield ae(`${e}/runtime/auth/verify_magic_code`, {
|
|
3408
3408
|
method: "POST",
|
|
3409
3409
|
headers: { "content-type": "application/json" },
|
|
3410
3410
|
body: JSON.stringify(Object.assign({
|
|
@@ -3415,9 +3415,9 @@ function Za(t) {
|
|
|
3415
3415
|
});
|
|
3416
3416
|
});
|
|
3417
3417
|
}
|
|
3418
|
-
function
|
|
3418
|
+
function Xu(t) {
|
|
3419
3419
|
return ze(this, arguments, void 0, function* ({ apiURI: e, appId: n, refreshToken: r }) {
|
|
3420
|
-
return yield
|
|
3420
|
+
return yield ae(`${e}/runtime/auth/verify_refresh_token`, {
|
|
3421
3421
|
method: "POST",
|
|
3422
3422
|
headers: { "content-type": "application/json" },
|
|
3423
3423
|
body: JSON.stringify({
|
|
@@ -3427,9 +3427,9 @@ function Xa(t) {
|
|
|
3427
3427
|
});
|
|
3428
3428
|
});
|
|
3429
3429
|
}
|
|
3430
|
-
function
|
|
3430
|
+
function ea(t) {
|
|
3431
3431
|
return ze(this, arguments, void 0, function* ({ apiURI: e, appId: n }) {
|
|
3432
|
-
return yield
|
|
3432
|
+
return yield ae(`${e}/runtime/auth/sign_in_guest`, {
|
|
3433
3433
|
method: "POST",
|
|
3434
3434
|
headers: { "content-type": "application/json" },
|
|
3435
3435
|
body: JSON.stringify({
|
|
@@ -3440,7 +3440,7 @@ function eu(t) {
|
|
|
3440
3440
|
}
|
|
3441
3441
|
function Rr(t) {
|
|
3442
3442
|
return ze(this, arguments, void 0, function* ({ apiURI: e, appId: n, code: r, codeVerifier: i, refreshToken: s }) {
|
|
3443
|
-
return yield
|
|
3443
|
+
return yield ae(`${e}/runtime/oauth/token`, {
|
|
3444
3444
|
method: "POST",
|
|
3445
3445
|
headers: { "content-type": "application/json" },
|
|
3446
3446
|
body: JSON.stringify({
|
|
@@ -3452,9 +3452,9 @@ function Rr(t) {
|
|
|
3452
3452
|
});
|
|
3453
3453
|
});
|
|
3454
3454
|
}
|
|
3455
|
-
function
|
|
3455
|
+
function ta(t) {
|
|
3456
3456
|
return ze(this, arguments, void 0, function* ({ apiURI: e, appId: n, nonce: r, idToken: i, clientName: s, refreshToken: o }) {
|
|
3457
|
-
return yield
|
|
3457
|
+
return yield ae(`${e}/runtime/oauth/id_token`, {
|
|
3458
3458
|
method: "POST",
|
|
3459
3459
|
headers: { "content-type": "application/json" },
|
|
3460
3460
|
body: JSON.stringify({
|
|
@@ -3467,9 +3467,9 @@ function tu(t) {
|
|
|
3467
3467
|
});
|
|
3468
3468
|
});
|
|
3469
3469
|
}
|
|
3470
|
-
function
|
|
3470
|
+
function na(t) {
|
|
3471
3471
|
return ze(this, arguments, void 0, function* ({ apiURI: e, appId: n, refreshToken: r }) {
|
|
3472
|
-
return yield
|
|
3472
|
+
return yield ae(`${e}/runtime/signout`, {
|
|
3473
3473
|
method: "POST",
|
|
3474
3474
|
headers: {
|
|
3475
3475
|
"content-type": "application/json"
|
|
@@ -3488,14 +3488,14 @@ var dt = function(t, e, n, r) {
|
|
|
3488
3488
|
});
|
|
3489
3489
|
}
|
|
3490
3490
|
return new (n || (n = Promise))(function(s, o) {
|
|
3491
|
-
function
|
|
3491
|
+
function u(c) {
|
|
3492
3492
|
try {
|
|
3493
3493
|
d(r.next(c));
|
|
3494
3494
|
} catch (f) {
|
|
3495
3495
|
o(f);
|
|
3496
3496
|
}
|
|
3497
3497
|
}
|
|
3498
|
-
function
|
|
3498
|
+
function a(c) {
|
|
3499
3499
|
try {
|
|
3500
3500
|
d(r.throw(c));
|
|
3501
3501
|
} catch (f) {
|
|
@@ -3503,29 +3503,29 @@ var dt = function(t, e, n, r) {
|
|
|
3503
3503
|
}
|
|
3504
3504
|
}
|
|
3505
3505
|
function d(c) {
|
|
3506
|
-
c.done ? s(c.value) : i(c.value).then(
|
|
3506
|
+
c.done ? s(c.value) : i(c.value).then(u, a);
|
|
3507
3507
|
}
|
|
3508
3508
|
d((r = r.apply(t, e || [])).next());
|
|
3509
3509
|
});
|
|
3510
3510
|
};
|
|
3511
|
-
function
|
|
3512
|
-
return dt(this, arguments, void 0, function* ({ apiURI: e, appId: n, path: r, file: i, refreshToken: s, contentType: o, contentDisposition:
|
|
3513
|
-
const
|
|
3511
|
+
function ra(t) {
|
|
3512
|
+
return dt(this, arguments, void 0, function* ({ apiURI: e, appId: n, path: r, file: i, refreshToken: s, contentType: o, contentDisposition: u }) {
|
|
3513
|
+
const a = {
|
|
3514
3514
|
app_id: n,
|
|
3515
3515
|
path: r,
|
|
3516
3516
|
authorization: `Bearer ${s}`,
|
|
3517
3517
|
"content-type": o || i.type
|
|
3518
3518
|
};
|
|
3519
|
-
return
|
|
3519
|
+
return u && (a["content-disposition"] = u), yield ae(`${e}/storage/upload`, {
|
|
3520
3520
|
method: "PUT",
|
|
3521
|
-
headers:
|
|
3521
|
+
headers: a,
|
|
3522
3522
|
body: i
|
|
3523
3523
|
});
|
|
3524
3524
|
});
|
|
3525
3525
|
}
|
|
3526
|
-
function
|
|
3526
|
+
function ia(t) {
|
|
3527
3527
|
return dt(this, arguments, void 0, function* ({ apiURI: e, appId: n, path: r, refreshToken: i }) {
|
|
3528
|
-
const { data: s } = yield
|
|
3528
|
+
const { data: s } = yield ae(`${e}/storage/files?app_id=${n}&filename=${encodeURIComponent(r)}`, {
|
|
3529
3529
|
method: "DELETE",
|
|
3530
3530
|
headers: {
|
|
3531
3531
|
"content-type": "application/json",
|
|
@@ -3535,9 +3535,9 @@ function iu(t) {
|
|
|
3535
3535
|
return s;
|
|
3536
3536
|
});
|
|
3537
3537
|
}
|
|
3538
|
-
function
|
|
3538
|
+
function sa(t) {
|
|
3539
3539
|
return dt(this, arguments, void 0, function* ({ apiURI: e, appId: n, fileName: r, refreshToken: i, metadata: s = {} }) {
|
|
3540
|
-
const { data: o } = yield
|
|
3540
|
+
const { data: o } = yield ae(`${e}/storage/signed-upload-url`, {
|
|
3541
3541
|
method: "POST",
|
|
3542
3542
|
headers: {
|
|
3543
3543
|
"content-type": "application/json",
|
|
@@ -3551,7 +3551,7 @@ function su(t) {
|
|
|
3551
3551
|
return o;
|
|
3552
3552
|
});
|
|
3553
3553
|
}
|
|
3554
|
-
function
|
|
3554
|
+
function oa(t, e) {
|
|
3555
3555
|
return dt(this, void 0, void 0, function* () {
|
|
3556
3556
|
return (yield fetch(t, {
|
|
3557
3557
|
method: "PUT",
|
|
@@ -3562,9 +3562,9 @@ function ou(t, e) {
|
|
|
3562
3562
|
})).ok;
|
|
3563
3563
|
});
|
|
3564
3564
|
}
|
|
3565
|
-
function
|
|
3565
|
+
function ua(t) {
|
|
3566
3566
|
return dt(this, arguments, void 0, function* ({ apiURI: e, appId: n, path: r, refreshToken: i }) {
|
|
3567
|
-
const { data: s } = yield
|
|
3567
|
+
const { data: s } = yield ae(`${e}/storage/signed-download-url?app_id=${n}&filename=${encodeURIComponent(r)}`, {
|
|
3568
3568
|
method: "GET",
|
|
3569
3569
|
headers: {
|
|
3570
3570
|
"content-type": "application/json",
|
|
@@ -3584,25 +3584,25 @@ function xr(t, e) {
|
|
|
3584
3584
|
n[r] = t[r];
|
|
3585
3585
|
}), n;
|
|
3586
3586
|
}
|
|
3587
|
-
function
|
|
3587
|
+
function aa(t, e, n) {
|
|
3588
3588
|
var r, i;
|
|
3589
3589
|
const s = {
|
|
3590
3590
|
peers: {}
|
|
3591
3591
|
};
|
|
3592
3592
|
if (e && "user" in e ? e.user : !0) {
|
|
3593
|
-
const
|
|
3594
|
-
s.user = Object.assign(Object.assign({},
|
|
3593
|
+
const u = xr((r = t.user) !== null && r !== void 0 ? r : {}, e == null ? void 0 : e.keys);
|
|
3594
|
+
s.user = Object.assign(Object.assign({}, u), { peerId: n });
|
|
3595
3595
|
}
|
|
3596
|
-
for (const
|
|
3597
|
-
const
|
|
3598
|
-
if (
|
|
3599
|
-
const c = xr(t.peers[
|
|
3600
|
-
s.peers[
|
|
3596
|
+
for (const u of Object.keys((i = t.peers) !== null && i !== void 0 ? i : {})) {
|
|
3597
|
+
const a = (e == null ? void 0 : e.peers) === void 0, d = Array.isArray(e == null ? void 0 : e.peers) && (e == null ? void 0 : e.peers.includes(u));
|
|
3598
|
+
if (a || d) {
|
|
3599
|
+
const c = xr(t.peers[u], e == null ? void 0 : e.keys);
|
|
3600
|
+
s.peers[u] = Object.assign(Object.assign({}, c), { peerId: u });
|
|
3601
3601
|
}
|
|
3602
3602
|
}
|
|
3603
3603
|
return s;
|
|
3604
3604
|
}
|
|
3605
|
-
function
|
|
3605
|
+
function ca(t, e) {
|
|
3606
3606
|
if (t.isLoading !== e.isLoading || t.error !== e.error || (t.user || e.user) && (!t.user || !e.user || !wr(t.user, e.user)) || !yi(t.peers, e.peers))
|
|
3607
3607
|
return !0;
|
|
3608
3608
|
for (const r of Object.keys(t.peers))
|
|
@@ -3627,8 +3627,8 @@ function Ki(t, e = []) {
|
|
|
3627
3627
|
t.forEach((n) => {
|
|
3628
3628
|
const { data: r } = n, { "datalog-result": i } = r, { "join-rows": s } = i;
|
|
3629
3629
|
for (const o of s)
|
|
3630
|
-
for (const
|
|
3631
|
-
e.push(
|
|
3630
|
+
for (const u of o)
|
|
3631
|
+
e.push(u);
|
|
3632
3632
|
Ki(n["child-nodes"], e);
|
|
3633
3633
|
});
|
|
3634
3634
|
}
|
|
@@ -3650,8 +3650,8 @@ function Ur(t) {
|
|
|
3650
3650
|
}, e;
|
|
3651
3651
|
}, {});
|
|
3652
3652
|
}
|
|
3653
|
-
const Wn = "v0.22.92
|
|
3654
|
-
function
|
|
3653
|
+
const Wn = "v0.22.92";
|
|
3654
|
+
function da(t, e) {
|
|
3655
3655
|
return {
|
|
3656
3656
|
info: t ? (...n) => console.info(...n, e()) : () => {
|
|
3657
3657
|
},
|
|
@@ -3735,7 +3735,7 @@ const Lr = [
|
|
|
3735
3735
|
"before",
|
|
3736
3736
|
"fields",
|
|
3737
3737
|
"aggregate"
|
|
3738
|
-
],
|
|
3738
|
+
], fa = (t) => t.valueType || "unknown", qi = (t, e, n = !1) => {
|
|
3739
3739
|
if (n || t == null)
|
|
3740
3740
|
return !0;
|
|
3741
3741
|
switch (e) {
|
|
@@ -3750,9 +3750,9 @@ const Lr = [
|
|
|
3750
3750
|
default:
|
|
3751
3751
|
return !0;
|
|
3752
3752
|
}
|
|
3753
|
-
},
|
|
3754
|
-
const
|
|
3755
|
-
if (!qi(f, c,
|
|
3753
|
+
}, la = (t, e, n, r, i, s, o) => {
|
|
3754
|
+
const u = s.valueType === "json", a = (d, c, f) => {
|
|
3755
|
+
if (!qi(f, c, u))
|
|
3756
3756
|
throw new R(`Invalid value for operator '${d}' on attribute '${r}' in entity '${i}'. Expected ${c}, but received: ${typeof f}`, o);
|
|
3757
3757
|
};
|
|
3758
3758
|
switch (t) {
|
|
@@ -3761,7 +3761,7 @@ const Lr = [
|
|
|
3761
3761
|
if (!Array.isArray(e))
|
|
3762
3762
|
throw new R(`Operator '${t}' for attribute '${r}' in entity '${i}' must be an array, but received: ${typeof e}`, o);
|
|
3763
3763
|
for (const d of e)
|
|
3764
|
-
|
|
3764
|
+
a(t, n, d);
|
|
3765
3765
|
break;
|
|
3766
3766
|
case "$not":
|
|
3767
3767
|
case "$ne":
|
|
@@ -3769,30 +3769,30 @@ const Lr = [
|
|
|
3769
3769
|
case "$lt":
|
|
3770
3770
|
case "$gte":
|
|
3771
3771
|
case "$lte":
|
|
3772
|
-
|
|
3772
|
+
a(t, n, e);
|
|
3773
3773
|
break;
|
|
3774
3774
|
case "$like":
|
|
3775
3775
|
case "$ilike":
|
|
3776
|
-
if (
|
|
3776
|
+
if (a(t, "string", e), t === "$ilike" && !s.isIndexed)
|
|
3777
3777
|
throw new R(`Operator '${t}' can only be used with indexed attributes, but '${r}' in entity '${i}' is not indexed`, o);
|
|
3778
3778
|
break;
|
|
3779
3779
|
case "$isNull":
|
|
3780
|
-
|
|
3780
|
+
a(t, "boolean", e);
|
|
3781
3781
|
break;
|
|
3782
3782
|
default:
|
|
3783
3783
|
throw new R(`Unknown operator '${t}' for attribute '${r}' in entity '${i}'`, o);
|
|
3784
3784
|
}
|
|
3785
3785
|
}, Le = (t, e, n, r, i) => {
|
|
3786
|
-
const s =
|
|
3786
|
+
const s = fa(n), o = n.valueType === "json";
|
|
3787
3787
|
if (typeof t == "object" && t !== null && !Array.isArray(t)) {
|
|
3788
3788
|
if (o)
|
|
3789
3789
|
return;
|
|
3790
|
-
const
|
|
3791
|
-
for (const [d, c] of Object.entries(
|
|
3792
|
-
|
|
3790
|
+
const a = t;
|
|
3791
|
+
for (const [d, c] of Object.entries(a))
|
|
3792
|
+
la(d, c, s, e, r, n, `${i}.${d}`);
|
|
3793
3793
|
} else if (!qi(t, s, o))
|
|
3794
3794
|
throw new R(`Invalid value for attribute '${e}' in entity '${r}'. Expected ${s}, but received: ${typeof t}`, i);
|
|
3795
|
-
},
|
|
3795
|
+
}, ha = (t, e, n, r, i) => {
|
|
3796
3796
|
const s = t.split(".");
|
|
3797
3797
|
if (s.length < 2)
|
|
3798
3798
|
throw new R(`Invalid dot notation path '${t}'. Must contain at least one dot.`, i);
|
|
@@ -3808,25 +3808,25 @@ const Lr = [
|
|
|
3808
3808
|
}
|
|
3809
3809
|
o = p.entityName;
|
|
3810
3810
|
}
|
|
3811
|
-
const
|
|
3812
|
-
if (!
|
|
3811
|
+
const u = s[s.length - 1], a = r.entities[o];
|
|
3812
|
+
if (!a)
|
|
3813
3813
|
throw new R(`Target entity '${o}' does not exist in schema for dot notation path '${t}'.`, i);
|
|
3814
|
-
if (
|
|
3814
|
+
if (u === "id") {
|
|
3815
3815
|
if (typeof e == "string" && !Ne(e))
|
|
3816
3816
|
throw new R(`Invalid value for id field in entity '${o}'. Expected a UUID, but received: ${e}`, i);
|
|
3817
3817
|
Le(e, t, new H("string", !1, !0), n, i);
|
|
3818
3818
|
return;
|
|
3819
3819
|
}
|
|
3820
|
-
const d =
|
|
3821
|
-
if (Object.keys(
|
|
3820
|
+
const d = a.attrs[u];
|
|
3821
|
+
if (Object.keys(a.links).includes(u)) {
|
|
3822
3822
|
if (typeof e == "string" && !Ne(e))
|
|
3823
|
-
throw new R(`Invalid value for link '${
|
|
3823
|
+
throw new R(`Invalid value for link '${u}' in entity '${o}'. Expected a UUID, but received: ${e}`, i);
|
|
3824
3824
|
Le(e, t, new H("string", !1, !0), n, i);
|
|
3825
3825
|
return;
|
|
3826
3826
|
}
|
|
3827
3827
|
if (!d) {
|
|
3828
|
-
const c = Object.keys(
|
|
3829
|
-
throw new R(`Attribute '${
|
|
3828
|
+
const c = Object.keys(a.attrs);
|
|
3829
|
+
throw new R(`Attribute '${u}' does not exist on entity '${o}' in dot notation path '${t}'. Available attributes: ${c.length > 0 ? c.join(", ") + ", id" : "id"}`, i);
|
|
3830
3830
|
}
|
|
3831
3831
|
Le(e, t, d, n, i);
|
|
3832
3832
|
}, Wi = (t, e, n, r) => {
|
|
@@ -3842,27 +3842,27 @@ const Lr = [
|
|
|
3842
3842
|
continue;
|
|
3843
3843
|
}
|
|
3844
3844
|
if (i.includes(".")) {
|
|
3845
|
-
|
|
3845
|
+
ha(i, s, e, n, `${r}.${i}`);
|
|
3846
3846
|
continue;
|
|
3847
3847
|
}
|
|
3848
3848
|
const o = n.entities[e];
|
|
3849
3849
|
if (!o)
|
|
3850
3850
|
continue;
|
|
3851
|
-
const
|
|
3852
|
-
if (!
|
|
3851
|
+
const u = o.attrs[i], a = o.links[i];
|
|
3852
|
+
if (!u && !a) {
|
|
3853
3853
|
const d = Object.keys(o.attrs), c = Object.keys(o.links);
|
|
3854
3854
|
throw new R(`Attribute or link '${i}' does not exist on entity '${e}'. Available attributes: ${d.length > 0 ? d.join(", ") : "none"}. Available links: ${c.length > 0 ? c.join(", ") : "none"}`, `${r}.${i}`);
|
|
3855
3855
|
}
|
|
3856
|
-
if (
|
|
3857
|
-
Le(s, i,
|
|
3858
|
-
else if (
|
|
3856
|
+
if (u)
|
|
3857
|
+
Le(s, i, u, e, `${r}.${i}`);
|
|
3858
|
+
else if (a) {
|
|
3859
3859
|
if (typeof s == "string" && !Ne(s))
|
|
3860
3860
|
throw new R(`Invalid value for link '${i}' in entity '${e}'. Expected a UUID, but received: ${s}`, `${r}.${i}`);
|
|
3861
3861
|
const d = new H("string", !1, !0);
|
|
3862
3862
|
Le(s, i, d, e, `${r}.${i}`);
|
|
3863
3863
|
}
|
|
3864
3864
|
}
|
|
3865
|
-
},
|
|
3865
|
+
}, pa = (t, e, n, r, i = 0) => {
|
|
3866
3866
|
for (const o of Object.keys(t))
|
|
3867
3867
|
if (!Lr.includes(o))
|
|
3868
3868
|
throw new R(`Invalid query parameter '${o}' in $ object. Valid parameters are: ${Lr.join(", ")}. Found: ${o}`, r);
|
|
@@ -3889,19 +3889,19 @@ const Lr = [
|
|
|
3889
3889
|
for (const o of Object.keys(t))
|
|
3890
3890
|
if (o !== "$") {
|
|
3891
3891
|
if (n && !(o in n.entities[e].links)) {
|
|
3892
|
-
const
|
|
3893
|
-
throw new R(`Link '${o}' does not exist on entity '${e}'. Available links: ${
|
|
3892
|
+
const a = Object.keys(n.entities[e].links);
|
|
3893
|
+
throw new R(`Link '${o}' does not exist on entity '${e}'. Available links: ${a.length > 0 ? a.join(", ") : "none"}`, `${r}.${o}`);
|
|
3894
3894
|
}
|
|
3895
|
-
const
|
|
3896
|
-
if (typeof
|
|
3897
|
-
const
|
|
3898
|
-
|
|
3895
|
+
const u = t[o];
|
|
3896
|
+
if (typeof u == "object" && u !== null) {
|
|
3897
|
+
const a = (s = n == null ? void 0 : n.entities[e].links[o]) === null || s === void 0 ? void 0 : s.entityName;
|
|
3898
|
+
a && zi(u, a, n, `${r}.${o}`, i + 1);
|
|
3899
3899
|
}
|
|
3900
3900
|
} else {
|
|
3901
|
-
const
|
|
3902
|
-
if (typeof
|
|
3903
|
-
throw new R(`Query parameter '$' must be an object in entity '${e}', but received: ${typeof
|
|
3904
|
-
|
|
3901
|
+
const u = t[o];
|
|
3902
|
+
if (typeof u != "object" || u === null)
|
|
3903
|
+
throw new R(`Query parameter '$' must be an object in entity '${e}', but received: ${typeof u}`, `${r}.$`);
|
|
3904
|
+
pa(u, e, n, `${r}.$`, i);
|
|
3905
3905
|
}
|
|
3906
3906
|
}, Fr = (t, e) => {
|
|
3907
3907
|
if (typeof t != "object" || t === null)
|
|
@@ -3928,19 +3928,19 @@ class ie extends Error {
|
|
|
3928
3928
|
super(e), this.name = "TransactionValidationError";
|
|
3929
3929
|
}
|
|
3930
3930
|
}
|
|
3931
|
-
const Vi = (t) => t.length > 0 ? t.join(", ") : "none",
|
|
3931
|
+
const Vi = (t) => t.length > 0 ? t.join(", ") : "none", ya = (t, e) => new ie(`Entity '${t}' does not exist in schema. Available entities: ${Vi(e)}`), Kr = {
|
|
3932
3932
|
string: (t) => typeof t == "string",
|
|
3933
3933
|
number: (t) => typeof t == "number" && !isNaN(t),
|
|
3934
3934
|
boolean: (t) => typeof t == "boolean",
|
|
3935
3935
|
date: (t) => t instanceof Date || typeof t == "string" || typeof t == "number",
|
|
3936
3936
|
json: () => !0
|
|
3937
|
-
},
|
|
3937
|
+
}, ba = (t, e) => {
|
|
3938
3938
|
var n, r;
|
|
3939
3939
|
return t == null ? !0 : (r = (n = Kr[e.valueType]) === null || n === void 0 ? void 0 : n.call(Kr, t)) !== null && r !== void 0 ? r : !1;
|
|
3940
3940
|
}, Bi = (t, e) => {
|
|
3941
3941
|
const n = e.entities[t];
|
|
3942
3942
|
if (!n)
|
|
3943
|
-
throw
|
|
3943
|
+
throw ya(t, Object.keys(e.entities));
|
|
3944
3944
|
return n;
|
|
3945
3945
|
}, Yt = (t, e, n) => {
|
|
3946
3946
|
const r = Bi(t, n);
|
|
@@ -3950,7 +3950,7 @@ const Vi = (t) => t.length > 0 ? t.join(", ") : "none", yu = (t, e) => new ie(`E
|
|
|
3950
3950
|
if (i === "id")
|
|
3951
3951
|
continue;
|
|
3952
3952
|
const o = r.attrs[i];
|
|
3953
|
-
if (o && !
|
|
3953
|
+
if (o && !ba(s, o))
|
|
3954
3954
|
throw new ie(`Invalid value for attribute '${i}' in entity '${t}'. Expected ${o.valueType}, but received: ${typeof s}`);
|
|
3955
3955
|
}
|
|
3956
3956
|
}, qr = (t, e, n) => {
|
|
@@ -3959,19 +3959,19 @@ const Vi = (t) => t.length > 0 ? t.join(", ") : "none", yu = (t, e) => new ie(`E
|
|
|
3959
3959
|
throw new ie(`Arguments for link operation on entity '${t}' must be an object, but received: ${typeof e}`);
|
|
3960
3960
|
for (const [i, s] of Object.entries(e)) {
|
|
3961
3961
|
if (!r.links[i]) {
|
|
3962
|
-
const
|
|
3963
|
-
throw new ie(`Link '${i}' does not exist on entity '${t}'. Available links: ${Vi(
|
|
3962
|
+
const u = Object.keys(r.links);
|
|
3963
|
+
throw new ie(`Link '${i}' does not exist on entity '${t}'. Available links: ${Vi(u)}`);
|
|
3964
3964
|
}
|
|
3965
3965
|
if (s != null) {
|
|
3966
3966
|
if (Array.isArray(s)) {
|
|
3967
|
-
for (const
|
|
3968
|
-
if (!Nr(
|
|
3969
|
-
throw new ie(`Invalid entity ID in link '${i}' for entity '${t}'. Expected a UUID or a lookup, but received: ${
|
|
3967
|
+
for (const u of s)
|
|
3968
|
+
if (!Nr(u))
|
|
3969
|
+
throw new ie(`Invalid entity ID in link '${i}' for entity '${t}'. Expected a UUID or a lookup, but received: ${u}`);
|
|
3970
3970
|
} else if (!Nr(s))
|
|
3971
3971
|
throw new ie(`Invalid UUID in link '${i}' for entity '${t}'. Expected a UUID, but received: ${s}`);
|
|
3972
3972
|
}
|
|
3973
3973
|
}
|
|
3974
|
-
},
|
|
3974
|
+
}, _a = {
|
|
3975
3975
|
create: Yt,
|
|
3976
3976
|
update: Yt,
|
|
3977
3977
|
merge: Yt,
|
|
@@ -3979,7 +3979,7 @@ const Vi = (t) => t.length > 0 ? t.join(", ") : "none", yu = (t, e) => new ie(`E
|
|
|
3979
3979
|
unlink: qr,
|
|
3980
3980
|
delete: () => {
|
|
3981
3981
|
}
|
|
3982
|
-
},
|
|
3982
|
+
}, ga = (t, e) => {
|
|
3983
3983
|
if (!e)
|
|
3984
3984
|
return;
|
|
3985
3985
|
const [n, r, i, s] = t;
|
|
@@ -3987,9 +3987,9 @@ const Vi = (t) => t.length > 0 ? t.join(", ") : "none", yu = (t, e) => new ie(`E
|
|
|
3987
3987
|
throw new ie(`Invalid id for entity '${r}'. Expected a UUID, but received: ${i}`);
|
|
3988
3988
|
if (typeof r != "string")
|
|
3989
3989
|
throw new ie(`Entity name must be a string, but received: ${typeof r}`);
|
|
3990
|
-
const o =
|
|
3990
|
+
const o = _a[n];
|
|
3991
3991
|
o && s !== void 0 && o(r, s, e);
|
|
3992
|
-
},
|
|
3992
|
+
}, wa = (t, e) => {
|
|
3993
3993
|
const n = Array.isArray(t) ? t : [t];
|
|
3994
3994
|
for (const r of n) {
|
|
3995
3995
|
if (!r || typeof r != "object")
|
|
@@ -3999,7 +3999,7 @@ const Vi = (t) => t.length > 0 ? t.join(", ") : "none", yu = (t, e) => new ie(`E
|
|
|
3999
3999
|
for (const i of r.__ops) {
|
|
4000
4000
|
if (!Array.isArray(i))
|
|
4001
4001
|
throw new ie(`Transaction operation must be an array, but received: ${typeof i}`);
|
|
4002
|
-
|
|
4002
|
+
ga(i, e);
|
|
4003
4003
|
}
|
|
4004
4004
|
}
|
|
4005
4005
|
};
|
|
@@ -4010,14 +4010,14 @@ var Wr = function(t, e, n, r) {
|
|
|
4010
4010
|
});
|
|
4011
4011
|
}
|
|
4012
4012
|
return new (n || (n = Promise))(function(s, o) {
|
|
4013
|
-
function
|
|
4013
|
+
function u(c) {
|
|
4014
4014
|
try {
|
|
4015
4015
|
d(r.next(c));
|
|
4016
4016
|
} catch (f) {
|
|
4017
4017
|
o(f);
|
|
4018
4018
|
}
|
|
4019
4019
|
}
|
|
4020
|
-
function
|
|
4020
|
+
function a(c) {
|
|
4021
4021
|
try {
|
|
4022
4022
|
d(r.throw(c));
|
|
4023
4023
|
} catch (f) {
|
|
@@ -4025,7 +4025,7 @@ var Wr = function(t, e, n, r) {
|
|
|
4025
4025
|
}
|
|
4026
4026
|
}
|
|
4027
4027
|
function d(c) {
|
|
4028
|
-
c.done ? s(c.value) : i(c.value).then(
|
|
4028
|
+
c.done ? s(c.value) : i(c.value).then(u, a);
|
|
4029
4029
|
}
|
|
4030
4030
|
d((r = r.apply(t, e || [])).next());
|
|
4031
4031
|
});
|
|
@@ -4061,7 +4061,7 @@ class zr {
|
|
|
4061
4061
|
return this.conn.send(JSON.stringify(e));
|
|
4062
4062
|
}
|
|
4063
4063
|
}
|
|
4064
|
-
class
|
|
4064
|
+
class Ta {
|
|
4065
4065
|
constructor(e, n) {
|
|
4066
4066
|
this.type = "sse", this.initParams = null, this.sendQueue = [], this.closeFired = !1, this.sseInitTimeout = void 0, this.id = `${this.type}_${Gi++}`, this.url = n, this.ES = e, this.conn = new e(n), this.sseInitTimeout = setTimeout(() => {
|
|
4067
4067
|
this.initParams || this.handleError();
|
|
@@ -4154,14 +4154,14 @@ var Vr = function(t, e, n, r) {
|
|
|
4154
4154
|
});
|
|
4155
4155
|
}
|
|
4156
4156
|
return new (n || (n = Promise))(function(s, o) {
|
|
4157
|
-
function
|
|
4157
|
+
function u(c) {
|
|
4158
4158
|
try {
|
|
4159
4159
|
d(r.next(c));
|
|
4160
4160
|
} catch (f) {
|
|
4161
4161
|
o(f);
|
|
4162
4162
|
}
|
|
4163
4163
|
}
|
|
4164
|
-
function
|
|
4164
|
+
function a(c) {
|
|
4165
4165
|
try {
|
|
4166
4166
|
d(r.throw(c));
|
|
4167
4167
|
} catch (f) {
|
|
@@ -4169,12 +4169,12 @@ var Vr = function(t, e, n, r) {
|
|
|
4169
4169
|
}
|
|
4170
4170
|
}
|
|
4171
4171
|
function d(c) {
|
|
4172
|
-
c.done ? s(c.value) : i(c.value).then(
|
|
4172
|
+
c.done ? s(c.value) : i(c.value).then(u, a);
|
|
4173
4173
|
}
|
|
4174
4174
|
d((r = r.apply(t, e || [])).next());
|
|
4175
4175
|
});
|
|
4176
4176
|
};
|
|
4177
|
-
function
|
|
4177
|
+
function ma(t, e) {
|
|
4178
4178
|
const n = t.values;
|
|
4179
4179
|
if (n) {
|
|
4180
4180
|
const r = mi(n.attrsStore, null);
|
|
@@ -4186,7 +4186,7 @@ function mu(t, e) {
|
|
|
4186
4186
|
}
|
|
4187
4187
|
return t;
|
|
4188
4188
|
}
|
|
4189
|
-
function
|
|
4189
|
+
function va(t, e) {
|
|
4190
4190
|
var n;
|
|
4191
4191
|
if (e.values) {
|
|
4192
4192
|
const r = [];
|
|
@@ -4198,7 +4198,7 @@ function vu(t, e) {
|
|
|
4198
4198
|
} else
|
|
4199
4199
|
return e;
|
|
4200
4200
|
}
|
|
4201
|
-
function
|
|
4201
|
+
function Sa(t, e, n) {
|
|
4202
4202
|
var r, i;
|
|
4203
4203
|
const s = (r = e == null ? void 0 : e.state) === null || r === void 0 ? void 0 : r.txId, o = (i = n == null ? void 0 : n.state) === null || i === void 0 ? void 0 : i.txId;
|
|
4204
4204
|
return s && (!o || s > o) ? e : o && (!s || o > s) ? n : e || n;
|
|
@@ -4225,17 +4225,17 @@ function Gr(t, e, n) {
|
|
|
4225
4225
|
break;
|
|
4226
4226
|
}
|
|
4227
4227
|
}
|
|
4228
|
-
function
|
|
4228
|
+
function Oa(t, e, n) {
|
|
4229
4229
|
var r, i, s, o;
|
|
4230
|
-
const
|
|
4231
|
-
for (const { action:
|
|
4230
|
+
const u = {};
|
|
4231
|
+
for (const { action: a, triple: d } of n) {
|
|
4232
4232
|
const [c, f, l] = d, p = (i = (r = e.getAttr(f)) === null || r === void 0 ? void 0 : r["forward-identity"]) === null || i === void 0 ? void 0 : i[2];
|
|
4233
4233
|
if (!p)
|
|
4234
4234
|
continue;
|
|
4235
|
-
const y = (s =
|
|
4236
|
-
|
|
4235
|
+
const y = (s = u[c]) !== null && s !== void 0 ? s : {};
|
|
4236
|
+
u[c] = y;
|
|
4237
4237
|
const b = (o = y[p]) !== null && o !== void 0 ? o : {};
|
|
4238
|
-
switch (y[p] = b,
|
|
4238
|
+
switch (y[p] = b, a) {
|
|
4239
4239
|
case "added":
|
|
4240
4240
|
b.newValue = l;
|
|
4241
4241
|
break;
|
|
@@ -4244,53 +4244,53 @@ function Ou(t, e, n) {
|
|
|
4244
4244
|
break;
|
|
4245
4245
|
}
|
|
4246
4246
|
}
|
|
4247
|
-
for (const
|
|
4248
|
-
const { oldValue: d, newValue: c } = a
|
|
4249
|
-
d === c && delete a
|
|
4247
|
+
for (const a of Object.keys(u)) {
|
|
4248
|
+
const { oldValue: d, newValue: c } = u[a];
|
|
4249
|
+
d === c && delete u[a];
|
|
4250
4250
|
}
|
|
4251
|
-
return
|
|
4251
|
+
return u;
|
|
4252
4252
|
}
|
|
4253
4253
|
function Tt(t, e) {
|
|
4254
4254
|
return { [t.table]: e.map((n) => n.entity) };
|
|
4255
4255
|
}
|
|
4256
|
-
function
|
|
4256
|
+
function Ea(t, e) {
|
|
4257
4257
|
var n;
|
|
4258
4258
|
if (t.orderFieldType)
|
|
4259
4259
|
return t.orderFieldType;
|
|
4260
4260
|
const r = t.orderField === "serverCreatedAt" ? "number" : (n = K(e(), t.table, t.orderField)) === null || n === void 0 ? void 0 : n["checked-data-type"];
|
|
4261
4261
|
return t.orderFieldType = r, r;
|
|
4262
4262
|
}
|
|
4263
|
-
function
|
|
4263
|
+
function Aa(t, e, n) {
|
|
4264
4264
|
const r = e;
|
|
4265
4265
|
if (t.orderField === "serverCreatedAt") {
|
|
4266
|
-
n.sort(t.orderDirection === "asc" ? function(o,
|
|
4267
|
-
return Ze(o.entity.id, o.serverCreatedAt,
|
|
4268
|
-
} : function(o,
|
|
4269
|
-
return Ze(
|
|
4266
|
+
n.sort(t.orderDirection === "asc" ? function(o, u) {
|
|
4267
|
+
return Ze(o.entity.id, o.serverCreatedAt, u.entity.id, u.serverCreatedAt, r);
|
|
4268
|
+
} : function(o, u) {
|
|
4269
|
+
return Ze(u.entity.id, u.serverCreatedAt, o.entity.id, o.serverCreatedAt, r);
|
|
4270
4270
|
});
|
|
4271
4271
|
return;
|
|
4272
4272
|
}
|
|
4273
4273
|
const i = t.orderField;
|
|
4274
|
-
n.sort(t.orderDirection === "asc" ? function(o,
|
|
4275
|
-
return Ze(o.entity.id, o.entity[i],
|
|
4276
|
-
} : function(o,
|
|
4277
|
-
return Ze(
|
|
4274
|
+
n.sort(t.orderDirection === "asc" ? function(o, u) {
|
|
4275
|
+
return Ze(o.entity.id, o.entity[i], u.entity.id, u.entity[i], r);
|
|
4276
|
+
} : function(o, u) {
|
|
4277
|
+
return Ze(u.entity.id, u.entity[i], o.entity.id, o.entity[i], r);
|
|
4278
4278
|
});
|
|
4279
4279
|
}
|
|
4280
4280
|
var ve;
|
|
4281
4281
|
(function(t) {
|
|
4282
4282
|
t.InitialSyncBatch = "InitialSyncBatch", t.InitialSyncComplete = "InitialSyncComplete", t.LoadFromStorage = "LoadFromStorage", t.SyncTransaction = "SyncTransaction", t.Error = "Error";
|
|
4283
4283
|
})(ve || (ve = {}));
|
|
4284
|
-
class
|
|
4284
|
+
class ka {
|
|
4285
4285
|
constructor(e, n, r, i, s, o) {
|
|
4286
4286
|
this.callbacks = {}, this.idToHash = {}, this.trySend = e, this.config = r, this.log = i, this.createStore = s, this.getAttrs = o, this.subs = new _n({
|
|
4287
4287
|
persister: n,
|
|
4288
|
-
merge:
|
|
4289
|
-
serialize:
|
|
4290
|
-
parse: (
|
|
4291
|
-
objectSize: (
|
|
4292
|
-
var
|
|
4293
|
-
return ((
|
|
4288
|
+
merge: Sa,
|
|
4289
|
+
serialize: va,
|
|
4290
|
+
parse: (u, a) => ma(a, this.config.useDateObjects),
|
|
4291
|
+
objectSize: (u) => {
|
|
4292
|
+
var a;
|
|
4293
|
+
return ((a = u.values) === null || a === void 0 ? void 0 : a.entities.length) || 0;
|
|
4294
4294
|
},
|
|
4295
4295
|
logger: i,
|
|
4296
4296
|
gc: {
|
|
@@ -4345,17 +4345,17 @@ class ku {
|
|
|
4345
4345
|
}
|
|
4346
4346
|
initSubscription(e, n, r) {
|
|
4347
4347
|
return Vr(this, void 0, void 0, function* () {
|
|
4348
|
-
var i, s, o,
|
|
4348
|
+
var i, s, o, u;
|
|
4349
4349
|
yield this.subs.waitForKeyToLoad(n);
|
|
4350
|
-
const
|
|
4351
|
-
if (
|
|
4352
|
-
this.sendResync(
|
|
4350
|
+
const a = this.subs.currentValue[n];
|
|
4351
|
+
if (a && a.state && a.state.txId) {
|
|
4352
|
+
this.sendResync(a, a.state, a.state.txId), !((i = a.values) === null || i === void 0) && i.entities && r && r({
|
|
4353
4353
|
type: ve.LoadFromStorage,
|
|
4354
|
-
data: Tt(
|
|
4354
|
+
data: Tt(a, (s = a.values) === null || s === void 0 ? void 0 : s.entities)
|
|
4355
4355
|
});
|
|
4356
4356
|
return;
|
|
4357
4357
|
}
|
|
4358
|
-
const d = Object.keys(e)[0], c = ((
|
|
4358
|
+
const d = Object.keys(e)[0], c = ((u = (o = e[d]) === null || o === void 0 ? void 0 : o.$) === null || u === void 0 ? void 0 : u.order) || { serverCreatedAt: "asc" }, [f, l] = Object.entries(c)[0];
|
|
4359
4359
|
this.subs.updateInPlace((p) => {
|
|
4360
4360
|
p[n] = {
|
|
4361
4361
|
query: e,
|
|
@@ -4401,30 +4401,30 @@ class ku {
|
|
|
4401
4401
|
this.log.error("Missing hash for subscription", e);
|
|
4402
4402
|
return;
|
|
4403
4403
|
}
|
|
4404
|
-
const o = [],
|
|
4405
|
-
if (!
|
|
4404
|
+
const o = [], u = this.subs.currentValue[s];
|
|
4405
|
+
if (!u) {
|
|
4406
4406
|
this.log.error("Missing sub for hash", s, e);
|
|
4407
4407
|
return;
|
|
4408
4408
|
}
|
|
4409
|
-
const
|
|
4409
|
+
const a = (n = u.values) !== null && n !== void 0 ? n : {
|
|
4410
4410
|
entities: [],
|
|
4411
4411
|
attrsStore: this.getAttrs()
|
|
4412
4412
|
};
|
|
4413
|
-
|
|
4414
|
-
const d =
|
|
4413
|
+
u.values = a;
|
|
4414
|
+
const d = a.entities;
|
|
4415
4415
|
for (const c of i) {
|
|
4416
|
-
const f = this.createStore(c), l = Jt(
|
|
4416
|
+
const f = this.createStore(c), l = Jt(u, f, a.attrsStore);
|
|
4417
4417
|
d.push({
|
|
4418
4418
|
store: f,
|
|
4419
4419
|
entity: l,
|
|
4420
|
-
serverCreatedAt: Br(
|
|
4420
|
+
serverCreatedAt: Br(u, f, a.attrsStore, l.id)
|
|
4421
4421
|
}), o.push(l);
|
|
4422
4422
|
}
|
|
4423
4423
|
this.subs.updateInPlace((c) => {
|
|
4424
|
-
c[s] =
|
|
4425
|
-
}),
|
|
4424
|
+
c[s] = u, c[s].updatedAt = Date.now();
|
|
4425
|
+
}), u.values && this.notifyCbs(s, {
|
|
4426
4426
|
type: ve.InitialSyncBatch,
|
|
4427
|
-
data: Tt(
|
|
4427
|
+
data: Tt(u, u.values.entities),
|
|
4428
4428
|
batch: o
|
|
4429
4429
|
});
|
|
4430
4430
|
}
|
|
@@ -4436,15 +4436,15 @@ class ku {
|
|
|
4436
4436
|
return;
|
|
4437
4437
|
}
|
|
4438
4438
|
this.subs.updateInPlace((o) => {
|
|
4439
|
-
const
|
|
4440
|
-
if (!
|
|
4439
|
+
const u = o[i];
|
|
4440
|
+
if (!u) {
|
|
4441
4441
|
this.log.error("Missing sub for hash", i, e);
|
|
4442
4442
|
return;
|
|
4443
4443
|
}
|
|
4444
|
-
const
|
|
4445
|
-
if (!
|
|
4446
|
-
return this.log.error("Sub never set init, missing result",
|
|
4447
|
-
|
|
4444
|
+
const a = u.state;
|
|
4445
|
+
if (!a)
|
|
4446
|
+
return this.log.error("Sub never set init, missing result", u, e), o;
|
|
4447
|
+
a.txId = e["tx-id"], u.updatedAt = Date.now();
|
|
4448
4448
|
});
|
|
4449
4449
|
const s = this.subs.currentValue[i];
|
|
4450
4450
|
s && this.notifyCbs(i, {
|
|
@@ -4459,37 +4459,37 @@ class ku {
|
|
|
4459
4459
|
this.log.error("Missing hash for subscription", e);
|
|
4460
4460
|
return;
|
|
4461
4461
|
}
|
|
4462
|
-
const
|
|
4463
|
-
if (!
|
|
4462
|
+
const u = this.subs.currentValue[o];
|
|
4463
|
+
if (!u) {
|
|
4464
4464
|
this.log.error("Missing sub for hash", o, e);
|
|
4465
4465
|
return;
|
|
4466
4466
|
}
|
|
4467
|
-
const
|
|
4468
|
-
if (!
|
|
4469
|
-
this.log.error("Missing state for sub",
|
|
4467
|
+
const a = u.state;
|
|
4468
|
+
if (!a) {
|
|
4469
|
+
this.log.error("Missing state for sub", u, e);
|
|
4470
4470
|
return;
|
|
4471
4471
|
}
|
|
4472
4472
|
for (const d of e.txes) {
|
|
4473
|
-
if (
|
|
4473
|
+
if (a.txId && a.txId >= d["tx-id"])
|
|
4474
4474
|
continue;
|
|
4475
|
-
|
|
4475
|
+
a.txId = d["tx-id"];
|
|
4476
4476
|
const c = [], f = {};
|
|
4477
4477
|
for (const g of d.changes) {
|
|
4478
4478
|
const m = (n = f[g.triple[0]]) !== null && n !== void 0 ? n : [];
|
|
4479
4479
|
f[g.triple[0]] = m, m.push(g);
|
|
4480
4480
|
}
|
|
4481
|
-
const l = (r =
|
|
4481
|
+
const l = (r = u.values) !== null && r !== void 0 ? r : {
|
|
4482
4482
|
entities: [],
|
|
4483
4483
|
attrsStore: this.getAttrs()
|
|
4484
4484
|
}, p = l.entities;
|
|
4485
|
-
|
|
4485
|
+
u.values = l;
|
|
4486
4486
|
const y = [];
|
|
4487
4487
|
e: for (const [g, m] of Object.entries(f))
|
|
4488
4488
|
for (let O = 0; O < p.length; O++) {
|
|
4489
4489
|
const S = p[O];
|
|
4490
4490
|
if (io(S.store, g)) {
|
|
4491
4491
|
Gr(S.store, l.attrsStore, m);
|
|
4492
|
-
const C = Jt(
|
|
4492
|
+
const C = Jt(u, S.store, l.attrsStore), $ = Oa(S.store, l.attrsStore, m)[g];
|
|
4493
4493
|
C ? (y.push({
|
|
4494
4494
|
oldEntity: S.entity,
|
|
4495
4495
|
newEntity: C,
|
|
@@ -4502,10 +4502,10 @@ class ku {
|
|
|
4502
4502
|
for (const [g, m] of Object.entries(f)) {
|
|
4503
4503
|
const O = this.createStore([]);
|
|
4504
4504
|
Gr(O, l.attrsStore, m);
|
|
4505
|
-
const S = Jt(
|
|
4505
|
+
const S = Jt(u, O, l.attrsStore);
|
|
4506
4506
|
if (!S) {
|
|
4507
4507
|
this.log.error("No entity found after applying change", {
|
|
4508
|
-
sub:
|
|
4508
|
+
sub: u,
|
|
4509
4509
|
changes: m,
|
|
4510
4510
|
store: O
|
|
4511
4511
|
});
|
|
@@ -4514,23 +4514,23 @@ class ku {
|
|
|
4514
4514
|
p.push({
|
|
4515
4515
|
store: O,
|
|
4516
4516
|
entity: S,
|
|
4517
|
-
serverCreatedAt: Br(
|
|
4517
|
+
serverCreatedAt: Br(u, O, l.attrsStore, S.id)
|
|
4518
4518
|
}), b.push(S);
|
|
4519
4519
|
}
|
|
4520
4520
|
const _ = [];
|
|
4521
4521
|
for (const g of c.sort().reverse())
|
|
4522
4522
|
_.push(p[g].entity), p.splice(g, 1);
|
|
4523
|
-
const T =
|
|
4524
|
-
|
|
4523
|
+
const T = Ea(u, this.getAttrs);
|
|
4524
|
+
Aa(u, T, p), this.notifyCbs(o, {
|
|
4525
4525
|
type: ve.SyncTransaction,
|
|
4526
|
-
data: Tt(
|
|
4526
|
+
data: Tt(u, (i = u.values) === null || i === void 0 ? void 0 : i.entities),
|
|
4527
4527
|
added: b,
|
|
4528
4528
|
removed: _,
|
|
4529
4529
|
updated: y
|
|
4530
4530
|
});
|
|
4531
4531
|
}
|
|
4532
4532
|
this.subs.updateInPlace((d) => {
|
|
4533
|
-
d[o] =
|
|
4533
|
+
d[o] = u, d[o].updatedAt = Date.now();
|
|
4534
4534
|
});
|
|
4535
4535
|
}
|
|
4536
4536
|
clearSubscriptionData(e, n) {
|
|
@@ -4569,14 +4569,14 @@ var N = function(t, e, n, r) {
|
|
|
4569
4569
|
});
|
|
4570
4570
|
}
|
|
4571
4571
|
return new (n || (n = Promise))(function(s, o) {
|
|
4572
|
-
function
|
|
4572
|
+
function u(c) {
|
|
4573
4573
|
try {
|
|
4574
4574
|
d(r.next(c));
|
|
4575
4575
|
} catch (f) {
|
|
4576
4576
|
o(f);
|
|
4577
4577
|
}
|
|
4578
4578
|
}
|
|
4579
|
-
function
|
|
4579
|
+
function a(c) {
|
|
4580
4580
|
try {
|
|
4581
4581
|
d(r.throw(c));
|
|
4582
4582
|
} catch (f) {
|
|
@@ -4584,7 +4584,7 @@ var N = function(t, e, n, r) {
|
|
|
4584
4584
|
}
|
|
4585
4585
|
}
|
|
4586
4586
|
function d(c) {
|
|
4587
|
-
c.done ? s(c.value) : i(c.value).then(
|
|
4587
|
+
c.done ? s(c.value) : i(c.value).then(u, a);
|
|
4588
4588
|
}
|
|
4589
4589
|
d((r = r.apply(t, e || [])).next());
|
|
4590
4590
|
});
|
|
@@ -4602,23 +4602,23 @@ const he = {
|
|
|
4602
4602
|
AUTHENTICATED: "authenticated",
|
|
4603
4603
|
CLOSED: "closed",
|
|
4604
4604
|
ERRORED: "errored"
|
|
4605
|
-
},
|
|
4605
|
+
}, ja = 3e4, Ca = 3e4, Ia = 200, Pa = {
|
|
4606
4606
|
apiURI: "https://api.instantdb.com",
|
|
4607
4607
|
websocketURI: "wss://api.instantdb.com/runtime/session"
|
|
4608
4608
|
}, Zt = "_instant_oauth_redirect", Ge = "currentUser";
|
|
4609
|
-
function
|
|
4609
|
+
function Ma({ transportType: t, appId: e, apiURI: n, wsURI: r, EventSourceImpl: i }) {
|
|
4610
4610
|
if (!i)
|
|
4611
4611
|
return new zr(`${r}?app_id=${e}`);
|
|
4612
4612
|
switch (t) {
|
|
4613
4613
|
case "ws":
|
|
4614
4614
|
return new zr(`${r}?app_id=${e}`);
|
|
4615
4615
|
case "sse":
|
|
4616
|
-
return new
|
|
4616
|
+
return new Ta(i, `${n}/runtime/sse?app_id=${e}`);
|
|
4617
4617
|
default:
|
|
4618
4618
|
throw new Error("Unknown transport type " + t);
|
|
4619
4619
|
}
|
|
4620
4620
|
}
|
|
4621
|
-
function
|
|
4621
|
+
function Ra() {
|
|
4622
4622
|
return typeof window < "u" || typeof chrome < "u";
|
|
4623
4623
|
}
|
|
4624
4624
|
const Qr = {
|
|
@@ -4627,7 +4627,7 @@ const Qr = {
|
|
|
4627
4627
|
"refresh-presence": !0,
|
|
4628
4628
|
"patch-presence": !0
|
|
4629
4629
|
};
|
|
4630
|
-
function
|
|
4630
|
+
function xa(t, e) {
|
|
4631
4631
|
var n;
|
|
4632
4632
|
const r = typeof t == "string" ? JSON.parse(t) : t;
|
|
4633
4633
|
if (!((n = r == null ? void 0 : r.result) === null || n === void 0) && n.store) {
|
|
@@ -4639,7 +4639,7 @@ function xu(t, e) {
|
|
|
4639
4639
|
}
|
|
4640
4640
|
return r;
|
|
4641
4641
|
}
|
|
4642
|
-
function $
|
|
4642
|
+
function $a(t, e) {
|
|
4643
4643
|
const { result: n } = e, i = Qi(e, ["result"]);
|
|
4644
4644
|
if (n) {
|
|
4645
4645
|
const s = Object.assign(Object.assign({}, n), { store: wi(n.store), attrsStore: n.attrsStore.toJSON() });
|
|
@@ -4647,7 +4647,7 @@ function $u(t, e) {
|
|
|
4647
4647
|
}
|
|
4648
4648
|
return i;
|
|
4649
4649
|
}
|
|
4650
|
-
function
|
|
4650
|
+
function Da(t, e) {
|
|
4651
4651
|
switch (t) {
|
|
4652
4652
|
case "pendingMutations":
|
|
4653
4653
|
return new Map(typeof e == "string" ? JSON.parse(e) : e);
|
|
@@ -4655,7 +4655,7 @@ function Du(t, e) {
|
|
|
4655
4655
|
return e;
|
|
4656
4656
|
}
|
|
4657
4657
|
}
|
|
4658
|
-
function
|
|
4658
|
+
function Ua(t, e) {
|
|
4659
4659
|
switch (t) {
|
|
4660
4660
|
case "pendingMutations":
|
|
4661
4661
|
return [...e.entries()];
|
|
@@ -4663,19 +4663,19 @@ function Uu(t, e) {
|
|
|
4663
4663
|
return e;
|
|
4664
4664
|
}
|
|
4665
4665
|
}
|
|
4666
|
-
function
|
|
4666
|
+
function La(t, e, n) {
|
|
4667
4667
|
const r = e == null ? void 0 : e.result, i = n == null ? void 0 : n.result;
|
|
4668
4668
|
return r && !i && n && (n.result = r), n || e;
|
|
4669
4669
|
}
|
|
4670
4670
|
function Hr(t) {
|
|
4671
4671
|
return [...t].sort((e, n) => {
|
|
4672
|
-
const [r, i] = e, [s, o] = n,
|
|
4673
|
-
return
|
|
4672
|
+
const [r, i] = e, [s, o] = n, u = i.order || 0, a = o.order || 0;
|
|
4673
|
+
return u == a ? r < s ? -1 : r > s ? 1 : 0 : u - a;
|
|
4674
4674
|
});
|
|
4675
4675
|
}
|
|
4676
|
-
class
|
|
4676
|
+
class Fa {
|
|
4677
4677
|
constructor(e, n = Ui, r = Li, i, s) {
|
|
4678
|
-
var o,
|
|
4678
|
+
var o, u, a;
|
|
4679
4679
|
if (this._isOnline = !0, this._isShutdown = !1, this.status = he.CONNECTING, this.queryCbs = {}, this.queryOnceDfds = {}, this.authCbs = [], this.attrsCbs = [], this.mutationErrorCbs = [], this.connectionStatusCbs = [], this.mutationDeferredStore = /* @__PURE__ */ new Map(), this._reconnectTimeoutId = null, this._reconnectTimeoutMs = 0, this._transportType = "ws", this._wsOk = null, this._localIdPromises = {}, this._errorMessage = null, this._oauthCallbackResponse = null, this._linkIndex = null, this._rooms = {}, this._roomsPendingLeave = {}, this._presence = {}, this._broadcastQueue = [], this._broadcastSubs = {}, this._currentUserCached = { isLoading: !0, error: void 0, user: void 0 }, this._beforeUnloadCbs = [], this._dataForQueryCache = {}, this._inFlightMutationEventIds = /* @__PURE__ */ new Set(), this._onMergeKv = (d, c, f) => {
|
|
4680
4680
|
var l, p;
|
|
4681
4681
|
switch (d) {
|
|
@@ -4706,9 +4706,9 @@ class Fu {
|
|
|
4706
4706
|
}, this.notifyQueryError = (d, c) => {
|
|
4707
4707
|
(this.queryCbs[d] || []).forEach((l) => l.cb({ error: c }));
|
|
4708
4708
|
}, this.pushTx = (d) => {
|
|
4709
|
-
this.config.disableValidation ||
|
|
4709
|
+
this.config.disableValidation || wa(d, this.config.schema);
|
|
4710
4710
|
try {
|
|
4711
|
-
const c =
|
|
4711
|
+
const c = Ku({
|
|
4712
4712
|
attrsStore: this.optimisticAttrs(),
|
|
4713
4713
|
schema: this.config.schema,
|
|
4714
4714
|
stores: Object.values(this.querySubs.currentValue).map((f) => {
|
|
@@ -4797,7 +4797,7 @@ class Fu {
|
|
|
4797
4797
|
return;
|
|
4798
4798
|
}
|
|
4799
4799
|
this._log.info("[socket][close]", c.id, "schedule reconnect, ms =", this._reconnectTimeoutMs), this._scheduleReconnect();
|
|
4800
|
-
}, this._EventSource = s, this.config = Object.assign(Object.assign({},
|
|
4800
|
+
}, this._EventSource = s, this.config = Object.assign(Object.assign({}, Pa), e), this.queryCacheLimit = (o = this.config.queryCacheLimit) !== null && o !== void 0 ? o : 10, this._pendingTxCleanupTimeout = (u = this.config.pendingTxCleanupTimeout) !== null && u !== void 0 ? u : Ca, this._pendingMutationCleanupThreshold = (a = this.config.pendingMutationCleanupThreshold) !== null && a !== void 0 ? a : Ia, this._log = da(e.verbose || qn || Fi, () => this._reactorStats()), this.versions = Object.assign(Object.assign({}, i || {}), { "@instantdb/core": Wn }), this.config.schema && (this._linkIndex = Ur(this.config.schema)), !!Ra()) {
|
|
4801
4801
|
if (!e.appId)
|
|
4802
4802
|
throw new Error("Instant must be initialized with an appId.");
|
|
4803
4803
|
if (!Ne(e.appId))
|
|
@@ -4812,7 +4812,7 @@ class Fu {
|
|
|
4812
4812
|
} catch (f) {
|
|
4813
4813
|
this._log.error("[error] handle broadcast channel", f);
|
|
4814
4814
|
}
|
|
4815
|
-
}))), this._initStorage(n), this._syncTable = new
|
|
4815
|
+
}))), this._initStorage(n), this._syncTable = new ka(this._trySendAuthed.bind(this), new n(this.config.appId, "syncSubs"), {
|
|
4816
4816
|
useDateObjects: this.config.useDateObjects
|
|
4817
4817
|
}, this._log, (d) => Et(this.ensureAttrs(), d, this.config.enableCardinalityInference, this.config.useDateObjects), () => this.ensureAttrs()), this._oauthCallbackResponse = this._oauthLoginInit(), this.getCurrentUser(), r.getIsOnline().then((d) => {
|
|
4818
4818
|
this._isOnline = d, this._startSocket(), r.listen((c) => {
|
|
@@ -4842,9 +4842,9 @@ class Fu {
|
|
|
4842
4842
|
_initStorage(e) {
|
|
4843
4843
|
this.querySubs = new _n({
|
|
4844
4844
|
persister: new e(this.config.appId, "querySubs"),
|
|
4845
|
-
merge:
|
|
4846
|
-
serialize: $
|
|
4847
|
-
parse: (n, r) =>
|
|
4845
|
+
merge: La,
|
|
4846
|
+
serialize: $a,
|
|
4847
|
+
parse: (n, r) => xa(r, this.config.useDateObjects),
|
|
4848
4848
|
// objectSize
|
|
4849
4849
|
objectSize: (n) => {
|
|
4850
4850
|
var r, i, s, o;
|
|
@@ -4863,8 +4863,8 @@ class Fu {
|
|
|
4863
4863
|
}), this.querySubs.onKeyLoaded = (n) => this._onQuerySubLoaded(n), this.kv = new _n({
|
|
4864
4864
|
persister: new e(this.config.appId, "kv"),
|
|
4865
4865
|
merge: this._onMergeKv,
|
|
4866
|
-
serialize:
|
|
4867
|
-
parse:
|
|
4866
|
+
serialize: Ua,
|
|
4867
|
+
parse: Da,
|
|
4868
4868
|
objectSize: () => 0,
|
|
4869
4869
|
logger: this._log,
|
|
4870
4870
|
saveThrottleMs: 100,
|
|
@@ -4895,10 +4895,10 @@ class Fu {
|
|
|
4895
4895
|
if (s)
|
|
4896
4896
|
i.resolve({ status: e, eventId: n });
|
|
4897
4897
|
else if (r != null && r.type) {
|
|
4898
|
-
const { status: o } = r,
|
|
4898
|
+
const { status: o } = r, u = Qi(r, ["status"]);
|
|
4899
4899
|
i.reject(new Dt({
|
|
4900
4900
|
// @ts-expect-error body.type is not constant typed
|
|
4901
|
-
body:
|
|
4901
|
+
body: u,
|
|
4902
4902
|
status: o ?? 0
|
|
4903
4903
|
}));
|
|
4904
4904
|
} else
|
|
@@ -4912,12 +4912,12 @@ class Fu {
|
|
|
4912
4912
|
const i = (r = (n = this._presence[e]) === null || n === void 0 ? void 0 : n.result) === null || r === void 0 ? void 0 : r.user, s = this._broadcastQueue[e];
|
|
4913
4913
|
if (this._broadcastQueue[e] = [], i && this._trySetPresence(e, i), s)
|
|
4914
4914
|
for (const o of s) {
|
|
4915
|
-
const { topic:
|
|
4916
|
-
this._tryBroadcast(e,
|
|
4915
|
+
const { topic: u, roomType: a, data: d } = o;
|
|
4916
|
+
this._tryBroadcast(e, a, u, d);
|
|
4917
4917
|
}
|
|
4918
4918
|
}
|
|
4919
4919
|
_handleReceive(e, n) {
|
|
4920
|
-
var r, i, s, o,
|
|
4920
|
+
var r, i, s, o, u, a;
|
|
4921
4921
|
const d = !!this.config.schema && ("cardinalityInference" in this.config ? !!this.config.cardinalityInference : !0);
|
|
4922
4922
|
switch (Qr[n.op] || this._log.info("[receive]", e, n.op, n), n.op) {
|
|
4923
4923
|
case "init-ok": {
|
|
@@ -4936,7 +4936,7 @@ class Fu {
|
|
|
4936
4936
|
const { q: l, result: p } = n, y = B(l);
|
|
4937
4937
|
if (!this._hasQueryListeners() && !this.querySubs.currentValue[y])
|
|
4938
4938
|
break;
|
|
4939
|
-
const b = (o = (s = p == null ? void 0 : p[0]) === null || s === void 0 ? void 0 : s.data) === null || o === void 0 ? void 0 : o["page-info"], _ = (
|
|
4939
|
+
const b = (o = (s = p == null ? void 0 : p[0]) === null || s === void 0 ? void 0 : s.data) === null || o === void 0 ? void 0 : o["page-info"], _ = (a = (u = p == null ? void 0 : p[0]) === null || u === void 0 ? void 0 : u.data) === null || a === void 0 ? void 0 : a.aggregate, T = Dr(p), g = this.ensureAttrs(), m = Et(g, T, d, this.config.useDateObjects);
|
|
4940
4940
|
this.querySubs.updateInPlace((O) => {
|
|
4941
4941
|
if (!O[y]) {
|
|
4942
4942
|
this._log.info("Missing value in querySubs", { hash: y, q: l });
|
|
@@ -5097,7 +5097,7 @@ class Fu {
|
|
|
5097
5097
|
}
|
|
5098
5098
|
}
|
|
5099
5099
|
_handleReceiveError(e) {
|
|
5100
|
-
var n, r, i, s, o,
|
|
5100
|
+
var n, r, i, s, o, u, a;
|
|
5101
5101
|
console.log("error", e);
|
|
5102
5102
|
const d = e["client-event-id"];
|
|
5103
5103
|
this._inFlightMutationEventIds.delete(d);
|
|
@@ -5121,11 +5121,11 @@ class Fu {
|
|
|
5121
5121
|
this._setStatus(he.ERRORED, f), this.notifyAll();
|
|
5122
5122
|
return;
|
|
5123
5123
|
}
|
|
5124
|
-
if (((
|
|
5124
|
+
if (((u = e["original-event"]) === null || u === void 0 ? void 0 : u.op) === "resync-table") {
|
|
5125
5125
|
this._syncTable.onResyncError(e);
|
|
5126
5126
|
return;
|
|
5127
5127
|
}
|
|
5128
|
-
if (((
|
|
5128
|
+
if (((a = e["original-event"]) === null || a === void 0 ? void 0 : a.op) === "start-sync") {
|
|
5129
5129
|
this._syncTable.onStartSyncError(e);
|
|
5130
5130
|
return;
|
|
5131
5131
|
}
|
|
@@ -5135,7 +5135,7 @@ class Fu {
|
|
|
5135
5135
|
}
|
|
5136
5136
|
notifyQueryOnceError(e, n, r, i) {
|
|
5137
5137
|
var s;
|
|
5138
|
-
const o = (s = this.queryOnceDfds[n]) === null || s === void 0 ? void 0 : s.find((
|
|
5138
|
+
const o = (s = this.queryOnceDfds[n]) === null || s === void 0 ? void 0 : s.find((u) => u.eventId === r);
|
|
5139
5139
|
o && (o.dfd.reject(i), this._completeQueryOnce(e, n, o.dfd));
|
|
5140
5140
|
}
|
|
5141
5141
|
_setAttrs(e) {
|
|
@@ -5177,7 +5177,7 @@ class Fu {
|
|
|
5177
5177
|
if (!this.querySubs)
|
|
5178
5178
|
return i.reject(new Error("We can't run `queryOnce` on the backend. Use adminAPI.query instead: https://www.instantdb.com/docs/backend#query")), i.promise;
|
|
5179
5179
|
const s = B(e), o = this._startQuerySub(e, s);
|
|
5180
|
-
return this.queryOnceDfds[s] = (r = this.queryOnceDfds[s]) !== null && r !== void 0 ? r : [], this.queryOnceDfds[s].push({ q: e, dfd: i, eventId: o }), setTimeout(() => i.reject(new Error("Query timed out")),
|
|
5180
|
+
return this.queryOnceDfds[s] = (r = this.queryOnceDfds[s]) !== null && r !== void 0 ? r : [], this.queryOnceDfds[s].push({ q: e, dfd: i, eventId: o }), setTimeout(() => i.reject(new Error("Query timed out")), ja), i.promise;
|
|
5181
5181
|
}
|
|
5182
5182
|
_completeQueryOnce(e, n, r) {
|
|
5183
5183
|
this.queryOnceDfds[n] && (this.queryOnceDfds[n] = this.queryOnceDfds[n].filter((i) => i.dfd !== r), this._cleanupQuery(e, n));
|
|
@@ -5221,37 +5221,37 @@ class Fu {
|
|
|
5221
5221
|
const [f, l, p] = c["forward-identity"];
|
|
5222
5222
|
return Ie(e, l, p);
|
|
5223
5223
|
}, o = { attrIdMap: {}, refSwapAttrIds: /* @__PURE__ */ new Set() };
|
|
5224
|
-
let
|
|
5225
|
-
const
|
|
5224
|
+
let u = !1;
|
|
5225
|
+
const a = (c, f) => {
|
|
5226
5226
|
const l = [];
|
|
5227
5227
|
for (const p of c) {
|
|
5228
5228
|
const [y] = p;
|
|
5229
5229
|
if (y === "add-attr") {
|
|
5230
5230
|
const [_, T] = p, g = i(T);
|
|
5231
5231
|
if (g && T.id !== g.id) {
|
|
5232
|
-
o.attrIdMap[T.id] = g.id,
|
|
5232
|
+
o.attrIdMap[T.id] = g.id, u = !0;
|
|
5233
5233
|
continue;
|
|
5234
5234
|
}
|
|
5235
5235
|
if (T["value-type"] === "ref") {
|
|
5236
5236
|
const m = s(T);
|
|
5237
5237
|
if (m) {
|
|
5238
|
-
o.attrIdMap[T.id] = m.id, o.refSwapAttrIds.add(T.id),
|
|
5238
|
+
o.attrIdMap[T.id] = m.id, o.refSwapAttrIds.add(T.id), u = !0;
|
|
5239
5239
|
continue;
|
|
5240
5240
|
}
|
|
5241
5241
|
}
|
|
5242
5242
|
}
|
|
5243
5243
|
if (r && f && r >= f && y === "add-attr" || y === "update-attr" || y === "delete-attr") {
|
|
5244
|
-
|
|
5244
|
+
u = !0;
|
|
5245
5245
|
continue;
|
|
5246
5246
|
}
|
|
5247
|
-
const b =
|
|
5247
|
+
const b = u ? bu(o, p) : p;
|
|
5248
5248
|
l.push(b);
|
|
5249
5249
|
}
|
|
5250
|
-
return
|
|
5250
|
+
return u ? l : c;
|
|
5251
5251
|
}, d = /* @__PURE__ */ new Map();
|
|
5252
5252
|
for (const [c, f] of n.entries())
|
|
5253
|
-
d.set(c, Object.assign(Object.assign({}, f), { "tx-steps":
|
|
5254
|
-
return
|
|
5253
|
+
d.set(c, Object.assign(Object.assign({}, f), { "tx-steps": a(f["tx-steps"], f["tx-id"]) }));
|
|
5254
|
+
return u ? d : n;
|
|
5255
5255
|
}
|
|
5256
5256
|
_rewriteMutationsSorted(e, n) {
|
|
5257
5257
|
return Hr(this._rewriteMutations(e, n).entries());
|
|
@@ -5263,21 +5263,21 @@ class Fu {
|
|
|
5263
5263
|
*/
|
|
5264
5264
|
optimisticAttrs() {
|
|
5265
5265
|
var e, n;
|
|
5266
|
-
const r = [...this._pendingMutations().values()].flatMap((
|
|
5267
|
-
for (const [
|
|
5268
|
-
if (
|
|
5269
|
-
s.push(
|
|
5270
|
-
else if (
|
|
5271
|
-
const d = Object.assign(Object.assign({}, this.attrs.getAttr(
|
|
5266
|
+
const r = [...this._pendingMutations().values()].flatMap((u) => u["tx-steps"]), i = new Set(r.filter(([u, a]) => u === "delete-attr").map(([u, a]) => a)), s = [];
|
|
5267
|
+
for (const [u, a] of r)
|
|
5268
|
+
if (u === "add-attr")
|
|
5269
|
+
s.push(a);
|
|
5270
|
+
else if (u === "update-attr" && a.id && (!((e = this.attrs) === null || e === void 0) && e.getAttr(a.id))) {
|
|
5271
|
+
const d = Object.assign(Object.assign({}, this.attrs.getAttr(a.id)), a);
|
|
5272
5272
|
s.push(d);
|
|
5273
5273
|
}
|
|
5274
5274
|
if (!i.size && !s.length)
|
|
5275
5275
|
return this.attrs || new Ae({}, this._linkIndex);
|
|
5276
5276
|
const o = Object.assign({}, ((n = this.attrs) === null || n === void 0 ? void 0 : n.attrs) || {});
|
|
5277
|
-
for (const
|
|
5278
|
-
o[
|
|
5279
|
-
for (const
|
|
5280
|
-
delete o[
|
|
5277
|
+
for (const u of s)
|
|
5278
|
+
o[u.id] = u;
|
|
5279
|
+
for (const u of i)
|
|
5280
|
+
delete o[u];
|
|
5281
5281
|
return new Ae(o, this._linkIndex);
|
|
5282
5282
|
}
|
|
5283
5283
|
/** Runs instaql on a query and a store */
|
|
@@ -5287,20 +5287,20 @@ class Fu {
|
|
|
5287
5287
|
return { error: n };
|
|
5288
5288
|
if (!this.querySubs || !this.kv.currentValue.pendingMutations)
|
|
5289
5289
|
return;
|
|
5290
|
-
const r = this.querySubs.version(), i = this.querySubs.currentValue, s = this.kv.version(), o = this._pendingMutations(), { q:
|
|
5291
|
-
if (!
|
|
5290
|
+
const r = this.querySubs.version(), i = this.querySubs.currentValue, s = this.kv.version(), o = this._pendingMutations(), { q: u, result: a } = i[e] || {};
|
|
5291
|
+
if (!a)
|
|
5292
5292
|
return;
|
|
5293
5293
|
const d = this._dataForQueryCache[e];
|
|
5294
5294
|
if (d && r === d.querySubVersion && s === d.pendingMutationsVersion)
|
|
5295
5295
|
return d;
|
|
5296
|
-
const { store: c, attrsStore: f, pageInfo: l, aggregate: p, processedTxId: y } =
|
|
5297
|
-
return { data: Ri({ store: _, attrsStore: T, pageInfo: l, aggregate: p },
|
|
5296
|
+
const { store: c, attrsStore: f, pageInfo: l, aggregate: p, processedTxId: y } = a, b = this._rewriteMutationsSorted(f, o), { store: _, attrsStore: T } = this._applyOptimisticUpdates(c, f, b, y);
|
|
5297
|
+
return { data: Ri({ store: _, attrsStore: T, pageInfo: l, aggregate: p }, u), querySubVersion: r, pendingMutationsVersion: s };
|
|
5298
5298
|
}
|
|
5299
5299
|
_applyOptimisticUpdates(e, n, r, i) {
|
|
5300
5300
|
for (const [s, o] of r)
|
|
5301
5301
|
if (!o["tx-id"] || i && o["tx-id"] > i) {
|
|
5302
|
-
const
|
|
5303
|
-
e =
|
|
5302
|
+
const u = _o(e, n, o["tx-steps"]);
|
|
5303
|
+
e = u.store, n = u.attrsStore;
|
|
5304
5304
|
}
|
|
5305
5305
|
return { store: e, attrsStore: n };
|
|
5306
5306
|
}
|
|
@@ -5410,7 +5410,7 @@ class Fu {
|
|
|
5410
5410
|
return;
|
|
5411
5411
|
}
|
|
5412
5412
|
const e = this._transport;
|
|
5413
|
-
this._transport =
|
|
5413
|
+
this._transport = Ma({
|
|
5414
5414
|
transportType: this._transportType,
|
|
5415
5415
|
appId: this.config.appId,
|
|
5416
5416
|
apiURI: this.config.apiURI,
|
|
@@ -5456,8 +5456,8 @@ class Fu {
|
|
|
5456
5456
|
typeof navigation.removeEventListener == "function") {
|
|
5457
5457
|
let i = !1;
|
|
5458
5458
|
const s = (o) => {
|
|
5459
|
-
var
|
|
5460
|
-
i || (i = !0, navigation.removeEventListener("navigate", s), !o.userInitiated && o.navigationType === "replace" && ((
|
|
5459
|
+
var u;
|
|
5460
|
+
i || (i = !0, navigation.removeEventListener("navigate", s), !o.userInitiated && o.navigationType === "replace" && ((u = o.destination) === null || u === void 0 ? void 0 : u.url) === n && history.replaceState(history.state, "", r));
|
|
5461
5461
|
};
|
|
5462
5462
|
navigation.addEventListener("navigate", s);
|
|
5463
5463
|
}
|
|
@@ -5478,20 +5478,20 @@ class Fu {
|
|
|
5478
5478
|
const o = s.get("error");
|
|
5479
5479
|
if (o)
|
|
5480
5480
|
return this._replaceUrlAfterOAuth(), { error: { message: o } };
|
|
5481
|
-
const
|
|
5482
|
-
if (!
|
|
5481
|
+
const u = s.get("code");
|
|
5482
|
+
if (!u)
|
|
5483
5483
|
return null;
|
|
5484
5484
|
this._replaceUrlAfterOAuth();
|
|
5485
5485
|
try {
|
|
5486
|
-
const
|
|
5486
|
+
const a = yield this._getCurrentUser(), d = (a == null ? void 0 : a.type) === "guest", { user: c } = yield Rr({
|
|
5487
5487
|
apiURI: this.config.apiURI,
|
|
5488
5488
|
appId: this.config.appId,
|
|
5489
|
-
code:
|
|
5490
|
-
refreshToken: d ?
|
|
5489
|
+
code: u,
|
|
5490
|
+
refreshToken: d ? a.refresh_token : void 0
|
|
5491
5491
|
});
|
|
5492
5492
|
return this.setCurrentUser(c), null;
|
|
5493
|
-
} catch (
|
|
5494
|
-
return ((e =
|
|
5493
|
+
} catch (a) {
|
|
5494
|
+
return ((e = a == null ? void 0 : a.body) === null || e === void 0 ? void 0 : e.type) === "record-not-found" && ((r = (n = a == null ? void 0 : a.body) === null || n === void 0 ? void 0 : n.hint) === null || r === void 0 ? void 0 : r["record-type"]) === "app-oauth-code" && (yield this._hasCurrentUser()) ? null : { error: { message: ((i = a == null ? void 0 : a.body) === null || i === void 0 ? void 0 : i.message) || "Error logging in." } };
|
|
5495
5495
|
}
|
|
5496
5496
|
});
|
|
5497
5497
|
}
|
|
@@ -5613,7 +5613,7 @@ class Fu {
|
|
|
5613
5613
|
}), this._reconnectTimeoutMs = 0, this._transport.close(), this._oauthCallbackResponse = null, this.notifyAuthSubs(n);
|
|
5614
5614
|
}
|
|
5615
5615
|
sendMagicCode({ email: e }) {
|
|
5616
|
-
return
|
|
5616
|
+
return Ju({
|
|
5617
5617
|
apiURI: this.config.apiURI,
|
|
5618
5618
|
appId: this.config.appId,
|
|
5619
5619
|
email: e
|
|
@@ -5622,19 +5622,19 @@ class Fu {
|
|
|
5622
5622
|
signInWithMagicCode(e) {
|
|
5623
5623
|
return N(this, arguments, void 0, function* ({ email: n, code: r }) {
|
|
5624
5624
|
var i;
|
|
5625
|
-
const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest",
|
|
5625
|
+
const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", u = yield Zu({
|
|
5626
5626
|
apiURI: this.config.apiURI,
|
|
5627
5627
|
appId: this.config.appId,
|
|
5628
5628
|
email: n,
|
|
5629
5629
|
code: r,
|
|
5630
5630
|
refreshToken: o ? s.user.refresh_token : void 0
|
|
5631
5631
|
});
|
|
5632
|
-
return yield this.changeCurrentUser(
|
|
5632
|
+
return yield this.changeCurrentUser(u.user), u;
|
|
5633
5633
|
});
|
|
5634
5634
|
}
|
|
5635
5635
|
signInWithCustomToken(e) {
|
|
5636
5636
|
return N(this, void 0, void 0, function* () {
|
|
5637
|
-
const n = yield
|
|
5637
|
+
const n = yield Xu({
|
|
5638
5638
|
apiURI: this.config.apiURI,
|
|
5639
5639
|
appId: this.config.appId,
|
|
5640
5640
|
refreshToken: e
|
|
@@ -5644,7 +5644,7 @@ class Fu {
|
|
|
5644
5644
|
}
|
|
5645
5645
|
signInAsGuest() {
|
|
5646
5646
|
return N(this, void 0, void 0, function* () {
|
|
5647
|
-
const e = yield
|
|
5647
|
+
const e = yield ea({
|
|
5648
5648
|
apiURI: this.config.apiURI,
|
|
5649
5649
|
appId: this.config.appId
|
|
5650
5650
|
});
|
|
@@ -5660,7 +5660,7 @@ class Fu {
|
|
|
5660
5660
|
this._log.info("[auth-invalidate] skipped invalidateToken");
|
|
5661
5661
|
return;
|
|
5662
5662
|
}
|
|
5663
|
-
|
|
5663
|
+
na({
|
|
5664
5664
|
apiURI: this.config.apiURI,
|
|
5665
5665
|
appId: this.config.appId,
|
|
5666
5666
|
refreshToken: i
|
|
@@ -5695,14 +5695,14 @@ class Fu {
|
|
|
5695
5695
|
exchangeCodeForToken(e) {
|
|
5696
5696
|
return N(this, arguments, void 0, function* ({ code: n, codeVerifier: r }) {
|
|
5697
5697
|
var i;
|
|
5698
|
-
const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest",
|
|
5698
|
+
const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", u = yield Rr({
|
|
5699
5699
|
apiURI: this.config.apiURI,
|
|
5700
5700
|
appId: this.config.appId,
|
|
5701
5701
|
code: n,
|
|
5702
5702
|
codeVerifier: r,
|
|
5703
5703
|
refreshToken: o ? s.user.refresh_token : void 0
|
|
5704
5704
|
});
|
|
5705
|
-
return yield this.changeCurrentUser(
|
|
5705
|
+
return yield this.changeCurrentUser(u.user), u;
|
|
5706
5706
|
});
|
|
5707
5707
|
}
|
|
5708
5708
|
issuerURI() {
|
|
@@ -5718,15 +5718,15 @@ class Fu {
|
|
|
5718
5718
|
signInWithIdToken(e) {
|
|
5719
5719
|
return N(this, arguments, void 0, function* ({ idToken: n, clientName: r, nonce: i }) {
|
|
5720
5720
|
var s;
|
|
5721
|
-
const o = yield this.getCurrentUser(),
|
|
5721
|
+
const o = yield this.getCurrentUser(), u = (s = o == null ? void 0 : o.user) === null || s === void 0 ? void 0 : s.refresh_token, a = yield ta({
|
|
5722
5722
|
apiURI: this.config.apiURI,
|
|
5723
5723
|
appId: this.config.appId,
|
|
5724
5724
|
idToken: n,
|
|
5725
5725
|
clientName: r,
|
|
5726
5726
|
nonce: i,
|
|
5727
|
-
refreshToken:
|
|
5727
|
+
refreshToken: u
|
|
5728
5728
|
});
|
|
5729
|
-
return yield this.changeCurrentUser(
|
|
5729
|
+
return yield this.changeCurrentUser(a.user), a;
|
|
5730
5730
|
});
|
|
5731
5731
|
}
|
|
5732
5732
|
// --------
|
|
@@ -5759,7 +5759,7 @@ class Fu {
|
|
|
5759
5759
|
// TODO: look into typing again
|
|
5760
5760
|
getPresence(e, n, r = {}) {
|
|
5761
5761
|
const i = this._rooms[n], s = this._presence[n];
|
|
5762
|
-
return !i || !s || !s.result ? null : Object.assign(Object.assign({},
|
|
5762
|
+
return !i || !s || !s.result ? null : Object.assign(Object.assign({}, aa(s.result, r, this._sessionId)), { isLoading: !i.isConnected, error: i.error });
|
|
5763
5763
|
}
|
|
5764
5764
|
// TODO: look into typing again
|
|
5765
5765
|
publishPresence(e, n, r) {
|
|
@@ -5797,8 +5797,8 @@ class Fu {
|
|
|
5797
5797
|
r.initialPresence || r.initialData
|
|
5798
5798
|
), o = Object.assign(Object.assign({}, r), { roomId: n, cb: i, prev: null });
|
|
5799
5799
|
return this._presence[n] = this._presence[n] || {}, this._presence[n].handlers = this._presence[n].handlers || [], this._presence[n].handlers.push(o), this._notifyPresenceSub(n, o), () => {
|
|
5800
|
-
var
|
|
5801
|
-
this._presence[n].handlers = (d = (
|
|
5800
|
+
var u, a, d;
|
|
5801
|
+
this._presence[n].handlers = (d = (a = (u = this._presence[n]) === null || u === void 0 ? void 0 : u.handlers) === null || a === void 0 ? void 0 : a.filter((c) => c !== o)) !== null && d !== void 0 ? d : [], s();
|
|
5802
5802
|
};
|
|
5803
5803
|
}
|
|
5804
5804
|
_notifyPresenceSubs(e) {
|
|
@@ -5809,14 +5809,14 @@ class Fu {
|
|
|
5809
5809
|
}
|
|
5810
5810
|
_notifyPresenceSub(e, n) {
|
|
5811
5811
|
const r = this.getPresence("", e, n);
|
|
5812
|
-
r && (n.prev && !
|
|
5812
|
+
r && (n.prev && !ca(r, n.prev) || (n.prev = r, n.cb(r)));
|
|
5813
5813
|
}
|
|
5814
5814
|
_patchPresencePeers(e, n) {
|
|
5815
5815
|
var r, i, s;
|
|
5816
5816
|
const o = ((i = (r = this._presence[e]) === null || r === void 0 ? void 0 : r.result) === null || i === void 0 ? void 0 : i.peers) || {};
|
|
5817
|
-
let
|
|
5817
|
+
let u = Object.fromEntries(Object.entries(o).map(([d, c]) => [d, { data: c }]));
|
|
5818
5818
|
(s = this._presence[e]) === null || s === void 0 || s.result;
|
|
5819
|
-
const
|
|
5819
|
+
const a = It(u, (d) => {
|
|
5820
5820
|
for (let [c, f, l] of n)
|
|
5821
5821
|
switch (f) {
|
|
5822
5822
|
case "+":
|
|
@@ -5831,7 +5831,7 @@ class Fu {
|
|
|
5831
5831
|
}
|
|
5832
5832
|
delete d[this._sessionId];
|
|
5833
5833
|
});
|
|
5834
|
-
this._setPresencePeers(e,
|
|
5834
|
+
this._setPresencePeers(e, a);
|
|
5835
5835
|
}
|
|
5836
5836
|
_setPresencePeers(e, n) {
|
|
5837
5837
|
const r = Object.assign({}, n);
|
|
@@ -5871,10 +5871,10 @@ class Fu {
|
|
|
5871
5871
|
}
|
|
5872
5872
|
_notifyBroadcastSubs(e, n, r) {
|
|
5873
5873
|
var i, s, o;
|
|
5874
|
-
(o = (s = (i = this._broadcastSubs) === null || i === void 0 ? void 0 : i[e]) === null || s === void 0 ? void 0 : s[n]) === null || o === void 0 || o.forEach((
|
|
5875
|
-
var
|
|
5876
|
-
const y = (
|
|
5877
|
-
return
|
|
5874
|
+
(o = (s = (i = this._broadcastSubs) === null || i === void 0 ? void 0 : i[e]) === null || s === void 0 ? void 0 : s[n]) === null || o === void 0 || o.forEach((u) => {
|
|
5875
|
+
var a, d, c, f, l, p;
|
|
5876
|
+
const y = (a = r.data) === null || a === void 0 ? void 0 : a.data, b = r.data["peer-id"] === this._sessionId ? (c = (d = this._presence[e]) === null || d === void 0 ? void 0 : d.result) === null || c === void 0 ? void 0 : c.user : (p = (l = (f = this._presence[e]) === null || f === void 0 ? void 0 : f.result) === null || l === void 0 ? void 0 : l.peers) === null || p === void 0 ? void 0 : p[r.data["peer-id"]];
|
|
5877
|
+
return u(y, b);
|
|
5878
5878
|
});
|
|
5879
5879
|
}
|
|
5880
5880
|
// --------
|
|
@@ -5883,14 +5883,14 @@ class Fu {
|
|
|
5883
5883
|
return N(this, void 0, void 0, function* () {
|
|
5884
5884
|
var i;
|
|
5885
5885
|
const s = yield this.getCurrentUser(), o = (i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.refresh_token;
|
|
5886
|
-
return
|
|
5886
|
+
return ra(Object.assign(Object.assign({}, r), { apiURI: this.config.apiURI, appId: this.config.appId, path: e, file: n, refreshToken: o }));
|
|
5887
5887
|
});
|
|
5888
5888
|
}
|
|
5889
5889
|
deleteFile(e) {
|
|
5890
5890
|
return N(this, void 0, void 0, function* () {
|
|
5891
5891
|
var n;
|
|
5892
5892
|
const r = yield this.getCurrentUser(), i = (n = r == null ? void 0 : r.user) === null || n === void 0 ? void 0 : n.refresh_token;
|
|
5893
|
-
return yield
|
|
5893
|
+
return yield ia({
|
|
5894
5894
|
apiURI: this.config.apiURI,
|
|
5895
5895
|
appId: this.config.appId,
|
|
5896
5896
|
path: e,
|
|
@@ -5903,20 +5903,20 @@ class Fu {
|
|
|
5903
5903
|
upload(e, n) {
|
|
5904
5904
|
return N(this, void 0, void 0, function* () {
|
|
5905
5905
|
var r;
|
|
5906
|
-
const i = yield this.getCurrentUser(), s = (r = i == null ? void 0 : i.user) === null || r === void 0 ? void 0 : r.refresh_token, o = e || n.name,
|
|
5906
|
+
const i = yield this.getCurrentUser(), s = (r = i == null ? void 0 : i.user) === null || r === void 0 ? void 0 : r.refresh_token, o = e || n.name, u = yield sa({
|
|
5907
5907
|
apiURI: this.config.apiURI,
|
|
5908
5908
|
appId: this.config.appId,
|
|
5909
5909
|
fileName: o,
|
|
5910
5910
|
refreshToken: s
|
|
5911
5911
|
});
|
|
5912
|
-
return yield
|
|
5912
|
+
return yield oa(u, n);
|
|
5913
5913
|
});
|
|
5914
5914
|
}
|
|
5915
5915
|
getDownloadUrl(e) {
|
|
5916
5916
|
return N(this, void 0, void 0, function* () {
|
|
5917
5917
|
var n;
|
|
5918
5918
|
const r = yield this.getCurrentUser(), i = (n = r == null ? void 0 : r.user) === null || n === void 0 ? void 0 : n.refresh_token;
|
|
5919
|
-
return yield
|
|
5919
|
+
return yield ua({
|
|
5920
5920
|
apiURI: this.config.apiURI,
|
|
5921
5921
|
appId: this.config.appId,
|
|
5922
5922
|
path: e,
|
|
@@ -5925,7 +5925,7 @@ class Fu {
|
|
|
5925
5925
|
});
|
|
5926
5926
|
}
|
|
5927
5927
|
}
|
|
5928
|
-
function
|
|
5928
|
+
function Na(t, e) {
|
|
5929
5929
|
return new Lt(
|
|
5930
5930
|
Hi(t, e),
|
|
5931
5931
|
// (XXX): LinksDef<any> stems from TypeScript’s inability to reconcile the
|
|
@@ -5937,44 +5937,44 @@ function Nu(t, e) {
|
|
|
5937
5937
|
void 0
|
|
5938
5938
|
);
|
|
5939
5939
|
}
|
|
5940
|
-
function
|
|
5940
|
+
function Ka(t) {
|
|
5941
5941
|
return new Ut(t, {});
|
|
5942
5942
|
}
|
|
5943
|
-
function
|
|
5943
|
+
function qa() {
|
|
5944
5944
|
return new H("string", !0, !1);
|
|
5945
5945
|
}
|
|
5946
|
-
function
|
|
5946
|
+
function Wa() {
|
|
5947
5947
|
return new H("number", !0, !1);
|
|
5948
5948
|
}
|
|
5949
|
-
function
|
|
5949
|
+
function za() {
|
|
5950
5950
|
return new H("boolean", !0, !1);
|
|
5951
5951
|
}
|
|
5952
|
-
function
|
|
5952
|
+
function Va() {
|
|
5953
5953
|
return new H("date", !0, !1);
|
|
5954
5954
|
}
|
|
5955
|
-
function
|
|
5955
|
+
function Ba() {
|
|
5956
5956
|
return new H("json", !0, !1);
|
|
5957
5957
|
}
|
|
5958
|
-
function
|
|
5958
|
+
function Ga() {
|
|
5959
5959
|
return new H("json", !0, !1);
|
|
5960
5960
|
}
|
|
5961
5961
|
function Hi(t, e) {
|
|
5962
5962
|
var n, r, i, s;
|
|
5963
5963
|
const o = { fwd: {}, rev: {} };
|
|
5964
|
-
for (const
|
|
5965
|
-
(n = o.fwd)[r =
|
|
5966
|
-
entityName:
|
|
5967
|
-
cardinality:
|
|
5968
|
-
}, o.rev[
|
|
5969
|
-
entityName:
|
|
5970
|
-
cardinality:
|
|
5964
|
+
for (const a of Object.values(e))
|
|
5965
|
+
(n = o.fwd)[r = a.forward.on] || (n[r] = {}), (i = o.rev)[s = a.reverse.on] || (i[s] = {}), o.fwd[a.forward.on][a.forward.label] = {
|
|
5966
|
+
entityName: a.reverse.on,
|
|
5967
|
+
cardinality: a.forward.has
|
|
5968
|
+
}, o.rev[a.reverse.on][a.reverse.label] = {
|
|
5969
|
+
entityName: a.forward.on,
|
|
5970
|
+
cardinality: a.reverse.has
|
|
5971
5971
|
};
|
|
5972
|
-
return Object.fromEntries(Object.entries(t).map(([
|
|
5973
|
-
|
|
5974
|
-
new Ut(d.attrs, Object.assign(Object.assign({}, o.fwd[
|
|
5972
|
+
return Object.fromEntries(Object.entries(t).map(([a, d]) => [
|
|
5973
|
+
a,
|
|
5974
|
+
new Ut(d.attrs, Object.assign(Object.assign({}, o.fwd[a]), o.rev[a]))
|
|
5975
5975
|
]));
|
|
5976
5976
|
}
|
|
5977
|
-
function
|
|
5977
|
+
function Qa({ entities: t, links: e, rooms: n }) {
|
|
5978
5978
|
const r = e ?? {}, i = n ?? {};
|
|
5979
5979
|
return new Lt(
|
|
5980
5980
|
Hi(t, r),
|
|
@@ -5989,46 +5989,46 @@ function Qu({ entities: t, links: e, rooms: n }) {
|
|
|
5989
5989
|
}
|
|
5990
5990
|
const Fc = {
|
|
5991
5991
|
// constructs
|
|
5992
|
-
graph:
|
|
5993
|
-
schema:
|
|
5994
|
-
entity:
|
|
5992
|
+
graph: Na,
|
|
5993
|
+
schema: Qa,
|
|
5994
|
+
entity: Ka,
|
|
5995
5995
|
// value types
|
|
5996
|
-
string:
|
|
5997
|
-
number:
|
|
5998
|
-
boolean:
|
|
5999
|
-
date:
|
|
6000
|
-
json:
|
|
6001
|
-
any:
|
|
5996
|
+
string: qa,
|
|
5997
|
+
number: Wa,
|
|
5998
|
+
boolean: za,
|
|
5999
|
+
date: Va,
|
|
6000
|
+
json: Ba,
|
|
6001
|
+
any: Ga
|
|
6002
6002
|
};
|
|
6003
6003
|
let mt;
|
|
6004
|
-
function
|
|
6004
|
+
function Ha(t, e) {
|
|
6005
6005
|
mt == null || mt.dispose();
|
|
6006
|
-
const n = tc(e), r =
|
|
6006
|
+
const n = tc(e), r = Za(e, u), i = Ja(Ya(t));
|
|
6007
6007
|
function s(c) {
|
|
6008
6008
|
var f;
|
|
6009
|
-
c.source === i.element.contentWindow && ((f = c.data) === null || f === void 0 ? void 0 : f.type) === "close" && n.isVisible() &&
|
|
6009
|
+
c.source === i.element.contentWindow && ((f = c.data) === null || f === void 0 ? void 0 : f.type) === "close" && n.isVisible() && u();
|
|
6010
6010
|
}
|
|
6011
6011
|
function o(c) {
|
|
6012
6012
|
const f = c.shiftKey && c.ctrlKey && c.key === "0", l = c.key === "Escape" || c.key === "Esc";
|
|
6013
|
-
(f || l && n.isVisible()) &&
|
|
6013
|
+
(f || l && n.isVisible()) && u();
|
|
6014
6014
|
}
|
|
6015
|
-
function
|
|
6015
|
+
function u() {
|
|
6016
6016
|
n.isVisible() ? n.element.style.display = "none" : (n.element.style.display = "block", n.element.contains(i.element) || n.element.appendChild(i.element));
|
|
6017
6017
|
}
|
|
6018
|
-
function
|
|
6018
|
+
function a() {
|
|
6019
6019
|
n.element.remove(), r.element.remove(), removeEventListener("keydown", o), removeEventListener("message", s);
|
|
6020
6020
|
}
|
|
6021
6021
|
function d() {
|
|
6022
6022
|
document.body.appendChild(n.element), document.body.appendChild(r.element), addEventListener("keydown", o), addEventListener("message", s), mt = {
|
|
6023
|
-
dispose:
|
|
6023
|
+
dispose: a
|
|
6024
6024
|
};
|
|
6025
6025
|
}
|
|
6026
6026
|
return d();
|
|
6027
6027
|
}
|
|
6028
|
-
function
|
|
6028
|
+
function Ya(t) {
|
|
6029
6029
|
return `${qn || Ni ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${t}`;
|
|
6030
6030
|
}
|
|
6031
|
-
function
|
|
6031
|
+
function Ja(t) {
|
|
6032
6032
|
const e = document.createElement("iframe");
|
|
6033
6033
|
return e.src = t, e.className = "instant-devtool-iframe", Object.assign(e.style, {
|
|
6034
6034
|
width: "100%",
|
|
@@ -6037,7 +6037,7 @@ function Ju(t) {
|
|
|
6037
6037
|
border: "none"
|
|
6038
6038
|
}), { element: e };
|
|
6039
6039
|
}
|
|
6040
|
-
function
|
|
6040
|
+
function Za(t, e) {
|
|
6041
6041
|
const n = `
|
|
6042
6042
|
<svg width="32" height="32" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
6043
6043
|
<rect width="512" height="512" fill="black"/>
|
|
@@ -6047,7 +6047,7 @@ function Zu(t, e) {
|
|
|
6047
6047
|
return r.innerHTML = n, r.className = "instant-devtool-toggler", Object.assign(r.style, Object.assign(Object.assign({
|
|
6048
6048
|
// pos
|
|
6049
6049
|
position: "fixed"
|
|
6050
|
-
},
|
|
6050
|
+
}, Xa(t.position)), {
|
|
6051
6051
|
height: "32px",
|
|
6052
6052
|
width: "32px",
|
|
6053
6053
|
// layout
|
|
@@ -6062,7 +6062,7 @@ function Zu(t, e) {
|
|
|
6062
6062
|
cursor: "pointer"
|
|
6063
6063
|
})), r.addEventListener("click", e), { element: r };
|
|
6064
6064
|
}
|
|
6065
|
-
function
|
|
6065
|
+
function Xa(t) {
|
|
6066
6066
|
switch (t) {
|
|
6067
6067
|
case "bottom-left":
|
|
6068
6068
|
return { bottom: "24px", left: "24px" };
|
|
@@ -6121,10 +6121,10 @@ class oc {
|
|
|
6121
6121
|
this.db = e, this.uploadFile = (n, r, i = {}) => this.db.uploadFile(n, r, i), this.delete = (n) => this.db.deleteFile(n), this.upload = (n, r) => this.db.upload(n, r), this.put = this.upload, this.getDownloadUrl = (n) => this.db.getDownloadUrl(n);
|
|
6122
6122
|
}
|
|
6123
6123
|
}
|
|
6124
|
-
function
|
|
6124
|
+
function uc(t) {
|
|
6125
6125
|
return JSON.parse(JSON.stringify(t));
|
|
6126
6126
|
}
|
|
6127
|
-
class
|
|
6127
|
+
class ac {
|
|
6128
6128
|
constructor(e) {
|
|
6129
6129
|
this.tx = Kn(), this._reactor = e, this.auth = new sc(this._reactor), this.storage = new oc(this._reactor);
|
|
6130
6130
|
}
|
|
@@ -6314,17 +6314,17 @@ function cc(t, e) {
|
|
|
6314
6314
|
}
|
|
6315
6315
|
function dc(t, e, n, r, i) {
|
|
6316
6316
|
var s, o;
|
|
6317
|
-
const
|
|
6318
|
-
if (
|
|
6319
|
-
return cc(
|
|
6320
|
-
const d = new
|
|
6321
|
-
return wn[gn(
|
|
6317
|
+
const u = Object.assign(Object.assign({}, t), { appId: (s = t.appId) === null || s === void 0 ? void 0 : s.trim(), useDateObjects: (o = t.useDateObjects) !== null && o !== void 0 ? o : !1 }), a = wn[gn(u)];
|
|
6318
|
+
if (a)
|
|
6319
|
+
return cc(a, u.schema) && a._reactor.updateSchema(u.schema), a;
|
|
6320
|
+
const d = new Fa(Object.assign(Object.assign(Object.assign({}, nc), u), { cardinalityInference: !!u.schema }), e || Ui, n || Li, Object.assign(Object.assign({}, r || {}), { "@instantdb/core": Wn }), i), c = new ac(d);
|
|
6321
|
+
return wn[gn(u)] = c, fc(u.appId, u.devtool), c;
|
|
6322
6322
|
}
|
|
6323
6323
|
function fc(t, e) {
|
|
6324
6324
|
if (typeof window > "u" || typeof window.location > "u" || typeof document > "u" || typeof e == "boolean" && !e)
|
|
6325
6325
|
return;
|
|
6326
6326
|
const n = Object.assign({ position: "bottom-right", allowedHosts: ["localhost"] }, typeof e == "object" ? e : {});
|
|
6327
|
-
n.allowedHosts.includes(window.location.hostname) &&
|
|
6327
|
+
n.allowedHosts.includes(window.location.hostname) && Ha(t, n);
|
|
6328
6328
|
}
|
|
6329
6329
|
var Tn = { exports: {} }, Qe = {};
|
|
6330
6330
|
/**
|
|
@@ -6341,12 +6341,12 @@ function lc() {
|
|
|
6341
6341
|
if (Zr) return Qe;
|
|
6342
6342
|
Zr = 1;
|
|
6343
6343
|
var t = oi, e = Symbol.for("react.element"), n = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, i = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
6344
|
-
function o(
|
|
6344
|
+
function o(u, a, d) {
|
|
6345
6345
|
var c, f = {}, l = null, p = null;
|
|
6346
|
-
d !== void 0 && (l = "" + d),
|
|
6347
|
-
for (c in
|
|
6348
|
-
if (
|
|
6349
|
-
return { $$typeof: e, type:
|
|
6346
|
+
d !== void 0 && (l = "" + d), a.key !== void 0 && (l = "" + a.key), a.ref !== void 0 && (p = a.ref);
|
|
6347
|
+
for (c in a) r.call(a, c) && !s.hasOwnProperty(c) && (f[c] = a[c]);
|
|
6348
|
+
if (u && u.defaultProps) for (c in a = u.defaultProps, a) f[c] === void 0 && (f[c] = a[c]);
|
|
6349
|
+
return { $$typeof: e, type: u, key: l, ref: p, props: f, _owner: i.current };
|
|
6350
6350
|
}
|
|
6351
6351
|
return Qe.Fragment = n, Qe.jsx = o, Qe.jsxs = o, Qe;
|
|
6352
6352
|
}
|
|
@@ -6365,7 +6365,7 @@ function hc() {
|
|
|
6365
6365
|
* LICENSE file in the root directory of this source tree.
|
|
6366
6366
|
*/
|
|
6367
6367
|
return t.NODE_ENV !== "production" && function() {
|
|
6368
|
-
var e = oi, n = Symbol.for("react.element"), r = Symbol.for("react.portal"), i = Symbol.for("react.fragment"), s = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"),
|
|
6368
|
+
var e = oi, n = Symbol.for("react.element"), r = Symbol.for("react.portal"), i = Symbol.for("react.fragment"), s = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), u = Symbol.for("react.provider"), a = Symbol.for("react.context"), d = Symbol.for("react.forward_ref"), c = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), l = Symbol.for("react.memo"), p = Symbol.for("react.lazy"), y = Symbol.for("react.offscreen"), b = Symbol.iterator, _ = "@@iterator";
|
|
6369
6369
|
function T(h) {
|
|
6370
6370
|
if (h === null || typeof h != "object")
|
|
6371
6371
|
return null;
|
|
@@ -6393,7 +6393,7 @@ function hc() {
|
|
|
6393
6393
|
var S = !1, C = !1, $ = !1, D = !1, Ve = !1, ft;
|
|
6394
6394
|
ft = Symbol.for("react.module.reference");
|
|
6395
6395
|
function lt(h) {
|
|
6396
|
-
return !!(typeof h == "string" || typeof h == "function" || h === i || h === o || Ve || h === s || h === c || h === f || D || h === y || S || C || $ || typeof h == "object" && h !== null && (h.$$typeof === p || h.$$typeof === l || h.$$typeof ===
|
|
6396
|
+
return !!(typeof h == "string" || typeof h == "function" || h === i || h === o || Ve || h === s || h === c || h === f || D || h === y || S || C || $ || typeof h == "object" && h !== null && (h.$$typeof === p || h.$$typeof === l || h.$$typeof === u || h.$$typeof === a || h.$$typeof === d || // This needs to include all possible module reference object
|
|
6397
6397
|
// types supported by any Flight configuration anywhere since
|
|
6398
6398
|
// we don't know which Flight build this will end up being used
|
|
6399
6399
|
// with.
|
|
@@ -6432,10 +6432,10 @@ function hc() {
|
|
|
6432
6432
|
}
|
|
6433
6433
|
if (typeof h == "object")
|
|
6434
6434
|
switch (h.$$typeof) {
|
|
6435
|
-
case
|
|
6435
|
+
case a:
|
|
6436
6436
|
var w = h;
|
|
6437
6437
|
return ht(w) + ".Consumer";
|
|
6438
|
-
case
|
|
6438
|
+
case u:
|
|
6439
6439
|
var v = h;
|
|
6440
6440
|
return ht(v._context) + ".Provider";
|
|
6441
6441
|
case d:
|
|
@@ -6698,8 +6698,8 @@ function hc() {
|
|
|
6698
6698
|
ref: !0,
|
|
6699
6699
|
__self: !0,
|
|
6700
6700
|
__source: !0
|
|
6701
|
-
}, or,
|
|
6702
|
-
function
|
|
6701
|
+
}, or, ur;
|
|
6702
|
+
function us(h) {
|
|
6703
6703
|
if (Be.call(h, "ref")) {
|
|
6704
6704
|
var w = Object.getOwnPropertyDescriptor(h, "ref").get;
|
|
6705
6705
|
if (w && w.isReactWarning)
|
|
@@ -6707,7 +6707,7 @@ function hc() {
|
|
|
6707
6707
|
}
|
|
6708
6708
|
return h.ref !== void 0;
|
|
6709
6709
|
}
|
|
6710
|
-
function
|
|
6710
|
+
function as(h) {
|
|
6711
6711
|
if (Be.call(h, "key")) {
|
|
6712
6712
|
var w = Object.getOwnPropertyDescriptor(h, "key").get;
|
|
6713
6713
|
if (w && w.isReactWarning)
|
|
@@ -6732,7 +6732,7 @@ function hc() {
|
|
|
6732
6732
|
function fs(h, w) {
|
|
6733
6733
|
{
|
|
6734
6734
|
var v = function() {
|
|
6735
|
-
|
|
6735
|
+
ur || (ur = !0, m("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", w));
|
|
6736
6736
|
};
|
|
6737
6737
|
v.isReactWarning = !0, Object.defineProperty(h, "ref", {
|
|
6738
6738
|
get: v,
|
|
@@ -6772,7 +6772,7 @@ function hc() {
|
|
|
6772
6772
|
function hs(h, w, v, E, P) {
|
|
6773
6773
|
{
|
|
6774
6774
|
var M, I = {}, k = null, G = null;
|
|
6775
|
-
v !== void 0 && (ir(v), k = "" + v),
|
|
6775
|
+
v !== void 0 && (ir(v), k = "" + v), as(w) && (ir(w.key), k = "" + w.key), us(w) && (G = w.ref, cs(w, P));
|
|
6776
6776
|
for (M in w)
|
|
6777
6777
|
Be.call(w, M) && !os.hasOwnProperty(M) && (I[M] = w[M]);
|
|
6778
6778
|
if (h && h.defaultProps) {
|
|
@@ -6787,13 +6787,13 @@ function hc() {
|
|
|
6787
6787
|
return ls(h, k, G, P, E, sr.current, I);
|
|
6788
6788
|
}
|
|
6789
6789
|
}
|
|
6790
|
-
var zt = g.ReactCurrentOwner,
|
|
6790
|
+
var zt = g.ReactCurrentOwner, ar = g.ReactDebugCurrentFrame;
|
|
6791
6791
|
function Pe(h) {
|
|
6792
6792
|
if (h) {
|
|
6793
6793
|
var w = h._owner, v = bt(h.type, h._source, w ? w.type : null);
|
|
6794
|
-
|
|
6794
|
+
ar.setExtraStackFrame(v);
|
|
6795
6795
|
} else
|
|
6796
|
-
|
|
6796
|
+
ar.setExtraStackFrame(null);
|
|
6797
6797
|
}
|
|
6798
6798
|
var Vt;
|
|
6799
6799
|
Vt = !1;
|
|
@@ -6966,8 +6966,8 @@ function ei(t) {
|
|
|
6966
6966
|
}
|
|
6967
6967
|
function bc(t, e, n) {
|
|
6968
6968
|
e && n && "ruleParams" in n && (e = Object.assign({ $$ruleParams: n.ruleParams }, e));
|
|
6969
|
-
const r = e ?
|
|
6970
|
-
(
|
|
6969
|
+
const r = e ? uc(e) : null, i = B(r), s = ot(ei(t._reactor.getPreviousResult(r))), o = we(
|
|
6970
|
+
(a) => (s.current = ei(t._reactor.getPreviousResult(r)), r ? t.subscribeQuery(r, (c) => {
|
|
6971
6971
|
s.current = Object.assign({
|
|
6972
6972
|
isLoading: !c,
|
|
6973
6973
|
// @ts-expect-error: ts thinks this will always be overwritten
|
|
@@ -6976,7 +6976,7 @@ function bc(t, e, n) {
|
|
|
6976
6976
|
pageInfo: void 0,
|
|
6977
6977
|
// @ts-expect-error: ts thinks this will always be overwritten
|
|
6978
6978
|
error: void 0
|
|
6979
|
-
}, c),
|
|
6979
|
+
}, c), a();
|
|
6980
6980
|
}) : () => {
|
|
6981
6981
|
}),
|
|
6982
6982
|
// Build a new subscribe function if the query changes
|
|
@@ -7016,9 +7016,9 @@ function Tc(t, e) {
|
|
|
7016
7016
|
}
|
|
7017
7017
|
function mc(t, e = {}) {
|
|
7018
7018
|
var n, r;
|
|
7019
|
-
const [i, s] =
|
|
7020
|
-
var
|
|
7021
|
-
return (
|
|
7019
|
+
const [i, s] = ui(() => {
|
|
7020
|
+
var a;
|
|
7021
|
+
return (a = t.core._reactor.getPresence(t.type, t.id, e)) !== null && a !== void 0 ? a : {
|
|
7022
7022
|
peers: {},
|
|
7023
7023
|
isLoading: !0
|
|
7024
7024
|
};
|
|
@@ -7026,8 +7026,8 @@ function mc(t, e = {}) {
|
|
|
7026
7026
|
ke(() => t.core._reactor.subscribePresence(t.type, t.id, e, (d) => {
|
|
7027
7027
|
s(d);
|
|
7028
7028
|
}), [t.id, e.user, (n = e.peers) === null || n === void 0 ? void 0 : n.join(), (r = e.keys) === null || r === void 0 ? void 0 : r.join()]);
|
|
7029
|
-
const o = we((
|
|
7030
|
-
t.core._reactor.publishPresence(t.type, t.id,
|
|
7029
|
+
const o = we((a) => {
|
|
7030
|
+
t.core._reactor.publishPresence(t.type, t.id, a);
|
|
7031
7031
|
}, [t.type, t.id]);
|
|
7032
7032
|
return tn(() => Object.assign(Object.assign({}, i), { publishPresence: o }), [i, o]);
|
|
7033
7033
|
}
|
|
@@ -7050,12 +7050,12 @@ function Sc(t, e, n = {}) {
|
|
|
7050
7050
|
[e]: null
|
|
7051
7051
|
});
|
|
7052
7052
|
}));
|
|
7053
|
-
}, [t.type, t.id, e, n == null ? void 0 : n.timeout, r]),
|
|
7053
|
+
}, [t.type, t.id, e, n == null ? void 0 : n.timeout, r]), u = we((c) => {
|
|
7054
7054
|
const l = !((n == null ? void 0 : n.stopOnEnter) && c.key === "Enter");
|
|
7055
7055
|
o(l);
|
|
7056
|
-
}, [n.stopOnEnter, o]),
|
|
7056
|
+
}, [n.stopOnEnter, o]), a = we(() => {
|
|
7057
7057
|
o(!1);
|
|
7058
|
-
}, [o]), d = tn(() => ({ onKeyDown:
|
|
7058
|
+
}, [o]), d = tn(() => ({ onKeyDown: u, onBlur: a }), [u, a]);
|
|
7059
7059
|
return {
|
|
7060
7060
|
active: s,
|
|
7061
7061
|
setActive: o,
|
|
@@ -7083,14 +7083,14 @@ var Ec = function(t, e, n, r) {
|
|
|
7083
7083
|
});
|
|
7084
7084
|
}
|
|
7085
7085
|
return new (n || (n = Promise))(function(s, o) {
|
|
7086
|
-
function
|
|
7086
|
+
function u(c) {
|
|
7087
7087
|
try {
|
|
7088
7088
|
d(r.next(c));
|
|
7089
7089
|
} catch (f) {
|
|
7090
7090
|
o(f);
|
|
7091
7091
|
}
|
|
7092
7092
|
}
|
|
7093
|
-
function
|
|
7093
|
+
function a(c) {
|
|
7094
7094
|
try {
|
|
7095
7095
|
d(r.throw(c));
|
|
7096
7096
|
} catch (f) {
|
|
@@ -7098,7 +7098,7 @@ var Ec = function(t, e, n, r) {
|
|
|
7098
7098
|
}
|
|
7099
7099
|
}
|
|
7100
7100
|
function d(c) {
|
|
7101
|
-
c.done ? s(c.value) : i(c.value).then(
|
|
7101
|
+
c.done ? s(c.value) : i(c.value).then(u, a);
|
|
7102
7102
|
}
|
|
7103
7103
|
d((r = r.apply(t, e || [])).next());
|
|
7104
7104
|
});
|
|
@@ -7111,16 +7111,16 @@ const Ac = {
|
|
|
7111
7111
|
class kc {
|
|
7112
7112
|
constructor(e, n) {
|
|
7113
7113
|
this.tx = Kn(), this.getLocalId = (r) => this.core.getLocalId(r), this.useLocalId = (r) => {
|
|
7114
|
-
const [i, s] =
|
|
7114
|
+
const [i, s] = ui(null);
|
|
7115
7115
|
return ke(() => {
|
|
7116
7116
|
Ec(this, void 0, void 0, function* () {
|
|
7117
|
-
const
|
|
7118
|
-
s(
|
|
7117
|
+
const u = yield this.getLocalId(r);
|
|
7118
|
+
s(u);
|
|
7119
7119
|
});
|
|
7120
7120
|
}, [r]), i;
|
|
7121
7121
|
}, this.rooms = Se, this.transact = (r) => this.core.transact(r), this.useQuery = (r, i) => bc(this.core, r, i).state, this.useAuth = () => {
|
|
7122
|
-
const r = ot(this.core._reactor._currentUserCached), i = we((o) => this.core.subscribeAuth((
|
|
7123
|
-
r.current = Object.assign({ isLoading: !1 },
|
|
7122
|
+
const r = ot(this.core._reactor._currentUserCached), i = we((o) => this.core.subscribeAuth((a) => {
|
|
7123
|
+
r.current = Object.assign({ isLoading: !1 }, a), o();
|
|
7124
7124
|
}), []);
|
|
7125
7125
|
return en(i, () => r.current, () => Ac);
|
|
7126
7126
|
}, this.useUser = () => {
|
|
@@ -7129,8 +7129,8 @@ class kc {
|
|
|
7129
7129
|
throw new qe("useUser must be used within an auth-protected route");
|
|
7130
7130
|
return r;
|
|
7131
7131
|
}, this.useConnectionStatus = () => {
|
|
7132
|
-
const r = ot(this.core._reactor.status), i = we((o) => this.core.subscribeConnectionStatus((
|
|
7133
|
-
|
|
7132
|
+
const r = ot(this.core._reactor.status), i = we((o) => this.core.subscribeConnectionStatus((a) => {
|
|
7133
|
+
a !== r.current && (r.current = a, o());
|
|
7134
7134
|
}), []);
|
|
7135
7135
|
return en(
|
|
7136
7136
|
i,
|
|
@@ -7197,7 +7197,7 @@ function jc(t) {
|
|
|
7197
7197
|
"`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
|
|
7198
7198
|
);
|
|
7199
7199
|
const { onEvent: e = Xt, onError: n = Xt, onRetry: r = Xt, onComment: i } = t;
|
|
7200
|
-
let s = "", o = !0,
|
|
7200
|
+
let s = "", o = !0, u, a = "", d = "";
|
|
7201
7201
|
function c(b) {
|
|
7202
7202
|
const _ = o ? b.replace(/^\xEF\xBB\xBF/, "") : b, [T, g] = Cc(`${s}${_}`);
|
|
7203
7203
|
for (const m of T)
|
|
@@ -7227,11 +7227,11 @@ function jc(t) {
|
|
|
7227
7227
|
d = _;
|
|
7228
7228
|
break;
|
|
7229
7229
|
case "data":
|
|
7230
|
-
|
|
7230
|
+
a = `${a}${_}
|
|
7231
7231
|
`;
|
|
7232
7232
|
break;
|
|
7233
7233
|
case "id":
|
|
7234
|
-
|
|
7234
|
+
u = _.includes("\0") ? void 0 : _;
|
|
7235
7235
|
break;
|
|
7236
7236
|
case "retry":
|
|
7237
7237
|
/^\d+$/.test(_) ? r(parseInt(_, 10)) : n(
|
|
@@ -7253,17 +7253,17 @@ function jc(t) {
|
|
|
7253
7253
|
}
|
|
7254
7254
|
}
|
|
7255
7255
|
function p() {
|
|
7256
|
-
|
|
7257
|
-
id:
|
|
7256
|
+
a.length > 0 && e({
|
|
7257
|
+
id: u,
|
|
7258
7258
|
event: d || void 0,
|
|
7259
7259
|
// If the data buffer's last character is a U+000A LINE FEED (LF) character,
|
|
7260
7260
|
// then remove the last character from the data buffer.
|
|
7261
|
-
data:
|
|
7262
|
-
`) ?
|
|
7263
|
-
}),
|
|
7261
|
+
data: a.endsWith(`
|
|
7262
|
+
`) ? a.slice(0, -1) : a
|
|
7263
|
+
}), u = void 0, a = "", d = "";
|
|
7264
7264
|
}
|
|
7265
7265
|
function y(b = {}) {
|
|
7266
|
-
s && b.consume && f(s), o = !0,
|
|
7266
|
+
s && b.consume && f(s), o = !0, u = void 0, a = "", d = "", s = "";
|
|
7267
7267
|
}
|
|
7268
7268
|
return { feed: c, reset: y };
|
|
7269
7269
|
}
|
|
@@ -7278,8 +7278,8 @@ function Cc(t) {
|
|
|
7278
7278
|
n = t.slice(r);
|
|
7279
7279
|
break;
|
|
7280
7280
|
} else {
|
|
7281
|
-
const
|
|
7282
|
-
e.push(
|
|
7281
|
+
const u = t.slice(r, o);
|
|
7282
|
+
e.push(u), r = o + 1, t[r - 1] === "\r" && t[r] === `
|
|
7283
7283
|
` && r++;
|
|
7284
7284
|
}
|
|
7285
7285
|
}
|
|
@@ -7353,12 +7353,12 @@ class kt extends EventTarget {
|
|
|
7353
7353
|
super(), q(this, se), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, q(this, J), q(this, Oe), q(this, xe), q(this, At), q(this, Rt), q(this, it), q(this, Ue), q(this, st, null), q(this, ge), q(this, $e), q(this, Fe, null), q(this, De, null), q(this, Xe, null), q(this, Sn, async (s) => {
|
|
7354
7354
|
var o;
|
|
7355
7355
|
A(this, $e).reset();
|
|
7356
|
-
const { body:
|
|
7356
|
+
const { body: u, redirected: a, status: d, headers: c } = s;
|
|
7357
7357
|
if (d === 204) {
|
|
7358
7358
|
pe(this, se, et).call(this, "Server sent HTTP 204, not reconnecting", 204), this.close();
|
|
7359
7359
|
return;
|
|
7360
7360
|
}
|
|
7361
|
-
if (
|
|
7361
|
+
if (a ? x(this, xe, new URL(s.url)) : x(this, xe, void 0), d !== 200) {
|
|
7362
7362
|
pe(this, se, et).call(this, `Non-200 status code (${d})`, d);
|
|
7363
7363
|
return;
|
|
7364
7364
|
}
|
|
@@ -7370,11 +7370,11 @@ class kt extends EventTarget {
|
|
|
7370
7370
|
return;
|
|
7371
7371
|
x(this, J, this.OPEN);
|
|
7372
7372
|
const f = new Event("open");
|
|
7373
|
-
if ((o = A(this, Xe)) == null || o.call(this, f), this.dispatchEvent(f), typeof
|
|
7373
|
+
if ((o = A(this, Xe)) == null || o.call(this, f), this.dispatchEvent(f), typeof u != "object" || !u || !("getReader" in u)) {
|
|
7374
7374
|
pe(this, se, et).call(this, "Invalid response body, expected a web ReadableStream", d), this.close();
|
|
7375
7375
|
return;
|
|
7376
7376
|
}
|
|
7377
|
-
const l = new TextDecoder(), p =
|
|
7377
|
+
const l = new TextDecoder(), p = u.getReader();
|
|
7378
7378
|
let y = !0;
|
|
7379
7379
|
do {
|
|
7380
7380
|
const { done: b, value: _ } = await p.read();
|
|
@@ -7574,8 +7574,8 @@ function Kc({
|
|
|
7574
7574
|
style: i,
|
|
7575
7575
|
userCursorColor: s,
|
|
7576
7576
|
children: o,
|
|
7577
|
-
renderCursor:
|
|
7578
|
-
propagate:
|
|
7577
|
+
renderCursor: u,
|
|
7578
|
+
propagate: a,
|
|
7579
7579
|
zIndex: d
|
|
7580
7580
|
}) {
|
|
7581
7581
|
const c = e || `cursors-space-default--${String(n.type)}-${n.id}`, f = n.usePresence({
|
|
@@ -7594,7 +7594,7 @@ function Kc({
|
|
|
7594
7594
|
});
|
|
7595
7595
|
}
|
|
7596
7596
|
function y(g) {
|
|
7597
|
-
|
|
7597
|
+
a || g.stopPropagation();
|
|
7598
7598
|
const m = g.currentTarget.getBoundingClientRect();
|
|
7599
7599
|
p(m, g);
|
|
7600
7600
|
}
|
|
@@ -7608,7 +7608,7 @@ function Kc({
|
|
|
7608
7608
|
return;
|
|
7609
7609
|
const m = g.touches[0];
|
|
7610
7610
|
if (m.target instanceof Element) {
|
|
7611
|
-
|
|
7611
|
+
a || g.stopPropagation();
|
|
7612
7612
|
const O = m.target.getBoundingClientRect();
|
|
7613
7613
|
p(O, m);
|
|
7614
7614
|
}
|
|
@@ -7652,7 +7652,7 @@ function Kc({
|
|
|
7652
7652
|
transformOrigin: "0 0",
|
|
7653
7653
|
transition: "transform 100ms"
|
|
7654
7654
|
},
|
|
7655
|
-
children:
|
|
7655
|
+
children: u ? u({
|
|
7656
7656
|
color: O.color,
|
|
7657
7657
|
presence: l == null ? void 0 : l.peers[g]
|
|
7658
7658
|
}) : /* @__PURE__ */ V.jsx(Rc, { ...O })
|