@instantdb/react 0.22.47-experimental.sync-table.19152834603.1 → 0.22.47-experimental.sync-table.19154203588.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/standalone/index.js +188 -175
- package/dist/standalone/index.umd.cjs +7 -7
- package/package.json +4 -4
package/dist/standalone/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import ni, { useRef as St, useCallback as be, useSyncExternalStore as Jt, useEffect as ve, useMemo as Zt, useState as ri, createElement as ws } from "react";
|
|
2
|
-
function
|
|
2
|
+
function z(t) {
|
|
3
3
|
if (typeof t == "number")
|
|
4
4
|
return (Math.abs(t * 2654435761) >>> 0).toString(16);
|
|
5
5
|
if (typeof t == "boolean")
|
|
@@ -18,7 +18,7 @@ function K(t) {
|
|
|
18
18
|
let e = 2166136261;
|
|
19
19
|
for (let n = 0; n < t.length; n++) {
|
|
20
20
|
e ^= (n + 1) * 2654435761;
|
|
21
|
-
const r =
|
|
21
|
+
const r = z(t[n]);
|
|
22
22
|
for (let i = 0; i < r.length; i++)
|
|
23
23
|
e ^= r.charCodeAt(i), e *= 16777619, e = e >>> 0;
|
|
24
24
|
}
|
|
@@ -28,14 +28,14 @@ function K(t) {
|
|
|
28
28
|
let e = 2166136261;
|
|
29
29
|
const n = Object.keys(t).sort();
|
|
30
30
|
for (let r = 0; r < n.length; r++) {
|
|
31
|
-
const i = n[r], s =
|
|
31
|
+
const i = n[r], s = z(i);
|
|
32
32
|
e ^= parseInt(s, 16), e *= 16777619, e = e >>> 0;
|
|
33
|
-
const o =
|
|
33
|
+
const o = z(t[i]);
|
|
34
34
|
e ^= parseInt(o, 16), e *= 16777619, e = e >>> 0;
|
|
35
35
|
}
|
|
36
36
|
return e.toString(16);
|
|
37
37
|
}
|
|
38
|
-
return
|
|
38
|
+
return z(String(t));
|
|
39
39
|
}
|
|
40
40
|
const D = {
|
|
41
41
|
Remove: "remove",
|
|
@@ -45,7 +45,7 @@ const D = {
|
|
|
45
45
|
mutable: "mutable",
|
|
46
46
|
immutable: "immutable"
|
|
47
47
|
}, jn = {};
|
|
48
|
-
function
|
|
48
|
+
function Ze(t, e) {
|
|
49
49
|
return t instanceof Map ? t.has(e) : Object.prototype.hasOwnProperty.call(t, e);
|
|
50
50
|
}
|
|
51
51
|
function yr(t, e) {
|
|
@@ -92,7 +92,7 @@ function si(t, e = []) {
|
|
|
92
92
|
if (r !== null && (r == null ? void 0 : r.original) !== t.original)
|
|
93
93
|
return null;
|
|
94
94
|
const i = t.parent.type === 3, s = i ? Array.from(t.parent.setMap.keys()).indexOf(t.key) : t.key;
|
|
95
|
-
if (!(i && n.size > s ||
|
|
95
|
+
if (!(i && n.size > s || Ze(n, s)))
|
|
96
96
|
return null;
|
|
97
97
|
e.push(s);
|
|
98
98
|
}
|
|
@@ -196,15 +196,15 @@ function oi(t, e) {
|
|
|
196
196
|
function Q(t) {
|
|
197
197
|
t.copy || (t.copy = oi(t.original, t.options));
|
|
198
198
|
}
|
|
199
|
-
function
|
|
199
|
+
function Qe(t) {
|
|
200
200
|
if (!ue(t))
|
|
201
201
|
return Mn(t);
|
|
202
202
|
if (Array.isArray(t))
|
|
203
|
-
return t.map(
|
|
203
|
+
return t.map(Qe);
|
|
204
204
|
if (t instanceof Map) {
|
|
205
205
|
const n = Array.from(t.entries()).map(([r, i]) => [
|
|
206
206
|
r,
|
|
207
|
-
|
|
207
|
+
Qe(i)
|
|
208
208
|
]);
|
|
209
209
|
if (!Pn(t)) {
|
|
210
210
|
const r = Object.getPrototypeOf(t).constructor;
|
|
@@ -213,7 +213,7 @@ function Ge(t) {
|
|
|
213
213
|
return new Map(n);
|
|
214
214
|
}
|
|
215
215
|
if (t instanceof Set) {
|
|
216
|
-
const n = Array.from(t).map(
|
|
216
|
+
const n = Array.from(t).map(Qe);
|
|
217
217
|
if (!In(t)) {
|
|
218
218
|
const r = Object.getPrototypeOf(t).constructor;
|
|
219
219
|
return new r(n);
|
|
@@ -222,11 +222,11 @@ function Ge(t) {
|
|
|
222
222
|
}
|
|
223
223
|
const e = Object.create(Object.getPrototypeOf(t));
|
|
224
224
|
for (const n in t)
|
|
225
|
-
e[n] =
|
|
225
|
+
e[n] = Qe(t[n]);
|
|
226
226
|
return e;
|
|
227
227
|
}
|
|
228
228
|
function _t(t) {
|
|
229
|
-
return Oe(t) ?
|
|
229
|
+
return Oe(t) ? Qe(t) : t;
|
|
230
230
|
}
|
|
231
231
|
function de(t) {
|
|
232
232
|
var e;
|
|
@@ -394,7 +394,7 @@ function As(t, e, n, r, i) {
|
|
|
394
394
|
}
|
|
395
395
|
function Cs({ original: t, copy: e, assignedMap: n }, r, i, s, o) {
|
|
396
396
|
n.forEach((u, a) => {
|
|
397
|
-
const d = pe(t, a), c = _t(pe(e, a)), f = u ?
|
|
397
|
+
const d = pe(t, a), c = _t(pe(e, a)), f = u ? Ze(t, a) ? D.Replace : D.Add : D.Remove;
|
|
398
398
|
if (he(d, c) && f === D.Replace)
|
|
399
399
|
return;
|
|
400
400
|
const h = r.concat(a), p = me(h, o);
|
|
@@ -669,7 +669,7 @@ const Is = Reflect.ownKeys(Ot), ai = /* @__PURE__ */ new WeakSet(), ci = {
|
|
|
669
669
|
if (d)
|
|
670
670
|
return d.bind(t.proxy);
|
|
671
671
|
}
|
|
672
|
-
if (!
|
|
672
|
+
if (!Ze(u, e)) {
|
|
673
673
|
const d = yr(u, e);
|
|
674
674
|
return d ? "value" in d ? d.value : (
|
|
675
675
|
// !case: support for getter
|
|
@@ -705,7 +705,7 @@ const Is = Reflect.ownKeys(Ot), ai = /* @__PURE__ */ new WeakSet(), ci = {
|
|
|
705
705
|
if (s != null && s.set)
|
|
706
706
|
return s.set.call(t.proxy, n), !0;
|
|
707
707
|
const o = qt(te(t), e), u = C(o);
|
|
708
|
-
return u && he(u.original, n) ? (t.copy[e] = n, t.assignedMap = (r = t.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), t.assignedMap.set(e, !1), !0) : (he(n, o) && (n !== void 0 ||
|
|
708
|
+
return u && he(u.original, n) ? (t.copy[e] = n, t.assignedMap = (r = t.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), t.assignedMap.set(e, !1), !0) : (he(n, o) && (n !== void 0 || Ze(t.original, e)) || (Q(t), de(t), Ze(t.original, e) && he(n, t.original[e]) ? t.assignedMap.delete(e) : t.assignedMap.set(e, !0), t.copy[e] = n, $n(t, e, n, nt)), !0);
|
|
709
709
|
},
|
|
710
710
|
has(t, e) {
|
|
711
711
|
return e in te(t);
|
|
@@ -909,12 +909,12 @@ const Rs = (t) => function e(n, r, i) {
|
|
|
909
909
|
throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");
|
|
910
910
|
const B = v == null ? void 0 : v[ms];
|
|
911
911
|
if (B) {
|
|
912
|
-
const
|
|
912
|
+
const Ve = B[0];
|
|
913
913
|
return _.strict && typeof v == "object" && v !== null && rn({
|
|
914
914
|
rootDraft: M,
|
|
915
915
|
value: v,
|
|
916
916
|
useRawReturn: !0
|
|
917
|
-
}), w([
|
|
917
|
+
}), w([Ve]);
|
|
918
918
|
}
|
|
919
919
|
if (v !== void 0)
|
|
920
920
|
return typeof v == "object" && v !== null && rn({ rootDraft: M, value: v }), w([v]);
|
|
@@ -945,7 +945,7 @@ function gt(t, e) {
|
|
|
945
945
|
return typeof t != "object" || typeof e != "object" || t === null || e === null ? t === e : fi(t, e) ? Object.keys(t).every((n) => gt(t[n], e[n])) : !1;
|
|
946
946
|
}
|
|
947
947
|
function Dn(t) {
|
|
948
|
-
if (!
|
|
948
|
+
if (!He(t))
|
|
949
949
|
return t;
|
|
950
950
|
const e = {};
|
|
951
951
|
for (const [n, r] of Object.entries(t))
|
|
@@ -953,7 +953,7 @@ function Dn(t) {
|
|
|
953
953
|
return e;
|
|
954
954
|
}
|
|
955
955
|
function li(t, e) {
|
|
956
|
-
if (!
|
|
956
|
+
if (!He(t) || !He(e))
|
|
957
957
|
return e;
|
|
958
958
|
const n = Object.assign({}, t);
|
|
959
959
|
for (const r of Object.keys(e)) {
|
|
@@ -963,12 +963,12 @@ function li(t, e) {
|
|
|
963
963
|
delete n[r];
|
|
964
964
|
continue;
|
|
965
965
|
}
|
|
966
|
-
const i =
|
|
966
|
+
const i = He(t[r]) && He(e[r]);
|
|
967
967
|
n[r] = i ? li(t[r], e[r]) : e[r];
|
|
968
968
|
}
|
|
969
969
|
return n;
|
|
970
970
|
}
|
|
971
|
-
function
|
|
971
|
+
function He(t) {
|
|
972
972
|
return typeof t == "object" && t !== null && !Array.isArray(t);
|
|
973
973
|
}
|
|
974
974
|
function $s(t, e, n) {
|
|
@@ -1331,7 +1331,7 @@ function Un(t) {
|
|
|
1331
1331
|
function Ln(t) {
|
|
1332
1332
|
return t["value-type"] === "blob";
|
|
1333
1333
|
}
|
|
1334
|
-
function
|
|
1334
|
+
function Ne(t, e) {
|
|
1335
1335
|
return t[e];
|
|
1336
1336
|
}
|
|
1337
1337
|
function it(t, e) {
|
|
@@ -1362,7 +1362,7 @@ function pi(t, e, n) {
|
|
|
1362
1362
|
const r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
|
|
1363
1363
|
for (const o of e) {
|
|
1364
1364
|
let [u, a, d, c] = o;
|
|
1365
|
-
const f =
|
|
1365
|
+
const f = Ne(t, a);
|
|
1366
1366
|
if (!f) {
|
|
1367
1367
|
console.warn("no such attr", u, t);
|
|
1368
1368
|
continue;
|
|
@@ -1436,7 +1436,7 @@ function gi(t, e) {
|
|
|
1436
1436
|
const n = st(t, e);
|
|
1437
1437
|
if (!n)
|
|
1438
1438
|
return;
|
|
1439
|
-
const [r, i, s] = n, o =
|
|
1439
|
+
const [r, i, s] = n, o = Ne(t.attrs, i);
|
|
1440
1440
|
o && (oe(t.eav, [r, i, s]), oe(t.aev, [i, r, s]), Un(o) && oe(t.vae, [s, i, r]));
|
|
1441
1441
|
}
|
|
1442
1442
|
let eo = 0;
|
|
@@ -1452,7 +1452,7 @@ function wi(t, e) {
|
|
|
1452
1452
|
if (!r)
|
|
1453
1453
|
return;
|
|
1454
1454
|
let [i, s, o] = r;
|
|
1455
|
-
const u =
|
|
1455
|
+
const u = Ne(t.attrs, s);
|
|
1456
1456
|
if (!u)
|
|
1457
1457
|
return;
|
|
1458
1458
|
u["checked-data-type"] === "date" && t.useDateObjects && (o = kt(o));
|
|
@@ -1464,7 +1464,7 @@ function to(t, e) {
|
|
|
1464
1464
|
const r = st(t, e);
|
|
1465
1465
|
if (!r)
|
|
1466
1466
|
return;
|
|
1467
|
-
const [i, s, o] = r, u =
|
|
1467
|
+
const [i, s, o] = r, u = Ne(t.attrs, s);
|
|
1468
1468
|
if (!u)
|
|
1469
1469
|
return;
|
|
1470
1470
|
if (!Ln(u))
|
|
@@ -1671,7 +1671,7 @@ function ao(t, e, n) {
|
|
|
1671
1671
|
}
|
|
1672
1672
|
return i;
|
|
1673
1673
|
}
|
|
1674
|
-
function
|
|
1674
|
+
function De(t, e, n) {
|
|
1675
1675
|
var r;
|
|
1676
1676
|
return (r = t.attrIndexes.forwardIdents.get(e)) === null || r === void 0 ? void 0 : r.get(n);
|
|
1677
1677
|
}
|
|
@@ -1692,7 +1692,7 @@ function fo(t, e) {
|
|
|
1692
1692
|
if (!n)
|
|
1693
1693
|
return;
|
|
1694
1694
|
const [r, i, s] = n;
|
|
1695
|
-
if (
|
|
1695
|
+
if (Ne(t.attrs, i))
|
|
1696
1696
|
return it(t.eav, [r, i]);
|
|
1697
1697
|
}
|
|
1698
1698
|
function lo(t, e) {
|
|
@@ -1703,7 +1703,7 @@ function lo(t, e) {
|
|
|
1703
1703
|
if (a !== "create" && a !== "update")
|
|
1704
1704
|
return !0;
|
|
1705
1705
|
let d = !1;
|
|
1706
|
-
const c =
|
|
1706
|
+
const c = Ne(t.attrs, s);
|
|
1707
1707
|
if (c) {
|
|
1708
1708
|
const f = Oi(t, c["forward-identity"][1]);
|
|
1709
1709
|
d = !!fo(t, [i, f.id, i]);
|
|
@@ -1779,7 +1779,7 @@ function So(t, e, n) {
|
|
|
1779
1779
|
return uo(t, Nn(n, e));
|
|
1780
1780
|
}
|
|
1781
1781
|
const vo = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
|
|
1782
|
-
function
|
|
1782
|
+
function Ue(t) {
|
|
1783
1783
|
return typeof t == "string" && vo.test(t);
|
|
1784
1784
|
}
|
|
1785
1785
|
const V = [];
|
|
@@ -1844,13 +1844,13 @@ function Mo() {
|
|
|
1844
1844
|
}
|
|
1845
1845
|
const Ro = Mo();
|
|
1846
1846
|
let $o = 0;
|
|
1847
|
-
function
|
|
1847
|
+
function Xe(t) {
|
|
1848
1848
|
return jt(`_${t}`, $o++);
|
|
1849
1849
|
}
|
|
1850
1850
|
function jt(t, e) {
|
|
1851
1851
|
return `?${t}-${e}`;
|
|
1852
1852
|
}
|
|
1853
|
-
class
|
|
1853
|
+
class Le extends Error {
|
|
1854
1854
|
constructor(e) {
|
|
1855
1855
|
super(e), this.name = "AttrNotFoundError";
|
|
1856
1856
|
}
|
|
@@ -1858,7 +1858,7 @@ class Ue extends Error {
|
|
|
1858
1858
|
function xo(t, e) {
|
|
1859
1859
|
const n = Oi(t, e);
|
|
1860
1860
|
if (!n)
|
|
1861
|
-
throw new
|
|
1861
|
+
throw new Le(`Could not find id attr for ${e}`);
|
|
1862
1862
|
return n;
|
|
1863
1863
|
}
|
|
1864
1864
|
function Er(t, e, n, r) {
|
|
@@ -1876,21 +1876,21 @@ function Uo(t, e, n) {
|
|
|
1876
1876
|
return t.map((r) => r === e ? n : r);
|
|
1877
1877
|
}
|
|
1878
1878
|
function Ai(t, e, n, r, i) {
|
|
1879
|
-
const s =
|
|
1879
|
+
const s = De(e, n, i), o = vi(e, n, i), u = s || o;
|
|
1880
1880
|
if (!u)
|
|
1881
|
-
throw new
|
|
1881
|
+
throw new Le(`Could not find attr for ${[n, i]}`);
|
|
1882
1882
|
if (u["value-type"] !== "ref")
|
|
1883
1883
|
throw new Error(`Attr ${u.id} is not a ref`);
|
|
1884
1884
|
const [a, d] = u["forward-identity"], [c, f] = u["reverse-identity"], h = r + 1, p = s ? [
|
|
1885
1885
|
t(d, r),
|
|
1886
1886
|
u.id,
|
|
1887
1887
|
t(f, h),
|
|
1888
|
-
|
|
1888
|
+
Xe("time")
|
|
1889
1889
|
] : [
|
|
1890
1890
|
t(d, h),
|
|
1891
1891
|
u.id,
|
|
1892
1892
|
t(f, r),
|
|
1893
|
-
|
|
1893
|
+
Xe("time")
|
|
1894
1894
|
];
|
|
1895
1895
|
return [s ? f : d, h, p, u, !!s];
|
|
1896
1896
|
}
|
|
@@ -1965,26 +1965,26 @@ function Lo(t, e) {
|
|
|
1965
1965
|
return e;
|
|
1966
1966
|
}
|
|
1967
1967
|
function Fo(t, e, n, r, i, s) {
|
|
1968
|
-
const o =
|
|
1968
|
+
const o = De(e, n, i), u = vi(e, n, i), a = o || u;
|
|
1969
1969
|
if (!a)
|
|
1970
|
-
throw new
|
|
1970
|
+
throw new Le(`No attr for etype = ${n} label = ${i}`);
|
|
1971
1971
|
if (s != null && s.hasOwnProperty("$isNull")) {
|
|
1972
|
-
const d =
|
|
1972
|
+
const d = De(e, n, "id");
|
|
1973
1973
|
if (!d)
|
|
1974
|
-
throw new
|
|
1974
|
+
throw new Le(`No attr for etype = ${n} label = id`);
|
|
1975
1975
|
return [
|
|
1976
1976
|
t(n, r),
|
|
1977
1977
|
d.id,
|
|
1978
1978
|
{ $isNull: { attrId: a.id, isNull: s.$isNull, reverse: !o } },
|
|
1979
|
-
|
|
1979
|
+
Xe("time")
|
|
1980
1980
|
];
|
|
1981
1981
|
}
|
|
1982
1982
|
return o ? [
|
|
1983
1983
|
t(n, r),
|
|
1984
1984
|
a.id,
|
|
1985
1985
|
Lo(a, s),
|
|
1986
|
-
|
|
1987
|
-
] : [s, a.id, t(n, r),
|
|
1986
|
+
Xe("time")
|
|
1987
|
+
] : [s, a.id, t(n, r), Xe("time")];
|
|
1988
1988
|
}
|
|
1989
1989
|
function No(t, e, n, r, i) {
|
|
1990
1990
|
const [s, o, u] = i.reduce((a, d) => {
|
|
@@ -2084,7 +2084,7 @@ function Ho(t, e, { etype: n, level: r, form: i }, s) {
|
|
|
2084
2084
|
}), v = _ ? j[0] : j;
|
|
2085
2085
|
return { [h]: v };
|
|
2086
2086
|
} catch (T) {
|
|
2087
|
-
if (T instanceof
|
|
2087
|
+
if (T instanceof Le)
|
|
2088
2088
|
return { [h]: _ ? void 0 : [] };
|
|
2089
2089
|
throw T;
|
|
2090
2090
|
}
|
|
@@ -2116,7 +2116,7 @@ function Zo(t, e) {
|
|
|
2116
2116
|
}
|
|
2117
2117
|
function Xo(t, e, n) {
|
|
2118
2118
|
const r = Object.keys(n)[0];
|
|
2119
|
-
return
|
|
2119
|
+
return De(t, e, r);
|
|
2120
2120
|
}
|
|
2121
2121
|
function eu(t, e, n, r) {
|
|
2122
2122
|
if (n)
|
|
@@ -2130,11 +2130,11 @@ function tu(t, e, n) {
|
|
|
2130
2130
|
return co(t, e);
|
|
2131
2131
|
const s = /* @__PURE__ */ new Map();
|
|
2132
2132
|
for (const o of n.fields) {
|
|
2133
|
-
const u =
|
|
2133
|
+
const u = De(t, e, o), a = (r = u == null ? void 0 : u["forward-identity"]) === null || r === void 0 ? void 0 : r[2];
|
|
2134
2134
|
a && Ln(u) && s.set(a, u);
|
|
2135
2135
|
}
|
|
2136
2136
|
if (!s.has("id")) {
|
|
2137
|
-
const o =
|
|
2137
|
+
const o = De(t, e, "id"), u = (i = o == null ? void 0 : o["forward-identity"]) === null || i === void 0 ? void 0 : i[2];
|
|
2138
2138
|
u && s.set(u, o);
|
|
2139
2139
|
}
|
|
2140
2140
|
return s;
|
|
@@ -2199,7 +2199,7 @@ function su(t, e) {
|
|
|
2199
2199
|
try {
|
|
2200
2200
|
return iu(t, e);
|
|
2201
2201
|
} catch (n) {
|
|
2202
|
-
if (n instanceof
|
|
2202
|
+
if (n instanceof Le)
|
|
2203
2203
|
return {};
|
|
2204
2204
|
throw n;
|
|
2205
2205
|
}
|
|
@@ -2316,7 +2316,7 @@ function fu(t, e) {
|
|
|
2316
2316
|
}
|
|
2317
2317
|
return i;
|
|
2318
2318
|
}
|
|
2319
|
-
function
|
|
2319
|
+
function K(t, e, n) {
|
|
2320
2320
|
return Object.values(t).find((r) => {
|
|
2321
2321
|
const [i, s, o] = r["forward-identity"];
|
|
2322
2322
|
return s === e && o === n;
|
|
@@ -2342,7 +2342,7 @@ function lu(t) {
|
|
|
2342
2342
|
function ln(t, e, n) {
|
|
2343
2343
|
return n.indexOf(".") !== -1 && // attr names can have `.` in them, so use the attr we find with a `.`
|
|
2344
2344
|
// before assuming it's a ref lookup.
|
|
2345
|
-
!
|
|
2345
|
+
!K(t, e, n);
|
|
2346
2346
|
}
|
|
2347
2347
|
function hn(t) {
|
|
2348
2348
|
const [e, n, ...r] = t.split(".");
|
|
@@ -2352,8 +2352,8 @@ function hn(t) {
|
|
|
2352
2352
|
}
|
|
2353
2353
|
function hu(t, e, n) {
|
|
2354
2354
|
if (!ln(t, e, n))
|
|
2355
|
-
return
|
|
2356
|
-
const r = hn(n), i =
|
|
2355
|
+
return K(t, e, n);
|
|
2356
|
+
const r = hn(n), i = K(t, e, r) || Se(t, e, r);
|
|
2357
2357
|
if (i && i["value-type"] !== "ref")
|
|
2358
2358
|
throw new Error(`${n} does not reference a valid link attribute.`);
|
|
2359
2359
|
return i;
|
|
@@ -2375,13 +2375,13 @@ function Mi(t, e, n, r) {
|
|
|
2375
2375
|
return Array.isArray(i) ? [[
|
|
2376
2376
|
"add-triple",
|
|
2377
2377
|
i,
|
|
2378
|
-
|
|
2378
|
+
K(t, e, "id").id,
|
|
2379
2379
|
i
|
|
2380
2380
|
]].concat(r) : r;
|
|
2381
2381
|
}
|
|
2382
2382
|
function pu({ attrs: t }, [e, n, r]) {
|
|
2383
2383
|
const i = Object.entries(r).flatMap(([s, o]) => {
|
|
2384
|
-
const u = Array.isArray(o) ? o : [o], a =
|
|
2384
|
+
const u = Array.isArray(o) ? o : [o], a = K(t, e, s), d = Se(t, e, s);
|
|
2385
2385
|
return u.map((c) => a ? [
|
|
2386
2386
|
"add-triple",
|
|
2387
2387
|
ee(t, e, n),
|
|
@@ -2398,7 +2398,7 @@ function pu({ attrs: t }, [e, n, r]) {
|
|
|
2398
2398
|
}
|
|
2399
2399
|
function yu({ attrs: t }, [e, n, r]) {
|
|
2400
2400
|
const i = Object.entries(r).flatMap(([s, o]) => {
|
|
2401
|
-
const u = Array.isArray(o) ? o : [o], a =
|
|
2401
|
+
const u = Array.isArray(o) ? o : [o], a = K(t, e, s), d = Se(t, e, s);
|
|
2402
2402
|
return u.map((c) => a ? [
|
|
2403
2403
|
"retract-triple",
|
|
2404
2404
|
ee(t, e, n),
|
|
@@ -2441,14 +2441,14 @@ function Ri({ stores: t, attrs: e }, [n, r, i, s]) {
|
|
|
2441
2441
|
function _u(t, e) {
|
|
2442
2442
|
const { stores: n, attrs: r } = t, [i, s, o, u] = e, a = Dn(o), d = ee(r, i, s);
|
|
2443
2443
|
return [["id", d]].concat(Object.entries(a)).map(([f, h]) => {
|
|
2444
|
-
const p =
|
|
2444
|
+
const p = K(r, i, f);
|
|
2445
2445
|
return p["checked-data-type"] === "date" && t.useDateObjects && (h = kt(h)), ["add-triple", d, p.id, h, { mode: "create" }];
|
|
2446
2446
|
});
|
|
2447
2447
|
}
|
|
2448
2448
|
function gu(t, e) {
|
|
2449
2449
|
const { stores: n, attrs: r } = t, [i, s, o, u] = e, a = Dn(o), d = ee(r, i, s), c = Ri(t, [i, d, o, u]);
|
|
2450
2450
|
return [["id", d]].concat(Object.entries(a)).map(([h, p]) => {
|
|
2451
|
-
const b =
|
|
2451
|
+
const b = K(r, i, h);
|
|
2452
2452
|
return b["checked-data-type"] === "date" && t.useDateObjects && (p = kt(p)), [
|
|
2453
2453
|
"add-triple",
|
|
2454
2454
|
d,
|
|
@@ -2463,7 +2463,7 @@ function Tu({ attrs: t }, [e, n]) {
|
|
|
2463
2463
|
}
|
|
2464
2464
|
function wu(t, e) {
|
|
2465
2465
|
const { stores: n, attrs: r } = t, [i, s, o, u] = e, a = Dn(o), d = ee(r, i, s), c = Ri(t, [i, d, o, u]), f = Object.entries(a).map(([p, b]) => {
|
|
2466
|
-
const y =
|
|
2466
|
+
const y = K(r, i, p);
|
|
2467
2467
|
return [
|
|
2468
2468
|
"deep-merge-triple",
|
|
2469
2469
|
d,
|
|
@@ -2475,7 +2475,7 @@ function wu(t, e) {
|
|
|
2475
2475
|
return [[
|
|
2476
2476
|
"add-triple",
|
|
2477
2477
|
d,
|
|
2478
|
-
|
|
2478
|
+
K(r, i, "id").id,
|
|
2479
2479
|
d,
|
|
2480
2480
|
...c ? [c] : []
|
|
2481
2481
|
]].concat(f);
|
|
@@ -2599,7 +2599,7 @@ function $u({ attrs: t, schema: e }, n) {
|
|
|
2599
2599
|
f != null && f.isUnsynced && !s.has(f.id) && (u.push(["add-attr", f]), s.add(f.id));
|
|
2600
2600
|
}
|
|
2601
2601
|
function c(f, h) {
|
|
2602
|
-
const p =
|
|
2602
|
+
const p = K(o, f, h), b = Se(o, f, h);
|
|
2603
2603
|
d(p), d(b), !p && !b && a(jr(e, f, h, Mu));
|
|
2604
2604
|
}
|
|
2605
2605
|
for (const f of n)
|
|
@@ -2607,29 +2607,29 @@ function $u({ attrs: t, schema: e }, n) {
|
|
|
2607
2607
|
const y = p[0];
|
|
2608
2608
|
if (b) {
|
|
2609
2609
|
c(h, b);
|
|
2610
|
-
const _ =
|
|
2610
|
+
const _ = K(o, h, b), T = Se(o, h, b);
|
|
2611
2611
|
d(_), d(T);
|
|
2612
2612
|
const w = ((r = _ == null ? void 0 : _["reverse-identity"]) === null || r === void 0 ? void 0 : r[1]) || ((i = T == null ? void 0 : T["forward-identity"]) === null || i === void 0 ? void 0 : i[1]) || b;
|
|
2613
2613
|
if (ln(o, w, y))
|
|
2614
2614
|
c(w, hn(y));
|
|
2615
2615
|
else {
|
|
2616
|
-
const m =
|
|
2616
|
+
const m = K(o, w, y);
|
|
2617
2617
|
m || a(pt(e, w, y, yn)), d(m);
|
|
2618
2618
|
}
|
|
2619
2619
|
} else if (ln(o, h, y))
|
|
2620
2620
|
c(h, hn(y));
|
|
2621
2621
|
else {
|
|
2622
|
-
const _ =
|
|
2622
|
+
const _ = K(o, h, y);
|
|
2623
2623
|
_ || a(pt(e, h, y, yn)), d(_);
|
|
2624
2624
|
}
|
|
2625
2625
|
}
|
|
2626
2626
|
for (const f of n) {
|
|
2627
2627
|
const [h, p, b, y] = f;
|
|
2628
2628
|
if (ku.has(h)) {
|
|
2629
|
-
const _ =
|
|
2629
|
+
const _ = K(o, p, "id");
|
|
2630
2630
|
d(_), _ || a(pt(e, p, "id", { "unique?": !0 }));
|
|
2631
2631
|
for (const T of Object.keys(y)) {
|
|
2632
|
-
const w =
|
|
2632
|
+
const w = K(o, p, T);
|
|
2633
2633
|
if (d(w), Iu.has(h) && (w || a(pt(e, p, T, T === "id" ? { "unique?": !0 } : null))), ju.has(h)) {
|
|
2634
2634
|
const m = Se(o, p, T);
|
|
2635
2635
|
!w && !m && a(jr(e, p, T)), d(m);
|
|
@@ -2758,11 +2758,11 @@ class xi {
|
|
|
2758
2758
|
};
|
|
2759
2759
|
}
|
|
2760
2760
|
}
|
|
2761
|
-
class
|
|
2761
|
+
class Fe extends Error {
|
|
2762
2762
|
constructor(e, n) {
|
|
2763
2763
|
super(e), this.hint = n;
|
|
2764
2764
|
const r = new.target.prototype;
|
|
2765
|
-
Object.setPrototypeOf && Object.setPrototypeOf(this, r), Error.captureStackTrace && Error.captureStackTrace(this,
|
|
2765
|
+
Object.setPrototypeOf && Object.setPrototypeOf(this, r), Error.captureStackTrace && Error.captureStackTrace(this, Fe), this.name = "InstantError";
|
|
2766
2766
|
}
|
|
2767
2767
|
get [Symbol.toStringTag]() {
|
|
2768
2768
|
return "InstantError";
|
|
@@ -2795,7 +2795,7 @@ var Uu = function(t, e, n, r) {
|
|
|
2795
2795
|
d((r = r.apply(t, e || [])).next());
|
|
2796
2796
|
});
|
|
2797
2797
|
};
|
|
2798
|
-
class It extends
|
|
2798
|
+
class It extends Fe {
|
|
2799
2799
|
constructor(e) {
|
|
2800
2800
|
var n;
|
|
2801
2801
|
const r = ((n = e.body) === null || n === void 0 ? void 0 : n.message) || `API Error (${e.status})`;
|
|
@@ -2813,7 +2813,7 @@ function ae(t, e) {
|
|
|
2813
2813
|
return n.status === 200 ? Promise.resolve(r) : Promise.reject(new It({ status: n.status, body: r }));
|
|
2814
2814
|
});
|
|
2815
2815
|
}
|
|
2816
|
-
var
|
|
2816
|
+
var We = function(t, e, n, r) {
|
|
2817
2817
|
function i(s) {
|
|
2818
2818
|
return s instanceof n ? s : new n(function(o) {
|
|
2819
2819
|
o(s);
|
|
@@ -2848,7 +2848,7 @@ function Lu({ apiURI: t, appId: e, email: n }) {
|
|
|
2848
2848
|
});
|
|
2849
2849
|
}
|
|
2850
2850
|
function Fu(t) {
|
|
2851
|
-
return
|
|
2851
|
+
return We(this, arguments, void 0, function* ({ apiURI: e, appId: n, email: r, code: i, refreshToken: s }) {
|
|
2852
2852
|
return yield ae(`${e}/runtime/auth/verify_magic_code`, {
|
|
2853
2853
|
method: "POST",
|
|
2854
2854
|
headers: { "content-type": "application/json" },
|
|
@@ -2861,7 +2861,7 @@ function Fu(t) {
|
|
|
2861
2861
|
});
|
|
2862
2862
|
}
|
|
2863
2863
|
function Nu(t) {
|
|
2864
|
-
return
|
|
2864
|
+
return We(this, arguments, void 0, function* ({ apiURI: e, appId: n, refreshToken: r }) {
|
|
2865
2865
|
return yield ae(`${e}/runtime/auth/verify_refresh_token`, {
|
|
2866
2866
|
method: "POST",
|
|
2867
2867
|
headers: { "content-type": "application/json" },
|
|
@@ -2873,7 +2873,7 @@ function Nu(t) {
|
|
|
2873
2873
|
});
|
|
2874
2874
|
}
|
|
2875
2875
|
function Wu(t) {
|
|
2876
|
-
return
|
|
2876
|
+
return We(this, arguments, void 0, function* ({ apiURI: e, appId: n }) {
|
|
2877
2877
|
return yield ae(`${e}/runtime/auth/sign_in_guest`, {
|
|
2878
2878
|
method: "POST",
|
|
2879
2879
|
headers: { "content-type": "application/json" },
|
|
@@ -2884,7 +2884,7 @@ function Wu(t) {
|
|
|
2884
2884
|
});
|
|
2885
2885
|
}
|
|
2886
2886
|
function Pr(t) {
|
|
2887
|
-
return
|
|
2887
|
+
return We(this, arguments, void 0, function* ({ apiURI: e, appId: n, code: r, codeVerifier: i, refreshToken: s }) {
|
|
2888
2888
|
return yield ae(`${e}/runtime/oauth/token`, {
|
|
2889
2889
|
method: "POST",
|
|
2890
2890
|
headers: { "content-type": "application/json" },
|
|
@@ -2898,7 +2898,7 @@ function Pr(t) {
|
|
|
2898
2898
|
});
|
|
2899
2899
|
}
|
|
2900
2900
|
function Vu(t) {
|
|
2901
|
-
return
|
|
2901
|
+
return We(this, arguments, void 0, function* ({ apiURI: e, appId: n, nonce: r, idToken: i, clientName: s, refreshToken: o }) {
|
|
2902
2902
|
return yield ae(`${e}/runtime/oauth/id_token`, {
|
|
2903
2903
|
method: "POST",
|
|
2904
2904
|
headers: { "content-type": "application/json" },
|
|
@@ -2913,7 +2913,7 @@ function Vu(t) {
|
|
|
2913
2913
|
});
|
|
2914
2914
|
}
|
|
2915
2915
|
function qu(t) {
|
|
2916
|
-
return
|
|
2916
|
+
return We(this, arguments, void 0, function* ({ apiURI: e, appId: n, refreshToken: r }) {
|
|
2917
2917
|
return yield ae(`${e}/runtime/signout`, {
|
|
2918
2918
|
method: "POST",
|
|
2919
2919
|
headers: {
|
|
@@ -3068,7 +3068,7 @@ class Rr {
|
|
|
3068
3068
|
this._reject(e);
|
|
3069
3069
|
}
|
|
3070
3070
|
}
|
|
3071
|
-
var
|
|
3071
|
+
var Ke = function(t, e, n, r) {
|
|
3072
3072
|
function i(s) {
|
|
3073
3073
|
return s instanceof n ? s : new n(function(o) {
|
|
3074
3074
|
o(s);
|
|
@@ -3103,7 +3103,7 @@ class bn {
|
|
|
3103
3103
|
this._subs = [], this._nextSave = null, this._persister = e, this._key = n, this._onMerge = i, this._loadedCbs = [], this._isLoading = !0, this.currentValue = r, this.serialize = s, this.parse = o, this._saveThrottleMs = u, this._pendingSaveCbs = [], this._version = 0, this._idleCallbackMaxWaitMs = a, this._load();
|
|
3104
3104
|
}
|
|
3105
3105
|
_getFromStorage() {
|
|
3106
|
-
return
|
|
3106
|
+
return Ke(this, void 0, void 0, function* () {
|
|
3107
3107
|
try {
|
|
3108
3108
|
return this.parse(yield this._persister.getItem(this._key));
|
|
3109
3109
|
} catch (e) {
|
|
@@ -3112,7 +3112,7 @@ class bn {
|
|
|
3112
3112
|
});
|
|
3113
3113
|
}
|
|
3114
3114
|
_load() {
|
|
3115
|
-
return
|
|
3115
|
+
return Ke(this, void 0, void 0, function* () {
|
|
3116
3116
|
const e = yield this._getFromStorage();
|
|
3117
3117
|
this._isLoading = !1;
|
|
3118
3118
|
const n = this._onMerge(e, this.currentValue);
|
|
@@ -3122,7 +3122,7 @@ class bn {
|
|
|
3122
3122
|
});
|
|
3123
3123
|
}
|
|
3124
3124
|
waitForLoaded() {
|
|
3125
|
-
return
|
|
3125
|
+
return Ke(this, void 0, void 0, function* () {
|
|
3126
3126
|
if (!this._isLoading)
|
|
3127
3127
|
return;
|
|
3128
3128
|
yield new Promise((n) => {
|
|
@@ -3137,7 +3137,7 @@ class bn {
|
|
|
3137
3137
|
return this._version;
|
|
3138
3138
|
}
|
|
3139
3139
|
waitForSync() {
|
|
3140
|
-
return
|
|
3140
|
+
return Ke(this, void 0, void 0, function* () {
|
|
3141
3141
|
if (!this._nextSave)
|
|
3142
3142
|
return;
|
|
3143
3143
|
yield new Promise((n) => {
|
|
@@ -3152,7 +3152,7 @@ class bn {
|
|
|
3152
3152
|
this._pendingSaveCbs.length = 0;
|
|
3153
3153
|
}
|
|
3154
3154
|
flush() {
|
|
3155
|
-
return
|
|
3155
|
+
return Ke(this, void 0, void 0, function* () {
|
|
3156
3156
|
this._nextSave && (clearTimeout(this._nextSave), this._writeToStorage());
|
|
3157
3157
|
});
|
|
3158
3158
|
}
|
|
@@ -3206,7 +3206,7 @@ function xr(t) {
|
|
|
3206
3206
|
}, e;
|
|
3207
3207
|
}, {});
|
|
3208
3208
|
}
|
|
3209
|
-
const qn = "v0.22.47-experimental.sync-table.
|
|
3209
|
+
const qn = "v0.22.47-experimental.sync-table.19154203588.1";
|
|
3210
3210
|
function Zu(t, e) {
|
|
3211
3211
|
return {
|
|
3212
3212
|
info: t ? (...n) => console.info(...n, e()) : () => {
|
|
@@ -3338,7 +3338,7 @@ const Dr = [
|
|
|
3338
3338
|
default:
|
|
3339
3339
|
throw new R(`Unknown operator '${t}' for attribute '${r}' in entity '${i}'`, o);
|
|
3340
3340
|
}
|
|
3341
|
-
},
|
|
3341
|
+
}, $e = (t, e, n, r, i) => {
|
|
3342
3342
|
const s = Xu(n), o = n.valueType === "json";
|
|
3343
3343
|
if (typeof t == "object" && t !== null && !Array.isArray(t)) {
|
|
3344
3344
|
if (o)
|
|
@@ -3368,23 +3368,23 @@ const Dr = [
|
|
|
3368
3368
|
if (!a)
|
|
3369
3369
|
throw new R(`Target entity '${o}' does not exist in schema for dot notation path '${t}'.`, i);
|
|
3370
3370
|
if (u === "id") {
|
|
3371
|
-
if (typeof e == "string" && !
|
|
3371
|
+
if (typeof e == "string" && !Ue(e))
|
|
3372
3372
|
throw new R(`Invalid value for id field in entity '${o}'. Expected a UUID, but received: ${e}`, i);
|
|
3373
|
-
|
|
3373
|
+
$e(e, t, new H("string", !1, !0), n, i);
|
|
3374
3374
|
return;
|
|
3375
3375
|
}
|
|
3376
3376
|
const d = a.attrs[u];
|
|
3377
3377
|
if (Object.keys(a.links).includes(u)) {
|
|
3378
|
-
if (typeof e == "string" && !
|
|
3378
|
+
if (typeof e == "string" && !Ue(e))
|
|
3379
3379
|
throw new R(`Invalid value for link '${u}' in entity '${o}'. Expected a UUID, but received: ${e}`, i);
|
|
3380
|
-
|
|
3380
|
+
$e(e, t, new H("string", !1, !0), n, i);
|
|
3381
3381
|
return;
|
|
3382
3382
|
}
|
|
3383
3383
|
if (!d) {
|
|
3384
3384
|
const c = Object.keys(a.attrs);
|
|
3385
3385
|
throw new R(`Attribute '${u}' does not exist on entity '${o}' in dot notation path '${t}'. Available attributes: ${c.length > 0 ? c.join(", ") + ", id" : "id"}`, i);
|
|
3386
3386
|
}
|
|
3387
|
-
|
|
3387
|
+
$e(e, t, d, n, i);
|
|
3388
3388
|
}, Ni = (t, e, n, r) => {
|
|
3389
3389
|
for (const [i, s] of Object.entries(t)) {
|
|
3390
3390
|
if (i === "or" || i === "and") {
|
|
@@ -3394,7 +3394,7 @@ const Dr = [
|
|
|
3394
3394
|
continue;
|
|
3395
3395
|
}
|
|
3396
3396
|
if (i === "id") {
|
|
3397
|
-
|
|
3397
|
+
$e(s, "id", new H("string", !1, !0), e, `${r}.id`);
|
|
3398
3398
|
continue;
|
|
3399
3399
|
}
|
|
3400
3400
|
if (i.includes(".")) {
|
|
@@ -3410,12 +3410,12 @@ const Dr = [
|
|
|
3410
3410
|
throw new R(`Attribute or link '${i}' does not exist on entity '${e}'. Available attributes: ${d.length > 0 ? d.join(", ") : "none"}. Available links: ${c.length > 0 ? c.join(", ") : "none"}`, `${r}.${i}`);
|
|
3411
3411
|
}
|
|
3412
3412
|
if (u)
|
|
3413
|
-
|
|
3413
|
+
$e(s, i, u, e, `${r}.${i}`);
|
|
3414
3414
|
else if (a) {
|
|
3415
|
-
if (typeof s == "string" && !
|
|
3415
|
+
if (typeof s == "string" && !Ue(s))
|
|
3416
3416
|
throw new R(`Invalid value for link '${i}' in entity '${e}'. Expected a UUID, but received: ${s}`, `${r}.${i}`);
|
|
3417
3417
|
const d = new H("string", !1, !0);
|
|
3418
|
-
|
|
3418
|
+
$e(s, i, d, e, `${r}.${i}`);
|
|
3419
3419
|
}
|
|
3420
3420
|
}
|
|
3421
3421
|
}, na = (t, e, n, r, i = 0) => {
|
|
@@ -3478,7 +3478,7 @@ const Dr = [
|
|
|
3478
3478
|
Wi(n[r], r, e, r, 0);
|
|
3479
3479
|
}
|
|
3480
3480
|
}
|
|
3481
|
-
}, Lr = (t) => typeof t != "string" ? !1 : At(t) ? !0 :
|
|
3481
|
+
}, Lr = (t) => typeof t != "string" ? !1 : At(t) ? !0 : Ue(t);
|
|
3482
3482
|
class ie extends Error {
|
|
3483
3483
|
constructor(e) {
|
|
3484
3484
|
super(e), this.name = "TransactionValidationError";
|
|
@@ -3539,7 +3539,7 @@ const Vi = (t) => t.length > 0 ? t.join(", ") : "none", ra = (t, e) => new ie(`E
|
|
|
3539
3539
|
if (!e)
|
|
3540
3540
|
return;
|
|
3541
3541
|
const [n, r, i, s] = t;
|
|
3542
|
-
if (!Array.isArray(i) && !
|
|
3542
|
+
if (!Array.isArray(i) && !Ue(i))
|
|
3543
3543
|
throw new ie(`Invalid id for entity '${r}'. Expected a UUID, but received: ${i}`);
|
|
3544
3544
|
if (typeof r != "string")
|
|
3545
3545
|
throw new ie(`Entity name must be a string, but received: ${typeof r}`);
|
|
@@ -3787,10 +3787,10 @@ function la(t, e) {
|
|
|
3787
3787
|
}
|
|
3788
3788
|
return o;
|
|
3789
3789
|
}
|
|
3790
|
-
var
|
|
3790
|
+
var Me;
|
|
3791
3791
|
(function(t) {
|
|
3792
|
-
t.InitialSyncBatch = "InitialSyncBatch", t.InitialSyncComplete = "InitialSyncComplete", t.LoadFromStorage = "LoadFromStorage", t.SyncTransaction = "SyncTransaction";
|
|
3793
|
-
})(
|
|
3792
|
+
t.InitialSyncBatch = "InitialSyncBatch", t.InitialSyncComplete = "InitialSyncComplete", t.LoadFromStorage = "LoadFromStorage", t.SyncTransaction = "SyncTransaction", t.Error = "Error";
|
|
3793
|
+
})(Me || (Me = {}));
|
|
3794
3794
|
class ha {
|
|
3795
3795
|
constructor(e, n, r, i, s) {
|
|
3796
3796
|
this.callbacks = {}, this.idToHash = {}, this.trySend = e, this.config = r, this.log = i, this.createStore = s, this.subs = new bn(n, "subs", {}, fa, da, (o) => ca(o, this.config.useDateObjects));
|
|
@@ -3799,17 +3799,18 @@ class ha {
|
|
|
3799
3799
|
this.subs.flush();
|
|
3800
3800
|
}
|
|
3801
3801
|
subscribe(e, n) {
|
|
3802
|
-
const r =
|
|
3803
|
-
return this.callbacks[r] = this.callbacks[r] || [], this.callbacks[r].push(n), this.initSubscription(e, r, n), () => {
|
|
3804
|
-
this.unsubscribe(r, n);
|
|
3802
|
+
const r = z(e);
|
|
3803
|
+
return this.callbacks[r] = this.callbacks[r] || [], this.callbacks[r].push(n), this.initSubscription(e, r, n), (i) => {
|
|
3804
|
+
this.unsubscribe(r, n, i);
|
|
3805
3805
|
};
|
|
3806
3806
|
}
|
|
3807
|
-
unsubscribe(e, n) {
|
|
3808
|
-
const
|
|
3809
|
-
if (this.callbacks[e] =
|
|
3810
|
-
delete this.callbacks[e]
|
|
3811
|
-
|
|
3812
|
-
|
|
3807
|
+
unsubscribe(e, n, r) {
|
|
3808
|
+
const i = (this.callbacks[e] || []).filter((s) => s !== n);
|
|
3809
|
+
if (this.callbacks[e] = i, !i.length) {
|
|
3810
|
+
if (delete this.callbacks[e], r)
|
|
3811
|
+
return;
|
|
3812
|
+
const s = this.subs.currentValue[e];
|
|
3813
|
+
s != null && s.state && this.clearSubscriptionData(s.state.subscriptionId), this.subs.set((o) => (delete o[e], o));
|
|
3813
3814
|
}
|
|
3814
3815
|
}
|
|
3815
3816
|
sendStart(e) {
|
|
@@ -3833,14 +3834,13 @@ class ha {
|
|
|
3833
3834
|
"subscription-id": e.subscriptionId
|
|
3834
3835
|
});
|
|
3835
3836
|
}
|
|
3836
|
-
// XXX: maybe not always cb?
|
|
3837
3837
|
initSubscription(e, n, r) {
|
|
3838
3838
|
return qr(this, void 0, void 0, function* () {
|
|
3839
3839
|
yield this.subs.waitForLoaded();
|
|
3840
3840
|
const i = this.subs.currentValue[n];
|
|
3841
3841
|
if (i && i.state && i.state.txId) {
|
|
3842
3842
|
this.sendResync(i, i.state), i.entities && r && r({
|
|
3843
|
-
type:
|
|
3843
|
+
type: Me.LoadFromStorage,
|
|
3844
3844
|
// XXX: Need to sort
|
|
3845
3845
|
data: i.entities.map((s) => s.entity)
|
|
3846
3846
|
});
|
|
@@ -3862,7 +3862,7 @@ class ha {
|
|
|
3862
3862
|
});
|
|
3863
3863
|
}
|
|
3864
3864
|
onStartSyncOk(e) {
|
|
3865
|
-
const n = e["subscription-id"], r = e.q, i =
|
|
3865
|
+
const n = e["subscription-id"], r = e.q, i = z(r);
|
|
3866
3866
|
this.idToHash[n] = i, this.subs.set((s) => {
|
|
3867
3867
|
const o = s[i];
|
|
3868
3868
|
return o ? (o.state = {
|
|
@@ -3895,7 +3895,7 @@ class ha {
|
|
|
3895
3895
|
return a;
|
|
3896
3896
|
})[i];
|
|
3897
3897
|
u.entities && this.notifyCbs(i, {
|
|
3898
|
-
type:
|
|
3898
|
+
type: Me.InitialSyncBatch,
|
|
3899
3899
|
data: u.entities.map((a) => a.entity),
|
|
3900
3900
|
batch: s
|
|
3901
3901
|
});
|
|
@@ -3973,7 +3973,7 @@ class ha {
|
|
|
3973
3973
|
for (const y of d.sort().reverse())
|
|
3974
3974
|
b.push(f[y].entity), f.splice(y, 1);
|
|
3975
3975
|
this.notifyCbs(r, {
|
|
3976
|
-
type:
|
|
3976
|
+
type: Me.SyncTransaction,
|
|
3977
3977
|
data: f.map((y) => y.entity),
|
|
3978
3978
|
added: p,
|
|
3979
3979
|
removed: b,
|
|
@@ -3992,6 +3992,15 @@ class ha {
|
|
|
3992
3992
|
return r;
|
|
3993
3993
|
}
|
|
3994
3994
|
}
|
|
3995
|
+
onStartSyncError(e) {
|
|
3996
|
+
const n = z(e["original-event"].q), r = {
|
|
3997
|
+
message: e.message || "Uh-oh, something went wrong. Ping Joe & Stopa.",
|
|
3998
|
+
status: e.status,
|
|
3999
|
+
type: e.type,
|
|
4000
|
+
hint: e.hint
|
|
4001
|
+
};
|
|
4002
|
+
this.notifyCbs(n, { type: Me.Error, data: [], error: r });
|
|
4003
|
+
}
|
|
3995
4004
|
onResyncError(e) {
|
|
3996
4005
|
const n = e["original-event"]["subscription-id"], r = this.clearSubscriptionData(n);
|
|
3997
4006
|
r && this.initSubscription(r.query, r.hash);
|
|
@@ -4111,7 +4120,7 @@ class va {
|
|
|
4111
4120
|
!c.has(p) && !b["tx-id"] && this._sendMutation(p, b);
|
|
4112
4121
|
});
|
|
4113
4122
|
}, this.getPreviousResult = (d) => {
|
|
4114
|
-
const c =
|
|
4123
|
+
const c = z(d);
|
|
4115
4124
|
return this.dataForQuery(c);
|
|
4116
4125
|
}, this.notifyOne = (d) => {
|
|
4117
4126
|
var c, f;
|
|
@@ -4214,7 +4223,7 @@ class va {
|
|
|
4214
4223
|
}, this._EventSource = s, this.config = Object.assign(Object.assign({}, ga), e), this.queryCacheLimit = (o = this.config.queryCacheLimit) !== null && o !== void 0 ? o : 10, this._pendingTxCleanupTimeout = (u = this.config.pendingTxCleanupTimeout) !== null && u !== void 0 ? u : ba, this._pendingMutationCleanupThreshold = (a = this.config.pendingMutationCleanupThreshold) !== null && a !== void 0 ? a : _a, this._log = Zu(e.verbose || Vn || Di, () => this._reactorStats()), this.versions = Object.assign(Object.assign({}, i || {}), { "@instantdb/core": qn }), this.config.schema && (this._linkIndex = xr(this.config.schema)), !!wa()) {
|
|
4215
4224
|
if (!e.appId)
|
|
4216
4225
|
throw new Error("Instant must be initialized with an appId.");
|
|
4217
|
-
if (!
|
|
4226
|
+
if (!Ue(e.appId))
|
|
4218
4227
|
throw new Error(`Instant must be initialized with a valid appId. \`${e.appId}\` is not a valid uuid.`);
|
|
4219
4228
|
typeof BroadcastChannel == "function" && (this._broadcastChannel = new BroadcastChannel("@instantdb"), this._broadcastChannel.addEventListener("message", (d) => F(this, void 0, void 0, function* () {
|
|
4220
4229
|
var c;
|
|
@@ -4285,7 +4294,7 @@ class va {
|
|
|
4285
4294
|
status: o
|
|
4286
4295
|
}));
|
|
4287
4296
|
} else
|
|
4288
|
-
i.reject(new
|
|
4297
|
+
i.reject(new Fe(r.message, r.hint));
|
|
4289
4298
|
}
|
|
4290
4299
|
_setStatus(e, n) {
|
|
4291
4300
|
this.status = e, this._errorMessage = n, this.notifyConnectionStatusSubs(e);
|
|
@@ -4312,11 +4321,11 @@ class va {
|
|
|
4312
4321
|
break;
|
|
4313
4322
|
}
|
|
4314
4323
|
case "add-query-exists": {
|
|
4315
|
-
this.notifyOneQueryOnce(
|
|
4324
|
+
this.notifyOneQueryOnce(z(n.q));
|
|
4316
4325
|
break;
|
|
4317
4326
|
}
|
|
4318
4327
|
case "add-query-ok": {
|
|
4319
|
-
const { q: h, result: p } = n, b =
|
|
4328
|
+
const { q: h, result: p } = n, b = z(h), y = (o = (s = p == null ? void 0 : p[0]) === null || s === void 0 ? void 0 : s.data) === null || o === void 0 ? void 0 : o["page-info"], _ = (a = (u = p == null ? void 0 : p[0]) === null || u === void 0 ? void 0 : u.data) === null || a === void 0 ? void 0 : a.aggregate, T = $r(p), w = Tt(this.attrs, T, d, this._linkIndex, this.config.useDateObjects);
|
|
4320
4329
|
this.querySubs.set((m) => (m[b].result = {
|
|
4321
4330
|
store: w,
|
|
4322
4331
|
pageInfo: y,
|
|
@@ -4348,8 +4357,8 @@ class va {
|
|
|
4348
4357
|
y !== this.pendingMutations.currentValue && this.pendingMutations.set(() => y);
|
|
4349
4358
|
const _ = Br(y.entries()), T = h.map((w) => {
|
|
4350
4359
|
var m, j, v, M;
|
|
4351
|
-
const U = w["instaql-query"], B = w["instaql-result"],
|
|
4352
|
-
return { hash:
|
|
4360
|
+
const U = w["instaql-query"], B = w["instaql-result"], Ve = z(U), ut = $r(B), Rt = Tt(this.attrs, ut, d, this._linkIndex, this.config.useDateObjects), $t = this._applyOptimisticUpdates(Rt, _, b), at = (j = (m = B == null ? void 0 : B[0]) === null || m === void 0 ? void 0 : m.data) === null || j === void 0 ? void 0 : j["page-info"], ce = (M = (v = B == null ? void 0 : B[0]) === null || v === void 0 ? void 0 : v.data) === null || M === void 0 ? void 0 : M.aggregate;
|
|
4361
|
+
return { hash: Ve, store: $t, pageInfo: at, aggregate: ce };
|
|
4353
4362
|
});
|
|
4354
4363
|
T.forEach(({ hash: w, store: m, pageInfo: j, aggregate: v }) => {
|
|
4355
4364
|
this.querySubs.set((M) => (M[w].result = { store: m, pageInfo: j, aggregate: v, processedTxId: b }, M));
|
|
@@ -4427,20 +4436,20 @@ class va {
|
|
|
4427
4436
|
}
|
|
4428
4437
|
}
|
|
4429
4438
|
_handleReceiveError(e) {
|
|
4430
|
-
var n, r, i, s, o, u;
|
|
4439
|
+
var n, r, i, s, o, u, a;
|
|
4431
4440
|
console.log("error", e);
|
|
4432
|
-
const
|
|
4433
|
-
this._inFlightMutationEventIds.delete(
|
|
4434
|
-
const
|
|
4441
|
+
const d = e["client-event-id"];
|
|
4442
|
+
this._inFlightMutationEventIds.delete(d);
|
|
4443
|
+
const c = this.pendingMutations.currentValue.get(d), f = {
|
|
4435
4444
|
message: e.message || "Uh-oh, something went wrong. Ping Joe & Stopa."
|
|
4436
4445
|
};
|
|
4437
|
-
if (e.hint && (
|
|
4438
|
-
this._handleMutationError("error",
|
|
4446
|
+
if (e.hint && (f.hint = e.hint), c) {
|
|
4447
|
+
this._handleMutationError("error", d, e);
|
|
4439
4448
|
return;
|
|
4440
4449
|
}
|
|
4441
4450
|
if (!((n = e["original-event"]) === null || n === void 0) && n.hasOwnProperty("q") && ((r = e["original-event"]) === null || r === void 0 ? void 0 : r.op) === "add-query") {
|
|
4442
|
-
const
|
|
4443
|
-
this.notifyQueryError(
|
|
4451
|
+
const b = (i = e["original-event"]) === null || i === void 0 ? void 0 : i.q, y = z(b);
|
|
4452
|
+
this.notifyQueryError(z(b), f), this.notifyQueryOnceError(b, y, d, f);
|
|
4444
4453
|
return;
|
|
4445
4454
|
}
|
|
4446
4455
|
if (((s = e["original-event"]) === null || s === void 0 ? void 0 : s.op) === "init") {
|
|
@@ -4448,15 +4457,19 @@ class va {
|
|
|
4448
4457
|
this.changeCurrentUser(null);
|
|
4449
4458
|
return;
|
|
4450
4459
|
}
|
|
4451
|
-
this._setStatus(fe.ERRORED,
|
|
4460
|
+
this._setStatus(fe.ERRORED, f), this.notifyAll();
|
|
4452
4461
|
return;
|
|
4453
4462
|
}
|
|
4454
4463
|
if (((u = e["original-event"]) === null || u === void 0 ? void 0 : u.op) === "resync-table") {
|
|
4455
4464
|
this._syncTable.onResyncError(e);
|
|
4456
4465
|
return;
|
|
4457
4466
|
}
|
|
4458
|
-
|
|
4459
|
-
|
|
4467
|
+
if (((a = e["original-event"]) === null || a === void 0 ? void 0 : a.op) === "start-sync") {
|
|
4468
|
+
this._syncTable.onStartSyncError(e);
|
|
4469
|
+
return;
|
|
4470
|
+
}
|
|
4471
|
+
const p = Object.assign({}, e);
|
|
4472
|
+
delete p.message, delete p.hint, console.error(e.message, p), e.hint && console.error(`This error comes with some debugging information. Here it is:
|
|
4460
4473
|
`, e.hint);
|
|
4461
4474
|
}
|
|
4462
4475
|
notifyQueryOnceError(e, n, r, i) {
|
|
@@ -4487,7 +4500,7 @@ class va {
|
|
|
4487
4500
|
subscribeQuery(e, n, r) {
|
|
4488
4501
|
var i;
|
|
4489
4502
|
this.config.disableValidation || Ur(e, this.config.schema), r && "ruleParams" in r && (e = Object.assign({ $$ruleParams: r.ruleParams }, e));
|
|
4490
|
-
const s =
|
|
4503
|
+
const s = z(e), o = this.getPreviousResult(e);
|
|
4491
4504
|
return o && n(o), this.queryCbs[s] = (i = this.queryCbs[s]) !== null && i !== void 0 ? i : [], this.queryCbs[s].push({ q: e, cb: n }), this._startQuerySub(e, s), () => {
|
|
4492
4505
|
this._unsubQuery(e, s, n);
|
|
4493
4506
|
};
|
|
@@ -4500,7 +4513,7 @@ class va {
|
|
|
4500
4513
|
return i.reject(new Error("We can't run `queryOnce`, because the device is offline.")), i.promise;
|
|
4501
4514
|
if (!this.querySubs)
|
|
4502
4515
|
return i.reject(new Error("We can't run `queryOnce` on the backend. Use adminAPI.query instead: https://www.instantdb.com/docs/backend#query")), i.promise;
|
|
4503
|
-
const s =
|
|
4516
|
+
const s = z(e), o = this._startQuerySub(e, s);
|
|
4504
4517
|
return this.queryOnceDfds[s] = (r = this.queryOnceDfds[s]) !== null && r !== void 0 ? r : [], this.queryOnceDfds[s].push({ q: e, dfd: i, eventId: o }), setTimeout(() => i.reject(new Error("Query timed out")), ya), i.promise;
|
|
4505
4518
|
}
|
|
4506
4519
|
_completeQueryOnce(e, n, r) {
|
|
@@ -4529,7 +4542,7 @@ class va {
|
|
|
4529
4542
|
return n;
|
|
4530
4543
|
const i = (c) => {
|
|
4531
4544
|
const [f, h, p] = c["forward-identity"];
|
|
4532
|
-
return
|
|
4545
|
+
return K(e, h, p);
|
|
4533
4546
|
}, s = (c) => {
|
|
4534
4547
|
const [f, h, p] = c["forward-identity"];
|
|
4535
4548
|
return Se(e, h, p);
|
|
@@ -4831,7 +4844,7 @@ class va {
|
|
|
4831
4844
|
return F(this, void 0, void 0, function* () {
|
|
4832
4845
|
const { user: e, error: n } = yield this.getCurrentUser();
|
|
4833
4846
|
if (n)
|
|
4834
|
-
throw new
|
|
4847
|
+
throw new Fe("Could not get current user: " + n.message);
|
|
4835
4848
|
return e;
|
|
4836
4849
|
});
|
|
4837
4850
|
}
|
|
@@ -5590,7 +5603,7 @@ function Gr(t) {
|
|
|
5590
5603
|
return "0";
|
|
5591
5604
|
if (Ht.get(t))
|
|
5592
5605
|
return Ht.get(t);
|
|
5593
|
-
const e =
|
|
5606
|
+
const e = z(t);
|
|
5594
5607
|
return Ht.set(t, e), e;
|
|
5595
5608
|
}
|
|
5596
5609
|
function Ga(t, e) {
|
|
@@ -5609,7 +5622,7 @@ function Ha(t, e) {
|
|
|
5609
5622
|
const n = Object.assign({ position: "bottom-right", allowedHosts: ["localhost"] }, typeof e == "object" ? e : {});
|
|
5610
5623
|
n.allowedHosts.includes(window.location.hostname) && Ra(t, n);
|
|
5611
5624
|
}
|
|
5612
|
-
var Tn = { exports: {} },
|
|
5625
|
+
var Tn = { exports: {} }, Be = {};
|
|
5613
5626
|
/**
|
|
5614
5627
|
* @license React
|
|
5615
5628
|
* react-jsx-runtime.production.min.js
|
|
@@ -5621,7 +5634,7 @@ var Tn = { exports: {} }, Ke = {};
|
|
|
5621
5634
|
*/
|
|
5622
5635
|
var Qr;
|
|
5623
5636
|
function Ya() {
|
|
5624
|
-
if (Qr) return
|
|
5637
|
+
if (Qr) return Be;
|
|
5625
5638
|
Qr = 1;
|
|
5626
5639
|
var t = ni, e = Symbol.for("react.element"), n = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, i = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
5627
5640
|
function o(u, a, d) {
|
|
@@ -5631,11 +5644,11 @@ function Ya() {
|
|
|
5631
5644
|
if (u && u.defaultProps) for (c in a = u.defaultProps, a) f[c] === void 0 && (f[c] = a[c]);
|
|
5632
5645
|
return { $$typeof: e, type: u, key: h, ref: p, props: f, _owner: i.current };
|
|
5633
5646
|
}
|
|
5634
|
-
return
|
|
5647
|
+
return Be.Fragment = n, Be.jsx = o, Be.jsxs = o, Be;
|
|
5635
5648
|
}
|
|
5636
|
-
var
|
|
5649
|
+
var Ge = {}, Hr;
|
|
5637
5650
|
function Ja() {
|
|
5638
|
-
if (Hr) return
|
|
5651
|
+
if (Hr) return Ge;
|
|
5639
5652
|
Hr = 1;
|
|
5640
5653
|
var t = {};
|
|
5641
5654
|
/**
|
|
@@ -5673,10 +5686,10 @@ function Ja() {
|
|
|
5673
5686
|
P.unshift("Warning: " + g), Function.prototype.apply.call(console[l], console, P);
|
|
5674
5687
|
}
|
|
5675
5688
|
}
|
|
5676
|
-
var v = !1, M = !1, U = !1, B = !1,
|
|
5689
|
+
var v = !1, M = !1, U = !1, B = !1, Ve = !1, ut;
|
|
5677
5690
|
ut = Symbol.for("react.module.reference");
|
|
5678
5691
|
function Rt(l) {
|
|
5679
|
-
return !!(typeof l == "string" || typeof l == "function" || l === i || l === o ||
|
|
5692
|
+
return !!(typeof l == "string" || typeof l == "function" || l === i || l === o || Ve || l === s || l === c || l === f || B || l === b || v || M || U || typeof l == "object" && l !== null && (l.$$typeof === p || l.$$typeof === h || l.$$typeof === u || l.$$typeof === a || l.$$typeof === d || // This needs to include all possible module reference object
|
|
5680
5693
|
// types supported by any Flight configuration anywhere since
|
|
5681
5694
|
// we don't know which Flight build this will end up being used
|
|
5682
5695
|
// with.
|
|
@@ -5737,13 +5750,13 @@ function Ja() {
|
|
|
5737
5750
|
}
|
|
5738
5751
|
return null;
|
|
5739
5752
|
}
|
|
5740
|
-
var _e = Object.assign,
|
|
5753
|
+
var _e = Object.assign, qe = 0, Bn, Gn, Qn, Hn, Yn, Jn, Zn;
|
|
5741
5754
|
function Xn() {
|
|
5742
5755
|
}
|
|
5743
5756
|
Xn.__reactDisabledLog = !0;
|
|
5744
5757
|
function Gi() {
|
|
5745
5758
|
{
|
|
5746
|
-
if (
|
|
5759
|
+
if (qe === 0) {
|
|
5747
5760
|
Bn = console.log, Gn = console.info, Qn = console.warn, Hn = console.error, Yn = console.group, Jn = console.groupCollapsed, Zn = console.groupEnd;
|
|
5748
5761
|
var l = {
|
|
5749
5762
|
configurable: !0,
|
|
@@ -5761,12 +5774,12 @@ function Ja() {
|
|
|
5761
5774
|
groupEnd: l
|
|
5762
5775
|
});
|
|
5763
5776
|
}
|
|
5764
|
-
|
|
5777
|
+
qe++;
|
|
5765
5778
|
}
|
|
5766
5779
|
}
|
|
5767
5780
|
function Qi() {
|
|
5768
5781
|
{
|
|
5769
|
-
if (
|
|
5782
|
+
if (qe--, qe === 0) {
|
|
5770
5783
|
var l = {
|
|
5771
5784
|
configurable: !0,
|
|
5772
5785
|
enumerable: !0,
|
|
@@ -5796,7 +5809,7 @@ function Ja() {
|
|
|
5796
5809
|
})
|
|
5797
5810
|
});
|
|
5798
5811
|
}
|
|
5799
|
-
|
|
5812
|
+
qe < 0 && m("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
5800
5813
|
}
|
|
5801
5814
|
}
|
|
5802
5815
|
var xt = w.ReactCurrentDispatcher, Dt;
|
|
@@ -5925,7 +5938,7 @@ function Ja() {
|
|
|
5925
5938
|
}
|
|
5926
5939
|
return "";
|
|
5927
5940
|
}
|
|
5928
|
-
var
|
|
5941
|
+
var ze = Object.prototype.hasOwnProperty, tr = {}, nr = w.ReactDebugCurrentFrame;
|
|
5929
5942
|
function lt(l) {
|
|
5930
5943
|
if (l) {
|
|
5931
5944
|
var g = l._owner, S = ft(l.type, l._source, g ? g.type : null);
|
|
@@ -5935,7 +5948,7 @@ function Ja() {
|
|
|
5935
5948
|
}
|
|
5936
5949
|
function Zi(l, g, S, O, I) {
|
|
5937
5950
|
{
|
|
5938
|
-
var P = Function.call.bind(
|
|
5951
|
+
var P = Function.call.bind(ze);
|
|
5939
5952
|
for (var k in l)
|
|
5940
5953
|
if (P(l, k)) {
|
|
5941
5954
|
var A = void 0;
|
|
@@ -5983,7 +5996,7 @@ function Ja() {
|
|
|
5983
5996
|
__source: !0
|
|
5984
5997
|
}, or, ur;
|
|
5985
5998
|
function rs(l) {
|
|
5986
|
-
if (
|
|
5999
|
+
if (ze.call(l, "ref")) {
|
|
5987
6000
|
var g = Object.getOwnPropertyDescriptor(l, "ref").get;
|
|
5988
6001
|
if (g && g.isReactWarning)
|
|
5989
6002
|
return !1;
|
|
@@ -5991,7 +6004,7 @@ function Ja() {
|
|
|
5991
6004
|
return l.ref !== void 0;
|
|
5992
6005
|
}
|
|
5993
6006
|
function is(l) {
|
|
5994
|
-
if (
|
|
6007
|
+
if (ze.call(l, "key")) {
|
|
5995
6008
|
var g = Object.getOwnPropertyDescriptor(l, "key").get;
|
|
5996
6009
|
if (g && g.isReactWarning)
|
|
5997
6010
|
return !1;
|
|
@@ -6057,7 +6070,7 @@ function Ja() {
|
|
|
6057
6070
|
var P, k = {}, A = null, G = null;
|
|
6058
6071
|
S !== void 0 && (ir(S), A = "" + S), is(g) && (ir(g.key), A = "" + g.key), rs(g) && (G = g.ref, ss(g, I));
|
|
6059
6072
|
for (P in g)
|
|
6060
|
-
|
|
6073
|
+
ze.call(g, P) && !ns.hasOwnProperty(P) && (k[P] = g[P]);
|
|
6061
6074
|
if (l && l.defaultProps) {
|
|
6062
6075
|
var x = l.defaultProps;
|
|
6063
6076
|
for (P in x)
|
|
@@ -6208,7 +6221,7 @@ Check the top-level render call using <` + S + ">.");
|
|
|
6208
6221
|
else
|
|
6209
6222
|
lr(re, l);
|
|
6210
6223
|
}
|
|
6211
|
-
if (
|
|
6224
|
+
if (ze.call(g, "key")) {
|
|
6212
6225
|
var ge = ce(l), Y = Object.keys(g).filter(function(Ts) {
|
|
6213
6226
|
return Ts !== "key";
|
|
6214
6227
|
}), Vt = Y.length > 0 ? "{key: someKey, " + Y.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
@@ -6232,8 +6245,8 @@ React keys must be passed directly to JSX without using spread:
|
|
|
6232
6245
|
return pr(l, g, S, !1);
|
|
6233
6246
|
}
|
|
6234
6247
|
var bs = ys, _s = ps;
|
|
6235
|
-
|
|
6236
|
-
}(),
|
|
6248
|
+
Ge.Fragment = i, Ge.jsx = bs, Ge.jsxs = _s;
|
|
6249
|
+
}(), Ge;
|
|
6237
6250
|
}
|
|
6238
6251
|
var Za = {};
|
|
6239
6252
|
Za.NODE_ENV === "production" ? Tn.exports = Ya() : Tn.exports = Ja();
|
|
@@ -6249,7 +6262,7 @@ function Yr(t) {
|
|
|
6249
6262
|
}
|
|
6250
6263
|
function ec(t, e, n) {
|
|
6251
6264
|
e && n && "ruleParams" in n && (e = Object.assign({ $$ruleParams: n.ruleParams }, e));
|
|
6252
|
-
const r = e ? Ka(e) : null, i =
|
|
6265
|
+
const r = e ? Ka(e) : null, i = z(r), s = St(Yr(t._reactor.getPreviousResult(r))), o = be(
|
|
6253
6266
|
(a) => (s.current = Yr(t._reactor.getPreviousResult(r)), r ? t.subscribeQuery(r, (c) => {
|
|
6254
6267
|
s.current = Object.assign({ isLoading: !c, data: void 0, pageInfo: void 0, error: void 0 }, c), a();
|
|
6255
6268
|
}) : () => {
|
|
@@ -6400,7 +6413,7 @@ class fc {
|
|
|
6400
6413
|
}, this.useUser = () => {
|
|
6401
6414
|
const { user: r } = this.useAuth();
|
|
6402
6415
|
if (!r)
|
|
6403
|
-
throw new
|
|
6416
|
+
throw new Fe("useUser must be used within an auth-protected route");
|
|
6404
6417
|
return r;
|
|
6405
6418
|
}, this.useConnectionStatus = () => {
|
|
6406
6419
|
const r = St(this.core._reactor.status), i = be((o) => this.core.subscribeConnectionStatus((a) => {
|
|
@@ -6620,32 +6633,32 @@ function Xr(t) {
|
|
|
6620
6633
|
}
|
|
6621
6634
|
var Bi = (t) => {
|
|
6622
6635
|
throw TypeError(t);
|
|
6623
|
-
}, zn = (t, e, n) => e.has(t) || Bi("Cannot " + n), E = (t, e, n) => (zn(t, e, "read from private field"), n ? n.call(t) : e.get(t)), N = (t, e, n) => e.has(t) ? Bi("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), $ = (t, e, n, r) => (zn(t, e, "write to private field"), e.set(t, n), n), le = (t, e, n) => (zn(t, e, "access private method"), n), J, we, je, wt, Ct, et,
|
|
6636
|
+
}, zn = (t, e, n) => e.has(t) || Bi("Cannot " + n), E = (t, e, n) => (zn(t, e, "read from private field"), n ? n.call(t) : e.get(t)), N = (t, e, n) => e.has(t) ? Bi("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), $ = (t, e, n, r) => (zn(t, e, "write to private field"), e.set(t, n), n), le = (t, e, n) => (zn(t, e, "access private method"), n), J, we, je, wt, Ct, et, Re, tt, ye, Ie, xe, Pe, Ye, se, mn, Sn, vn, ei, On, En, Je, An, Cn;
|
|
6624
6637
|
class mt extends EventTarget {
|
|
6625
6638
|
constructor(e, n) {
|
|
6626
6639
|
var r, i;
|
|
6627
|
-
super(), N(this, se), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, N(this, J), N(this, we), N(this, je), N(this, wt), N(this, Ct), N(this, et), N(this,
|
|
6640
|
+
super(), N(this, se), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, N(this, J), N(this, we), N(this, je), N(this, wt), N(this, Ct), N(this, et), N(this, Re), N(this, tt, null), N(this, ye), N(this, Ie), N(this, xe, null), N(this, Pe, null), N(this, Ye, null), N(this, Sn, async (s) => {
|
|
6628
6641
|
var o;
|
|
6629
6642
|
E(this, Ie).reset();
|
|
6630
6643
|
const { body: u, redirected: a, status: d, headers: c } = s;
|
|
6631
6644
|
if (d === 204) {
|
|
6632
|
-
le(this, se,
|
|
6645
|
+
le(this, se, Je).call(this, "Server sent HTTP 204, not reconnecting", 204), this.close();
|
|
6633
6646
|
return;
|
|
6634
6647
|
}
|
|
6635
6648
|
if (a ? $(this, je, new URL(s.url)) : $(this, je, void 0), d !== 200) {
|
|
6636
|
-
le(this, se,
|
|
6649
|
+
le(this, se, Je).call(this, `Non-200 status code (${d})`, d);
|
|
6637
6650
|
return;
|
|
6638
6651
|
}
|
|
6639
6652
|
if (!(c.get("content-type") || "").startsWith("text/event-stream")) {
|
|
6640
|
-
le(this, se,
|
|
6653
|
+
le(this, se, Je).call(this, 'Invalid content type, expected "text/event-stream"', d);
|
|
6641
6654
|
return;
|
|
6642
6655
|
}
|
|
6643
6656
|
if (E(this, J) === this.CLOSED)
|
|
6644
6657
|
return;
|
|
6645
6658
|
$(this, J, this.OPEN);
|
|
6646
6659
|
const f = new Event("open");
|
|
6647
|
-
if ((o = E(this,
|
|
6648
|
-
le(this, se,
|
|
6660
|
+
if ((o = E(this, Ye)) == null || o.call(this, f), this.dispatchEvent(f), typeof u != "object" || !u || !("getReader" in u)) {
|
|
6661
|
+
le(this, se, Je).call(this, "Invalid response body, expected a web ReadableStream", d), this.close();
|
|
6649
6662
|
return;
|
|
6650
6663
|
}
|
|
6651
6664
|
const h = new TextDecoder(), p = u.getReader();
|
|
@@ -6667,7 +6680,7 @@ class mt extends EventTarget {
|
|
|
6667
6680
|
}), N(this, En, (s) => {
|
|
6668
6681
|
$(this, et, s);
|
|
6669
6682
|
}), N(this, Cn, () => {
|
|
6670
|
-
$(this,
|
|
6683
|
+
$(this, Re, void 0), E(this, J) === this.CONNECTING && le(this, se, mn).call(this);
|
|
6671
6684
|
});
|
|
6672
6685
|
try {
|
|
6673
6686
|
if (e instanceof URL)
|
|
@@ -6717,10 +6730,10 @@ class mt extends EventTarget {
|
|
|
6717
6730
|
}
|
|
6718
6731
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */
|
|
6719
6732
|
get onerror() {
|
|
6720
|
-
return E(this,
|
|
6733
|
+
return E(this, xe);
|
|
6721
6734
|
}
|
|
6722
6735
|
set onerror(e) {
|
|
6723
|
-
$(this,
|
|
6736
|
+
$(this, xe, e);
|
|
6724
6737
|
}
|
|
6725
6738
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */
|
|
6726
6739
|
get onmessage() {
|
|
@@ -6731,10 +6744,10 @@ class mt extends EventTarget {
|
|
|
6731
6744
|
}
|
|
6732
6745
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */
|
|
6733
6746
|
get onopen() {
|
|
6734
|
-
return E(this,
|
|
6747
|
+
return E(this, Ye);
|
|
6735
6748
|
}
|
|
6736
6749
|
set onopen(e) {
|
|
6737
|
-
$(this,
|
|
6750
|
+
$(this, Ye, e);
|
|
6738
6751
|
}
|
|
6739
6752
|
addEventListener(e, n, r) {
|
|
6740
6753
|
const i = n;
|
|
@@ -6752,10 +6765,10 @@ class mt extends EventTarget {
|
|
|
6752
6765
|
* @public
|
|
6753
6766
|
*/
|
|
6754
6767
|
close() {
|
|
6755
|
-
E(this,
|
|
6768
|
+
E(this, Re) && clearTimeout(E(this, Re)), E(this, J) !== this.CLOSED && (E(this, ye) && E(this, ye).abort(), $(this, J, this.CLOSED), $(this, ye, void 0));
|
|
6756
6769
|
}
|
|
6757
6770
|
}
|
|
6758
|
-
J = /* @__PURE__ */ new WeakMap(), we = /* @__PURE__ */ new WeakMap(), je = /* @__PURE__ */ new WeakMap(), wt = /* @__PURE__ */ new WeakMap(), Ct = /* @__PURE__ */ new WeakMap(), et = /* @__PURE__ */ new WeakMap(),
|
|
6771
|
+
J = /* @__PURE__ */ new WeakMap(), we = /* @__PURE__ */ new WeakMap(), je = /* @__PURE__ */ new WeakMap(), wt = /* @__PURE__ */ new WeakMap(), Ct = /* @__PURE__ */ new WeakMap(), et = /* @__PURE__ */ new WeakMap(), Re = /* @__PURE__ */ new WeakMap(), tt = /* @__PURE__ */ new WeakMap(), ye = /* @__PURE__ */ new WeakMap(), Ie = /* @__PURE__ */ new WeakMap(), xe = /* @__PURE__ */ new WeakMap(), Pe = /* @__PURE__ */ new WeakMap(), Ye = /* @__PURE__ */ new WeakMap(), se = /* @__PURE__ */ new WeakSet(), /**
|
|
6759
6772
|
* Connect to the given URL and start receiving events
|
|
6760
6773
|
*
|
|
6761
6774
|
* @internal
|
|
@@ -6787,11 +6800,11 @@ ei = function() {
|
|
|
6787
6800
|
* @param code - The HTTP status code, if available
|
|
6788
6801
|
* @internal
|
|
6789
6802
|
*/
|
|
6790
|
-
|
|
6803
|
+
Je = function(t, e) {
|
|
6791
6804
|
var n;
|
|
6792
6805
|
E(this, J) !== this.CLOSED && $(this, J, this.CLOSED);
|
|
6793
6806
|
const r = new Zr("error", { code: e, message: t });
|
|
6794
|
-
(n = E(this,
|
|
6807
|
+
(n = E(this, xe)) == null || n.call(this, r), this.dispatchEvent(r);
|
|
6795
6808
|
}, /**
|
|
6796
6809
|
* Schedules a reconnection attempt against the EventSource endpoint.
|
|
6797
6810
|
*
|
|
@@ -6805,7 +6818,7 @@ An = function(t, e) {
|
|
|
6805
6818
|
return;
|
|
6806
6819
|
$(this, J, this.CONNECTING);
|
|
6807
6820
|
const r = new Zr("error", { code: e, message: t });
|
|
6808
|
-
(n = E(this,
|
|
6821
|
+
(n = E(this, xe)) == null || n.call(this, r), this.dispatchEvent(r), $(this, Re, setTimeout(E(this, Cn), E(this, et)));
|
|
6809
6822
|
}, Cn = /* @__PURE__ */ new WeakMap(), /**
|
|
6810
6823
|
* ReadyState representing an EventSource currently trying to connect
|
|
6811
6824
|
*
|