@instantdb/react 1.0.3-branch-idb-fix.24363677444.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commonjs/index.d.ts +2 -2
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js.map +1 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/standalone/index.js +926 -894
- package/dist/standalone/index.umd.cjs +12 -12
- package/package.json +4 -4
- package/src/index.ts +2 -0
package/dist/standalone/index.js
CHANGED
|
@@ -2,7 +2,7 @@ var Mi = Object.defineProperty;
|
|
|
2
2
|
var Ri = (n, e, t) => e in n ? Mi(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
3
|
var p = (n, e, t) => Ri(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
import fs, { useRef as $e, useCallback as Me, useSyncExternalStore as qt, useEffect as We, useMemo as mn, useState as ds, createElement as ji } from "react";
|
|
5
|
-
function
|
|
5
|
+
function se(n) {
|
|
6
6
|
if (typeof n == "number")
|
|
7
7
|
return (Math.abs(n * 2654435761) >>> 0).toString(16);
|
|
8
8
|
if (typeof n == "boolean")
|
|
@@ -21,7 +21,7 @@ function ee(n) {
|
|
|
21
21
|
let e = 2166136261;
|
|
22
22
|
for (let t = 0; t < n.length; t++) {
|
|
23
23
|
e ^= (t + 1) * 2654435761;
|
|
24
|
-
const r =
|
|
24
|
+
const r = se(n[t]);
|
|
25
25
|
for (let s = 0; s < r.length; s++)
|
|
26
26
|
e ^= r.charCodeAt(s), e *= 16777619, e = e >>> 0;
|
|
27
27
|
}
|
|
@@ -34,20 +34,20 @@ function ee(n) {
|
|
|
34
34
|
const s = t[r];
|
|
35
35
|
if (n[s] === void 0)
|
|
36
36
|
continue;
|
|
37
|
-
const i =
|
|
37
|
+
const i = se(s);
|
|
38
38
|
e ^= parseInt(i, 16), e *= 16777619, e = e >>> 0;
|
|
39
|
-
const o =
|
|
39
|
+
const o = se(n[s]);
|
|
40
40
|
e ^= parseInt(o, 16), e *= 16777619, e = e >>> 0;
|
|
41
41
|
}
|
|
42
42
|
return e.toString(16);
|
|
43
43
|
}
|
|
44
|
-
return
|
|
44
|
+
return se(String(n));
|
|
45
45
|
}
|
|
46
|
-
const
|
|
46
|
+
const te = {
|
|
47
47
|
Remove: "remove",
|
|
48
48
|
Replace: "replace",
|
|
49
49
|
Add: "add"
|
|
50
|
-
}, hs = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), xi = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), Dt = Symbol.iterator,
|
|
50
|
+
}, hs = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), xi = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), Dt = Symbol.iterator, we = {
|
|
51
51
|
mutable: "mutable",
|
|
52
52
|
immutable: "immutable"
|
|
53
53
|
}, Qn = {};
|
|
@@ -71,7 +71,7 @@ function Bn(n) {
|
|
|
71
71
|
function Gn(n) {
|
|
72
72
|
return Object.getPrototypeOf(n) === Map.prototype;
|
|
73
73
|
}
|
|
74
|
-
function
|
|
74
|
+
function me(n) {
|
|
75
75
|
var e;
|
|
76
76
|
return (e = n.copy) !== null && e !== void 0 ? e : n.original;
|
|
77
77
|
}
|
|
@@ -86,11 +86,11 @@ function Hn(n) {
|
|
|
86
86
|
const t = D(n);
|
|
87
87
|
return t ? (e = t.copy) !== null && e !== void 0 ? e : t.original : n;
|
|
88
88
|
}
|
|
89
|
-
function
|
|
89
|
+
function ke(n, e) {
|
|
90
90
|
if (!n || typeof n != "object")
|
|
91
91
|
return !1;
|
|
92
92
|
let t;
|
|
93
|
-
return Object.getPrototypeOf(n) === Object.prototype || Array.isArray(n) || n instanceof Map || n instanceof Set || !!(e != null && e.mark) && ((t = e.mark(n,
|
|
93
|
+
return Object.getPrototypeOf(n) === Object.prototype || Array.isArray(n) || n instanceof Map || n instanceof Set || !!(e != null && e.mark) && ((t = e.mark(n, we)) === we.immutable || typeof t == "function");
|
|
94
94
|
}
|
|
95
95
|
function ps(n, e = []) {
|
|
96
96
|
if (Object.hasOwnProperty.call(n, "key")) {
|
|
@@ -123,7 +123,7 @@ function Et(n, e, t) {
|
|
|
123
123
|
}
|
|
124
124
|
function un(n, e) {
|
|
125
125
|
const t = D(n);
|
|
126
|
-
return (t ?
|
|
126
|
+
return (t ? me(t) : n)[e];
|
|
127
127
|
}
|
|
128
128
|
function Re(n, e) {
|
|
129
129
|
return n === e ? n !== 0 || 1 / n === 1 / e : n !== n && e !== e;
|
|
@@ -180,8 +180,8 @@ function ys(n, e) {
|
|
|
180
180
|
return new r(n);
|
|
181
181
|
}
|
|
182
182
|
return new Map(n);
|
|
183
|
-
} else if (e != null && e.mark && (t = e.mark(n,
|
|
184
|
-
if (t ===
|
|
183
|
+
} else if (e != null && e.mark && (t = e.mark(n, we), t !== void 0) && t !== we.mutable) {
|
|
184
|
+
if (t === we.immutable)
|
|
185
185
|
return Di(n);
|
|
186
186
|
if (typeof t == "function") {
|
|
187
187
|
if (e.enablePatches || e.enableAutoFreeze)
|
|
@@ -199,11 +199,11 @@ function ys(n, e) {
|
|
|
199
199
|
} else
|
|
200
200
|
throw new Error("Please check mark() to ensure that it is a stable marker draftable function.");
|
|
201
201
|
}
|
|
202
|
-
function
|
|
202
|
+
function de(n) {
|
|
203
203
|
n.copy || (n.copy = ys(n.original, n.options));
|
|
204
204
|
}
|
|
205
205
|
function dt(n) {
|
|
206
|
-
if (!
|
|
206
|
+
if (!ke(n))
|
|
207
207
|
return Hn(n);
|
|
208
208
|
if (Array.isArray(n))
|
|
209
209
|
return n.map(dt);
|
|
@@ -301,14 +301,14 @@ function Jn(n, e) {
|
|
|
301
301
|
n.forEach((r, s) => e(s, r, n));
|
|
302
302
|
}
|
|
303
303
|
function bs(n, e, t) {
|
|
304
|
-
if (qe(n) || !
|
|
304
|
+
if (qe(n) || !ke(n, t) || e.has(n) || Object.isFrozen(n))
|
|
305
305
|
return;
|
|
306
306
|
const r = n instanceof Set, s = r ? /* @__PURE__ */ new Map() : void 0;
|
|
307
307
|
if (e.add(n), Jn(n, (i, o) => {
|
|
308
308
|
var a;
|
|
309
309
|
if (qe(o)) {
|
|
310
310
|
const c = D(o);
|
|
311
|
-
|
|
311
|
+
de(c);
|
|
312
312
|
const u = !((a = c.assignedMap) === null || a === void 0) && a.size || c.operated ? c.copy : c.original;
|
|
313
313
|
Et(r ? s : n, i, u);
|
|
314
314
|
} else
|
|
@@ -347,7 +347,7 @@ function Yn(n, e, t, r) {
|
|
|
347
347
|
let u = s.original;
|
|
348
348
|
s.copy && (u = s.copy), Tn(n), Sn(n, r, i, o), n.options.enableAutoFreeze && (n.options.updatedValues = (a = n.options.updatedValues) !== null && a !== void 0 ? a : /* @__PURE__ */ new WeakMap(), n.options.updatedValues.set(u, s.original)), Et(c, e, u);
|
|
349
349
|
}
|
|
350
|
-
}), n.options.enableAutoFreeze && s.finalities !== n.finalities && (n.options.enableAutoFreeze = !1)),
|
|
350
|
+
}), n.options.enableAutoFreeze && s.finalities !== n.finalities && (n.options.enableAutoFreeze = !1)), ke(t, n.options) && n.finalities.draft.push(() => {
|
|
351
351
|
const i = n.type === 3 ? n.setMap : n.copy;
|
|
352
352
|
Re(je(i, e), t) && Li(n, e);
|
|
353
353
|
});
|
|
@@ -359,12 +359,12 @@ function Fi(n, e, t, r, s) {
|
|
|
359
359
|
if (o.get(u.toString()) && c[u] !== i[u]) {
|
|
360
360
|
const l = e.concat([u]), f = Ne(l, s);
|
|
361
361
|
t.push({
|
|
362
|
-
op:
|
|
362
|
+
op: te.Replace,
|
|
363
363
|
path: f,
|
|
364
364
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
365
365
|
value: Ut(c[u])
|
|
366
366
|
}), r.push({
|
|
367
|
-
op:
|
|
367
|
+
op: te.Replace,
|
|
368
368
|
path: f,
|
|
369
369
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
370
370
|
value: Ut(i[u])
|
|
@@ -373,7 +373,7 @@ function Fi(n, e, t, r, s) {
|
|
|
373
373
|
for (let u = i.length; u < c.length; u += 1) {
|
|
374
374
|
const l = e.concat([u]), f = Ne(l, s);
|
|
375
375
|
t.push({
|
|
376
|
-
op:
|
|
376
|
+
op: te.Add,
|
|
377
377
|
path: f,
|
|
378
378
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
379
379
|
value: Ut(c[u])
|
|
@@ -384,7 +384,7 @@ function Fi(n, e, t, r, s) {
|
|
|
384
384
|
if (u) {
|
|
385
385
|
const l = e.concat(["length"]), f = Ne(l, s);
|
|
386
386
|
r.push({
|
|
387
|
-
op:
|
|
387
|
+
op: te.Replace,
|
|
388
388
|
path: f,
|
|
389
389
|
value: i.length
|
|
390
390
|
});
|
|
@@ -392,7 +392,7 @@ function Fi(n, e, t, r, s) {
|
|
|
392
392
|
for (let l = c.length; i.length < l; l -= 1) {
|
|
393
393
|
const f = e.concat([l - 1]), d = Ne(f, s);
|
|
394
394
|
r.push({
|
|
395
|
-
op:
|
|
395
|
+
op: te.Remove,
|
|
396
396
|
path: d
|
|
397
397
|
});
|
|
398
398
|
}
|
|
@@ -400,11 +400,11 @@ function Fi(n, e, t, r, s) {
|
|
|
400
400
|
}
|
|
401
401
|
function Ni({ original: n, copy: e, assignedMap: t }, r, s, i, o) {
|
|
402
402
|
t.forEach((a, c) => {
|
|
403
|
-
const u = je(n, c), l = Ut(je(e, c)), f = a ? mt(n, c) ?
|
|
404
|
-
if (Re(u, l) && f ===
|
|
403
|
+
const u = je(n, c), l = Ut(je(e, c)), f = a ? mt(n, c) ? te.Replace : te.Add : te.Remove;
|
|
404
|
+
if (Re(u, l) && f === te.Replace)
|
|
405
405
|
return;
|
|
406
406
|
const d = r.concat(c), y = Ne(d, o);
|
|
407
|
-
s.push(f ===
|
|
407
|
+
s.push(f === te.Remove ? { op: f, path: y } : { op: f, path: y, value: l }), i.push(f === te.Add ? { op: te.Remove, path: y } : f === te.Remove ? { op: te.Add, path: y, value: u } : { op: te.Replace, path: y, value: u });
|
|
408
408
|
});
|
|
409
409
|
}
|
|
410
410
|
function Ki({ original: n, copy: e }, t, r, s, i) {
|
|
@@ -413,11 +413,11 @@ function Ki({ original: n, copy: e }, t, r, s, i) {
|
|
|
413
413
|
if (!e.has(a)) {
|
|
414
414
|
const c = t.concat([o]), u = Ne(c, i);
|
|
415
415
|
r.push({
|
|
416
|
-
op:
|
|
416
|
+
op: te.Remove,
|
|
417
417
|
path: u,
|
|
418
418
|
value: a
|
|
419
419
|
}), s.unshift({
|
|
420
|
-
op:
|
|
420
|
+
op: te.Add,
|
|
421
421
|
path: u,
|
|
422
422
|
value: a
|
|
423
423
|
});
|
|
@@ -427,11 +427,11 @@ function Ki({ original: n, copy: e }, t, r, s, i) {
|
|
|
427
427
|
if (!n.has(a)) {
|
|
428
428
|
const c = t.concat([o]), u = Ne(c, i);
|
|
429
429
|
r.push({
|
|
430
|
-
op:
|
|
430
|
+
op: te.Add,
|
|
431
431
|
path: u,
|
|
432
432
|
value: a
|
|
433
433
|
}), s.unshift({
|
|
434
|
-
op:
|
|
434
|
+
op: te.Remove,
|
|
435
435
|
path: u,
|
|
436
436
|
value: a
|
|
437
437
|
});
|
|
@@ -452,29 +452,29 @@ function vt(n, e, t, r) {
|
|
|
452
452
|
}
|
|
453
453
|
}
|
|
454
454
|
const zt = (n, e, t = !1) => {
|
|
455
|
-
if (typeof n == "object" && n !== null && (!
|
|
455
|
+
if (typeof n == "object" && n !== null && (!ke(n, e) || t))
|
|
456
456
|
throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.");
|
|
457
457
|
}, vn = {
|
|
458
458
|
get size() {
|
|
459
|
-
return
|
|
459
|
+
return me(D(this)).size;
|
|
460
460
|
},
|
|
461
461
|
has(n) {
|
|
462
|
-
return
|
|
462
|
+
return me(D(this)).has(n);
|
|
463
463
|
},
|
|
464
464
|
set(n, e) {
|
|
465
|
-
const t = D(this), r =
|
|
466
|
-
return (!r.has(n) || !Re(r.get(n), e)) && (
|
|
465
|
+
const t = D(this), r = me(t);
|
|
466
|
+
return (!r.has(n) || !Re(r.get(n), e)) && (de(t), Ie(t), t.assignedMap.set(n, !0), t.copy.set(n, e), Yn(t, n, e, vt)), this;
|
|
467
467
|
},
|
|
468
468
|
delete(n) {
|
|
469
469
|
if (!this.has(n))
|
|
470
470
|
return !1;
|
|
471
471
|
const e = D(this);
|
|
472
|
-
return
|
|
472
|
+
return de(e), Ie(e), e.original.has(n) ? e.assignedMap.set(n, !1) : e.assignedMap.delete(n), e.copy.delete(n), !0;
|
|
473
473
|
},
|
|
474
474
|
clear() {
|
|
475
475
|
const n = D(this);
|
|
476
476
|
if (this.size) {
|
|
477
|
-
|
|
477
|
+
de(n), Ie(n), n.assignedMap = /* @__PURE__ */ new Map();
|
|
478
478
|
for (const [e] of n.original)
|
|
479
479
|
n.assignedMap.set(e, !1);
|
|
480
480
|
n.copy.clear();
|
|
@@ -482,14 +482,14 @@ const zt = (n, e, t = !1) => {
|
|
|
482
482
|
},
|
|
483
483
|
forEach(n, e) {
|
|
484
484
|
const t = D(this);
|
|
485
|
-
|
|
485
|
+
me(t).forEach((r, s) => {
|
|
486
486
|
n.call(e, this.get(s), s, this);
|
|
487
487
|
});
|
|
488
488
|
},
|
|
489
489
|
get(n) {
|
|
490
490
|
var e, t;
|
|
491
|
-
const r = D(this), s =
|
|
492
|
-
if (r.options.strict && zt(s, r.options, i), i || r.finalized || !
|
|
491
|
+
const r = D(this), s = me(r).get(n), i = ((t = (e = r.options).mark) === null || t === void 0 ? void 0 : t.call(e, s, we)) === we.mutable;
|
|
492
|
+
if (r.options.strict && zt(s, r.options, i), i || r.finalized || !ke(s, r.options) || s !== r.original.get(n))
|
|
493
493
|
return s;
|
|
494
494
|
const o = Qn.createDraft({
|
|
495
495
|
original: s,
|
|
@@ -498,10 +498,10 @@ const zt = (n, e, t = !1) => {
|
|
|
498
498
|
finalities: r.finalities,
|
|
499
499
|
options: r.options
|
|
500
500
|
});
|
|
501
|
-
return
|
|
501
|
+
return de(r), r.copy.set(n, o), o;
|
|
502
502
|
},
|
|
503
503
|
keys() {
|
|
504
|
-
return
|
|
504
|
+
return me(D(this)).keys();
|
|
505
505
|
},
|
|
506
506
|
values() {
|
|
507
507
|
const n = this.keys();
|
|
@@ -542,8 +542,8 @@ const zt = (n, e, t = !1) => {
|
|
|
542
542
|
return i;
|
|
543
543
|
const o = i.value;
|
|
544
544
|
let a = n.setMap.get(o);
|
|
545
|
-
const c = D(a), u = ((s = (r = n.options).mark) === null || s === void 0 ? void 0 : s.call(r, a,
|
|
546
|
-
if (n.options.strict && zt(o, n.options, u), !u && !c &&
|
|
545
|
+
const c = D(a), u = ((s = (r = n.options).mark) === null || s === void 0 ? void 0 : s.call(r, a, we)) === we.mutable;
|
|
546
|
+
if (n.options.strict && zt(o, n.options, u), !u && !c && ke(o, n.options) && !n.finalized && n.original.has(o)) {
|
|
547
547
|
const l = Qn.createDraft({
|
|
548
548
|
original: o,
|
|
549
549
|
parentDraft: n,
|
|
@@ -565,19 +565,19 @@ const zt = (n, e, t = !1) => {
|
|
|
565
565
|
const e = D(this);
|
|
566
566
|
if (e.setMap.has(n))
|
|
567
567
|
return !0;
|
|
568
|
-
|
|
568
|
+
de(e);
|
|
569
569
|
const t = D(n);
|
|
570
570
|
return !!(t && e.setMap.has(t.original));
|
|
571
571
|
},
|
|
572
572
|
add(n) {
|
|
573
573
|
const e = D(this);
|
|
574
|
-
return this.has(n) || (
|
|
574
|
+
return this.has(n) || (de(e), Ie(e), e.assignedMap.set(n, !0), e.setMap.set(n, n), Yn(e, n, n, vt)), this;
|
|
575
575
|
},
|
|
576
576
|
delete(n) {
|
|
577
577
|
if (!this.has(n))
|
|
578
578
|
return !1;
|
|
579
579
|
const e = D(this);
|
|
580
|
-
|
|
580
|
+
de(e), Ie(e);
|
|
581
581
|
const t = D(n);
|
|
582
582
|
return t && e.setMap.has(t.original) ? (e.assignedMap.set(t.original, !1), e.setMap.delete(t.original)) : (!t && e.setMap.has(n) ? e.assignedMap.set(n, !1) : e.assignedMap.delete(n), e.setMap.delete(n));
|
|
583
583
|
},
|
|
@@ -585,14 +585,14 @@ const zt = (n, e, t = !1) => {
|
|
|
585
585
|
if (!this.size)
|
|
586
586
|
return;
|
|
587
587
|
const n = D(this);
|
|
588
|
-
|
|
588
|
+
de(n), Ie(n);
|
|
589
589
|
for (const e of n.original)
|
|
590
590
|
n.assignedMap.set(e, !1);
|
|
591
591
|
n.setMap.clear();
|
|
592
592
|
},
|
|
593
593
|
values() {
|
|
594
594
|
const n = D(this);
|
|
595
|
-
|
|
595
|
+
de(n);
|
|
596
596
|
const e = n.setMap.keys();
|
|
597
597
|
return {
|
|
598
598
|
[Symbol.iterator]: () => this.values(),
|
|
@@ -601,7 +601,7 @@ const zt = (n, e, t = !1) => {
|
|
|
601
601
|
},
|
|
602
602
|
entries() {
|
|
603
603
|
const n = D(this);
|
|
604
|
-
|
|
604
|
+
de(n);
|
|
605
605
|
const e = n.setMap.keys();
|
|
606
606
|
return {
|
|
607
607
|
[Symbol.iterator]: () => this.entries(),
|
|
@@ -657,10 +657,10 @@ const qi = Reflect.ownKeys(Vt), gs = /* @__PURE__ */ new WeakSet(), _s = {
|
|
|
657
657
|
let o;
|
|
658
658
|
if (n.options.mark) {
|
|
659
659
|
const u = e === "size" && (n.original instanceof Map || n.original instanceof Set) ? Reflect.get(n.original, e) : Reflect.get(n.original, e, t);
|
|
660
|
-
if (o = n.options.mark(u,
|
|
660
|
+
if (o = n.options.mark(u, we), o === we.mutable)
|
|
661
661
|
return n.options.strict && zt(u, n.options, !0), u;
|
|
662
662
|
}
|
|
663
|
-
const a =
|
|
663
|
+
const a = me(n);
|
|
664
664
|
if (a instanceof Map && Wi.includes(e)) {
|
|
665
665
|
if (e === "size")
|
|
666
666
|
return Object.getOwnPropertyDescriptor(vn, "size").get.call(n.proxy);
|
|
@@ -683,10 +683,10 @@ const qi = Reflect.ownKeys(Vt), gs = /* @__PURE__ */ new WeakSet(), _s = {
|
|
|
683
683
|
) : void 0;
|
|
684
684
|
}
|
|
685
685
|
const c = a[e];
|
|
686
|
-
if (n.options.strict && zt(c, n.options), n.finalized || !
|
|
686
|
+
if (n.options.strict && zt(c, n.options), n.finalized || !ke(c, n.options))
|
|
687
687
|
return c;
|
|
688
688
|
if (c === un(n.original, e)) {
|
|
689
|
-
if (
|
|
689
|
+
if (de(n), n.copy[e] = Zn({
|
|
690
690
|
original: n.original[e],
|
|
691
691
|
parentDraft: n,
|
|
692
692
|
key: n.type === 1 ? Number(e) : e,
|
|
@@ -694,7 +694,7 @@ const qi = Reflect.ownKeys(Vt), gs = /* @__PURE__ */ new WeakSet(), _s = {
|
|
|
694
694
|
options: n.options
|
|
695
695
|
}), typeof o == "function") {
|
|
696
696
|
const u = D(n.copy[e]);
|
|
697
|
-
return
|
|
697
|
+
return de(u), Ie(u), u.copy;
|
|
698
698
|
}
|
|
699
699
|
return n.copy[e];
|
|
700
700
|
}
|
|
@@ -707,20 +707,20 @@ const qi = Reflect.ownKeys(Vt), gs = /* @__PURE__ */ new WeakSet(), _s = {
|
|
|
707
707
|
let s;
|
|
708
708
|
if (n.type === 1 && e !== "length" && !(Number.isInteger(s = Number(e)) && s >= 0 && (e === 0 || s === 0 || String(s) === String(e))))
|
|
709
709
|
throw new Error("Only supports setting array indices and the 'length' property.");
|
|
710
|
-
const i = Sr(
|
|
710
|
+
const i = Sr(me(n), e);
|
|
711
711
|
if (i != null && i.set)
|
|
712
712
|
return i.set.call(n.proxy, t), !0;
|
|
713
|
-
const o = un(
|
|
714
|
-
return a && Re(a.original, t) ? (n.copy[e] = t, n.assignedMap = (r = n.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), n.assignedMap.set(e, !1), !0) : (Re(t, o) && (t !== void 0 || mt(n.original, e)) || (
|
|
713
|
+
const o = un(me(n), e), a = D(o);
|
|
714
|
+
return a && Re(a.original, t) ? (n.copy[e] = t, n.assignedMap = (r = n.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), n.assignedMap.set(e, !1), !0) : (Re(t, o) && (t !== void 0 || mt(n.original, e)) || (de(n), Ie(n), mt(n.original, e) && Re(t, n.original[e]) ? n.assignedMap.delete(e) : n.assignedMap.set(e, !0), n.copy[e] = t, Yn(n, e, t, vt)), !0);
|
|
715
715
|
},
|
|
716
716
|
has(n, e) {
|
|
717
|
-
return e in
|
|
717
|
+
return e in me(n);
|
|
718
718
|
},
|
|
719
719
|
ownKeys(n) {
|
|
720
|
-
return Reflect.ownKeys(
|
|
720
|
+
return Reflect.ownKeys(me(n));
|
|
721
721
|
},
|
|
722
722
|
getOwnPropertyDescriptor(n, e) {
|
|
723
|
-
const t =
|
|
723
|
+
const t = me(n), r = Reflect.getOwnPropertyDescriptor(t, e);
|
|
724
724
|
return r && {
|
|
725
725
|
writable: !0,
|
|
726
726
|
configurable: n.type !== 1 || e !== "length",
|
|
@@ -739,7 +739,7 @@ const qi = Reflect.ownKeys(Vt), gs = /* @__PURE__ */ new WeakSet(), _s = {
|
|
|
739
739
|
},
|
|
740
740
|
deleteProperty(n, e) {
|
|
741
741
|
var t;
|
|
742
|
-
return n.type === 1 ? _s.set.call(this, n, e, void 0, n.proxy) : (un(n.original, e) !== void 0 || e in n.original ? (
|
|
742
|
+
return n.type === 1 ? _s.set.call(this, n, e, void 0, n.proxy) : (un(n.original, e) !== void 0 || e in n.original ? (de(n), Ie(n), n.assignedMap.set(e, !1)) : (n.assignedMap = (t = n.assignedMap) !== null && t !== void 0 ? t : /* @__PURE__ */ new Map(), n.assignedMap.delete(e)), n.copy && delete n.copy[e], !0);
|
|
743
743
|
}
|
|
744
744
|
};
|
|
745
745
|
function Zn(n) {
|
|
@@ -762,14 +762,14 @@ function Zn(n) {
|
|
|
762
762
|
l.finalities.draft.push((f, d) => {
|
|
763
763
|
var y, b;
|
|
764
764
|
const g = D(c);
|
|
765
|
-
let
|
|
766
|
-
const S = je(
|
|
765
|
+
let m = l.type === 3 ? l.setMap : l.copy;
|
|
766
|
+
const S = je(m, r), _ = D(S);
|
|
767
767
|
if (_) {
|
|
768
|
-
let
|
|
769
|
-
_.operated && (
|
|
768
|
+
let w = _.original;
|
|
769
|
+
_.operated && (w = Hn(S)), Tn(_), Sn(_, vt, f, d), l.options.enableAutoFreeze && (l.options.updatedValues = (y = l.options.updatedValues) !== null && y !== void 0 ? y : /* @__PURE__ */ new WeakMap(), l.options.updatedValues.set(w, _.original)), Et(m, r, w);
|
|
770
770
|
}
|
|
771
|
-
(b = g.callbacks) === null || b === void 0 || b.forEach((
|
|
772
|
-
|
|
771
|
+
(b = g.callbacks) === null || b === void 0 || b.forEach((w) => {
|
|
772
|
+
w(f, d);
|
|
773
773
|
});
|
|
774
774
|
});
|
|
775
775
|
} else {
|
|
@@ -790,8 +790,8 @@ function zi(n, e, t, r, s) {
|
|
|
790
790
|
const u = c ? e[0] : o ? o.operated ? o.copy : o.original : n;
|
|
791
791
|
return o && wn(o), s && Je(u, u, o == null ? void 0 : o.options.updatedValues), [
|
|
792
792
|
u,
|
|
793
|
-
t && c ? [{ op:
|
|
794
|
-
r && c ? [{ op:
|
|
793
|
+
t && c ? [{ op: te.Replace, path: [], value: e[0] }] : t,
|
|
794
|
+
r && c ? [{ op: te.Replace, path: [], value: a }] : r
|
|
795
795
|
];
|
|
796
796
|
}
|
|
797
797
|
function Vi(n, e) {
|
|
@@ -803,7 +803,7 @@ function Vi(n, e) {
|
|
|
803
803
|
};
|
|
804
804
|
let s, i;
|
|
805
805
|
e.enablePatches && (s = [], i = []);
|
|
806
|
-
const a = ((t = e.mark) === null || t === void 0 ? void 0 : t.call(e, n,
|
|
806
|
+
const a = ((t = e.mark) === null || t === void 0 ? void 0 : t.call(e, n, we)) === we.mutable || !ke(n, e) ? n : Zn({
|
|
807
807
|
original: n,
|
|
808
808
|
parentDraft: null,
|
|
809
809
|
finalities: r,
|
|
@@ -835,7 +835,7 @@ function En(n) {
|
|
|
835
835
|
function ms(n) {
|
|
836
836
|
var e;
|
|
837
837
|
const t = D(n);
|
|
838
|
-
if (!
|
|
838
|
+
if (!ke(n, t == null ? void 0 : t.options))
|
|
839
839
|
return n;
|
|
840
840
|
const r = ze(n);
|
|
841
841
|
if (t && !t.operated)
|
|
@@ -872,72 +872,72 @@ function Or(n) {
|
|
|
872
872
|
const Qi = (n) => function e(t, r, s) {
|
|
873
873
|
var i, o, a;
|
|
874
874
|
if (typeof t == "function" && typeof r != "function")
|
|
875
|
-
return function(v, ...
|
|
876
|
-
return e(v, (
|
|
875
|
+
return function(v, ...U) {
|
|
876
|
+
return e(v, (I) => t.call(this, I, ...U), r);
|
|
877
877
|
};
|
|
878
878
|
const c = t, u = r;
|
|
879
879
|
let l = s;
|
|
880
880
|
if (typeof r != "function" && (l = r), l !== void 0 && Object.prototype.toString.call(l) !== "[object Object]")
|
|
881
881
|
throw new Error(`Invalid options: ${l}, 'options' should be an object.`);
|
|
882
882
|
l = Object.assign(Object.assign({}, n), l);
|
|
883
|
-
const f = qe(c) ? Or(c) : c, d = Array.isArray(l.mark) ? (v,
|
|
884
|
-
for (const
|
|
885
|
-
if (typeof
|
|
886
|
-
throw new Error(`Invalid mark: ${
|
|
887
|
-
const
|
|
888
|
-
if (
|
|
889
|
-
return
|
|
890
|
-
}
|
|
891
|
-
} : l.mark, y = (i = l.enablePatches) !== null && i !== void 0 ? i : !1, b = (o = l.strict) !== null && o !== void 0 ? o : !1,
|
|
883
|
+
const f = qe(c) ? Or(c) : c, d = Array.isArray(l.mark) ? (v, U) => {
|
|
884
|
+
for (const I of l.mark) {
|
|
885
|
+
if (typeof I != "function")
|
|
886
|
+
throw new Error(`Invalid mark: ${I}, 'mark' should be a function.`);
|
|
887
|
+
const P = I(v, U);
|
|
888
|
+
if (P)
|
|
889
|
+
return P;
|
|
890
|
+
}
|
|
891
|
+
} : l.mark, y = (i = l.enablePatches) !== null && i !== void 0 ? i : !1, b = (o = l.strict) !== null && o !== void 0 ? o : !1, m = {
|
|
892
892
|
enableAutoFreeze: (a = l.enableAutoFreeze) !== null && a !== void 0 ? a : !1,
|
|
893
893
|
mark: d,
|
|
894
894
|
strict: b,
|
|
895
895
|
enablePatches: y
|
|
896
896
|
};
|
|
897
|
-
if (!
|
|
897
|
+
if (!ke(f, m) && typeof f == "object" && f !== null)
|
|
898
898
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
899
|
-
const [S, _] = Vi(f,
|
|
899
|
+
const [S, _] = Vi(f, m);
|
|
900
900
|
if (typeof r != "function") {
|
|
901
|
-
if (!
|
|
901
|
+
if (!ke(f, m))
|
|
902
902
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
903
903
|
return [S, _];
|
|
904
904
|
}
|
|
905
|
-
let
|
|
905
|
+
let w;
|
|
906
906
|
try {
|
|
907
|
-
|
|
907
|
+
w = u(S);
|
|
908
908
|
} catch (v) {
|
|
909
909
|
throw wn(D(S)), v;
|
|
910
910
|
}
|
|
911
|
-
const
|
|
912
|
-
const
|
|
911
|
+
const C = (v) => {
|
|
912
|
+
const U = D(S);
|
|
913
913
|
if (!qe(v)) {
|
|
914
|
-
if (v !== void 0 && !Re(v, S) && (
|
|
914
|
+
if (v !== void 0 && !Re(v, S) && (U != null && U.operated))
|
|
915
915
|
throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");
|
|
916
|
-
const
|
|
917
|
-
if (
|
|
918
|
-
const
|
|
919
|
-
return
|
|
920
|
-
rootDraft:
|
|
916
|
+
const P = v == null ? void 0 : v[xi];
|
|
917
|
+
if (P) {
|
|
918
|
+
const H = P[0];
|
|
919
|
+
return m.strict && typeof v == "object" && v !== null && En({
|
|
920
|
+
rootDraft: U,
|
|
921
921
|
value: v,
|
|
922
922
|
useRawReturn: !0
|
|
923
|
-
}), _([
|
|
923
|
+
}), _([H]);
|
|
924
924
|
}
|
|
925
925
|
if (v !== void 0)
|
|
926
|
-
return typeof v == "object" && v !== null && En({ rootDraft:
|
|
926
|
+
return typeof v == "object" && v !== null && En({ rootDraft: U, value: v }), _([v]);
|
|
927
927
|
}
|
|
928
928
|
if (v === S || v === void 0)
|
|
929
929
|
return _([]);
|
|
930
|
-
const
|
|
931
|
-
if (
|
|
932
|
-
if (
|
|
930
|
+
const I = D(v);
|
|
931
|
+
if (m === I.options) {
|
|
932
|
+
if (I.operated)
|
|
933
933
|
throw new Error("Cannot return a modified child draft.");
|
|
934
934
|
return _([Or(v)]);
|
|
935
935
|
}
|
|
936
936
|
return _([v]);
|
|
937
937
|
};
|
|
938
|
-
return
|
|
938
|
+
return w instanceof Promise ? w.then(C, (v) => {
|
|
939
939
|
throw wn(D(S)), v;
|
|
940
|
-
}) :
|
|
940
|
+
}) : C(w);
|
|
941
941
|
}, Qt = Qi();
|
|
942
942
|
Object.prototype.constructor.toString();
|
|
943
943
|
function ws(n, e) {
|
|
@@ -1370,7 +1370,7 @@ class Ke {
|
|
|
1370
1370
|
for (const e of Object.values(this.attrs))
|
|
1371
1371
|
if (tr(e)) {
|
|
1372
1372
|
const [t, r, s] = e["forward-identity"];
|
|
1373
|
-
|
|
1373
|
+
be(this.blobAttrs, [r, s], e);
|
|
1374
1374
|
}
|
|
1375
1375
|
return this._blobAttrs;
|
|
1376
1376
|
}
|
|
@@ -1381,7 +1381,7 @@ class Ke {
|
|
|
1381
1381
|
for (const e of Object.values(this.attrs))
|
|
1382
1382
|
if (e["primary?"]) {
|
|
1383
1383
|
const [t, r] = e["forward-identity"];
|
|
1384
|
-
|
|
1384
|
+
be(this._primaryKeys, [r], e);
|
|
1385
1385
|
}
|
|
1386
1386
|
return this._primaryKeys;
|
|
1387
1387
|
}
|
|
@@ -1391,7 +1391,7 @@ class Ke {
|
|
|
1391
1391
|
this._forwardIdents = /* @__PURE__ */ new Map();
|
|
1392
1392
|
for (const e of Object.values(this.attrs)) {
|
|
1393
1393
|
const t = e["forward-identity"], [r, s, i] = t;
|
|
1394
|
-
|
|
1394
|
+
be(this._forwardIdents, [s, i], e);
|
|
1395
1395
|
}
|
|
1396
1396
|
return this._forwardIdents;
|
|
1397
1397
|
}
|
|
@@ -1403,7 +1403,7 @@ class Ke {
|
|
|
1403
1403
|
const t = e["reverse-identity"];
|
|
1404
1404
|
if (t) {
|
|
1405
1405
|
const [r, s, i] = t;
|
|
1406
|
-
|
|
1406
|
+
be(this._revIdents, [s, i], e);
|
|
1407
1407
|
}
|
|
1408
1408
|
}
|
|
1409
1409
|
return this._revIdents;
|
|
@@ -1424,7 +1424,7 @@ function tr(n) {
|
|
|
1424
1424
|
function ot(n, e) {
|
|
1425
1425
|
return e.reduce((t, r) => t && t.get(r), n);
|
|
1426
1426
|
}
|
|
1427
|
-
function
|
|
1427
|
+
function Oe(n, e) {
|
|
1428
1428
|
if (e.length === 0)
|
|
1429
1429
|
throw new Error("path must have at least one element");
|
|
1430
1430
|
if (e.length === 1) {
|
|
@@ -1432,9 +1432,9 @@ function Ee(n, e) {
|
|
|
1432
1432
|
return;
|
|
1433
1433
|
}
|
|
1434
1434
|
const [t, ...r] = e;
|
|
1435
|
-
n.has(t) &&
|
|
1435
|
+
n.has(t) && Oe(n.get(t), r);
|
|
1436
1436
|
}
|
|
1437
|
-
function
|
|
1437
|
+
function be(n, e, t) {
|
|
1438
1438
|
let r = n;
|
|
1439
1439
|
const s = e.length - 1;
|
|
1440
1440
|
for (let i = 0; i < s; i++) {
|
|
@@ -1453,13 +1453,13 @@ function vs(n, e, t) {
|
|
|
1453
1453
|
console.warn("no such attr", c, a);
|
|
1454
1454
|
continue;
|
|
1455
1455
|
}
|
|
1456
|
-
l["checked-data-type"] === "date" && t && (u = Jt(u), o[2] = u), er(l) &&
|
|
1456
|
+
l["checked-data-type"] === "date" && t && (u = Jt(u), o[2] = u), er(l) && be(i, [u, c, a], o), be(r, [a, c, u], o), be(s, [c, a, u], o);
|
|
1457
1457
|
}
|
|
1458
1458
|
return { eav: r, aev: s, vae: i };
|
|
1459
1459
|
}
|
|
1460
1460
|
function Es(n) {
|
|
1461
1461
|
return {
|
|
1462
|
-
triples:
|
|
1462
|
+
triples: ge(n.eav, 3),
|
|
1463
1463
|
cardinalityInference: n.cardinalityInference,
|
|
1464
1464
|
useDateObjects: n.useDateObjects,
|
|
1465
1465
|
version: 1
|
|
@@ -1488,7 +1488,7 @@ function Ot(n, e) {
|
|
|
1488
1488
|
const [o, a] = e[0], c = n.aev.get(o);
|
|
1489
1489
|
if (!c)
|
|
1490
1490
|
return null;
|
|
1491
|
-
t = (s =
|
|
1491
|
+
t = (s = ge(c, 2).find((l) => l[2] === a)) == null ? void 0 : s[0];
|
|
1492
1492
|
} else
|
|
1493
1493
|
t = e[0];
|
|
1494
1494
|
if (!t)
|
|
@@ -1498,7 +1498,7 @@ function Ot(n, e) {
|
|
|
1498
1498
|
const [o, a] = r, c = n.aev.get(o);
|
|
1499
1499
|
if (!c)
|
|
1500
1500
|
return null;
|
|
1501
|
-
const l = (i =
|
|
1501
|
+
const l = (i = ge(c, 2).find((g) => g[2] === a)) == null ? void 0 : i[0];
|
|
1502
1502
|
if (!l)
|
|
1503
1503
|
return null;
|
|
1504
1504
|
const [f, d, y, ...b] = e;
|
|
@@ -1513,7 +1513,7 @@ function As(n, e, t) {
|
|
|
1513
1513
|
if (!r)
|
|
1514
1514
|
return;
|
|
1515
1515
|
const [s, i, o] = r, a = e.getAttr(i);
|
|
1516
|
-
a && (
|
|
1516
|
+
a && (Oe(n.eav, [s, i, o]), Oe(n.aev, [i, s, o]), er(a) && Oe(n.vae, [o, i, s]));
|
|
1517
1517
|
}
|
|
1518
1518
|
let yo = 0;
|
|
1519
1519
|
function Cs(n, e, t) {
|
|
@@ -1532,7 +1532,7 @@ function Is(n, e, t) {
|
|
|
1532
1532
|
return;
|
|
1533
1533
|
a["checked-data-type"] === "date" && n.useDateObjects && (o = Jt(o));
|
|
1534
1534
|
const c = ot(n.eav, [s, i, o]), u = (c == null ? void 0 : c[3]) ?? Cs(n, a, r), l = [s, i, o, u];
|
|
1535
|
-
ho(a) ? (
|
|
1535
|
+
ho(a) ? (be(n.eav, [s, i], /* @__PURE__ */ new Map([[o, l]])), be(n.aev, [i, s], /* @__PURE__ */ new Map([[o, l]]))) : (be(n.eav, [s, i, o], l), be(n.aev, [i, s, o], l)), er(a) && be(n.vae, [o, i, s], l);
|
|
1536
1536
|
}
|
|
1537
1537
|
function bo(n, e, t) {
|
|
1538
1538
|
var y;
|
|
@@ -1556,7 +1556,7 @@ function bo(n, e, t) {
|
|
|
1556
1556
|
f,
|
|
1557
1557
|
Cs(n, a, u)
|
|
1558
1558
|
];
|
|
1559
|
-
|
|
1559
|
+
be(n.eav, [s, i], /* @__PURE__ */ new Map([[f, d]])), be(n.aev, [i, s], /* @__PURE__ */ new Map([[f, d]]));
|
|
1560
1560
|
}
|
|
1561
1561
|
function kn(n, e, t) {
|
|
1562
1562
|
var u, l;
|
|
@@ -1567,23 +1567,23 @@ function kn(n, e, t) {
|
|
|
1567
1567
|
if (a) {
|
|
1568
1568
|
for (const f of a.keys()) {
|
|
1569
1569
|
const d = e.getAttr(f);
|
|
1570
|
-
d && d["on-delete-reverse"] === "cascade" &&
|
|
1571
|
-
var
|
|
1572
|
-
return kn(n, e, [g, (
|
|
1570
|
+
d && d["on-delete-reverse"] === "cascade" && ge(a.get(f), 1).forEach(([y, b, g]) => {
|
|
1571
|
+
var m;
|
|
1572
|
+
return kn(n, e, [g, (m = d["reverse-identity"]) == null ? void 0 : m[1]]);
|
|
1573
1573
|
}), // Fall back to deleting everything if we've rehydrated tx-steps from
|
|
1574
1574
|
// the store that didn't set `etype` in deleteEntity
|
|
1575
1575
|
(!s || // If we don't know about the attr, let's just get rid of it
|
|
1576
1576
|
!d || // Make sure it matches the etype
|
|
1577
|
-
((u = d["forward-identity"]) == null ? void 0 : u[1]) === s) && (
|
|
1577
|
+
((u = d["forward-identity"]) == null ? void 0 : u[1]) === s) && (Oe(n.aev, [f, o]), Oe(n.eav, [o, f]));
|
|
1578
1578
|
}
|
|
1579
|
-
a.size === 0 &&
|
|
1579
|
+
a.size === 0 && Oe(n.eav, [o]);
|
|
1580
1580
|
}
|
|
1581
|
-
const c = n.vae.get(o) &&
|
|
1581
|
+
const c = n.vae.get(o) && ge(n.vae.get(o), 2);
|
|
1582
1582
|
c && c.forEach((f) => {
|
|
1583
|
-
var
|
|
1583
|
+
var m, S, _;
|
|
1584
1584
|
const [d, y, b] = f, g = e.getAttr(y);
|
|
1585
|
-
(!s || !g || ((
|
|
1586
|
-
}), ((l = n.vae.get(o)) == null ? void 0 : l.size) === 0 &&
|
|
1585
|
+
(!s || !g || ((m = g["reverse-identity"]) == null ? void 0 : m[1]) === s) && (Oe(n.eav, [d, y, b]), Oe(n.aev, [y, d, b]), Oe(n.vae, [b, y, d])), g && g["on-delete"] === "cascade" && ((S = g["reverse-identity"]) == null ? void 0 : S[1]) === s && kn(n, e, [d, (_ = g["forward-identity"]) == null ? void 0 : _[1]]);
|
|
1586
|
+
}), ((l = n.vae.get(o)) == null ? void 0 : l.size) === 0 && Oe(n.vae, [o]);
|
|
1587
1587
|
}
|
|
1588
1588
|
function Ps(n, e, t) {
|
|
1589
1589
|
const r = vs(e, t, n.useDateObjects);
|
|
@@ -1595,7 +1595,7 @@ function go(n, [e]) {
|
|
|
1595
1595
|
n.addAttr(e);
|
|
1596
1596
|
}
|
|
1597
1597
|
function Ms(n) {
|
|
1598
|
-
return
|
|
1598
|
+
return ge(n.eav, 3);
|
|
1599
1599
|
}
|
|
1600
1600
|
function _o(n, e, [t]) {
|
|
1601
1601
|
if (!e.getAttr(t))
|
|
@@ -1638,7 +1638,7 @@ function wo(n, e, t) {
|
|
|
1638
1638
|
throw new Error(`unhandled transaction action: ${r}`);
|
|
1639
1639
|
}
|
|
1640
1640
|
}
|
|
1641
|
-
function
|
|
1641
|
+
function ge(n, e, t = []) {
|
|
1642
1642
|
if (!n || e === 0)
|
|
1643
1643
|
return t;
|
|
1644
1644
|
if (e === 1) {
|
|
@@ -1647,7 +1647,7 @@ function ye(n, e, t = []) {
|
|
|
1647
1647
|
return t;
|
|
1648
1648
|
}
|
|
1649
1649
|
for (const r of n.values())
|
|
1650
|
-
|
|
1650
|
+
ge(r, e - 1, t);
|
|
1651
1651
|
return t;
|
|
1652
1652
|
}
|
|
1653
1653
|
function Pt(n, e, t) {
|
|
@@ -1675,7 +1675,7 @@ function Pt(n, e, t) {
|
|
|
1675
1675
|
return r;
|
|
1676
1676
|
}
|
|
1677
1677
|
if (t != null && t.$comparator)
|
|
1678
|
-
return
|
|
1678
|
+
return ge(e, 1).filter(t.$op);
|
|
1679
1679
|
const s = t.in || t.$in || [t];
|
|
1680
1680
|
for (const o of s) {
|
|
1681
1681
|
const a = e.get(o);
|
|
@@ -1692,11 +1692,11 @@ function So(n, [e, t, r]) {
|
|
|
1692
1692
|
switch (To(e, t, r)) {
|
|
1693
1693
|
case "e": {
|
|
1694
1694
|
const a = n.eav.get(e);
|
|
1695
|
-
return
|
|
1695
|
+
return ge(a, 2);
|
|
1696
1696
|
}
|
|
1697
1697
|
case "ea": {
|
|
1698
1698
|
const a = (i = n.eav.get(e)) == null ? void 0 : i.get(t);
|
|
1699
|
-
return
|
|
1699
|
+
return ge(a, 1);
|
|
1700
1700
|
}
|
|
1701
1701
|
case "eav": {
|
|
1702
1702
|
const a = (o = n.eav.get(e)) == null ? void 0 : o.get(t);
|
|
@@ -1713,7 +1713,7 @@ function So(n, [e, t, r]) {
|
|
|
1713
1713
|
}
|
|
1714
1714
|
case "a": {
|
|
1715
1715
|
const a = n.aev.get(t);
|
|
1716
|
-
return
|
|
1716
|
+
return ge(a, 2);
|
|
1717
1717
|
}
|
|
1718
1718
|
case "av": {
|
|
1719
1719
|
const a = n.aev.get(t);
|
|
@@ -1732,7 +1732,7 @@ function So(n, [e, t, r]) {
|
|
|
1732
1732
|
return a;
|
|
1733
1733
|
}
|
|
1734
1734
|
default:
|
|
1735
|
-
return
|
|
1735
|
+
return ge(n.eav, 3);
|
|
1736
1736
|
}
|
|
1737
1737
|
}
|
|
1738
1738
|
function vo(n, e, t) {
|
|
@@ -1741,13 +1741,13 @@ function vo(n, e, t) {
|
|
|
1741
1741
|
if (!e)
|
|
1742
1742
|
return r;
|
|
1743
1743
|
for (const [i, o] of e.entries()) {
|
|
1744
|
-
const a = (s = n.eav.get(t)) == null ? void 0 : s.get(o.id), c =
|
|
1744
|
+
const a = (s = n.eav.get(t)) == null ? void 0 : s.get(o.id), c = ge(a, 1);
|
|
1745
1745
|
for (const u of c)
|
|
1746
1746
|
r[i] = u[2];
|
|
1747
1747
|
}
|
|
1748
1748
|
return r;
|
|
1749
1749
|
}
|
|
1750
|
-
function
|
|
1750
|
+
function ie(n, e, t) {
|
|
1751
1751
|
var r;
|
|
1752
1752
|
return (r = n.forwardIdents.get(e)) == null ? void 0 : r.get(t);
|
|
1753
1753
|
}
|
|
@@ -1867,11 +1867,11 @@ const Uo = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a
|
|
|
1867
1867
|
function st(n) {
|
|
1868
1868
|
return typeof n == "string" && Uo.test(n);
|
|
1869
1869
|
}
|
|
1870
|
-
const
|
|
1870
|
+
const ae = [];
|
|
1871
1871
|
for (let n = 0; n < 256; ++n)
|
|
1872
|
-
|
|
1872
|
+
ae.push((n + 256).toString(16).slice(1));
|
|
1873
1873
|
function Lo(n, e = 0) {
|
|
1874
|
-
return (
|
|
1874
|
+
return (ae[n[e + 0]] + ae[n[e + 1]] + ae[n[e + 2]] + ae[n[e + 3]] + "-" + ae[n[e + 4]] + ae[n[e + 5]] + "-" + ae[n[e + 6]] + ae[n[e + 7]] + "-" + ae[n[e + 8]] + ae[n[e + 9]] + "-" + ae[n[e + 10]] + ae[n[e + 11]] + ae[n[e + 12]] + ae[n[e + 13]] + ae[n[e + 14]] + ae[n[e + 15]]).toLowerCase();
|
|
1875
1875
|
}
|
|
1876
1876
|
let ln;
|
|
1877
1877
|
const Fo = new Uint8Array(16);
|
|
@@ -1912,7 +1912,7 @@ function qo(n, e) {
|
|
|
1912
1912
|
function zo(n, e) {
|
|
1913
1913
|
return qo(Mr(n), Mr(e));
|
|
1914
1914
|
}
|
|
1915
|
-
function
|
|
1915
|
+
function Z() {
|
|
1916
1916
|
return Wo();
|
|
1917
1917
|
}
|
|
1918
1918
|
function Vo(n, e) {
|
|
@@ -1965,7 +1965,7 @@ function Yo(n, e, t) {
|
|
|
1965
1965
|
return n.map((r) => r === e ? t : r);
|
|
1966
1966
|
}
|
|
1967
1967
|
function $s(n, e, t, r, s) {
|
|
1968
|
-
const i =
|
|
1968
|
+
const i = ie(e, t, s), o = Ve(e, t, s), a = i || o;
|
|
1969
1969
|
if (!a)
|
|
1970
1970
|
throw new it(`Could not find attr for ${[t, s]}`);
|
|
1971
1971
|
if (a["value-type"] !== "ref")
|
|
@@ -2054,11 +2054,11 @@ function Zo(n, e) {
|
|
|
2054
2054
|
return e;
|
|
2055
2055
|
}
|
|
2056
2056
|
function Xo(n, e, t, r, s, i) {
|
|
2057
|
-
const o =
|
|
2057
|
+
const o = ie(e, t, s), a = Ve(e, t, s), c = o || a;
|
|
2058
2058
|
if (!c)
|
|
2059
2059
|
throw new it(`No attr for etype = ${t} label = ${s}`);
|
|
2060
2060
|
if (i != null && i.hasOwnProperty("$isNull")) {
|
|
2061
|
-
const u =
|
|
2061
|
+
const u = ie(e, t, "id");
|
|
2062
2062
|
if (!u)
|
|
2063
2063
|
throw new it(`No attr for etype = ${t} label = id`);
|
|
2064
2064
|
return [
|
|
@@ -2164,16 +2164,16 @@ function ua(n, e, t, { etype: r, level: s, form: i }, o) {
|
|
|
2164
2164
|
const a = Object.keys(i).filter((c) => c !== "$");
|
|
2165
2165
|
return a.length ? Object.entries(o).map(function([u, l]) {
|
|
2166
2166
|
return a.map(function(y) {
|
|
2167
|
-
var g,
|
|
2168
|
-
const b = !!(e.cardinalityInference && ((S = (
|
|
2167
|
+
var g, m, S;
|
|
2168
|
+
const b = !!(e.cardinalityInference && ((S = (m = (g = t.linkIndex) == null ? void 0 : g[r]) == null ? void 0 : m[y]) != null && S.isSingular));
|
|
2169
2169
|
try {
|
|
2170
|
-
const [_,
|
|
2170
|
+
const [_, w, C] = ca(n, t, r, s, y, u), v = Fs(e, t, {
|
|
2171
2171
|
etype: _,
|
|
2172
|
-
level:
|
|
2172
|
+
level: w,
|
|
2173
2173
|
form: i[y],
|
|
2174
|
-
join:
|
|
2175
|
-
}),
|
|
2176
|
-
return { [y]:
|
|
2174
|
+
join: C
|
|
2175
|
+
}), U = b ? v[0] : v;
|
|
2176
|
+
return { [y]: U };
|
|
2177
2177
|
} catch (_) {
|
|
2178
2178
|
if (_ instanceof it)
|
|
2179
2179
|
return { [y]: b ? void 0 : [] };
|
|
@@ -2218,7 +2218,7 @@ function ha(n, e) {
|
|
|
2218
2218
|
}
|
|
2219
2219
|
function pa(n, e, t) {
|
|
2220
2220
|
const r = Object.keys(t)[0];
|
|
2221
|
-
return
|
|
2221
|
+
return ie(n, e, r);
|
|
2222
2222
|
}
|
|
2223
2223
|
function ya(n, e, t, r) {
|
|
2224
2224
|
if (t)
|
|
@@ -2232,32 +2232,32 @@ function ba(n, e, t) {
|
|
|
2232
2232
|
return Eo(n, e);
|
|
2233
2233
|
const r = /* @__PURE__ */ new Map();
|
|
2234
2234
|
for (const o of t.fields) {
|
|
2235
|
-
const a =
|
|
2235
|
+
const a = ie(n, e, o), c = (s = a == null ? void 0 : a["forward-identity"]) == null ? void 0 : s[2];
|
|
2236
2236
|
c && tr(a) && r.set(c, a);
|
|
2237
2237
|
}
|
|
2238
2238
|
if (!r.has("id")) {
|
|
2239
|
-
const o =
|
|
2239
|
+
const o = ie(n, e, "id"), a = (i = o == null ? void 0 : o["forward-identity"]) == null ? void 0 : i[2];
|
|
2240
2240
|
a && r.set(a, o);
|
|
2241
2241
|
}
|
|
2242
2242
|
return r;
|
|
2243
2243
|
}
|
|
2244
2244
|
function ga(n, e, { etype: t, pageInfo: r, dq: s, form: i }) {
|
|
2245
|
-
var g,
|
|
2245
|
+
var g, m;
|
|
2246
2246
|
const o = (g = i == null ? void 0 : i.$) == null ? void 0 : g.order, a = Ls(i), c = _a(i);
|
|
2247
2247
|
let u = $o(n, s);
|
|
2248
2248
|
const l = r == null ? void 0 : r["start-cursor"], f = r == null ? void 0 : r["end-cursor"], d = ya(e, t, l, o);
|
|
2249
|
-
if (d && ((
|
|
2249
|
+
if (d && ((m = d == null ? void 0 : d["forward-identity"]) == null ? void 0 : m[2]) !== "id") {
|
|
2250
2250
|
const S = d["checked-data-type"] === "date", _ = d.id;
|
|
2251
|
-
u = u.map(([
|
|
2252
|
-
var v,
|
|
2253
|
-
let
|
|
2254
|
-
return S && (
|
|
2251
|
+
u = u.map(([w]) => {
|
|
2252
|
+
var v, U, I, P, H;
|
|
2253
|
+
let C = (H = (P = (I = (U = (v = n.eav.get(w)) == null ? void 0 : v.get(_)) == null ? void 0 : U.values()) == null ? void 0 : I.next()) == null ? void 0 : P.value) == null ? void 0 : H[2];
|
|
2254
|
+
return S && (C = In(C)), [w, C];
|
|
2255
2255
|
});
|
|
2256
2256
|
}
|
|
2257
|
-
u.sort(c === "asc" ? function(_,
|
|
2258
|
-
return Bt(_,
|
|
2259
|
-
} : function(_,
|
|
2260
|
-
return Bt(
|
|
2257
|
+
u.sort(c === "asc" ? function(_, w) {
|
|
2258
|
+
return Bt(_, w, d == null ? void 0 : d["checked-data-type"]);
|
|
2259
|
+
} : function(_, w) {
|
|
2260
|
+
return Bt(w, _, d == null ? void 0 : d["checked-data-type"]);
|
|
2261
2261
|
});
|
|
2262
2262
|
let y = {};
|
|
2263
2263
|
const b = ba(e, t, s);
|
|
@@ -2265,8 +2265,8 @@ function ga(n, e, { etype: t, pageInfo: r, dq: s, form: i }) {
|
|
|
2265
2265
|
const [_] = S;
|
|
2266
2266
|
if (y[_] || !a && l && d && fa(l, d, c, S) || !a && f && d && da(f, d, c, S))
|
|
2267
2267
|
continue;
|
|
2268
|
-
const
|
|
2269
|
-
|
|
2268
|
+
const w = vo(n, b, _);
|
|
2269
|
+
w && (y[_] = w);
|
|
2270
2270
|
}
|
|
2271
2271
|
return y;
|
|
2272
2272
|
}
|
|
@@ -2281,7 +2281,7 @@ function Ls(n) {
|
|
|
2281
2281
|
return !e && !t && !r;
|
|
2282
2282
|
}
|
|
2283
2283
|
function ma(n, e, { etype: t, level: r, form: s, join: i, pageInfo: o }) {
|
|
2284
|
-
var d, y, b, g,
|
|
2284
|
+
var d, y, b, g, m;
|
|
2285
2285
|
if (!Ls(s) && (!o || !o["start-cursor"]))
|
|
2286
2286
|
return [];
|
|
2287
2287
|
const a = ta(oa(e, t, r, (d = s.$) == null ? void 0 : d.where), i), c = aa(Yt, t, r), u = (y = s.$) == null ? void 0 : y.fields, l = ga(n, e, {
|
|
@@ -2289,7 +2289,7 @@ function ma(n, e, { etype: t, level: r, form: s, join: i, pageInfo: o }) {
|
|
|
2289
2289
|
pageInfo: o,
|
|
2290
2290
|
form: s,
|
|
2291
2291
|
dq: { where: a, find: c, fields: u }
|
|
2292
|
-
}), f = ((b = s.$) == null ? void 0 : b.limit) || ((g = s.$) == null ? void 0 : g.first) || ((
|
|
2292
|
+
}), f = ((b = s.$) == null ? void 0 : b.limit) || ((g = s.$) == null ? void 0 : g.first) || ((m = s.$) == null ? void 0 : m.last);
|
|
2293
2293
|
if (f != null) {
|
|
2294
2294
|
r > 0 && xs && console.warn("WARNING: Limits in child queries are only run client-side. Data returned from the server will not have a limit.");
|
|
2295
2295
|
const S = Object.entries(l);
|
|
@@ -2431,7 +2431,7 @@ function Ca(n) {
|
|
|
2431
2431
|
function Ia(n, e, t) {
|
|
2432
2432
|
return t.indexOf(".") !== -1 && // attr names can have `.` in them, so use the attr we find with a `.`
|
|
2433
2433
|
// before assuming it's a ref lookup.
|
|
2434
|
-
!
|
|
2434
|
+
!ie(n, e, t);
|
|
2435
2435
|
}
|
|
2436
2436
|
function Mn(n) {
|
|
2437
2437
|
const [e, t, ...r] = n.split(".");
|
|
@@ -2441,8 +2441,8 @@ function Mn(n) {
|
|
|
2441
2441
|
}
|
|
2442
2442
|
function Pa(n, e, t) {
|
|
2443
2443
|
if (!Ia(n, e, t))
|
|
2444
|
-
return
|
|
2445
|
-
const r = Mn(t), s =
|
|
2444
|
+
return ie(n, e, t);
|
|
2445
|
+
const r = Mn(t), s = ie(n, e, r) || Ve(n, e, r);
|
|
2446
2446
|
if (s && s["value-type"] !== "ref")
|
|
2447
2447
|
throw new Error(`${t} does not reference a valid link attribute.`);
|
|
2448
2448
|
return s;
|
|
@@ -2450,7 +2450,7 @@ function Pa(n, e, t) {
|
|
|
2450
2450
|
function Rn(n) {
|
|
2451
2451
|
return typeof n == "string" && !Gt(n) ? null : typeof n == "string" && Gt(n) ? Pn(n) : Ca(n);
|
|
2452
2452
|
}
|
|
2453
|
-
function
|
|
2453
|
+
function _e(n, e, t) {
|
|
2454
2454
|
const r = Rn(t);
|
|
2455
2455
|
if (r === null)
|
|
2456
2456
|
return t;
|
|
@@ -2461,52 +2461,52 @@ function be(n, e, t) {
|
|
|
2461
2461
|
}
|
|
2462
2462
|
function Ks(n, e, t, r) {
|
|
2463
2463
|
var o;
|
|
2464
|
-
const s =
|
|
2464
|
+
const s = _e(n, e, t);
|
|
2465
2465
|
return Array.isArray(s) ? [[
|
|
2466
2466
|
"add-triple",
|
|
2467
2467
|
s,
|
|
2468
|
-
(o =
|
|
2468
|
+
(o = ie(n, e, "id")) == null ? void 0 : o.id,
|
|
2469
2469
|
s
|
|
2470
2470
|
]].concat(r) : r;
|
|
2471
2471
|
}
|
|
2472
2472
|
function Ma({ attrsStore: n }, [e, t, r]) {
|
|
2473
2473
|
const s = Object.entries(r).flatMap(([i, o]) => {
|
|
2474
|
-
const a = Array.isArray(o) ? o : [o], c =
|
|
2474
|
+
const a = Array.isArray(o) ? o : [o], c = ie(n, e, i), u = Ve(n, e, i);
|
|
2475
2475
|
return a.map((l) => c ? [
|
|
2476
2476
|
"add-triple",
|
|
2477
|
-
|
|
2477
|
+
_e(n, e, t),
|
|
2478
2478
|
c.id,
|
|
2479
2479
|
// Uses `!` because if we get here, we should have created the attr if it doesn't
|
|
2480
2480
|
// already exist
|
|
2481
|
-
|
|
2481
|
+
_e(n, c["reverse-identity"][1], l)
|
|
2482
2482
|
] : [
|
|
2483
2483
|
"add-triple",
|
|
2484
2484
|
// Uses `!` because if we get here, we should have created the attr if it doesn't
|
|
2485
2485
|
// already exist
|
|
2486
|
-
|
|
2486
|
+
_e(n, u["forward-identity"][1], l),
|
|
2487
2487
|
u == null ? void 0 : u.id,
|
|
2488
|
-
|
|
2488
|
+
_e(n, e, t)
|
|
2489
2489
|
]);
|
|
2490
2490
|
});
|
|
2491
2491
|
return Ks(n, e, t, s);
|
|
2492
2492
|
}
|
|
2493
2493
|
function Ra({ attrsStore: n }, [e, t, r]) {
|
|
2494
2494
|
const s = Object.entries(r).flatMap(([i, o]) => {
|
|
2495
|
-
const a = Array.isArray(o) ? o : [o], c =
|
|
2495
|
+
const a = Array.isArray(o) ? o : [o], c = ie(n, e, i), u = Ve(n, e, i);
|
|
2496
2496
|
return a.map((l) => c ? [
|
|
2497
2497
|
"retract-triple",
|
|
2498
|
-
|
|
2498
|
+
_e(n, e, t),
|
|
2499
2499
|
c.id,
|
|
2500
2500
|
// Uses `!` because if we get here, we should have created the attr if it doesn't
|
|
2501
2501
|
// already exist
|
|
2502
|
-
|
|
2502
|
+
_e(n, c["reverse-identity"][1], l)
|
|
2503
2503
|
] : [
|
|
2504
2504
|
"retract-triple",
|
|
2505
2505
|
// Uses `!` because if we get here, we should have created the attr if it doesn't
|
|
2506
2506
|
// already exist
|
|
2507
|
-
|
|
2507
|
+
_e(n, u["forward-identity"][1], l),
|
|
2508
2508
|
u.id,
|
|
2509
|
-
|
|
2509
|
+
_e(n, e, t)
|
|
2510
2510
|
]);
|
|
2511
2511
|
});
|
|
2512
2512
|
return Ks(n, e, t, s);
|
|
@@ -2518,7 +2518,7 @@ function ja(n, e, t, r) {
|
|
|
2518
2518
|
for (const a of n || []) {
|
|
2519
2519
|
const c = a == null ? void 0 : a.aev.get(i);
|
|
2520
2520
|
if (c) {
|
|
2521
|
-
for (const [u, l, f] of
|
|
2521
|
+
for (const [u, l, f] of ge(c, 2))
|
|
2522
2522
|
if (f === o)
|
|
2523
2523
|
return !0;
|
|
2524
2524
|
}
|
|
@@ -2538,16 +2538,16 @@ function Ws({ stores: n, attrsStore: e }, [t, r, s, i]) {
|
|
|
2538
2538
|
return (i == null ? void 0 : i.upsert) === !1 ? { mode: "update" } : (i == null ? void 0 : i.upsert) === !0 ? null : ja(n, e, t, r) ? { mode: "update" } : null;
|
|
2539
2539
|
}
|
|
2540
2540
|
function xa(n, e) {
|
|
2541
|
-
const { attrsStore: t } = n, [r, s, i, o] = e, a = Xn(i), c =
|
|
2541
|
+
const { attrsStore: t } = n, [r, s, i, o] = e, a = Xn(i), c = _e(t, r, s);
|
|
2542
2542
|
return [["id", c]].concat(Object.entries(a)).map(([l, f]) => {
|
|
2543
|
-
const d =
|
|
2543
|
+
const d = ie(t, r, l);
|
|
2544
2544
|
return d["checked-data-type"] === "date" && n.useDateObjects && (f = Jt(f)), ["add-triple", c, d.id, f, { mode: "create" }];
|
|
2545
2545
|
});
|
|
2546
2546
|
}
|
|
2547
2547
|
function $a(n, e) {
|
|
2548
|
-
const { attrsStore: t } = n, [r, s, i, o] = e, a = Xn(i), c =
|
|
2548
|
+
const { attrsStore: t } = n, [r, s, i, o] = e, a = Xn(i), c = _e(t, r, s), u = Ws(n, [r, c, i, o]);
|
|
2549
2549
|
return [["id", c]].concat(Object.entries(a)).map(([f, d]) => {
|
|
2550
|
-
const y =
|
|
2550
|
+
const y = ie(t, r, f);
|
|
2551
2551
|
return y["checked-data-type"] === "date" && n.useDateObjects && (d = Jt(d)), [
|
|
2552
2552
|
"add-triple",
|
|
2553
2553
|
c,
|
|
@@ -2558,11 +2558,11 @@ function $a(n, e) {
|
|
|
2558
2558
|
});
|
|
2559
2559
|
}
|
|
2560
2560
|
function Da({ attrsStore: n }, [e, t]) {
|
|
2561
|
-
return [["delete-entity",
|
|
2561
|
+
return [["delete-entity", _e(n, e, t), e]];
|
|
2562
2562
|
}
|
|
2563
2563
|
function Ua(n, e) {
|
|
2564
|
-
const { attrsStore: t } = n, [r, s, i, o] = e, a = Xn(i), c =
|
|
2565
|
-
const b =
|
|
2564
|
+
const { attrsStore: t } = n, [r, s, i, o] = e, a = Xn(i), c = _e(t, r, s), u = Ws(n, [r, c, i, o]), l = Object.entries(a).map(([d, y]) => {
|
|
2565
|
+
const b = ie(t, r, d);
|
|
2566
2566
|
return [
|
|
2567
2567
|
"deep-merge-triple",
|
|
2568
2568
|
c,
|
|
@@ -2574,13 +2574,13 @@ function Ua(n, e) {
|
|
|
2574
2574
|
return [[
|
|
2575
2575
|
"add-triple",
|
|
2576
2576
|
c,
|
|
2577
|
-
|
|
2577
|
+
ie(t, r, "id").id,
|
|
2578
2578
|
c,
|
|
2579
2579
|
...u ? [u] : []
|
|
2580
2580
|
]].concat(l);
|
|
2581
2581
|
}
|
|
2582
2582
|
function La({ attrsStore: n }, [e, t, r]) {
|
|
2583
|
-
return [["rule-params",
|
|
2583
|
+
return [["rule-params", _e(n, e, t), e, r]];
|
|
2584
2584
|
}
|
|
2585
2585
|
function Fa(n) {
|
|
2586
2586
|
const [e, t, r, s, i] = n;
|
|
@@ -2636,7 +2636,7 @@ function Wa(n, e, t) {
|
|
|
2636
2636
|
};
|
|
2637
2637
|
}
|
|
2638
2638
|
function Mt(n, e, t, r) {
|
|
2639
|
-
const s = n ? Wa(n, e, t) : null, i =
|
|
2639
|
+
const s = n ? Wa(n, e, t) : null, i = Z(), a = [Z(), e, t];
|
|
2640
2640
|
return {
|
|
2641
2641
|
id: i,
|
|
2642
2642
|
"forward-identity": a,
|
|
@@ -2658,8 +2658,8 @@ function za(n, e, t) {
|
|
|
2658
2658
|
throw new Error(`Couldn't find the link ${e}.${t} in your schema`);
|
|
2659
2659
|
const { forward: s, reverse: i } = r;
|
|
2660
2660
|
return {
|
|
2661
|
-
"forward-identity": [
|
|
2662
|
-
"reverse-identity": [
|
|
2661
|
+
"forward-identity": [Z(), s.on, s.label],
|
|
2662
|
+
"reverse-identity": [Z(), i.on, i.label],
|
|
2663
2663
|
cardinality: s.has === "one" ? "one" : "many",
|
|
2664
2664
|
"unique?": i.has === "one",
|
|
2665
2665
|
"on-delete": s.onDelete,
|
|
@@ -2667,7 +2667,7 @@ function za(n, e, t) {
|
|
|
2667
2667
|
};
|
|
2668
2668
|
}
|
|
2669
2669
|
function Dr(n, e, t, r) {
|
|
2670
|
-
const s = n ? za(n, e, t) : null, i =
|
|
2670
|
+
const s = n ? za(n, e, t) : null, i = Z(), o = [Z(), e, t], a = [Z(), t, e];
|
|
2671
2671
|
return {
|
|
2672
2672
|
id: i,
|
|
2673
2673
|
// @ts-ignore: ts thinks it's any[]
|
|
@@ -2719,12 +2719,12 @@ function Ya({ attrsStore: n, schema: e }, t) {
|
|
|
2719
2719
|
var d, y;
|
|
2720
2720
|
const r = /* @__PURE__ */ new Set(), s = [], i = [];
|
|
2721
2721
|
function o(b, g) {
|
|
2722
|
-
return
|
|
2722
|
+
return ie(n, b, g) || s.find((m) => m["forward-identity"][1] === b && m["forward-identity"][2] === g);
|
|
2723
2723
|
}
|
|
2724
2724
|
function a(b, g) {
|
|
2725
|
-
return Ve(n, b, g) || s.find((
|
|
2725
|
+
return Ve(n, b, g) || s.find((m) => {
|
|
2726
2726
|
var S, _;
|
|
2727
|
-
return ((S =
|
|
2727
|
+
return ((S = m["reverse-identity"]) == null ? void 0 : S[1]) === b && ((_ = m["reverse-identity"]) == null ? void 0 : _[2]) === g;
|
|
2728
2728
|
});
|
|
2729
2729
|
}
|
|
2730
2730
|
function c(b) {
|
|
@@ -2739,40 +2739,40 @@ function Ya({ attrsStore: n, schema: e }, t) {
|
|
|
2739
2739
|
!o(b, g);
|
|
2740
2740
|
}
|
|
2741
2741
|
function f(b, g) {
|
|
2742
|
-
const
|
|
2743
|
-
u(
|
|
2742
|
+
const m = o(b, g), S = a(b, g);
|
|
2743
|
+
u(m), u(S), !m && !S && c(Dr(e, b, g, Ha));
|
|
2744
2744
|
}
|
|
2745
2745
|
for (const b of t)
|
|
2746
|
-
for (const { etype: g, lookupPair:
|
|
2747
|
-
const _ =
|
|
2746
|
+
for (const { etype: g, lookupPair: m, linkLabel: S } of Ja(b)) {
|
|
2747
|
+
const _ = m[0];
|
|
2748
2748
|
if (S) {
|
|
2749
2749
|
f(g, S);
|
|
2750
|
-
const
|
|
2751
|
-
u(
|
|
2752
|
-
const v = ((d =
|
|
2750
|
+
const w = o(g, S), C = a(g, S);
|
|
2751
|
+
u(w), u(C);
|
|
2752
|
+
const v = ((d = w == null ? void 0 : w["reverse-identity"]) == null ? void 0 : d[1]) || ((y = C == null ? void 0 : C["forward-identity"]) == null ? void 0 : y[1]) || S;
|
|
2753
2753
|
if (l(v, _))
|
|
2754
2754
|
f(v, Mn(_));
|
|
2755
2755
|
else {
|
|
2756
|
-
const
|
|
2757
|
-
|
|
2756
|
+
const U = o(v, _);
|
|
2757
|
+
U || c(Mt(e, v, _, jn)), u(U);
|
|
2758
2758
|
}
|
|
2759
2759
|
} else if (l(g, _))
|
|
2760
2760
|
f(g, Mn(_));
|
|
2761
2761
|
else {
|
|
2762
|
-
const
|
|
2763
|
-
|
|
2762
|
+
const w = o(g, _);
|
|
2763
|
+
w || c(Mt(e, g, _, jn)), u(w);
|
|
2764
2764
|
}
|
|
2765
2765
|
}
|
|
2766
2766
|
for (const b of t) {
|
|
2767
|
-
const [g,
|
|
2767
|
+
const [g, m, S, _] = b;
|
|
2768
2768
|
if (Va.has(g)) {
|
|
2769
|
-
const
|
|
2770
|
-
u(
|
|
2771
|
-
for (const
|
|
2772
|
-
const v = o(
|
|
2773
|
-
if (u(v), Ba.has(g) && (v || c(Mt(e,
|
|
2774
|
-
const
|
|
2775
|
-
!v && !
|
|
2769
|
+
const w = o(m, "id");
|
|
2770
|
+
u(w), w || c(Mt(e, m, "id", { "unique?": !0 }));
|
|
2771
|
+
for (const C of Object.keys(_)) {
|
|
2772
|
+
const v = o(m, C);
|
|
2773
|
+
if (u(v), Ba.has(g) && (v || c(Mt(e, m, C, C === "id" ? { "unique?": !0 } : null))), Qa.has(g)) {
|
|
2774
|
+
const U = a(m, C);
|
|
2775
|
+
!v && !U && c(Dr(e, m, C)), u(U);
|
|
2776
2776
|
}
|
|
2777
2777
|
}
|
|
2778
2778
|
}
|
|
@@ -3086,8 +3086,8 @@ async function sc(n, e, t) {
|
|
|
3086
3086
|
};
|
|
3087
3087
|
a[y] = S;
|
|
3088
3088
|
}
|
|
3089
|
-
const
|
|
3090
|
-
s.add(
|
|
3089
|
+
const m = t.put(g, y);
|
|
3090
|
+
s.add(m);
|
|
3091
3091
|
}
|
|
3092
3092
|
const c = { objects: a }, u = t.put(c, et);
|
|
3093
3093
|
s.add(u);
|
|
@@ -3111,19 +3111,19 @@ async function ic(n, e) {
|
|
|
3111
3111
|
return;
|
|
3112
3112
|
const r = await new Promise((l, f) => {
|
|
3113
3113
|
const b = t.transaction(["kv"], "readonly").objectStore("kv").openCursor();
|
|
3114
|
-
b.onerror = (
|
|
3115
|
-
f(
|
|
3114
|
+
b.onerror = (m) => {
|
|
3115
|
+
f(m);
|
|
3116
3116
|
};
|
|
3117
3117
|
const g = [];
|
|
3118
3118
|
b.onsuccess = () => {
|
|
3119
|
-
const
|
|
3120
|
-
if (
|
|
3121
|
-
const S =
|
|
3122
|
-
g.push([S, _]),
|
|
3119
|
+
const m = b.result;
|
|
3120
|
+
if (m) {
|
|
3121
|
+
const S = m.key, _ = m.value;
|
|
3122
|
+
g.push([S, _]), m.continue();
|
|
3123
3123
|
} else
|
|
3124
3124
|
l(g);
|
|
3125
|
-
}, b.onerror = (
|
|
3126
|
-
f(
|
|
3125
|
+
}, b.onerror = (m) => {
|
|
3126
|
+
f(m);
|
|
3127
3127
|
};
|
|
3128
3128
|
}), s = e.transaction(["kv", "querySubs"], "readwrite"), i = s.objectStore("kv"), o = s.objectStore("querySubs"), a = [], c = { objects: {} };
|
|
3129
3129
|
for (const [l, f] of r)
|
|
@@ -3265,20 +3265,20 @@ class zs {
|
|
|
3265
3265
|
};
|
|
3266
3266
|
}
|
|
3267
3267
|
}
|
|
3268
|
-
class
|
|
3268
|
+
class ue extends Error {
|
|
3269
3269
|
constructor(t, r, s) {
|
|
3270
3270
|
super(t);
|
|
3271
3271
|
p(this, "hint");
|
|
3272
3272
|
p(this, "traceId");
|
|
3273
3273
|
this.hint = r, s && (this.traceId = s);
|
|
3274
3274
|
const i = new.target.prototype;
|
|
3275
|
-
Object.setPrototypeOf && Object.setPrototypeOf(this, i), Error.captureStackTrace && Error.captureStackTrace(this,
|
|
3275
|
+
Object.setPrototypeOf && Object.setPrototypeOf(this, i), Error.captureStackTrace && Error.captureStackTrace(this, ue), this.name = "InstantError";
|
|
3276
3276
|
}
|
|
3277
3277
|
get [Symbol.toStringTag]() {
|
|
3278
3278
|
return "InstantError";
|
|
3279
3279
|
}
|
|
3280
3280
|
}
|
|
3281
|
-
class Zt extends
|
|
3281
|
+
class Zt extends ue {
|
|
3282
3282
|
constructor(t) {
|
|
3283
3283
|
var i;
|
|
3284
3284
|
const r = ((i = t.body) == null ? void 0 : i.message) || `API Error (${t.status})`;
|
|
@@ -3292,19 +3292,19 @@ class Zt extends le {
|
|
|
3292
3292
|
return "InstantAPIError";
|
|
3293
3293
|
}
|
|
3294
3294
|
}
|
|
3295
|
-
async function
|
|
3295
|
+
async function Ae(n, e) {
|
|
3296
3296
|
const t = await fetch(n, e), r = await t.json();
|
|
3297
3297
|
return t.status === 200 ? Promise.resolve(r) : Promise.reject(new Zt({ status: t.status, body: r }));
|
|
3298
3298
|
}
|
|
3299
3299
|
function oc({ apiURI: n, appId: e, email: t }) {
|
|
3300
|
-
return
|
|
3300
|
+
return Ae(`${n}/runtime/auth/send_magic_code`, {
|
|
3301
3301
|
method: "POST",
|
|
3302
3302
|
headers: { "content-type": "application/json" },
|
|
3303
3303
|
body: JSON.stringify({ "app-id": e, email: t })
|
|
3304
3304
|
});
|
|
3305
3305
|
}
|
|
3306
3306
|
async function ac({ apiURI: n, appId: e, email: t, code: r, refreshToken: s, extraFields: i }) {
|
|
3307
|
-
return await
|
|
3307
|
+
return await Ae(`${n}/runtime/auth/verify_magic_code`, {
|
|
3308
3308
|
method: "POST",
|
|
3309
3309
|
headers: { "content-type": "application/json" },
|
|
3310
3310
|
body: JSON.stringify({
|
|
@@ -3317,7 +3317,7 @@ async function ac({ apiURI: n, appId: e, email: t, code: r, refreshToken: s, ext
|
|
|
3317
3317
|
});
|
|
3318
3318
|
}
|
|
3319
3319
|
async function cc({ apiURI: n, appId: e, refreshToken: t }) {
|
|
3320
|
-
return await
|
|
3320
|
+
return await Ae(`${n}/runtime/auth/verify_refresh_token`, {
|
|
3321
3321
|
method: "POST",
|
|
3322
3322
|
headers: { "content-type": "application/json" },
|
|
3323
3323
|
body: JSON.stringify({
|
|
@@ -3327,7 +3327,7 @@ async function cc({ apiURI: n, appId: e, refreshToken: t }) {
|
|
|
3327
3327
|
});
|
|
3328
3328
|
}
|
|
3329
3329
|
async function uc({ apiURI: n, appId: e }) {
|
|
3330
|
-
return await
|
|
3330
|
+
return await Ae(`${n}/runtime/auth/sign_in_guest`, {
|
|
3331
3331
|
method: "POST",
|
|
3332
3332
|
headers: { "content-type": "application/json" },
|
|
3333
3333
|
body: JSON.stringify({
|
|
@@ -3336,7 +3336,7 @@ async function uc({ apiURI: n, appId: e }) {
|
|
|
3336
3336
|
});
|
|
3337
3337
|
}
|
|
3338
3338
|
async function Nr({ apiURI: n, appId: e, code: t, codeVerifier: r, refreshToken: s, extraFields: i }) {
|
|
3339
|
-
return await
|
|
3339
|
+
return await Ae(`${n}/runtime/oauth/token`, {
|
|
3340
3340
|
method: "POST",
|
|
3341
3341
|
headers: { "content-type": "application/json" },
|
|
3342
3342
|
body: JSON.stringify({
|
|
@@ -3349,7 +3349,7 @@ async function Nr({ apiURI: n, appId: e, code: t, codeVerifier: r, refreshToken:
|
|
|
3349
3349
|
});
|
|
3350
3350
|
}
|
|
3351
3351
|
async function lc({ apiURI: n, appId: e, nonce: t, idToken: r, clientName: s, refreshToken: i, extraFields: o }) {
|
|
3352
|
-
return await
|
|
3352
|
+
return await Ae(`${n}/runtime/oauth/id_token`, {
|
|
3353
3353
|
method: "POST",
|
|
3354
3354
|
headers: { "content-type": "application/json" },
|
|
3355
3355
|
body: JSON.stringify({
|
|
@@ -3363,7 +3363,7 @@ async function lc({ apiURI: n, appId: e, nonce: t, idToken: r, clientName: s, re
|
|
|
3363
3363
|
});
|
|
3364
3364
|
}
|
|
3365
3365
|
async function fc({ apiURI: n, appId: e, refreshToken: t }) {
|
|
3366
|
-
return await
|
|
3366
|
+
return await Ae(`${n}/runtime/signout`, {
|
|
3367
3367
|
method: "POST",
|
|
3368
3368
|
headers: {
|
|
3369
3369
|
"content-type": "application/json"
|
|
@@ -3381,14 +3381,14 @@ async function dc({ apiURI: n, appId: e, path: t, file: r, refreshToken: s, cont
|
|
|
3381
3381
|
authorization: `Bearer ${s}`,
|
|
3382
3382
|
"content-type": i || r.type
|
|
3383
3383
|
};
|
|
3384
|
-
return o && (a["content-disposition"] = o), await
|
|
3384
|
+
return o && (a["content-disposition"] = o), await Ae(`${n}/storage/upload`, {
|
|
3385
3385
|
method: "PUT",
|
|
3386
3386
|
headers: a,
|
|
3387
3387
|
body: r
|
|
3388
3388
|
});
|
|
3389
3389
|
}
|
|
3390
3390
|
async function hc({ apiURI: n, appId: e, path: t, refreshToken: r }) {
|
|
3391
|
-
const { data: s } = await
|
|
3391
|
+
const { data: s } = await Ae(`${n}/storage/files?app_id=${e}&filename=${encodeURIComponent(t)}`, {
|
|
3392
3392
|
method: "DELETE",
|
|
3393
3393
|
headers: {
|
|
3394
3394
|
"content-type": "application/json",
|
|
@@ -3398,7 +3398,7 @@ async function hc({ apiURI: n, appId: e, path: t, refreshToken: r }) {
|
|
|
3398
3398
|
return s;
|
|
3399
3399
|
}
|
|
3400
3400
|
async function pc({ apiURI: n, appId: e, fileName: t, refreshToken: r, metadata: s = {} }) {
|
|
3401
|
-
const { data: i } = await
|
|
3401
|
+
const { data: i } = await Ae(`${n}/storage/signed-upload-url`, {
|
|
3402
3402
|
method: "POST",
|
|
3403
3403
|
headers: {
|
|
3404
3404
|
"content-type": "application/json",
|
|
@@ -3421,7 +3421,7 @@ async function yc(n, e) {
|
|
|
3421
3421
|
})).ok;
|
|
3422
3422
|
}
|
|
3423
3423
|
async function bc({ apiURI: n, appId: e, path: t, refreshToken: r }) {
|
|
3424
|
-
const { data: s } = await
|
|
3424
|
+
const { data: s } = await Ae(`${n}/storage/signed-download-url?app_id=${e}&filename=${encodeURIComponent(t)}`, {
|
|
3425
3425
|
method: "GET",
|
|
3426
3426
|
headers: {
|
|
3427
3427
|
"content-type": "application/json",
|
|
@@ -3508,7 +3508,7 @@ function zr(n) {
|
|
|
3508
3508
|
}, e;
|
|
3509
3509
|
}, {});
|
|
3510
3510
|
}
|
|
3511
|
-
const ir = "v1.0.3
|
|
3511
|
+
const ir = "v1.0.3";
|
|
3512
3512
|
function mc(n, e) {
|
|
3513
3513
|
return {
|
|
3514
3514
|
info: n ? (...t) => console.info(...t, e()) : () => {
|
|
@@ -3519,7 +3519,7 @@ function mc(n, e) {
|
|
|
3519
3519
|
}
|
|
3520
3520
|
};
|
|
3521
3521
|
}
|
|
3522
|
-
class
|
|
3522
|
+
class he {
|
|
3523
3523
|
constructor(e, t, r, s = { indexed: !1, unique: !1 }) {
|
|
3524
3524
|
p(this, "valueType");
|
|
3525
3525
|
p(this, "required");
|
|
@@ -3534,19 +3534,19 @@ class fe {
|
|
|
3534
3534
|
* and enforced for backend
|
|
3535
3535
|
*/
|
|
3536
3536
|
clientRequired() {
|
|
3537
|
-
return new
|
|
3537
|
+
return new he(this.valueType, !1, this.isIndexed, this.config);
|
|
3538
3538
|
}
|
|
3539
3539
|
optional() {
|
|
3540
|
-
return new
|
|
3540
|
+
return new he(this.valueType, !1, this.isIndexed, this.config);
|
|
3541
3541
|
}
|
|
3542
3542
|
unique() {
|
|
3543
|
-
return new
|
|
3543
|
+
return new he(this.valueType, this.required, this.isIndexed, {
|
|
3544
3544
|
...this.config,
|
|
3545
3545
|
unique: !0
|
|
3546
3546
|
});
|
|
3547
3547
|
}
|
|
3548
3548
|
indexed() {
|
|
3549
|
-
return new
|
|
3549
|
+
return new he(this.valueType, this.required, !0, {
|
|
3550
3550
|
...this.config,
|
|
3551
3551
|
indexed: !0
|
|
3552
3552
|
});
|
|
@@ -3592,7 +3592,7 @@ class en {
|
|
|
3592
3592
|
return new en(this.entities, this.links, {});
|
|
3593
3593
|
}
|
|
3594
3594
|
}
|
|
3595
|
-
class
|
|
3595
|
+
class B extends Error {
|
|
3596
3596
|
constructor(e, t) {
|
|
3597
3597
|
const r = t ? `At path '${t}': ${e}` : e;
|
|
3598
3598
|
super(r), this.name = "QueryValidationError";
|
|
@@ -3629,13 +3629,13 @@ const Vr = [
|
|
|
3629
3629
|
}, Tc = (n, e, t, r, s, i, o) => {
|
|
3630
3630
|
const a = i.valueType === "json", c = (u, l, f) => {
|
|
3631
3631
|
if (!Gs(f, l, a))
|
|
3632
|
-
throw new
|
|
3632
|
+
throw new B(`Invalid value for operator '${u}' on attribute '${r}' in entity '${s}'. Expected ${l}, but received: ${typeof f}`, o);
|
|
3633
3633
|
};
|
|
3634
3634
|
switch (n) {
|
|
3635
3635
|
case "in":
|
|
3636
3636
|
case "$in":
|
|
3637
3637
|
if (!Array.isArray(e))
|
|
3638
|
-
throw new
|
|
3638
|
+
throw new B(`Operator '${n}' for attribute '${r}' in entity '${s}' must be an array, but received: ${typeof e}`, o);
|
|
3639
3639
|
for (const u of e)
|
|
3640
3640
|
c(n, t, u);
|
|
3641
3641
|
break;
|
|
@@ -3650,13 +3650,13 @@ const Vr = [
|
|
|
3650
3650
|
case "$like":
|
|
3651
3651
|
case "$ilike":
|
|
3652
3652
|
if (c(n, "string", e), n === "$ilike" && !i.isIndexed)
|
|
3653
|
-
throw new
|
|
3653
|
+
throw new B(`Operator '${n}' can only be used with indexed attributes, but '${r}' in entity '${s}' is not indexed`, o);
|
|
3654
3654
|
break;
|
|
3655
3655
|
case "$isNull":
|
|
3656
3656
|
c(n, "boolean", e);
|
|
3657
3657
|
break;
|
|
3658
3658
|
default:
|
|
3659
|
-
throw new
|
|
3659
|
+
throw new B(`Unknown operator '${n}' for attribute '${r}' in entity '${s}'`, o);
|
|
3660
3660
|
}
|
|
3661
3661
|
}, nt = (n, e, t, r, s) => {
|
|
3662
3662
|
const i = wc(t), o = t.valueType === "json";
|
|
@@ -3667,42 +3667,42 @@ const Vr = [
|
|
|
3667
3667
|
for (const [u, l] of Object.entries(c))
|
|
3668
3668
|
Tc(u, l, i, e, r, t, `${s}.${u}`);
|
|
3669
3669
|
} else if (!Gs(n, i, o))
|
|
3670
|
-
throw new
|
|
3670
|
+
throw new B(`Invalid value for attribute '${e}' in entity '${r}'. Expected ${i}, but received: ${typeof n}`, s);
|
|
3671
3671
|
}, Sc = (n, e, t, r, s) => {
|
|
3672
3672
|
const i = n.split(".");
|
|
3673
3673
|
if (i.length < 2)
|
|
3674
|
-
throw new
|
|
3674
|
+
throw new B(`Invalid dot notation path '${n}'. Must contain at least one dot.`, s);
|
|
3675
3675
|
let o = t;
|
|
3676
3676
|
for (let l = 0; l < i.length - 1; l++) {
|
|
3677
3677
|
const f = i[l], d = r.entities[o];
|
|
3678
3678
|
if (!d)
|
|
3679
|
-
throw new
|
|
3679
|
+
throw new B(`Entity '${o}' does not exist in schema while traversing dot notation path '${n}'.`, s);
|
|
3680
3680
|
const y = d.links[f];
|
|
3681
3681
|
if (!y) {
|
|
3682
3682
|
const b = Object.keys(d.links);
|
|
3683
|
-
throw new
|
|
3683
|
+
throw new B(`Link '${f}' does not exist on entity '${o}' in dot notation path '${n}'. Available links: ${b.length > 0 ? b.join(", ") : "none"}`, s);
|
|
3684
3684
|
}
|
|
3685
3685
|
o = y.entityName;
|
|
3686
3686
|
}
|
|
3687
3687
|
const a = i[i.length - 1], c = r.entities[o];
|
|
3688
3688
|
if (!c)
|
|
3689
|
-
throw new
|
|
3689
|
+
throw new B(`Target entity '${o}' does not exist in schema for dot notation path '${n}'.`, s);
|
|
3690
3690
|
if (a === "id") {
|
|
3691
3691
|
if (typeof e == "string" && !st(e))
|
|
3692
|
-
throw new
|
|
3693
|
-
nt(e, n, new
|
|
3692
|
+
throw new B(`Invalid value for id field in entity '${o}'. Expected a UUID, but received: ${e}`, s);
|
|
3693
|
+
nt(e, n, new he("string", !1, !0), t, s);
|
|
3694
3694
|
return;
|
|
3695
3695
|
}
|
|
3696
3696
|
const u = c.attrs[a];
|
|
3697
3697
|
if (Object.keys(c.links).includes(a)) {
|
|
3698
3698
|
if (typeof e == "string" && !st(e))
|
|
3699
|
-
throw new
|
|
3700
|
-
nt(e, n, new
|
|
3699
|
+
throw new B(`Invalid value for link '${a}' in entity '${o}'. Expected a UUID, but received: ${e}`, s);
|
|
3700
|
+
nt(e, n, new he("string", !1, !0), t, s);
|
|
3701
3701
|
return;
|
|
3702
3702
|
}
|
|
3703
3703
|
if (!u) {
|
|
3704
3704
|
const l = Object.keys(c.attrs);
|
|
3705
|
-
throw new
|
|
3705
|
+
throw new B(`Attribute '${a}' does not exist on entity '${o}' in dot notation path '${n}'. Available attributes: ${l.length > 0 ? l.join(", ") + ", id" : "id"}`, s);
|
|
3706
3706
|
}
|
|
3707
3707
|
nt(e, n, u, t, s);
|
|
3708
3708
|
}, Hs = (n, e, t, r) => {
|
|
@@ -3714,7 +3714,7 @@ const Vr = [
|
|
|
3714
3714
|
continue;
|
|
3715
3715
|
}
|
|
3716
3716
|
if (s === "id") {
|
|
3717
|
-
nt(i, "id", new
|
|
3717
|
+
nt(i, "id", new he("string", !1, !0), e, `${r}.id`);
|
|
3718
3718
|
continue;
|
|
3719
3719
|
}
|
|
3720
3720
|
if (s.includes(".")) {
|
|
@@ -3727,21 +3727,21 @@ const Vr = [
|
|
|
3727
3727
|
const a = o.attrs[s], c = o.links[s];
|
|
3728
3728
|
if (!a && !c) {
|
|
3729
3729
|
const u = Object.keys(o.attrs), l = Object.keys(o.links);
|
|
3730
|
-
throw new
|
|
3730
|
+
throw new B(`Attribute or link '${s}' does not exist on entity '${e}'. Available attributes: ${u.length > 0 ? u.join(", ") : "none"}. Available links: ${l.length > 0 ? l.join(", ") : "none"}`, `${r}.${s}`);
|
|
3731
3731
|
}
|
|
3732
3732
|
if (a)
|
|
3733
3733
|
nt(i, s, a, e, `${r}.${s}`);
|
|
3734
3734
|
else if (c) {
|
|
3735
3735
|
if (typeof i == "string" && !st(i))
|
|
3736
|
-
throw new
|
|
3737
|
-
const u = new
|
|
3736
|
+
throw new B(`Invalid value for link '${s}' in entity '${e}'. Expected a UUID, but received: ${i}`, `${r}.${s}`);
|
|
3737
|
+
const u = new he("string", !1, !0);
|
|
3738
3738
|
nt(i, s, u, e, `${r}.${s}`);
|
|
3739
3739
|
}
|
|
3740
3740
|
}
|
|
3741
3741
|
}, vc = (n, e, t, r, s = 0) => {
|
|
3742
3742
|
for (const o of Object.keys(n))
|
|
3743
3743
|
if (!Vr.includes(o))
|
|
3744
|
-
throw new
|
|
3744
|
+
throw new B(`Invalid query parameter '${o}' in $ object. Valid parameters are: ${Vr.join(", ")}. Found: ${o}`, r);
|
|
3745
3745
|
const i = [
|
|
3746
3746
|
// 'limit', // only supported client side
|
|
3747
3747
|
"offset",
|
|
@@ -3754,21 +3754,21 @@ const Vr = [
|
|
|
3754
3754
|
];
|
|
3755
3755
|
for (const o of i)
|
|
3756
3756
|
if (n[o] !== void 0 && s > 0)
|
|
3757
|
-
throw new
|
|
3757
|
+
throw new B(`'${o}' can only be used on top-level namespaces. It cannot be used in nested queries.`, r);
|
|
3758
3758
|
if (n.where && t) {
|
|
3759
3759
|
if (typeof n.where != "object" || n.where === null)
|
|
3760
|
-
throw new
|
|
3760
|
+
throw new B(`'where' clause must be an object in entity '${e}', but received: ${typeof n.where}`, r ? `${r}.where` : void 0);
|
|
3761
3761
|
Hs(n.where, e, t, r ? `${r}.where` : "where");
|
|
3762
3762
|
}
|
|
3763
3763
|
}, Js = (n, e, t, r, s = 0) => {
|
|
3764
3764
|
var i;
|
|
3765
3765
|
if (!n || typeof n != "object")
|
|
3766
|
-
throw new
|
|
3766
|
+
throw new B(`Query part for entity '${e}' must be an object, but received: ${typeof n}`, r);
|
|
3767
3767
|
for (const o of Object.keys(n))
|
|
3768
3768
|
if (o !== "$") {
|
|
3769
3769
|
if (t && !(o in t.entities[e].links)) {
|
|
3770
3770
|
const c = Object.keys(t.entities[e].links);
|
|
3771
|
-
throw new
|
|
3771
|
+
throw new B(`Link '${o}' does not exist on entity '${e}'. Available links: ${c.length > 0 ? c.join(", ") : "none"}`, `${r}.${o}`);
|
|
3772
3772
|
}
|
|
3773
3773
|
const a = n[o];
|
|
3774
3774
|
if (typeof a == "object" && a !== null) {
|
|
@@ -3778,35 +3778,35 @@ const Vr = [
|
|
|
3778
3778
|
} else {
|
|
3779
3779
|
const a = n[o];
|
|
3780
3780
|
if (typeof a != "object" || a === null)
|
|
3781
|
-
throw new
|
|
3781
|
+
throw new B(`Query parameter '$' must be an object in entity '${e}', but received: ${typeof a}`, `${r}.$`);
|
|
3782
3782
|
vc(a, e, t, `${r}.$`, s);
|
|
3783
3783
|
}
|
|
3784
3784
|
}, Qr = (n, e) => {
|
|
3785
3785
|
if (typeof n != "object" || n === null)
|
|
3786
|
-
throw new
|
|
3786
|
+
throw new B(`Query must be an object, but received: ${typeof n}${n === null ? " (null)" : ""}`);
|
|
3787
3787
|
if (Array.isArray(n))
|
|
3788
|
-
throw new
|
|
3788
|
+
throw new B(`Query must be an object, but received: ${typeof n}`);
|
|
3789
3789
|
const t = n;
|
|
3790
3790
|
for (const r of Object.keys(t)) {
|
|
3791
3791
|
if (Array.isArray(n[r]))
|
|
3792
|
-
throw new
|
|
3792
|
+
throw new B(`Query keys must be strings, but found key of type: ${typeof r}`, r);
|
|
3793
3793
|
if (typeof r != "string")
|
|
3794
|
-
throw new
|
|
3794
|
+
throw new B(`Query keys must be strings, but found key of type: ${typeof r}`, r);
|
|
3795
3795
|
if (r !== "$$ruleParams") {
|
|
3796
3796
|
if (e && !e.entities[r]) {
|
|
3797
3797
|
const s = Object.keys(e.entities);
|
|
3798
|
-
throw new
|
|
3798
|
+
throw new B(`Entity '${r}' does not exist in schema. Available entities: ${s.length > 0 ? s.join(", ") : "none"}`, r);
|
|
3799
3799
|
}
|
|
3800
3800
|
Js(t[r], r, e, r, 0);
|
|
3801
3801
|
}
|
|
3802
3802
|
}
|
|
3803
3803
|
}, Br = (n) => typeof n != "string" ? !1 : Gt(n) ? !0 : st(n);
|
|
3804
|
-
class
|
|
3804
|
+
class Se extends Error {
|
|
3805
3805
|
constructor(e) {
|
|
3806
3806
|
super(e), this.name = "TransactionValidationError";
|
|
3807
3807
|
}
|
|
3808
3808
|
}
|
|
3809
|
-
const Ys = (n) => n.length > 0 ? n.join(", ") : "none", Ec = (n, e) => new
|
|
3809
|
+
const Ys = (n) => n.length > 0 ? n.join(", ") : "none", Ec = (n, e) => new Se(`Entity '${n}' does not exist in schema. Available entities: ${Ys(e)}`), fn = {
|
|
3810
3810
|
string: (n) => typeof n == "string",
|
|
3811
3811
|
number: (n) => typeof n == "number" && !isNaN(n),
|
|
3812
3812
|
boolean: (n) => typeof n == "boolean",
|
|
@@ -3823,30 +3823,30 @@ const Ys = (n) => n.length > 0 ? n.join(", ") : "none", Ec = (n, e) => new Te(`E
|
|
|
3823
3823
|
}, dn = (n, e, t) => {
|
|
3824
3824
|
const r = Zs(n, t);
|
|
3825
3825
|
if (typeof e != "object" || e === null)
|
|
3826
|
-
throw new
|
|
3826
|
+
throw new Se(`Arguments for data operation on entity '${n}' must be an object, but received: ${typeof e}`);
|
|
3827
3827
|
for (const [s, i] of Object.entries(e)) {
|
|
3828
3828
|
if (s === "id")
|
|
3829
3829
|
continue;
|
|
3830
3830
|
const o = r.attrs[s];
|
|
3831
3831
|
if (o && !Oc(i, o))
|
|
3832
|
-
throw new
|
|
3832
|
+
throw new Se(`Invalid value for attribute '${s}' in entity '${n}'. Expected ${o.valueType}, but received: ${typeof i}`);
|
|
3833
3833
|
}
|
|
3834
3834
|
}, Gr = (n, e, t) => {
|
|
3835
3835
|
const r = Zs(n, t);
|
|
3836
3836
|
if (typeof e != "object" || e === null)
|
|
3837
|
-
throw new
|
|
3837
|
+
throw new Se(`Arguments for link operation on entity '${n}' must be an object, but received: ${typeof e}`);
|
|
3838
3838
|
for (const [s, i] of Object.entries(e)) {
|
|
3839
3839
|
if (!r.links[s]) {
|
|
3840
3840
|
const a = Object.keys(r.links);
|
|
3841
|
-
throw new
|
|
3841
|
+
throw new Se(`Link '${s}' does not exist on entity '${n}'. Available links: ${Ys(a)}`);
|
|
3842
3842
|
}
|
|
3843
3843
|
if (i != null) {
|
|
3844
3844
|
if (Array.isArray(i)) {
|
|
3845
3845
|
for (const a of i)
|
|
3846
3846
|
if (!Br(a))
|
|
3847
|
-
throw new
|
|
3847
|
+
throw new Se(`Invalid entity ID in link '${s}' for entity '${n}'. Expected a UUID or a lookup, but received: ${a}`);
|
|
3848
3848
|
} else if (!Br(i))
|
|
3849
|
-
throw new
|
|
3849
|
+
throw new Se(`Invalid UUID in link '${s}' for entity '${n}'. Expected a UUID, but received: ${i}`);
|
|
3850
3850
|
}
|
|
3851
3851
|
}
|
|
3852
3852
|
}, kc = {
|
|
@@ -3862,21 +3862,21 @@ const Ys = (n) => n.length > 0 ? n.join(", ") : "none", Ec = (n, e) => new Te(`E
|
|
|
3862
3862
|
return;
|
|
3863
3863
|
const [t, r, s, i] = n;
|
|
3864
3864
|
if (!Array.isArray(s) && !st(s))
|
|
3865
|
-
throw new
|
|
3865
|
+
throw new Se(`Invalid id for entity '${r}'. Expected a UUID, but received: ${s}`);
|
|
3866
3866
|
if (typeof r != "string")
|
|
3867
|
-
throw new
|
|
3867
|
+
throw new Se(`Entity name must be a string, but received: ${typeof r}`);
|
|
3868
3868
|
const o = kc[t];
|
|
3869
3869
|
o && i !== void 0 && o(r, i, e);
|
|
3870
3870
|
}, Cc = (n, e) => {
|
|
3871
3871
|
const t = Array.isArray(n) ? n : [n];
|
|
3872
3872
|
for (const r of t) {
|
|
3873
3873
|
if (!r || typeof r != "object")
|
|
3874
|
-
throw new
|
|
3874
|
+
throw new Se(`Transaction chunk must be an object, but received: ${typeof r}`);
|
|
3875
3875
|
if (!Array.isArray(r.__ops))
|
|
3876
|
-
throw new
|
|
3876
|
+
throw new Se(`Transaction chunk must have __ops array, but received: ${typeof r.__ops}`);
|
|
3877
3877
|
for (const s of r.__ops) {
|
|
3878
3878
|
if (!Array.isArray(s))
|
|
3879
|
-
throw new
|
|
3879
|
+
throw new Se(`Transaction operation must be an array, but received: ${typeof s}`);
|
|
3880
3880
|
Ac(s, e);
|
|
3881
3881
|
}
|
|
3882
3882
|
}
|
|
@@ -4051,7 +4051,7 @@ function hn(n, e, t) {
|
|
|
4051
4051
|
}
|
|
4052
4052
|
function Jr(n, e, t, r) {
|
|
4053
4053
|
var o;
|
|
4054
|
-
const s = (o =
|
|
4054
|
+
const s = (o = ie(t, n.table, "id")) == null ? void 0 : o.id;
|
|
4055
4055
|
if (!s)
|
|
4056
4056
|
return -1;
|
|
4057
4057
|
const i = ot(e.eav, [r, s, r]);
|
|
@@ -4100,7 +4100,7 @@ function xc(n, e) {
|
|
|
4100
4100
|
var r;
|
|
4101
4101
|
if (n.orderFieldType)
|
|
4102
4102
|
return n.orderFieldType;
|
|
4103
|
-
const t = n.orderField === "serverCreatedAt" ? "number" : (r =
|
|
4103
|
+
const t = n.orderField === "serverCreatedAt" ? "number" : (r = ie(e(), n.table, n.orderField)) == null ? void 0 : r["checked-data-type"];
|
|
4104
4104
|
return n.orderFieldType = t, t;
|
|
4105
4105
|
}
|
|
4106
4106
|
function $c(n, e, t) {
|
|
@@ -4159,7 +4159,7 @@ class Dc {
|
|
|
4159
4159
|
this.subs.flush();
|
|
4160
4160
|
}
|
|
4161
4161
|
subscribe(e, t) {
|
|
4162
|
-
const r =
|
|
4162
|
+
const r = se(e);
|
|
4163
4163
|
return this.callbacks[r] = this.callbacks[r] || [], this.callbacks[r].push(t), this.initSubscription(e, r, t), (s) => {
|
|
4164
4164
|
this.unsubscribe(r, t, s == null ? void 0 : s.keepSubscription);
|
|
4165
4165
|
};
|
|
@@ -4175,7 +4175,7 @@ class Dc {
|
|
|
4175
4175
|
}
|
|
4176
4176
|
}
|
|
4177
4177
|
sendStart(e) {
|
|
4178
|
-
this.trySend(
|
|
4178
|
+
this.trySend(Z(), {
|
|
4179
4179
|
op: "start-sync",
|
|
4180
4180
|
q: e
|
|
4181
4181
|
});
|
|
@@ -4189,7 +4189,7 @@ class Dc {
|
|
|
4189
4189
|
});
|
|
4190
4190
|
}
|
|
4191
4191
|
sendRemove(e, t) {
|
|
4192
|
-
this.trySend(
|
|
4192
|
+
this.trySend(Z(), {
|
|
4193
4193
|
op: "remove-sync",
|
|
4194
4194
|
"subscription-id": e.subscriptionId,
|
|
4195
4195
|
"keep-subscription": t
|
|
@@ -4227,7 +4227,7 @@ class Dc {
|
|
|
4227
4227
|
}
|
|
4228
4228
|
}
|
|
4229
4229
|
onStartSyncOk(e) {
|
|
4230
|
-
const t = e["subscription-id"], r = e.q, s =
|
|
4230
|
+
const t = e["subscription-id"], r = e.q, s = se(r);
|
|
4231
4231
|
this.idToHash[t] = s, this.subs.updateInPlace((i) => {
|
|
4232
4232
|
const o = i[s];
|
|
4233
4233
|
if (!o)
|
|
@@ -4321,9 +4321,9 @@ class Dc {
|
|
|
4321
4321
|
continue;
|
|
4322
4322
|
i.txId = a["tx-id"];
|
|
4323
4323
|
const c = [], u = {};
|
|
4324
|
-
for (const
|
|
4325
|
-
const S = u[
|
|
4326
|
-
u[
|
|
4324
|
+
for (const m of a.changes) {
|
|
4325
|
+
const S = u[m.triple[0]] ?? [];
|
|
4326
|
+
u[m.triple[0]] = S, S.push(m);
|
|
4327
4327
|
}
|
|
4328
4328
|
const l = s.values ?? {
|
|
4329
4329
|
entities: [],
|
|
@@ -4331,26 +4331,26 @@ class Dc {
|
|
|
4331
4331
|
}, f = l.entities;
|
|
4332
4332
|
s.values = l;
|
|
4333
4333
|
const d = [];
|
|
4334
|
-
e: for (const [
|
|
4334
|
+
e: for (const [m, S] of Object.entries(u))
|
|
4335
4335
|
for (let _ = 0; _ < f.length; _++) {
|
|
4336
|
-
const
|
|
4337
|
-
if (po(
|
|
4338
|
-
Yr(
|
|
4339
|
-
const
|
|
4340
|
-
|
|
4341
|
-
oldEntity:
|
|
4342
|
-
newEntity:
|
|
4336
|
+
const w = f[_];
|
|
4337
|
+
if (po(w.store, m)) {
|
|
4338
|
+
Yr(w.store, l.attrsStore, S);
|
|
4339
|
+
const C = hn(s, w.store, l.attrsStore), v = jc(w.store, l.attrsStore, S)[m];
|
|
4340
|
+
C ? (d.push({
|
|
4341
|
+
oldEntity: w.entity,
|
|
4342
|
+
newEntity: C,
|
|
4343
4343
|
changedFields: v || {}
|
|
4344
|
-
}),
|
|
4344
|
+
}), w.entity = C) : c.push(_), delete u[m];
|
|
4345
4345
|
continue e;
|
|
4346
4346
|
}
|
|
4347
4347
|
}
|
|
4348
4348
|
const y = [];
|
|
4349
|
-
for (const [
|
|
4349
|
+
for (const [m, S] of Object.entries(u)) {
|
|
4350
4350
|
const _ = this.createStore([]);
|
|
4351
4351
|
Yr(_, l.attrsStore, S);
|
|
4352
|
-
const
|
|
4353
|
-
if (!
|
|
4352
|
+
const w = hn(s, _, l.attrsStore);
|
|
4353
|
+
if (!w) {
|
|
4354
4354
|
this.log.error("No entity found after applying change", {
|
|
4355
4355
|
sub: s,
|
|
4356
4356
|
changes: S,
|
|
@@ -4360,13 +4360,13 @@ class Dc {
|
|
|
4360
4360
|
}
|
|
4361
4361
|
f.push({
|
|
4362
4362
|
store: _,
|
|
4363
|
-
entity:
|
|
4364
|
-
serverCreatedAt: Jr(s, _, l.attrsStore,
|
|
4365
|
-
}), y.push(
|
|
4363
|
+
entity: w,
|
|
4364
|
+
serverCreatedAt: Jr(s, _, l.attrsStore, w.id)
|
|
4365
|
+
}), y.push(w);
|
|
4366
4366
|
}
|
|
4367
4367
|
const b = [];
|
|
4368
|
-
for (const
|
|
4369
|
-
b.push(f[
|
|
4368
|
+
for (const m of c.sort().reverse())
|
|
4369
|
+
b.push(f[m].entity), f.splice(m, 1);
|
|
4370
4370
|
const g = xc(s, this.getAttrs);
|
|
4371
4371
|
$c(s, g, f), this.notifyCbs(r, {
|
|
4372
4372
|
type: Ue.SyncTransaction,
|
|
@@ -4392,7 +4392,7 @@ class Dc {
|
|
|
4392
4392
|
}
|
|
4393
4393
|
}
|
|
4394
4394
|
onStartSyncError(e) {
|
|
4395
|
-
const t =
|
|
4395
|
+
const t = se(e["original-event"].q), r = {
|
|
4396
4396
|
message: e.message || "Uh-oh, something went wrong. Ping Joe & Stopa.",
|
|
4397
4397
|
status: e.status,
|
|
4398
4398
|
type: e.type,
|
|
@@ -4412,66 +4412,66 @@ class Dc {
|
|
|
4412
4412
|
function Uc({ WStream: n, opts: e, startStream: t, appendStream: r, registerStream: s }) {
|
|
4413
4413
|
const i = e.clientId;
|
|
4414
4414
|
let o = null, a = null, c = null;
|
|
4415
|
-
const u =
|
|
4415
|
+
const u = Z();
|
|
4416
4416
|
let l = !1, f = !1;
|
|
4417
4417
|
const d = [], y = [], b = [];
|
|
4418
|
-
let g = !1,
|
|
4419
|
-
const _ = [],
|
|
4420
|
-
function
|
|
4418
|
+
let g = !1, m = 0, S = 0;
|
|
4419
|
+
const _ = [], w = new TextEncoder();
|
|
4420
|
+
function C() {
|
|
4421
4421
|
f = !0;
|
|
4422
4422
|
for (const O of d)
|
|
4423
4423
|
O(a ?? void 0);
|
|
4424
4424
|
}
|
|
4425
4425
|
function v(O) {
|
|
4426
4426
|
return d.push(O), f && O(a ?? void 0), () => {
|
|
4427
|
-
const
|
|
4428
|
-
|
|
4427
|
+
const A = d.indexOf(O);
|
|
4428
|
+
A !== -1 && d.splice(A, 1);
|
|
4429
4429
|
};
|
|
4430
4430
|
}
|
|
4431
|
-
function
|
|
4431
|
+
function U(O) {
|
|
4432
4432
|
return b.push(O), () => {
|
|
4433
|
-
const
|
|
4434
|
-
|
|
4433
|
+
const A = b.indexOf(O);
|
|
4434
|
+
A !== -1 && b.splice(A, 1);
|
|
4435
4435
|
};
|
|
4436
4436
|
}
|
|
4437
4437
|
e.waitUntil && e.waitUntil(new Promise((O) => {
|
|
4438
4438
|
b.push(O);
|
|
4439
4439
|
}));
|
|
4440
|
-
function
|
|
4440
|
+
function I() {
|
|
4441
4441
|
for (const O of b)
|
|
4442
4442
|
try {
|
|
4443
4443
|
O();
|
|
4444
4444
|
} catch {
|
|
4445
4445
|
}
|
|
4446
4446
|
}
|
|
4447
|
-
function
|
|
4447
|
+
function P(O) {
|
|
4448
4448
|
return y.push(O), o && O(o), () => {
|
|
4449
|
-
const
|
|
4450
|
-
|
|
4449
|
+
const A = y.indexOf(O);
|
|
4450
|
+
A !== -1 && y.splice(A, 1);
|
|
4451
4451
|
};
|
|
4452
4452
|
}
|
|
4453
|
-
function
|
|
4453
|
+
function H(O) {
|
|
4454
4454
|
o = O;
|
|
4455
|
-
for (const
|
|
4456
|
-
|
|
4455
|
+
for (const A of y)
|
|
4456
|
+
A(o);
|
|
4457
4457
|
}
|
|
4458
|
-
function
|
|
4458
|
+
function K() {
|
|
4459
4459
|
g = !0;
|
|
4460
4460
|
}
|
|
4461
|
-
function
|
|
4462
|
-
let
|
|
4463
|
-
for (const { byteLen:
|
|
4464
|
-
const
|
|
4465
|
-
if (
|
|
4461
|
+
function G(O) {
|
|
4462
|
+
let A = m, W = 0, J = 0;
|
|
4463
|
+
for (const { byteLen: X } of _) {
|
|
4464
|
+
const le = A + X;
|
|
4465
|
+
if (le > O)
|
|
4466
4466
|
break;
|
|
4467
|
-
|
|
4467
|
+
A = le, W++, J += X;
|
|
4468
4468
|
}
|
|
4469
|
-
|
|
4469
|
+
W > 0 && (m += J, S -= J, _.splice(0, W));
|
|
4470
4470
|
}
|
|
4471
|
-
function
|
|
4472
|
-
a =
|
|
4471
|
+
function V(O, A) {
|
|
4472
|
+
a = A, C(), O.error(A), I();
|
|
4473
4473
|
}
|
|
4474
|
-
async function
|
|
4474
|
+
async function ne() {
|
|
4475
4475
|
const O = await t({
|
|
4476
4476
|
clientId: i,
|
|
4477
4477
|
reconnectToken: u,
|
|
@@ -4479,130 +4479,130 @@ function Uc({ WStream: n, opts: e, startStream: t, appendStream: r, registerStre
|
|
|
4479
4479
|
});
|
|
4480
4480
|
switch (O.type) {
|
|
4481
4481
|
case "ok": {
|
|
4482
|
-
const { streamId:
|
|
4483
|
-
o =
|
|
4484
|
-
streamId:
|
|
4485
|
-
chunks: _.map((
|
|
4486
|
-
offset:
|
|
4482
|
+
const { streamId: A, offset: W } = O;
|
|
4483
|
+
o = A, G(W), _.length && r({
|
|
4484
|
+
streamId: A,
|
|
4485
|
+
chunks: _.map((J) => J.chunk),
|
|
4486
|
+
offset: m
|
|
4487
4487
|
}), g = !1;
|
|
4488
4488
|
break;
|
|
4489
4489
|
}
|
|
4490
4490
|
case "disconnect": {
|
|
4491
|
-
|
|
4491
|
+
K();
|
|
4492
4492
|
break;
|
|
4493
4493
|
}
|
|
4494
4494
|
case "error": {
|
|
4495
|
-
c &&
|
|
4495
|
+
c && V(c, O.error);
|
|
4496
4496
|
break;
|
|
4497
4497
|
}
|
|
4498
4498
|
}
|
|
4499
4499
|
}
|
|
4500
|
-
function
|
|
4501
|
-
|
|
4500
|
+
function q() {
|
|
4501
|
+
K(), ne();
|
|
4502
4502
|
}
|
|
4503
|
-
function k({ offset: O, done:
|
|
4504
|
-
|
|
4503
|
+
function k({ offset: O, done: A }) {
|
|
4504
|
+
G(O), A && (l = !0, I());
|
|
4505
4505
|
}
|
|
4506
|
-
function
|
|
4507
|
-
return l ? (
|
|
4506
|
+
function j(O) {
|
|
4507
|
+
return l ? (V(O, new ue("Stream has been closed.")), null) : o || (V(O, new ue("Stream has not been initialized.")), null);
|
|
4508
4508
|
}
|
|
4509
4509
|
async function R(O) {
|
|
4510
4510
|
c = O;
|
|
4511
|
-
let
|
|
4512
|
-
for (;
|
|
4513
|
-
let
|
|
4514
|
-
|
|
4515
|
-
const
|
|
4511
|
+
let A = !0, W = 0;
|
|
4512
|
+
for (; A; ) {
|
|
4513
|
+
let J = Date.now() + Math.min(15e3, 500 * (W - 1));
|
|
4514
|
+
A = !1;
|
|
4515
|
+
const X = await t({
|
|
4516
4516
|
clientId: e.clientId,
|
|
4517
4517
|
reconnectToken: u,
|
|
4518
4518
|
ruleParams: e.ruleParams
|
|
4519
4519
|
});
|
|
4520
|
-
switch (
|
|
4520
|
+
switch (X.type) {
|
|
4521
4521
|
case "ok": {
|
|
4522
|
-
const { streamId:
|
|
4522
|
+
const { streamId: le, offset: at } = X;
|
|
4523
4523
|
if (at !== 0) {
|
|
4524
|
-
const
|
|
4525
|
-
|
|
4524
|
+
const ve = new ue("Write stream is corrupted");
|
|
4525
|
+
V(O, ve);
|
|
4526
4526
|
return;
|
|
4527
4527
|
}
|
|
4528
|
-
|
|
4529
|
-
onDisconnect:
|
|
4528
|
+
H(le), s(le, {
|
|
4529
|
+
onDisconnect: K,
|
|
4530
4530
|
onFlush: k,
|
|
4531
|
-
onConnectionReconnect:
|
|
4532
|
-
onAppendFailed:
|
|
4531
|
+
onConnectionReconnect: ne,
|
|
4532
|
+
onAppendFailed: q
|
|
4533
4533
|
}), g = !1;
|
|
4534
4534
|
return;
|
|
4535
4535
|
}
|
|
4536
4536
|
case "disconnect": {
|
|
4537
|
-
|
|
4538
|
-
setTimeout(
|
|
4537
|
+
A = !0, K(), W++, await new Promise((le) => {
|
|
4538
|
+
setTimeout(le, Math.max(0, J - Date.now()));
|
|
4539
4539
|
});
|
|
4540
4540
|
break;
|
|
4541
4541
|
}
|
|
4542
4542
|
case "error": {
|
|
4543
|
-
|
|
4543
|
+
V(O, X.error);
|
|
4544
4544
|
return;
|
|
4545
4545
|
}
|
|
4546
4546
|
}
|
|
4547
4547
|
}
|
|
4548
4548
|
}
|
|
4549
|
-
class
|
|
4550
|
-
constructor(
|
|
4551
|
-
super(
|
|
4549
|
+
class F extends n {
|
|
4550
|
+
constructor(A, W) {
|
|
4551
|
+
super(A, W);
|
|
4552
4552
|
}
|
|
4553
4553
|
async streamId() {
|
|
4554
|
-
return o || new Promise((
|
|
4555
|
-
const
|
|
4556
|
-
for (const
|
|
4557
|
-
|
|
4558
|
-
},
|
|
4559
|
-
|
|
4560
|
-
}, at = (
|
|
4561
|
-
|
|
4554
|
+
return o || new Promise((A, W) => {
|
|
4555
|
+
const J = [], X = () => {
|
|
4556
|
+
for (const ve of J)
|
|
4557
|
+
ve();
|
|
4558
|
+
}, le = (ve) => {
|
|
4559
|
+
A(ve), X();
|
|
4560
|
+
}, at = (ve) => {
|
|
4561
|
+
W(ve || new ue("Stream is closed.")), X();
|
|
4562
4562
|
};
|
|
4563
|
-
|
|
4563
|
+
J.push(P(le)), J.push(v(at));
|
|
4564
4564
|
});
|
|
4565
4565
|
}
|
|
4566
4566
|
}
|
|
4567
4567
|
return {
|
|
4568
|
-
stream: new
|
|
4568
|
+
stream: new F({
|
|
4569
4569
|
// TODO(dww): accept a storage so that write streams can survive across
|
|
4570
4570
|
// browser restarts
|
|
4571
4571
|
async start(O) {
|
|
4572
4572
|
try {
|
|
4573
4573
|
await R(O);
|
|
4574
|
-
} catch (
|
|
4575
|
-
|
|
4574
|
+
} catch (A) {
|
|
4575
|
+
V(O, A);
|
|
4576
4576
|
}
|
|
4577
4577
|
},
|
|
4578
|
-
write(O,
|
|
4579
|
-
const
|
|
4580
|
-
if (
|
|
4581
|
-
const
|
|
4582
|
-
_.push({ chunk: O, byteLen:
|
|
4583
|
-
const
|
|
4584
|
-
S +=
|
|
4578
|
+
write(O, A) {
|
|
4579
|
+
const W = j(A);
|
|
4580
|
+
if (W) {
|
|
4581
|
+
const J = w.encode(O).length;
|
|
4582
|
+
_.push({ chunk: O, byteLen: J });
|
|
4583
|
+
const X = m + S;
|
|
4584
|
+
S += J, g || r({ streamId: W, chunks: [O], offset: X });
|
|
4585
4585
|
}
|
|
4586
4586
|
},
|
|
4587
4587
|
close() {
|
|
4588
4588
|
o ? r({
|
|
4589
4589
|
streamId: o,
|
|
4590
4590
|
chunks: [],
|
|
4591
|
-
offset:
|
|
4591
|
+
offset: m + S,
|
|
4592
4592
|
isDone: !0
|
|
4593
|
-
}) :
|
|
4593
|
+
}) : I(), C();
|
|
4594
4594
|
},
|
|
4595
4595
|
abort(O) {
|
|
4596
4596
|
o ? r({
|
|
4597
4597
|
streamId: o,
|
|
4598
4598
|
chunks: [],
|
|
4599
|
-
offset:
|
|
4599
|
+
offset: m + S,
|
|
4600
4600
|
isDone: !0,
|
|
4601
4601
|
abortReason: O
|
|
4602
|
-
}) :
|
|
4602
|
+
}) : I(), C();
|
|
4603
4603
|
}
|
|
4604
4604
|
}),
|
|
4605
|
-
addCompleteCb:
|
|
4605
|
+
addCompleteCb: U,
|
|
4606
4606
|
closed() {
|
|
4607
4607
|
return f;
|
|
4608
4608
|
}
|
|
@@ -4646,123 +4646,155 @@ function Fc({ RStream: n, opts: e, startStream: t, cancelStream: r }) {
|
|
|
4646
4646
|
let s = e.byteOffset || 0, i = !1;
|
|
4647
4647
|
const o = new TextDecoder("utf-8"), a = new TextEncoder();
|
|
4648
4648
|
let c, u = !1;
|
|
4649
|
-
const l = [];
|
|
4650
|
-
|
|
4649
|
+
const l = [], f = [];
|
|
4650
|
+
let d = null, y = null;
|
|
4651
|
+
function b(I) {
|
|
4651
4652
|
u = !0;
|
|
4652
|
-
for (const
|
|
4653
|
-
|
|
4653
|
+
for (const P of l)
|
|
4654
|
+
P(I);
|
|
4655
|
+
}
|
|
4656
|
+
function g(I) {
|
|
4657
|
+
return l.push(I), () => {
|
|
4658
|
+
const P = l.indexOf(I);
|
|
4659
|
+
P !== -1 && l.splice(P, 1);
|
|
4660
|
+
};
|
|
4654
4661
|
}
|
|
4655
|
-
function
|
|
4656
|
-
return
|
|
4657
|
-
const
|
|
4658
|
-
|
|
4662
|
+
function m(I) {
|
|
4663
|
+
return f.push(I), d && I(d), () => {
|
|
4664
|
+
const P = f.indexOf(I);
|
|
4665
|
+
P !== -1 && f.splice(P, 1);
|
|
4659
4666
|
};
|
|
4660
4667
|
}
|
|
4661
|
-
function
|
|
4662
|
-
|
|
4668
|
+
function S(I, P) {
|
|
4669
|
+
y = P, I.error(P), b(P);
|
|
4663
4670
|
}
|
|
4664
|
-
let
|
|
4665
|
-
async function
|
|
4666
|
-
c =
|
|
4667
|
-
const
|
|
4668
|
-
for await (const
|
|
4671
|
+
let _ = 0;
|
|
4672
|
+
async function w(I, P) {
|
|
4673
|
+
c = Z();
|
|
4674
|
+
const H = { ...I || {}, eventId: c };
|
|
4675
|
+
for await (const K of t(H)) {
|
|
4669
4676
|
if (i)
|
|
4670
4677
|
return;
|
|
4671
|
-
if (
|
|
4678
|
+
if (K.type === "reconnect")
|
|
4672
4679
|
return { retry: !0 };
|
|
4673
|
-
if (
|
|
4674
|
-
|
|
4680
|
+
if (K.type === "error") {
|
|
4681
|
+
S(P, K.error);
|
|
4675
4682
|
return;
|
|
4676
4683
|
}
|
|
4677
|
-
if (
|
|
4678
|
-
|
|
4684
|
+
if (K.offset > s) {
|
|
4685
|
+
S(P, new ue("Stream is corrupted.")), i = !0;
|
|
4679
4686
|
return;
|
|
4680
4687
|
}
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
|
|
4688
|
+
d = K.streamId;
|
|
4689
|
+
for (const V of f)
|
|
4690
|
+
V(d);
|
|
4691
|
+
let G = s - K.offset;
|
|
4692
|
+
if (K.files && K.files.length) {
|
|
4693
|
+
const V = new AbortController();
|
|
4694
|
+
let ne = fetch(K.files[0].url, {
|
|
4695
|
+
signal: V.signal
|
|
4686
4696
|
});
|
|
4687
|
-
for (let
|
|
4688
|
-
const
|
|
4689
|
-
if (
|
|
4690
|
-
if (
|
|
4691
|
-
|
|
4697
|
+
for (let q = 0; q < K.files.length; q++) {
|
|
4698
|
+
const k = K.files[q + 1], R = await ne;
|
|
4699
|
+
if (k && (ne = fetch(k.url, { signal: V.signal })), !R.ok) {
|
|
4700
|
+
if (_++, _ > 10) {
|
|
4701
|
+
S(P, new ue("Unable to process stream."));
|
|
4692
4702
|
return;
|
|
4693
4703
|
}
|
|
4694
4704
|
return { retry: !0 };
|
|
4695
4705
|
}
|
|
4696
|
-
if (
|
|
4697
|
-
const
|
|
4706
|
+
if (R.body) {
|
|
4707
|
+
const F = R.body.getReader();
|
|
4698
4708
|
try {
|
|
4699
4709
|
for (; ; ) {
|
|
4700
|
-
const { done:
|
|
4701
|
-
if (
|
|
4710
|
+
const { done: N, value: O } = await F.read();
|
|
4711
|
+
if (N)
|
|
4702
4712
|
break;
|
|
4703
4713
|
if (i) {
|
|
4704
|
-
|
|
4714
|
+
V.abort();
|
|
4705
4715
|
return;
|
|
4706
4716
|
}
|
|
4707
|
-
let
|
|
4708
|
-
if (
|
|
4717
|
+
let A = O;
|
|
4718
|
+
if (G > 0 && (A = O.subarray(G), G -= O.length - A.length), !A.length)
|
|
4709
4719
|
continue;
|
|
4710
|
-
s +=
|
|
4711
|
-
const
|
|
4712
|
-
|
|
4720
|
+
s += A.length;
|
|
4721
|
+
const W = o.decode(A);
|
|
4722
|
+
P.enqueue(W);
|
|
4713
4723
|
}
|
|
4714
4724
|
} finally {
|
|
4715
|
-
|
|
4725
|
+
F.releaseLock();
|
|
4716
4726
|
}
|
|
4717
4727
|
} else {
|
|
4718
|
-
const
|
|
4719
|
-
let
|
|
4728
|
+
const F = await R.arrayBuffer();
|
|
4729
|
+
let N = F;
|
|
4720
4730
|
if (i) {
|
|
4721
|
-
|
|
4731
|
+
V.abort();
|
|
4722
4732
|
return;
|
|
4723
4733
|
}
|
|
4724
|
-
if (
|
|
4734
|
+
if (G > 0 && (N = new Uint8Array(F).subarray(G), G -= F.byteLength - N.length), !N.byteLength)
|
|
4725
4735
|
continue;
|
|
4726
|
-
s +=
|
|
4727
|
-
const
|
|
4728
|
-
|
|
4736
|
+
s += N.byteLength;
|
|
4737
|
+
const O = o.decode(N);
|
|
4738
|
+
P.enqueue(O);
|
|
4729
4739
|
}
|
|
4730
4740
|
}
|
|
4731
4741
|
}
|
|
4732
|
-
if (
|
|
4733
|
-
let
|
|
4734
|
-
if (
|
|
4735
|
-
const
|
|
4736
|
-
if (
|
|
4742
|
+
if (_ = 0, K.content) {
|
|
4743
|
+
let V = K.content, ne = a.encode(K.content);
|
|
4744
|
+
if (G > 0) {
|
|
4745
|
+
const q = ne.subarray(G);
|
|
4746
|
+
if (G -= ne.length - q.length, !q.length)
|
|
4737
4747
|
continue;
|
|
4738
|
-
|
|
4748
|
+
ne = q, V = o.decode(q);
|
|
4739
4749
|
}
|
|
4740
|
-
s +=
|
|
4750
|
+
s += ne.length, P.enqueue(V);
|
|
4741
4751
|
}
|
|
4742
4752
|
}
|
|
4743
4753
|
}
|
|
4744
|
-
async function
|
|
4745
|
-
let
|
|
4746
|
-
for (;
|
|
4747
|
-
|
|
4748
|
-
let
|
|
4749
|
-
const
|
|
4750
|
-
|
|
4751
|
-
setTimeout(
|
|
4754
|
+
async function C(I) {
|
|
4755
|
+
let P = !0, H = 0;
|
|
4756
|
+
for (; P; ) {
|
|
4757
|
+
P = !1;
|
|
4758
|
+
let K = Date.now() + Math.min(15e3, 500 * (H - 1));
|
|
4759
|
+
const G = await w({ ...e, offset: s }, I);
|
|
4760
|
+
G != null && G.retry && (P = !0, H++, K < Date.now() - 3e5 && (H = 0), await new Promise((V) => {
|
|
4761
|
+
setTimeout(V, Math.max(0, K - Date.now()));
|
|
4752
4762
|
}));
|
|
4753
4763
|
}
|
|
4754
|
-
!i && !u && (
|
|
4764
|
+
!i && !u && (I.close(), b());
|
|
4765
|
+
}
|
|
4766
|
+
class v extends n {
|
|
4767
|
+
constructor(P, H) {
|
|
4768
|
+
super(P, H);
|
|
4769
|
+
}
|
|
4770
|
+
async streamId() {
|
|
4771
|
+
if (d)
|
|
4772
|
+
return d;
|
|
4773
|
+
if (y)
|
|
4774
|
+
throw y;
|
|
4775
|
+
return new Promise((P, H) => {
|
|
4776
|
+
const K = [], G = () => {
|
|
4777
|
+
for (const q of K)
|
|
4778
|
+
q();
|
|
4779
|
+
}, V = (q) => {
|
|
4780
|
+
P(q), G();
|
|
4781
|
+
}, ne = (q) => {
|
|
4782
|
+
H(q || new ue("Stream is closed.")), G();
|
|
4783
|
+
};
|
|
4784
|
+
K.push(m(V)), K.push(g(ne));
|
|
4785
|
+
});
|
|
4786
|
+
}
|
|
4755
4787
|
}
|
|
4756
4788
|
return {
|
|
4757
|
-
stream: new
|
|
4758
|
-
start(
|
|
4759
|
-
|
|
4789
|
+
stream: new v({
|
|
4790
|
+
start(I) {
|
|
4791
|
+
C(I);
|
|
4760
4792
|
},
|
|
4761
|
-
cancel(
|
|
4762
|
-
i = !0, c && r({ eventId: c }),
|
|
4793
|
+
cancel(I) {
|
|
4794
|
+
i = !0, c && r({ eventId: c }), b();
|
|
4763
4795
|
}
|
|
4764
4796
|
}),
|
|
4765
|
-
addCloseCb:
|
|
4797
|
+
addCloseCb: g,
|
|
4766
4798
|
closed() {
|
|
4767
4799
|
return u;
|
|
4768
4800
|
}
|
|
@@ -4804,7 +4836,7 @@ class Nc {
|
|
|
4804
4836
|
}), t;
|
|
4805
4837
|
}
|
|
4806
4838
|
startWriteStream(e) {
|
|
4807
|
-
const t =
|
|
4839
|
+
const t = Z();
|
|
4808
4840
|
let r = null;
|
|
4809
4841
|
const s = new Promise((o) => {
|
|
4810
4842
|
r = o;
|
|
@@ -4828,7 +4860,7 @@ class Nc {
|
|
|
4828
4860
|
offset: s,
|
|
4829
4861
|
done: !!r
|
|
4830
4862
|
};
|
|
4831
|
-
i && (o["abort-reason"] = i), this.trySend(
|
|
4863
|
+
i && (o["abort-reason"] = i), this.trySend(Z(), o);
|
|
4832
4864
|
}
|
|
4833
4865
|
onAppendFailed(e) {
|
|
4834
4866
|
const t = this.writeStreams[e["stream-id"]];
|
|
@@ -4863,10 +4895,9 @@ class Nc {
|
|
|
4863
4895
|
op: "unsubscribe-stream",
|
|
4864
4896
|
"subscribe-event-id": e
|
|
4865
4897
|
};
|
|
4866
|
-
this.trySend(
|
|
4898
|
+
this.trySend(Z(), t), delete this.readStreamIterators[e];
|
|
4867
4899
|
}
|
|
4868
4900
|
onStreamAppend(e) {
|
|
4869
|
-
var s;
|
|
4870
4901
|
const t = e["client-event-id"], r = this.readStreamIterators[t];
|
|
4871
4902
|
if (!r) {
|
|
4872
4903
|
this.log.info("No iterator for read stream", e);
|
|
@@ -4875,15 +4906,16 @@ class Nc {
|
|
|
4875
4906
|
if (e.error) {
|
|
4876
4907
|
e.retry ? r.push({ type: "reconnect" }) : r.push({
|
|
4877
4908
|
type: "error",
|
|
4878
|
-
error: new
|
|
4909
|
+
error: new ue(e.error)
|
|
4879
4910
|
}), r.close(), delete this.readStreamIterators[t];
|
|
4880
4911
|
return;
|
|
4881
4912
|
}
|
|
4882
|
-
|
|
4913
|
+
r.push({
|
|
4883
4914
|
type: "append",
|
|
4884
4915
|
offset: e.offset,
|
|
4885
4916
|
files: e.files,
|
|
4886
|
-
content: e.content
|
|
4917
|
+
content: e.content,
|
|
4918
|
+
streamId: e["stream-id"]
|
|
4887
4919
|
}), e.done && (r.close(), delete this.readStreamIterators[t]);
|
|
4888
4920
|
}
|
|
4889
4921
|
onConnectionStatusChange(e) {
|
|
@@ -4912,7 +4944,7 @@ class Nc {
|
|
|
4912
4944
|
const r = e["client-event-id"], s = this.startWriteStreamCbs[r];
|
|
4913
4945
|
s && (s({
|
|
4914
4946
|
type: "error",
|
|
4915
|
-
error: new
|
|
4947
|
+
error: new ue(e.message || "Unknown error", e.hint)
|
|
4916
4948
|
}), delete this.startWriteStreamCbs[r]);
|
|
4917
4949
|
break;
|
|
4918
4950
|
}
|
|
@@ -4920,7 +4952,7 @@ class Nc {
|
|
|
4920
4952
|
const r = e["client-event-id"], s = this.readStreamIterators[r];
|
|
4921
4953
|
s && (s.push({
|
|
4922
4954
|
type: "error",
|
|
4923
|
-
error: new
|
|
4955
|
+
error: new ue(e.message || "Unknown error", e.hint)
|
|
4924
4956
|
}), s.close(), delete this.readStreamIterators[r]);
|
|
4925
4957
|
break;
|
|
4926
4958
|
}
|
|
@@ -5095,7 +5127,7 @@ class Xc {
|
|
|
5095
5127
|
// Queries
|
|
5096
5128
|
p(this, "getPreviousResult", (e) => {
|
|
5097
5129
|
var r;
|
|
5098
|
-
const t =
|
|
5130
|
+
const t = se(e);
|
|
5099
5131
|
return (r = this.dataForQuery(t)) == null ? void 0 : r.data;
|
|
5100
5132
|
});
|
|
5101
5133
|
/** Re-run instaql and call all callbacks with new data */
|
|
@@ -5138,7 +5170,7 @@ class Xc {
|
|
|
5138
5170
|
* @returns
|
|
5139
5171
|
*/
|
|
5140
5172
|
p(this, "pushOps", (e, t) => {
|
|
5141
|
-
const r =
|
|
5173
|
+
const r = Z(), s = [...this._pendingMutations().values()], i = Math.max(0, ...s.map((c) => c.order || 0)) + 1, o = {
|
|
5142
5174
|
op: "transact",
|
|
5143
5175
|
"tx-steps": e,
|
|
5144
5176
|
created: Date.now(),
|
|
@@ -5159,7 +5191,7 @@ class Xc {
|
|
|
5159
5191
|
}
|
|
5160
5192
|
this._log.info("[socket][open]", this._transport.id), this._setStatus(Ce.OPENED), this.getCurrentUser().then((r) => {
|
|
5161
5193
|
var s;
|
|
5162
|
-
this._trySend(
|
|
5194
|
+
this._trySend(Z(), {
|
|
5163
5195
|
op: "init",
|
|
5164
5196
|
"app-id": this.config.appId,
|
|
5165
5197
|
"refresh-token": (s = r.user) == null ? void 0 : s.refresh_token,
|
|
@@ -5349,7 +5381,7 @@ class Xc {
|
|
|
5349
5381
|
status: o ?? 0
|
|
5350
5382
|
}));
|
|
5351
5383
|
} else
|
|
5352
|
-
s.reject(new
|
|
5384
|
+
s.reject(new ue((r == null ? void 0 : r.message) || "Unknown error", r == null ? void 0 : r.hint));
|
|
5353
5385
|
}
|
|
5354
5386
|
_setStatus(e, t) {
|
|
5355
5387
|
this.status = e, this._errorMessage = t, this.notifyConnectionStatusSubs(e), this._instantStream.onConnectionStatusChange(e);
|
|
@@ -5373,7 +5405,7 @@ class Xc {
|
|
|
5373
5405
|
_addQueryData(e, t, r) {
|
|
5374
5406
|
if (!this.attrs)
|
|
5375
5407
|
throw new Error("Attrs in reactor have not been set");
|
|
5376
|
-
const s =
|
|
5408
|
+
const s = se(e), i = this.ensureAttrs(), o = pt(this.attrs, t.triples, r, this.config.useDateObjects);
|
|
5377
5409
|
this.querySubs.updateInPlace((a) => {
|
|
5378
5410
|
a[s] = {
|
|
5379
5411
|
result: {
|
|
@@ -5400,23 +5432,23 @@ class Xc {
|
|
|
5400
5432
|
break;
|
|
5401
5433
|
}
|
|
5402
5434
|
case "add-query-exists": {
|
|
5403
|
-
this.notifyOneQueryOnce(
|
|
5435
|
+
this.notifyOneQueryOnce(se(t.q));
|
|
5404
5436
|
break;
|
|
5405
5437
|
}
|
|
5406
5438
|
case "add-query-ok": {
|
|
5407
|
-
const { q: y, result: b } = t, g =
|
|
5439
|
+
const { q: y, result: b } = t, g = se(y);
|
|
5408
5440
|
if (!this._hasQueryListeners() && !this.querySubs.currentValue[g])
|
|
5409
5441
|
break;
|
|
5410
|
-
const
|
|
5442
|
+
const m = (c = (a = b == null ? void 0 : b[0]) == null ? void 0 : a.data) == null ? void 0 : c["page-info"], S = (l = (u = b == null ? void 0 : b[0]) == null ? void 0 : u.data) == null ? void 0 : l.aggregate, _ = qr(b), w = this.ensureAttrs(), C = pt(w, _, r, this.config.useDateObjects);
|
|
5411
5443
|
this.querySubs.updateInPlace((v) => {
|
|
5412
5444
|
if (!v[g]) {
|
|
5413
5445
|
this._log.info("Missing value in querySubs", { hash: g, q: y });
|
|
5414
5446
|
return;
|
|
5415
5447
|
}
|
|
5416
5448
|
v[g].result = {
|
|
5417
|
-
store:
|
|
5418
|
-
attrsStore:
|
|
5419
|
-
pageInfo:
|
|
5449
|
+
store: C,
|
|
5450
|
+
attrsStore: w,
|
|
5451
|
+
pageInfo: m,
|
|
5420
5452
|
aggregate: S,
|
|
5421
5453
|
processedTxId: t["processed-tx-id"]
|
|
5422
5454
|
};
|
|
@@ -5458,46 +5490,46 @@ class Xc {
|
|
|
5458
5490
|
case "refresh-ok": {
|
|
5459
5491
|
const { computations: y, attrs: b } = t, g = t["processed-tx-id"];
|
|
5460
5492
|
b && this._setAttrs(b), this._cleanupPendingMutationsTimeout();
|
|
5461
|
-
const
|
|
5462
|
-
|
|
5463
|
-
|
|
5493
|
+
const m = this._rewriteMutations(this.ensureAttrs(), this._pendingMutations(), g);
|
|
5494
|
+
m !== this._pendingMutations() && this.kv.updateInPlace((w) => {
|
|
5495
|
+
w.pendingMutations = m;
|
|
5464
5496
|
});
|
|
5465
|
-
const S = bn(
|
|
5466
|
-
var
|
|
5467
|
-
const
|
|
5497
|
+
const S = bn(m.entries()), _ = y.map((w) => {
|
|
5498
|
+
var q, k, j, R;
|
|
5499
|
+
const C = w["instaql-query"], v = w["instaql-result"], U = se(C), I = qr(v), P = this.ensureAttrs(), H = pt(P, I, r, this.config.useDateObjects), { store: K, attrsStore: G } = this._applyOptimisticUpdates(H, P, S, g), V = (k = (q = v == null ? void 0 : v[0]) == null ? void 0 : q.data) == null ? void 0 : k["page-info"], ne = (R = (j = v == null ? void 0 : v[0]) == null ? void 0 : j.data) == null ? void 0 : R.aggregate;
|
|
5468
5500
|
return {
|
|
5469
|
-
q:
|
|
5470
|
-
hash:
|
|
5471
|
-
store:
|
|
5472
|
-
attrsStore:
|
|
5473
|
-
pageInfo:
|
|
5474
|
-
aggregate:
|
|
5501
|
+
q: C,
|
|
5502
|
+
hash: U,
|
|
5503
|
+
store: K,
|
|
5504
|
+
attrsStore: G,
|
|
5505
|
+
pageInfo: V,
|
|
5506
|
+
aggregate: ne
|
|
5475
5507
|
};
|
|
5476
5508
|
});
|
|
5477
|
-
_.forEach(({ hash:
|
|
5478
|
-
this.querySubs.updateInPlace((
|
|
5479
|
-
if (!
|
|
5480
|
-
this._log.error("Missing value in querySubs", { hash:
|
|
5509
|
+
_.forEach(({ hash: w, q: C, store: v, attrsStore: U, pageInfo: I, aggregate: P }) => {
|
|
5510
|
+
this.querySubs.updateInPlace((H) => {
|
|
5511
|
+
if (!H[w]) {
|
|
5512
|
+
this._log.error("Missing value in querySubs", { hash: w, q: C });
|
|
5481
5513
|
return;
|
|
5482
5514
|
}
|
|
5483
|
-
|
|
5515
|
+
H[w].result = {
|
|
5484
5516
|
store: v,
|
|
5485
|
-
attrsStore:
|
|
5486
|
-
pageInfo:
|
|
5487
|
-
aggregate:
|
|
5517
|
+
attrsStore: U,
|
|
5518
|
+
pageInfo: I,
|
|
5519
|
+
aggregate: P,
|
|
5488
5520
|
processedTxId: g
|
|
5489
5521
|
};
|
|
5490
5522
|
});
|
|
5491
|
-
}), this._cleanupPendingMutationsQueries(), _.forEach(({ hash:
|
|
5492
|
-
this.notifyOne(
|
|
5523
|
+
}), this._cleanupPendingMutationsQueries(), _.forEach(({ hash: w }) => {
|
|
5524
|
+
this.notifyOne(w);
|
|
5493
5525
|
});
|
|
5494
5526
|
break;
|
|
5495
5527
|
}
|
|
5496
5528
|
case "transact-ok": {
|
|
5497
5529
|
const { "client-event-id": y, "tx-id": b } = t;
|
|
5498
5530
|
this._inFlightMutationEventIds.delete(y);
|
|
5499
|
-
const
|
|
5500
|
-
if (!
|
|
5531
|
+
const m = this._rewriteMutations(this.ensureAttrs(), this._pendingMutations()).get(y);
|
|
5532
|
+
if (!m)
|
|
5501
5533
|
break;
|
|
5502
5534
|
this._updatePendingMutations((_) => {
|
|
5503
5535
|
_.set(y, {
|
|
@@ -5507,10 +5539,10 @@ class Xc {
|
|
|
5507
5539
|
});
|
|
5508
5540
|
});
|
|
5509
5541
|
const S = [];
|
|
5510
|
-
for (const _ of
|
|
5542
|
+
for (const _ of m["tx-steps"])
|
|
5511
5543
|
if (_[0] === "add-attr") {
|
|
5512
|
-
const
|
|
5513
|
-
S.push(
|
|
5544
|
+
const w = _[1];
|
|
5545
|
+
S.push(w);
|
|
5514
5546
|
}
|
|
5515
5547
|
if (S.length) {
|
|
5516
5548
|
const _ = Object.values(this.ensureAttrs().attrs);
|
|
@@ -5604,8 +5636,8 @@ class Xc {
|
|
|
5604
5636
|
return;
|
|
5605
5637
|
}
|
|
5606
5638
|
if ((a = e["original-event"]) != null && a.hasOwnProperty("q") && ((c = e["original-event"]) == null ? void 0 : c.op) === "add-query") {
|
|
5607
|
-
const y = (u = e["original-event"]) == null ? void 0 : u.q, b =
|
|
5608
|
-
this.notifyQueryError(
|
|
5639
|
+
const y = (u = e["original-event"]) == null ? void 0 : u.q, b = se(y);
|
|
5640
|
+
this.notifyQueryError(se(y), s), this.notifyQueryOnceError(y, b, t, s);
|
|
5609
5641
|
return;
|
|
5610
5642
|
}
|
|
5611
5643
|
if (((l = e["original-event"]) == null ? void 0 : l.op) === "init") {
|
|
@@ -5646,7 +5678,7 @@ class Xc {
|
|
|
5646
5678
|
this.attrs = new Ke(e.reduce((t, r) => (t[r.id] = r, t), {}), this._linkIndex), this.notifyAttrsSubs();
|
|
5647
5679
|
}
|
|
5648
5680
|
_startQuerySub(e, t) {
|
|
5649
|
-
const r =
|
|
5681
|
+
const r = Z();
|
|
5650
5682
|
return this.querySubs.updateInPlace((s) => {
|
|
5651
5683
|
s[t] = s[t] || { q: e, result: null, eventId: r }, s[t].lastAccessed = Date.now();
|
|
5652
5684
|
}), this._trySendAuthed(r, { op: "add-query", q: e }), r;
|
|
@@ -5666,7 +5698,7 @@ class Xc {
|
|
|
5666
5698
|
*/
|
|
5667
5699
|
subscribeQuery(e, t, r) {
|
|
5668
5700
|
this.config.disableValidation || Qr(e, this.config.schema), r && "ruleParams" in r && (e = { $$ruleParams: r.ruleParams, ...e });
|
|
5669
|
-
const s =
|
|
5701
|
+
const s = se(e), i = this.getPreviousResult(e);
|
|
5670
5702
|
return i && t(i), this.queryCbs[s] = this.queryCbs[s] ?? [], this.queryCbs[s].push({ q: e, cb: t }), this._startQuerySub(e, s), () => {
|
|
5671
5703
|
this._unsubQuery(e, s, t);
|
|
5672
5704
|
};
|
|
@@ -5678,7 +5710,7 @@ class Xc {
|
|
|
5678
5710
|
return r.reject(new Error("We can't run `queryOnce`, because the device is offline.")), r.promise;
|
|
5679
5711
|
if (!this.querySubs)
|
|
5680
5712
|
return r.reject(new Error("We can't run `queryOnce` on the backend. Use adminAPI.query instead: https://www.instantdb.com/docs/backend#query")), r.promise;
|
|
5681
|
-
const s =
|
|
5713
|
+
const s = se(e), i = this._startQuerySub(e, s);
|
|
5682
5714
|
return this.queryOnceDfds[s] = this.queryOnceDfds[s] ?? [], this.queryOnceDfds[s].push({ q: e, dfd: r, eventId: i }), setTimeout(() => r.reject(new Error("Query timed out")), Kc), r.promise;
|
|
5683
5715
|
}
|
|
5684
5716
|
_completeQueryOnce(e, t, r) {
|
|
@@ -5692,7 +5724,7 @@ class Xc {
|
|
|
5692
5724
|
return !!((t = this.queryCbs[e]) != null && t.length || (r = this.queryOnceDfds[e]) != null && r.length);
|
|
5693
5725
|
}
|
|
5694
5726
|
_cleanupQuery(e, t) {
|
|
5695
|
-
this._hasQueryListeners(t) || (delete this.queryCbs[t], delete this.queryOnceDfds[t], delete this._dataForQueryCache[t], this.querySubs.unloadKey(t), this._trySendAuthed(
|
|
5727
|
+
this._hasQueryListeners(t) || (delete this.queryCbs[t], delete this.queryOnceDfds[t], delete this._dataForQueryCache[t], this.querySubs.unloadKey(t), this._trySendAuthed(Z(), { op: "remove-query", q: e }));
|
|
5696
5728
|
}
|
|
5697
5729
|
// When we `pushTx`, it's possible that we don't yet have `this.attrs`
|
|
5698
5730
|
// This means that `tx-steps` in `pendingMutations` will include `add-attr`
|
|
@@ -5718,7 +5750,7 @@ class Xc {
|
|
|
5718
5750
|
return /* @__PURE__ */ new Map();
|
|
5719
5751
|
const s = (l) => {
|
|
5720
5752
|
const [f, d, y] = l["forward-identity"];
|
|
5721
|
-
return
|
|
5753
|
+
return ie(e, d, y);
|
|
5722
5754
|
}, i = (l) => {
|
|
5723
5755
|
const [f, d, y] = l["forward-identity"];
|
|
5724
5756
|
return Ve(e, d, y);
|
|
@@ -5729,15 +5761,15 @@ class Xc {
|
|
|
5729
5761
|
for (const y of l) {
|
|
5730
5762
|
const [b] = y;
|
|
5731
5763
|
if (b === "add-attr") {
|
|
5732
|
-
const [
|
|
5764
|
+
const [m, S] = y, _ = s(S);
|
|
5733
5765
|
if (_ && S.id !== _.id) {
|
|
5734
5766
|
o.attrIdMap[S.id] = _.id, a = !0;
|
|
5735
5767
|
continue;
|
|
5736
5768
|
}
|
|
5737
5769
|
if (S["value-type"] === "ref") {
|
|
5738
|
-
const
|
|
5739
|
-
if (
|
|
5740
|
-
o.attrIdMap[S.id] =
|
|
5770
|
+
const w = i(S);
|
|
5771
|
+
if (w) {
|
|
5772
|
+
o.attrIdMap[S.id] = w.id, o.refSwapAttrIds.add(S.id), a = !0;
|
|
5741
5773
|
continue;
|
|
5742
5774
|
}
|
|
5743
5775
|
}
|
|
@@ -5799,9 +5831,9 @@ class Xc {
|
|
|
5799
5831
|
if (l && s === l.querySubVersion && o === l.pendingMutationsVersion)
|
|
5800
5832
|
return l;
|
|
5801
5833
|
let f = u.store, d = u.attrsStore;
|
|
5802
|
-
const { pageInfo: y, aggregate: b, processedTxId: g } = u,
|
|
5834
|
+
const { pageInfo: y, aggregate: b, processedTxId: g } = u, m = this._rewriteMutationsSorted(d, a);
|
|
5803
5835
|
if (t) {
|
|
5804
|
-
const _ = this._applyOptimisticUpdates(f, d,
|
|
5836
|
+
const _ = this._applyOptimisticUpdates(f, d, m, g);
|
|
5805
5837
|
f = _.store, d = _.attrsStore;
|
|
5806
5838
|
}
|
|
5807
5839
|
return { data: Ns({ store: f, attrsStore: d, pageInfo: y, aggregate: b }, c), querySubVersion: s, pendingMutationsVersion: o };
|
|
@@ -5950,7 +5982,7 @@ class Xc {
|
|
|
5950
5982
|
const r = await this.kv.waitForKeyToLoad(t);
|
|
5951
5983
|
if (r)
|
|
5952
5984
|
return r;
|
|
5953
|
-
const s =
|
|
5985
|
+
const s = Z();
|
|
5954
5986
|
return this.kv.updateInPlace((i) => {
|
|
5955
5987
|
i[t] || (i[t] = s);
|
|
5956
5988
|
}), await this.kv.waitForKeyToLoad(t);
|
|
@@ -6037,7 +6069,7 @@ class Xc {
|
|
|
6037
6069
|
async getAuth() {
|
|
6038
6070
|
const { user: e, error: t } = await this.getCurrentUser();
|
|
6039
6071
|
if (t)
|
|
6040
|
-
throw new
|
|
6072
|
+
throw new ue("Could not get current user: " + t.message);
|
|
6041
6073
|
return e ?? null;
|
|
6042
6074
|
}
|
|
6043
6075
|
subscribeConnectionStatus(e) {
|
|
@@ -6330,14 +6362,14 @@ class Xc {
|
|
|
6330
6362
|
i.result.user = o, s.isConnected && (this._trySetPresence(t, o), this._notifyPresenceSubs(t));
|
|
6331
6363
|
}
|
|
6332
6364
|
_trySetPresence(e, t) {
|
|
6333
|
-
this._trySendAuthed(
|
|
6365
|
+
this._trySendAuthed(Z(), {
|
|
6334
6366
|
op: "set-presence",
|
|
6335
6367
|
"room-id": e,
|
|
6336
6368
|
data: t
|
|
6337
6369
|
});
|
|
6338
6370
|
}
|
|
6339
6371
|
_tryJoinRoom(e, t, r) {
|
|
6340
|
-
this._trySendAuthed(
|
|
6372
|
+
this._trySendAuthed(Z(), {
|
|
6341
6373
|
op: "join-room",
|
|
6342
6374
|
"room-type": e,
|
|
6343
6375
|
"room-id": t,
|
|
@@ -6345,7 +6377,7 @@ class Xc {
|
|
|
6345
6377
|
}), delete this._roomsPendingLeave[t];
|
|
6346
6378
|
}
|
|
6347
6379
|
_tryLeaveRoom(e) {
|
|
6348
|
-
this._trySendAuthed(
|
|
6380
|
+
this._trySendAuthed(Z(), { op: "leave-room", "room-id": e });
|
|
6349
6381
|
}
|
|
6350
6382
|
_trySetRoomConnected(e, t) {
|
|
6351
6383
|
const r = this._rooms[e];
|
|
@@ -6419,7 +6451,7 @@ class Xc {
|
|
|
6419
6451
|
}
|
|
6420
6452
|
}
|
|
6421
6453
|
_tryBroadcast(e, t, r, s) {
|
|
6422
|
-
this._trySendAuthed(
|
|
6454
|
+
this._trySendAuthed(Z(), {
|
|
6423
6455
|
op: "client-broadcast",
|
|
6424
6456
|
"room-id": e,
|
|
6425
6457
|
roomType: t,
|
|
@@ -6504,22 +6536,22 @@ function tu(n) {
|
|
|
6504
6536
|
return new Xt(n, {});
|
|
6505
6537
|
}
|
|
6506
6538
|
function nu() {
|
|
6507
|
-
return new
|
|
6539
|
+
return new he("string", !0, !1);
|
|
6508
6540
|
}
|
|
6509
6541
|
function ru() {
|
|
6510
|
-
return new
|
|
6542
|
+
return new he("number", !0, !1);
|
|
6511
6543
|
}
|
|
6512
6544
|
function su() {
|
|
6513
|
-
return new
|
|
6545
|
+
return new he("boolean", !0, !1);
|
|
6514
6546
|
}
|
|
6515
6547
|
function iu() {
|
|
6516
|
-
return new
|
|
6548
|
+
return new he("date", !0, !1);
|
|
6517
6549
|
}
|
|
6518
6550
|
function ou() {
|
|
6519
|
-
return new
|
|
6551
|
+
return new he("json", !0, !1);
|
|
6520
6552
|
}
|
|
6521
6553
|
function au() {
|
|
6522
|
-
return new
|
|
6554
|
+
return new he("json", !0, !1);
|
|
6523
6555
|
}
|
|
6524
6556
|
function ei(n, e) {
|
|
6525
6557
|
var s, i, o, a;
|
|
@@ -6744,190 +6776,190 @@ const gu = (n) => JSON.stringify(n), bt = (n, e = !1) => JSON.stringify([n, e]),
|
|
|
6744
6776
|
];
|
|
6745
6777
|
return { chunks: t, data: r };
|
|
6746
6778
|
}, gn = ["bootstrap", "bootstrap", "bootstrap", 1], Tu = (n, e, t, r) => {
|
|
6747
|
-
var
|
|
6748
|
-
const { entityName: s, entityQuery: i } = ni(e), o = ((
|
|
6779
|
+
var G, V, ne, q;
|
|
6780
|
+
const { entityName: s, entityQuery: i } = ni(e), o = ((G = i.$) == null ? void 0 : G.limit) || 10, a = s, c = ti((V = i.$) == null ? void 0 : V.order), u = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map();
|
|
6749
6781
|
let d = !1, y = !0, b = null, g = null;
|
|
6750
|
-
const
|
|
6782
|
+
const m = (k) => {
|
|
6751
6783
|
t({ error: k, data: void 0, canLoadNextPage: !1 });
|
|
6752
6784
|
}, S = () => {
|
|
6753
6785
|
if (!y)
|
|
6754
6786
|
return;
|
|
6755
|
-
const { chunks: k, data:
|
|
6787
|
+
const { chunks: k, data: j } = wu(u, l);
|
|
6756
6788
|
t({
|
|
6757
|
-
data: { [a]:
|
|
6789
|
+
data: { [a]: j },
|
|
6758
6790
|
// @ts-expect-error hidden debug variable
|
|
6759
6791
|
chunks: k,
|
|
6760
6792
|
canLoadNextPage: mu(u)
|
|
6761
6793
|
});
|
|
6762
|
-
}, _ = (k,
|
|
6763
|
-
u.set(bt(k,
|
|
6764
|
-
},
|
|
6765
|
-
l.set(bt(k),
|
|
6766
|
-
},
|
|
6767
|
-
var O,
|
|
6768
|
-
const { cursor: R } = Xr(k),
|
|
6769
|
-
|
|
6770
|
-
const
|
|
6794
|
+
}, _ = (k, j) => {
|
|
6795
|
+
u.set(bt(k, j.afterInclusive), j), S();
|
|
6796
|
+
}, w = (k, j) => {
|
|
6797
|
+
l.set(bt(k), j), P(), S();
|
|
6798
|
+
}, C = (k, j) => {
|
|
6799
|
+
var O, A;
|
|
6800
|
+
const { cursor: R } = Xr(k), F = f.get(He("reverse", R));
|
|
6801
|
+
F == null || F();
|
|
6802
|
+
const N = n.subscribeQuery({
|
|
6771
6803
|
[a]: {
|
|
6772
6804
|
...i,
|
|
6773
6805
|
$: {
|
|
6774
6806
|
after: R,
|
|
6775
|
-
before:
|
|
6807
|
+
before: j.endCursor,
|
|
6776
6808
|
beforeInclusive: !0,
|
|
6777
6809
|
where: (O = i.$) == null ? void 0 : O.where,
|
|
6778
|
-
fields: (
|
|
6810
|
+
fields: (A = i.$) == null ? void 0 : A.fields,
|
|
6779
6811
|
order: es(c)
|
|
6780
6812
|
}
|
|
6781
6813
|
}
|
|
6782
|
-
}, (
|
|
6783
|
-
if (
|
|
6784
|
-
return
|
|
6785
|
-
const
|
|
6786
|
-
ut(
|
|
6787
|
-
data:
|
|
6814
|
+
}, (W) => {
|
|
6815
|
+
if (W.error)
|
|
6816
|
+
return m(W.error);
|
|
6817
|
+
const J = W.data[a], X = W.pageInfo[a];
|
|
6818
|
+
ut(J && X, "Expected query subscription to contain rows and pageInfo"), w(R, {
|
|
6819
|
+
data: J,
|
|
6788
6820
|
status: "frozen",
|
|
6789
|
-
hasMore:
|
|
6790
|
-
endCursor:
|
|
6821
|
+
hasMore: X.hasNextPage,
|
|
6822
|
+
endCursor: X.endCursor
|
|
6791
6823
|
});
|
|
6792
6824
|
}, r);
|
|
6793
|
-
f.set(He("reverse", R),
|
|
6825
|
+
f.set(He("reverse", R), N);
|
|
6794
6826
|
}, v = (k) => {
|
|
6795
|
-
var R,
|
|
6796
|
-
const
|
|
6827
|
+
var R, F;
|
|
6828
|
+
const j = n.subscribeQuery({
|
|
6797
6829
|
[a]: {
|
|
6798
6830
|
...i,
|
|
6799
6831
|
$: {
|
|
6800
6832
|
limit: o,
|
|
6801
6833
|
after: k,
|
|
6802
6834
|
where: (R = i.$) == null ? void 0 : R.where,
|
|
6803
|
-
fields: (
|
|
6835
|
+
fields: (F = i.$) == null ? void 0 : F.fields,
|
|
6804
6836
|
order: es(c)
|
|
6805
6837
|
}
|
|
6806
6838
|
}
|
|
6807
|
-
}, (
|
|
6808
|
-
if (
|
|
6809
|
-
return
|
|
6810
|
-
const O =
|
|
6811
|
-
ut(O &&
|
|
6839
|
+
}, (N) => {
|
|
6840
|
+
if (N.error)
|
|
6841
|
+
return m(N.error);
|
|
6842
|
+
const O = N.data[a], A = N.pageInfo[a];
|
|
6843
|
+
ut(O && A, "Expected rows and pageInfo"), w(k, {
|
|
6812
6844
|
data: O,
|
|
6813
6845
|
status: "bootstrapping",
|
|
6814
|
-
hasMore:
|
|
6815
|
-
endCursor:
|
|
6846
|
+
hasMore: A.hasNextPage,
|
|
6847
|
+
endCursor: A.endCursor
|
|
6816
6848
|
});
|
|
6817
6849
|
}, r);
|
|
6818
|
-
f.set(He("reverse", k),
|
|
6819
|
-
},
|
|
6820
|
-
var
|
|
6850
|
+
f.set(He("reverse", k), j);
|
|
6851
|
+
}, U = (k, j = !1) => {
|
|
6852
|
+
var F, N;
|
|
6821
6853
|
const R = n.subscribeQuery({
|
|
6822
6854
|
[a]: {
|
|
6823
6855
|
...i,
|
|
6824
6856
|
$: {
|
|
6825
6857
|
limit: o,
|
|
6826
6858
|
after: k,
|
|
6827
|
-
afterInclusive:
|
|
6828
|
-
where: (
|
|
6829
|
-
fields: (
|
|
6859
|
+
afterInclusive: j,
|
|
6860
|
+
where: (F = i.$) == null ? void 0 : F.where,
|
|
6861
|
+
fields: (N = i.$) == null ? void 0 : N.fields,
|
|
6830
6862
|
order: c
|
|
6831
6863
|
}
|
|
6832
6864
|
}
|
|
6833
6865
|
}, (O) => {
|
|
6834
6866
|
if (O.error)
|
|
6835
|
-
return
|
|
6836
|
-
const
|
|
6837
|
-
ut(
|
|
6838
|
-
data:
|
|
6867
|
+
return m(O.error);
|
|
6868
|
+
const A = O.data[a], W = O.pageInfo[a];
|
|
6869
|
+
ut(A && W, "Page info and rows"), _(k, {
|
|
6870
|
+
data: A,
|
|
6839
6871
|
status: "bootstrapping",
|
|
6840
|
-
hasMore:
|
|
6841
|
-
endCursor:
|
|
6842
|
-
afterInclusive:
|
|
6872
|
+
hasMore: W.hasNextPage,
|
|
6873
|
+
endCursor: W.endCursor,
|
|
6874
|
+
afterInclusive: j
|
|
6843
6875
|
});
|
|
6844
6876
|
}, r);
|
|
6845
|
-
f.set(He("forward", k,
|
|
6846
|
-
},
|
|
6847
|
-
var
|
|
6848
|
-
const R = bt(k,
|
|
6849
|
-
|
|
6850
|
-
const
|
|
6851
|
-
if (!(
|
|
6877
|
+
f.set(He("forward", k, j), R);
|
|
6878
|
+
}, I = (k, j = !1) => {
|
|
6879
|
+
var A, W;
|
|
6880
|
+
const R = bt(k, j), F = f.get(He("forward", k, j));
|
|
6881
|
+
F == null || F();
|
|
6882
|
+
const N = u.get(R);
|
|
6883
|
+
if (!(N != null && N.endCursor))
|
|
6852
6884
|
return;
|
|
6853
6885
|
const O = n.subscribeQuery({
|
|
6854
6886
|
[a]: {
|
|
6855
6887
|
...i,
|
|
6856
6888
|
$: {
|
|
6857
6889
|
after: k,
|
|
6858
|
-
afterInclusive:
|
|
6859
|
-
before:
|
|
6890
|
+
afterInclusive: N.afterInclusive,
|
|
6891
|
+
before: N.endCursor,
|
|
6860
6892
|
beforeInclusive: !0,
|
|
6861
|
-
where: (
|
|
6862
|
-
fields: (
|
|
6893
|
+
where: (A = i.$) == null ? void 0 : A.where,
|
|
6894
|
+
fields: (W = i.$) == null ? void 0 : W.fields,
|
|
6863
6895
|
order: c
|
|
6864
6896
|
}
|
|
6865
6897
|
}
|
|
6866
|
-
}, (
|
|
6867
|
-
if (
|
|
6868
|
-
return
|
|
6869
|
-
const
|
|
6870
|
-
ut(
|
|
6871
|
-
data:
|
|
6898
|
+
}, (J) => {
|
|
6899
|
+
if (J.error)
|
|
6900
|
+
return m(J.error);
|
|
6901
|
+
const X = J.data[a], le = J.pageInfo[a];
|
|
6902
|
+
ut(X && le, "Expected rows and pageInfo"), _(k, {
|
|
6903
|
+
data: X,
|
|
6872
6904
|
status: "frozen",
|
|
6873
|
-
hasMore:
|
|
6874
|
-
endCursor:
|
|
6875
|
-
afterInclusive:
|
|
6905
|
+
hasMore: le.hasNextPage,
|
|
6906
|
+
endCursor: le.endCursor,
|
|
6907
|
+
afterInclusive: N.afterInclusive
|
|
6876
6908
|
});
|
|
6877
6909
|
}, r);
|
|
6878
|
-
f.set(He("forward", k,
|
|
6879
|
-
},
|
|
6910
|
+
f.set(He("forward", k, j), O);
|
|
6911
|
+
}, P = () => {
|
|
6880
6912
|
const k = Array.from(l.entries()).at(-1);
|
|
6881
6913
|
if (!k)
|
|
6882
6914
|
return;
|
|
6883
|
-
const [
|
|
6915
|
+
const [j, R] = k;
|
|
6884
6916
|
if (!(R != null && R.hasMore) || !_u(R))
|
|
6885
6917
|
return;
|
|
6886
|
-
const
|
|
6887
|
-
|
|
6888
|
-
},
|
|
6918
|
+
const F = `${j}:${gu(R.endCursor)}`;
|
|
6919
|
+
F != b && (b = F, C(j, R), v(R.endCursor));
|
|
6920
|
+
}, H = () => {
|
|
6889
6921
|
const k = Array.from(u.entries()).at(-1);
|
|
6890
6922
|
if (!k)
|
|
6891
6923
|
return;
|
|
6892
|
-
const [
|
|
6924
|
+
const [j, R] = k;
|
|
6893
6925
|
if (!R.endCursor)
|
|
6894
6926
|
return;
|
|
6895
|
-
const { cursor:
|
|
6896
|
-
|
|
6927
|
+
const { cursor: F, afterInclusive: N } = Xr(j);
|
|
6928
|
+
I(F, N), U(R.endCursor);
|
|
6897
6929
|
};
|
|
6898
6930
|
return g = n.subscribeQuery({
|
|
6899
6931
|
[a]: {
|
|
6900
6932
|
...i,
|
|
6901
6933
|
$: {
|
|
6902
6934
|
limit: o,
|
|
6903
|
-
where: (
|
|
6904
|
-
fields: (
|
|
6935
|
+
where: (ne = i.$) == null ? void 0 : ne.where,
|
|
6936
|
+
fields: (q = i.$) == null ? void 0 : q.fields,
|
|
6905
6937
|
order: c
|
|
6906
6938
|
}
|
|
6907
6939
|
}
|
|
6908
6940
|
}, async (k) => {
|
|
6909
|
-
var
|
|
6941
|
+
var N;
|
|
6910
6942
|
if (d)
|
|
6911
6943
|
return;
|
|
6912
6944
|
if (k.error)
|
|
6913
|
-
return
|
|
6914
|
-
const
|
|
6915
|
-
if (ut(R &&
|
|
6945
|
+
return m(k.error);
|
|
6946
|
+
const j = k.pageInfo[a], R = (N = k == null ? void 0 : k.data) == null ? void 0 : N[a];
|
|
6947
|
+
if (ut(R && j, "Expected rows and pageInfo"), R.length < o) {
|
|
6916
6948
|
_(gn, {
|
|
6917
6949
|
data: R,
|
|
6918
6950
|
status: "pre-bootstrap"
|
|
6919
6951
|
});
|
|
6920
6952
|
return;
|
|
6921
6953
|
}
|
|
6922
|
-
const
|
|
6923
|
-
if (!
|
|
6954
|
+
const F = j.startCursor;
|
|
6955
|
+
if (!F) {
|
|
6924
6956
|
_(gn, {
|
|
6925
6957
|
data: R,
|
|
6926
6958
|
status: "pre-bootstrap"
|
|
6927
6959
|
});
|
|
6928
6960
|
return;
|
|
6929
6961
|
}
|
|
6930
|
-
u.delete(bt(gn)),
|
|
6962
|
+
u.delete(bt(gn)), U(F, !0), v(j.startCursor), d = !0;
|
|
6931
6963
|
}, r), {
|
|
6932
6964
|
unsubscribe: () => {
|
|
6933
6965
|
if (y) {
|
|
@@ -6937,7 +6969,7 @@ const gu = (n) => JSON.stringify(n), bt = (n, e = !1) => JSON.stringify([n, e]),
|
|
|
6937
6969
|
f.clear();
|
|
6938
6970
|
}
|
|
6939
6971
|
},
|
|
6940
|
-
loadNextPage:
|
|
6972
|
+
loadNextPage: H
|
|
6941
6973
|
};
|
|
6942
6974
|
}, Su = (n, e, t) => {
|
|
6943
6975
|
var u, l, f, d;
|
|
@@ -6971,10 +7003,10 @@ const gu = (n) => JSON.stringify(n), bt = (n, e = !1) => JSON.stringify([n, e]),
|
|
|
6971
7003
|
};
|
|
6972
7004
|
}, ni = (n) => {
|
|
6973
7005
|
if (Object.keys(n).length !== 1)
|
|
6974
|
-
throw new
|
|
7006
|
+
throw new B("subscribeInfiniteQuery expects exactly one entity");
|
|
6975
7007
|
const [t, r] = Object.entries(n)[0];
|
|
6976
7008
|
if (!t || !r)
|
|
6977
|
-
throw new
|
|
7009
|
+
throw new B("No query provided for infinite query");
|
|
6978
7010
|
return { entityName: t, entityQuery: r };
|
|
6979
7011
|
}, vu = {
|
|
6980
7012
|
apiURI: "https://api.instantdb.com",
|
|
@@ -7404,7 +7436,7 @@ function ns(n) {
|
|
|
7404
7436
|
const e = ts.get(n);
|
|
7405
7437
|
if (e)
|
|
7406
7438
|
return e;
|
|
7407
|
-
const t =
|
|
7439
|
+
const t = se(n);
|
|
7408
7440
|
return ts.set(n, t), t;
|
|
7409
7441
|
}
|
|
7410
7442
|
function Pu(n, e) {
|
|
@@ -7475,54 +7507,54 @@ function xu() {
|
|
|
7475
7507
|
* LICENSE file in the root directory of this source tree.
|
|
7476
7508
|
*/
|
|
7477
7509
|
return n.NODE_ENV !== "production" && function() {
|
|
7478
|
-
var e = fs, t = Symbol.for("react.element"), r = Symbol.for("react.portal"), s = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), a = Symbol.for("react.provider"), c = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), l = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), d = Symbol.for("react.memo"), y = Symbol.for("react.lazy"), b = Symbol.for("react.offscreen"), g = Symbol.iterator,
|
|
7510
|
+
var e = fs, t = Symbol.for("react.element"), r = Symbol.for("react.portal"), s = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), a = Symbol.for("react.provider"), c = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), l = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), d = Symbol.for("react.memo"), y = Symbol.for("react.lazy"), b = Symbol.for("react.offscreen"), g = Symbol.iterator, m = "@@iterator";
|
|
7479
7511
|
function S(h) {
|
|
7480
7512
|
if (h === null || typeof h != "object")
|
|
7481
7513
|
return null;
|
|
7482
|
-
var T = g && h[g] || h[
|
|
7514
|
+
var T = g && h[g] || h[m];
|
|
7483
7515
|
return typeof T == "function" ? T : null;
|
|
7484
7516
|
}
|
|
7485
7517
|
var _ = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
7486
|
-
function
|
|
7518
|
+
function w(h) {
|
|
7487
7519
|
{
|
|
7488
|
-
for (var T = arguments.length, E = new Array(T > 1 ? T - 1 : 0),
|
|
7489
|
-
E[
|
|
7490
|
-
|
|
7520
|
+
for (var T = arguments.length, E = new Array(T > 1 ? T - 1 : 0), M = 1; M < T; M++)
|
|
7521
|
+
E[M - 1] = arguments[M];
|
|
7522
|
+
C("error", h, E);
|
|
7491
7523
|
}
|
|
7492
7524
|
}
|
|
7493
|
-
function
|
|
7525
|
+
function C(h, T, E) {
|
|
7494
7526
|
{
|
|
7495
|
-
var
|
|
7496
|
-
|
|
7497
|
-
var
|
|
7498
|
-
return String(
|
|
7527
|
+
var M = _.ReactDebugCurrentFrame, z = M.getStackAddendum();
|
|
7528
|
+
z !== "" && (T += "%s", E = E.concat([z]));
|
|
7529
|
+
var Q = E.map(function(L) {
|
|
7530
|
+
return String(L);
|
|
7499
7531
|
});
|
|
7500
|
-
|
|
7532
|
+
Q.unshift("Warning: " + T), Function.prototype.apply.call(console[h], console, Q);
|
|
7501
7533
|
}
|
|
7502
7534
|
}
|
|
7503
|
-
var v = !1,
|
|
7504
|
-
|
|
7505
|
-
function
|
|
7506
|
-
return !!(typeof h == "string" || typeof h == "function" || h === s || h === o ||
|
|
7535
|
+
var v = !1, U = !1, I = !1, P = !1, H = !1, K;
|
|
7536
|
+
K = Symbol.for("react.module.reference");
|
|
7537
|
+
function G(h) {
|
|
7538
|
+
return !!(typeof h == "string" || typeof h == "function" || h === s || h === o || H || h === i || h === l || h === f || P || h === b || v || U || I || typeof h == "object" && h !== null && (h.$$typeof === y || h.$$typeof === d || h.$$typeof === a || h.$$typeof === c || h.$$typeof === u || // This needs to include all possible module reference object
|
|
7507
7539
|
// types supported by any Flight configuration anywhere since
|
|
7508
7540
|
// we don't know which Flight build this will end up being used
|
|
7509
7541
|
// with.
|
|
7510
|
-
h.$$typeof ===
|
|
7542
|
+
h.$$typeof === K || h.getModuleId !== void 0));
|
|
7511
7543
|
}
|
|
7512
|
-
function
|
|
7513
|
-
var
|
|
7514
|
-
if (
|
|
7515
|
-
return
|
|
7516
|
-
var
|
|
7517
|
-
return
|
|
7544
|
+
function V(h, T, E) {
|
|
7545
|
+
var M = h.displayName;
|
|
7546
|
+
if (M)
|
|
7547
|
+
return M;
|
|
7548
|
+
var z = T.displayName || T.name || "";
|
|
7549
|
+
return z !== "" ? E + "(" + z + ")" : E;
|
|
7518
7550
|
}
|
|
7519
|
-
function
|
|
7551
|
+
function ne(h) {
|
|
7520
7552
|
return h.displayName || "Context";
|
|
7521
7553
|
}
|
|
7522
|
-
function
|
|
7554
|
+
function q(h) {
|
|
7523
7555
|
if (h == null)
|
|
7524
7556
|
return null;
|
|
7525
|
-
if (typeof h.tag == "number" &&
|
|
7557
|
+
if (typeof h.tag == "number" && w("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof h == "function")
|
|
7526
7558
|
return h.displayName || h.name || null;
|
|
7527
7559
|
if (typeof h == "string")
|
|
7528
7560
|
return h;
|
|
@@ -7544,19 +7576,19 @@ function xu() {
|
|
|
7544
7576
|
switch (h.$$typeof) {
|
|
7545
7577
|
case c:
|
|
7546
7578
|
var T = h;
|
|
7547
|
-
return
|
|
7579
|
+
return ne(T) + ".Consumer";
|
|
7548
7580
|
case a:
|
|
7549
7581
|
var E = h;
|
|
7550
|
-
return
|
|
7582
|
+
return ne(E._context) + ".Provider";
|
|
7551
7583
|
case u:
|
|
7552
|
-
return
|
|
7584
|
+
return V(h, h.render, "ForwardRef");
|
|
7553
7585
|
case d:
|
|
7554
|
-
var
|
|
7555
|
-
return
|
|
7586
|
+
var M = h.displayName || null;
|
|
7587
|
+
return M !== null ? M : q(h.type) || "Memo";
|
|
7556
7588
|
case y: {
|
|
7557
|
-
var
|
|
7589
|
+
var z = h, Q = z._payload, L = z._init;
|
|
7558
7590
|
try {
|
|
7559
|
-
return
|
|
7591
|
+
return q(L(Q));
|
|
7560
7592
|
} catch {
|
|
7561
7593
|
return null;
|
|
7562
7594
|
}
|
|
@@ -7564,18 +7596,18 @@ function xu() {
|
|
|
7564
7596
|
}
|
|
7565
7597
|
return null;
|
|
7566
7598
|
}
|
|
7567
|
-
var k = Object.assign,
|
|
7568
|
-
function
|
|
7599
|
+
var k = Object.assign, j = 0, R, F, N, O, A, W, J;
|
|
7600
|
+
function X() {
|
|
7569
7601
|
}
|
|
7570
|
-
|
|
7571
|
-
function
|
|
7602
|
+
X.__reactDisabledLog = !0;
|
|
7603
|
+
function le() {
|
|
7572
7604
|
{
|
|
7573
|
-
if (
|
|
7574
|
-
R = console.log,
|
|
7605
|
+
if (j === 0) {
|
|
7606
|
+
R = console.log, F = console.info, N = console.warn, O = console.error, A = console.group, W = console.groupCollapsed, J = console.groupEnd;
|
|
7575
7607
|
var h = {
|
|
7576
7608
|
configurable: !0,
|
|
7577
7609
|
enumerable: !0,
|
|
7578
|
-
value:
|
|
7610
|
+
value: X,
|
|
7579
7611
|
writable: !0
|
|
7580
7612
|
};
|
|
7581
7613
|
Object.defineProperties(console, {
|
|
@@ -7588,12 +7620,12 @@ function xu() {
|
|
|
7588
7620
|
groupEnd: h
|
|
7589
7621
|
});
|
|
7590
7622
|
}
|
|
7591
|
-
|
|
7623
|
+
j++;
|
|
7592
7624
|
}
|
|
7593
7625
|
}
|
|
7594
7626
|
function at() {
|
|
7595
7627
|
{
|
|
7596
|
-
if (
|
|
7628
|
+
if (j--, j === 0) {
|
|
7597
7629
|
var h = {
|
|
7598
7630
|
configurable: !0,
|
|
7599
7631
|
enumerable: !0,
|
|
@@ -7604,37 +7636,37 @@ function xu() {
|
|
|
7604
7636
|
value: R
|
|
7605
7637
|
}),
|
|
7606
7638
|
info: k({}, h, {
|
|
7607
|
-
value:
|
|
7639
|
+
value: F
|
|
7608
7640
|
}),
|
|
7609
7641
|
warn: k({}, h, {
|
|
7610
|
-
value:
|
|
7642
|
+
value: N
|
|
7611
7643
|
}),
|
|
7612
7644
|
error: k({}, h, {
|
|
7613
7645
|
value: O
|
|
7614
7646
|
}),
|
|
7615
7647
|
group: k({}, h, {
|
|
7616
|
-
value:
|
|
7648
|
+
value: A
|
|
7617
7649
|
}),
|
|
7618
7650
|
groupCollapsed: k({}, h, {
|
|
7619
|
-
value:
|
|
7651
|
+
value: W
|
|
7620
7652
|
}),
|
|
7621
7653
|
groupEnd: k({}, h, {
|
|
7622
|
-
value:
|
|
7654
|
+
value: J
|
|
7623
7655
|
})
|
|
7624
7656
|
});
|
|
7625
7657
|
}
|
|
7626
|
-
|
|
7658
|
+
j < 0 && w("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
7627
7659
|
}
|
|
7628
7660
|
}
|
|
7629
|
-
var
|
|
7661
|
+
var ve = _.ReactCurrentDispatcher, tn;
|
|
7630
7662
|
function kt(h, T, E) {
|
|
7631
7663
|
{
|
|
7632
7664
|
if (tn === void 0)
|
|
7633
7665
|
try {
|
|
7634
7666
|
throw Error();
|
|
7635
|
-
} catch (
|
|
7636
|
-
var
|
|
7637
|
-
tn =
|
|
7667
|
+
} catch (z) {
|
|
7668
|
+
var M = z.stack.trim().match(/\n( *(at )?)/);
|
|
7669
|
+
tn = M && M[1] || "";
|
|
7638
7670
|
}
|
|
7639
7671
|
return `
|
|
7640
7672
|
` + tn + h;
|
|
@@ -7653,65 +7685,65 @@ function xu() {
|
|
|
7653
7685
|
if (E !== void 0)
|
|
7654
7686
|
return E;
|
|
7655
7687
|
}
|
|
7656
|
-
var
|
|
7688
|
+
var M;
|
|
7657
7689
|
nn = !0;
|
|
7658
|
-
var
|
|
7690
|
+
var z = Error.prepareStackTrace;
|
|
7659
7691
|
Error.prepareStackTrace = void 0;
|
|
7660
|
-
var
|
|
7661
|
-
|
|
7692
|
+
var Q;
|
|
7693
|
+
Q = ve.current, ve.current = null, le();
|
|
7662
7694
|
try {
|
|
7663
7695
|
if (T) {
|
|
7664
|
-
var
|
|
7696
|
+
var L = function() {
|
|
7665
7697
|
throw Error();
|
|
7666
7698
|
};
|
|
7667
|
-
if (Object.defineProperty(
|
|
7699
|
+
if (Object.defineProperty(L.prototype, "props", {
|
|
7668
7700
|
set: function() {
|
|
7669
7701
|
throw Error();
|
|
7670
7702
|
}
|
|
7671
7703
|
}), typeof Reflect == "object" && Reflect.construct) {
|
|
7672
7704
|
try {
|
|
7673
|
-
Reflect.construct(
|
|
7674
|
-
} catch (
|
|
7675
|
-
|
|
7705
|
+
Reflect.construct(L, []);
|
|
7706
|
+
} catch (pe) {
|
|
7707
|
+
M = pe;
|
|
7676
7708
|
}
|
|
7677
|
-
Reflect.construct(h, [],
|
|
7709
|
+
Reflect.construct(h, [], L);
|
|
7678
7710
|
} else {
|
|
7679
7711
|
try {
|
|
7680
|
-
|
|
7681
|
-
} catch (
|
|
7682
|
-
|
|
7712
|
+
L.call();
|
|
7713
|
+
} catch (pe) {
|
|
7714
|
+
M = pe;
|
|
7683
7715
|
}
|
|
7684
|
-
h.call(
|
|
7716
|
+
h.call(L.prototype);
|
|
7685
7717
|
}
|
|
7686
7718
|
} else {
|
|
7687
7719
|
try {
|
|
7688
7720
|
throw Error();
|
|
7689
|
-
} catch (
|
|
7690
|
-
|
|
7721
|
+
} catch (pe) {
|
|
7722
|
+
M = pe;
|
|
7691
7723
|
}
|
|
7692
7724
|
h();
|
|
7693
7725
|
}
|
|
7694
|
-
} catch (
|
|
7695
|
-
if (
|
|
7696
|
-
for (var $ =
|
|
7697
|
-
`),
|
|
7698
|
-
`),
|
|
7699
|
-
|
|
7700
|
-
for (;
|
|
7701
|
-
if ($[
|
|
7702
|
-
if (
|
|
7726
|
+
} catch (pe) {
|
|
7727
|
+
if (pe && M && typeof pe.stack == "string") {
|
|
7728
|
+
for (var $ = pe.stack.split(`
|
|
7729
|
+
`), fe = M.stack.split(`
|
|
7730
|
+
`), ee = $.length - 1, re = fe.length - 1; ee >= 1 && re >= 0 && $[ee] !== fe[re]; )
|
|
7731
|
+
re--;
|
|
7732
|
+
for (; ee >= 1 && re >= 0; ee--, re--)
|
|
7733
|
+
if ($[ee] !== fe[re]) {
|
|
7734
|
+
if (ee !== 1 || re !== 1)
|
|
7703
7735
|
do
|
|
7704
|
-
if (
|
|
7705
|
-
var
|
|
7706
|
-
` + $[
|
|
7707
|
-
return h.displayName &&
|
|
7736
|
+
if (ee--, re--, re < 0 || $[ee] !== fe[re]) {
|
|
7737
|
+
var Te = `
|
|
7738
|
+
` + $[ee].replace(" at new ", " at ");
|
|
7739
|
+
return h.displayName && Te.includes("<anonymous>") && (Te = Te.replace("<anonymous>", h.displayName)), typeof h == "function" && At.set(h, Te), Te;
|
|
7708
7740
|
}
|
|
7709
|
-
while (
|
|
7741
|
+
while (ee >= 1 && re >= 0);
|
|
7710
7742
|
break;
|
|
7711
7743
|
}
|
|
7712
7744
|
}
|
|
7713
7745
|
} finally {
|
|
7714
|
-
nn = !1,
|
|
7746
|
+
nn = !1, ve.current = Q, at(), Error.prepareStackTrace = z;
|
|
7715
7747
|
}
|
|
7716
7748
|
var Be = h ? h.displayName || h.name : "", De = Be ? kt(Be) : "";
|
|
7717
7749
|
return typeof h == "function" && At.set(h, De), De;
|
|
@@ -7743,9 +7775,9 @@ function xu() {
|
|
|
7743
7775
|
case d:
|
|
7744
7776
|
return Ct(h.type, T, E);
|
|
7745
7777
|
case y: {
|
|
7746
|
-
var
|
|
7778
|
+
var M = h, z = M._payload, Q = M._init;
|
|
7747
7779
|
try {
|
|
7748
|
-
return Ct(
|
|
7780
|
+
return Ct(Q(z), T, E);
|
|
7749
7781
|
} catch {
|
|
7750
7782
|
}
|
|
7751
7783
|
}
|
|
@@ -7760,22 +7792,22 @@ function xu() {
|
|
|
7760
7792
|
} else
|
|
7761
7793
|
ur.setExtraStackFrame(null);
|
|
7762
7794
|
}
|
|
7763
|
-
function ui(h, T, E,
|
|
7795
|
+
function ui(h, T, E, M, z) {
|
|
7764
7796
|
{
|
|
7765
|
-
var
|
|
7766
|
-
for (var
|
|
7767
|
-
if (
|
|
7797
|
+
var Q = Function.call.bind(ct);
|
|
7798
|
+
for (var L in h)
|
|
7799
|
+
if (Q(h, L)) {
|
|
7768
7800
|
var $ = void 0;
|
|
7769
7801
|
try {
|
|
7770
|
-
if (typeof h[
|
|
7771
|
-
var
|
|
7772
|
-
throw
|
|
7802
|
+
if (typeof h[L] != "function") {
|
|
7803
|
+
var fe = Error((M || "React class") + ": " + E + " type `" + L + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof h[L] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
7804
|
+
throw fe.name = "Invariant Violation", fe;
|
|
7773
7805
|
}
|
|
7774
|
-
$ = h[
|
|
7775
|
-
} catch (
|
|
7776
|
-
$ =
|
|
7806
|
+
$ = h[L](T, L, M, E, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
7807
|
+
} catch (ee) {
|
|
7808
|
+
$ = ee;
|
|
7777
7809
|
}
|
|
7778
|
-
$ && !($ instanceof Error) && (It(
|
|
7810
|
+
$ && !($ instanceof Error) && (It(z), w("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", M || "React class", E, L, typeof $), It(null)), $ instanceof Error && !($.message in cr) && (cr[$.message] = !0, It(z), w("Failed %s type: %s", E, $.message), It(null));
|
|
7779
7811
|
}
|
|
7780
7812
|
}
|
|
7781
7813
|
}
|
|
@@ -7801,7 +7833,7 @@ function xu() {
|
|
|
7801
7833
|
}
|
|
7802
7834
|
function fr(h) {
|
|
7803
7835
|
if (di(h))
|
|
7804
|
-
return
|
|
7836
|
+
return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", fi(h)), lr(h);
|
|
7805
7837
|
}
|
|
7806
7838
|
var dr = _.ReactCurrentOwner, hi = {
|
|
7807
7839
|
key: !0,
|
|
@@ -7831,7 +7863,7 @@ function xu() {
|
|
|
7831
7863
|
function gi(h, T) {
|
|
7832
7864
|
{
|
|
7833
7865
|
var E = function() {
|
|
7834
|
-
hr || (hr = !0,
|
|
7866
|
+
hr || (hr = !0, w("%s: `key` 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)", T));
|
|
7835
7867
|
};
|
|
7836
7868
|
E.isReactWarning = !0, Object.defineProperty(h, "key", {
|
|
7837
7869
|
get: E,
|
|
@@ -7842,7 +7874,7 @@ function xu() {
|
|
|
7842
7874
|
function _i(h, T) {
|
|
7843
7875
|
{
|
|
7844
7876
|
var E = function() {
|
|
7845
|
-
pr || (pr = !0,
|
|
7877
|
+
pr || (pr = !0, w("%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)", T));
|
|
7846
7878
|
};
|
|
7847
7879
|
E.isReactWarning = !0, Object.defineProperty(h, "ref", {
|
|
7848
7880
|
get: E,
|
|
@@ -7850,7 +7882,7 @@ function xu() {
|
|
|
7850
7882
|
});
|
|
7851
7883
|
}
|
|
7852
7884
|
}
|
|
7853
|
-
var mi = function(h, T, E,
|
|
7885
|
+
var mi = function(h, T, E, M, z, Q, L) {
|
|
7854
7886
|
var $ = {
|
|
7855
7887
|
// This tag allows us to uniquely identify this as a React Element
|
|
7856
7888
|
$$typeof: t,
|
|
@@ -7858,9 +7890,9 @@ function xu() {
|
|
|
7858
7890
|
type: h,
|
|
7859
7891
|
key: T,
|
|
7860
7892
|
ref: E,
|
|
7861
|
-
props:
|
|
7893
|
+
props: L,
|
|
7862
7894
|
// Record the component responsible for creating this element.
|
|
7863
|
-
_owner:
|
|
7895
|
+
_owner: Q
|
|
7864
7896
|
};
|
|
7865
7897
|
return $._store = {}, Object.defineProperty($._store, "validated", {
|
|
7866
7898
|
configurable: !1,
|
|
@@ -7871,30 +7903,30 @@ function xu() {
|
|
|
7871
7903
|
configurable: !1,
|
|
7872
7904
|
enumerable: !1,
|
|
7873
7905
|
writable: !1,
|
|
7874
|
-
value:
|
|
7906
|
+
value: M
|
|
7875
7907
|
}), Object.defineProperty($, "_source", {
|
|
7876
7908
|
configurable: !1,
|
|
7877
7909
|
enumerable: !1,
|
|
7878
7910
|
writable: !1,
|
|
7879
|
-
value:
|
|
7911
|
+
value: z
|
|
7880
7912
|
}), Object.freeze && (Object.freeze($.props), Object.freeze($)), $;
|
|
7881
7913
|
};
|
|
7882
|
-
function wi(h, T, E,
|
|
7914
|
+
function wi(h, T, E, M, z) {
|
|
7883
7915
|
{
|
|
7884
|
-
var
|
|
7885
|
-
E !== void 0 && (fr(E), $ = "" + E), yi(T) && (fr(T.key), $ = "" + T.key), pi(T) && (
|
|
7886
|
-
for (
|
|
7887
|
-
ct.call(T,
|
|
7916
|
+
var Q, L = {}, $ = null, fe = null;
|
|
7917
|
+
E !== void 0 && (fr(E), $ = "" + E), yi(T) && (fr(T.key), $ = "" + T.key), pi(T) && (fe = T.ref, bi(T, z));
|
|
7918
|
+
for (Q in T)
|
|
7919
|
+
ct.call(T, Q) && !hi.hasOwnProperty(Q) && (L[Q] = T[Q]);
|
|
7888
7920
|
if (h && h.defaultProps) {
|
|
7889
|
-
var
|
|
7890
|
-
for (
|
|
7891
|
-
|
|
7921
|
+
var ee = h.defaultProps;
|
|
7922
|
+
for (Q in ee)
|
|
7923
|
+
L[Q] === void 0 && (L[Q] = ee[Q]);
|
|
7892
7924
|
}
|
|
7893
|
-
if ($ ||
|
|
7894
|
-
var
|
|
7895
|
-
$ && gi(
|
|
7925
|
+
if ($ || fe) {
|
|
7926
|
+
var re = typeof h == "function" ? h.displayName || h.name || "Unknown" : h;
|
|
7927
|
+
$ && gi(L, re), fe && _i(L, re);
|
|
7896
7928
|
}
|
|
7897
|
-
return mi(h, $,
|
|
7929
|
+
return mi(h, $, fe, z, M, dr.current, L);
|
|
7898
7930
|
}
|
|
7899
7931
|
}
|
|
7900
7932
|
var sn = _.ReactCurrentOwner, yr = _.ReactDebugCurrentFrame;
|
|
@@ -7913,7 +7945,7 @@ function xu() {
|
|
|
7913
7945
|
function br() {
|
|
7914
7946
|
{
|
|
7915
7947
|
if (sn.current) {
|
|
7916
|
-
var h =
|
|
7948
|
+
var h = q(sn.current.type);
|
|
7917
7949
|
if (h)
|
|
7918
7950
|
return `
|
|
7919
7951
|
|
|
@@ -7947,8 +7979,8 @@ Check the top-level render call using <` + E + ">.");
|
|
|
7947
7979
|
if (gr[E])
|
|
7948
7980
|
return;
|
|
7949
7981
|
gr[E] = !0;
|
|
7950
|
-
var
|
|
7951
|
-
h && h._owner && h._owner !== sn.current && (
|
|
7982
|
+
var M = "";
|
|
7983
|
+
h && h._owner && h._owner !== sn.current && (M = " It was passed a child from " + q(h._owner.type) + "."), Qe(h), w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', E, M), Qe(null);
|
|
7952
7984
|
}
|
|
7953
7985
|
}
|
|
7954
7986
|
function mr(h, T) {
|
|
@@ -7957,16 +7989,16 @@ Check the top-level render call using <` + E + ">.");
|
|
|
7957
7989
|
return;
|
|
7958
7990
|
if (rn(h))
|
|
7959
7991
|
for (var E = 0; E < h.length; E++) {
|
|
7960
|
-
var
|
|
7961
|
-
an(
|
|
7992
|
+
var M = h[E];
|
|
7993
|
+
an(M) && _r(M, T);
|
|
7962
7994
|
}
|
|
7963
7995
|
else if (an(h))
|
|
7964
7996
|
h._store && (h._store.validated = !0);
|
|
7965
7997
|
else if (h) {
|
|
7966
|
-
var
|
|
7967
|
-
if (typeof
|
|
7968
|
-
for (var
|
|
7969
|
-
an(
|
|
7998
|
+
var z = S(h);
|
|
7999
|
+
if (typeof z == "function" && z !== h.entries)
|
|
8000
|
+
for (var Q = z.call(h), L; !(L = Q.next()).done; )
|
|
8001
|
+
an(L.value) && _r(L.value, T);
|
|
7970
8002
|
}
|
|
7971
8003
|
}
|
|
7972
8004
|
}
|
|
@@ -7985,63 +8017,63 @@ Check the top-level render call using <` + E + ">.");
|
|
|
7985
8017
|
else
|
|
7986
8018
|
return;
|
|
7987
8019
|
if (E) {
|
|
7988
|
-
var
|
|
7989
|
-
ui(E, h.props, "prop",
|
|
8020
|
+
var M = q(T);
|
|
8021
|
+
ui(E, h.props, "prop", M, h);
|
|
7990
8022
|
} else if (T.PropTypes !== void 0 && !on) {
|
|
7991
8023
|
on = !0;
|
|
7992
|
-
var
|
|
7993
|
-
|
|
8024
|
+
var z = q(T);
|
|
8025
|
+
w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", z || "Unknown");
|
|
7994
8026
|
}
|
|
7995
|
-
typeof T.getDefaultProps == "function" && !T.getDefaultProps.isReactClassApproved &&
|
|
8027
|
+
typeof T.getDefaultProps == "function" && !T.getDefaultProps.isReactClassApproved && w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
7996
8028
|
}
|
|
7997
8029
|
}
|
|
7998
8030
|
function Ei(h) {
|
|
7999
8031
|
{
|
|
8000
8032
|
for (var T = Object.keys(h.props), E = 0; E < T.length; E++) {
|
|
8001
|
-
var
|
|
8002
|
-
if (
|
|
8003
|
-
Qe(h),
|
|
8033
|
+
var M = T[E];
|
|
8034
|
+
if (M !== "children" && M !== "key") {
|
|
8035
|
+
Qe(h), w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", M), Qe(null);
|
|
8004
8036
|
break;
|
|
8005
8037
|
}
|
|
8006
8038
|
}
|
|
8007
|
-
h.ref !== null && (Qe(h),
|
|
8039
|
+
h.ref !== null && (Qe(h), w("Invalid attribute `ref` supplied to `React.Fragment`."), Qe(null));
|
|
8008
8040
|
}
|
|
8009
8041
|
}
|
|
8010
8042
|
var wr = {};
|
|
8011
|
-
function Tr(h, T, E,
|
|
8043
|
+
function Tr(h, T, E, M, z, Q) {
|
|
8012
8044
|
{
|
|
8013
|
-
var
|
|
8014
|
-
if (!
|
|
8045
|
+
var L = G(h);
|
|
8046
|
+
if (!L) {
|
|
8015
8047
|
var $ = "";
|
|
8016
8048
|
(h === void 0 || typeof h == "object" && h !== null && Object.keys(h).length === 0) && ($ += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
8017
|
-
var
|
|
8018
|
-
|
|
8019
|
-
var
|
|
8020
|
-
h === null ?
|
|
8049
|
+
var fe = Ti();
|
|
8050
|
+
fe ? $ += fe : $ += br();
|
|
8051
|
+
var ee;
|
|
8052
|
+
h === null ? ee = "null" : rn(h) ? ee = "array" : h !== void 0 && h.$$typeof === t ? (ee = "<" + (q(h.type) || "Unknown") + " />", $ = " Did you accidentally export a JSX literal instead of a component?") : ee = typeof h, w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", ee, $);
|
|
8021
8053
|
}
|
|
8022
|
-
var
|
|
8023
|
-
if (
|
|
8024
|
-
return
|
|
8025
|
-
if (
|
|
8026
|
-
var
|
|
8027
|
-
if (
|
|
8028
|
-
if (
|
|
8029
|
-
if (rn(
|
|
8030
|
-
for (var Be = 0; Be <
|
|
8031
|
-
mr(
|
|
8032
|
-
Object.freeze && Object.freeze(
|
|
8054
|
+
var re = wi(h, T, E, z, Q);
|
|
8055
|
+
if (re == null)
|
|
8056
|
+
return re;
|
|
8057
|
+
if (L) {
|
|
8058
|
+
var Te = T.children;
|
|
8059
|
+
if (Te !== void 0)
|
|
8060
|
+
if (M)
|
|
8061
|
+
if (rn(Te)) {
|
|
8062
|
+
for (var Be = 0; Be < Te.length; Be++)
|
|
8063
|
+
mr(Te[Be], h);
|
|
8064
|
+
Object.freeze && Object.freeze(Te);
|
|
8033
8065
|
} else
|
|
8034
|
-
|
|
8066
|
+
w("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
8035
8067
|
else
|
|
8036
|
-
mr(
|
|
8068
|
+
mr(Te, h);
|
|
8037
8069
|
}
|
|
8038
8070
|
if (ct.call(T, "key")) {
|
|
8039
|
-
var De =
|
|
8071
|
+
var De = q(h), pe = Object.keys(T).filter(function(Pi) {
|
|
8040
8072
|
return Pi !== "key";
|
|
8041
|
-
}), cn =
|
|
8073
|
+
}), cn = pe.length > 0 ? "{key: someKey, " + pe.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
8042
8074
|
if (!wr[De + cn]) {
|
|
8043
|
-
var Ii =
|
|
8044
|
-
|
|
8075
|
+
var Ii = pe.length > 0 ? "{" + pe.join(": ..., ") + ": ...}" : "{}";
|
|
8076
|
+
w(`A props object containing a "key" prop is being spread into JSX:
|
|
8045
8077
|
let props = %s;
|
|
8046
8078
|
<%s {...props} />
|
|
8047
8079
|
React keys must be passed directly to JSX without using spread:
|
|
@@ -8049,7 +8081,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
8049
8081
|
<%s key={someKey} {...props} />`, cn, De, Ii, De), wr[De + cn] = !0;
|
|
8050
8082
|
}
|
|
8051
8083
|
}
|
|
8052
|
-
return h === s ? Ei(
|
|
8084
|
+
return h === s ? Ei(re) : vi(re), re;
|
|
8053
8085
|
}
|
|
8054
8086
|
}
|
|
8055
8087
|
function Oi(h, T, E) {
|
|
@@ -8064,7 +8096,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
8064
8096
|
}
|
|
8065
8097
|
var $u = {};
|
|
8066
8098
|
$u.NODE_ENV === "production" ? Un.exports = ju() : Un.exports = xu();
|
|
8067
|
-
var
|
|
8099
|
+
var ce = Un.exports;
|
|
8068
8100
|
const Du = {
|
|
8069
8101
|
isLoading: !0,
|
|
8070
8102
|
data: void 0,
|
|
@@ -8082,7 +8114,7 @@ function is(n) {
|
|
|
8082
8114
|
}
|
|
8083
8115
|
function Uu(n, e, t, r) {
|
|
8084
8116
|
e && t && "ruleParams" in t && (e = { $$ruleParams: t.ruleParams, ...e });
|
|
8085
|
-
const s = e ? ri(e) : null, i =
|
|
8117
|
+
const s = e ? ri(e) : null, i = se(s), o = $e(is(n._reactor.getPreviousResult(s))), a = $e(Du), c = Me(
|
|
8086
8118
|
(l) => (o.current = is(n._reactor.getPreviousResult(s)), l(), s ? n.subscribeQuery(s, (d) => {
|
|
8087
8119
|
o.current = {
|
|
8088
8120
|
isLoading: !d,
|
|
@@ -8108,7 +8140,7 @@ const Lu = {
|
|
|
8108
8140
|
canLoadNextPage: !1
|
|
8109
8141
|
};
|
|
8110
8142
|
function Fu({ core: n, query: e, opts: t }) {
|
|
8111
|
-
const r = $e(null), s =
|
|
8143
|
+
const r = $e(null), s = se(e), i = se(t), o = Su(n, e, t), a = $e({
|
|
8112
8144
|
...o,
|
|
8113
8145
|
isLoading: !o.data && !o.error
|
|
8114
8146
|
}), c = Me((f) => {
|
|
@@ -8459,7 +8491,7 @@ class Nt {
|
|
|
8459
8491
|
p(this, "useUser", () => {
|
|
8460
8492
|
const { user: e } = this.useAuth();
|
|
8461
8493
|
if (!e)
|
|
8462
|
-
throw new
|
|
8494
|
+
throw new ue("useUser must be used within an auth-protected route");
|
|
8463
8495
|
return e;
|
|
8464
8496
|
});
|
|
8465
8497
|
/**
|
|
@@ -8549,7 +8581,7 @@ class Nt {
|
|
|
8549
8581
|
*/
|
|
8550
8582
|
p(this, "SignedIn", ({ children: e }) => {
|
|
8551
8583
|
const t = this.useAuth();
|
|
8552
|
-
return t.isLoading || t.error || !t.user ? null :
|
|
8584
|
+
return t.isLoading || t.error || !t.user ? null : ce.jsx(ce.Fragment, { children: e });
|
|
8553
8585
|
});
|
|
8554
8586
|
/**
|
|
8555
8587
|
* Only render children if the user is signed out.
|
|
@@ -8563,7 +8595,7 @@ class Nt {
|
|
|
8563
8595
|
*/
|
|
8564
8596
|
p(this, "SignedOut", ({ children: e }) => {
|
|
8565
8597
|
const t = this.useAuth();
|
|
8566
|
-
return t.isLoading || t.error || t.user ? null :
|
|
8598
|
+
return t.isLoading || t.error || t.user ? null : ce.jsx(ce.Fragment, { children: e });
|
|
8567
8599
|
});
|
|
8568
8600
|
this.core = Mu(
|
|
8569
8601
|
e,
|
|
@@ -8627,9 +8659,9 @@ function Hu(n) {
|
|
|
8627
8659
|
const { onEvent: e = _n, onError: t = _n, onRetry: r = _n, onComment: s } = n;
|
|
8628
8660
|
let i = "", o = !0, a, c = "", u = "";
|
|
8629
8661
|
function l(g) {
|
|
8630
|
-
const
|
|
8631
|
-
for (const
|
|
8632
|
-
f(
|
|
8662
|
+
const m = o ? g.replace(/^\xEF\xBB\xBF/, "") : g, [S, _] = Ju(`${i}${m}`);
|
|
8663
|
+
for (const w of S)
|
|
8664
|
+
f(w);
|
|
8633
8665
|
i = _, o = !1;
|
|
8634
8666
|
}
|
|
8635
8667
|
function f(g) {
|
|
@@ -8641,31 +8673,31 @@ function Hu(n) {
|
|
|
8641
8673
|
s && s(g.slice(g.startsWith(": ") ? 2 : 1));
|
|
8642
8674
|
return;
|
|
8643
8675
|
}
|
|
8644
|
-
const
|
|
8645
|
-
if (
|
|
8646
|
-
const S = g.slice(0,
|
|
8647
|
-
d(S,
|
|
8676
|
+
const m = g.indexOf(":");
|
|
8677
|
+
if (m !== -1) {
|
|
8678
|
+
const S = g.slice(0, m), _ = g[m + 1] === " " ? 2 : 1, w = g.slice(m + _);
|
|
8679
|
+
d(S, w, g);
|
|
8648
8680
|
return;
|
|
8649
8681
|
}
|
|
8650
8682
|
d(g, "", g);
|
|
8651
8683
|
}
|
|
8652
|
-
function d(g,
|
|
8684
|
+
function d(g, m, S) {
|
|
8653
8685
|
switch (g) {
|
|
8654
8686
|
case "event":
|
|
8655
|
-
u =
|
|
8687
|
+
u = m;
|
|
8656
8688
|
break;
|
|
8657
8689
|
case "data":
|
|
8658
|
-
c = `${c}${
|
|
8690
|
+
c = `${c}${m}
|
|
8659
8691
|
`;
|
|
8660
8692
|
break;
|
|
8661
8693
|
case "id":
|
|
8662
|
-
a =
|
|
8694
|
+
a = m.includes("\0") ? void 0 : m;
|
|
8663
8695
|
break;
|
|
8664
8696
|
case "retry":
|
|
8665
|
-
/^\d+$/.test(
|
|
8666
|
-
new os(`Invalid \`retry\` value: "${
|
|
8697
|
+
/^\d+$/.test(m) ? r(parseInt(m, 10)) : t(
|
|
8698
|
+
new os(`Invalid \`retry\` value: "${m}"`, {
|
|
8667
8699
|
type: "invalid-retry",
|
|
8668
|
-
value:
|
|
8700
|
+
value: m,
|
|
8669
8701
|
line: S
|
|
8670
8702
|
})
|
|
8671
8703
|
);
|
|
@@ -8674,7 +8706,7 @@ function Hu(n) {
|
|
|
8674
8706
|
t(
|
|
8675
8707
|
new os(
|
|
8676
8708
|
`Unknown field "${g.length > 20 ? `${g.slice(0, 20)}…` : g}"`,
|
|
8677
|
-
{ type: "unknown-field", field: g, value:
|
|
8709
|
+
{ type: "unknown-field", field: g, value: m, line: S }
|
|
8678
8710
|
)
|
|
8679
8711
|
);
|
|
8680
8712
|
break;
|
|
@@ -8774,69 +8806,69 @@ function cs(n) {
|
|
|
8774
8806
|
}
|
|
8775
8807
|
var si = (n) => {
|
|
8776
8808
|
throw TypeError(n);
|
|
8777
|
-
}, or = (n, e, t) => e.has(n) || si("Cannot " + t),
|
|
8809
|
+
}, or = (n, e, t) => e.has(n) || si("Cannot " + t), x = (n, e, t) => (or(n, e, "read from private field"), t ? t.call(n) : e.get(n)), oe = (n, e, t) => e.has(n) ? si("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), Y = (n, e, t, r) => (or(n, e, "write to private field"), e.set(n, t), t), Pe = (n, e, t) => (or(n, e, "access private method"), t), ye, Fe, Ye, Kt, Ht, Tt, tt, St, xe, Ze, rt, Xe, gt, Ee, Fn, Nn, Kn, us, Wn, qn, _t, zn, Vn;
|
|
8778
8810
|
class Wt extends EventTarget {
|
|
8779
8811
|
constructor(e, t) {
|
|
8780
8812
|
var r, s;
|
|
8781
|
-
super(),
|
|
8813
|
+
super(), oe(this, Ee), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, oe(this, ye), oe(this, Fe), oe(this, Ye), oe(this, Kt), oe(this, Ht), oe(this, Tt), oe(this, tt), oe(this, St, null), oe(this, xe), oe(this, Ze), oe(this, rt, null), oe(this, Xe, null), oe(this, gt, null), oe(this, Nn, async (i) => {
|
|
8782
8814
|
var o;
|
|
8783
|
-
|
|
8815
|
+
x(this, Ze).reset();
|
|
8784
8816
|
const { body: a, redirected: c, status: u, headers: l } = i;
|
|
8785
8817
|
if (u === 204) {
|
|
8786
|
-
Pe(this,
|
|
8818
|
+
Pe(this, Ee, _t).call(this, "Server sent HTTP 204, not reconnecting", 204), this.close();
|
|
8787
8819
|
return;
|
|
8788
8820
|
}
|
|
8789
|
-
if (c ?
|
|
8790
|
-
Pe(this,
|
|
8821
|
+
if (c ? Y(this, Ye, new URL(i.url)) : Y(this, Ye, void 0), u !== 200) {
|
|
8822
|
+
Pe(this, Ee, _t).call(this, `Non-200 status code (${u})`, u);
|
|
8791
8823
|
return;
|
|
8792
8824
|
}
|
|
8793
8825
|
if (!(l.get("content-type") || "").startsWith("text/event-stream")) {
|
|
8794
|
-
Pe(this,
|
|
8826
|
+
Pe(this, Ee, _t).call(this, 'Invalid content type, expected "text/event-stream"', u);
|
|
8795
8827
|
return;
|
|
8796
8828
|
}
|
|
8797
|
-
if (
|
|
8829
|
+
if (x(this, ye) === this.CLOSED)
|
|
8798
8830
|
return;
|
|
8799
|
-
|
|
8831
|
+
Y(this, ye, this.OPEN);
|
|
8800
8832
|
const f = new Event("open");
|
|
8801
|
-
if ((o =
|
|
8802
|
-
Pe(this,
|
|
8833
|
+
if ((o = x(this, gt)) == null || o.call(this, f), this.dispatchEvent(f), typeof a != "object" || !a || !("getReader" in a)) {
|
|
8834
|
+
Pe(this, Ee, _t).call(this, "Invalid response body, expected a web ReadableStream", u), this.close();
|
|
8803
8835
|
return;
|
|
8804
8836
|
}
|
|
8805
8837
|
const d = new TextDecoder(), y = a.getReader();
|
|
8806
8838
|
let b = !0;
|
|
8807
8839
|
do {
|
|
8808
|
-
const { done: g, value:
|
|
8809
|
-
|
|
8840
|
+
const { done: g, value: m } = await y.read();
|
|
8841
|
+
m && x(this, Ze).feed(d.decode(m, { stream: !g })), g && (b = !1, x(this, Ze).reset(), Pe(this, Ee, zn).call(this));
|
|
8810
8842
|
} while (b);
|
|
8811
|
-
}),
|
|
8812
|
-
|
|
8813
|
-
}),
|
|
8814
|
-
typeof i.id == "string" &&
|
|
8843
|
+
}), oe(this, Kn, (i) => {
|
|
8844
|
+
Y(this, xe, void 0), !(i.name === "AbortError" || i.type === "aborted") && Pe(this, Ee, zn).call(this, Ln(i));
|
|
8845
|
+
}), oe(this, Wn, (i) => {
|
|
8846
|
+
typeof i.id == "string" && Y(this, St, i.id);
|
|
8815
8847
|
const o = new MessageEvent(i.event || "message", {
|
|
8816
8848
|
data: i.data,
|
|
8817
|
-
origin:
|
|
8849
|
+
origin: x(this, Ye) ? x(this, Ye).origin : x(this, Fe).origin,
|
|
8818
8850
|
lastEventId: i.id || ""
|
|
8819
8851
|
});
|
|
8820
|
-
|
|
8821
|
-
}),
|
|
8822
|
-
|
|
8823
|
-
}),
|
|
8824
|
-
|
|
8852
|
+
x(this, Xe) && (!i.event || i.event === "message") && x(this, Xe).call(this, o), this.dispatchEvent(o);
|
|
8853
|
+
}), oe(this, qn, (i) => {
|
|
8854
|
+
Y(this, Tt, i);
|
|
8855
|
+
}), oe(this, Vn, () => {
|
|
8856
|
+
Y(this, tt, void 0), x(this, ye) === this.CONNECTING && Pe(this, Ee, Fn).call(this);
|
|
8825
8857
|
});
|
|
8826
8858
|
try {
|
|
8827
8859
|
if (e instanceof URL)
|
|
8828
|
-
|
|
8860
|
+
Y(this, Fe, e);
|
|
8829
8861
|
else if (typeof e == "string")
|
|
8830
|
-
|
|
8862
|
+
Y(this, Fe, new URL(e, Zu()));
|
|
8831
8863
|
else
|
|
8832
8864
|
throw new Error("Invalid URL");
|
|
8833
8865
|
} catch {
|
|
8834
8866
|
throw Yu("An invalid or illegal string was specified");
|
|
8835
8867
|
}
|
|
8836
|
-
|
|
8837
|
-
onEvent:
|
|
8838
|
-
onRetry:
|
|
8839
|
-
})),
|
|
8868
|
+
Y(this, Ze, Hu({
|
|
8869
|
+
onEvent: x(this, Wn),
|
|
8870
|
+
onRetry: x(this, qn)
|
|
8871
|
+
})), Y(this, ye, this.CONNECTING), Y(this, Tt, 3e3), Y(this, Ht, (r = t == null ? void 0 : t.fetch) != null ? r : globalThis.fetch), Y(this, Kt, (s = t == null ? void 0 : t.withCredentials) != null ? s : !1), Pe(this, Ee, Fn).call(this);
|
|
8840
8872
|
}
|
|
8841
8873
|
/**
|
|
8842
8874
|
* Returns the state of this EventSource object's connection. It can have the values described below.
|
|
@@ -8849,7 +8881,7 @@ class Wt extends EventTarget {
|
|
|
8849
8881
|
* @public
|
|
8850
8882
|
*/
|
|
8851
8883
|
get readyState() {
|
|
8852
|
-
return
|
|
8884
|
+
return x(this, ye);
|
|
8853
8885
|
}
|
|
8854
8886
|
/**
|
|
8855
8887
|
* Returns the URL providing the event stream.
|
|
@@ -8859,7 +8891,7 @@ class Wt extends EventTarget {
|
|
|
8859
8891
|
* @public
|
|
8860
8892
|
*/
|
|
8861
8893
|
get url() {
|
|
8862
|
-
return
|
|
8894
|
+
return x(this, Fe).href;
|
|
8863
8895
|
}
|
|
8864
8896
|
/**
|
|
8865
8897
|
* Returns true if the credentials mode for connection requests to the URL providing the event stream is set to "include", and false otherwise.
|
|
@@ -8867,28 +8899,28 @@ class Wt extends EventTarget {
|
|
|
8867
8899
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/withCredentials)
|
|
8868
8900
|
*/
|
|
8869
8901
|
get withCredentials() {
|
|
8870
|
-
return
|
|
8902
|
+
return x(this, Kt);
|
|
8871
8903
|
}
|
|
8872
8904
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */
|
|
8873
8905
|
get onerror() {
|
|
8874
|
-
return
|
|
8906
|
+
return x(this, rt);
|
|
8875
8907
|
}
|
|
8876
8908
|
set onerror(e) {
|
|
8877
|
-
|
|
8909
|
+
Y(this, rt, e);
|
|
8878
8910
|
}
|
|
8879
8911
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */
|
|
8880
8912
|
get onmessage() {
|
|
8881
|
-
return
|
|
8913
|
+
return x(this, Xe);
|
|
8882
8914
|
}
|
|
8883
8915
|
set onmessage(e) {
|
|
8884
|
-
|
|
8916
|
+
Y(this, Xe, e);
|
|
8885
8917
|
}
|
|
8886
8918
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */
|
|
8887
8919
|
get onopen() {
|
|
8888
|
-
return
|
|
8920
|
+
return x(this, gt);
|
|
8889
8921
|
}
|
|
8890
8922
|
set onopen(e) {
|
|
8891
|
-
|
|
8923
|
+
Y(this, gt, e);
|
|
8892
8924
|
}
|
|
8893
8925
|
addEventListener(e, t, r) {
|
|
8894
8926
|
const s = t;
|
|
@@ -8906,16 +8938,16 @@ class Wt extends EventTarget {
|
|
|
8906
8938
|
* @public
|
|
8907
8939
|
*/
|
|
8908
8940
|
close() {
|
|
8909
|
-
|
|
8941
|
+
x(this, tt) && clearTimeout(x(this, tt)), x(this, ye) !== this.CLOSED && (x(this, xe) && x(this, xe).abort(), Y(this, ye, this.CLOSED), Y(this, xe, void 0));
|
|
8910
8942
|
}
|
|
8911
8943
|
}
|
|
8912
|
-
|
|
8944
|
+
ye = /* @__PURE__ */ new WeakMap(), Fe = /* @__PURE__ */ new WeakMap(), Ye = /* @__PURE__ */ new WeakMap(), Kt = /* @__PURE__ */ new WeakMap(), Ht = /* @__PURE__ */ new WeakMap(), Tt = /* @__PURE__ */ new WeakMap(), tt = /* @__PURE__ */ new WeakMap(), St = /* @__PURE__ */ new WeakMap(), xe = /* @__PURE__ */ new WeakMap(), Ze = /* @__PURE__ */ new WeakMap(), rt = /* @__PURE__ */ new WeakMap(), Xe = /* @__PURE__ */ new WeakMap(), gt = /* @__PURE__ */ new WeakMap(), Ee = /* @__PURE__ */ new WeakSet(), /**
|
|
8913
8945
|
* Connect to the given URL and start receiving events
|
|
8914
8946
|
*
|
|
8915
8947
|
* @internal
|
|
8916
8948
|
*/
|
|
8917
8949
|
Fn = function() {
|
|
8918
|
-
|
|
8950
|
+
Y(this, ye, this.CONNECTING), Y(this, xe, new AbortController()), x(this, Ht)(x(this, Fe), Pe(this, Ee, us).call(this)).then(x(this, Nn)).catch(x(this, Kn));
|
|
8919
8951
|
}, Nn = /* @__PURE__ */ new WeakMap(), Kn = /* @__PURE__ */ new WeakMap(), /**
|
|
8920
8952
|
* Get request options for the `fetch()` request
|
|
8921
8953
|
*
|
|
@@ -8929,9 +8961,9 @@ us = function() {
|
|
|
8929
8961
|
// [spec] …will have their mode set to "cors"…
|
|
8930
8962
|
mode: "cors",
|
|
8931
8963
|
redirect: "follow",
|
|
8932
|
-
headers: { Accept: "text/event-stream", ...
|
|
8964
|
+
headers: { Accept: "text/event-stream", ...x(this, St) ? { "Last-Event-ID": x(this, St) } : void 0 },
|
|
8933
8965
|
cache: "no-store",
|
|
8934
|
-
signal: (n =
|
|
8966
|
+
signal: (n = x(this, xe)) == null ? void 0 : n.signal
|
|
8935
8967
|
};
|
|
8936
8968
|
return "window" in globalThis && (e.credentials = this.withCredentials ? "include" : "same-origin"), e;
|
|
8937
8969
|
}, Wn = /* @__PURE__ */ new WeakMap(), qn = /* @__PURE__ */ new WeakMap(), /**
|
|
@@ -8943,9 +8975,9 @@ us = function() {
|
|
|
8943
8975
|
*/
|
|
8944
8976
|
_t = function(n, e) {
|
|
8945
8977
|
var t;
|
|
8946
|
-
|
|
8978
|
+
x(this, ye) !== this.CLOSED && Y(this, ye, this.CLOSED);
|
|
8947
8979
|
const r = new as("error", { code: e, message: n });
|
|
8948
|
-
(t =
|
|
8980
|
+
(t = x(this, rt)) == null || t.call(this, r), this.dispatchEvent(r);
|
|
8949
8981
|
}, /**
|
|
8950
8982
|
* Schedules a reconnection attempt against the EventSource endpoint.
|
|
8951
8983
|
*
|
|
@@ -8955,11 +8987,11 @@ _t = function(n, e) {
|
|
|
8955
8987
|
*/
|
|
8956
8988
|
zn = function(n, e) {
|
|
8957
8989
|
var t;
|
|
8958
|
-
if (
|
|
8990
|
+
if (x(this, ye) === this.CLOSED)
|
|
8959
8991
|
return;
|
|
8960
|
-
|
|
8992
|
+
Y(this, ye, this.CONNECTING);
|
|
8961
8993
|
const r = new as("error", { code: e, message: n });
|
|
8962
|
-
(t =
|
|
8994
|
+
(t = x(this, rt)) == null || t.call(this, r), this.dispatchEvent(r), Y(this, tt, setTimeout(x(this, Vn), x(this, Tt)));
|
|
8963
8995
|
}, Vn = /* @__PURE__ */ new WeakMap(), /**
|
|
8964
8996
|
* ReadyState representing an EventSource currently trying to connect
|
|
8965
8997
|
*
|
|
@@ -9008,36 +9040,36 @@ function ll({
|
|
|
9008
9040
|
const l = e || `cursors-space-default--${String(t.type)}-${t.id}`, f = t.usePresence({
|
|
9009
9041
|
keys: [l]
|
|
9010
9042
|
}), d = t._core._reactor.getPresence(t.type, t.id);
|
|
9011
|
-
function y(_,
|
|
9012
|
-
const
|
|
9043
|
+
function y(_, w) {
|
|
9044
|
+
const C = w.clientX, v = w.clientY, U = (C - _.left) / _.width * 100, I = (v - _.top) / _.height * 100;
|
|
9013
9045
|
f.publishPresence({
|
|
9014
9046
|
[l]: {
|
|
9015
|
-
x:
|
|
9047
|
+
x: C,
|
|
9016
9048
|
y: v,
|
|
9017
|
-
xPercent:
|
|
9018
|
-
yPercent:
|
|
9049
|
+
xPercent: U,
|
|
9050
|
+
yPercent: I,
|
|
9019
9051
|
color: i
|
|
9020
9052
|
}
|
|
9021
9053
|
});
|
|
9022
9054
|
}
|
|
9023
9055
|
function b(_) {
|
|
9024
9056
|
c || _.stopPropagation();
|
|
9025
|
-
const
|
|
9026
|
-
y(
|
|
9057
|
+
const w = _.currentTarget.getBoundingClientRect();
|
|
9058
|
+
y(w, _);
|
|
9027
9059
|
}
|
|
9028
9060
|
function g(_) {
|
|
9029
9061
|
f.publishPresence({
|
|
9030
9062
|
[l]: void 0
|
|
9031
9063
|
});
|
|
9032
9064
|
}
|
|
9033
|
-
function
|
|
9065
|
+
function m(_) {
|
|
9034
9066
|
if (_.touches.length !== 1)
|
|
9035
9067
|
return;
|
|
9036
|
-
const
|
|
9037
|
-
if (
|
|
9068
|
+
const w = _.touches[0];
|
|
9069
|
+
if (w.target instanceof Element) {
|
|
9038
9070
|
c || _.stopPropagation();
|
|
9039
|
-
const
|
|
9040
|
-
y(
|
|
9071
|
+
const C = w.target.getBoundingClientRect();
|
|
9072
|
+
y(C, w);
|
|
9041
9073
|
}
|
|
9042
9074
|
}
|
|
9043
9075
|
function S(_) {
|
|
@@ -9050,7 +9082,7 @@ function ll({
|
|
|
9050
9082
|
{
|
|
9051
9083
|
onMouseMove: b,
|
|
9052
9084
|
onMouseOut: g,
|
|
9053
|
-
onTouchMove:
|
|
9085
|
+
onTouchMove: m,
|
|
9054
9086
|
onTouchEnd: S,
|
|
9055
9087
|
className: r,
|
|
9056
9088
|
style: {
|
|
@@ -9060,7 +9092,7 @@ function ll({
|
|
|
9060
9092
|
},
|
|
9061
9093
|
[
|
|
9062
9094
|
o,
|
|
9063
|
-
/* @__PURE__ */
|
|
9095
|
+
/* @__PURE__ */ ce.jsx(
|
|
9064
9096
|
"div",
|
|
9065
9097
|
{
|
|
9066
9098
|
style: {
|
|
@@ -9068,21 +9100,21 @@ function ll({
|
|
|
9068
9100
|
...tl,
|
|
9069
9101
|
zIndex: u !== void 0 ? u : nl
|
|
9070
9102
|
},
|
|
9071
|
-
children: Object.entries(f.peers).map(([_,
|
|
9072
|
-
const
|
|
9073
|
-
return
|
|
9103
|
+
children: Object.entries(f.peers).map(([_, w]) => {
|
|
9104
|
+
const C = w[l];
|
|
9105
|
+
return C ? /* @__PURE__ */ ce.jsx(
|
|
9074
9106
|
"div",
|
|
9075
9107
|
{
|
|
9076
9108
|
style: {
|
|
9077
9109
|
...ls,
|
|
9078
|
-
transform: `translate(${
|
|
9110
|
+
transform: `translate(${C.xPercent}%, ${C.yPercent}%)`,
|
|
9079
9111
|
transformOrigin: "0 0",
|
|
9080
9112
|
transition: "transform 100ms"
|
|
9081
9113
|
},
|
|
9082
9114
|
children: a ? a({
|
|
9083
|
-
color:
|
|
9115
|
+
color: C.color,
|
|
9084
9116
|
presence: d == null ? void 0 : d.peers[_]
|
|
9085
|
-
}) : /* @__PURE__ */
|
|
9117
|
+
}) : /* @__PURE__ */ ce.jsx(el, { ...C })
|
|
9086
9118
|
},
|
|
9087
9119
|
_
|
|
9088
9120
|
) : null;
|
|
@@ -9095,7 +9127,7 @@ function ll({
|
|
|
9095
9127
|
}
|
|
9096
9128
|
function el({ color: n }) {
|
|
9097
9129
|
const t = n || "black";
|
|
9098
|
-
return /* @__PURE__ */
|
|
9130
|
+
return /* @__PURE__ */ ce.jsxs(
|
|
9099
9131
|
"svg",
|
|
9100
9132
|
{
|
|
9101
9133
|
style: { height: 35, width: 35 },
|
|
@@ -9103,36 +9135,36 @@ function el({ color: n }) {
|
|
|
9103
9135
|
fill: "none",
|
|
9104
9136
|
xmlns: "http://www.w3.org/2000/svg",
|
|
9105
9137
|
children: [
|
|
9106
|
-
/* @__PURE__ */
|
|
9138
|
+
/* @__PURE__ */ ce.jsxs(
|
|
9107
9139
|
"g",
|
|
9108
9140
|
{
|
|
9109
9141
|
fill: "rgba(0,0,0,.2)",
|
|
9110
9142
|
transform: "matrix(1, 0, 0, 1, -11.999999046325684, -8.406899452209473)",
|
|
9111
9143
|
children: [
|
|
9112
|
-
/* @__PURE__ */
|
|
9113
|
-
/* @__PURE__ */
|
|
9144
|
+
/* @__PURE__ */ ce.jsx("path", { d: "m12 24.4219v-16.015l11.591 11.619h-6.781l-.411.124z" }),
|
|
9145
|
+
/* @__PURE__ */ ce.jsx("path", { d: "m21.0845 25.0962-3.605 1.535-4.682-11.089 3.686-1.553z" })
|
|
9114
9146
|
]
|
|
9115
9147
|
}
|
|
9116
9148
|
),
|
|
9117
|
-
/* @__PURE__ */
|
|
9149
|
+
/* @__PURE__ */ ce.jsxs(
|
|
9118
9150
|
"g",
|
|
9119
9151
|
{
|
|
9120
9152
|
fill: "white",
|
|
9121
9153
|
transform: "matrix(1, 0, 0, 1, -11.999999046325684, -8.406899452209473)",
|
|
9122
9154
|
children: [
|
|
9123
|
-
/* @__PURE__ */
|
|
9124
|
-
/* @__PURE__ */
|
|
9155
|
+
/* @__PURE__ */ ce.jsx("path", { d: "m12 24.4219v-16.015l11.591 11.619h-6.781l-.411.124z" }),
|
|
9156
|
+
/* @__PURE__ */ ce.jsx("path", { d: "m21.0845 25.0962-3.605 1.535-4.682-11.089 3.686-1.553z" })
|
|
9125
9157
|
]
|
|
9126
9158
|
}
|
|
9127
9159
|
),
|
|
9128
|
-
/* @__PURE__ */
|
|
9160
|
+
/* @__PURE__ */ ce.jsxs(
|
|
9129
9161
|
"g",
|
|
9130
9162
|
{
|
|
9131
9163
|
fill: t,
|
|
9132
9164
|
transform: "matrix(1, 0, 0, 1, -11.999999046325684, -8.406899452209473)",
|
|
9133
9165
|
children: [
|
|
9134
|
-
/* @__PURE__ */
|
|
9135
|
-
/* @__PURE__ */
|
|
9166
|
+
/* @__PURE__ */ ce.jsx("path", { d: "m19.751 24.4155-1.844.774-3.1-7.374 1.841-.775z" }),
|
|
9167
|
+
/* @__PURE__ */ ce.jsx("path", { d: "m13 10.814v11.188l2.969-2.866.428-.139h4.768z" })
|
|
9136
9168
|
]
|
|
9137
9169
|
}
|
|
9138
9170
|
)
|
|
@@ -9160,7 +9192,7 @@ export {
|
|
|
9160
9192
|
Ue as SyncTableCallbackEventType,
|
|
9161
9193
|
cl as createInstantRouteHandler,
|
|
9162
9194
|
al as i,
|
|
9163
|
-
|
|
9195
|
+
Z as id,
|
|
9164
9196
|
Xu as init,
|
|
9165
9197
|
ul as init_experimental,
|
|
9166
9198
|
Ea as lookup,
|