@instantdb/react 0.22.149 → 0.22.150-branch-stream-fixes.22600975156.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/standalone/index.js +788 -788
- package/dist/standalone/index.umd.cjs +13 -13
- package/package.json +4 -4
package/dist/standalone/index.js
CHANGED
|
@@ -40,11 +40,11 @@ function H(n) {
|
|
|
40
40
|
}
|
|
41
41
|
return H(String(n));
|
|
42
42
|
}
|
|
43
|
-
const
|
|
43
|
+
const q = {
|
|
44
44
|
Remove: "remove",
|
|
45
45
|
Replace: "replace",
|
|
46
46
|
Add: "add"
|
|
47
|
-
}, is = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), Si = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"),
|
|
47
|
+
}, is = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), Si = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), Mt = Symbol.iterator, he = {
|
|
48
48
|
mutable: "mutable",
|
|
49
49
|
immutable: "immutable"
|
|
50
50
|
}, Nn = {};
|
|
@@ -68,7 +68,7 @@ function Wn(n) {
|
|
|
68
68
|
function Kn(n) {
|
|
69
69
|
return Object.getPrototypeOf(n) === Map.prototype;
|
|
70
70
|
}
|
|
71
|
-
function
|
|
71
|
+
function de(n) {
|
|
72
72
|
var e;
|
|
73
73
|
return (e = n.copy) !== null && e !== void 0 ? e : n.original;
|
|
74
74
|
}
|
|
@@ -83,11 +83,11 @@ function qn(n) {
|
|
|
83
83
|
const t = R(n);
|
|
84
84
|
return t ? (e = t.copy) !== null && e !== void 0 ? e : t.original : n;
|
|
85
85
|
}
|
|
86
|
-
function
|
|
86
|
+
function Te(n, e) {
|
|
87
87
|
if (!n || typeof n != "object")
|
|
88
88
|
return !1;
|
|
89
89
|
let t;
|
|
90
|
-
return Object.getPrototypeOf(n) === Object.prototype || Array.isArray(n) || n instanceof Map || n instanceof Set || !!(e != null && e.mark) && ((t = e.mark(n,
|
|
90
|
+
return Object.getPrototypeOf(n) === Object.prototype || Array.isArray(n) || n instanceof Map || n instanceof Set || !!(e != null && e.mark) && ((t = e.mark(n, he)) === he.immutable || typeof t == "function");
|
|
91
91
|
}
|
|
92
92
|
function os(n, e = []) {
|
|
93
93
|
if (Object.hasOwnProperty.call(n, "key")) {
|
|
@@ -120,7 +120,7 @@ function mt(n, e, t) {
|
|
|
120
120
|
}
|
|
121
121
|
function rn(n, e) {
|
|
122
122
|
const t = R(n);
|
|
123
|
-
return (t ?
|
|
123
|
+
return (t ? de(t) : n)[e];
|
|
124
124
|
}
|
|
125
125
|
function ke(n, e) {
|
|
126
126
|
return n === e ? n !== 0 || 1 / n === 1 / e : n !== n && e !== e;
|
|
@@ -177,8 +177,8 @@ function as(n, e) {
|
|
|
177
177
|
return new r(n);
|
|
178
178
|
}
|
|
179
179
|
return new Map(n);
|
|
180
|
-
} else if (e != null && e.mark && (t = e.mark(n,
|
|
181
|
-
if (t ===
|
|
180
|
+
} else if (e != null && e.mark && (t = e.mark(n, he), t !== void 0) && t !== he.mutable) {
|
|
181
|
+
if (t === he.immutable)
|
|
182
182
|
return Ei(n);
|
|
183
183
|
if (typeof t == "function") {
|
|
184
184
|
if (e.enablePatches || e.enableAutoFreeze)
|
|
@@ -196,11 +196,11 @@ function as(n, e) {
|
|
|
196
196
|
} else
|
|
197
197
|
throw new Error("Please check mark() to ensure that it is a stable marker draftable function.");
|
|
198
198
|
}
|
|
199
|
-
function
|
|
199
|
+
function re(n) {
|
|
200
200
|
n.copy || (n.copy = as(n.original, n.options));
|
|
201
201
|
}
|
|
202
202
|
function ot(n) {
|
|
203
|
-
if (!
|
|
203
|
+
if (!Te(n))
|
|
204
204
|
return qn(n);
|
|
205
205
|
if (Array.isArray(n))
|
|
206
206
|
return n.map(ot);
|
|
@@ -228,7 +228,7 @@ function ot(n) {
|
|
|
228
228
|
e[t] = ot(n[t]);
|
|
229
229
|
return e;
|
|
230
230
|
}
|
|
231
|
-
function
|
|
231
|
+
function Rt(n) {
|
|
232
232
|
return Ne(n) ? ot(n) : n;
|
|
233
233
|
}
|
|
234
234
|
function Oe(n) {
|
|
@@ -298,14 +298,14 @@ function zn(n, e) {
|
|
|
298
298
|
n.forEach((r, s) => e(s, r, n));
|
|
299
299
|
}
|
|
300
300
|
function cs(n, e, t) {
|
|
301
|
-
if (Ne(n) || !
|
|
301
|
+
if (Ne(n) || !Te(n, t) || e.has(n) || Object.isFrozen(n))
|
|
302
302
|
return;
|
|
303
303
|
const r = n instanceof Set, s = r ? /* @__PURE__ */ new Map() : void 0;
|
|
304
304
|
if (e.add(n), zn(n, (i, o) => {
|
|
305
305
|
var a;
|
|
306
306
|
if (Ne(o)) {
|
|
307
307
|
const c = R(o);
|
|
308
|
-
|
|
308
|
+
re(c);
|
|
309
309
|
const u = !((a = c.assignedMap) === null || a === void 0) && a.size || c.operated ? c.copy : c.original;
|
|
310
310
|
mt(r ? s : n, i, u);
|
|
311
311
|
} else
|
|
@@ -344,7 +344,7 @@ function Vn(n, e, t, r) {
|
|
|
344
344
|
let u = s.original;
|
|
345
345
|
s.copy && (u = s.copy), yn(n), bn(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)), mt(c, e, u);
|
|
346
346
|
}
|
|
347
|
-
}), n.options.enableAutoFreeze && s.finalities !== n.finalities && (n.options.enableAutoFreeze = !1)),
|
|
347
|
+
}), n.options.enableAutoFreeze && s.finalities !== n.finalities && (n.options.enableAutoFreeze = !1)), Te(t, n.options) && n.finalities.draft.push(() => {
|
|
348
348
|
const i = n.type === 3 ? n.setMap : n.copy;
|
|
349
349
|
ke(Ce(i, e), t) && Ai(n, e);
|
|
350
350
|
});
|
|
@@ -356,24 +356,24 @@ function ki(n, e, t, r, s) {
|
|
|
356
356
|
if (o.get(u.toString()) && c[u] !== i[u]) {
|
|
357
357
|
const l = e.concat([u]), f = Ue(l, s);
|
|
358
358
|
t.push({
|
|
359
|
-
op:
|
|
359
|
+
op: q.Replace,
|
|
360
360
|
path: f,
|
|
361
361
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
362
|
-
value:
|
|
362
|
+
value: Rt(c[u])
|
|
363
363
|
}), r.push({
|
|
364
|
-
op:
|
|
364
|
+
op: q.Replace,
|
|
365
365
|
path: f,
|
|
366
366
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
367
|
-
value:
|
|
367
|
+
value: Rt(i[u])
|
|
368
368
|
});
|
|
369
369
|
}
|
|
370
370
|
for (let u = i.length; u < c.length; u += 1) {
|
|
371
371
|
const l = e.concat([u]), f = Ue(l, s);
|
|
372
372
|
t.push({
|
|
373
|
-
op:
|
|
373
|
+
op: q.Add,
|
|
374
374
|
path: f,
|
|
375
375
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
376
|
-
value:
|
|
376
|
+
value: Rt(c[u])
|
|
377
377
|
});
|
|
378
378
|
}
|
|
379
379
|
if (i.length < c.length) {
|
|
@@ -381,7 +381,7 @@ function ki(n, e, t, r, s) {
|
|
|
381
381
|
if (u) {
|
|
382
382
|
const l = e.concat(["length"]), f = Ue(l, s);
|
|
383
383
|
r.push({
|
|
384
|
-
op:
|
|
384
|
+
op: q.Replace,
|
|
385
385
|
path: f,
|
|
386
386
|
value: i.length
|
|
387
387
|
});
|
|
@@ -389,7 +389,7 @@ function ki(n, e, t, r, s) {
|
|
|
389
389
|
for (let l = c.length; i.length < l; l -= 1) {
|
|
390
390
|
const f = e.concat([l - 1]), p = Ue(f, s);
|
|
391
391
|
r.push({
|
|
392
|
-
op:
|
|
392
|
+
op: q.Remove,
|
|
393
393
|
path: p
|
|
394
394
|
});
|
|
395
395
|
}
|
|
@@ -397,11 +397,11 @@ function ki(n, e, t, r, s) {
|
|
|
397
397
|
}
|
|
398
398
|
function Ci({ original: n, copy: e, assignedMap: t }, r, s, i, o) {
|
|
399
399
|
t.forEach((a, c) => {
|
|
400
|
-
const u = Ce(n, c), l =
|
|
401
|
-
if (ke(u, l) && f ===
|
|
400
|
+
const u = Ce(n, c), l = Rt(Ce(e, c)), f = a ? dt(n, c) ? q.Replace : q.Add : q.Remove;
|
|
401
|
+
if (ke(u, l) && f === q.Replace)
|
|
402
402
|
return;
|
|
403
403
|
const p = r.concat(c), y = Ue(p, o);
|
|
404
|
-
s.push(f ===
|
|
404
|
+
s.push(f === q.Remove ? { op: f, path: y } : { op: f, path: y, value: l }), i.push(f === q.Add ? { op: q.Remove, path: y } : f === q.Remove ? { op: q.Add, path: y, value: u } : { op: q.Replace, path: y, value: u });
|
|
405
405
|
});
|
|
406
406
|
}
|
|
407
407
|
function Ii({ original: n, copy: e }, t, r, s, i) {
|
|
@@ -410,11 +410,11 @@ function Ii({ original: n, copy: e }, t, r, s, i) {
|
|
|
410
410
|
if (!e.has(a)) {
|
|
411
411
|
const c = t.concat([o]), u = Ue(c, i);
|
|
412
412
|
r.push({
|
|
413
|
-
op:
|
|
413
|
+
op: q.Remove,
|
|
414
414
|
path: u,
|
|
415
415
|
value: a
|
|
416
416
|
}), s.unshift({
|
|
417
|
-
op:
|
|
417
|
+
op: q.Add,
|
|
418
418
|
path: u,
|
|
419
419
|
value: a
|
|
420
420
|
});
|
|
@@ -424,11 +424,11 @@ function Ii({ original: n, copy: e }, t, r, s, i) {
|
|
|
424
424
|
if (!n.has(a)) {
|
|
425
425
|
const c = t.concat([o]), u = Ue(c, i);
|
|
426
426
|
r.push({
|
|
427
|
-
op:
|
|
427
|
+
op: q.Add,
|
|
428
428
|
path: u,
|
|
429
429
|
value: a
|
|
430
430
|
}), s.unshift({
|
|
431
|
-
op:
|
|
431
|
+
op: q.Remove,
|
|
432
432
|
path: u,
|
|
433
433
|
value: a
|
|
434
434
|
});
|
|
@@ -448,30 +448,30 @@ function _t(n, e, t, r) {
|
|
|
448
448
|
return Ii(n, e, t, r, s);
|
|
449
449
|
}
|
|
450
450
|
}
|
|
451
|
-
const
|
|
452
|
-
if (typeof n == "object" && n !== null && (!
|
|
451
|
+
const Lt = (n, e, t = !1) => {
|
|
452
|
+
if (typeof n == "object" && n !== null && (!Te(n, e) || t))
|
|
453
453
|
throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.");
|
|
454
454
|
}, gn = {
|
|
455
455
|
get size() {
|
|
456
|
-
return
|
|
456
|
+
return de(R(this)).size;
|
|
457
457
|
},
|
|
458
458
|
has(n) {
|
|
459
|
-
return
|
|
459
|
+
return de(R(this)).has(n);
|
|
460
460
|
},
|
|
461
461
|
set(n, e) {
|
|
462
|
-
const t = R(this), r =
|
|
463
|
-
return (!r.has(n) || !ke(r.get(n), e)) && (
|
|
462
|
+
const t = R(this), r = de(t);
|
|
463
|
+
return (!r.has(n) || !ke(r.get(n), e)) && (re(t), Oe(t), t.assignedMap.set(n, !0), t.copy.set(n, e), Vn(t, n, e, _t)), this;
|
|
464
464
|
},
|
|
465
465
|
delete(n) {
|
|
466
466
|
if (!this.has(n))
|
|
467
467
|
return !1;
|
|
468
468
|
const e = R(this);
|
|
469
|
-
return
|
|
469
|
+
return re(e), Oe(e), e.original.has(n) ? e.assignedMap.set(n, !1) : e.assignedMap.delete(n), e.copy.delete(n), !0;
|
|
470
470
|
},
|
|
471
471
|
clear() {
|
|
472
472
|
const n = R(this);
|
|
473
473
|
if (this.size) {
|
|
474
|
-
|
|
474
|
+
re(n), Oe(n), n.assignedMap = /* @__PURE__ */ new Map();
|
|
475
475
|
for (const [e] of n.original)
|
|
476
476
|
n.assignedMap.set(e, !1);
|
|
477
477
|
n.copy.clear();
|
|
@@ -479,14 +479,14 @@ const Ut = (n, e, t = !1) => {
|
|
|
479
479
|
},
|
|
480
480
|
forEach(n, e) {
|
|
481
481
|
const t = R(this);
|
|
482
|
-
|
|
482
|
+
de(t).forEach((r, s) => {
|
|
483
483
|
n.call(e, this.get(s), s, this);
|
|
484
484
|
});
|
|
485
485
|
},
|
|
486
486
|
get(n) {
|
|
487
487
|
var e, t;
|
|
488
|
-
const r = R(this), s =
|
|
489
|
-
if (r.options.strict &&
|
|
488
|
+
const r = R(this), s = de(r).get(n), i = ((t = (e = r.options).mark) === null || t === void 0 ? void 0 : t.call(e, s, he)) === he.mutable;
|
|
489
|
+
if (r.options.strict && Lt(s, r.options, i), i || r.finalized || !Te(s, r.options) || s !== r.original.get(n))
|
|
490
490
|
return s;
|
|
491
491
|
const o = Nn.createDraft({
|
|
492
492
|
original: s,
|
|
@@ -495,15 +495,15 @@ const Ut = (n, e, t = !1) => {
|
|
|
495
495
|
finalities: r.finalities,
|
|
496
496
|
options: r.options
|
|
497
497
|
});
|
|
498
|
-
return
|
|
498
|
+
return re(r), r.copy.set(n, o), o;
|
|
499
499
|
},
|
|
500
500
|
keys() {
|
|
501
|
-
return
|
|
501
|
+
return de(R(this)).keys();
|
|
502
502
|
},
|
|
503
503
|
values() {
|
|
504
504
|
const n = this.keys();
|
|
505
505
|
return {
|
|
506
|
-
[
|
|
506
|
+
[Mt]: () => this.values(),
|
|
507
507
|
next: () => {
|
|
508
508
|
const e = n.next();
|
|
509
509
|
return e.done ? e : {
|
|
@@ -516,7 +516,7 @@ const Ut = (n, e, t = !1) => {
|
|
|
516
516
|
entries() {
|
|
517
517
|
const n = this.keys();
|
|
518
518
|
return {
|
|
519
|
-
[
|
|
519
|
+
[Mt]: () => this.entries(),
|
|
520
520
|
next: () => {
|
|
521
521
|
const e = n.next();
|
|
522
522
|
if (e.done)
|
|
@@ -529,7 +529,7 @@ const Ut = (n, e, t = !1) => {
|
|
|
529
529
|
}
|
|
530
530
|
};
|
|
531
531
|
},
|
|
532
|
-
[
|
|
532
|
+
[Mt]() {
|
|
533
533
|
return this.entries();
|
|
534
534
|
}
|
|
535
535
|
}, Pi = Reflect.ownKeys(gn), _r = (n, e, { isValuesIterator: t }) => () => {
|
|
@@ -539,8 +539,8 @@ const Ut = (n, e, t = !1) => {
|
|
|
539
539
|
return i;
|
|
540
540
|
const o = i.value;
|
|
541
541
|
let a = n.setMap.get(o);
|
|
542
|
-
const c = R(a), u = ((s = (r = n.options).mark) === null || s === void 0 ? void 0 : s.call(r, a,
|
|
543
|
-
if (n.options.strict &&
|
|
542
|
+
const c = R(a), u = ((s = (r = n.options).mark) === null || s === void 0 ? void 0 : s.call(r, a, he)) === he.mutable;
|
|
543
|
+
if (n.options.strict && Lt(o, n.options, u), !u && !c && Te(o, n.options) && !n.finalized && n.original.has(o)) {
|
|
544
544
|
const l = Nn.createDraft({
|
|
545
545
|
original: o,
|
|
546
546
|
parentDraft: n,
|
|
@@ -554,7 +554,7 @@ const Ut = (n, e, t = !1) => {
|
|
|
554
554
|
done: !1,
|
|
555
555
|
value: t ? a : [a, a]
|
|
556
556
|
};
|
|
557
|
-
},
|
|
557
|
+
}, Ft = {
|
|
558
558
|
get size() {
|
|
559
559
|
return R(this).setMap.size;
|
|
560
560
|
},
|
|
@@ -562,19 +562,19 @@ const Ut = (n, e, t = !1) => {
|
|
|
562
562
|
const e = R(this);
|
|
563
563
|
if (e.setMap.has(n))
|
|
564
564
|
return !0;
|
|
565
|
-
|
|
565
|
+
re(e);
|
|
566
566
|
const t = R(n);
|
|
567
567
|
return !!(t && e.setMap.has(t.original));
|
|
568
568
|
},
|
|
569
569
|
add(n) {
|
|
570
570
|
const e = R(this);
|
|
571
|
-
return this.has(n) || (
|
|
571
|
+
return this.has(n) || (re(e), Oe(e), e.assignedMap.set(n, !0), e.setMap.set(n, n), Vn(e, n, n, _t)), this;
|
|
572
572
|
},
|
|
573
573
|
delete(n) {
|
|
574
574
|
if (!this.has(n))
|
|
575
575
|
return !1;
|
|
576
576
|
const e = R(this);
|
|
577
|
-
|
|
577
|
+
re(e), Oe(e);
|
|
578
578
|
const t = R(n);
|
|
579
579
|
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));
|
|
580
580
|
},
|
|
@@ -582,14 +582,14 @@ const Ut = (n, e, t = !1) => {
|
|
|
582
582
|
if (!this.size)
|
|
583
583
|
return;
|
|
584
584
|
const n = R(this);
|
|
585
|
-
|
|
585
|
+
re(n), Oe(n);
|
|
586
586
|
for (const e of n.original)
|
|
587
587
|
n.assignedMap.set(e, !1);
|
|
588
588
|
n.setMap.clear();
|
|
589
589
|
},
|
|
590
590
|
values() {
|
|
591
591
|
const n = R(this);
|
|
592
|
-
|
|
592
|
+
re(n);
|
|
593
593
|
const e = n.setMap.keys();
|
|
594
594
|
return {
|
|
595
595
|
[Symbol.iterator]: () => this.values(),
|
|
@@ -598,7 +598,7 @@ const Ut = (n, e, t = !1) => {
|
|
|
598
598
|
},
|
|
599
599
|
entries() {
|
|
600
600
|
const n = R(this);
|
|
601
|
-
|
|
601
|
+
re(n);
|
|
602
602
|
const e = n.setMap.keys();
|
|
603
603
|
return {
|
|
604
604
|
[Symbol.iterator]: () => this.entries(),
|
|
@@ -610,7 +610,7 @@ const Ut = (n, e, t = !1) => {
|
|
|
610
610
|
keys() {
|
|
611
611
|
return this.values();
|
|
612
612
|
},
|
|
613
|
-
[
|
|
613
|
+
[Mt]() {
|
|
614
614
|
return this.values();
|
|
615
615
|
},
|
|
616
616
|
forEach(n, e) {
|
|
@@ -620,7 +620,7 @@ const Ut = (n, e, t = !1) => {
|
|
|
620
620
|
n.call(e, r.value, r.value, this), r = t.next();
|
|
621
621
|
}
|
|
622
622
|
};
|
|
623
|
-
Set.prototype.difference && Object.assign(
|
|
623
|
+
Set.prototype.difference && Object.assign(Ft, {
|
|
624
624
|
intersection(n) {
|
|
625
625
|
return Set.prototype.intersection.call(new Set(this.values()), n);
|
|
626
626
|
},
|
|
@@ -643,7 +643,7 @@ Set.prototype.difference && Object.assign(Lt, {
|
|
|
643
643
|
return Set.prototype.isDisjointFrom.call(new Set(this.values()), n);
|
|
644
644
|
}
|
|
645
645
|
});
|
|
646
|
-
const Mi = Reflect.ownKeys(
|
|
646
|
+
const Mi = Reflect.ownKeys(Ft), us = /* @__PURE__ */ new WeakSet(), ls = {
|
|
647
647
|
get(n, e, t) {
|
|
648
648
|
var r, s;
|
|
649
649
|
const i = (r = n.copy) === null || r === void 0 ? void 0 : r[e];
|
|
@@ -654,10 +654,10 @@ const Mi = Reflect.ownKeys(Lt), us = /* @__PURE__ */ new WeakSet(), ls = {
|
|
|
654
654
|
let o;
|
|
655
655
|
if (n.options.mark) {
|
|
656
656
|
const u = e === "size" && (n.original instanceof Map || n.original instanceof Set) ? Reflect.get(n.original, e) : Reflect.get(n.original, e, t);
|
|
657
|
-
if (o = n.options.mark(u,
|
|
658
|
-
return n.options.strict &&
|
|
657
|
+
if (o = n.options.mark(u, he), o === he.mutable)
|
|
658
|
+
return n.options.strict && Lt(u, n.options, !0), u;
|
|
659
659
|
}
|
|
660
|
-
const a =
|
|
660
|
+
const a = de(n);
|
|
661
661
|
if (a instanceof Map && Pi.includes(e)) {
|
|
662
662
|
if (e === "size")
|
|
663
663
|
return Object.getOwnPropertyDescriptor(gn, "size").get.call(n.proxy);
|
|
@@ -667,8 +667,8 @@ const Mi = Reflect.ownKeys(Lt), us = /* @__PURE__ */ new WeakSet(), ls = {
|
|
|
667
667
|
}
|
|
668
668
|
if (a instanceof Set && Mi.includes(e)) {
|
|
669
669
|
if (e === "size")
|
|
670
|
-
return Object.getOwnPropertyDescriptor(
|
|
671
|
-
const u =
|
|
670
|
+
return Object.getOwnPropertyDescriptor(Ft, "size").get.call(n.proxy);
|
|
671
|
+
const u = Ft[e];
|
|
672
672
|
if (u)
|
|
673
673
|
return u.bind(n.proxy);
|
|
674
674
|
}
|
|
@@ -680,10 +680,10 @@ const Mi = Reflect.ownKeys(Lt), us = /* @__PURE__ */ new WeakSet(), ls = {
|
|
|
680
680
|
) : void 0;
|
|
681
681
|
}
|
|
682
682
|
const c = a[e];
|
|
683
|
-
if (n.options.strict &&
|
|
683
|
+
if (n.options.strict && Lt(c, n.options), n.finalized || !Te(c, n.options))
|
|
684
684
|
return c;
|
|
685
685
|
if (c === rn(n.original, e)) {
|
|
686
|
-
if (
|
|
686
|
+
if (re(n), n.copy[e] = Bn({
|
|
687
687
|
original: n.original[e],
|
|
688
688
|
parentDraft: n,
|
|
689
689
|
key: n.type === 1 ? Number(e) : e,
|
|
@@ -691,7 +691,7 @@ const Mi = Reflect.ownKeys(Lt), us = /* @__PURE__ */ new WeakSet(), ls = {
|
|
|
691
691
|
options: n.options
|
|
692
692
|
}), typeof o == "function") {
|
|
693
693
|
const u = R(n.copy[e]);
|
|
694
|
-
return
|
|
694
|
+
return re(u), Oe(u), u.copy;
|
|
695
695
|
}
|
|
696
696
|
return n.copy[e];
|
|
697
697
|
}
|
|
@@ -704,20 +704,20 @@ const Mi = Reflect.ownKeys(Lt), us = /* @__PURE__ */ new WeakSet(), ls = {
|
|
|
704
704
|
let s;
|
|
705
705
|
if (n.type === 1 && e !== "length" && !(Number.isInteger(s = Number(e)) && s >= 0 && (e === 0 || s === 0 || String(s) === String(e))))
|
|
706
706
|
throw new Error("Only supports setting array indices and the 'length' property.");
|
|
707
|
-
const i = br(
|
|
707
|
+
const i = br(de(n), e);
|
|
708
708
|
if (i != null && i.set)
|
|
709
709
|
return i.set.call(n.proxy, t), !0;
|
|
710
|
-
const o = rn(
|
|
711
|
-
return a && ke(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) : (ke(t, o) && (t !== void 0 || dt(n.original, e)) || (
|
|
710
|
+
const o = rn(de(n), e), a = R(o);
|
|
711
|
+
return a && ke(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) : (ke(t, o) && (t !== void 0 || dt(n.original, e)) || (re(n), Oe(n), dt(n.original, e) && ke(t, n.original[e]) ? n.assignedMap.delete(e) : n.assignedMap.set(e, !0), n.copy[e] = t, Vn(n, e, t, _t)), !0);
|
|
712
712
|
},
|
|
713
713
|
has(n, e) {
|
|
714
|
-
return e in
|
|
714
|
+
return e in de(n);
|
|
715
715
|
},
|
|
716
716
|
ownKeys(n) {
|
|
717
|
-
return Reflect.ownKeys(
|
|
717
|
+
return Reflect.ownKeys(de(n));
|
|
718
718
|
},
|
|
719
719
|
getOwnPropertyDescriptor(n, e) {
|
|
720
|
-
const t =
|
|
720
|
+
const t = de(n), r = Reflect.getOwnPropertyDescriptor(t, e);
|
|
721
721
|
return r && {
|
|
722
722
|
writable: !0,
|
|
723
723
|
configurable: n.type !== 1 || e !== "length",
|
|
@@ -736,7 +736,7 @@ const Mi = Reflect.ownKeys(Lt), us = /* @__PURE__ */ new WeakSet(), ls = {
|
|
|
736
736
|
},
|
|
737
737
|
deleteProperty(n, e) {
|
|
738
738
|
var t;
|
|
739
|
-
return n.type === 1 ? ls.set.call(this, n, e, void 0, n.proxy) : (rn(n.original, e) !== void 0 || e in n.original ? (
|
|
739
|
+
return n.type === 1 ? ls.set.call(this, n, e, void 0, n.proxy) : (rn(n.original, e) !== void 0 || e in n.original ? (re(n), Oe(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);
|
|
740
740
|
}
|
|
741
741
|
};
|
|
742
742
|
function Bn(n) {
|
|
@@ -758,14 +758,14 @@ function Bn(n) {
|
|
|
758
758
|
const l = t;
|
|
759
759
|
l.finalities.draft.push((f, p) => {
|
|
760
760
|
var y, b;
|
|
761
|
-
const
|
|
761
|
+
const _ = R(c);
|
|
762
762
|
let m = l.type === 3 ? l.setMap : l.copy;
|
|
763
|
-
const S = Ce(m, r),
|
|
764
|
-
if (
|
|
765
|
-
let w =
|
|
766
|
-
|
|
763
|
+
const S = Ce(m, r), g = R(S);
|
|
764
|
+
if (g) {
|
|
765
|
+
let w = g.original;
|
|
766
|
+
g.operated && (w = qn(S)), yn(g), bn(g, _t, f, p), l.options.enableAutoFreeze && (l.options.updatedValues = (y = l.options.updatedValues) !== null && y !== void 0 ? y : /* @__PURE__ */ new WeakMap(), l.options.updatedValues.set(w, g.original)), mt(m, r, w);
|
|
767
767
|
}
|
|
768
|
-
(b =
|
|
768
|
+
(b = _.callbacks) === null || b === void 0 || b.forEach((w) => {
|
|
769
769
|
w(f, p);
|
|
770
770
|
});
|
|
771
771
|
});
|
|
@@ -787,8 +787,8 @@ function Ri(n, e, t, r, s) {
|
|
|
787
787
|
const u = c ? e[0] : o ? o.operated ? o.copy : o.original : n;
|
|
788
788
|
return o && pn(o), s && Be(u, u, o == null ? void 0 : o.options.updatedValues), [
|
|
789
789
|
u,
|
|
790
|
-
t && c ? [{ op:
|
|
791
|
-
r && c ? [{ op:
|
|
790
|
+
t && c ? [{ op: q.Replace, path: [], value: e[0] }] : t,
|
|
791
|
+
r && c ? [{ op: q.Replace, path: [], value: a }] : r
|
|
792
792
|
];
|
|
793
793
|
}
|
|
794
794
|
function ji(n, e) {
|
|
@@ -800,7 +800,7 @@ function ji(n, e) {
|
|
|
800
800
|
};
|
|
801
801
|
let s, i;
|
|
802
802
|
e.enablePatches && (s = [], i = []);
|
|
803
|
-
const a = ((t = e.mark) === null || t === void 0 ? void 0 : t.call(e, n,
|
|
803
|
+
const a = ((t = e.mark) === null || t === void 0 ? void 0 : t.call(e, n, he)) === he.mutable || !Te(n, e) ? n : Bn({
|
|
804
804
|
original: n,
|
|
805
805
|
parentDraft: null,
|
|
806
806
|
finalities: r,
|
|
@@ -832,7 +832,7 @@ function _n(n) {
|
|
|
832
832
|
function fs(n) {
|
|
833
833
|
var e;
|
|
834
834
|
const t = R(n);
|
|
835
|
-
if (!
|
|
835
|
+
if (!Te(n, t == null ? void 0 : t.options))
|
|
836
836
|
return n;
|
|
837
837
|
const r = We(n);
|
|
838
838
|
if (t && !t.operated)
|
|
@@ -869,19 +869,19 @@ function mr(n) {
|
|
|
869
869
|
const xi = (n) => function e(t, r, s) {
|
|
870
870
|
var i, o, a;
|
|
871
871
|
if (typeof t == "function" && typeof r != "function")
|
|
872
|
-
return function(v, ...
|
|
873
|
-
return e(v, (
|
|
872
|
+
return function(v, ...C) {
|
|
873
|
+
return e(v, (j) => t.call(this, j, ...C), r);
|
|
874
874
|
};
|
|
875
875
|
const c = t, u = r;
|
|
876
876
|
let l = s;
|
|
877
877
|
if (typeof r != "function" && (l = r), l !== void 0 && Object.prototype.toString.call(l) !== "[object Object]")
|
|
878
878
|
throw new Error(`Invalid options: ${l}, 'options' should be an object.`);
|
|
879
879
|
l = Object.assign(Object.assign({}, n), l);
|
|
880
|
-
const f = Ne(c) ? mr(c) : c, p = Array.isArray(l.mark) ? (v,
|
|
881
|
-
for (const
|
|
882
|
-
if (typeof
|
|
883
|
-
throw new Error(`Invalid mark: ${
|
|
884
|
-
const U =
|
|
880
|
+
const f = Ne(c) ? mr(c) : c, p = Array.isArray(l.mark) ? (v, C) => {
|
|
881
|
+
for (const j of l.mark) {
|
|
882
|
+
if (typeof j != "function")
|
|
883
|
+
throw new Error(`Invalid mark: ${j}, 'mark' should be a function.`);
|
|
884
|
+
const U = j(v, C);
|
|
885
885
|
if (U)
|
|
886
886
|
return U;
|
|
887
887
|
}
|
|
@@ -891,13 +891,13 @@ const xi = (n) => function e(t, r, s) {
|
|
|
891
891
|
strict: b,
|
|
892
892
|
enablePatches: y
|
|
893
893
|
};
|
|
894
|
-
if (!
|
|
894
|
+
if (!Te(f, m) && typeof f == "object" && f !== null)
|
|
895
895
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
896
|
-
const [S,
|
|
896
|
+
const [S, g] = ji(f, m);
|
|
897
897
|
if (typeof r != "function") {
|
|
898
|
-
if (!
|
|
898
|
+
if (!Te(f, m))
|
|
899
899
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
900
|
-
return [S,
|
|
900
|
+
return [S, g];
|
|
901
901
|
}
|
|
902
902
|
let w;
|
|
903
903
|
try {
|
|
@@ -906,36 +906,36 @@ const xi = (n) => function e(t, r, s) {
|
|
|
906
906
|
throw pn(R(S)), v;
|
|
907
907
|
}
|
|
908
908
|
const O = (v) => {
|
|
909
|
-
const
|
|
909
|
+
const C = R(S);
|
|
910
910
|
if (!Ne(v)) {
|
|
911
|
-
if (v !== void 0 && !ke(v, S) && (
|
|
911
|
+
if (v !== void 0 && !ke(v, S) && (C != null && C.operated))
|
|
912
912
|
throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");
|
|
913
913
|
const U = v == null ? void 0 : v[Si];
|
|
914
914
|
if (U) {
|
|
915
|
-
const
|
|
915
|
+
const B = U[0];
|
|
916
916
|
return m.strict && typeof v == "object" && v !== null && _n({
|
|
917
|
-
rootDraft:
|
|
917
|
+
rootDraft: C,
|
|
918
918
|
value: v,
|
|
919
919
|
useRawReturn: !0
|
|
920
|
-
}),
|
|
920
|
+
}), g([B]);
|
|
921
921
|
}
|
|
922
922
|
if (v !== void 0)
|
|
923
|
-
return typeof v == "object" && v !== null && _n({ rootDraft:
|
|
923
|
+
return typeof v == "object" && v !== null && _n({ rootDraft: C, value: v }), g([v]);
|
|
924
924
|
}
|
|
925
925
|
if (v === S || v === void 0)
|
|
926
|
-
return
|
|
927
|
-
const
|
|
928
|
-
if (m ===
|
|
929
|
-
if (
|
|
926
|
+
return g([]);
|
|
927
|
+
const j = R(v);
|
|
928
|
+
if (m === j.options) {
|
|
929
|
+
if (j.operated)
|
|
930
930
|
throw new Error("Cannot return a modified child draft.");
|
|
931
|
-
return
|
|
931
|
+
return g([mr(v)]);
|
|
932
932
|
}
|
|
933
|
-
return
|
|
933
|
+
return g([v]);
|
|
934
934
|
};
|
|
935
935
|
return w instanceof Promise ? w.then(O, (v) => {
|
|
936
936
|
throw pn(R(S)), v;
|
|
937
937
|
}) : O(w);
|
|
938
|
-
},
|
|
938
|
+
}, Nt = xi();
|
|
939
939
|
Object.prototype.constructor.toString();
|
|
940
940
|
function ds(n, e) {
|
|
941
941
|
const t = Object.keys(n), r = Object.keys(e);
|
|
@@ -944,8 +944,8 @@ function ds(n, e) {
|
|
|
944
944
|
function wr(n, e) {
|
|
945
945
|
return Object.keys(n).length === Object.keys(e).length && Object.keys(n).every((t) => e.hasOwnProperty(t) && n[t] === e[t]);
|
|
946
946
|
}
|
|
947
|
-
function
|
|
948
|
-
return typeof n != "object" || typeof e != "object" || n === null || e === null ? n === e : ds(n, e) ? Object.keys(n).every((t) =>
|
|
947
|
+
function jt(n, e) {
|
|
948
|
+
return typeof n != "object" || typeof e != "object" || n === null || e === null ? n === e : ds(n, e) ? Object.keys(n).every((t) => jt(n[t], e[t])) : !1;
|
|
949
949
|
}
|
|
950
950
|
function Gn(n) {
|
|
951
951
|
if (!at(n))
|
|
@@ -1318,7 +1318,7 @@ function Xi(n) {
|
|
|
1318
1318
|
return null;
|
|
1319
1319
|
}
|
|
1320
1320
|
}
|
|
1321
|
-
function
|
|
1321
|
+
function zt(n) {
|
|
1322
1322
|
if (n !== void 0) {
|
|
1323
1323
|
if (n === null)
|
|
1324
1324
|
return null;
|
|
@@ -1367,7 +1367,7 @@ class Le {
|
|
|
1367
1367
|
for (const e of Object.values(this.attrs))
|
|
1368
1368
|
if (Hn(e)) {
|
|
1369
1369
|
const [t, r, s] = e["forward-identity"];
|
|
1370
|
-
|
|
1370
|
+
ue(this.blobAttrs, [r, s], e);
|
|
1371
1371
|
}
|
|
1372
1372
|
return this._blobAttrs;
|
|
1373
1373
|
}
|
|
@@ -1378,7 +1378,7 @@ class Le {
|
|
|
1378
1378
|
for (const e of Object.values(this.attrs))
|
|
1379
1379
|
if (e["primary?"]) {
|
|
1380
1380
|
const [t, r] = e["forward-identity"];
|
|
1381
|
-
|
|
1381
|
+
ue(this._primaryKeys, [r], e);
|
|
1382
1382
|
}
|
|
1383
1383
|
return this._primaryKeys;
|
|
1384
1384
|
}
|
|
@@ -1388,7 +1388,7 @@ class Le {
|
|
|
1388
1388
|
this._forwardIdents = /* @__PURE__ */ new Map();
|
|
1389
1389
|
for (const e of Object.values(this.attrs)) {
|
|
1390
1390
|
const t = e["forward-identity"], [r, s, i] = t;
|
|
1391
|
-
|
|
1391
|
+
ue(this._forwardIdents, [s, i], e);
|
|
1392
1392
|
}
|
|
1393
1393
|
return this._forwardIdents;
|
|
1394
1394
|
}
|
|
@@ -1400,7 +1400,7 @@ class Le {
|
|
|
1400
1400
|
const t = e["reverse-identity"];
|
|
1401
1401
|
if (t) {
|
|
1402
1402
|
const [r, s, i] = t;
|
|
1403
|
-
|
|
1403
|
+
ue(this._revIdents, [s, i], e);
|
|
1404
1404
|
}
|
|
1405
1405
|
}
|
|
1406
1406
|
return this._revIdents;
|
|
@@ -1421,7 +1421,7 @@ function Hn(n) {
|
|
|
1421
1421
|
function tt(n, e) {
|
|
1422
1422
|
return e.reduce((t, r) => t && t.get(r), n);
|
|
1423
1423
|
}
|
|
1424
|
-
function
|
|
1424
|
+
function we(n, e) {
|
|
1425
1425
|
if (e.length === 0)
|
|
1426
1426
|
throw new Error("path must have at least one element");
|
|
1427
1427
|
if (e.length === 1) {
|
|
@@ -1429,9 +1429,9 @@ function me(n, e) {
|
|
|
1429
1429
|
return;
|
|
1430
1430
|
}
|
|
1431
1431
|
const [t, ...r] = e;
|
|
1432
|
-
n.has(t) &&
|
|
1432
|
+
n.has(t) && we(n.get(t), r);
|
|
1433
1433
|
}
|
|
1434
|
-
function
|
|
1434
|
+
function ue(n, e, t) {
|
|
1435
1435
|
let r = n;
|
|
1436
1436
|
const s = e.length - 1;
|
|
1437
1437
|
for (let i = 0; i < s; i++) {
|
|
@@ -1450,13 +1450,13 @@ function ys(n, e, t) {
|
|
|
1450
1450
|
console.warn("no such attr", c, a);
|
|
1451
1451
|
continue;
|
|
1452
1452
|
}
|
|
1453
|
-
l["checked-data-type"] === "date" && t && (u =
|
|
1453
|
+
l["checked-data-type"] === "date" && t && (u = zt(u), o[2] = u), Qn(l) && ue(i, [u, c, a], o), ue(r, [a, c, u], o), ue(s, [c, a, u], o);
|
|
1454
1454
|
}
|
|
1455
1455
|
return { eav: r, aev: s, vae: i };
|
|
1456
1456
|
}
|
|
1457
1457
|
function bs(n) {
|
|
1458
1458
|
return {
|
|
1459
|
-
triples:
|
|
1459
|
+
triples: le(n.eav, 3),
|
|
1460
1460
|
cardinalityInference: n.cardinalityInference,
|
|
1461
1461
|
useDateObjects: n.useDateObjects,
|
|
1462
1462
|
version: 1
|
|
@@ -1485,7 +1485,7 @@ function wt(n, e) {
|
|
|
1485
1485
|
const [o, a] = e[0], c = n.aev.get(o);
|
|
1486
1486
|
if (!c)
|
|
1487
1487
|
return null;
|
|
1488
|
-
t = (s =
|
|
1488
|
+
t = (s = le(c, 2).find((l) => l[2] === a)) == null ? void 0 : s[0];
|
|
1489
1489
|
} else
|
|
1490
1490
|
t = e[0];
|
|
1491
1491
|
if (!t)
|
|
@@ -1495,7 +1495,7 @@ function wt(n, e) {
|
|
|
1495
1495
|
const [o, a] = r, c = n.aev.get(o);
|
|
1496
1496
|
if (!c)
|
|
1497
1497
|
return null;
|
|
1498
|
-
const l = (i =
|
|
1498
|
+
const l = (i = le(c, 2).find((_) => _[2] === a)) == null ? void 0 : i[0];
|
|
1499
1499
|
if (!l)
|
|
1500
1500
|
return null;
|
|
1501
1501
|
const [f, p, y, ...b] = e;
|
|
@@ -1510,7 +1510,7 @@ function ms(n, e, t) {
|
|
|
1510
1510
|
if (!r)
|
|
1511
1511
|
return;
|
|
1512
1512
|
const [s, i, o] = r, a = e.getAttr(i);
|
|
1513
|
-
a && (
|
|
1513
|
+
a && (we(n.eav, [s, i, o]), we(n.aev, [i, s, o]), Qn(a) && we(n.vae, [o, i, s]));
|
|
1514
1514
|
}
|
|
1515
1515
|
let no = 0;
|
|
1516
1516
|
function ws(n, e, t) {
|
|
@@ -1527,9 +1527,9 @@ function Ts(n, e, t) {
|
|
|
1527
1527
|
const a = e.getAttr(i);
|
|
1528
1528
|
if (!a)
|
|
1529
1529
|
return;
|
|
1530
|
-
a["checked-data-type"] === "date" && n.useDateObjects && (o =
|
|
1530
|
+
a["checked-data-type"] === "date" && n.useDateObjects && (o = zt(o));
|
|
1531
1531
|
const c = tt(n.eav, [s, i, o]), u = (c == null ? void 0 : c[3]) ?? ws(n, a, r), l = [s, i, o, u];
|
|
1532
|
-
eo(a) ? (
|
|
1532
|
+
eo(a) ? (ue(n.eav, [s, i], /* @__PURE__ */ new Map([[o, l]])), ue(n.aev, [i, s], /* @__PURE__ */ new Map([[o, l]]))) : (ue(n.eav, [s, i, o], l), ue(n.aev, [i, s, o], l)), Qn(a) && ue(n.vae, [o, i, s], l);
|
|
1533
1533
|
}
|
|
1534
1534
|
function ro(n, e, t) {
|
|
1535
1535
|
var y;
|
|
@@ -1553,7 +1553,7 @@ function ro(n, e, t) {
|
|
|
1553
1553
|
f,
|
|
1554
1554
|
ws(n, a, u)
|
|
1555
1555
|
];
|
|
1556
|
-
|
|
1556
|
+
ue(n.eav, [s, i], /* @__PURE__ */ new Map([[f, p]])), ue(n.aev, [i, s], /* @__PURE__ */ new Map([[f, p]]));
|
|
1557
1557
|
}
|
|
1558
1558
|
function wn(n, e, t) {
|
|
1559
1559
|
var u, l;
|
|
@@ -1564,23 +1564,23 @@ function wn(n, e, t) {
|
|
|
1564
1564
|
if (a) {
|
|
1565
1565
|
for (const f of a.keys()) {
|
|
1566
1566
|
const p = e.getAttr(f);
|
|
1567
|
-
p && p["on-delete-reverse"] === "cascade" &&
|
|
1567
|
+
p && p["on-delete-reverse"] === "cascade" && le(a.get(f), 1).forEach(([y, b, _]) => {
|
|
1568
1568
|
var m;
|
|
1569
|
-
return wn(n, e, [
|
|
1569
|
+
return wn(n, e, [_, (m = p["reverse-identity"]) == null ? void 0 : m[1]]);
|
|
1570
1570
|
}), // Fall back to deleting everything if we've rehydrated tx-steps from
|
|
1571
1571
|
// the store that didn't set `etype` in deleteEntity
|
|
1572
1572
|
(!s || // If we don't know about the attr, let's just get rid of it
|
|
1573
1573
|
!p || // Make sure it matches the etype
|
|
1574
|
-
((u = p["forward-identity"]) == null ? void 0 : u[1]) === s) && (
|
|
1574
|
+
((u = p["forward-identity"]) == null ? void 0 : u[1]) === s) && (we(n.aev, [f, o]), we(n.eav, [o, f]));
|
|
1575
1575
|
}
|
|
1576
|
-
a.size === 0 &&
|
|
1576
|
+
a.size === 0 && we(n.eav, [o]);
|
|
1577
1577
|
}
|
|
1578
|
-
const c = n.vae.get(o) &&
|
|
1578
|
+
const c = n.vae.get(o) && le(n.vae.get(o), 2);
|
|
1579
1579
|
c && c.forEach((f) => {
|
|
1580
|
-
var m, S,
|
|
1581
|
-
const [p, y, b] = f,
|
|
1582
|
-
(!s || !
|
|
1583
|
-
}), ((l = n.vae.get(o)) == null ? void 0 : l.size) === 0 &&
|
|
1580
|
+
var m, S, g;
|
|
1581
|
+
const [p, y, b] = f, _ = e.getAttr(y);
|
|
1582
|
+
(!s || !_ || ((m = _["reverse-identity"]) == null ? void 0 : m[1]) === s) && (we(n.eav, [p, y, b]), we(n.aev, [y, p, b]), we(n.vae, [b, y, p])), _ && _["on-delete"] === "cascade" && ((S = _["reverse-identity"]) == null ? void 0 : S[1]) === s && wn(n, e, [p, (g = _["forward-identity"]) == null ? void 0 : g[1]]);
|
|
1583
|
+
}), ((l = n.vae.get(o)) == null ? void 0 : l.size) === 0 && we(n.vae, [o]);
|
|
1584
1584
|
}
|
|
1585
1585
|
function Ss(n, e, t) {
|
|
1586
1586
|
const r = ys(e, t, n.useDateObjects);
|
|
@@ -1592,7 +1592,7 @@ function so(n, [e]) {
|
|
|
1592
1592
|
n.addAttr(e);
|
|
1593
1593
|
}
|
|
1594
1594
|
function vs(n) {
|
|
1595
|
-
return
|
|
1595
|
+
return le(n.eav, 3);
|
|
1596
1596
|
}
|
|
1597
1597
|
function io(n, e, [t]) {
|
|
1598
1598
|
if (!e.getAttr(t))
|
|
@@ -1635,7 +1635,7 @@ function ao(n, e, t) {
|
|
|
1635
1635
|
throw new Error(`unhandled transaction action: ${r}`);
|
|
1636
1636
|
}
|
|
1637
1637
|
}
|
|
1638
|
-
function
|
|
1638
|
+
function le(n, e, t = []) {
|
|
1639
1639
|
if (!n || e === 0)
|
|
1640
1640
|
return t;
|
|
1641
1641
|
if (e === 1) {
|
|
@@ -1644,10 +1644,10 @@ function ue(n, e, t = []) {
|
|
|
1644
1644
|
return t;
|
|
1645
1645
|
}
|
|
1646
1646
|
for (const r of n.values())
|
|
1647
|
-
|
|
1647
|
+
le(r, e - 1, t);
|
|
1648
1648
|
return t;
|
|
1649
1649
|
}
|
|
1650
|
-
function
|
|
1650
|
+
function At(n, e, t) {
|
|
1651
1651
|
var i;
|
|
1652
1652
|
const r = [];
|
|
1653
1653
|
if (t != null && t.hasOwnProperty("$not")) {
|
|
@@ -1672,7 +1672,7 @@ function Ot(n, e, t) {
|
|
|
1672
1672
|
return r;
|
|
1673
1673
|
}
|
|
1674
1674
|
if (t != null && t.$comparator)
|
|
1675
|
-
return
|
|
1675
|
+
return le(e, 1).filter(t.$op);
|
|
1676
1676
|
const s = t.in || t.$in || [t];
|
|
1677
1677
|
for (const o of s) {
|
|
1678
1678
|
const a = e.get(o);
|
|
@@ -1689,15 +1689,15 @@ function uo(n, [e, t, r]) {
|
|
|
1689
1689
|
switch (co(e, t, r)) {
|
|
1690
1690
|
case "e": {
|
|
1691
1691
|
const a = n.eav.get(e);
|
|
1692
|
-
return
|
|
1692
|
+
return le(a, 2);
|
|
1693
1693
|
}
|
|
1694
1694
|
case "ea": {
|
|
1695
1695
|
const a = (i = n.eav.get(e)) == null ? void 0 : i.get(t);
|
|
1696
|
-
return
|
|
1696
|
+
return le(a, 1);
|
|
1697
1697
|
}
|
|
1698
1698
|
case "eav": {
|
|
1699
1699
|
const a = (o = n.eav.get(e)) == null ? void 0 : o.get(t);
|
|
1700
|
-
return a ?
|
|
1700
|
+
return a ? At(n, a, r) : [];
|
|
1701
1701
|
}
|
|
1702
1702
|
case "ev": {
|
|
1703
1703
|
const a = n.eav.get(e);
|
|
@@ -1705,12 +1705,12 @@ function uo(n, [e, t, r]) {
|
|
|
1705
1705
|
return [];
|
|
1706
1706
|
const c = [];
|
|
1707
1707
|
for (const u of a.values())
|
|
1708
|
-
c.push(...
|
|
1708
|
+
c.push(...At(n, u, r));
|
|
1709
1709
|
return c;
|
|
1710
1710
|
}
|
|
1711
1711
|
case "a": {
|
|
1712
1712
|
const a = n.aev.get(t);
|
|
1713
|
-
return
|
|
1713
|
+
return le(a, 2);
|
|
1714
1714
|
}
|
|
1715
1715
|
case "av": {
|
|
1716
1716
|
const a = n.aev.get(t);
|
|
@@ -1718,18 +1718,18 @@ function uo(n, [e, t, r]) {
|
|
|
1718
1718
|
return [];
|
|
1719
1719
|
const c = [];
|
|
1720
1720
|
for (const u of a.values())
|
|
1721
|
-
c.push(...
|
|
1721
|
+
c.push(...At(n, u, r));
|
|
1722
1722
|
return c;
|
|
1723
1723
|
}
|
|
1724
1724
|
case "v": {
|
|
1725
1725
|
const a = [];
|
|
1726
1726
|
for (const c of n.eav.values())
|
|
1727
1727
|
for (const u of c.values())
|
|
1728
|
-
a.push(...
|
|
1728
|
+
a.push(...At(n, u, r));
|
|
1729
1729
|
return a;
|
|
1730
1730
|
}
|
|
1731
1731
|
default:
|
|
1732
|
-
return
|
|
1732
|
+
return le(n.eav, 3);
|
|
1733
1733
|
}
|
|
1734
1734
|
}
|
|
1735
1735
|
function lo(n, e, t) {
|
|
@@ -1738,13 +1738,13 @@ function lo(n, e, t) {
|
|
|
1738
1738
|
if (!e)
|
|
1739
1739
|
return r;
|
|
1740
1740
|
for (const [i, o] of e.entries()) {
|
|
1741
|
-
const a = (s = n.eav.get(t)) == null ? void 0 : s.get(o.id), c =
|
|
1741
|
+
const a = (s = n.eav.get(t)) == null ? void 0 : s.get(o.id), c = le(a, 1);
|
|
1742
1742
|
for (const u of c)
|
|
1743
1743
|
r[i] = u[2];
|
|
1744
1744
|
}
|
|
1745
1745
|
return r;
|
|
1746
1746
|
}
|
|
1747
|
-
function
|
|
1747
|
+
function V(n, e, t) {
|
|
1748
1748
|
var r;
|
|
1749
1749
|
return (r = n.forwardIdents.get(e)) == null ? void 0 : r.get(t);
|
|
1750
1750
|
}
|
|
@@ -1787,7 +1787,7 @@ function po(n, e, t) {
|
|
|
1787
1787
|
}
|
|
1788
1788
|
return !(u === "create" && l || u === "update" && !l);
|
|
1789
1789
|
});
|
|
1790
|
-
return
|
|
1790
|
+
return Nt({ store: n, attrsStore: e }, (s) => {
|
|
1791
1791
|
r.forEach((i) => {
|
|
1792
1792
|
ao(s.store, s.attrsStore, i);
|
|
1793
1793
|
});
|
|
@@ -1931,9 +1931,9 @@ const Fu = (n) => {
|
|
|
1931
1931
|
};
|
|
1932
1932
|
let Do = 0;
|
|
1933
1933
|
function ht(n) {
|
|
1934
|
-
return
|
|
1934
|
+
return Vt(`_${n}`, Do++);
|
|
1935
1935
|
}
|
|
1936
|
-
function
|
|
1936
|
+
function Vt(n, e) {
|
|
1937
1937
|
return `?${n}-${e}`;
|
|
1938
1938
|
}
|
|
1939
1939
|
class et extends Error {
|
|
@@ -1962,7 +1962,7 @@ function Fo(n, e, t) {
|
|
|
1962
1962
|
return n.map((r) => r === e ? t : r);
|
|
1963
1963
|
}
|
|
1964
1964
|
function ks(n, e, t, r, s) {
|
|
1965
|
-
const i =
|
|
1965
|
+
const i = V(e, t, s), o = Ke(e, t, s), a = i || o;
|
|
1966
1966
|
if (!a)
|
|
1967
1967
|
throw new et(`Could not find attr for ${[t, s]}`);
|
|
1968
1968
|
if (a["value-type"] !== "ref")
|
|
@@ -2051,11 +2051,11 @@ function No(n, e) {
|
|
|
2051
2051
|
return e;
|
|
2052
2052
|
}
|
|
2053
2053
|
function Wo(n, e, t, r, s, i) {
|
|
2054
|
-
const o =
|
|
2054
|
+
const o = V(e, t, s), a = Ke(e, t, s), c = o || a;
|
|
2055
2055
|
if (!c)
|
|
2056
2056
|
throw new et(`No attr for etype = ${t} label = ${s}`);
|
|
2057
2057
|
if (i != null && i.hasOwnProperty("$isNull")) {
|
|
2058
|
-
const u =
|
|
2058
|
+
const u = V(e, t, "id");
|
|
2059
2059
|
if (!u)
|
|
2060
2060
|
throw new et(`No attr for etype = ${t} label = id`);
|
|
2061
2061
|
return [
|
|
@@ -2074,8 +2074,8 @@ function Wo(n, e, t, r, s, i) {
|
|
|
2074
2074
|
}
|
|
2075
2075
|
function Ko(n, e, t, r, s) {
|
|
2076
2076
|
const [i, o, a] = s.reduce((c, u) => {
|
|
2077
|
-
const [l, f, p] = c, [y, b,
|
|
2078
|
-
return [y, b, [...p,
|
|
2077
|
+
const [l, f, p] = c, [y, b, _] = ks(n, e, l, f, u);
|
|
2078
|
+
return [y, b, [...p, _]];
|
|
2079
2079
|
}, [t, r, []]);
|
|
2080
2080
|
return [i, o, a];
|
|
2081
2081
|
}
|
|
@@ -2147,7 +2147,7 @@ function Cs(n, e, t, r, s) {
|
|
|
2147
2147
|
});
|
|
2148
2148
|
}
|
|
2149
2149
|
function Qo(n, e, t, r) {
|
|
2150
|
-
const s =
|
|
2150
|
+
const s = Vt;
|
|
2151
2151
|
return r ? Cs(s, n, e, t, r).concat(Ar(s, n, e, t)) : Ar(s, n, e, t);
|
|
2152
2152
|
}
|
|
2153
2153
|
function Ho(n, e, t) {
|
|
@@ -2161,20 +2161,20 @@ function Yo(n, e, t, { etype: r, level: s, form: i }, o) {
|
|
|
2161
2161
|
const a = Object.keys(i).filter((c) => c !== "$");
|
|
2162
2162
|
return a.length ? Object.entries(o).map(function([u, l]) {
|
|
2163
2163
|
return a.map(function(y) {
|
|
2164
|
-
var
|
|
2165
|
-
const b = !!(e.cardinalityInference && ((S = (m = (
|
|
2164
|
+
var _, m, S;
|
|
2165
|
+
const b = !!(e.cardinalityInference && ((S = (m = (_ = t.linkIndex) == null ? void 0 : _[r]) == null ? void 0 : m[y]) != null && S.isSingular));
|
|
2166
2166
|
try {
|
|
2167
|
-
const [
|
|
2168
|
-
etype:
|
|
2167
|
+
const [g, w, O] = Jo(n, t, r, s, y, u), v = Ps(e, t, {
|
|
2168
|
+
etype: g,
|
|
2169
2169
|
level: w,
|
|
2170
2170
|
form: i[y],
|
|
2171
2171
|
join: O
|
|
2172
|
-
}),
|
|
2173
|
-
return { [y]:
|
|
2174
|
-
} catch (
|
|
2175
|
-
if (
|
|
2172
|
+
}), C = b ? v[0] : v;
|
|
2173
|
+
return { [y]: C };
|
|
2174
|
+
} catch (g) {
|
|
2175
|
+
if (g instanceof et)
|
|
2176
2176
|
return { [y]: b ? void 0 : [] };
|
|
2177
|
-
throw
|
|
2177
|
+
throw g;
|
|
2178
2178
|
}
|
|
2179
2179
|
}).reduce(function(y, b) {
|
|
2180
2180
|
return { ...y, ...b };
|
|
@@ -2187,7 +2187,7 @@ function Zo(n, e, t) {
|
|
|
2187
2187
|
function ut(n, e, t, r, s) {
|
|
2188
2188
|
return e === r || e == null && r == null ? Ro(n, t) : r == null ? 1 : e == null ? -1 : Zo(e, r, s);
|
|
2189
2189
|
}
|
|
2190
|
-
function
|
|
2190
|
+
function Wt([n, e], [t, r], s) {
|
|
2191
2191
|
return ut(n, e, t, r, s);
|
|
2192
2192
|
}
|
|
2193
2193
|
function vn(n) {
|
|
@@ -2197,9 +2197,9 @@ function Xo(n, e, t, r) {
|
|
|
2197
2197
|
var b;
|
|
2198
2198
|
const [s, i, o, a] = n, c = t === "desc" ? 1 : -1;
|
|
2199
2199
|
if (((b = e["forward-identity"]) == null ? void 0 : b[2]) === "id")
|
|
2200
|
-
return
|
|
2200
|
+
return Wt(r, [s, a], null) === c;
|
|
2201
2201
|
const [u, l] = r, f = e["checked-data-type"], p = f === "date" ? vn(l) : l, y = f === "date" ? vn(o) : o;
|
|
2202
|
-
return
|
|
2202
|
+
return Wt([u, p], [s, y], f) === c;
|
|
2203
2203
|
}
|
|
2204
2204
|
function ea(n, e) {
|
|
2205
2205
|
const t = e[1];
|
|
@@ -2207,7 +2207,7 @@ function ea(n, e) {
|
|
|
2207
2207
|
}
|
|
2208
2208
|
function ta(n, e, t) {
|
|
2209
2209
|
const r = Object.keys(t)[0];
|
|
2210
|
-
return
|
|
2210
|
+
return V(n, e, r);
|
|
2211
2211
|
}
|
|
2212
2212
|
function na(n, e, t, r) {
|
|
2213
2213
|
if (t)
|
|
@@ -2221,32 +2221,32 @@ function ra(n, e, t) {
|
|
|
2221
2221
|
return fo(n, e);
|
|
2222
2222
|
const r = /* @__PURE__ */ new Map();
|
|
2223
2223
|
for (const o of t.fields) {
|
|
2224
|
-
const a =
|
|
2224
|
+
const a = V(n, e, o), c = (s = a == null ? void 0 : a["forward-identity"]) == null ? void 0 : s[2];
|
|
2225
2225
|
c && Hn(a) && r.set(c, a);
|
|
2226
2226
|
}
|
|
2227
2227
|
if (!r.has("id")) {
|
|
2228
|
-
const o =
|
|
2228
|
+
const o = V(n, e, "id"), a = (i = o == null ? void 0 : o["forward-identity"]) == null ? void 0 : i[2];
|
|
2229
2229
|
a && r.set(a, o);
|
|
2230
2230
|
}
|
|
2231
2231
|
return r;
|
|
2232
2232
|
}
|
|
2233
2233
|
function sa(n, e, { etype: t, pageInfo: r, dq: s, form: i }) {
|
|
2234
|
-
var b,
|
|
2234
|
+
var b, _;
|
|
2235
2235
|
const o = (b = i == null ? void 0 : i.$) == null ? void 0 : b.order, a = Is(i), c = ia(i);
|
|
2236
2236
|
let u = vo(n, s);
|
|
2237
2237
|
const l = r == null ? void 0 : r["start-cursor"], f = na(e, t, l, o);
|
|
2238
|
-
if (f && ((
|
|
2238
|
+
if (f && ((_ = f == null ? void 0 : f["forward-identity"]) == null ? void 0 : _[2]) !== "id") {
|
|
2239
2239
|
const m = f["checked-data-type"] === "date", S = f.id;
|
|
2240
|
-
u = u.map(([
|
|
2241
|
-
var O, v,
|
|
2242
|
-
let w = (U = (
|
|
2243
|
-
return m && (w = vn(w)), [
|
|
2240
|
+
u = u.map(([g]) => {
|
|
2241
|
+
var O, v, C, j, U;
|
|
2242
|
+
let w = (U = (j = (C = (v = (O = n.eav.get(g)) == null ? void 0 : O.get(S)) == null ? void 0 : v.values()) == null ? void 0 : C.next()) == null ? void 0 : j.value) == null ? void 0 : U[2];
|
|
2243
|
+
return m && (w = vn(w)), [g, w];
|
|
2244
2244
|
});
|
|
2245
2245
|
}
|
|
2246
|
-
u.sort(c === "asc" ? function(S,
|
|
2247
|
-
return
|
|
2248
|
-
} : function(S,
|
|
2249
|
-
return
|
|
2246
|
+
u.sort(c === "asc" ? function(S, g) {
|
|
2247
|
+
return Wt(S, g, f == null ? void 0 : f["checked-data-type"]);
|
|
2248
|
+
} : function(S, g) {
|
|
2249
|
+
return Wt(g, S, f == null ? void 0 : f["checked-data-type"]);
|
|
2250
2250
|
});
|
|
2251
2251
|
let p = {};
|
|
2252
2252
|
const y = ra(e, t, s);
|
|
@@ -2254,8 +2254,8 @@ function sa(n, e, { etype: t, pageInfo: r, dq: s, form: i }) {
|
|
|
2254
2254
|
const [S] = m;
|
|
2255
2255
|
if (p[S] || !a && l && f && Xo(l, f, c, m))
|
|
2256
2256
|
continue;
|
|
2257
|
-
const
|
|
2258
|
-
|
|
2257
|
+
const g = lo(n, y, S);
|
|
2258
|
+
g && (p[S] = g);
|
|
2259
2259
|
}
|
|
2260
2260
|
return p;
|
|
2261
2261
|
}
|
|
@@ -2270,15 +2270,15 @@ function Is(n) {
|
|
|
2270
2270
|
return !e && !t && !r;
|
|
2271
2271
|
}
|
|
2272
2272
|
function oa(n, e, { etype: t, level: r, form: s, join: i, pageInfo: o }) {
|
|
2273
|
-
var p, y, b,
|
|
2273
|
+
var p, y, b, _, m;
|
|
2274
2274
|
if (!Is(s) && (!o || !o["start-cursor"]))
|
|
2275
2275
|
return [];
|
|
2276
|
-
const a = qo(Qo(e, t, r, (p = s.$) == null ? void 0 : p.where), i), c = Ho(
|
|
2276
|
+
const a = qo(Qo(e, t, r, (p = s.$) == null ? void 0 : p.where), i), c = Ho(Vt, t, r), u = (y = s.$) == null ? void 0 : y.fields, l = sa(n, e, {
|
|
2277
2277
|
etype: t,
|
|
2278
2278
|
pageInfo: o,
|
|
2279
2279
|
form: s,
|
|
2280
2280
|
dq: { where: a, find: c, fields: u }
|
|
2281
|
-
}), f = ((b = s.$) == null ? void 0 : b.limit) || ((
|
|
2281
|
+
}), f = ((b = s.$) == null ? void 0 : b.limit) || ((_ = s.$) == null ? void 0 : _.first) || ((m = s.$) == null ? void 0 : m.last);
|
|
2282
2282
|
if (f != null) {
|
|
2283
2283
|
r > 0 && As && console.warn("WARNING: Limits in child queries are only run client-side. Data returned from the server will not have a limit.");
|
|
2284
2284
|
const S = Object.entries(l);
|
|
@@ -2297,7 +2297,7 @@ function aa(n, e, t) {
|
|
|
2297
2297
|
}
|
|
2298
2298
|
function Ps(n, e, t) {
|
|
2299
2299
|
const r = aa(n, e, t);
|
|
2300
|
-
return Yo(
|
|
2300
|
+
return Yo(Vt, n, e, t, r);
|
|
2301
2301
|
}
|
|
2302
2302
|
function ca(n) {
|
|
2303
2303
|
const e = {};
|
|
@@ -2336,7 +2336,7 @@ function ua() {
|
|
|
2336
2336
|
return new Set(Object.keys(e));
|
|
2337
2337
|
}
|
|
2338
2338
|
const la = ua();
|
|
2339
|
-
function
|
|
2339
|
+
function xt(n, e, t) {
|
|
2340
2340
|
const r = {
|
|
2341
2341
|
__etype: n,
|
|
2342
2342
|
__ops: t
|
|
@@ -2348,7 +2348,7 @@ function jt(n, e, t) {
|
|
|
2348
2348
|
if (i === "__etype")
|
|
2349
2349
|
return n;
|
|
2350
2350
|
if (la.has(i))
|
|
2351
|
-
return (o, a) =>
|
|
2351
|
+
return (o, a) => xt(n, e, [
|
|
2352
2352
|
...t,
|
|
2353
2353
|
a ? [i, n, e, o, a] : [i, n, e, o]
|
|
2354
2354
|
]);
|
|
@@ -2358,7 +2358,7 @@ function jt(n, e, t) {
|
|
|
2358
2358
|
function fa(n, e) {
|
|
2359
2359
|
return `lookup__${n}__${JSON.stringify(e)}`;
|
|
2360
2360
|
}
|
|
2361
|
-
function
|
|
2361
|
+
function Kt(n) {
|
|
2362
2362
|
return n.startsWith("lookup__");
|
|
2363
2363
|
}
|
|
2364
2364
|
function En(n) {
|
|
@@ -2371,11 +2371,11 @@ function da(n) {
|
|
|
2371
2371
|
}, {
|
|
2372
2372
|
get(e, t) {
|
|
2373
2373
|
if (t === "lookup")
|
|
2374
|
-
return (s, i) =>
|
|
2374
|
+
return (s, i) => xt(n, En(fa(s, i)), []);
|
|
2375
2375
|
if (t === "__etype")
|
|
2376
2376
|
return n;
|
|
2377
2377
|
const r = t;
|
|
2378
|
-
return
|
|
2378
|
+
return Kt(r) ? xt(n, En(r), []) : xt(n, r, []);
|
|
2379
2379
|
}
|
|
2380
2380
|
});
|
|
2381
2381
|
}
|
|
@@ -2420,7 +2420,7 @@ function ya(n) {
|
|
|
2420
2420
|
function ba(n, e, t) {
|
|
2421
2421
|
return t.indexOf(".") !== -1 && // attr names can have `.` in them, so use the attr we find with a `.`
|
|
2422
2422
|
// before assuming it's a ref lookup.
|
|
2423
|
-
!
|
|
2423
|
+
!V(n, e, t);
|
|
2424
2424
|
}
|
|
2425
2425
|
function On(n) {
|
|
2426
2426
|
const [e, t, ...r] = n.split(".");
|
|
@@ -2430,16 +2430,16 @@ function On(n) {
|
|
|
2430
2430
|
}
|
|
2431
2431
|
function ga(n, e, t) {
|
|
2432
2432
|
if (!ba(n, e, t))
|
|
2433
|
-
return
|
|
2434
|
-
const r = On(t), s =
|
|
2433
|
+
return V(n, e, t);
|
|
2434
|
+
const r = On(t), s = V(n, e, r) || Ke(n, e, r);
|
|
2435
2435
|
if (s && s["value-type"] !== "ref")
|
|
2436
2436
|
throw new Error(`${t} does not reference a valid link attribute.`);
|
|
2437
2437
|
return s;
|
|
2438
2438
|
}
|
|
2439
2439
|
function An(n) {
|
|
2440
|
-
return typeof n == "string" && !
|
|
2440
|
+
return typeof n == "string" && !Kt(n) ? null : typeof n == "string" && Kt(n) ? En(n) : ya(n);
|
|
2441
2441
|
}
|
|
2442
|
-
function
|
|
2442
|
+
function fe(n, e, t) {
|
|
2443
2443
|
const r = An(t);
|
|
2444
2444
|
if (r === null)
|
|
2445
2445
|
return t;
|
|
@@ -2450,52 +2450,52 @@ function le(n, e, t) {
|
|
|
2450
2450
|
}
|
|
2451
2451
|
function Rs(n, e, t, r) {
|
|
2452
2452
|
var o;
|
|
2453
|
-
const s =
|
|
2453
|
+
const s = fe(n, e, t);
|
|
2454
2454
|
return Array.isArray(s) ? [[
|
|
2455
2455
|
"add-triple",
|
|
2456
2456
|
s,
|
|
2457
|
-
(o =
|
|
2457
|
+
(o = V(n, e, "id")) == null ? void 0 : o.id,
|
|
2458
2458
|
s
|
|
2459
2459
|
]].concat(r) : r;
|
|
2460
2460
|
}
|
|
2461
2461
|
function _a({ attrsStore: n }, [e, t, r]) {
|
|
2462
2462
|
const s = Object.entries(r).flatMap(([i, o]) => {
|
|
2463
|
-
const a = Array.isArray(o) ? o : [o], c =
|
|
2463
|
+
const a = Array.isArray(o) ? o : [o], c = V(n, e, i), u = Ke(n, e, i);
|
|
2464
2464
|
return a.map((l) => c ? [
|
|
2465
2465
|
"add-triple",
|
|
2466
|
-
|
|
2466
|
+
fe(n, e, t),
|
|
2467
2467
|
c.id,
|
|
2468
2468
|
// Uses `!` because if we get here, we should have created the attr if it doesn't
|
|
2469
2469
|
// already exist
|
|
2470
|
-
|
|
2470
|
+
fe(n, c["reverse-identity"][1], l)
|
|
2471
2471
|
] : [
|
|
2472
2472
|
"add-triple",
|
|
2473
2473
|
// Uses `!` because if we get here, we should have created the attr if it doesn't
|
|
2474
2474
|
// already exist
|
|
2475
|
-
|
|
2475
|
+
fe(n, u["forward-identity"][1], l),
|
|
2476
2476
|
u == null ? void 0 : u.id,
|
|
2477
|
-
|
|
2477
|
+
fe(n, e, t)
|
|
2478
2478
|
]);
|
|
2479
2479
|
});
|
|
2480
2480
|
return Rs(n, e, t, s);
|
|
2481
2481
|
}
|
|
2482
2482
|
function ma({ attrsStore: n }, [e, t, r]) {
|
|
2483
2483
|
const s = Object.entries(r).flatMap(([i, o]) => {
|
|
2484
|
-
const a = Array.isArray(o) ? o : [o], c =
|
|
2484
|
+
const a = Array.isArray(o) ? o : [o], c = V(n, e, i), u = Ke(n, e, i);
|
|
2485
2485
|
return a.map((l) => c ? [
|
|
2486
2486
|
"retract-triple",
|
|
2487
|
-
|
|
2487
|
+
fe(n, e, t),
|
|
2488
2488
|
c.id,
|
|
2489
2489
|
// Uses `!` because if we get here, we should have created the attr if it doesn't
|
|
2490
2490
|
// already exist
|
|
2491
|
-
|
|
2491
|
+
fe(n, c["reverse-identity"][1], l)
|
|
2492
2492
|
] : [
|
|
2493
2493
|
"retract-triple",
|
|
2494
2494
|
// Uses `!` because if we get here, we should have created the attr if it doesn't
|
|
2495
2495
|
// already exist
|
|
2496
|
-
|
|
2496
|
+
fe(n, u["forward-identity"][1], l),
|
|
2497
2497
|
u.id,
|
|
2498
|
-
|
|
2498
|
+
fe(n, e, t)
|
|
2499
2499
|
]);
|
|
2500
2500
|
});
|
|
2501
2501
|
return Rs(n, e, t, s);
|
|
@@ -2507,7 +2507,7 @@ function wa(n, e, t, r) {
|
|
|
2507
2507
|
for (const a of n || []) {
|
|
2508
2508
|
const c = a == null ? void 0 : a.aev.get(i);
|
|
2509
2509
|
if (c) {
|
|
2510
|
-
for (const [u, l, f] of
|
|
2510
|
+
for (const [u, l, f] of le(c, 2))
|
|
2511
2511
|
if (f === o)
|
|
2512
2512
|
return !0;
|
|
2513
2513
|
}
|
|
@@ -2527,17 +2527,17 @@ function js({ stores: n, attrsStore: e }, [t, r, s, i]) {
|
|
|
2527
2527
|
return (i == null ? void 0 : i.upsert) === !1 ? { mode: "update" } : (i == null ? void 0 : i.upsert) === !0 ? null : wa(n, e, t, r) ? { mode: "update" } : null;
|
|
2528
2528
|
}
|
|
2529
2529
|
function Ta(n, e) {
|
|
2530
|
-
const { attrsStore: t } = n, [r, s, i, o] = e, a = Gn(i), c =
|
|
2530
|
+
const { attrsStore: t } = n, [r, s, i, o] = e, a = Gn(i), c = fe(t, r, s);
|
|
2531
2531
|
return [["id", c]].concat(Object.entries(a)).map(([l, f]) => {
|
|
2532
|
-
const p =
|
|
2533
|
-
return p["checked-data-type"] === "date" && n.useDateObjects && (f =
|
|
2532
|
+
const p = V(t, r, l);
|
|
2533
|
+
return p["checked-data-type"] === "date" && n.useDateObjects && (f = zt(f)), ["add-triple", c, p.id, f, { mode: "create" }];
|
|
2534
2534
|
});
|
|
2535
2535
|
}
|
|
2536
2536
|
function Sa(n, e) {
|
|
2537
|
-
const { attrsStore: t } = n, [r, s, i, o] = e, a = Gn(i), c =
|
|
2537
|
+
const { attrsStore: t } = n, [r, s, i, o] = e, a = Gn(i), c = fe(t, r, s), u = js(n, [r, c, i, o]);
|
|
2538
2538
|
return [["id", c]].concat(Object.entries(a)).map(([f, p]) => {
|
|
2539
|
-
const y =
|
|
2540
|
-
return y["checked-data-type"] === "date" && n.useDateObjects && (p =
|
|
2539
|
+
const y = V(t, r, f);
|
|
2540
|
+
return y["checked-data-type"] === "date" && n.useDateObjects && (p = zt(p)), [
|
|
2541
2541
|
"add-triple",
|
|
2542
2542
|
c,
|
|
2543
2543
|
y.id,
|
|
@@ -2547,11 +2547,11 @@ function Sa(n, e) {
|
|
|
2547
2547
|
});
|
|
2548
2548
|
}
|
|
2549
2549
|
function va({ attrsStore: n }, [e, t]) {
|
|
2550
|
-
return [["delete-entity",
|
|
2550
|
+
return [["delete-entity", fe(n, e, t), e]];
|
|
2551
2551
|
}
|
|
2552
2552
|
function Ea(n, e) {
|
|
2553
|
-
const { attrsStore: t } = n, [r, s, i, o] = e, a = Gn(i), c =
|
|
2554
|
-
const b =
|
|
2553
|
+
const { attrsStore: t } = n, [r, s, i, o] = e, a = Gn(i), c = fe(t, r, s), u = js(n, [r, c, i, o]), l = Object.entries(a).map(([p, y]) => {
|
|
2554
|
+
const b = V(t, r, p);
|
|
2555
2555
|
return [
|
|
2556
2556
|
"deep-merge-triple",
|
|
2557
2557
|
c,
|
|
@@ -2563,13 +2563,13 @@ function Ea(n, e) {
|
|
|
2563
2563
|
return [[
|
|
2564
2564
|
"add-triple",
|
|
2565
2565
|
c,
|
|
2566
|
-
|
|
2566
|
+
V(t, r, "id").id,
|
|
2567
2567
|
c,
|
|
2568
2568
|
...u ? [u] : []
|
|
2569
2569
|
]].concat(l);
|
|
2570
2570
|
}
|
|
2571
2571
|
function Oa({ attrsStore: n }, [e, t, r]) {
|
|
2572
|
-
return [["rule-params",
|
|
2572
|
+
return [["rule-params", fe(n, e, t), e, r]];
|
|
2573
2573
|
}
|
|
2574
2574
|
function Aa(n) {
|
|
2575
2575
|
const [e, t, r, s, i] = n;
|
|
@@ -2624,7 +2624,7 @@ function Ia(n, e, t) {
|
|
|
2624
2624
|
"checked-data-type": o
|
|
2625
2625
|
};
|
|
2626
2626
|
}
|
|
2627
|
-
function
|
|
2627
|
+
function kt(n, e, t, r) {
|
|
2628
2628
|
const s = n ? Ia(n, e, t) : null, i = W(), a = [W(), e, t];
|
|
2629
2629
|
return {
|
|
2630
2630
|
id: i,
|
|
@@ -2707,13 +2707,13 @@ function Ua(n) {
|
|
|
2707
2707
|
function La({ attrsStore: n, schema: e }, t) {
|
|
2708
2708
|
var p, y;
|
|
2709
2709
|
const r = /* @__PURE__ */ new Set(), s = [], i = [];
|
|
2710
|
-
function o(b,
|
|
2711
|
-
return
|
|
2710
|
+
function o(b, _) {
|
|
2711
|
+
return V(n, b, _) || s.find((m) => m["forward-identity"][1] === b && m["forward-identity"][2] === _);
|
|
2712
2712
|
}
|
|
2713
|
-
function a(b,
|
|
2714
|
-
return Ke(n, b,
|
|
2715
|
-
var S,
|
|
2716
|
-
return ((S = m["reverse-identity"]) == null ? void 0 : S[1]) === b && ((
|
|
2713
|
+
function a(b, _) {
|
|
2714
|
+
return Ke(n, b, _) || s.find((m) => {
|
|
2715
|
+
var S, g;
|
|
2716
|
+
return ((S = m["reverse-identity"]) == null ? void 0 : S[1]) === b && ((g = m["reverse-identity"]) == null ? void 0 : g[2]) === _;
|
|
2717
2717
|
});
|
|
2718
2718
|
}
|
|
2719
2719
|
function c(b) {
|
|
@@ -2722,54 +2722,54 @@ function La({ attrsStore: n, schema: e }, t) {
|
|
|
2722
2722
|
function u(b) {
|
|
2723
2723
|
b && "isUnsynced" in b && b.isUnsynced && !r.has(b.id) && (s.push(b), i.push(["add-attr", b]), r.add(b.id));
|
|
2724
2724
|
}
|
|
2725
|
-
function l(b,
|
|
2726
|
-
return
|
|
2725
|
+
function l(b, _) {
|
|
2726
|
+
return _.indexOf(".") !== -1 && // attr names can have `.` in them, so use the attr we find with a `.`
|
|
2727
2727
|
// before assuming it's a ref lookup.
|
|
2728
|
-
!o(b,
|
|
2728
|
+
!o(b, _);
|
|
2729
2729
|
}
|
|
2730
|
-
function f(b,
|
|
2731
|
-
const m = o(b,
|
|
2732
|
-
u(m), u(S), !m && !S && c(Pr(e, b,
|
|
2730
|
+
function f(b, _) {
|
|
2731
|
+
const m = o(b, _), S = a(b, _);
|
|
2732
|
+
u(m), u(S), !m && !S && c(Pr(e, b, _, Da));
|
|
2733
2733
|
}
|
|
2734
2734
|
for (const b of t)
|
|
2735
|
-
for (const { etype:
|
|
2736
|
-
const
|
|
2735
|
+
for (const { etype: _, lookupPair: m, linkLabel: S } of Ua(b)) {
|
|
2736
|
+
const g = m[0];
|
|
2737
2737
|
if (S) {
|
|
2738
|
-
f(
|
|
2739
|
-
const w = o(
|
|
2738
|
+
f(_, S);
|
|
2739
|
+
const w = o(_, S), O = a(_, S);
|
|
2740
2740
|
u(w), u(O);
|
|
2741
2741
|
const v = ((p = w == null ? void 0 : w["reverse-identity"]) == null ? void 0 : p[1]) || ((y = O == null ? void 0 : O["forward-identity"]) == null ? void 0 : y[1]) || S;
|
|
2742
|
-
if (l(v,
|
|
2743
|
-
f(v, On(
|
|
2742
|
+
if (l(v, g))
|
|
2743
|
+
f(v, On(g));
|
|
2744
2744
|
else {
|
|
2745
|
-
const
|
|
2746
|
-
|
|
2745
|
+
const C = o(v, g);
|
|
2746
|
+
C || c(kt(e, v, g, kn)), u(C);
|
|
2747
2747
|
}
|
|
2748
|
-
} else if (l(
|
|
2749
|
-
f(
|
|
2748
|
+
} else if (l(_, g))
|
|
2749
|
+
f(_, On(g));
|
|
2750
2750
|
else {
|
|
2751
|
-
const w = o(
|
|
2752
|
-
w || c(
|
|
2751
|
+
const w = o(_, g);
|
|
2752
|
+
w || c(kt(e, _, g, kn)), u(w);
|
|
2753
2753
|
}
|
|
2754
2754
|
}
|
|
2755
2755
|
for (const b of t) {
|
|
2756
|
-
const [
|
|
2757
|
-
if (Ra.has(
|
|
2756
|
+
const [_, m, S, g] = b;
|
|
2757
|
+
if (Ra.has(_)) {
|
|
2758
2758
|
const w = o(m, "id");
|
|
2759
|
-
u(w), w || c(
|
|
2760
|
-
for (const O of Object.keys(
|
|
2759
|
+
u(w), w || c(kt(e, m, "id", { "unique?": !0 }));
|
|
2760
|
+
for (const O of Object.keys(g)) {
|
|
2761
2761
|
const v = o(m, O);
|
|
2762
|
-
if (u(v), xa.has(
|
|
2763
|
-
const
|
|
2764
|
-
!v && !
|
|
2762
|
+
if (u(v), xa.has(_) && (v || c(kt(e, m, O, O === "id" ? { "unique?": !0 } : null))), ja.has(_)) {
|
|
2763
|
+
const C = a(m, O);
|
|
2764
|
+
!v && !C && c(Pr(e, m, O)), u(C);
|
|
2765
2765
|
}
|
|
2766
2766
|
}
|
|
2767
2767
|
}
|
|
2768
2768
|
}
|
|
2769
2769
|
if (s.length) {
|
|
2770
2770
|
const b = { ...n.attrs };
|
|
2771
|
-
for (const
|
|
2772
|
-
b[
|
|
2771
|
+
for (const _ of s)
|
|
2772
|
+
b[_.id] = _;
|
|
2773
2773
|
return [new Le(b, n.linkIndex), i];
|
|
2774
2774
|
}
|
|
2775
2775
|
return [n, i];
|
|
@@ -2958,13 +2958,13 @@ class Cn {
|
|
|
2958
2958
|
for (const [p, y] of Object.entries(r.objects))
|
|
2959
2959
|
!t.has(p) && y.updatedAt < o - this._gcOpts.maxAgeMs && (s.push(this._persister.removeItem(p)), delete r.objects[p], i.removed.push(p), i.removedOldCount++);
|
|
2960
2960
|
const a = Object.entries(r.objects);
|
|
2961
|
-
a.sort(([p, y], [b,
|
|
2961
|
+
a.sort(([p, y], [b, _]) => y.updatedAt - _.updatedAt);
|
|
2962
2962
|
const c = a.filter(([p]) => !t.has(p));
|
|
2963
2963
|
if (a.length > this._gcOpts.maxEntries)
|
|
2964
2964
|
for (const [p] of c.slice(0, a.length - this._gcOpts.maxEntries))
|
|
2965
2965
|
s.push(this._persister.removeItem(p)), delete r.objects[p], i.removed.push(p), i.removedThresholdCount++;
|
|
2966
2966
|
const u = Object.entries(r.objects);
|
|
2967
|
-
u.sort(([p, y], [b,
|
|
2967
|
+
u.sort(([p, y], [b, _]) => y.updatedAt - _.updatedAt);
|
|
2968
2968
|
const l = u.filter(([p]) => !t.has(p));
|
|
2969
2969
|
let f = u.reduce((p, [y, b]) => p + b.size, 0);
|
|
2970
2970
|
for (; f > 0 && f > this._gcOpts.maxSize && l.length; ) {
|
|
@@ -3008,7 +3008,7 @@ class Cn {
|
|
|
3008
3008
|
// so that we know which entries we need to persist to the store.
|
|
3009
3009
|
updateInPlace(e) {
|
|
3010
3010
|
this._version++;
|
|
3011
|
-
const [t, r] =
|
|
3011
|
+
const [t, r] = Nt(this.currentValue, e, {
|
|
3012
3012
|
enablePatches: !0
|
|
3013
3013
|
});
|
|
3014
3014
|
for (const s of r) {
|
|
@@ -3058,16 +3058,16 @@ async function Va(n, e, t) {
|
|
|
3058
3058
|
var l, f, p;
|
|
3059
3059
|
const a = {};
|
|
3060
3060
|
for (const [y, b] of Object.entries(r)) {
|
|
3061
|
-
const
|
|
3062
|
-
if (
|
|
3061
|
+
const _ = typeof b == "string" ? JSON.parse(b) : b;
|
|
3062
|
+
if (_.lastAccessed) {
|
|
3063
3063
|
const S = {
|
|
3064
|
-
createdAt:
|
|
3065
|
-
updatedAt:
|
|
3066
|
-
size: ((p = (f = (l =
|
|
3064
|
+
createdAt: _.lastAccessed,
|
|
3065
|
+
updatedAt: _.lastAccessed,
|
|
3066
|
+
size: ((p = (f = (l = _.result) == null ? void 0 : l.store) == null ? void 0 : f.triples) == null ? void 0 : p.length) ?? 0
|
|
3067
3067
|
};
|
|
3068
3068
|
a[y] = S;
|
|
3069
3069
|
}
|
|
3070
|
-
const m = t.put(
|
|
3070
|
+
const m = t.put(_, y);
|
|
3071
3071
|
s.add(m);
|
|
3072
3072
|
}
|
|
3073
3073
|
const c = { objects: a }, u = t.put(c, pt);
|
|
@@ -3095,14 +3095,14 @@ async function Ba(n, e) {
|
|
|
3095
3095
|
b.onerror = (m) => {
|
|
3096
3096
|
f(m);
|
|
3097
3097
|
};
|
|
3098
|
-
const
|
|
3098
|
+
const _ = [];
|
|
3099
3099
|
b.onsuccess = () => {
|
|
3100
3100
|
const m = b.result;
|
|
3101
3101
|
if (m) {
|
|
3102
|
-
const S = m.key,
|
|
3103
|
-
|
|
3102
|
+
const S = m.key, g = m.value;
|
|
3103
|
+
_.push([S, g]), m.continue();
|
|
3104
3104
|
} else
|
|
3105
|
-
l(
|
|
3105
|
+
l(_);
|
|
3106
3106
|
}, b.onerror = (m) => {
|
|
3107
3107
|
f(m);
|
|
3108
3108
|
};
|
|
@@ -3246,19 +3246,19 @@ class $s {
|
|
|
3246
3246
|
};
|
|
3247
3247
|
}
|
|
3248
3248
|
}
|
|
3249
|
-
class
|
|
3249
|
+
class se extends Error {
|
|
3250
3250
|
constructor(t, r) {
|
|
3251
3251
|
super(t);
|
|
3252
3252
|
h(this, "hint");
|
|
3253
3253
|
this.hint = r;
|
|
3254
3254
|
const s = new.target.prototype;
|
|
3255
|
-
Object.setPrototypeOf && Object.setPrototypeOf(this, s), Error.captureStackTrace && Error.captureStackTrace(this,
|
|
3255
|
+
Object.setPrototypeOf && Object.setPrototypeOf(this, s), Error.captureStackTrace && Error.captureStackTrace(this, se), this.name = "InstantError";
|
|
3256
3256
|
}
|
|
3257
3257
|
get [Symbol.toStringTag]() {
|
|
3258
3258
|
return "InstantError";
|
|
3259
3259
|
}
|
|
3260
3260
|
}
|
|
3261
|
-
class
|
|
3261
|
+
class Bt extends se {
|
|
3262
3262
|
constructor(t) {
|
|
3263
3263
|
var i;
|
|
3264
3264
|
const r = ((i = t.body) == null ? void 0 : i.message) || `API Error (${t.status})`;
|
|
@@ -3266,25 +3266,25 @@ class Vt extends ne {
|
|
|
3266
3266
|
h(this, "body");
|
|
3267
3267
|
h(this, "status");
|
|
3268
3268
|
const s = new.target.prototype;
|
|
3269
|
-
Object.setPrototypeOf && Object.setPrototypeOf(this, s), Error.captureStackTrace && Error.captureStackTrace(this,
|
|
3269
|
+
Object.setPrototypeOf && Object.setPrototypeOf(this, s), Error.captureStackTrace && Error.captureStackTrace(this, Bt), this.name = "InstantAPIError", this.status = t.status, this.body = t.body;
|
|
3270
3270
|
}
|
|
3271
3271
|
get [Symbol.toStringTag]() {
|
|
3272
3272
|
return "InstantAPIError";
|
|
3273
3273
|
}
|
|
3274
3274
|
}
|
|
3275
|
-
async function
|
|
3275
|
+
async function Se(n, e) {
|
|
3276
3276
|
const t = await fetch(n, e), r = await t.json();
|
|
3277
|
-
return t.status === 200 ? Promise.resolve(r) : Promise.reject(new
|
|
3277
|
+
return t.status === 200 ? Promise.resolve(r) : Promise.reject(new Bt({ status: t.status, body: r }));
|
|
3278
3278
|
}
|
|
3279
3279
|
function Ga({ apiURI: n, appId: e, email: t }) {
|
|
3280
|
-
return
|
|
3280
|
+
return Se(`${n}/runtime/auth/send_magic_code`, {
|
|
3281
3281
|
method: "POST",
|
|
3282
3282
|
headers: { "content-type": "application/json" },
|
|
3283
3283
|
body: JSON.stringify({ "app-id": e, email: t })
|
|
3284
3284
|
});
|
|
3285
3285
|
}
|
|
3286
3286
|
async function Qa({ apiURI: n, appId: e, email: t, code: r, refreshToken: s }) {
|
|
3287
|
-
return await
|
|
3287
|
+
return await Se(`${n}/runtime/auth/verify_magic_code`, {
|
|
3288
3288
|
method: "POST",
|
|
3289
3289
|
headers: { "content-type": "application/json" },
|
|
3290
3290
|
body: JSON.stringify({
|
|
@@ -3296,7 +3296,7 @@ async function Qa({ apiURI: n, appId: e, email: t, code: r, refreshToken: s }) {
|
|
|
3296
3296
|
});
|
|
3297
3297
|
}
|
|
3298
3298
|
async function Ha({ apiURI: n, appId: e, refreshToken: t }) {
|
|
3299
|
-
return await
|
|
3299
|
+
return await Se(`${n}/runtime/auth/verify_refresh_token`, {
|
|
3300
3300
|
method: "POST",
|
|
3301
3301
|
headers: { "content-type": "application/json" },
|
|
3302
3302
|
body: JSON.stringify({
|
|
@@ -3306,7 +3306,7 @@ async function Ha({ apiURI: n, appId: e, refreshToken: t }) {
|
|
|
3306
3306
|
});
|
|
3307
3307
|
}
|
|
3308
3308
|
async function Ja({ apiURI: n, appId: e }) {
|
|
3309
|
-
return await
|
|
3309
|
+
return await Se(`${n}/runtime/auth/sign_in_guest`, {
|
|
3310
3310
|
method: "POST",
|
|
3311
3311
|
headers: { "content-type": "application/json" },
|
|
3312
3312
|
body: JSON.stringify({
|
|
@@ -3315,7 +3315,7 @@ async function Ja({ apiURI: n, appId: e }) {
|
|
|
3315
3315
|
});
|
|
3316
3316
|
}
|
|
3317
3317
|
async function xr({ apiURI: n, appId: e, code: t, codeVerifier: r, refreshToken: s }) {
|
|
3318
|
-
return await
|
|
3318
|
+
return await Se(`${n}/runtime/oauth/token`, {
|
|
3319
3319
|
method: "POST",
|
|
3320
3320
|
headers: { "content-type": "application/json" },
|
|
3321
3321
|
body: JSON.stringify({
|
|
@@ -3327,7 +3327,7 @@ async function xr({ apiURI: n, appId: e, code: t, codeVerifier: r, refreshToken:
|
|
|
3327
3327
|
});
|
|
3328
3328
|
}
|
|
3329
3329
|
async function Ya({ apiURI: n, appId: e, nonce: t, idToken: r, clientName: s, refreshToken: i }) {
|
|
3330
|
-
return await
|
|
3330
|
+
return await Se(`${n}/runtime/oauth/id_token`, {
|
|
3331
3331
|
method: "POST",
|
|
3332
3332
|
headers: { "content-type": "application/json" },
|
|
3333
3333
|
body: JSON.stringify({
|
|
@@ -3340,7 +3340,7 @@ async function Ya({ apiURI: n, appId: e, nonce: t, idToken: r, clientName: s, re
|
|
|
3340
3340
|
});
|
|
3341
3341
|
}
|
|
3342
3342
|
async function Za({ apiURI: n, appId: e, refreshToken: t }) {
|
|
3343
|
-
return await
|
|
3343
|
+
return await Se(`${n}/runtime/signout`, {
|
|
3344
3344
|
method: "POST",
|
|
3345
3345
|
headers: {
|
|
3346
3346
|
"content-type": "application/json"
|
|
@@ -3358,14 +3358,14 @@ async function Xa({ apiURI: n, appId: e, path: t, file: r, refreshToken: s, cont
|
|
|
3358
3358
|
authorization: `Bearer ${s}`,
|
|
3359
3359
|
"content-type": i || r.type
|
|
3360
3360
|
};
|
|
3361
|
-
return o && (a["content-disposition"] = o), await
|
|
3361
|
+
return o && (a["content-disposition"] = o), await Se(`${n}/storage/upload`, {
|
|
3362
3362
|
method: "PUT",
|
|
3363
3363
|
headers: a,
|
|
3364
3364
|
body: r
|
|
3365
3365
|
});
|
|
3366
3366
|
}
|
|
3367
3367
|
async function ec({ apiURI: n, appId: e, path: t, refreshToken: r }) {
|
|
3368
|
-
const { data: s } = await
|
|
3368
|
+
const { data: s } = await Se(`${n}/storage/files?app_id=${e}&filename=${encodeURIComponent(t)}`, {
|
|
3369
3369
|
method: "DELETE",
|
|
3370
3370
|
headers: {
|
|
3371
3371
|
"content-type": "application/json",
|
|
@@ -3375,7 +3375,7 @@ async function ec({ apiURI: n, appId: e, path: t, refreshToken: r }) {
|
|
|
3375
3375
|
return s;
|
|
3376
3376
|
}
|
|
3377
3377
|
async function tc({ apiURI: n, appId: e, fileName: t, refreshToken: r, metadata: s = {} }) {
|
|
3378
|
-
const { data: i } = await
|
|
3378
|
+
const { data: i } = await Se(`${n}/storage/signed-upload-url`, {
|
|
3379
3379
|
method: "POST",
|
|
3380
3380
|
headers: {
|
|
3381
3381
|
"content-type": "application/json",
|
|
@@ -3398,7 +3398,7 @@ async function nc(n, e) {
|
|
|
3398
3398
|
})).ok;
|
|
3399
3399
|
}
|
|
3400
3400
|
async function rc({ apiURI: n, appId: e, path: t, refreshToken: r }) {
|
|
3401
|
-
const { data: s } = await
|
|
3401
|
+
const { data: s } = await Se(`${n}/storage/signed-download-url?app_id=${e}&filename=${encodeURIComponent(t)}`, {
|
|
3402
3402
|
method: "GET",
|
|
3403
3403
|
headers: {
|
|
3404
3404
|
"content-type": "application/json",
|
|
@@ -3485,7 +3485,7 @@ function Lr(n) {
|
|
|
3485
3485
|
}, e;
|
|
3486
3486
|
}, {});
|
|
3487
3487
|
}
|
|
3488
|
-
const Xn = "v0.22.
|
|
3488
|
+
const Xn = "v0.22.150-branch-stream-fixes.22600975156.1";
|
|
3489
3489
|
function oc(n, e) {
|
|
3490
3490
|
return {
|
|
3491
3491
|
info: n ? (...t) => console.info(...t, e()) : () => {
|
|
@@ -3496,7 +3496,7 @@ function oc(n, e) {
|
|
|
3496
3496
|
}
|
|
3497
3497
|
};
|
|
3498
3498
|
}
|
|
3499
|
-
class
|
|
3499
|
+
class ie {
|
|
3500
3500
|
constructor(e, t, r, s = { indexed: !1, unique: !1 }) {
|
|
3501
3501
|
h(this, "valueType");
|
|
3502
3502
|
h(this, "required");
|
|
@@ -3511,35 +3511,35 @@ class re {
|
|
|
3511
3511
|
* and enforced for backend
|
|
3512
3512
|
*/
|
|
3513
3513
|
clientRequired() {
|
|
3514
|
-
return new
|
|
3514
|
+
return new ie(this.valueType, !1, this.isIndexed, this.config);
|
|
3515
3515
|
}
|
|
3516
3516
|
optional() {
|
|
3517
|
-
return new
|
|
3517
|
+
return new ie(this.valueType, !1, this.isIndexed, this.config);
|
|
3518
3518
|
}
|
|
3519
3519
|
unique() {
|
|
3520
|
-
return new
|
|
3520
|
+
return new ie(this.valueType, this.required, this.isIndexed, {
|
|
3521
3521
|
...this.config,
|
|
3522
3522
|
unique: !0
|
|
3523
3523
|
});
|
|
3524
3524
|
}
|
|
3525
3525
|
indexed() {
|
|
3526
|
-
return new
|
|
3526
|
+
return new ie(this.valueType, this.required, !0, {
|
|
3527
3527
|
...this.config,
|
|
3528
3528
|
indexed: !0
|
|
3529
3529
|
});
|
|
3530
3530
|
}
|
|
3531
3531
|
}
|
|
3532
|
-
class
|
|
3532
|
+
class Gt {
|
|
3533
3533
|
constructor(e, t) {
|
|
3534
3534
|
h(this, "attrs");
|
|
3535
3535
|
h(this, "links");
|
|
3536
3536
|
this.attrs = e, this.links = t;
|
|
3537
3537
|
}
|
|
3538
3538
|
asType() {
|
|
3539
|
-
return new
|
|
3539
|
+
return new Gt(this.attrs, this.links);
|
|
3540
3540
|
}
|
|
3541
3541
|
}
|
|
3542
|
-
class
|
|
3542
|
+
class Qt {
|
|
3543
3543
|
constructor(e, t, r) {
|
|
3544
3544
|
h(this, "entities");
|
|
3545
3545
|
h(this, "links");
|
|
@@ -3566,7 +3566,7 @@ class Gt {
|
|
|
3566
3566
|
* @see https://instantdb.com/docs/presence-and-topics#typesafety
|
|
3567
3567
|
*/
|
|
3568
3568
|
withRoomSchema() {
|
|
3569
|
-
return new
|
|
3569
|
+
return new Qt(this.entities, this.links, {});
|
|
3570
3570
|
}
|
|
3571
3571
|
}
|
|
3572
3572
|
class F extends Error {
|
|
@@ -3665,14 +3665,14 @@ const Fr = [
|
|
|
3665
3665
|
if (a === "id") {
|
|
3666
3666
|
if (typeof e == "string" && !Xe(e))
|
|
3667
3667
|
throw new F(`Invalid value for id field in entity '${o}'. Expected a UUID, but received: ${e}`, s);
|
|
3668
|
-
Ye(e, n, new
|
|
3668
|
+
Ye(e, n, new ie("string", !1, !0), t, s);
|
|
3669
3669
|
return;
|
|
3670
3670
|
}
|
|
3671
3671
|
const u = c.attrs[a];
|
|
3672
3672
|
if (Object.keys(c.links).includes(a)) {
|
|
3673
3673
|
if (typeof e == "string" && !Xe(e))
|
|
3674
3674
|
throw new F(`Invalid value for link '${a}' in entity '${o}'. Expected a UUID, but received: ${e}`, s);
|
|
3675
|
-
Ye(e, n, new
|
|
3675
|
+
Ye(e, n, new ie("string", !1, !0), t, s);
|
|
3676
3676
|
return;
|
|
3677
3677
|
}
|
|
3678
3678
|
if (!u) {
|
|
@@ -3689,7 +3689,7 @@ const Fr = [
|
|
|
3689
3689
|
continue;
|
|
3690
3690
|
}
|
|
3691
3691
|
if (s === "id") {
|
|
3692
|
-
Ye(i, "id", new
|
|
3692
|
+
Ye(i, "id", new ie("string", !1, !0), e, `${r}.id`);
|
|
3693
3693
|
continue;
|
|
3694
3694
|
}
|
|
3695
3695
|
if (s.includes(".")) {
|
|
@@ -3709,7 +3709,7 @@ const Fr = [
|
|
|
3709
3709
|
else if (c) {
|
|
3710
3710
|
if (typeof i == "string" && !Xe(i))
|
|
3711
3711
|
throw new F(`Invalid value for link '${s}' in entity '${e}'. Expected a UUID, but received: ${i}`, `${r}.${s}`);
|
|
3712
|
-
const u = new
|
|
3712
|
+
const u = new ie("string", !1, !0);
|
|
3713
3713
|
Ye(i, s, u, e, `${r}.${s}`);
|
|
3714
3714
|
}
|
|
3715
3715
|
}
|
|
@@ -3773,13 +3773,13 @@ const Fr = [
|
|
|
3773
3773
|
Ws(t[r], r, e, r, 0);
|
|
3774
3774
|
}
|
|
3775
3775
|
}
|
|
3776
|
-
}, Wr = (n) => typeof n != "string" ? !1 :
|
|
3777
|
-
class
|
|
3776
|
+
}, Wr = (n) => typeof n != "string" ? !1 : Kt(n) ? !0 : Xe(n);
|
|
3777
|
+
class be extends Error {
|
|
3778
3778
|
constructor(e) {
|
|
3779
3779
|
super(e), this.name = "TransactionValidationError";
|
|
3780
3780
|
}
|
|
3781
3781
|
}
|
|
3782
|
-
const Ks = (n) => n.length > 0 ? n.join(", ") : "none", fc = (n, e) => new
|
|
3782
|
+
const Ks = (n) => n.length > 0 ? n.join(", ") : "none", fc = (n, e) => new be(`Entity '${n}' does not exist in schema. Available entities: ${Ks(e)}`), on = {
|
|
3783
3783
|
string: (n) => typeof n == "string",
|
|
3784
3784
|
number: (n) => typeof n == "number" && !isNaN(n),
|
|
3785
3785
|
boolean: (n) => typeof n == "boolean",
|
|
@@ -3796,30 +3796,30 @@ const Ks = (n) => n.length > 0 ? n.join(", ") : "none", fc = (n, e) => new ye(`E
|
|
|
3796
3796
|
}, an = (n, e, t) => {
|
|
3797
3797
|
const r = qs(n, t);
|
|
3798
3798
|
if (typeof e != "object" || e === null)
|
|
3799
|
-
throw new
|
|
3799
|
+
throw new be(`Arguments for data operation on entity '${n}' must be an object, but received: ${typeof e}`);
|
|
3800
3800
|
for (const [s, i] of Object.entries(e)) {
|
|
3801
3801
|
if (s === "id")
|
|
3802
3802
|
continue;
|
|
3803
3803
|
const o = r.attrs[s];
|
|
3804
3804
|
if (o && !dc(i, o))
|
|
3805
|
-
throw new
|
|
3805
|
+
throw new be(`Invalid value for attribute '${s}' in entity '${n}'. Expected ${o.valueType}, but received: ${typeof i}`);
|
|
3806
3806
|
}
|
|
3807
3807
|
}, Kr = (n, e, t) => {
|
|
3808
3808
|
const r = qs(n, t);
|
|
3809
3809
|
if (typeof e != "object" || e === null)
|
|
3810
|
-
throw new
|
|
3810
|
+
throw new be(`Arguments for link operation on entity '${n}' must be an object, but received: ${typeof e}`);
|
|
3811
3811
|
for (const [s, i] of Object.entries(e)) {
|
|
3812
3812
|
if (!r.links[s]) {
|
|
3813
3813
|
const a = Object.keys(r.links);
|
|
3814
|
-
throw new
|
|
3814
|
+
throw new be(`Link '${s}' does not exist on entity '${n}'. Available links: ${Ks(a)}`);
|
|
3815
3815
|
}
|
|
3816
3816
|
if (i != null) {
|
|
3817
3817
|
if (Array.isArray(i)) {
|
|
3818
3818
|
for (const a of i)
|
|
3819
3819
|
if (!Wr(a))
|
|
3820
|
-
throw new
|
|
3820
|
+
throw new be(`Invalid entity ID in link '${s}' for entity '${n}'. Expected a UUID or a lookup, but received: ${a}`);
|
|
3821
3821
|
} else if (!Wr(i))
|
|
3822
|
-
throw new
|
|
3822
|
+
throw new be(`Invalid UUID in link '${s}' for entity '${n}'. Expected a UUID, but received: ${i}`);
|
|
3823
3823
|
}
|
|
3824
3824
|
}
|
|
3825
3825
|
}, hc = {
|
|
@@ -3835,21 +3835,21 @@ const Ks = (n) => n.length > 0 ? n.join(", ") : "none", fc = (n, e) => new ye(`E
|
|
|
3835
3835
|
return;
|
|
3836
3836
|
const [t, r, s, i] = n;
|
|
3837
3837
|
if (!Array.isArray(s) && !Xe(s))
|
|
3838
|
-
throw new
|
|
3838
|
+
throw new be(`Invalid id for entity '${r}'. Expected a UUID, but received: ${s}`);
|
|
3839
3839
|
if (typeof r != "string")
|
|
3840
|
-
throw new
|
|
3840
|
+
throw new be(`Entity name must be a string, but received: ${typeof r}`);
|
|
3841
3841
|
const o = hc[t];
|
|
3842
3842
|
o && i !== void 0 && o(r, i, e);
|
|
3843
3843
|
}, yc = (n, e) => {
|
|
3844
3844
|
const t = Array.isArray(n) ? n : [n];
|
|
3845
3845
|
for (const r of t) {
|
|
3846
3846
|
if (!r || typeof r != "object")
|
|
3847
|
-
throw new
|
|
3847
|
+
throw new be(`Transaction chunk must be an object, but received: ${typeof r}`);
|
|
3848
3848
|
if (!Array.isArray(r.__ops))
|
|
3849
|
-
throw new
|
|
3849
|
+
throw new be(`Transaction chunk must have __ops array, but received: ${typeof r.__ops}`);
|
|
3850
3850
|
for (const s of r.__ops) {
|
|
3851
3851
|
if (!Array.isArray(s))
|
|
3852
|
-
throw new
|
|
3852
|
+
throw new be(`Transaction operation must be an array, but received: ${typeof s}`);
|
|
3853
3853
|
pc(s, e);
|
|
3854
3854
|
}
|
|
3855
3855
|
}
|
|
@@ -4024,7 +4024,7 @@ function cn(n, e, t) {
|
|
|
4024
4024
|
}
|
|
4025
4025
|
function zr(n, e, t, r) {
|
|
4026
4026
|
var o;
|
|
4027
|
-
const s = (o =
|
|
4027
|
+
const s = (o = V(t, n.table, "id")) == null ? void 0 : o.id;
|
|
4028
4028
|
if (!s)
|
|
4029
4029
|
return -1;
|
|
4030
4030
|
const i = tt(e.eav, [r, s, r]);
|
|
@@ -4066,14 +4066,14 @@ function wc(n, e, t) {
|
|
|
4066
4066
|
u === l && delete a[c];
|
|
4067
4067
|
return r;
|
|
4068
4068
|
}
|
|
4069
|
-
function
|
|
4069
|
+
function Ct(n, e) {
|
|
4070
4070
|
return { [n.table]: e.map((t) => t.entity) };
|
|
4071
4071
|
}
|
|
4072
4072
|
function Tc(n, e) {
|
|
4073
4073
|
var r;
|
|
4074
4074
|
if (n.orderFieldType)
|
|
4075
4075
|
return n.orderFieldType;
|
|
4076
|
-
const t = n.orderField === "serverCreatedAt" ? "number" : (r =
|
|
4076
|
+
const t = n.orderField === "serverCreatedAt" ? "number" : (r = V(e(), n.table, n.orderField)) == null ? void 0 : r["checked-data-type"];
|
|
4077
4077
|
return n.orderFieldType = t, t;
|
|
4078
4078
|
}
|
|
4079
4079
|
function Sc(n, e, t) {
|
|
@@ -4175,7 +4175,7 @@ class vc {
|
|
|
4175
4175
|
if (s && s.state && s.state.txId) {
|
|
4176
4176
|
this.sendResync(s, s.state, s.state.txId), (u = s.values) != null && u.entities && r && r({
|
|
4177
4177
|
type: xe.LoadFromStorage,
|
|
4178
|
-
data:
|
|
4178
|
+
data: Ct(s, (l = s.values) == null ? void 0 : l.entities)
|
|
4179
4179
|
});
|
|
4180
4180
|
return;
|
|
4181
4181
|
}
|
|
@@ -4244,7 +4244,7 @@ class vc {
|
|
|
4244
4244
|
u[s] = o, u[s].updatedAt = Date.now();
|
|
4245
4245
|
}), o.values && this.notifyCbs(s, {
|
|
4246
4246
|
type: xe.InitialSyncBatch,
|
|
4247
|
-
data:
|
|
4247
|
+
data: Ct(o, o.values.entities),
|
|
4248
4248
|
batch: i
|
|
4249
4249
|
});
|
|
4250
4250
|
}
|
|
@@ -4269,7 +4269,7 @@ class vc {
|
|
|
4269
4269
|
const s = this.subs.currentValue[r];
|
|
4270
4270
|
s && this.notifyCbs(r, {
|
|
4271
4271
|
type: xe.InitialSyncComplete,
|
|
4272
|
-
data:
|
|
4272
|
+
data: Ct(s, ((i = s.values) == null ? void 0 : i.entities) || [])
|
|
4273
4273
|
});
|
|
4274
4274
|
}
|
|
4275
4275
|
onSyncUpdateTriples(e) {
|
|
@@ -4305,8 +4305,8 @@ class vc {
|
|
|
4305
4305
|
s.values = l;
|
|
4306
4306
|
const p = [];
|
|
4307
4307
|
e: for (const [m, S] of Object.entries(u))
|
|
4308
|
-
for (let
|
|
4309
|
-
const w = f[
|
|
4308
|
+
for (let g = 0; g < f.length; g++) {
|
|
4309
|
+
const w = f[g];
|
|
4310
4310
|
if (to(w.store, m)) {
|
|
4311
4311
|
Vr(w.store, l.attrsStore, S);
|
|
4312
4312
|
const O = cn(s, w.store, l.attrsStore), v = wc(w.store, l.attrsStore, S)[m];
|
|
@@ -4314,36 +4314,36 @@ class vc {
|
|
|
4314
4314
|
oldEntity: w.entity,
|
|
4315
4315
|
newEntity: O,
|
|
4316
4316
|
changedFields: v || {}
|
|
4317
|
-
}), w.entity = O) : c.push(
|
|
4317
|
+
}), w.entity = O) : c.push(g), delete u[m];
|
|
4318
4318
|
continue e;
|
|
4319
4319
|
}
|
|
4320
4320
|
}
|
|
4321
4321
|
const y = [];
|
|
4322
4322
|
for (const [m, S] of Object.entries(u)) {
|
|
4323
|
-
const
|
|
4324
|
-
Vr(
|
|
4325
|
-
const w = cn(s,
|
|
4323
|
+
const g = this.createStore([]);
|
|
4324
|
+
Vr(g, l.attrsStore, S);
|
|
4325
|
+
const w = cn(s, g, l.attrsStore);
|
|
4326
4326
|
if (!w) {
|
|
4327
4327
|
this.log.error("No entity found after applying change", {
|
|
4328
4328
|
sub: s,
|
|
4329
4329
|
changes: S,
|
|
4330
|
-
store:
|
|
4330
|
+
store: g
|
|
4331
4331
|
});
|
|
4332
4332
|
continue;
|
|
4333
4333
|
}
|
|
4334
4334
|
f.push({
|
|
4335
|
-
store:
|
|
4335
|
+
store: g,
|
|
4336
4336
|
entity: w,
|
|
4337
|
-
serverCreatedAt: zr(s,
|
|
4337
|
+
serverCreatedAt: zr(s, g, l.attrsStore, w.id)
|
|
4338
4338
|
}), y.push(w);
|
|
4339
4339
|
}
|
|
4340
4340
|
const b = [];
|
|
4341
4341
|
for (const m of c.sort().reverse())
|
|
4342
4342
|
b.push(f[m].entity), f.splice(m, 1);
|
|
4343
|
-
const
|
|
4344
|
-
Sc(s,
|
|
4343
|
+
const _ = Tc(s, this.getAttrs);
|
|
4344
|
+
Sc(s, _, f), this.notifyCbs(r, {
|
|
4345
4345
|
type: xe.SyncTransaction,
|
|
4346
|
-
data:
|
|
4346
|
+
data: Ct(s, (o = s.values) == null ? void 0 : o.entities),
|
|
4347
4347
|
added: y,
|
|
4348
4348
|
removed: b,
|
|
4349
4349
|
updated: p
|
|
@@ -4384,200 +4384,200 @@ class vc {
|
|
|
4384
4384
|
}
|
|
4385
4385
|
function Ec({ WStream: n, opts: e, startStream: t, appendStream: r, registerStream: s }) {
|
|
4386
4386
|
const i = e.clientId;
|
|
4387
|
-
let o = null, a = null;
|
|
4388
|
-
const
|
|
4389
|
-
let
|
|
4390
|
-
const
|
|
4391
|
-
let
|
|
4392
|
-
const
|
|
4393
|
-
function
|
|
4394
|
-
|
|
4395
|
-
for (const
|
|
4396
|
-
|
|
4397
|
-
}
|
|
4398
|
-
function
|
|
4399
|
-
return
|
|
4400
|
-
const
|
|
4401
|
-
|
|
4387
|
+
let o = null, a = null, c = null;
|
|
4388
|
+
const u = W();
|
|
4389
|
+
let l = !1, f = !1;
|
|
4390
|
+
const p = [], y = [], b = [];
|
|
4391
|
+
let _ = !1, m = 0, S = 0;
|
|
4392
|
+
const g = [], w = new TextEncoder();
|
|
4393
|
+
function O() {
|
|
4394
|
+
f = !0;
|
|
4395
|
+
for (const A of p)
|
|
4396
|
+
A(a ?? void 0);
|
|
4397
|
+
}
|
|
4398
|
+
function v(A) {
|
|
4399
|
+
return p.push(A), f && A(a ?? void 0), () => {
|
|
4400
|
+
const I = p.indexOf(A);
|
|
4401
|
+
I !== -1 && p.splice(I, 1);
|
|
4402
4402
|
};
|
|
4403
4403
|
}
|
|
4404
|
-
function
|
|
4405
|
-
return
|
|
4406
|
-
const
|
|
4407
|
-
|
|
4404
|
+
function C(A) {
|
|
4405
|
+
return b.push(A), () => {
|
|
4406
|
+
const I = b.indexOf(A);
|
|
4407
|
+
I !== -1 && b.splice(I, 1);
|
|
4408
4408
|
};
|
|
4409
4409
|
}
|
|
4410
|
-
e.waitUntil && e.waitUntil(new Promise((
|
|
4411
|
-
|
|
4410
|
+
e.waitUntil && e.waitUntil(new Promise((A) => {
|
|
4411
|
+
b.push(A);
|
|
4412
4412
|
}));
|
|
4413
|
-
function
|
|
4414
|
-
for (const
|
|
4413
|
+
function j() {
|
|
4414
|
+
for (const A of b)
|
|
4415
4415
|
try {
|
|
4416
|
-
|
|
4416
|
+
A();
|
|
4417
4417
|
} catch {
|
|
4418
4418
|
}
|
|
4419
4419
|
}
|
|
4420
|
-
function
|
|
4421
|
-
return
|
|
4422
|
-
const
|
|
4423
|
-
|
|
4420
|
+
function U(A) {
|
|
4421
|
+
return y.push(A), o && A(o), () => {
|
|
4422
|
+
const I = y.indexOf(A);
|
|
4423
|
+
I !== -1 && y.splice(I, 1);
|
|
4424
4424
|
};
|
|
4425
4425
|
}
|
|
4426
|
-
function
|
|
4427
|
-
o =
|
|
4428
|
-
for (const
|
|
4429
|
-
|
|
4426
|
+
function B(A) {
|
|
4427
|
+
o = A;
|
|
4428
|
+
for (const I of y)
|
|
4429
|
+
I(o);
|
|
4430
4430
|
}
|
|
4431
|
-
function
|
|
4432
|
-
|
|
4431
|
+
function pe() {
|
|
4432
|
+
_ = !0;
|
|
4433
4433
|
}
|
|
4434
|
-
function
|
|
4435
|
-
let
|
|
4436
|
-
for (const { byteLen:
|
|
4437
|
-
const
|
|
4438
|
-
if (
|
|
4434
|
+
function Me(A) {
|
|
4435
|
+
let I = m, Q = 0, J = 0;
|
|
4436
|
+
for (const { byteLen: oe } of g) {
|
|
4437
|
+
const ge = I + oe;
|
|
4438
|
+
if (ge > A)
|
|
4439
4439
|
break;
|
|
4440
|
-
|
|
4440
|
+
I = ge, Q++, J += oe;
|
|
4441
4441
|
}
|
|
4442
|
-
Q > 0 && (
|
|
4442
|
+
Q > 0 && (m += J, S -= J, g.splice(0, Q));
|
|
4443
4443
|
}
|
|
4444
|
-
function
|
|
4445
|
-
|
|
4444
|
+
function ee(A, I) {
|
|
4445
|
+
a = I, O(), A.error(I), j();
|
|
4446
4446
|
}
|
|
4447
|
-
async function
|
|
4448
|
-
const
|
|
4447
|
+
async function te() {
|
|
4448
|
+
const A = await t({
|
|
4449
4449
|
clientId: i,
|
|
4450
|
-
reconnectToken:
|
|
4450
|
+
reconnectToken: u,
|
|
4451
4451
|
ruleParams: e.ruleParams
|
|
4452
4452
|
});
|
|
4453
|
-
switch (
|
|
4453
|
+
switch (A.type) {
|
|
4454
4454
|
case "ok": {
|
|
4455
|
-
const { streamId:
|
|
4456
|
-
o =
|
|
4457
|
-
streamId:
|
|
4458
|
-
chunks:
|
|
4459
|
-
offset:
|
|
4460
|
-
}),
|
|
4455
|
+
const { streamId: I, offset: Q } = A;
|
|
4456
|
+
o = I, Me(Q), g.length && r({
|
|
4457
|
+
streamId: I,
|
|
4458
|
+
chunks: g.map((J) => J.chunk),
|
|
4459
|
+
offset: m
|
|
4460
|
+
}), _ = !1;
|
|
4461
4461
|
break;
|
|
4462
4462
|
}
|
|
4463
4463
|
case "disconnect": {
|
|
4464
|
-
|
|
4464
|
+
pe();
|
|
4465
4465
|
break;
|
|
4466
4466
|
}
|
|
4467
4467
|
case "error": {
|
|
4468
|
-
|
|
4468
|
+
c && ee(c, A.error);
|
|
4469
4469
|
break;
|
|
4470
4470
|
}
|
|
4471
4471
|
}
|
|
4472
4472
|
}
|
|
4473
|
-
function
|
|
4474
|
-
|
|
4473
|
+
function L() {
|
|
4474
|
+
pe(), te();
|
|
4475
4475
|
}
|
|
4476
|
-
function
|
|
4477
|
-
|
|
4476
|
+
function X({ offset: A, done: I }) {
|
|
4477
|
+
Me(A), I && (l = !0, j());
|
|
4478
4478
|
}
|
|
4479
|
-
function
|
|
4480
|
-
return
|
|
4479
|
+
function ve(A) {
|
|
4480
|
+
return l ? (ee(A, new se("Stream has been closed.")), null) : o || (ee(A, new se("Stream has not been initialized.")), null);
|
|
4481
4481
|
}
|
|
4482
|
-
async function
|
|
4483
|
-
|
|
4484
|
-
let
|
|
4485
|
-
for (;
|
|
4482
|
+
async function Re(A) {
|
|
4483
|
+
c = A;
|
|
4484
|
+
let I = !0, Q = 0;
|
|
4485
|
+
for (; I; ) {
|
|
4486
4486
|
let J = Date.now() + Math.min(15e3, 500 * (Q - 1));
|
|
4487
|
-
|
|
4488
|
-
const
|
|
4487
|
+
I = !1;
|
|
4488
|
+
const oe = await t({
|
|
4489
4489
|
clientId: e.clientId,
|
|
4490
|
-
reconnectToken:
|
|
4490
|
+
reconnectToken: u,
|
|
4491
4491
|
ruleParams: e.ruleParams
|
|
4492
4492
|
});
|
|
4493
|
-
switch (
|
|
4493
|
+
switch (oe.type) {
|
|
4494
4494
|
case "ok": {
|
|
4495
|
-
const { streamId:
|
|
4495
|
+
const { streamId: ge, offset: nt } = oe;
|
|
4496
4496
|
if (nt !== 0) {
|
|
4497
|
-
const
|
|
4498
|
-
|
|
4497
|
+
const _e = new se("Write stream is corrupted");
|
|
4498
|
+
ee(A, _e);
|
|
4499
4499
|
return;
|
|
4500
4500
|
}
|
|
4501
|
-
|
|
4502
|
-
onDisconnect:
|
|
4503
|
-
onFlush:
|
|
4504
|
-
onConnectionReconnect:
|
|
4505
|
-
onAppendFailed:
|
|
4506
|
-
}),
|
|
4501
|
+
B(ge), s(ge, {
|
|
4502
|
+
onDisconnect: pe,
|
|
4503
|
+
onFlush: X,
|
|
4504
|
+
onConnectionReconnect: te,
|
|
4505
|
+
onAppendFailed: L
|
|
4506
|
+
}), _ = !1;
|
|
4507
4507
|
return;
|
|
4508
4508
|
}
|
|
4509
4509
|
case "disconnect": {
|
|
4510
|
-
|
|
4511
|
-
setTimeout(
|
|
4510
|
+
I = !0, pe(), Q++, await new Promise((ge) => {
|
|
4511
|
+
setTimeout(ge, Math.max(0, J - Date.now()));
|
|
4512
4512
|
});
|
|
4513
4513
|
break;
|
|
4514
4514
|
}
|
|
4515
4515
|
case "error": {
|
|
4516
|
-
|
|
4516
|
+
ee(A, oe.error);
|
|
4517
4517
|
return;
|
|
4518
4518
|
}
|
|
4519
4519
|
}
|
|
4520
4520
|
}
|
|
4521
4521
|
}
|
|
4522
|
-
class
|
|
4523
|
-
constructor(
|
|
4524
|
-
super(
|
|
4522
|
+
class Tt extends n {
|
|
4523
|
+
constructor(I, Q) {
|
|
4524
|
+
super(I, Q);
|
|
4525
4525
|
}
|
|
4526
4526
|
async streamId() {
|
|
4527
|
-
return o || new Promise((
|
|
4528
|
-
const J = [],
|
|
4529
|
-
for (const
|
|
4530
|
-
|
|
4531
|
-
},
|
|
4532
|
-
|
|
4533
|
-
}, nt = () => {
|
|
4534
|
-
Q(new
|
|
4527
|
+
return o || new Promise((I, Q) => {
|
|
4528
|
+
const J = [], oe = () => {
|
|
4529
|
+
for (const _e of J)
|
|
4530
|
+
_e();
|
|
4531
|
+
}, ge = (_e) => {
|
|
4532
|
+
I(_e), oe();
|
|
4533
|
+
}, nt = (_e) => {
|
|
4534
|
+
Q(_e || new se("Stream is closed.")), oe();
|
|
4535
4535
|
};
|
|
4536
|
-
J.push(
|
|
4536
|
+
J.push(U(ge)), J.push(v(nt));
|
|
4537
4537
|
});
|
|
4538
4538
|
}
|
|
4539
4539
|
}
|
|
4540
4540
|
return {
|
|
4541
|
-
stream: new
|
|
4541
|
+
stream: new Tt({
|
|
4542
4542
|
// TODO(dww): accept a storage so that write streams can survive across
|
|
4543
4543
|
// browser restarts
|
|
4544
|
-
async start(
|
|
4544
|
+
async start(A) {
|
|
4545
4545
|
try {
|
|
4546
|
-
await
|
|
4547
|
-
} catch (
|
|
4548
|
-
|
|
4546
|
+
await Re(A);
|
|
4547
|
+
} catch (I) {
|
|
4548
|
+
ee(A, I);
|
|
4549
4549
|
}
|
|
4550
4550
|
},
|
|
4551
|
-
write(
|
|
4552
|
-
const Q =
|
|
4551
|
+
write(A, I) {
|
|
4552
|
+
const Q = ve(I);
|
|
4553
4553
|
if (Q) {
|
|
4554
|
-
const J =
|
|
4555
|
-
|
|
4556
|
-
const
|
|
4557
|
-
|
|
4554
|
+
const J = w.encode(A).length;
|
|
4555
|
+
g.push({ chunk: A, byteLen: J });
|
|
4556
|
+
const oe = m + S;
|
|
4557
|
+
S += J, _ || r({ streamId: Q, chunks: [A], offset: oe });
|
|
4558
4558
|
}
|
|
4559
4559
|
},
|
|
4560
4560
|
close() {
|
|
4561
4561
|
o ? r({
|
|
4562
4562
|
streamId: o,
|
|
4563
4563
|
chunks: [],
|
|
4564
|
-
offset:
|
|
4564
|
+
offset: m + S,
|
|
4565
4565
|
isDone: !0
|
|
4566
|
-
}) :
|
|
4566
|
+
}) : j(), O();
|
|
4567
4567
|
},
|
|
4568
|
-
abort(
|
|
4568
|
+
abort(A) {
|
|
4569
4569
|
o ? r({
|
|
4570
4570
|
streamId: o,
|
|
4571
4571
|
chunks: [],
|
|
4572
|
-
offset:
|
|
4572
|
+
offset: m + S,
|
|
4573
4573
|
isDone: !0,
|
|
4574
|
-
abortReason:
|
|
4575
|
-
}) :
|
|
4574
|
+
abortReason: A
|
|
4575
|
+
}) : j(), O();
|
|
4576
4576
|
}
|
|
4577
4577
|
}),
|
|
4578
|
-
addCompleteCb:
|
|
4578
|
+
addCompleteCb: C,
|
|
4579
4579
|
closed() {
|
|
4580
|
-
return
|
|
4580
|
+
return f;
|
|
4581
4581
|
}
|
|
4582
4582
|
};
|
|
4583
4583
|
}
|
|
@@ -4622,22 +4622,22 @@ function Ac({ RStream: n, opts: e, startStream: t, cancelStream: r }) {
|
|
|
4622
4622
|
const l = [];
|
|
4623
4623
|
function f() {
|
|
4624
4624
|
u = !0;
|
|
4625
|
-
for (const
|
|
4626
|
-
|
|
4625
|
+
for (const g of l)
|
|
4626
|
+
g();
|
|
4627
4627
|
}
|
|
4628
|
-
function p(
|
|
4629
|
-
return l.push(
|
|
4630
|
-
const w = l.indexOf(
|
|
4628
|
+
function p(g) {
|
|
4629
|
+
return l.push(g), () => {
|
|
4630
|
+
const w = l.indexOf(g);
|
|
4631
4631
|
w !== -1 && l.splice(w, 1);
|
|
4632
4632
|
};
|
|
4633
4633
|
}
|
|
4634
|
-
function y(
|
|
4635
|
-
|
|
4634
|
+
function y(g, w) {
|
|
4635
|
+
g.error(w), f();
|
|
4636
4636
|
}
|
|
4637
4637
|
let b = 0;
|
|
4638
|
-
async function g
|
|
4638
|
+
async function _(g, w) {
|
|
4639
4639
|
c = W();
|
|
4640
|
-
const O = { ...
|
|
4640
|
+
const O = { ...g || {}, eventId: c };
|
|
4641
4641
|
for await (const v of t(O)) {
|
|
4642
4642
|
if (i)
|
|
4643
4643
|
return;
|
|
@@ -4648,45 +4648,45 @@ function Ac({ RStream: n, opts: e, startStream: t, cancelStream: r }) {
|
|
|
4648
4648
|
return;
|
|
4649
4649
|
}
|
|
4650
4650
|
if (v.offset > s) {
|
|
4651
|
-
y(w, new
|
|
4651
|
+
y(w, new se("Stream is corrupted.")), i = !0;
|
|
4652
4652
|
return;
|
|
4653
4653
|
}
|
|
4654
|
-
let
|
|
4654
|
+
let C = s - v.offset;
|
|
4655
4655
|
if (v.files && v.files.length) {
|
|
4656
|
-
const
|
|
4656
|
+
const j = new AbortController();
|
|
4657
4657
|
let U = fetch(v.files[0].url, {
|
|
4658
|
-
signal:
|
|
4658
|
+
signal: j.signal
|
|
4659
4659
|
});
|
|
4660
|
-
for (let
|
|
4661
|
-
const
|
|
4662
|
-
if (
|
|
4660
|
+
for (let B = 0; B < v.files.length; B++) {
|
|
4661
|
+
const pe = v.files[B + 1], ee = await U;
|
|
4662
|
+
if (pe && (U = fetch(pe.url, { signal: j.signal })), !ee.ok) {
|
|
4663
4663
|
if (b++, b > 10) {
|
|
4664
|
-
y(w, new
|
|
4664
|
+
y(w, new se("Unable to process stream."));
|
|
4665
4665
|
return;
|
|
4666
4666
|
}
|
|
4667
4667
|
return { retry: !0 };
|
|
4668
4668
|
}
|
|
4669
|
-
if (
|
|
4670
|
-
for await (const
|
|
4669
|
+
if (ee.body)
|
|
4670
|
+
for await (const te of ee.body) {
|
|
4671
4671
|
if (i) {
|
|
4672
|
-
|
|
4672
|
+
j.abort();
|
|
4673
4673
|
return;
|
|
4674
4674
|
}
|
|
4675
|
-
let L =
|
|
4676
|
-
if (
|
|
4675
|
+
let L = te;
|
|
4676
|
+
if (C > 0 && (L = te.subarray(C), C -= te.length - L.length), !L.length)
|
|
4677
4677
|
continue;
|
|
4678
4678
|
s += L.length;
|
|
4679
4679
|
const X = o.decode(L);
|
|
4680
4680
|
w.enqueue(X);
|
|
4681
4681
|
}
|
|
4682
4682
|
else {
|
|
4683
|
-
const
|
|
4684
|
-
let L =
|
|
4683
|
+
const te = await ee.arrayBuffer();
|
|
4684
|
+
let L = te;
|
|
4685
4685
|
if (i) {
|
|
4686
|
-
|
|
4686
|
+
j.abort();
|
|
4687
4687
|
return;
|
|
4688
4688
|
}
|
|
4689
|
-
if (
|
|
4689
|
+
if (C > 0 && (L = new Uint8Array(te).subarray(C), C -= te.byteLength - L.length), !L.byteLength)
|
|
4690
4690
|
continue;
|
|
4691
4691
|
s += L.byteLength;
|
|
4692
4692
|
const X = o.decode(L);
|
|
@@ -4695,35 +4695,35 @@ function Ac({ RStream: n, opts: e, startStream: t, cancelStream: r }) {
|
|
|
4695
4695
|
}
|
|
4696
4696
|
}
|
|
4697
4697
|
if (b = 0, v.content) {
|
|
4698
|
-
let
|
|
4699
|
-
if (
|
|
4700
|
-
const
|
|
4701
|
-
if (
|
|
4698
|
+
let j = v.content, U = a.encode(v.content);
|
|
4699
|
+
if (C > 0) {
|
|
4700
|
+
const B = U.subarray(C);
|
|
4701
|
+
if (C -= U.length - B.length, !B.length)
|
|
4702
4702
|
continue;
|
|
4703
|
-
U =
|
|
4703
|
+
U = B, j = o.decode(B);
|
|
4704
4704
|
}
|
|
4705
|
-
s += U.length, w.enqueue(
|
|
4705
|
+
s += U.length, w.enqueue(j);
|
|
4706
4706
|
}
|
|
4707
4707
|
}
|
|
4708
4708
|
}
|
|
4709
|
-
async function m(
|
|
4709
|
+
async function m(g) {
|
|
4710
4710
|
let w = !0, O = 0;
|
|
4711
4711
|
for (; w; ) {
|
|
4712
4712
|
w = !1;
|
|
4713
4713
|
let v = Date.now() + Math.min(15e3, 500 * (O - 1));
|
|
4714
|
-
const
|
|
4715
|
-
|
|
4716
|
-
setTimeout(
|
|
4714
|
+
const C = await _({ ...e, offset: s }, g);
|
|
4715
|
+
C != null && C.retry && (w = !0, O++, v < Date.now() - 3e5 && (O = 0), await new Promise((j) => {
|
|
4716
|
+
setTimeout(j, Math.max(0, v - Date.now()));
|
|
4717
4717
|
}));
|
|
4718
4718
|
}
|
|
4719
|
-
!i && !u && (
|
|
4719
|
+
!i && !u && (g.close(), f());
|
|
4720
4720
|
}
|
|
4721
4721
|
return {
|
|
4722
4722
|
stream: new n({
|
|
4723
|
-
start(
|
|
4724
|
-
m(
|
|
4723
|
+
start(g) {
|
|
4724
|
+
m(g);
|
|
4725
4725
|
},
|
|
4726
|
-
cancel(
|
|
4726
|
+
cancel(g) {
|
|
4727
4727
|
i = !0, c && r({ eventId: c }), f();
|
|
4728
4728
|
}
|
|
4729
4729
|
}),
|
|
@@ -4840,7 +4840,7 @@ class kc {
|
|
|
4840
4840
|
if (e.error) {
|
|
4841
4841
|
e.retry ? r.push({ type: "reconnect" }) : r.push({
|
|
4842
4842
|
type: "error",
|
|
4843
|
-
error: new
|
|
4843
|
+
error: new se(e.error)
|
|
4844
4844
|
}), r.close(), delete this.readStreamIterators[t];
|
|
4845
4845
|
return;
|
|
4846
4846
|
}
|
|
@@ -4877,7 +4877,7 @@ class kc {
|
|
|
4877
4877
|
const r = e["client-event-id"], s = this.startWriteStreamCbs[r];
|
|
4878
4878
|
s && (s({
|
|
4879
4879
|
type: "error",
|
|
4880
|
-
error: new
|
|
4880
|
+
error: new se(e.message || "Unknown error", e.hint)
|
|
4881
4881
|
}), delete this.startWriteStreamCbs[r]);
|
|
4882
4882
|
break;
|
|
4883
4883
|
}
|
|
@@ -4885,7 +4885,7 @@ class kc {
|
|
|
4885
4885
|
const r = e["client-event-id"], s = this.readStreamIterators[r];
|
|
4886
4886
|
s && (s.push({
|
|
4887
4887
|
type: "error",
|
|
4888
|
-
error: new
|
|
4888
|
+
error: new se(e.message || "Unknown error", e.hint)
|
|
4889
4889
|
}), s.close(), delete this.readStreamIterators[r]);
|
|
4890
4890
|
break;
|
|
4891
4891
|
}
|
|
@@ -5065,7 +5065,7 @@ class Nc {
|
|
|
5065
5065
|
h(this, "notifyOne", (e) => {
|
|
5066
5066
|
var i;
|
|
5067
5067
|
const t = this.queryCbs[e] ?? [], r = (i = this._dataForQueryCache[e]) == null ? void 0 : i.data, s = this.dataForQuery(e);
|
|
5068
|
-
s != null && s.data && (this._dataForQueryCache[e] = s, !
|
|
5068
|
+
s != null && s.data && (this._dataForQueryCache[e] = s, !jt(s.data, r) && t.forEach((o) => o.cb(s.data)));
|
|
5069
5069
|
});
|
|
5070
5070
|
h(this, "notifyOneQueryOnce", (e) => {
|
|
5071
5071
|
var s;
|
|
@@ -5299,13 +5299,13 @@ class Nc {
|
|
|
5299
5299
|
s.resolve({ status: e, eventId: t });
|
|
5300
5300
|
else if (r != null && r.type) {
|
|
5301
5301
|
const { status: o, ...a } = r;
|
|
5302
|
-
s.reject(new
|
|
5302
|
+
s.reject(new Bt({
|
|
5303
5303
|
// @ts-expect-error body.type is not constant typed
|
|
5304
5304
|
body: a,
|
|
5305
5305
|
status: o ?? 0
|
|
5306
5306
|
}));
|
|
5307
5307
|
} else
|
|
5308
|
-
s.reject(new
|
|
5308
|
+
s.reject(new se((r == null ? void 0 : r.message) || "Unknown error", r == null ? void 0 : r.hint));
|
|
5309
5309
|
}
|
|
5310
5310
|
_setStatus(e, t) {
|
|
5311
5311
|
this.status = e, this._errorMessage = t, this.notifyConnectionStatusSubs(e), this._instantStream.onConnectionStatusChange(e);
|
|
@@ -5350,8 +5350,8 @@ class Nc {
|
|
|
5350
5350
|
case "init-ok": {
|
|
5351
5351
|
this._setStatus(Ee.AUTHENTICATED), this._reconnectTimeoutMs = 0, this._setAttrs(t.attrs), this._flushPendingMessages(), this._sessionId = t["session-id"];
|
|
5352
5352
|
for (const y of Object.keys(this._rooms)) {
|
|
5353
|
-
const b = (i = (s = this._presence[y]) == null ? void 0 : s.result) == null ? void 0 : i.user,
|
|
5354
|
-
this._tryJoinRoom(
|
|
5353
|
+
const b = (i = (s = this._presence[y]) == null ? void 0 : s.result) == null ? void 0 : i.user, _ = (o = this._rooms[y]) == null ? void 0 : o.roomType;
|
|
5354
|
+
this._tryJoinRoom(_, y, b);
|
|
5355
5355
|
}
|
|
5356
5356
|
break;
|
|
5357
5357
|
}
|
|
@@ -5360,23 +5360,23 @@ class Nc {
|
|
|
5360
5360
|
break;
|
|
5361
5361
|
}
|
|
5362
5362
|
case "add-query-ok": {
|
|
5363
|
-
const { q: y, result: b } = t,
|
|
5364
|
-
if (!this._hasQueryListeners() && !this.querySubs.currentValue[
|
|
5363
|
+
const { q: y, result: b } = t, _ = H(y);
|
|
5364
|
+
if (!this._hasQueryListeners() && !this.querySubs.currentValue[_])
|
|
5365
5365
|
break;
|
|
5366
|
-
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,
|
|
5366
|
+
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, g = Ur(b), w = this.ensureAttrs(), O = ct(w, g, r, this.config.useDateObjects);
|
|
5367
5367
|
this.querySubs.updateInPlace((v) => {
|
|
5368
|
-
if (!v[
|
|
5369
|
-
this._log.info("Missing value in querySubs", { hash:
|
|
5368
|
+
if (!v[_]) {
|
|
5369
|
+
this._log.info("Missing value in querySubs", { hash: _, q: y });
|
|
5370
5370
|
return;
|
|
5371
5371
|
}
|
|
5372
|
-
v[
|
|
5372
|
+
v[_].result = {
|
|
5373
5373
|
store: O,
|
|
5374
5374
|
attrsStore: w,
|
|
5375
5375
|
pageInfo: m,
|
|
5376
5376
|
aggregate: S,
|
|
5377
5377
|
processedTxId: t["processed-tx-id"]
|
|
5378
5378
|
};
|
|
5379
|
-
}), this._cleanupPendingMutationsQueries(), this.notifyOne(
|
|
5379
|
+
}), this._cleanupPendingMutationsQueries(), this.notifyOne(_), this.notifyOneQueryOnce(_), this._cleanupPendingMutationsTimeout();
|
|
5380
5380
|
break;
|
|
5381
5381
|
}
|
|
5382
5382
|
case "start-sync-ok": {
|
|
@@ -5412,39 +5412,39 @@ class Nc {
|
|
|
5412
5412
|
break;
|
|
5413
5413
|
}
|
|
5414
5414
|
case "refresh-ok": {
|
|
5415
|
-
const { computations: y, attrs: b } = t,
|
|
5415
|
+
const { computations: y, attrs: b } = t, _ = t["processed-tx-id"];
|
|
5416
5416
|
b && this._setAttrs(b), this._cleanupPendingMutationsTimeout();
|
|
5417
|
-
const m = this._rewriteMutations(this.ensureAttrs(), this._pendingMutations(),
|
|
5417
|
+
const m = this._rewriteMutations(this.ensureAttrs(), this._pendingMutations(), _);
|
|
5418
5418
|
m !== this._pendingMutations() && this.kv.updateInPlace((w) => {
|
|
5419
5419
|
w.pendingMutations = m;
|
|
5420
5420
|
});
|
|
5421
|
-
const S = ln(m.entries()),
|
|
5422
|
-
var L, X, ve,
|
|
5423
|
-
const O = w["instaql-query"], v = w["instaql-result"],
|
|
5421
|
+
const S = ln(m.entries()), g = y.map((w) => {
|
|
5422
|
+
var L, X, ve, Re;
|
|
5423
|
+
const O = w["instaql-query"], v = w["instaql-result"], C = H(O), j = Ur(v), U = this.ensureAttrs(), B = ct(U, j, r, this.config.useDateObjects), { store: pe, attrsStore: Me } = this._applyOptimisticUpdates(B, U, S, _), ee = (X = (L = v == null ? void 0 : v[0]) == null ? void 0 : L.data) == null ? void 0 : X["page-info"], te = (Re = (ve = v == null ? void 0 : v[0]) == null ? void 0 : ve.data) == null ? void 0 : Re.aggregate;
|
|
5424
5424
|
return {
|
|
5425
5425
|
q: O,
|
|
5426
|
-
hash:
|
|
5427
|
-
store:
|
|
5428
|
-
attrsStore:
|
|
5429
|
-
pageInfo:
|
|
5430
|
-
aggregate:
|
|
5426
|
+
hash: C,
|
|
5427
|
+
store: pe,
|
|
5428
|
+
attrsStore: Me,
|
|
5429
|
+
pageInfo: ee,
|
|
5430
|
+
aggregate: te
|
|
5431
5431
|
};
|
|
5432
5432
|
});
|
|
5433
|
-
|
|
5434
|
-
this.querySubs.updateInPlace((
|
|
5435
|
-
if (!
|
|
5433
|
+
g.forEach(({ hash: w, q: O, store: v, attrsStore: C, pageInfo: j, aggregate: U }) => {
|
|
5434
|
+
this.querySubs.updateInPlace((B) => {
|
|
5435
|
+
if (!B[w]) {
|
|
5436
5436
|
this._log.error("Missing value in querySubs", { hash: w, q: O });
|
|
5437
5437
|
return;
|
|
5438
5438
|
}
|
|
5439
|
-
|
|
5439
|
+
B[w].result = {
|
|
5440
5440
|
store: v,
|
|
5441
|
-
attrsStore:
|
|
5442
|
-
pageInfo:
|
|
5441
|
+
attrsStore: C,
|
|
5442
|
+
pageInfo: j,
|
|
5443
5443
|
aggregate: U,
|
|
5444
|
-
processedTxId:
|
|
5444
|
+
processedTxId: _
|
|
5445
5445
|
};
|
|
5446
5446
|
});
|
|
5447
|
-
}), this._cleanupPendingMutationsQueries(),
|
|
5447
|
+
}), this._cleanupPendingMutationsQueries(), g.forEach(({ hash: w }) => {
|
|
5448
5448
|
this.notifyOne(w);
|
|
5449
5449
|
});
|
|
5450
5450
|
break;
|
|
@@ -5455,22 +5455,22 @@ class Nc {
|
|
|
5455
5455
|
const m = this._rewriteMutations(this.ensureAttrs(), this._pendingMutations()).get(y);
|
|
5456
5456
|
if (!m)
|
|
5457
5457
|
break;
|
|
5458
|
-
this._updatePendingMutations((
|
|
5459
|
-
|
|
5460
|
-
...
|
|
5458
|
+
this._updatePendingMutations((g) => {
|
|
5459
|
+
g.set(y, {
|
|
5460
|
+
...g.get(y),
|
|
5461
5461
|
"tx-id": b,
|
|
5462
5462
|
confirmed: Date.now()
|
|
5463
5463
|
});
|
|
5464
5464
|
});
|
|
5465
5465
|
const S = [];
|
|
5466
|
-
for (const
|
|
5467
|
-
if (
|
|
5468
|
-
const w =
|
|
5466
|
+
for (const g of m["tx-steps"])
|
|
5467
|
+
if (g[0] === "add-attr") {
|
|
5468
|
+
const w = g[1];
|
|
5469
5469
|
S.push(w);
|
|
5470
5470
|
}
|
|
5471
5471
|
if (S.length) {
|
|
5472
|
-
const
|
|
5473
|
-
this._setAttrs([...
|
|
5472
|
+
const g = Object.values(this.ensureAttrs().attrs);
|
|
5473
|
+
this._setAttrs([...g, ...S]);
|
|
5474
5474
|
}
|
|
5475
5475
|
this._finishTransaction("synced", y), this._cleanupPendingMutationsTimeout();
|
|
5476
5476
|
break;
|
|
@@ -5674,7 +5674,7 @@ class Nc {
|
|
|
5674
5674
|
return /* @__PURE__ */ new Map();
|
|
5675
5675
|
const s = (l) => {
|
|
5676
5676
|
const [f, p, y] = l["forward-identity"];
|
|
5677
|
-
return
|
|
5677
|
+
return V(e, p, y);
|
|
5678
5678
|
}, i = (l) => {
|
|
5679
5679
|
const [f, p, y] = l["forward-identity"];
|
|
5680
5680
|
return Ke(e, p, y);
|
|
@@ -5685,9 +5685,9 @@ class Nc {
|
|
|
5685
5685
|
for (const y of l) {
|
|
5686
5686
|
const [b] = y;
|
|
5687
5687
|
if (b === "add-attr") {
|
|
5688
|
-
const [m, S] = y,
|
|
5689
|
-
if (
|
|
5690
|
-
o.attrIdMap[S.id] =
|
|
5688
|
+
const [m, S] = y, g = s(S);
|
|
5689
|
+
if (g && S.id !== g.id) {
|
|
5690
|
+
o.attrIdMap[S.id] = g.id, a = !0;
|
|
5691
5691
|
continue;
|
|
5692
5692
|
}
|
|
5693
5693
|
if (S["value-type"] === "ref") {
|
|
@@ -5702,8 +5702,8 @@ class Nc {
|
|
|
5702
5702
|
a = !0;
|
|
5703
5703
|
continue;
|
|
5704
5704
|
}
|
|
5705
|
-
const
|
|
5706
|
-
p.push(
|
|
5705
|
+
const _ = a ? pa(o, y) : y;
|
|
5706
|
+
p.push(_);
|
|
5707
5707
|
}
|
|
5708
5708
|
return a ? p : l;
|
|
5709
5709
|
}, u = /* @__PURE__ */ new Map();
|
|
@@ -5755,10 +5755,10 @@ class Nc {
|
|
|
5755
5755
|
if (l && s === l.querySubVersion && o === l.pendingMutationsVersion)
|
|
5756
5756
|
return l;
|
|
5757
5757
|
let f = u.store, p = u.attrsStore;
|
|
5758
|
-
const { pageInfo: y, aggregate: b, processedTxId:
|
|
5758
|
+
const { pageInfo: y, aggregate: b, processedTxId: _ } = u, m = this._rewriteMutationsSorted(p, a);
|
|
5759
5759
|
if (t) {
|
|
5760
|
-
const
|
|
5761
|
-
f =
|
|
5760
|
+
const g = this._applyOptimisticUpdates(f, p, m, _);
|
|
5761
|
+
f = g.store, p = g.attrsStore;
|
|
5762
5762
|
}
|
|
5763
5763
|
return { data: Ms({ store: f, attrsStore: p, pageInfo: y, aggregate: b }, c), querySubVersion: s, pendingMutationsVersion: o };
|
|
5764
5764
|
}
|
|
@@ -5978,7 +5978,7 @@ class Nc {
|
|
|
5978
5978
|
t.isLoading || e(this._currentUserCached);
|
|
5979
5979
|
let r = !1;
|
|
5980
5980
|
return this.getCurrentUser().then((s) => {
|
|
5981
|
-
r ||
|
|
5981
|
+
r || jt(s, t) || e(s);
|
|
5982
5982
|
}), () => {
|
|
5983
5983
|
r = !0, this.authCbs = this.authCbs.filter((s) => s !== e);
|
|
5984
5984
|
};
|
|
@@ -5986,7 +5986,7 @@ class Nc {
|
|
|
5986
5986
|
async getAuth() {
|
|
5987
5987
|
const { user: e, error: t } = await this.getCurrentUser();
|
|
5988
5988
|
if (t)
|
|
5989
|
-
throw new
|
|
5989
|
+
throw new se("Could not get current user: " + t.message);
|
|
5990
5990
|
return e ?? null;
|
|
5991
5991
|
}
|
|
5992
5992
|
subscribeConnectionStatus(e) {
|
|
@@ -6062,7 +6062,7 @@ class Nc {
|
|
|
6062
6062
|
async changeCurrentUser(e) {
|
|
6063
6063
|
var r;
|
|
6064
6064
|
const { user: t } = await this.getCurrentUser();
|
|
6065
|
-
if (!
|
|
6065
|
+
if (!jt(t, e)) {
|
|
6066
6066
|
await this.setCurrentUser(e), await this.updateUser(e);
|
|
6067
6067
|
try {
|
|
6068
6068
|
await this.kv.flush(), (r = this._broadcastChannel) == null || r.postMessage({ type: "auth" });
|
|
@@ -6309,7 +6309,7 @@ class Nc {
|
|
|
6309
6309
|
const r = ((a = (o = this._presence[e]) == null ? void 0 : o.result) == null ? void 0 : a.peers) || {};
|
|
6310
6310
|
let s = Object.fromEntries(Object.entries(r).map(([u, l]) => [u, { data: l }]));
|
|
6311
6311
|
(c = this._presence[e]) == null || c.result;
|
|
6312
|
-
const i =
|
|
6312
|
+
const i = Nt(s, (u) => {
|
|
6313
6313
|
for (let [l, f, p] of t)
|
|
6314
6314
|
switch (f) {
|
|
6315
6315
|
case "+":
|
|
@@ -6330,7 +6330,7 @@ class Nc {
|
|
|
6330
6330
|
const r = { ...t };
|
|
6331
6331
|
delete r[this._sessionId];
|
|
6332
6332
|
const s = Object.fromEntries(Object.entries(r).map(([i, o]) => [i, o.data]));
|
|
6333
|
-
this._presence =
|
|
6333
|
+
this._presence = Nt(this._presence, (i) => {
|
|
6334
6334
|
Tr(i, [e, "result", "peers"], s);
|
|
6335
6335
|
});
|
|
6336
6336
|
}
|
|
@@ -6364,8 +6364,8 @@ class Nc {
|
|
|
6364
6364
|
_notifyBroadcastSubs(e, t, r) {
|
|
6365
6365
|
var s, i, o;
|
|
6366
6366
|
(o = (i = (s = this._broadcastSubs) == null ? void 0 : s[e]) == null ? void 0 : i[t]) == null || o.forEach((a) => {
|
|
6367
|
-
var l, f, p, y, b,
|
|
6368
|
-
const c = (l = r.data) == null ? void 0 : l.data, u = r.data["peer-id"] === this._sessionId ? (p = (f = this._presence[e]) == null ? void 0 : f.result) == null ? void 0 : p.user : (
|
|
6367
|
+
var l, f, p, y, b, _;
|
|
6368
|
+
const c = (l = r.data) == null ? void 0 : l.data, u = r.data["peer-id"] === this._sessionId ? (p = (f = this._presence[e]) == null ? void 0 : f.result) == null ? void 0 : p.user : (_ = (b = (y = this._presence[e]) == null ? void 0 : y.result) == null ? void 0 : b.peers) == null ? void 0 : _[r.data["peer-id"]];
|
|
6369
6369
|
return a(c, u);
|
|
6370
6370
|
});
|
|
6371
6371
|
}
|
|
@@ -6417,7 +6417,7 @@ class Nc {
|
|
|
6417
6417
|
}
|
|
6418
6418
|
}
|
|
6419
6419
|
function Wc(n, e) {
|
|
6420
|
-
return new
|
|
6420
|
+
return new Qt(
|
|
6421
6421
|
Vs(n, e),
|
|
6422
6422
|
// (XXX): LinksDef<any> stems from TypeScript’s inability to reconcile the
|
|
6423
6423
|
// type EntitiesWithLinks<EntitiesWithoutLinks, Links> with
|
|
@@ -6429,25 +6429,25 @@ function Wc(n, e) {
|
|
|
6429
6429
|
);
|
|
6430
6430
|
}
|
|
6431
6431
|
function Kc(n) {
|
|
6432
|
-
return new
|
|
6432
|
+
return new Gt(n, {});
|
|
6433
6433
|
}
|
|
6434
6434
|
function qc() {
|
|
6435
|
-
return new
|
|
6435
|
+
return new ie("string", !0, !1);
|
|
6436
6436
|
}
|
|
6437
6437
|
function zc() {
|
|
6438
|
-
return new
|
|
6438
|
+
return new ie("number", !0, !1);
|
|
6439
6439
|
}
|
|
6440
6440
|
function Vc() {
|
|
6441
|
-
return new
|
|
6441
|
+
return new ie("boolean", !0, !1);
|
|
6442
6442
|
}
|
|
6443
6443
|
function Bc() {
|
|
6444
|
-
return new
|
|
6444
|
+
return new ie("date", !0, !1);
|
|
6445
6445
|
}
|
|
6446
6446
|
function Gc() {
|
|
6447
|
-
return new
|
|
6447
|
+
return new ie("json", !0, !1);
|
|
6448
6448
|
}
|
|
6449
6449
|
function Qc() {
|
|
6450
|
-
return new
|
|
6450
|
+
return new ie("json", !0, !1);
|
|
6451
6451
|
}
|
|
6452
6452
|
function Vs(n, e) {
|
|
6453
6453
|
var s, i, o, a;
|
|
@@ -6462,7 +6462,7 @@ function Vs(n, e) {
|
|
|
6462
6462
|
};
|
|
6463
6463
|
return Object.fromEntries(Object.entries(n).map(([c, u]) => [
|
|
6464
6464
|
c,
|
|
6465
|
-
new
|
|
6465
|
+
new Gt(u.attrs, {
|
|
6466
6466
|
...t.fwd[c],
|
|
6467
6467
|
...t.rev[c]
|
|
6468
6468
|
})
|
|
@@ -6470,7 +6470,7 @@ function Vs(n, e) {
|
|
|
6470
6470
|
}
|
|
6471
6471
|
function Hc({ entities: n, links: e, rooms: t }) {
|
|
6472
6472
|
const r = e ?? {}, s = t ?? {};
|
|
6473
|
-
return new
|
|
6473
|
+
return new Qt(
|
|
6474
6474
|
Vs(n, r),
|
|
6475
6475
|
// (XXX): LinksDef<any> stems from TypeScript's inability to reconcile the
|
|
6476
6476
|
// type EntitiesWithLinks<EntitiesWithoutLinks, Links> with
|
|
@@ -6494,9 +6494,9 @@ const Wu = {
|
|
|
6494
6494
|
json: Gc,
|
|
6495
6495
|
any: Qc
|
|
6496
6496
|
};
|
|
6497
|
-
let
|
|
6497
|
+
let It;
|
|
6498
6498
|
function Jc(n, e) {
|
|
6499
|
-
|
|
6499
|
+
It == null || It.dispose();
|
|
6500
6500
|
const t = nu(e), r = Xc(e, a), s = Zc(Yc(n));
|
|
6501
6501
|
function i(l) {
|
|
6502
6502
|
var f;
|
|
@@ -6513,7 +6513,7 @@ function Jc(n, e) {
|
|
|
6513
6513
|
t.element.remove(), r.element.remove(), removeEventListener("keydown", o), removeEventListener("message", i);
|
|
6514
6514
|
}
|
|
6515
6515
|
function u() {
|
|
6516
|
-
document.body.appendChild(t.element), document.body.appendChild(r.element), addEventListener("keydown", o), addEventListener("message", i),
|
|
6516
|
+
document.body.appendChild(t.element), document.body.appendChild(r.element), addEventListener("keydown", o), addEventListener("message", i), It = {
|
|
6517
6517
|
dispose: c
|
|
6518
6518
|
};
|
|
6519
6519
|
}
|
|
@@ -6612,7 +6612,7 @@ function ru(n, e) {
|
|
|
6612
6612
|
}
|
|
6613
6613
|
});
|
|
6614
6614
|
}
|
|
6615
|
-
function
|
|
6615
|
+
function Pt(n, e) {
|
|
6616
6616
|
return new Response(JSON.stringify({ ok: !1, error: e }), {
|
|
6617
6617
|
status: n,
|
|
6618
6618
|
headers: { "Content-Type": "application/json" }
|
|
@@ -6624,17 +6624,17 @@ const Ku = (n) => ({
|
|
|
6624
6624
|
try {
|
|
6625
6625
|
t = await e.json();
|
|
6626
6626
|
} catch {
|
|
6627
|
-
return
|
|
6627
|
+
return Pt(400, "Invalid JSON body");
|
|
6628
6628
|
}
|
|
6629
6629
|
if (!t.type)
|
|
6630
|
-
return
|
|
6630
|
+
return Pt(400, 'Missing "type" field');
|
|
6631
6631
|
if (t.appId !== n.appId)
|
|
6632
|
-
return
|
|
6632
|
+
return Pt(403, "App ID mismatch");
|
|
6633
6633
|
switch (t.type) {
|
|
6634
6634
|
case "sync-user":
|
|
6635
6635
|
return ru(n, t.user ?? null);
|
|
6636
6636
|
default:
|
|
6637
|
-
return
|
|
6637
|
+
return Pt(400, `Unknown type: ${t.type}`);
|
|
6638
6638
|
}
|
|
6639
6639
|
}
|
|
6640
6640
|
}), su = {
|
|
@@ -7114,48 +7114,48 @@ function bu() {
|
|
|
7114
7114
|
* LICENSE file in the root directory of this source tree.
|
|
7115
7115
|
*/
|
|
7116
7116
|
return n.NODE_ENV !== "production" && function() {
|
|
7117
|
-
var e = rs, 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"), p = Symbol.for("react.memo"), y = Symbol.for("react.lazy"), b = Symbol.for("react.offscreen"),
|
|
7117
|
+
var e = rs, 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"), p = Symbol.for("react.memo"), y = Symbol.for("react.lazy"), b = Symbol.for("react.offscreen"), _ = Symbol.iterator, m = "@@iterator";
|
|
7118
7118
|
function S(d) {
|
|
7119
7119
|
if (d === null || typeof d != "object")
|
|
7120
7120
|
return null;
|
|
7121
|
-
var T =
|
|
7121
|
+
var T = _ && d[_] || d[m];
|
|
7122
7122
|
return typeof T == "function" ? T : null;
|
|
7123
7123
|
}
|
|
7124
|
-
var
|
|
7124
|
+
var g = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
7125
7125
|
function w(d) {
|
|
7126
7126
|
{
|
|
7127
|
-
for (var T = arguments.length, E = new Array(T > 1 ? T - 1 : 0),
|
|
7128
|
-
E[
|
|
7127
|
+
for (var T = arguments.length, E = new Array(T > 1 ? T - 1 : 0), k = 1; k < T; k++)
|
|
7128
|
+
E[k - 1] = arguments[k];
|
|
7129
7129
|
O("error", d, E);
|
|
7130
7130
|
}
|
|
7131
7131
|
}
|
|
7132
7132
|
function O(d, T, E) {
|
|
7133
7133
|
{
|
|
7134
|
-
var
|
|
7134
|
+
var k = g.ReactDebugCurrentFrame, $ = k.getStackAddendum();
|
|
7135
7135
|
$ !== "" && (T += "%s", E = E.concat([$]));
|
|
7136
|
-
var D = E.map(function(
|
|
7137
|
-
return String(
|
|
7136
|
+
var D = E.map(function(x) {
|
|
7137
|
+
return String(x);
|
|
7138
7138
|
});
|
|
7139
7139
|
D.unshift("Warning: " + T), Function.prototype.apply.call(console[d], console, D);
|
|
7140
7140
|
}
|
|
7141
7141
|
}
|
|
7142
|
-
var v = !1,
|
|
7143
|
-
|
|
7144
|
-
function
|
|
7145
|
-
return !!(typeof d == "string" || typeof d == "function" || d === s || d === o ||
|
|
7142
|
+
var v = !1, C = !1, j = !1, U = !1, B = !1, pe;
|
|
7143
|
+
pe = Symbol.for("react.module.reference");
|
|
7144
|
+
function Me(d) {
|
|
7145
|
+
return !!(typeof d == "string" || typeof d == "function" || d === s || d === o || B || d === i || d === l || d === f || U || d === b || v || C || j || typeof d == "object" && d !== null && (d.$$typeof === y || d.$$typeof === p || d.$$typeof === a || d.$$typeof === c || d.$$typeof === u || // This needs to include all possible module reference object
|
|
7146
7146
|
// types supported by any Flight configuration anywhere since
|
|
7147
7147
|
// we don't know which Flight build this will end up being used
|
|
7148
7148
|
// with.
|
|
7149
|
-
d.$$typeof ===
|
|
7149
|
+
d.$$typeof === pe || d.getModuleId !== void 0));
|
|
7150
7150
|
}
|
|
7151
|
-
function
|
|
7152
|
-
var
|
|
7153
|
-
if (
|
|
7154
|
-
return
|
|
7151
|
+
function ee(d, T, E) {
|
|
7152
|
+
var k = d.displayName;
|
|
7153
|
+
if (k)
|
|
7154
|
+
return k;
|
|
7155
7155
|
var $ = T.displayName || T.name || "";
|
|
7156
7156
|
return $ !== "" ? E + "(" + $ + ")" : E;
|
|
7157
7157
|
}
|
|
7158
|
-
function
|
|
7158
|
+
function te(d) {
|
|
7159
7159
|
return d.displayName || "Context";
|
|
7160
7160
|
}
|
|
7161
7161
|
function L(d) {
|
|
@@ -7183,19 +7183,19 @@ function bu() {
|
|
|
7183
7183
|
switch (d.$$typeof) {
|
|
7184
7184
|
case c:
|
|
7185
7185
|
var T = d;
|
|
7186
|
-
return
|
|
7186
|
+
return te(T) + ".Consumer";
|
|
7187
7187
|
case a:
|
|
7188
7188
|
var E = d;
|
|
7189
|
-
return
|
|
7189
|
+
return te(E._context) + ".Provider";
|
|
7190
7190
|
case u:
|
|
7191
|
-
return
|
|
7191
|
+
return ee(d, d.render, "ForwardRef");
|
|
7192
7192
|
case p:
|
|
7193
|
-
var
|
|
7194
|
-
return
|
|
7193
|
+
var k = d.displayName || null;
|
|
7194
|
+
return k !== null ? k : L(d.type) || "Memo";
|
|
7195
7195
|
case y: {
|
|
7196
|
-
var $ = d, D = $._payload,
|
|
7196
|
+
var $ = d, D = $._payload, x = $._init;
|
|
7197
7197
|
try {
|
|
7198
|
-
return L(
|
|
7198
|
+
return L(x(D));
|
|
7199
7199
|
} catch {
|
|
7200
7200
|
return null;
|
|
7201
7201
|
}
|
|
@@ -7203,18 +7203,18 @@ function bu() {
|
|
|
7203
7203
|
}
|
|
7204
7204
|
return null;
|
|
7205
7205
|
}
|
|
7206
|
-
var X = Object.assign, ve = 0,
|
|
7207
|
-
function
|
|
7206
|
+
var X = Object.assign, ve = 0, Re, Tt, Ht, A, I, Q, J;
|
|
7207
|
+
function oe() {
|
|
7208
7208
|
}
|
|
7209
|
-
|
|
7210
|
-
function
|
|
7209
|
+
oe.__reactDisabledLog = !0;
|
|
7210
|
+
function ge() {
|
|
7211
7211
|
{
|
|
7212
7212
|
if (ve === 0) {
|
|
7213
|
-
|
|
7213
|
+
Re = console.log, Tt = console.info, Ht = console.warn, A = console.error, I = console.group, Q = console.groupCollapsed, J = console.groupEnd;
|
|
7214
7214
|
var d = {
|
|
7215
7215
|
configurable: !0,
|
|
7216
7216
|
enumerable: !0,
|
|
7217
|
-
value:
|
|
7217
|
+
value: oe,
|
|
7218
7218
|
writable: !0
|
|
7219
7219
|
};
|
|
7220
7220
|
Object.defineProperties(console, {
|
|
@@ -7230,7 +7230,7 @@ function bu() {
|
|
|
7230
7230
|
ve++;
|
|
7231
7231
|
}
|
|
7232
7232
|
}
|
|
7233
|
-
function
|
|
7233
|
+
function nt() {
|
|
7234
7234
|
{
|
|
7235
7235
|
if (ve--, ve === 0) {
|
|
7236
7236
|
var d = {
|
|
@@ -7240,120 +7240,120 @@ function bu() {
|
|
|
7240
7240
|
};
|
|
7241
7241
|
Object.defineProperties(console, {
|
|
7242
7242
|
log: X({}, d, {
|
|
7243
|
-
value:
|
|
7243
|
+
value: Re
|
|
7244
7244
|
}),
|
|
7245
7245
|
info: X({}, d, {
|
|
7246
|
-
value:
|
|
7246
|
+
value: Tt
|
|
7247
7247
|
}),
|
|
7248
7248
|
warn: X({}, d, {
|
|
7249
|
-
value:
|
|
7249
|
+
value: Ht
|
|
7250
7250
|
}),
|
|
7251
7251
|
error: X({}, d, {
|
|
7252
|
-
value:
|
|
7252
|
+
value: A
|
|
7253
7253
|
}),
|
|
7254
7254
|
group: X({}, d, {
|
|
7255
|
-
value:
|
|
7255
|
+
value: I
|
|
7256
7256
|
}),
|
|
7257
7257
|
groupCollapsed: X({}, d, {
|
|
7258
|
-
value:
|
|
7258
|
+
value: Q
|
|
7259
7259
|
}),
|
|
7260
7260
|
groupEnd: X({}, d, {
|
|
7261
|
-
value:
|
|
7261
|
+
value: J
|
|
7262
7262
|
})
|
|
7263
7263
|
});
|
|
7264
7264
|
}
|
|
7265
7265
|
ve < 0 && w("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
7266
7266
|
}
|
|
7267
7267
|
}
|
|
7268
|
-
var
|
|
7269
|
-
function
|
|
7268
|
+
var _e = g.ReactCurrentDispatcher, Jt;
|
|
7269
|
+
function St(d, T, E) {
|
|
7270
7270
|
{
|
|
7271
7271
|
if (Jt === void 0)
|
|
7272
7272
|
try {
|
|
7273
7273
|
throw Error();
|
|
7274
7274
|
} catch ($) {
|
|
7275
|
-
var
|
|
7276
|
-
Jt =
|
|
7275
|
+
var k = $.stack.trim().match(/\n( *(at )?)/);
|
|
7276
|
+
Jt = k && k[1] || "";
|
|
7277
7277
|
}
|
|
7278
7278
|
return `
|
|
7279
7279
|
` + Jt + d;
|
|
7280
7280
|
}
|
|
7281
7281
|
}
|
|
7282
|
-
var Yt = !1,
|
|
7282
|
+
var Yt = !1, vt;
|
|
7283
7283
|
{
|
|
7284
7284
|
var Qs = typeof WeakMap == "function" ? WeakMap : Map;
|
|
7285
|
-
|
|
7285
|
+
vt = new Qs();
|
|
7286
7286
|
}
|
|
7287
7287
|
function tr(d, T) {
|
|
7288
7288
|
if (!d || Yt)
|
|
7289
7289
|
return "";
|
|
7290
7290
|
{
|
|
7291
|
-
var E =
|
|
7291
|
+
var E = vt.get(d);
|
|
7292
7292
|
if (E !== void 0)
|
|
7293
7293
|
return E;
|
|
7294
7294
|
}
|
|
7295
|
-
var
|
|
7295
|
+
var k;
|
|
7296
7296
|
Yt = !0;
|
|
7297
7297
|
var $ = Error.prepareStackTrace;
|
|
7298
7298
|
Error.prepareStackTrace = void 0;
|
|
7299
7299
|
var D;
|
|
7300
|
-
D =
|
|
7300
|
+
D = _e.current, _e.current = null, ge();
|
|
7301
7301
|
try {
|
|
7302
7302
|
if (T) {
|
|
7303
|
-
var
|
|
7303
|
+
var x = function() {
|
|
7304
7304
|
throw Error();
|
|
7305
7305
|
};
|
|
7306
|
-
if (Object.defineProperty(
|
|
7306
|
+
if (Object.defineProperty(x.prototype, "props", {
|
|
7307
7307
|
set: function() {
|
|
7308
7308
|
throw Error();
|
|
7309
7309
|
}
|
|
7310
7310
|
}), typeof Reflect == "object" && Reflect.construct) {
|
|
7311
7311
|
try {
|
|
7312
|
-
Reflect.construct(
|
|
7313
|
-
} catch (
|
|
7314
|
-
|
|
7312
|
+
Reflect.construct(x, []);
|
|
7313
|
+
} catch (ae) {
|
|
7314
|
+
k = ae;
|
|
7315
7315
|
}
|
|
7316
|
-
Reflect.construct(d, [],
|
|
7316
|
+
Reflect.construct(d, [], x);
|
|
7317
7317
|
} else {
|
|
7318
7318
|
try {
|
|
7319
|
-
|
|
7320
|
-
} catch (
|
|
7321
|
-
|
|
7319
|
+
x.call();
|
|
7320
|
+
} catch (ae) {
|
|
7321
|
+
k = ae;
|
|
7322
7322
|
}
|
|
7323
|
-
d.call(
|
|
7323
|
+
d.call(x.prototype);
|
|
7324
7324
|
}
|
|
7325
7325
|
} else {
|
|
7326
7326
|
try {
|
|
7327
7327
|
throw Error();
|
|
7328
|
-
} catch (
|
|
7329
|
-
|
|
7328
|
+
} catch (ae) {
|
|
7329
|
+
k = ae;
|
|
7330
7330
|
}
|
|
7331
7331
|
d();
|
|
7332
7332
|
}
|
|
7333
|
-
} catch (
|
|
7334
|
-
if (
|
|
7335
|
-
for (var M =
|
|
7336
|
-
`),
|
|
7337
|
-
`),
|
|
7338
|
-
|
|
7339
|
-
for (;
|
|
7340
|
-
if (M[
|
|
7341
|
-
if (
|
|
7333
|
+
} catch (ae) {
|
|
7334
|
+
if (ae && k && typeof ae.stack == "string") {
|
|
7335
|
+
for (var M = ae.stack.split(`
|
|
7336
|
+
`), ne = k.stack.split(`
|
|
7337
|
+
`), K = M.length - 1, z = ne.length - 1; K >= 1 && z >= 0 && M[K] !== ne[z]; )
|
|
7338
|
+
z--;
|
|
7339
|
+
for (; K >= 1 && z >= 0; K--, z--)
|
|
7340
|
+
if (M[K] !== ne[z]) {
|
|
7341
|
+
if (K !== 1 || z !== 1)
|
|
7342
7342
|
do
|
|
7343
|
-
if (
|
|
7344
|
-
var
|
|
7345
|
-
` + M[
|
|
7346
|
-
return d.displayName &&
|
|
7343
|
+
if (K--, z--, z < 0 || M[K] !== ne[z]) {
|
|
7344
|
+
var ye = `
|
|
7345
|
+
` + M[K].replace(" at new ", " at ");
|
|
7346
|
+
return d.displayName && ye.includes("<anonymous>") && (ye = ye.replace("<anonymous>", d.displayName)), typeof d == "function" && vt.set(d, ye), ye;
|
|
7347
7347
|
}
|
|
7348
|
-
while (
|
|
7348
|
+
while (K >= 1 && z >= 0);
|
|
7349
7349
|
break;
|
|
7350
7350
|
}
|
|
7351
7351
|
}
|
|
7352
7352
|
} finally {
|
|
7353
|
-
Yt = !1,
|
|
7353
|
+
Yt = !1, _e.current = D, nt(), Error.prepareStackTrace = $;
|
|
7354
7354
|
}
|
|
7355
|
-
var ze = d ? d.displayName || d.name : "", je = ze ?
|
|
7356
|
-
return typeof d == "function" &&
|
|
7355
|
+
var ze = d ? d.displayName || d.name : "", je = ze ? St(ze) : "";
|
|
7356
|
+
return typeof d == "function" && vt.set(d, je), je;
|
|
7357
7357
|
}
|
|
7358
7358
|
function Hs(d, T, E) {
|
|
7359
7359
|
return tr(d, !1);
|
|
@@ -7362,59 +7362,59 @@ function bu() {
|
|
|
7362
7362
|
var T = d.prototype;
|
|
7363
7363
|
return !!(T && T.isReactComponent);
|
|
7364
7364
|
}
|
|
7365
|
-
function
|
|
7365
|
+
function Et(d, T, E) {
|
|
7366
7366
|
if (d == null)
|
|
7367
7367
|
return "";
|
|
7368
7368
|
if (typeof d == "function")
|
|
7369
7369
|
return tr(d, Js(d));
|
|
7370
7370
|
if (typeof d == "string")
|
|
7371
|
-
return
|
|
7371
|
+
return St(d);
|
|
7372
7372
|
switch (d) {
|
|
7373
7373
|
case l:
|
|
7374
|
-
return
|
|
7374
|
+
return St("Suspense");
|
|
7375
7375
|
case f:
|
|
7376
|
-
return
|
|
7376
|
+
return St("SuspenseList");
|
|
7377
7377
|
}
|
|
7378
7378
|
if (typeof d == "object")
|
|
7379
7379
|
switch (d.$$typeof) {
|
|
7380
7380
|
case u:
|
|
7381
7381
|
return Hs(d.render);
|
|
7382
7382
|
case p:
|
|
7383
|
-
return
|
|
7383
|
+
return Et(d.type, T, E);
|
|
7384
7384
|
case y: {
|
|
7385
|
-
var
|
|
7385
|
+
var k = d, $ = k._payload, D = k._init;
|
|
7386
7386
|
try {
|
|
7387
|
-
return
|
|
7387
|
+
return Et(D($), T, E);
|
|
7388
7388
|
} catch {
|
|
7389
7389
|
}
|
|
7390
7390
|
}
|
|
7391
7391
|
}
|
|
7392
7392
|
return "";
|
|
7393
7393
|
}
|
|
7394
|
-
var rt = Object.prototype.hasOwnProperty, nr = {}, rr =
|
|
7395
|
-
function
|
|
7394
|
+
var rt = Object.prototype.hasOwnProperty, nr = {}, rr = g.ReactDebugCurrentFrame;
|
|
7395
|
+
function Ot(d) {
|
|
7396
7396
|
if (d) {
|
|
7397
|
-
var T = d._owner, E =
|
|
7397
|
+
var T = d._owner, E = Et(d.type, d._source, T ? T.type : null);
|
|
7398
7398
|
rr.setExtraStackFrame(E);
|
|
7399
7399
|
} else
|
|
7400
7400
|
rr.setExtraStackFrame(null);
|
|
7401
7401
|
}
|
|
7402
|
-
function Ys(d, T, E,
|
|
7402
|
+
function Ys(d, T, E, k, $) {
|
|
7403
7403
|
{
|
|
7404
7404
|
var D = Function.call.bind(rt);
|
|
7405
|
-
for (var
|
|
7406
|
-
if (D(d,
|
|
7405
|
+
for (var x in d)
|
|
7406
|
+
if (D(d, x)) {
|
|
7407
7407
|
var M = void 0;
|
|
7408
7408
|
try {
|
|
7409
|
-
if (typeof d[
|
|
7410
|
-
var
|
|
7411
|
-
throw
|
|
7409
|
+
if (typeof d[x] != "function") {
|
|
7410
|
+
var ne = Error((k || "React class") + ": " + E + " type `" + x + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof d[x] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
7411
|
+
throw ne.name = "Invariant Violation", ne;
|
|
7412
7412
|
}
|
|
7413
|
-
M = d[
|
|
7414
|
-
} catch (
|
|
7415
|
-
M =
|
|
7413
|
+
M = d[x](T, x, k, E, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
7414
|
+
} catch (K) {
|
|
7415
|
+
M = K;
|
|
7416
7416
|
}
|
|
7417
|
-
M && !(M instanceof Error) && (
|
|
7417
|
+
M && !(M instanceof Error) && (Ot($), 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).", k || "React class", E, x, typeof M), Ot(null)), M instanceof Error && !(M.message in nr) && (nr[M.message] = !0, Ot($), w("Failed %s type: %s", E, M.message), Ot(null));
|
|
7418
7418
|
}
|
|
7419
7419
|
}
|
|
7420
7420
|
}
|
|
@@ -7442,7 +7442,7 @@ function bu() {
|
|
|
7442
7442
|
if (ei(d))
|
|
7443
7443
|
return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Xs(d)), sr(d);
|
|
7444
7444
|
}
|
|
7445
|
-
var or =
|
|
7445
|
+
var or = g.ReactCurrentOwner, ti = {
|
|
7446
7446
|
key: !0,
|
|
7447
7447
|
ref: !0,
|
|
7448
7448
|
__self: !0,
|
|
@@ -7489,7 +7489,7 @@ function bu() {
|
|
|
7489
7489
|
});
|
|
7490
7490
|
}
|
|
7491
7491
|
}
|
|
7492
|
-
var ai = function(d, T, E,
|
|
7492
|
+
var ai = function(d, T, E, k, $, D, x) {
|
|
7493
7493
|
var M = {
|
|
7494
7494
|
// This tag allows us to uniquely identify this as a React Element
|
|
7495
7495
|
$$typeof: t,
|
|
@@ -7497,7 +7497,7 @@ function bu() {
|
|
|
7497
7497
|
type: d,
|
|
7498
7498
|
key: T,
|
|
7499
7499
|
ref: E,
|
|
7500
|
-
props:
|
|
7500
|
+
props: x,
|
|
7501
7501
|
// Record the component responsible for creating this element.
|
|
7502
7502
|
_owner: D
|
|
7503
7503
|
};
|
|
@@ -7510,7 +7510,7 @@ function bu() {
|
|
|
7510
7510
|
configurable: !1,
|
|
7511
7511
|
enumerable: !1,
|
|
7512
7512
|
writable: !1,
|
|
7513
|
-
value:
|
|
7513
|
+
value: k
|
|
7514
7514
|
}), Object.defineProperty(M, "_source", {
|
|
7515
7515
|
configurable: !1,
|
|
7516
7516
|
enumerable: !1,
|
|
@@ -7518,28 +7518,28 @@ function bu() {
|
|
|
7518
7518
|
value: $
|
|
7519
7519
|
}), Object.freeze && (Object.freeze(M.props), Object.freeze(M)), M;
|
|
7520
7520
|
};
|
|
7521
|
-
function ci(d, T, E,
|
|
7521
|
+
function ci(d, T, E, k, $) {
|
|
7522
7522
|
{
|
|
7523
|
-
var D,
|
|
7524
|
-
E !== void 0 && (ir(E), M = "" + E), ri(T) && (ir(T.key), M = "" + T.key), ni(T) && (
|
|
7523
|
+
var D, x = {}, M = null, ne = null;
|
|
7524
|
+
E !== void 0 && (ir(E), M = "" + E), ri(T) && (ir(T.key), M = "" + T.key), ni(T) && (ne = T.ref, si(T, $));
|
|
7525
7525
|
for (D in T)
|
|
7526
|
-
rt.call(T, D) && !ti.hasOwnProperty(D) && (
|
|
7526
|
+
rt.call(T, D) && !ti.hasOwnProperty(D) && (x[D] = T[D]);
|
|
7527
7527
|
if (d && d.defaultProps) {
|
|
7528
|
-
var
|
|
7529
|
-
for (D in
|
|
7530
|
-
|
|
7528
|
+
var K = d.defaultProps;
|
|
7529
|
+
for (D in K)
|
|
7530
|
+
x[D] === void 0 && (x[D] = K[D]);
|
|
7531
7531
|
}
|
|
7532
|
-
if (M ||
|
|
7533
|
-
var
|
|
7534
|
-
M && ii(
|
|
7532
|
+
if (M || ne) {
|
|
7533
|
+
var z = typeof d == "function" ? d.displayName || d.name || "Unknown" : d;
|
|
7534
|
+
M && ii(x, z), ne && oi(x, z);
|
|
7535
7535
|
}
|
|
7536
|
-
return ai(d, M,
|
|
7536
|
+
return ai(d, M, ne, $, k, or.current, x);
|
|
7537
7537
|
}
|
|
7538
7538
|
}
|
|
7539
|
-
var Xt =
|
|
7539
|
+
var Xt = g.ReactCurrentOwner, ur = g.ReactDebugCurrentFrame;
|
|
7540
7540
|
function qe(d) {
|
|
7541
7541
|
if (d) {
|
|
7542
|
-
var T = d._owner, E =
|
|
7542
|
+
var T = d._owner, E = Et(d.type, d._source, T ? T.type : null);
|
|
7543
7543
|
ur.setExtraStackFrame(E);
|
|
7544
7544
|
} else
|
|
7545
7545
|
ur.setExtraStackFrame(null);
|
|
@@ -7586,8 +7586,8 @@ Check the top-level render call using <` + E + ">.");
|
|
|
7586
7586
|
if (fr[E])
|
|
7587
7587
|
return;
|
|
7588
7588
|
fr[E] = !0;
|
|
7589
|
-
var
|
|
7590
|
-
d && d._owner && d._owner !== Xt.current && (
|
|
7589
|
+
var k = "";
|
|
7590
|
+
d && d._owner && d._owner !== Xt.current && (k = " It was passed a child from " + L(d._owner.type) + "."), qe(d), 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, k), qe(null);
|
|
7591
7591
|
}
|
|
7592
7592
|
}
|
|
7593
7593
|
function hr(d, T) {
|
|
@@ -7596,16 +7596,16 @@ Check the top-level render call using <` + E + ">.");
|
|
|
7596
7596
|
return;
|
|
7597
7597
|
if (Zt(d))
|
|
7598
7598
|
for (var E = 0; E < d.length; E++) {
|
|
7599
|
-
var
|
|
7600
|
-
tn(
|
|
7599
|
+
var k = d[E];
|
|
7600
|
+
tn(k) && dr(k, T);
|
|
7601
7601
|
}
|
|
7602
7602
|
else if (tn(d))
|
|
7603
7603
|
d._store && (d._store.validated = !0);
|
|
7604
7604
|
else if (d) {
|
|
7605
7605
|
var $ = S(d);
|
|
7606
7606
|
if (typeof $ == "function" && $ !== d.entries)
|
|
7607
|
-
for (var D = $.call(d),
|
|
7608
|
-
tn(
|
|
7607
|
+
for (var D = $.call(d), x; !(x = D.next()).done; )
|
|
7608
|
+
tn(x.value) && dr(x.value, T);
|
|
7609
7609
|
}
|
|
7610
7610
|
}
|
|
7611
7611
|
}
|
|
@@ -7624,8 +7624,8 @@ Check the top-level render call using <` + E + ">.");
|
|
|
7624
7624
|
else
|
|
7625
7625
|
return;
|
|
7626
7626
|
if (E) {
|
|
7627
|
-
var
|
|
7628
|
-
Ys(E, d.props, "prop",
|
|
7627
|
+
var k = L(T);
|
|
7628
|
+
Ys(E, d.props, "prop", k, d);
|
|
7629
7629
|
} else if (T.PropTypes !== void 0 && !en) {
|
|
7630
7630
|
en = !0;
|
|
7631
7631
|
var $ = L(T);
|
|
@@ -7637,9 +7637,9 @@ Check the top-level render call using <` + E + ">.");
|
|
|
7637
7637
|
function di(d) {
|
|
7638
7638
|
{
|
|
7639
7639
|
for (var T = Object.keys(d.props), E = 0; E < T.length; E++) {
|
|
7640
|
-
var
|
|
7641
|
-
if (
|
|
7642
|
-
qe(d), w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",
|
|
7640
|
+
var k = T[E];
|
|
7641
|
+
if (k !== "children" && k !== "key") {
|
|
7642
|
+
qe(d), w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", k), qe(null);
|
|
7643
7643
|
break;
|
|
7644
7644
|
}
|
|
7645
7645
|
}
|
|
@@ -7647,39 +7647,39 @@ Check the top-level render call using <` + E + ">.");
|
|
|
7647
7647
|
}
|
|
7648
7648
|
}
|
|
7649
7649
|
var pr = {};
|
|
7650
|
-
function yr(d, T, E,
|
|
7650
|
+
function yr(d, T, E, k, $, D) {
|
|
7651
7651
|
{
|
|
7652
|
-
var
|
|
7653
|
-
if (!
|
|
7652
|
+
var x = Me(d);
|
|
7653
|
+
if (!x) {
|
|
7654
7654
|
var M = "";
|
|
7655
7655
|
(d === void 0 || typeof d == "object" && d !== null && Object.keys(d).length === 0) && (M += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
7656
|
-
var
|
|
7657
|
-
|
|
7658
|
-
var
|
|
7659
|
-
d === null ?
|
|
7656
|
+
var ne = ui();
|
|
7657
|
+
ne ? M += ne : M += lr();
|
|
7658
|
+
var K;
|
|
7659
|
+
d === null ? K = "null" : Zt(d) ? K = "array" : d !== void 0 && d.$$typeof === t ? (K = "<" + (L(d.type) || "Unknown") + " />", M = " Did you accidentally export a JSX literal instead of a component?") : K = typeof d, w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", K, M);
|
|
7660
7660
|
}
|
|
7661
|
-
var
|
|
7662
|
-
if (
|
|
7663
|
-
return
|
|
7664
|
-
if (
|
|
7665
|
-
var
|
|
7666
|
-
if (
|
|
7667
|
-
if (
|
|
7668
|
-
if (Zt(
|
|
7669
|
-
for (var ze = 0; ze <
|
|
7670
|
-
hr(
|
|
7671
|
-
Object.freeze && Object.freeze(
|
|
7661
|
+
var z = ci(d, T, E, $, D);
|
|
7662
|
+
if (z == null)
|
|
7663
|
+
return z;
|
|
7664
|
+
if (x) {
|
|
7665
|
+
var ye = T.children;
|
|
7666
|
+
if (ye !== void 0)
|
|
7667
|
+
if (k)
|
|
7668
|
+
if (Zt(ye)) {
|
|
7669
|
+
for (var ze = 0; ze < ye.length; ze++)
|
|
7670
|
+
hr(ye[ze], d);
|
|
7671
|
+
Object.freeze && Object.freeze(ye);
|
|
7672
7672
|
} else
|
|
7673
7673
|
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.");
|
|
7674
7674
|
else
|
|
7675
|
-
hr(
|
|
7675
|
+
hr(ye, d);
|
|
7676
7676
|
}
|
|
7677
7677
|
if (rt.call(T, "key")) {
|
|
7678
|
-
var je = L(d),
|
|
7678
|
+
var je = L(d), ae = Object.keys(T).filter(function(_i) {
|
|
7679
7679
|
return _i !== "key";
|
|
7680
|
-
}), nn =
|
|
7680
|
+
}), nn = ae.length > 0 ? "{key: someKey, " + ae.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
7681
7681
|
if (!pr[je + nn]) {
|
|
7682
|
-
var gi =
|
|
7682
|
+
var gi = ae.length > 0 ? "{" + ae.join(": ..., ") + ": ...}" : "{}";
|
|
7683
7683
|
w(`A props object containing a "key" prop is being spread into JSX:
|
|
7684
7684
|
let props = %s;
|
|
7685
7685
|
<%s {...props} />
|
|
@@ -7688,7 +7688,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
7688
7688
|
<%s key={someKey} {...props} />`, nn, je, gi, je), pr[je + nn] = !0;
|
|
7689
7689
|
}
|
|
7690
7690
|
}
|
|
7691
|
-
return d === s ? di(
|
|
7691
|
+
return d === s ? di(z) : fi(z), z;
|
|
7692
7692
|
}
|
|
7693
7693
|
}
|
|
7694
7694
|
function hi(d, T, E) {
|
|
@@ -7915,7 +7915,7 @@ const Cu = {
|
|
|
7915
7915
|
user: void 0,
|
|
7916
7916
|
error: void 0
|
|
7917
7917
|
};
|
|
7918
|
-
class
|
|
7918
|
+
class $t {
|
|
7919
7919
|
constructor(e, t) {
|
|
7920
7920
|
h(this, "tx", Yn());
|
|
7921
7921
|
h(this, "auth");
|
|
@@ -8061,7 +8061,7 @@ class xt {
|
|
|
8061
8061
|
h(this, "useUser", () => {
|
|
8062
8062
|
const { user: e } = this.useAuth();
|
|
8063
8063
|
if (!e)
|
|
8064
|
-
throw new
|
|
8064
|
+
throw new se("useUser must be used within an auth-protected route");
|
|
8065
8065
|
return e;
|
|
8066
8066
|
});
|
|
8067
8067
|
/**
|
|
@@ -8185,7 +8185,7 @@ class xt {
|
|
|
8185
8185
|
return this.core.getAuth();
|
|
8186
8186
|
}
|
|
8187
8187
|
}
|
|
8188
|
-
h(
|
|
8188
|
+
h($t, "Store"), h($t, "NetworkListener"), h($t, "EventSourceImpl");
|
|
8189
8189
|
class Zr extends Error {
|
|
8190
8190
|
constructor(e, t) {
|
|
8191
8191
|
super(e), this.name = "ParseError", this.type = t.type, this.field = t.field, this.value = t.value, this.line = t.line;
|
|
@@ -8200,31 +8200,31 @@ function Iu(n) {
|
|
|
8200
8200
|
);
|
|
8201
8201
|
const { onEvent: e = fn, onError: t = fn, onRetry: r = fn, onComment: s } = n;
|
|
8202
8202
|
let i = "", o = !0, a, c = "", u = "";
|
|
8203
|
-
function l(
|
|
8204
|
-
const m = o ?
|
|
8203
|
+
function l(_) {
|
|
8204
|
+
const m = o ? _.replace(/^\xEF\xBB\xBF/, "") : _, [S, g] = Pu(`${i}${m}`);
|
|
8205
8205
|
for (const w of S)
|
|
8206
8206
|
f(w);
|
|
8207
|
-
i =
|
|
8207
|
+
i = g, o = !1;
|
|
8208
8208
|
}
|
|
8209
|
-
function f(
|
|
8210
|
-
if (
|
|
8209
|
+
function f(_) {
|
|
8210
|
+
if (_ === "") {
|
|
8211
8211
|
y();
|
|
8212
8212
|
return;
|
|
8213
8213
|
}
|
|
8214
|
-
if (
|
|
8215
|
-
s && s(
|
|
8214
|
+
if (_.startsWith(":")) {
|
|
8215
|
+
s && s(_.slice(_.startsWith(": ") ? 2 : 1));
|
|
8216
8216
|
return;
|
|
8217
8217
|
}
|
|
8218
|
-
const m =
|
|
8218
|
+
const m = _.indexOf(":");
|
|
8219
8219
|
if (m !== -1) {
|
|
8220
|
-
const S =
|
|
8221
|
-
p(S, w,
|
|
8220
|
+
const S = _.slice(0, m), g = _[m + 1] === " " ? 2 : 1, w = _.slice(m + g);
|
|
8221
|
+
p(S, w, _);
|
|
8222
8222
|
return;
|
|
8223
8223
|
}
|
|
8224
|
-
p(
|
|
8224
|
+
p(_, "", _);
|
|
8225
8225
|
}
|
|
8226
|
-
function p(
|
|
8227
|
-
switch (
|
|
8226
|
+
function p(_, m, S) {
|
|
8227
|
+
switch (_) {
|
|
8228
8228
|
case "event":
|
|
8229
8229
|
u = m;
|
|
8230
8230
|
break;
|
|
@@ -8247,8 +8247,8 @@ function Iu(n) {
|
|
|
8247
8247
|
default:
|
|
8248
8248
|
t(
|
|
8249
8249
|
new Zr(
|
|
8250
|
-
`Unknown field "${
|
|
8251
|
-
{ type: "unknown-field", field:
|
|
8250
|
+
`Unknown field "${_.length > 20 ? `${_.slice(0, 20)}…` : _}"`,
|
|
8251
|
+
{ type: "unknown-field", field: _, value: m, line: S }
|
|
8252
8252
|
)
|
|
8253
8253
|
);
|
|
8254
8254
|
break;
|
|
@@ -8264,8 +8264,8 @@ function Iu(n) {
|
|
|
8264
8264
|
`) ? c.slice(0, -1) : c
|
|
8265
8265
|
}), a = void 0, c = "", u = "";
|
|
8266
8266
|
}
|
|
8267
|
-
function b(
|
|
8268
|
-
i &&
|
|
8267
|
+
function b(_ = {}) {
|
|
8268
|
+
i && _.consume && f(i), o = !0, a = void 0, c = "", u = "", i = "";
|
|
8269
8269
|
}
|
|
8270
8270
|
return { feed: l, reset: b };
|
|
8271
8271
|
}
|
|
@@ -8348,54 +8348,54 @@ function es(n) {
|
|
|
8348
8348
|
}
|
|
8349
8349
|
var Bs = (n) => {
|
|
8350
8350
|
throw TypeError(n);
|
|
8351
|
-
}, er = (n, e, t) => e.has(n) || Bs("Cannot " + t),
|
|
8352
|
-
class
|
|
8351
|
+
}, er = (n, e, t) => e.has(n) || Bs("Cannot " + t), P = (n, e, t) => (er(n, e, "read from private field"), t ? t.call(n) : e.get(n)), G = (n, e, t) => e.has(n) ? Bs("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), N = (n, e, t, r) => (er(n, e, "write to private field"), e.set(n, t), t), Ae = (n, e, t) => (er(n, e, "access private method"), t), ce, De, Ge, Dt, qt, yt, Je, bt, Ie, Qe, Ze, He, lt, me, jn, xn, $n, ts, Dn, Un, ft, Ln, Fn;
|
|
8352
|
+
class Ut extends EventTarget {
|
|
8353
8353
|
constructor(e, t) {
|
|
8354
8354
|
var r, s;
|
|
8355
|
-
super(), G(this,
|
|
8355
|
+
super(), G(this, me), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, G(this, ce), G(this, De), G(this, Ge), G(this, Dt), G(this, qt), G(this, yt), G(this, Je), G(this, bt, null), G(this, Ie), G(this, Qe), G(this, Ze, null), G(this, He, null), G(this, lt, null), G(this, xn, async (i) => {
|
|
8356
8356
|
var o;
|
|
8357
|
-
|
|
8357
|
+
P(this, Qe).reset();
|
|
8358
8358
|
const { body: a, redirected: c, status: u, headers: l } = i;
|
|
8359
8359
|
if (u === 204) {
|
|
8360
|
-
Ae(this,
|
|
8360
|
+
Ae(this, me, ft).call(this, "Server sent HTTP 204, not reconnecting", 204), this.close();
|
|
8361
8361
|
return;
|
|
8362
8362
|
}
|
|
8363
8363
|
if (c ? N(this, Ge, new URL(i.url)) : N(this, Ge, void 0), u !== 200) {
|
|
8364
|
-
Ae(this,
|
|
8364
|
+
Ae(this, me, ft).call(this, `Non-200 status code (${u})`, u);
|
|
8365
8365
|
return;
|
|
8366
8366
|
}
|
|
8367
8367
|
if (!(l.get("content-type") || "").startsWith("text/event-stream")) {
|
|
8368
|
-
Ae(this,
|
|
8368
|
+
Ae(this, me, ft).call(this, 'Invalid content type, expected "text/event-stream"', u);
|
|
8369
8369
|
return;
|
|
8370
8370
|
}
|
|
8371
|
-
if (
|
|
8371
|
+
if (P(this, ce) === this.CLOSED)
|
|
8372
8372
|
return;
|
|
8373
|
-
N(this,
|
|
8373
|
+
N(this, ce, this.OPEN);
|
|
8374
8374
|
const f = new Event("open");
|
|
8375
|
-
if ((o =
|
|
8376
|
-
Ae(this,
|
|
8375
|
+
if ((o = P(this, lt)) == null || o.call(this, f), this.dispatchEvent(f), typeof a != "object" || !a || !("getReader" in a)) {
|
|
8376
|
+
Ae(this, me, ft).call(this, "Invalid response body, expected a web ReadableStream", u), this.close();
|
|
8377
8377
|
return;
|
|
8378
8378
|
}
|
|
8379
8379
|
const p = new TextDecoder(), y = a.getReader();
|
|
8380
8380
|
let b = !0;
|
|
8381
8381
|
do {
|
|
8382
|
-
const { done:
|
|
8383
|
-
m &&
|
|
8382
|
+
const { done: _, value: m } = await y.read();
|
|
8383
|
+
m && P(this, Qe).feed(p.decode(m, { stream: !_ })), _ && (b = !1, P(this, Qe).reset(), Ae(this, me, Ln).call(this));
|
|
8384
8384
|
} while (b);
|
|
8385
8385
|
}), G(this, $n, (i) => {
|
|
8386
|
-
N(this, Ie, void 0), !(i.name === "AbortError" || i.type === "aborted") && Ae(this,
|
|
8386
|
+
N(this, Ie, void 0), !(i.name === "AbortError" || i.type === "aborted") && Ae(this, me, Ln).call(this, Rn(i));
|
|
8387
8387
|
}), G(this, Dn, (i) => {
|
|
8388
8388
|
typeof i.id == "string" && N(this, bt, i.id);
|
|
8389
8389
|
const o = new MessageEvent(i.event || "message", {
|
|
8390
8390
|
data: i.data,
|
|
8391
|
-
origin:
|
|
8391
|
+
origin: P(this, Ge) ? P(this, Ge).origin : P(this, De).origin,
|
|
8392
8392
|
lastEventId: i.id || ""
|
|
8393
8393
|
});
|
|
8394
|
-
|
|
8394
|
+
P(this, He) && (!i.event || i.event === "message") && P(this, He).call(this, o), this.dispatchEvent(o);
|
|
8395
8395
|
}), G(this, Un, (i) => {
|
|
8396
8396
|
N(this, yt, i);
|
|
8397
8397
|
}), G(this, Fn, () => {
|
|
8398
|
-
N(this, Je, void 0),
|
|
8398
|
+
N(this, Je, void 0), P(this, ce) === this.CONNECTING && Ae(this, me, jn).call(this);
|
|
8399
8399
|
});
|
|
8400
8400
|
try {
|
|
8401
8401
|
if (e instanceof URL)
|
|
@@ -8408,9 +8408,9 @@ class Dt extends EventTarget {
|
|
|
8408
8408
|
throw Mu("An invalid or illegal string was specified");
|
|
8409
8409
|
}
|
|
8410
8410
|
N(this, Qe, Iu({
|
|
8411
|
-
onEvent:
|
|
8412
|
-
onRetry:
|
|
8413
|
-
})), N(this,
|
|
8411
|
+
onEvent: P(this, Dn),
|
|
8412
|
+
onRetry: P(this, Un)
|
|
8413
|
+
})), N(this, ce, this.CONNECTING), N(this, yt, 3e3), N(this, qt, (r = t == null ? void 0 : t.fetch) != null ? r : globalThis.fetch), N(this, Dt, (s = t == null ? void 0 : t.withCredentials) != null ? s : !1), Ae(this, me, jn).call(this);
|
|
8414
8414
|
}
|
|
8415
8415
|
/**
|
|
8416
8416
|
* Returns the state of this EventSource object's connection. It can have the values described below.
|
|
@@ -8423,7 +8423,7 @@ class Dt extends EventTarget {
|
|
|
8423
8423
|
* @public
|
|
8424
8424
|
*/
|
|
8425
8425
|
get readyState() {
|
|
8426
|
-
return
|
|
8426
|
+
return P(this, ce);
|
|
8427
8427
|
}
|
|
8428
8428
|
/**
|
|
8429
8429
|
* Returns the URL providing the event stream.
|
|
@@ -8433,7 +8433,7 @@ class Dt extends EventTarget {
|
|
|
8433
8433
|
* @public
|
|
8434
8434
|
*/
|
|
8435
8435
|
get url() {
|
|
8436
|
-
return
|
|
8436
|
+
return P(this, De).href;
|
|
8437
8437
|
}
|
|
8438
8438
|
/**
|
|
8439
8439
|
* Returns true if the credentials mode for connection requests to the URL providing the event stream is set to "include", and false otherwise.
|
|
@@ -8441,25 +8441,25 @@ class Dt extends EventTarget {
|
|
|
8441
8441
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/withCredentials)
|
|
8442
8442
|
*/
|
|
8443
8443
|
get withCredentials() {
|
|
8444
|
-
return
|
|
8444
|
+
return P(this, Dt);
|
|
8445
8445
|
}
|
|
8446
8446
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */
|
|
8447
8447
|
get onerror() {
|
|
8448
|
-
return
|
|
8448
|
+
return P(this, Ze);
|
|
8449
8449
|
}
|
|
8450
8450
|
set onerror(e) {
|
|
8451
8451
|
N(this, Ze, e);
|
|
8452
8452
|
}
|
|
8453
8453
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */
|
|
8454
8454
|
get onmessage() {
|
|
8455
|
-
return
|
|
8455
|
+
return P(this, He);
|
|
8456
8456
|
}
|
|
8457
8457
|
set onmessage(e) {
|
|
8458
8458
|
N(this, He, e);
|
|
8459
8459
|
}
|
|
8460
8460
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */
|
|
8461
8461
|
get onopen() {
|
|
8462
|
-
return
|
|
8462
|
+
return P(this, lt);
|
|
8463
8463
|
}
|
|
8464
8464
|
set onopen(e) {
|
|
8465
8465
|
N(this, lt, e);
|
|
@@ -8480,16 +8480,16 @@ class Dt extends EventTarget {
|
|
|
8480
8480
|
* @public
|
|
8481
8481
|
*/
|
|
8482
8482
|
close() {
|
|
8483
|
-
|
|
8483
|
+
P(this, Je) && clearTimeout(P(this, Je)), P(this, ce) !== this.CLOSED && (P(this, Ie) && P(this, Ie).abort(), N(this, ce, this.CLOSED), N(this, Ie, void 0));
|
|
8484
8484
|
}
|
|
8485
8485
|
}
|
|
8486
|
-
|
|
8486
|
+
ce = /* @__PURE__ */ new WeakMap(), De = /* @__PURE__ */ new WeakMap(), Ge = /* @__PURE__ */ new WeakMap(), Dt = /* @__PURE__ */ new WeakMap(), qt = /* @__PURE__ */ new WeakMap(), yt = /* @__PURE__ */ new WeakMap(), Je = /* @__PURE__ */ new WeakMap(), bt = /* @__PURE__ */ new WeakMap(), Ie = /* @__PURE__ */ new WeakMap(), Qe = /* @__PURE__ */ new WeakMap(), Ze = /* @__PURE__ */ new WeakMap(), He = /* @__PURE__ */ new WeakMap(), lt = /* @__PURE__ */ new WeakMap(), me = /* @__PURE__ */ new WeakSet(), /**
|
|
8487
8487
|
* Connect to the given URL and start receiving events
|
|
8488
8488
|
*
|
|
8489
8489
|
* @internal
|
|
8490
8490
|
*/
|
|
8491
8491
|
jn = function() {
|
|
8492
|
-
N(this,
|
|
8492
|
+
N(this, ce, this.CONNECTING), N(this, Ie, new AbortController()), P(this, qt)(P(this, De), Ae(this, me, ts).call(this)).then(P(this, xn)).catch(P(this, $n));
|
|
8493
8493
|
}, xn = /* @__PURE__ */ new WeakMap(), $n = /* @__PURE__ */ new WeakMap(), /**
|
|
8494
8494
|
* Get request options for the `fetch()` request
|
|
8495
8495
|
*
|
|
@@ -8503,9 +8503,9 @@ ts = function() {
|
|
|
8503
8503
|
// [spec] …will have their mode set to "cors"…
|
|
8504
8504
|
mode: "cors",
|
|
8505
8505
|
redirect: "follow",
|
|
8506
|
-
headers: { Accept: "text/event-stream", ...
|
|
8506
|
+
headers: { Accept: "text/event-stream", ...P(this, bt) ? { "Last-Event-ID": P(this, bt) } : void 0 },
|
|
8507
8507
|
cache: "no-store",
|
|
8508
|
-
signal: (n =
|
|
8508
|
+
signal: (n = P(this, Ie)) == null ? void 0 : n.signal
|
|
8509
8509
|
};
|
|
8510
8510
|
return "window" in globalThis && (e.credentials = this.withCredentials ? "include" : "same-origin"), e;
|
|
8511
8511
|
}, Dn = /* @__PURE__ */ new WeakMap(), Un = /* @__PURE__ */ new WeakMap(), /**
|
|
@@ -8517,9 +8517,9 @@ ts = function() {
|
|
|
8517
8517
|
*/
|
|
8518
8518
|
ft = function(n, e) {
|
|
8519
8519
|
var t;
|
|
8520
|
-
|
|
8520
|
+
P(this, ce) !== this.CLOSED && N(this, ce, this.CLOSED);
|
|
8521
8521
|
const r = new Xr("error", { code: e, message: n });
|
|
8522
|
-
(t =
|
|
8522
|
+
(t = P(this, Ze)) == null || t.call(this, r), this.dispatchEvent(r);
|
|
8523
8523
|
}, /**
|
|
8524
8524
|
* Schedules a reconnection attempt against the EventSource endpoint.
|
|
8525
8525
|
*
|
|
@@ -8529,34 +8529,34 @@ ft = function(n, e) {
|
|
|
8529
8529
|
*/
|
|
8530
8530
|
Ln = function(n, e) {
|
|
8531
8531
|
var t;
|
|
8532
|
-
if (
|
|
8532
|
+
if (P(this, ce) === this.CLOSED)
|
|
8533
8533
|
return;
|
|
8534
|
-
N(this,
|
|
8534
|
+
N(this, ce, this.CONNECTING);
|
|
8535
8535
|
const r = new Xr("error", { code: e, message: n });
|
|
8536
|
-
(t =
|
|
8536
|
+
(t = P(this, Ze)) == null || t.call(this, r), this.dispatchEvent(r), N(this, Je, setTimeout(P(this, Fn), P(this, yt)));
|
|
8537
8537
|
}, Fn = /* @__PURE__ */ new WeakMap(), /**
|
|
8538
8538
|
* ReadyState representing an EventSource currently trying to connect
|
|
8539
8539
|
*
|
|
8540
8540
|
* @public
|
|
8541
8541
|
*/
|
|
8542
|
-
|
|
8542
|
+
Ut.CONNECTING = 0, /**
|
|
8543
8543
|
* ReadyState representing an EventSource connection that is open (eg connected)
|
|
8544
8544
|
*
|
|
8545
8545
|
* @public
|
|
8546
8546
|
*/
|
|
8547
|
-
|
|
8547
|
+
Ut.OPEN = 1, /**
|
|
8548
8548
|
* ReadyState representing an EventSource connection that is closed (eg disconnected)
|
|
8549
8549
|
*
|
|
8550
8550
|
* @public
|
|
8551
8551
|
*/
|
|
8552
|
-
|
|
8552
|
+
Ut.CLOSED = 2;
|
|
8553
8553
|
function Ru() {
|
|
8554
8554
|
const n = "document" in globalThis ? globalThis.document : void 0;
|
|
8555
8555
|
return n && typeof n == "object" && "baseURI" in n && typeof n.baseURI == "string" ? n.baseURI : void 0;
|
|
8556
8556
|
}
|
|
8557
|
-
class Gs extends
|
|
8557
|
+
class Gs extends $t {
|
|
8558
8558
|
}
|
|
8559
|
-
h(Gs, "EventSourceImpl",
|
|
8559
|
+
h(Gs, "EventSourceImpl", Ut);
|
|
8560
8560
|
function ju(n) {
|
|
8561
8561
|
const e = {
|
|
8562
8562
|
...n,
|
|
@@ -8582,39 +8582,39 @@ function zu({
|
|
|
8582
8582
|
const l = e || `cursors-space-default--${String(t.type)}-${t.id}`, f = t.usePresence({
|
|
8583
8583
|
keys: [l]
|
|
8584
8584
|
}), p = t._core._reactor.getPresence(t.type, t.id);
|
|
8585
|
-
function y(
|
|
8586
|
-
const O = w.clientX, v = w.clientY,
|
|
8585
|
+
function y(g, w) {
|
|
8586
|
+
const O = w.clientX, v = w.clientY, C = (O - g.left) / g.width * 100, j = (v - g.top) / g.height * 100;
|
|
8587
8587
|
f.publishPresence({
|
|
8588
8588
|
[l]: {
|
|
8589
8589
|
x: O,
|
|
8590
8590
|
y: v,
|
|
8591
|
-
xPercent:
|
|
8592
|
-
yPercent:
|
|
8591
|
+
xPercent: C,
|
|
8592
|
+
yPercent: j,
|
|
8593
8593
|
color: i
|
|
8594
8594
|
}
|
|
8595
8595
|
});
|
|
8596
8596
|
}
|
|
8597
|
-
function b(
|
|
8598
|
-
c ||
|
|
8599
|
-
const w =
|
|
8600
|
-
y(w,
|
|
8597
|
+
function b(g) {
|
|
8598
|
+
c || g.stopPropagation();
|
|
8599
|
+
const w = g.currentTarget.getBoundingClientRect();
|
|
8600
|
+
y(w, g);
|
|
8601
8601
|
}
|
|
8602
|
-
function g
|
|
8602
|
+
function _(g) {
|
|
8603
8603
|
f.publishPresence({
|
|
8604
8604
|
[l]: void 0
|
|
8605
8605
|
});
|
|
8606
8606
|
}
|
|
8607
|
-
function m(
|
|
8608
|
-
if (
|
|
8607
|
+
function m(g) {
|
|
8608
|
+
if (g.touches.length !== 1)
|
|
8609
8609
|
return;
|
|
8610
|
-
const w =
|
|
8610
|
+
const w = g.touches[0];
|
|
8611
8611
|
if (w.target instanceof Element) {
|
|
8612
|
-
c ||
|
|
8612
|
+
c || g.stopPropagation();
|
|
8613
8613
|
const O = w.target.getBoundingClientRect();
|
|
8614
8614
|
y(O, w);
|
|
8615
8615
|
}
|
|
8616
8616
|
}
|
|
8617
|
-
function S(
|
|
8617
|
+
function S(g) {
|
|
8618
8618
|
f.publishPresence({
|
|
8619
8619
|
[l]: void 0
|
|
8620
8620
|
});
|
|
@@ -8623,7 +8623,7 @@ function zu({
|
|
|
8623
8623
|
n,
|
|
8624
8624
|
{
|
|
8625
8625
|
onMouseMove: b,
|
|
8626
|
-
onMouseOut:
|
|
8626
|
+
onMouseOut: _,
|
|
8627
8627
|
onTouchMove: m,
|
|
8628
8628
|
onTouchEnd: S,
|
|
8629
8629
|
className: r,
|
|
@@ -8642,7 +8642,7 @@ function zu({
|
|
|
8642
8642
|
...$u,
|
|
8643
8643
|
zIndex: u !== void 0 ? u : Du
|
|
8644
8644
|
},
|
|
8645
|
-
children: Object.entries(f.peers).map(([
|
|
8645
|
+
children: Object.entries(f.peers).map(([g, w]) => {
|
|
8646
8646
|
const O = w[l];
|
|
8647
8647
|
return O ? /* @__PURE__ */ Z.jsx(
|
|
8648
8648
|
"div",
|
|
@@ -8655,10 +8655,10 @@ function zu({
|
|
|
8655
8655
|
},
|
|
8656
8656
|
children: a ? a({
|
|
8657
8657
|
color: O.color,
|
|
8658
|
-
presence: p == null ? void 0 : p.peers[
|
|
8658
|
+
presence: p == null ? void 0 : p.peers[g]
|
|
8659
8659
|
}) : /* @__PURE__ */ Z.jsx(xu, { ...O })
|
|
8660
8660
|
},
|
|
8661
|
-
|
|
8661
|
+
g
|
|
8662
8662
|
) : null;
|
|
8663
8663
|
})
|
|
8664
8664
|
},
|
|
@@ -8727,8 +8727,8 @@ const ns = {
|
|
|
8727
8727
|
}, Du = 99999;
|
|
8728
8728
|
export {
|
|
8729
8729
|
zu as Cursors,
|
|
8730
|
-
|
|
8731
|
-
|
|
8730
|
+
Bt as InstantAPIError,
|
|
8731
|
+
$t as InstantReactAbstractDatabase,
|
|
8732
8732
|
Gs as InstantReactWebDatabase,
|
|
8733
8733
|
Na as StoreInterface,
|
|
8734
8734
|
xe as SyncTableCallbackEventType,
|