@instantdb/react 0.22.154 → 0.22.155-branch-drewh-typesafe-e2e.22783295017.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 +392 -384
- package/dist/standalone/index.umd.cjs +10 -10
- package/package.json +4 -4
package/dist/standalone/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var mi = Object.defineProperty;
|
|
2
2
|
var wi = (n, e, t) => e in n ? mi(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
3
|
var h = (n, e, t) => wi(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import rs, { useRef as gt, useCallback as
|
|
5
|
-
function
|
|
4
|
+
import rs, { useRef as gt, useCallback as Me, useSyncExternalStore as dn, useEffect as Fe, useMemo as hn, useState as ss, createElement as Ti } from "react";
|
|
5
|
+
function J(n) {
|
|
6
6
|
if (typeof n == "number")
|
|
7
7
|
return (Math.abs(n * 2654435761) >>> 0).toString(16);
|
|
8
8
|
if (typeof n == "boolean")
|
|
@@ -21,7 +21,7 @@ function H(n) {
|
|
|
21
21
|
let e = 2166136261;
|
|
22
22
|
for (let t = 0; t < n.length; t++) {
|
|
23
23
|
e ^= (t + 1) * 2654435761;
|
|
24
|
-
const r =
|
|
24
|
+
const r = J(n[t]);
|
|
25
25
|
for (let s = 0; s < r.length; s++)
|
|
26
26
|
e ^= r.charCodeAt(s), e *= 16777619, e = e >>> 0;
|
|
27
27
|
}
|
|
@@ -31,20 +31,20 @@ function H(n) {
|
|
|
31
31
|
let e = 2166136261;
|
|
32
32
|
const t = Object.keys(n).sort();
|
|
33
33
|
for (let r = 0; r < t.length; r++) {
|
|
34
|
-
const s = t[r], i =
|
|
34
|
+
const s = t[r], i = J(s);
|
|
35
35
|
e ^= parseInt(i, 16), e *= 16777619, e = e >>> 0;
|
|
36
|
-
const o =
|
|
36
|
+
const o = J(n[s]);
|
|
37
37
|
e ^= parseInt(o, 16), e *= 16777619, e = e >>> 0;
|
|
38
38
|
}
|
|
39
39
|
return e.toString(16);
|
|
40
40
|
}
|
|
41
|
-
return
|
|
41
|
+
return J(String(n));
|
|
42
42
|
}
|
|
43
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__"), Mt = Symbol.iterator,
|
|
47
|
+
}, is = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), Si = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), Mt = Symbol.iterator, pe = {
|
|
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 he(n) {
|
|
72
72
|
var e;
|
|
73
73
|
return (e = n.copy) !== null && e !== void 0 ? e : n.original;
|
|
74
74
|
}
|
|
@@ -83,15 +83,15 @@ 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 Se(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, pe)) === pe.immutable || typeof t == "function");
|
|
91
91
|
}
|
|
92
92
|
function os(n, e = []) {
|
|
93
93
|
if (Object.hasOwnProperty.call(n, "key")) {
|
|
94
|
-
const t = n.parent.copy, r = R(
|
|
94
|
+
const t = n.parent.copy, r = R(Ie(t, n.key));
|
|
95
95
|
if (r !== null && (r == null ? void 0 : r.original) !== n.original)
|
|
96
96
|
return null;
|
|
97
97
|
const s = n.parent.type === 3, i = s ? Array.from(n.parent.setMap.keys()).indexOf(n.key) : n.key;
|
|
@@ -112,7 +112,7 @@ function os(n, e = []) {
|
|
|
112
112
|
function We(n) {
|
|
113
113
|
return Array.isArray(n) ? 1 : n instanceof Map ? 2 : n instanceof Set ? 3 : 0;
|
|
114
114
|
}
|
|
115
|
-
function
|
|
115
|
+
function Ie(n, e) {
|
|
116
116
|
return We(n) === 2 ? n.get(e) : n[e];
|
|
117
117
|
}
|
|
118
118
|
function mt(n, e, t) {
|
|
@@ -120,9 +120,9 @@ 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 ? he(t) : n)[e];
|
|
124
124
|
}
|
|
125
|
-
function
|
|
125
|
+
function Ce(n, e) {
|
|
126
126
|
return n === e ? n !== 0 || 1 / n === 1 / e : n !== n && e !== e;
|
|
127
127
|
}
|
|
128
128
|
function pn(n) {
|
|
@@ -139,7 +139,7 @@ function Ue(n, e) {
|
|
|
139
139
|
function vi(n, e) {
|
|
140
140
|
for (let t = 0; t < e.length - 1; t += 1) {
|
|
141
141
|
const r = e[t];
|
|
142
|
-
if (n =
|
|
142
|
+
if (n = Ie(We(n) === 3 ? Array.from(n) : n, r), typeof n != "object")
|
|
143
143
|
throw new Error(`Cannot resolve patch at '${e.join("/")}'.`);
|
|
144
144
|
}
|
|
145
145
|
return n;
|
|
@@ -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, pe), t !== void 0) && t !== pe.mutable) {
|
|
181
|
+
if (t === pe.immutable)
|
|
182
182
|
return Ei(n);
|
|
183
183
|
if (typeof t == "function") {
|
|
184
184
|
if (e.enablePatches || e.enableAutoFreeze)
|
|
@@ -200,7 +200,7 @@ 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 (!Se(n))
|
|
204
204
|
return qn(n);
|
|
205
205
|
if (Array.isArray(n))
|
|
206
206
|
return n.map(ot);
|
|
@@ -298,7 +298,7 @@ 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) || !Se(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) => {
|
|
@@ -319,7 +319,7 @@ function cs(n, e, t) {
|
|
|
319
319
|
}
|
|
320
320
|
function Ai(n, e) {
|
|
321
321
|
const t = n.type === 3 ? n.setMap : n.copy;
|
|
322
|
-
n.finalities.revoke.length > 1 && n.assignedMap.get(e) && t && cs(
|
|
322
|
+
n.finalities.revoke.length > 1 && n.assignedMap.get(e) && t && cs(Ie(t, e), n.finalities.handledSet, n.options);
|
|
323
323
|
}
|
|
324
324
|
function yn(n) {
|
|
325
325
|
n.type === 3 && n.copy && (n.copy.clear(), n.setMap.forEach((e) => {
|
|
@@ -340,13 +340,13 @@ function Vn(n, e, t, r) {
|
|
|
340
340
|
s && (s.callbacks || (s.callbacks = []), s.callbacks.push((i, o) => {
|
|
341
341
|
var a;
|
|
342
342
|
const c = n.type === 3 ? n.setMap : n.copy;
|
|
343
|
-
if (
|
|
343
|
+
if (Ce(Ie(c, e), t)) {
|
|
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)), Se(t, n.options) && n.finalities.draft.push(() => {
|
|
348
348
|
const i = n.type === 3 ? n.setMap : n.copy;
|
|
349
|
-
|
|
349
|
+
Ce(Ie(i, e), t) && Ai(n, e);
|
|
350
350
|
});
|
|
351
351
|
}
|
|
352
352
|
function ki(n, e, t, r, s) {
|
|
@@ -397,8 +397,8 @@ 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 =
|
|
401
|
-
if (
|
|
400
|
+
const u = Ie(n, c), l = Rt(Ie(e, c)), f = a ? dt(n, c) ? q.Replace : q.Add : q.Remove;
|
|
401
|
+
if (Ce(u, l) && f === q.Replace)
|
|
402
402
|
return;
|
|
403
403
|
const p = r.concat(c), y = Ue(p, o);
|
|
404
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 });
|
|
@@ -449,18 +449,18 @@ function _t(n, e, t, r) {
|
|
|
449
449
|
}
|
|
450
450
|
}
|
|
451
451
|
const Lt = (n, e, t = !1) => {
|
|
452
|
-
if (typeof n == "object" && n !== null && (!
|
|
452
|
+
if (typeof n == "object" && n !== null && (!Se(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 he(R(this)).size;
|
|
457
457
|
},
|
|
458
458
|
has(n) {
|
|
459
|
-
return
|
|
459
|
+
return he(R(this)).has(n);
|
|
460
460
|
},
|
|
461
461
|
set(n, e) {
|
|
462
|
-
const t = R(this), r =
|
|
463
|
-
return (!r.has(n) || !
|
|
462
|
+
const t = R(this), r = he(t);
|
|
463
|
+
return (!r.has(n) || !Ce(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))
|
|
@@ -479,14 +479,14 @@ const Lt = (n, e, t = !1) => {
|
|
|
479
479
|
},
|
|
480
480
|
forEach(n, e) {
|
|
481
481
|
const t = R(this);
|
|
482
|
-
|
|
482
|
+
he(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 && Lt(s, r.options, i), i || r.finalized || !
|
|
488
|
+
const r = R(this), s = he(r).get(n), i = ((t = (e = r.options).mark) === null || t === void 0 ? void 0 : t.call(e, s, pe)) === pe.mutable;
|
|
489
|
+
if (r.options.strict && Lt(s, r.options, i), i || r.finalized || !Se(s, r.options) || s !== r.original.get(n))
|
|
490
490
|
return s;
|
|
491
491
|
const o = Nn.createDraft({
|
|
492
492
|
original: s,
|
|
@@ -498,7 +498,7 @@ const Lt = (n, e, t = !1) => {
|
|
|
498
498
|
return re(r), r.copy.set(n, o), o;
|
|
499
499
|
},
|
|
500
500
|
keys() {
|
|
501
|
-
return
|
|
501
|
+
return he(R(this)).keys();
|
|
502
502
|
},
|
|
503
503
|
values() {
|
|
504
504
|
const n = this.keys();
|
|
@@ -539,8 +539,8 @@ const Lt = (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 && Lt(o, n.options, u), !u && !c &&
|
|
542
|
+
const c = R(a), u = ((s = (r = n.options).mark) === null || s === void 0 ? void 0 : s.call(r, a, pe)) === pe.mutable;
|
|
543
|
+
if (n.options.strict && Lt(o, n.options, u), !u && !c && Se(o, n.options) && !n.finalized && n.original.has(o)) {
|
|
544
544
|
const l = Nn.createDraft({
|
|
545
545
|
original: o,
|
|
546
546
|
parentDraft: n,
|
|
@@ -654,10 +654,10 @@ const Mi = Reflect.ownKeys(Ft), 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,
|
|
657
|
+
if (o = n.options.mark(u, pe), o === pe.mutable)
|
|
658
658
|
return n.options.strict && Lt(u, n.options, !0), u;
|
|
659
659
|
}
|
|
660
|
-
const a =
|
|
660
|
+
const a = he(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);
|
|
@@ -680,7 +680,7 @@ const Mi = Reflect.ownKeys(Ft), us = /* @__PURE__ */ new WeakSet(), ls = {
|
|
|
680
680
|
) : void 0;
|
|
681
681
|
}
|
|
682
682
|
const c = a[e];
|
|
683
|
-
if (n.options.strict && Lt(c, n.options), n.finalized || !
|
|
683
|
+
if (n.options.strict && Lt(c, n.options), n.finalized || !Se(c, n.options))
|
|
684
684
|
return c;
|
|
685
685
|
if (c === rn(n.original, e)) {
|
|
686
686
|
if (re(n), n.copy[e] = Bn({
|
|
@@ -704,20 +704,20 @@ const Mi = Reflect.ownKeys(Ft), 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(he(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 &&
|
|
710
|
+
const o = rn(he(n), e), a = R(o);
|
|
711
|
+
return a && Ce(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) : (Ce(t, o) && (t !== void 0 || dt(n.original, e)) || (re(n), Oe(n), dt(n.original, e) && Ce(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 he(n);
|
|
715
715
|
},
|
|
716
716
|
ownKeys(n) {
|
|
717
|
-
return Reflect.ownKeys(
|
|
717
|
+
return Reflect.ownKeys(he(n));
|
|
718
718
|
},
|
|
719
719
|
getOwnPropertyDescriptor(n, e) {
|
|
720
|
-
const t =
|
|
720
|
+
const t = he(n), r = Reflect.getOwnPropertyDescriptor(t, e);
|
|
721
721
|
return r && {
|
|
722
722
|
writable: !0,
|
|
723
723
|
configurable: n.type !== 1 || e !== "length",
|
|
@@ -760,7 +760,7 @@ function Bn(n) {
|
|
|
760
760
|
var y, b;
|
|
761
761
|
const _ = R(c);
|
|
762
762
|
let m = l.type === 3 ? l.setMap : l.copy;
|
|
763
|
-
const S =
|
|
763
|
+
const S = Ie(m, r), g = R(S);
|
|
764
764
|
if (g) {
|
|
765
765
|
let w = g.original;
|
|
766
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);
|
|
@@ -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, pe)) === pe.mutable || !Se(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 (!Se(n, t == null ? void 0 : t.options))
|
|
836
836
|
return n;
|
|
837
837
|
const r = We(n);
|
|
838
838
|
if (t && !t.operated)
|
|
@@ -851,7 +851,7 @@ function fs(n) {
|
|
|
851
851
|
} else
|
|
852
852
|
s = n;
|
|
853
853
|
if (zn(s, (o, a) => {
|
|
854
|
-
if (t &&
|
|
854
|
+
if (t && Ce(Ie(t.original, o), a))
|
|
855
855
|
return;
|
|
856
856
|
const c = fs(a);
|
|
857
857
|
c !== a && (s === n && i(), mt(s, o, c));
|
|
@@ -891,11 +891,11 @@ const xi = (n) => function e(t, r, s) {
|
|
|
891
891
|
strict: b,
|
|
892
892
|
enablePatches: y
|
|
893
893
|
};
|
|
894
|
-
if (!
|
|
894
|
+
if (!Se(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
896
|
const [S, g] = ji(f, m);
|
|
897
897
|
if (typeof r != "function") {
|
|
898
|
-
if (!
|
|
898
|
+
if (!Se(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
900
|
return [S, g];
|
|
901
901
|
}
|
|
@@ -908,7 +908,7 @@ const xi = (n) => function e(t, r, s) {
|
|
|
908
908
|
const O = (v) => {
|
|
909
909
|
const C = R(S);
|
|
910
910
|
if (!Ne(v)) {
|
|
911
|
-
if (v !== void 0 && !
|
|
911
|
+
if (v !== void 0 && !Ce(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) {
|
|
@@ -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
|
+
le(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
|
+
le(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
|
+
le(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
|
+
le(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 Te(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 we(n, e) {
|
|
|
1429
1429
|
return;
|
|
1430
1430
|
}
|
|
1431
1431
|
const [t, ...r] = e;
|
|
1432
|
-
n.has(t) &&
|
|
1432
|
+
n.has(t) && Te(n.get(t), r);
|
|
1433
1433
|
}
|
|
1434
|
-
function
|
|
1434
|
+
function le(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 = zt(u), o[2] = u), Qn(l) &&
|
|
1453
|
+
l["checked-data-type"] === "date" && t && (u = zt(u), o[2] = u), Qn(l) && le(i, [u, c, a], o), le(r, [a, c, u], o), le(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: fe(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 = fe(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 = fe(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 && (Te(n.eav, [s, i, o]), Te(n.aev, [i, s, o]), Qn(a) && Te(n.vae, [o, i, s]));
|
|
1514
1514
|
}
|
|
1515
1515
|
let no = 0;
|
|
1516
1516
|
function ws(n, e, t) {
|
|
@@ -1529,7 +1529,7 @@ function Ts(n, e, t) {
|
|
|
1529
1529
|
return;
|
|
1530
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) ? (le(n.eav, [s, i], /* @__PURE__ */ new Map([[o, l]])), le(n.aev, [i, s], /* @__PURE__ */ new Map([[o, l]]))) : (le(n.eav, [s, i, o], l), le(n.aev, [i, s, o], l)), Qn(a) && le(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
|
+
le(n.eav, [s, i], /* @__PURE__ */ new Map([[f, p]])), le(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" && fe(a.get(f), 1).forEach(([y, b, _]) => {
|
|
1568
1568
|
var m;
|
|
1569
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) && (Te(n.aev, [f, o]), Te(n.eav, [o, f]));
|
|
1575
1575
|
}
|
|
1576
|
-
a.size === 0 &&
|
|
1576
|
+
a.size === 0 && Te(n.eav, [o]);
|
|
1577
1577
|
}
|
|
1578
|
-
const c = n.vae.get(o) &&
|
|
1578
|
+
const c = n.vae.get(o) && fe(n.vae.get(o), 2);
|
|
1579
1579
|
c && c.forEach((f) => {
|
|
1580
1580
|
var m, S, g;
|
|
1581
1581
|
const [p, y, b] = f, _ = e.getAttr(y);
|
|
1582
|
-
(!s || !_ || ((m = _["reverse-identity"]) == null ? void 0 : m[1]) === s) && (
|
|
1583
|
-
}), ((l = n.vae.get(o)) == null ? void 0 : l.size) === 0 &&
|
|
1582
|
+
(!s || !_ || ((m = _["reverse-identity"]) == null ? void 0 : m[1]) === s) && (Te(n.eav, [p, y, b]), Te(n.aev, [y, p, b]), Te(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 && Te(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 fe(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 fe(n, e, t = []) {
|
|
1639
1639
|
if (!n || e === 0)
|
|
1640
1640
|
return t;
|
|
1641
1641
|
if (e === 1) {
|
|
@@ -1644,7 +1644,7 @@ function le(n, e, t = []) {
|
|
|
1644
1644
|
return t;
|
|
1645
1645
|
}
|
|
1646
1646
|
for (const r of n.values())
|
|
1647
|
-
|
|
1647
|
+
fe(r, e - 1, t);
|
|
1648
1648
|
return t;
|
|
1649
1649
|
}
|
|
1650
1650
|
function At(n, e, t) {
|
|
@@ -1672,7 +1672,7 @@ function At(n, e, t) {
|
|
|
1672
1672
|
return r;
|
|
1673
1673
|
}
|
|
1674
1674
|
if (t != null && t.$comparator)
|
|
1675
|
-
return
|
|
1675
|
+
return fe(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,11 +1689,11 @@ 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 fe(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 fe(a, 1);
|
|
1697
1697
|
}
|
|
1698
1698
|
case "eav": {
|
|
1699
1699
|
const a = (o = n.eav.get(e)) == null ? void 0 : o.get(t);
|
|
@@ -1710,7 +1710,7 @@ function uo(n, [e, t, r]) {
|
|
|
1710
1710
|
}
|
|
1711
1711
|
case "a": {
|
|
1712
1712
|
const a = n.aev.get(t);
|
|
1713
|
-
return
|
|
1713
|
+
return fe(a, 2);
|
|
1714
1714
|
}
|
|
1715
1715
|
case "av": {
|
|
1716
1716
|
const a = n.aev.get(t);
|
|
@@ -1729,7 +1729,7 @@ function uo(n, [e, t, r]) {
|
|
|
1729
1729
|
return a;
|
|
1730
1730
|
}
|
|
1731
1731
|
default:
|
|
1732
|
-
return
|
|
1732
|
+
return fe(n.eav, 3);
|
|
1733
1733
|
}
|
|
1734
1734
|
}
|
|
1735
1735
|
function lo(n, e, t) {
|
|
@@ -1738,7 +1738,7 @@ 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 = fe(a, 1);
|
|
1742
1742
|
for (const u of c)
|
|
1743
1743
|
r[i] = u[2];
|
|
1744
1744
|
}
|
|
@@ -1864,11 +1864,11 @@ const Oo = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a
|
|
|
1864
1864
|
function Xe(n) {
|
|
1865
1865
|
return typeof n == "string" && Oo.test(n);
|
|
1866
1866
|
}
|
|
1867
|
-
const
|
|
1867
|
+
const Z = [];
|
|
1868
1868
|
for (let n = 0; n < 256; ++n)
|
|
1869
|
-
|
|
1869
|
+
Z.push((n + 256).toString(16).slice(1));
|
|
1870
1870
|
function Ao(n, e = 0) {
|
|
1871
|
-
return (
|
|
1871
|
+
return (Z[n[e + 0]] + Z[n[e + 1]] + Z[n[e + 2]] + Z[n[e + 3]] + "-" + Z[n[e + 4]] + Z[n[e + 5]] + "-" + Z[n[e + 6]] + Z[n[e + 7]] + "-" + Z[n[e + 8]] + Z[n[e + 9]] + "-" + Z[n[e + 10]] + Z[n[e + 11]] + Z[n[e + 12]] + Z[n[e + 13]] + Z[n[e + 14]] + Z[n[e + 15]]).toLowerCase();
|
|
1872
1872
|
}
|
|
1873
1873
|
let sn;
|
|
1874
1874
|
const ko = new Uint8Array(16);
|
|
@@ -1909,7 +1909,7 @@ function Mo(n, e) {
|
|
|
1909
1909
|
function Ro(n, e) {
|
|
1910
1910
|
return Mo(Or(n), Or(e));
|
|
1911
1911
|
}
|
|
1912
|
-
function
|
|
1912
|
+
function N() {
|
|
1913
1913
|
return Po();
|
|
1914
1914
|
}
|
|
1915
1915
|
function jo(n, e) {
|
|
@@ -2439,7 +2439,7 @@ function ga(n, e, t) {
|
|
|
2439
2439
|
function An(n) {
|
|
2440
2440
|
return typeof n == "string" && !Kt(n) ? null : typeof n == "string" && Kt(n) ? En(n) : ya(n);
|
|
2441
2441
|
}
|
|
2442
|
-
function
|
|
2442
|
+
function de(n, e, t) {
|
|
2443
2443
|
const r = An(t);
|
|
2444
2444
|
if (r === null)
|
|
2445
2445
|
return t;
|
|
@@ -2450,7 +2450,7 @@ function fe(n, e, t) {
|
|
|
2450
2450
|
}
|
|
2451
2451
|
function Rs(n, e, t, r) {
|
|
2452
2452
|
var o;
|
|
2453
|
-
const s =
|
|
2453
|
+
const s = de(n, e, t);
|
|
2454
2454
|
return Array.isArray(s) ? [[
|
|
2455
2455
|
"add-triple",
|
|
2456
2456
|
s,
|
|
@@ -2463,18 +2463,18 @@ function _a({ attrsStore: n }, [e, t, r]) {
|
|
|
2463
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
|
+
de(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
|
+
de(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
|
+
de(n, u["forward-identity"][1], l),
|
|
2476
2476
|
u == null ? void 0 : u.id,
|
|
2477
|
-
|
|
2477
|
+
de(n, e, t)
|
|
2478
2478
|
]);
|
|
2479
2479
|
});
|
|
2480
2480
|
return Rs(n, e, t, s);
|
|
@@ -2484,18 +2484,18 @@ function ma({ attrsStore: n }, [e, t, r]) {
|
|
|
2484
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
|
+
de(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
|
+
de(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
|
+
de(n, u["forward-identity"][1], l),
|
|
2497
2497
|
u.id,
|
|
2498
|
-
|
|
2498
|
+
de(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 fe(c, 2))
|
|
2511
2511
|
if (f === o)
|
|
2512
2512
|
return !0;
|
|
2513
2513
|
}
|
|
@@ -2527,14 +2527,14 @@ 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 = de(t, r, s);
|
|
2531
2531
|
return [["id", c]].concat(Object.entries(a)).map(([l, f]) => {
|
|
2532
2532
|
const p = V(t, r, l);
|
|
2533
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 = de(t, r, s), u = js(n, [r, c, i, o]);
|
|
2538
2538
|
return [["id", c]].concat(Object.entries(a)).map(([f, p]) => {
|
|
2539
2539
|
const y = V(t, r, f);
|
|
2540
2540
|
return y["checked-data-type"] === "date" && n.useDateObjects && (p = zt(p)), [
|
|
@@ -2547,10 +2547,10 @@ function Sa(n, e) {
|
|
|
2547
2547
|
});
|
|
2548
2548
|
}
|
|
2549
2549
|
function va({ attrsStore: n }, [e, t]) {
|
|
2550
|
-
return [["delete-entity",
|
|
2550
|
+
return [["delete-entity", de(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 =
|
|
2553
|
+
const { attrsStore: t } = n, [r, s, i, o] = e, a = Gn(i), c = de(t, r, s), u = js(n, [r, c, i, o]), l = Object.entries(a).map(([p, y]) => {
|
|
2554
2554
|
const b = V(t, r, p);
|
|
2555
2555
|
return [
|
|
2556
2556
|
"deep-merge-triple",
|
|
@@ -2569,7 +2569,7 @@ function Ea(n, e) {
|
|
|
2569
2569
|
]].concat(l);
|
|
2570
2570
|
}
|
|
2571
2571
|
function Oa({ attrsStore: n }, [e, t, r]) {
|
|
2572
|
-
return [["rule-params",
|
|
2572
|
+
return [["rule-params", de(n, e, t), e, r]];
|
|
2573
2573
|
}
|
|
2574
2574
|
function Aa(n) {
|
|
2575
2575
|
const [e, t, r, s, i] = n;
|
|
@@ -2625,7 +2625,7 @@ function Ia(n, e, t) {
|
|
|
2625
2625
|
};
|
|
2626
2626
|
}
|
|
2627
2627
|
function kt(n, e, t, r) {
|
|
2628
|
-
const s = n ? Ia(n, e, t) : null, i =
|
|
2628
|
+
const s = n ? Ia(n, e, t) : null, i = N(), a = [N(), e, t];
|
|
2629
2629
|
return {
|
|
2630
2630
|
id: i,
|
|
2631
2631
|
"forward-identity": a,
|
|
@@ -2647,8 +2647,8 @@ function Ma(n, e, t) {
|
|
|
2647
2647
|
throw new Error(`Couldn't find the link ${e}.${t} in your schema`);
|
|
2648
2648
|
const { forward: s, reverse: i } = r;
|
|
2649
2649
|
return {
|
|
2650
|
-
"forward-identity": [
|
|
2651
|
-
"reverse-identity": [
|
|
2650
|
+
"forward-identity": [N(), s.on, s.label],
|
|
2651
|
+
"reverse-identity": [N(), i.on, i.label],
|
|
2652
2652
|
cardinality: s.has === "one" ? "one" : "many",
|
|
2653
2653
|
"unique?": i.has === "one",
|
|
2654
2654
|
"on-delete": s.onDelete,
|
|
@@ -2656,7 +2656,7 @@ function Ma(n, e, t) {
|
|
|
2656
2656
|
};
|
|
2657
2657
|
}
|
|
2658
2658
|
function Pr(n, e, t, r) {
|
|
2659
|
-
const s = n ? Ma(n, e, t) : null, i =
|
|
2659
|
+
const s = n ? Ma(n, e, t) : null, i = N(), o = [N(), e, t], a = [N(), t, e];
|
|
2660
2660
|
return {
|
|
2661
2661
|
id: i,
|
|
2662
2662
|
// @ts-ignore: ts thinks it's any[]
|
|
@@ -3272,19 +3272,19 @@ class Bt extends se {
|
|
|
3272
3272
|
return "InstantAPIError";
|
|
3273
3273
|
}
|
|
3274
3274
|
}
|
|
3275
|
-
async function
|
|
3275
|
+
async function ve(n, e) {
|
|
3276
3276
|
const t = await fetch(n, e), r = await t.json();
|
|
3277
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 ve(`${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 ve(`${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 ve(`${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 ve(`${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 ve(`${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 ve(`${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 ve(`${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 ve(`${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 ve(`${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 ve(`${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 ve(`${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.155-branch-drewh-typesafe-e2e.22783295017.1";
|
|
3489
3489
|
function oc(n, e) {
|
|
3490
3490
|
return {
|
|
3491
3491
|
info: n ? (...t) => console.info(...t, e()) : () => {
|
|
@@ -3569,7 +3569,7 @@ class Qt {
|
|
|
3569
3569
|
return new Qt(this.entities, this.links, {});
|
|
3570
3570
|
}
|
|
3571
3571
|
}
|
|
3572
|
-
class
|
|
3572
|
+
class L extends Error {
|
|
3573
3573
|
constructor(e, t) {
|
|
3574
3574
|
const r = t ? `At path '${t}': ${e}` : e;
|
|
3575
3575
|
super(r), this.name = "QueryValidationError";
|
|
@@ -3604,13 +3604,13 @@ const Fr = [
|
|
|
3604
3604
|
}, cc = (n, e, t, r, s, i, o) => {
|
|
3605
3605
|
const a = i.valueType === "json", c = (u, l, f) => {
|
|
3606
3606
|
if (!Fs(f, l, a))
|
|
3607
|
-
throw new
|
|
3607
|
+
throw new L(`Invalid value for operator '${u}' on attribute '${r}' in entity '${s}'. Expected ${l}, but received: ${typeof f}`, o);
|
|
3608
3608
|
};
|
|
3609
3609
|
switch (n) {
|
|
3610
3610
|
case "in":
|
|
3611
3611
|
case "$in":
|
|
3612
3612
|
if (!Array.isArray(e))
|
|
3613
|
-
throw new
|
|
3613
|
+
throw new L(`Operator '${n}' for attribute '${r}' in entity '${s}' must be an array, but received: ${typeof e}`, o);
|
|
3614
3614
|
for (const u of e)
|
|
3615
3615
|
c(n, t, u);
|
|
3616
3616
|
break;
|
|
@@ -3625,13 +3625,13 @@ const Fr = [
|
|
|
3625
3625
|
case "$like":
|
|
3626
3626
|
case "$ilike":
|
|
3627
3627
|
if (c(n, "string", e), n === "$ilike" && !i.isIndexed)
|
|
3628
|
-
throw new
|
|
3628
|
+
throw new L(`Operator '${n}' can only be used with indexed attributes, but '${r}' in entity '${s}' is not indexed`, o);
|
|
3629
3629
|
break;
|
|
3630
3630
|
case "$isNull":
|
|
3631
3631
|
c(n, "boolean", e);
|
|
3632
3632
|
break;
|
|
3633
3633
|
default:
|
|
3634
|
-
throw new
|
|
3634
|
+
throw new L(`Unknown operator '${n}' for attribute '${r}' in entity '${s}'`, o);
|
|
3635
3635
|
}
|
|
3636
3636
|
}, Ye = (n, e, t, r, s) => {
|
|
3637
3637
|
const i = ac(t), o = t.valueType === "json";
|
|
@@ -3642,42 +3642,42 @@ const Fr = [
|
|
|
3642
3642
|
for (const [u, l] of Object.entries(c))
|
|
3643
3643
|
cc(u, l, i, e, r, t, `${s}.${u}`);
|
|
3644
3644
|
} else if (!Fs(n, i, o))
|
|
3645
|
-
throw new
|
|
3645
|
+
throw new L(`Invalid value for attribute '${e}' in entity '${r}'. Expected ${i}, but received: ${typeof n}`, s);
|
|
3646
3646
|
}, uc = (n, e, t, r, s) => {
|
|
3647
3647
|
const i = n.split(".");
|
|
3648
3648
|
if (i.length < 2)
|
|
3649
|
-
throw new
|
|
3649
|
+
throw new L(`Invalid dot notation path '${n}'. Must contain at least one dot.`, s);
|
|
3650
3650
|
let o = t;
|
|
3651
3651
|
for (let l = 0; l < i.length - 1; l++) {
|
|
3652
3652
|
const f = i[l], p = r.entities[o];
|
|
3653
3653
|
if (!p)
|
|
3654
|
-
throw new
|
|
3654
|
+
throw new L(`Entity '${o}' does not exist in schema while traversing dot notation path '${n}'.`, s);
|
|
3655
3655
|
const y = p.links[f];
|
|
3656
3656
|
if (!y) {
|
|
3657
3657
|
const b = Object.keys(p.links);
|
|
3658
|
-
throw new
|
|
3658
|
+
throw new L(`Link '${f}' does not exist on entity '${o}' in dot notation path '${n}'. Available links: ${b.length > 0 ? b.join(", ") : "none"}`, s);
|
|
3659
3659
|
}
|
|
3660
3660
|
o = y.entityName;
|
|
3661
3661
|
}
|
|
3662
3662
|
const a = i[i.length - 1], c = r.entities[o];
|
|
3663
3663
|
if (!c)
|
|
3664
|
-
throw new
|
|
3664
|
+
throw new L(`Target entity '${o}' does not exist in schema for dot notation path '${n}'.`, s);
|
|
3665
3665
|
if (a === "id") {
|
|
3666
3666
|
if (typeof e == "string" && !Xe(e))
|
|
3667
|
-
throw new
|
|
3667
|
+
throw new L(`Invalid value for id field in entity '${o}'. Expected a UUID, but received: ${e}`, s);
|
|
3668
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
|
-
throw new
|
|
3674
|
+
throw new L(`Invalid value for link '${a}' in entity '${o}'. Expected a UUID, but received: ${e}`, s);
|
|
3675
3675
|
Ye(e, n, new ie("string", !1, !0), t, s);
|
|
3676
3676
|
return;
|
|
3677
3677
|
}
|
|
3678
3678
|
if (!u) {
|
|
3679
3679
|
const l = Object.keys(c.attrs);
|
|
3680
|
-
throw new
|
|
3680
|
+
throw new L(`Attribute '${a}' does not exist on entity '${o}' in dot notation path '${n}'. Available attributes: ${l.length > 0 ? l.join(", ") + ", id" : "id"}`, s);
|
|
3681
3681
|
}
|
|
3682
3682
|
Ye(e, n, u, t, s);
|
|
3683
3683
|
}, Ns = (n, e, t, r) => {
|
|
@@ -3702,13 +3702,13 @@ const Fr = [
|
|
|
3702
3702
|
const a = o.attrs[s], c = o.links[s];
|
|
3703
3703
|
if (!a && !c) {
|
|
3704
3704
|
const u = Object.keys(o.attrs), l = Object.keys(o.links);
|
|
3705
|
-
throw new
|
|
3705
|
+
throw new L(`Attribute or link '${s}' does not exist on entity '${e}'. Available attributes: ${u.length > 0 ? u.join(", ") : "none"}. Available links: ${l.length > 0 ? l.join(", ") : "none"}`, `${r}.${s}`);
|
|
3706
3706
|
}
|
|
3707
3707
|
if (a)
|
|
3708
3708
|
Ye(i, s, a, e, `${r}.${s}`);
|
|
3709
3709
|
else if (c) {
|
|
3710
3710
|
if (typeof i == "string" && !Xe(i))
|
|
3711
|
-
throw new
|
|
3711
|
+
throw new L(`Invalid value for link '${s}' in entity '${e}'. Expected a UUID, but received: ${i}`, `${r}.${s}`);
|
|
3712
3712
|
const u = new ie("string", !1, !0);
|
|
3713
3713
|
Ye(i, s, u, e, `${r}.${s}`);
|
|
3714
3714
|
}
|
|
@@ -3716,7 +3716,7 @@ const Fr = [
|
|
|
3716
3716
|
}, lc = (n, e, t, r, s = 0) => {
|
|
3717
3717
|
for (const o of Object.keys(n))
|
|
3718
3718
|
if (!Fr.includes(o))
|
|
3719
|
-
throw new
|
|
3719
|
+
throw new L(`Invalid query parameter '${o}' in $ object. Valid parameters are: ${Fr.join(", ")}. Found: ${o}`, r);
|
|
3720
3720
|
const i = [
|
|
3721
3721
|
// 'limit', // only supported client side
|
|
3722
3722
|
"offset",
|
|
@@ -3727,21 +3727,21 @@ const Fr = [
|
|
|
3727
3727
|
];
|
|
3728
3728
|
for (const o of i)
|
|
3729
3729
|
if (n[o] !== void 0 && s > 0)
|
|
3730
|
-
throw new
|
|
3730
|
+
throw new L(`'${o}' can only be used on top-level namespaces. It cannot be used in nested queries.`, r);
|
|
3731
3731
|
if (n.where && t) {
|
|
3732
3732
|
if (typeof n.where != "object" || n.where === null)
|
|
3733
|
-
throw new
|
|
3733
|
+
throw new L(`'where' clause must be an object in entity '${e}', but received: ${typeof n.where}`, r ? `${r}.where` : void 0);
|
|
3734
3734
|
Ns(n.where, e, t, r ? `${r}.where` : "where");
|
|
3735
3735
|
}
|
|
3736
3736
|
}, Ws = (n, e, t, r, s = 0) => {
|
|
3737
3737
|
var i;
|
|
3738
3738
|
if (!n || typeof n != "object")
|
|
3739
|
-
throw new
|
|
3739
|
+
throw new L(`Query part for entity '${e}' must be an object, but received: ${typeof n}`, r);
|
|
3740
3740
|
for (const o of Object.keys(n))
|
|
3741
3741
|
if (o !== "$") {
|
|
3742
3742
|
if (t && !(o in t.entities[e].links)) {
|
|
3743
3743
|
const c = Object.keys(t.entities[e].links);
|
|
3744
|
-
throw new
|
|
3744
|
+
throw new L(`Link '${o}' does not exist on entity '${e}'. Available links: ${c.length > 0 ? c.join(", ") : "none"}`, `${r}.${o}`);
|
|
3745
3745
|
}
|
|
3746
3746
|
const a = n[o];
|
|
3747
3747
|
if (typeof a == "object" && a !== null) {
|
|
@@ -3751,35 +3751,35 @@ const Fr = [
|
|
|
3751
3751
|
} else {
|
|
3752
3752
|
const a = n[o];
|
|
3753
3753
|
if (typeof a != "object" || a === null)
|
|
3754
|
-
throw new
|
|
3754
|
+
throw new L(`Query parameter '$' must be an object in entity '${e}', but received: ${typeof a}`, `${r}.$`);
|
|
3755
3755
|
lc(a, e, t, `${r}.$`, s);
|
|
3756
3756
|
}
|
|
3757
3757
|
}, Nr = (n, e) => {
|
|
3758
3758
|
if (typeof n != "object" || n === null)
|
|
3759
|
-
throw new
|
|
3759
|
+
throw new L(`Query must be an object, but received: ${typeof n}${n === null ? " (null)" : ""}`);
|
|
3760
3760
|
if (Array.isArray(n))
|
|
3761
|
-
throw new
|
|
3761
|
+
throw new L(`Query must be an object, but received: ${typeof n}`);
|
|
3762
3762
|
const t = n;
|
|
3763
3763
|
for (const r of Object.keys(t)) {
|
|
3764
3764
|
if (Array.isArray(n[r]))
|
|
3765
|
-
throw new
|
|
3765
|
+
throw new L(`Query keys must be strings, but found key of type: ${typeof r}`, r);
|
|
3766
3766
|
if (typeof r != "string")
|
|
3767
|
-
throw new
|
|
3767
|
+
throw new L(`Query keys must be strings, but found key of type: ${typeof r}`, r);
|
|
3768
3768
|
if (r !== "$$ruleParams") {
|
|
3769
3769
|
if (e && !e.entities[r]) {
|
|
3770
3770
|
const s = Object.keys(e.entities);
|
|
3771
|
-
throw new
|
|
3771
|
+
throw new L(`Entity '${r}' does not exist in schema. Available entities: ${s.length > 0 ? s.join(", ") : "none"}`, r);
|
|
3772
3772
|
}
|
|
3773
3773
|
Ws(t[r], r, e, r, 0);
|
|
3774
3774
|
}
|
|
3775
3775
|
}
|
|
3776
3776
|
}, Wr = (n) => typeof n != "string" ? !1 : Kt(n) ? !0 : Xe(n);
|
|
3777
|
-
class
|
|
3777
|
+
class ge 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 ge(`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 be(`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 ge(`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 ge(`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 ge(`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 ge(`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 ge(`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 ge(`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 be(`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 ge(`Invalid id for entity '${r}'. Expected a UUID, but received: ${s}`);
|
|
3839
3839
|
if (typeof r != "string")
|
|
3840
|
-
throw new
|
|
3840
|
+
throw new ge(`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 ge(`Transaction chunk must be an object, but received: ${typeof r}`);
|
|
3848
3848
|
if (!Array.isArray(r.__ops))
|
|
3849
|
-
throw new
|
|
3849
|
+
throw new ge(`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 ge(`Transaction operation must be an array, but received: ${typeof s}`);
|
|
3853
3853
|
pc(s, e);
|
|
3854
3854
|
}
|
|
3855
3855
|
}
|
|
@@ -4132,7 +4132,7 @@ class vc {
|
|
|
4132
4132
|
this.subs.flush();
|
|
4133
4133
|
}
|
|
4134
4134
|
subscribe(e, t) {
|
|
4135
|
-
const r =
|
|
4135
|
+
const r = J(e);
|
|
4136
4136
|
return this.callbacks[r] = this.callbacks[r] || [], this.callbacks[r].push(t), this.initSubscription(e, r, t), (s) => {
|
|
4137
4137
|
this.unsubscribe(r, t, s == null ? void 0 : s.keepSubscription);
|
|
4138
4138
|
};
|
|
@@ -4148,7 +4148,7 @@ class vc {
|
|
|
4148
4148
|
}
|
|
4149
4149
|
}
|
|
4150
4150
|
sendStart(e) {
|
|
4151
|
-
this.trySend(
|
|
4151
|
+
this.trySend(N(), {
|
|
4152
4152
|
op: "start-sync",
|
|
4153
4153
|
q: e
|
|
4154
4154
|
});
|
|
@@ -4162,7 +4162,7 @@ class vc {
|
|
|
4162
4162
|
});
|
|
4163
4163
|
}
|
|
4164
4164
|
sendRemove(e, t) {
|
|
4165
|
-
this.trySend(
|
|
4165
|
+
this.trySend(N(), {
|
|
4166
4166
|
op: "remove-sync",
|
|
4167
4167
|
"subscription-id": e.subscriptionId,
|
|
4168
4168
|
"keep-subscription": t
|
|
@@ -4200,7 +4200,7 @@ class vc {
|
|
|
4200
4200
|
}
|
|
4201
4201
|
}
|
|
4202
4202
|
onStartSyncOk(e) {
|
|
4203
|
-
const t = e["subscription-id"], r = e.q, s =
|
|
4203
|
+
const t = e["subscription-id"], r = e.q, s = J(r);
|
|
4204
4204
|
this.idToHash[t] = s, this.subs.updateInPlace((i) => {
|
|
4205
4205
|
const o = i[s];
|
|
4206
4206
|
if (!o)
|
|
@@ -4365,7 +4365,7 @@ class vc {
|
|
|
4365
4365
|
}
|
|
4366
4366
|
}
|
|
4367
4367
|
onStartSyncError(e) {
|
|
4368
|
-
const t =
|
|
4368
|
+
const t = J(e["original-event"].q), r = {
|
|
4369
4369
|
message: e.message || "Uh-oh, something went wrong. Ping Joe & Stopa.",
|
|
4370
4370
|
status: e.status,
|
|
4371
4371
|
type: e.type,
|
|
@@ -4385,7 +4385,7 @@ class vc {
|
|
|
4385
4385
|
function Ec({ WStream: n, opts: e, startStream: t, appendStream: r, registerStream: s }) {
|
|
4386
4386
|
const i = e.clientId;
|
|
4387
4387
|
let o = null, a = null, c = null;
|
|
4388
|
-
const u =
|
|
4388
|
+
const u = N();
|
|
4389
4389
|
let l = !1, f = !1;
|
|
4390
4390
|
const p = [], y = [], b = [];
|
|
4391
4391
|
let _ = !1, m = 0, S = 0;
|
|
@@ -4428,23 +4428,23 @@ function Ec({ WStream: n, opts: e, startStream: t, appendStream: r, registerStre
|
|
|
4428
4428
|
for (const I of y)
|
|
4429
4429
|
I(o);
|
|
4430
4430
|
}
|
|
4431
|
-
function
|
|
4431
|
+
function ye() {
|
|
4432
4432
|
_ = !0;
|
|
4433
4433
|
}
|
|
4434
|
-
function
|
|
4435
|
-
let I = m,
|
|
4436
|
-
for (const { byteLen:
|
|
4437
|
-
const
|
|
4438
|
-
if (
|
|
4434
|
+
function Re(A) {
|
|
4435
|
+
let I = m, H = 0, Y = 0;
|
|
4436
|
+
for (const { byteLen: ae } of g) {
|
|
4437
|
+
const _e = I + ae;
|
|
4438
|
+
if (_e > A)
|
|
4439
4439
|
break;
|
|
4440
|
-
I =
|
|
4440
|
+
I = _e, H++, Y += ae;
|
|
4441
4441
|
}
|
|
4442
|
-
|
|
4442
|
+
H > 0 && (m += Y, S -= Y, g.splice(0, H));
|
|
4443
4443
|
}
|
|
4444
|
-
function
|
|
4444
|
+
function te(A, I) {
|
|
4445
4445
|
a = I, O(), A.error(I), j();
|
|
4446
4446
|
}
|
|
4447
|
-
async function
|
|
4447
|
+
async function oe() {
|
|
4448
4448
|
const A = await t({
|
|
4449
4449
|
clientId: i,
|
|
4450
4450
|
reconnectToken: u,
|
|
@@ -4452,88 +4452,88 @@ function Ec({ WStream: n, opts: e, startStream: t, appendStream: r, registerStre
|
|
|
4452
4452
|
});
|
|
4453
4453
|
switch (A.type) {
|
|
4454
4454
|
case "ok": {
|
|
4455
|
-
const { streamId: I, offset:
|
|
4456
|
-
o = I,
|
|
4455
|
+
const { streamId: I, offset: H } = A;
|
|
4456
|
+
o = I, Re(H), g.length && r({
|
|
4457
4457
|
streamId: I,
|
|
4458
|
-
chunks: g.map((
|
|
4458
|
+
chunks: g.map((Y) => Y.chunk),
|
|
4459
4459
|
offset: m
|
|
4460
4460
|
}), _ = !1;
|
|
4461
4461
|
break;
|
|
4462
4462
|
}
|
|
4463
4463
|
case "disconnect": {
|
|
4464
|
-
|
|
4464
|
+
ye();
|
|
4465
4465
|
break;
|
|
4466
4466
|
}
|
|
4467
4467
|
case "error": {
|
|
4468
|
-
c &&
|
|
4468
|
+
c && te(c, A.error);
|
|
4469
4469
|
break;
|
|
4470
4470
|
}
|
|
4471
4471
|
}
|
|
4472
4472
|
}
|
|
4473
|
-
function
|
|
4474
|
-
|
|
4473
|
+
function W() {
|
|
4474
|
+
ye(), oe();
|
|
4475
4475
|
}
|
|
4476
|
-
function
|
|
4477
|
-
|
|
4476
|
+
function Q({ offset: A, done: I }) {
|
|
4477
|
+
Re(A), I && (l = !0, j());
|
|
4478
4478
|
}
|
|
4479
|
-
function
|
|
4480
|
-
return l ? (
|
|
4479
|
+
function ee(A) {
|
|
4480
|
+
return l ? (te(A, new se("Stream has been closed.")), null) : o || (te(A, new se("Stream has not been initialized.")), null);
|
|
4481
4481
|
}
|
|
4482
|
-
async function
|
|
4482
|
+
async function Ae(A) {
|
|
4483
4483
|
c = A;
|
|
4484
|
-
let I = !0,
|
|
4484
|
+
let I = !0, H = 0;
|
|
4485
4485
|
for (; I; ) {
|
|
4486
|
-
let
|
|
4486
|
+
let Y = Date.now() + Math.min(15e3, 500 * (H - 1));
|
|
4487
4487
|
I = !1;
|
|
4488
|
-
const
|
|
4488
|
+
const ae = await t({
|
|
4489
4489
|
clientId: e.clientId,
|
|
4490
4490
|
reconnectToken: u,
|
|
4491
4491
|
ruleParams: e.ruleParams
|
|
4492
4492
|
});
|
|
4493
|
-
switch (
|
|
4493
|
+
switch (ae.type) {
|
|
4494
4494
|
case "ok": {
|
|
4495
|
-
const { streamId:
|
|
4495
|
+
const { streamId: _e, offset: nt } = ae;
|
|
4496
4496
|
if (nt !== 0) {
|
|
4497
|
-
const
|
|
4498
|
-
|
|
4497
|
+
const me = new se("Write stream is corrupted");
|
|
4498
|
+
te(A, me);
|
|
4499
4499
|
return;
|
|
4500
4500
|
}
|
|
4501
|
-
B(
|
|
4502
|
-
onDisconnect:
|
|
4503
|
-
onFlush:
|
|
4504
|
-
onConnectionReconnect:
|
|
4505
|
-
onAppendFailed:
|
|
4501
|
+
B(_e), s(_e, {
|
|
4502
|
+
onDisconnect: ye,
|
|
4503
|
+
onFlush: Q,
|
|
4504
|
+
onConnectionReconnect: oe,
|
|
4505
|
+
onAppendFailed: W
|
|
4506
4506
|
}), _ = !1;
|
|
4507
4507
|
return;
|
|
4508
4508
|
}
|
|
4509
4509
|
case "disconnect": {
|
|
4510
|
-
I = !0,
|
|
4511
|
-
setTimeout(
|
|
4510
|
+
I = !0, ye(), H++, await new Promise((_e) => {
|
|
4511
|
+
setTimeout(_e, Math.max(0, Y - Date.now()));
|
|
4512
4512
|
});
|
|
4513
4513
|
break;
|
|
4514
4514
|
}
|
|
4515
4515
|
case "error": {
|
|
4516
|
-
|
|
4516
|
+
te(A, ae.error);
|
|
4517
4517
|
return;
|
|
4518
4518
|
}
|
|
4519
4519
|
}
|
|
4520
4520
|
}
|
|
4521
4521
|
}
|
|
4522
4522
|
class Tt extends n {
|
|
4523
|
-
constructor(I,
|
|
4524
|
-
super(I,
|
|
4523
|
+
constructor(I, H) {
|
|
4524
|
+
super(I, H);
|
|
4525
4525
|
}
|
|
4526
4526
|
async streamId() {
|
|
4527
|
-
return o || new Promise((I,
|
|
4528
|
-
const
|
|
4529
|
-
for (const
|
|
4530
|
-
|
|
4531
|
-
},
|
|
4532
|
-
I(
|
|
4533
|
-
}, nt = (
|
|
4534
|
-
|
|
4527
|
+
return o || new Promise((I, H) => {
|
|
4528
|
+
const Y = [], ae = () => {
|
|
4529
|
+
for (const me of Y)
|
|
4530
|
+
me();
|
|
4531
|
+
}, _e = (me) => {
|
|
4532
|
+
I(me), ae();
|
|
4533
|
+
}, nt = (me) => {
|
|
4534
|
+
H(me || new se("Stream is closed.")), ae();
|
|
4535
4535
|
};
|
|
4536
|
-
|
|
4536
|
+
Y.push(U(_e)), Y.push(v(nt));
|
|
4537
4537
|
});
|
|
4538
4538
|
}
|
|
4539
4539
|
}
|
|
@@ -4543,18 +4543,18 @@ function Ec({ WStream: n, opts: e, startStream: t, appendStream: r, registerStre
|
|
|
4543
4543
|
// browser restarts
|
|
4544
4544
|
async start(A) {
|
|
4545
4545
|
try {
|
|
4546
|
-
await
|
|
4546
|
+
await Ae(A);
|
|
4547
4547
|
} catch (I) {
|
|
4548
|
-
|
|
4548
|
+
te(A, I);
|
|
4549
4549
|
}
|
|
4550
4550
|
},
|
|
4551
4551
|
write(A, I) {
|
|
4552
|
-
const
|
|
4553
|
-
if (
|
|
4554
|
-
const
|
|
4555
|
-
g.push({ chunk: A, byteLen:
|
|
4556
|
-
const
|
|
4557
|
-
S +=
|
|
4552
|
+
const H = ee(I);
|
|
4553
|
+
if (H) {
|
|
4554
|
+
const Y = w.encode(A).length;
|
|
4555
|
+
g.push({ chunk: A, byteLen: Y });
|
|
4556
|
+
const ae = m + S;
|
|
4557
|
+
S += Y, _ || r({ streamId: H, chunks: [A], offset: ae });
|
|
4558
4558
|
}
|
|
4559
4559
|
},
|
|
4560
4560
|
close() {
|
|
@@ -4636,7 +4636,7 @@ function Ac({ RStream: n, opts: e, startStream: t, cancelStream: r }) {
|
|
|
4636
4636
|
}
|
|
4637
4637
|
let b = 0;
|
|
4638
4638
|
async function _(g, w) {
|
|
4639
|
-
c =
|
|
4639
|
+
c = N();
|
|
4640
4640
|
const O = { ...g || {}, eventId: c };
|
|
4641
4641
|
for await (const v of t(O)) {
|
|
4642
4642
|
if (i)
|
|
@@ -4658,39 +4658,47 @@ function Ac({ RStream: n, opts: e, startStream: t, cancelStream: r }) {
|
|
|
4658
4658
|
signal: j.signal
|
|
4659
4659
|
});
|
|
4660
4660
|
for (let B = 0; B < v.files.length; B++) {
|
|
4661
|
-
const
|
|
4662
|
-
if (
|
|
4661
|
+
const ye = v.files[B + 1], te = await U;
|
|
4662
|
+
if (ye && (U = fetch(ye.url, { signal: j.signal })), !te.ok) {
|
|
4663
4663
|
if (b++, b > 10) {
|
|
4664
4664
|
y(w, new se("Unable to process stream."));
|
|
4665
4665
|
return;
|
|
4666
4666
|
}
|
|
4667
4667
|
return { retry: !0 };
|
|
4668
4668
|
}
|
|
4669
|
-
if (
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4669
|
+
if (te.body) {
|
|
4670
|
+
const oe = te.body.getReader();
|
|
4671
|
+
try {
|
|
4672
|
+
for (; ; ) {
|
|
4673
|
+
const { done: W, value: Q } = await oe.read();
|
|
4674
|
+
if (W)
|
|
4675
|
+
break;
|
|
4676
|
+
if (i) {
|
|
4677
|
+
j.abort();
|
|
4678
|
+
return;
|
|
4679
|
+
}
|
|
4680
|
+
let ee = Q;
|
|
4681
|
+
if (C > 0 && (ee = Q.subarray(C), C -= Q.length - ee.length), !ee.length)
|
|
4682
|
+
continue;
|
|
4683
|
+
s += ee.length;
|
|
4684
|
+
const Ae = o.decode(ee);
|
|
4685
|
+
w.enqueue(Ae);
|
|
4674
4686
|
}
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
continue;
|
|
4678
|
-
s += L.length;
|
|
4679
|
-
const X = o.decode(L);
|
|
4680
|
-
w.enqueue(X);
|
|
4687
|
+
} finally {
|
|
4688
|
+
oe.releaseLock();
|
|
4681
4689
|
}
|
|
4682
|
-
else {
|
|
4683
|
-
const
|
|
4684
|
-
let
|
|
4690
|
+
} else {
|
|
4691
|
+
const oe = await te.arrayBuffer();
|
|
4692
|
+
let W = oe;
|
|
4685
4693
|
if (i) {
|
|
4686
4694
|
j.abort();
|
|
4687
4695
|
return;
|
|
4688
4696
|
}
|
|
4689
|
-
if (C > 0 && (
|
|
4697
|
+
if (C > 0 && (W = new Uint8Array(oe).subarray(C), C -= oe.byteLength - W.length), !W.byteLength)
|
|
4690
4698
|
continue;
|
|
4691
|
-
s +=
|
|
4692
|
-
const
|
|
4693
|
-
w.enqueue(
|
|
4699
|
+
s += W.byteLength;
|
|
4700
|
+
const Q = o.decode(W);
|
|
4701
|
+
w.enqueue(Q);
|
|
4694
4702
|
}
|
|
4695
4703
|
}
|
|
4696
4704
|
}
|
|
@@ -4769,7 +4777,7 @@ class kc {
|
|
|
4769
4777
|
}), t;
|
|
4770
4778
|
}
|
|
4771
4779
|
startWriteStream(e) {
|
|
4772
|
-
const t =
|
|
4780
|
+
const t = N();
|
|
4773
4781
|
let r = null;
|
|
4774
4782
|
const s = new Promise((o) => {
|
|
4775
4783
|
r = o;
|
|
@@ -4793,7 +4801,7 @@ class kc {
|
|
|
4793
4801
|
offset: s,
|
|
4794
4802
|
done: !!r
|
|
4795
4803
|
};
|
|
4796
|
-
i && (o["abort-reason"] = i), this.trySend(
|
|
4804
|
+
i && (o["abort-reason"] = i), this.trySend(N(), o);
|
|
4797
4805
|
}
|
|
4798
4806
|
onAppendFailed(e) {
|
|
4799
4807
|
const t = this.writeStreams[e["stream-id"]];
|
|
@@ -4828,7 +4836,7 @@ class kc {
|
|
|
4828
4836
|
op: "unsubscribe-stream",
|
|
4829
4837
|
"subscribe-event-id": e
|
|
4830
4838
|
};
|
|
4831
|
-
this.trySend(
|
|
4839
|
+
this.trySend(N(), t), delete this.readStreamIterators[e];
|
|
4832
4840
|
}
|
|
4833
4841
|
onStreamAppend(e) {
|
|
4834
4842
|
var s;
|
|
@@ -5058,7 +5066,7 @@ class Nc {
|
|
|
5058
5066
|
// Queries
|
|
5059
5067
|
h(this, "getPreviousResult", (e) => {
|
|
5060
5068
|
var r;
|
|
5061
|
-
const t =
|
|
5069
|
+
const t = J(e);
|
|
5062
5070
|
return (r = this.dataForQuery(t)) == null ? void 0 : r.data;
|
|
5063
5071
|
});
|
|
5064
5072
|
/** Re-run instaql and call all callbacks with new data */
|
|
@@ -5101,7 +5109,7 @@ class Nc {
|
|
|
5101
5109
|
* @returns
|
|
5102
5110
|
*/
|
|
5103
5111
|
h(this, "pushOps", (e, t) => {
|
|
5104
|
-
const r =
|
|
5112
|
+
const r = N(), s = [...this._pendingMutations().values()], i = Math.max(0, ...s.map((c) => c.order || 0)) + 1, o = {
|
|
5105
5113
|
op: "transact",
|
|
5106
5114
|
"tx-steps": e,
|
|
5107
5115
|
created: Date.now(),
|
|
@@ -5122,7 +5130,7 @@ class Nc {
|
|
|
5122
5130
|
}
|
|
5123
5131
|
this._log.info("[socket][open]", this._transport.id), this._setStatus(Ee.OPENED), this.getCurrentUser().then((r) => {
|
|
5124
5132
|
var s;
|
|
5125
|
-
this._trySend(
|
|
5133
|
+
this._trySend(N(), {
|
|
5126
5134
|
op: "init",
|
|
5127
5135
|
"app-id": this.config.appId,
|
|
5128
5136
|
"refresh-token": (s = r.user) == null ? void 0 : s.refresh_token,
|
|
@@ -5329,7 +5337,7 @@ class Nc {
|
|
|
5329
5337
|
_addQueryData(e, t, r) {
|
|
5330
5338
|
if (!this.attrs)
|
|
5331
5339
|
throw new Error("Attrs in reactor have not been set");
|
|
5332
|
-
const s =
|
|
5340
|
+
const s = J(e), i = this.ensureAttrs(), o = ct(this.attrs, t.triples, r, this.config.useDateObjects);
|
|
5333
5341
|
this.querySubs.updateInPlace((a) => {
|
|
5334
5342
|
a[s] = {
|
|
5335
5343
|
result: {
|
|
@@ -5356,11 +5364,11 @@ class Nc {
|
|
|
5356
5364
|
break;
|
|
5357
5365
|
}
|
|
5358
5366
|
case "add-query-exists": {
|
|
5359
|
-
this.notifyOneQueryOnce(
|
|
5367
|
+
this.notifyOneQueryOnce(J(t.q));
|
|
5360
5368
|
break;
|
|
5361
5369
|
}
|
|
5362
5370
|
case "add-query-ok": {
|
|
5363
|
-
const { q: y, result: b } = t, _ =
|
|
5371
|
+
const { q: y, result: b } = t, _ = J(y);
|
|
5364
5372
|
if (!this._hasQueryListeners() && !this.querySubs.currentValue[_])
|
|
5365
5373
|
break;
|
|
5366
5374
|
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);
|
|
@@ -5419,15 +5427,15 @@ class Nc {
|
|
|
5419
5427
|
w.pendingMutations = m;
|
|
5420
5428
|
});
|
|
5421
5429
|
const S = ln(m.entries()), g = y.map((w) => {
|
|
5422
|
-
var
|
|
5423
|
-
const O = w["instaql-query"], v = w["instaql-result"], C =
|
|
5430
|
+
var W, Q, ee, Ae;
|
|
5431
|
+
const O = w["instaql-query"], v = w["instaql-result"], C = J(O), j = Ur(v), U = this.ensureAttrs(), B = ct(U, j, r, this.config.useDateObjects), { store: ye, attrsStore: Re } = this._applyOptimisticUpdates(B, U, S, _), te = (Q = (W = v == null ? void 0 : v[0]) == null ? void 0 : W.data) == null ? void 0 : Q["page-info"], oe = (Ae = (ee = v == null ? void 0 : v[0]) == null ? void 0 : ee.data) == null ? void 0 : Ae.aggregate;
|
|
5424
5432
|
return {
|
|
5425
5433
|
q: O,
|
|
5426
5434
|
hash: C,
|
|
5427
|
-
store:
|
|
5428
|
-
attrsStore:
|
|
5429
|
-
pageInfo:
|
|
5430
|
-
aggregate:
|
|
5435
|
+
store: ye,
|
|
5436
|
+
attrsStore: Re,
|
|
5437
|
+
pageInfo: te,
|
|
5438
|
+
aggregate: oe
|
|
5431
5439
|
};
|
|
5432
5440
|
});
|
|
5433
5441
|
g.forEach(({ hash: w, q: O, store: v, attrsStore: C, pageInfo: j, aggregate: U }) => {
|
|
@@ -5560,8 +5568,8 @@ class Nc {
|
|
|
5560
5568
|
return;
|
|
5561
5569
|
}
|
|
5562
5570
|
if ((a = e["original-event"]) != null && a.hasOwnProperty("q") && ((c = e["original-event"]) == null ? void 0 : c.op) === "add-query") {
|
|
5563
|
-
const y = (u = e["original-event"]) == null ? void 0 : u.q, b =
|
|
5564
|
-
this.notifyQueryError(
|
|
5571
|
+
const y = (u = e["original-event"]) == null ? void 0 : u.q, b = J(y);
|
|
5572
|
+
this.notifyQueryError(J(y), s), this.notifyQueryOnceError(y, b, t, s);
|
|
5565
5573
|
return;
|
|
5566
5574
|
}
|
|
5567
5575
|
if (((l = e["original-event"]) == null ? void 0 : l.op) === "init") {
|
|
@@ -5602,7 +5610,7 @@ class Nc {
|
|
|
5602
5610
|
this.attrs = new Le(e.reduce((t, r) => (t[r.id] = r, t), {}), this._linkIndex), this.notifyAttrsSubs();
|
|
5603
5611
|
}
|
|
5604
5612
|
_startQuerySub(e, t) {
|
|
5605
|
-
const r =
|
|
5613
|
+
const r = N();
|
|
5606
5614
|
return this.querySubs.updateInPlace((s) => {
|
|
5607
5615
|
s[t] = s[t] || { q: e, result: null, eventId: r }, s[t].lastAccessed = Date.now();
|
|
5608
5616
|
}), this._trySendAuthed(r, { op: "add-query", q: e }), r;
|
|
@@ -5622,7 +5630,7 @@ class Nc {
|
|
|
5622
5630
|
*/
|
|
5623
5631
|
subscribeQuery(e, t, r) {
|
|
5624
5632
|
this.config.disableValidation || Nr(e, this.config.schema), r && "ruleParams" in r && (e = { $$ruleParams: r.ruleParams, ...e });
|
|
5625
|
-
const s =
|
|
5633
|
+
const s = J(e), i = this.getPreviousResult(e);
|
|
5626
5634
|
return i && t(i), this.queryCbs[s] = this.queryCbs[s] ?? [], this.queryCbs[s].push({ q: e, cb: t }), this._startQuerySub(e, s), () => {
|
|
5627
5635
|
this._unsubQuery(e, s, t);
|
|
5628
5636
|
};
|
|
@@ -5634,7 +5642,7 @@ class Nc {
|
|
|
5634
5642
|
return r.reject(new Error("We can't run `queryOnce`, because the device is offline.")), r.promise;
|
|
5635
5643
|
if (!this.querySubs)
|
|
5636
5644
|
return r.reject(new Error("We can't run `queryOnce` on the backend. Use adminAPI.query instead: https://www.instantdb.com/docs/backend#query")), r.promise;
|
|
5637
|
-
const s =
|
|
5645
|
+
const s = J(e), i = this._startQuerySub(e, s);
|
|
5638
5646
|
return this.queryOnceDfds[s] = this.queryOnceDfds[s] ?? [], this.queryOnceDfds[s].push({ q: e, dfd: r, eventId: i }), setTimeout(() => r.reject(new Error("Query timed out")), Cc), r.promise;
|
|
5639
5647
|
}
|
|
5640
5648
|
_completeQueryOnce(e, t, r) {
|
|
@@ -5648,7 +5656,7 @@ class Nc {
|
|
|
5648
5656
|
return !!((t = this.queryCbs[e]) != null && t.length || (r = this.queryOnceDfds[e]) != null && r.length);
|
|
5649
5657
|
}
|
|
5650
5658
|
_cleanupQuery(e, t) {
|
|
5651
|
-
this._hasQueryListeners(t) || (delete this.queryCbs[t], delete this.queryOnceDfds[t], delete this._dataForQueryCache[t], this.querySubs.unloadKey(t), this._trySendAuthed(
|
|
5659
|
+
this._hasQueryListeners(t) || (delete this.queryCbs[t], delete this.queryOnceDfds[t], delete this._dataForQueryCache[t], this.querySubs.unloadKey(t), this._trySendAuthed(N(), { op: "remove-query", q: e }));
|
|
5652
5660
|
}
|
|
5653
5661
|
// When we `pushTx`, it's possible that we don't yet have `this.attrs`
|
|
5654
5662
|
// This means that `tx-steps` in `pendingMutations` will include `add-attr`
|
|
@@ -5906,7 +5914,7 @@ class Nc {
|
|
|
5906
5914
|
const r = await this.kv.waitForKeyToLoad(t);
|
|
5907
5915
|
if (r)
|
|
5908
5916
|
return r;
|
|
5909
|
-
const s =
|
|
5917
|
+
const s = N();
|
|
5910
5918
|
return this.kv.updateInPlace((i) => {
|
|
5911
5919
|
i[t] || (i[t] = s);
|
|
5912
5920
|
}), await this.kv.waitForKeyToLoad(t);
|
|
@@ -6258,14 +6266,14 @@ class Nc {
|
|
|
6258
6266
|
i.result.user = o, s.isConnected && (this._trySetPresence(t, o), this._notifyPresenceSubs(t));
|
|
6259
6267
|
}
|
|
6260
6268
|
_trySetPresence(e, t) {
|
|
6261
|
-
this._trySendAuthed(
|
|
6269
|
+
this._trySendAuthed(N(), {
|
|
6262
6270
|
op: "set-presence",
|
|
6263
6271
|
"room-id": e,
|
|
6264
6272
|
data: t
|
|
6265
6273
|
});
|
|
6266
6274
|
}
|
|
6267
6275
|
_tryJoinRoom(e, t, r) {
|
|
6268
|
-
this._trySendAuthed(
|
|
6276
|
+
this._trySendAuthed(N(), {
|
|
6269
6277
|
op: "join-room",
|
|
6270
6278
|
"room-type": e,
|
|
6271
6279
|
"room-id": t,
|
|
@@ -6273,7 +6281,7 @@ class Nc {
|
|
|
6273
6281
|
}), delete this._roomsPendingLeave[t];
|
|
6274
6282
|
}
|
|
6275
6283
|
_tryLeaveRoom(e) {
|
|
6276
|
-
this._trySendAuthed(
|
|
6284
|
+
this._trySendAuthed(N(), { op: "leave-room", "room-id": e });
|
|
6277
6285
|
}
|
|
6278
6286
|
_trySetRoomConnected(e, t) {
|
|
6279
6287
|
const r = this._rooms[e];
|
|
@@ -6347,7 +6355,7 @@ class Nc {
|
|
|
6347
6355
|
}
|
|
6348
6356
|
}
|
|
6349
6357
|
_tryBroadcast(e, t, r, s) {
|
|
6350
|
-
this._trySendAuthed(
|
|
6358
|
+
this._trySendAuthed(N(), {
|
|
6351
6359
|
op: "client-broadcast",
|
|
6352
6360
|
"room-id": e,
|
|
6353
6361
|
roomType: t,
|
|
@@ -7043,7 +7051,7 @@ function Qr(n) {
|
|
|
7043
7051
|
const e = Gr.get(n);
|
|
7044
7052
|
if (e)
|
|
7045
7053
|
return e;
|
|
7046
|
-
const t =
|
|
7054
|
+
const t = J(n);
|
|
7047
7055
|
return Gr.set(n, t), t;
|
|
7048
7056
|
}
|
|
7049
7057
|
function du(n, e) {
|
|
@@ -7139,26 +7147,26 @@ function bu() {
|
|
|
7139
7147
|
D.unshift("Warning: " + T), Function.prototype.apply.call(console[d], console, D);
|
|
7140
7148
|
}
|
|
7141
7149
|
}
|
|
7142
|
-
var v = !1, C = !1, j = !1, U = !1, B = !1,
|
|
7143
|
-
|
|
7144
|
-
function
|
|
7150
|
+
var v = !1, C = !1, j = !1, U = !1, B = !1, ye;
|
|
7151
|
+
ye = Symbol.for("react.module.reference");
|
|
7152
|
+
function Re(d) {
|
|
7145
7153
|
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
7154
|
// types supported by any Flight configuration anywhere since
|
|
7147
7155
|
// we don't know which Flight build this will end up being used
|
|
7148
7156
|
// with.
|
|
7149
|
-
d.$$typeof ===
|
|
7157
|
+
d.$$typeof === ye || d.getModuleId !== void 0));
|
|
7150
7158
|
}
|
|
7151
|
-
function
|
|
7159
|
+
function te(d, T, E) {
|
|
7152
7160
|
var k = d.displayName;
|
|
7153
7161
|
if (k)
|
|
7154
7162
|
return k;
|
|
7155
7163
|
var $ = T.displayName || T.name || "";
|
|
7156
7164
|
return $ !== "" ? E + "(" + $ + ")" : E;
|
|
7157
7165
|
}
|
|
7158
|
-
function
|
|
7166
|
+
function oe(d) {
|
|
7159
7167
|
return d.displayName || "Context";
|
|
7160
7168
|
}
|
|
7161
|
-
function
|
|
7169
|
+
function W(d) {
|
|
7162
7170
|
if (d == null)
|
|
7163
7171
|
return null;
|
|
7164
7172
|
if (typeof d.tag == "number" && w("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof d == "function")
|
|
@@ -7183,19 +7191,19 @@ function bu() {
|
|
|
7183
7191
|
switch (d.$$typeof) {
|
|
7184
7192
|
case c:
|
|
7185
7193
|
var T = d;
|
|
7186
|
-
return
|
|
7194
|
+
return oe(T) + ".Consumer";
|
|
7187
7195
|
case a:
|
|
7188
7196
|
var E = d;
|
|
7189
|
-
return
|
|
7197
|
+
return oe(E._context) + ".Provider";
|
|
7190
7198
|
case u:
|
|
7191
|
-
return
|
|
7199
|
+
return te(d, d.render, "ForwardRef");
|
|
7192
7200
|
case p:
|
|
7193
7201
|
var k = d.displayName || null;
|
|
7194
|
-
return k !== null ? k :
|
|
7202
|
+
return k !== null ? k : W(d.type) || "Memo";
|
|
7195
7203
|
case y: {
|
|
7196
7204
|
var $ = d, D = $._payload, x = $._init;
|
|
7197
7205
|
try {
|
|
7198
|
-
return
|
|
7206
|
+
return W(x(D));
|
|
7199
7207
|
} catch {
|
|
7200
7208
|
return null;
|
|
7201
7209
|
}
|
|
@@ -7203,18 +7211,18 @@ function bu() {
|
|
|
7203
7211
|
}
|
|
7204
7212
|
return null;
|
|
7205
7213
|
}
|
|
7206
|
-
var
|
|
7207
|
-
function
|
|
7214
|
+
var Q = Object.assign, ee = 0, Ae, Tt, Ht, A, I, H, Y;
|
|
7215
|
+
function ae() {
|
|
7208
7216
|
}
|
|
7209
|
-
|
|
7210
|
-
function
|
|
7217
|
+
ae.__reactDisabledLog = !0;
|
|
7218
|
+
function _e() {
|
|
7211
7219
|
{
|
|
7212
|
-
if (
|
|
7213
|
-
|
|
7220
|
+
if (ee === 0) {
|
|
7221
|
+
Ae = console.log, Tt = console.info, Ht = console.warn, A = console.error, I = console.group, H = console.groupCollapsed, Y = console.groupEnd;
|
|
7214
7222
|
var d = {
|
|
7215
7223
|
configurable: !0,
|
|
7216
7224
|
enumerable: !0,
|
|
7217
|
-
value:
|
|
7225
|
+
value: ae,
|
|
7218
7226
|
writable: !0
|
|
7219
7227
|
};
|
|
7220
7228
|
Object.defineProperties(console, {
|
|
@@ -7227,45 +7235,45 @@ function bu() {
|
|
|
7227
7235
|
groupEnd: d
|
|
7228
7236
|
});
|
|
7229
7237
|
}
|
|
7230
|
-
|
|
7238
|
+
ee++;
|
|
7231
7239
|
}
|
|
7232
7240
|
}
|
|
7233
7241
|
function nt() {
|
|
7234
7242
|
{
|
|
7235
|
-
if (
|
|
7243
|
+
if (ee--, ee === 0) {
|
|
7236
7244
|
var d = {
|
|
7237
7245
|
configurable: !0,
|
|
7238
7246
|
enumerable: !0,
|
|
7239
7247
|
writable: !0
|
|
7240
7248
|
};
|
|
7241
7249
|
Object.defineProperties(console, {
|
|
7242
|
-
log:
|
|
7243
|
-
value:
|
|
7250
|
+
log: Q({}, d, {
|
|
7251
|
+
value: Ae
|
|
7244
7252
|
}),
|
|
7245
|
-
info:
|
|
7253
|
+
info: Q({}, d, {
|
|
7246
7254
|
value: Tt
|
|
7247
7255
|
}),
|
|
7248
|
-
warn:
|
|
7256
|
+
warn: Q({}, d, {
|
|
7249
7257
|
value: Ht
|
|
7250
7258
|
}),
|
|
7251
|
-
error:
|
|
7259
|
+
error: Q({}, d, {
|
|
7252
7260
|
value: A
|
|
7253
7261
|
}),
|
|
7254
|
-
group:
|
|
7262
|
+
group: Q({}, d, {
|
|
7255
7263
|
value: I
|
|
7256
7264
|
}),
|
|
7257
|
-
groupCollapsed:
|
|
7258
|
-
value:
|
|
7265
|
+
groupCollapsed: Q({}, d, {
|
|
7266
|
+
value: H
|
|
7259
7267
|
}),
|
|
7260
|
-
groupEnd:
|
|
7261
|
-
value:
|
|
7268
|
+
groupEnd: Q({}, d, {
|
|
7269
|
+
value: Y
|
|
7262
7270
|
})
|
|
7263
7271
|
});
|
|
7264
7272
|
}
|
|
7265
|
-
|
|
7273
|
+
ee < 0 && w("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
7266
7274
|
}
|
|
7267
7275
|
}
|
|
7268
|
-
var
|
|
7276
|
+
var me = g.ReactCurrentDispatcher, Jt;
|
|
7269
7277
|
function St(d, T, E) {
|
|
7270
7278
|
{
|
|
7271
7279
|
if (Jt === void 0)
|
|
@@ -7297,7 +7305,7 @@ function bu() {
|
|
|
7297
7305
|
var $ = Error.prepareStackTrace;
|
|
7298
7306
|
Error.prepareStackTrace = void 0;
|
|
7299
7307
|
var D;
|
|
7300
|
-
D =
|
|
7308
|
+
D = me.current, me.current = null, _e();
|
|
7301
7309
|
try {
|
|
7302
7310
|
if (T) {
|
|
7303
7311
|
var x = function() {
|
|
@@ -7310,29 +7318,29 @@ function bu() {
|
|
|
7310
7318
|
}), typeof Reflect == "object" && Reflect.construct) {
|
|
7311
7319
|
try {
|
|
7312
7320
|
Reflect.construct(x, []);
|
|
7313
|
-
} catch (
|
|
7314
|
-
k =
|
|
7321
|
+
} catch (ce) {
|
|
7322
|
+
k = ce;
|
|
7315
7323
|
}
|
|
7316
7324
|
Reflect.construct(d, [], x);
|
|
7317
7325
|
} else {
|
|
7318
7326
|
try {
|
|
7319
7327
|
x.call();
|
|
7320
|
-
} catch (
|
|
7321
|
-
k =
|
|
7328
|
+
} catch (ce) {
|
|
7329
|
+
k = ce;
|
|
7322
7330
|
}
|
|
7323
7331
|
d.call(x.prototype);
|
|
7324
7332
|
}
|
|
7325
7333
|
} else {
|
|
7326
7334
|
try {
|
|
7327
7335
|
throw Error();
|
|
7328
|
-
} catch (
|
|
7329
|
-
k =
|
|
7336
|
+
} catch (ce) {
|
|
7337
|
+
k = ce;
|
|
7330
7338
|
}
|
|
7331
7339
|
d();
|
|
7332
7340
|
}
|
|
7333
|
-
} catch (
|
|
7334
|
-
if (
|
|
7335
|
-
for (var M =
|
|
7341
|
+
} catch (ce) {
|
|
7342
|
+
if (ce && k && typeof ce.stack == "string") {
|
|
7343
|
+
for (var M = ce.stack.split(`
|
|
7336
7344
|
`), ne = k.stack.split(`
|
|
7337
7345
|
`), K = M.length - 1, z = ne.length - 1; K >= 1 && z >= 0 && M[K] !== ne[z]; )
|
|
7338
7346
|
z--;
|
|
@@ -7341,16 +7349,16 @@ function bu() {
|
|
|
7341
7349
|
if (K !== 1 || z !== 1)
|
|
7342
7350
|
do
|
|
7343
7351
|
if (K--, z--, z < 0 || M[K] !== ne[z]) {
|
|
7344
|
-
var
|
|
7352
|
+
var be = `
|
|
7345
7353
|
` + M[K].replace(" at new ", " at ");
|
|
7346
|
-
return d.displayName &&
|
|
7354
|
+
return d.displayName && be.includes("<anonymous>") && (be = be.replace("<anonymous>", d.displayName)), typeof d == "function" && vt.set(d, be), be;
|
|
7347
7355
|
}
|
|
7348
7356
|
while (K >= 1 && z >= 0);
|
|
7349
7357
|
break;
|
|
7350
7358
|
}
|
|
7351
7359
|
}
|
|
7352
7360
|
} finally {
|
|
7353
|
-
Yt = !1,
|
|
7361
|
+
Yt = !1, me.current = D, nt(), Error.prepareStackTrace = $;
|
|
7354
7362
|
}
|
|
7355
7363
|
var ze = d ? d.displayName || d.name : "", je = ze ? St(ze) : "";
|
|
7356
7364
|
return typeof d == "function" && vt.set(d, je), je;
|
|
@@ -7552,7 +7560,7 @@ function bu() {
|
|
|
7552
7560
|
function lr() {
|
|
7553
7561
|
{
|
|
7554
7562
|
if (Xt.current) {
|
|
7555
|
-
var d =
|
|
7563
|
+
var d = W(Xt.current.type);
|
|
7556
7564
|
if (d)
|
|
7557
7565
|
return `
|
|
7558
7566
|
|
|
@@ -7587,7 +7595,7 @@ Check the top-level render call using <` + E + ">.");
|
|
|
7587
7595
|
return;
|
|
7588
7596
|
fr[E] = !0;
|
|
7589
7597
|
var k = "";
|
|
7590
|
-
d && d._owner && d._owner !== Xt.current && (k = " It was passed a child from " +
|
|
7598
|
+
d && d._owner && d._owner !== Xt.current && (k = " It was passed a child from " + W(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
7599
|
}
|
|
7592
7600
|
}
|
|
7593
7601
|
function hr(d, T) {
|
|
@@ -7624,11 +7632,11 @@ Check the top-level render call using <` + E + ">.");
|
|
|
7624
7632
|
else
|
|
7625
7633
|
return;
|
|
7626
7634
|
if (E) {
|
|
7627
|
-
var k =
|
|
7635
|
+
var k = W(T);
|
|
7628
7636
|
Ys(E, d.props, "prop", k, d);
|
|
7629
7637
|
} else if (T.PropTypes !== void 0 && !en) {
|
|
7630
7638
|
en = !0;
|
|
7631
|
-
var $ =
|
|
7639
|
+
var $ = W(T);
|
|
7632
7640
|
w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", $ || "Unknown");
|
|
7633
7641
|
}
|
|
7634
7642
|
typeof T.getDefaultProps == "function" && !T.getDefaultProps.isReactClassApproved && w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
@@ -7649,37 +7657,37 @@ Check the top-level render call using <` + E + ">.");
|
|
|
7649
7657
|
var pr = {};
|
|
7650
7658
|
function yr(d, T, E, k, $, D) {
|
|
7651
7659
|
{
|
|
7652
|
-
var x =
|
|
7660
|
+
var x = Re(d);
|
|
7653
7661
|
if (!x) {
|
|
7654
7662
|
var M = "";
|
|
7655
7663
|
(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
7664
|
var ne = ui();
|
|
7657
7665
|
ne ? M += ne : M += lr();
|
|
7658
7666
|
var K;
|
|
7659
|
-
d === null ? K = "null" : Zt(d) ? K = "array" : d !== void 0 && d.$$typeof === t ? (K = "<" + (
|
|
7667
|
+
d === null ? K = "null" : Zt(d) ? K = "array" : d !== void 0 && d.$$typeof === t ? (K = "<" + (W(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
7668
|
}
|
|
7661
7669
|
var z = ci(d, T, E, $, D);
|
|
7662
7670
|
if (z == null)
|
|
7663
7671
|
return z;
|
|
7664
7672
|
if (x) {
|
|
7665
|
-
var
|
|
7666
|
-
if (
|
|
7673
|
+
var be = T.children;
|
|
7674
|
+
if (be !== void 0)
|
|
7667
7675
|
if (k)
|
|
7668
|
-
if (Zt(
|
|
7669
|
-
for (var ze = 0; ze <
|
|
7670
|
-
hr(
|
|
7671
|
-
Object.freeze && Object.freeze(
|
|
7676
|
+
if (Zt(be)) {
|
|
7677
|
+
for (var ze = 0; ze < be.length; ze++)
|
|
7678
|
+
hr(be[ze], d);
|
|
7679
|
+
Object.freeze && Object.freeze(be);
|
|
7672
7680
|
} else
|
|
7673
7681
|
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
7682
|
else
|
|
7675
|
-
hr(
|
|
7683
|
+
hr(be, d);
|
|
7676
7684
|
}
|
|
7677
7685
|
if (rt.call(T, "key")) {
|
|
7678
|
-
var je =
|
|
7686
|
+
var je = W(d), ce = Object.keys(T).filter(function(_i) {
|
|
7679
7687
|
return _i !== "key";
|
|
7680
|
-
}), nn =
|
|
7688
|
+
}), nn = ce.length > 0 ? "{key: someKey, " + ce.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
7681
7689
|
if (!pr[je + nn]) {
|
|
7682
|
-
var gi =
|
|
7690
|
+
var gi = ce.length > 0 ? "{" + ce.join(": ..., ") + ": ...}" : "{}";
|
|
7683
7691
|
w(`A props object containing a "key" prop is being spread into JSX:
|
|
7684
7692
|
let props = %s;
|
|
7685
7693
|
<%s {...props} />
|
|
@@ -7703,7 +7711,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
7703
7711
|
}
|
|
7704
7712
|
var gu = {};
|
|
7705
7713
|
gu.NODE_ENV === "production" ? Mn.exports = yu() : Mn.exports = bu();
|
|
7706
|
-
var
|
|
7714
|
+
var X = Mn.exports;
|
|
7707
7715
|
const _u = {
|
|
7708
7716
|
isLoading: !0,
|
|
7709
7717
|
data: void 0,
|
|
@@ -7721,7 +7729,7 @@ function Yr(n) {
|
|
|
7721
7729
|
}
|
|
7722
7730
|
function mu(n, e, t) {
|
|
7723
7731
|
e && t && "ruleParams" in t && (e = { $$ruleParams: t.ruleParams, ...e });
|
|
7724
|
-
const r = e ? lu(e) : null, s =
|
|
7732
|
+
const r = e ? lu(e) : null, s = J(r), i = gt(Yr(n._reactor.getPreviousResult(r))), o = Me(
|
|
7725
7733
|
(c) => (i.current = Yr(n._reactor.getPreviousResult(r)), c(), r ? n.subscribeQuery(r, (l) => {
|
|
7726
7734
|
i.current = {
|
|
7727
7735
|
isLoading: !l,
|
|
@@ -7761,7 +7769,7 @@ function Su(n, e, t) {
|
|
|
7761
7769
|
}), [n.id, e]);
|
|
7762
7770
|
}
|
|
7763
7771
|
function vu(n, e) {
|
|
7764
|
-
return Fe(() => n.core._reactor.joinRoom(n.type, n.id), [n.id]),
|
|
7772
|
+
return Fe(() => n.core._reactor.joinRoom(n.type, n.id), [n.id]), Me((r) => {
|
|
7765
7773
|
n.core._reactor.publishTopic({
|
|
7766
7774
|
roomType: n.type,
|
|
7767
7775
|
roomId: n.id,
|
|
@@ -7779,7 +7787,7 @@ function Eu(n, e = {}) {
|
|
|
7779
7787
|
Fe(() => n.core._reactor.subscribePresence(n.type, n.id, e, (u) => {
|
|
7780
7788
|
r(u);
|
|
7781
7789
|
}), [n.id, e.user, (o = e.peers) == null ? void 0 : o.join(), (a = e.keys) == null ? void 0 : a.join()]);
|
|
7782
|
-
const s =
|
|
7790
|
+
const s = Me((c) => {
|
|
7783
7791
|
n.core._reactor.publishPresence(n.type, n.id, c);
|
|
7784
7792
|
}, [n.type, n.id]);
|
|
7785
7793
|
return hn(() => ({
|
|
@@ -7796,7 +7804,7 @@ function Au(n, e, t = {}) {
|
|
|
7796
7804
|
}), i = hn(() => {
|
|
7797
7805
|
const l = n._core._reactor.getPresence(n.type, n.id);
|
|
7798
7806
|
return t != null && t.writeOnly ? [] : Object.values((l == null ? void 0 : l.peers) ?? {}).filter((f) => f[e] === !0);
|
|
7799
|
-
}, [t == null ? void 0 : t.writeOnly, s]), o =
|
|
7807
|
+
}, [t == null ? void 0 : t.writeOnly, s]), o = Me((l) => {
|
|
7800
7808
|
n.core._reactor.publishPresence(n.type, n.id, {
|
|
7801
7809
|
[e]: l
|
|
7802
7810
|
}), l && ((t == null ? void 0 : t.timeout) === null || (t == null ? void 0 : t.timeout) === 0 || r.set((t == null ? void 0 : t.timeout) ?? Tu, () => {
|
|
@@ -7804,10 +7812,10 @@ function Au(n, e, t = {}) {
|
|
|
7804
7812
|
[e]: null
|
|
7805
7813
|
});
|
|
7806
7814
|
}));
|
|
7807
|
-
}, [n.type, n.id, e, t == null ? void 0 : t.timeout, r]), a =
|
|
7815
|
+
}, [n.type, n.id, e, t == null ? void 0 : t.timeout, r]), a = Me((l) => {
|
|
7808
7816
|
const p = !((t == null ? void 0 : t.stopOnEnter) && l.key === "Enter");
|
|
7809
7817
|
o(p);
|
|
7810
|
-
}, [t.stopOnEnter, o]), c =
|
|
7818
|
+
}, [t.stopOnEnter, o]), c = Me(() => {
|
|
7811
7819
|
o(!1);
|
|
7812
7820
|
}, [o]), u = hn(() => ({ onKeyDown: a, onBlur: c }), [a, c]);
|
|
7813
7821
|
return {
|
|
@@ -8087,7 +8095,7 @@ class $t {
|
|
|
8087
8095
|
* }
|
|
8088
8096
|
*/
|
|
8089
8097
|
h(this, "useConnectionStatus", () => {
|
|
8090
|
-
const e = gt(this.core._reactor.status), t =
|
|
8098
|
+
const e = gt(this.core._reactor.status), t = Me((s) => this.core.subscribeConnectionStatus((o) => {
|
|
8091
8099
|
o !== e.current && (e.current = o, s());
|
|
8092
8100
|
}), []);
|
|
8093
8101
|
return dn(
|
|
@@ -8123,7 +8131,7 @@ class $t {
|
|
|
8123
8131
|
*/
|
|
8124
8132
|
h(this, "SignedIn", ({ children: e }) => {
|
|
8125
8133
|
const t = this.useAuth();
|
|
8126
|
-
return t.isLoading || t.error || !t.user ? null :
|
|
8134
|
+
return t.isLoading || t.error || !t.user ? null : X.jsx(X.Fragment, { children: e });
|
|
8127
8135
|
});
|
|
8128
8136
|
/**
|
|
8129
8137
|
* Only render children if the user is signed out.
|
|
@@ -8137,7 +8145,7 @@ class $t {
|
|
|
8137
8145
|
*/
|
|
8138
8146
|
h(this, "SignedOut", ({ children: e }) => {
|
|
8139
8147
|
const t = this.useAuth();
|
|
8140
|
-
return t.isLoading || t.error || t.user ? null :
|
|
8148
|
+
return t.isLoading || t.error || t.user ? null : X.jsx(X.Fragment, { children: e });
|
|
8141
8149
|
});
|
|
8142
8150
|
this.core = hu(
|
|
8143
8151
|
e,
|
|
@@ -8166,7 +8174,7 @@ class $t {
|
|
|
8166
8174
|
return new ku(this.core, e, t);
|
|
8167
8175
|
}
|
|
8168
8176
|
_useAuth() {
|
|
8169
|
-
const e = gt(this.core._reactor._currentUserCached), t =
|
|
8177
|
+
const e = gt(this.core._reactor._currentUserCached), t = Me((s) => this.core.subscribeAuth((o) => {
|
|
8170
8178
|
e.current = { isLoading: !1, ...o }, s();
|
|
8171
8179
|
}), []);
|
|
8172
8180
|
return dn(t, () => e.current, () => Cu);
|
|
@@ -8348,44 +8356,44 @@ function es(n) {
|
|
|
8348
8356
|
}
|
|
8349
8357
|
var Bs = (n) => {
|
|
8350
8358
|
throw TypeError(n);
|
|
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),
|
|
8359
|
+
}, 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), F = (n, e, t, r) => (er(n, e, "write to private field"), e.set(n, t), t), ke = (n, e, t) => (er(n, e, "access private method"), t), ue, De, Ge, Dt, qt, yt, Je, bt, Pe, Qe, Ze, He, lt, we, jn, xn, $n, ts, Dn, Un, ft, Ln, Fn;
|
|
8352
8360
|
class Ut extends EventTarget {
|
|
8353
8361
|
constructor(e, t) {
|
|
8354
8362
|
var r, s;
|
|
8355
|
-
super(), G(this,
|
|
8363
|
+
super(), G(this, we), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, G(this, ue), G(this, De), G(this, Ge), G(this, Dt), G(this, qt), G(this, yt), G(this, Je), G(this, bt, null), G(this, Pe), G(this, Qe), G(this, Ze, null), G(this, He, null), G(this, lt, null), G(this, xn, async (i) => {
|
|
8356
8364
|
var o;
|
|
8357
8365
|
P(this, Qe).reset();
|
|
8358
8366
|
const { body: a, redirected: c, status: u, headers: l } = i;
|
|
8359
8367
|
if (u === 204) {
|
|
8360
|
-
|
|
8368
|
+
ke(this, we, ft).call(this, "Server sent HTTP 204, not reconnecting", 204), this.close();
|
|
8361
8369
|
return;
|
|
8362
8370
|
}
|
|
8363
|
-
if (c ?
|
|
8364
|
-
|
|
8371
|
+
if (c ? F(this, Ge, new URL(i.url)) : F(this, Ge, void 0), u !== 200) {
|
|
8372
|
+
ke(this, we, ft).call(this, `Non-200 status code (${u})`, u);
|
|
8365
8373
|
return;
|
|
8366
8374
|
}
|
|
8367
8375
|
if (!(l.get("content-type") || "").startsWith("text/event-stream")) {
|
|
8368
|
-
|
|
8376
|
+
ke(this, we, ft).call(this, 'Invalid content type, expected "text/event-stream"', u);
|
|
8369
8377
|
return;
|
|
8370
8378
|
}
|
|
8371
|
-
if (P(this,
|
|
8379
|
+
if (P(this, ue) === this.CLOSED)
|
|
8372
8380
|
return;
|
|
8373
|
-
|
|
8381
|
+
F(this, ue, this.OPEN);
|
|
8374
8382
|
const f = new Event("open");
|
|
8375
8383
|
if ((o = P(this, lt)) == null || o.call(this, f), this.dispatchEvent(f), typeof a != "object" || !a || !("getReader" in a)) {
|
|
8376
|
-
|
|
8384
|
+
ke(this, we, ft).call(this, "Invalid response body, expected a web ReadableStream", u), this.close();
|
|
8377
8385
|
return;
|
|
8378
8386
|
}
|
|
8379
8387
|
const p = new TextDecoder(), y = a.getReader();
|
|
8380
8388
|
let b = !0;
|
|
8381
8389
|
do {
|
|
8382
8390
|
const { done: _, value: m } = await y.read();
|
|
8383
|
-
m && P(this, Qe).feed(p.decode(m, { stream: !_ })), _ && (b = !1, P(this, Qe).reset(),
|
|
8391
|
+
m && P(this, Qe).feed(p.decode(m, { stream: !_ })), _ && (b = !1, P(this, Qe).reset(), ke(this, we, Ln).call(this));
|
|
8384
8392
|
} while (b);
|
|
8385
8393
|
}), G(this, $n, (i) => {
|
|
8386
|
-
|
|
8394
|
+
F(this, Pe, void 0), !(i.name === "AbortError" || i.type === "aborted") && ke(this, we, Ln).call(this, Rn(i));
|
|
8387
8395
|
}), G(this, Dn, (i) => {
|
|
8388
|
-
typeof i.id == "string" &&
|
|
8396
|
+
typeof i.id == "string" && F(this, bt, i.id);
|
|
8389
8397
|
const o = new MessageEvent(i.event || "message", {
|
|
8390
8398
|
data: i.data,
|
|
8391
8399
|
origin: P(this, Ge) ? P(this, Ge).origin : P(this, De).origin,
|
|
@@ -8393,24 +8401,24 @@ class Ut extends EventTarget {
|
|
|
8393
8401
|
});
|
|
8394
8402
|
P(this, He) && (!i.event || i.event === "message") && P(this, He).call(this, o), this.dispatchEvent(o);
|
|
8395
8403
|
}), G(this, Un, (i) => {
|
|
8396
|
-
|
|
8404
|
+
F(this, yt, i);
|
|
8397
8405
|
}), G(this, Fn, () => {
|
|
8398
|
-
|
|
8406
|
+
F(this, Je, void 0), P(this, ue) === this.CONNECTING && ke(this, we, jn).call(this);
|
|
8399
8407
|
});
|
|
8400
8408
|
try {
|
|
8401
8409
|
if (e instanceof URL)
|
|
8402
|
-
|
|
8410
|
+
F(this, De, e);
|
|
8403
8411
|
else if (typeof e == "string")
|
|
8404
|
-
|
|
8412
|
+
F(this, De, new URL(e, Ru()));
|
|
8405
8413
|
else
|
|
8406
8414
|
throw new Error("Invalid URL");
|
|
8407
8415
|
} catch {
|
|
8408
8416
|
throw Mu("An invalid or illegal string was specified");
|
|
8409
8417
|
}
|
|
8410
|
-
|
|
8418
|
+
F(this, Qe, Iu({
|
|
8411
8419
|
onEvent: P(this, Dn),
|
|
8412
8420
|
onRetry: P(this, Un)
|
|
8413
|
-
})),
|
|
8421
|
+
})), F(this, ue, this.CONNECTING), F(this, yt, 3e3), F(this, qt, (r = t == null ? void 0 : t.fetch) != null ? r : globalThis.fetch), F(this, Dt, (s = t == null ? void 0 : t.withCredentials) != null ? s : !1), ke(this, we, jn).call(this);
|
|
8414
8422
|
}
|
|
8415
8423
|
/**
|
|
8416
8424
|
* Returns the state of this EventSource object's connection. It can have the values described below.
|
|
@@ -8423,7 +8431,7 @@ class Ut extends EventTarget {
|
|
|
8423
8431
|
* @public
|
|
8424
8432
|
*/
|
|
8425
8433
|
get readyState() {
|
|
8426
|
-
return P(this,
|
|
8434
|
+
return P(this, ue);
|
|
8427
8435
|
}
|
|
8428
8436
|
/**
|
|
8429
8437
|
* Returns the URL providing the event stream.
|
|
@@ -8448,21 +8456,21 @@ class Ut extends EventTarget {
|
|
|
8448
8456
|
return P(this, Ze);
|
|
8449
8457
|
}
|
|
8450
8458
|
set onerror(e) {
|
|
8451
|
-
|
|
8459
|
+
F(this, Ze, e);
|
|
8452
8460
|
}
|
|
8453
8461
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */
|
|
8454
8462
|
get onmessage() {
|
|
8455
8463
|
return P(this, He);
|
|
8456
8464
|
}
|
|
8457
8465
|
set onmessage(e) {
|
|
8458
|
-
|
|
8466
|
+
F(this, He, e);
|
|
8459
8467
|
}
|
|
8460
8468
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */
|
|
8461
8469
|
get onopen() {
|
|
8462
8470
|
return P(this, lt);
|
|
8463
8471
|
}
|
|
8464
8472
|
set onopen(e) {
|
|
8465
|
-
|
|
8473
|
+
F(this, lt, e);
|
|
8466
8474
|
}
|
|
8467
8475
|
addEventListener(e, t, r) {
|
|
8468
8476
|
const s = t;
|
|
@@ -8480,16 +8488,16 @@ class Ut extends EventTarget {
|
|
|
8480
8488
|
* @public
|
|
8481
8489
|
*/
|
|
8482
8490
|
close() {
|
|
8483
|
-
P(this, Je) && clearTimeout(P(this, Je)), P(this,
|
|
8491
|
+
P(this, Je) && clearTimeout(P(this, Je)), P(this, ue) !== this.CLOSED && (P(this, Pe) && P(this, Pe).abort(), F(this, ue, this.CLOSED), F(this, Pe, void 0));
|
|
8484
8492
|
}
|
|
8485
8493
|
}
|
|
8486
|
-
|
|
8494
|
+
ue = /* @__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(), Pe = /* @__PURE__ */ new WeakMap(), Qe = /* @__PURE__ */ new WeakMap(), Ze = /* @__PURE__ */ new WeakMap(), He = /* @__PURE__ */ new WeakMap(), lt = /* @__PURE__ */ new WeakMap(), we = /* @__PURE__ */ new WeakSet(), /**
|
|
8487
8495
|
* Connect to the given URL and start receiving events
|
|
8488
8496
|
*
|
|
8489
8497
|
* @internal
|
|
8490
8498
|
*/
|
|
8491
8499
|
jn = function() {
|
|
8492
|
-
|
|
8500
|
+
F(this, ue, this.CONNECTING), F(this, Pe, new AbortController()), P(this, qt)(P(this, De), ke(this, we, ts).call(this)).then(P(this, xn)).catch(P(this, $n));
|
|
8493
8501
|
}, xn = /* @__PURE__ */ new WeakMap(), $n = /* @__PURE__ */ new WeakMap(), /**
|
|
8494
8502
|
* Get request options for the `fetch()` request
|
|
8495
8503
|
*
|
|
@@ -8505,7 +8513,7 @@ ts = function() {
|
|
|
8505
8513
|
redirect: "follow",
|
|
8506
8514
|
headers: { Accept: "text/event-stream", ...P(this, bt) ? { "Last-Event-ID": P(this, bt) } : void 0 },
|
|
8507
8515
|
cache: "no-store",
|
|
8508
|
-
signal: (n = P(this,
|
|
8516
|
+
signal: (n = P(this, Pe)) == null ? void 0 : n.signal
|
|
8509
8517
|
};
|
|
8510
8518
|
return "window" in globalThis && (e.credentials = this.withCredentials ? "include" : "same-origin"), e;
|
|
8511
8519
|
}, Dn = /* @__PURE__ */ new WeakMap(), Un = /* @__PURE__ */ new WeakMap(), /**
|
|
@@ -8517,7 +8525,7 @@ ts = function() {
|
|
|
8517
8525
|
*/
|
|
8518
8526
|
ft = function(n, e) {
|
|
8519
8527
|
var t;
|
|
8520
|
-
P(this,
|
|
8528
|
+
P(this, ue) !== this.CLOSED && F(this, ue, this.CLOSED);
|
|
8521
8529
|
const r = new Xr("error", { code: e, message: n });
|
|
8522
8530
|
(t = P(this, Ze)) == null || t.call(this, r), this.dispatchEvent(r);
|
|
8523
8531
|
}, /**
|
|
@@ -8529,11 +8537,11 @@ ft = function(n, e) {
|
|
|
8529
8537
|
*/
|
|
8530
8538
|
Ln = function(n, e) {
|
|
8531
8539
|
var t;
|
|
8532
|
-
if (P(this,
|
|
8540
|
+
if (P(this, ue) === this.CLOSED)
|
|
8533
8541
|
return;
|
|
8534
|
-
|
|
8542
|
+
F(this, ue, this.CONNECTING);
|
|
8535
8543
|
const r = new Xr("error", { code: e, message: n });
|
|
8536
|
-
(t = P(this, Ze)) == null || t.call(this, r), this.dispatchEvent(r),
|
|
8544
|
+
(t = P(this, Ze)) == null || t.call(this, r), this.dispatchEvent(r), F(this, Je, setTimeout(P(this, Fn), P(this, yt)));
|
|
8537
8545
|
}, Fn = /* @__PURE__ */ new WeakMap(), /**
|
|
8538
8546
|
* ReadyState representing an EventSource currently trying to connect
|
|
8539
8547
|
*
|
|
@@ -8634,7 +8642,7 @@ function zu({
|
|
|
8634
8642
|
},
|
|
8635
8643
|
[
|
|
8636
8644
|
o,
|
|
8637
|
-
/* @__PURE__ */
|
|
8645
|
+
/* @__PURE__ */ X.jsx(
|
|
8638
8646
|
"div",
|
|
8639
8647
|
{
|
|
8640
8648
|
style: {
|
|
@@ -8644,7 +8652,7 @@ function zu({
|
|
|
8644
8652
|
},
|
|
8645
8653
|
children: Object.entries(f.peers).map(([g, w]) => {
|
|
8646
8654
|
const O = w[l];
|
|
8647
|
-
return O ? /* @__PURE__ */
|
|
8655
|
+
return O ? /* @__PURE__ */ X.jsx(
|
|
8648
8656
|
"div",
|
|
8649
8657
|
{
|
|
8650
8658
|
style: {
|
|
@@ -8656,7 +8664,7 @@ function zu({
|
|
|
8656
8664
|
children: a ? a({
|
|
8657
8665
|
color: O.color,
|
|
8658
8666
|
presence: p == null ? void 0 : p.peers[g]
|
|
8659
|
-
}) : /* @__PURE__ */
|
|
8667
|
+
}) : /* @__PURE__ */ X.jsx(xu, { ...O })
|
|
8660
8668
|
},
|
|
8661
8669
|
g
|
|
8662
8670
|
) : null;
|
|
@@ -8669,7 +8677,7 @@ function zu({
|
|
|
8669
8677
|
}
|
|
8670
8678
|
function xu({ color: n }) {
|
|
8671
8679
|
const t = n || "black";
|
|
8672
|
-
return /* @__PURE__ */
|
|
8680
|
+
return /* @__PURE__ */ X.jsxs(
|
|
8673
8681
|
"svg",
|
|
8674
8682
|
{
|
|
8675
8683
|
style: { height: 35, width: 35 },
|
|
@@ -8677,36 +8685,36 @@ function xu({ color: n }) {
|
|
|
8677
8685
|
fill: "none",
|
|
8678
8686
|
xmlns: "http://www.w3.org/2000/svg",
|
|
8679
8687
|
children: [
|
|
8680
|
-
/* @__PURE__ */
|
|
8688
|
+
/* @__PURE__ */ X.jsxs(
|
|
8681
8689
|
"g",
|
|
8682
8690
|
{
|
|
8683
8691
|
fill: "rgba(0,0,0,.2)",
|
|
8684
8692
|
transform: "matrix(1, 0, 0, 1, -11.999999046325684, -8.406899452209473)",
|
|
8685
8693
|
children: [
|
|
8686
|
-
/* @__PURE__ */
|
|
8687
|
-
/* @__PURE__ */
|
|
8694
|
+
/* @__PURE__ */ X.jsx("path", { d: "m12 24.4219v-16.015l11.591 11.619h-6.781l-.411.124z" }),
|
|
8695
|
+
/* @__PURE__ */ X.jsx("path", { d: "m21.0845 25.0962-3.605 1.535-4.682-11.089 3.686-1.553z" })
|
|
8688
8696
|
]
|
|
8689
8697
|
}
|
|
8690
8698
|
),
|
|
8691
|
-
/* @__PURE__ */
|
|
8699
|
+
/* @__PURE__ */ X.jsxs(
|
|
8692
8700
|
"g",
|
|
8693
8701
|
{
|
|
8694
8702
|
fill: "white",
|
|
8695
8703
|
transform: "matrix(1, 0, 0, 1, -11.999999046325684, -8.406899452209473)",
|
|
8696
8704
|
children: [
|
|
8697
|
-
/* @__PURE__ */
|
|
8698
|
-
/* @__PURE__ */
|
|
8705
|
+
/* @__PURE__ */ X.jsx("path", { d: "m12 24.4219v-16.015l11.591 11.619h-6.781l-.411.124z" }),
|
|
8706
|
+
/* @__PURE__ */ X.jsx("path", { d: "m21.0845 25.0962-3.605 1.535-4.682-11.089 3.686-1.553z" })
|
|
8699
8707
|
]
|
|
8700
8708
|
}
|
|
8701
8709
|
),
|
|
8702
|
-
/* @__PURE__ */
|
|
8710
|
+
/* @__PURE__ */ X.jsxs(
|
|
8703
8711
|
"g",
|
|
8704
8712
|
{
|
|
8705
8713
|
fill: t,
|
|
8706
8714
|
transform: "matrix(1, 0, 0, 1, -11.999999046325684, -8.406899452209473)",
|
|
8707
8715
|
children: [
|
|
8708
|
-
/* @__PURE__ */
|
|
8709
|
-
/* @__PURE__ */
|
|
8716
|
+
/* @__PURE__ */ X.jsx("path", { d: "m19.751 24.4155-1.844.774-3.1-7.374 1.841-.775z" }),
|
|
8717
|
+
/* @__PURE__ */ X.jsx("path", { d: "m13 10.814v11.188l2.969-2.866.428-.139h4.768z" })
|
|
8710
8718
|
]
|
|
8711
8719
|
}
|
|
8712
8720
|
)
|
|
@@ -8734,7 +8742,7 @@ export {
|
|
|
8734
8742
|
xe as SyncTableCallbackEventType,
|
|
8735
8743
|
Ku as createInstantRouteHandler,
|
|
8736
8744
|
Wu as i,
|
|
8737
|
-
|
|
8745
|
+
N as id,
|
|
8738
8746
|
ju as init,
|
|
8739
8747
|
qu as init_experimental,
|
|
8740
8748
|
fa as lookup,
|