@instantdb/react 0.22.155 → 0.22.156
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commonjs/next-ssr/HydrationStreamProvider.js +0 -1
- package/dist/commonjs/next-ssr/HydrationStreamProvider.js.map +1 -1
- package/dist/commonjs/next-ssr/InstantSuspenseProvider.d.ts +2 -5
- package/dist/commonjs/next-ssr/InstantSuspenseProvider.d.ts.map +1 -1
- package/dist/commonjs/next-ssr/InstantSuspenseProvider.js +116 -48
- package/dist/commonjs/next-ssr/InstantSuspenseProvider.js.map +1 -1
- package/dist/esm/next-ssr/HydrationStreamProvider.js +0 -1
- package/dist/esm/next-ssr/HydrationStreamProvider.js.map +1 -1
- package/dist/esm/next-ssr/InstantSuspenseProvider.d.ts +2 -5
- package/dist/esm/next-ssr/InstantSuspenseProvider.d.ts.map +1 -1
- package/dist/esm/next-ssr/InstantSuspenseProvider.js +117 -49
- package/dist/esm/next-ssr/InstantSuspenseProvider.js.map +1 -1
- package/dist/standalone/index.js +126 -116
- package/dist/standalone/index.umd.cjs +6 -6
- package/package.json +4 -4
- package/src/next-ssr/HydrationStreamProvider.tsx +1 -1
- package/src/next-ssr/InstantSuspenseProvider.tsx +172 -71
package/dist/standalone/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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
|
|
4
|
+
import rs, { useRef as Xe, useCallback as Me, useSyncExternalStore as dn, useEffect as Fe, useMemo as hn, useState as ss, createElement as Ti } from "react";
|
|
5
5
|
function J(n) {
|
|
6
6
|
if (typeof n == "number")
|
|
7
7
|
return (Math.abs(n * 2654435761) >>> 0).toString(16);
|
|
@@ -48,7 +48,7 @@ const q = {
|
|
|
48
48
|
mutable: "mutable",
|
|
49
49
|
immutable: "immutable"
|
|
50
50
|
}, Nn = {};
|
|
51
|
-
function
|
|
51
|
+
function ht(n, e) {
|
|
52
52
|
return n instanceof Map ? n.has(e) : Object.prototype.hasOwnProperty.call(n, e);
|
|
53
53
|
}
|
|
54
54
|
function br(n, e) {
|
|
@@ -95,7 +95,7 @@ function os(n, e = []) {
|
|
|
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;
|
|
98
|
-
if (!(s && t.size > i ||
|
|
98
|
+
if (!(s && t.size > i || ht(t, i)))
|
|
99
99
|
return null;
|
|
100
100
|
e.push(i);
|
|
101
101
|
}
|
|
@@ -199,15 +199,15 @@ function as(n, e) {
|
|
|
199
199
|
function re(n) {
|
|
200
200
|
n.copy || (n.copy = as(n.original, n.options));
|
|
201
201
|
}
|
|
202
|
-
function
|
|
202
|
+
function at(n) {
|
|
203
203
|
if (!Se(n))
|
|
204
204
|
return qn(n);
|
|
205
205
|
if (Array.isArray(n))
|
|
206
|
-
return n.map(
|
|
206
|
+
return n.map(at);
|
|
207
207
|
if (n instanceof Map) {
|
|
208
208
|
const t = Array.from(n.entries()).map(([r, s]) => [
|
|
209
209
|
r,
|
|
210
|
-
|
|
210
|
+
at(s)
|
|
211
211
|
]);
|
|
212
212
|
if (!Kn(n)) {
|
|
213
213
|
const r = Object.getPrototypeOf(n).constructor;
|
|
@@ -216,7 +216,7 @@ function ot(n) {
|
|
|
216
216
|
return new Map(t);
|
|
217
217
|
}
|
|
218
218
|
if (n instanceof Set) {
|
|
219
|
-
const t = Array.from(n).map(
|
|
219
|
+
const t = Array.from(n).map(at);
|
|
220
220
|
if (!Wn(n)) {
|
|
221
221
|
const r = Object.getPrototypeOf(n).constructor;
|
|
222
222
|
return new r(t);
|
|
@@ -225,11 +225,11 @@ function ot(n) {
|
|
|
225
225
|
}
|
|
226
226
|
const e = Object.create(Object.getPrototypeOf(n));
|
|
227
227
|
for (const t in n)
|
|
228
|
-
e[t] =
|
|
228
|
+
e[t] = at(n[t]);
|
|
229
229
|
return e;
|
|
230
230
|
}
|
|
231
231
|
function Rt(n) {
|
|
232
|
-
return Ne(n) ?
|
|
232
|
+
return Ne(n) ? at(n) : n;
|
|
233
233
|
}
|
|
234
234
|
function Oe(n) {
|
|
235
235
|
var e;
|
|
@@ -397,7 +397,7 @@ 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 = Ie(n, c), l = Rt(Ie(e, c)), f = a ?
|
|
400
|
+
const u = Ie(n, c), l = Rt(Ie(e, c)), f = a ? ht(n, c) ? q.Replace : q.Add : q.Remove;
|
|
401
401
|
if (Ce(u, l) && f === q.Replace)
|
|
402
402
|
return;
|
|
403
403
|
const p = r.concat(c), y = Ue(p, o);
|
|
@@ -672,7 +672,7 @@ const Mi = Reflect.ownKeys(Ft), us = /* @__PURE__ */ new WeakSet(), ls = {
|
|
|
672
672
|
if (u)
|
|
673
673
|
return u.bind(n.proxy);
|
|
674
674
|
}
|
|
675
|
-
if (!
|
|
675
|
+
if (!ht(a, e)) {
|
|
676
676
|
const u = br(a, e);
|
|
677
677
|
return u ? "value" in u ? u.value : (
|
|
678
678
|
// !case: support for getter
|
|
@@ -708,7 +708,7 @@ const Mi = Reflect.ownKeys(Ft), us = /* @__PURE__ */ new WeakSet(), ls = {
|
|
|
708
708
|
if (i != null && i.set)
|
|
709
709
|
return i.set.call(n.proxy, t), !0;
|
|
710
710
|
const o = rn(he(n), e), a = R(o);
|
|
711
|
-
return a && Ce(a.original, t) ? (n.copy[e] = t, n.assignedMap = (r = n.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), n.assignedMap.set(e, !1), !0) : (Ce(t, o) && (t !== void 0 ||
|
|
711
|
+
return a && Ce(a.original, t) ? (n.copy[e] = t, n.assignedMap = (r = n.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), n.assignedMap.set(e, !1), !0) : (Ce(t, o) && (t !== void 0 || ht(n.original, e)) || (re(n), Oe(n), ht(n.original, e) && Ce(t, n.original[e]) ? n.assignedMap.delete(e) : n.assignedMap.set(e, !0), n.copy[e] = t, Vn(n, e, t, _t)), !0);
|
|
712
712
|
},
|
|
713
713
|
has(n, e) {
|
|
714
714
|
return e in he(n);
|
|
@@ -948,7 +948,7 @@ function jt(n, e) {
|
|
|
948
948
|
return typeof n != "object" || typeof e != "object" || n === null || e === null ? n === e : ds(n, e) ? Object.keys(n).every((t) => jt(n[t], e[t])) : !1;
|
|
949
949
|
}
|
|
950
950
|
function Gn(n) {
|
|
951
|
-
if (!
|
|
951
|
+
if (!ct(n))
|
|
952
952
|
return n;
|
|
953
953
|
const e = {};
|
|
954
954
|
for (const [t, r] of Object.entries(n))
|
|
@@ -956,7 +956,7 @@ function Gn(n) {
|
|
|
956
956
|
return e;
|
|
957
957
|
}
|
|
958
958
|
function hs(n, e) {
|
|
959
|
-
if (!
|
|
959
|
+
if (!ct(n) || !ct(e))
|
|
960
960
|
return e;
|
|
961
961
|
const t = { ...n };
|
|
962
962
|
for (const r of Object.keys(e)) {
|
|
@@ -966,12 +966,12 @@ function hs(n, e) {
|
|
|
966
966
|
delete t[r];
|
|
967
967
|
continue;
|
|
968
968
|
}
|
|
969
|
-
const s =
|
|
969
|
+
const s = ct(n[r]) && ct(e[r]);
|
|
970
970
|
t[r] = s ? hs(n[r], e[r]) : e[r];
|
|
971
971
|
}
|
|
972
972
|
return t;
|
|
973
973
|
}
|
|
974
|
-
function
|
|
974
|
+
function ct(n) {
|
|
975
975
|
return typeof n == "object" && n !== null && !Array.isArray(n);
|
|
976
976
|
}
|
|
977
977
|
function $i(n, e, t) {
|
|
@@ -1418,7 +1418,7 @@ function Qn(n) {
|
|
|
1418
1418
|
function Hn(n) {
|
|
1419
1419
|
return n["value-type"] === "blob";
|
|
1420
1420
|
}
|
|
1421
|
-
function
|
|
1421
|
+
function nt(n, e) {
|
|
1422
1422
|
return e.reduce((t, r) => t && t.get(r), n);
|
|
1423
1423
|
}
|
|
1424
1424
|
function Te(n, e) {
|
|
@@ -1463,7 +1463,7 @@ function bs(n) {
|
|
|
1463
1463
|
};
|
|
1464
1464
|
}
|
|
1465
1465
|
function gs(n, e) {
|
|
1466
|
-
return
|
|
1466
|
+
return ut(n, e.triples, e.cardinalityInference, e.useDateObjects);
|
|
1467
1467
|
}
|
|
1468
1468
|
function _s(n, e) {
|
|
1469
1469
|
if (n)
|
|
@@ -1472,9 +1472,9 @@ function _s(n, e) {
|
|
|
1472
1472
|
return new Le(e.attrs, e.linkIndex);
|
|
1473
1473
|
}
|
|
1474
1474
|
function to(n, e) {
|
|
1475
|
-
return
|
|
1475
|
+
return nt(n.eav, [e]) !== void 0;
|
|
1476
1476
|
}
|
|
1477
|
-
function
|
|
1477
|
+
function ut(n, e, t, r) {
|
|
1478
1478
|
const s = ys(n, e, r);
|
|
1479
1479
|
return s.cardinalityInference = t, s.useDateObjects = r, s;
|
|
1480
1480
|
}
|
|
@@ -1516,7 +1516,7 @@ let no = 0;
|
|
|
1516
1516
|
function ws(n, e, t) {
|
|
1517
1517
|
const [r, s, i] = t;
|
|
1518
1518
|
let o;
|
|
1519
|
-
const a =
|
|
1519
|
+
const a = nt(n.eav, [r, s, i]);
|
|
1520
1520
|
return a && (o = a[3]), o || Date.now() * 10 + no++;
|
|
1521
1521
|
}
|
|
1522
1522
|
function Ts(n, e, t) {
|
|
@@ -1528,7 +1528,7 @@ function Ts(n, e, t) {
|
|
|
1528
1528
|
if (!a)
|
|
1529
1529
|
return;
|
|
1530
1530
|
a["checked-data-type"] === "date" && n.useDateObjects && (o = zt(o));
|
|
1531
|
-
const c =
|
|
1531
|
+
const c = nt(n.eav, [s, i, o]), u = (c == null ? void 0 : c[3]) ?? ws(n, a, r), l = [s, i, o, u];
|
|
1532
1532
|
eo(a) ? (le(n.eav, [s, i], /* @__PURE__ */ new Map([[o, l]])), le(n.aev, [i, s], /* @__PURE__ */ new Map([[o, l]]))) : (le(n.eav, [s, i, o], l), le(n.aev, [i, s, o], l)), Qn(a) && le(n.vae, [o, i, s], l);
|
|
1533
1533
|
}
|
|
1534
1534
|
function ro(n, e, t) {
|
|
@@ -1541,7 +1541,7 @@ function ro(n, e, t) {
|
|
|
1541
1541
|
return;
|
|
1542
1542
|
if (!Hn(a))
|
|
1543
1543
|
throw new Error("merge operation is not supported for links");
|
|
1544
|
-
const c =
|
|
1544
|
+
const c = nt(n.eav, [s, i]);
|
|
1545
1545
|
if (!c)
|
|
1546
1546
|
return;
|
|
1547
1547
|
const u = (y = c.values().next()) == null ? void 0 : y.value;
|
|
@@ -1766,7 +1766,7 @@ function ho(n, e, t) {
|
|
|
1766
1766
|
return;
|
|
1767
1767
|
const [s, i, o] = r;
|
|
1768
1768
|
if (e.getAttr(i))
|
|
1769
|
-
return
|
|
1769
|
+
return nt(n.eav, [s, i]);
|
|
1770
1770
|
}
|
|
1771
1771
|
function po(n, e, t) {
|
|
1772
1772
|
const r = t.filter(([s, i, o, a, c]) => {
|
|
@@ -1861,7 +1861,7 @@ function Eo(n, e, t) {
|
|
|
1861
1861
|
return uo(n, Jn(t, e));
|
|
1862
1862
|
}
|
|
1863
1863
|
const Oo = /^(?:[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;
|
|
1864
|
-
function
|
|
1864
|
+
function et(n) {
|
|
1865
1865
|
return typeof n == "string" && Oo.test(n);
|
|
1866
1866
|
}
|
|
1867
1867
|
const Z = [];
|
|
@@ -1930,13 +1930,13 @@ const Fu = (n) => {
|
|
|
1930
1930
|
As = n;
|
|
1931
1931
|
};
|
|
1932
1932
|
let Do = 0;
|
|
1933
|
-
function
|
|
1933
|
+
function pt(n) {
|
|
1934
1934
|
return Vt(`_${n}`, Do++);
|
|
1935
1935
|
}
|
|
1936
1936
|
function Vt(n, e) {
|
|
1937
1937
|
return `?${n}-${e}`;
|
|
1938
1938
|
}
|
|
1939
|
-
class
|
|
1939
|
+
class tt extends Error {
|
|
1940
1940
|
constructor(e) {
|
|
1941
1941
|
super(e), this.name = "AttrNotFoundError";
|
|
1942
1942
|
}
|
|
@@ -1944,7 +1944,7 @@ class et extends Error {
|
|
|
1944
1944
|
function Uo(n, e) {
|
|
1945
1945
|
const t = Es(n, e);
|
|
1946
1946
|
if (!t)
|
|
1947
|
-
throw new
|
|
1947
|
+
throw new tt(`Could not find id attr for ${e}`);
|
|
1948
1948
|
return t;
|
|
1949
1949
|
}
|
|
1950
1950
|
function Ar(n, e, t, r) {
|
|
@@ -1964,19 +1964,19 @@ function Fo(n, e, t) {
|
|
|
1964
1964
|
function ks(n, e, t, r, s) {
|
|
1965
1965
|
const i = V(e, t, s), o = Ke(e, t, s), a = i || o;
|
|
1966
1966
|
if (!a)
|
|
1967
|
-
throw new
|
|
1967
|
+
throw new tt(`Could not find attr for ${[t, s]}`);
|
|
1968
1968
|
if (a["value-type"] !== "ref")
|
|
1969
1969
|
throw new Error(`Attr ${a.id} is not a ref`);
|
|
1970
1970
|
const [c, u] = a["forward-identity"], [l, f] = a["reverse-identity"], p = r + 1, y = i ? [
|
|
1971
1971
|
n(u, r),
|
|
1972
1972
|
a.id,
|
|
1973
1973
|
n(f, p),
|
|
1974
|
-
|
|
1974
|
+
pt("time")
|
|
1975
1975
|
] : [
|
|
1976
1976
|
n(u, p),
|
|
1977
1977
|
a.id,
|
|
1978
1978
|
n(f, r),
|
|
1979
|
-
|
|
1979
|
+
pt("time")
|
|
1980
1980
|
];
|
|
1981
1981
|
return [i ? f : u, p, y, a, !!i];
|
|
1982
1982
|
}
|
|
@@ -2053,24 +2053,24 @@ function No(n, e) {
|
|
|
2053
2053
|
function Wo(n, e, t, r, s, i) {
|
|
2054
2054
|
const o = V(e, t, s), a = Ke(e, t, s), c = o || a;
|
|
2055
2055
|
if (!c)
|
|
2056
|
-
throw new
|
|
2056
|
+
throw new tt(`No attr for etype = ${t} label = ${s}`);
|
|
2057
2057
|
if (i != null && i.hasOwnProperty("$isNull")) {
|
|
2058
2058
|
const u = V(e, t, "id");
|
|
2059
2059
|
if (!u)
|
|
2060
|
-
throw new
|
|
2060
|
+
throw new tt(`No attr for etype = ${t} label = id`);
|
|
2061
2061
|
return [
|
|
2062
2062
|
n(t, r),
|
|
2063
2063
|
u.id,
|
|
2064
2064
|
{ $isNull: { attrId: c.id, isNull: i.$isNull, reverse: !o } },
|
|
2065
|
-
|
|
2065
|
+
pt("time")
|
|
2066
2066
|
];
|
|
2067
2067
|
}
|
|
2068
2068
|
return o ? [
|
|
2069
2069
|
n(t, r),
|
|
2070
2070
|
c.id,
|
|
2071
2071
|
No(c, i),
|
|
2072
|
-
|
|
2073
|
-
] : [i, c.id, n(t, r),
|
|
2072
|
+
pt("time")
|
|
2073
|
+
] : [i, c.id, n(t, r), pt("time")];
|
|
2074
2074
|
}
|
|
2075
2075
|
function Ko(n, e, t, r, s) {
|
|
2076
2076
|
const [i, o, a] = s.reduce((c, u) => {
|
|
@@ -2172,7 +2172,7 @@ function Yo(n, e, t, { etype: r, level: s, form: i }, o) {
|
|
|
2172
2172
|
}), C = b ? v[0] : v;
|
|
2173
2173
|
return { [y]: C };
|
|
2174
2174
|
} catch (g) {
|
|
2175
|
-
if (g instanceof
|
|
2175
|
+
if (g instanceof tt)
|
|
2176
2176
|
return { [y]: b ? void 0 : [] };
|
|
2177
2177
|
throw g;
|
|
2178
2178
|
}
|
|
@@ -2184,11 +2184,11 @@ function Yo(n, e, t, { etype: r, level: s, form: i }, o) {
|
|
|
2184
2184
|
function Zo(n, e, t) {
|
|
2185
2185
|
return t === "string" ? $o(n, e) : n > e ? 1 : -1;
|
|
2186
2186
|
}
|
|
2187
|
-
function
|
|
2187
|
+
function lt(n, e, t, r, s) {
|
|
2188
2188
|
return e === r || e == null && r == null ? Ro(n, t) : r == null ? 1 : e == null ? -1 : Zo(e, r, s);
|
|
2189
2189
|
}
|
|
2190
2190
|
function Wt([n, e], [t, r], s) {
|
|
2191
|
-
return
|
|
2191
|
+
return lt(n, e, t, r, s);
|
|
2192
2192
|
}
|
|
2193
2193
|
function vn(n) {
|
|
2194
2194
|
return n == null ? n : new Date(n).getTime();
|
|
@@ -2290,7 +2290,7 @@ function aa(n, e, t) {
|
|
|
2290
2290
|
try {
|
|
2291
2291
|
return oa(n, e, t);
|
|
2292
2292
|
} catch (r) {
|
|
2293
|
-
if (r instanceof
|
|
2293
|
+
if (r instanceof tt)
|
|
2294
2294
|
return {};
|
|
2295
2295
|
throw r;
|
|
2296
2296
|
}
|
|
@@ -2781,7 +2781,7 @@ function Fa(n, e) {
|
|
|
2781
2781
|
function Mr(n, e) {
|
|
2782
2782
|
typeof requestIdleCallback > "u" ? n() : requestIdleCallback(n, { timeout: e });
|
|
2783
2783
|
}
|
|
2784
|
-
const
|
|
2784
|
+
const yt = "__meta";
|
|
2785
2785
|
class Na {
|
|
2786
2786
|
constructor(e, t) {
|
|
2787
2787
|
}
|
|
@@ -2819,7 +2819,7 @@ class Cn {
|
|
|
2819
2819
|
var e;
|
|
2820
2820
|
this._meta.loadingPromise && await this._meta.loadingPromise;
|
|
2821
2821
|
try {
|
|
2822
|
-
const t = this._persister.getItem(
|
|
2822
|
+
const t = this._persister.getItem(yt);
|
|
2823
2823
|
this._meta.loadingPromise = t;
|
|
2824
2824
|
const r = await t;
|
|
2825
2825
|
this._meta.isLoading = !1, this._meta.error = null, this._meta.loadingPromise = null, this._meta.attempts = 0;
|
|
@@ -2901,7 +2901,7 @@ class Cn {
|
|
|
2901
2901
|
const p = this._persister.removeItem(f);
|
|
2902
2902
|
t.push(p.then(() => 1)), this._loadedKeys.delete(f), this._pendingSaveKeys.delete(f);
|
|
2903
2903
|
}
|
|
2904
|
-
const a = [], c = [[
|
|
2904
|
+
const a = [], c = [[yt, s]], u = s.objects ?? {};
|
|
2905
2905
|
s.objects = u;
|
|
2906
2906
|
for (const f of o)
|
|
2907
2907
|
if (this._loadedKeys.has(f)) {
|
|
@@ -2930,7 +2930,7 @@ class Cn {
|
|
|
2930
2930
|
if (!this._gcOpts)
|
|
2931
2931
|
return;
|
|
2932
2932
|
const e = new Set(await this._persister.getAllKeys());
|
|
2933
|
-
e.delete(
|
|
2933
|
+
e.delete(yt);
|
|
2934
2934
|
const t = new Set(Object.keys(this.currentValue));
|
|
2935
2935
|
for (const p of Object.keys(this._loadingKeys))
|
|
2936
2936
|
t.add(p);
|
|
@@ -3070,7 +3070,7 @@ async function Va(n, e, t) {
|
|
|
3070
3070
|
const m = t.put(_, y);
|
|
3071
3071
|
s.add(m);
|
|
3072
3072
|
}
|
|
3073
|
-
const c = { objects: a }, u = t.put(c,
|
|
3073
|
+
const c = { objects: a }, u = t.put(c, yt);
|
|
3074
3074
|
s.add(u);
|
|
3075
3075
|
for (const y of s)
|
|
3076
3076
|
y.onsuccess = () => {
|
|
@@ -3126,7 +3126,7 @@ async function Ba(n, e) {
|
|
|
3126
3126
|
break;
|
|
3127
3127
|
}
|
|
3128
3128
|
}
|
|
3129
|
-
const u = Rr(
|
|
3129
|
+
const u = Rr(yt, c, i);
|
|
3130
3130
|
a.push(u), await Promise.all(a), await new Promise((l, f) => {
|
|
3131
3131
|
s.oncomplete = (p) => l(p), s.onerror = (p) => f(p), s.onabort = (p) => f(p);
|
|
3132
3132
|
});
|
|
@@ -3247,12 +3247,13 @@ class $s {
|
|
|
3247
3247
|
}
|
|
3248
3248
|
}
|
|
3249
3249
|
class se extends Error {
|
|
3250
|
-
constructor(t, r) {
|
|
3250
|
+
constructor(t, r, s) {
|
|
3251
3251
|
super(t);
|
|
3252
3252
|
h(this, "hint");
|
|
3253
|
-
this
|
|
3254
|
-
|
|
3255
|
-
|
|
3253
|
+
h(this, "traceId");
|
|
3254
|
+
this.hint = r, s && (this.traceId = s);
|
|
3255
|
+
const i = new.target.prototype;
|
|
3256
|
+
Object.setPrototypeOf && Object.setPrototypeOf(this, i), Error.captureStackTrace && Error.captureStackTrace(this, se), this.name = "InstantError";
|
|
3256
3257
|
}
|
|
3257
3258
|
get [Symbol.toStringTag]() {
|
|
3258
3259
|
return "InstantError";
|
|
@@ -3262,7 +3263,7 @@ class Bt extends se {
|
|
|
3262
3263
|
constructor(t) {
|
|
3263
3264
|
var i;
|
|
3264
3265
|
const r = ((i = t.body) == null ? void 0 : i.message) || `API Error (${t.status})`;
|
|
3265
|
-
super(r, t.body.hint);
|
|
3266
|
+
super(r, t.body.hint, t.body["trace-id"]);
|
|
3266
3267
|
h(this, "body");
|
|
3267
3268
|
h(this, "status");
|
|
3268
3269
|
const s = new.target.prototype;
|
|
@@ -3485,7 +3486,7 @@ function Lr(n) {
|
|
|
3485
3486
|
}, e;
|
|
3486
3487
|
}, {});
|
|
3487
3488
|
}
|
|
3488
|
-
const Xn = "v0.22.
|
|
3489
|
+
const Xn = "v0.22.156";
|
|
3489
3490
|
function oc(n, e) {
|
|
3490
3491
|
return {
|
|
3491
3492
|
info: n ? (...t) => console.info(...t, e()) : () => {
|
|
@@ -3663,14 +3664,14 @@ const Fr = [
|
|
|
3663
3664
|
if (!c)
|
|
3664
3665
|
throw new L(`Target entity '${o}' does not exist in schema for dot notation path '${n}'.`, s);
|
|
3665
3666
|
if (a === "id") {
|
|
3666
|
-
if (typeof e == "string" && !
|
|
3667
|
+
if (typeof e == "string" && !et(e))
|
|
3667
3668
|
throw new L(`Invalid value for id field in entity '${o}'. Expected a UUID, but received: ${e}`, s);
|
|
3668
3669
|
Ye(e, n, new ie("string", !1, !0), t, s);
|
|
3669
3670
|
return;
|
|
3670
3671
|
}
|
|
3671
3672
|
const u = c.attrs[a];
|
|
3672
3673
|
if (Object.keys(c.links).includes(a)) {
|
|
3673
|
-
if (typeof e == "string" && !
|
|
3674
|
+
if (typeof e == "string" && !et(e))
|
|
3674
3675
|
throw new L(`Invalid value for link '${a}' in entity '${o}'. Expected a UUID, but received: ${e}`, s);
|
|
3675
3676
|
Ye(e, n, new ie("string", !1, !0), t, s);
|
|
3676
3677
|
return;
|
|
@@ -3707,7 +3708,7 @@ const Fr = [
|
|
|
3707
3708
|
if (a)
|
|
3708
3709
|
Ye(i, s, a, e, `${r}.${s}`);
|
|
3709
3710
|
else if (c) {
|
|
3710
|
-
if (typeof i == "string" && !
|
|
3711
|
+
if (typeof i == "string" && !et(i))
|
|
3711
3712
|
throw new L(`Invalid value for link '${s}' in entity '${e}'. Expected a UUID, but received: ${i}`, `${r}.${s}`);
|
|
3712
3713
|
const u = new ie("string", !1, !0);
|
|
3713
3714
|
Ye(i, s, u, e, `${r}.${s}`);
|
|
@@ -3773,7 +3774,7 @@ const Fr = [
|
|
|
3773
3774
|
Ws(t[r], r, e, r, 0);
|
|
3774
3775
|
}
|
|
3775
3776
|
}
|
|
3776
|
-
}, Wr = (n) => typeof n != "string" ? !1 : Kt(n) ? !0 :
|
|
3777
|
+
}, Wr = (n) => typeof n != "string" ? !1 : Kt(n) ? !0 : et(n);
|
|
3777
3778
|
class ge extends Error {
|
|
3778
3779
|
constructor(e) {
|
|
3779
3780
|
super(e), this.name = "TransactionValidationError";
|
|
@@ -3834,7 +3835,7 @@ const Ks = (n) => n.length > 0 ? n.join(", ") : "none", fc = (n, e) => new ge(`E
|
|
|
3834
3835
|
if (!e)
|
|
3835
3836
|
return;
|
|
3836
3837
|
const [t, r, s, i] = n;
|
|
3837
|
-
if (!Array.isArray(s) && !
|
|
3838
|
+
if (!Array.isArray(s) && !et(s))
|
|
3838
3839
|
throw new ge(`Invalid id for entity '${r}'. Expected a UUID, but received: ${s}`);
|
|
3839
3840
|
if (typeof r != "string")
|
|
3840
3841
|
throw new ge(`Entity name must be a string, but received: ${typeof r}`);
|
|
@@ -4027,7 +4028,7 @@ function zr(n, e, t, r) {
|
|
|
4027
4028
|
const s = (o = V(t, n.table, "id")) == null ? void 0 : o.id;
|
|
4028
4029
|
if (!s)
|
|
4029
4030
|
return -1;
|
|
4030
|
-
const i =
|
|
4031
|
+
const i = nt(e.eav, [r, s, r]);
|
|
4031
4032
|
return i ? i[3] : -1;
|
|
4032
4033
|
}
|
|
4033
4034
|
function Vr(n, e, t) {
|
|
@@ -4080,17 +4081,17 @@ function Sc(n, e, t) {
|
|
|
4080
4081
|
const r = e;
|
|
4081
4082
|
if (n.orderField === "serverCreatedAt") {
|
|
4082
4083
|
t.sort(n.orderDirection === "asc" ? function(o, a) {
|
|
4083
|
-
return
|
|
4084
|
+
return lt(o.entity.id, o.serverCreatedAt, a.entity.id, a.serverCreatedAt, r);
|
|
4084
4085
|
} : function(o, a) {
|
|
4085
|
-
return
|
|
4086
|
+
return lt(a.entity.id, a.serverCreatedAt, o.entity.id, o.serverCreatedAt, r);
|
|
4086
4087
|
});
|
|
4087
4088
|
return;
|
|
4088
4089
|
}
|
|
4089
4090
|
const s = n.orderField;
|
|
4090
4091
|
t.sort(n.orderDirection === "asc" ? function(o, a) {
|
|
4091
|
-
return
|
|
4092
|
+
return lt(o.entity.id, o.entity[s], a.entity.id, a.entity[s], r);
|
|
4092
4093
|
} : function(o, a) {
|
|
4093
|
-
return
|
|
4094
|
+
return lt(a.entity.id, a.entity[s], o.entity.id, o.entity[s], r);
|
|
4094
4095
|
});
|
|
4095
4096
|
}
|
|
4096
4097
|
var xe;
|
|
@@ -4492,8 +4493,8 @@ function Ec({ WStream: n, opts: e, startStream: t, appendStream: r, registerStre
|
|
|
4492
4493
|
});
|
|
4493
4494
|
switch (ae.type) {
|
|
4494
4495
|
case "ok": {
|
|
4495
|
-
const { streamId: _e, offset:
|
|
4496
|
-
if (
|
|
4496
|
+
const { streamId: _e, offset: rt } = ae;
|
|
4497
|
+
if (rt !== 0) {
|
|
4497
4498
|
const me = new se("Write stream is corrupted");
|
|
4498
4499
|
te(A, me);
|
|
4499
4500
|
return;
|
|
@@ -4530,10 +4531,10 @@ function Ec({ WStream: n, opts: e, startStream: t, appendStream: r, registerStre
|
|
|
4530
4531
|
me();
|
|
4531
4532
|
}, _e = (me) => {
|
|
4532
4533
|
I(me), ae();
|
|
4533
|
-
},
|
|
4534
|
+
}, rt = (me) => {
|
|
4534
4535
|
H(me || new se("Stream is closed.")), ae();
|
|
4535
4536
|
};
|
|
4536
|
-
Y.push(U(_e)), Y.push(v(
|
|
4537
|
+
Y.push(U(_e)), Y.push(v(rt));
|
|
4537
4538
|
});
|
|
4538
4539
|
}
|
|
4539
4540
|
}
|
|
@@ -5049,6 +5050,8 @@ class Nc {
|
|
|
5049
5050
|
h(this, "_pendingTxCleanupTimeout");
|
|
5050
5051
|
h(this, "_pendingMutationCleanupThreshold");
|
|
5051
5052
|
h(this, "_inFlightMutationEventIds", /* @__PURE__ */ new Set());
|
|
5053
|
+
/** @type FrameworkClient | null */
|
|
5054
|
+
h(this, "_frameworkClient", null);
|
|
5052
5055
|
h(this, "_onMergeKv", (e, t, r) => {
|
|
5053
5056
|
switch (e) {
|
|
5054
5057
|
case "pendingMutations": {
|
|
@@ -5193,7 +5196,7 @@ class Nc {
|
|
|
5193
5196
|
if (this._EventSource = i, this.config = { ...Rc, ...e }, this.queryCacheLimit = this.config.queryCacheLimit ?? 10, this._pendingTxCleanupTimeout = this.config.pendingTxCleanupTimeout ?? Ic, this._pendingMutationCleanupThreshold = this.config.pendingMutationCleanupThreshold ?? Pc, this._log = oc(e.verbose || Zn || Ds, () => this._reactorStats()), this.versions = { ...s || {}, "@instantdb/core": Xn }, this.config.schema && (this._linkIndex = Lr(this.config.schema)), !!xc()) {
|
|
5194
5197
|
if (!e.appId)
|
|
5195
5198
|
throw new Error("Instant must be initialized with an appId.");
|
|
5196
|
-
if (!
|
|
5199
|
+
if (!et(e.appId))
|
|
5197
5200
|
throw new Error(`Instant must be initialized with a valid appId. \`${e.appId}\` is not a valid uuid.`);
|
|
5198
5201
|
typeof BroadcastChannel == "function" && (this._broadcastChannel = new BroadcastChannel("@instantdb"), this._broadcastChannel.addEventListener("message", async (o) => {
|
|
5199
5202
|
var a;
|
|
@@ -5211,7 +5214,7 @@ class Nc {
|
|
|
5211
5214
|
}
|
|
5212
5215
|
})), this._initStorage(t), this._syncTable = new vc(this._trySendAuthed.bind(this), new t(this.config.appId, "syncSubs"), {
|
|
5213
5216
|
useDateObjects: this.config.useDateObjects
|
|
5214
|
-
}, this._log, (o) =>
|
|
5217
|
+
}, this._log, (o) => ut(this.ensureAttrs(), o, this.config.enableCardinalityInference, this.config.useDateObjects), () => this.ensureAttrs()), this._instantStream = new kc({
|
|
5215
5218
|
WStream: this.config.WritableStream || WritableStream,
|
|
5216
5219
|
RStream: this.config.ReadableStream || ReadableStream,
|
|
5217
5220
|
trySend: this._trySendAuthed.bind(this),
|
|
@@ -5228,6 +5231,13 @@ class Nc {
|
|
|
5228
5231
|
}), typeof addEventListener < "u" && (this._beforeUnload = this._beforeUnload.bind(this), addEventListener("beforeunload", this._beforeUnload));
|
|
5229
5232
|
}
|
|
5230
5233
|
}
|
|
5234
|
+
getFrameworkClient() {
|
|
5235
|
+
return this._frameworkClient;
|
|
5236
|
+
}
|
|
5237
|
+
/** @param {FrameworkClient} client */
|
|
5238
|
+
setFrameworkClient(e) {
|
|
5239
|
+
this._frameworkClient = e;
|
|
5240
|
+
}
|
|
5231
5241
|
ensureAttrs() {
|
|
5232
5242
|
if (!this.attrs)
|
|
5233
5243
|
throw new Error("attrs have not loaded.");
|
|
@@ -5337,7 +5347,7 @@ class Nc {
|
|
|
5337
5347
|
_addQueryData(e, t, r) {
|
|
5338
5348
|
if (!this.attrs)
|
|
5339
5349
|
throw new Error("Attrs in reactor have not been set");
|
|
5340
|
-
const s = J(e), i = this.ensureAttrs(), o =
|
|
5350
|
+
const s = J(e), i = this.ensureAttrs(), o = ut(this.attrs, t.triples, r, this.config.useDateObjects);
|
|
5341
5351
|
this.querySubs.updateInPlace((a) => {
|
|
5342
5352
|
a[s] = {
|
|
5343
5353
|
result: {
|
|
@@ -5371,7 +5381,7 @@ class Nc {
|
|
|
5371
5381
|
const { q: y, result: b } = t, _ = J(y);
|
|
5372
5382
|
if (!this._hasQueryListeners() && !this.querySubs.currentValue[_])
|
|
5373
5383
|
break;
|
|
5374
|
-
const m = (c = (a = b == null ? void 0 : b[0]) == null ? void 0 : a.data) == null ? void 0 : c["page-info"], S = (l = (u = b == null ? void 0 : b[0]) == null ? void 0 : u.data) == null ? void 0 : l.aggregate, g = Ur(b), w = this.ensureAttrs(), O =
|
|
5384
|
+
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 = ut(w, g, r, this.config.useDateObjects);
|
|
5375
5385
|
this.querySubs.updateInPlace((v) => {
|
|
5376
5386
|
if (!v[_]) {
|
|
5377
5387
|
this._log.info("Missing value in querySubs", { hash: _, q: y });
|
|
@@ -5428,7 +5438,7 @@ class Nc {
|
|
|
5428
5438
|
});
|
|
5429
5439
|
const S = ln(m.entries()), g = y.map((w) => {
|
|
5430
5440
|
var W, Q, ee, Ae;
|
|
5431
|
-
const O = w["instaql-query"], v = w["instaql-result"], C = J(O), j = Ur(v), U = this.ensureAttrs(), B =
|
|
5441
|
+
const O = w["instaql-query"], v = w["instaql-result"], C = J(O), j = Ur(v), U = this.ensureAttrs(), B = ut(U, j, r, this.config.useDateObjects), { store: ye, attrsStore: Re } = this._applyOptimisticUpdates(B, U, S, _), te = (Q = (W = v == null ? void 0 : v[0]) == null ? void 0 : W.data) == null ? void 0 : Q["page-info"], oe = (Ae = (ee = v == null ? void 0 : v[0]) == null ? void 0 : ee.data) == null ? void 0 : Ae.aggregate;
|
|
5432
5442
|
return {
|
|
5433
5443
|
q: O,
|
|
5434
5444
|
hash: C,
|
|
@@ -6071,7 +6081,7 @@ class Nc {
|
|
|
6071
6081
|
var r;
|
|
6072
6082
|
const { user: t } = await this.getCurrentUser();
|
|
6073
6083
|
if (!jt(t, e)) {
|
|
6074
|
-
await this.setCurrentUser(e), await this.updateUser(e);
|
|
6084
|
+
this._frameworkClient = null, await this.setCurrentUser(e), await this.updateUser(e);
|
|
6075
6085
|
try {
|
|
6076
6086
|
await this.kv.flush(), (r = this._broadcastChannel) == null || r.postMessage({ type: "auth" });
|
|
6077
6087
|
} catch (s) {
|
|
@@ -7083,7 +7093,7 @@ function pu(n, e) {
|
|
|
7083
7093
|
};
|
|
7084
7094
|
t.allowedHosts.includes(window.location.hostname) && Jc(n, t);
|
|
7085
7095
|
}
|
|
7086
|
-
var Mn = { exports: {} },
|
|
7096
|
+
var Mn = { exports: {} }, it = {};
|
|
7087
7097
|
/**
|
|
7088
7098
|
* @license React
|
|
7089
7099
|
* react-jsx-runtime.production.min.js
|
|
@@ -7095,7 +7105,7 @@ var Mn = { exports: {} }, st = {};
|
|
|
7095
7105
|
*/
|
|
7096
7106
|
var Hr;
|
|
7097
7107
|
function yu() {
|
|
7098
|
-
if (Hr) return
|
|
7108
|
+
if (Hr) return it;
|
|
7099
7109
|
Hr = 1;
|
|
7100
7110
|
var n = rs, e = Symbol.for("react.element"), t = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, s = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, i = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
7101
7111
|
function o(a, c, u) {
|
|
@@ -7105,11 +7115,11 @@ function yu() {
|
|
|
7105
7115
|
if (a && a.defaultProps) for (l in c = a.defaultProps, c) f[l] === void 0 && (f[l] = c[l]);
|
|
7106
7116
|
return { $$typeof: e, type: a, key: p, ref: y, props: f, _owner: s.current };
|
|
7107
7117
|
}
|
|
7108
|
-
return
|
|
7118
|
+
return it.Fragment = t, it.jsx = o, it.jsxs = o, it;
|
|
7109
7119
|
}
|
|
7110
|
-
var
|
|
7120
|
+
var ot = {}, Jr;
|
|
7111
7121
|
function bu() {
|
|
7112
|
-
if (Jr) return
|
|
7122
|
+
if (Jr) return ot;
|
|
7113
7123
|
Jr = 1;
|
|
7114
7124
|
var n = {};
|
|
7115
7125
|
/**
|
|
@@ -7238,7 +7248,7 @@ function bu() {
|
|
|
7238
7248
|
ee++;
|
|
7239
7249
|
}
|
|
7240
7250
|
}
|
|
7241
|
-
function
|
|
7251
|
+
function rt() {
|
|
7242
7252
|
{
|
|
7243
7253
|
if (ee--, ee === 0) {
|
|
7244
7254
|
var d = {
|
|
@@ -7358,7 +7368,7 @@ function bu() {
|
|
|
7358
7368
|
}
|
|
7359
7369
|
}
|
|
7360
7370
|
} finally {
|
|
7361
|
-
Yt = !1, me.current = D,
|
|
7371
|
+
Yt = !1, me.current = D, rt(), Error.prepareStackTrace = $;
|
|
7362
7372
|
}
|
|
7363
7373
|
var ze = d ? d.displayName || d.name : "", je = ze ? St(ze) : "";
|
|
7364
7374
|
return typeof d == "function" && vt.set(d, je), je;
|
|
@@ -7399,7 +7409,7 @@ function bu() {
|
|
|
7399
7409
|
}
|
|
7400
7410
|
return "";
|
|
7401
7411
|
}
|
|
7402
|
-
var
|
|
7412
|
+
var st = Object.prototype.hasOwnProperty, nr = {}, rr = g.ReactDebugCurrentFrame;
|
|
7403
7413
|
function Ot(d) {
|
|
7404
7414
|
if (d) {
|
|
7405
7415
|
var T = d._owner, E = Et(d.type, d._source, T ? T.type : null);
|
|
@@ -7409,7 +7419,7 @@ function bu() {
|
|
|
7409
7419
|
}
|
|
7410
7420
|
function Ys(d, T, E, k, $) {
|
|
7411
7421
|
{
|
|
7412
|
-
var D = Function.call.bind(
|
|
7422
|
+
var D = Function.call.bind(st);
|
|
7413
7423
|
for (var x in d)
|
|
7414
7424
|
if (D(d, x)) {
|
|
7415
7425
|
var M = void 0;
|
|
@@ -7457,7 +7467,7 @@ function bu() {
|
|
|
7457
7467
|
__source: !0
|
|
7458
7468
|
}, ar, cr;
|
|
7459
7469
|
function ni(d) {
|
|
7460
|
-
if (
|
|
7470
|
+
if (st.call(d, "ref")) {
|
|
7461
7471
|
var T = Object.getOwnPropertyDescriptor(d, "ref").get;
|
|
7462
7472
|
if (T && T.isReactWarning)
|
|
7463
7473
|
return !1;
|
|
@@ -7465,7 +7475,7 @@ function bu() {
|
|
|
7465
7475
|
return d.ref !== void 0;
|
|
7466
7476
|
}
|
|
7467
7477
|
function ri(d) {
|
|
7468
|
-
if (
|
|
7478
|
+
if (st.call(d, "key")) {
|
|
7469
7479
|
var T = Object.getOwnPropertyDescriptor(d, "key").get;
|
|
7470
7480
|
if (T && T.isReactWarning)
|
|
7471
7481
|
return !1;
|
|
@@ -7531,7 +7541,7 @@ function bu() {
|
|
|
7531
7541
|
var D, x = {}, M = null, ne = null;
|
|
7532
7542
|
E !== void 0 && (ir(E), M = "" + E), ri(T) && (ir(T.key), M = "" + T.key), ni(T) && (ne = T.ref, si(T, $));
|
|
7533
7543
|
for (D in T)
|
|
7534
|
-
|
|
7544
|
+
st.call(T, D) && !ti.hasOwnProperty(D) && (x[D] = T[D]);
|
|
7535
7545
|
if (d && d.defaultProps) {
|
|
7536
7546
|
var K = d.defaultProps;
|
|
7537
7547
|
for (D in K)
|
|
@@ -7682,7 +7692,7 @@ Check the top-level render call using <` + E + ">.");
|
|
|
7682
7692
|
else
|
|
7683
7693
|
hr(be, d);
|
|
7684
7694
|
}
|
|
7685
|
-
if (
|
|
7695
|
+
if (st.call(T, "key")) {
|
|
7686
7696
|
var je = W(d), ce = Object.keys(T).filter(function(_i) {
|
|
7687
7697
|
return _i !== "key";
|
|
7688
7698
|
}), nn = ce.length > 0 ? "{key: someKey, " + ce.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
@@ -7706,8 +7716,8 @@ React keys must be passed directly to JSX without using spread:
|
|
|
7706
7716
|
return yr(d, T, E, !1);
|
|
7707
7717
|
}
|
|
7708
7718
|
var yi = pi, bi = hi;
|
|
7709
|
-
|
|
7710
|
-
}(),
|
|
7719
|
+
ot.Fragment = s, ot.jsx = yi, ot.jsxs = bi;
|
|
7720
|
+
}(), ot;
|
|
7711
7721
|
}
|
|
7712
7722
|
var gu = {};
|
|
7713
7723
|
gu.NODE_ENV === "production" ? Mn.exports = yu() : Mn.exports = bu();
|
|
@@ -7727,29 +7737,29 @@ function Yr(n) {
|
|
|
7727
7737
|
...n || {}
|
|
7728
7738
|
};
|
|
7729
7739
|
}
|
|
7730
|
-
function mu(n, e, t) {
|
|
7740
|
+
function mu(n, e, t, r) {
|
|
7731
7741
|
e && t && "ruleParams" in t && (e = { $$ruleParams: t.ruleParams, ...e });
|
|
7732
|
-
const
|
|
7733
|
-
(
|
|
7734
|
-
|
|
7735
|
-
isLoading: !
|
|
7742
|
+
const s = e ? lu(e) : null, i = J(s), o = Xe(Yr(n._reactor.getPreviousResult(s))), a = Xe(_u), c = Me(
|
|
7743
|
+
(l) => (o.current = Yr(n._reactor.getPreviousResult(s)), l(), s ? n.subscribeQuery(s, (p) => {
|
|
7744
|
+
o.current = {
|
|
7745
|
+
isLoading: !p,
|
|
7736
7746
|
// @ts-expect-error: ts thinks this will always be overwritten
|
|
7737
7747
|
data: void 0,
|
|
7738
7748
|
// @ts-expect-error: ts thinks this will always be overwritten
|
|
7739
7749
|
pageInfo: void 0,
|
|
7740
7750
|
// @ts-expect-error: ts thinks this will always be overwritten
|
|
7741
7751
|
error: void 0,
|
|
7742
|
-
...
|
|
7743
|
-
},
|
|
7752
|
+
...p
|
|
7753
|
+
}, l();
|
|
7744
7754
|
}) : () => {
|
|
7745
7755
|
}),
|
|
7746
7756
|
// Build a new subscribe function if the query changes
|
|
7747
|
-
[
|
|
7757
|
+
[i]
|
|
7748
7758
|
);
|
|
7749
|
-
return { state: dn(
|
|
7759
|
+
return { state: dn(c, () => o.current, () => a.current), query: s, queryHash: i };
|
|
7750
7760
|
}
|
|
7751
7761
|
function wu() {
|
|
7752
|
-
const n =
|
|
7762
|
+
const n = Xe(null);
|
|
7753
7763
|
Fe(() => {
|
|
7754
7764
|
t();
|
|
7755
7765
|
}, []);
|
|
@@ -7763,7 +7773,7 @@ function wu() {
|
|
|
7763
7773
|
}
|
|
7764
7774
|
const Tu = 1e3;
|
|
7765
7775
|
function Su(n, e, t) {
|
|
7766
|
-
const r =
|
|
7776
|
+
const r = Xe(t);
|
|
7767
7777
|
r.current = t, Fe(() => n.core._reactor.subscribeTopic(n.type, n.id, e, (i, o) => {
|
|
7768
7778
|
r.current(i, o);
|
|
7769
7779
|
}), [n.id, e]);
|
|
@@ -8095,7 +8105,7 @@ class $t {
|
|
|
8095
8105
|
* }
|
|
8096
8106
|
*/
|
|
8097
8107
|
h(this, "useConnectionStatus", () => {
|
|
8098
|
-
const e =
|
|
8108
|
+
const e = Xe(this.core._reactor.status), t = Me((s) => this.core.subscribeConnectionStatus((o) => {
|
|
8099
8109
|
o !== e.current && (e.current = o, s());
|
|
8100
8110
|
}), []);
|
|
8101
8111
|
return dn(
|
|
@@ -8174,7 +8184,7 @@ class $t {
|
|
|
8174
8184
|
return new ku(this.core, e, t);
|
|
8175
8185
|
}
|
|
8176
8186
|
_useAuth() {
|
|
8177
|
-
const e =
|
|
8187
|
+
const e = Xe(this.core._reactor._currentUserCached), t = Me((s) => this.core.subscribeAuth((o) => {
|
|
8178
8188
|
e.current = { isLoading: !1, ...o }, s();
|
|
8179
8189
|
}), []);
|
|
8180
8190
|
return dn(t, () => e.current, () => Cu);
|
|
@@ -8356,32 +8366,32 @@ function es(n) {
|
|
|
8356
8366
|
}
|
|
8357
8367
|
var Bs = (n) => {
|
|
8358
8368
|
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), F = (n, e, t, r) => (er(n, e, "write to private field"), e.set(n, t), t), ke = (n, e, t) => (er(n, e, "access private method"), t), ue, De, Ge, Dt, qt,
|
|
8369
|
+
}, er = (n, e, t) => e.has(n) || Bs("Cannot " + t), P = (n, e, t) => (er(n, e, "read from private field"), t ? t.call(n) : e.get(n)), G = (n, e, t) => e.has(n) ? Bs("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), F = (n, e, t, r) => (er(n, e, "write to private field"), e.set(n, t), t), ke = (n, e, t) => (er(n, e, "access private method"), t), ue, De, Ge, Dt, qt, bt, Je, gt, Pe, Qe, Ze, He, ft, we, jn, xn, $n, ts, Dn, Un, dt, Ln, Fn;
|
|
8360
8370
|
class Ut extends EventTarget {
|
|
8361
8371
|
constructor(e, t) {
|
|
8362
8372
|
var r, s;
|
|
8363
|
-
super(), G(this, we), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, G(this, ue), G(this, De), G(this, Ge), G(this, Dt), G(this, qt), G(this,
|
|
8373
|
+
super(), G(this, we), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, G(this, ue), G(this, De), G(this, Ge), G(this, Dt), G(this, qt), G(this, bt), G(this, Je), G(this, gt, null), G(this, Pe), G(this, Qe), G(this, Ze, null), G(this, He, null), G(this, ft, null), G(this, xn, async (i) => {
|
|
8364
8374
|
var o;
|
|
8365
8375
|
P(this, Qe).reset();
|
|
8366
8376
|
const { body: a, redirected: c, status: u, headers: l } = i;
|
|
8367
8377
|
if (u === 204) {
|
|
8368
|
-
ke(this, we,
|
|
8378
|
+
ke(this, we, dt).call(this, "Server sent HTTP 204, not reconnecting", 204), this.close();
|
|
8369
8379
|
return;
|
|
8370
8380
|
}
|
|
8371
8381
|
if (c ? F(this, Ge, new URL(i.url)) : F(this, Ge, void 0), u !== 200) {
|
|
8372
|
-
ke(this, we,
|
|
8382
|
+
ke(this, we, dt).call(this, `Non-200 status code (${u})`, u);
|
|
8373
8383
|
return;
|
|
8374
8384
|
}
|
|
8375
8385
|
if (!(l.get("content-type") || "").startsWith("text/event-stream")) {
|
|
8376
|
-
ke(this, we,
|
|
8386
|
+
ke(this, we, dt).call(this, 'Invalid content type, expected "text/event-stream"', u);
|
|
8377
8387
|
return;
|
|
8378
8388
|
}
|
|
8379
8389
|
if (P(this, ue) === this.CLOSED)
|
|
8380
8390
|
return;
|
|
8381
8391
|
F(this, ue, this.OPEN);
|
|
8382
8392
|
const f = new Event("open");
|
|
8383
|
-
if ((o = P(this,
|
|
8384
|
-
ke(this, we,
|
|
8393
|
+
if ((o = P(this, ft)) == null || o.call(this, f), this.dispatchEvent(f), typeof a != "object" || !a || !("getReader" in a)) {
|
|
8394
|
+
ke(this, we, dt).call(this, "Invalid response body, expected a web ReadableStream", u), this.close();
|
|
8385
8395
|
return;
|
|
8386
8396
|
}
|
|
8387
8397
|
const p = new TextDecoder(), y = a.getReader();
|
|
@@ -8393,7 +8403,7 @@ class Ut extends EventTarget {
|
|
|
8393
8403
|
}), G(this, $n, (i) => {
|
|
8394
8404
|
F(this, Pe, void 0), !(i.name === "AbortError" || i.type === "aborted") && ke(this, we, Ln).call(this, Rn(i));
|
|
8395
8405
|
}), G(this, Dn, (i) => {
|
|
8396
|
-
typeof i.id == "string" && F(this,
|
|
8406
|
+
typeof i.id == "string" && F(this, gt, i.id);
|
|
8397
8407
|
const o = new MessageEvent(i.event || "message", {
|
|
8398
8408
|
data: i.data,
|
|
8399
8409
|
origin: P(this, Ge) ? P(this, Ge).origin : P(this, De).origin,
|
|
@@ -8401,7 +8411,7 @@ class Ut extends EventTarget {
|
|
|
8401
8411
|
});
|
|
8402
8412
|
P(this, He) && (!i.event || i.event === "message") && P(this, He).call(this, o), this.dispatchEvent(o);
|
|
8403
8413
|
}), G(this, Un, (i) => {
|
|
8404
|
-
F(this,
|
|
8414
|
+
F(this, bt, i);
|
|
8405
8415
|
}), G(this, Fn, () => {
|
|
8406
8416
|
F(this, Je, void 0), P(this, ue) === this.CONNECTING && ke(this, we, jn).call(this);
|
|
8407
8417
|
});
|
|
@@ -8418,7 +8428,7 @@ class Ut extends EventTarget {
|
|
|
8418
8428
|
F(this, Qe, Iu({
|
|
8419
8429
|
onEvent: P(this, Dn),
|
|
8420
8430
|
onRetry: P(this, Un)
|
|
8421
|
-
})), F(this, ue, this.CONNECTING), F(this,
|
|
8431
|
+
})), F(this, ue, this.CONNECTING), F(this, bt, 3e3), F(this, qt, (r = t == null ? void 0 : t.fetch) != null ? r : globalThis.fetch), F(this, Dt, (s = t == null ? void 0 : t.withCredentials) != null ? s : !1), ke(this, we, jn).call(this);
|
|
8422
8432
|
}
|
|
8423
8433
|
/**
|
|
8424
8434
|
* Returns the state of this EventSource object's connection. It can have the values described below.
|
|
@@ -8467,10 +8477,10 @@ class Ut extends EventTarget {
|
|
|
8467
8477
|
}
|
|
8468
8478
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */
|
|
8469
8479
|
get onopen() {
|
|
8470
|
-
return P(this,
|
|
8480
|
+
return P(this, ft);
|
|
8471
8481
|
}
|
|
8472
8482
|
set onopen(e) {
|
|
8473
|
-
F(this,
|
|
8483
|
+
F(this, ft, e);
|
|
8474
8484
|
}
|
|
8475
8485
|
addEventListener(e, t, r) {
|
|
8476
8486
|
const s = t;
|
|
@@ -8491,7 +8501,7 @@ class Ut extends EventTarget {
|
|
|
8491
8501
|
P(this, Je) && clearTimeout(P(this, Je)), P(this, ue) !== this.CLOSED && (P(this, Pe) && P(this, Pe).abort(), F(this, ue, this.CLOSED), F(this, Pe, void 0));
|
|
8492
8502
|
}
|
|
8493
8503
|
}
|
|
8494
|
-
ue = /* @__PURE__ */ new WeakMap(), De = /* @__PURE__ */ new WeakMap(), Ge = /* @__PURE__ */ new WeakMap(), Dt = /* @__PURE__ */ new WeakMap(), qt = /* @__PURE__ */ new WeakMap(),
|
|
8504
|
+
ue = /* @__PURE__ */ new WeakMap(), De = /* @__PURE__ */ new WeakMap(), Ge = /* @__PURE__ */ new WeakMap(), Dt = /* @__PURE__ */ new WeakMap(), qt = /* @__PURE__ */ new WeakMap(), bt = /* @__PURE__ */ new WeakMap(), Je = /* @__PURE__ */ new WeakMap(), gt = /* @__PURE__ */ new WeakMap(), Pe = /* @__PURE__ */ new WeakMap(), Qe = /* @__PURE__ */ new WeakMap(), Ze = /* @__PURE__ */ new WeakMap(), He = /* @__PURE__ */ new WeakMap(), ft = /* @__PURE__ */ new WeakMap(), we = /* @__PURE__ */ new WeakSet(), /**
|
|
8495
8505
|
* Connect to the given URL and start receiving events
|
|
8496
8506
|
*
|
|
8497
8507
|
* @internal
|
|
@@ -8511,7 +8521,7 @@ ts = function() {
|
|
|
8511
8521
|
// [spec] …will have their mode set to "cors"…
|
|
8512
8522
|
mode: "cors",
|
|
8513
8523
|
redirect: "follow",
|
|
8514
|
-
headers: { Accept: "text/event-stream", ...P(this,
|
|
8524
|
+
headers: { Accept: "text/event-stream", ...P(this, gt) ? { "Last-Event-ID": P(this, gt) } : void 0 },
|
|
8515
8525
|
cache: "no-store",
|
|
8516
8526
|
signal: (n = P(this, Pe)) == null ? void 0 : n.signal
|
|
8517
8527
|
};
|
|
@@ -8523,7 +8533,7 @@ ts = function() {
|
|
|
8523
8533
|
* @param code - The HTTP status code, if available
|
|
8524
8534
|
* @internal
|
|
8525
8535
|
*/
|
|
8526
|
-
|
|
8536
|
+
dt = function(n, e) {
|
|
8527
8537
|
var t;
|
|
8528
8538
|
P(this, ue) !== this.CLOSED && F(this, ue, this.CLOSED);
|
|
8529
8539
|
const r = new Xr("error", { code: e, message: n });
|
|
@@ -8541,7 +8551,7 @@ Ln = function(n, e) {
|
|
|
8541
8551
|
return;
|
|
8542
8552
|
F(this, ue, this.CONNECTING);
|
|
8543
8553
|
const r = new Xr("error", { code: e, message: n });
|
|
8544
|
-
(t = P(this, Ze)) == null || t.call(this, r), this.dispatchEvent(r), F(this, Je, setTimeout(P(this, Fn), P(this,
|
|
8554
|
+
(t = P(this, Ze)) == null || t.call(this, r), this.dispatchEvent(r), F(this, Je, setTimeout(P(this, Fn), P(this, bt)));
|
|
8545
8555
|
}, Fn = /* @__PURE__ */ new WeakMap(), /**
|
|
8546
8556
|
* ReadyState representing an EventSource currently trying to connect
|
|
8547
8557
|
*
|