@instantdb/solidjs 0.22.185-branch-rules-rm-seed-example.23928637149.1 → 0.22.185
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
CHANGED
|
@@ -201,15 +201,15 @@ function Gn(t, e) {
|
|
|
201
201
|
function H(t) {
|
|
202
202
|
t.copy || (t.copy = Gn(t.original, t.options));
|
|
203
203
|
}
|
|
204
|
-
function
|
|
204
|
+
function xe(t) {
|
|
205
205
|
if (!ae(t))
|
|
206
206
|
return Yt(t);
|
|
207
207
|
if (Array.isArray(t))
|
|
208
|
-
return t.map(
|
|
208
|
+
return t.map(xe);
|
|
209
209
|
if (t instanceof Map) {
|
|
210
210
|
const n = Array.from(t.entries()).map(([r, s]) => [
|
|
211
211
|
r,
|
|
212
|
-
|
|
212
|
+
xe(s)
|
|
213
213
|
]);
|
|
214
214
|
if (!Jt(t)) {
|
|
215
215
|
const r = Object.getPrototypeOf(t).constructor;
|
|
@@ -218,7 +218,7 @@ function Re(t) {
|
|
|
218
218
|
return new Map(n);
|
|
219
219
|
}
|
|
220
220
|
if (t instanceof Set) {
|
|
221
|
-
const n = Array.from(t).map(
|
|
221
|
+
const n = Array.from(t).map(xe);
|
|
222
222
|
if (!Ht(t)) {
|
|
223
223
|
const r = Object.getPrototypeOf(t).constructor;
|
|
224
224
|
return new r(n);
|
|
@@ -227,11 +227,11 @@ function Re(t) {
|
|
|
227
227
|
}
|
|
228
228
|
const e = Object.create(Object.getPrototypeOf(t));
|
|
229
229
|
for (const n in t)
|
|
230
|
-
e[n] =
|
|
230
|
+
e[n] = xe(t[n]);
|
|
231
231
|
return e;
|
|
232
232
|
}
|
|
233
233
|
function Xe(t) {
|
|
234
|
-
return Se(t) ?
|
|
234
|
+
return Se(t) ? xe(t) : t;
|
|
235
235
|
}
|
|
236
236
|
function fe(t) {
|
|
237
237
|
var e;
|
|
@@ -453,7 +453,7 @@ function ze(t, e, n, r) {
|
|
|
453
453
|
const nt = (t, e, n = !1) => {
|
|
454
454
|
if (typeof t == "object" && t !== null && (!ae(t, e) || n))
|
|
455
455
|
throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.");
|
|
456
|
-
},
|
|
456
|
+
}, Rt = {
|
|
457
457
|
get size() {
|
|
458
458
|
return re(C(this)).size;
|
|
459
459
|
},
|
|
@@ -534,7 +534,7 @@ const nt = (t, e, n = !1) => {
|
|
|
534
534
|
[Ze]() {
|
|
535
535
|
return this.entries();
|
|
536
536
|
}
|
|
537
|
-
}, Yr = Reflect.ownKeys(
|
|
537
|
+
}, Yr = Reflect.ownKeys(Rt), dn = (t, e, { isValuesIterator: n }) => () => {
|
|
538
538
|
var r, s;
|
|
539
539
|
const i = e.next();
|
|
540
540
|
if (i.done)
|
|
@@ -662,8 +662,8 @@ const Zr = Reflect.ownKeys(rt), Jn = /* @__PURE__ */ new WeakSet(), Yn = {
|
|
|
662
662
|
const a = re(t);
|
|
663
663
|
if (a instanceof Map && Yr.includes(e)) {
|
|
664
664
|
if (e === "size")
|
|
665
|
-
return Object.getOwnPropertyDescriptor(
|
|
666
|
-
const u =
|
|
665
|
+
return Object.getOwnPropertyDescriptor(Rt, "size").get.call(t.proxy);
|
|
666
|
+
const u = Rt[e];
|
|
667
667
|
if (u)
|
|
668
668
|
return u.bind(t.proxy);
|
|
669
669
|
}
|
|
@@ -816,7 +816,7 @@ function es(t, e) {
|
|
|
816
816
|
}
|
|
817
817
|
];
|
|
818
818
|
}
|
|
819
|
-
function
|
|
819
|
+
function xt(t) {
|
|
820
820
|
const { rootDraft: e, value: n, useRawReturn: r = !1, isRoot: s = !0 } = t;
|
|
821
821
|
Zt(n, (i, o, a) => {
|
|
822
822
|
const c = C(o);
|
|
@@ -828,7 +828,7 @@ function Rt(t) {
|
|
|
828
828
|
a.clear(), l.forEach((f) => a.add(i === f ? u : f));
|
|
829
829
|
} else
|
|
830
830
|
We(a, i, u);
|
|
831
|
-
} else typeof o == "object" && o !== null && (t.value = o, t.isRoot = !1,
|
|
831
|
+
} else typeof o == "object" && o !== null && (t.value = o, t.isRoot = !1, xt(t));
|
|
832
832
|
}), s && (t.isContainDraft || console.warn("The return value does not contain any draft, please use 'rawReturn()' to wrap the return value to improve performance."), r && console.warn("The return value contains drafts, please don't use 'rawReturn()' to wrap the return value."));
|
|
833
833
|
}
|
|
834
834
|
function Zn(t) {
|
|
@@ -915,14 +915,14 @@ const ts = (t) => function e(n, r, s) {
|
|
|
915
915
|
const $ = T == null ? void 0 : T[zr];
|
|
916
916
|
if ($) {
|
|
917
917
|
const D = $[0];
|
|
918
|
-
return w.strict && typeof T == "object" && T !== null &&
|
|
918
|
+
return w.strict && typeof T == "object" && T !== null && xt({
|
|
919
919
|
rootDraft: k,
|
|
920
920
|
value: T,
|
|
921
921
|
useRawReturn: !0
|
|
922
922
|
}), b([D]);
|
|
923
923
|
}
|
|
924
924
|
if (T !== void 0)
|
|
925
|
-
return typeof T == "object" && T !== null &&
|
|
925
|
+
return typeof T == "object" && T !== null && xt({ rootDraft: k, value: T }), b([T]);
|
|
926
926
|
}
|
|
927
927
|
if (T === m || T === void 0)
|
|
928
928
|
return b([]);
|
|
@@ -1770,7 +1770,7 @@ function $s(t, e, n) {
|
|
|
1770
1770
|
if (e.getAttr(i))
|
|
1771
1771
|
return $e(t.eav, [s, i]);
|
|
1772
1772
|
}
|
|
1773
|
-
function
|
|
1773
|
+
function Rs(t, e, n) {
|
|
1774
1774
|
const r = n.filter(([s, i, o, a, c]) => {
|
|
1775
1775
|
if (s !== "add-triple" && s !== "deep-merge-triple")
|
|
1776
1776
|
return !0;
|
|
@@ -1800,7 +1800,7 @@ function xs(t, e, n) {
|
|
|
1800
1800
|
}
|
|
1801
1801
|
});
|
|
1802
1802
|
}
|
|
1803
|
-
function
|
|
1803
|
+
function xs(t) {
|
|
1804
1804
|
return typeof t == "string" && t.startsWith("?");
|
|
1805
1805
|
}
|
|
1806
1806
|
function Ds(t, e, n) {
|
|
@@ -1854,7 +1854,7 @@ function Lt(t, e, n = [{}]) {
|
|
|
1854
1854
|
return e.reduce((r, s) => qs(t, s, r), n);
|
|
1855
1855
|
}
|
|
1856
1856
|
function sn(t, e) {
|
|
1857
|
-
return Array.isArray(e) ? e.map((n) => sn(t, n)) :
|
|
1857
|
+
return Array.isArray(e) ? e.map((n) => sn(t, n)) : xs(e) ? t[e] : e;
|
|
1858
1858
|
}
|
|
1859
1859
|
function zs(t, { find: e, where: n }) {
|
|
1860
1860
|
return Lt(t, n).map((s) => sn(s, e));
|
|
@@ -1911,7 +1911,7 @@ function Ys(t, e) {
|
|
|
1911
1911
|
function Zs(t, e) {
|
|
1912
1912
|
return Ys(_n(t), _n(e));
|
|
1913
1913
|
}
|
|
1914
|
-
function
|
|
1914
|
+
function x() {
|
|
1915
1915
|
return Js();
|
|
1916
1916
|
}
|
|
1917
1917
|
function Xs(t, e) {
|
|
@@ -2371,7 +2371,7 @@ function Kt(t) {
|
|
|
2371
2371
|
const [e, n, ...r] = t.split("__");
|
|
2372
2372
|
return [n, JSON.parse(r.join("__"))];
|
|
2373
2373
|
}
|
|
2374
|
-
function
|
|
2374
|
+
function Ri(t) {
|
|
2375
2375
|
return new Proxy({
|
|
2376
2376
|
__etype: t
|
|
2377
2377
|
}, {
|
|
@@ -2388,12 +2388,12 @@ function xi(t) {
|
|
|
2388
2388
|
function on() {
|
|
2389
2389
|
return new Proxy({}, {
|
|
2390
2390
|
get(t, e) {
|
|
2391
|
-
return
|
|
2391
|
+
return Ri(e);
|
|
2392
2392
|
}
|
|
2393
2393
|
});
|
|
2394
2394
|
}
|
|
2395
2395
|
const fc = on();
|
|
2396
|
-
function
|
|
2396
|
+
function xi(t) {
|
|
2397
2397
|
return t.__ops;
|
|
2398
2398
|
}
|
|
2399
2399
|
function Di(t, e) {
|
|
@@ -2631,7 +2631,7 @@ function Yi(t, e, n) {
|
|
|
2631
2631
|
};
|
|
2632
2632
|
}
|
|
2633
2633
|
function Be(t, e, n, r) {
|
|
2634
|
-
const s = t ? Yi(t, e, n) : null, i =
|
|
2634
|
+
const s = t ? Yi(t, e, n) : null, i = x(), a = [x(), e, n];
|
|
2635
2635
|
return {
|
|
2636
2636
|
id: i,
|
|
2637
2637
|
"forward-identity": a,
|
|
@@ -2653,8 +2653,8 @@ function Xi(t, e, n) {
|
|
|
2653
2653
|
throw new Error(`Couldn't find the link ${e}.${n} in your schema`);
|
|
2654
2654
|
const { forward: s, reverse: i } = r;
|
|
2655
2655
|
return {
|
|
2656
|
-
"forward-identity": [
|
|
2657
|
-
"reverse-identity": [
|
|
2656
|
+
"forward-identity": [x(), s.on, s.label],
|
|
2657
|
+
"reverse-identity": [x(), i.on, i.label],
|
|
2658
2658
|
cardinality: s.has === "one" ? "one" : "many",
|
|
2659
2659
|
"unique?": i.has === "one",
|
|
2660
2660
|
"on-delete": s.onDelete,
|
|
@@ -2662,7 +2662,7 @@ function Xi(t, e, n) {
|
|
|
2662
2662
|
};
|
|
2663
2663
|
}
|
|
2664
2664
|
function An(t, e, n, r) {
|
|
2665
|
-
const s = t ? Xi(t, e, n) : null, i =
|
|
2665
|
+
const s = t ? Xi(t, e, n) : null, i = x(), o = [x(), e, n], a = [x(), n, e];
|
|
2666
2666
|
return {
|
|
2667
2667
|
id: i,
|
|
2668
2668
|
// @ts-ignore: ts thinks it's any[]
|
|
@@ -2781,7 +2781,7 @@ function oo({ attrsStore: t, schema: e }, n) {
|
|
|
2781
2781
|
return [t, i];
|
|
2782
2782
|
}
|
|
2783
2783
|
function ao(t, e) {
|
|
2784
|
-
const r = (Array.isArray(e) ? e : [e]).flatMap((c) =>
|
|
2784
|
+
const r = (Array.isArray(e) ? e : [e]).flatMap((c) => xi(c)), [s, i] = oo(t, r), o = { ...t, attrsStore: s }, a = r.flatMap((c) => Hi(o, c));
|
|
2785
2785
|
return [...i, ...a];
|
|
2786
2786
|
}
|
|
2787
2787
|
function kn(t, e) {
|
|
@@ -3503,7 +3503,7 @@ function jn(t) {
|
|
|
3503
3503
|
}, e;
|
|
3504
3504
|
}, {});
|
|
3505
3505
|
}
|
|
3506
|
-
const cn = "v0.22.185
|
|
3506
|
+
const cn = "v0.22.185";
|
|
3507
3507
|
function Eo(t, e) {
|
|
3508
3508
|
return {
|
|
3509
3509
|
info: t ? (...n) => console.info(...n, e()) : () => {
|
|
@@ -3776,7 +3776,7 @@ const $n = [
|
|
|
3776
3776
|
throw new j(`Query parameter '$' must be an object in entity '${e}', but received: ${typeof a}`, `${r}.$`);
|
|
3777
3777
|
$o(a, e, n, `${r}.$`, s);
|
|
3778
3778
|
}
|
|
3779
|
-
},
|
|
3779
|
+
}, Rn = (t, e) => {
|
|
3780
3780
|
if (typeof t != "object" || t === null)
|
|
3781
3781
|
throw new j(`Query must be an object, but received: ${typeof t}${t === null ? " (null)" : ""}`);
|
|
3782
3782
|
if (Array.isArray(t))
|
|
@@ -3795,25 +3795,25 @@ const $n = [
|
|
|
3795
3795
|
Cr(n[r], r, e, r, 0);
|
|
3796
3796
|
}
|
|
3797
3797
|
}
|
|
3798
|
-
},
|
|
3798
|
+
}, xn = (t) => typeof t != "string" ? !1 : ot(t) ? !0 : Me(t);
|
|
3799
3799
|
class ie extends Error {
|
|
3800
3800
|
constructor(e) {
|
|
3801
3801
|
super(e), this.name = "TransactionValidationError";
|
|
3802
3802
|
}
|
|
3803
3803
|
}
|
|
3804
|
-
const Er = (t) => t.length > 0 ? t.join(", ") : "none",
|
|
3804
|
+
const Er = (t) => t.length > 0 ? t.join(", ") : "none", Ro = (t, e) => new ie(`Entity '${t}' does not exist in schema. Available entities: ${Er(e)}`), vt = {
|
|
3805
3805
|
string: (t) => typeof t == "string",
|
|
3806
3806
|
number: (t) => typeof t == "number" && !isNaN(t),
|
|
3807
3807
|
boolean: (t) => typeof t == "boolean",
|
|
3808
3808
|
date: (t) => t instanceof Date || typeof t == "string" || typeof t == "number",
|
|
3809
3809
|
json: () => !0
|
|
3810
|
-
},
|
|
3810
|
+
}, xo = (t, e) => {
|
|
3811
3811
|
var n;
|
|
3812
3812
|
return t == null ? !0 : ((n = vt[e.valueType]) == null ? void 0 : n.call(vt, t)) ?? !1;
|
|
3813
3813
|
}, Pr = (t, e) => {
|
|
3814
3814
|
const n = e.entities[t];
|
|
3815
3815
|
if (!n)
|
|
3816
|
-
throw
|
|
3816
|
+
throw Ro(t, Object.keys(e.entities));
|
|
3817
3817
|
return n;
|
|
3818
3818
|
}, At = (t, e, n) => {
|
|
3819
3819
|
const r = Pr(t, n);
|
|
@@ -3823,7 +3823,7 @@ const Er = (t) => t.length > 0 ? t.join(", ") : "none", xo = (t, e) => new ie(`E
|
|
|
3823
3823
|
if (s === "id")
|
|
3824
3824
|
continue;
|
|
3825
3825
|
const o = r.attrs[s];
|
|
3826
|
-
if (o && !
|
|
3826
|
+
if (o && !xo(i, o))
|
|
3827
3827
|
throw new ie(`Invalid value for attribute '${s}' in entity '${t}'. Expected ${o.valueType}, but received: ${typeof i}`);
|
|
3828
3828
|
}
|
|
3829
3829
|
}, Dn = (t, e, n) => {
|
|
@@ -3838,9 +3838,9 @@ const Er = (t) => t.length > 0 ? t.join(", ") : "none", xo = (t, e) => new ie(`E
|
|
|
3838
3838
|
if (i != null) {
|
|
3839
3839
|
if (Array.isArray(i)) {
|
|
3840
3840
|
for (const a of i)
|
|
3841
|
-
if (!
|
|
3841
|
+
if (!xn(a))
|
|
3842
3842
|
throw new ie(`Invalid entity ID in link '${s}' for entity '${t}'. Expected a UUID or a lookup, but received: ${a}`);
|
|
3843
|
-
} else if (!
|
|
3843
|
+
} else if (!xn(i))
|
|
3844
3844
|
throw new ie(`Invalid UUID in link '${s}' for entity '${t}'. Expected a UUID, but received: ${i}`);
|
|
3845
3845
|
}
|
|
3846
3846
|
}
|
|
@@ -4170,7 +4170,7 @@ class Qo {
|
|
|
4170
4170
|
}
|
|
4171
4171
|
}
|
|
4172
4172
|
sendStart(e) {
|
|
4173
|
-
this.trySend(
|
|
4173
|
+
this.trySend(x(), {
|
|
4174
4174
|
op: "start-sync",
|
|
4175
4175
|
q: e
|
|
4176
4176
|
});
|
|
@@ -4184,7 +4184,7 @@ class Qo {
|
|
|
4184
4184
|
});
|
|
4185
4185
|
}
|
|
4186
4186
|
sendRemove(e, n) {
|
|
4187
|
-
this.trySend(
|
|
4187
|
+
this.trySend(x(), {
|
|
4188
4188
|
op: "remove-sync",
|
|
4189
4189
|
"subscription-id": e.subscriptionId,
|
|
4190
4190
|
"keep-subscription": n
|
|
@@ -4407,7 +4407,7 @@ class Qo {
|
|
|
4407
4407
|
function Bo({ WStream: t, opts: e, startStream: n, appendStream: r, registerStream: s }) {
|
|
4408
4408
|
const i = e.clientId;
|
|
4409
4409
|
let o = null, a = null, c = null;
|
|
4410
|
-
const u =
|
|
4410
|
+
const u = x();
|
|
4411
4411
|
let l = !1, f = !1;
|
|
4412
4412
|
const d = [], p = [], y = [];
|
|
4413
4413
|
let g = !1, w = 0, m = 0;
|
|
@@ -4541,7 +4541,7 @@ function Bo({ WStream: t, opts: e, startStream: n, appendStream: r, registerStre
|
|
|
4541
4541
|
}
|
|
4542
4542
|
}
|
|
4543
4543
|
}
|
|
4544
|
-
class
|
|
4544
|
+
class R extends t {
|
|
4545
4545
|
constructor(A, M) {
|
|
4546
4546
|
super(A, M);
|
|
4547
4547
|
}
|
|
@@ -4560,7 +4560,7 @@ function Bo({ WStream: t, opts: e, startStream: n, appendStream: r, registerStre
|
|
|
4560
4560
|
}
|
|
4561
4561
|
}
|
|
4562
4562
|
return {
|
|
4563
|
-
stream: new
|
|
4563
|
+
stream: new R({
|
|
4564
4564
|
// TODO(dww): accept a storage so that write streams can survive across
|
|
4565
4565
|
// browser restarts
|
|
4566
4566
|
async start(S) {
|
|
@@ -4658,7 +4658,7 @@ function Ho({ RStream: t, opts: e, startStream: n, cancelStream: r }) {
|
|
|
4658
4658
|
}
|
|
4659
4659
|
let y = 0;
|
|
4660
4660
|
async function g(b, _) {
|
|
4661
|
-
c =
|
|
4661
|
+
c = x();
|
|
4662
4662
|
const O = { ...b || {}, eventId: c };
|
|
4663
4663
|
for await (const T of n(O)) {
|
|
4664
4664
|
if (i)
|
|
@@ -4799,7 +4799,7 @@ class Jo {
|
|
|
4799
4799
|
}), n;
|
|
4800
4800
|
}
|
|
4801
4801
|
startWriteStream(e) {
|
|
4802
|
-
const n =
|
|
4802
|
+
const n = x();
|
|
4803
4803
|
let r = null;
|
|
4804
4804
|
const s = new Promise((o) => {
|
|
4805
4805
|
r = o;
|
|
@@ -4823,7 +4823,7 @@ class Jo {
|
|
|
4823
4823
|
offset: s,
|
|
4824
4824
|
done: !!r
|
|
4825
4825
|
};
|
|
4826
|
-
i && (o["abort-reason"] = i), this.trySend(
|
|
4826
|
+
i && (o["abort-reason"] = i), this.trySend(x(), o);
|
|
4827
4827
|
}
|
|
4828
4828
|
onAppendFailed(e) {
|
|
4829
4829
|
const n = this.writeStreams[e["stream-id"]];
|
|
@@ -4858,7 +4858,7 @@ class Jo {
|
|
|
4858
4858
|
op: "unsubscribe-stream",
|
|
4859
4859
|
"subscribe-event-id": e
|
|
4860
4860
|
};
|
|
4861
|
-
this.trySend(
|
|
4861
|
+
this.trySend(x(), n), delete this.readStreamIterators[e];
|
|
4862
4862
|
}
|
|
4863
4863
|
onStreamAppend(e) {
|
|
4864
4864
|
var s;
|
|
@@ -5133,7 +5133,7 @@ class ua {
|
|
|
5133
5133
|
* @returns
|
|
5134
5134
|
*/
|
|
5135
5135
|
h(this, "pushOps", (e, n) => {
|
|
5136
|
-
const r =
|
|
5136
|
+
const r = x(), s = [...this._pendingMutations().values()], i = Math.max(0, ...s.map((c) => c.order || 0)) + 1, o = {
|
|
5137
5137
|
op: "transact",
|
|
5138
5138
|
"tx-steps": e,
|
|
5139
5139
|
created: Date.now(),
|
|
@@ -5154,7 +5154,7 @@ class ua {
|
|
|
5154
5154
|
}
|
|
5155
5155
|
this._log.info("[socket][open]", this._transport.id), this._setStatus(le.OPENED), this.getCurrentUser().then((r) => {
|
|
5156
5156
|
var s;
|
|
5157
|
-
this._trySend(
|
|
5157
|
+
this._trySend(x(), {
|
|
5158
5158
|
op: "init",
|
|
5159
5159
|
"app-id": this.config.appId,
|
|
5160
5160
|
"refresh-token": (s = r.user) == null ? void 0 : s.refresh_token,
|
|
@@ -5641,7 +5641,7 @@ class ua {
|
|
|
5641
5641
|
this.attrs = new Te(e.reduce((n, r) => (n[r.id] = r, n), {}), this._linkIndex), this.notifyAttrsSubs();
|
|
5642
5642
|
}
|
|
5643
5643
|
_startQuerySub(e, n) {
|
|
5644
|
-
const r =
|
|
5644
|
+
const r = x();
|
|
5645
5645
|
return this.querySubs.updateInPlace((s) => {
|
|
5646
5646
|
s[n] = s[n] || { q: e, result: null, eventId: r }, s[n].lastAccessed = Date.now();
|
|
5647
5647
|
}), this._trySendAuthed(r, { op: "add-query", q: e }), r;
|
|
@@ -5660,14 +5660,14 @@ class ua {
|
|
|
5660
5660
|
* Returns an unsubscribe function
|
|
5661
5661
|
*/
|
|
5662
5662
|
subscribeQuery(e, n, r) {
|
|
5663
|
-
this.config.disableValidation ||
|
|
5663
|
+
this.config.disableValidation || Rn(e, this.config.schema), r && "ruleParams" in r && (e = { $$ruleParams: r.ruleParams, ...e });
|
|
5664
5664
|
const s = W(e), i = this.getPreviousResult(e);
|
|
5665
5665
|
return i && n(i), this.queryCbs[s] = this.queryCbs[s] ?? [], this.queryCbs[s].push({ q: e, cb: n }), this._startQuerySub(e, s), () => {
|
|
5666
5666
|
this._unsubQuery(e, s, n);
|
|
5667
5667
|
};
|
|
5668
5668
|
}
|
|
5669
5669
|
queryOnce(e, n) {
|
|
5670
|
-
this.config.disableValidation ||
|
|
5670
|
+
this.config.disableValidation || Rn(e, this.config.schema), n && "ruleParams" in n && (e = { $$ruleParams: n.ruleParams, ...e });
|
|
5671
5671
|
const r = new Pn();
|
|
5672
5672
|
if (!this._isOnline)
|
|
5673
5673
|
return r.reject(new Error("We can't run `queryOnce`, because the device is offline.")), r.promise;
|
|
@@ -5687,7 +5687,7 @@ class ua {
|
|
|
5687
5687
|
return !!((n = this.queryCbs[e]) != null && n.length || (r = this.queryOnceDfds[e]) != null && r.length);
|
|
5688
5688
|
}
|
|
5689
5689
|
_cleanupQuery(e, n) {
|
|
5690
|
-
this._hasQueryListeners(n) || (delete this.queryCbs[n], delete this.queryOnceDfds[n], delete this._dataForQueryCache[n], this.querySubs.unloadKey(n), this._trySendAuthed(
|
|
5690
|
+
this._hasQueryListeners(n) || (delete this.queryCbs[n], delete this.queryOnceDfds[n], delete this._dataForQueryCache[n], this.querySubs.unloadKey(n), this._trySendAuthed(x(), { op: "remove-query", q: e }));
|
|
5691
5691
|
}
|
|
5692
5692
|
// When we `pushTx`, it's possible that we don't yet have `this.attrs`
|
|
5693
5693
|
// This means that `tx-steps` in `pendingMutations` will include `add-attr`
|
|
@@ -5804,7 +5804,7 @@ class ua {
|
|
|
5804
5804
|
_applyOptimisticUpdates(e, n, r, s) {
|
|
5805
5805
|
for (const [i, o] of r)
|
|
5806
5806
|
if (!o["tx-id"] || s && o["tx-id"] > s) {
|
|
5807
|
-
const a =
|
|
5807
|
+
const a = Rs(e, n, o["tx-steps"]);
|
|
5808
5808
|
e = a.store, n = a.attrsStore;
|
|
5809
5809
|
}
|
|
5810
5810
|
return { store: e, attrsStore: n };
|
|
@@ -5945,7 +5945,7 @@ class ua {
|
|
|
5945
5945
|
const r = await this.kv.waitForKeyToLoad(n);
|
|
5946
5946
|
if (r)
|
|
5947
5947
|
return r;
|
|
5948
|
-
const s =
|
|
5948
|
+
const s = x();
|
|
5949
5949
|
return this.kv.updateInPlace((i) => {
|
|
5950
5950
|
i[n] || (i[n] = s);
|
|
5951
5951
|
}), await this.kv.waitForKeyToLoad(n);
|
|
@@ -6325,14 +6325,14 @@ class ua {
|
|
|
6325
6325
|
i.result.user = o, s.isConnected && (this._trySetPresence(n, o), this._notifyPresenceSubs(n));
|
|
6326
6326
|
}
|
|
6327
6327
|
_trySetPresence(e, n) {
|
|
6328
|
-
this._trySendAuthed(
|
|
6328
|
+
this._trySendAuthed(x(), {
|
|
6329
6329
|
op: "set-presence",
|
|
6330
6330
|
"room-id": e,
|
|
6331
6331
|
data: n
|
|
6332
6332
|
});
|
|
6333
6333
|
}
|
|
6334
6334
|
_tryJoinRoom(e, n, r) {
|
|
6335
|
-
this._trySendAuthed(
|
|
6335
|
+
this._trySendAuthed(x(), {
|
|
6336
6336
|
op: "join-room",
|
|
6337
6337
|
"room-type": e,
|
|
6338
6338
|
"room-id": n,
|
|
@@ -6340,7 +6340,7 @@ class ua {
|
|
|
6340
6340
|
}), delete this._roomsPendingLeave[n];
|
|
6341
6341
|
}
|
|
6342
6342
|
_tryLeaveRoom(e) {
|
|
6343
|
-
this._trySendAuthed(
|
|
6343
|
+
this._trySendAuthed(x(), { op: "leave-room", "room-id": e });
|
|
6344
6344
|
}
|
|
6345
6345
|
_trySetRoomConnected(e, n) {
|
|
6346
6346
|
const r = this._rooms[e];
|
|
@@ -6414,7 +6414,7 @@ class ua {
|
|
|
6414
6414
|
}
|
|
6415
6415
|
}
|
|
6416
6416
|
_tryBroadcast(e, n, r, s) {
|
|
6417
|
-
this._trySendAuthed(
|
|
6417
|
+
this._trySendAuthed(x(), {
|
|
6418
6418
|
op: "client-broadcast",
|
|
6419
6419
|
"room-id": e,
|
|
6420
6420
|
roomType: n,
|
|
@@ -6705,7 +6705,7 @@ const hc = (t) => ({
|
|
|
6705
6705
|
}
|
|
6706
6706
|
}
|
|
6707
6707
|
});
|
|
6708
|
-
function
|
|
6708
|
+
function Re(t, e) {
|
|
6709
6709
|
if (!t)
|
|
6710
6710
|
throw new Error("[assertion error] " + e);
|
|
6711
6711
|
}
|
|
@@ -6760,8 +6760,8 @@ const Ia = (t) => JSON.stringify(t), Fe = (t, e = !1) => JSON.stringify([t, e]),
|
|
|
6760
6760
|
l.set(Fe(v), I), $(), m();
|
|
6761
6761
|
}, O = (v, I) => {
|
|
6762
6762
|
var S, A;
|
|
6763
|
-
const { cursor: E } = Kn(v),
|
|
6764
|
-
|
|
6763
|
+
const { cursor: E } = Kn(v), R = f.get(Ie("reverse", E));
|
|
6764
|
+
R == null || R();
|
|
6765
6765
|
const U = t.subscribeQuery({
|
|
6766
6766
|
[a]: {
|
|
6767
6767
|
...i,
|
|
@@ -6778,7 +6778,7 @@ const Ia = (t) => JSON.stringify(t), Fe = (t, e = !1) => JSON.stringify([t, e]),
|
|
|
6778
6778
|
if (M.error)
|
|
6779
6779
|
return w(M.error);
|
|
6780
6780
|
const L = M.data[a], K = M.pageInfo[a];
|
|
6781
|
-
|
|
6781
|
+
Re(L && K, "Expected query subscription to contain rows and pageInfo"), _(E, {
|
|
6782
6782
|
data: L,
|
|
6783
6783
|
status: "frozen",
|
|
6784
6784
|
hasMore: K.hasNextPage,
|
|
@@ -6787,7 +6787,7 @@ const Ia = (t) => JSON.stringify(t), Fe = (t, e = !1) => JSON.stringify([t, e]),
|
|
|
6787
6787
|
}, r);
|
|
6788
6788
|
f.set(Ie("reverse", E), U);
|
|
6789
6789
|
}, T = (v) => {
|
|
6790
|
-
var E,
|
|
6790
|
+
var E, R;
|
|
6791
6791
|
const I = t.subscribeQuery({
|
|
6792
6792
|
[a]: {
|
|
6793
6793
|
...i,
|
|
@@ -6795,7 +6795,7 @@ const Ia = (t) => JSON.stringify(t), Fe = (t, e = !1) => JSON.stringify([t, e]),
|
|
|
6795
6795
|
limit: o,
|
|
6796
6796
|
after: v,
|
|
6797
6797
|
where: (E = i.$) == null ? void 0 : E.where,
|
|
6798
|
-
fields: (
|
|
6798
|
+
fields: (R = i.$) == null ? void 0 : R.fields,
|
|
6799
6799
|
order: qn(c)
|
|
6800
6800
|
}
|
|
6801
6801
|
}
|
|
@@ -6803,7 +6803,7 @@ const Ia = (t) => JSON.stringify(t), Fe = (t, e = !1) => JSON.stringify([t, e]),
|
|
|
6803
6803
|
if (U.error)
|
|
6804
6804
|
return w(U.error);
|
|
6805
6805
|
const S = U.data[a], A = U.pageInfo[a];
|
|
6806
|
-
|
|
6806
|
+
Re(S && A, "Expected rows and pageInfo"), _(v, {
|
|
6807
6807
|
data: S,
|
|
6808
6808
|
status: "bootstrapping",
|
|
6809
6809
|
hasMore: A.hasNextPage,
|
|
@@ -6812,7 +6812,7 @@ const Ia = (t) => JSON.stringify(t), Fe = (t, e = !1) => JSON.stringify([t, e]),
|
|
|
6812
6812
|
}, r);
|
|
6813
6813
|
f.set(Ie("reverse", v), I);
|
|
6814
6814
|
}, k = (v, I = !1) => {
|
|
6815
|
-
var
|
|
6815
|
+
var R, U;
|
|
6816
6816
|
const E = t.subscribeQuery({
|
|
6817
6817
|
[a]: {
|
|
6818
6818
|
...i,
|
|
@@ -6820,7 +6820,7 @@ const Ia = (t) => JSON.stringify(t), Fe = (t, e = !1) => JSON.stringify([t, e]),
|
|
|
6820
6820
|
limit: o,
|
|
6821
6821
|
after: v,
|
|
6822
6822
|
afterInclusive: I,
|
|
6823
|
-
where: (
|
|
6823
|
+
where: (R = i.$) == null ? void 0 : R.where,
|
|
6824
6824
|
fields: (U = i.$) == null ? void 0 : U.fields,
|
|
6825
6825
|
order: c
|
|
6826
6826
|
}
|
|
@@ -6829,7 +6829,7 @@ const Ia = (t) => JSON.stringify(t), Fe = (t, e = !1) => JSON.stringify([t, e]),
|
|
|
6829
6829
|
if (S.error)
|
|
6830
6830
|
return w(S.error);
|
|
6831
6831
|
const A = S.data[a], M = S.pageInfo[a];
|
|
6832
|
-
|
|
6832
|
+
Re(A && M, "Page info and rows"), b(v, {
|
|
6833
6833
|
data: A,
|
|
6834
6834
|
status: "bootstrapping",
|
|
6835
6835
|
hasMore: M.hasNextPage,
|
|
@@ -6840,8 +6840,8 @@ const Ia = (t) => JSON.stringify(t), Fe = (t, e = !1) => JSON.stringify([t, e]),
|
|
|
6840
6840
|
f.set(Ie("forward", v, I), E);
|
|
6841
6841
|
}, P = (v, I = !1) => {
|
|
6842
6842
|
var A, M;
|
|
6843
|
-
const E = Fe(v, I),
|
|
6844
|
-
|
|
6843
|
+
const E = Fe(v, I), R = f.get(Ie("forward", v, I));
|
|
6844
|
+
R == null || R();
|
|
6845
6845
|
const U = u.get(E);
|
|
6846
6846
|
if (!(U != null && U.endCursor))
|
|
6847
6847
|
return;
|
|
@@ -6862,7 +6862,7 @@ const Ia = (t) => JSON.stringify(t), Fe = (t, e = !1) => JSON.stringify([t, e]),
|
|
|
6862
6862
|
if (L.error)
|
|
6863
6863
|
return w(L.error);
|
|
6864
6864
|
const K = L.data[a], ne = L.pageInfo[a];
|
|
6865
|
-
|
|
6865
|
+
Re(K && ne, "Expected rows and pageInfo"), b(v, {
|
|
6866
6866
|
data: K,
|
|
6867
6867
|
status: "frozen",
|
|
6868
6868
|
hasMore: ne.hasNextPage,
|
|
@@ -6878,8 +6878,8 @@ const Ia = (t) => JSON.stringify(t), Fe = (t, e = !1) => JSON.stringify([t, e]),
|
|
|
6878
6878
|
const [I, E] = v;
|
|
6879
6879
|
if (!(E != null && E.hasMore) || !Ca(E))
|
|
6880
6880
|
return;
|
|
6881
|
-
const
|
|
6882
|
-
|
|
6881
|
+
const R = `${I}:${Ia(E.endCursor)}`;
|
|
6882
|
+
R != y && (y = R, O(I, E), T(E.endCursor));
|
|
6883
6883
|
}, D = () => {
|
|
6884
6884
|
const v = Array.from(u.entries()).at(-1);
|
|
6885
6885
|
if (!v)
|
|
@@ -6887,8 +6887,8 @@ const Ia = (t) => JSON.stringify(t), Fe = (t, e = !1) => JSON.stringify([t, e]),
|
|
|
6887
6887
|
const [I, E] = v;
|
|
6888
6888
|
if (!E.endCursor)
|
|
6889
6889
|
return;
|
|
6890
|
-
const { cursor:
|
|
6891
|
-
P(
|
|
6890
|
+
const { cursor: R, afterInclusive: U } = Kn(I);
|
|
6891
|
+
P(R, U), k(E.endCursor);
|
|
6892
6892
|
};
|
|
6893
6893
|
return g = t.subscribeQuery({
|
|
6894
6894
|
[a]: {
|
|
@@ -6907,22 +6907,22 @@ const Ia = (t) => JSON.stringify(t), Fe = (t, e = !1) => JSON.stringify([t, e]),
|
|
|
6907
6907
|
if (v.error)
|
|
6908
6908
|
return w(v.error);
|
|
6909
6909
|
const I = v.pageInfo[a], E = (U = v == null ? void 0 : v.data) == null ? void 0 : U[a];
|
|
6910
|
-
if (
|
|
6910
|
+
if (Re(E && I, "Expected rows and pageInfo"), E.length < o) {
|
|
6911
6911
|
b(Et, {
|
|
6912
6912
|
data: E,
|
|
6913
6913
|
status: "pre-bootstrap"
|
|
6914
6914
|
});
|
|
6915
6915
|
return;
|
|
6916
6916
|
}
|
|
6917
|
-
const
|
|
6918
|
-
if (!
|
|
6917
|
+
const R = I.startCursor;
|
|
6918
|
+
if (!R) {
|
|
6919
6919
|
b(Et, {
|
|
6920
6920
|
data: E,
|
|
6921
6921
|
status: "pre-bootstrap"
|
|
6922
6922
|
});
|
|
6923
6923
|
return;
|
|
6924
6924
|
}
|
|
6925
|
-
u.delete(Fe(Et)), k(
|
|
6925
|
+
u.delete(Fe(Et)), k(R, !0), T(I.startCursor), d = !0;
|
|
6926
6926
|
}, r), {
|
|
6927
6927
|
unsubscribe: () => {
|
|
6928
6928
|
if (p) {
|
|
@@ -6941,11 +6941,11 @@ const Ia = (t) => JSON.stringify(t), Fe = (t, e = !1) => JSON.stringify([t, e]),
|
|
|
6941
6941
|
if (!n || !r)
|
|
6942
6942
|
throw new j("No query provided for infinite query");
|
|
6943
6943
|
return { entityName: n, entityQuery: r };
|
|
6944
|
-
},
|
|
6944
|
+
}, Ra = {
|
|
6945
6945
|
apiURI: "https://api.instantdb.com",
|
|
6946
6946
|
websocketURI: "wss://api.instantdb.com/runtime/session"
|
|
6947
6947
|
};
|
|
6948
|
-
function
|
|
6948
|
+
function xa() {
|
|
6949
6949
|
return globalThis.__instantDbSchemaHashStore = globalThis.__instantDbSchemaHashStore ?? /* @__PURE__ */ new WeakMap(), globalThis.__instantDbSchemaHashStore;
|
|
6950
6950
|
}
|
|
6951
6951
|
function Da() {
|
|
@@ -6955,7 +6955,7 @@ function Qt(t) {
|
|
|
6955
6955
|
const e = t.__adminToken;
|
|
6956
6956
|
return t.appId + "_" + (t.websocketURI || "default_ws_uri") + "_" + (t.apiURI || "default_api_uri") + "_" + (e || "client_only") + "_" + t.useDateObjects;
|
|
6957
6957
|
}
|
|
6958
|
-
const Bt = Da(), zn =
|
|
6958
|
+
const Bt = Da(), zn = xa();
|
|
6959
6959
|
class Ua {
|
|
6960
6960
|
constructor(e) {
|
|
6961
6961
|
h(this, "db");
|
|
@@ -7385,7 +7385,7 @@ function za(t, e, n, r, s) {
|
|
|
7385
7385
|
if (o)
|
|
7386
7386
|
return qa(o, i.schema) && o._reactor.updateSchema(i.schema), o;
|
|
7387
7387
|
const a = new ua({
|
|
7388
|
-
...
|
|
7388
|
+
...Ra,
|
|
7389
7389
|
...i,
|
|
7390
7390
|
cardinalityInference: !!i.schema
|
|
7391
7391
|
}, e || Tr, n || Sr, { ...r || {}, "@instantdb/core": cn }, s), c = new Ka(a);
|
|
@@ -7415,8 +7415,8 @@ function Ne(t, e) {
|
|
|
7415
7415
|
observers: null,
|
|
7416
7416
|
observerSlots: null,
|
|
7417
7417
|
comparator: e.equals || void 0
|
|
7418
|
-
}, r = (s) => (typeof s == "function" && (s = s(n.value)),
|
|
7419
|
-
return [
|
|
7418
|
+
}, r = (s) => (typeof s == "function" && (s = s(n.value)), xr(n, s));
|
|
7419
|
+
return [Rr.bind(n), r];
|
|
7420
7420
|
}
|
|
7421
7421
|
function de(t, e, n) {
|
|
7422
7422
|
$r = Za;
|
|
@@ -7426,7 +7426,7 @@ function de(t, e, n) {
|
|
|
7426
7426
|
function un(t, e, n) {
|
|
7427
7427
|
n = n ? Object.assign({}, at, n) : at;
|
|
7428
7428
|
const r = Dr(t, e, !0, 0);
|
|
7429
|
-
return r.observers = null, r.observerSlots = null, r.comparator = n.equals || void 0, wt(r),
|
|
7429
|
+
return r.observers = null, r.observerSlots = null, r.comparator = n.equals || void 0, wt(r), Rr.bind(r);
|
|
7430
7430
|
}
|
|
7431
7431
|
function Ha(t) {
|
|
7432
7432
|
if (z === null) return t();
|
|
@@ -7441,7 +7441,7 @@ function Ha(t) {
|
|
|
7441
7441
|
function he(t) {
|
|
7442
7442
|
return Q === null || (Q.cleanups === null ? Q.cleanups = [t] : Q.cleanups.push(t)), t;
|
|
7443
7443
|
}
|
|
7444
|
-
function
|
|
7444
|
+
function Rr() {
|
|
7445
7445
|
if (this.sources && this.state)
|
|
7446
7446
|
if (this.state === ke) wt(this);
|
|
7447
7447
|
else {
|
|
@@ -7454,7 +7454,7 @@ function xr() {
|
|
|
7454
7454
|
}
|
|
7455
7455
|
return this.value;
|
|
7456
7456
|
}
|
|
7457
|
-
function
|
|
7457
|
+
function xr(t, e, n) {
|
|
7458
7458
|
let r = t.value;
|
|
7459
7459
|
return (!t.comparator || !t.comparator(r, e)) && (t.value = e, t.observers && t.observers.length && _t(() => {
|
|
7460
7460
|
for (let s = 0; s < t.observers.length; s += 1) {
|
|
@@ -7482,7 +7482,7 @@ function Ja(t, e, n) {
|
|
|
7482
7482
|
} finally {
|
|
7483
7483
|
z = i, Q = s;
|
|
7484
7484
|
}
|
|
7485
|
-
(!t.updatedAt || t.updatedAt <= n) && (t.updatedAt != null && "observers" in t ?
|
|
7485
|
+
(!t.updatedAt || t.updatedAt <= n) && (t.updatedAt != null && "observers" in t ? xr(t, r) : t.value = r, t.updatedAt = n);
|
|
7486
7486
|
}
|
|
7487
7487
|
function Dr(t, e, n, r = ke, s) {
|
|
7488
7488
|
const i = {
|
|
@@ -7937,7 +7937,7 @@ export {
|
|
|
7937
7937
|
_e as SyncTableCallbackEventType,
|
|
7938
7938
|
hc as createInstantRouteHandler,
|
|
7939
7939
|
dc as i,
|
|
7940
|
-
|
|
7940
|
+
x as id,
|
|
7941
7941
|
pc as init,
|
|
7942
7942
|
$i as lookup,
|
|
7943
7943
|
fc as tx
|