@instantdb/react 0.22.154-branch-safari-fix.22774465692.1 → 0.22.154
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 +384 -392
- 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 Pe, useSyncExternalStore as dn, useEffect as Fe, useMemo as hn, useState as ss, createElement as Ti } from "react";
|
|
5
|
+
function H(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 J(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 = H(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 J(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 = H(s);
|
|
35
35
|
e ^= parseInt(i, 16), e *= 16777619, e = e >>> 0;
|
|
36
|
-
const o =
|
|
36
|
+
const o = H(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 H(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, he = {
|
|
48
48
|
mutable: "mutable",
|
|
49
49
|
immutable: "immutable"
|
|
50
50
|
}, Nn = {};
|
|
@@ -68,7 +68,7 @@ function Wn(n) {
|
|
|
68
68
|
function Kn(n) {
|
|
69
69
|
return Object.getPrototypeOf(n) === Map.prototype;
|
|
70
70
|
}
|
|
71
|
-
function
|
|
71
|
+
function de(n) {
|
|
72
72
|
var e;
|
|
73
73
|
return (e = n.copy) !== null && e !== void 0 ? e : n.original;
|
|
74
74
|
}
|
|
@@ -83,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 Te(n, e) {
|
|
87
87
|
if (!n || typeof n != "object")
|
|
88
88
|
return !1;
|
|
89
89
|
let t;
|
|
90
|
-
return Object.getPrototypeOf(n) === Object.prototype || Array.isArray(n) || n instanceof Map || n instanceof Set || !!(e != null && e.mark) && ((t = e.mark(n,
|
|
90
|
+
return Object.getPrototypeOf(n) === Object.prototype || Array.isArray(n) || n instanceof Map || n instanceof Set || !!(e != null && e.mark) && ((t = e.mark(n, he)) === he.immutable || typeof t == "function");
|
|
91
91
|
}
|
|
92
92
|
function os(n, e = []) {
|
|
93
93
|
if (Object.hasOwnProperty.call(n, "key")) {
|
|
94
|
-
const t = n.parent.copy, r = R(
|
|
94
|
+
const t = n.parent.copy, r = R(Ce(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 Ce(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 ? de(t) : n)[e];
|
|
124
124
|
}
|
|
125
|
-
function
|
|
125
|
+
function ke(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 = Ce(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, he), t !== void 0) && t !== he.mutable) {
|
|
181
|
+
if (t === he.immutable)
|
|
182
182
|
return Ei(n);
|
|
183
183
|
if (typeof t == "function") {
|
|
184
184
|
if (e.enablePatches || e.enableAutoFreeze)
|
|
@@ -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 (!Te(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) || !Te(n, t) || e.has(n) || Object.isFrozen(n))
|
|
302
302
|
return;
|
|
303
303
|
const r = n instanceof Set, s = r ? /* @__PURE__ */ new Map() : void 0;
|
|
304
304
|
if (e.add(n), zn(n, (i, o) => {
|
|
@@ -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(Ce(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 (Ce(
|
|
343
|
+
if (ke(Ce(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)), Te(t, n.options) && n.finalities.draft.push(() => {
|
|
348
348
|
const i = n.type === 3 ? n.setMap : n.copy;
|
|
349
|
-
Ce(
|
|
349
|
+
ke(Ce(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 = Ce(n, c), l = Rt(Ce(e, c)), f = a ? dt(n, c) ? q.Replace : q.Add : q.Remove;
|
|
401
|
+
if (ke(u, l) && f === q.Replace)
|
|
402
402
|
return;
|
|
403
403
|
const p = r.concat(c), y = Ue(p, o);
|
|
404
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 && (!Te(n, e) || t))
|
|
453
453
|
throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.");
|
|
454
454
|
}, gn = {
|
|
455
455
|
get size() {
|
|
456
|
-
return
|
|
456
|
+
return de(R(this)).size;
|
|
457
457
|
},
|
|
458
458
|
has(n) {
|
|
459
|
-
return
|
|
459
|
+
return de(R(this)).has(n);
|
|
460
460
|
},
|
|
461
461
|
set(n, e) {
|
|
462
|
-
const t = R(this), r =
|
|
463
|
-
return (!r.has(n) || !
|
|
462
|
+
const t = R(this), r = de(t);
|
|
463
|
+
return (!r.has(n) || !ke(r.get(n), e)) && (re(t), Oe(t), t.assignedMap.set(n, !0), t.copy.set(n, e), Vn(t, n, e, _t)), this;
|
|
464
464
|
},
|
|
465
465
|
delete(n) {
|
|
466
466
|
if (!this.has(n))
|
|
@@ -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
|
+
de(t).forEach((r, s) => {
|
|
483
483
|
n.call(e, this.get(s), s, this);
|
|
484
484
|
});
|
|
485
485
|
},
|
|
486
486
|
get(n) {
|
|
487
487
|
var e, t;
|
|
488
|
-
const r = R(this), s =
|
|
489
|
-
if (r.options.strict && Lt(s, r.options, i), i || r.finalized || !
|
|
488
|
+
const r = R(this), s = de(r).get(n), i = ((t = (e = r.options).mark) === null || t === void 0 ? void 0 : t.call(e, s, he)) === he.mutable;
|
|
489
|
+
if (r.options.strict && Lt(s, r.options, i), i || r.finalized || !Te(s, r.options) || s !== r.original.get(n))
|
|
490
490
|
return s;
|
|
491
491
|
const o = Nn.createDraft({
|
|
492
492
|
original: s,
|
|
@@ -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 de(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, he)) === he.mutable;
|
|
543
|
+
if (n.options.strict && Lt(o, n.options, u), !u && !c && Te(o, n.options) && !n.finalized && n.original.has(o)) {
|
|
544
544
|
const l = Nn.createDraft({
|
|
545
545
|
original: o,
|
|
546
546
|
parentDraft: n,
|
|
@@ -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, he), o === he.mutable)
|
|
658
658
|
return n.options.strict && Lt(u, n.options, !0), u;
|
|
659
659
|
}
|
|
660
|
-
const a =
|
|
660
|
+
const a = de(n);
|
|
661
661
|
if (a instanceof Map && Pi.includes(e)) {
|
|
662
662
|
if (e === "size")
|
|
663
663
|
return Object.getOwnPropertyDescriptor(gn, "size").get.call(n.proxy);
|
|
@@ -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 || !Te(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(de(n), e);
|
|
708
708
|
if (i != null && i.set)
|
|
709
709
|
return i.set.call(n.proxy, t), !0;
|
|
710
|
-
const o = rn(
|
|
711
|
-
return a &&
|
|
710
|
+
const o = rn(de(n), e), a = R(o);
|
|
711
|
+
return a && ke(a.original, t) ? (n.copy[e] = t, n.assignedMap = (r = n.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), n.assignedMap.set(e, !1), !0) : (ke(t, o) && (t !== void 0 || dt(n.original, e)) || (re(n), Oe(n), dt(n.original, e) && ke(t, n.original[e]) ? n.assignedMap.delete(e) : n.assignedMap.set(e, !0), n.copy[e] = t, Vn(n, e, t, _t)), !0);
|
|
712
712
|
},
|
|
713
713
|
has(n, e) {
|
|
714
|
-
return e in
|
|
714
|
+
return e in de(n);
|
|
715
715
|
},
|
|
716
716
|
ownKeys(n) {
|
|
717
|
-
return Reflect.ownKeys(
|
|
717
|
+
return Reflect.ownKeys(de(n));
|
|
718
718
|
},
|
|
719
719
|
getOwnPropertyDescriptor(n, e) {
|
|
720
|
-
const t =
|
|
720
|
+
const t = de(n), r = Reflect.getOwnPropertyDescriptor(t, e);
|
|
721
721
|
return r && {
|
|
722
722
|
writable: !0,
|
|
723
723
|
configurable: n.type !== 1 || e !== "length",
|
|
@@ -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 = Ce(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, he)) === he.mutable || !Te(n, e) ? n : Bn({
|
|
804
804
|
original: n,
|
|
805
805
|
parentDraft: null,
|
|
806
806
|
finalities: r,
|
|
@@ -832,7 +832,7 @@ function _n(n) {
|
|
|
832
832
|
function fs(n) {
|
|
833
833
|
var e;
|
|
834
834
|
const t = R(n);
|
|
835
|
-
if (!
|
|
835
|
+
if (!Te(n, t == null ? void 0 : t.options))
|
|
836
836
|
return n;
|
|
837
837
|
const r = We(n);
|
|
838
838
|
if (t && !t.operated)
|
|
@@ -851,7 +851,7 @@ function fs(n) {
|
|
|
851
851
|
} else
|
|
852
852
|
s = n;
|
|
853
853
|
if (zn(s, (o, a) => {
|
|
854
|
-
if (t && Ce(
|
|
854
|
+
if (t && ke(Ce(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 (!Te(f, m) && typeof f == "object" && f !== null)
|
|
895
895
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
896
896
|
const [S, g] = ji(f, m);
|
|
897
897
|
if (typeof r != "function") {
|
|
898
|
-
if (!
|
|
898
|
+
if (!Te(f, m))
|
|
899
899
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
900
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 && !ke(v, S) && (C != null && C.operated))
|
|
912
912
|
throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");
|
|
913
913
|
const U = v == null ? void 0 : v[Si];
|
|
914
914
|
if (U) {
|
|
@@ -1367,7 +1367,7 @@ class Le {
|
|
|
1367
1367
|
for (const e of Object.values(this.attrs))
|
|
1368
1368
|
if (Hn(e)) {
|
|
1369
1369
|
const [t, r, s] = e["forward-identity"];
|
|
1370
|
-
|
|
1370
|
+
ue(this.blobAttrs, [r, s], e);
|
|
1371
1371
|
}
|
|
1372
1372
|
return this._blobAttrs;
|
|
1373
1373
|
}
|
|
@@ -1378,7 +1378,7 @@ class Le {
|
|
|
1378
1378
|
for (const e of Object.values(this.attrs))
|
|
1379
1379
|
if (e["primary?"]) {
|
|
1380
1380
|
const [t, r] = e["forward-identity"];
|
|
1381
|
-
|
|
1381
|
+
ue(this._primaryKeys, [r], e);
|
|
1382
1382
|
}
|
|
1383
1383
|
return this._primaryKeys;
|
|
1384
1384
|
}
|
|
@@ -1388,7 +1388,7 @@ class Le {
|
|
|
1388
1388
|
this._forwardIdents = /* @__PURE__ */ new Map();
|
|
1389
1389
|
for (const e of Object.values(this.attrs)) {
|
|
1390
1390
|
const t = e["forward-identity"], [r, s, i] = t;
|
|
1391
|
-
|
|
1391
|
+
ue(this._forwardIdents, [s, i], e);
|
|
1392
1392
|
}
|
|
1393
1393
|
return this._forwardIdents;
|
|
1394
1394
|
}
|
|
@@ -1400,7 +1400,7 @@ class Le {
|
|
|
1400
1400
|
const t = e["reverse-identity"];
|
|
1401
1401
|
if (t) {
|
|
1402
1402
|
const [r, s, i] = t;
|
|
1403
|
-
|
|
1403
|
+
ue(this._revIdents, [s, i], e);
|
|
1404
1404
|
}
|
|
1405
1405
|
}
|
|
1406
1406
|
return this._revIdents;
|
|
@@ -1421,7 +1421,7 @@ function Hn(n) {
|
|
|
1421
1421
|
function tt(n, e) {
|
|
1422
1422
|
return e.reduce((t, r) => t && t.get(r), n);
|
|
1423
1423
|
}
|
|
1424
|
-
function
|
|
1424
|
+
function we(n, e) {
|
|
1425
1425
|
if (e.length === 0)
|
|
1426
1426
|
throw new Error("path must have at least one element");
|
|
1427
1427
|
if (e.length === 1) {
|
|
@@ -1429,9 +1429,9 @@ function Te(n, e) {
|
|
|
1429
1429
|
return;
|
|
1430
1430
|
}
|
|
1431
1431
|
const [t, ...r] = e;
|
|
1432
|
-
n.has(t) &&
|
|
1432
|
+
n.has(t) && we(n.get(t), r);
|
|
1433
1433
|
}
|
|
1434
|
-
function
|
|
1434
|
+
function ue(n, e, t) {
|
|
1435
1435
|
let r = n;
|
|
1436
1436
|
const s = e.length - 1;
|
|
1437
1437
|
for (let i = 0; i < s; i++) {
|
|
@@ -1450,13 +1450,13 @@ function ys(n, e, t) {
|
|
|
1450
1450
|
console.warn("no such attr", c, a);
|
|
1451
1451
|
continue;
|
|
1452
1452
|
}
|
|
1453
|
-
l["checked-data-type"] === "date" && t && (u = zt(u), o[2] = u), Qn(l) &&
|
|
1453
|
+
l["checked-data-type"] === "date" && t && (u = zt(u), o[2] = u), Qn(l) && ue(i, [u, c, a], o), ue(r, [a, c, u], o), ue(s, [c, a, u], o);
|
|
1454
1454
|
}
|
|
1455
1455
|
return { eav: r, aev: s, vae: i };
|
|
1456
1456
|
}
|
|
1457
1457
|
function bs(n) {
|
|
1458
1458
|
return {
|
|
1459
|
-
triples:
|
|
1459
|
+
triples: le(n.eav, 3),
|
|
1460
1460
|
cardinalityInference: n.cardinalityInference,
|
|
1461
1461
|
useDateObjects: n.useDateObjects,
|
|
1462
1462
|
version: 1
|
|
@@ -1485,7 +1485,7 @@ function wt(n, e) {
|
|
|
1485
1485
|
const [o, a] = e[0], c = n.aev.get(o);
|
|
1486
1486
|
if (!c)
|
|
1487
1487
|
return null;
|
|
1488
|
-
t = (s =
|
|
1488
|
+
t = (s = le(c, 2).find((l) => l[2] === a)) == null ? void 0 : s[0];
|
|
1489
1489
|
} else
|
|
1490
1490
|
t = e[0];
|
|
1491
1491
|
if (!t)
|
|
@@ -1495,7 +1495,7 @@ function wt(n, e) {
|
|
|
1495
1495
|
const [o, a] = r, c = n.aev.get(o);
|
|
1496
1496
|
if (!c)
|
|
1497
1497
|
return null;
|
|
1498
|
-
const l = (i =
|
|
1498
|
+
const l = (i = le(c, 2).find((_) => _[2] === a)) == null ? void 0 : i[0];
|
|
1499
1499
|
if (!l)
|
|
1500
1500
|
return null;
|
|
1501
1501
|
const [f, p, y, ...b] = e;
|
|
@@ -1510,7 +1510,7 @@ function ms(n, e, t) {
|
|
|
1510
1510
|
if (!r)
|
|
1511
1511
|
return;
|
|
1512
1512
|
const [s, i, o] = r, a = e.getAttr(i);
|
|
1513
|
-
a && (
|
|
1513
|
+
a && (we(n.eav, [s, i, o]), we(n.aev, [i, s, o]), Qn(a) && we(n.vae, [o, i, s]));
|
|
1514
1514
|
}
|
|
1515
1515
|
let no = 0;
|
|
1516
1516
|
function ws(n, e, t) {
|
|
@@ -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) ? (ue(n.eav, [s, i], /* @__PURE__ */ new Map([[o, l]])), ue(n.aev, [i, s], /* @__PURE__ */ new Map([[o, l]]))) : (ue(n.eav, [s, i, o], l), ue(n.aev, [i, s, o], l)), Qn(a) && ue(n.vae, [o, i, s], l);
|
|
1533
1533
|
}
|
|
1534
1534
|
function ro(n, e, t) {
|
|
1535
1535
|
var y;
|
|
@@ -1553,7 +1553,7 @@ function ro(n, e, t) {
|
|
|
1553
1553
|
f,
|
|
1554
1554
|
ws(n, a, u)
|
|
1555
1555
|
];
|
|
1556
|
-
|
|
1556
|
+
ue(n.eav, [s, i], /* @__PURE__ */ new Map([[f, p]])), ue(n.aev, [i, s], /* @__PURE__ */ new Map([[f, p]]));
|
|
1557
1557
|
}
|
|
1558
1558
|
function wn(n, e, t) {
|
|
1559
1559
|
var u, l;
|
|
@@ -1564,23 +1564,23 @@ function wn(n, e, t) {
|
|
|
1564
1564
|
if (a) {
|
|
1565
1565
|
for (const f of a.keys()) {
|
|
1566
1566
|
const p = e.getAttr(f);
|
|
1567
|
-
p && p["on-delete-reverse"] === "cascade" &&
|
|
1567
|
+
p && p["on-delete-reverse"] === "cascade" && le(a.get(f), 1).forEach(([y, b, _]) => {
|
|
1568
1568
|
var m;
|
|
1569
1569
|
return wn(n, e, [_, (m = p["reverse-identity"]) == null ? void 0 : m[1]]);
|
|
1570
1570
|
}), // Fall back to deleting everything if we've rehydrated tx-steps from
|
|
1571
1571
|
// the store that didn't set `etype` in deleteEntity
|
|
1572
1572
|
(!s || // If we don't know about the attr, let's just get rid of it
|
|
1573
1573
|
!p || // Make sure it matches the etype
|
|
1574
|
-
((u = p["forward-identity"]) == null ? void 0 : u[1]) === s) && (
|
|
1574
|
+
((u = p["forward-identity"]) == null ? void 0 : u[1]) === s) && (we(n.aev, [f, o]), we(n.eav, [o, f]));
|
|
1575
1575
|
}
|
|
1576
|
-
a.size === 0 &&
|
|
1576
|
+
a.size === 0 && we(n.eav, [o]);
|
|
1577
1577
|
}
|
|
1578
|
-
const c = n.vae.get(o) &&
|
|
1578
|
+
const c = n.vae.get(o) && le(n.vae.get(o), 2);
|
|
1579
1579
|
c && c.forEach((f) => {
|
|
1580
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) && (we(n.eav, [p, y, b]), we(n.aev, [y, p, b]), we(n.vae, [b, y, p])), _ && _["on-delete"] === "cascade" && ((S = _["reverse-identity"]) == null ? void 0 : S[1]) === s && wn(n, e, [p, (g = _["forward-identity"]) == null ? void 0 : g[1]]);
|
|
1583
|
+
}), ((l = n.vae.get(o)) == null ? void 0 : l.size) === 0 && we(n.vae, [o]);
|
|
1584
1584
|
}
|
|
1585
1585
|
function Ss(n, e, t) {
|
|
1586
1586
|
const r = ys(e, t, n.useDateObjects);
|
|
@@ -1592,7 +1592,7 @@ function so(n, [e]) {
|
|
|
1592
1592
|
n.addAttr(e);
|
|
1593
1593
|
}
|
|
1594
1594
|
function vs(n) {
|
|
1595
|
-
return
|
|
1595
|
+
return le(n.eav, 3);
|
|
1596
1596
|
}
|
|
1597
1597
|
function io(n, e, [t]) {
|
|
1598
1598
|
if (!e.getAttr(t))
|
|
@@ -1635,7 +1635,7 @@ function ao(n, e, t) {
|
|
|
1635
1635
|
throw new Error(`unhandled transaction action: ${r}`);
|
|
1636
1636
|
}
|
|
1637
1637
|
}
|
|
1638
|
-
function
|
|
1638
|
+
function le(n, e, t = []) {
|
|
1639
1639
|
if (!n || e === 0)
|
|
1640
1640
|
return t;
|
|
1641
1641
|
if (e === 1) {
|
|
@@ -1644,7 +1644,7 @@ function fe(n, e, t = []) {
|
|
|
1644
1644
|
return t;
|
|
1645
1645
|
}
|
|
1646
1646
|
for (const r of n.values())
|
|
1647
|
-
|
|
1647
|
+
le(r, e - 1, t);
|
|
1648
1648
|
return t;
|
|
1649
1649
|
}
|
|
1650
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 le(e, 1).filter(t.$op);
|
|
1676
1676
|
const s = t.in || t.$in || [t];
|
|
1677
1677
|
for (const o of s) {
|
|
1678
1678
|
const a = e.get(o);
|
|
@@ -1689,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 le(a, 2);
|
|
1693
1693
|
}
|
|
1694
1694
|
case "ea": {
|
|
1695
1695
|
const a = (i = n.eav.get(e)) == null ? void 0 : i.get(t);
|
|
1696
|
-
return
|
|
1696
|
+
return le(a, 1);
|
|
1697
1697
|
}
|
|
1698
1698
|
case "eav": {
|
|
1699
1699
|
const a = (o = n.eav.get(e)) == null ? void 0 : o.get(t);
|
|
@@ -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 le(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 le(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 = le(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 Y = [];
|
|
1868
1868
|
for (let n = 0; n < 256; ++n)
|
|
1869
|
-
|
|
1869
|
+
Y.push((n + 256).toString(16).slice(1));
|
|
1870
1870
|
function Ao(n, e = 0) {
|
|
1871
|
-
return (
|
|
1871
|
+
return (Y[n[e + 0]] + Y[n[e + 1]] + Y[n[e + 2]] + Y[n[e + 3]] + "-" + Y[n[e + 4]] + Y[n[e + 5]] + "-" + Y[n[e + 6]] + Y[n[e + 7]] + "-" + Y[n[e + 8]] + Y[n[e + 9]] + "-" + Y[n[e + 10]] + Y[n[e + 11]] + Y[n[e + 12]] + Y[n[e + 13]] + Y[n[e + 14]] + Y[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 W() {
|
|
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 fe(n, e, t) {
|
|
2443
2443
|
const r = An(t);
|
|
2444
2444
|
if (r === null)
|
|
2445
2445
|
return t;
|
|
@@ -2450,7 +2450,7 @@ function de(n, e, t) {
|
|
|
2450
2450
|
}
|
|
2451
2451
|
function Rs(n, e, t, r) {
|
|
2452
2452
|
var o;
|
|
2453
|
-
const s =
|
|
2453
|
+
const s = fe(n, e, t);
|
|
2454
2454
|
return Array.isArray(s) ? [[
|
|
2455
2455
|
"add-triple",
|
|
2456
2456
|
s,
|
|
@@ -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
|
+
fe(n, e, t),
|
|
2467
2467
|
c.id,
|
|
2468
2468
|
// Uses `!` because if we get here, we should have created the attr if it doesn't
|
|
2469
2469
|
// already exist
|
|
2470
|
-
|
|
2470
|
+
fe(n, c["reverse-identity"][1], l)
|
|
2471
2471
|
] : [
|
|
2472
2472
|
"add-triple",
|
|
2473
2473
|
// Uses `!` because if we get here, we should have created the attr if it doesn't
|
|
2474
2474
|
// already exist
|
|
2475
|
-
|
|
2475
|
+
fe(n, u["forward-identity"][1], l),
|
|
2476
2476
|
u == null ? void 0 : u.id,
|
|
2477
|
-
|
|
2477
|
+
fe(n, e, t)
|
|
2478
2478
|
]);
|
|
2479
2479
|
});
|
|
2480
2480
|
return Rs(n, e, t, s);
|
|
@@ -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
|
+
fe(n, e, t),
|
|
2488
2488
|
c.id,
|
|
2489
2489
|
// Uses `!` because if we get here, we should have created the attr if it doesn't
|
|
2490
2490
|
// already exist
|
|
2491
|
-
|
|
2491
|
+
fe(n, c["reverse-identity"][1], l)
|
|
2492
2492
|
] : [
|
|
2493
2493
|
"retract-triple",
|
|
2494
2494
|
// Uses `!` because if we get here, we should have created the attr if it doesn't
|
|
2495
2495
|
// already exist
|
|
2496
|
-
|
|
2496
|
+
fe(n, u["forward-identity"][1], l),
|
|
2497
2497
|
u.id,
|
|
2498
|
-
|
|
2498
|
+
fe(n, e, t)
|
|
2499
2499
|
]);
|
|
2500
2500
|
});
|
|
2501
2501
|
return Rs(n, e, t, s);
|
|
@@ -2507,7 +2507,7 @@ function wa(n, e, t, r) {
|
|
|
2507
2507
|
for (const a of n || []) {
|
|
2508
2508
|
const c = a == null ? void 0 : a.aev.get(i);
|
|
2509
2509
|
if (c) {
|
|
2510
|
-
for (const [u, l, f] of
|
|
2510
|
+
for (const [u, l, f] of le(c, 2))
|
|
2511
2511
|
if (f === o)
|
|
2512
2512
|
return !0;
|
|
2513
2513
|
}
|
|
@@ -2527,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 = fe(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 = fe(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", fe(n, e, t), e]];
|
|
2551
2551
|
}
|
|
2552
2552
|
function Ea(n, e) {
|
|
2553
|
-
const { attrsStore: t } = n, [r, s, i, o] = e, a = Gn(i), c =
|
|
2553
|
+
const { attrsStore: t } = n, [r, s, i, o] = e, a = Gn(i), c = fe(t, r, s), u = js(n, [r, c, i, o]), l = Object.entries(a).map(([p, y]) => {
|
|
2554
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", fe(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 = W(), a = [W(), 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": [W(), s.on, s.label],
|
|
2651
|
+
"reverse-identity": [W(), 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 = W(), o = [W(), e, t], a = [W(), 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 Se(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 Se(`${n}/runtime/auth/send_magic_code`, {
|
|
3281
3281
|
method: "POST",
|
|
3282
3282
|
headers: { "content-type": "application/json" },
|
|
3283
3283
|
body: JSON.stringify({ "app-id": e, email: t })
|
|
3284
3284
|
});
|
|
3285
3285
|
}
|
|
3286
3286
|
async function Qa({ apiURI: n, appId: e, email: t, code: r, refreshToken: s }) {
|
|
3287
|
-
return await
|
|
3287
|
+
return await Se(`${n}/runtime/auth/verify_magic_code`, {
|
|
3288
3288
|
method: "POST",
|
|
3289
3289
|
headers: { "content-type": "application/json" },
|
|
3290
3290
|
body: JSON.stringify({
|
|
@@ -3296,7 +3296,7 @@ async function Qa({ apiURI: n, appId: e, email: t, code: r, refreshToken: s }) {
|
|
|
3296
3296
|
});
|
|
3297
3297
|
}
|
|
3298
3298
|
async function Ha({ apiURI: n, appId: e, refreshToken: t }) {
|
|
3299
|
-
return await
|
|
3299
|
+
return await Se(`${n}/runtime/auth/verify_refresh_token`, {
|
|
3300
3300
|
method: "POST",
|
|
3301
3301
|
headers: { "content-type": "application/json" },
|
|
3302
3302
|
body: JSON.stringify({
|
|
@@ -3306,7 +3306,7 @@ async function Ha({ apiURI: n, appId: e, refreshToken: t }) {
|
|
|
3306
3306
|
});
|
|
3307
3307
|
}
|
|
3308
3308
|
async function Ja({ apiURI: n, appId: e }) {
|
|
3309
|
-
return await
|
|
3309
|
+
return await Se(`${n}/runtime/auth/sign_in_guest`, {
|
|
3310
3310
|
method: "POST",
|
|
3311
3311
|
headers: { "content-type": "application/json" },
|
|
3312
3312
|
body: JSON.stringify({
|
|
@@ -3315,7 +3315,7 @@ async function Ja({ apiURI: n, appId: e }) {
|
|
|
3315
3315
|
});
|
|
3316
3316
|
}
|
|
3317
3317
|
async function xr({ apiURI: n, appId: e, code: t, codeVerifier: r, refreshToken: s }) {
|
|
3318
|
-
return await
|
|
3318
|
+
return await Se(`${n}/runtime/oauth/token`, {
|
|
3319
3319
|
method: "POST",
|
|
3320
3320
|
headers: { "content-type": "application/json" },
|
|
3321
3321
|
body: JSON.stringify({
|
|
@@ -3327,7 +3327,7 @@ async function xr({ apiURI: n, appId: e, code: t, codeVerifier: r, refreshToken:
|
|
|
3327
3327
|
});
|
|
3328
3328
|
}
|
|
3329
3329
|
async function Ya({ apiURI: n, appId: e, nonce: t, idToken: r, clientName: s, refreshToken: i }) {
|
|
3330
|
-
return await
|
|
3330
|
+
return await Se(`${n}/runtime/oauth/id_token`, {
|
|
3331
3331
|
method: "POST",
|
|
3332
3332
|
headers: { "content-type": "application/json" },
|
|
3333
3333
|
body: JSON.stringify({
|
|
@@ -3340,7 +3340,7 @@ async function Ya({ apiURI: n, appId: e, nonce: t, idToken: r, clientName: s, re
|
|
|
3340
3340
|
});
|
|
3341
3341
|
}
|
|
3342
3342
|
async function Za({ apiURI: n, appId: e, refreshToken: t }) {
|
|
3343
|
-
return await
|
|
3343
|
+
return await Se(`${n}/runtime/signout`, {
|
|
3344
3344
|
method: "POST",
|
|
3345
3345
|
headers: {
|
|
3346
3346
|
"content-type": "application/json"
|
|
@@ -3358,14 +3358,14 @@ async function Xa({ apiURI: n, appId: e, path: t, file: r, refreshToken: s, cont
|
|
|
3358
3358
|
authorization: `Bearer ${s}`,
|
|
3359
3359
|
"content-type": i || r.type
|
|
3360
3360
|
};
|
|
3361
|
-
return o && (a["content-disposition"] = o), await
|
|
3361
|
+
return o && (a["content-disposition"] = o), await Se(`${n}/storage/upload`, {
|
|
3362
3362
|
method: "PUT",
|
|
3363
3363
|
headers: a,
|
|
3364
3364
|
body: r
|
|
3365
3365
|
});
|
|
3366
3366
|
}
|
|
3367
3367
|
async function ec({ apiURI: n, appId: e, path: t, refreshToken: r }) {
|
|
3368
|
-
const { data: s } = await
|
|
3368
|
+
const { data: s } = await Se(`${n}/storage/files?app_id=${e}&filename=${encodeURIComponent(t)}`, {
|
|
3369
3369
|
method: "DELETE",
|
|
3370
3370
|
headers: {
|
|
3371
3371
|
"content-type": "application/json",
|
|
@@ -3375,7 +3375,7 @@ async function ec({ apiURI: n, appId: e, path: t, refreshToken: r }) {
|
|
|
3375
3375
|
return s;
|
|
3376
3376
|
}
|
|
3377
3377
|
async function tc({ apiURI: n, appId: e, fileName: t, refreshToken: r, metadata: s = {} }) {
|
|
3378
|
-
const { data: i } = await
|
|
3378
|
+
const { data: i } = await Se(`${n}/storage/signed-upload-url`, {
|
|
3379
3379
|
method: "POST",
|
|
3380
3380
|
headers: {
|
|
3381
3381
|
"content-type": "application/json",
|
|
@@ -3398,7 +3398,7 @@ async function nc(n, e) {
|
|
|
3398
3398
|
})).ok;
|
|
3399
3399
|
}
|
|
3400
3400
|
async function rc({ apiURI: n, appId: e, path: t, refreshToken: r }) {
|
|
3401
|
-
const { data: s } = await
|
|
3401
|
+
const { data: s } = await Se(`${n}/storage/signed-download-url?app_id=${e}&filename=${encodeURIComponent(t)}`, {
|
|
3402
3402
|
method: "GET",
|
|
3403
3403
|
headers: {
|
|
3404
3404
|
"content-type": "application/json",
|
|
@@ -3485,7 +3485,7 @@ function Lr(n) {
|
|
|
3485
3485
|
}, e;
|
|
3486
3486
|
}, {});
|
|
3487
3487
|
}
|
|
3488
|
-
const Xn = "v0.22.154
|
|
3488
|
+
const Xn = "v0.22.154";
|
|
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 F 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 F(`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 F(`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 F(`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 F(`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 F(`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 F(`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 F(`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 F(`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 F(`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 F(`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 F(`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 F(`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 F(`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 F(`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 F(`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 F(`'${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 F(`'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 F(`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 F(`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 F(`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 F(`Query must be an object, but received: ${typeof n}${n === null ? " (null)" : ""}`);
|
|
3760
3760
|
if (Array.isArray(n))
|
|
3761
|
-
throw new
|
|
3761
|
+
throw new F(`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 F(`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 F(`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 F(`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 be extends Error {
|
|
3778
3778
|
constructor(e) {
|
|
3779
3779
|
super(e), this.name = "TransactionValidationError";
|
|
3780
3780
|
}
|
|
3781
3781
|
}
|
|
3782
|
-
const Ks = (n) => n.length > 0 ? n.join(", ") : "none", fc = (n, e) => new
|
|
3782
|
+
const Ks = (n) => n.length > 0 ? n.join(", ") : "none", fc = (n, e) => new be(`Entity '${n}' does not exist in schema. Available entities: ${Ks(e)}`), on = {
|
|
3783
3783
|
string: (n) => typeof n == "string",
|
|
3784
3784
|
number: (n) => typeof n == "number" && !isNaN(n),
|
|
3785
3785
|
boolean: (n) => typeof n == "boolean",
|
|
@@ -3796,30 +3796,30 @@ const Ks = (n) => n.length > 0 ? n.join(", ") : "none", fc = (n, e) => new ge(`E
|
|
|
3796
3796
|
}, an = (n, e, t) => {
|
|
3797
3797
|
const r = qs(n, t);
|
|
3798
3798
|
if (typeof e != "object" || e === null)
|
|
3799
|
-
throw new
|
|
3799
|
+
throw new be(`Arguments for data operation on entity '${n}' must be an object, but received: ${typeof e}`);
|
|
3800
3800
|
for (const [s, i] of Object.entries(e)) {
|
|
3801
3801
|
if (s === "id")
|
|
3802
3802
|
continue;
|
|
3803
3803
|
const o = r.attrs[s];
|
|
3804
3804
|
if (o && !dc(i, o))
|
|
3805
|
-
throw new
|
|
3805
|
+
throw new be(`Invalid value for attribute '${s}' in entity '${n}'. Expected ${o.valueType}, but received: ${typeof i}`);
|
|
3806
3806
|
}
|
|
3807
3807
|
}, Kr = (n, e, t) => {
|
|
3808
3808
|
const r = qs(n, t);
|
|
3809
3809
|
if (typeof e != "object" || e === null)
|
|
3810
|
-
throw new
|
|
3810
|
+
throw new be(`Arguments for link operation on entity '${n}' must be an object, but received: ${typeof e}`);
|
|
3811
3811
|
for (const [s, i] of Object.entries(e)) {
|
|
3812
3812
|
if (!r.links[s]) {
|
|
3813
3813
|
const a = Object.keys(r.links);
|
|
3814
|
-
throw new
|
|
3814
|
+
throw new be(`Link '${s}' does not exist on entity '${n}'. Available links: ${Ks(a)}`);
|
|
3815
3815
|
}
|
|
3816
3816
|
if (i != null) {
|
|
3817
3817
|
if (Array.isArray(i)) {
|
|
3818
3818
|
for (const a of i)
|
|
3819
3819
|
if (!Wr(a))
|
|
3820
|
-
throw new
|
|
3820
|
+
throw new be(`Invalid entity ID in link '${s}' for entity '${n}'. Expected a UUID or a lookup, but received: ${a}`);
|
|
3821
3821
|
} else if (!Wr(i))
|
|
3822
|
-
throw new
|
|
3822
|
+
throw new be(`Invalid UUID in link '${s}' for entity '${n}'. Expected a UUID, but received: ${i}`);
|
|
3823
3823
|
}
|
|
3824
3824
|
}
|
|
3825
3825
|
}, hc = {
|
|
@@ -3835,21 +3835,21 @@ const Ks = (n) => n.length > 0 ? n.join(", ") : "none", fc = (n, e) => new ge(`E
|
|
|
3835
3835
|
return;
|
|
3836
3836
|
const [t, r, s, i] = n;
|
|
3837
3837
|
if (!Array.isArray(s) && !Xe(s))
|
|
3838
|
-
throw new
|
|
3838
|
+
throw new be(`Invalid id for entity '${r}'. Expected a UUID, but received: ${s}`);
|
|
3839
3839
|
if (typeof r != "string")
|
|
3840
|
-
throw new
|
|
3840
|
+
throw new be(`Entity name must be a string, but received: ${typeof r}`);
|
|
3841
3841
|
const o = hc[t];
|
|
3842
3842
|
o && i !== void 0 && o(r, i, e);
|
|
3843
3843
|
}, yc = (n, e) => {
|
|
3844
3844
|
const t = Array.isArray(n) ? n : [n];
|
|
3845
3845
|
for (const r of t) {
|
|
3846
3846
|
if (!r || typeof r != "object")
|
|
3847
|
-
throw new
|
|
3847
|
+
throw new be(`Transaction chunk must be an object, but received: ${typeof r}`);
|
|
3848
3848
|
if (!Array.isArray(r.__ops))
|
|
3849
|
-
throw new
|
|
3849
|
+
throw new be(`Transaction chunk must have __ops array, but received: ${typeof r.__ops}`);
|
|
3850
3850
|
for (const s of r.__ops) {
|
|
3851
3851
|
if (!Array.isArray(s))
|
|
3852
|
-
throw new
|
|
3852
|
+
throw new be(`Transaction operation must be an array, but received: ${typeof s}`);
|
|
3853
3853
|
pc(s, e);
|
|
3854
3854
|
}
|
|
3855
3855
|
}
|
|
@@ -4132,7 +4132,7 @@ class vc {
|
|
|
4132
4132
|
this.subs.flush();
|
|
4133
4133
|
}
|
|
4134
4134
|
subscribe(e, t) {
|
|
4135
|
-
const r =
|
|
4135
|
+
const r = H(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(W(), {
|
|
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(W(), {
|
|
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 = H(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 = H(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 = W();
|
|
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 pe() {
|
|
4432
4432
|
_ = !0;
|
|
4433
4433
|
}
|
|
4434
|
-
function
|
|
4435
|
-
let I = m,
|
|
4436
|
-
for (const { byteLen:
|
|
4437
|
-
const
|
|
4438
|
-
if (
|
|
4434
|
+
function Me(A) {
|
|
4435
|
+
let I = m, Q = 0, J = 0;
|
|
4436
|
+
for (const { byteLen: oe } of g) {
|
|
4437
|
+
const ge = I + oe;
|
|
4438
|
+
if (ge > A)
|
|
4439
4439
|
break;
|
|
4440
|
-
I =
|
|
4440
|
+
I = ge, Q++, J += oe;
|
|
4441
4441
|
}
|
|
4442
|
-
|
|
4442
|
+
Q > 0 && (m += J, S -= J, g.splice(0, Q));
|
|
4443
4443
|
}
|
|
4444
|
-
function
|
|
4444
|
+
function ee(A, I) {
|
|
4445
4445
|
a = I, O(), A.error(I), j();
|
|
4446
4446
|
}
|
|
4447
|
-
async function
|
|
4447
|
+
async function te() {
|
|
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: Q } = A;
|
|
4456
|
+
o = I, Me(Q), g.length && r({
|
|
4457
4457
|
streamId: I,
|
|
4458
|
-
chunks: g.map((
|
|
4458
|
+
chunks: g.map((J) => J.chunk),
|
|
4459
4459
|
offset: m
|
|
4460
4460
|
}), _ = !1;
|
|
4461
4461
|
break;
|
|
4462
4462
|
}
|
|
4463
4463
|
case "disconnect": {
|
|
4464
|
-
|
|
4464
|
+
pe();
|
|
4465
4465
|
break;
|
|
4466
4466
|
}
|
|
4467
4467
|
case "error": {
|
|
4468
|
-
c &&
|
|
4468
|
+
c && ee(c, A.error);
|
|
4469
4469
|
break;
|
|
4470
4470
|
}
|
|
4471
4471
|
}
|
|
4472
4472
|
}
|
|
4473
|
-
function
|
|
4474
|
-
|
|
4473
|
+
function L() {
|
|
4474
|
+
pe(), te();
|
|
4475
4475
|
}
|
|
4476
|
-
function
|
|
4477
|
-
|
|
4476
|
+
function X({ offset: A, done: I }) {
|
|
4477
|
+
Me(A), I && (l = !0, j());
|
|
4478
4478
|
}
|
|
4479
|
-
function
|
|
4480
|
-
return l ? (
|
|
4479
|
+
function ve(A) {
|
|
4480
|
+
return l ? (ee(A, new se("Stream has been closed.")), null) : o || (ee(A, new se("Stream has not been initialized.")), null);
|
|
4481
4481
|
}
|
|
4482
|
-
async function
|
|
4482
|
+
async function Re(A) {
|
|
4483
4483
|
c = A;
|
|
4484
|
-
let I = !0,
|
|
4484
|
+
let I = !0, Q = 0;
|
|
4485
4485
|
for (; I; ) {
|
|
4486
|
-
let
|
|
4486
|
+
let J = Date.now() + Math.min(15e3, 500 * (Q - 1));
|
|
4487
4487
|
I = !1;
|
|
4488
|
-
const
|
|
4488
|
+
const oe = await t({
|
|
4489
4489
|
clientId: e.clientId,
|
|
4490
4490
|
reconnectToken: u,
|
|
4491
4491
|
ruleParams: e.ruleParams
|
|
4492
4492
|
});
|
|
4493
|
-
switch (
|
|
4493
|
+
switch (oe.type) {
|
|
4494
4494
|
case "ok": {
|
|
4495
|
-
const { streamId:
|
|
4495
|
+
const { streamId: ge, offset: nt } = oe;
|
|
4496
4496
|
if (nt !== 0) {
|
|
4497
|
-
const
|
|
4498
|
-
|
|
4497
|
+
const _e = new se("Write stream is corrupted");
|
|
4498
|
+
ee(A, _e);
|
|
4499
4499
|
return;
|
|
4500
4500
|
}
|
|
4501
|
-
B(
|
|
4502
|
-
onDisconnect:
|
|
4503
|
-
onFlush:
|
|
4504
|
-
onConnectionReconnect:
|
|
4505
|
-
onAppendFailed:
|
|
4501
|
+
B(ge), s(ge, {
|
|
4502
|
+
onDisconnect: pe,
|
|
4503
|
+
onFlush: X,
|
|
4504
|
+
onConnectionReconnect: te,
|
|
4505
|
+
onAppendFailed: L
|
|
4506
4506
|
}), _ = !1;
|
|
4507
4507
|
return;
|
|
4508
4508
|
}
|
|
4509
4509
|
case "disconnect": {
|
|
4510
|
-
I = !0,
|
|
4511
|
-
setTimeout(
|
|
4510
|
+
I = !0, pe(), Q++, await new Promise((ge) => {
|
|
4511
|
+
setTimeout(ge, Math.max(0, J - Date.now()));
|
|
4512
4512
|
});
|
|
4513
4513
|
break;
|
|
4514
4514
|
}
|
|
4515
4515
|
case "error": {
|
|
4516
|
-
|
|
4516
|
+
ee(A, oe.error);
|
|
4517
4517
|
return;
|
|
4518
4518
|
}
|
|
4519
4519
|
}
|
|
4520
4520
|
}
|
|
4521
4521
|
}
|
|
4522
4522
|
class Tt extends n {
|
|
4523
|
-
constructor(I,
|
|
4524
|
-
super(I,
|
|
4523
|
+
constructor(I, Q) {
|
|
4524
|
+
super(I, Q);
|
|
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, Q) => {
|
|
4528
|
+
const J = [], oe = () => {
|
|
4529
|
+
for (const _e of J)
|
|
4530
|
+
_e();
|
|
4531
|
+
}, ge = (_e) => {
|
|
4532
|
+
I(_e), oe();
|
|
4533
|
+
}, nt = (_e) => {
|
|
4534
|
+
Q(_e || new se("Stream is closed.")), oe();
|
|
4535
4535
|
};
|
|
4536
|
-
|
|
4536
|
+
J.push(U(ge)), J.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 Re(A);
|
|
4547
4547
|
} catch (I) {
|
|
4548
|
-
|
|
4548
|
+
ee(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 Q = ve(I);
|
|
4553
|
+
if (Q) {
|
|
4554
|
+
const J = w.encode(A).length;
|
|
4555
|
+
g.push({ chunk: A, byteLen: J });
|
|
4556
|
+
const oe = m + S;
|
|
4557
|
+
S += J, _ || r({ streamId: Q, chunks: [A], offset: oe });
|
|
4558
4558
|
}
|
|
4559
4559
|
},
|
|
4560
4560
|
close() {
|
|
@@ -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 = W();
|
|
4640
4640
|
const O = { ...g || {}, eventId: c };
|
|
4641
4641
|
for await (const v of t(O)) {
|
|
4642
4642
|
if (i)
|
|
@@ -4658,47 +4658,39 @@ 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 pe = v.files[B + 1], ee = await U;
|
|
4662
|
+
if (pe && (U = fetch(pe.url, { signal: j.signal })), !ee.ok) {
|
|
4663
4663
|
if (b++, b > 10) {
|
|
4664
4664
|
y(w, new se("Unable to process stream."));
|
|
4665
4665
|
return;
|
|
4666
4666
|
}
|
|
4667
4667
|
return { retry: !0 };
|
|
4668
4668
|
}
|
|
4669
|
-
if (
|
|
4670
|
-
const
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
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);
|
|
4669
|
+
if (ee.body)
|
|
4670
|
+
for await (const te of ee.body) {
|
|
4671
|
+
if (i) {
|
|
4672
|
+
j.abort();
|
|
4673
|
+
return;
|
|
4686
4674
|
}
|
|
4687
|
-
|
|
4688
|
-
|
|
4675
|
+
let L = te;
|
|
4676
|
+
if (C > 0 && (L = te.subarray(C), C -= te.length - L.length), !L.length)
|
|
4677
|
+
continue;
|
|
4678
|
+
s += L.length;
|
|
4679
|
+
const X = o.decode(L);
|
|
4680
|
+
w.enqueue(X);
|
|
4689
4681
|
}
|
|
4690
|
-
|
|
4691
|
-
const
|
|
4692
|
-
let
|
|
4682
|
+
else {
|
|
4683
|
+
const te = await ee.arrayBuffer();
|
|
4684
|
+
let L = te;
|
|
4693
4685
|
if (i) {
|
|
4694
4686
|
j.abort();
|
|
4695
4687
|
return;
|
|
4696
4688
|
}
|
|
4697
|
-
if (C > 0 && (
|
|
4689
|
+
if (C > 0 && (L = new Uint8Array(te).subarray(C), C -= te.byteLength - L.length), !L.byteLength)
|
|
4698
4690
|
continue;
|
|
4699
|
-
s +=
|
|
4700
|
-
const
|
|
4701
|
-
w.enqueue(
|
|
4691
|
+
s += L.byteLength;
|
|
4692
|
+
const X = o.decode(L);
|
|
4693
|
+
w.enqueue(X);
|
|
4702
4694
|
}
|
|
4703
4695
|
}
|
|
4704
4696
|
}
|
|
@@ -4777,7 +4769,7 @@ class kc {
|
|
|
4777
4769
|
}), t;
|
|
4778
4770
|
}
|
|
4779
4771
|
startWriteStream(e) {
|
|
4780
|
-
const t =
|
|
4772
|
+
const t = W();
|
|
4781
4773
|
let r = null;
|
|
4782
4774
|
const s = new Promise((o) => {
|
|
4783
4775
|
r = o;
|
|
@@ -4801,7 +4793,7 @@ class kc {
|
|
|
4801
4793
|
offset: s,
|
|
4802
4794
|
done: !!r
|
|
4803
4795
|
};
|
|
4804
|
-
i && (o["abort-reason"] = i), this.trySend(
|
|
4796
|
+
i && (o["abort-reason"] = i), this.trySend(W(), o);
|
|
4805
4797
|
}
|
|
4806
4798
|
onAppendFailed(e) {
|
|
4807
4799
|
const t = this.writeStreams[e["stream-id"]];
|
|
@@ -4836,7 +4828,7 @@ class kc {
|
|
|
4836
4828
|
op: "unsubscribe-stream",
|
|
4837
4829
|
"subscribe-event-id": e
|
|
4838
4830
|
};
|
|
4839
|
-
this.trySend(
|
|
4831
|
+
this.trySend(W(), t), delete this.readStreamIterators[e];
|
|
4840
4832
|
}
|
|
4841
4833
|
onStreamAppend(e) {
|
|
4842
4834
|
var s;
|
|
@@ -5066,7 +5058,7 @@ class Nc {
|
|
|
5066
5058
|
// Queries
|
|
5067
5059
|
h(this, "getPreviousResult", (e) => {
|
|
5068
5060
|
var r;
|
|
5069
|
-
const t =
|
|
5061
|
+
const t = H(e);
|
|
5070
5062
|
return (r = this.dataForQuery(t)) == null ? void 0 : r.data;
|
|
5071
5063
|
});
|
|
5072
5064
|
/** Re-run instaql and call all callbacks with new data */
|
|
@@ -5109,7 +5101,7 @@ class Nc {
|
|
|
5109
5101
|
* @returns
|
|
5110
5102
|
*/
|
|
5111
5103
|
h(this, "pushOps", (e, t) => {
|
|
5112
|
-
const r =
|
|
5104
|
+
const r = W(), s = [...this._pendingMutations().values()], i = Math.max(0, ...s.map((c) => c.order || 0)) + 1, o = {
|
|
5113
5105
|
op: "transact",
|
|
5114
5106
|
"tx-steps": e,
|
|
5115
5107
|
created: Date.now(),
|
|
@@ -5130,7 +5122,7 @@ class Nc {
|
|
|
5130
5122
|
}
|
|
5131
5123
|
this._log.info("[socket][open]", this._transport.id), this._setStatus(Ee.OPENED), this.getCurrentUser().then((r) => {
|
|
5132
5124
|
var s;
|
|
5133
|
-
this._trySend(
|
|
5125
|
+
this._trySend(W(), {
|
|
5134
5126
|
op: "init",
|
|
5135
5127
|
"app-id": this.config.appId,
|
|
5136
5128
|
"refresh-token": (s = r.user) == null ? void 0 : s.refresh_token,
|
|
@@ -5337,7 +5329,7 @@ class Nc {
|
|
|
5337
5329
|
_addQueryData(e, t, r) {
|
|
5338
5330
|
if (!this.attrs)
|
|
5339
5331
|
throw new Error("Attrs in reactor have not been set");
|
|
5340
|
-
const s =
|
|
5332
|
+
const s = H(e), i = this.ensureAttrs(), o = ct(this.attrs, t.triples, r, this.config.useDateObjects);
|
|
5341
5333
|
this.querySubs.updateInPlace((a) => {
|
|
5342
5334
|
a[s] = {
|
|
5343
5335
|
result: {
|
|
@@ -5364,11 +5356,11 @@ class Nc {
|
|
|
5364
5356
|
break;
|
|
5365
5357
|
}
|
|
5366
5358
|
case "add-query-exists": {
|
|
5367
|
-
this.notifyOneQueryOnce(
|
|
5359
|
+
this.notifyOneQueryOnce(H(t.q));
|
|
5368
5360
|
break;
|
|
5369
5361
|
}
|
|
5370
5362
|
case "add-query-ok": {
|
|
5371
|
-
const { q: y, result: b } = t, _ =
|
|
5363
|
+
const { q: y, result: b } = t, _ = H(y);
|
|
5372
5364
|
if (!this._hasQueryListeners() && !this.querySubs.currentValue[_])
|
|
5373
5365
|
break;
|
|
5374
5366
|
const m = (c = (a = b == null ? void 0 : b[0]) == null ? void 0 : a.data) == null ? void 0 : c["page-info"], S = (l = (u = b == null ? void 0 : b[0]) == null ? void 0 : u.data) == null ? void 0 : l.aggregate, g = Ur(b), w = this.ensureAttrs(), O = ct(w, g, r, this.config.useDateObjects);
|
|
@@ -5427,15 +5419,15 @@ class Nc {
|
|
|
5427
5419
|
w.pendingMutations = m;
|
|
5428
5420
|
});
|
|
5429
5421
|
const S = ln(m.entries()), g = y.map((w) => {
|
|
5430
|
-
var
|
|
5431
|
-
const O = w["instaql-query"], v = w["instaql-result"], C =
|
|
5422
|
+
var L, X, ve, Re;
|
|
5423
|
+
const O = w["instaql-query"], v = w["instaql-result"], C = H(O), j = Ur(v), U = this.ensureAttrs(), B = ct(U, j, r, this.config.useDateObjects), { store: pe, attrsStore: Me } = this._applyOptimisticUpdates(B, U, S, _), ee = (X = (L = v == null ? void 0 : v[0]) == null ? void 0 : L.data) == null ? void 0 : X["page-info"], te = (Re = (ve = v == null ? void 0 : v[0]) == null ? void 0 : ve.data) == null ? void 0 : Re.aggregate;
|
|
5432
5424
|
return {
|
|
5433
5425
|
q: O,
|
|
5434
5426
|
hash: C,
|
|
5435
|
-
store:
|
|
5436
|
-
attrsStore:
|
|
5437
|
-
pageInfo:
|
|
5438
|
-
aggregate:
|
|
5427
|
+
store: pe,
|
|
5428
|
+
attrsStore: Me,
|
|
5429
|
+
pageInfo: ee,
|
|
5430
|
+
aggregate: te
|
|
5439
5431
|
};
|
|
5440
5432
|
});
|
|
5441
5433
|
g.forEach(({ hash: w, q: O, store: v, attrsStore: C, pageInfo: j, aggregate: U }) => {
|
|
@@ -5568,8 +5560,8 @@ class Nc {
|
|
|
5568
5560
|
return;
|
|
5569
5561
|
}
|
|
5570
5562
|
if ((a = e["original-event"]) != null && a.hasOwnProperty("q") && ((c = e["original-event"]) == null ? void 0 : c.op) === "add-query") {
|
|
5571
|
-
const y = (u = e["original-event"]) == null ? void 0 : u.q, b =
|
|
5572
|
-
this.notifyQueryError(
|
|
5563
|
+
const y = (u = e["original-event"]) == null ? void 0 : u.q, b = H(y);
|
|
5564
|
+
this.notifyQueryError(H(y), s), this.notifyQueryOnceError(y, b, t, s);
|
|
5573
5565
|
return;
|
|
5574
5566
|
}
|
|
5575
5567
|
if (((l = e["original-event"]) == null ? void 0 : l.op) === "init") {
|
|
@@ -5610,7 +5602,7 @@ class Nc {
|
|
|
5610
5602
|
this.attrs = new Le(e.reduce((t, r) => (t[r.id] = r, t), {}), this._linkIndex), this.notifyAttrsSubs();
|
|
5611
5603
|
}
|
|
5612
5604
|
_startQuerySub(e, t) {
|
|
5613
|
-
const r =
|
|
5605
|
+
const r = W();
|
|
5614
5606
|
return this.querySubs.updateInPlace((s) => {
|
|
5615
5607
|
s[t] = s[t] || { q: e, result: null, eventId: r }, s[t].lastAccessed = Date.now();
|
|
5616
5608
|
}), this._trySendAuthed(r, { op: "add-query", q: e }), r;
|
|
@@ -5630,7 +5622,7 @@ class Nc {
|
|
|
5630
5622
|
*/
|
|
5631
5623
|
subscribeQuery(e, t, r) {
|
|
5632
5624
|
this.config.disableValidation || Nr(e, this.config.schema), r && "ruleParams" in r && (e = { $$ruleParams: r.ruleParams, ...e });
|
|
5633
|
-
const s =
|
|
5625
|
+
const s = H(e), i = this.getPreviousResult(e);
|
|
5634
5626
|
return i && t(i), this.queryCbs[s] = this.queryCbs[s] ?? [], this.queryCbs[s].push({ q: e, cb: t }), this._startQuerySub(e, s), () => {
|
|
5635
5627
|
this._unsubQuery(e, s, t);
|
|
5636
5628
|
};
|
|
@@ -5642,7 +5634,7 @@ class Nc {
|
|
|
5642
5634
|
return r.reject(new Error("We can't run `queryOnce`, because the device is offline.")), r.promise;
|
|
5643
5635
|
if (!this.querySubs)
|
|
5644
5636
|
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;
|
|
5645
|
-
const s =
|
|
5637
|
+
const s = H(e), i = this._startQuerySub(e, s);
|
|
5646
5638
|
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;
|
|
5647
5639
|
}
|
|
5648
5640
|
_completeQueryOnce(e, t, r) {
|
|
@@ -5656,7 +5648,7 @@ class Nc {
|
|
|
5656
5648
|
return !!((t = this.queryCbs[e]) != null && t.length || (r = this.queryOnceDfds[e]) != null && r.length);
|
|
5657
5649
|
}
|
|
5658
5650
|
_cleanupQuery(e, t) {
|
|
5659
|
-
this._hasQueryListeners(t) || (delete this.queryCbs[t], delete this.queryOnceDfds[t], delete this._dataForQueryCache[t], this.querySubs.unloadKey(t), this._trySendAuthed(
|
|
5651
|
+
this._hasQueryListeners(t) || (delete this.queryCbs[t], delete this.queryOnceDfds[t], delete this._dataForQueryCache[t], this.querySubs.unloadKey(t), this._trySendAuthed(W(), { op: "remove-query", q: e }));
|
|
5660
5652
|
}
|
|
5661
5653
|
// When we `pushTx`, it's possible that we don't yet have `this.attrs`
|
|
5662
5654
|
// This means that `tx-steps` in `pendingMutations` will include `add-attr`
|
|
@@ -5914,7 +5906,7 @@ class Nc {
|
|
|
5914
5906
|
const r = await this.kv.waitForKeyToLoad(t);
|
|
5915
5907
|
if (r)
|
|
5916
5908
|
return r;
|
|
5917
|
-
const s =
|
|
5909
|
+
const s = W();
|
|
5918
5910
|
return this.kv.updateInPlace((i) => {
|
|
5919
5911
|
i[t] || (i[t] = s);
|
|
5920
5912
|
}), await this.kv.waitForKeyToLoad(t);
|
|
@@ -6266,14 +6258,14 @@ class Nc {
|
|
|
6266
6258
|
i.result.user = o, s.isConnected && (this._trySetPresence(t, o), this._notifyPresenceSubs(t));
|
|
6267
6259
|
}
|
|
6268
6260
|
_trySetPresence(e, t) {
|
|
6269
|
-
this._trySendAuthed(
|
|
6261
|
+
this._trySendAuthed(W(), {
|
|
6270
6262
|
op: "set-presence",
|
|
6271
6263
|
"room-id": e,
|
|
6272
6264
|
data: t
|
|
6273
6265
|
});
|
|
6274
6266
|
}
|
|
6275
6267
|
_tryJoinRoom(e, t, r) {
|
|
6276
|
-
this._trySendAuthed(
|
|
6268
|
+
this._trySendAuthed(W(), {
|
|
6277
6269
|
op: "join-room",
|
|
6278
6270
|
"room-type": e,
|
|
6279
6271
|
"room-id": t,
|
|
@@ -6281,7 +6273,7 @@ class Nc {
|
|
|
6281
6273
|
}), delete this._roomsPendingLeave[t];
|
|
6282
6274
|
}
|
|
6283
6275
|
_tryLeaveRoom(e) {
|
|
6284
|
-
this._trySendAuthed(
|
|
6276
|
+
this._trySendAuthed(W(), { op: "leave-room", "room-id": e });
|
|
6285
6277
|
}
|
|
6286
6278
|
_trySetRoomConnected(e, t) {
|
|
6287
6279
|
const r = this._rooms[e];
|
|
@@ -6355,7 +6347,7 @@ class Nc {
|
|
|
6355
6347
|
}
|
|
6356
6348
|
}
|
|
6357
6349
|
_tryBroadcast(e, t, r, s) {
|
|
6358
|
-
this._trySendAuthed(
|
|
6350
|
+
this._trySendAuthed(W(), {
|
|
6359
6351
|
op: "client-broadcast",
|
|
6360
6352
|
"room-id": e,
|
|
6361
6353
|
roomType: t,
|
|
@@ -7051,7 +7043,7 @@ function Qr(n) {
|
|
|
7051
7043
|
const e = Gr.get(n);
|
|
7052
7044
|
if (e)
|
|
7053
7045
|
return e;
|
|
7054
|
-
const t =
|
|
7046
|
+
const t = H(n);
|
|
7055
7047
|
return Gr.set(n, t), t;
|
|
7056
7048
|
}
|
|
7057
7049
|
function du(n, e) {
|
|
@@ -7147,26 +7139,26 @@ function bu() {
|
|
|
7147
7139
|
D.unshift("Warning: " + T), Function.prototype.apply.call(console[d], console, D);
|
|
7148
7140
|
}
|
|
7149
7141
|
}
|
|
7150
|
-
var v = !1, C = !1, j = !1, U = !1, B = !1,
|
|
7151
|
-
|
|
7152
|
-
function
|
|
7142
|
+
var v = !1, C = !1, j = !1, U = !1, B = !1, pe;
|
|
7143
|
+
pe = Symbol.for("react.module.reference");
|
|
7144
|
+
function Me(d) {
|
|
7153
7145
|
return !!(typeof d == "string" || typeof d == "function" || d === s || d === o || B || d === i || d === l || d === f || U || d === b || v || C || j || typeof d == "object" && d !== null && (d.$$typeof === y || d.$$typeof === p || d.$$typeof === a || d.$$typeof === c || d.$$typeof === u || // This needs to include all possible module reference object
|
|
7154
7146
|
// types supported by any Flight configuration anywhere since
|
|
7155
7147
|
// we don't know which Flight build this will end up being used
|
|
7156
7148
|
// with.
|
|
7157
|
-
d.$$typeof ===
|
|
7149
|
+
d.$$typeof === pe || d.getModuleId !== void 0));
|
|
7158
7150
|
}
|
|
7159
|
-
function
|
|
7151
|
+
function ee(d, T, E) {
|
|
7160
7152
|
var k = d.displayName;
|
|
7161
7153
|
if (k)
|
|
7162
7154
|
return k;
|
|
7163
7155
|
var $ = T.displayName || T.name || "";
|
|
7164
7156
|
return $ !== "" ? E + "(" + $ + ")" : E;
|
|
7165
7157
|
}
|
|
7166
|
-
function
|
|
7158
|
+
function te(d) {
|
|
7167
7159
|
return d.displayName || "Context";
|
|
7168
7160
|
}
|
|
7169
|
-
function
|
|
7161
|
+
function L(d) {
|
|
7170
7162
|
if (d == null)
|
|
7171
7163
|
return null;
|
|
7172
7164
|
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")
|
|
@@ -7191,19 +7183,19 @@ function bu() {
|
|
|
7191
7183
|
switch (d.$$typeof) {
|
|
7192
7184
|
case c:
|
|
7193
7185
|
var T = d;
|
|
7194
|
-
return
|
|
7186
|
+
return te(T) + ".Consumer";
|
|
7195
7187
|
case a:
|
|
7196
7188
|
var E = d;
|
|
7197
|
-
return
|
|
7189
|
+
return te(E._context) + ".Provider";
|
|
7198
7190
|
case u:
|
|
7199
|
-
return
|
|
7191
|
+
return ee(d, d.render, "ForwardRef");
|
|
7200
7192
|
case p:
|
|
7201
7193
|
var k = d.displayName || null;
|
|
7202
|
-
return k !== null ? k :
|
|
7194
|
+
return k !== null ? k : L(d.type) || "Memo";
|
|
7203
7195
|
case y: {
|
|
7204
7196
|
var $ = d, D = $._payload, x = $._init;
|
|
7205
7197
|
try {
|
|
7206
|
-
return
|
|
7198
|
+
return L(x(D));
|
|
7207
7199
|
} catch {
|
|
7208
7200
|
return null;
|
|
7209
7201
|
}
|
|
@@ -7211,18 +7203,18 @@ function bu() {
|
|
|
7211
7203
|
}
|
|
7212
7204
|
return null;
|
|
7213
7205
|
}
|
|
7214
|
-
var
|
|
7215
|
-
function
|
|
7206
|
+
var X = Object.assign, ve = 0, Re, Tt, Ht, A, I, Q, J;
|
|
7207
|
+
function oe() {
|
|
7216
7208
|
}
|
|
7217
|
-
|
|
7218
|
-
function
|
|
7209
|
+
oe.__reactDisabledLog = !0;
|
|
7210
|
+
function ge() {
|
|
7219
7211
|
{
|
|
7220
|
-
if (
|
|
7221
|
-
|
|
7212
|
+
if (ve === 0) {
|
|
7213
|
+
Re = console.log, Tt = console.info, Ht = console.warn, A = console.error, I = console.group, Q = console.groupCollapsed, J = console.groupEnd;
|
|
7222
7214
|
var d = {
|
|
7223
7215
|
configurable: !0,
|
|
7224
7216
|
enumerable: !0,
|
|
7225
|
-
value:
|
|
7217
|
+
value: oe,
|
|
7226
7218
|
writable: !0
|
|
7227
7219
|
};
|
|
7228
7220
|
Object.defineProperties(console, {
|
|
@@ -7235,45 +7227,45 @@ function bu() {
|
|
|
7235
7227
|
groupEnd: d
|
|
7236
7228
|
});
|
|
7237
7229
|
}
|
|
7238
|
-
|
|
7230
|
+
ve++;
|
|
7239
7231
|
}
|
|
7240
7232
|
}
|
|
7241
7233
|
function nt() {
|
|
7242
7234
|
{
|
|
7243
|
-
if (
|
|
7235
|
+
if (ve--, ve === 0) {
|
|
7244
7236
|
var d = {
|
|
7245
7237
|
configurable: !0,
|
|
7246
7238
|
enumerable: !0,
|
|
7247
7239
|
writable: !0
|
|
7248
7240
|
};
|
|
7249
7241
|
Object.defineProperties(console, {
|
|
7250
|
-
log:
|
|
7251
|
-
value:
|
|
7242
|
+
log: X({}, d, {
|
|
7243
|
+
value: Re
|
|
7252
7244
|
}),
|
|
7253
|
-
info:
|
|
7245
|
+
info: X({}, d, {
|
|
7254
7246
|
value: Tt
|
|
7255
7247
|
}),
|
|
7256
|
-
warn:
|
|
7248
|
+
warn: X({}, d, {
|
|
7257
7249
|
value: Ht
|
|
7258
7250
|
}),
|
|
7259
|
-
error:
|
|
7251
|
+
error: X({}, d, {
|
|
7260
7252
|
value: A
|
|
7261
7253
|
}),
|
|
7262
|
-
group:
|
|
7254
|
+
group: X({}, d, {
|
|
7263
7255
|
value: I
|
|
7264
7256
|
}),
|
|
7265
|
-
groupCollapsed:
|
|
7266
|
-
value:
|
|
7257
|
+
groupCollapsed: X({}, d, {
|
|
7258
|
+
value: Q
|
|
7267
7259
|
}),
|
|
7268
|
-
groupEnd:
|
|
7269
|
-
value:
|
|
7260
|
+
groupEnd: X({}, d, {
|
|
7261
|
+
value: J
|
|
7270
7262
|
})
|
|
7271
7263
|
});
|
|
7272
7264
|
}
|
|
7273
|
-
|
|
7265
|
+
ve < 0 && w("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
7274
7266
|
}
|
|
7275
7267
|
}
|
|
7276
|
-
var
|
|
7268
|
+
var _e = g.ReactCurrentDispatcher, Jt;
|
|
7277
7269
|
function St(d, T, E) {
|
|
7278
7270
|
{
|
|
7279
7271
|
if (Jt === void 0)
|
|
@@ -7305,7 +7297,7 @@ function bu() {
|
|
|
7305
7297
|
var $ = Error.prepareStackTrace;
|
|
7306
7298
|
Error.prepareStackTrace = void 0;
|
|
7307
7299
|
var D;
|
|
7308
|
-
D =
|
|
7300
|
+
D = _e.current, _e.current = null, ge();
|
|
7309
7301
|
try {
|
|
7310
7302
|
if (T) {
|
|
7311
7303
|
var x = function() {
|
|
@@ -7318,29 +7310,29 @@ function bu() {
|
|
|
7318
7310
|
}), typeof Reflect == "object" && Reflect.construct) {
|
|
7319
7311
|
try {
|
|
7320
7312
|
Reflect.construct(x, []);
|
|
7321
|
-
} catch (
|
|
7322
|
-
k =
|
|
7313
|
+
} catch (ae) {
|
|
7314
|
+
k = ae;
|
|
7323
7315
|
}
|
|
7324
7316
|
Reflect.construct(d, [], x);
|
|
7325
7317
|
} else {
|
|
7326
7318
|
try {
|
|
7327
7319
|
x.call();
|
|
7328
|
-
} catch (
|
|
7329
|
-
k =
|
|
7320
|
+
} catch (ae) {
|
|
7321
|
+
k = ae;
|
|
7330
7322
|
}
|
|
7331
7323
|
d.call(x.prototype);
|
|
7332
7324
|
}
|
|
7333
7325
|
} else {
|
|
7334
7326
|
try {
|
|
7335
7327
|
throw Error();
|
|
7336
|
-
} catch (
|
|
7337
|
-
k =
|
|
7328
|
+
} catch (ae) {
|
|
7329
|
+
k = ae;
|
|
7338
7330
|
}
|
|
7339
7331
|
d();
|
|
7340
7332
|
}
|
|
7341
|
-
} catch (
|
|
7342
|
-
if (
|
|
7343
|
-
for (var M =
|
|
7333
|
+
} catch (ae) {
|
|
7334
|
+
if (ae && k && typeof ae.stack == "string") {
|
|
7335
|
+
for (var M = ae.stack.split(`
|
|
7344
7336
|
`), ne = k.stack.split(`
|
|
7345
7337
|
`), K = M.length - 1, z = ne.length - 1; K >= 1 && z >= 0 && M[K] !== ne[z]; )
|
|
7346
7338
|
z--;
|
|
@@ -7349,16 +7341,16 @@ function bu() {
|
|
|
7349
7341
|
if (K !== 1 || z !== 1)
|
|
7350
7342
|
do
|
|
7351
7343
|
if (K--, z--, z < 0 || M[K] !== ne[z]) {
|
|
7352
|
-
var
|
|
7344
|
+
var ye = `
|
|
7353
7345
|
` + M[K].replace(" at new ", " at ");
|
|
7354
|
-
return d.displayName &&
|
|
7346
|
+
return d.displayName && ye.includes("<anonymous>") && (ye = ye.replace("<anonymous>", d.displayName)), typeof d == "function" && vt.set(d, ye), ye;
|
|
7355
7347
|
}
|
|
7356
7348
|
while (K >= 1 && z >= 0);
|
|
7357
7349
|
break;
|
|
7358
7350
|
}
|
|
7359
7351
|
}
|
|
7360
7352
|
} finally {
|
|
7361
|
-
Yt = !1,
|
|
7353
|
+
Yt = !1, _e.current = D, nt(), Error.prepareStackTrace = $;
|
|
7362
7354
|
}
|
|
7363
7355
|
var ze = d ? d.displayName || d.name : "", je = ze ? St(ze) : "";
|
|
7364
7356
|
return typeof d == "function" && vt.set(d, je), je;
|
|
@@ -7560,7 +7552,7 @@ function bu() {
|
|
|
7560
7552
|
function lr() {
|
|
7561
7553
|
{
|
|
7562
7554
|
if (Xt.current) {
|
|
7563
|
-
var d =
|
|
7555
|
+
var d = L(Xt.current.type);
|
|
7564
7556
|
if (d)
|
|
7565
7557
|
return `
|
|
7566
7558
|
|
|
@@ -7595,7 +7587,7 @@ Check the top-level render call using <` + E + ">.");
|
|
|
7595
7587
|
return;
|
|
7596
7588
|
fr[E] = !0;
|
|
7597
7589
|
var k = "";
|
|
7598
|
-
d && d._owner && d._owner !== Xt.current && (k = " It was passed a child from " +
|
|
7590
|
+
d && d._owner && d._owner !== Xt.current && (k = " It was passed a child from " + L(d._owner.type) + "."), qe(d), w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', E, k), qe(null);
|
|
7599
7591
|
}
|
|
7600
7592
|
}
|
|
7601
7593
|
function hr(d, T) {
|
|
@@ -7632,11 +7624,11 @@ Check the top-level render call using <` + E + ">.");
|
|
|
7632
7624
|
else
|
|
7633
7625
|
return;
|
|
7634
7626
|
if (E) {
|
|
7635
|
-
var k =
|
|
7627
|
+
var k = L(T);
|
|
7636
7628
|
Ys(E, d.props, "prop", k, d);
|
|
7637
7629
|
} else if (T.PropTypes !== void 0 && !en) {
|
|
7638
7630
|
en = !0;
|
|
7639
|
-
var $ =
|
|
7631
|
+
var $ = L(T);
|
|
7640
7632
|
w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", $ || "Unknown");
|
|
7641
7633
|
}
|
|
7642
7634
|
typeof T.getDefaultProps == "function" && !T.getDefaultProps.isReactClassApproved && w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
@@ -7657,37 +7649,37 @@ Check the top-level render call using <` + E + ">.");
|
|
|
7657
7649
|
var pr = {};
|
|
7658
7650
|
function yr(d, T, E, k, $, D) {
|
|
7659
7651
|
{
|
|
7660
|
-
var x =
|
|
7652
|
+
var x = Me(d);
|
|
7661
7653
|
if (!x) {
|
|
7662
7654
|
var M = "";
|
|
7663
7655
|
(d === void 0 || typeof d == "object" && d !== null && Object.keys(d).length === 0) && (M += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
7664
7656
|
var ne = ui();
|
|
7665
7657
|
ne ? M += ne : M += lr();
|
|
7666
7658
|
var K;
|
|
7667
|
-
d === null ? K = "null" : Zt(d) ? K = "array" : d !== void 0 && d.$$typeof === t ? (K = "<" + (
|
|
7659
|
+
d === null ? K = "null" : Zt(d) ? K = "array" : d !== void 0 && d.$$typeof === t ? (K = "<" + (L(d.type) || "Unknown") + " />", M = " Did you accidentally export a JSX literal instead of a component?") : K = typeof d, w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", K, M);
|
|
7668
7660
|
}
|
|
7669
7661
|
var z = ci(d, T, E, $, D);
|
|
7670
7662
|
if (z == null)
|
|
7671
7663
|
return z;
|
|
7672
7664
|
if (x) {
|
|
7673
|
-
var
|
|
7674
|
-
if (
|
|
7665
|
+
var ye = T.children;
|
|
7666
|
+
if (ye !== void 0)
|
|
7675
7667
|
if (k)
|
|
7676
|
-
if (Zt(
|
|
7677
|
-
for (var ze = 0; ze <
|
|
7678
|
-
hr(
|
|
7679
|
-
Object.freeze && Object.freeze(
|
|
7668
|
+
if (Zt(ye)) {
|
|
7669
|
+
for (var ze = 0; ze < ye.length; ze++)
|
|
7670
|
+
hr(ye[ze], d);
|
|
7671
|
+
Object.freeze && Object.freeze(ye);
|
|
7680
7672
|
} else
|
|
7681
7673
|
w("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
7682
7674
|
else
|
|
7683
|
-
hr(
|
|
7675
|
+
hr(ye, d);
|
|
7684
7676
|
}
|
|
7685
7677
|
if (rt.call(T, "key")) {
|
|
7686
|
-
var je =
|
|
7678
|
+
var je = L(d), ae = Object.keys(T).filter(function(_i) {
|
|
7687
7679
|
return _i !== "key";
|
|
7688
|
-
}), nn =
|
|
7680
|
+
}), nn = ae.length > 0 ? "{key: someKey, " + ae.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
7689
7681
|
if (!pr[je + nn]) {
|
|
7690
|
-
var gi =
|
|
7682
|
+
var gi = ae.length > 0 ? "{" + ae.join(": ..., ") + ": ...}" : "{}";
|
|
7691
7683
|
w(`A props object containing a "key" prop is being spread into JSX:
|
|
7692
7684
|
let props = %s;
|
|
7693
7685
|
<%s {...props} />
|
|
@@ -7711,7 +7703,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
7711
7703
|
}
|
|
7712
7704
|
var gu = {};
|
|
7713
7705
|
gu.NODE_ENV === "production" ? Mn.exports = yu() : Mn.exports = bu();
|
|
7714
|
-
var
|
|
7706
|
+
var Z = Mn.exports;
|
|
7715
7707
|
const _u = {
|
|
7716
7708
|
isLoading: !0,
|
|
7717
7709
|
data: void 0,
|
|
@@ -7729,7 +7721,7 @@ function Yr(n) {
|
|
|
7729
7721
|
}
|
|
7730
7722
|
function mu(n, e, t) {
|
|
7731
7723
|
e && t && "ruleParams" in t && (e = { $$ruleParams: t.ruleParams, ...e });
|
|
7732
|
-
const r = e ? lu(e) : null, s =
|
|
7724
|
+
const r = e ? lu(e) : null, s = H(r), i = gt(Yr(n._reactor.getPreviousResult(r))), o = Pe(
|
|
7733
7725
|
(c) => (i.current = Yr(n._reactor.getPreviousResult(r)), c(), r ? n.subscribeQuery(r, (l) => {
|
|
7734
7726
|
i.current = {
|
|
7735
7727
|
isLoading: !l,
|
|
@@ -7769,7 +7761,7 @@ function Su(n, e, t) {
|
|
|
7769
7761
|
}), [n.id, e]);
|
|
7770
7762
|
}
|
|
7771
7763
|
function vu(n, e) {
|
|
7772
|
-
return Fe(() => n.core._reactor.joinRoom(n.type, n.id), [n.id]),
|
|
7764
|
+
return Fe(() => n.core._reactor.joinRoom(n.type, n.id), [n.id]), Pe((r) => {
|
|
7773
7765
|
n.core._reactor.publishTopic({
|
|
7774
7766
|
roomType: n.type,
|
|
7775
7767
|
roomId: n.id,
|
|
@@ -7787,7 +7779,7 @@ function Eu(n, e = {}) {
|
|
|
7787
7779
|
Fe(() => n.core._reactor.subscribePresence(n.type, n.id, e, (u) => {
|
|
7788
7780
|
r(u);
|
|
7789
7781
|
}), [n.id, e.user, (o = e.peers) == null ? void 0 : o.join(), (a = e.keys) == null ? void 0 : a.join()]);
|
|
7790
|
-
const s =
|
|
7782
|
+
const s = Pe((c) => {
|
|
7791
7783
|
n.core._reactor.publishPresence(n.type, n.id, c);
|
|
7792
7784
|
}, [n.type, n.id]);
|
|
7793
7785
|
return hn(() => ({
|
|
@@ -7804,7 +7796,7 @@ function Au(n, e, t = {}) {
|
|
|
7804
7796
|
}), i = hn(() => {
|
|
7805
7797
|
const l = n._core._reactor.getPresence(n.type, n.id);
|
|
7806
7798
|
return t != null && t.writeOnly ? [] : Object.values((l == null ? void 0 : l.peers) ?? {}).filter((f) => f[e] === !0);
|
|
7807
|
-
}, [t == null ? void 0 : t.writeOnly, s]), o =
|
|
7799
|
+
}, [t == null ? void 0 : t.writeOnly, s]), o = Pe((l) => {
|
|
7808
7800
|
n.core._reactor.publishPresence(n.type, n.id, {
|
|
7809
7801
|
[e]: l
|
|
7810
7802
|
}), l && ((t == null ? void 0 : t.timeout) === null || (t == null ? void 0 : t.timeout) === 0 || r.set((t == null ? void 0 : t.timeout) ?? Tu, () => {
|
|
@@ -7812,10 +7804,10 @@ function Au(n, e, t = {}) {
|
|
|
7812
7804
|
[e]: null
|
|
7813
7805
|
});
|
|
7814
7806
|
}));
|
|
7815
|
-
}, [n.type, n.id, e, t == null ? void 0 : t.timeout, r]), a =
|
|
7807
|
+
}, [n.type, n.id, e, t == null ? void 0 : t.timeout, r]), a = Pe((l) => {
|
|
7816
7808
|
const p = !((t == null ? void 0 : t.stopOnEnter) && l.key === "Enter");
|
|
7817
7809
|
o(p);
|
|
7818
|
-
}, [t.stopOnEnter, o]), c =
|
|
7810
|
+
}, [t.stopOnEnter, o]), c = Pe(() => {
|
|
7819
7811
|
o(!1);
|
|
7820
7812
|
}, [o]), u = hn(() => ({ onKeyDown: a, onBlur: c }), [a, c]);
|
|
7821
7813
|
return {
|
|
@@ -8095,7 +8087,7 @@ class $t {
|
|
|
8095
8087
|
* }
|
|
8096
8088
|
*/
|
|
8097
8089
|
h(this, "useConnectionStatus", () => {
|
|
8098
|
-
const e = gt(this.core._reactor.status), t =
|
|
8090
|
+
const e = gt(this.core._reactor.status), t = Pe((s) => this.core.subscribeConnectionStatus((o) => {
|
|
8099
8091
|
o !== e.current && (e.current = o, s());
|
|
8100
8092
|
}), []);
|
|
8101
8093
|
return dn(
|
|
@@ -8131,7 +8123,7 @@ class $t {
|
|
|
8131
8123
|
*/
|
|
8132
8124
|
h(this, "SignedIn", ({ children: e }) => {
|
|
8133
8125
|
const t = this.useAuth();
|
|
8134
|
-
return t.isLoading || t.error || !t.user ? null :
|
|
8126
|
+
return t.isLoading || t.error || !t.user ? null : Z.jsx(Z.Fragment, { children: e });
|
|
8135
8127
|
});
|
|
8136
8128
|
/**
|
|
8137
8129
|
* Only render children if the user is signed out.
|
|
@@ -8145,7 +8137,7 @@ class $t {
|
|
|
8145
8137
|
*/
|
|
8146
8138
|
h(this, "SignedOut", ({ children: e }) => {
|
|
8147
8139
|
const t = this.useAuth();
|
|
8148
|
-
return t.isLoading || t.error || t.user ? null :
|
|
8140
|
+
return t.isLoading || t.error || t.user ? null : Z.jsx(Z.Fragment, { children: e });
|
|
8149
8141
|
});
|
|
8150
8142
|
this.core = hu(
|
|
8151
8143
|
e,
|
|
@@ -8174,7 +8166,7 @@ class $t {
|
|
|
8174
8166
|
return new ku(this.core, e, t);
|
|
8175
8167
|
}
|
|
8176
8168
|
_useAuth() {
|
|
8177
|
-
const e = gt(this.core._reactor._currentUserCached), t =
|
|
8169
|
+
const e = gt(this.core._reactor._currentUserCached), t = Pe((s) => this.core.subscribeAuth((o) => {
|
|
8178
8170
|
e.current = { isLoading: !1, ...o }, s();
|
|
8179
8171
|
}), []);
|
|
8180
8172
|
return dn(t, () => e.current, () => Cu);
|
|
@@ -8356,44 +8348,44 @@ function es(n) {
|
|
|
8356
8348
|
}
|
|
8357
8349
|
var Bs = (n) => {
|
|
8358
8350
|
throw TypeError(n);
|
|
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),
|
|
8351
|
+
}, er = (n, e, t) => e.has(n) || Bs("Cannot " + t), P = (n, e, t) => (er(n, e, "read from private field"), t ? t.call(n) : e.get(n)), G = (n, e, t) => e.has(n) ? Bs("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), N = (n, e, t, r) => (er(n, e, "write to private field"), e.set(n, t), t), Ae = (n, e, t) => (er(n, e, "access private method"), t), ce, De, Ge, Dt, qt, yt, Je, bt, Ie, Qe, Ze, He, lt, me, jn, xn, $n, ts, Dn, Un, ft, Ln, Fn;
|
|
8360
8352
|
class Ut extends EventTarget {
|
|
8361
8353
|
constructor(e, t) {
|
|
8362
8354
|
var r, s;
|
|
8363
|
-
super(), G(this,
|
|
8355
|
+
super(), G(this, me), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, G(this, ce), G(this, De), G(this, Ge), G(this, Dt), G(this, qt), G(this, yt), G(this, Je), G(this, bt, null), G(this, Ie), G(this, Qe), G(this, Ze, null), G(this, He, null), G(this, lt, null), G(this, xn, async (i) => {
|
|
8364
8356
|
var o;
|
|
8365
8357
|
P(this, Qe).reset();
|
|
8366
8358
|
const { body: a, redirected: c, status: u, headers: l } = i;
|
|
8367
8359
|
if (u === 204) {
|
|
8368
|
-
|
|
8360
|
+
Ae(this, me, ft).call(this, "Server sent HTTP 204, not reconnecting", 204), this.close();
|
|
8369
8361
|
return;
|
|
8370
8362
|
}
|
|
8371
|
-
if (c ?
|
|
8372
|
-
|
|
8363
|
+
if (c ? N(this, Ge, new URL(i.url)) : N(this, Ge, void 0), u !== 200) {
|
|
8364
|
+
Ae(this, me, ft).call(this, `Non-200 status code (${u})`, u);
|
|
8373
8365
|
return;
|
|
8374
8366
|
}
|
|
8375
8367
|
if (!(l.get("content-type") || "").startsWith("text/event-stream")) {
|
|
8376
|
-
|
|
8368
|
+
Ae(this, me, ft).call(this, 'Invalid content type, expected "text/event-stream"', u);
|
|
8377
8369
|
return;
|
|
8378
8370
|
}
|
|
8379
|
-
if (P(this,
|
|
8371
|
+
if (P(this, ce) === this.CLOSED)
|
|
8380
8372
|
return;
|
|
8381
|
-
|
|
8373
|
+
N(this, ce, this.OPEN);
|
|
8382
8374
|
const f = new Event("open");
|
|
8383
8375
|
if ((o = P(this, lt)) == null || o.call(this, f), this.dispatchEvent(f), typeof a != "object" || !a || !("getReader" in a)) {
|
|
8384
|
-
|
|
8376
|
+
Ae(this, me, ft).call(this, "Invalid response body, expected a web ReadableStream", u), this.close();
|
|
8385
8377
|
return;
|
|
8386
8378
|
}
|
|
8387
8379
|
const p = new TextDecoder(), y = a.getReader();
|
|
8388
8380
|
let b = !0;
|
|
8389
8381
|
do {
|
|
8390
8382
|
const { done: _, value: m } = await y.read();
|
|
8391
|
-
m && P(this, Qe).feed(p.decode(m, { stream: !_ })), _ && (b = !1, P(this, Qe).reset(),
|
|
8383
|
+
m && P(this, Qe).feed(p.decode(m, { stream: !_ })), _ && (b = !1, P(this, Qe).reset(), Ae(this, me, Ln).call(this));
|
|
8392
8384
|
} while (b);
|
|
8393
8385
|
}), G(this, $n, (i) => {
|
|
8394
|
-
|
|
8386
|
+
N(this, Ie, void 0), !(i.name === "AbortError" || i.type === "aborted") && Ae(this, me, Ln).call(this, Rn(i));
|
|
8395
8387
|
}), G(this, Dn, (i) => {
|
|
8396
|
-
typeof i.id == "string" &&
|
|
8388
|
+
typeof i.id == "string" && N(this, bt, i.id);
|
|
8397
8389
|
const o = new MessageEvent(i.event || "message", {
|
|
8398
8390
|
data: i.data,
|
|
8399
8391
|
origin: P(this, Ge) ? P(this, Ge).origin : P(this, De).origin,
|
|
@@ -8401,24 +8393,24 @@ class Ut extends EventTarget {
|
|
|
8401
8393
|
});
|
|
8402
8394
|
P(this, He) && (!i.event || i.event === "message") && P(this, He).call(this, o), this.dispatchEvent(o);
|
|
8403
8395
|
}), G(this, Un, (i) => {
|
|
8404
|
-
|
|
8396
|
+
N(this, yt, i);
|
|
8405
8397
|
}), G(this, Fn, () => {
|
|
8406
|
-
|
|
8398
|
+
N(this, Je, void 0), P(this, ce) === this.CONNECTING && Ae(this, me, jn).call(this);
|
|
8407
8399
|
});
|
|
8408
8400
|
try {
|
|
8409
8401
|
if (e instanceof URL)
|
|
8410
|
-
|
|
8402
|
+
N(this, De, e);
|
|
8411
8403
|
else if (typeof e == "string")
|
|
8412
|
-
|
|
8404
|
+
N(this, De, new URL(e, Ru()));
|
|
8413
8405
|
else
|
|
8414
8406
|
throw new Error("Invalid URL");
|
|
8415
8407
|
} catch {
|
|
8416
8408
|
throw Mu("An invalid or illegal string was specified");
|
|
8417
8409
|
}
|
|
8418
|
-
|
|
8410
|
+
N(this, Qe, Iu({
|
|
8419
8411
|
onEvent: P(this, Dn),
|
|
8420
8412
|
onRetry: P(this, Un)
|
|
8421
|
-
})),
|
|
8413
|
+
})), N(this, ce, this.CONNECTING), N(this, yt, 3e3), N(this, qt, (r = t == null ? void 0 : t.fetch) != null ? r : globalThis.fetch), N(this, Dt, (s = t == null ? void 0 : t.withCredentials) != null ? s : !1), Ae(this, me, jn).call(this);
|
|
8422
8414
|
}
|
|
8423
8415
|
/**
|
|
8424
8416
|
* Returns the state of this EventSource object's connection. It can have the values described below.
|
|
@@ -8431,7 +8423,7 @@ class Ut extends EventTarget {
|
|
|
8431
8423
|
* @public
|
|
8432
8424
|
*/
|
|
8433
8425
|
get readyState() {
|
|
8434
|
-
return P(this,
|
|
8426
|
+
return P(this, ce);
|
|
8435
8427
|
}
|
|
8436
8428
|
/**
|
|
8437
8429
|
* Returns the URL providing the event stream.
|
|
@@ -8456,21 +8448,21 @@ class Ut extends EventTarget {
|
|
|
8456
8448
|
return P(this, Ze);
|
|
8457
8449
|
}
|
|
8458
8450
|
set onerror(e) {
|
|
8459
|
-
|
|
8451
|
+
N(this, Ze, e);
|
|
8460
8452
|
}
|
|
8461
8453
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */
|
|
8462
8454
|
get onmessage() {
|
|
8463
8455
|
return P(this, He);
|
|
8464
8456
|
}
|
|
8465
8457
|
set onmessage(e) {
|
|
8466
|
-
|
|
8458
|
+
N(this, He, e);
|
|
8467
8459
|
}
|
|
8468
8460
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */
|
|
8469
8461
|
get onopen() {
|
|
8470
8462
|
return P(this, lt);
|
|
8471
8463
|
}
|
|
8472
8464
|
set onopen(e) {
|
|
8473
|
-
|
|
8465
|
+
N(this, lt, e);
|
|
8474
8466
|
}
|
|
8475
8467
|
addEventListener(e, t, r) {
|
|
8476
8468
|
const s = t;
|
|
@@ -8488,16 +8480,16 @@ class Ut extends EventTarget {
|
|
|
8488
8480
|
* @public
|
|
8489
8481
|
*/
|
|
8490
8482
|
close() {
|
|
8491
|
-
P(this, Je) && clearTimeout(P(this, Je)), P(this,
|
|
8483
|
+
P(this, Je) && clearTimeout(P(this, Je)), P(this, ce) !== this.CLOSED && (P(this, Ie) && P(this, Ie).abort(), N(this, ce, this.CLOSED), N(this, Ie, void 0));
|
|
8492
8484
|
}
|
|
8493
8485
|
}
|
|
8494
|
-
|
|
8486
|
+
ce = /* @__PURE__ */ new WeakMap(), De = /* @__PURE__ */ new WeakMap(), Ge = /* @__PURE__ */ new WeakMap(), Dt = /* @__PURE__ */ new WeakMap(), qt = /* @__PURE__ */ new WeakMap(), yt = /* @__PURE__ */ new WeakMap(), Je = /* @__PURE__ */ new WeakMap(), bt = /* @__PURE__ */ new WeakMap(), Ie = /* @__PURE__ */ new WeakMap(), Qe = /* @__PURE__ */ new WeakMap(), Ze = /* @__PURE__ */ new WeakMap(), He = /* @__PURE__ */ new WeakMap(), lt = /* @__PURE__ */ new WeakMap(), me = /* @__PURE__ */ new WeakSet(), /**
|
|
8495
8487
|
* Connect to the given URL and start receiving events
|
|
8496
8488
|
*
|
|
8497
8489
|
* @internal
|
|
8498
8490
|
*/
|
|
8499
8491
|
jn = function() {
|
|
8500
|
-
|
|
8492
|
+
N(this, ce, this.CONNECTING), N(this, Ie, new AbortController()), P(this, qt)(P(this, De), Ae(this, me, ts).call(this)).then(P(this, xn)).catch(P(this, $n));
|
|
8501
8493
|
}, xn = /* @__PURE__ */ new WeakMap(), $n = /* @__PURE__ */ new WeakMap(), /**
|
|
8502
8494
|
* Get request options for the `fetch()` request
|
|
8503
8495
|
*
|
|
@@ -8513,7 +8505,7 @@ ts = function() {
|
|
|
8513
8505
|
redirect: "follow",
|
|
8514
8506
|
headers: { Accept: "text/event-stream", ...P(this, bt) ? { "Last-Event-ID": P(this, bt) } : void 0 },
|
|
8515
8507
|
cache: "no-store",
|
|
8516
|
-
signal: (n = P(this,
|
|
8508
|
+
signal: (n = P(this, Ie)) == null ? void 0 : n.signal
|
|
8517
8509
|
};
|
|
8518
8510
|
return "window" in globalThis && (e.credentials = this.withCredentials ? "include" : "same-origin"), e;
|
|
8519
8511
|
}, Dn = /* @__PURE__ */ new WeakMap(), Un = /* @__PURE__ */ new WeakMap(), /**
|
|
@@ -8525,7 +8517,7 @@ ts = function() {
|
|
|
8525
8517
|
*/
|
|
8526
8518
|
ft = function(n, e) {
|
|
8527
8519
|
var t;
|
|
8528
|
-
P(this,
|
|
8520
|
+
P(this, ce) !== this.CLOSED && N(this, ce, this.CLOSED);
|
|
8529
8521
|
const r = new Xr("error", { code: e, message: n });
|
|
8530
8522
|
(t = P(this, Ze)) == null || t.call(this, r), this.dispatchEvent(r);
|
|
8531
8523
|
}, /**
|
|
@@ -8537,11 +8529,11 @@ ft = function(n, e) {
|
|
|
8537
8529
|
*/
|
|
8538
8530
|
Ln = function(n, e) {
|
|
8539
8531
|
var t;
|
|
8540
|
-
if (P(this,
|
|
8532
|
+
if (P(this, ce) === this.CLOSED)
|
|
8541
8533
|
return;
|
|
8542
|
-
|
|
8534
|
+
N(this, ce, this.CONNECTING);
|
|
8543
8535
|
const r = new Xr("error", { code: e, message: n });
|
|
8544
|
-
(t = P(this, Ze)) == null || t.call(this, r), this.dispatchEvent(r),
|
|
8536
|
+
(t = P(this, Ze)) == null || t.call(this, r), this.dispatchEvent(r), N(this, Je, setTimeout(P(this, Fn), P(this, yt)));
|
|
8545
8537
|
}, Fn = /* @__PURE__ */ new WeakMap(), /**
|
|
8546
8538
|
* ReadyState representing an EventSource currently trying to connect
|
|
8547
8539
|
*
|
|
@@ -8642,7 +8634,7 @@ function zu({
|
|
|
8642
8634
|
},
|
|
8643
8635
|
[
|
|
8644
8636
|
o,
|
|
8645
|
-
/* @__PURE__ */
|
|
8637
|
+
/* @__PURE__ */ Z.jsx(
|
|
8646
8638
|
"div",
|
|
8647
8639
|
{
|
|
8648
8640
|
style: {
|
|
@@ -8652,7 +8644,7 @@ function zu({
|
|
|
8652
8644
|
},
|
|
8653
8645
|
children: Object.entries(f.peers).map(([g, w]) => {
|
|
8654
8646
|
const O = w[l];
|
|
8655
|
-
return O ? /* @__PURE__ */
|
|
8647
|
+
return O ? /* @__PURE__ */ Z.jsx(
|
|
8656
8648
|
"div",
|
|
8657
8649
|
{
|
|
8658
8650
|
style: {
|
|
@@ -8664,7 +8656,7 @@ function zu({
|
|
|
8664
8656
|
children: a ? a({
|
|
8665
8657
|
color: O.color,
|
|
8666
8658
|
presence: p == null ? void 0 : p.peers[g]
|
|
8667
|
-
}) : /* @__PURE__ */
|
|
8659
|
+
}) : /* @__PURE__ */ Z.jsx(xu, { ...O })
|
|
8668
8660
|
},
|
|
8669
8661
|
g
|
|
8670
8662
|
) : null;
|
|
@@ -8677,7 +8669,7 @@ function zu({
|
|
|
8677
8669
|
}
|
|
8678
8670
|
function xu({ color: n }) {
|
|
8679
8671
|
const t = n || "black";
|
|
8680
|
-
return /* @__PURE__ */
|
|
8672
|
+
return /* @__PURE__ */ Z.jsxs(
|
|
8681
8673
|
"svg",
|
|
8682
8674
|
{
|
|
8683
8675
|
style: { height: 35, width: 35 },
|
|
@@ -8685,36 +8677,36 @@ function xu({ color: n }) {
|
|
|
8685
8677
|
fill: "none",
|
|
8686
8678
|
xmlns: "http://www.w3.org/2000/svg",
|
|
8687
8679
|
children: [
|
|
8688
|
-
/* @__PURE__ */
|
|
8680
|
+
/* @__PURE__ */ Z.jsxs(
|
|
8689
8681
|
"g",
|
|
8690
8682
|
{
|
|
8691
8683
|
fill: "rgba(0,0,0,.2)",
|
|
8692
8684
|
transform: "matrix(1, 0, 0, 1, -11.999999046325684, -8.406899452209473)",
|
|
8693
8685
|
children: [
|
|
8694
|
-
/* @__PURE__ */
|
|
8695
|
-
/* @__PURE__ */
|
|
8686
|
+
/* @__PURE__ */ Z.jsx("path", { d: "m12 24.4219v-16.015l11.591 11.619h-6.781l-.411.124z" }),
|
|
8687
|
+
/* @__PURE__ */ Z.jsx("path", { d: "m21.0845 25.0962-3.605 1.535-4.682-11.089 3.686-1.553z" })
|
|
8696
8688
|
]
|
|
8697
8689
|
}
|
|
8698
8690
|
),
|
|
8699
|
-
/* @__PURE__ */
|
|
8691
|
+
/* @__PURE__ */ Z.jsxs(
|
|
8700
8692
|
"g",
|
|
8701
8693
|
{
|
|
8702
8694
|
fill: "white",
|
|
8703
8695
|
transform: "matrix(1, 0, 0, 1, -11.999999046325684, -8.406899452209473)",
|
|
8704
8696
|
children: [
|
|
8705
|
-
/* @__PURE__ */
|
|
8706
|
-
/* @__PURE__ */
|
|
8697
|
+
/* @__PURE__ */ Z.jsx("path", { d: "m12 24.4219v-16.015l11.591 11.619h-6.781l-.411.124z" }),
|
|
8698
|
+
/* @__PURE__ */ Z.jsx("path", { d: "m21.0845 25.0962-3.605 1.535-4.682-11.089 3.686-1.553z" })
|
|
8707
8699
|
]
|
|
8708
8700
|
}
|
|
8709
8701
|
),
|
|
8710
|
-
/* @__PURE__ */
|
|
8702
|
+
/* @__PURE__ */ Z.jsxs(
|
|
8711
8703
|
"g",
|
|
8712
8704
|
{
|
|
8713
8705
|
fill: t,
|
|
8714
8706
|
transform: "matrix(1, 0, 0, 1, -11.999999046325684, -8.406899452209473)",
|
|
8715
8707
|
children: [
|
|
8716
|
-
/* @__PURE__ */
|
|
8717
|
-
/* @__PURE__ */
|
|
8708
|
+
/* @__PURE__ */ Z.jsx("path", { d: "m19.751 24.4155-1.844.774-3.1-7.374 1.841-.775z" }),
|
|
8709
|
+
/* @__PURE__ */ Z.jsx("path", { d: "m13 10.814v11.188l2.969-2.866.428-.139h4.768z" })
|
|
8718
8710
|
]
|
|
8719
8711
|
}
|
|
8720
8712
|
)
|
|
@@ -8742,7 +8734,7 @@ export {
|
|
|
8742
8734
|
xe as SyncTableCallbackEventType,
|
|
8743
8735
|
Ku as createInstantRouteHandler,
|
|
8744
8736
|
Wu as i,
|
|
8745
|
-
|
|
8737
|
+
W as id,
|
|
8746
8738
|
ju as init,
|
|
8747
8739
|
qu as init_experimental,
|
|
8748
8740
|
fa as lookup,
|