@instantdb/solidjs 0.22.162 → 0.22.163
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/.turbo/turbo-build.log
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
|
|
2
|
-
> @instantdb/solidjs@0.22.
|
|
2
|
+
> @instantdb/solidjs@0.22.163 build /home/runner/work/instant/instant/client/packages/solidjs
|
|
3
3
|
> rm -rf dist; npm run build:tshy && npm run build:standalone && npm run check-exports
|
|
4
4
|
|
|
5
5
|
npm warn Unknown env config "verify-deps-before-run". This will stop working in the next major version of npm.
|
|
6
6
|
npm warn Unknown user config "always-auth". This will stop working in the next major version of npm.
|
|
7
7
|
|
|
8
|
-
> @instantdb/solidjs@0.22.
|
|
8
|
+
> @instantdb/solidjs@0.22.163 build:tshy
|
|
9
9
|
> tshy
|
|
10
10
|
|
|
11
11
|
npm warn Unknown env config "verify-deps-before-run". This will stop working in the next major version of npm.
|
|
12
12
|
npm warn Unknown user config "always-auth". This will stop working in the next major version of npm.
|
|
13
13
|
|
|
14
|
-
> @instantdb/solidjs@0.22.
|
|
14
|
+
> @instantdb/solidjs@0.22.163 build:standalone
|
|
15
15
|
> vite build
|
|
16
16
|
|
|
17
17
|
[36mvite v5.4.14 [32mbuilding for production...[36m[39m
|
|
@@ -19,17 +19,17 @@ transforming...
|
|
|
19
19
|
[32m✓[39m 69 modules transformed.
|
|
20
20
|
rendering chunks...
|
|
21
21
|
computing gzip size...
|
|
22
|
-
[2mdist/standalone/[22m[36mindex.umd.cjs [39m[1m[
|
|
23
|
-
[2mdist/standalone/[22m[36mindex.js [39m[1m[
|
|
24
|
-
[32m✓ built in 1.
|
|
22
|
+
[2mdist/standalone/[22m[36mindex.umd.cjs [39m[1m[2m152.44 kB[22m[1m[22m[2m │ gzip: 46.37 kB[22m
|
|
23
|
+
[2mdist/standalone/[22m[36mindex.js [39m[1m[2m231.23 kB[22m[1m[22m[2m │ gzip: 59.84 kB[22m
|
|
24
|
+
[32m✓ built in 1.93s[39m
|
|
25
25
|
npm warn Unknown env config "verify-deps-before-run". This will stop working in the next major version of npm.
|
|
26
26
|
npm warn Unknown user config "always-auth". This will stop working in the next major version of npm.
|
|
27
27
|
|
|
28
|
-
> @instantdb/solidjs@0.22.
|
|
28
|
+
> @instantdb/solidjs@0.22.163 check-exports
|
|
29
29
|
> attw --pack .
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
@instantdb/solidjs v0.22.
|
|
32
|
+
@instantdb/solidjs v0.22.163
|
|
33
33
|
|
|
34
34
|
Build tools:
|
|
35
35
|
- @arethetypeswrong/cli@^0.17.4
|
package/dist/standalone/index.js
CHANGED
|
@@ -47,7 +47,7 @@ const M = {
|
|
|
47
47
|
mutable: "mutable",
|
|
48
48
|
immutable: "immutable"
|
|
49
49
|
}, Nt = {};
|
|
50
|
-
function
|
|
50
|
+
function xe(t, e) {
|
|
51
51
|
return t instanceof Map ? t.has(e) : Object.prototype.hasOwnProperty.call(t, e);
|
|
52
52
|
}
|
|
53
53
|
function tn(t, e) {
|
|
@@ -94,7 +94,7 @@ function Un(t, e = []) {
|
|
|
94
94
|
if (r !== null && (r == null ? void 0 : r.original) !== t.original)
|
|
95
95
|
return null;
|
|
96
96
|
const s = t.parent.type === 3, i = s ? Array.from(t.parent.setMap.keys()).indexOf(t.key) : t.key;
|
|
97
|
-
if (!(s && n.size > i ||
|
|
97
|
+
if (!(s && n.size > i || xe(n, i)))
|
|
98
98
|
return null;
|
|
99
99
|
e.push(i);
|
|
100
100
|
}
|
|
@@ -198,15 +198,15 @@ function Ln(t, e) {
|
|
|
198
198
|
function N(t) {
|
|
199
199
|
t.copy || (t.copy = Ln(t.original, t.options));
|
|
200
200
|
}
|
|
201
|
-
function
|
|
201
|
+
function Me(t) {
|
|
202
202
|
if (!te(t))
|
|
203
203
|
return zt(t);
|
|
204
204
|
if (Array.isArray(t))
|
|
205
|
-
return t.map(
|
|
205
|
+
return t.map(Me);
|
|
206
206
|
if (t instanceof Map) {
|
|
207
207
|
const n = Array.from(t.entries()).map(([r, s]) => [
|
|
208
208
|
r,
|
|
209
|
-
|
|
209
|
+
Me(s)
|
|
210
210
|
]);
|
|
211
211
|
if (!qt(t)) {
|
|
212
212
|
const r = Object.getPrototypeOf(t).constructor;
|
|
@@ -215,7 +215,7 @@ function Pe(t) {
|
|
|
215
215
|
return new Map(n);
|
|
216
216
|
}
|
|
217
217
|
if (t instanceof Set) {
|
|
218
|
-
const n = Array.from(t).map(
|
|
218
|
+
const n = Array.from(t).map(Me);
|
|
219
219
|
if (!Kt(t)) {
|
|
220
220
|
const r = Object.getPrototypeOf(t).constructor;
|
|
221
221
|
return new r(n);
|
|
@@ -224,11 +224,11 @@ function Pe(t) {
|
|
|
224
224
|
}
|
|
225
225
|
const e = Object.create(Object.getPrototypeOf(t));
|
|
226
226
|
for (const n in t)
|
|
227
|
-
e[n] =
|
|
227
|
+
e[n] = Me(t[n]);
|
|
228
228
|
return e;
|
|
229
229
|
}
|
|
230
230
|
function Be(t) {
|
|
231
|
-
return we(t) ?
|
|
231
|
+
return we(t) ? Me(t) : t;
|
|
232
232
|
}
|
|
233
233
|
function oe(t) {
|
|
234
234
|
var e;
|
|
@@ -396,7 +396,7 @@ function Lr(t, e, n, r, s) {
|
|
|
396
396
|
}
|
|
397
397
|
function Fr({ original: t, copy: e, assignedMap: n }, r, s, i, o) {
|
|
398
398
|
n.forEach((a, c) => {
|
|
399
|
-
const u = he(t, c), l = Be(he(e, c)), f = a ?
|
|
399
|
+
const u = he(t, c), l = Be(he(e, c)), f = a ? xe(t, c) ? M.Replace : M.Add : M.Remove;
|
|
400
400
|
if (fe(u, l) && f === M.Replace)
|
|
401
401
|
return;
|
|
402
402
|
const h = r.concat(c), p = be(h, o);
|
|
@@ -671,7 +671,7 @@ const qr = Reflect.ownKeys(Ye), Nn = /* @__PURE__ */ new WeakSet(), Kn = {
|
|
|
671
671
|
if (u)
|
|
672
672
|
return u.bind(t.proxy);
|
|
673
673
|
}
|
|
674
|
-
if (!
|
|
674
|
+
if (!xe(a, e)) {
|
|
675
675
|
const u = tn(a, e);
|
|
676
676
|
return u ? "value" in u ? u.value : (
|
|
677
677
|
// !case: support for getter
|
|
@@ -707,7 +707,7 @@ const qr = Reflect.ownKeys(Ye), Nn = /* @__PURE__ */ new WeakSet(), Kn = {
|
|
|
707
707
|
if (i != null && i.set)
|
|
708
708
|
return i.set.call(t.proxy, n), !0;
|
|
709
709
|
const o = yt(G(t), e), a = O(o);
|
|
710
|
-
return a && fe(a.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) : (fe(n, o) && (n !== void 0 ||
|
|
710
|
+
return a && fe(a.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) : (fe(n, o) && (n !== void 0 || xe(t.original, e)) || (N(t), oe(t), xe(t.original, e) && fe(n, t.original[e]) ? t.assignedMap.delete(e) : t.assignedMap.set(e, !0), t.copy[e] = n, Vt(t, e, n, Le)), !0);
|
|
711
711
|
},
|
|
712
712
|
has(t, e) {
|
|
713
713
|
return e in G(t);
|
|
@@ -947,7 +947,7 @@ function Ge(t, e) {
|
|
|
947
947
|
return typeof t != "object" || typeof e != "object" || t === null || e === null ? t === e : zn(t, e) ? Object.keys(t).every((n) => Ge(t[n], e[n])) : !1;
|
|
948
948
|
}
|
|
949
949
|
function Bt(t) {
|
|
950
|
-
if (!
|
|
950
|
+
if (!je(t))
|
|
951
951
|
return t;
|
|
952
952
|
const e = {};
|
|
953
953
|
for (const [n, r] of Object.entries(t))
|
|
@@ -955,7 +955,7 @@ function Bt(t) {
|
|
|
955
955
|
return e;
|
|
956
956
|
}
|
|
957
957
|
function Wn(t, e) {
|
|
958
|
-
if (!
|
|
958
|
+
if (!je(t) || !je(e))
|
|
959
959
|
return e;
|
|
960
960
|
const n = { ...t };
|
|
961
961
|
for (const r of Object.keys(e)) {
|
|
@@ -965,12 +965,12 @@ function Wn(t, e) {
|
|
|
965
965
|
delete n[r];
|
|
966
966
|
continue;
|
|
967
967
|
}
|
|
968
|
-
const s =
|
|
968
|
+
const s = je(t[r]) && je(e[r]);
|
|
969
969
|
n[r] = s ? Wn(t[r], e[r]) : e[r];
|
|
970
970
|
}
|
|
971
971
|
return n;
|
|
972
972
|
}
|
|
973
|
-
function
|
|
973
|
+
function je(t) {
|
|
974
974
|
return typeof t == "object" && t !== null && !Array.isArray(t);
|
|
975
975
|
}
|
|
976
976
|
function Qr(t, e, n) {
|
|
@@ -1417,7 +1417,7 @@ function Gt(t) {
|
|
|
1417
1417
|
function Ht(t) {
|
|
1418
1418
|
return t["value-type"] === "blob";
|
|
1419
1419
|
}
|
|
1420
|
-
function
|
|
1420
|
+
function Ee(t, e) {
|
|
1421
1421
|
return e.reduce((n, r) => n && n.get(r), t);
|
|
1422
1422
|
}
|
|
1423
1423
|
function ee(t, e) {
|
|
@@ -1462,7 +1462,7 @@ function Bn(t) {
|
|
|
1462
1462
|
};
|
|
1463
1463
|
}
|
|
1464
1464
|
function Gn(t, e) {
|
|
1465
|
-
return
|
|
1465
|
+
return De(t, e.triples, e.cardinalityInference, e.useDateObjects);
|
|
1466
1466
|
}
|
|
1467
1467
|
function Hn(t, e) {
|
|
1468
1468
|
if (t)
|
|
@@ -1471,9 +1471,9 @@ function Hn(t, e) {
|
|
|
1471
1471
|
return new ge(e.attrs, e.linkIndex);
|
|
1472
1472
|
}
|
|
1473
1473
|
function ds(t, e) {
|
|
1474
|
-
return
|
|
1474
|
+
return Ee(t.eav, [e]) !== void 0;
|
|
1475
1475
|
}
|
|
1476
|
-
function
|
|
1476
|
+
function De(t, e, n, r) {
|
|
1477
1477
|
const s = Qn(t, e, r);
|
|
1478
1478
|
return s.cardinalityInference = n, s.useDateObjects = r, s;
|
|
1479
1479
|
}
|
|
@@ -1515,7 +1515,7 @@ let hs = 0;
|
|
|
1515
1515
|
function Yn(t, e, n) {
|
|
1516
1516
|
const [r, s, i] = n;
|
|
1517
1517
|
let o;
|
|
1518
|
-
const a =
|
|
1518
|
+
const a = Ee(t.eav, [r, s, i]);
|
|
1519
1519
|
return a && (o = a[3]), o || Date.now() * 10 + hs++;
|
|
1520
1520
|
}
|
|
1521
1521
|
function Zn(t, e, n) {
|
|
@@ -1527,7 +1527,7 @@ function Zn(t, e, n) {
|
|
|
1527
1527
|
if (!a)
|
|
1528
1528
|
return;
|
|
1529
1529
|
a["checked-data-type"] === "date" && t.useDateObjects && (o = ot(o));
|
|
1530
|
-
const c =
|
|
1530
|
+
const c = Ee(t.eav, [s, i, o]), u = (c == null ? void 0 : c[3]) ?? Yn(t, a, r), l = [s, i, o, u];
|
|
1531
1531
|
fs(a) ? (W(t.eav, [s, i], /* @__PURE__ */ new Map([[o, l]])), W(t.aev, [i, s], /* @__PURE__ */ new Map([[o, l]]))) : (W(t.eav, [s, i, o], l), W(t.aev, [i, s, o], l)), Gt(a) && W(t.vae, [o, i, s], l);
|
|
1532
1532
|
}
|
|
1533
1533
|
function ps(t, e, n) {
|
|
@@ -1540,7 +1540,7 @@ function ps(t, e, n) {
|
|
|
1540
1540
|
return;
|
|
1541
1541
|
if (!Ht(a))
|
|
1542
1542
|
throw new Error("merge operation is not supported for links");
|
|
1543
|
-
const c =
|
|
1543
|
+
const c = Ee(t.eav, [s, i]);
|
|
1544
1544
|
if (!c)
|
|
1545
1545
|
return;
|
|
1546
1546
|
const u = (p = c.values().next()) == null ? void 0 : p.value;
|
|
@@ -1765,7 +1765,7 @@ function vs(t, e, n) {
|
|
|
1765
1765
|
return;
|
|
1766
1766
|
const [s, i, o] = r;
|
|
1767
1767
|
if (e.getAttr(i))
|
|
1768
|
-
return
|
|
1768
|
+
return Ee(t.eav, [s, i]);
|
|
1769
1769
|
}
|
|
1770
1770
|
function As(t, e, n) {
|
|
1771
1771
|
const r = n.filter(([s, i, o, a, c]) => {
|
|
@@ -1860,7 +1860,7 @@ function $s(t, e, n) {
|
|
|
1860
1860
|
return ms(t, Jt(n, e));
|
|
1861
1861
|
}
|
|
1862
1862
|
const Rs = /^(?:[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;
|
|
1863
|
-
function
|
|
1863
|
+
function Ie(t) {
|
|
1864
1864
|
return typeof t == "string" && Rs.test(t);
|
|
1865
1865
|
}
|
|
1866
1866
|
const $ = [];
|
|
@@ -1925,13 +1925,13 @@ function Ws() {
|
|
|
1925
1925
|
}
|
|
1926
1926
|
const Vs = Ws();
|
|
1927
1927
|
let Qs = !0, Bs = 0;
|
|
1928
|
-
function
|
|
1928
|
+
function Ue(t) {
|
|
1929
1929
|
return at(`_${t}`, Bs++);
|
|
1930
1930
|
}
|
|
1931
1931
|
function at(t, e) {
|
|
1932
1932
|
return `?${t}-${e}`;
|
|
1933
1933
|
}
|
|
1934
|
-
class
|
|
1934
|
+
class Ce extends Error {
|
|
1935
1935
|
constructor(e) {
|
|
1936
1936
|
super(e), this.name = "AttrNotFoundError";
|
|
1937
1937
|
}
|
|
@@ -1939,7 +1939,7 @@ class Ie extends Error {
|
|
|
1939
1939
|
function Gs(t, e) {
|
|
1940
1940
|
const n = tr(t, e);
|
|
1941
1941
|
if (!n)
|
|
1942
|
-
throw new
|
|
1942
|
+
throw new Ce(`Could not find id attr for ${e}`);
|
|
1943
1943
|
return n;
|
|
1944
1944
|
}
|
|
1945
1945
|
function dn(t, e, n, r) {
|
|
@@ -1959,19 +1959,19 @@ function Js(t, e, n) {
|
|
|
1959
1959
|
function rr(t, e, n, r, s) {
|
|
1960
1960
|
const i = j(e, n, s), o = me(e, n, s), a = i || o;
|
|
1961
1961
|
if (!a)
|
|
1962
|
-
throw new
|
|
1962
|
+
throw new Ce(`Could not find attr for ${[n, s]}`);
|
|
1963
1963
|
if (a["value-type"] !== "ref")
|
|
1964
1964
|
throw new Error(`Attr ${a.id} is not a ref`);
|
|
1965
1965
|
const [c, u] = a["forward-identity"], [l, f] = a["reverse-identity"], h = r + 1, p = i ? [
|
|
1966
1966
|
t(u, r),
|
|
1967
1967
|
a.id,
|
|
1968
1968
|
t(f, h),
|
|
1969
|
-
|
|
1969
|
+
Ue("time")
|
|
1970
1970
|
] : [
|
|
1971
1971
|
t(u, h),
|
|
1972
1972
|
a.id,
|
|
1973
1973
|
t(f, r),
|
|
1974
|
-
|
|
1974
|
+
Ue("time")
|
|
1975
1975
|
];
|
|
1976
1976
|
return [i ? f : u, h, p, a, !!i];
|
|
1977
1977
|
}
|
|
@@ -2048,24 +2048,24 @@ function Ys(t, e) {
|
|
|
2048
2048
|
function Zs(t, e, n, r, s, i) {
|
|
2049
2049
|
const o = j(e, n, s), a = me(e, n, s), c = o || a;
|
|
2050
2050
|
if (!c)
|
|
2051
|
-
throw new
|
|
2051
|
+
throw new Ce(`No attr for etype = ${n} label = ${s}`);
|
|
2052
2052
|
if (i != null && i.hasOwnProperty("$isNull")) {
|
|
2053
2053
|
const u = j(e, n, "id");
|
|
2054
2054
|
if (!u)
|
|
2055
|
-
throw new
|
|
2055
|
+
throw new Ce(`No attr for etype = ${n} label = id`);
|
|
2056
2056
|
return [
|
|
2057
2057
|
t(n, r),
|
|
2058
2058
|
u.id,
|
|
2059
2059
|
{ $isNull: { attrId: c.id, isNull: i.$isNull, reverse: !o } },
|
|
2060
|
-
|
|
2060
|
+
Ue("time")
|
|
2061
2061
|
];
|
|
2062
2062
|
}
|
|
2063
2063
|
return o ? [
|
|
2064
2064
|
t(n, r),
|
|
2065
2065
|
c.id,
|
|
2066
2066
|
Ys(c, i),
|
|
2067
|
-
|
|
2068
|
-
] : [i, c.id, t(n, r),
|
|
2067
|
+
Ue("time")
|
|
2068
|
+
] : [i, c.id, t(n, r), Ue("time")];
|
|
2069
2069
|
}
|
|
2070
2070
|
function Xs(t, e, n, r, s) {
|
|
2071
2071
|
const [i, o, a] = s.reduce((c, u) => {
|
|
@@ -2167,7 +2167,7 @@ function ci(t, e, n, { etype: r, level: s, form: i }, o) {
|
|
|
2167
2167
|
}), v = y ? T[0] : T;
|
|
2168
2168
|
return { [p]: v };
|
|
2169
2169
|
} catch (b) {
|
|
2170
|
-
if (b instanceof
|
|
2170
|
+
if (b instanceof Ce)
|
|
2171
2171
|
return { [p]: y ? void 0 : [] };
|
|
2172
2172
|
throw b;
|
|
2173
2173
|
}
|
|
@@ -2179,11 +2179,11 @@ function ci(t, e, n, { etype: r, level: s, form: i }, o) {
|
|
|
2179
2179
|
function ui(t, e, n) {
|
|
2180
2180
|
return n === "string" ? Vs(t, e) : t > e ? 1 : -1;
|
|
2181
2181
|
}
|
|
2182
|
-
function
|
|
2182
|
+
function $e(t, e, n, r, s) {
|
|
2183
2183
|
return e === r || e == null && r == null ? qs(t, n) : r == null ? 1 : e == null ? -1 : ui(e, r, s);
|
|
2184
2184
|
}
|
|
2185
2185
|
function Xe([t, e], [n, r], s) {
|
|
2186
|
-
return
|
|
2186
|
+
return $e(t, e, n, r, s);
|
|
2187
2187
|
}
|
|
2188
2188
|
function jt(t) {
|
|
2189
2189
|
return t == null ? t : new Date(t).getTime();
|
|
@@ -2285,7 +2285,7 @@ function wi(t, e, n) {
|
|
|
2285
2285
|
try {
|
|
2286
2286
|
return gi(t, e, n);
|
|
2287
2287
|
} catch (r) {
|
|
2288
|
-
if (r instanceof
|
|
2288
|
+
if (r instanceof Ce)
|
|
2289
2289
|
return {};
|
|
2290
2290
|
throw r;
|
|
2291
2291
|
}
|
|
@@ -2776,7 +2776,7 @@ function Ji(t, e) {
|
|
|
2776
2776
|
function gn(t, e) {
|
|
2777
2777
|
typeof requestIdleCallback > "u" ? t() : requestIdleCallback(t, { timeout: e });
|
|
2778
2778
|
}
|
|
2779
|
-
const
|
|
2779
|
+
const Oe = "__meta";
|
|
2780
2780
|
class Yi {
|
|
2781
2781
|
constructor(e, n) {
|
|
2782
2782
|
}
|
|
@@ -2814,7 +2814,7 @@ class Ut {
|
|
|
2814
2814
|
var e;
|
|
2815
2815
|
this._meta.loadingPromise && await this._meta.loadingPromise;
|
|
2816
2816
|
try {
|
|
2817
|
-
const n = this._persister.getItem(
|
|
2817
|
+
const n = this._persister.getItem(Oe);
|
|
2818
2818
|
this._meta.loadingPromise = n;
|
|
2819
2819
|
const r = await n;
|
|
2820
2820
|
this._meta.isLoading = !1, this._meta.error = null, this._meta.loadingPromise = null, this._meta.attempts = 0;
|
|
@@ -2896,7 +2896,7 @@ class Ut {
|
|
|
2896
2896
|
const h = this._persister.removeItem(f);
|
|
2897
2897
|
n.push(h.then(() => 1)), this._loadedKeys.delete(f), this._pendingSaveKeys.delete(f);
|
|
2898
2898
|
}
|
|
2899
|
-
const a = [], c = [[
|
|
2899
|
+
const a = [], c = [[Oe, s]], u = s.objects ?? {};
|
|
2900
2900
|
s.objects = u;
|
|
2901
2901
|
for (const f of o)
|
|
2902
2902
|
if (this._loadedKeys.has(f)) {
|
|
@@ -2925,7 +2925,7 @@ class Ut {
|
|
|
2925
2925
|
if (!this._gcOpts)
|
|
2926
2926
|
return;
|
|
2927
2927
|
const e = new Set(await this._persister.getAllKeys());
|
|
2928
|
-
e.delete(
|
|
2928
|
+
e.delete(Oe);
|
|
2929
2929
|
const n = new Set(Object.keys(this.currentValue));
|
|
2930
2930
|
for (const h of Object.keys(this._loadingKeys))
|
|
2931
2931
|
n.add(h);
|
|
@@ -3020,6 +3020,14 @@ class Ut {
|
|
|
3020
3020
|
this._subs = this._subs.filter((n) => n !== e);
|
|
3021
3021
|
};
|
|
3022
3022
|
}
|
|
3023
|
+
// Removes any keys that we haven't loaded--used when
|
|
3024
|
+
// changing users to make sure we clean out all user data
|
|
3025
|
+
async clearUnloadedKeys() {
|
|
3026
|
+
let e = !1;
|
|
3027
|
+
for (const n of await this._persister.getAllKeys())
|
|
3028
|
+
n === Oe || n in this.currentValue || (this._pendingSaveKeys.add(n), e = !0);
|
|
3029
|
+
e && await this._enqueuePersist();
|
|
3030
|
+
}
|
|
3023
3031
|
}
|
|
3024
3032
|
const Zi = 6, Xi = ["kv", "querySubs", "syncSubs"];
|
|
3025
3033
|
function eo(t) {
|
|
@@ -3065,7 +3073,7 @@ async function no(t, e, n) {
|
|
|
3065
3073
|
const w = n.put(g, p);
|
|
3066
3074
|
s.add(w);
|
|
3067
3075
|
}
|
|
3068
|
-
const c = { objects: a }, u = n.put(c,
|
|
3076
|
+
const c = { objects: a }, u = n.put(c, Oe);
|
|
3069
3077
|
s.add(u);
|
|
3070
3078
|
for (const p of s)
|
|
3071
3079
|
p.onsuccess = () => {
|
|
@@ -3121,7 +3129,7 @@ async function ro(t, e) {
|
|
|
3121
3129
|
break;
|
|
3122
3130
|
}
|
|
3123
3131
|
}
|
|
3124
|
-
const u = wn(
|
|
3132
|
+
const u = wn(Oe, c, i);
|
|
3125
3133
|
a.push(u), await Promise.all(a), await new Promise((l, f) => {
|
|
3126
3134
|
s.oncomplete = (h) => l(h), s.onerror = (h) => f(h), s.onabort = (h) => f(h);
|
|
3127
3135
|
});
|
|
@@ -3481,7 +3489,7 @@ function An(t) {
|
|
|
3481
3489
|
}, e;
|
|
3482
3490
|
}, {});
|
|
3483
3491
|
}
|
|
3484
|
-
const Xt = "v0.22.
|
|
3492
|
+
const Xt = "v0.22.163";
|
|
3485
3493
|
function wo(t, e) {
|
|
3486
3494
|
return {
|
|
3487
3495
|
info: t ? (...n) => console.info(...n, e()) : () => {
|
|
@@ -3629,7 +3637,7 @@ const On = [
|
|
|
3629
3637
|
default:
|
|
3630
3638
|
throw new C(`Unknown operator '${t}' for attribute '${r}' in entity '${s}'`, o);
|
|
3631
3639
|
}
|
|
3632
|
-
},
|
|
3640
|
+
}, ke = (t, e, n, r, s) => {
|
|
3633
3641
|
const i = _o(n), o = n.valueType === "json";
|
|
3634
3642
|
if (typeof t == "object" && t !== null && !Array.isArray(t)) {
|
|
3635
3643
|
if (o)
|
|
@@ -3659,23 +3667,23 @@ const On = [
|
|
|
3659
3667
|
if (!c)
|
|
3660
3668
|
throw new C(`Target entity '${o}' does not exist in schema for dot notation path '${t}'.`, s);
|
|
3661
3669
|
if (a === "id") {
|
|
3662
|
-
if (typeof e == "string" && !
|
|
3670
|
+
if (typeof e == "string" && !Ie(e))
|
|
3663
3671
|
throw new C(`Invalid value for id field in entity '${o}'. Expected a UUID, but received: ${e}`, s);
|
|
3664
|
-
|
|
3672
|
+
ke(e, t, new q("string", !1, !0), n, s);
|
|
3665
3673
|
return;
|
|
3666
3674
|
}
|
|
3667
3675
|
const u = c.attrs[a];
|
|
3668
3676
|
if (Object.keys(c.links).includes(a)) {
|
|
3669
|
-
if (typeof e == "string" && !
|
|
3677
|
+
if (typeof e == "string" && !Ie(e))
|
|
3670
3678
|
throw new C(`Invalid value for link '${a}' in entity '${o}'. Expected a UUID, but received: ${e}`, s);
|
|
3671
|
-
|
|
3679
|
+
ke(e, t, new q("string", !1, !0), n, s);
|
|
3672
3680
|
return;
|
|
3673
3681
|
}
|
|
3674
3682
|
if (!u) {
|
|
3675
3683
|
const l = Object.keys(c.attrs);
|
|
3676
3684
|
throw new C(`Attribute '${a}' does not exist on entity '${o}' in dot notation path '${t}'. Available attributes: ${l.length > 0 ? l.join(", ") + ", id" : "id"}`, s);
|
|
3677
3685
|
}
|
|
3678
|
-
|
|
3686
|
+
ke(e, t, u, n, s);
|
|
3679
3687
|
}, br = (t, e, n, r) => {
|
|
3680
3688
|
for (const [s, i] of Object.entries(t)) {
|
|
3681
3689
|
if (s === "or" || s === "and") {
|
|
@@ -3685,7 +3693,7 @@ const On = [
|
|
|
3685
3693
|
continue;
|
|
3686
3694
|
}
|
|
3687
3695
|
if (s === "id") {
|
|
3688
|
-
|
|
3696
|
+
ke(i, "id", new q("string", !1, !0), e, `${r}.id`);
|
|
3689
3697
|
continue;
|
|
3690
3698
|
}
|
|
3691
3699
|
if (s.includes(".")) {
|
|
@@ -3701,12 +3709,12 @@ const On = [
|
|
|
3701
3709
|
throw new C(`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}`);
|
|
3702
3710
|
}
|
|
3703
3711
|
if (a)
|
|
3704
|
-
|
|
3712
|
+
ke(i, s, a, e, `${r}.${s}`);
|
|
3705
3713
|
else if (c) {
|
|
3706
|
-
if (typeof i == "string" && !
|
|
3714
|
+
if (typeof i == "string" && !Ie(i))
|
|
3707
3715
|
throw new C(`Invalid value for link '${s}' in entity '${e}'. Expected a UUID, but received: ${i}`, `${r}.${s}`);
|
|
3708
3716
|
const u = new q("string", !1, !0);
|
|
3709
|
-
|
|
3717
|
+
ke(i, s, u, e, `${r}.${s}`);
|
|
3710
3718
|
}
|
|
3711
3719
|
}
|
|
3712
3720
|
}, So = (t, e, n, r, s = 0) => {
|
|
@@ -3769,7 +3777,7 @@ const On = [
|
|
|
3769
3777
|
gr(n[r], r, e, r, 0);
|
|
3770
3778
|
}
|
|
3771
3779
|
}
|
|
3772
|
-
}, In = (t) => typeof t != "string" ? !1 : et(t) ? !0 :
|
|
3780
|
+
}, In = (t) => typeof t != "string" ? !1 : et(t) ? !0 : Ie(t);
|
|
3773
3781
|
class Y extends Error {
|
|
3774
3782
|
constructor(e) {
|
|
3775
3783
|
super(e), this.name = "TransactionValidationError";
|
|
@@ -3830,7 +3838,7 @@ const wr = (t) => t.length > 0 ? t.join(", ") : "none", vo = (t, e) => new Y(`En
|
|
|
3830
3838
|
if (!e)
|
|
3831
3839
|
return;
|
|
3832
3840
|
const [n, r, s, i] = t;
|
|
3833
|
-
if (!Array.isArray(s) && !
|
|
3841
|
+
if (!Array.isArray(s) && !Ie(s))
|
|
3834
3842
|
throw new Y(`Invalid id for entity '${r}'. Expected a UUID, but received: ${s}`);
|
|
3835
3843
|
if (typeof r != "string")
|
|
3836
3844
|
throw new Y(`Entity name must be a string, but received: ${typeof r}`);
|
|
@@ -4023,7 +4031,7 @@ function Pn(t, e, n, r) {
|
|
|
4023
4031
|
const s = (o = j(n, t.table, "id")) == null ? void 0 : o.id;
|
|
4024
4032
|
if (!s)
|
|
4025
4033
|
return -1;
|
|
4026
|
-
const i =
|
|
4034
|
+
const i = Ee(e.eav, [r, s, r]);
|
|
4027
4035
|
return i ? i[3] : -1;
|
|
4028
4036
|
}
|
|
4029
4037
|
function Mn(t, e, n) {
|
|
@@ -4076,17 +4084,17 @@ function $o(t, e, n) {
|
|
|
4076
4084
|
const r = e;
|
|
4077
4085
|
if (t.orderField === "serverCreatedAt") {
|
|
4078
4086
|
n.sort(t.orderDirection === "asc" ? function(o, a) {
|
|
4079
|
-
return
|
|
4087
|
+
return $e(o.entity.id, o.serverCreatedAt, a.entity.id, a.serverCreatedAt, r);
|
|
4080
4088
|
} : function(o, a) {
|
|
4081
|
-
return
|
|
4089
|
+
return $e(a.entity.id, a.serverCreatedAt, o.entity.id, o.serverCreatedAt, r);
|
|
4082
4090
|
});
|
|
4083
4091
|
return;
|
|
4084
4092
|
}
|
|
4085
4093
|
const s = t.orderField;
|
|
4086
4094
|
n.sort(t.orderDirection === "asc" ? function(o, a) {
|
|
4087
|
-
return
|
|
4095
|
+
return $e(o.entity.id, o.entity[s], a.entity.id, a.entity[s], r);
|
|
4088
4096
|
} : function(o, a) {
|
|
4089
|
-
return
|
|
4097
|
+
return $e(a.entity.id, a.entity[s], o.entity.id, o.entity[s], r);
|
|
4090
4098
|
});
|
|
4091
4099
|
}
|
|
4092
4100
|
var ye;
|
|
@@ -4427,7 +4435,7 @@ function xo({ WStream: t, opts: e, startStream: n, appendStream: r, registerStre
|
|
|
4427
4435
|
function ae() {
|
|
4428
4436
|
g = !0;
|
|
4429
4437
|
}
|
|
4430
|
-
function
|
|
4438
|
+
function Pe(S) {
|
|
4431
4439
|
let k = w, F = 0, z = 0;
|
|
4432
4440
|
for (const { byteLen: X } of b) {
|
|
4433
4441
|
const ce = k + X;
|
|
@@ -4449,7 +4457,7 @@ function xo({ WStream: t, opts: e, startStream: n, appendStream: r, registerStre
|
|
|
4449
4457
|
switch (S.type) {
|
|
4450
4458
|
case "ok": {
|
|
4451
4459
|
const { streamId: k, offset: F } = S;
|
|
4452
|
-
o = k,
|
|
4460
|
+
o = k, Pe(F), b.length && r({
|
|
4453
4461
|
streamId: k,
|
|
4454
4462
|
chunks: b.map((z) => z.chunk),
|
|
4455
4463
|
offset: w
|
|
@@ -4470,7 +4478,7 @@ function xo({ WStream: t, opts: e, startStream: n, appendStream: r, registerStre
|
|
|
4470
4478
|
ae(), Z();
|
|
4471
4479
|
}
|
|
4472
4480
|
function re({ offset: S, done: k }) {
|
|
4473
|
-
|
|
4481
|
+
Pe(S), k && (l = !0, I());
|
|
4474
4482
|
}
|
|
4475
4483
|
function se(S) {
|
|
4476
4484
|
return l ? (B(S, new K("Stream has been closed.")), null) : o || (B(S, new K("Stream has not been initialized.")), null);
|
|
@@ -5191,7 +5199,7 @@ class Zo {
|
|
|
5191
5199
|
if (this._EventSource = i, this.config = { ...Wo, ...e }, this.queryCacheLimit = this.config.queryCacheLimit ?? 10, this._pendingTxCleanupTimeout = this.config.pendingTxCleanupTimeout ?? Ko, this._pendingMutationCleanupThreshold = this.config.pendingMutationCleanupThreshold ?? qo, this._log = wo(e.verbose || Zt || dr, () => this._reactorStats()), this.versions = { ...s || {}, "@instantdb/core": Xt }, this.config.schema && (this._linkIndex = An(this.config.schema)), !!Qo()) {
|
|
5192
5200
|
if (!e.appId)
|
|
5193
5201
|
throw new Error("Instant must be initialized with an appId.");
|
|
5194
|
-
if (!
|
|
5202
|
+
if (!Ie(e.appId))
|
|
5195
5203
|
throw new Error(`Instant must be initialized with a valid appId. \`${e.appId}\` is not a valid uuid.`);
|
|
5196
5204
|
typeof BroadcastChannel == "function" && (this._broadcastChannel = new BroadcastChannel("@instantdb"), this._broadcastChannel.addEventListener("message", async (o) => {
|
|
5197
5205
|
var a;
|
|
@@ -5209,7 +5217,7 @@ class Zo {
|
|
|
5209
5217
|
}
|
|
5210
5218
|
})), this._initStorage(n), this._syncTable = new Ro(this._trySendAuthed.bind(this), new n(this.config.appId, "syncSubs"), {
|
|
5211
5219
|
useDateObjects: this.config.useDateObjects
|
|
5212
|
-
}, this._log, (o) =>
|
|
5220
|
+
}, this._log, (o) => De(this.ensureAttrs(), o, this.config.enableCardinalityInference, this.config.useDateObjects), () => this.ensureAttrs()), this._instantStream = new Fo({
|
|
5213
5221
|
WStream: this.config.WritableStream || WritableStream,
|
|
5214
5222
|
RStream: this.config.ReadableStream || ReadableStream,
|
|
5215
5223
|
trySend: this._trySendAuthed.bind(this),
|
|
@@ -5342,7 +5350,7 @@ class Zo {
|
|
|
5342
5350
|
_addQueryData(e, n, r) {
|
|
5343
5351
|
if (!this.attrs)
|
|
5344
5352
|
throw new Error("Attrs in reactor have not been set");
|
|
5345
|
-
const s = x(e), i = this.ensureAttrs(), o =
|
|
5353
|
+
const s = x(e), i = this.ensureAttrs(), o = De(this.attrs, n.triples, r, this.config.useDateObjects);
|
|
5346
5354
|
this.querySubs.updateInPlace((a) => {
|
|
5347
5355
|
a[s] = {
|
|
5348
5356
|
result: {
|
|
@@ -5376,7 +5384,7 @@ class Zo {
|
|
|
5376
5384
|
const { q: p, result: y } = n, g = x(p);
|
|
5377
5385
|
if (!this._hasQueryListeners() && !this.querySubs.currentValue[g])
|
|
5378
5386
|
break;
|
|
5379
|
-
const w = (c = (a = y == null ? void 0 : y[0]) == null ? void 0 : a.data) == null ? void 0 : c["page-info"], _ = (l = (u = y == null ? void 0 : y[0]) == null ? void 0 : u.data) == null ? void 0 : l.aggregate, b = vn(y), m = this.ensureAttrs(), A =
|
|
5387
|
+
const w = (c = (a = y == null ? void 0 : y[0]) == null ? void 0 : a.data) == null ? void 0 : c["page-info"], _ = (l = (u = y == null ? void 0 : y[0]) == null ? void 0 : u.data) == null ? void 0 : l.aggregate, b = vn(y), m = this.ensureAttrs(), A = De(m, b, r, this.config.useDateObjects);
|
|
5380
5388
|
this.querySubs.updateInPlace((T) => {
|
|
5381
5389
|
if (!T[g]) {
|
|
5382
5390
|
this._log.info("Missing value in querySubs", { hash: g, q: p });
|
|
@@ -5433,12 +5441,12 @@ class Zo {
|
|
|
5433
5441
|
});
|
|
5434
5442
|
const _ = Tt(w.entries()), b = p.map((m) => {
|
|
5435
5443
|
var J, re, se, Se;
|
|
5436
|
-
const A = m["instaql-query"], T = m["instaql-result"], v = x(A), I = vn(T), E = this.ensureAttrs(), D =
|
|
5444
|
+
const A = m["instaql-query"], T = m["instaql-result"], v = x(A), I = vn(T), E = this.ensureAttrs(), D = De(E, I, r, this.config.useDateObjects), { store: ae, attrsStore: Pe } = this._applyOptimisticUpdates(D, E, _, g), B = (re = (J = T == null ? void 0 : T[0]) == null ? void 0 : J.data) == null ? void 0 : re["page-info"], Z = (Se = (se = T == null ? void 0 : T[0]) == null ? void 0 : se.data) == null ? void 0 : Se.aggregate;
|
|
5437
5445
|
return {
|
|
5438
5446
|
q: A,
|
|
5439
5447
|
hash: v,
|
|
5440
5448
|
store: ae,
|
|
5441
|
-
attrsStore:
|
|
5449
|
+
attrsStore: Pe,
|
|
5442
5450
|
pageInfo: B,
|
|
5443
5451
|
aggregate: Z
|
|
5444
5452
|
};
|
|
@@ -6113,6 +6121,13 @@ class Zo {
|
|
|
6113
6121
|
Object.keys(r).forEach((s) => {
|
|
6114
6122
|
delete r[s].result;
|
|
6115
6123
|
});
|
|
6124
|
+
}), this.querySubs.clearUnloadedKeys(), this._updatePendingMutations((r) => {
|
|
6125
|
+
for (const [s, i] of r.entries())
|
|
6126
|
+
this.mutationDeferredStore.get(s) && this._finishTransaction("error", s, {
|
|
6127
|
+
message: "User changed while transaction was in progress.",
|
|
6128
|
+
type: "user-changed"
|
|
6129
|
+
});
|
|
6130
|
+
r.clear();
|
|
6116
6131
|
}), this._reconnectTimeoutMs = 0, this._transport.close(), this._oauthCallbackResponse = null, this.notifyAuthSubs(n);
|
|
6117
6132
|
}
|
|
6118
6133
|
sendMagicCode({ email: e }) {
|
|
@@ -7095,7 +7110,7 @@ let Sr = kr;
|
|
|
7095
7110
|
const Te = 1, nt = 2, Ea = {};
|
|
7096
7111
|
var U = null;
|
|
7097
7112
|
let St = null, Pa = null, R = null, L = null, de = null, ft = 0;
|
|
7098
|
-
function
|
|
7113
|
+
function Re(t, e) {
|
|
7099
7114
|
e = e ? Object.assign({}, tt, e) : tt;
|
|
7100
7115
|
const n = {
|
|
7101
7116
|
value: t,
|
|
@@ -7305,7 +7320,7 @@ function La(t, e) {
|
|
|
7305
7320
|
};
|
|
7306
7321
|
}
|
|
7307
7322
|
function Fa(t, e = {}) {
|
|
7308
|
-
const [n, r] =
|
|
7323
|
+
const [n, r] = Re(
|
|
7309
7324
|
t.core._reactor.getPresence(t.type, t.id, e) ?? {
|
|
7310
7325
|
peers: {},
|
|
7311
7326
|
isLoading: !0
|
|
@@ -7456,7 +7471,7 @@ class Va {
|
|
|
7456
7471
|
* // state().isLoading, state().error, state().data
|
|
7457
7472
|
*/
|
|
7458
7473
|
d(this, "useQuery", (e, n) => {
|
|
7459
|
-
const [r, s] =
|
|
7474
|
+
const [r, s] = Re(Rn);
|
|
7460
7475
|
return ue(() => {
|
|
7461
7476
|
const i = typeof e == "function" ? e() : e;
|
|
7462
7477
|
if (!i) {
|
|
@@ -7499,7 +7514,7 @@ class Va {
|
|
|
7499
7514
|
* }
|
|
7500
7515
|
*/
|
|
7501
7516
|
d(this, "useAuth", () => {
|
|
7502
|
-
const [e, n] =
|
|
7517
|
+
const [e, n] = Re(
|
|
7503
7518
|
this.core._reactor._currentUserCached ?? za
|
|
7504
7519
|
);
|
|
7505
7520
|
return ue(() => {
|
|
@@ -7542,7 +7557,7 @@ class Va {
|
|
|
7542
7557
|
* }
|
|
7543
7558
|
*/
|
|
7544
7559
|
d(this, "useConnectionStatus", () => {
|
|
7545
|
-
const [e, n] =
|
|
7560
|
+
const [e, n] = Re(
|
|
7546
7561
|
this.core._reactor.status
|
|
7547
7562
|
);
|
|
7548
7563
|
return ue(() => {
|
|
@@ -7563,7 +7578,7 @@ class Va {
|
|
|
7563
7578
|
* // deviceId() is null initially, then the ID string
|
|
7564
7579
|
*/
|
|
7565
7580
|
d(this, "useLocalId", (e) => {
|
|
7566
|
-
const [n, r] =
|
|
7581
|
+
const [n, r] = Re(null);
|
|
7567
7582
|
return ue(() => {
|
|
7568
7583
|
let s = !0;
|
|
7569
7584
|
this.getLocalId(e).then((i) => {
|