@instantdb/react 0.22.162 → 0.22.163-branch-inclusive.23215682227.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 +129 -110
- package/dist/standalone/index.umd.cjs +5 -5
- package/package.json +4 -4
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 et, 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 pt(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 || pt(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 ct(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(ct);
|
|
207
207
|
if (n instanceof Map) {
|
|
208
208
|
const t = Array.from(n.entries()).map(([r, s]) => [
|
|
209
209
|
r,
|
|
210
|
-
|
|
210
|
+
ct(s)
|
|
211
211
|
]);
|
|
212
212
|
if (!Kn(n)) {
|
|
213
213
|
const r = Object.getPrototypeOf(n).constructor;
|
|
@@ -216,7 +216,7 @@ function at(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(ct);
|
|
220
220
|
if (!Wn(n)) {
|
|
221
221
|
const r = Object.getPrototypeOf(n).constructor;
|
|
222
222
|
return new r(t);
|
|
@@ -225,11 +225,11 @@ function at(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] = ct(n[t]);
|
|
229
229
|
return e;
|
|
230
230
|
}
|
|
231
231
|
function Rt(n) {
|
|
232
|
-
return Ne(n) ?
|
|
232
|
+
return Ne(n) ? ct(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 ? pt(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 (!pt(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 || pt(n.original, e)) || (re(n), Oe(n), pt(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 (!ut(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 (!ut(n) || !ut(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 = ut(n[r]) && ut(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 ut(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 rt(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 lt(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 rt(n.eav, [e]) !== void 0;
|
|
1476
1476
|
}
|
|
1477
|
-
function
|
|
1477
|
+
function lt(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 = rt(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 = rt(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 = rt(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 rt(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 tt(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 yt(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 nt extends Error {
|
|
1940
1940
|
constructor(e) {
|
|
1941
1941
|
super(e), this.name = "AttrNotFoundError";
|
|
1942
1942
|
}
|
|
@@ -1944,7 +1944,7 @@ class tt 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 nt(`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 nt(`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
|
+
yt("time")
|
|
1975
1975
|
] : [
|
|
1976
1976
|
n(u, p),
|
|
1977
1977
|
a.id,
|
|
1978
1978
|
n(f, r),
|
|
1979
|
-
|
|
1979
|
+
yt("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 nt(`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 nt(`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
|
+
yt("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
|
+
yt("time")
|
|
2073
|
+
] : [i, c.id, n(t, r), yt("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 nt)
|
|
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 ft(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 ft(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 nt)
|
|
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 Je = "__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(Je);
|
|
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 = [[Je, 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(Je);
|
|
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);
|
|
@@ -3025,6 +3025,14 @@ class Cn {
|
|
|
3025
3025
|
this._subs = this._subs.filter((t) => t !== e);
|
|
3026
3026
|
};
|
|
3027
3027
|
}
|
|
3028
|
+
// Removes any keys that we haven't loaded--used when
|
|
3029
|
+
// changing users to make sure we clean out all user data
|
|
3030
|
+
async clearUnloadedKeys() {
|
|
3031
|
+
let e = !1;
|
|
3032
|
+
for (const t of await this._persister.getAllKeys())
|
|
3033
|
+
t === Je || t in this.currentValue || (this._pendingSaveKeys.add(t), e = !0);
|
|
3034
|
+
e && await this._enqueuePersist();
|
|
3035
|
+
}
|
|
3028
3036
|
}
|
|
3029
3037
|
const Wa = 6, Ka = ["kv", "querySubs", "syncSubs"];
|
|
3030
3038
|
function qa(n) {
|
|
@@ -3070,7 +3078,7 @@ async function Va(n, e, t) {
|
|
|
3070
3078
|
const m = t.put(_, y);
|
|
3071
3079
|
s.add(m);
|
|
3072
3080
|
}
|
|
3073
|
-
const c = { objects: a }, u = t.put(c,
|
|
3081
|
+
const c = { objects: a }, u = t.put(c, Je);
|
|
3074
3082
|
s.add(u);
|
|
3075
3083
|
for (const y of s)
|
|
3076
3084
|
y.onsuccess = () => {
|
|
@@ -3126,7 +3134,7 @@ async function Ba(n, e) {
|
|
|
3126
3134
|
break;
|
|
3127
3135
|
}
|
|
3128
3136
|
}
|
|
3129
|
-
const u = Rr(
|
|
3137
|
+
const u = Rr(Je, c, i);
|
|
3130
3138
|
a.push(u), await Promise.all(a), await new Promise((l, f) => {
|
|
3131
3139
|
s.oncomplete = (p) => l(p), s.onerror = (p) => f(p), s.onabort = (p) => f(p);
|
|
3132
3140
|
});
|
|
@@ -3486,7 +3494,7 @@ function Lr(n) {
|
|
|
3486
3494
|
}, e;
|
|
3487
3495
|
}, {});
|
|
3488
3496
|
}
|
|
3489
|
-
const Xn = "v0.22.
|
|
3497
|
+
const Xn = "v0.22.163-branch-inclusive.23215682227.1";
|
|
3490
3498
|
function oc(n, e) {
|
|
3491
3499
|
return {
|
|
3492
3500
|
info: n ? (...t) => console.info(...t, e()) : () => {
|
|
@@ -3584,7 +3592,9 @@ const Fr = [
|
|
|
3584
3592
|
"first",
|
|
3585
3593
|
"offset",
|
|
3586
3594
|
"after",
|
|
3595
|
+
"afterInclusive",
|
|
3587
3596
|
"before",
|
|
3597
|
+
"beforeInclusive",
|
|
3588
3598
|
"fields",
|
|
3589
3599
|
"aggregate"
|
|
3590
3600
|
], ac = (n) => n.valueType || "unknown", Fs = (n, e, t = !1) => {
|
|
@@ -3634,7 +3644,7 @@ const Fr = [
|
|
|
3634
3644
|
default:
|
|
3635
3645
|
throw new L(`Unknown operator '${n}' for attribute '${r}' in entity '${s}'`, o);
|
|
3636
3646
|
}
|
|
3637
|
-
},
|
|
3647
|
+
}, Ze = (n, e, t, r, s) => {
|
|
3638
3648
|
const i = ac(t), o = t.valueType === "json";
|
|
3639
3649
|
if (typeof n == "object" && n !== null && !Array.isArray(n)) {
|
|
3640
3650
|
if (o)
|
|
@@ -3664,23 +3674,23 @@ const Fr = [
|
|
|
3664
3674
|
if (!c)
|
|
3665
3675
|
throw new L(`Target entity '${o}' does not exist in schema for dot notation path '${n}'.`, s);
|
|
3666
3676
|
if (a === "id") {
|
|
3667
|
-
if (typeof e == "string" && !
|
|
3677
|
+
if (typeof e == "string" && !tt(e))
|
|
3668
3678
|
throw new L(`Invalid value for id field in entity '${o}'. Expected a UUID, but received: ${e}`, s);
|
|
3669
|
-
|
|
3679
|
+
Ze(e, n, new ie("string", !1, !0), t, s);
|
|
3670
3680
|
return;
|
|
3671
3681
|
}
|
|
3672
3682
|
const u = c.attrs[a];
|
|
3673
3683
|
if (Object.keys(c.links).includes(a)) {
|
|
3674
|
-
if (typeof e == "string" && !
|
|
3684
|
+
if (typeof e == "string" && !tt(e))
|
|
3675
3685
|
throw new L(`Invalid value for link '${a}' in entity '${o}'. Expected a UUID, but received: ${e}`, s);
|
|
3676
|
-
|
|
3686
|
+
Ze(e, n, new ie("string", !1, !0), t, s);
|
|
3677
3687
|
return;
|
|
3678
3688
|
}
|
|
3679
3689
|
if (!u) {
|
|
3680
3690
|
const l = Object.keys(c.attrs);
|
|
3681
3691
|
throw new L(`Attribute '${a}' does not exist on entity '${o}' in dot notation path '${n}'. Available attributes: ${l.length > 0 ? l.join(", ") + ", id" : "id"}`, s);
|
|
3682
3692
|
}
|
|
3683
|
-
|
|
3693
|
+
Ze(e, n, u, t, s);
|
|
3684
3694
|
}, Ns = (n, e, t, r) => {
|
|
3685
3695
|
for (const [s, i] of Object.entries(n)) {
|
|
3686
3696
|
if (s === "or" || s === "and") {
|
|
@@ -3690,7 +3700,7 @@ const Fr = [
|
|
|
3690
3700
|
continue;
|
|
3691
3701
|
}
|
|
3692
3702
|
if (s === "id") {
|
|
3693
|
-
|
|
3703
|
+
Ze(i, "id", new ie("string", !1, !0), e, `${r}.id`);
|
|
3694
3704
|
continue;
|
|
3695
3705
|
}
|
|
3696
3706
|
if (s.includes(".")) {
|
|
@@ -3706,12 +3716,12 @@ const Fr = [
|
|
|
3706
3716
|
throw new L(`Attribute or link '${s}' does not exist on entity '${e}'. Available attributes: ${u.length > 0 ? u.join(", ") : "none"}. Available links: ${l.length > 0 ? l.join(", ") : "none"}`, `${r}.${s}`);
|
|
3707
3717
|
}
|
|
3708
3718
|
if (a)
|
|
3709
|
-
|
|
3719
|
+
Ze(i, s, a, e, `${r}.${s}`);
|
|
3710
3720
|
else if (c) {
|
|
3711
|
-
if (typeof i == "string" && !
|
|
3721
|
+
if (typeof i == "string" && !tt(i))
|
|
3712
3722
|
throw new L(`Invalid value for link '${s}' in entity '${e}'. Expected a UUID, but received: ${i}`, `${r}.${s}`);
|
|
3713
3723
|
const u = new ie("string", !1, !0);
|
|
3714
|
-
|
|
3724
|
+
Ze(i, s, u, e, `${r}.${s}`);
|
|
3715
3725
|
}
|
|
3716
3726
|
}
|
|
3717
3727
|
}, lc = (n, e, t, r, s = 0) => {
|
|
@@ -3722,7 +3732,9 @@ const Fr = [
|
|
|
3722
3732
|
// 'limit', // only supported client side
|
|
3723
3733
|
"offset",
|
|
3724
3734
|
"before",
|
|
3735
|
+
"beforeInclusive",
|
|
3725
3736
|
"after",
|
|
3737
|
+
"afterInclusive",
|
|
3726
3738
|
"first",
|
|
3727
3739
|
"last"
|
|
3728
3740
|
];
|
|
@@ -3774,7 +3786,7 @@ const Fr = [
|
|
|
3774
3786
|
Ws(t[r], r, e, r, 0);
|
|
3775
3787
|
}
|
|
3776
3788
|
}
|
|
3777
|
-
}, Wr = (n) => typeof n != "string" ? !1 : Kt(n) ? !0 :
|
|
3789
|
+
}, Wr = (n) => typeof n != "string" ? !1 : Kt(n) ? !0 : tt(n);
|
|
3778
3790
|
class ge extends Error {
|
|
3779
3791
|
constructor(e) {
|
|
3780
3792
|
super(e), this.name = "TransactionValidationError";
|
|
@@ -3835,7 +3847,7 @@ const Ks = (n) => n.length > 0 ? n.join(", ") : "none", fc = (n, e) => new ge(`E
|
|
|
3835
3847
|
if (!e)
|
|
3836
3848
|
return;
|
|
3837
3849
|
const [t, r, s, i] = n;
|
|
3838
|
-
if (!Array.isArray(s) && !
|
|
3850
|
+
if (!Array.isArray(s) && !tt(s))
|
|
3839
3851
|
throw new ge(`Invalid id for entity '${r}'. Expected a UUID, but received: ${s}`);
|
|
3840
3852
|
if (typeof r != "string")
|
|
3841
3853
|
throw new ge(`Entity name must be a string, but received: ${typeof r}`);
|
|
@@ -4028,7 +4040,7 @@ function zr(n, e, t, r) {
|
|
|
4028
4040
|
const s = (o = V(t, n.table, "id")) == null ? void 0 : o.id;
|
|
4029
4041
|
if (!s)
|
|
4030
4042
|
return -1;
|
|
4031
|
-
const i =
|
|
4043
|
+
const i = rt(e.eav, [r, s, r]);
|
|
4032
4044
|
return i ? i[3] : -1;
|
|
4033
4045
|
}
|
|
4034
4046
|
function Vr(n, e, t) {
|
|
@@ -4081,17 +4093,17 @@ function Sc(n, e, t) {
|
|
|
4081
4093
|
const r = e;
|
|
4082
4094
|
if (n.orderField === "serverCreatedAt") {
|
|
4083
4095
|
t.sort(n.orderDirection === "asc" ? function(o, a) {
|
|
4084
|
-
return
|
|
4096
|
+
return ft(o.entity.id, o.serverCreatedAt, a.entity.id, a.serverCreatedAt, r);
|
|
4085
4097
|
} : function(o, a) {
|
|
4086
|
-
return
|
|
4098
|
+
return ft(a.entity.id, a.serverCreatedAt, o.entity.id, o.serverCreatedAt, r);
|
|
4087
4099
|
});
|
|
4088
4100
|
return;
|
|
4089
4101
|
}
|
|
4090
4102
|
const s = n.orderField;
|
|
4091
4103
|
t.sort(n.orderDirection === "asc" ? function(o, a) {
|
|
4092
|
-
return
|
|
4104
|
+
return ft(o.entity.id, o.entity[s], a.entity.id, a.entity[s], r);
|
|
4093
4105
|
} : function(o, a) {
|
|
4094
|
-
return
|
|
4106
|
+
return ft(a.entity.id, a.entity[s], o.entity.id, o.entity[s], r);
|
|
4095
4107
|
});
|
|
4096
4108
|
}
|
|
4097
4109
|
var xe;
|
|
@@ -4493,8 +4505,8 @@ function Ec({ WStream: n, opts: e, startStream: t, appendStream: r, registerStre
|
|
|
4493
4505
|
});
|
|
4494
4506
|
switch (ae.type) {
|
|
4495
4507
|
case "ok": {
|
|
4496
|
-
const { streamId: _e, offset:
|
|
4497
|
-
if (
|
|
4508
|
+
const { streamId: _e, offset: st } = ae;
|
|
4509
|
+
if (st !== 0) {
|
|
4498
4510
|
const me = new se("Write stream is corrupted");
|
|
4499
4511
|
te(A, me);
|
|
4500
4512
|
return;
|
|
@@ -4531,10 +4543,10 @@ function Ec({ WStream: n, opts: e, startStream: t, appendStream: r, registerStre
|
|
|
4531
4543
|
me();
|
|
4532
4544
|
}, _e = (me) => {
|
|
4533
4545
|
I(me), ae();
|
|
4534
|
-
},
|
|
4546
|
+
}, st = (me) => {
|
|
4535
4547
|
H(me || new se("Stream is closed.")), ae();
|
|
4536
4548
|
};
|
|
4537
|
-
Y.push(U(_e)), Y.push(v(
|
|
4549
|
+
Y.push(U(_e)), Y.push(v(st));
|
|
4538
4550
|
});
|
|
4539
4551
|
}
|
|
4540
4552
|
}
|
|
@@ -5196,7 +5208,7 @@ class Nc {
|
|
|
5196
5208
|
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()) {
|
|
5197
5209
|
if (!e.appId)
|
|
5198
5210
|
throw new Error("Instant must be initialized with an appId.");
|
|
5199
|
-
if (!
|
|
5211
|
+
if (!tt(e.appId))
|
|
5200
5212
|
throw new Error(`Instant must be initialized with a valid appId. \`${e.appId}\` is not a valid uuid.`);
|
|
5201
5213
|
typeof BroadcastChannel == "function" && (this._broadcastChannel = new BroadcastChannel("@instantdb"), this._broadcastChannel.addEventListener("message", async (o) => {
|
|
5202
5214
|
var a;
|
|
@@ -5214,7 +5226,7 @@ class Nc {
|
|
|
5214
5226
|
}
|
|
5215
5227
|
})), this._initStorage(t), this._syncTable = new vc(this._trySendAuthed.bind(this), new t(this.config.appId, "syncSubs"), {
|
|
5216
5228
|
useDateObjects: this.config.useDateObjects
|
|
5217
|
-
}, this._log, (o) =>
|
|
5229
|
+
}, this._log, (o) => lt(this.ensureAttrs(), o, this.config.enableCardinalityInference, this.config.useDateObjects), () => this.ensureAttrs()), this._instantStream = new kc({
|
|
5218
5230
|
WStream: this.config.WritableStream || WritableStream,
|
|
5219
5231
|
RStream: this.config.ReadableStream || ReadableStream,
|
|
5220
5232
|
trySend: this._trySendAuthed.bind(this),
|
|
@@ -5347,7 +5359,7 @@ class Nc {
|
|
|
5347
5359
|
_addQueryData(e, t, r) {
|
|
5348
5360
|
if (!this.attrs)
|
|
5349
5361
|
throw new Error("Attrs in reactor have not been set");
|
|
5350
|
-
const s = J(e), i = this.ensureAttrs(), o =
|
|
5362
|
+
const s = J(e), i = this.ensureAttrs(), o = lt(this.attrs, t.triples, r, this.config.useDateObjects);
|
|
5351
5363
|
this.querySubs.updateInPlace((a) => {
|
|
5352
5364
|
a[s] = {
|
|
5353
5365
|
result: {
|
|
@@ -5381,7 +5393,7 @@ class Nc {
|
|
|
5381
5393
|
const { q: y, result: b } = t, _ = J(y);
|
|
5382
5394
|
if (!this._hasQueryListeners() && !this.querySubs.currentValue[_])
|
|
5383
5395
|
break;
|
|
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 =
|
|
5396
|
+
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 = lt(w, g, r, this.config.useDateObjects);
|
|
5385
5397
|
this.querySubs.updateInPlace((v) => {
|
|
5386
5398
|
if (!v[_]) {
|
|
5387
5399
|
this._log.info("Missing value in querySubs", { hash: _, q: y });
|
|
@@ -5438,7 +5450,7 @@ class Nc {
|
|
|
5438
5450
|
});
|
|
5439
5451
|
const S = ln(m.entries()), g = y.map((w) => {
|
|
5440
5452
|
var W, Q, ee, Ae;
|
|
5441
|
-
const O = w["instaql-query"], v = w["instaql-result"], C = J(O), j = Ur(v), U = this.ensureAttrs(), B =
|
|
5453
|
+
const O = w["instaql-query"], v = w["instaql-result"], C = J(O), j = Ur(v), U = this.ensureAttrs(), B = lt(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;
|
|
5442
5454
|
return {
|
|
5443
5455
|
q: O,
|
|
5444
5456
|
hash: C,
|
|
@@ -6118,6 +6130,13 @@ class Nc {
|
|
|
6118
6130
|
Object.keys(r).forEach((s) => {
|
|
6119
6131
|
delete r[s].result;
|
|
6120
6132
|
});
|
|
6133
|
+
}), this.querySubs.clearUnloadedKeys(), this._updatePendingMutations((r) => {
|
|
6134
|
+
for (const [s, i] of r.entries())
|
|
6135
|
+
this.mutationDeferredStore.get(s) && this._finishTransaction("error", s, {
|
|
6136
|
+
message: "User changed while transaction was in progress.",
|
|
6137
|
+
type: "user-changed"
|
|
6138
|
+
});
|
|
6139
|
+
r.clear();
|
|
6121
6140
|
}), this._reconnectTimeoutMs = 0, this._transport.close(), this._oauthCallbackResponse = null, this.notifyAuthSubs(t);
|
|
6122
6141
|
}
|
|
6123
6142
|
sendMagicCode({ email: e }) {
|
|
@@ -7093,7 +7112,7 @@ function pu(n, e) {
|
|
|
7093
7112
|
};
|
|
7094
7113
|
t.allowedHosts.includes(window.location.hostname) && Jc(n, t);
|
|
7095
7114
|
}
|
|
7096
|
-
var Mn = { exports: {} },
|
|
7115
|
+
var Mn = { exports: {} }, ot = {};
|
|
7097
7116
|
/**
|
|
7098
7117
|
* @license React
|
|
7099
7118
|
* react-jsx-runtime.production.min.js
|
|
@@ -7105,7 +7124,7 @@ var Mn = { exports: {} }, it = {};
|
|
|
7105
7124
|
*/
|
|
7106
7125
|
var Hr;
|
|
7107
7126
|
function yu() {
|
|
7108
|
-
if (Hr) return
|
|
7127
|
+
if (Hr) return ot;
|
|
7109
7128
|
Hr = 1;
|
|
7110
7129
|
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 };
|
|
7111
7130
|
function o(a, c, u) {
|
|
@@ -7115,11 +7134,11 @@ function yu() {
|
|
|
7115
7134
|
if (a && a.defaultProps) for (l in c = a.defaultProps, c) f[l] === void 0 && (f[l] = c[l]);
|
|
7116
7135
|
return { $$typeof: e, type: a, key: p, ref: y, props: f, _owner: s.current };
|
|
7117
7136
|
}
|
|
7118
|
-
return
|
|
7137
|
+
return ot.Fragment = t, ot.jsx = o, ot.jsxs = o, ot;
|
|
7119
7138
|
}
|
|
7120
|
-
var
|
|
7139
|
+
var at = {}, Jr;
|
|
7121
7140
|
function bu() {
|
|
7122
|
-
if (Jr) return
|
|
7141
|
+
if (Jr) return at;
|
|
7123
7142
|
Jr = 1;
|
|
7124
7143
|
var n = {};
|
|
7125
7144
|
/**
|
|
@@ -7248,7 +7267,7 @@ function bu() {
|
|
|
7248
7267
|
ee++;
|
|
7249
7268
|
}
|
|
7250
7269
|
}
|
|
7251
|
-
function
|
|
7270
|
+
function st() {
|
|
7252
7271
|
{
|
|
7253
7272
|
if (ee--, ee === 0) {
|
|
7254
7273
|
var d = {
|
|
@@ -7368,7 +7387,7 @@ function bu() {
|
|
|
7368
7387
|
}
|
|
7369
7388
|
}
|
|
7370
7389
|
} finally {
|
|
7371
|
-
Yt = !1, me.current = D,
|
|
7390
|
+
Yt = !1, me.current = D, st(), Error.prepareStackTrace = $;
|
|
7372
7391
|
}
|
|
7373
7392
|
var ze = d ? d.displayName || d.name : "", je = ze ? St(ze) : "";
|
|
7374
7393
|
return typeof d == "function" && vt.set(d, je), je;
|
|
@@ -7409,7 +7428,7 @@ function bu() {
|
|
|
7409
7428
|
}
|
|
7410
7429
|
return "";
|
|
7411
7430
|
}
|
|
7412
|
-
var
|
|
7431
|
+
var it = Object.prototype.hasOwnProperty, nr = {}, rr = g.ReactDebugCurrentFrame;
|
|
7413
7432
|
function Ot(d) {
|
|
7414
7433
|
if (d) {
|
|
7415
7434
|
var T = d._owner, E = Et(d.type, d._source, T ? T.type : null);
|
|
@@ -7419,7 +7438,7 @@ function bu() {
|
|
|
7419
7438
|
}
|
|
7420
7439
|
function Ys(d, T, E, k, $) {
|
|
7421
7440
|
{
|
|
7422
|
-
var D = Function.call.bind(
|
|
7441
|
+
var D = Function.call.bind(it);
|
|
7423
7442
|
for (var x in d)
|
|
7424
7443
|
if (D(d, x)) {
|
|
7425
7444
|
var M = void 0;
|
|
@@ -7467,7 +7486,7 @@ function bu() {
|
|
|
7467
7486
|
__source: !0
|
|
7468
7487
|
}, ar, cr;
|
|
7469
7488
|
function ni(d) {
|
|
7470
|
-
if (
|
|
7489
|
+
if (it.call(d, "ref")) {
|
|
7471
7490
|
var T = Object.getOwnPropertyDescriptor(d, "ref").get;
|
|
7472
7491
|
if (T && T.isReactWarning)
|
|
7473
7492
|
return !1;
|
|
@@ -7475,7 +7494,7 @@ function bu() {
|
|
|
7475
7494
|
return d.ref !== void 0;
|
|
7476
7495
|
}
|
|
7477
7496
|
function ri(d) {
|
|
7478
|
-
if (
|
|
7497
|
+
if (it.call(d, "key")) {
|
|
7479
7498
|
var T = Object.getOwnPropertyDescriptor(d, "key").get;
|
|
7480
7499
|
if (T && T.isReactWarning)
|
|
7481
7500
|
return !1;
|
|
@@ -7541,7 +7560,7 @@ function bu() {
|
|
|
7541
7560
|
var D, x = {}, M = null, ne = null;
|
|
7542
7561
|
E !== void 0 && (ir(E), M = "" + E), ri(T) && (ir(T.key), M = "" + T.key), ni(T) && (ne = T.ref, si(T, $));
|
|
7543
7562
|
for (D in T)
|
|
7544
|
-
|
|
7563
|
+
it.call(T, D) && !ti.hasOwnProperty(D) && (x[D] = T[D]);
|
|
7545
7564
|
if (d && d.defaultProps) {
|
|
7546
7565
|
var K = d.defaultProps;
|
|
7547
7566
|
for (D in K)
|
|
@@ -7692,7 +7711,7 @@ Check the top-level render call using <` + E + ">.");
|
|
|
7692
7711
|
else
|
|
7693
7712
|
hr(be, d);
|
|
7694
7713
|
}
|
|
7695
|
-
if (
|
|
7714
|
+
if (it.call(T, "key")) {
|
|
7696
7715
|
var je = W(d), ce = Object.keys(T).filter(function(_i) {
|
|
7697
7716
|
return _i !== "key";
|
|
7698
7717
|
}), nn = ce.length > 0 ? "{key: someKey, " + ce.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
@@ -7716,8 +7735,8 @@ React keys must be passed directly to JSX without using spread:
|
|
|
7716
7735
|
return yr(d, T, E, !1);
|
|
7717
7736
|
}
|
|
7718
7737
|
var yi = pi, bi = hi;
|
|
7719
|
-
|
|
7720
|
-
}(),
|
|
7738
|
+
at.Fragment = s, at.jsx = yi, at.jsxs = bi;
|
|
7739
|
+
}(), at;
|
|
7721
7740
|
}
|
|
7722
7741
|
var gu = {};
|
|
7723
7742
|
gu.NODE_ENV === "production" ? Mn.exports = yu() : Mn.exports = bu();
|
|
@@ -7739,7 +7758,7 @@ function Yr(n) {
|
|
|
7739
7758
|
}
|
|
7740
7759
|
function mu(n, e, t, r) {
|
|
7741
7760
|
e && t && "ruleParams" in t && (e = { $$ruleParams: t.ruleParams, ...e });
|
|
7742
|
-
const s = e ? lu(e) : null, i = J(s), o =
|
|
7761
|
+
const s = e ? lu(e) : null, i = J(s), o = et(Yr(n._reactor.getPreviousResult(s))), a = et(_u), c = Me(
|
|
7743
7762
|
(l) => (o.current = Yr(n._reactor.getPreviousResult(s)), l(), s ? n.subscribeQuery(s, (p) => {
|
|
7744
7763
|
o.current = {
|
|
7745
7764
|
isLoading: !p,
|
|
@@ -7759,7 +7778,7 @@ function mu(n, e, t, r) {
|
|
|
7759
7778
|
return { state: dn(c, () => o.current, () => a.current), query: s, queryHash: i };
|
|
7760
7779
|
}
|
|
7761
7780
|
function wu() {
|
|
7762
|
-
const n =
|
|
7781
|
+
const n = et(null);
|
|
7763
7782
|
Fe(() => {
|
|
7764
7783
|
t();
|
|
7765
7784
|
}, []);
|
|
@@ -7773,7 +7792,7 @@ function wu() {
|
|
|
7773
7792
|
}
|
|
7774
7793
|
const Tu = 1e3;
|
|
7775
7794
|
function Su(n, e, t) {
|
|
7776
|
-
const r =
|
|
7795
|
+
const r = et(t);
|
|
7777
7796
|
r.current = t, Fe(() => n.core._reactor.subscribeTopic(n.type, n.id, e, (i, o) => {
|
|
7778
7797
|
r.current(i, o);
|
|
7779
7798
|
}), [n.id, e]);
|
|
@@ -8105,7 +8124,7 @@ class $t {
|
|
|
8105
8124
|
* }
|
|
8106
8125
|
*/
|
|
8107
8126
|
h(this, "useConnectionStatus", () => {
|
|
8108
|
-
const e =
|
|
8127
|
+
const e = et(this.core._reactor.status), t = Me((s) => this.core.subscribeConnectionStatus((o) => {
|
|
8109
8128
|
o !== e.current && (e.current = o, s());
|
|
8110
8129
|
}), []);
|
|
8111
8130
|
return dn(
|
|
@@ -8184,7 +8203,7 @@ class $t {
|
|
|
8184
8203
|
return new ku(this.core, e, t);
|
|
8185
8204
|
}
|
|
8186
8205
|
_useAuth() {
|
|
8187
|
-
const e =
|
|
8206
|
+
const e = et(this.core._reactor._currentUserCached), t = Me((s) => this.core.subscribeAuth((o) => {
|
|
8188
8207
|
e.current = { isLoading: !1, ...o }, s();
|
|
8189
8208
|
}), []);
|
|
8190
8209
|
return dn(t, () => e.current, () => Cu);
|
|
@@ -8366,32 +8385,32 @@ function es(n) {
|
|
|
8366
8385
|
}
|
|
8367
8386
|
var Bs = (n) => {
|
|
8368
8387
|
throw TypeError(n);
|
|
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,
|
|
8388
|
+
}, 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, Ye, gt, Pe, Qe, Xe, He, dt, we, jn, xn, $n, ts, Dn, Un, ht, Ln, Fn;
|
|
8370
8389
|
class Ut extends EventTarget {
|
|
8371
8390
|
constructor(e, t) {
|
|
8372
8391
|
var r, s;
|
|
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,
|
|
8392
|
+
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, Ye), G(this, gt, null), G(this, Pe), G(this, Qe), G(this, Xe, null), G(this, He, null), G(this, dt, null), G(this, xn, async (i) => {
|
|
8374
8393
|
var o;
|
|
8375
8394
|
P(this, Qe).reset();
|
|
8376
8395
|
const { body: a, redirected: c, status: u, headers: l } = i;
|
|
8377
8396
|
if (u === 204) {
|
|
8378
|
-
ke(this, we,
|
|
8397
|
+
ke(this, we, ht).call(this, "Server sent HTTP 204, not reconnecting", 204), this.close();
|
|
8379
8398
|
return;
|
|
8380
8399
|
}
|
|
8381
8400
|
if (c ? F(this, Ge, new URL(i.url)) : F(this, Ge, void 0), u !== 200) {
|
|
8382
|
-
ke(this, we,
|
|
8401
|
+
ke(this, we, ht).call(this, `Non-200 status code (${u})`, u);
|
|
8383
8402
|
return;
|
|
8384
8403
|
}
|
|
8385
8404
|
if (!(l.get("content-type") || "").startsWith("text/event-stream")) {
|
|
8386
|
-
ke(this, we,
|
|
8405
|
+
ke(this, we, ht).call(this, 'Invalid content type, expected "text/event-stream"', u);
|
|
8387
8406
|
return;
|
|
8388
8407
|
}
|
|
8389
8408
|
if (P(this, ue) === this.CLOSED)
|
|
8390
8409
|
return;
|
|
8391
8410
|
F(this, ue, this.OPEN);
|
|
8392
8411
|
const f = new Event("open");
|
|
8393
|
-
if ((o = P(this,
|
|
8394
|
-
ke(this, we,
|
|
8412
|
+
if ((o = P(this, dt)) == null || o.call(this, f), this.dispatchEvent(f), typeof a != "object" || !a || !("getReader" in a)) {
|
|
8413
|
+
ke(this, we, ht).call(this, "Invalid response body, expected a web ReadableStream", u), this.close();
|
|
8395
8414
|
return;
|
|
8396
8415
|
}
|
|
8397
8416
|
const p = new TextDecoder(), y = a.getReader();
|
|
@@ -8413,7 +8432,7 @@ class Ut extends EventTarget {
|
|
|
8413
8432
|
}), G(this, Un, (i) => {
|
|
8414
8433
|
F(this, bt, i);
|
|
8415
8434
|
}), G(this, Fn, () => {
|
|
8416
|
-
F(this,
|
|
8435
|
+
F(this, Ye, void 0), P(this, ue) === this.CONNECTING && ke(this, we, jn).call(this);
|
|
8417
8436
|
});
|
|
8418
8437
|
try {
|
|
8419
8438
|
if (e instanceof URL)
|
|
@@ -8463,10 +8482,10 @@ class Ut extends EventTarget {
|
|
|
8463
8482
|
}
|
|
8464
8483
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */
|
|
8465
8484
|
get onerror() {
|
|
8466
|
-
return P(this,
|
|
8485
|
+
return P(this, Xe);
|
|
8467
8486
|
}
|
|
8468
8487
|
set onerror(e) {
|
|
8469
|
-
F(this,
|
|
8488
|
+
F(this, Xe, e);
|
|
8470
8489
|
}
|
|
8471
8490
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */
|
|
8472
8491
|
get onmessage() {
|
|
@@ -8477,10 +8496,10 @@ class Ut extends EventTarget {
|
|
|
8477
8496
|
}
|
|
8478
8497
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */
|
|
8479
8498
|
get onopen() {
|
|
8480
|
-
return P(this,
|
|
8499
|
+
return P(this, dt);
|
|
8481
8500
|
}
|
|
8482
8501
|
set onopen(e) {
|
|
8483
|
-
F(this,
|
|
8502
|
+
F(this, dt, e);
|
|
8484
8503
|
}
|
|
8485
8504
|
addEventListener(e, t, r) {
|
|
8486
8505
|
const s = t;
|
|
@@ -8498,10 +8517,10 @@ class Ut extends EventTarget {
|
|
|
8498
8517
|
* @public
|
|
8499
8518
|
*/
|
|
8500
8519
|
close() {
|
|
8501
|
-
P(this,
|
|
8520
|
+
P(this, Ye) && clearTimeout(P(this, Ye)), P(this, ue) !== this.CLOSED && (P(this, Pe) && P(this, Pe).abort(), F(this, ue, this.CLOSED), F(this, Pe, void 0));
|
|
8502
8521
|
}
|
|
8503
8522
|
}
|
|
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(),
|
|
8523
|
+
ue = /* @__PURE__ */ new WeakMap(), De = /* @__PURE__ */ new WeakMap(), Ge = /* @__PURE__ */ new WeakMap(), Dt = /* @__PURE__ */ new WeakMap(), qt = /* @__PURE__ */ new WeakMap(), bt = /* @__PURE__ */ new WeakMap(), Ye = /* @__PURE__ */ new WeakMap(), gt = /* @__PURE__ */ new WeakMap(), Pe = /* @__PURE__ */ new WeakMap(), Qe = /* @__PURE__ */ new WeakMap(), Xe = /* @__PURE__ */ new WeakMap(), He = /* @__PURE__ */ new WeakMap(), dt = /* @__PURE__ */ new WeakMap(), we = /* @__PURE__ */ new WeakSet(), /**
|
|
8505
8524
|
* Connect to the given URL and start receiving events
|
|
8506
8525
|
*
|
|
8507
8526
|
* @internal
|
|
@@ -8533,11 +8552,11 @@ ts = function() {
|
|
|
8533
8552
|
* @param code - The HTTP status code, if available
|
|
8534
8553
|
* @internal
|
|
8535
8554
|
*/
|
|
8536
|
-
|
|
8555
|
+
ht = function(n, e) {
|
|
8537
8556
|
var t;
|
|
8538
8557
|
P(this, ue) !== this.CLOSED && F(this, ue, this.CLOSED);
|
|
8539
8558
|
const r = new Xr("error", { code: e, message: n });
|
|
8540
|
-
(t = P(this,
|
|
8559
|
+
(t = P(this, Xe)) == null || t.call(this, r), this.dispatchEvent(r);
|
|
8541
8560
|
}, /**
|
|
8542
8561
|
* Schedules a reconnection attempt against the EventSource endpoint.
|
|
8543
8562
|
*
|
|
@@ -8551,7 +8570,7 @@ Ln = function(n, e) {
|
|
|
8551
8570
|
return;
|
|
8552
8571
|
F(this, ue, this.CONNECTING);
|
|
8553
8572
|
const r = new Xr("error", { code: e, message: n });
|
|
8554
|
-
(t = P(this,
|
|
8573
|
+
(t = P(this, Xe)) == null || t.call(this, r), this.dispatchEvent(r), F(this, Ye, setTimeout(P(this, Fn), P(this, bt)));
|
|
8555
8574
|
}, Fn = /* @__PURE__ */ new WeakMap(), /**
|
|
8556
8575
|
* ReadyState representing an EventSource currently trying to connect
|
|
8557
8576
|
*
|