@instantdb/core 1.0.63-branch-codex-indexeddb-explicit-commit.31419272329.1 → 1.0.63-branch-codex-indexeddb-explicit-commit.31419410889.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/__tests__/src/utils/PersistedObject.test.ts +0 -36
- package/dist/commonjs/IndexedDBStorage.d.ts.map +1 -1
- package/dist/commonjs/IndexedDBStorage.js +6 -7
- package/dist/commonjs/IndexedDBStorage.js.map +1 -1
- package/dist/esm/IndexedDBStorage.d.ts.map +1 -1
- package/dist/esm/IndexedDBStorage.js +6 -7
- package/dist/esm/IndexedDBStorage.js.map +1 -1
- package/dist/standalone/index.js +257 -257
- package/dist/standalone/index.umd.cjs +3 -3
- package/package.json +2 -2
- package/src/IndexedDBStorage.ts +6 -7
package/dist/standalone/index.js
CHANGED
|
@@ -783,15 +783,15 @@ function Ut(n) {
|
|
|
783
783
|
if (s.revoke.push(u), Pn.add(c), a.proxy = c, t) {
|
|
784
784
|
const l = t;
|
|
785
785
|
l.finalities.draft.push((f, d) => {
|
|
786
|
-
var h,
|
|
787
|
-
const
|
|
788
|
-
let
|
|
789
|
-
const
|
|
790
|
-
if (
|
|
791
|
-
let A =
|
|
792
|
-
|
|
786
|
+
var h, p;
|
|
787
|
+
const m = I(c);
|
|
788
|
+
let b = l.type === 3 ? l.setMap : l.copy;
|
|
789
|
+
const y = de(b, r), g = I(y);
|
|
790
|
+
if (g) {
|
|
791
|
+
let A = g.original;
|
|
792
|
+
g.operated && (A = xt(y)), pt(g), yt(g, Re, f, d), l.options.enableAutoFreeze && (l.options.updatedValues = (h = l.options.updatedValues) !== null && h !== void 0 ? h : /* @__PURE__ */ new WeakMap(), l.options.updatedValues.set(A, g.original)), De(b, r, A);
|
|
793
793
|
}
|
|
794
|
-
(
|
|
794
|
+
(p = m.callbacks) === null || p === void 0 || p.forEach((A) => {
|
|
795
795
|
A(f, d);
|
|
796
796
|
});
|
|
797
797
|
});
|
|
@@ -911,55 +911,55 @@ const jr = (n) => function e(t, r, s) {
|
|
|
911
911
|
if (O)
|
|
912
912
|
return O;
|
|
913
913
|
}
|
|
914
|
-
}) : l.mark, h = (i = l.enablePatches) !== null && i !== void 0 ? i : !1,
|
|
914
|
+
}) : l.mark, h = (i = l.enablePatches) !== null && i !== void 0 ? i : !1, p = (o = l.strict) !== null && o !== void 0 ? o : !1, b = {
|
|
915
915
|
enableAutoFreeze: (a = l.enableAutoFreeze) !== null && a !== void 0 ? a : !1,
|
|
916
916
|
mark: d,
|
|
917
|
-
strict:
|
|
917
|
+
strict: p,
|
|
918
918
|
enablePatches: h
|
|
919
919
|
};
|
|
920
|
-
if (!ie(f,
|
|
920
|
+
if (!ie(f, b) && typeof f == "object" && f !== null)
|
|
921
921
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
922
|
-
const [
|
|
922
|
+
const [y, g] = Pr(f, b);
|
|
923
923
|
if (typeof r != "function") {
|
|
924
|
-
if (!ie(f,
|
|
924
|
+
if (!ie(f, b))
|
|
925
925
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
926
|
-
return [
|
|
926
|
+
return [y, g];
|
|
927
927
|
}
|
|
928
928
|
let A;
|
|
929
929
|
try {
|
|
930
|
-
A = u(
|
|
930
|
+
A = u(y);
|
|
931
931
|
} catch (k) {
|
|
932
|
-
throw ht(I(
|
|
932
|
+
throw ht(I(y)), k;
|
|
933
933
|
}
|
|
934
934
|
const R = (k) => {
|
|
935
|
-
const N = I(
|
|
935
|
+
const N = I(y);
|
|
936
936
|
if (!ye(k)) {
|
|
937
|
-
if (k !== void 0 && !le(k,
|
|
937
|
+
if (k !== void 0 && !le(k, y) && N?.operated)
|
|
938
938
|
throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");
|
|
939
939
|
const O = k?.[_r];
|
|
940
940
|
if (O) {
|
|
941
941
|
const q = O[0];
|
|
942
|
-
return
|
|
942
|
+
return b.strict && typeof k == "object" && k !== null && gt({
|
|
943
943
|
rootDraft: N,
|
|
944
944
|
value: k,
|
|
945
945
|
useRawReturn: !0
|
|
946
|
-
}),
|
|
946
|
+
}), g([q]);
|
|
947
947
|
}
|
|
948
948
|
if (k !== void 0)
|
|
949
|
-
return typeof k == "object" && k !== null && gt({ rootDraft: N, value: k }),
|
|
949
|
+
return typeof k == "object" && k !== null && gt({ rootDraft: N, value: k }), g([k]);
|
|
950
950
|
}
|
|
951
|
-
if (k ===
|
|
952
|
-
return
|
|
951
|
+
if (k === y || k === void 0)
|
|
952
|
+
return g([]);
|
|
953
953
|
const C = I(k);
|
|
954
|
-
if (
|
|
954
|
+
if (b === C.options) {
|
|
955
955
|
if (C.operated)
|
|
956
956
|
throw new Error("Cannot return a modified child draft.");
|
|
957
|
-
return
|
|
957
|
+
return g([Bt(k)]);
|
|
958
958
|
}
|
|
959
|
-
return
|
|
959
|
+
return g([k]);
|
|
960
960
|
};
|
|
961
961
|
return A instanceof Promise ? A.then(R, (k) => {
|
|
962
|
-
throw ht(I(
|
|
962
|
+
throw ht(I(y)), k;
|
|
963
963
|
}) : R(A);
|
|
964
964
|
}, Ye = jr();
|
|
965
965
|
Object.prototype.constructor.toString();
|
|
@@ -1291,8 +1291,8 @@ function Vr(n) {
|
|
|
1291
1291
|
const [, r, s, i, o, a, c, u, l] = t, f = s.padStart(2, "0"), d = i.padStart(2, "0");
|
|
1292
1292
|
let h = a.padStart(2, "0");
|
|
1293
1293
|
c !== void 0 && (h += `:${c.padStart(2, "0")}`), u !== void 0 && (h += `:${u.padStart(2, "0")}`);
|
|
1294
|
-
const
|
|
1295
|
-
return new Date(
|
|
1294
|
+
const p = `${r}-${f}-${d}T${h}${l}`;
|
|
1295
|
+
return new Date(p);
|
|
1296
1296
|
}
|
|
1297
1297
|
return null;
|
|
1298
1298
|
}
|
|
@@ -2127,14 +2127,14 @@ function Ls(n, e, t, r, s, i) {
|
|
|
2127
2127
|
function Ns(n, e, t, r, s) {
|
|
2128
2128
|
const [i, o, a] = s.reduce(
|
|
2129
2129
|
(c, u) => {
|
|
2130
|
-
const [l, f, d] = c, [h,
|
|
2130
|
+
const [l, f, d] = c, [h, p, m] = Hn(
|
|
2131
2131
|
n,
|
|
2132
2132
|
e,
|
|
2133
2133
|
l,
|
|
2134
2134
|
f,
|
|
2135
2135
|
u
|
|
2136
2136
|
);
|
|
2137
|
-
return [h,
|
|
2137
|
+
return [h, p, [...d, m]];
|
|
2138
2138
|
},
|
|
2139
2139
|
[t, r, []]
|
|
2140
2140
|
);
|
|
@@ -2262,29 +2262,29 @@ function Gs(n, e, t, { etype: r, level: s, form: i }, o) {
|
|
|
2262
2262
|
const a = Object.keys(i).filter((c) => c !== "$");
|
|
2263
2263
|
return a.length ? Object.entries(o).map(function([u, l]) {
|
|
2264
2264
|
return a.map(function(h) {
|
|
2265
|
-
const
|
|
2265
|
+
const p = !!(e.cardinalityInference && t.linkIndex?.[r]?.[h]?.isSingular);
|
|
2266
2266
|
try {
|
|
2267
|
-
const [
|
|
2267
|
+
const [m, b, y] = Bs(
|
|
2268
2268
|
n,
|
|
2269
2269
|
t,
|
|
2270
2270
|
r,
|
|
2271
2271
|
s,
|
|
2272
2272
|
h,
|
|
2273
2273
|
u
|
|
2274
|
-
),
|
|
2275
|
-
etype:
|
|
2276
|
-
level:
|
|
2274
|
+
), g = Xn(e, t, {
|
|
2275
|
+
etype: m,
|
|
2276
|
+
level: b,
|
|
2277
2277
|
form: i[h],
|
|
2278
|
-
join:
|
|
2279
|
-
}), A =
|
|
2278
|
+
join: y
|
|
2279
|
+
}), A = p ? g[0] : g;
|
|
2280
2280
|
return { [h]: A };
|
|
2281
|
-
} catch (
|
|
2282
|
-
if (
|
|
2283
|
-
return { [h]:
|
|
2284
|
-
throw
|
|
2281
|
+
} catch (m) {
|
|
2282
|
+
if (m instanceof Oe)
|
|
2283
|
+
return { [h]: p ? void 0 : [] };
|
|
2284
|
+
throw m;
|
|
2285
2285
|
}
|
|
2286
|
-
}).reduce(function(h,
|
|
2287
|
-
return { ...h, ...
|
|
2286
|
+
}).reduce(function(h, p) {
|
|
2287
|
+
return { ...h, ...p };
|
|
2288
2288
|
}, l);
|
|
2289
2289
|
}) : Object.values(o);
|
|
2290
2290
|
}
|
|
@@ -2348,27 +2348,27 @@ function ni(n, e, { etype: t, pageInfo: r, dq: s, form: i }) {
|
|
|
2348
2348
|
let u = _s(n, s);
|
|
2349
2349
|
const l = r?.["start-cursor"], f = r?.["end-cursor"], d = ei(e, t, l, o);
|
|
2350
2350
|
if (d && d?.["forward-identity"]?.[2] !== "id") {
|
|
2351
|
-
const
|
|
2352
|
-
u = u.map(([
|
|
2353
|
-
let
|
|
2354
|
-
return
|
|
2351
|
+
const m = d["checked-data-type"] === "date", b = d.id;
|
|
2352
|
+
u = u.map(([y]) => {
|
|
2353
|
+
let g = n.eav.get(y)?.get(b)?.values()?.next()?.value?.[2];
|
|
2354
|
+
return m && (g = Tt(g)), [y, g];
|
|
2355
2355
|
});
|
|
2356
2356
|
}
|
|
2357
2357
|
u.sort(
|
|
2358
|
-
c === "asc" ? function(
|
|
2359
|
-
return Ze(
|
|
2360
|
-
} : function(
|
|
2361
|
-
return Ze(
|
|
2358
|
+
c === "asc" ? function(b, y) {
|
|
2359
|
+
return Ze(b, y, d?.["checked-data-type"]);
|
|
2360
|
+
} : function(b, y) {
|
|
2361
|
+
return Ze(y, b, d?.["checked-data-type"]);
|
|
2362
2362
|
}
|
|
2363
2363
|
);
|
|
2364
2364
|
let h = {};
|
|
2365
|
-
const
|
|
2366
|
-
for (const
|
|
2367
|
-
const [
|
|
2368
|
-
if (h[
|
|
2365
|
+
const p = ti(e, t, s);
|
|
2366
|
+
for (const m of u) {
|
|
2367
|
+
const [b] = m;
|
|
2368
|
+
if (h[b] || !a && l && d && Js(l, d, c, m) || !a && f && d && Ys(f, d, c, m))
|
|
2369
2369
|
continue;
|
|
2370
|
-
const
|
|
2371
|
-
|
|
2370
|
+
const y = cs(n, p, b);
|
|
2371
|
+
y && (h[b] = y);
|
|
2372
2372
|
}
|
|
2373
2373
|
return h;
|
|
2374
2374
|
}
|
|
@@ -2674,11 +2674,11 @@ function Si({ attrsStore: n }, [e, t]) {
|
|
|
2674
2674
|
}
|
|
2675
2675
|
function Ti(n, e) {
|
|
2676
2676
|
const { attrsStore: t } = n, [r, s, i, o] = e, a = Lt(i), c = Y(t, r, s), u = nr(n, [r, c, i, o]), l = Object.entries(a).map(([d, h]) => {
|
|
2677
|
-
const
|
|
2677
|
+
const p = U(t, r, d);
|
|
2678
2678
|
return [
|
|
2679
2679
|
"deep-merge-triple",
|
|
2680
2680
|
c,
|
|
2681
|
-
|
|
2681
|
+
p.id,
|
|
2682
2682
|
h,
|
|
2683
2683
|
...u ? [u] : []
|
|
2684
2684
|
];
|
|
@@ -2829,12 +2829,12 @@ function Di({ attrsStore: n, schema: e }, t) {
|
|
|
2829
2829
|
const r = /* @__PURE__ */ new Set(), s = [], i = [];
|
|
2830
2830
|
function o(d, h) {
|
|
2831
2831
|
return U(n, d, h) || s.find(
|
|
2832
|
-
(
|
|
2832
|
+
(p) => p["forward-identity"][1] === d && p["forward-identity"][2] === h
|
|
2833
2833
|
);
|
|
2834
2834
|
}
|
|
2835
2835
|
function a(d, h) {
|
|
2836
2836
|
return ge(n, d, h) || s.find(
|
|
2837
|
-
(
|
|
2837
|
+
(p) => p["reverse-identity"]?.[1] === d && p["reverse-identity"]?.[2] === h
|
|
2838
2838
|
);
|
|
2839
2839
|
}
|
|
2840
2840
|
function c(d) {
|
|
@@ -2849,49 +2849,49 @@ function Di({ attrsStore: n, schema: e }, t) {
|
|
|
2849
2849
|
!o(d, h);
|
|
2850
2850
|
}
|
|
2851
2851
|
function f(d, h) {
|
|
2852
|
-
const
|
|
2853
|
-
u(
|
|
2852
|
+
const p = o(d, h), m = a(d, h);
|
|
2853
|
+
u(p), u(m), !p && !m && c(sn(e, d, h, xi));
|
|
2854
2854
|
}
|
|
2855
2855
|
for (const d of t)
|
|
2856
|
-
for (const { etype: h, lookupPair:
|
|
2857
|
-
const
|
|
2858
|
-
if (
|
|
2859
|
-
f(h,
|
|
2860
|
-
const
|
|
2861
|
-
u(
|
|
2862
|
-
const A =
|
|
2863
|
-
if (l(A,
|
|
2864
|
-
f(A, At(
|
|
2856
|
+
for (const { etype: h, lookupPair: p, linkLabel: m } of Ri(d)) {
|
|
2857
|
+
const b = p[0];
|
|
2858
|
+
if (m) {
|
|
2859
|
+
f(h, m);
|
|
2860
|
+
const y = o(h, m), g = a(h, m);
|
|
2861
|
+
u(y), u(g);
|
|
2862
|
+
const A = y?.["reverse-identity"]?.[1] || g?.["forward-identity"]?.[1] || m;
|
|
2863
|
+
if (l(A, b))
|
|
2864
|
+
f(A, At(b));
|
|
2865
2865
|
else {
|
|
2866
|
-
const R = o(A,
|
|
2866
|
+
const R = o(A, b);
|
|
2867
2867
|
R || c(
|
|
2868
|
-
Fe(e, A,
|
|
2868
|
+
Fe(e, A, b, Ot)
|
|
2869
2869
|
), u(R);
|
|
2870
2870
|
}
|
|
2871
|
-
} else if (l(h,
|
|
2872
|
-
f(h, At(
|
|
2871
|
+
} else if (l(h, b))
|
|
2872
|
+
f(h, At(b));
|
|
2873
2873
|
else {
|
|
2874
|
-
const
|
|
2875
|
-
|
|
2874
|
+
const y = o(h, b);
|
|
2875
|
+
y || c(Fe(e, h, b, Ot)), u(y);
|
|
2876
2876
|
}
|
|
2877
2877
|
}
|
|
2878
2878
|
for (const d of t) {
|
|
2879
|
-
const [h,
|
|
2879
|
+
const [h, p, m, b] = d;
|
|
2880
2880
|
if (Mi.has(h)) {
|
|
2881
|
-
const
|
|
2882
|
-
u(
|
|
2883
|
-
for (const
|
|
2884
|
-
const A = o(
|
|
2881
|
+
const y = o(p, "id");
|
|
2882
|
+
u(y), y || c(Fe(e, p, "id", { "unique?": !0 }));
|
|
2883
|
+
for (const g of Object.keys(b)) {
|
|
2884
|
+
const A = o(p, g);
|
|
2885
2885
|
if (u(A), ji.has(h) && (A || c(
|
|
2886
2886
|
Fe(
|
|
2887
2887
|
e,
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2888
|
+
p,
|
|
2889
|
+
g,
|
|
2890
|
+
g === "id" ? { "unique?": !0 } : null
|
|
2891
2891
|
)
|
|
2892
2892
|
)), Pi.has(h)) {
|
|
2893
|
-
const R = a(
|
|
2894
|
-
!A && !R && c(sn(e,
|
|
2893
|
+
const R = a(p, g);
|
|
2894
|
+
!A && !R && c(sn(e, p, g)), u(R);
|
|
2895
2895
|
}
|
|
2896
2896
|
}
|
|
2897
2897
|
}
|
|
@@ -3022,7 +3022,7 @@ class It {
|
|
|
3022
3022
|
);
|
|
3023
3023
|
});
|
|
3024
3024
|
return t.push(f), Promise.all(t).then(
|
|
3025
|
-
(d) => d.reduce((h,
|
|
3025
|
+
(d) => d.reduce((h, p) => h + p, 0)
|
|
3026
3026
|
);
|
|
3027
3027
|
}
|
|
3028
3028
|
const s = this._meta.value;
|
|
@@ -3041,12 +3041,12 @@ class It {
|
|
|
3041
3041
|
if (this._loadedKeys.has(f)) {
|
|
3042
3042
|
const d = this.serialize(f, this.currentValue[f]);
|
|
3043
3043
|
c.push([f, d]);
|
|
3044
|
-
const h = this._objectSize(d),
|
|
3044
|
+
const h = this._objectSize(d), p = u[f] ?? {
|
|
3045
3045
|
createdAt: Date.now(),
|
|
3046
3046
|
updatedAt: Date.now(),
|
|
3047
3047
|
size: h
|
|
3048
3048
|
};
|
|
3049
|
-
|
|
3049
|
+
p.updatedAt = Date.now(), p.size = h, u[f] = p, this._pendingSaveKeys.delete(f);
|
|
3050
3050
|
} else
|
|
3051
3051
|
a.push(f);
|
|
3052
3052
|
const l = this._persister.multiSet(c);
|
|
@@ -3092,7 +3092,7 @@ class It {
|
|
|
3092
3092
|
for (const [d, h] of Object.entries(r.objects))
|
|
3093
3093
|
!t.has(d) && h.updatedAt < o - this._gcOpts.maxAgeMs && (s.push(this._persister.removeItem(d)), delete r.objects[d], i.removed.push(d), i.removedOldCount++);
|
|
3094
3094
|
const a = Object.entries(r.objects);
|
|
3095
|
-
a.sort(([d, h], [
|
|
3095
|
+
a.sort(([d, h], [p, m]) => h.updatedAt - m.updatedAt);
|
|
3096
3096
|
const c = a.filter(([d]) => !t.has(d));
|
|
3097
3097
|
if (a.length > this._gcOpts.maxEntries)
|
|
3098
3098
|
for (const [d] of c.slice(
|
|
@@ -3101,9 +3101,9 @@ class It {
|
|
|
3101
3101
|
))
|
|
3102
3102
|
s.push(this._persister.removeItem(d)), delete r.objects[d], i.removed.push(d), i.removedThresholdCount++;
|
|
3103
3103
|
const u = Object.entries(r.objects);
|
|
3104
|
-
u.sort(([d, h], [
|
|
3104
|
+
u.sort(([d, h], [p, m]) => h.updatedAt - m.updatedAt);
|
|
3105
3105
|
const l = u.filter(([d]) => !t.has(d));
|
|
3106
|
-
let f = u.reduce((d, [h,
|
|
3106
|
+
let f = u.reduce((d, [h, p]) => d + p.size, 0);
|
|
3107
3107
|
for (; f > 0 && f > this._gcOpts.maxSize && l.length; ) {
|
|
3108
3108
|
const [[d, h]] = l.splice(0, 1);
|
|
3109
3109
|
f -= h.size, s.push(this._persister.removeItem(d)), delete r.objects[d], i.removed.push(d), i.removedSizeCount++;
|
|
@@ -3205,12 +3205,12 @@ async function qi(n, e, t) {
|
|
|
3205
3205
|
for (const [l, f] of Object.entries(r)) {
|
|
3206
3206
|
const d = typeof f == "string" ? JSON.parse(f) : f;
|
|
3207
3207
|
if (d.lastAccessed) {
|
|
3208
|
-
const
|
|
3208
|
+
const p = {
|
|
3209
3209
|
createdAt: d.lastAccessed,
|
|
3210
3210
|
updatedAt: d.lastAccessed,
|
|
3211
3211
|
size: d.result?.store?.triples?.length ?? 0
|
|
3212
3212
|
};
|
|
3213
|
-
a[l] =
|
|
3213
|
+
a[l] = p;
|
|
3214
3214
|
}
|
|
3215
3215
|
const h = t.put(d, l);
|
|
3216
3216
|
s.add(h);
|
|
@@ -3235,41 +3235,41 @@ async function zi(n, e) {
|
|
|
3235
3235
|
const t = await Ki(`instant_${n}_5`);
|
|
3236
3236
|
if (!t)
|
|
3237
3237
|
return;
|
|
3238
|
-
const r = await new Promise((
|
|
3239
|
-
const
|
|
3240
|
-
|
|
3241
|
-
|
|
3238
|
+
const r = await new Promise((l, f) => {
|
|
3239
|
+
const p = t.transaction(["kv"], "readonly").objectStore("kv").openCursor();
|
|
3240
|
+
p.onerror = (b) => {
|
|
3241
|
+
f(b);
|
|
3242
3242
|
};
|
|
3243
|
-
const
|
|
3244
|
-
|
|
3245
|
-
const
|
|
3246
|
-
if (
|
|
3247
|
-
const
|
|
3248
|
-
|
|
3243
|
+
const m = [];
|
|
3244
|
+
p.onsuccess = () => {
|
|
3245
|
+
const b = p.result;
|
|
3246
|
+
if (b) {
|
|
3247
|
+
const y = b.key, g = b.value;
|
|
3248
|
+
m.push([y, g]), b.continue();
|
|
3249
3249
|
} else
|
|
3250
|
-
|
|
3251
|
-
},
|
|
3252
|
-
|
|
3250
|
+
l(m);
|
|
3251
|
+
}, p.onerror = (b) => {
|
|
3252
|
+
f(b);
|
|
3253
3253
|
};
|
|
3254
|
-
}), s = e.transaction(["kv", "querySubs"], "readwrite"), i = s.objectStore("kv"), o = s.objectStore("querySubs"), a =
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
const h = qi(f, d, o);
|
|
3260
|
-
c.push(h);
|
|
3254
|
+
}), s = e.transaction(["kv", "querySubs"], "readwrite"), i = s.objectStore("kv"), o = s.objectStore("querySubs"), a = [], c = { objects: {} };
|
|
3255
|
+
for (const [l, f] of r)
|
|
3256
|
+
if (l === "querySubs") {
|
|
3257
|
+
const d = qi(l, f, o);
|
|
3258
|
+
a.push(d);
|
|
3261
3259
|
} else {
|
|
3262
|
-
const
|
|
3263
|
-
|
|
3264
|
-
const
|
|
3260
|
+
const d = an(l, f, i);
|
|
3261
|
+
a.push(d);
|
|
3262
|
+
const h = {
|
|
3265
3263
|
createdAt: Date.now(),
|
|
3266
3264
|
updatedAt: Date.now(),
|
|
3267
3265
|
size: 0
|
|
3268
3266
|
};
|
|
3269
|
-
|
|
3267
|
+
c.objects[l] = h;
|
|
3270
3268
|
}
|
|
3271
|
-
const
|
|
3272
|
-
|
|
3269
|
+
const u = an(ve, c, i);
|
|
3270
|
+
a.push(u), await Promise.all(a), await new Promise((l, f) => {
|
|
3271
|
+
s.oncomplete = (d) => l(d), s.onerror = (d) => f(d), s.onabort = (d) => f(d);
|
|
3272
|
+
});
|
|
3273
3273
|
}
|
|
3274
3274
|
const cn = /* @__PURE__ */ new Map();
|
|
3275
3275
|
class sr extends rr {
|
|
@@ -3696,7 +3696,7 @@ function Ct(n) {
|
|
|
3696
3696
|
link: t
|
|
3697
3697
|
}, e), {});
|
|
3698
3698
|
}
|
|
3699
|
-
const ur = "v1.0.63-branch-codex-indexeddb-explicit-commit.
|
|
3699
|
+
const ur = "v1.0.63-branch-codex-indexeddb-explicit-commit.31419410889.1";
|
|
3700
3700
|
function ro(n, e, t = console) {
|
|
3701
3701
|
return {
|
|
3702
3702
|
info: n ? (...r) => t.info(...r, e()) : () => {
|
|
@@ -3916,9 +3916,9 @@ const hn = [
|
|
|
3916
3916
|
);
|
|
3917
3917
|
const h = d.links[f];
|
|
3918
3918
|
if (!h) {
|
|
3919
|
-
const
|
|
3919
|
+
const p = Object.keys(d.links);
|
|
3920
3920
|
throw new P(
|
|
3921
|
-
`Link '${f}' does not exist on entity '${o}' in dot notation path '${n}'. Available links: ${
|
|
3921
|
+
`Link '${f}' does not exist on entity '${o}' in dot notation path '${n}'. Available links: ${p.length > 0 ? p.join(", ") : "none"}`,
|
|
3922
3922
|
s
|
|
3923
3923
|
);
|
|
3924
3924
|
}
|
|
@@ -4723,9 +4723,9 @@ class vo {
|
|
|
4723
4723
|
continue;
|
|
4724
4724
|
i.txId = o["tx-id"];
|
|
4725
4725
|
const a = [], c = {};
|
|
4726
|
-
for (const
|
|
4727
|
-
const
|
|
4728
|
-
c[
|
|
4726
|
+
for (const m of o.changes) {
|
|
4727
|
+
const b = c[m.triple[0]] ?? [];
|
|
4728
|
+
c[m.triple[0]] = b, b.push(m);
|
|
4729
4729
|
}
|
|
4730
4730
|
const u = s.values ?? {
|
|
4731
4731
|
entities: [],
|
|
@@ -4733,53 +4733,53 @@ class vo {
|
|
|
4733
4733
|
}, l = u.entities;
|
|
4734
4734
|
s.values = u;
|
|
4735
4735
|
const f = [];
|
|
4736
|
-
e: for (const [
|
|
4737
|
-
for (let
|
|
4738
|
-
const
|
|
4739
|
-
if (Xr(
|
|
4740
|
-
wn(
|
|
4741
|
-
const A = ct(s,
|
|
4742
|
-
|
|
4736
|
+
e: for (const [m, b] of Object.entries(c))
|
|
4737
|
+
for (let y = 0; y < l.length; y++) {
|
|
4738
|
+
const g = l[y];
|
|
4739
|
+
if (Xr(g.store, m)) {
|
|
4740
|
+
wn(g.store, u.attrsStore, b);
|
|
4741
|
+
const A = ct(s, g.store, u.attrsStore), R = wo(
|
|
4742
|
+
g.store,
|
|
4743
4743
|
u.attrsStore,
|
|
4744
|
-
|
|
4745
|
-
)[
|
|
4744
|
+
b
|
|
4745
|
+
)[m];
|
|
4746
4746
|
A ? (f.push({
|
|
4747
|
-
oldEntity:
|
|
4747
|
+
oldEntity: g.entity,
|
|
4748
4748
|
newEntity: A,
|
|
4749
4749
|
changedFields: R || {}
|
|
4750
|
-
}),
|
|
4750
|
+
}), g.entity = A) : a.push(y), delete c[m];
|
|
4751
4751
|
continue e;
|
|
4752
4752
|
}
|
|
4753
4753
|
}
|
|
4754
4754
|
const d = [];
|
|
4755
|
-
for (const [
|
|
4756
|
-
const
|
|
4757
|
-
wn(
|
|
4758
|
-
const
|
|
4759
|
-
if (!
|
|
4755
|
+
for (const [m, b] of Object.entries(c)) {
|
|
4756
|
+
const y = this.createStore([]);
|
|
4757
|
+
wn(y, u.attrsStore, b);
|
|
4758
|
+
const g = ct(s, y, u.attrsStore);
|
|
4759
|
+
if (!g) {
|
|
4760
4760
|
this.log.error("No entity found after applying change", {
|
|
4761
4761
|
sub: s,
|
|
4762
|
-
changes:
|
|
4763
|
-
store:
|
|
4762
|
+
changes: b,
|
|
4763
|
+
store: y
|
|
4764
4764
|
});
|
|
4765
4765
|
continue;
|
|
4766
4766
|
}
|
|
4767
4767
|
l.push({
|
|
4768
|
-
store:
|
|
4769
|
-
entity:
|
|
4768
|
+
store: y,
|
|
4769
|
+
entity: g,
|
|
4770
4770
|
serverCreatedAt: mn(
|
|
4771
4771
|
s,
|
|
4772
|
-
|
|
4772
|
+
y,
|
|
4773
4773
|
u.attrsStore,
|
|
4774
|
-
|
|
4774
|
+
g.id
|
|
4775
4775
|
)
|
|
4776
|
-
}), d.push(
|
|
4776
|
+
}), d.push(g);
|
|
4777
4777
|
}
|
|
4778
4778
|
const h = [];
|
|
4779
|
-
for (const
|
|
4780
|
-
h.push(l[
|
|
4781
|
-
const
|
|
4782
|
-
So(s,
|
|
4779
|
+
for (const m of a.sort().reverse())
|
|
4780
|
+
h.push(l[m].entity), l.splice(m, 1);
|
|
4781
|
+
const p = _o(s, this.getAttrs);
|
|
4782
|
+
So(s, p, l), this.notifyCbs(r, {
|
|
4783
4783
|
type: "SyncTransaction",
|
|
4784
4784
|
data: Ke(s, s.values?.entities),
|
|
4785
4785
|
added: d,
|
|
@@ -4831,9 +4831,9 @@ function Ao({
|
|
|
4831
4831
|
let o = null, a = null, c = null;
|
|
4832
4832
|
const u = j();
|
|
4833
4833
|
let l = !1, f = !1;
|
|
4834
|
-
const d = [], h = [],
|
|
4835
|
-
let
|
|
4836
|
-
const
|
|
4834
|
+
const d = [], h = [], p = [];
|
|
4835
|
+
let m = !1, b = 0, y = 0;
|
|
4836
|
+
const g = [], A = new TextEncoder();
|
|
4837
4837
|
function R() {
|
|
4838
4838
|
f = !0;
|
|
4839
4839
|
for (const _ of d)
|
|
@@ -4846,18 +4846,18 @@ function Ao({
|
|
|
4846
4846
|
};
|
|
4847
4847
|
}
|
|
4848
4848
|
function N(_) {
|
|
4849
|
-
return
|
|
4850
|
-
const v =
|
|
4851
|
-
v !== -1 &&
|
|
4849
|
+
return p.push(_), () => {
|
|
4850
|
+
const v = p.indexOf(_);
|
|
4851
|
+
v !== -1 && p.splice(v, 1);
|
|
4852
4852
|
};
|
|
4853
4853
|
}
|
|
4854
4854
|
e.waitUntil && e.waitUntil(
|
|
4855
4855
|
new Promise((_) => {
|
|
4856
|
-
|
|
4856
|
+
p.push(_);
|
|
4857
4857
|
})
|
|
4858
4858
|
);
|
|
4859
4859
|
function C() {
|
|
4860
|
-
for (const _ of
|
|
4860
|
+
for (const _ of p)
|
|
4861
4861
|
try {
|
|
4862
4862
|
_();
|
|
4863
4863
|
} catch {
|
|
@@ -4875,17 +4875,17 @@ function Ao({
|
|
|
4875
4875
|
v(o);
|
|
4876
4876
|
}
|
|
4877
4877
|
function M() {
|
|
4878
|
-
|
|
4878
|
+
m = !0;
|
|
4879
4879
|
}
|
|
4880
4880
|
function w(_) {
|
|
4881
|
-
let v =
|
|
4882
|
-
for (const { byteLen: re } of
|
|
4881
|
+
let v = b, F = 0, B = 0;
|
|
4882
|
+
for (const { byteLen: re } of g) {
|
|
4883
4883
|
const ue = v + re;
|
|
4884
4884
|
if (ue > _)
|
|
4885
4885
|
break;
|
|
4886
4886
|
v = ue, F++, B += re;
|
|
4887
4887
|
}
|
|
4888
|
-
F > 0 && (
|
|
4888
|
+
F > 0 && (b += B, y -= B, g.splice(0, F));
|
|
4889
4889
|
}
|
|
4890
4890
|
function S(_, v) {
|
|
4891
4891
|
a = v, R(), _.error(v), C();
|
|
@@ -4899,11 +4899,11 @@ function Ao({
|
|
|
4899
4899
|
switch (_.type) {
|
|
4900
4900
|
case "ok": {
|
|
4901
4901
|
const { streamId: v, offset: F } = _;
|
|
4902
|
-
o = v, w(F),
|
|
4902
|
+
o = v, w(F), g.length && r({
|
|
4903
4903
|
streamId: v,
|
|
4904
|
-
chunks:
|
|
4905
|
-
offset:
|
|
4906
|
-
}),
|
|
4904
|
+
chunks: g.map((B) => B.chunk),
|
|
4905
|
+
offset: b
|
|
4906
|
+
}), m = !1;
|
|
4907
4907
|
break;
|
|
4908
4908
|
}
|
|
4909
4909
|
case "disconnect": {
|
|
@@ -4949,7 +4949,7 @@ function Ao({
|
|
|
4949
4949
|
onFlush: D,
|
|
4950
4950
|
onConnectionReconnect: T,
|
|
4951
4951
|
onAppendFailed: E
|
|
4952
|
-
}),
|
|
4952
|
+
}), m = !1;
|
|
4953
4953
|
return;
|
|
4954
4954
|
}
|
|
4955
4955
|
case "disconnect": {
|
|
@@ -4998,16 +4998,16 @@ function Ao({
|
|
|
4998
4998
|
const F = Z(v);
|
|
4999
4999
|
if (F) {
|
|
5000
5000
|
const B = A.encode(_).length;
|
|
5001
|
-
|
|
5002
|
-
const re =
|
|
5003
|
-
|
|
5001
|
+
g.push({ chunk: _, byteLen: B });
|
|
5002
|
+
const re = b + y;
|
|
5003
|
+
y += B, m || r({ streamId: F, chunks: [_], offset: re });
|
|
5004
5004
|
}
|
|
5005
5005
|
},
|
|
5006
5006
|
close() {
|
|
5007
5007
|
o ? r({
|
|
5008
5008
|
streamId: o,
|
|
5009
5009
|
chunks: [],
|
|
5010
|
-
offset:
|
|
5010
|
+
offset: b + y,
|
|
5011
5011
|
isDone: !0
|
|
5012
5012
|
}) : C(), R();
|
|
5013
5013
|
},
|
|
@@ -5015,7 +5015,7 @@ function Ao({
|
|
|
5015
5015
|
o ? r({
|
|
5016
5016
|
streamId: o,
|
|
5017
5017
|
chunks: [],
|
|
5018
|
-
offset:
|
|
5018
|
+
offset: b + y,
|
|
5019
5019
|
isDone: !0,
|
|
5020
5020
|
abortReason: _
|
|
5021
5021
|
}) : C(), R();
|
|
@@ -5071,27 +5071,27 @@ function Oo({
|
|
|
5071
5071
|
let c, u = !1;
|
|
5072
5072
|
const l = [], f = [];
|
|
5073
5073
|
let d = null, h = null;
|
|
5074
|
-
function
|
|
5074
|
+
function p(C) {
|
|
5075
5075
|
u = !0;
|
|
5076
5076
|
for (const O of l)
|
|
5077
5077
|
O(C);
|
|
5078
5078
|
}
|
|
5079
|
-
function
|
|
5079
|
+
function m(C) {
|
|
5080
5080
|
return l.push(C), () => {
|
|
5081
5081
|
const O = l.indexOf(C);
|
|
5082
5082
|
O !== -1 && l.splice(O, 1);
|
|
5083
5083
|
};
|
|
5084
5084
|
}
|
|
5085
|
-
function
|
|
5085
|
+
function b(C) {
|
|
5086
5086
|
return f.push(C), d && C(d), () => {
|
|
5087
5087
|
const O = f.indexOf(C);
|
|
5088
5088
|
O !== -1 && f.splice(O, 1);
|
|
5089
5089
|
};
|
|
5090
5090
|
}
|
|
5091
|
-
function
|
|
5092
|
-
h = O, C.error(O),
|
|
5091
|
+
function y(C, O) {
|
|
5092
|
+
h = O, C.error(O), p(O);
|
|
5093
5093
|
}
|
|
5094
|
-
let
|
|
5094
|
+
let g = 0;
|
|
5095
5095
|
async function A(C, O) {
|
|
5096
5096
|
c = j();
|
|
5097
5097
|
const q = { ...C || {}, eventId: c };
|
|
@@ -5101,11 +5101,11 @@ function Oo({
|
|
|
5101
5101
|
if (M.type === "reconnect")
|
|
5102
5102
|
return { retry: !0 };
|
|
5103
5103
|
if (M.type === "error") {
|
|
5104
|
-
|
|
5104
|
+
y(O, M.error);
|
|
5105
5105
|
return;
|
|
5106
5106
|
}
|
|
5107
5107
|
if (M.offset > s) {
|
|
5108
|
-
|
|
5108
|
+
y(O, new L("Stream is corrupted.")), i = !0;
|
|
5109
5109
|
return;
|
|
5110
5110
|
}
|
|
5111
5111
|
d = M.streamId;
|
|
@@ -5120,8 +5120,8 @@ function Oo({
|
|
|
5120
5120
|
for (let E = 0; E < M.files.length; E++) {
|
|
5121
5121
|
const D = M.files[E + 1], Q = await T;
|
|
5122
5122
|
if (D && (T = fetch(D.url, { signal: S.signal })), !Q.ok) {
|
|
5123
|
-
if (
|
|
5124
|
-
|
|
5123
|
+
if (g++, g > 10) {
|
|
5124
|
+
y(O, new L("Unable to process stream."));
|
|
5125
5125
|
return;
|
|
5126
5126
|
}
|
|
5127
5127
|
return { retry: !0 };
|
|
@@ -5162,7 +5162,7 @@ function Oo({
|
|
|
5162
5162
|
}
|
|
5163
5163
|
}
|
|
5164
5164
|
}
|
|
5165
|
-
if (
|
|
5165
|
+
if (g = 0, M.content) {
|
|
5166
5166
|
let S = M.content, T = a.encode(M.content);
|
|
5167
5167
|
if (w > 0) {
|
|
5168
5168
|
const E = T.subarray(w);
|
|
@@ -5186,7 +5186,7 @@ function Oo({
|
|
|
5186
5186
|
setTimeout(S, Math.max(0, M - Date.now()));
|
|
5187
5187
|
}));
|
|
5188
5188
|
}
|
|
5189
|
-
!i && !u && (C.close(),
|
|
5189
|
+
!i && !u && (C.close(), p());
|
|
5190
5190
|
}
|
|
5191
5191
|
class k extends n {
|
|
5192
5192
|
constructor(O, q) {
|
|
@@ -5206,7 +5206,7 @@ function Oo({
|
|
|
5206
5206
|
}, T = (E) => {
|
|
5207
5207
|
q(E || new L("Stream is closed.")), w();
|
|
5208
5208
|
};
|
|
5209
|
-
M.push(
|
|
5209
|
+
M.push(b(S)), M.push(m(T));
|
|
5210
5210
|
});
|
|
5211
5211
|
}
|
|
5212
5212
|
}
|
|
@@ -5216,10 +5216,10 @@ function Oo({
|
|
|
5216
5216
|
R(C);
|
|
5217
5217
|
},
|
|
5218
5218
|
cancel(C) {
|
|
5219
|
-
i = !0, c && r({ eventId: c }),
|
|
5219
|
+
i = !0, c && r({ eventId: c }), p();
|
|
5220
5220
|
}
|
|
5221
5221
|
}),
|
|
5222
|
-
addCloseCb:
|
|
5222
|
+
addCloseCb: m,
|
|
5223
5223
|
closed() {
|
|
5224
5224
|
return u;
|
|
5225
5225
|
}
|
|
@@ -5792,12 +5792,12 @@ class Ko {
|
|
|
5792
5792
|
r,
|
|
5793
5793
|
this.config.useDateObjects
|
|
5794
5794
|
);
|
|
5795
|
-
this.querySubs.updateInPlace((
|
|
5796
|
-
if (!
|
|
5795
|
+
this.querySubs.updateInPlace((p) => {
|
|
5796
|
+
if (!p[c]) {
|
|
5797
5797
|
this._log.info("Missing value in querySubs", { hash: c, q: o });
|
|
5798
5798
|
return;
|
|
5799
5799
|
}
|
|
5800
|
-
|
|
5800
|
+
p[c].result = {
|
|
5801
5801
|
store: h,
|
|
5802
5802
|
attrsStore: d,
|
|
5803
5803
|
pageInfo: u,
|
|
@@ -5851,20 +5851,20 @@ class Ko {
|
|
|
5851
5851
|
d.pendingMutations = u;
|
|
5852
5852
|
});
|
|
5853
5853
|
const l = dt(u.entries()), f = o.map((d) => {
|
|
5854
|
-
const h = d["instaql-query"],
|
|
5855
|
-
|
|
5856
|
-
|
|
5854
|
+
const h = d["instaql-query"], p = d["instaql-result"], m = G(h), b = fn(p), y = this.ensureAttrs(), g = Te(
|
|
5855
|
+
y,
|
|
5856
|
+
b,
|
|
5857
5857
|
r,
|
|
5858
5858
|
this.config.useDateObjects
|
|
5859
5859
|
), { store: A, attrsStore: R } = this._applyOptimisticUpdates(
|
|
5860
|
-
|
|
5861
|
-
|
|
5860
|
+
g,
|
|
5861
|
+
y,
|
|
5862
5862
|
l,
|
|
5863
5863
|
c
|
|
5864
|
-
), k =
|
|
5864
|
+
), k = p?.[0]?.data?.["page-info"], N = p?.[0]?.data?.aggregate;
|
|
5865
5865
|
return {
|
|
5866
5866
|
q: h,
|
|
5867
|
-
hash:
|
|
5867
|
+
hash: m,
|
|
5868
5868
|
store: A,
|
|
5869
5869
|
attrsStore: R,
|
|
5870
5870
|
pageInfo: k,
|
|
@@ -5872,17 +5872,17 @@ class Ko {
|
|
|
5872
5872
|
};
|
|
5873
5873
|
});
|
|
5874
5874
|
f.forEach(
|
|
5875
|
-
({ hash: d, q: h, store:
|
|
5876
|
-
this.querySubs.updateInPlace((
|
|
5877
|
-
if (!
|
|
5875
|
+
({ hash: d, q: h, store: p, attrsStore: m, pageInfo: b, aggregate: y }) => {
|
|
5876
|
+
this.querySubs.updateInPlace((g) => {
|
|
5877
|
+
if (!g[d]) {
|
|
5878
5878
|
this._log.error("Missing value in querySubs", { hash: d, q: h });
|
|
5879
5879
|
return;
|
|
5880
5880
|
}
|
|
5881
|
-
|
|
5882
|
-
store:
|
|
5883
|
-
attrsStore:
|
|
5884
|
-
pageInfo:
|
|
5885
|
-
aggregate:
|
|
5881
|
+
g[d].result = {
|
|
5882
|
+
store: p,
|
|
5883
|
+
attrsStore: m,
|
|
5884
|
+
pageInfo: b,
|
|
5885
|
+
aggregate: y,
|
|
5886
5886
|
processedTxId: c
|
|
5887
5887
|
};
|
|
5888
5888
|
});
|
|
@@ -6186,27 +6186,27 @@ class Ko {
|
|
|
6186
6186
|
const c = (l, f) => {
|
|
6187
6187
|
const d = [];
|
|
6188
6188
|
for (const h of l) {
|
|
6189
|
-
const [
|
|
6190
|
-
if (
|
|
6191
|
-
const [
|
|
6192
|
-
if (
|
|
6193
|
-
o.attrIdMap[
|
|
6189
|
+
const [p] = h;
|
|
6190
|
+
if (p === "add-attr") {
|
|
6191
|
+
const [b, y] = h, g = s(y);
|
|
6192
|
+
if (g && y.id !== g.id) {
|
|
6193
|
+
o.attrIdMap[y.id] = g.id, a = !0;
|
|
6194
6194
|
continue;
|
|
6195
6195
|
}
|
|
6196
|
-
if (
|
|
6197
|
-
const A = i(
|
|
6196
|
+
if (y["value-type"] === "ref") {
|
|
6197
|
+
const A = i(y);
|
|
6198
6198
|
if (A) {
|
|
6199
|
-
o.attrIdMap[
|
|
6199
|
+
o.attrIdMap[y.id] = A.id, o.refSwapAttrIds.add(y.id), a = !0;
|
|
6200
6200
|
continue;
|
|
6201
6201
|
}
|
|
6202
6202
|
}
|
|
6203
6203
|
}
|
|
6204
|
-
if (r && f && r >= f &&
|
|
6204
|
+
if (r && f && r >= f && p === "add-attr" || p === "update-attr" || p === "delete-attr") {
|
|
6205
6205
|
a = !0;
|
|
6206
6206
|
continue;
|
|
6207
6207
|
}
|
|
6208
|
-
const
|
|
6209
|
-
d.push(
|
|
6208
|
+
const m = a ? fi(o, h) : h;
|
|
6209
|
+
d.push(m);
|
|
6210
6210
|
}
|
|
6211
6211
|
return a ? d : l;
|
|
6212
6212
|
}, u = /* @__PURE__ */ new Map();
|
|
@@ -6257,21 +6257,21 @@ class Ko {
|
|
|
6257
6257
|
if (l && s === l.querySubVersion && o === l.pendingMutationsVersion)
|
|
6258
6258
|
return l;
|
|
6259
6259
|
let f = u.store, d = u.attrsStore;
|
|
6260
|
-
const { pageInfo: h, aggregate:
|
|
6260
|
+
const { pageInfo: h, aggregate: p, processedTxId: m } = u, b = this._rewriteMutationsSorted(
|
|
6261
6261
|
d,
|
|
6262
6262
|
a
|
|
6263
6263
|
);
|
|
6264
6264
|
if (t) {
|
|
6265
|
-
const
|
|
6265
|
+
const g = this._applyOptimisticUpdates(
|
|
6266
6266
|
f,
|
|
6267
6267
|
d,
|
|
6268
|
-
|
|
6269
|
-
|
|
6268
|
+
b,
|
|
6269
|
+
m
|
|
6270
6270
|
);
|
|
6271
|
-
f =
|
|
6271
|
+
f = g.store, d = g.attrsStore;
|
|
6272
6272
|
}
|
|
6273
6273
|
return { data: qt(
|
|
6274
|
-
{ store: f, attrsStore: d, pageInfo: h, aggregate:
|
|
6274
|
+
{ store: f, attrsStore: d, pageInfo: h, aggregate: p },
|
|
6275
6275
|
c
|
|
6276
6276
|
), querySubVersion: s, pendingMutationsVersion: o };
|
|
6277
6277
|
}
|
|
@@ -7442,29 +7442,29 @@ const va = (n) => ({
|
|
|
7442
7442
|
if (a.topics)
|
|
7443
7443
|
for (const [l, f] of Object.entries(a.topics)) {
|
|
7444
7444
|
const d = f, h = {};
|
|
7445
|
-
for (const [
|
|
7446
|
-
const
|
|
7447
|
-
let
|
|
7448
|
-
switch (
|
|
7445
|
+
for (const [p, m] of Object.entries(d.attrs)) {
|
|
7446
|
+
const b = m;
|
|
7447
|
+
let y;
|
|
7448
|
+
switch (b.valueType) {
|
|
7449
7449
|
case "string":
|
|
7450
|
-
|
|
7450
|
+
y = $.string();
|
|
7451
7451
|
break;
|
|
7452
7452
|
case "number":
|
|
7453
|
-
|
|
7453
|
+
y = $.number();
|
|
7454
7454
|
break;
|
|
7455
7455
|
case "boolean":
|
|
7456
|
-
|
|
7456
|
+
y = $.boolean();
|
|
7457
7457
|
break;
|
|
7458
7458
|
case "date":
|
|
7459
|
-
|
|
7459
|
+
y = $.date();
|
|
7460
7460
|
break;
|
|
7461
7461
|
case "json":
|
|
7462
|
-
|
|
7462
|
+
y = $.json();
|
|
7463
7463
|
break;
|
|
7464
7464
|
default:
|
|
7465
|
-
|
|
7465
|
+
y = $.json();
|
|
7466
7466
|
}
|
|
7467
|
-
|
|
7467
|
+
b.required || (y = y.optional()), b.config?.indexed && (y = y.indexed()), b.config?.unique && (y = y.unique()), h[p] = y;
|
|
7468
7468
|
}
|
|
7469
7469
|
u[l] = $.entity(h);
|
|
7470
7470
|
}
|
|
@@ -7687,10 +7687,10 @@ const oa = (n) => JSON.stringify(n), je = (n, e = !1) => JSON.stringify([n, e]),
|
|
|
7687
7687
|
return { chunks: t, data: r };
|
|
7688
7688
|
}, ft = ["bootstrap", "bootstrap", "bootstrap", 1], la = (n, e, t, r) => {
|
|
7689
7689
|
const { entityName: s, entityQuery: i } = mr(e), o = i.$?.limit || 10, a = s, c = gr(i.$?.order), u = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map();
|
|
7690
|
-
let d = !1, h = !0,
|
|
7691
|
-
const
|
|
7690
|
+
let d = !1, h = !0, p = null, m = null;
|
|
7691
|
+
const b = (w) => {
|
|
7692
7692
|
t({ error: w, data: void 0, canLoadNextPage: !1 });
|
|
7693
|
-
},
|
|
7693
|
+
}, y = () => {
|
|
7694
7694
|
if (!h) return;
|
|
7695
7695
|
const { chunks: w, data: S } = ua(u, l);
|
|
7696
7696
|
t({
|
|
@@ -7699,10 +7699,10 @@ const oa = (n) => JSON.stringify(n), je = (n, e = !1) => JSON.stringify([n, e]),
|
|
|
7699
7699
|
chunks: w,
|
|
7700
7700
|
canLoadNextPage: ca(u)
|
|
7701
7701
|
});
|
|
7702
|
-
},
|
|
7703
|
-
u.set(je(w, S.afterInclusive), S),
|
|
7702
|
+
}, g = (w, S) => {
|
|
7703
|
+
u.set(je(w, S.afterInclusive), S), y();
|
|
7704
7704
|
}, A = (w, S) => {
|
|
7705
|
-
l.set(je(w), S), O(),
|
|
7705
|
+
l.set(je(w), S), O(), y();
|
|
7706
7706
|
}, R = (w, S) => {
|
|
7707
7707
|
const { cursor: T } = vn(w);
|
|
7708
7708
|
f.get(we("reverse", T))?.();
|
|
@@ -7722,7 +7722,7 @@ const oa = (n) => JSON.stringify(n), je = (n, e = !1) => JSON.stringify([n, e]),
|
|
|
7722
7722
|
},
|
|
7723
7723
|
(Z) => {
|
|
7724
7724
|
if (Z.error)
|
|
7725
|
-
return
|
|
7725
|
+
return b(Z.error);
|
|
7726
7726
|
const Q = Z.data[a], z = Z.pageInfo[a];
|
|
7727
7727
|
Ce(
|
|
7728
7728
|
Q && z,
|
|
@@ -7753,7 +7753,7 @@ const oa = (n) => JSON.stringify(n), je = (n, e = !1) => JSON.stringify([n, e]),
|
|
|
7753
7753
|
},
|
|
7754
7754
|
(T) => {
|
|
7755
7755
|
if (T.error)
|
|
7756
|
-
return
|
|
7756
|
+
return b(T.error);
|
|
7757
7757
|
const E = T.data[a], D = T.pageInfo[a];
|
|
7758
7758
|
Ce(E && D, "Expected rows and pageInfo"), A(w, {
|
|
7759
7759
|
data: E,
|
|
@@ -7782,9 +7782,9 @@ const oa = (n) => JSON.stringify(n), je = (n, e = !1) => JSON.stringify([n, e]),
|
|
|
7782
7782
|
},
|
|
7783
7783
|
(E) => {
|
|
7784
7784
|
if (E.error)
|
|
7785
|
-
return
|
|
7785
|
+
return b(E.error);
|
|
7786
7786
|
const D = E.data[a], Z = E.pageInfo[a];
|
|
7787
|
-
Ce(D && Z, "Page info and rows"),
|
|
7787
|
+
Ce(D && Z, "Page info and rows"), g(w, {
|
|
7788
7788
|
data: D,
|
|
7789
7789
|
status: "bootstrapping",
|
|
7790
7790
|
hasMore: Z.hasNextPage,
|
|
@@ -7822,9 +7822,9 @@ const oa = (n) => JSON.stringify(n), je = (n, e = !1) => JSON.stringify([n, e]),
|
|
|
7822
7822
|
},
|
|
7823
7823
|
(Q) => {
|
|
7824
7824
|
if (Q.error)
|
|
7825
|
-
return
|
|
7825
|
+
return b(Q.error);
|
|
7826
7826
|
const z = Q.data[a], te = Q.pageInfo[a];
|
|
7827
|
-
Ce(z && te, "Expected rows and pageInfo"),
|
|
7827
|
+
Ce(z && te, "Expected rows and pageInfo"), g(w, {
|
|
7828
7828
|
data: z,
|
|
7829
7829
|
status: "frozen",
|
|
7830
7830
|
hasMore: te.hasNextPage,
|
|
@@ -7841,7 +7841,7 @@ const oa = (n) => JSON.stringify(n), je = (n, e = !1) => JSON.stringify([n, e]),
|
|
|
7841
7841
|
const [S, T] = w;
|
|
7842
7842
|
if (!T?.hasMore || !aa(T)) return;
|
|
7843
7843
|
const E = `${S}:${oa(T.endCursor)}`;
|
|
7844
|
-
E !=
|
|
7844
|
+
E != p && (p = E, R(S, T), k(T.endCursor));
|
|
7845
7845
|
}, q = () => {
|
|
7846
7846
|
const w = Array.from(u.entries()).at(-1);
|
|
7847
7847
|
if (!w) return;
|
|
@@ -7850,7 +7850,7 @@ const oa = (n) => JSON.stringify(n), je = (n, e = !1) => JSON.stringify([n, e]),
|
|
|
7850
7850
|
const { cursor: E, afterInclusive: D } = vn(S);
|
|
7851
7851
|
C(E, D), N(T.endCursor);
|
|
7852
7852
|
};
|
|
7853
|
-
return
|
|
7853
|
+
return m = n.subscribeQuery(
|
|
7854
7854
|
{
|
|
7855
7855
|
[a]: {
|
|
7856
7856
|
...i,
|
|
@@ -7865,10 +7865,10 @@ const oa = (n) => JSON.stringify(n), je = (n, e = !1) => JSON.stringify([n, e]),
|
|
|
7865
7865
|
async (w) => {
|
|
7866
7866
|
if (d) return;
|
|
7867
7867
|
if (w.error)
|
|
7868
|
-
return
|
|
7868
|
+
return b(w.error);
|
|
7869
7869
|
const S = w.pageInfo[a], T = w?.data?.[a];
|
|
7870
7870
|
if (Ce(T && S, "Expected rows and pageInfo"), T.length < o) {
|
|
7871
|
-
|
|
7871
|
+
g(ft, {
|
|
7872
7872
|
data: T,
|
|
7873
7873
|
status: "pre-bootstrap"
|
|
7874
7874
|
});
|
|
@@ -7876,7 +7876,7 @@ const oa = (n) => JSON.stringify(n), je = (n, e = !1) => JSON.stringify([n, e]),
|
|
|
7876
7876
|
}
|
|
7877
7877
|
const E = S.startCursor;
|
|
7878
7878
|
if (!E) {
|
|
7879
|
-
|
|
7879
|
+
g(ft, {
|
|
7880
7880
|
data: T,
|
|
7881
7881
|
status: "pre-bootstrap"
|
|
7882
7882
|
});
|
|
@@ -7888,7 +7888,7 @@ const oa = (n) => JSON.stringify(n), je = (n, e = !1) => JSON.stringify([n, e]),
|
|
|
7888
7888
|
), {
|
|
7889
7889
|
unsubscribe: () => {
|
|
7890
7890
|
if (h) {
|
|
7891
|
-
h = !1,
|
|
7891
|
+
h = !1, m?.(), m = null;
|
|
7892
7892
|
for (const w of f.values())
|
|
7893
7893
|
w?.();
|
|
7894
7894
|
f.clear();
|