@instantdb/core 0.22.86-experimental.split-store.20183617880.1 → 0.22.86-experimental.split-store.20247643606.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/commonjs/Reactor.d.ts.map +1 -1
- package/dist/commonjs/Reactor.js +3 -2
- package/dist/commonjs/Reactor.js.map +1 -1
- package/dist/commonjs/instaml.d.ts.map +1 -1
- package/dist/commonjs/instaml.js +22 -18
- package/dist/commonjs/instaml.js.map +1 -1
- package/dist/commonjs/store.d.ts.map +1 -1
- package/dist/commonjs/store.js +12 -17
- package/dist/commonjs/store.js.map +1 -1
- package/dist/esm/Reactor.d.ts.map +1 -1
- package/dist/esm/Reactor.js +3 -2
- package/dist/esm/Reactor.js.map +1 -1
- package/dist/esm/instaml.d.ts.map +1 -1
- package/dist/esm/instaml.js +22 -18
- package/dist/esm/instaml.js.map +1 -1
- package/dist/esm/store.d.ts.map +1 -1
- package/dist/esm/store.js +12 -17
- package/dist/esm/store.js.map +1 -1
- package/dist/standalone/index.js +195 -193
- package/dist/standalone/index.umd.cjs +2 -2
- package/package.json +2 -2
- package/src/Reactor.js +3 -2
- package/src/instaml.ts +11 -7
- package/src/store.ts +14 -17
package/dist/standalone/index.js
CHANGED
|
@@ -64,7 +64,7 @@ function st(t) {
|
|
|
64
64
|
function it(t) {
|
|
65
65
|
return Object.getPrototypeOf(t) === Map.prototype;
|
|
66
66
|
}
|
|
67
|
-
function
|
|
67
|
+
function U(t) {
|
|
68
68
|
var e;
|
|
69
69
|
return (e = t.copy) !== null && e !== void 0 ? e : t.original;
|
|
70
70
|
}
|
|
@@ -116,7 +116,7 @@ function he(t, e, n) {
|
|
|
116
116
|
}
|
|
117
117
|
function De(t, e) {
|
|
118
118
|
const n = S(t);
|
|
119
|
-
return (n ?
|
|
119
|
+
return (n ? U(n) : t)[e];
|
|
120
120
|
}
|
|
121
121
|
function Q(t, e) {
|
|
122
122
|
return t === e ? t !== 0 || 1 / t === 1 / e : t !== t && e !== e;
|
|
@@ -449,13 +449,13 @@ const Ae = (t, e, n = !1) => {
|
|
|
449
449
|
throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.");
|
|
450
450
|
}, ze = {
|
|
451
451
|
get size() {
|
|
452
|
-
return
|
|
452
|
+
return U(S(this)).size;
|
|
453
453
|
},
|
|
454
454
|
has(t) {
|
|
455
|
-
return
|
|
455
|
+
return U(S(this)).has(t);
|
|
456
456
|
},
|
|
457
457
|
set(t, e) {
|
|
458
|
-
const n = S(this), r =
|
|
458
|
+
const n = S(this), r = U(n);
|
|
459
459
|
return (!r.has(t) || !Q(r.get(t), e)) && (j(n), V(n), n.assignedMap.set(t, !0), n.copy.set(t, e), ct(n, t, e, fe)), this;
|
|
460
460
|
},
|
|
461
461
|
delete(t) {
|
|
@@ -475,13 +475,13 @@ const Ae = (t, e, n = !1) => {
|
|
|
475
475
|
},
|
|
476
476
|
forEach(t, e) {
|
|
477
477
|
const n = S(this);
|
|
478
|
-
|
|
478
|
+
U(n).forEach((r, s) => {
|
|
479
479
|
t.call(e, this.get(s), s, this);
|
|
480
480
|
});
|
|
481
481
|
},
|
|
482
482
|
get(t) {
|
|
483
483
|
var e, n;
|
|
484
|
-
const r = S(this), s =
|
|
484
|
+
const r = S(this), s = U(r).get(t), i = ((n = (e = r.options).mark) === null || n === void 0 ? void 0 : n.call(e, s, F)) === F.mutable;
|
|
485
485
|
if (r.options.strict && Ae(s, r.options, i), i || r.finalized || !q(s, r.options) || s !== r.original.get(t))
|
|
486
486
|
return s;
|
|
487
487
|
const o = rt.createDraft({
|
|
@@ -494,7 +494,7 @@ const Ae = (t, e, n = !1) => {
|
|
|
494
494
|
return j(r), r.copy.set(t, o), o;
|
|
495
495
|
},
|
|
496
496
|
keys() {
|
|
497
|
-
return
|
|
497
|
+
return U(S(this)).keys();
|
|
498
498
|
},
|
|
499
499
|
values() {
|
|
500
500
|
const t = this.keys();
|
|
@@ -653,7 +653,7 @@ const rr = Reflect.ownKeys(ve), rn = /* @__PURE__ */ new WeakSet(), sn = {
|
|
|
653
653
|
if (o = t.options.mark(u, F), o === F.mutable)
|
|
654
654
|
return t.options.strict && Ae(u, t.options, !0), u;
|
|
655
655
|
}
|
|
656
|
-
const a =
|
|
656
|
+
const a = U(t);
|
|
657
657
|
if (a instanceof Map && nr.includes(e)) {
|
|
658
658
|
if (e === "size")
|
|
659
659
|
return Object.getOwnPropertyDescriptor(ze, "size").get.call(t.proxy);
|
|
@@ -700,20 +700,20 @@ const rr = Reflect.ownKeys(ve), rn = /* @__PURE__ */ new WeakSet(), sn = {
|
|
|
700
700
|
let s;
|
|
701
701
|
if (t.type === 1 && e !== "length" && !(Number.isInteger(s = Number(e)) && s >= 0 && (e === 0 || s === 0 || String(s) === String(e))))
|
|
702
702
|
throw new Error("Only supports setting array indices and the 'length' property.");
|
|
703
|
-
const i = wt(
|
|
703
|
+
const i = wt(U(t), e);
|
|
704
704
|
if (i != null && i.set)
|
|
705
705
|
return i.set.call(t.proxy, n), !0;
|
|
706
|
-
const o = De(
|
|
706
|
+
const o = De(U(t), e), a = S(o);
|
|
707
707
|
return a && Q(a.original, n) ? (t.copy[e] = n, t.assignedMap = (r = t.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), t.assignedMap.set(e, !1), !0) : (Q(n, o) && (n !== void 0 || ce(t.original, e)) || (j(t), V(t), ce(t.original, e) && Q(n, t.original[e]) ? t.assignedMap.delete(e) : t.assignedMap.set(e, !0), t.copy[e] = n, ct(t, e, n, fe)), !0);
|
|
708
708
|
},
|
|
709
709
|
has(t, e) {
|
|
710
|
-
return e in
|
|
710
|
+
return e in U(t);
|
|
711
711
|
},
|
|
712
712
|
ownKeys(t) {
|
|
713
|
-
return Reflect.ownKeys(
|
|
713
|
+
return Reflect.ownKeys(U(t));
|
|
714
714
|
},
|
|
715
715
|
getOwnPropertyDescriptor(t, e) {
|
|
716
|
-
const n =
|
|
716
|
+
const n = U(t), r = Reflect.getOwnPropertyDescriptor(n, e);
|
|
717
717
|
return r && {
|
|
718
718
|
writable: !0,
|
|
719
719
|
configurable: t.type !== 1 || e !== "length",
|
|
@@ -756,10 +756,10 @@ function ut(t) {
|
|
|
756
756
|
var h, p;
|
|
757
757
|
const y = S(c);
|
|
758
758
|
let b = l.type === 3 ? l.setMap : l.copy;
|
|
759
|
-
const
|
|
760
|
-
if (
|
|
761
|
-
let T =
|
|
762
|
-
|
|
759
|
+
const g = G(b, r), _ = S(g);
|
|
760
|
+
if (_) {
|
|
761
|
+
let T = _.original;
|
|
762
|
+
_.operated && (T = ot(g)), Ke(_), qe(_, fe, f, d), l.options.enableAutoFreeze && (l.options.updatedValues = (h = l.options.updatedValues) !== null && h !== void 0 ? h : /* @__PURE__ */ new WeakMap(), l.options.updatedValues.set(T, _.original)), he(b, r, T);
|
|
763
763
|
}
|
|
764
764
|
(p = y.callbacks) === null || p === void 0 || p.forEach((T) => {
|
|
765
765
|
T(f, d);
|
|
@@ -877,9 +877,9 @@ const or = (t) => function e(n, r, s) {
|
|
|
877
877
|
for (const M of l.mark) {
|
|
878
878
|
if (typeof M != "function")
|
|
879
879
|
throw new Error(`Invalid mark: ${M}, 'mark' should be a function.`);
|
|
880
|
-
const
|
|
881
|
-
if (
|
|
882
|
-
return
|
|
880
|
+
const x = M(m, O);
|
|
881
|
+
if (x)
|
|
882
|
+
return x;
|
|
883
883
|
}
|
|
884
884
|
} : l.mark, h = (i = l.enablePatches) !== null && i !== void 0 ? i : !1, p = (o = l.strict) !== null && o !== void 0 ? o : !1, b = {
|
|
885
885
|
enableAutoFreeze: (a = l.enableAutoFreeze) !== null && a !== void 0 ? a : !1,
|
|
@@ -889,47 +889,47 @@ const or = (t) => function e(n, r, s) {
|
|
|
889
889
|
};
|
|
890
890
|
if (!q(f, b) && typeof f == "object" && f !== null)
|
|
891
891
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
892
|
-
const [
|
|
892
|
+
const [g, _] = ir(f, b);
|
|
893
893
|
if (typeof r != "function") {
|
|
894
894
|
if (!q(f, b))
|
|
895
895
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
896
|
-
return [
|
|
896
|
+
return [g, _];
|
|
897
897
|
}
|
|
898
898
|
let T;
|
|
899
899
|
try {
|
|
900
|
-
T = u(
|
|
900
|
+
T = u(g);
|
|
901
901
|
} catch (m) {
|
|
902
|
-
throw Ne(S(
|
|
902
|
+
throw Ne(S(g)), m;
|
|
903
903
|
}
|
|
904
904
|
const A = (m) => {
|
|
905
|
-
const O = S(
|
|
905
|
+
const O = S(g);
|
|
906
906
|
if (!J(m)) {
|
|
907
|
-
if (m !== void 0 && !Q(m,
|
|
907
|
+
if (m !== void 0 && !Q(m, g) && (O != null && O.operated))
|
|
908
908
|
throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");
|
|
909
|
-
const
|
|
910
|
-
if (
|
|
911
|
-
const $e =
|
|
909
|
+
const x = m == null ? void 0 : m[Bn];
|
|
910
|
+
if (x) {
|
|
911
|
+
const $e = x[0];
|
|
912
912
|
return b.strict && typeof m == "object" && m !== null && Ve({
|
|
913
913
|
rootDraft: O,
|
|
914
914
|
value: m,
|
|
915
915
|
useRawReturn: !0
|
|
916
|
-
}),
|
|
916
|
+
}), _([$e]);
|
|
917
917
|
}
|
|
918
918
|
if (m !== void 0)
|
|
919
|
-
return typeof m == "object" && m !== null && Ve({ rootDraft: O, value: m }),
|
|
919
|
+
return typeof m == "object" && m !== null && Ve({ rootDraft: O, value: m }), _([m]);
|
|
920
920
|
}
|
|
921
|
-
if (m ===
|
|
922
|
-
return
|
|
921
|
+
if (m === g || m === void 0)
|
|
922
|
+
return _([]);
|
|
923
923
|
const M = S(m);
|
|
924
924
|
if (b === M.options) {
|
|
925
925
|
if (M.operated)
|
|
926
926
|
throw new Error("Cannot return a modified child draft.");
|
|
927
|
-
return
|
|
927
|
+
return _([St(m)]);
|
|
928
928
|
}
|
|
929
|
-
return
|
|
929
|
+
return _([m]);
|
|
930
930
|
};
|
|
931
931
|
return T instanceof Promise ? T.then(A, (m) => {
|
|
932
|
-
throw Ne(S(
|
|
932
|
+
throw Ne(S(g)), m;
|
|
933
933
|
}) : A(T);
|
|
934
934
|
}, Oe = or();
|
|
935
935
|
Object.prototype.constructor.toString();
|
|
@@ -1365,49 +1365,47 @@ class H {
|
|
|
1365
1365
|
getAttr(e) {
|
|
1366
1366
|
return this.attrs[e];
|
|
1367
1367
|
}
|
|
1368
|
-
// XXX: Might be better to create all of the indexes at once as soon as someone
|
|
1369
|
-
// requests one index
|
|
1370
1368
|
get blobAttrs() {
|
|
1371
1369
|
if (this._blobAttrs)
|
|
1372
1370
|
return this._blobAttrs;
|
|
1373
|
-
|
|
1371
|
+
this._blobAttrs = /* @__PURE__ */ new Map();
|
|
1374
1372
|
for (const e of Object.values(this.attrs))
|
|
1375
1373
|
if (dt(e)) {
|
|
1376
1374
|
const [n, r, s] = e["forward-identity"];
|
|
1377
|
-
|
|
1375
|
+
L(this.blobAttrs, [r, s], e);
|
|
1378
1376
|
}
|
|
1379
1377
|
return this._blobAttrs;
|
|
1380
1378
|
}
|
|
1381
1379
|
get primaryKeys() {
|
|
1382
1380
|
if (this._primaryKeys)
|
|
1383
1381
|
return this._primaryKeys;
|
|
1384
|
-
|
|
1382
|
+
this._primaryKeys = /* @__PURE__ */ new Map();
|
|
1385
1383
|
for (const e of Object.values(this.attrs))
|
|
1386
1384
|
if (e["primary?"]) {
|
|
1387
1385
|
const [n, r] = e["forward-identity"];
|
|
1388
|
-
|
|
1386
|
+
L(this._primaryKeys, [r], e);
|
|
1389
1387
|
}
|
|
1390
1388
|
return this._primaryKeys;
|
|
1391
1389
|
}
|
|
1392
1390
|
get forwardIdents() {
|
|
1393
1391
|
if (this._forwardIdents)
|
|
1394
1392
|
return this._forwardIdents;
|
|
1395
|
-
|
|
1393
|
+
this._forwardIdents = /* @__PURE__ */ new Map();
|
|
1396
1394
|
for (const e of Object.values(this.attrs)) {
|
|
1397
1395
|
const n = e["forward-identity"], [r, s, i] = n;
|
|
1398
|
-
|
|
1396
|
+
L(this._forwardIdents, [s, i], e);
|
|
1399
1397
|
}
|
|
1400
1398
|
return this._forwardIdents;
|
|
1401
1399
|
}
|
|
1402
1400
|
get revIdents() {
|
|
1403
1401
|
if (this._revIdents)
|
|
1404
1402
|
return this._revIdents;
|
|
1405
|
-
|
|
1403
|
+
this._revIdents = /* @__PURE__ */ new Map();
|
|
1406
1404
|
for (const e of Object.values(this.attrs)) {
|
|
1407
1405
|
const n = e["reverse-identity"];
|
|
1408
1406
|
if (n) {
|
|
1409
1407
|
const [r, s, i] = n;
|
|
1410
|
-
|
|
1408
|
+
L(this._revIdents, [s, i], e);
|
|
1411
1409
|
}
|
|
1412
1410
|
}
|
|
1413
1411
|
return this._revIdents;
|
|
@@ -1437,15 +1435,15 @@ function K(t, e) {
|
|
|
1437
1435
|
const [n, ...r] = e;
|
|
1438
1436
|
t.has(n) && K(t.get(n), r);
|
|
1439
1437
|
}
|
|
1440
|
-
function
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1438
|
+
function L(t, e, n) {
|
|
1439
|
+
let r = t;
|
|
1440
|
+
const s = e.length - 1;
|
|
1441
|
+
for (let i = 0; i < s; i++) {
|
|
1442
|
+
const o = e[i];
|
|
1443
|
+
let a = r.get(o);
|
|
1444
|
+
a === void 0 && (a = /* @__PURE__ */ new Map(), r.set(o, a)), r = a;
|
|
1445
1445
|
}
|
|
1446
|
-
|
|
1447
|
-
let i = t.get(r);
|
|
1448
|
-
i || (i = /* @__PURE__ */ new Map(), t.set(r, i)), D(i, s, n);
|
|
1446
|
+
s > -1 && r.set(e[s], n);
|
|
1449
1447
|
}
|
|
1450
1448
|
function ln(t, e, n) {
|
|
1451
1449
|
const r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
|
|
@@ -1456,13 +1454,13 @@ function ln(t, e, n) {
|
|
|
1456
1454
|
console.warn("no such attr", c, a);
|
|
1457
1455
|
continue;
|
|
1458
1456
|
}
|
|
1459
|
-
l["checked-data-type"] === "date" && n && (u = Ie(u), o[2] = u), ft(l) &&
|
|
1457
|
+
l["checked-data-type"] === "date" && n && (u = Ie(u), o[2] = u), ft(l) && L(i, [u, c, a], o), L(r, [a, c, u], o), L(s, [c, a, u], o);
|
|
1460
1458
|
}
|
|
1461
1459
|
return { eav: r, aev: s, vae: i };
|
|
1462
1460
|
}
|
|
1463
1461
|
function fn(t) {
|
|
1464
1462
|
return {
|
|
1465
|
-
triples:
|
|
1463
|
+
triples: D(t.eav, 3),
|
|
1466
1464
|
cardinalityInference: t.cardinalityInference,
|
|
1467
1465
|
useDateObjects: t.useDateObjects,
|
|
1468
1466
|
version: 1
|
|
@@ -1500,7 +1498,7 @@ function pe(t, e) {
|
|
|
1500
1498
|
const [o, a] = e[0], c = t.aev.get(o);
|
|
1501
1499
|
if (!c)
|
|
1502
1500
|
return null;
|
|
1503
|
-
n = (s =
|
|
1501
|
+
n = (s = D(c, 2).find((l) => l[2] === a)) == null ? void 0 : s[0];
|
|
1504
1502
|
} else
|
|
1505
1503
|
n = e[0];
|
|
1506
1504
|
if (!n)
|
|
@@ -1510,7 +1508,7 @@ function pe(t, e) {
|
|
|
1510
1508
|
const [o, a] = r, c = t.aev.get(o);
|
|
1511
1509
|
if (!c)
|
|
1512
1510
|
return null;
|
|
1513
|
-
const l = (i =
|
|
1511
|
+
const l = (i = D(c, 2).find((y) => y[2] === a)) == null ? void 0 : i[0];
|
|
1514
1512
|
if (!l)
|
|
1515
1513
|
return null;
|
|
1516
1514
|
const [f, d, h, ...p] = e;
|
|
@@ -1544,7 +1542,7 @@ function bn(t, e, n) {
|
|
|
1544
1542
|
return;
|
|
1545
1543
|
a["checked-data-type"] === "date" && t.useDateObjects && (o = Ie(o));
|
|
1546
1544
|
const c = re(t.eav, [s, i, o]), u = (c == null ? void 0 : c[3]) ?? yn(t, a, r), l = [s, i, o, u];
|
|
1547
|
-
kr(a) ? (
|
|
1545
|
+
kr(a) ? (L(t.eav, [s, i], /* @__PURE__ */ new Map([[o, l]])), L(t.aev, [i, s], /* @__PURE__ */ new Map([[o, l]]))) : (L(t.eav, [s, i, o], l), L(t.aev, [i, s, o], l)), ft(a) && L(t.vae, [o, i, s], l);
|
|
1548
1546
|
}
|
|
1549
1547
|
function Cr(t, e, n) {
|
|
1550
1548
|
var h;
|
|
@@ -1565,7 +1563,7 @@ function Cr(t, e, n) {
|
|
|
1565
1563
|
f,
|
|
1566
1564
|
yn(t, a, u)
|
|
1567
1565
|
];
|
|
1568
|
-
|
|
1566
|
+
L(t.eav, [s, i], /* @__PURE__ */ new Map([[f, d]]));
|
|
1569
1567
|
}
|
|
1570
1568
|
function Qe(t, e, n) {
|
|
1571
1569
|
var u, l;
|
|
@@ -1576,7 +1574,7 @@ function Qe(t, e, n) {
|
|
|
1576
1574
|
if (a) {
|
|
1577
1575
|
for (const f of a.keys()) {
|
|
1578
1576
|
const d = e.getAttr(f);
|
|
1579
|
-
d && d["on-delete-reverse"] === "cascade" &&
|
|
1577
|
+
d && d["on-delete-reverse"] === "cascade" && D(a.get(f), 1).forEach(
|
|
1580
1578
|
([h, p, y]) => {
|
|
1581
1579
|
var b;
|
|
1582
1580
|
return Qe(t, e, [y, (b = d["reverse-identity"]) == null ? void 0 : b[1]]);
|
|
@@ -1589,11 +1587,11 @@ function Qe(t, e, n) {
|
|
|
1589
1587
|
}
|
|
1590
1588
|
a.size === 0 && K(t.eav, [o]);
|
|
1591
1589
|
}
|
|
1592
|
-
const c = t.vae.get(o) &&
|
|
1590
|
+
const c = t.vae.get(o) && D(t.vae.get(o), 2);
|
|
1593
1591
|
c && c.forEach((f) => {
|
|
1594
|
-
var b,
|
|
1592
|
+
var b, g, _;
|
|
1595
1593
|
const [d, h, p] = f, y = e.getAttr(h);
|
|
1596
|
-
(!s || !y || ((b = y["reverse-identity"]) == null ? void 0 : b[1]) === s) && (K(t.eav, [d, h, p]), K(t.aev, [h, d, p]), K(t.vae, [p, h, d])), y && y["on-delete"] === "cascade" && ((
|
|
1594
|
+
(!s || !y || ((b = y["reverse-identity"]) == null ? void 0 : b[1]) === s) && (K(t.eav, [d, h, p]), K(t.aev, [h, d, p]), K(t.vae, [p, h, d])), y && y["on-delete"] === "cascade" && ((g = y["reverse-identity"]) == null ? void 0 : g[1]) === s && Qe(t, e, [d, (_ = y["forward-identity"]) == null ? void 0 : _[1]]);
|
|
1597
1595
|
}), ((l = t.vae.get(o)) == null ? void 0 : l.size) === 0 && K(t.vae, [o]);
|
|
1598
1596
|
}
|
|
1599
1597
|
function _n(t, e, n) {
|
|
@@ -1610,7 +1608,7 @@ function Mr(t, [e]) {
|
|
|
1610
1608
|
t.addAttr(e);
|
|
1611
1609
|
}
|
|
1612
1610
|
function gn(t) {
|
|
1613
|
-
return
|
|
1611
|
+
return D(t.eav, 3);
|
|
1614
1612
|
}
|
|
1615
1613
|
function Pr(t, e, [n]) {
|
|
1616
1614
|
if (!e.getAttr(n)) return;
|
|
@@ -1652,7 +1650,7 @@ function $r(t, e, n) {
|
|
|
1652
1650
|
throw new Error(`unhandled transaction action: ${r}`);
|
|
1653
1651
|
}
|
|
1654
1652
|
}
|
|
1655
|
-
function
|
|
1653
|
+
function D(t, e, n = []) {
|
|
1656
1654
|
if (!t || e === 0)
|
|
1657
1655
|
return n;
|
|
1658
1656
|
if (e === 1) {
|
|
@@ -1661,7 +1659,7 @@ function R(t, e, n = []) {
|
|
|
1661
1659
|
return n;
|
|
1662
1660
|
}
|
|
1663
1661
|
for (const r of t.values())
|
|
1664
|
-
|
|
1662
|
+
D(r, e - 1, n);
|
|
1665
1663
|
return n;
|
|
1666
1664
|
}
|
|
1667
1665
|
function ye(t, e, n) {
|
|
@@ -1689,7 +1687,7 @@ function ye(t, e, n) {
|
|
|
1689
1687
|
return r;
|
|
1690
1688
|
}
|
|
1691
1689
|
if (n != null && n.$comparator)
|
|
1692
|
-
return
|
|
1690
|
+
return D(e, 1).filter(n.$op);
|
|
1693
1691
|
const s = n.in || n.$in || [n];
|
|
1694
1692
|
for (const o of s) {
|
|
1695
1693
|
const a = e.get(o);
|
|
@@ -1706,11 +1704,11 @@ function Rr(t, [e, n, r]) {
|
|
|
1706
1704
|
switch (Dr(e, n, r)) {
|
|
1707
1705
|
case "e": {
|
|
1708
1706
|
const a = t.eav.get(e);
|
|
1709
|
-
return
|
|
1707
|
+
return D(a, 2);
|
|
1710
1708
|
}
|
|
1711
1709
|
case "ea": {
|
|
1712
1710
|
const a = (i = t.eav.get(e)) == null ? void 0 : i.get(n);
|
|
1713
|
-
return
|
|
1711
|
+
return D(a, 1);
|
|
1714
1712
|
}
|
|
1715
1713
|
case "eav": {
|
|
1716
1714
|
const a = (o = t.eav.get(e)) == null ? void 0 : o.get(n);
|
|
@@ -1727,7 +1725,7 @@ function Rr(t, [e, n, r]) {
|
|
|
1727
1725
|
}
|
|
1728
1726
|
case "a": {
|
|
1729
1727
|
const a = t.aev.get(n);
|
|
1730
|
-
return
|
|
1728
|
+
return D(a, 2);
|
|
1731
1729
|
}
|
|
1732
1730
|
case "av": {
|
|
1733
1731
|
const a = t.aev.get(n);
|
|
@@ -1746,7 +1744,7 @@ function Rr(t, [e, n, r]) {
|
|
|
1746
1744
|
return a;
|
|
1747
1745
|
}
|
|
1748
1746
|
default:
|
|
1749
|
-
return
|
|
1747
|
+
return D(t.eav, 3);
|
|
1750
1748
|
}
|
|
1751
1749
|
}
|
|
1752
1750
|
function xr(t, e, n) {
|
|
@@ -1755,7 +1753,7 @@ function xr(t, e, n) {
|
|
|
1755
1753
|
if (!e)
|
|
1756
1754
|
return r;
|
|
1757
1755
|
for (const [i, o] of e.entries()) {
|
|
1758
|
-
const a = (s = t.eav.get(n)) == null ? void 0 : s.get(o.id), c =
|
|
1756
|
+
const a = (s = t.eav.get(n)) == null ? void 0 : s.get(o.id), c = D(a, 1);
|
|
1759
1757
|
for (const u of c)
|
|
1760
1758
|
r[i] = u[2];
|
|
1761
1759
|
}
|
|
@@ -2241,10 +2239,10 @@ function Ss(t, e, n, { etype: r, level: s, form: i }, o) {
|
|
|
2241
2239
|
const a = Object.keys(i).filter((c) => c !== "$");
|
|
2242
2240
|
return a.length ? Object.entries(o).map(function([u, l]) {
|
|
2243
2241
|
return a.map(function(h) {
|
|
2244
|
-
var y, b,
|
|
2245
|
-
const p = !!(e.cardinalityInference && ((
|
|
2242
|
+
var y, b, g;
|
|
2243
|
+
const p = !!(e.cardinalityInference && ((g = (b = (y = n.linkIndex) == null ? void 0 : y[r]) == null ? void 0 : b[h]) != null && g.isSingular));
|
|
2246
2244
|
try {
|
|
2247
|
-
const [
|
|
2245
|
+
const [_, T, A] = ms(
|
|
2248
2246
|
t,
|
|
2249
2247
|
n,
|
|
2250
2248
|
r,
|
|
@@ -2252,16 +2250,16 @@ function Ss(t, e, n, { etype: r, level: s, form: i }, o) {
|
|
|
2252
2250
|
h,
|
|
2253
2251
|
u
|
|
2254
2252
|
), m = vn(e, n, {
|
|
2255
|
-
etype:
|
|
2253
|
+
etype: _,
|
|
2256
2254
|
level: T,
|
|
2257
2255
|
form: i[h],
|
|
2258
2256
|
join: A
|
|
2259
2257
|
}), O = p ? m[0] : m;
|
|
2260
2258
|
return { [h]: O };
|
|
2261
|
-
} catch (
|
|
2262
|
-
if (
|
|
2259
|
+
} catch (_) {
|
|
2260
|
+
if (_ instanceof ne)
|
|
2263
2261
|
return { [h]: p ? void 0 : [] };
|
|
2264
|
-
throw
|
|
2262
|
+
throw _;
|
|
2265
2263
|
}
|
|
2266
2264
|
}).reduce(function(h, p) {
|
|
2267
2265
|
return { ...h, ...p };
|
|
@@ -2323,28 +2321,28 @@ function Cs(t, e, { etype: n, pageInfo: r, dq: s, form: i }) {
|
|
|
2323
2321
|
let u = Br(t, s);
|
|
2324
2322
|
const l = r == null ? void 0 : r["start-cursor"], f = Es(e, n, l, o);
|
|
2325
2323
|
if (f && ((y = f == null ? void 0 : f["forward-identity"]) == null ? void 0 : y[2]) !== "id") {
|
|
2326
|
-
const b = f["checked-data-type"] === "date",
|
|
2327
|
-
u = u.map(([
|
|
2328
|
-
var A, m, O, M,
|
|
2329
|
-
let T = (
|
|
2330
|
-
return b && (T = He(T)), [
|
|
2324
|
+
const b = f["checked-data-type"] === "date", g = f.id;
|
|
2325
|
+
u = u.map(([_]) => {
|
|
2326
|
+
var A, m, O, M, x;
|
|
2327
|
+
let T = (x = (M = (O = (m = (A = t.eav.get(_)) == null ? void 0 : A.get(g)) == null ? void 0 : m.values()) == null ? void 0 : O.next()) == null ? void 0 : M.value) == null ? void 0 : x[2];
|
|
2328
|
+
return b && (T = He(T)), [_, T];
|
|
2331
2329
|
});
|
|
2332
2330
|
}
|
|
2333
2331
|
u.sort(
|
|
2334
|
-
c === "asc" ? function(
|
|
2335
|
-
return ke(_, g, f == null ? void 0 : f["checked-data-type"]);
|
|
2336
|
-
} : function(_, g) {
|
|
2332
|
+
c === "asc" ? function(g, _) {
|
|
2337
2333
|
return ke(g, _, f == null ? void 0 : f["checked-data-type"]);
|
|
2334
|
+
} : function(g, _) {
|
|
2335
|
+
return ke(_, g, f == null ? void 0 : f["checked-data-type"]);
|
|
2338
2336
|
}
|
|
2339
2337
|
);
|
|
2340
2338
|
let d = {};
|
|
2341
2339
|
const h = Is(e, n, s);
|
|
2342
2340
|
for (const b of u) {
|
|
2343
|
-
const [
|
|
2344
|
-
if (d[
|
|
2341
|
+
const [g] = b;
|
|
2342
|
+
if (d[g] || !a && l && f && vs(l, f, c, b))
|
|
2345
2343
|
continue;
|
|
2346
|
-
const
|
|
2347
|
-
|
|
2344
|
+
const _ = xr(t, h, g);
|
|
2345
|
+
_ && (d[g] = _);
|
|
2348
2346
|
}
|
|
2349
2347
|
return d;
|
|
2350
2348
|
}
|
|
@@ -2375,8 +2373,8 @@ function Ps(t, e, { etype: n, level: r, form: s, join: i, pageInfo: o }) {
|
|
|
2375
2373
|
r > 0 && console.warn(
|
|
2376
2374
|
"WARNING: Limits in child queries are only run client-side. Data returned from the server will not have a limit."
|
|
2377
2375
|
);
|
|
2378
|
-
const
|
|
2379
|
-
return
|
|
2376
|
+
const g = Object.entries(l);
|
|
2377
|
+
return g.length <= f ? l : Object.fromEntries(g.slice(0, f));
|
|
2380
2378
|
}
|
|
2381
2379
|
return l;
|
|
2382
2380
|
}
|
|
@@ -2541,7 +2539,7 @@ function Ks(t, e, n) {
|
|
|
2541
2539
|
function Ze(t) {
|
|
2542
2540
|
return typeof t == "string" && !Ee(t) ? null : typeof t == "string" && Ee(t) ? kn(t) : Fs(t);
|
|
2543
2541
|
}
|
|
2544
|
-
function
|
|
2542
|
+
function R(t, e, n) {
|
|
2545
2543
|
const r = Ze(n);
|
|
2546
2544
|
if (r === null)
|
|
2547
2545
|
return n;
|
|
@@ -2552,7 +2550,7 @@ function x(t, e, n) {
|
|
|
2552
2550
|
}
|
|
2553
2551
|
function In(t, e, n, r) {
|
|
2554
2552
|
var o;
|
|
2555
|
-
const s =
|
|
2553
|
+
const s = R(t, e, n);
|
|
2556
2554
|
return Array.isArray(s) ? [[
|
|
2557
2555
|
"add-triple",
|
|
2558
2556
|
s,
|
|
@@ -2565,16 +2563,18 @@ function qs({ attrsStore: t }, [e, n, r]) {
|
|
|
2565
2563
|
const a = Array.isArray(o) ? o : [o], c = E(t, e, i), u = Z(t, e, i);
|
|
2566
2564
|
return a.map((l) => c ? [
|
|
2567
2565
|
"add-triple",
|
|
2568
|
-
|
|
2566
|
+
R(t, e, n),
|
|
2569
2567
|
c.id,
|
|
2570
|
-
//
|
|
2571
|
-
|
|
2568
|
+
// Uses `!` because if we get here, we should have created the attr if it doesn't
|
|
2569
|
+
// already exist
|
|
2570
|
+
R(t, c["reverse-identity"][1], l)
|
|
2572
2571
|
] : [
|
|
2573
2572
|
"add-triple",
|
|
2574
|
-
//
|
|
2575
|
-
|
|
2573
|
+
// Uses `!` because if we get here, we should have created the attr if it doesn't
|
|
2574
|
+
// already exist
|
|
2575
|
+
R(t, u["forward-identity"][1], l),
|
|
2576
2576
|
u == null ? void 0 : u.id,
|
|
2577
|
-
|
|
2577
|
+
R(t, e, n)
|
|
2578
2578
|
]);
|
|
2579
2579
|
});
|
|
2580
2580
|
return In(t, e, n, s);
|
|
@@ -2584,16 +2584,18 @@ function zs({ attrsStore: t }, [e, n, r]) {
|
|
|
2584
2584
|
const a = Array.isArray(o) ? o : [o], c = E(t, e, i), u = Z(t, e, i);
|
|
2585
2585
|
return a.map((l) => c ? [
|
|
2586
2586
|
"retract-triple",
|
|
2587
|
-
|
|
2587
|
+
R(t, e, n),
|
|
2588
2588
|
c.id,
|
|
2589
|
-
//
|
|
2590
|
-
|
|
2589
|
+
// Uses `!` because if we get here, we should have created the attr if it doesn't
|
|
2590
|
+
// already exist
|
|
2591
|
+
R(t, c["reverse-identity"][1], l)
|
|
2591
2592
|
] : [
|
|
2592
2593
|
"retract-triple",
|
|
2593
|
-
//
|
|
2594
|
-
|
|
2594
|
+
// Uses `!` because if we get here, we should have created the attr if it doesn't
|
|
2595
|
+
// already exist
|
|
2596
|
+
R(t, u["forward-identity"][1], l),
|
|
2595
2597
|
u.id,
|
|
2596
|
-
|
|
2598
|
+
R(t, e, n)
|
|
2597
2599
|
]);
|
|
2598
2600
|
});
|
|
2599
2601
|
return In(t, e, n, s);
|
|
@@ -2605,7 +2607,7 @@ function Vs(t, e, n, r) {
|
|
|
2605
2607
|
for (const a of t || []) {
|
|
2606
2608
|
const c = a == null ? void 0 : a.aev.get(i);
|
|
2607
2609
|
if (c) {
|
|
2608
|
-
for (const [u, l, f] of
|
|
2610
|
+
for (const [u, l, f] of D(c, 2))
|
|
2609
2611
|
if (f === o)
|
|
2610
2612
|
return !0;
|
|
2611
2613
|
}
|
|
@@ -2625,14 +2627,14 @@ function Cn({ stores: t, attrsStore: e }, [n, r, s, i]) {
|
|
|
2625
2627
|
return (i == null ? void 0 : i.upsert) === !1 ? { mode: "update" } : (i == null ? void 0 : i.upsert) === !0 ? null : Vs(t, e, n, r) ? { mode: "update" } : null;
|
|
2626
2628
|
}
|
|
2627
2629
|
function Ws(t, e) {
|
|
2628
|
-
const { attrsStore: n } = t, [r, s, i, o] = e, a = lt(i), c =
|
|
2630
|
+
const { attrsStore: n } = t, [r, s, i, o] = e, a = lt(i), c = R(n, r, s);
|
|
2629
2631
|
return [["id", c]].concat(Object.entries(a)).map(([l, f]) => {
|
|
2630
2632
|
const d = E(n, r, l);
|
|
2631
2633
|
return d["checked-data-type"] === "date" && t.useDateObjects && (f = Ie(f)), ["add-triple", c, d.id, f, { mode: "create" }];
|
|
2632
2634
|
});
|
|
2633
2635
|
}
|
|
2634
2636
|
function Qs(t, e) {
|
|
2635
|
-
const { attrsStore: n } = t, [r, s, i, o] = e, a = lt(i), c =
|
|
2637
|
+
const { attrsStore: n } = t, [r, s, i, o] = e, a = lt(i), c = R(n, r, s), u = Cn(t, [r, c, i, o]);
|
|
2636
2638
|
return [["id", c]].concat(Object.entries(a)).map(([f, d]) => {
|
|
2637
2639
|
const h = E(n, r, f);
|
|
2638
2640
|
return h["checked-data-type"] === "date" && t.useDateObjects && (d = Ie(d)), [
|
|
@@ -2645,10 +2647,10 @@ function Qs(t, e) {
|
|
|
2645
2647
|
});
|
|
2646
2648
|
}
|
|
2647
2649
|
function Gs({ attrsStore: t }, [e, n]) {
|
|
2648
|
-
return [["delete-entity",
|
|
2650
|
+
return [["delete-entity", R(t, e, n), e]];
|
|
2649
2651
|
}
|
|
2650
2652
|
function Bs(t, e) {
|
|
2651
|
-
const { attrsStore: n } = t, [r, s, i, o] = e, a = lt(i), c =
|
|
2653
|
+
const { attrsStore: n } = t, [r, s, i, o] = e, a = lt(i), c = R(n, r, s), u = Cn(t, [r, c, i, o]), l = Object.entries(a).map(([d, h]) => {
|
|
2652
2654
|
const p = E(n, r, d);
|
|
2653
2655
|
return [
|
|
2654
2656
|
"deep-merge-triple",
|
|
@@ -2667,7 +2669,7 @@ function Bs(t, e) {
|
|
|
2667
2669
|
]].concat(l);
|
|
2668
2670
|
}
|
|
2669
2671
|
function Hs({ attrsStore: t }, [e, n, r]) {
|
|
2670
|
-
return [["rule-params",
|
|
2672
|
+
return [["rule-params", R(t, e, n), e, r]];
|
|
2671
2673
|
}
|
|
2672
2674
|
function Js(t) {
|
|
2673
2675
|
const [e, n, r, s, i] = t;
|
|
@@ -2812,8 +2814,8 @@ function ci({ attrsStore: t, schema: e }, n) {
|
|
|
2812
2814
|
function a(p, y) {
|
|
2813
2815
|
return Z(t, p, y) || s.find(
|
|
2814
2816
|
(b) => {
|
|
2815
|
-
var
|
|
2816
|
-
return ((
|
|
2817
|
+
var g, _;
|
|
2818
|
+
return ((g = b["reverse-identity"]) == null ? void 0 : g[1]) === p && ((_ = b["reverse-identity"]) == null ? void 0 : _[2]) === y;
|
|
2817
2819
|
}
|
|
2818
2820
|
);
|
|
2819
2821
|
}
|
|
@@ -2829,38 +2831,38 @@ function ci({ attrsStore: t, schema: e }, n) {
|
|
|
2829
2831
|
!o(p, y);
|
|
2830
2832
|
}
|
|
2831
2833
|
function f(p, y) {
|
|
2832
|
-
const b = o(p, y),
|
|
2833
|
-
u(b), u(
|
|
2834
|
+
const b = o(p, y), g = a(p, y);
|
|
2835
|
+
u(b), u(g), !b && !g && c($t(e, p, y, oi));
|
|
2834
2836
|
}
|
|
2835
2837
|
for (const p of n)
|
|
2836
|
-
for (const { etype: y, lookupPair: b, linkLabel:
|
|
2837
|
-
const
|
|
2838
|
-
if (
|
|
2839
|
-
f(y,
|
|
2840
|
-
const T = o(y,
|
|
2838
|
+
for (const { etype: y, lookupPair: b, linkLabel: g } of ai(p)) {
|
|
2839
|
+
const _ = b[0];
|
|
2840
|
+
if (g) {
|
|
2841
|
+
f(y, g);
|
|
2842
|
+
const T = o(y, g), A = a(y, g);
|
|
2841
2843
|
u(T), u(A);
|
|
2842
|
-
const m = ((d = T == null ? void 0 : T["reverse-identity"]) == null ? void 0 : d[1]) || ((h = A == null ? void 0 : A["forward-identity"]) == null ? void 0 : h[1]) ||
|
|
2843
|
-
if (l(m,
|
|
2844
|
-
f(m, Ye(
|
|
2844
|
+
const m = ((d = T == null ? void 0 : T["reverse-identity"]) == null ? void 0 : d[1]) || ((h = A == null ? void 0 : A["forward-identity"]) == null ? void 0 : h[1]) || g;
|
|
2845
|
+
if (l(m, _))
|
|
2846
|
+
f(m, Ye(_));
|
|
2845
2847
|
else {
|
|
2846
|
-
const O = o(m,
|
|
2848
|
+
const O = o(m, _);
|
|
2847
2849
|
O || c(
|
|
2848
|
-
be(e, m,
|
|
2850
|
+
be(e, m, _, Xe)
|
|
2849
2851
|
), u(O);
|
|
2850
2852
|
}
|
|
2851
|
-
} else if (l(y,
|
|
2852
|
-
f(y, Ye(
|
|
2853
|
+
} else if (l(y, _))
|
|
2854
|
+
f(y, Ye(_));
|
|
2853
2855
|
else {
|
|
2854
|
-
const T = o(y,
|
|
2855
|
-
T || c(be(e, y,
|
|
2856
|
+
const T = o(y, _);
|
|
2857
|
+
T || c(be(e, y, _, Xe)), u(T);
|
|
2856
2858
|
}
|
|
2857
2859
|
}
|
|
2858
2860
|
for (const p of n) {
|
|
2859
|
-
const [y, b,
|
|
2861
|
+
const [y, b, g, _] = p;
|
|
2860
2862
|
if (ni.has(y)) {
|
|
2861
2863
|
const T = o(b, "id");
|
|
2862
2864
|
u(T), T || c(be(e, b, "id", { "unique?": !0 }));
|
|
2863
|
-
for (const A of Object.keys(
|
|
2865
|
+
for (const A of Object.keys(_)) {
|
|
2864
2866
|
const m = o(b, A);
|
|
2865
2867
|
if (u(m), si.has(y) && (m || c(
|
|
2866
2868
|
be(
|
|
@@ -3159,12 +3161,12 @@ async function yi(t, e, n) {
|
|
|
3159
3161
|
for (const [h, p] of Object.entries(r)) {
|
|
3160
3162
|
const y = typeof p == "string" ? JSON.parse(p) : p;
|
|
3161
3163
|
if (y.lastAccessed) {
|
|
3162
|
-
const
|
|
3164
|
+
const g = {
|
|
3163
3165
|
createdAt: y.lastAccessed,
|
|
3164
3166
|
updatedAt: y.lastAccessed,
|
|
3165
3167
|
size: ((d = (f = (l = y.result) == null ? void 0 : l.store) == null ? void 0 : f.triples) == null ? void 0 : d.length) ?? 0
|
|
3166
3168
|
};
|
|
3167
|
-
a[h] =
|
|
3169
|
+
a[h] = g;
|
|
3168
3170
|
}
|
|
3169
3171
|
const b = n.put(y, h);
|
|
3170
3172
|
s.add(b);
|
|
@@ -3198,8 +3200,8 @@ async function bi(t, e) {
|
|
|
3198
3200
|
p.onsuccess = () => {
|
|
3199
3201
|
const b = p.result;
|
|
3200
3202
|
if (b) {
|
|
3201
|
-
const
|
|
3202
|
-
y.push([
|
|
3203
|
+
const g = b.key, _ = b.value;
|
|
3204
|
+
y.push([g, _]), b.continue();
|
|
3203
3205
|
} else
|
|
3204
3206
|
l(y);
|
|
3205
3207
|
}, p.onerror = (b) => {
|
|
@@ -3637,7 +3639,7 @@ function Kt(t) {
|
|
|
3637
3639
|
}, e;
|
|
3638
3640
|
}, {});
|
|
3639
3641
|
}
|
|
3640
|
-
const Rn = "v0.22.86-experimental.split-store.
|
|
3642
|
+
const Rn = "v0.22.86-experimental.split-store.20247643606.1";
|
|
3641
3643
|
function Mi(t, e) {
|
|
3642
3644
|
return {
|
|
3643
3645
|
info: t ? (...n) => console.info(...n, e()) : () => {
|
|
@@ -4645,8 +4647,8 @@ class Bi {
|
|
|
4645
4647
|
i.txId = a["tx-id"];
|
|
4646
4648
|
const c = [], u = {};
|
|
4647
4649
|
for (const b of a.changes) {
|
|
4648
|
-
const
|
|
4649
|
-
u[b.triple[0]] =
|
|
4650
|
+
const g = u[b.triple[0]] ?? [];
|
|
4651
|
+
u[b.triple[0]] = g, g.push(b);
|
|
4650
4652
|
}
|
|
4651
4653
|
const l = s.values ?? {
|
|
4652
4654
|
entities: [],
|
|
@@ -4654,43 +4656,43 @@ class Bi {
|
|
|
4654
4656
|
}, f = l.entities;
|
|
4655
4657
|
s.values = l;
|
|
4656
4658
|
const d = [];
|
|
4657
|
-
e: for (const [b,
|
|
4658
|
-
for (let
|
|
4659
|
-
const T = f[
|
|
4659
|
+
e: for (const [b, g] of Object.entries(u))
|
|
4660
|
+
for (let _ = 0; _ < f.length; _++) {
|
|
4661
|
+
const T = f[_];
|
|
4660
4662
|
if (Er(T.store, b)) {
|
|
4661
|
-
Bt(T.store, l.attrsStore,
|
|
4663
|
+
Bt(T.store, l.attrsStore, g);
|
|
4662
4664
|
const A = Le(s, T.store, l.attrsStore), m = Vi(
|
|
4663
4665
|
T.store,
|
|
4664
4666
|
l.attrsStore,
|
|
4665
|
-
|
|
4667
|
+
g
|
|
4666
4668
|
)[b];
|
|
4667
4669
|
A ? (d.push({
|
|
4668
4670
|
oldEntity: T.entity,
|
|
4669
4671
|
newEntity: A,
|
|
4670
4672
|
changedFields: m || {}
|
|
4671
|
-
}), T.entity = A) : c.push(
|
|
4673
|
+
}), T.entity = A) : c.push(_), delete u[b];
|
|
4672
4674
|
continue e;
|
|
4673
4675
|
}
|
|
4674
4676
|
}
|
|
4675
4677
|
const h = [];
|
|
4676
|
-
for (const [b,
|
|
4677
|
-
const
|
|
4678
|
-
Bt(
|
|
4679
|
-
const T = Le(s,
|
|
4678
|
+
for (const [b, g] of Object.entries(u)) {
|
|
4679
|
+
const _ = this.createStore([]);
|
|
4680
|
+
Bt(_, l.attrsStore, g);
|
|
4681
|
+
const T = Le(s, _, l.attrsStore);
|
|
4680
4682
|
if (!T) {
|
|
4681
4683
|
this.log.error("No entity found after applying change", {
|
|
4682
4684
|
sub: s,
|
|
4683
|
-
changes:
|
|
4684
|
-
store:
|
|
4685
|
+
changes: g,
|
|
4686
|
+
store: _
|
|
4685
4687
|
});
|
|
4686
4688
|
continue;
|
|
4687
4689
|
}
|
|
4688
4690
|
f.push({
|
|
4689
|
-
store:
|
|
4691
|
+
store: _,
|
|
4690
4692
|
entity: T,
|
|
4691
4693
|
serverCreatedAt: Gt(
|
|
4692
4694
|
s,
|
|
4693
|
-
|
|
4695
|
+
_,
|
|
4694
4696
|
l.attrsStore,
|
|
4695
4697
|
T.id
|
|
4696
4698
|
)
|
|
@@ -5248,20 +5250,20 @@ class oo {
|
|
|
5248
5250
|
const { q: d, result: h } = n, p = P(d);
|
|
5249
5251
|
if (!this._hasQueryListeners() && !this.querySubs.currentValue[p])
|
|
5250
5252
|
break;
|
|
5251
|
-
const y = (a = (o = h == null ? void 0 : h[0]) == null ? void 0 : o.data) == null ? void 0 : a["page-info"], b = (u = (c = h == null ? void 0 : h[0]) == null ? void 0 : c.data) == null ? void 0 : u.aggregate,
|
|
5252
|
-
this.ensureAttrs(),
|
|
5253
|
+
const y = (a = (o = h == null ? void 0 : h[0]) == null ? void 0 : o.data) == null ? void 0 : a["page-info"], b = (u = (c = h == null ? void 0 : h[0]) == null ? void 0 : c.data) == null ? void 0 : u.aggregate, g = Nt(h), _ = this.ensureAttrs(), T = Se(
|
|
5253
5254
|
_,
|
|
5255
|
+
g,
|
|
5254
5256
|
r,
|
|
5255
5257
|
this.config.useDateObjects
|
|
5256
5258
|
);
|
|
5257
|
-
this.querySubs.updateInPlace((
|
|
5258
|
-
if (!
|
|
5259
|
+
this.querySubs.updateInPlace((A) => {
|
|
5260
|
+
if (!A[p]) {
|
|
5259
5261
|
this._log.info("Missing value in querySubs", { hash: p, q: d });
|
|
5260
5262
|
return;
|
|
5261
5263
|
}
|
|
5262
|
-
|
|
5263
|
-
store:
|
|
5264
|
-
attrsStore:
|
|
5264
|
+
A[p].result = {
|
|
5265
|
+
store: T,
|
|
5266
|
+
attrsStore: _,
|
|
5265
5267
|
pageInfo: y,
|
|
5266
5268
|
aggregate: b,
|
|
5267
5269
|
processedTxId: n["processed-tx-id"]
|
|
@@ -5293,18 +5295,18 @@ class oo {
|
|
|
5293
5295
|
this._pendingMutations(),
|
|
5294
5296
|
p
|
|
5295
5297
|
);
|
|
5296
|
-
y !== this._pendingMutations() && this.kv.updateInPlace((
|
|
5297
|
-
|
|
5298
|
+
y !== this._pendingMutations() && this.kv.updateInPlace((_) => {
|
|
5299
|
+
_.pendingMutations = y;
|
|
5298
5300
|
});
|
|
5299
|
-
const b = Jt(y.entries()),
|
|
5301
|
+
const b = Jt(y.entries()), g = d.map((_) => {
|
|
5300
5302
|
var yt, bt, _t, gt;
|
|
5301
|
-
const T =
|
|
5303
|
+
const T = _["instaql-query"], A = _["instaql-result"], m = P(T), O = Nt(A), M = this.ensureAttrs(), x = Se(
|
|
5302
5304
|
M,
|
|
5303
5305
|
O,
|
|
5304
5306
|
r,
|
|
5305
5307
|
this.config.useDateObjects
|
|
5306
5308
|
), { store: $e, attrsStore: zn } = this._applyOptimisticUpdates(
|
|
5307
|
-
|
|
5309
|
+
x,
|
|
5308
5310
|
M,
|
|
5309
5311
|
b,
|
|
5310
5312
|
p
|
|
@@ -5318,14 +5320,14 @@ class oo {
|
|
|
5318
5320
|
aggregate: Wn
|
|
5319
5321
|
};
|
|
5320
5322
|
});
|
|
5321
|
-
|
|
5322
|
-
({ hash:
|
|
5323
|
-
this.querySubs.updateInPlace((
|
|
5324
|
-
if (!
|
|
5325
|
-
this._log.error("Missing value in querySubs", { hash:
|
|
5323
|
+
g.forEach(
|
|
5324
|
+
({ hash: _, q: T, store: A, attrsStore: m, pageInfo: O, aggregate: M }) => {
|
|
5325
|
+
this.querySubs.updateInPlace((x) => {
|
|
5326
|
+
if (!x[_]) {
|
|
5327
|
+
this._log.error("Missing value in querySubs", { hash: _, q: T });
|
|
5326
5328
|
return;
|
|
5327
5329
|
}
|
|
5328
|
-
|
|
5330
|
+
x[_].result = {
|
|
5329
5331
|
store: A,
|
|
5330
5332
|
attrsStore: m,
|
|
5331
5333
|
pageInfo: O,
|
|
@@ -5334,8 +5336,8 @@ class oo {
|
|
|
5334
5336
|
};
|
|
5335
5337
|
});
|
|
5336
5338
|
}
|
|
5337
|
-
), this._cleanupPendingMutationsQueries(),
|
|
5338
|
-
this.notifyOne(
|
|
5339
|
+
), this._cleanupPendingMutationsQueries(), g.forEach(({ hash: _ }) => {
|
|
5340
|
+
this.notifyOne(_);
|
|
5339
5341
|
});
|
|
5340
5342
|
break;
|
|
5341
5343
|
}
|
|
@@ -5348,22 +5350,22 @@ class oo {
|
|
|
5348
5350
|
).get(d);
|
|
5349
5351
|
if (!y)
|
|
5350
5352
|
break;
|
|
5351
|
-
this._updatePendingMutations((
|
|
5352
|
-
|
|
5353
|
-
...
|
|
5353
|
+
this._updatePendingMutations((g) => {
|
|
5354
|
+
g.set(d, {
|
|
5355
|
+
...g.get(d),
|
|
5354
5356
|
"tx-id": h,
|
|
5355
5357
|
confirmed: Date.now()
|
|
5356
5358
|
});
|
|
5357
5359
|
});
|
|
5358
5360
|
const b = [];
|
|
5359
|
-
for (const
|
|
5360
|
-
if (
|
|
5361
|
-
const
|
|
5362
|
-
b.push(
|
|
5361
|
+
for (const g of y["tx-steps"])
|
|
5362
|
+
if (g[0] === "add-attr") {
|
|
5363
|
+
const _ = g[1];
|
|
5364
|
+
b.push(_);
|
|
5363
5365
|
}
|
|
5364
5366
|
if (b.length) {
|
|
5365
|
-
const
|
|
5366
|
-
this._setAttrs([...
|
|
5367
|
+
const g = Object.values(this.ensureAttrs());
|
|
5368
|
+
this._setAttrs([...g, ...b]), this._setAttrs(b);
|
|
5367
5369
|
}
|
|
5368
5370
|
this._finishTransaction("synced", d), this._cleanupPendingMutationsTimeout();
|
|
5369
5371
|
break;
|
|
@@ -5578,15 +5580,15 @@ class oo {
|
|
|
5578
5580
|
for (const h of l) {
|
|
5579
5581
|
const [p] = h;
|
|
5580
5582
|
if (p === "add-attr") {
|
|
5581
|
-
const [b,
|
|
5582
|
-
if (
|
|
5583
|
-
o.attrIdMap[
|
|
5583
|
+
const [b, g] = h, _ = s(g);
|
|
5584
|
+
if (_ && g.id !== _.id) {
|
|
5585
|
+
o.attrIdMap[g.id] = _.id, a = !0;
|
|
5584
5586
|
continue;
|
|
5585
5587
|
}
|
|
5586
|
-
if (
|
|
5587
|
-
const T = i(
|
|
5588
|
+
if (g["value-type"] === "ref") {
|
|
5589
|
+
const T = i(g);
|
|
5588
5590
|
if (T) {
|
|
5589
|
-
o.attrIdMap[
|
|
5591
|
+
o.attrIdMap[g.id] = T.id, o.refSwapAttrIds.add(g.id), a = !0;
|
|
5590
5592
|
continue;
|
|
5591
5593
|
}
|
|
5592
5594
|
}
|
|
@@ -5650,9 +5652,9 @@ class oo {
|
|
|
5650
5652
|
const { store: l, attrsStore: f, pageInfo: d, aggregate: h, processedTxId: p } = c, y = this._rewriteMutationsSorted(
|
|
5651
5653
|
f,
|
|
5652
5654
|
o
|
|
5653
|
-
), { store: b, attrsStore:
|
|
5655
|
+
), { store: b, attrsStore: g } = this._applyOptimisticUpdates(l, f, y, p);
|
|
5654
5656
|
return { data: On(
|
|
5655
|
-
{ store: b, attrsStore:
|
|
5657
|
+
{ store: b, attrsStore: g, pageInfo: d, aggregate: h },
|
|
5656
5658
|
a
|
|
5657
5659
|
), querySubVersion: r, pendingMutationsVersion: i };
|
|
5658
5660
|
}
|