@instantdb/core 0.22.86-experimental.split-store.20243647937.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 +0 -6
- 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 +0 -6
- package/dist/esm/store.js.map +1 -1
- package/dist/standalone/index.js +127 -125
- 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 +0 -6
package/dist/standalone/index.js
CHANGED
|
@@ -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);
|
|
@@ -889,22 +889,22 @@ 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
909
|
const x = m == null ? void 0 : m[Bn];
|
|
910
910
|
if (x) {
|
|
@@ -913,23 +913,23 @@ const or = (t) => function e(n, r, s) {
|
|
|
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,12 +1365,10 @@ 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"];
|
|
@@ -1381,7 +1379,7 @@ class H {
|
|
|
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"];
|
|
@@ -1392,7 +1390,7 @@ class H {
|
|
|
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);
|
|
@@ -1402,7 +1400,7 @@ class H {
|
|
|
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) {
|
|
@@ -1591,9 +1589,9 @@ function Qe(t, e, n) {
|
|
|
1591
1589
|
}
|
|
1592
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) {
|
|
@@ -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(([
|
|
2324
|
+
const b = f["checked-data-type"] === "date", g = f.id;
|
|
2325
|
+
u = u.map(([_]) => {
|
|
2328
2326
|
var A, m, O, M, x;
|
|
2329
|
-
let T = (x = (M = (O = (m = (A = t.eav.get(
|
|
2330
|
-
return b && (T = He(T)), [
|
|
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
|
}
|
|
@@ -2567,11 +2565,13 @@ function qs({ attrsStore: t }, [e, n, r]) {
|
|
|
2567
2565
|
"add-triple",
|
|
2568
2566
|
R(t, e, n),
|
|
2569
2567
|
c.id,
|
|
2570
|
-
//
|
|
2568
|
+
// Uses `!` because if we get here, we should have created the attr if it doesn't
|
|
2569
|
+
// already exist
|
|
2571
2570
|
R(t, c["reverse-identity"][1], l)
|
|
2572
2571
|
] : [
|
|
2573
2572
|
"add-triple",
|
|
2574
|
-
//
|
|
2573
|
+
// Uses `!` because if we get here, we should have created the attr if it doesn't
|
|
2574
|
+
// already exist
|
|
2575
2575
|
R(t, u["forward-identity"][1], l),
|
|
2576
2576
|
u == null ? void 0 : u.id,
|
|
2577
2577
|
R(t, e, n)
|
|
@@ -2586,11 +2586,13 @@ function zs({ attrsStore: t }, [e, n, r]) {
|
|
|
2586
2586
|
"retract-triple",
|
|
2587
2587
|
R(t, e, n),
|
|
2588
2588
|
c.id,
|
|
2589
|
-
//
|
|
2589
|
+
// Uses `!` because if we get here, we should have created the attr if it doesn't
|
|
2590
|
+
// already exist
|
|
2590
2591
|
R(t, c["reverse-identity"][1], l)
|
|
2591
2592
|
] : [
|
|
2592
2593
|
"retract-triple",
|
|
2593
|
-
//
|
|
2594
|
+
// Uses `!` because if we get here, we should have created the attr if it doesn't
|
|
2595
|
+
// already exist
|
|
2594
2596
|
R(t, u["forward-identity"][1], l),
|
|
2595
2597
|
u.id,
|
|
2596
2598
|
R(t, e, n)
|
|
@@ -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,12 +5295,12 @@ 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,
|
|
@@ -5318,14 +5320,14 @@ class oo {
|
|
|
5318
5320
|
aggregate: Wn
|
|
5319
5321
|
};
|
|
5320
5322
|
});
|
|
5321
|
-
|
|
5322
|
-
({ hash:
|
|
5323
|
+
g.forEach(
|
|
5324
|
+
({ hash: _, q: T, store: A, attrsStore: m, pageInfo: O, aggregate: M }) => {
|
|
5323
5325
|
this.querySubs.updateInPlace((x) => {
|
|
5324
|
-
if (!x[
|
|
5325
|
-
this._log.error("Missing value in querySubs", { hash:
|
|
5326
|
+
if (!x[_]) {
|
|
5327
|
+
this._log.error("Missing value in querySubs", { hash: _, q: T });
|
|
5326
5328
|
return;
|
|
5327
5329
|
}
|
|
5328
|
-
x[
|
|
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
|
}
|