@instantdb/react 0.22.90 → 0.22.91-experimental.btnfix.20319025226.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 +510 -510
- package/dist/standalone/index.umd.cjs +11 -11
- package/package.json +4 -4
package/dist/standalone/index.js
CHANGED
|
@@ -242,11 +242,11 @@ function Re(t, e, n, r, i) {
|
|
|
242
242
|
if (r.length > 0) {
|
|
243
243
|
const a = r.indexOf(o);
|
|
244
244
|
if (o && typeof o == "object" && a !== -1)
|
|
245
|
-
throw r[0] === o ? new Error("Forbids circular reference") : new Error(`Forbids circular reference: ~/${i.slice(0, a).map((u,
|
|
245
|
+
throw r[0] === o ? new Error("Forbids circular reference") : new Error(`Forbids circular reference: ~/${i.slice(0, a).map((u, d) => {
|
|
246
246
|
if (typeof u == "symbol")
|
|
247
247
|
return `[${u.toString()}]`;
|
|
248
|
-
const
|
|
249
|
-
return typeof u == "object" && (
|
|
248
|
+
const c = r[d];
|
|
249
|
+
return typeof u == "object" && (c instanceof Map || c instanceof Set) ? Array.from(c.keys()).indexOf(u) : u;
|
|
250
250
|
}).join("/")}`);
|
|
251
251
|
r.push(o), i.push(e);
|
|
252
252
|
} else
|
|
@@ -303,8 +303,8 @@ function fi(t, e, n) {
|
|
|
303
303
|
if (je(o)) {
|
|
304
304
|
const u = j(o);
|
|
305
305
|
Q(u);
|
|
306
|
-
const
|
|
307
|
-
ut(r ? i : t, s,
|
|
306
|
+
const d = !((a = u.assignedMap) === null || a === void 0) && a.size || u.operated ? u.copy : u.original;
|
|
307
|
+
ut(r ? i : t, s, d);
|
|
308
308
|
} else
|
|
309
309
|
fi(o, e, n);
|
|
310
310
|
}), i) {
|
|
@@ -338,8 +338,8 @@ function $n(t, e, n, r) {
|
|
|
338
338
|
var a;
|
|
339
339
|
const u = t.type === 3 ? t.setMap : t.copy;
|
|
340
340
|
if (be(_e(u, e), n)) {
|
|
341
|
-
let
|
|
342
|
-
i.copy && (
|
|
341
|
+
let d = i.original;
|
|
342
|
+
i.copy && (d = i.copy), rn(t), sn(t, r, s, o), t.options.enableAutoFreeze && (t.options.updatedValues = (a = t.options.updatedValues) !== null && a !== void 0 ? a : /* @__PURE__ */ new WeakMap(), t.options.updatedValues.set(d, i.original)), ut(u, e, d);
|
|
343
343
|
}
|
|
344
344
|
}), t.options.enableAutoFreeze && i.finalities !== t.finalities && (t.options.enableAutoFreeze = !1)), ae(n, t.options) && t.finalities.draft.push(() => {
|
|
345
345
|
const s = t.type === 3 ? t.setMap : t.copy;
|
|
@@ -349,42 +349,42 @@ function $n(t, e, n, r) {
|
|
|
349
349
|
function Is(t, e, n, r, i) {
|
|
350
350
|
let { original: s, assignedMap: o, options: a } = t, u = t.copy;
|
|
351
351
|
u.length < s.length && ([s, u] = [u, s], [n, r] = [r, n]);
|
|
352
|
-
for (let
|
|
353
|
-
if (o.get(
|
|
354
|
-
const
|
|
352
|
+
for (let d = 0; d < s.length; d += 1)
|
|
353
|
+
if (o.get(d.toString()) && u[d] !== s[d]) {
|
|
354
|
+
const c = e.concat([d]), f = Ee(c, i);
|
|
355
355
|
n.push({
|
|
356
356
|
op: L.Replace,
|
|
357
357
|
path: f,
|
|
358
358
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
359
|
-
value: St(u[
|
|
359
|
+
value: St(u[d])
|
|
360
360
|
}), r.push({
|
|
361
361
|
op: L.Replace,
|
|
362
362
|
path: f,
|
|
363
363
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
364
|
-
value: St(s[
|
|
364
|
+
value: St(s[d])
|
|
365
365
|
});
|
|
366
366
|
}
|
|
367
|
-
for (let
|
|
368
|
-
const
|
|
367
|
+
for (let d = s.length; d < u.length; d += 1) {
|
|
368
|
+
const c = e.concat([d]), f = Ee(c, i);
|
|
369
369
|
n.push({
|
|
370
370
|
op: L.Add,
|
|
371
371
|
path: f,
|
|
372
372
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
373
|
-
value: St(u[
|
|
373
|
+
value: St(u[d])
|
|
374
374
|
});
|
|
375
375
|
}
|
|
376
376
|
if (s.length < u.length) {
|
|
377
|
-
const { arrayLengthAssignment:
|
|
378
|
-
if (
|
|
379
|
-
const
|
|
377
|
+
const { arrayLengthAssignment: d = !0 } = a.enablePatches;
|
|
378
|
+
if (d) {
|
|
379
|
+
const c = e.concat(["length"]), f = Ee(c, i);
|
|
380
380
|
r.push({
|
|
381
381
|
op: L.Replace,
|
|
382
382
|
path: f,
|
|
383
383
|
value: s.length
|
|
384
384
|
});
|
|
385
385
|
} else
|
|
386
|
-
for (let
|
|
387
|
-
const f = e.concat([
|
|
386
|
+
for (let c = u.length; s.length < c; c -= 1) {
|
|
387
|
+
const f = e.concat([c - 1]), l = Ee(f, i);
|
|
388
388
|
r.push({
|
|
389
389
|
op: L.Remove,
|
|
390
390
|
path: l
|
|
@@ -394,39 +394,39 @@ function Is(t, e, n, r, i) {
|
|
|
394
394
|
}
|
|
395
395
|
function Ps({ original: t, copy: e, assignedMap: n }, r, i, s, o) {
|
|
396
396
|
n.forEach((a, u) => {
|
|
397
|
-
const
|
|
398
|
-
if (be(
|
|
397
|
+
const d = _e(t, u), c = St(_e(e, u)), f = a ? tt(t, u) ? L.Replace : L.Add : L.Remove;
|
|
398
|
+
if (be(d, c) && f === L.Replace)
|
|
399
399
|
return;
|
|
400
400
|
const l = r.concat(u), p = Ee(l, o);
|
|
401
|
-
i.push(f === L.Remove ? { op: f, path: p } : { op: f, path: p, value:
|
|
401
|
+
i.push(f === L.Remove ? { op: f, path: p } : { op: f, path: p, value: c }), s.push(f === L.Add ? { op: L.Remove, path: p } : f === L.Remove ? { op: L.Add, path: p, value: d } : { op: L.Replace, path: p, value: d });
|
|
402
402
|
});
|
|
403
403
|
}
|
|
404
404
|
function Ms({ original: t, copy: e }, n, r, i, s) {
|
|
405
405
|
let o = 0;
|
|
406
406
|
t.forEach((a) => {
|
|
407
407
|
if (!e.has(a)) {
|
|
408
|
-
const u = n.concat([o]),
|
|
408
|
+
const u = n.concat([o]), d = Ee(u, s);
|
|
409
409
|
r.push({
|
|
410
410
|
op: L.Remove,
|
|
411
|
-
path:
|
|
411
|
+
path: d,
|
|
412
412
|
value: a
|
|
413
413
|
}), i.unshift({
|
|
414
414
|
op: L.Add,
|
|
415
|
-
path:
|
|
415
|
+
path: d,
|
|
416
416
|
value: a
|
|
417
417
|
});
|
|
418
418
|
}
|
|
419
419
|
o += 1;
|
|
420
420
|
}), o = 0, e.forEach((a) => {
|
|
421
421
|
if (!t.has(a)) {
|
|
422
|
-
const u = n.concat([o]),
|
|
422
|
+
const u = n.concat([o]), d = Ee(u, s);
|
|
423
423
|
r.push({
|
|
424
424
|
op: L.Add,
|
|
425
|
-
path:
|
|
425
|
+
path: d,
|
|
426
426
|
value: a
|
|
427
427
|
}), i.unshift({
|
|
428
428
|
op: L.Remove,
|
|
429
|
-
path:
|
|
429
|
+
path: d,
|
|
430
430
|
value: a
|
|
431
431
|
});
|
|
432
432
|
}
|
|
@@ -536,16 +536,16 @@ const jt = (t, e, n = !1) => {
|
|
|
536
536
|
return s;
|
|
537
537
|
const o = s.value;
|
|
538
538
|
let a = t.setMap.get(o);
|
|
539
|
-
const u = j(a),
|
|
540
|
-
if (t.options.strict && jt(o, t.options,
|
|
541
|
-
const
|
|
539
|
+
const u = j(a), d = ((i = (r = t.options).mark) === null || i === void 0 ? void 0 : i.call(r, a, ne)) === ne.mutable;
|
|
540
|
+
if (t.options.strict && jt(o, t.options, d), !d && !u && ae(o, t.options) && !t.finalized && t.original.has(o)) {
|
|
541
|
+
const c = In.createDraft({
|
|
542
542
|
original: o,
|
|
543
543
|
parentDraft: t,
|
|
544
544
|
key: o,
|
|
545
545
|
finalities: t.finalities,
|
|
546
546
|
options: t.options
|
|
547
547
|
});
|
|
548
|
-
t.setMap.set(o,
|
|
548
|
+
t.setMap.set(o, c), a = c;
|
|
549
549
|
} else u && (a = u.proxy);
|
|
550
550
|
return {
|
|
551
551
|
done: !1,
|
|
@@ -650,30 +650,30 @@ const xs = Reflect.ownKeys(Ct), li = /* @__PURE__ */ new WeakSet(), hi = {
|
|
|
650
650
|
return t;
|
|
651
651
|
let o;
|
|
652
652
|
if (t.options.mark) {
|
|
653
|
-
const
|
|
654
|
-
if (o = t.options.mark(
|
|
655
|
-
return t.options.strict && jt(
|
|
653
|
+
const d = e === "size" && (t.original instanceof Map || t.original instanceof Set) ? Reflect.get(t.original, e) : Reflect.get(t.original, e, n);
|
|
654
|
+
if (o = t.options.mark(d, ne), o === ne.mutable)
|
|
655
|
+
return t.options.strict && jt(d, t.options, !0), d;
|
|
656
656
|
}
|
|
657
657
|
const a = te(t);
|
|
658
658
|
if (a instanceof Map && Rs.includes(e)) {
|
|
659
659
|
if (e === "size")
|
|
660
660
|
return Object.getOwnPropertyDescriptor(on, "size").get.call(t.proxy);
|
|
661
|
-
const
|
|
662
|
-
if (
|
|
663
|
-
return
|
|
661
|
+
const d = on[e];
|
|
662
|
+
if (d)
|
|
663
|
+
return d.bind(t.proxy);
|
|
664
664
|
}
|
|
665
665
|
if (a instanceof Set && xs.includes(e)) {
|
|
666
666
|
if (e === "size")
|
|
667
667
|
return Object.getOwnPropertyDescriptor(Ct, "size").get.call(t.proxy);
|
|
668
|
-
const
|
|
669
|
-
if (
|
|
670
|
-
return
|
|
668
|
+
const d = Ct[e];
|
|
669
|
+
if (d)
|
|
670
|
+
return d.bind(t.proxy);
|
|
671
671
|
}
|
|
672
672
|
if (!tt(a, e)) {
|
|
673
|
-
const
|
|
674
|
-
return
|
|
673
|
+
const d = yr(a, e);
|
|
674
|
+
return d ? "value" in d ? d.value : (
|
|
675
675
|
// !case: support for getter
|
|
676
|
-
(i =
|
|
676
|
+
(i = d.get) === null || i === void 0 ? void 0 : i.call(t.proxy)
|
|
677
677
|
) : void 0;
|
|
678
678
|
}
|
|
679
679
|
const u = a[e];
|
|
@@ -687,8 +687,8 @@ const xs = Reflect.ownKeys(Ct), li = /* @__PURE__ */ new WeakSet(), hi = {
|
|
|
687
687
|
finalities: t.finalities,
|
|
688
688
|
options: t.options
|
|
689
689
|
}), typeof o == "function") {
|
|
690
|
-
const
|
|
691
|
-
return Q(
|
|
690
|
+
const d = j(t.copy[e]);
|
|
691
|
+
return Q(d), fe(d), d.copy;
|
|
692
692
|
}
|
|
693
693
|
return t.copy[e];
|
|
694
694
|
}
|
|
@@ -750,26 +750,26 @@ function Dn(t) {
|
|
|
750
750
|
setMap: o === 3 ? new Map(e.entries()) : void 0
|
|
751
751
|
};
|
|
752
752
|
(r || "key" in t) && (a.key = r);
|
|
753
|
-
const { proxy: u, revoke:
|
|
754
|
-
if (i.revoke.push(
|
|
755
|
-
const
|
|
756
|
-
|
|
753
|
+
const { proxy: u, revoke: d } = Proxy.revocable(o === 1 ? Object.assign([], a) : a, hi);
|
|
754
|
+
if (i.revoke.push(d), li.add(u), a.proxy = u, n) {
|
|
755
|
+
const c = n;
|
|
756
|
+
c.finalities.draft.push((f, l) => {
|
|
757
757
|
var p, y;
|
|
758
758
|
const b = j(u);
|
|
759
|
-
let _ =
|
|
759
|
+
let _ = c.type === 3 ? c.setMap : c.copy;
|
|
760
760
|
const T = _e(_, r), g = j(T);
|
|
761
761
|
if (g) {
|
|
762
762
|
let m = g.original;
|
|
763
|
-
g.operated && (m = Rn(T)), rn(g), sn(g, at, f, l),
|
|
763
|
+
g.operated && (m = Rn(T)), rn(g), sn(g, at, f, l), c.options.enableAutoFreeze && (c.options.updatedValues = (p = c.options.updatedValues) !== null && p !== void 0 ? p : /* @__PURE__ */ new WeakMap(), c.options.updatedValues.set(m, g.original)), ut(_, r, m);
|
|
764
764
|
}
|
|
765
765
|
(y = b.callbacks) === null || y === void 0 || y.forEach((m) => {
|
|
766
766
|
m(f, l);
|
|
767
767
|
});
|
|
768
768
|
});
|
|
769
769
|
} else {
|
|
770
|
-
const
|
|
771
|
-
|
|
772
|
-
rn(
|
|
770
|
+
const c = j(u);
|
|
771
|
+
c.finalities.draft.push((f, l) => {
|
|
772
|
+
rn(c), sn(c, at, f, l);
|
|
773
773
|
});
|
|
774
774
|
}
|
|
775
775
|
return u;
|
|
@@ -781,9 +781,9 @@ function $s(t, e, n, r, i) {
|
|
|
781
781
|
if (o != null && o.operated)
|
|
782
782
|
for (; o.finalities.draft.length > 0; )
|
|
783
783
|
o.finalities.draft.pop()(n, r);
|
|
784
|
-
const
|
|
785
|
-
return o && nn(o), i && Re(
|
|
786
|
-
|
|
784
|
+
const d = u ? e[0] : o ? o.operated ? o.copy : o.original : t;
|
|
785
|
+
return o && nn(o), i && Re(d, d, o == null ? void 0 : o.options.updatedValues), [
|
|
786
|
+
d,
|
|
787
787
|
n && u ? [{ op: L.Replace, path: [], value: e[0] }] : n,
|
|
788
788
|
r && u ? [{ op: L.Replace, path: [], value: a }] : r
|
|
789
789
|
];
|
|
@@ -806,8 +806,8 @@ function Ds(t, e) {
|
|
|
806
806
|
return [
|
|
807
807
|
a,
|
|
808
808
|
(u = []) => {
|
|
809
|
-
const [
|
|
810
|
-
return e.enablePatches ? [
|
|
809
|
+
const [d, c, f] = $s(a, u, i, s, e.enableAutoFreeze);
|
|
810
|
+
return e.enablePatches ? [d, c, f] : d;
|
|
811
811
|
}
|
|
812
812
|
];
|
|
813
813
|
}
|
|
@@ -817,12 +817,12 @@ function an(t) {
|
|
|
817
817
|
const u = j(o);
|
|
818
818
|
if (u && e && u.finalities === e.finalities) {
|
|
819
819
|
t.isContainDraft = !0;
|
|
820
|
-
const
|
|
820
|
+
const d = u.original;
|
|
821
821
|
if (a instanceof Set) {
|
|
822
|
-
const
|
|
823
|
-
a.clear(),
|
|
822
|
+
const c = Array.from(a);
|
|
823
|
+
a.clear(), c.forEach((f) => a.add(s === f ? d : f));
|
|
824
824
|
} else
|
|
825
|
-
ut(a, s,
|
|
825
|
+
ut(a, s, d);
|
|
826
826
|
} else typeof o == "object" && o !== null && (t.value = o, t.isRoot = !1, an(t));
|
|
827
827
|
}), i && (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."));
|
|
828
828
|
}
|
|
@@ -869,21 +869,21 @@ const Us = (t) => function e(n, r, i) {
|
|
|
869
869
|
return function(S, ...C) {
|
|
870
870
|
return e(S, ($) => n.call(this, $, ...C), r);
|
|
871
871
|
};
|
|
872
|
-
const u = n,
|
|
873
|
-
let
|
|
874
|
-
if (typeof r != "function" && (
|
|
875
|
-
throw new Error(`Invalid options: ${
|
|
876
|
-
|
|
877
|
-
const f = je(u) ? gr(u) : u, l = Array.isArray(
|
|
878
|
-
for (const $ of
|
|
872
|
+
const u = n, d = r;
|
|
873
|
+
let c = i;
|
|
874
|
+
if (typeof r != "function" && (c = r), c !== void 0 && Object.prototype.toString.call(c) !== "[object Object]")
|
|
875
|
+
throw new Error(`Invalid options: ${c}, 'options' should be an object.`);
|
|
876
|
+
c = Object.assign(Object.assign({}, t), c);
|
|
877
|
+
const f = je(u) ? gr(u) : u, l = Array.isArray(c.mark) ? (S, C) => {
|
|
878
|
+
for (const $ of c.mark) {
|
|
879
879
|
if (typeof $ != "function")
|
|
880
880
|
throw new Error(`Invalid mark: ${$}, 'mark' should be a function.`);
|
|
881
881
|
const D = $(S, C);
|
|
882
882
|
if (D)
|
|
883
883
|
return D;
|
|
884
884
|
}
|
|
885
|
-
} :
|
|
886
|
-
enableAutoFreeze: (a =
|
|
885
|
+
} : c.mark, p = (s = c.enablePatches) !== null && s !== void 0 ? s : !1, y = (o = c.strict) !== null && o !== void 0 ? o : !1, _ = {
|
|
886
|
+
enableAutoFreeze: (a = c.enableAutoFreeze) !== null && a !== void 0 ? a : !1,
|
|
887
887
|
mark: l,
|
|
888
888
|
strict: y,
|
|
889
889
|
enablePatches: p
|
|
@@ -898,7 +898,7 @@ const Us = (t) => function e(n, r, i) {
|
|
|
898
898
|
}
|
|
899
899
|
let m;
|
|
900
900
|
try {
|
|
901
|
-
m =
|
|
901
|
+
m = d(T);
|
|
902
902
|
} catch (S) {
|
|
903
903
|
throw nn(j(T)), S;
|
|
904
904
|
}
|
|
@@ -1246,8 +1246,8 @@ function Hs(t) {
|
|
|
1246
1246
|
function Ys(t) {
|
|
1247
1247
|
const e = /^(\d+)-(\d{1,2})-(\d{1,2})([ T])(.+)$/, n = t.match(e);
|
|
1248
1248
|
if (n) {
|
|
1249
|
-
const [, r, i, s, o, a] = n, u = i.padStart(2, "0"),
|
|
1250
|
-
return new Date(
|
|
1249
|
+
const [, r, i, s, o, a] = n, u = i.padStart(2, "0"), d = s.padStart(2, "0"), c = `${r}-${u}-${d}T${a}`;
|
|
1250
|
+
return new Date(c);
|
|
1251
1251
|
}
|
|
1252
1252
|
return null;
|
|
1253
1253
|
}
|
|
@@ -1255,8 +1255,8 @@ function Js(t) {
|
|
|
1255
1255
|
const [e, n] = t.split(", "), [r, i, s] = e.split("/").map(Number), o = n.match(/(\d{1,2}):(\d{2}):(\d{2}) (AM|PM)/);
|
|
1256
1256
|
if (!o)
|
|
1257
1257
|
throw new Error(`Unable to parse time from: ${t}`);
|
|
1258
|
-
let [, a, u,
|
|
1259
|
-
return a = Number(a), u = Number(u),
|
|
1258
|
+
let [, a, u, d, c] = o;
|
|
1259
|
+
return a = Number(a), u = Number(u), d = Number(d), c === "PM" && a !== 12 ? a += 12 : c === "AM" && a === 12 && (a = 0), new Date(Date.UTC(s, r - 1, i, a, u, d));
|
|
1260
1260
|
}
|
|
1261
1261
|
function Zs(t) {
|
|
1262
1262
|
switch (t) {
|
|
@@ -1435,13 +1435,13 @@ function Z(t, e, n) {
|
|
|
1435
1435
|
function gi(t, e, n) {
|
|
1436
1436
|
const r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
|
|
1437
1437
|
for (const o of e) {
|
|
1438
|
-
let [a, u,
|
|
1439
|
-
const
|
|
1440
|
-
if (!
|
|
1438
|
+
let [a, u, d] = o;
|
|
1439
|
+
const c = t.getAttr(u);
|
|
1440
|
+
if (!c) {
|
|
1441
1441
|
console.warn("no such attr", u, a);
|
|
1442
1442
|
continue;
|
|
1443
1443
|
}
|
|
1444
|
-
|
|
1444
|
+
c["checked-data-type"] === "date" && n && (d = xt(d), o[2] = d), Ln(c) && Z(s, [d, u, a], o), Z(r, [a, u, d], o), Z(i, [u, a, d], o);
|
|
1445
1445
|
}
|
|
1446
1446
|
return { eav: r, aev: i, vae: s };
|
|
1447
1447
|
}
|
|
@@ -1476,7 +1476,7 @@ function ct(t, e) {
|
|
|
1476
1476
|
const [o, a] = e[0], u = t.aev.get(o);
|
|
1477
1477
|
if (!u)
|
|
1478
1478
|
return null;
|
|
1479
|
-
i = (n = X(u, 2).find((
|
|
1479
|
+
i = (n = X(u, 2).find((c) => c[2] === a)) === null || n === void 0 ? void 0 : n[0];
|
|
1480
1480
|
} else
|
|
1481
1481
|
i = e[0];
|
|
1482
1482
|
if (!i)
|
|
@@ -1486,11 +1486,11 @@ function ct(t, e) {
|
|
|
1486
1486
|
const [o, a] = s, u = t.aev.get(o);
|
|
1487
1487
|
if (!u)
|
|
1488
1488
|
return null;
|
|
1489
|
-
const
|
|
1490
|
-
if (!
|
|
1489
|
+
const c = (r = X(u, 2).find((b) => b[2] === a)) === null || r === void 0 ? void 0 : r[0];
|
|
1490
|
+
if (!c)
|
|
1491
1491
|
return null;
|
|
1492
1492
|
const [f, l, p, ...y] = e;
|
|
1493
|
-
return [i, l,
|
|
1493
|
+
return [i, l, c, ...y];
|
|
1494
1494
|
} else {
|
|
1495
1495
|
const [o, ...a] = e;
|
|
1496
1496
|
return [i, ...a];
|
|
@@ -1520,7 +1520,7 @@ function Oi(t, e, n) {
|
|
|
1520
1520
|
if (!u)
|
|
1521
1521
|
return;
|
|
1522
1522
|
u["checked-data-type"] === "date" && t.useDateObjects && (a = xt(a));
|
|
1523
|
-
const
|
|
1523
|
+
const d = We(t.eav, [s, o, a]), c = (r = d == null ? void 0 : d[3]) !== null && r !== void 0 ? r : Si(t, u, i), f = [s, o, a, c];
|
|
1524
1524
|
ro(u) ? (Z(t.eav, [s, o], /* @__PURE__ */ new Map([[a, f]])), Z(t.aev, [o, s], /* @__PURE__ */ new Map([[a, f]]))) : (Z(t.eav, [s, o, a], f), Z(t.aev, [o, s, a], f)), Ln(u) && Z(t.vae, [a, o, s], f);
|
|
1525
1525
|
}
|
|
1526
1526
|
function oo(t, e, n) {
|
|
@@ -1533,17 +1533,17 @@ function oo(t, e, n) {
|
|
|
1533
1533
|
return;
|
|
1534
1534
|
if (!Fn(u))
|
|
1535
1535
|
throw new Error("merge operation is not supported for links");
|
|
1536
|
-
const
|
|
1537
|
-
if (!c)
|
|
1538
|
-
return;
|
|
1539
|
-
const d = (r = c.values().next()) === null || r === void 0 ? void 0 : r.value;
|
|
1536
|
+
const d = We(t.eav, [s, o]);
|
|
1540
1537
|
if (!d)
|
|
1541
1538
|
return;
|
|
1542
|
-
const
|
|
1539
|
+
const c = (r = d.values().next()) === null || r === void 0 ? void 0 : r.value;
|
|
1540
|
+
if (!c)
|
|
1541
|
+
return;
|
|
1542
|
+
const f = c[2], l = bi(f, a), p = [
|
|
1543
1543
|
s,
|
|
1544
1544
|
o,
|
|
1545
1545
|
l,
|
|
1546
|
-
Si(t, u,
|
|
1546
|
+
Si(t, u, c)
|
|
1547
1547
|
];
|
|
1548
1548
|
Z(t.eav, [s, o], /* @__PURE__ */ new Map([[l, p]])), Z(t.aev, [o, s], /* @__PURE__ */ new Map([[l, p]]));
|
|
1549
1549
|
}
|
|
@@ -1552,11 +1552,11 @@ function cn(t, e, n) {
|
|
|
1552
1552
|
const [s, o] = n, a = ct(t, [s]);
|
|
1553
1553
|
if (!a)
|
|
1554
1554
|
return;
|
|
1555
|
-
const [u] = a,
|
|
1556
|
-
if (
|
|
1557
|
-
for (const f of
|
|
1555
|
+
const [u] = a, d = t.eav.get(u);
|
|
1556
|
+
if (d) {
|
|
1557
|
+
for (const f of d.keys()) {
|
|
1558
1558
|
const l = e.getAttr(f);
|
|
1559
|
-
l && l["on-delete-reverse"] === "cascade" && X(
|
|
1559
|
+
l && l["on-delete-reverse"] === "cascade" && X(d.get(f), 1).forEach(([p, y, b]) => {
|
|
1560
1560
|
var _;
|
|
1561
1561
|
return cn(t, e, [b, (_ = l["reverse-identity"]) === null || _ === void 0 ? void 0 : _[1]]);
|
|
1562
1562
|
}), // Fall back to deleting everything if we've rehydrated tx-steps from
|
|
@@ -1565,10 +1565,10 @@ function cn(t, e, n) {
|
|
|
1565
1565
|
!l || // Make sure it matches the etype
|
|
1566
1566
|
((r = l["forward-identity"]) === null || r === void 0 ? void 0 : r[1]) === o) && (oe(t.aev, [f, u]), oe(t.eav, [u, f]));
|
|
1567
1567
|
}
|
|
1568
|
-
|
|
1568
|
+
d.size === 0 && oe(t.eav, [u]);
|
|
1569
1569
|
}
|
|
1570
|
-
const
|
|
1571
|
-
|
|
1570
|
+
const c = t.vae.get(u) && X(t.vae.get(u), 2);
|
|
1571
|
+
c && c.forEach((f) => {
|
|
1572
1572
|
var l, p, y;
|
|
1573
1573
|
const [b, _, T] = f, g = e.getAttr(_);
|
|
1574
1574
|
(!o || !g || ((l = g["reverse-identity"]) === null || l === void 0 ? void 0 : l[1]) === o) && (oe(t.eav, [b, _, T]), oe(t.aev, [_, b, T]), oe(t.vae, [T, _, b])), g && g["on-delete"] === "cascade" && ((p = g["reverse-identity"]) === null || p === void 0 ? void 0 : p[1]) === o && cn(t, e, [b, (y = g["forward-identity"]) === null || y === void 0 ? void 0 : y[1]]);
|
|
@@ -1650,16 +1650,16 @@ function gt(t, e, n) {
|
|
|
1650
1650
|
if (n != null && n.hasOwnProperty("$isNull")) {
|
|
1651
1651
|
const { attrId: o, isNull: a, reverse: u } = n.$isNull;
|
|
1652
1652
|
if (u)
|
|
1653
|
-
for (const c of e.keys()) {
|
|
1654
|
-
const d = t.vae.get(c), f = !d || !d.get(o);
|
|
1655
|
-
(a ? f : !f) && i.push(e.get(c));
|
|
1656
|
-
}
|
|
1657
|
-
else {
|
|
1658
|
-
const c = t.aev.get(o);
|
|
1659
1653
|
for (const d of e.keys()) {
|
|
1660
|
-
const
|
|
1654
|
+
const c = t.vae.get(d), f = !c || !c.get(o);
|
|
1661
1655
|
(a ? f : !f) && i.push(e.get(d));
|
|
1662
1656
|
}
|
|
1657
|
+
else {
|
|
1658
|
+
const d = t.aev.get(o);
|
|
1659
|
+
for (const c of e.keys()) {
|
|
1660
|
+
const f = !d || ((r = d.get(c)) === null || r === void 0 ? void 0 : r.get(null)) || !d.get(c);
|
|
1661
|
+
(a ? f : !f) && i.push(e.get(c));
|
|
1662
|
+
}
|
|
1663
1663
|
}
|
|
1664
1664
|
return i;
|
|
1665
1665
|
}
|
|
@@ -1696,8 +1696,8 @@ function ho(t, [e, n, r]) {
|
|
|
1696
1696
|
if (!a)
|
|
1697
1697
|
return [];
|
|
1698
1698
|
const u = [];
|
|
1699
|
-
for (const
|
|
1700
|
-
u.push(...gt(t,
|
|
1699
|
+
for (const d of a.values())
|
|
1700
|
+
u.push(...gt(t, d, r));
|
|
1701
1701
|
return u;
|
|
1702
1702
|
}
|
|
1703
1703
|
case "a": {
|
|
@@ -1709,15 +1709,15 @@ function ho(t, [e, n, r]) {
|
|
|
1709
1709
|
if (!a)
|
|
1710
1710
|
return [];
|
|
1711
1711
|
const u = [];
|
|
1712
|
-
for (const
|
|
1713
|
-
u.push(...gt(t,
|
|
1712
|
+
for (const d of a.values())
|
|
1713
|
+
u.push(...gt(t, d, r));
|
|
1714
1714
|
return u;
|
|
1715
1715
|
}
|
|
1716
1716
|
case "v": {
|
|
1717
1717
|
const a = [];
|
|
1718
1718
|
for (const u of t.eav.values())
|
|
1719
|
-
for (const
|
|
1720
|
-
a.push(...gt(t,
|
|
1719
|
+
for (const d of u.values())
|
|
1720
|
+
a.push(...gt(t, d, r));
|
|
1721
1721
|
return a;
|
|
1722
1722
|
}
|
|
1723
1723
|
default:
|
|
@@ -1731,8 +1731,8 @@ function po(t, e, n) {
|
|
|
1731
1731
|
return i;
|
|
1732
1732
|
for (const [s, o] of e.entries()) {
|
|
1733
1733
|
const a = (r = t.eav.get(n)) === null || r === void 0 ? void 0 : r.get(o.id), u = X(a, 1);
|
|
1734
|
-
for (const
|
|
1735
|
-
i[s] =
|
|
1734
|
+
for (const d of u)
|
|
1735
|
+
i[s] = d[2];
|
|
1736
1736
|
}
|
|
1737
1737
|
return i;
|
|
1738
1738
|
}
|
|
@@ -1764,20 +1764,20 @@ function _o(t, e, n) {
|
|
|
1764
1764
|
const r = n.filter(([i, s, o, a, u]) => {
|
|
1765
1765
|
if (i !== "add-triple" && i !== "deep-merge-triple")
|
|
1766
1766
|
return !0;
|
|
1767
|
-
const
|
|
1768
|
-
if (
|
|
1767
|
+
const d = u == null ? void 0 : u.mode;
|
|
1768
|
+
if (d !== "create" && d !== "update")
|
|
1769
1769
|
return !0;
|
|
1770
|
-
let
|
|
1770
|
+
let c = !1;
|
|
1771
1771
|
const f = e.getAttr(o);
|
|
1772
1772
|
if (f) {
|
|
1773
1773
|
const l = ki(e, f["forward-identity"][1]);
|
|
1774
|
-
|
|
1774
|
+
c = !!bo(t, e, [
|
|
1775
1775
|
s,
|
|
1776
1776
|
l == null ? void 0 : l.id,
|
|
1777
1777
|
s
|
|
1778
1778
|
]);
|
|
1779
1779
|
}
|
|
1780
|
-
return !(
|
|
1780
|
+
return !(d === "create" && c || d === "update" && !c);
|
|
1781
1781
|
});
|
|
1782
1782
|
return It({ store: t, attrsStore: e }, (i) => {
|
|
1783
1783
|
r.forEach((s) => {
|
|
@@ -1955,18 +1955,18 @@ function Ci(t, e, n, r, i) {
|
|
|
1955
1955
|
throw new Ke(`Could not find attr for ${[n, i]}`);
|
|
1956
1956
|
if (a["value-type"] !== "ref")
|
|
1957
1957
|
throw new Error(`Attr ${a.id} is not a ref`);
|
|
1958
|
-
const [u,
|
|
1959
|
-
t(
|
|
1958
|
+
const [u, d] = a["forward-identity"], [c, f] = a["reverse-identity"], l = r + 1, p = s ? [
|
|
1959
|
+
t(d, r),
|
|
1960
1960
|
a.id,
|
|
1961
1961
|
t(f, l),
|
|
1962
1962
|
nt("time")
|
|
1963
1963
|
] : [
|
|
1964
|
-
t(
|
|
1964
|
+
t(d, l),
|
|
1965
1965
|
a.id,
|
|
1966
1966
|
t(f, r),
|
|
1967
1967
|
nt("time")
|
|
1968
1968
|
];
|
|
1969
|
-
return [s ? f :
|
|
1969
|
+
return [s ? f : d, l, p, a, !!s];
|
|
1970
1970
|
}
|
|
1971
1971
|
function Ar(t, e) {
|
|
1972
1972
|
if (typeof e != "string")
|
|
@@ -2043,12 +2043,12 @@ function zo(t, e, n, r, i, s) {
|
|
|
2043
2043
|
if (!u)
|
|
2044
2044
|
throw new Ke(`No attr for etype = ${n} label = ${i}`);
|
|
2045
2045
|
if (s != null && s.hasOwnProperty("$isNull")) {
|
|
2046
|
-
const
|
|
2047
|
-
if (!
|
|
2046
|
+
const d = K(e, n, "id");
|
|
2047
|
+
if (!d)
|
|
2048
2048
|
throw new Ke(`No attr for etype = ${n} label = id`);
|
|
2049
2049
|
return [
|
|
2050
2050
|
t(n, r),
|
|
2051
|
-
|
|
2051
|
+
d.id,
|
|
2052
2052
|
{ $isNull: { attrId: u.id, isNull: s.$isNull, reverse: !o } },
|
|
2053
2053
|
nt("time")
|
|
2054
2054
|
];
|
|
@@ -2061,15 +2061,15 @@ function zo(t, e, n, r, i, s) {
|
|
|
2061
2061
|
] : [s, u.id, t(n, r), nt("time")];
|
|
2062
2062
|
}
|
|
2063
2063
|
function Vo(t, e, n, r, i) {
|
|
2064
|
-
const [s, o, a] = i.reduce((u,
|
|
2065
|
-
const [
|
|
2064
|
+
const [s, o, a] = i.reduce((u, d) => {
|
|
2065
|
+
const [c, f, l] = u, [p, y, b] = Ci(t, e, c, f, d);
|
|
2066
2066
|
return [p, y, [...l, b]];
|
|
2067
2067
|
}, [n, r, []]);
|
|
2068
2068
|
return [s, o, a];
|
|
2069
2069
|
}
|
|
2070
2070
|
function fn(t, e, n, r, i, s) {
|
|
2071
|
-
const o = i.slice(0, i.length - 1), a = i[i.length - 1], [u,
|
|
2072
|
-
return
|
|
2071
|
+
const o = i.slice(0, i.length - 1), a = i[i.length - 1], [u, d, c] = Vo(t, e, n, r, o), f = zo(t, e, u, d, a, s);
|
|
2072
|
+
return c.concat([f]);
|
|
2073
2073
|
}
|
|
2074
2074
|
function Bo(t, e) {
|
|
2075
2075
|
return e ? [e].concat(t) : t;
|
|
@@ -2087,9 +2087,9 @@ function Ho(t, e, n) {
|
|
|
2087
2087
|
};
|
|
2088
2088
|
}
|
|
2089
2089
|
function kr(t, e, n, r, i, s) {
|
|
2090
|
-
const o = t(r, i), a = s.map((u,
|
|
2091
|
-
const
|
|
2092
|
-
return Ii(
|
|
2090
|
+
const o = t(r, i), a = s.map((u, d) => {
|
|
2091
|
+
const c = Ho(t, o, d);
|
|
2092
|
+
return Ii(c, n, r, i, u);
|
|
2093
2093
|
});
|
|
2094
2094
|
return { [e]: { patterns: a, joinSym: o } };
|
|
2095
2095
|
}
|
|
@@ -2114,11 +2114,11 @@ function Ii(t, e, n, r, i) {
|
|
|
2114
2114
|
return [];
|
|
2115
2115
|
const a = s.split(".");
|
|
2116
2116
|
if (o != null && o.hasOwnProperty("$ne") && (o = Object.assign(Object.assign({}, o), { $not: o.$ne }), delete o.$ne), o != null && o.hasOwnProperty("$not")) {
|
|
2117
|
-
const u = fn(t, e, n, r, a, o),
|
|
2117
|
+
const u = fn(t, e, n, r, a, o), d = jr(t, e, n, r, a);
|
|
2118
2118
|
return [
|
|
2119
2119
|
{
|
|
2120
2120
|
or: {
|
|
2121
|
-
patterns: [u, ...
|
|
2121
|
+
patterns: [u, ...d],
|
|
2122
2122
|
joinSym: t(n, r)
|
|
2123
2123
|
}
|
|
2124
2124
|
}
|
|
@@ -2142,17 +2142,17 @@ function Zo(t, e, n) {
|
|
|
2142
2142
|
return [t(e, n), t("time", n)];
|
|
2143
2143
|
}
|
|
2144
2144
|
function Xo(t, e, n, r, i, s) {
|
|
2145
|
-
const [o, a, u,
|
|
2146
|
-
return [o, a, f,
|
|
2145
|
+
const [o, a, u, d, c] = Ci(t, e, n, r, i), f = qo(u, t(n, r), s);
|
|
2146
|
+
return [o, a, f, d, c];
|
|
2147
2147
|
}
|
|
2148
2148
|
function ea(t, e, n, { etype: r, level: i, form: s }, o) {
|
|
2149
2149
|
const a = Object.keys(s).filter((u) => u !== "$");
|
|
2150
|
-
return a.length ? Object.entries(o).map(function([
|
|
2150
|
+
return a.length ? Object.entries(o).map(function([d, c]) {
|
|
2151
2151
|
return a.map(function(p) {
|
|
2152
2152
|
var y, b, _;
|
|
2153
2153
|
const T = !!(e.cardinalityInference && (!((_ = (b = (y = n.linkIndex) === null || y === void 0 ? void 0 : y[r]) === null || b === void 0 ? void 0 : b[p]) === null || _ === void 0) && _.isSingular));
|
|
2154
2154
|
try {
|
|
2155
|
-
const [g, m, O] = Xo(t, n, r, i, p,
|
|
2155
|
+
const [g, m, O] = Xo(t, n, r, i, p, d), S = Mi(e, n, {
|
|
2156
2156
|
etype: g,
|
|
2157
2157
|
level: m,
|
|
2158
2158
|
form: s[p],
|
|
@@ -2166,7 +2166,7 @@ function ea(t, e, n, { etype: r, level: i, form: s }, o) {
|
|
|
2166
2166
|
}
|
|
2167
2167
|
}).reduce(function(p, y) {
|
|
2168
2168
|
return Object.assign(Object.assign({}, p), y);
|
|
2169
|
-
},
|
|
2169
|
+
}, c);
|
|
2170
2170
|
}) : Object.values(o);
|
|
2171
2171
|
}
|
|
2172
2172
|
function ta(t, e, n) {
|
|
@@ -2183,11 +2183,11 @@ function ln(t) {
|
|
|
2183
2183
|
}
|
|
2184
2184
|
function na(t, e, n, r) {
|
|
2185
2185
|
var i;
|
|
2186
|
-
const [s, o, a, u] = t,
|
|
2186
|
+
const [s, o, a, u] = t, d = n === "desc" ? 1 : -1;
|
|
2187
2187
|
if (((i = e["forward-identity"]) === null || i === void 0 ? void 0 : i[2]) === "id")
|
|
2188
|
-
return Pt(r, [s, u], null) ===
|
|
2189
|
-
const [
|
|
2190
|
-
return Pt([
|
|
2188
|
+
return Pt(r, [s, u], null) === d;
|
|
2189
|
+
const [c, f] = r, l = e["checked-data-type"], p = l === "date" ? ln(f) : f, y = l === "date" ? ln(a) : a;
|
|
2190
|
+
return Pt([c, p], [s, y], l) === d;
|
|
2191
2191
|
}
|
|
2192
2192
|
function ra(t, e) {
|
|
2193
2193
|
const n = e[1];
|
|
@@ -2220,7 +2220,7 @@ function oa(t, e, n) {
|
|
|
2220
2220
|
}
|
|
2221
2221
|
function aa(t, e, { etype: n, pageInfo: r, dq: i, form: s }) {
|
|
2222
2222
|
var o, a;
|
|
2223
|
-
const u = (o = s == null ? void 0 : s.$) === null || o === void 0 ? void 0 : o.order,
|
|
2223
|
+
const u = (o = s == null ? void 0 : s.$) === null || o === void 0 ? void 0 : o.order, d = Pi(s), c = ua(s);
|
|
2224
2224
|
let f = Ao(t, i);
|
|
2225
2225
|
const l = r == null ? void 0 : r["start-cursor"], p = sa(e, n, l, u);
|
|
2226
2226
|
if (p && ((a = p == null ? void 0 : p["forward-identity"]) === null || a === void 0 ? void 0 : a[2]) !== "id") {
|
|
@@ -2231,7 +2231,7 @@ function aa(t, e, { etype: n, pageInfo: r, dq: i, form: s }) {
|
|
|
2231
2231
|
return _ && (D = ln(D)), [g, D];
|
|
2232
2232
|
});
|
|
2233
2233
|
}
|
|
2234
|
-
f.sort(
|
|
2234
|
+
f.sort(c === "asc" ? function(T, g) {
|
|
2235
2235
|
return Pt(T, g, p == null ? void 0 : p["checked-data-type"]);
|
|
2236
2236
|
} : function(T, g) {
|
|
2237
2237
|
return Pt(g, T, p == null ? void 0 : p["checked-data-type"]);
|
|
@@ -2240,7 +2240,7 @@ function aa(t, e, { etype: n, pageInfo: r, dq: i, form: s }) {
|
|
|
2240
2240
|
const b = oa(e, n, i);
|
|
2241
2241
|
for (const _ of f) {
|
|
2242
2242
|
const [T] = _;
|
|
2243
|
-
if (y[T] || !
|
|
2243
|
+
if (y[T] || !d && l && p && na(l, p, c, _))
|
|
2244
2244
|
continue;
|
|
2245
2245
|
const g = po(t, b, T);
|
|
2246
2246
|
g && (y[T] = g);
|
|
@@ -2258,7 +2258,7 @@ function Pi(t) {
|
|
|
2258
2258
|
return !i && !s && !o;
|
|
2259
2259
|
}
|
|
2260
2260
|
function ca(t, e, { etype: n, level: r, form: i, join: s, pageInfo: o }) {
|
|
2261
|
-
var a, u,
|
|
2261
|
+
var a, u, d, c, f;
|
|
2262
2262
|
if (!Pi(i) && (!o || !o["start-cursor"]))
|
|
2263
2263
|
return [];
|
|
2264
2264
|
const l = Bo(Jo(e, n, r, (a = i.$) === null || a === void 0 ? void 0 : a.where), s), p = Zo($t, n, r), y = (u = i.$) === null || u === void 0 ? void 0 : u.fields, b = aa(t, e, {
|
|
@@ -2266,7 +2266,7 @@ function ca(t, e, { etype: n, level: r, form: i, join: s, pageInfo: o }) {
|
|
|
2266
2266
|
pageInfo: o,
|
|
2267
2267
|
form: i,
|
|
2268
2268
|
dq: { where: l, find: p, fields: y }
|
|
2269
|
-
}), _ = ((
|
|
2269
|
+
}), _ = ((d = i.$) === null || d === void 0 ? void 0 : d.limit) || ((c = i.$) === null || c === void 0 ? void 0 : c.first) || ((f = i.$) === null || f === void 0 ? void 0 : f.last);
|
|
2270
2270
|
if (_ != null) {
|
|
2271
2271
|
r > 0 && console.warn("WARNING: Limits in child queries are only run client-side. Data returned from the server will not have a limit.");
|
|
2272
2272
|
const T = Object.entries(b);
|
|
@@ -2299,12 +2299,12 @@ function fa(t) {
|
|
|
2299
2299
|
return e;
|
|
2300
2300
|
}
|
|
2301
2301
|
function Ri({ store: t, attrsStore: e, pageInfo: n, aggregate: r }, i) {
|
|
2302
|
-
const o = { data: Object.keys(i).reduce(function(u,
|
|
2303
|
-
return r != null && r[
|
|
2304
|
-
etype:
|
|
2305
|
-
form: i[
|
|
2302
|
+
const o = { data: Object.keys(i).reduce(function(u, d) {
|
|
2303
|
+
return r != null && r[d] || d === "$$ruleParams" || (u[d] = Mi(t, e, {
|
|
2304
|
+
etype: d,
|
|
2305
|
+
form: i[d],
|
|
2306
2306
|
level: 0,
|
|
2307
|
-
pageInfo: n == null ? void 0 : n[
|
|
2307
|
+
pageInfo: n == null ? void 0 : n[d]
|
|
2308
2308
|
})), u;
|
|
2309
2309
|
}, {}) };
|
|
2310
2310
|
return n && (o.pageInfo = fa(n)), r && (o.aggregate = r), o;
|
|
@@ -2383,8 +2383,8 @@ function ba(t, e) {
|
|
|
2383
2383
|
if (a)
|
|
2384
2384
|
i.push(a);
|
|
2385
2385
|
else if (Array.isArray(o) && o.length == 2 && n[o[0]]) {
|
|
2386
|
-
const [u,
|
|
2387
|
-
i.push([n[u],
|
|
2386
|
+
const [u, d] = o;
|
|
2387
|
+
i.push([n[u], d]);
|
|
2388
2388
|
} else
|
|
2389
2389
|
i.push(o);
|
|
2390
2390
|
}
|
|
@@ -2446,20 +2446,20 @@ function $i(t, e, n, r) {
|
|
|
2446
2446
|
}
|
|
2447
2447
|
function Ta({ attrsStore: t }, [e, n, r]) {
|
|
2448
2448
|
const i = Object.entries(r).flatMap(([s, o]) => {
|
|
2449
|
-
const a = Array.isArray(o) ? o : [o], u = K(t, e, s),
|
|
2450
|
-
return a.map((
|
|
2449
|
+
const a = Array.isArray(o) ? o : [o], u = K(t, e, s), d = Ie(t, e, s);
|
|
2450
|
+
return a.map((c) => u ? [
|
|
2451
2451
|
"add-triple",
|
|
2452
2452
|
ee(t, e, n),
|
|
2453
2453
|
u.id,
|
|
2454
2454
|
// Uses `!` because if we get here, we should have created the attr if it doesn't
|
|
2455
2455
|
// already exist
|
|
2456
|
-
ee(t, u["reverse-identity"][1],
|
|
2456
|
+
ee(t, u["reverse-identity"][1], c)
|
|
2457
2457
|
] : [
|
|
2458
2458
|
"add-triple",
|
|
2459
2459
|
// Uses `!` because if we get here, we should have created the attr if it doesn't
|
|
2460
2460
|
// already exist
|
|
2461
|
-
ee(t,
|
|
2462
|
-
|
|
2461
|
+
ee(t, d["forward-identity"][1], c),
|
|
2462
|
+
d == null ? void 0 : d.id,
|
|
2463
2463
|
ee(t, e, n)
|
|
2464
2464
|
]);
|
|
2465
2465
|
});
|
|
@@ -2467,20 +2467,20 @@ function Ta({ attrsStore: t }, [e, n, r]) {
|
|
|
2467
2467
|
}
|
|
2468
2468
|
function ma({ attrsStore: t }, [e, n, r]) {
|
|
2469
2469
|
const i = Object.entries(r).flatMap(([s, o]) => {
|
|
2470
|
-
const a = Array.isArray(o) ? o : [o], u = K(t, e, s),
|
|
2471
|
-
return a.map((
|
|
2470
|
+
const a = Array.isArray(o) ? o : [o], u = K(t, e, s), d = Ie(t, e, s);
|
|
2471
|
+
return a.map((c) => u ? [
|
|
2472
2472
|
"retract-triple",
|
|
2473
2473
|
ee(t, e, n),
|
|
2474
2474
|
u.id,
|
|
2475
2475
|
// Uses `!` because if we get here, we should have created the attr if it doesn't
|
|
2476
2476
|
// already exist
|
|
2477
|
-
ee(t, u["reverse-identity"][1],
|
|
2477
|
+
ee(t, u["reverse-identity"][1], c)
|
|
2478
2478
|
] : [
|
|
2479
2479
|
"retract-triple",
|
|
2480
2480
|
// Uses `!` because if we get here, we should have created the attr if it doesn't
|
|
2481
2481
|
// already exist
|
|
2482
|
-
ee(t,
|
|
2483
|
-
|
|
2482
|
+
ee(t, d["forward-identity"][1], c),
|
|
2483
|
+
d.id,
|
|
2484
2484
|
ee(t, e, n)
|
|
2485
2485
|
]);
|
|
2486
2486
|
});
|
|
@@ -2493,7 +2493,7 @@ function va(t, e, n, r) {
|
|
|
2493
2493
|
for (const a of t || []) {
|
|
2494
2494
|
const u = a == null ? void 0 : a.aev.get(s);
|
|
2495
2495
|
if (u) {
|
|
2496
|
-
for (const [
|
|
2496
|
+
for (const [d, c, f] of X(u, 2))
|
|
2497
2497
|
if (f === o)
|
|
2498
2498
|
return !0;
|
|
2499
2499
|
}
|
|
@@ -2514,13 +2514,13 @@ function Di({ stores: t, attrsStore: e }, [n, r, i, s]) {
|
|
|
2514
2514
|
}
|
|
2515
2515
|
function Sa(t, e) {
|
|
2516
2516
|
const { attrsStore: n } = t, [r, i, s, o] = e, a = Un(s), u = ee(n, r, i);
|
|
2517
|
-
return [["id", u]].concat(Object.entries(a)).map(([
|
|
2518
|
-
const l = K(n, r,
|
|
2517
|
+
return [["id", u]].concat(Object.entries(a)).map(([c, f]) => {
|
|
2518
|
+
const l = K(n, r, c);
|
|
2519
2519
|
return l["checked-data-type"] === "date" && t.useDateObjects && (f = xt(f)), ["add-triple", u, l.id, f, { mode: "create" }];
|
|
2520
2520
|
});
|
|
2521
2521
|
}
|
|
2522
2522
|
function Oa(t, e) {
|
|
2523
|
-
const { attrsStore: n } = t, [r, i, s, o] = e, a = Un(s), u = ee(n, r, i),
|
|
2523
|
+
const { attrsStore: n } = t, [r, i, s, o] = e, a = Un(s), u = ee(n, r, i), d = Di(t, [r, u, s, o]);
|
|
2524
2524
|
return [["id", u]].concat(Object.entries(a)).map(([f, l]) => {
|
|
2525
2525
|
const p = K(n, r, f);
|
|
2526
2526
|
return p["checked-data-type"] === "date" && t.useDateObjects && (l = xt(l)), [
|
|
@@ -2528,7 +2528,7 @@ function Oa(t, e) {
|
|
|
2528
2528
|
u,
|
|
2529
2529
|
p.id,
|
|
2530
2530
|
l,
|
|
2531
|
-
...
|
|
2531
|
+
...d ? [d] : []
|
|
2532
2532
|
];
|
|
2533
2533
|
});
|
|
2534
2534
|
}
|
|
@@ -2536,14 +2536,14 @@ function Ea({ attrsStore: t }, [e, n]) {
|
|
|
2536
2536
|
return [["delete-entity", ee(t, e, n), e]];
|
|
2537
2537
|
}
|
|
2538
2538
|
function Aa(t, e) {
|
|
2539
|
-
const { attrsStore: n } = t, [r, i, s, o] = e, a = Un(s), u = ee(n, r, i),
|
|
2539
|
+
const { attrsStore: n } = t, [r, i, s, o] = e, a = Un(s), u = ee(n, r, i), d = Di(t, [r, u, s, o]), c = Object.entries(a).map(([l, p]) => {
|
|
2540
2540
|
const y = K(n, r, l);
|
|
2541
2541
|
return [
|
|
2542
2542
|
"deep-merge-triple",
|
|
2543
2543
|
u,
|
|
2544
2544
|
y.id,
|
|
2545
2545
|
p,
|
|
2546
|
-
...
|
|
2546
|
+
...d ? [d] : []
|
|
2547
2547
|
];
|
|
2548
2548
|
});
|
|
2549
2549
|
return [[
|
|
@@ -2551,8 +2551,8 @@ function Aa(t, e) {
|
|
|
2551
2551
|
u,
|
|
2552
2552
|
K(n, r, "id").id,
|
|
2553
2553
|
u,
|
|
2554
|
-
...
|
|
2555
|
-
]].concat(
|
|
2554
|
+
...d ? [d] : []
|
|
2555
|
+
]].concat(c);
|
|
2556
2556
|
}
|
|
2557
2557
|
function ka({ attrsStore: t }, [e, n, r]) {
|
|
2558
2558
|
return [["rule-params", ee(t, e, n), e, r]];
|
|
@@ -2663,9 +2663,9 @@ function Fa(t) {
|
|
|
2663
2663
|
const o = yn(i);
|
|
2664
2664
|
if (o && e.push({ etype: r, lookupPair: o }), n === "link")
|
|
2665
2665
|
for (const [a, u] of Object.entries(s)) {
|
|
2666
|
-
const
|
|
2667
|
-
for (const
|
|
2668
|
-
const f = yn(
|
|
2666
|
+
const d = Array.isArray(u) ? u : [u];
|
|
2667
|
+
for (const c of d) {
|
|
2668
|
+
const f = yn(c);
|
|
2669
2669
|
f && e.push({
|
|
2670
2670
|
etype: r,
|
|
2671
2671
|
lookupPair: f,
|
|
@@ -2681,13 +2681,13 @@ function Na({ attrsStore: t, schema: e }, n) {
|
|
|
2681
2681
|
function u(y, b) {
|
|
2682
2682
|
return K(t, y, b) || o.find((_) => _["forward-identity"][1] === y && _["forward-identity"][2] === b);
|
|
2683
2683
|
}
|
|
2684
|
-
function
|
|
2684
|
+
function d(y, b) {
|
|
2685
2685
|
return Ie(t, y, b) || o.find((_) => {
|
|
2686
2686
|
var T, g;
|
|
2687
2687
|
return ((T = _["reverse-identity"]) === null || T === void 0 ? void 0 : T[1]) === y && ((g = _["reverse-identity"]) === null || g === void 0 ? void 0 : g[2]) === b;
|
|
2688
2688
|
});
|
|
2689
2689
|
}
|
|
2690
|
-
function
|
|
2690
|
+
function c(y) {
|
|
2691
2691
|
o.push(y), a.push(["add-attr", y]), s.add(y.id);
|
|
2692
2692
|
}
|
|
2693
2693
|
function f(y) {
|
|
@@ -2699,40 +2699,40 @@ function Na({ attrsStore: t, schema: e }, n) {
|
|
|
2699
2699
|
!u(y, b);
|
|
2700
2700
|
}
|
|
2701
2701
|
function p(y, b) {
|
|
2702
|
-
const _ = u(y, b), T =
|
|
2703
|
-
f(_), f(T), !_ && !T &&
|
|
2702
|
+
const _ = u(y, b), T = d(y, b);
|
|
2703
|
+
f(_), f(T), !_ && !T && c(Cr(e, y, b, La));
|
|
2704
2704
|
}
|
|
2705
2705
|
for (const y of n)
|
|
2706
2706
|
for (const { etype: b, lookupPair: _, linkLabel: T } of Fa(y)) {
|
|
2707
2707
|
const g = _[0];
|
|
2708
2708
|
if (T) {
|
|
2709
2709
|
p(b, T);
|
|
2710
|
-
const m = u(b, T), O =
|
|
2710
|
+
const m = u(b, T), O = d(b, T);
|
|
2711
2711
|
f(m), f(O);
|
|
2712
2712
|
const S = ((r = m == null ? void 0 : m["reverse-identity"]) === null || r === void 0 ? void 0 : r[1]) || ((i = O == null ? void 0 : O["forward-identity"]) === null || i === void 0 ? void 0 : i[1]) || T;
|
|
2713
2713
|
if (l(S, g))
|
|
2714
2714
|
p(S, pn(g));
|
|
2715
2715
|
else {
|
|
2716
2716
|
const C = u(S, g);
|
|
2717
|
-
C ||
|
|
2717
|
+
C || c(wt(e, S, g, bn)), f(C);
|
|
2718
2718
|
}
|
|
2719
2719
|
} else if (l(b, g))
|
|
2720
2720
|
p(b, pn(g));
|
|
2721
2721
|
else {
|
|
2722
2722
|
const m = u(b, g);
|
|
2723
|
-
m ||
|
|
2723
|
+
m || c(wt(e, b, g, bn)), f(m);
|
|
2724
2724
|
}
|
|
2725
2725
|
}
|
|
2726
2726
|
for (const y of n) {
|
|
2727
2727
|
const [b, _, T, g] = y;
|
|
2728
2728
|
if (xa.has(b)) {
|
|
2729
2729
|
const m = u(_, "id");
|
|
2730
|
-
f(m), m ||
|
|
2730
|
+
f(m), m || c(wt(e, _, "id", { "unique?": !0 }));
|
|
2731
2731
|
for (const O of Object.keys(g)) {
|
|
2732
2732
|
const S = u(_, O);
|
|
2733
|
-
if (f(S), Da.has(b) && (S ||
|
|
2734
|
-
const C =
|
|
2735
|
-
!S && !C &&
|
|
2733
|
+
if (f(S), Da.has(b) && (S || c(wt(e, _, O, O === "id" ? { "unique?": !0 } : null))), $a.has(b)) {
|
|
2734
|
+
const C = d(_, O);
|
|
2735
|
+
!S && !C && c(Cr(e, _, O)), f(C);
|
|
2736
2736
|
}
|
|
2737
2737
|
}
|
|
2738
2738
|
}
|
|
@@ -2756,24 +2756,24 @@ var de = function(t, e, n, r) {
|
|
|
2756
2756
|
});
|
|
2757
2757
|
}
|
|
2758
2758
|
return new (n || (n = Promise))(function(s, o) {
|
|
2759
|
-
function a(
|
|
2759
|
+
function a(c) {
|
|
2760
2760
|
try {
|
|
2761
|
-
|
|
2761
|
+
d(r.next(c));
|
|
2762
2762
|
} catch (f) {
|
|
2763
2763
|
o(f);
|
|
2764
2764
|
}
|
|
2765
2765
|
}
|
|
2766
|
-
function u(
|
|
2766
|
+
function u(c) {
|
|
2767
2767
|
try {
|
|
2768
|
-
|
|
2768
|
+
d(r.throw(c));
|
|
2769
2769
|
} catch (f) {
|
|
2770
2770
|
o(f);
|
|
2771
2771
|
}
|
|
2772
2772
|
}
|
|
2773
|
-
function c
|
|
2774
|
-
|
|
2773
|
+
function d(c) {
|
|
2774
|
+
c.done ? s(c.value) : i(c.value).then(a, u);
|
|
2775
2775
|
}
|
|
2776
|
-
|
|
2776
|
+
d((r = r.apply(t, e || [])).next());
|
|
2777
2777
|
});
|
|
2778
2778
|
};
|
|
2779
2779
|
function Ir(t, e) {
|
|
@@ -2896,12 +2896,12 @@ class _n {
|
|
|
2896
2896
|
const y = this._persister.removeItem(p);
|
|
2897
2897
|
i.push(y.then(() => 1)), this._loadedKeys.delete(p), this._pendingSaveKeys.delete(p);
|
|
2898
2898
|
}
|
|
2899
|
-
const
|
|
2899
|
+
const d = [], c = [[rt, o]], f = (n = o.objects) !== null && n !== void 0 ? n : {};
|
|
2900
2900
|
o.objects = f;
|
|
2901
2901
|
for (const p of u)
|
|
2902
2902
|
if (this._loadedKeys.has(p)) {
|
|
2903
2903
|
const y = this.serialize(p, this.currentValue[p]);
|
|
2904
|
-
|
|
2904
|
+
c.push([p, y]);
|
|
2905
2905
|
const b = this._objectSize(y), _ = (r = f[p]) !== null && r !== void 0 ? r : {
|
|
2906
2906
|
createdAt: Date.now(),
|
|
2907
2907
|
updatedAt: Date.now(),
|
|
@@ -2909,10 +2909,10 @@ class _n {
|
|
|
2909
2909
|
};
|
|
2910
2910
|
_.updatedAt = Date.now(), _.size = b, f[p] = _, this._pendingSaveKeys.delete(p);
|
|
2911
2911
|
} else
|
|
2912
|
-
|
|
2913
|
-
const l = this._persister.multiSet(
|
|
2912
|
+
d.push(p);
|
|
2913
|
+
const l = this._persister.multiSet(c);
|
|
2914
2914
|
i.push(l.then(() => 1));
|
|
2915
|
-
for (const p of
|
|
2915
|
+
for (const p of d) {
|
|
2916
2916
|
const y = this._loadKey(p).then(() => this._enqueuePersist(e));
|
|
2917
2917
|
i.push(y);
|
|
2918
2918
|
}
|
|
@@ -2961,12 +2961,12 @@ class _n {
|
|
|
2961
2961
|
if (a.length > this._gcOpts.maxEntries)
|
|
2962
2962
|
for (const [l] of u.slice(0, a.length - this._gcOpts.maxEntries))
|
|
2963
2963
|
i.push(this._persister.removeItem(l)), delete r.objects[l], s.removed.push(l), s.removedThresholdCount++;
|
|
2964
|
-
const
|
|
2965
|
-
|
|
2966
|
-
const
|
|
2967
|
-
let f =
|
|
2968
|
-
for (; f > 0 && f > this._gcOpts.maxSize &&
|
|
2969
|
-
const [[l, p]] =
|
|
2964
|
+
const d = Object.entries(r.objects);
|
|
2965
|
+
d.sort(([l, p], [y, b]) => p.updatedAt - b.updatedAt);
|
|
2966
|
+
const c = d.filter(([l]) => !n.has(l));
|
|
2967
|
+
let f = d.reduce((l, [p, y]) => l + y.size, 0);
|
|
2968
|
+
for (; f > 0 && f > this._gcOpts.maxSize && c.length; ) {
|
|
2969
|
+
const [[l, p]] = c.splice(0, 1);
|
|
2970
2970
|
f -= p.size, i.push(this._persister.removeItem(l)), delete r.objects[l], s.removed.push(l), s.removedSizeCount++;
|
|
2971
2971
|
}
|
|
2972
2972
|
for (const l of Object.keys(r.objects))
|
|
@@ -3032,24 +3032,24 @@ var ye = function(t, e, n, r) {
|
|
|
3032
3032
|
});
|
|
3033
3033
|
}
|
|
3034
3034
|
return new (n || (n = Promise))(function(s, o) {
|
|
3035
|
-
function a(
|
|
3035
|
+
function a(c) {
|
|
3036
3036
|
try {
|
|
3037
|
-
|
|
3037
|
+
d(r.next(c));
|
|
3038
3038
|
} catch (f) {
|
|
3039
3039
|
o(f);
|
|
3040
3040
|
}
|
|
3041
3041
|
}
|
|
3042
|
-
function u(
|
|
3042
|
+
function u(c) {
|
|
3043
3043
|
try {
|
|
3044
|
-
|
|
3044
|
+
d(r.throw(c));
|
|
3045
3045
|
} catch (f) {
|
|
3046
3046
|
o(f);
|
|
3047
3047
|
}
|
|
3048
3048
|
}
|
|
3049
|
-
function c
|
|
3050
|
-
|
|
3049
|
+
function d(c) {
|
|
3050
|
+
c.done ? s(c.value) : i(c.value).then(a, u);
|
|
3051
3051
|
}
|
|
3052
|
-
|
|
3052
|
+
d((r = r.apply(t, e || [])).next());
|
|
3053
3053
|
});
|
|
3054
3054
|
};
|
|
3055
3055
|
const Wa = 6, za = ["kv", "querySubs", "syncSubs"];
|
|
@@ -3084,7 +3084,7 @@ function Ga(t, e, n) {
|
|
|
3084
3084
|
return;
|
|
3085
3085
|
const i = /* @__PURE__ */ new Set();
|
|
3086
3086
|
return new Promise((s, o) => {
|
|
3087
|
-
var a, u,
|
|
3087
|
+
var a, u, d, c;
|
|
3088
3088
|
const f = {};
|
|
3089
3089
|
for (const [y, b] of Object.entries(r)) {
|
|
3090
3090
|
const _ = typeof b == "string" ? JSON.parse(b) : b;
|
|
@@ -3092,7 +3092,7 @@ function Ga(t, e, n) {
|
|
|
3092
3092
|
const g = {
|
|
3093
3093
|
createdAt: _.lastAccessed,
|
|
3094
3094
|
updatedAt: _.lastAccessed,
|
|
3095
|
-
size: (
|
|
3095
|
+
size: (c = (d = (u = (a = _.result) === null || a === void 0 ? void 0 : a.store) === null || u === void 0 ? void 0 : u.triples) === null || d === void 0 ? void 0 : d.length) !== null && c !== void 0 ? c : 0
|
|
3096
3096
|
};
|
|
3097
3097
|
f[y] = g;
|
|
3098
3098
|
}
|
|
@@ -3123,7 +3123,7 @@ function Qa(t, e) {
|
|
|
3123
3123
|
const n = yield Ba(`instant_${t}_5`);
|
|
3124
3124
|
if (!n)
|
|
3125
3125
|
return;
|
|
3126
|
-
const r = yield new Promise((
|
|
3126
|
+
const r = yield new Promise((c, f) => {
|
|
3127
3127
|
const y = n.transaction(["kv"], "readonly").objectStore("kv").openCursor();
|
|
3128
3128
|
y.onerror = (_) => {
|
|
3129
3129
|
f(_);
|
|
@@ -3135,33 +3135,33 @@ function Qa(t, e) {
|
|
|
3135
3135
|
const T = _.key, g = _.value;
|
|
3136
3136
|
b.push([T, g]), _.continue();
|
|
3137
3137
|
} else
|
|
3138
|
-
|
|
3138
|
+
c(b);
|
|
3139
3139
|
}, y.onerror = (_) => {
|
|
3140
3140
|
f(_);
|
|
3141
3141
|
};
|
|
3142
3142
|
}), i = e.transaction(["kv", "querySubs"], "readwrite"), s = i.objectStore("kv"), o = i.objectStore("querySubs"), a = [], u = { objects: {} };
|
|
3143
|
-
for (const [
|
|
3144
|
-
switch (
|
|
3143
|
+
for (const [c, f] of r)
|
|
3144
|
+
switch (c) {
|
|
3145
3145
|
case "querySubs": {
|
|
3146
|
-
const l = Ga(
|
|
3146
|
+
const l = Ga(c, f, o);
|
|
3147
3147
|
a.push(l);
|
|
3148
3148
|
break;
|
|
3149
3149
|
}
|
|
3150
3150
|
default: {
|
|
3151
|
-
const l = Pr(
|
|
3151
|
+
const l = Pr(c, f, s);
|
|
3152
3152
|
a.push(l);
|
|
3153
3153
|
const p = {
|
|
3154
3154
|
createdAt: Date.now(),
|
|
3155
3155
|
updatedAt: Date.now(),
|
|
3156
3156
|
size: 0
|
|
3157
3157
|
};
|
|
3158
|
-
u.objects[
|
|
3158
|
+
u.objects[c] = p;
|
|
3159
3159
|
break;
|
|
3160
3160
|
}
|
|
3161
3161
|
}
|
|
3162
|
-
const
|
|
3163
|
-
a.push(
|
|
3164
|
-
i.oncomplete = (l) =>
|
|
3162
|
+
const d = Pr(rt, u, s);
|
|
3163
|
+
a.push(d), yield Promise.all(a), yield new Promise((c, f) => {
|
|
3164
|
+
i.oncomplete = (l) => c(l), i.onerror = (l) => f(l), i.onabort = (l) => f(l);
|
|
3165
3165
|
});
|
|
3166
3166
|
});
|
|
3167
3167
|
}
|
|
@@ -3179,8 +3179,8 @@ class Ui extends qa {
|
|
|
3179
3179
|
}, i.onsuccess = (s) => {
|
|
3180
3180
|
const a = s.target.result;
|
|
3181
3181
|
if (r) {
|
|
3182
|
-
const u = Qa(this._appId, a).catch((
|
|
3183
|
-
Va("Error upgrading store from version 5 to 6.")(
|
|
3182
|
+
const u = Qa(this._appId, a).catch((d) => {
|
|
3183
|
+
Va("Error upgrading store from version 5 to 6.")(d);
|
|
3184
3184
|
});
|
|
3185
3185
|
Mr.set(this.dbName, u), u.then(() => e(a)).catch(() => e(a));
|
|
3186
3186
|
} else {
|
|
@@ -3215,9 +3215,9 @@ class Ui extends qa {
|
|
|
3215
3215
|
const r = yield this._dbPromise;
|
|
3216
3216
|
return new Promise((i, s) => {
|
|
3217
3217
|
const u = r.transaction([this._storeName], "readwrite").objectStore(this._storeName).put(n, e);
|
|
3218
|
-
u.onerror = (
|
|
3219
|
-
s(
|
|
3220
|
-
}, u.onsuccess = (
|
|
3218
|
+
u.onerror = (d) => {
|
|
3219
|
+
s(d);
|
|
3220
|
+
}, u.onsuccess = (d) => {
|
|
3221
3221
|
i();
|
|
3222
3222
|
};
|
|
3223
3223
|
});
|
|
@@ -3229,14 +3229,14 @@ class Ui extends qa {
|
|
|
3229
3229
|
const n = yield this._dbPromise;
|
|
3230
3230
|
return new Promise((r, i) => {
|
|
3231
3231
|
const s = n.transaction([this._storeName], "readwrite"), o = s.objectStore(this._storeName), a = /* @__PURE__ */ new Set();
|
|
3232
|
-
for (const [u,
|
|
3233
|
-
const
|
|
3234
|
-
a.add(
|
|
3232
|
+
for (const [u, d] of e) {
|
|
3233
|
+
const c = o.put(d, u);
|
|
3234
|
+
a.add(c);
|
|
3235
3235
|
}
|
|
3236
3236
|
for (const u of a)
|
|
3237
|
-
u.onerror = (
|
|
3238
|
-
s.abort(), i(
|
|
3239
|
-
}, u.onsuccess = (
|
|
3237
|
+
u.onerror = (d) => {
|
|
3238
|
+
s.abort(), i(d);
|
|
3239
|
+
}, u.onsuccess = (d) => {
|
|
3240
3240
|
a.delete(u), a.size === 0 && r();
|
|
3241
3241
|
};
|
|
3242
3242
|
});
|
|
@@ -3276,24 +3276,24 @@ var Ha = function(t, e, n, r) {
|
|
|
3276
3276
|
});
|
|
3277
3277
|
}
|
|
3278
3278
|
return new (n || (n = Promise))(function(s, o) {
|
|
3279
|
-
function a(
|
|
3279
|
+
function a(c) {
|
|
3280
3280
|
try {
|
|
3281
|
-
|
|
3281
|
+
d(r.next(c));
|
|
3282
3282
|
} catch (f) {
|
|
3283
3283
|
o(f);
|
|
3284
3284
|
}
|
|
3285
3285
|
}
|
|
3286
|
-
function u(
|
|
3286
|
+
function u(c) {
|
|
3287
3287
|
try {
|
|
3288
|
-
|
|
3288
|
+
d(r.throw(c));
|
|
3289
3289
|
} catch (f) {
|
|
3290
3290
|
o(f);
|
|
3291
3291
|
}
|
|
3292
3292
|
}
|
|
3293
|
-
function c
|
|
3294
|
-
|
|
3293
|
+
function d(c) {
|
|
3294
|
+
c.done ? s(c.value) : i(c.value).then(a, u);
|
|
3295
3295
|
}
|
|
3296
|
-
|
|
3296
|
+
d((r = r.apply(t, e || [])).next());
|
|
3297
3297
|
});
|
|
3298
3298
|
};
|
|
3299
3299
|
class Li {
|
|
@@ -3330,24 +3330,24 @@ var Ya = function(t, e, n, r) {
|
|
|
3330
3330
|
});
|
|
3331
3331
|
}
|
|
3332
3332
|
return new (n || (n = Promise))(function(s, o) {
|
|
3333
|
-
function a(
|
|
3333
|
+
function a(c) {
|
|
3334
3334
|
try {
|
|
3335
|
-
|
|
3335
|
+
d(r.next(c));
|
|
3336
3336
|
} catch (f) {
|
|
3337
3337
|
o(f);
|
|
3338
3338
|
}
|
|
3339
3339
|
}
|
|
3340
|
-
function u(
|
|
3340
|
+
function u(c) {
|
|
3341
3341
|
try {
|
|
3342
|
-
|
|
3342
|
+
d(r.throw(c));
|
|
3343
3343
|
} catch (f) {
|
|
3344
3344
|
o(f);
|
|
3345
3345
|
}
|
|
3346
3346
|
}
|
|
3347
|
-
function c
|
|
3348
|
-
|
|
3347
|
+
function d(c) {
|
|
3348
|
+
c.done ? s(c.value) : i(c.value).then(a, u);
|
|
3349
3349
|
}
|
|
3350
|
-
|
|
3350
|
+
d((r = r.apply(t, e || [])).next());
|
|
3351
3351
|
});
|
|
3352
3352
|
};
|
|
3353
3353
|
class Dt extends qe {
|
|
@@ -3375,24 +3375,24 @@ var ze = function(t, e, n, r) {
|
|
|
3375
3375
|
});
|
|
3376
3376
|
}
|
|
3377
3377
|
return new (n || (n = Promise))(function(s, o) {
|
|
3378
|
-
function a(
|
|
3378
|
+
function a(c) {
|
|
3379
3379
|
try {
|
|
3380
|
-
|
|
3380
|
+
d(r.next(c));
|
|
3381
3381
|
} catch (f) {
|
|
3382
3382
|
o(f);
|
|
3383
3383
|
}
|
|
3384
3384
|
}
|
|
3385
|
-
function u(
|
|
3385
|
+
function u(c) {
|
|
3386
3386
|
try {
|
|
3387
|
-
|
|
3387
|
+
d(r.throw(c));
|
|
3388
3388
|
} catch (f) {
|
|
3389
3389
|
o(f);
|
|
3390
3390
|
}
|
|
3391
3391
|
}
|
|
3392
|
-
function c
|
|
3393
|
-
|
|
3392
|
+
function d(c) {
|
|
3393
|
+
c.done ? s(c.value) : i(c.value).then(a, u);
|
|
3394
3394
|
}
|
|
3395
|
-
|
|
3395
|
+
d((r = r.apply(t, e || [])).next());
|
|
3396
3396
|
});
|
|
3397
3397
|
};
|
|
3398
3398
|
function Ja({ apiURI: t, appId: e, email: n }) {
|
|
@@ -3488,24 +3488,24 @@ var dt = function(t, e, n, r) {
|
|
|
3488
3488
|
});
|
|
3489
3489
|
}
|
|
3490
3490
|
return new (n || (n = Promise))(function(s, o) {
|
|
3491
|
-
function a(
|
|
3491
|
+
function a(c) {
|
|
3492
3492
|
try {
|
|
3493
|
-
|
|
3493
|
+
d(r.next(c));
|
|
3494
3494
|
} catch (f) {
|
|
3495
3495
|
o(f);
|
|
3496
3496
|
}
|
|
3497
3497
|
}
|
|
3498
|
-
function u(
|
|
3498
|
+
function u(c) {
|
|
3499
3499
|
try {
|
|
3500
|
-
|
|
3500
|
+
d(r.throw(c));
|
|
3501
3501
|
} catch (f) {
|
|
3502
3502
|
o(f);
|
|
3503
3503
|
}
|
|
3504
3504
|
}
|
|
3505
|
-
function c
|
|
3506
|
-
|
|
3505
|
+
function d(c) {
|
|
3506
|
+
c.done ? s(c.value) : i(c.value).then(a, u);
|
|
3507
3507
|
}
|
|
3508
|
-
|
|
3508
|
+
d((r = r.apply(t, e || [])).next());
|
|
3509
3509
|
});
|
|
3510
3510
|
};
|
|
3511
3511
|
function ru(t) {
|
|
@@ -3594,10 +3594,10 @@ function uu(t, e, n) {
|
|
|
3594
3594
|
s.user = Object.assign(Object.assign({}, a), { peerId: n });
|
|
3595
3595
|
}
|
|
3596
3596
|
for (const a of Object.keys((i = t.peers) !== null && i !== void 0 ? i : {})) {
|
|
3597
|
-
const u = (e == null ? void 0 : e.peers) === void 0,
|
|
3598
|
-
if (u ||
|
|
3599
|
-
const
|
|
3600
|
-
s.peers[a] = Object.assign(Object.assign({},
|
|
3597
|
+
const u = (e == null ? void 0 : e.peers) === void 0, d = Array.isArray(e == null ? void 0 : e.peers) && (e == null ? void 0 : e.peers.includes(a));
|
|
3598
|
+
if (u || d) {
|
|
3599
|
+
const c = xr(t.peers[a], e == null ? void 0 : e.keys);
|
|
3600
|
+
s.peers[a] = Object.assign(Object.assign({}, c), { peerId: a });
|
|
3601
3601
|
}
|
|
3602
3602
|
}
|
|
3603
3603
|
return s;
|
|
@@ -3650,7 +3650,7 @@ function Ur(t) {
|
|
|
3650
3650
|
}, e;
|
|
3651
3651
|
}, {});
|
|
3652
3652
|
}
|
|
3653
|
-
const Wn = "v0.22.
|
|
3653
|
+
const Wn = "v0.22.91-experimental.btnfix.20319025226.1";
|
|
3654
3654
|
function du(t, e) {
|
|
3655
3655
|
return {
|
|
3656
3656
|
info: t ? (...n) => console.info(...n, e()) : () => {
|
|
@@ -3751,17 +3751,17 @@ const Lr = [
|
|
|
3751
3751
|
return !0;
|
|
3752
3752
|
}
|
|
3753
3753
|
}, lu = (t, e, n, r, i, s, o) => {
|
|
3754
|
-
const a = s.valueType === "json", u = (
|
|
3755
|
-
if (!qi(f,
|
|
3756
|
-
throw new R(`Invalid value for operator '${
|
|
3754
|
+
const a = s.valueType === "json", u = (d, c, f) => {
|
|
3755
|
+
if (!qi(f, c, a))
|
|
3756
|
+
throw new R(`Invalid value for operator '${d}' on attribute '${r}' in entity '${i}'. Expected ${c}, but received: ${typeof f}`, o);
|
|
3757
3757
|
};
|
|
3758
3758
|
switch (t) {
|
|
3759
3759
|
case "in":
|
|
3760
3760
|
case "$in":
|
|
3761
3761
|
if (!Array.isArray(e))
|
|
3762
3762
|
throw new R(`Operator '${t}' for attribute '${r}' in entity '${i}' must be an array, but received: ${typeof e}`, o);
|
|
3763
|
-
for (const
|
|
3764
|
-
u(t, n,
|
|
3763
|
+
for (const d of e)
|
|
3764
|
+
u(t, n, d);
|
|
3765
3765
|
break;
|
|
3766
3766
|
case "$not":
|
|
3767
3767
|
case "$ne":
|
|
@@ -3788,8 +3788,8 @@ const Lr = [
|
|
|
3788
3788
|
if (o)
|
|
3789
3789
|
return;
|
|
3790
3790
|
const u = t;
|
|
3791
|
-
for (const [
|
|
3792
|
-
lu(
|
|
3791
|
+
for (const [d, c] of Object.entries(u))
|
|
3792
|
+
lu(d, c, s, e, r, n, `${i}.${d}`);
|
|
3793
3793
|
} else if (!qi(t, s, o))
|
|
3794
3794
|
throw new R(`Invalid value for attribute '${e}' in entity '${r}'. Expected ${s}, but received: ${typeof t}`, i);
|
|
3795
3795
|
}, hu = (t, e, n, r, i) => {
|
|
@@ -3797,8 +3797,8 @@ const Lr = [
|
|
|
3797
3797
|
if (s.length < 2)
|
|
3798
3798
|
throw new R(`Invalid dot notation path '${t}'. Must contain at least one dot.`, i);
|
|
3799
3799
|
let o = n;
|
|
3800
|
-
for (let
|
|
3801
|
-
const f = s[
|
|
3800
|
+
for (let c = 0; c < s.length - 1; c++) {
|
|
3801
|
+
const f = s[c], l = r.entities[o];
|
|
3802
3802
|
if (!l)
|
|
3803
3803
|
throw new R(`Entity '${o}' does not exist in schema while traversing dot notation path '${t}'.`, i);
|
|
3804
3804
|
const p = l.links[f];
|
|
@@ -3817,24 +3817,24 @@ const Lr = [
|
|
|
3817
3817
|
Le(e, t, new H("string", !1, !0), n, i);
|
|
3818
3818
|
return;
|
|
3819
3819
|
}
|
|
3820
|
-
const
|
|
3820
|
+
const d = u.attrs[a];
|
|
3821
3821
|
if (Object.keys(u.links).includes(a)) {
|
|
3822
3822
|
if (typeof e == "string" && !Ne(e))
|
|
3823
3823
|
throw new R(`Invalid value for link '${a}' in entity '${o}'. Expected a UUID, but received: ${e}`, i);
|
|
3824
3824
|
Le(e, t, new H("string", !1, !0), n, i);
|
|
3825
3825
|
return;
|
|
3826
3826
|
}
|
|
3827
|
-
if (!
|
|
3828
|
-
const
|
|
3829
|
-
throw new R(`Attribute '${a}' does not exist on entity '${o}' in dot notation path '${t}'. Available attributes: ${
|
|
3827
|
+
if (!d) {
|
|
3828
|
+
const c = Object.keys(u.attrs);
|
|
3829
|
+
throw new R(`Attribute '${a}' does not exist on entity '${o}' in dot notation path '${t}'. Available attributes: ${c.length > 0 ? c.join(", ") + ", id" : "id"}`, i);
|
|
3830
3830
|
}
|
|
3831
|
-
Le(e, t,
|
|
3831
|
+
Le(e, t, d, n, i);
|
|
3832
3832
|
}, Wi = (t, e, n, r) => {
|
|
3833
3833
|
for (const [i, s] of Object.entries(t)) {
|
|
3834
3834
|
if (i === "or" || i === "and") {
|
|
3835
3835
|
if (Array.isArray(s))
|
|
3836
|
-
for (const
|
|
3837
|
-
typeof
|
|
3836
|
+
for (const d of s)
|
|
3837
|
+
typeof d == "object" && d !== null && Wi(d, e, n, `${r}.${i}[${d}]`);
|
|
3838
3838
|
continue;
|
|
3839
3839
|
}
|
|
3840
3840
|
if (i === "id") {
|
|
@@ -3850,16 +3850,16 @@ const Lr = [
|
|
|
3850
3850
|
continue;
|
|
3851
3851
|
const a = o.attrs[i], u = o.links[i];
|
|
3852
3852
|
if (!a && !u) {
|
|
3853
|
-
const
|
|
3854
|
-
throw new R(`Attribute or link '${i}' does not exist on entity '${e}'. Available attributes: ${
|
|
3853
|
+
const d = Object.keys(o.attrs), c = Object.keys(o.links);
|
|
3854
|
+
throw new R(`Attribute or link '${i}' does not exist on entity '${e}'. Available attributes: ${d.length > 0 ? d.join(", ") : "none"}. Available links: ${c.length > 0 ? c.join(", ") : "none"}`, `${r}.${i}`);
|
|
3855
3855
|
}
|
|
3856
3856
|
if (a)
|
|
3857
3857
|
Le(s, i, a, e, `${r}.${i}`);
|
|
3858
3858
|
else if (u) {
|
|
3859
3859
|
if (typeof s == "string" && !Ne(s))
|
|
3860
3860
|
throw new R(`Invalid value for link '${i}' in entity '${e}'. Expected a UUID, but received: ${s}`, `${r}.${i}`);
|
|
3861
|
-
const
|
|
3862
|
-
Le(s, i,
|
|
3861
|
+
const d = new H("string", !1, !0);
|
|
3862
|
+
Le(s, i, d, e, `${r}.${i}`);
|
|
3863
3863
|
}
|
|
3864
3864
|
}
|
|
3865
3865
|
}, pu = (t, e, n, r, i = 0) => {
|
|
@@ -4010,24 +4010,24 @@ var Wr = function(t, e, n, r) {
|
|
|
4010
4010
|
});
|
|
4011
4011
|
}
|
|
4012
4012
|
return new (n || (n = Promise))(function(s, o) {
|
|
4013
|
-
function a(
|
|
4013
|
+
function a(c) {
|
|
4014
4014
|
try {
|
|
4015
|
-
|
|
4015
|
+
d(r.next(c));
|
|
4016
4016
|
} catch (f) {
|
|
4017
4017
|
o(f);
|
|
4018
4018
|
}
|
|
4019
4019
|
}
|
|
4020
|
-
function u(
|
|
4020
|
+
function u(c) {
|
|
4021
4021
|
try {
|
|
4022
|
-
|
|
4022
|
+
d(r.throw(c));
|
|
4023
4023
|
} catch (f) {
|
|
4024
4024
|
o(f);
|
|
4025
4025
|
}
|
|
4026
4026
|
}
|
|
4027
|
-
function c
|
|
4028
|
-
|
|
4027
|
+
function d(c) {
|
|
4028
|
+
c.done ? s(c.value) : i(c.value).then(a, u);
|
|
4029
4029
|
}
|
|
4030
|
-
|
|
4030
|
+
d((r = r.apply(t, e || [])).next());
|
|
4031
4031
|
});
|
|
4032
4032
|
};
|
|
4033
4033
|
let Gi = 0;
|
|
@@ -4154,24 +4154,24 @@ var Vr = function(t, e, n, r) {
|
|
|
4154
4154
|
});
|
|
4155
4155
|
}
|
|
4156
4156
|
return new (n || (n = Promise))(function(s, o) {
|
|
4157
|
-
function a(
|
|
4157
|
+
function a(c) {
|
|
4158
4158
|
try {
|
|
4159
|
-
|
|
4159
|
+
d(r.next(c));
|
|
4160
4160
|
} catch (f) {
|
|
4161
4161
|
o(f);
|
|
4162
4162
|
}
|
|
4163
4163
|
}
|
|
4164
|
-
function u(
|
|
4164
|
+
function u(c) {
|
|
4165
4165
|
try {
|
|
4166
|
-
|
|
4166
|
+
d(r.throw(c));
|
|
4167
4167
|
} catch (f) {
|
|
4168
4168
|
o(f);
|
|
4169
4169
|
}
|
|
4170
4170
|
}
|
|
4171
|
-
function c
|
|
4172
|
-
|
|
4171
|
+
function d(c) {
|
|
4172
|
+
c.done ? s(c.value) : i(c.value).then(a, u);
|
|
4173
4173
|
}
|
|
4174
|
-
|
|
4174
|
+
d((r = r.apply(t, e || [])).next());
|
|
4175
4175
|
});
|
|
4176
4176
|
};
|
|
4177
4177
|
function mu(t, e) {
|
|
@@ -4228,12 +4228,12 @@ function Gr(t, e, n) {
|
|
|
4228
4228
|
function Ou(t, e, n) {
|
|
4229
4229
|
var r, i, s, o;
|
|
4230
4230
|
const a = {};
|
|
4231
|
-
for (const { action: u, triple:
|
|
4232
|
-
const [
|
|
4231
|
+
for (const { action: u, triple: d } of n) {
|
|
4232
|
+
const [c, f, l] = d, p = (i = (r = e.getAttr(f)) === null || r === void 0 ? void 0 : r["forward-identity"]) === null || i === void 0 ? void 0 : i[2];
|
|
4233
4233
|
if (!p)
|
|
4234
4234
|
continue;
|
|
4235
|
-
const y = (s = a[
|
|
4236
|
-
a[
|
|
4235
|
+
const y = (s = a[c]) !== null && s !== void 0 ? s : {};
|
|
4236
|
+
a[c] = y;
|
|
4237
4237
|
const b = (o = y[p]) !== null && o !== void 0 ? o : {};
|
|
4238
4238
|
switch (y[p] = b, u) {
|
|
4239
4239
|
case "added":
|
|
@@ -4245,8 +4245,8 @@ function Ou(t, e, n) {
|
|
|
4245
4245
|
}
|
|
4246
4246
|
}
|
|
4247
4247
|
for (const u of Object.keys(a)) {
|
|
4248
|
-
const { oldValue:
|
|
4249
|
-
|
|
4248
|
+
const { oldValue: d, newValue: c } = a[u];
|
|
4249
|
+
d === c && delete a[u];
|
|
4250
4250
|
}
|
|
4251
4251
|
return a;
|
|
4252
4252
|
}
|
|
@@ -4355,12 +4355,12 @@ class ku {
|
|
|
4355
4355
|
});
|
|
4356
4356
|
return;
|
|
4357
4357
|
}
|
|
4358
|
-
const
|
|
4358
|
+
const d = Object.keys(e)[0], c = ((a = (o = e[d]) === null || o === void 0 ? void 0 : o.$) === null || a === void 0 ? void 0 : a.order) || { serverCreatedAt: "asc" }, [f, l] = Object.entries(c)[0];
|
|
4359
4359
|
this.subs.updateInPlace((p) => {
|
|
4360
4360
|
p[n] = {
|
|
4361
4361
|
query: e,
|
|
4362
4362
|
hash: n,
|
|
4363
|
-
table:
|
|
4363
|
+
table: d,
|
|
4364
4364
|
orderDirection: l,
|
|
4365
4365
|
orderField: f,
|
|
4366
4366
|
createdAt: Date.now(),
|
|
@@ -4411,17 +4411,17 @@ class ku {
|
|
|
4411
4411
|
attrsStore: this.getAttrs()
|
|
4412
4412
|
};
|
|
4413
4413
|
a.values = u;
|
|
4414
|
-
const
|
|
4415
|
-
for (const
|
|
4416
|
-
const f = this.createStore(
|
|
4417
|
-
|
|
4414
|
+
const d = u.entities;
|
|
4415
|
+
for (const c of i) {
|
|
4416
|
+
const f = this.createStore(c), l = Jt(a, f, u.attrsStore);
|
|
4417
|
+
d.push({
|
|
4418
4418
|
store: f,
|
|
4419
4419
|
entity: l,
|
|
4420
4420
|
serverCreatedAt: Br(a, f, u.attrsStore, l.id)
|
|
4421
4421
|
}), o.push(l);
|
|
4422
4422
|
}
|
|
4423
|
-
this.subs.updateInPlace((
|
|
4424
|
-
|
|
4423
|
+
this.subs.updateInPlace((c) => {
|
|
4424
|
+
c[s] = a, c[s].updatedAt = Date.now();
|
|
4425
4425
|
}), a.values && this.notifyCbs(s, {
|
|
4426
4426
|
type: ve.InitialSyncBatch,
|
|
4427
4427
|
data: Tt(a, a.values.entities),
|
|
@@ -4469,12 +4469,12 @@ class ku {
|
|
|
4469
4469
|
this.log.error("Missing state for sub", a, e);
|
|
4470
4470
|
return;
|
|
4471
4471
|
}
|
|
4472
|
-
for (const
|
|
4473
|
-
if (u.txId && u.txId >=
|
|
4472
|
+
for (const d of e.txes) {
|
|
4473
|
+
if (u.txId && u.txId >= d["tx-id"])
|
|
4474
4474
|
continue;
|
|
4475
|
-
u.txId =
|
|
4476
|
-
const
|
|
4477
|
-
for (const g of
|
|
4475
|
+
u.txId = d["tx-id"];
|
|
4476
|
+
const c = [], f = {};
|
|
4477
|
+
for (const g of d.changes) {
|
|
4478
4478
|
const m = (n = f[g.triple[0]]) !== null && n !== void 0 ? n : [];
|
|
4479
4479
|
f[g.triple[0]] = m, m.push(g);
|
|
4480
4480
|
}
|
|
@@ -4494,7 +4494,7 @@ class ku {
|
|
|
4494
4494
|
oldEntity: S.entity,
|
|
4495
4495
|
newEntity: C,
|
|
4496
4496
|
changedFields: $ || {}
|
|
4497
|
-
}), S.entity = C) :
|
|
4497
|
+
}), S.entity = C) : c.push(O), delete f[g];
|
|
4498
4498
|
continue e;
|
|
4499
4499
|
}
|
|
4500
4500
|
}
|
|
@@ -4518,7 +4518,7 @@ class ku {
|
|
|
4518
4518
|
}), b.push(S);
|
|
4519
4519
|
}
|
|
4520
4520
|
const _ = [];
|
|
4521
|
-
for (const g of
|
|
4521
|
+
for (const g of c.sort().reverse())
|
|
4522
4522
|
_.push(p[g].entity), p.splice(g, 1);
|
|
4523
4523
|
const T = Eu(a, this.getAttrs);
|
|
4524
4524
|
Au(a, T, p), this.notifyCbs(o, {
|
|
@@ -4529,8 +4529,8 @@ class ku {
|
|
|
4529
4529
|
updated: y
|
|
4530
4530
|
});
|
|
4531
4531
|
}
|
|
4532
|
-
this.subs.updateInPlace((
|
|
4533
|
-
|
|
4532
|
+
this.subs.updateInPlace((d) => {
|
|
4533
|
+
d[o] = a, d[o].updatedAt = Date.now();
|
|
4534
4534
|
});
|
|
4535
4535
|
}
|
|
4536
4536
|
clearSubscriptionData(e, n) {
|
|
@@ -4569,24 +4569,24 @@ var N = function(t, e, n, r) {
|
|
|
4569
4569
|
});
|
|
4570
4570
|
}
|
|
4571
4571
|
return new (n || (n = Promise))(function(s, o) {
|
|
4572
|
-
function a(
|
|
4572
|
+
function a(c) {
|
|
4573
4573
|
try {
|
|
4574
|
-
|
|
4574
|
+
d(r.next(c));
|
|
4575
4575
|
} catch (f) {
|
|
4576
4576
|
o(f);
|
|
4577
4577
|
}
|
|
4578
4578
|
}
|
|
4579
|
-
function u(
|
|
4579
|
+
function u(c) {
|
|
4580
4580
|
try {
|
|
4581
|
-
|
|
4581
|
+
d(r.throw(c));
|
|
4582
4582
|
} catch (f) {
|
|
4583
4583
|
o(f);
|
|
4584
4584
|
}
|
|
4585
4585
|
}
|
|
4586
|
-
function c
|
|
4587
|
-
|
|
4586
|
+
function d(c) {
|
|
4587
|
+
c.done ? s(c.value) : i(c.value).then(a, u);
|
|
4588
4588
|
}
|
|
4589
|
-
|
|
4589
|
+
d((r = r.apply(t, e || [])).next());
|
|
4590
4590
|
});
|
|
4591
4591
|
}, Qi = function(t, e) {
|
|
4592
4592
|
var n = {};
|
|
@@ -4676,39 +4676,39 @@ function Hr(t) {
|
|
|
4676
4676
|
class Fu {
|
|
4677
4677
|
constructor(e, n = Ui, r = Li, i, s) {
|
|
4678
4678
|
var o, a, u;
|
|
4679
|
-
if (this._isOnline = !0, this._isShutdown = !1, this.status = he.CONNECTING, this.queryCbs = {}, this.queryOnceDfds = {}, this.authCbs = [], this.attrsCbs = [], this.mutationErrorCbs = [], this.connectionStatusCbs = [], this.mutationDeferredStore = /* @__PURE__ */ new Map(), this._reconnectTimeoutId = null, this._reconnectTimeoutMs = 0, this._transportType = "ws", this._wsOk = null, this._localIdPromises = {}, this._errorMessage = null, this._oauthCallbackResponse = null, this._linkIndex = null, this._rooms = {}, this._roomsPendingLeave = {}, this._presence = {}, this._broadcastQueue = [], this._broadcastSubs = {}, this._currentUserCached = { isLoading: !0, error: void 0, user: void 0 }, this._beforeUnloadCbs = [], this._dataForQueryCache = {}, this._inFlightMutationEventIds = /* @__PURE__ */ new Set(), this._onMergeKv = (
|
|
4679
|
+
if (this._isOnline = !0, this._isShutdown = !1, this.status = he.CONNECTING, this.queryCbs = {}, this.queryOnceDfds = {}, this.authCbs = [], this.attrsCbs = [], this.mutationErrorCbs = [], this.connectionStatusCbs = [], this.mutationDeferredStore = /* @__PURE__ */ new Map(), this._reconnectTimeoutId = null, this._reconnectTimeoutMs = 0, this._transportType = "ws", this._wsOk = null, this._localIdPromises = {}, this._errorMessage = null, this._oauthCallbackResponse = null, this._linkIndex = null, this._rooms = {}, this._roomsPendingLeave = {}, this._presence = {}, this._broadcastQueue = [], this._broadcastSubs = {}, this._currentUserCached = { isLoading: !0, error: void 0, user: void 0 }, this._beforeUnloadCbs = [], this._dataForQueryCache = {}, this._inFlightMutationEventIds = /* @__PURE__ */ new Set(), this._onMergeKv = (d, c, f) => {
|
|
4680
4680
|
var l, p;
|
|
4681
|
-
switch (
|
|
4681
|
+
switch (d) {
|
|
4682
4682
|
case "pendingMutations": {
|
|
4683
|
-
const y = (l =
|
|
4684
|
-
return (
|
|
4683
|
+
const y = (l = c == null ? void 0 : c.entries()) !== null && l !== void 0 ? l : [], b = (p = f == null ? void 0 : f.entries()) !== null && p !== void 0 ? p : [], _ = new Map([...y, ...b]);
|
|
4684
|
+
return (c ? this._rewriteMutationsSorted(this.attrs, c) : []).forEach(([g, m]) => {
|
|
4685
4685
|
var O;
|
|
4686
4686
|
!(!((O = f == null ? void 0 : f.pendingMutations) === null || O === void 0) && O.has(g)) && !m["tx-id"] && this._sendMutation(g, m);
|
|
4687
4687
|
}), _;
|
|
4688
4688
|
}
|
|
4689
4689
|
default:
|
|
4690
|
-
return f ||
|
|
4691
|
-
}
|
|
4692
|
-
}, this.getPreviousResult = (
|
|
4693
|
-
var
|
|
4694
|
-
const f = B(
|
|
4695
|
-
return (
|
|
4696
|
-
}, this.notifyOne = (
|
|
4697
|
-
var
|
|
4698
|
-
const l = (
|
|
4699
|
-
y != null && y.data && (this._dataForQueryCache[
|
|
4700
|
-
}, this.notifyOneQueryOnce = (
|
|
4701
|
-
var
|
|
4702
|
-
const l = (
|
|
4690
|
+
return f || c;
|
|
4691
|
+
}
|
|
4692
|
+
}, this.getPreviousResult = (d) => {
|
|
4693
|
+
var c;
|
|
4694
|
+
const f = B(d);
|
|
4695
|
+
return (c = this.dataForQuery(f)) === null || c === void 0 ? void 0 : c.data;
|
|
4696
|
+
}, this.notifyOne = (d) => {
|
|
4697
|
+
var c, f;
|
|
4698
|
+
const l = (c = this.queryCbs[d]) !== null && c !== void 0 ? c : [], p = (f = this._dataForQueryCache[d]) === null || f === void 0 ? void 0 : f.data, y = this.dataForQuery(d);
|
|
4699
|
+
y != null && y.data && (this._dataForQueryCache[d] = y, !Ot(y.data, p) && l.forEach((b) => b.cb(y.data)));
|
|
4700
|
+
}, this.notifyOneQueryOnce = (d) => {
|
|
4701
|
+
var c, f;
|
|
4702
|
+
const l = (c = this.queryOnceDfds[d]) !== null && c !== void 0 ? c : [], p = (f = this.dataForQuery(d)) === null || f === void 0 ? void 0 : f.data;
|
|
4703
4703
|
l.forEach((y) => {
|
|
4704
|
-
this._completeQueryOnce(y.q,
|
|
4704
|
+
this._completeQueryOnce(y.q, d, y.dfd), y.dfd.resolve(p);
|
|
4705
4705
|
});
|
|
4706
|
-
}, this.notifyQueryError = (
|
|
4707
|
-
(this.queryCbs[
|
|
4708
|
-
}, this.pushTx = (
|
|
4709
|
-
this.config.disableValidation || wu(
|
|
4706
|
+
}, this.notifyQueryError = (d, c) => {
|
|
4707
|
+
(this.queryCbs[d] || []).forEach((l) => l.cb({ error: c }));
|
|
4708
|
+
}, this.pushTx = (d) => {
|
|
4709
|
+
this.config.disableValidation || wu(d, this.config.schema);
|
|
4710
4710
|
try {
|
|
4711
|
-
const
|
|
4711
|
+
const c = Ka({
|
|
4712
4712
|
attrsStore: this.optimisticAttrs(),
|
|
4713
4713
|
schema: this.config.schema,
|
|
4714
4714
|
stores: Object.values(this.querySubs.currentValue).map((f) => {
|
|
@@ -4716,17 +4716,17 @@ class Fu {
|
|
|
4716
4716
|
return (l = f == null ? void 0 : f.result) === null || l === void 0 ? void 0 : l.store;
|
|
4717
4717
|
}),
|
|
4718
4718
|
useDateObjects: this.config.useDateObjects
|
|
4719
|
-
},
|
|
4720
|
-
return this.pushOps(
|
|
4721
|
-
} catch (
|
|
4722
|
-
return this.pushOps([],
|
|
4719
|
+
}, d);
|
|
4720
|
+
return this.pushOps(c);
|
|
4721
|
+
} catch (c) {
|
|
4722
|
+
return this.pushOps([], c);
|
|
4723
4723
|
}
|
|
4724
|
-
}, this.pushOps = (
|
|
4724
|
+
}, this.pushOps = (d, c) => {
|
|
4725
4725
|
const f = W(), l = [...this._pendingMutations().values()], p = Math.max(0, ...l.map((_) => _.order || 0)) + 1, y = {
|
|
4726
4726
|
op: "transact",
|
|
4727
|
-
"tx-steps":
|
|
4727
|
+
"tx-steps": d,
|
|
4728
4728
|
created: Date.now(),
|
|
4729
|
-
error:
|
|
4729
|
+
error: c,
|
|
4730
4730
|
order: p
|
|
4731
4731
|
};
|
|
4732
4732
|
this._updatePendingMutations((_) => {
|
|
@@ -4734,10 +4734,10 @@ class Fu {
|
|
|
4734
4734
|
});
|
|
4735
4735
|
const b = new $r();
|
|
4736
4736
|
return this.mutationDeferredStore.set(f, b), this._sendMutation(f, y), this.notifyAll(), b.promise;
|
|
4737
|
-
}, this._transportOnOpen = (
|
|
4738
|
-
const
|
|
4739
|
-
if (this._transport !==
|
|
4740
|
-
this._log.info("[socket][open]",
|
|
4737
|
+
}, this._transportOnOpen = (d) => {
|
|
4738
|
+
const c = d.target;
|
|
4739
|
+
if (this._transport !== c) {
|
|
4740
|
+
this._log.info("[socket][open]", c.id, "skip; this is no longer the current transport");
|
|
4741
4741
|
return;
|
|
4742
4742
|
}
|
|
4743
4743
|
this._log.info("[socket][open]", this._transport.id), this._setStatus(he.OPENED), this.getCurrentUser().then((f) => {
|
|
@@ -4755,26 +4755,26 @@ class Fu {
|
|
|
4755
4755
|
"__admin-token": this.config.__adminToken
|
|
4756
4756
|
});
|
|
4757
4757
|
}).catch((f) => {
|
|
4758
|
-
this._log.error("[socket][error]",
|
|
4758
|
+
this._log.error("[socket][error]", c.id, f);
|
|
4759
4759
|
});
|
|
4760
|
-
}, this._transportOnMessage = (
|
|
4761
|
-
const
|
|
4762
|
-
if (this._transport !==
|
|
4763
|
-
this._log.info("[socket][message]",
|
|
4760
|
+
}, this._transportOnMessage = (d) => {
|
|
4761
|
+
const c = d.target, f = d.message;
|
|
4762
|
+
if (this._transport !== c) {
|
|
4763
|
+
this._log.info("[socket][message]", c.id, f, "skip; this is no longer the current transport");
|
|
4764
4764
|
return;
|
|
4765
4765
|
}
|
|
4766
|
-
if (!this._wsOk &&
|
|
4767
|
-
for (const l of
|
|
4768
|
-
this._handleReceive(
|
|
4766
|
+
if (!this._wsOk && c.type === "ws" && (this._wsOk = !0), this._transportType = "ws", Array.isArray(d.message))
|
|
4767
|
+
for (const l of d.message)
|
|
4768
|
+
this._handleReceive(c.id, l);
|
|
4769
4769
|
else
|
|
4770
|
-
this._handleReceive(
|
|
4771
|
-
}, this._transportOnError = (
|
|
4772
|
-
const
|
|
4773
|
-
if (this._transport !==
|
|
4774
|
-
this._log.info("[socket][error]",
|
|
4770
|
+
this._handleReceive(c.id, d.message);
|
|
4771
|
+
}, this._transportOnError = (d) => {
|
|
4772
|
+
const c = d.target;
|
|
4773
|
+
if (this._transport !== c) {
|
|
4774
|
+
this._log.info("[socket][error]", c.id, "skip; this is no longer the current transport");
|
|
4775
4775
|
return;
|
|
4776
4776
|
}
|
|
4777
|
-
this._log.error("[socket][error]",
|
|
4777
|
+
this._log.error("[socket][error]", c.id, d);
|
|
4778
4778
|
}, this._scheduleReconnect = () => {
|
|
4779
4779
|
!this._wsOk && this._transportType !== "sse" && (this._transportType = "sse", this._reconnectTimeoutMs = 0), setTimeout(() => {
|
|
4780
4780
|
if (this._reconnectTimeoutMs = Math.min(this._reconnectTimeoutMs + 1e3, 1e4), !this._isOnline) {
|
|
@@ -4783,29 +4783,29 @@ class Fu {
|
|
|
4783
4783
|
}
|
|
4784
4784
|
this._startSocket();
|
|
4785
4785
|
}, this._reconnectTimeoutMs);
|
|
4786
|
-
}, this._transportOnClose = (
|
|
4787
|
-
const
|
|
4788
|
-
if (this._transport !==
|
|
4789
|
-
this._log.info("[socket][close]",
|
|
4786
|
+
}, this._transportOnClose = (d) => {
|
|
4787
|
+
const c = d.target;
|
|
4788
|
+
if (this._transport !== c) {
|
|
4789
|
+
this._log.info("[socket][close]", c.id, "skip; this is no longer the current transport");
|
|
4790
4790
|
return;
|
|
4791
4791
|
}
|
|
4792
4792
|
this._setStatus(he.CLOSED);
|
|
4793
4793
|
for (const f of Object.values(this._rooms))
|
|
4794
4794
|
f.isConnected = !1;
|
|
4795
4795
|
if (this._isShutdown) {
|
|
4796
|
-
this._log.info("[socket][close]",
|
|
4796
|
+
this._log.info("[socket][close]", c.id, "Reactor has been shut down and will not reconnect");
|
|
4797
4797
|
return;
|
|
4798
4798
|
}
|
|
4799
|
-
this._log.info("[socket][close]",
|
|
4799
|
+
this._log.info("[socket][close]", c.id, "schedule reconnect, ms =", this._reconnectTimeoutMs), this._scheduleReconnect();
|
|
4800
4800
|
}, this._EventSource = s, this.config = Object.assign(Object.assign({}, Pu), e), this.queryCacheLimit = (o = this.config.queryCacheLimit) !== null && o !== void 0 ? o : 10, this._pendingTxCleanupTimeout = (a = this.config.pendingTxCleanupTimeout) !== null && a !== void 0 ? a : Cu, this._pendingMutationCleanupThreshold = (u = this.config.pendingMutationCleanupThreshold) !== null && u !== void 0 ? u : Iu, this._log = du(e.verbose || qn || Fi, () => this._reactorStats()), this.versions = Object.assign(Object.assign({}, i || {}), { "@instantdb/core": Wn }), this.config.schema && (this._linkIndex = Ur(this.config.schema)), !!Ru()) {
|
|
4801
4801
|
if (!e.appId)
|
|
4802
4802
|
throw new Error("Instant must be initialized with an appId.");
|
|
4803
4803
|
if (!Ne(e.appId))
|
|
4804
4804
|
throw new Error(`Instant must be initialized with a valid appId. \`${e.appId}\` is not a valid uuid.`);
|
|
4805
|
-
typeof BroadcastChannel == "function" && (this._broadcastChannel = new BroadcastChannel("@instantdb"), this._broadcastChannel.addEventListener("message", (
|
|
4806
|
-
var
|
|
4805
|
+
typeof BroadcastChannel == "function" && (this._broadcastChannel = new BroadcastChannel("@instantdb"), this._broadcastChannel.addEventListener("message", (d) => N(this, void 0, void 0, function* () {
|
|
4806
|
+
var c;
|
|
4807
4807
|
try {
|
|
4808
|
-
if (((
|
|
4808
|
+
if (((c = d.data) === null || c === void 0 ? void 0 : c.type) === "auth") {
|
|
4809
4809
|
const f = yield this.getCurrentUser();
|
|
4810
4810
|
this.updateUser(f.user);
|
|
4811
4811
|
}
|
|
@@ -4814,9 +4814,9 @@ class Fu {
|
|
|
4814
4814
|
}
|
|
4815
4815
|
}))), this._initStorage(n), this._syncTable = new ku(this._trySendAuthed.bind(this), new n(this.config.appId, "syncSubs"), {
|
|
4816
4816
|
useDateObjects: this.config.useDateObjects
|
|
4817
|
-
}, this._log, (
|
|
4818
|
-
this._isOnline =
|
|
4819
|
-
|
|
4817
|
+
}, this._log, (d) => Et(this.ensureAttrs(), d, this.config.enableCardinalityInference, this.config.useDateObjects), () => this.ensureAttrs()), this._oauthCallbackResponse = this._oauthLoginInit(), this.getCurrentUser(), r.getIsOnline().then((d) => {
|
|
4818
|
+
this._isOnline = d, this._startSocket(), r.listen((c) => {
|
|
4819
|
+
c !== this._isOnline && (this._log.info("[network] online =", c), this._isOnline = c, this._isOnline ? this._startSocket() : (this._log.info("Changing status from", this.status, "to", he.CLOSED), this._setStatus(he.CLOSED)));
|
|
4820
4820
|
});
|
|
4821
4821
|
}), typeof addEventListener < "u" && (this._beforeUnload = this._beforeUnload.bind(this), addEventListener("beforeunload", this._beforeUnload));
|
|
4822
4822
|
}
|
|
@@ -4912,13 +4912,13 @@ class Fu {
|
|
|
4912
4912
|
const i = (r = (n = this._presence[e]) === null || n === void 0 ? void 0 : n.result) === null || r === void 0 ? void 0 : r.user, s = this._broadcastQueue[e];
|
|
4913
4913
|
if (this._broadcastQueue[e] = [], i && this._trySetPresence(e, i), s)
|
|
4914
4914
|
for (const o of s) {
|
|
4915
|
-
const { topic: a, roomType: u, data:
|
|
4916
|
-
this._tryBroadcast(e, u, a,
|
|
4915
|
+
const { topic: a, roomType: u, data: d } = o;
|
|
4916
|
+
this._tryBroadcast(e, u, a, d);
|
|
4917
4917
|
}
|
|
4918
4918
|
}
|
|
4919
4919
|
_handleReceive(e, n) {
|
|
4920
4920
|
var r, i, s, o, a, u;
|
|
4921
|
-
const
|
|
4921
|
+
const d = !!this.config.schema && ("cardinalityInference" in this.config ? !!this.config.cardinalityInference : !0);
|
|
4922
4922
|
switch (Qr[n.op] || this._log.info("[receive]", e, n.op, n), n.op) {
|
|
4923
4923
|
case "init-ok": {
|
|
4924
4924
|
this._setStatus(he.AUTHENTICATED), this._reconnectTimeoutMs = 0, this._setAttrs(n.attrs), this._flushPendingMessages(), this._sessionId = n["session-id"];
|
|
@@ -4936,7 +4936,7 @@ class Fu {
|
|
|
4936
4936
|
const { q: l, result: p } = n, y = B(l);
|
|
4937
4937
|
if (!this._hasQueryListeners() && !this.querySubs.currentValue[y])
|
|
4938
4938
|
break;
|
|
4939
|
-
const b = (o = (s = p == null ? void 0 : p[0]) === null || s === void 0 ? void 0 : s.data) === null || o === void 0 ? void 0 : o["page-info"], _ = (u = (a = p == null ? void 0 : p[0]) === null || a === void 0 ? void 0 : a.data) === null || u === void 0 ? void 0 : u.aggregate, T = Dr(p), g = this.ensureAttrs(), m = Et(g, T,
|
|
4939
|
+
const b = (o = (s = p == null ? void 0 : p[0]) === null || s === void 0 ? void 0 : s.data) === null || o === void 0 ? void 0 : o["page-info"], _ = (u = (a = p == null ? void 0 : p[0]) === null || a === void 0 ? void 0 : a.data) === null || u === void 0 ? void 0 : u.aggregate, T = Dr(p), g = this.ensureAttrs(), m = Et(g, T, d, this.config.useDateObjects);
|
|
4940
4940
|
this.querySubs.updateInPlace((O) => {
|
|
4941
4941
|
if (!O[y]) {
|
|
4942
4942
|
this._log.info("Missing value in querySubs", { hash: y, q: l });
|
|
@@ -4977,7 +4977,7 @@ class Fu {
|
|
|
4977
4977
|
});
|
|
4978
4978
|
const _ = Hr(b.entries()), T = l.map((g) => {
|
|
4979
4979
|
var m, O, S, C;
|
|
4980
|
-
const $ = g["instaql-query"], D = g["instaql-result"], Ve = B($), ft = Dr(D), lt = this.ensureAttrs(), Ft = Et(lt, ft,
|
|
4980
|
+
const $ = g["instaql-query"], D = g["instaql-result"], Ve = B($), ft = Dr(D), lt = this.ensureAttrs(), Ft = Et(lt, ft, d, this.config.useDateObjects), { store: ht, attrsStore: ce } = this._applyOptimisticUpdates(Ft, lt, _, y), le = (O = (m = D == null ? void 0 : D[0]) === null || m === void 0 ? void 0 : m.data) === null || O === void 0 ? void 0 : O["page-info"], Te = (C = (S = D == null ? void 0 : D[0]) === null || S === void 0 ? void 0 : S.data) === null || C === void 0 ? void 0 : C.aggregate;
|
|
4981
4981
|
return {
|
|
4982
4982
|
q: $,
|
|
4983
4983
|
hash: Ve,
|
|
@@ -5058,8 +5058,8 @@ class Fu {
|
|
|
5058
5058
|
break;
|
|
5059
5059
|
}
|
|
5060
5060
|
case "join-room-error":
|
|
5061
|
-
const
|
|
5062
|
-
f && (f.error = n.error), this._notifyPresenceSubs(
|
|
5061
|
+
const c = n["room-id"], f = this._rooms[c];
|
|
5062
|
+
f && (f.error = n.error), this._notifyPresenceSubs(c);
|
|
5063
5063
|
break;
|
|
5064
5064
|
case "error":
|
|
5065
5065
|
this._handleReceiveError(n);
|
|
@@ -5099,18 +5099,18 @@ class Fu {
|
|
|
5099
5099
|
_handleReceiveError(e) {
|
|
5100
5100
|
var n, r, i, s, o, a, u;
|
|
5101
5101
|
console.log("error", e);
|
|
5102
|
-
const
|
|
5103
|
-
this._inFlightMutationEventIds.delete(
|
|
5104
|
-
const
|
|
5102
|
+
const d = e["client-event-id"];
|
|
5103
|
+
this._inFlightMutationEventIds.delete(d);
|
|
5104
|
+
const c = this._pendingMutations().get(d), f = {
|
|
5105
5105
|
message: e.message || "Uh-oh, something went wrong. Ping Joe & Stopa."
|
|
5106
5106
|
};
|
|
5107
|
-
if (e.hint && (f.hint = e.hint),
|
|
5108
|
-
this._handleMutationError("error",
|
|
5107
|
+
if (e.hint && (f.hint = e.hint), c) {
|
|
5108
|
+
this._handleMutationError("error", d, e);
|
|
5109
5109
|
return;
|
|
5110
5110
|
}
|
|
5111
5111
|
if (!((n = e["original-event"]) === null || n === void 0) && n.hasOwnProperty("q") && ((r = e["original-event"]) === null || r === void 0 ? void 0 : r.op) === "add-query") {
|
|
5112
5112
|
const y = (i = e["original-event"]) === null || i === void 0 ? void 0 : i.q, b = B(y);
|
|
5113
|
-
this.notifyQueryError(B(y), f), this.notifyQueryOnceError(y, b,
|
|
5113
|
+
this.notifyQueryError(B(y), f), this.notifyQueryOnceError(y, b, d, f);
|
|
5114
5114
|
return;
|
|
5115
5115
|
}
|
|
5116
5116
|
if (((s = e["original-event"]) === null || s === void 0 ? void 0 : s.op) === "init") {
|
|
@@ -5214,17 +5214,17 @@ class Fu {
|
|
|
5214
5214
|
return n;
|
|
5215
5215
|
if (!n)
|
|
5216
5216
|
return /* @__PURE__ */ new Map();
|
|
5217
|
-
const i = (
|
|
5218
|
-
const [f, l, p] =
|
|
5217
|
+
const i = (c) => {
|
|
5218
|
+
const [f, l, p] = c["forward-identity"];
|
|
5219
5219
|
return K(e, l, p);
|
|
5220
|
-
}, s = (
|
|
5221
|
-
const [f, l, p] =
|
|
5220
|
+
}, s = (c) => {
|
|
5221
|
+
const [f, l, p] = c["forward-identity"];
|
|
5222
5222
|
return Ie(e, l, p);
|
|
5223
5223
|
}, o = { attrIdMap: {}, refSwapAttrIds: /* @__PURE__ */ new Set() };
|
|
5224
5224
|
let a = !1;
|
|
5225
|
-
const u = (
|
|
5225
|
+
const u = (c, f) => {
|
|
5226
5226
|
const l = [];
|
|
5227
|
-
for (const p of
|
|
5227
|
+
for (const p of c) {
|
|
5228
5228
|
const [y] = p;
|
|
5229
5229
|
if (y === "add-attr") {
|
|
5230
5230
|
const [_, T] = p, g = i(T);
|
|
@@ -5247,11 +5247,11 @@ class Fu {
|
|
|
5247
5247
|
const b = a ? ba(o, p) : p;
|
|
5248
5248
|
l.push(b);
|
|
5249
5249
|
}
|
|
5250
|
-
return a ? l :
|
|
5251
|
-
},
|
|
5252
|
-
for (const [
|
|
5253
|
-
|
|
5254
|
-
return a ?
|
|
5250
|
+
return a ? l : c;
|
|
5251
|
+
}, d = /* @__PURE__ */ new Map();
|
|
5252
|
+
for (const [c, f] of n.entries())
|
|
5253
|
+
d.set(c, Object.assign(Object.assign({}, f), { "tx-steps": u(f["tx-steps"], f["tx-id"]) }));
|
|
5254
|
+
return a ? d : n;
|
|
5255
5255
|
}
|
|
5256
5256
|
_rewriteMutationsSorted(e, n) {
|
|
5257
5257
|
return Hr(this._rewriteMutations(e, n).entries());
|
|
@@ -5268,8 +5268,8 @@ class Fu {
|
|
|
5268
5268
|
if (a === "add-attr")
|
|
5269
5269
|
s.push(u);
|
|
5270
5270
|
else if (a === "update-attr" && u.id && (!((e = this.attrs) === null || e === void 0) && e.getAttr(u.id))) {
|
|
5271
|
-
const
|
|
5272
|
-
s.push(
|
|
5271
|
+
const d = Object.assign(Object.assign({}, this.attrs.getAttr(u.id)), u);
|
|
5272
|
+
s.push(d);
|
|
5273
5273
|
}
|
|
5274
5274
|
if (!i.size && !s.length)
|
|
5275
5275
|
return this.attrs || new Ae({}, this._linkIndex);
|
|
@@ -5290,10 +5290,10 @@ class Fu {
|
|
|
5290
5290
|
const r = this.querySubs.version(), i = this.querySubs.currentValue, s = this.kv.version(), o = this._pendingMutations(), { q: a, result: u } = i[e] || {};
|
|
5291
5291
|
if (!u)
|
|
5292
5292
|
return;
|
|
5293
|
-
const
|
|
5294
|
-
if (
|
|
5295
|
-
return
|
|
5296
|
-
const { store:
|
|
5293
|
+
const d = this._dataForQueryCache[e];
|
|
5294
|
+
if (d && r === d.querySubVersion && s === d.pendingMutationsVersion)
|
|
5295
|
+
return d;
|
|
5296
|
+
const { store: c, attrsStore: f, pageInfo: l, aggregate: p, processedTxId: y } = u, b = this._rewriteMutationsSorted(f, o), { store: _, attrsStore: T } = this._applyOptimisticUpdates(c, f, b, y);
|
|
5297
5297
|
return { data: Ri({ store: _, attrsStore: T, pageInfo: l, aggregate: p }, a), querySubVersion: r, pendingMutationsVersion: s };
|
|
5298
5298
|
}
|
|
5299
5299
|
_applyOptimisticUpdates(e, n, r, i) {
|
|
@@ -5483,13 +5483,13 @@ class Fu {
|
|
|
5483
5483
|
return null;
|
|
5484
5484
|
this._replaceUrlAfterOAuth();
|
|
5485
5485
|
try {
|
|
5486
|
-
const u = yield this._getCurrentUser(),
|
|
5486
|
+
const u = yield this._getCurrentUser(), d = (u == null ? void 0 : u.type) === "guest", { user: c } = yield Rr({
|
|
5487
5487
|
apiURI: this.config.apiURI,
|
|
5488
5488
|
appId: this.config.appId,
|
|
5489
5489
|
code: a,
|
|
5490
|
-
refreshToken:
|
|
5490
|
+
refreshToken: d ? u.refresh_token : void 0
|
|
5491
5491
|
});
|
|
5492
|
-
return this.setCurrentUser(
|
|
5492
|
+
return this.setCurrentUser(c), null;
|
|
5493
5493
|
} catch (u) {
|
|
5494
5494
|
return ((e = u == null ? void 0 : u.body) === null || e === void 0 ? void 0 : e.type) === "record-not-found" && ((r = (n = u == null ? void 0 : u.body) === null || n === void 0 ? void 0 : n.hint) === null || r === void 0 ? void 0 : r["record-type"]) === "app-oauth-code" && (yield this._hasCurrentUser()) ? null : { error: { message: ((i = u == null ? void 0 : u.body) === null || i === void 0 ? void 0 : i.message) || "Error logging in." } };
|
|
5495
5495
|
}
|
|
@@ -5797,8 +5797,8 @@ class Fu {
|
|
|
5797
5797
|
r.initialPresence || r.initialData
|
|
5798
5798
|
), o = Object.assign(Object.assign({}, r), { roomId: n, cb: i, prev: null });
|
|
5799
5799
|
return this._presence[n] = this._presence[n] || {}, this._presence[n].handlers = this._presence[n].handlers || [], this._presence[n].handlers.push(o), this._notifyPresenceSub(n, o), () => {
|
|
5800
|
-
var a, u,
|
|
5801
|
-
this._presence[n].handlers = (
|
|
5800
|
+
var a, u, d;
|
|
5801
|
+
this._presence[n].handlers = (d = (u = (a = this._presence[n]) === null || a === void 0 ? void 0 : a.handlers) === null || u === void 0 ? void 0 : u.filter((c) => c !== o)) !== null && d !== void 0 ? d : [], s();
|
|
5802
5802
|
};
|
|
5803
5803
|
}
|
|
5804
5804
|
_notifyPresenceSubs(e) {
|
|
@@ -5814,22 +5814,22 @@ class Fu {
|
|
|
5814
5814
|
_patchPresencePeers(e, n) {
|
|
5815
5815
|
var r, i, s;
|
|
5816
5816
|
const o = ((i = (r = this._presence[e]) === null || r === void 0 ? void 0 : r.result) === null || i === void 0 ? void 0 : i.peers) || {};
|
|
5817
|
-
let a = Object.fromEntries(Object.entries(o).map(([
|
|
5817
|
+
let a = Object.fromEntries(Object.entries(o).map(([d, c]) => [d, { data: c }]));
|
|
5818
5818
|
(s = this._presence[e]) === null || s === void 0 || s.result;
|
|
5819
|
-
const u = It(a, (
|
|
5820
|
-
for (let [
|
|
5819
|
+
const u = It(a, (d) => {
|
|
5820
|
+
for (let [c, f, l] of n)
|
|
5821
5821
|
switch (f) {
|
|
5822
5822
|
case "+":
|
|
5823
|
-
Ls(
|
|
5823
|
+
Ls(d, c, l);
|
|
5824
5824
|
break;
|
|
5825
5825
|
case "r":
|
|
5826
|
-
Tr(
|
|
5826
|
+
Tr(d, c, l);
|
|
5827
5827
|
break;
|
|
5828
5828
|
case "-":
|
|
5829
|
-
_i(
|
|
5829
|
+
_i(d, c);
|
|
5830
5830
|
break;
|
|
5831
5831
|
}
|
|
5832
|
-
delete
|
|
5832
|
+
delete d[this._sessionId];
|
|
5833
5833
|
});
|
|
5834
5834
|
this._setPresencePeers(e, u);
|
|
5835
5835
|
}
|
|
@@ -5872,8 +5872,8 @@ class Fu {
|
|
|
5872
5872
|
_notifyBroadcastSubs(e, n, r) {
|
|
5873
5873
|
var i, s, o;
|
|
5874
5874
|
(o = (s = (i = this._broadcastSubs) === null || i === void 0 ? void 0 : i[e]) === null || s === void 0 ? void 0 : s[n]) === null || o === void 0 || o.forEach((a) => {
|
|
5875
|
-
var u,
|
|
5876
|
-
const y = (u = r.data) === null || u === void 0 ? void 0 : u.data, b = r.data["peer-id"] === this._sessionId ? (
|
|
5875
|
+
var u, d, c, f, l, p;
|
|
5876
|
+
const y = (u = r.data) === null || u === void 0 ? void 0 : u.data, b = r.data["peer-id"] === this._sessionId ? (c = (d = this._presence[e]) === null || d === void 0 ? void 0 : d.result) === null || c === void 0 ? void 0 : c.user : (p = (l = (f = this._presence[e]) === null || f === void 0 ? void 0 : f.result) === null || l === void 0 ? void 0 : l.peers) === null || p === void 0 ? void 0 : p[r.data["peer-id"]];
|
|
5877
5877
|
return a(y, b);
|
|
5878
5878
|
});
|
|
5879
5879
|
}
|
|
@@ -5969,9 +5969,9 @@ function Hi(t, e) {
|
|
|
5969
5969
|
entityName: u.forward.on,
|
|
5970
5970
|
cardinality: u.reverse.has
|
|
5971
5971
|
};
|
|
5972
|
-
return Object.fromEntries(Object.entries(t).map(([u,
|
|
5972
|
+
return Object.fromEntries(Object.entries(t).map(([u, d]) => [
|
|
5973
5973
|
u,
|
|
5974
|
-
new Ut(
|
|
5974
|
+
new Ut(d.attrs, Object.assign(Object.assign({}, o.fwd[u]), o.rev[u]))
|
|
5975
5975
|
]));
|
|
5976
5976
|
}
|
|
5977
5977
|
function Qu({ entities: t, links: e, rooms: n }) {
|
|
@@ -6004,12 +6004,12 @@ let mt;
|
|
|
6004
6004
|
function Hu(t, e) {
|
|
6005
6005
|
mt == null || mt.dispose();
|
|
6006
6006
|
const n = tc(e), r = Zu(e, a), i = Ju(Yu(t));
|
|
6007
|
-
function s(
|
|
6007
|
+
function s(c) {
|
|
6008
6008
|
var f;
|
|
6009
|
-
|
|
6009
|
+
c.source === i.element.contentWindow && ((f = c.data) === null || f === void 0 ? void 0 : f.type) === "close" && n.isVisible() && a();
|
|
6010
6010
|
}
|
|
6011
|
-
function o(
|
|
6012
|
-
const f =
|
|
6011
|
+
function o(c) {
|
|
6012
|
+
const f = c.shiftKey && c.ctrlKey && c.key === "0", l = c.key === "Escape" || c.key === "Esc";
|
|
6013
6013
|
(f || l && n.isVisible()) && a();
|
|
6014
6014
|
}
|
|
6015
6015
|
function a() {
|
|
@@ -6018,12 +6018,12 @@ function Hu(t, e) {
|
|
|
6018
6018
|
function u() {
|
|
6019
6019
|
n.element.remove(), r.element.remove(), removeEventListener("keydown", o), removeEventListener("message", s);
|
|
6020
6020
|
}
|
|
6021
|
-
function
|
|
6021
|
+
function d() {
|
|
6022
6022
|
document.body.appendChild(n.element), document.body.appendChild(r.element), addEventListener("keydown", o), addEventListener("message", s), mt = {
|
|
6023
6023
|
dispose: u
|
|
6024
6024
|
};
|
|
6025
6025
|
}
|
|
6026
|
-
return
|
|
6026
|
+
return d();
|
|
6027
6027
|
}
|
|
6028
6028
|
function Yu(t) {
|
|
6029
6029
|
return `${qn || Ni ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${t}`;
|
|
@@ -6313,12 +6313,12 @@ function cc(t, e) {
|
|
|
6313
6313
|
return Jr(t._reactor.config.schema) !== Jr(e);
|
|
6314
6314
|
}
|
|
6315
6315
|
function dc(t, e, n, r, i) {
|
|
6316
|
-
var s;
|
|
6317
|
-
const
|
|
6318
|
-
if (
|
|
6319
|
-
return cc(
|
|
6320
|
-
const
|
|
6321
|
-
return wn[gn(
|
|
6316
|
+
var s, o;
|
|
6317
|
+
const a = Object.assign(Object.assign({}, t), { appId: (s = t.appId) === null || s === void 0 ? void 0 : s.trim(), useDateObjects: (o = t.useDateObjects) !== null && o !== void 0 ? o : !1 }), u = wn[gn(a)];
|
|
6318
|
+
if (u)
|
|
6319
|
+
return cc(u, a.schema) && u._reactor.updateSchema(a.schema), u;
|
|
6320
|
+
const d = new Fu(Object.assign(Object.assign(Object.assign({}, nc), a), { cardinalityInference: !!a.schema }), e || Ui, n || Li, Object.assign(Object.assign({}, r || {}), { "@instantdb/core": Wn }), i), c = new uc(d);
|
|
6321
|
+
return wn[gn(a)] = c, fc(a.appId, a.devtool), c;
|
|
6322
6322
|
}
|
|
6323
6323
|
function fc(t, e) {
|
|
6324
6324
|
if (typeof window > "u" || typeof window.location > "u" || typeof document > "u" || typeof e == "boolean" && !e)
|
|
@@ -6341,11 +6341,11 @@ function lc() {
|
|
|
6341
6341
|
if (Zr) return Qe;
|
|
6342
6342
|
Zr = 1;
|
|
6343
6343
|
var t = oi, e = Symbol.for("react.element"), n = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, i = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
6344
|
-
function o(a, u,
|
|
6345
|
-
var
|
|
6346
|
-
|
|
6347
|
-
for (
|
|
6348
|
-
if (a && a.defaultProps) for (
|
|
6344
|
+
function o(a, u, d) {
|
|
6345
|
+
var c, f = {}, l = null, p = null;
|
|
6346
|
+
d !== void 0 && (l = "" + d), u.key !== void 0 && (l = "" + u.key), u.ref !== void 0 && (p = u.ref);
|
|
6347
|
+
for (c in u) r.call(u, c) && !s.hasOwnProperty(c) && (f[c] = u[c]);
|
|
6348
|
+
if (a && a.defaultProps) for (c in u = a.defaultProps, u) f[c] === void 0 && (f[c] = u[c]);
|
|
6349
6349
|
return { $$typeof: e, type: a, key: l, ref: p, props: f, _owner: i.current };
|
|
6350
6350
|
}
|
|
6351
6351
|
return Qe.Fragment = n, Qe.jsx = o, Qe.jsxs = o, Qe;
|
|
@@ -6365,7 +6365,7 @@ function hc() {
|
|
|
6365
6365
|
* LICENSE file in the root directory of this source tree.
|
|
6366
6366
|
*/
|
|
6367
6367
|
return t.NODE_ENV !== "production" && function() {
|
|
6368
|
-
var e = oi, n = Symbol.for("react.element"), r = Symbol.for("react.portal"), i = Symbol.for("react.fragment"), s = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), a = Symbol.for("react.provider"), u = Symbol.for("react.context"),
|
|
6368
|
+
var e = oi, n = Symbol.for("react.element"), r = Symbol.for("react.portal"), i = Symbol.for("react.fragment"), s = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), a = Symbol.for("react.provider"), u = Symbol.for("react.context"), d = Symbol.for("react.forward_ref"), c = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), l = Symbol.for("react.memo"), p = Symbol.for("react.lazy"), y = Symbol.for("react.offscreen"), b = Symbol.iterator, _ = "@@iterator";
|
|
6369
6369
|
function T(h) {
|
|
6370
6370
|
if (h === null || typeof h != "object")
|
|
6371
6371
|
return null;
|
|
@@ -6393,7 +6393,7 @@ function hc() {
|
|
|
6393
6393
|
var S = !1, C = !1, $ = !1, D = !1, Ve = !1, ft;
|
|
6394
6394
|
ft = Symbol.for("react.module.reference");
|
|
6395
6395
|
function lt(h) {
|
|
6396
|
-
return !!(typeof h == "string" || typeof h == "function" || h === i || h === o || Ve || h === s || h ===
|
|
6396
|
+
return !!(typeof h == "string" || typeof h == "function" || h === i || h === o || Ve || h === s || h === c || h === f || D || h === y || S || C || $ || typeof h == "object" && h !== null && (h.$$typeof === p || h.$$typeof === l || h.$$typeof === a || h.$$typeof === u || h.$$typeof === d || // This needs to include all possible module reference object
|
|
6397
6397
|
// types supported by any Flight configuration anywhere since
|
|
6398
6398
|
// we don't know which Flight build this will end up being used
|
|
6399
6399
|
// with.
|
|
@@ -6425,7 +6425,7 @@ function hc() {
|
|
|
6425
6425
|
return "Profiler";
|
|
6426
6426
|
case s:
|
|
6427
6427
|
return "StrictMode";
|
|
6428
|
-
case
|
|
6428
|
+
case c:
|
|
6429
6429
|
return "Suspense";
|
|
6430
6430
|
case f:
|
|
6431
6431
|
return "SuspenseList";
|
|
@@ -6438,7 +6438,7 @@ function hc() {
|
|
|
6438
6438
|
case a:
|
|
6439
6439
|
var v = h;
|
|
6440
6440
|
return ht(v._context) + ".Provider";
|
|
6441
|
-
case
|
|
6441
|
+
case d:
|
|
6442
6442
|
return Ft(h, h.render, "ForwardRef");
|
|
6443
6443
|
case l:
|
|
6444
6444
|
var E = h.displayName || null;
|
|
@@ -6621,14 +6621,14 @@ function hc() {
|
|
|
6621
6621
|
if (typeof h == "string")
|
|
6622
6622
|
return pt(h);
|
|
6623
6623
|
switch (h) {
|
|
6624
|
-
case
|
|
6624
|
+
case c:
|
|
6625
6625
|
return pt("Suspense");
|
|
6626
6626
|
case f:
|
|
6627
6627
|
return pt("SuspenseList");
|
|
6628
6628
|
}
|
|
6629
6629
|
if (typeof h == "object")
|
|
6630
6630
|
switch (h.$$typeof) {
|
|
6631
|
-
case
|
|
6631
|
+
case d:
|
|
6632
6632
|
return es(h.render);
|
|
6633
6633
|
case l:
|
|
6634
6634
|
return bt(h.type, w, v);
|
|
@@ -6868,7 +6868,7 @@ Check the top-level render call using <` + v + ">.");
|
|
|
6868
6868
|
var v;
|
|
6869
6869
|
if (typeof w == "function")
|
|
6870
6870
|
v = w.propTypes;
|
|
6871
|
-
else if (typeof w == "object" && (w.$$typeof ===
|
|
6871
|
+
else if (typeof w == "object" && (w.$$typeof === d || // Note: Memo only checks outer props here.
|
|
6872
6872
|
// Inner props are checked in the reconciler.
|
|
6873
6873
|
w.$$typeof === l))
|
|
6874
6874
|
v = w.propTypes;
|
|
@@ -6967,16 +6967,16 @@ function ei(t) {
|
|
|
6967
6967
|
function bc(t, e, n) {
|
|
6968
6968
|
e && n && "ruleParams" in n && (e = Object.assign({ $$ruleParams: n.ruleParams }, e));
|
|
6969
6969
|
const r = e ? ac(e) : null, i = B(r), s = ot(ei(t._reactor.getPreviousResult(r))), o = we(
|
|
6970
|
-
(u) => (s.current = ei(t._reactor.getPreviousResult(r)), r ? t.subscribeQuery(r, (
|
|
6970
|
+
(u) => (s.current = ei(t._reactor.getPreviousResult(r)), r ? t.subscribeQuery(r, (c) => {
|
|
6971
6971
|
s.current = Object.assign({
|
|
6972
|
-
isLoading: !
|
|
6972
|
+
isLoading: !c,
|
|
6973
6973
|
// @ts-expect-error: ts thinks this will always be overwritten
|
|
6974
6974
|
data: void 0,
|
|
6975
6975
|
// @ts-expect-error: ts thinks this will always be overwritten
|
|
6976
6976
|
pageInfo: void 0,
|
|
6977
6977
|
// @ts-expect-error: ts thinks this will always be overwritten
|
|
6978
6978
|
error: void 0
|
|
6979
|
-
},
|
|
6979
|
+
}, c), u();
|
|
6980
6980
|
}) : () => {
|
|
6981
6981
|
}),
|
|
6982
6982
|
// Build a new subscribe function if the query changes
|
|
@@ -7023,8 +7023,8 @@ function mc(t, e = {}) {
|
|
|
7023
7023
|
isLoading: !0
|
|
7024
7024
|
};
|
|
7025
7025
|
});
|
|
7026
|
-
ke(() => t.core._reactor.subscribePresence(t.type, t.id, e, (
|
|
7027
|
-
s(
|
|
7026
|
+
ke(() => t.core._reactor.subscribePresence(t.type, t.id, e, (d) => {
|
|
7027
|
+
s(d);
|
|
7028
7028
|
}), [t.id, e.user, (n = e.peers) === null || n === void 0 ? void 0 : n.join(), (r = e.keys) === null || r === void 0 ? void 0 : r.join()]);
|
|
7029
7029
|
const o = we((u) => {
|
|
7030
7030
|
t.core._reactor.publishPresence(t.type, t.id, u);
|
|
@@ -7038,28 +7038,28 @@ function Sc(t, e, n = {}) {
|
|
|
7038
7038
|
const r = _c(), i = Se.usePresence(t, {
|
|
7039
7039
|
keys: [e]
|
|
7040
7040
|
}), s = tn(() => {
|
|
7041
|
-
var
|
|
7041
|
+
var c;
|
|
7042
7042
|
const f = t._core._reactor.getPresence(t.type, t.id);
|
|
7043
|
-
return n != null && n.writeOnly ? [] : Object.values((
|
|
7044
|
-
}, [n == null ? void 0 : n.writeOnly, i]), o = we((
|
|
7043
|
+
return n != null && n.writeOnly ? [] : Object.values((c = f == null ? void 0 : f.peers) !== null && c !== void 0 ? c : {}).filter((l) => l[e] === !0);
|
|
7044
|
+
}, [n == null ? void 0 : n.writeOnly, i]), o = we((c) => {
|
|
7045
7045
|
var f;
|
|
7046
7046
|
t.core._reactor.publishPresence(t.type, t.id, {
|
|
7047
|
-
[e]:
|
|
7048
|
-
}),
|
|
7047
|
+
[e]: c
|
|
7048
|
+
}), c && ((n == null ? void 0 : n.timeout) === null || (n == null ? void 0 : n.timeout) === 0 || r.set((f = n == null ? void 0 : n.timeout) !== null && f !== void 0 ? f : gc, () => {
|
|
7049
7049
|
t.core._reactor.publishPresence(t.type, t.id, {
|
|
7050
7050
|
[e]: null
|
|
7051
7051
|
});
|
|
7052
7052
|
}));
|
|
7053
|
-
}, [t.type, t.id, e, n == null ? void 0 : n.timeout, r]), a = we((
|
|
7054
|
-
const l = !((n == null ? void 0 : n.stopOnEnter) &&
|
|
7053
|
+
}, [t.type, t.id, e, n == null ? void 0 : n.timeout, r]), a = we((c) => {
|
|
7054
|
+
const l = !((n == null ? void 0 : n.stopOnEnter) && c.key === "Enter");
|
|
7055
7055
|
o(l);
|
|
7056
7056
|
}, [n.stopOnEnter, o]), u = we(() => {
|
|
7057
7057
|
o(!1);
|
|
7058
|
-
}, [o]),
|
|
7058
|
+
}, [o]), d = tn(() => ({ onKeyDown: a, onBlur: u }), [a, u]);
|
|
7059
7059
|
return {
|
|
7060
7060
|
active: s,
|
|
7061
7061
|
setActive: o,
|
|
7062
|
-
inputProps:
|
|
7062
|
+
inputProps: d
|
|
7063
7063
|
};
|
|
7064
7064
|
}
|
|
7065
7065
|
const Se = {
|
|
@@ -7083,24 +7083,24 @@ var Ec = function(t, e, n, r) {
|
|
|
7083
7083
|
});
|
|
7084
7084
|
}
|
|
7085
7085
|
return new (n || (n = Promise))(function(s, o) {
|
|
7086
|
-
function a(
|
|
7086
|
+
function a(c) {
|
|
7087
7087
|
try {
|
|
7088
|
-
|
|
7088
|
+
d(r.next(c));
|
|
7089
7089
|
} catch (f) {
|
|
7090
7090
|
o(f);
|
|
7091
7091
|
}
|
|
7092
7092
|
}
|
|
7093
|
-
function u(
|
|
7093
|
+
function u(c) {
|
|
7094
7094
|
try {
|
|
7095
|
-
|
|
7095
|
+
d(r.throw(c));
|
|
7096
7096
|
} catch (f) {
|
|
7097
7097
|
o(f);
|
|
7098
7098
|
}
|
|
7099
7099
|
}
|
|
7100
|
-
function c
|
|
7101
|
-
|
|
7100
|
+
function d(c) {
|
|
7101
|
+
c.done ? s(c.value) : i(c.value).then(a, u);
|
|
7102
7102
|
}
|
|
7103
|
-
|
|
7103
|
+
d((r = r.apply(t, e || [])).next());
|
|
7104
7104
|
});
|
|
7105
7105
|
};
|
|
7106
7106
|
const Ac = {
|
|
@@ -7197,8 +7197,8 @@ function jc(t) {
|
|
|
7197
7197
|
"`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
|
|
7198
7198
|
);
|
|
7199
7199
|
const { onEvent: e = Xt, onError: n = Xt, onRetry: r = Xt, onComment: i } = t;
|
|
7200
|
-
let s = "", o = !0, a, u = "",
|
|
7201
|
-
function
|
|
7200
|
+
let s = "", o = !0, a, u = "", d = "";
|
|
7201
|
+
function c(b) {
|
|
7202
7202
|
const _ = o ? b.replace(/^\xEF\xBB\xBF/, "") : b, [T, g] = Cc(`${s}${_}`);
|
|
7203
7203
|
for (const m of T)
|
|
7204
7204
|
f(m);
|
|
@@ -7224,7 +7224,7 @@ function jc(t) {
|
|
|
7224
7224
|
function l(b, _, T) {
|
|
7225
7225
|
switch (b) {
|
|
7226
7226
|
case "event":
|
|
7227
|
-
|
|
7227
|
+
d = _;
|
|
7228
7228
|
break;
|
|
7229
7229
|
case "data":
|
|
7230
7230
|
u = `${u}${_}
|
|
@@ -7255,17 +7255,17 @@ function jc(t) {
|
|
|
7255
7255
|
function p() {
|
|
7256
7256
|
u.length > 0 && e({
|
|
7257
7257
|
id: a,
|
|
7258
|
-
event:
|
|
7258
|
+
event: d || void 0,
|
|
7259
7259
|
// If the data buffer's last character is a U+000A LINE FEED (LF) character,
|
|
7260
7260
|
// then remove the last character from the data buffer.
|
|
7261
7261
|
data: u.endsWith(`
|
|
7262
7262
|
`) ? u.slice(0, -1) : u
|
|
7263
|
-
}), a = void 0, u = "",
|
|
7263
|
+
}), a = void 0, u = "", d = "";
|
|
7264
7264
|
}
|
|
7265
7265
|
function y(b = {}) {
|
|
7266
|
-
s && b.consume && f(s), o = !0, a = void 0, u = "",
|
|
7266
|
+
s && b.consume && f(s), o = !0, a = void 0, u = "", d = "", s = "";
|
|
7267
7267
|
}
|
|
7268
|
-
return { feed:
|
|
7268
|
+
return { feed: c, reset: y };
|
|
7269
7269
|
}
|
|
7270
7270
|
function Cc(t) {
|
|
7271
7271
|
const e = [];
|
|
@@ -7353,17 +7353,17 @@ class kt extends EventTarget {
|
|
|
7353
7353
|
super(), q(this, se), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, q(this, J), q(this, Oe), q(this, xe), q(this, At), q(this, Rt), q(this, it), q(this, Ue), q(this, st, null), q(this, ge), q(this, $e), q(this, Fe, null), q(this, De, null), q(this, Xe, null), q(this, Sn, async (s) => {
|
|
7354
7354
|
var o;
|
|
7355
7355
|
A(this, $e).reset();
|
|
7356
|
-
const { body: a, redirected: u, status:
|
|
7357
|
-
if (
|
|
7356
|
+
const { body: a, redirected: u, status: d, headers: c } = s;
|
|
7357
|
+
if (d === 204) {
|
|
7358
7358
|
pe(this, se, et).call(this, "Server sent HTTP 204, not reconnecting", 204), this.close();
|
|
7359
7359
|
return;
|
|
7360
7360
|
}
|
|
7361
|
-
if (u ? x(this, xe, new URL(s.url)) : x(this, xe, void 0),
|
|
7362
|
-
pe(this, se, et).call(this, `Non-200 status code (${
|
|
7361
|
+
if (u ? x(this, xe, new URL(s.url)) : x(this, xe, void 0), d !== 200) {
|
|
7362
|
+
pe(this, se, et).call(this, `Non-200 status code (${d})`, d);
|
|
7363
7363
|
return;
|
|
7364
7364
|
}
|
|
7365
|
-
if (!(
|
|
7366
|
-
pe(this, se, et).call(this, 'Invalid content type, expected "text/event-stream"',
|
|
7365
|
+
if (!(c.get("content-type") || "").startsWith("text/event-stream")) {
|
|
7366
|
+
pe(this, se, et).call(this, 'Invalid content type, expected "text/event-stream"', d);
|
|
7367
7367
|
return;
|
|
7368
7368
|
}
|
|
7369
7369
|
if (A(this, J) === this.CLOSED)
|
|
@@ -7371,7 +7371,7 @@ class kt extends EventTarget {
|
|
|
7371
7371
|
x(this, J, this.OPEN);
|
|
7372
7372
|
const f = new Event("open");
|
|
7373
7373
|
if ((o = A(this, Xe)) == null || o.call(this, f), this.dispatchEvent(f), typeof a != "object" || !a || !("getReader" in a)) {
|
|
7374
|
-
pe(this, se, et).call(this, "Invalid response body, expected a web ReadableStream",
|
|
7374
|
+
pe(this, se, et).call(this, "Invalid response body, expected a web ReadableStream", d), this.close();
|
|
7375
7375
|
return;
|
|
7376
7376
|
}
|
|
7377
7377
|
const l = new TextDecoder(), p = a.getReader();
|
|
@@ -7576,15 +7576,15 @@ function Kc({
|
|
|
7576
7576
|
children: o,
|
|
7577
7577
|
renderCursor: a,
|
|
7578
7578
|
propagate: u,
|
|
7579
|
-
zIndex:
|
|
7579
|
+
zIndex: d
|
|
7580
7580
|
}) {
|
|
7581
|
-
const
|
|
7582
|
-
keys: [
|
|
7581
|
+
const c = e || `cursors-space-default--${String(n.type)}-${n.id}`, f = n.usePresence({
|
|
7582
|
+
keys: [c]
|
|
7583
7583
|
}), l = n._core._reactor.getPresence(n.type, n.id);
|
|
7584
7584
|
function p(g, m) {
|
|
7585
7585
|
const O = m.clientX, S = m.clientY, C = (O - g.left) / g.width * 100, $ = (S - g.top) / g.height * 100;
|
|
7586
7586
|
f.publishPresence({
|
|
7587
|
-
[
|
|
7587
|
+
[c]: {
|
|
7588
7588
|
x: O,
|
|
7589
7589
|
y: S,
|
|
7590
7590
|
xPercent: C,
|
|
@@ -7600,7 +7600,7 @@ function Kc({
|
|
|
7600
7600
|
}
|
|
7601
7601
|
function b(g) {
|
|
7602
7602
|
f.publishPresence({
|
|
7603
|
-
[
|
|
7603
|
+
[c]: void 0
|
|
7604
7604
|
});
|
|
7605
7605
|
}
|
|
7606
7606
|
function _(g) {
|
|
@@ -7615,7 +7615,7 @@ function Kc({
|
|
|
7615
7615
|
}
|
|
7616
7616
|
function T(g) {
|
|
7617
7617
|
f.publishPresence({
|
|
7618
|
-
[
|
|
7618
|
+
[c]: void 0
|
|
7619
7619
|
});
|
|
7620
7620
|
}
|
|
7621
7621
|
return Os(
|
|
@@ -7639,10 +7639,10 @@ function Kc({
|
|
|
7639
7639
|
style: {
|
|
7640
7640
|
...si,
|
|
7641
7641
|
...xc,
|
|
7642
|
-
zIndex:
|
|
7642
|
+
zIndex: d !== void 0 ? d : $c
|
|
7643
7643
|
},
|
|
7644
7644
|
children: Object.entries(f.peers).map(([g, m]) => {
|
|
7645
|
-
const O = m[
|
|
7645
|
+
const O = m[c];
|
|
7646
7646
|
return O ? /* @__PURE__ */ V.jsx(
|
|
7647
7647
|
"div",
|
|
7648
7648
|
{
|
|
@@ -7661,7 +7661,7 @@ function Kc({
|
|
|
7661
7661
|
) : null;
|
|
7662
7662
|
})
|
|
7663
7663
|
},
|
|
7664
|
-
|
|
7664
|
+
c
|
|
7665
7665
|
)
|
|
7666
7666
|
]
|
|
7667
7667
|
);
|