@instantdb/react-common 0.22.90 → 0.22.91-experimental.btnfix.20319025226.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/standalone/index.js +477 -477
- package/dist/standalone/index.umd.cjs +7 -7
- package/package.json +3 -3
package/dist/standalone/index.js
CHANGED
|
@@ -14,11 +14,11 @@ function Ui() {
|
|
|
14
14
|
if ($n) return Re;
|
|
15
15
|
$n = 1;
|
|
16
16
|
var t = wr, e = Symbol.for("react.element"), n = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, i = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
17
|
-
function o(u, a,
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
for (
|
|
21
|
-
if (u && u.defaultProps) for (
|
|
17
|
+
function o(u, a, d) {
|
|
18
|
+
var c, f = {}, l = null, p = null;
|
|
19
|
+
d !== void 0 && (l = "" + d), a.key !== void 0 && (l = "" + a.key), a.ref !== void 0 && (p = a.ref);
|
|
20
|
+
for (c in a) r.call(a, c) && !s.hasOwnProperty(c) && (f[c] = a[c]);
|
|
21
|
+
if (u && u.defaultProps) for (c in a = u.defaultProps, a) f[c] === void 0 && (f[c] = a[c]);
|
|
22
22
|
return { $$typeof: e, type: u, key: l, ref: p, props: f, _owner: i.current };
|
|
23
23
|
}
|
|
24
24
|
return Re.Fragment = n, Re.jsx = o, Re.jsxs = o, Re;
|
|
@@ -38,7 +38,7 @@ function Li() {
|
|
|
38
38
|
* LICENSE file in the root directory of this source tree.
|
|
39
39
|
*/
|
|
40
40
|
return t.NODE_ENV !== "production" && function() {
|
|
41
|
-
var e = wr, n = Symbol.for("react.element"), r = Symbol.for("react.portal"), i = Symbol.for("react.fragment"), s = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), u = Symbol.for("react.provider"), a = Symbol.for("react.context"),
|
|
41
|
+
var e = wr, n = Symbol.for("react.element"), r = Symbol.for("react.portal"), i = Symbol.for("react.fragment"), s = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), u = Symbol.for("react.provider"), a = Symbol.for("react.context"), d = Symbol.for("react.forward_ref"), c = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), l = Symbol.for("react.memo"), p = Symbol.for("react.lazy"), y = Symbol.for("react.offscreen"), b = Symbol.iterator, _ = "@@iterator";
|
|
42
42
|
function w(h) {
|
|
43
43
|
if (h === null || typeof h != "object")
|
|
44
44
|
return null;
|
|
@@ -66,7 +66,7 @@ function Li() {
|
|
|
66
66
|
var S = !1, C = !1, $ = !1, R = !1, Pe = !1, Ge;
|
|
67
67
|
Ge = Symbol.for("react.module.reference");
|
|
68
68
|
function Qe(h) {
|
|
69
|
-
return !!(typeof h == "string" || typeof h == "function" || h === i || h === o || Pe || h === s || h ===
|
|
69
|
+
return !!(typeof h == "string" || typeof h == "function" || h === i || h === o || Pe || h === s || h === c || h === f || R || h === y || S || C || $ || typeof h == "object" && h !== null && (h.$$typeof === p || h.$$typeof === l || h.$$typeof === u || h.$$typeof === a || h.$$typeof === d || // This needs to include all possible module reference object
|
|
70
70
|
// types supported by any Flight configuration anywhere since
|
|
71
71
|
// we don't know which Flight build this will end up being used
|
|
72
72
|
// with.
|
|
@@ -98,7 +98,7 @@ function Li() {
|
|
|
98
98
|
return "Profiler";
|
|
99
99
|
case s:
|
|
100
100
|
return "StrictMode";
|
|
101
|
-
case
|
|
101
|
+
case c:
|
|
102
102
|
return "Suspense";
|
|
103
103
|
case f:
|
|
104
104
|
return "SuspenseList";
|
|
@@ -111,7 +111,7 @@ function Li() {
|
|
|
111
111
|
case u:
|
|
112
112
|
var m = h;
|
|
113
113
|
return He(m._context) + ".Provider";
|
|
114
|
-
case
|
|
114
|
+
case d:
|
|
115
115
|
return _t(h, h.render, "ForwardRef");
|
|
116
116
|
case l:
|
|
117
117
|
var O = h.displayName || null;
|
|
@@ -294,14 +294,14 @@ function Li() {
|
|
|
294
294
|
if (typeof h == "string")
|
|
295
295
|
return Ye(h);
|
|
296
296
|
switch (h) {
|
|
297
|
-
case
|
|
297
|
+
case c:
|
|
298
298
|
return Ye("Suspense");
|
|
299
299
|
case f:
|
|
300
300
|
return Ye("SuspenseList");
|
|
301
301
|
}
|
|
302
302
|
if (typeof h == "object")
|
|
303
303
|
switch (h.$$typeof) {
|
|
304
|
-
case
|
|
304
|
+
case d:
|
|
305
305
|
return hi(h.render);
|
|
306
306
|
case l:
|
|
307
307
|
return Ze(h.type, T, m);
|
|
@@ -541,7 +541,7 @@ Check the top-level render call using <` + m + ">.");
|
|
|
541
541
|
var m;
|
|
542
542
|
if (typeof T == "function")
|
|
543
543
|
m = T.propTypes;
|
|
544
|
-
else if (typeof T == "object" && (T.$$typeof ===
|
|
544
|
+
else if (typeof T == "object" && (T.$$typeof === d || // Note: Memo only checks outer props here.
|
|
545
545
|
// Inner props are checked in the reconciler.
|
|
546
546
|
T.$$typeof === l))
|
|
547
547
|
m = T.propTypes;
|
|
@@ -871,11 +871,11 @@ function Oe(t, e, n, r, i) {
|
|
|
871
871
|
if (r.length > 0) {
|
|
872
872
|
const u = r.indexOf(o);
|
|
873
873
|
if (o && typeof o == "object" && u !== -1)
|
|
874
|
-
throw r[0] === o ? new Error("Forbids circular reference") : new Error(`Forbids circular reference: ~/${i.slice(0, u).map((a,
|
|
874
|
+
throw r[0] === o ? new Error("Forbids circular reference") : new Error(`Forbids circular reference: ~/${i.slice(0, u).map((a, d) => {
|
|
875
875
|
if (typeof a == "symbol")
|
|
876
876
|
return `[${a.toString()}]`;
|
|
877
|
-
const
|
|
878
|
-
return typeof a == "object" && (
|
|
877
|
+
const c = r[d];
|
|
878
|
+
return typeof a == "object" && (c instanceof Map || c instanceof Set) ? Array.from(c.keys()).indexOf(a) : a;
|
|
879
879
|
}).join("/")}`);
|
|
880
880
|
r.push(o), i.push(e);
|
|
881
881
|
} else
|
|
@@ -932,8 +932,8 @@ function Ar(t, e, n) {
|
|
|
932
932
|
if (Te(o)) {
|
|
933
933
|
const a = k(o);
|
|
934
934
|
V(a);
|
|
935
|
-
const
|
|
936
|
-
Ve(r ? i : t, s,
|
|
935
|
+
const d = !((u = a.assignedMap) === null || u === void 0) && u.size || a.operated ? a.copy : a.original;
|
|
936
|
+
Ve(r ? i : t, s, d);
|
|
937
937
|
} else
|
|
938
938
|
Ar(o, e, n);
|
|
939
939
|
}), i) {
|
|
@@ -967,8 +967,8 @@ function nn(t, e, n, r) {
|
|
|
967
967
|
var u;
|
|
968
968
|
const a = t.type === 3 ? t.setMap : t.copy;
|
|
969
969
|
if (ce(de(a, e), n)) {
|
|
970
|
-
let
|
|
971
|
-
i.copy && (
|
|
970
|
+
let d = i.original;
|
|
971
|
+
i.copy && (d = i.copy), Dt(t), xt(t, r, s, o), t.options.enableAutoFreeze && (t.options.updatedValues = (u = t.options.updatedValues) !== null && u !== void 0 ? u : /* @__PURE__ */ new WeakMap(), t.options.updatedValues.set(d, i.original)), Ve(a, e, d);
|
|
972
972
|
}
|
|
973
973
|
}), t.options.enableAutoFreeze && i.finalities !== t.finalities && (t.options.enableAutoFreeze = !1)), ee(n, t.options) && t.finalities.draft.push(() => {
|
|
974
974
|
const s = t.type === 3 ? t.setMap : t.copy;
|
|
@@ -978,42 +978,42 @@ function nn(t, e, n, r) {
|
|
|
978
978
|
function Wi(t, e, n, r, i) {
|
|
979
979
|
let { original: s, assignedMap: o, options: u } = t, a = t.copy;
|
|
980
980
|
a.length < s.length && ([s, a] = [a, s], [n, r] = [r, n]);
|
|
981
|
-
for (let
|
|
982
|
-
if (o.get(
|
|
983
|
-
const
|
|
981
|
+
for (let d = 0; d < s.length; d += 1)
|
|
982
|
+
if (o.get(d.toString()) && a[d] !== s[d]) {
|
|
983
|
+
const c = e.concat([d]), f = be(c, i);
|
|
984
984
|
n.push({
|
|
985
985
|
op: x.Replace,
|
|
986
986
|
path: f,
|
|
987
987
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
988
|
-
value: ot(a[
|
|
988
|
+
value: ot(a[d])
|
|
989
989
|
}), r.push({
|
|
990
990
|
op: x.Replace,
|
|
991
991
|
path: f,
|
|
992
992
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
993
|
-
value: ot(s[
|
|
993
|
+
value: ot(s[d])
|
|
994
994
|
});
|
|
995
995
|
}
|
|
996
|
-
for (let
|
|
997
|
-
const
|
|
996
|
+
for (let d = s.length; d < a.length; d += 1) {
|
|
997
|
+
const c = e.concat([d]), f = be(c, i);
|
|
998
998
|
n.push({
|
|
999
999
|
op: x.Add,
|
|
1000
1000
|
path: f,
|
|
1001
1001
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
1002
|
-
value: ot(a[
|
|
1002
|
+
value: ot(a[d])
|
|
1003
1003
|
});
|
|
1004
1004
|
}
|
|
1005
1005
|
if (s.length < a.length) {
|
|
1006
|
-
const { arrayLengthAssignment:
|
|
1007
|
-
if (
|
|
1008
|
-
const
|
|
1006
|
+
const { arrayLengthAssignment: d = !0 } = u.enablePatches;
|
|
1007
|
+
if (d) {
|
|
1008
|
+
const c = e.concat(["length"]), f = be(c, i);
|
|
1009
1009
|
r.push({
|
|
1010
1010
|
op: x.Replace,
|
|
1011
1011
|
path: f,
|
|
1012
1012
|
value: s.length
|
|
1013
1013
|
});
|
|
1014
1014
|
} else
|
|
1015
|
-
for (let
|
|
1016
|
-
const f = e.concat([
|
|
1015
|
+
for (let c = a.length; s.length < c; c -= 1) {
|
|
1016
|
+
const f = e.concat([c - 1]), l = be(f, i);
|
|
1017
1017
|
r.push({
|
|
1018
1018
|
op: x.Remove,
|
|
1019
1019
|
path: l
|
|
@@ -1023,39 +1023,39 @@ function Wi(t, e, n, r, i) {
|
|
|
1023
1023
|
}
|
|
1024
1024
|
function Bi({ original: t, copy: e, assignedMap: n }, r, i, s, o) {
|
|
1025
1025
|
n.forEach((u, a) => {
|
|
1026
|
-
const
|
|
1027
|
-
if (ce(
|
|
1026
|
+
const d = de(t, a), c = ot(de(e, a)), f = u ? Fe(t, a) ? x.Replace : x.Add : x.Remove;
|
|
1027
|
+
if (ce(d, c) && f === x.Replace)
|
|
1028
1028
|
return;
|
|
1029
1029
|
const l = r.concat(a), p = be(l, o);
|
|
1030
|
-
i.push(f === x.Remove ? { op: f, path: p } : { op: f, path: p, value:
|
|
1030
|
+
i.push(f === x.Remove ? { op: f, path: p } : { op: f, path: p, value: c }), s.push(f === x.Add ? { op: x.Remove, path: p } : f === x.Remove ? { op: x.Add, path: p, value: d } : { op: x.Replace, path: p, value: d });
|
|
1031
1031
|
});
|
|
1032
1032
|
}
|
|
1033
1033
|
function Gi({ original: t, copy: e }, n, r, i, s) {
|
|
1034
1034
|
let o = 0;
|
|
1035
1035
|
t.forEach((u) => {
|
|
1036
1036
|
if (!e.has(u)) {
|
|
1037
|
-
const a = n.concat([o]),
|
|
1037
|
+
const a = n.concat([o]), d = be(a, s);
|
|
1038
1038
|
r.push({
|
|
1039
1039
|
op: x.Remove,
|
|
1040
|
-
path:
|
|
1040
|
+
path: d,
|
|
1041
1041
|
value: u
|
|
1042
1042
|
}), i.unshift({
|
|
1043
1043
|
op: x.Add,
|
|
1044
|
-
path:
|
|
1044
|
+
path: d,
|
|
1045
1045
|
value: u
|
|
1046
1046
|
});
|
|
1047
1047
|
}
|
|
1048
1048
|
o += 1;
|
|
1049
1049
|
}), o = 0, e.forEach((u) => {
|
|
1050
1050
|
if (!t.has(u)) {
|
|
1051
|
-
const a = n.concat([o]),
|
|
1051
|
+
const a = n.concat([o]), d = be(a, s);
|
|
1052
1052
|
r.push({
|
|
1053
1053
|
op: x.Add,
|
|
1054
|
-
path:
|
|
1054
|
+
path: d,
|
|
1055
1055
|
value: u
|
|
1056
1056
|
}), i.unshift({
|
|
1057
1057
|
op: x.Remove,
|
|
1058
|
-
path:
|
|
1058
|
+
path: d,
|
|
1059
1059
|
value: u
|
|
1060
1060
|
});
|
|
1061
1061
|
}
|
|
@@ -1165,16 +1165,16 @@ const ct = (t, e, n = !1) => {
|
|
|
1165
1165
|
return s;
|
|
1166
1166
|
const o = s.value;
|
|
1167
1167
|
let u = t.setMap.get(o);
|
|
1168
|
-
const a = k(u),
|
|
1169
|
-
if (t.options.strict && ct(o, t.options,
|
|
1170
|
-
const
|
|
1168
|
+
const a = k(u), d = ((i = (r = t.options).mark) === null || i === void 0 ? void 0 : i.call(r, u, Y)) === Y.mutable;
|
|
1169
|
+
if (t.options.strict && ct(o, t.options, d), !d && !a && ee(o, t.options) && !t.finalized && t.original.has(o)) {
|
|
1170
|
+
const c = Jt.createDraft({
|
|
1171
1171
|
original: o,
|
|
1172
1172
|
parentDraft: t,
|
|
1173
1173
|
key: o,
|
|
1174
1174
|
finalities: t.finalities,
|
|
1175
1175
|
options: t.options
|
|
1176
1176
|
});
|
|
1177
|
-
t.setMap.set(o,
|
|
1177
|
+
t.setMap.set(o, c), u = c;
|
|
1178
1178
|
} else a && (u = a.proxy);
|
|
1179
1179
|
return {
|
|
1180
1180
|
done: !1,
|
|
@@ -1279,30 +1279,30 @@ const Hi = Reflect.ownKeys(dt), Er = /* @__PURE__ */ new WeakSet(), kr = {
|
|
|
1279
1279
|
return t;
|
|
1280
1280
|
let o;
|
|
1281
1281
|
if (t.options.mark) {
|
|
1282
|
-
const
|
|
1283
|
-
if (o = t.options.mark(
|
|
1284
|
-
return t.options.strict && ct(
|
|
1282
|
+
const d = e === "size" && (t.original instanceof Map || t.original instanceof Set) ? Reflect.get(t.original, e) : Reflect.get(t.original, e, n);
|
|
1283
|
+
if (o = t.options.mark(d, Y), o === Y.mutable)
|
|
1284
|
+
return t.options.strict && ct(d, t.options, !0), d;
|
|
1285
1285
|
}
|
|
1286
1286
|
const u = H(t);
|
|
1287
1287
|
if (u instanceof Map && Qi.includes(e)) {
|
|
1288
1288
|
if (e === "size")
|
|
1289
1289
|
return Object.getOwnPropertyDescriptor(Ut, "size").get.call(t.proxy);
|
|
1290
|
-
const
|
|
1291
|
-
if (
|
|
1292
|
-
return
|
|
1290
|
+
const d = Ut[e];
|
|
1291
|
+
if (d)
|
|
1292
|
+
return d.bind(t.proxy);
|
|
1293
1293
|
}
|
|
1294
1294
|
if (u instanceof Set && Hi.includes(e)) {
|
|
1295
1295
|
if (e === "size")
|
|
1296
1296
|
return Object.getOwnPropertyDescriptor(dt, "size").get.call(t.proxy);
|
|
1297
|
-
const
|
|
1298
|
-
if (
|
|
1299
|
-
return
|
|
1297
|
+
const d = dt[e];
|
|
1298
|
+
if (d)
|
|
1299
|
+
return d.bind(t.proxy);
|
|
1300
1300
|
}
|
|
1301
1301
|
if (!Fe(u, e)) {
|
|
1302
|
-
const
|
|
1303
|
-
return
|
|
1302
|
+
const d = xn(u, e);
|
|
1303
|
+
return d ? "value" in d ? d.value : (
|
|
1304
1304
|
// !case: support for getter
|
|
1305
|
-
(i =
|
|
1305
|
+
(i = d.get) === null || i === void 0 ? void 0 : i.call(t.proxy)
|
|
1306
1306
|
) : void 0;
|
|
1307
1307
|
}
|
|
1308
1308
|
const a = u[e];
|
|
@@ -1316,8 +1316,8 @@ const Hi = Reflect.ownKeys(dt), Er = /* @__PURE__ */ new WeakSet(), kr = {
|
|
|
1316
1316
|
finalities: t.finalities,
|
|
1317
1317
|
options: t.options
|
|
1318
1318
|
}), typeof o == "function") {
|
|
1319
|
-
const
|
|
1320
|
-
return V(
|
|
1319
|
+
const d = k(t.copy[e]);
|
|
1320
|
+
return V(d), ie(d), d.copy;
|
|
1321
1321
|
}
|
|
1322
1322
|
return t.copy[e];
|
|
1323
1323
|
}
|
|
@@ -1379,26 +1379,26 @@ function rn(t) {
|
|
|
1379
1379
|
setMap: o === 3 ? new Map(e.entries()) : void 0
|
|
1380
1380
|
};
|
|
1381
1381
|
(r || "key" in t) && (u.key = r);
|
|
1382
|
-
const { proxy: a, revoke:
|
|
1383
|
-
if (i.revoke.push(
|
|
1384
|
-
const
|
|
1385
|
-
|
|
1382
|
+
const { proxy: a, revoke: d } = Proxy.revocable(o === 1 ? Object.assign([], u) : u, kr);
|
|
1383
|
+
if (i.revoke.push(d), Er.add(a), u.proxy = a, n) {
|
|
1384
|
+
const c = n;
|
|
1385
|
+
c.finalities.draft.push((f, l) => {
|
|
1386
1386
|
var p, y;
|
|
1387
1387
|
const b = k(a);
|
|
1388
|
-
let _ =
|
|
1388
|
+
let _ = c.type === 3 ? c.setMap : c.copy;
|
|
1389
1389
|
const w = de(_, r), g = k(w);
|
|
1390
1390
|
if (g) {
|
|
1391
1391
|
let v = g.original;
|
|
1392
|
-
g.operated && (v = en(w)), Dt(g), xt(g, ze, f, l),
|
|
1392
|
+
g.operated && (v = en(w)), Dt(g), xt(g, ze, f, l), c.options.enableAutoFreeze && (c.options.updatedValues = (p = c.options.updatedValues) !== null && p !== void 0 ? p : /* @__PURE__ */ new WeakMap(), c.options.updatedValues.set(v, g.original)), Ve(_, r, v);
|
|
1393
1393
|
}
|
|
1394
1394
|
(y = b.callbacks) === null || y === void 0 || y.forEach((v) => {
|
|
1395
1395
|
v(f, l);
|
|
1396
1396
|
});
|
|
1397
1397
|
});
|
|
1398
1398
|
} else {
|
|
1399
|
-
const
|
|
1400
|
-
|
|
1401
|
-
Dt(
|
|
1399
|
+
const c = k(a);
|
|
1400
|
+
c.finalities.draft.push((f, l) => {
|
|
1401
|
+
Dt(c), xt(c, ze, f, l);
|
|
1402
1402
|
});
|
|
1403
1403
|
}
|
|
1404
1404
|
return a;
|
|
@@ -1410,9 +1410,9 @@ function Yi(t, e, n, r, i) {
|
|
|
1410
1410
|
if (o != null && o.operated)
|
|
1411
1411
|
for (; o.finalities.draft.length > 0; )
|
|
1412
1412
|
o.finalities.draft.pop()(n, r);
|
|
1413
|
-
const
|
|
1414
|
-
return o && $t(o), i && Oe(
|
|
1415
|
-
|
|
1413
|
+
const d = a ? e[0] : o ? o.operated ? o.copy : o.original : t;
|
|
1414
|
+
return o && $t(o), i && Oe(d, d, o == null ? void 0 : o.options.updatedValues), [
|
|
1415
|
+
d,
|
|
1416
1416
|
n && a ? [{ op: x.Replace, path: [], value: e[0] }] : n,
|
|
1417
1417
|
r && a ? [{ op: x.Replace, path: [], value: u }] : r
|
|
1418
1418
|
];
|
|
@@ -1435,8 +1435,8 @@ function Ji(t, e) {
|
|
|
1435
1435
|
return [
|
|
1436
1436
|
u,
|
|
1437
1437
|
(a = []) => {
|
|
1438
|
-
const [
|
|
1439
|
-
return e.enablePatches ? [
|
|
1438
|
+
const [d, c, f] = Yi(u, a, i, s, e.enableAutoFreeze);
|
|
1439
|
+
return e.enablePatches ? [d, c, f] : d;
|
|
1440
1440
|
}
|
|
1441
1441
|
];
|
|
1442
1442
|
}
|
|
@@ -1446,12 +1446,12 @@ function Lt(t) {
|
|
|
1446
1446
|
const a = k(o);
|
|
1447
1447
|
if (a && e && a.finalities === e.finalities) {
|
|
1448
1448
|
t.isContainDraft = !0;
|
|
1449
|
-
const
|
|
1449
|
+
const d = a.original;
|
|
1450
1450
|
if (u instanceof Set) {
|
|
1451
|
-
const
|
|
1452
|
-
u.clear(),
|
|
1451
|
+
const c = Array.from(u);
|
|
1452
|
+
u.clear(), c.forEach((f) => u.add(s === f ? d : f));
|
|
1453
1453
|
} else
|
|
1454
|
-
Ve(u, s,
|
|
1454
|
+
Ve(u, s, d);
|
|
1455
1455
|
} else typeof o == "object" && o !== null && (t.value = o, t.isRoot = !1, Lt(t));
|
|
1456
1456
|
}), i && (t.isContainDraft || console.warn("The return value does not contain any draft, please use 'rawReturn()' to wrap the return value to improve performance."), r && console.warn("The return value contains drafts, please don't use 'rawReturn()' to wrap the return value."));
|
|
1457
1457
|
}
|
|
@@ -1498,21 +1498,21 @@ const Zi = (t) => function e(n, r, i) {
|
|
|
1498
1498
|
return function(S, ...C) {
|
|
1499
1499
|
return e(S, ($) => n.call(this, $, ...C), r);
|
|
1500
1500
|
};
|
|
1501
|
-
const a = n,
|
|
1502
|
-
let
|
|
1503
|
-
if (typeof r != "function" && (
|
|
1504
|
-
throw new Error(`Invalid options: ${
|
|
1505
|
-
|
|
1506
|
-
const f = Te(a) ? Fn(a) : a, l = Array.isArray(
|
|
1507
|
-
for (const $ of
|
|
1501
|
+
const a = n, d = r;
|
|
1502
|
+
let c = i;
|
|
1503
|
+
if (typeof r != "function" && (c = r), c !== void 0 && Object.prototype.toString.call(c) !== "[object Object]")
|
|
1504
|
+
throw new Error(`Invalid options: ${c}, 'options' should be an object.`);
|
|
1505
|
+
c = Object.assign(Object.assign({}, t), c);
|
|
1506
|
+
const f = Te(a) ? Fn(a) : a, l = Array.isArray(c.mark) ? (S, C) => {
|
|
1507
|
+
for (const $ of c.mark) {
|
|
1508
1508
|
if (typeof $ != "function")
|
|
1509
1509
|
throw new Error(`Invalid mark: ${$}, 'mark' should be a function.`);
|
|
1510
1510
|
const R = $(S, C);
|
|
1511
1511
|
if (R)
|
|
1512
1512
|
return R;
|
|
1513
1513
|
}
|
|
1514
|
-
} :
|
|
1515
|
-
enableAutoFreeze: (u =
|
|
1514
|
+
} : c.mark, p = (s = c.enablePatches) !== null && s !== void 0 ? s : !1, y = (o = c.strict) !== null && o !== void 0 ? o : !1, _ = {
|
|
1515
|
+
enableAutoFreeze: (u = c.enableAutoFreeze) !== null && u !== void 0 ? u : !1,
|
|
1516
1516
|
mark: l,
|
|
1517
1517
|
strict: y,
|
|
1518
1518
|
enablePatches: p
|
|
@@ -1527,7 +1527,7 @@ const Zi = (t) => function e(n, r, i) {
|
|
|
1527
1527
|
}
|
|
1528
1528
|
let v;
|
|
1529
1529
|
try {
|
|
1530
|
-
v =
|
|
1530
|
+
v = d(w);
|
|
1531
1531
|
} catch (S) {
|
|
1532
1532
|
throw $t(k(w)), S;
|
|
1533
1533
|
}
|
|
@@ -1875,8 +1875,8 @@ function ds(t) {
|
|
|
1875
1875
|
function fs(t) {
|
|
1876
1876
|
const e = /^(\d+)-(\d{1,2})-(\d{1,2})([ T])(.+)$/, n = t.match(e);
|
|
1877
1877
|
if (n) {
|
|
1878
|
-
const [, r, i, s, o, u] = n, a = i.padStart(2, "0"),
|
|
1879
|
-
return new Date(
|
|
1878
|
+
const [, r, i, s, o, u] = n, a = i.padStart(2, "0"), d = s.padStart(2, "0"), c = `${r}-${a}-${d}T${u}`;
|
|
1879
|
+
return new Date(c);
|
|
1880
1880
|
}
|
|
1881
1881
|
return null;
|
|
1882
1882
|
}
|
|
@@ -1884,8 +1884,8 @@ function ls(t) {
|
|
|
1884
1884
|
const [e, n] = t.split(", "), [r, i, s] = e.split("/").map(Number), o = n.match(/(\d{1,2}):(\d{2}):(\d{2}) (AM|PM)/);
|
|
1885
1885
|
if (!o)
|
|
1886
1886
|
throw new Error(`Unable to parse time from: ${t}`);
|
|
1887
|
-
let [, u, a,
|
|
1888
|
-
return u = Number(u), a = Number(a),
|
|
1887
|
+
let [, u, a, d, c] = o;
|
|
1888
|
+
return u = Number(u), a = Number(a), d = Number(d), c === "PM" && u !== 12 ? u += 12 : c === "AM" && u === 12 && (u = 0), new Date(Date.UTC(s, r - 1, i, u, a, d));
|
|
1889
1889
|
}
|
|
1890
1890
|
function hs(t) {
|
|
1891
1891
|
switch (t) {
|
|
@@ -2064,13 +2064,13 @@ function B(t, e, n) {
|
|
|
2064
2064
|
function Mr(t, e, n) {
|
|
2065
2065
|
const r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
|
|
2066
2066
|
for (const o of e) {
|
|
2067
|
-
let [u, a,
|
|
2068
|
-
const
|
|
2069
|
-
if (!
|
|
2067
|
+
let [u, a, d] = o;
|
|
2068
|
+
const c = t.getAttr(a);
|
|
2069
|
+
if (!c) {
|
|
2070
2070
|
console.warn("no such attr", a, u);
|
|
2071
2071
|
continue;
|
|
2072
2072
|
}
|
|
2073
|
-
|
|
2073
|
+
c["checked-data-type"] === "date" && n && (d = pt(d), o[2] = d), on(c) && B(s, [d, a, u], o), B(r, [u, a, d], o), B(i, [a, u, d], o);
|
|
2074
2074
|
}
|
|
2075
2075
|
return { eav: r, aev: i, vae: s };
|
|
2076
2076
|
}
|
|
@@ -2105,7 +2105,7 @@ function We(t, e) {
|
|
|
2105
2105
|
const [o, u] = e[0], a = t.aev.get(o);
|
|
2106
2106
|
if (!a)
|
|
2107
2107
|
return null;
|
|
2108
|
-
i = (n = G(a, 2).find((
|
|
2108
|
+
i = (n = G(a, 2).find((c) => c[2] === u)) === null || n === void 0 ? void 0 : n[0];
|
|
2109
2109
|
} else
|
|
2110
2110
|
i = e[0];
|
|
2111
2111
|
if (!i)
|
|
@@ -2115,11 +2115,11 @@ function We(t, e) {
|
|
|
2115
2115
|
const [o, u] = s, a = t.aev.get(o);
|
|
2116
2116
|
if (!a)
|
|
2117
2117
|
return null;
|
|
2118
|
-
const
|
|
2119
|
-
if (!
|
|
2118
|
+
const c = (r = G(a, 2).find((b) => b[2] === u)) === null || r === void 0 ? void 0 : r[0];
|
|
2119
|
+
if (!c)
|
|
2120
2120
|
return null;
|
|
2121
2121
|
const [f, l, p, ...y] = e;
|
|
2122
|
-
return [i, l,
|
|
2122
|
+
return [i, l, c, ...y];
|
|
2123
2123
|
} else {
|
|
2124
2124
|
const [o, ...u] = e;
|
|
2125
2125
|
return [i, ...u];
|
|
@@ -2149,7 +2149,7 @@ function Lr(t, e, n) {
|
|
|
2149
2149
|
if (!a)
|
|
2150
2150
|
return;
|
|
2151
2151
|
a["checked-data-type"] === "date" && t.useDateObjects && (u = pt(u));
|
|
2152
|
-
const
|
|
2152
|
+
const d = Ce(t.eav, [s, o, u]), c = (r = d == null ? void 0 : d[3]) !== null && r !== void 0 ? r : Ur(t, a, i), f = [s, o, u, c];
|
|
2153
2153
|
gs(a) ? (B(t.eav, [s, o], /* @__PURE__ */ new Map([[u, f]])), B(t.aev, [o, s], /* @__PURE__ */ new Map([[u, f]]))) : (B(t.eav, [s, o, u], f), B(t.aev, [o, s, u], f)), on(a) && B(t.vae, [u, o, s], f);
|
|
2154
2154
|
}
|
|
2155
2155
|
function ms(t, e, n) {
|
|
@@ -2162,17 +2162,17 @@ function ms(t, e, n) {
|
|
|
2162
2162
|
return;
|
|
2163
2163
|
if (!un(a))
|
|
2164
2164
|
throw new Error("merge operation is not supported for links");
|
|
2165
|
-
const
|
|
2166
|
-
if (!c)
|
|
2167
|
-
return;
|
|
2168
|
-
const d = (r = c.values().next()) === null || r === void 0 ? void 0 : r.value;
|
|
2165
|
+
const d = Ce(t.eav, [s, o]);
|
|
2169
2166
|
if (!d)
|
|
2170
2167
|
return;
|
|
2171
|
-
const
|
|
2168
|
+
const c = (r = d.values().next()) === null || r === void 0 ? void 0 : r.value;
|
|
2169
|
+
if (!c)
|
|
2170
|
+
return;
|
|
2171
|
+
const f = c[2], l = Ir(f, u), p = [
|
|
2172
2172
|
s,
|
|
2173
2173
|
o,
|
|
2174
2174
|
l,
|
|
2175
|
-
Ur(t, a,
|
|
2175
|
+
Ur(t, a, c)
|
|
2176
2176
|
];
|
|
2177
2177
|
B(t.eav, [s, o], /* @__PURE__ */ new Map([[l, p]])), B(t.aev, [o, s], /* @__PURE__ */ new Map([[l, p]]));
|
|
2178
2178
|
}
|
|
@@ -2181,11 +2181,11 @@ function Nt(t, e, n) {
|
|
|
2181
2181
|
const [s, o] = n, u = We(t, [s]);
|
|
2182
2182
|
if (!u)
|
|
2183
2183
|
return;
|
|
2184
|
-
const [a] = u,
|
|
2185
|
-
if (
|
|
2186
|
-
for (const f of
|
|
2184
|
+
const [a] = u, d = t.eav.get(a);
|
|
2185
|
+
if (d) {
|
|
2186
|
+
for (const f of d.keys()) {
|
|
2187
2187
|
const l = e.getAttr(f);
|
|
2188
|
-
l && l["on-delete-reverse"] === "cascade" && G(
|
|
2188
|
+
l && l["on-delete-reverse"] === "cascade" && G(d.get(f), 1).forEach(([p, y, b]) => {
|
|
2189
2189
|
var _;
|
|
2190
2190
|
return Nt(t, e, [b, (_ = l["reverse-identity"]) === null || _ === void 0 ? void 0 : _[1]]);
|
|
2191
2191
|
}), // Fall back to deleting everything if we've rehydrated tx-steps from
|
|
@@ -2194,10 +2194,10 @@ function Nt(t, e, n) {
|
|
|
2194
2194
|
!l || // Make sure it matches the etype
|
|
2195
2195
|
((r = l["forward-identity"]) === null || r === void 0 ? void 0 : r[1]) === o) && (X(t.aev, [f, a]), X(t.eav, [a, f]));
|
|
2196
2196
|
}
|
|
2197
|
-
|
|
2197
|
+
d.size === 0 && X(t.eav, [a]);
|
|
2198
2198
|
}
|
|
2199
|
-
const
|
|
2200
|
-
|
|
2199
|
+
const c = t.vae.get(a) && G(t.vae.get(a), 2);
|
|
2200
|
+
c && c.forEach((f) => {
|
|
2201
2201
|
var l, p, y;
|
|
2202
2202
|
const [b, _, w] = f, g = e.getAttr(_);
|
|
2203
2203
|
(!o || !g || ((l = g["reverse-identity"]) === null || l === void 0 ? void 0 : l[1]) === o) && (X(t.eav, [b, _, w]), X(t.aev, [_, b, w]), X(t.vae, [w, _, b])), g && g["on-delete"] === "cascade" && ((p = g["reverse-identity"]) === null || p === void 0 ? void 0 : p[1]) === o && Nt(t, e, [b, (y = g["forward-identity"]) === null || y === void 0 ? void 0 : y[1]]);
|
|
@@ -2279,16 +2279,16 @@ function tt(t, e, n) {
|
|
|
2279
2279
|
if (n != null && n.hasOwnProperty("$isNull")) {
|
|
2280
2280
|
const { attrId: o, isNull: u, reverse: a } = n.$isNull;
|
|
2281
2281
|
if (a)
|
|
2282
|
-
for (const c of e.keys()) {
|
|
2283
|
-
const d = t.vae.get(c), f = !d || !d.get(o);
|
|
2284
|
-
(u ? f : !f) && i.push(e.get(c));
|
|
2285
|
-
}
|
|
2286
|
-
else {
|
|
2287
|
-
const c = t.aev.get(o);
|
|
2288
2282
|
for (const d of e.keys()) {
|
|
2289
|
-
const
|
|
2283
|
+
const c = t.vae.get(d), f = !c || !c.get(o);
|
|
2290
2284
|
(u ? f : !f) && i.push(e.get(d));
|
|
2291
2285
|
}
|
|
2286
|
+
else {
|
|
2287
|
+
const d = t.aev.get(o);
|
|
2288
|
+
for (const c of e.keys()) {
|
|
2289
|
+
const f = !d || ((r = d.get(c)) === null || r === void 0 ? void 0 : r.get(null)) || !d.get(c);
|
|
2290
|
+
(u ? f : !f) && i.push(e.get(c));
|
|
2291
|
+
}
|
|
2292
2292
|
}
|
|
2293
2293
|
return i;
|
|
2294
2294
|
}
|
|
@@ -2325,8 +2325,8 @@ function ks(t, [e, n, r]) {
|
|
|
2325
2325
|
if (!u)
|
|
2326
2326
|
return [];
|
|
2327
2327
|
const a = [];
|
|
2328
|
-
for (const
|
|
2329
|
-
a.push(...tt(t,
|
|
2328
|
+
for (const d of u.values())
|
|
2329
|
+
a.push(...tt(t, d, r));
|
|
2330
2330
|
return a;
|
|
2331
2331
|
}
|
|
2332
2332
|
case "a": {
|
|
@@ -2338,15 +2338,15 @@ function ks(t, [e, n, r]) {
|
|
|
2338
2338
|
if (!u)
|
|
2339
2339
|
return [];
|
|
2340
2340
|
const a = [];
|
|
2341
|
-
for (const
|
|
2342
|
-
a.push(...tt(t,
|
|
2341
|
+
for (const d of u.values())
|
|
2342
|
+
a.push(...tt(t, d, r));
|
|
2343
2343
|
return a;
|
|
2344
2344
|
}
|
|
2345
2345
|
case "v": {
|
|
2346
2346
|
const u = [];
|
|
2347
2347
|
for (const a of t.eav.values())
|
|
2348
|
-
for (const
|
|
2349
|
-
u.push(...tt(t,
|
|
2348
|
+
for (const d of a.values())
|
|
2349
|
+
u.push(...tt(t, d, r));
|
|
2350
2350
|
return u;
|
|
2351
2351
|
}
|
|
2352
2352
|
default:
|
|
@@ -2360,8 +2360,8 @@ function js(t, e, n) {
|
|
|
2360
2360
|
return i;
|
|
2361
2361
|
for (const [s, o] of e.entries()) {
|
|
2362
2362
|
const u = (r = t.eav.get(n)) === null || r === void 0 ? void 0 : r.get(o.id), a = G(u, 1);
|
|
2363
|
-
for (const
|
|
2364
|
-
i[s] =
|
|
2363
|
+
for (const d of a)
|
|
2364
|
+
i[s] = d[2];
|
|
2365
2365
|
}
|
|
2366
2366
|
return i;
|
|
2367
2367
|
}
|
|
@@ -2393,20 +2393,20 @@ function Ps(t, e, n) {
|
|
|
2393
2393
|
const r = n.filter(([i, s, o, u, a]) => {
|
|
2394
2394
|
if (i !== "add-triple" && i !== "deep-merge-triple")
|
|
2395
2395
|
return !0;
|
|
2396
|
-
const
|
|
2397
|
-
if (
|
|
2396
|
+
const d = a == null ? void 0 : a.mode;
|
|
2397
|
+
if (d !== "create" && d !== "update")
|
|
2398
2398
|
return !0;
|
|
2399
|
-
let
|
|
2399
|
+
let c = !1;
|
|
2400
2400
|
const f = e.getAttr(o);
|
|
2401
2401
|
if (f) {
|
|
2402
2402
|
const l = Kr(e, f["forward-identity"][1]);
|
|
2403
|
-
|
|
2403
|
+
c = !!Is(t, e, [
|
|
2404
2404
|
s,
|
|
2405
2405
|
l == null ? void 0 : l.id,
|
|
2406
2406
|
s
|
|
2407
2407
|
]);
|
|
2408
2408
|
}
|
|
2409
|
-
return !(
|
|
2409
|
+
return !(d === "create" && c || d === "update" && !c);
|
|
2410
2410
|
});
|
|
2411
2411
|
return ft({ store: t, attrsStore: e }, (i) => {
|
|
2412
2412
|
r.forEach((s) => {
|
|
@@ -2584,18 +2584,18 @@ function zr(t, e, n, r, i) {
|
|
|
2584
2584
|
throw new ke(`Could not find attr for ${[n, i]}`);
|
|
2585
2585
|
if (u["value-type"] !== "ref")
|
|
2586
2586
|
throw new Error(`Attr ${u.id} is not a ref`);
|
|
2587
|
-
const [a,
|
|
2588
|
-
t(
|
|
2587
|
+
const [a, d] = u["forward-identity"], [c, f] = u["reverse-identity"], l = r + 1, p = s ? [
|
|
2588
|
+
t(d, r),
|
|
2589
2589
|
u.id,
|
|
2590
2590
|
t(f, l),
|
|
2591
2591
|
Ne("time")
|
|
2592
2592
|
] : [
|
|
2593
|
-
t(
|
|
2593
|
+
t(d, l),
|
|
2594
2594
|
u.id,
|
|
2595
2595
|
t(f, r),
|
|
2596
2596
|
Ne("time")
|
|
2597
2597
|
];
|
|
2598
|
-
return [s ? f :
|
|
2598
|
+
return [s ? f : d, l, p, u, !!s];
|
|
2599
2599
|
}
|
|
2600
2600
|
function Gn(t, e) {
|
|
2601
2601
|
if (typeof e != "string")
|
|
@@ -2672,12 +2672,12 @@ function io(t, e, n, r, i, s) {
|
|
|
2672
2672
|
if (!a)
|
|
2673
2673
|
throw new ke(`No attr for etype = ${n} label = ${i}`);
|
|
2674
2674
|
if (s != null && s.hasOwnProperty("$isNull")) {
|
|
2675
|
-
const
|
|
2676
|
-
if (!
|
|
2675
|
+
const d = F(e, n, "id");
|
|
2676
|
+
if (!d)
|
|
2677
2677
|
throw new ke(`No attr for etype = ${n} label = id`);
|
|
2678
2678
|
return [
|
|
2679
2679
|
t(n, r),
|
|
2680
|
-
|
|
2680
|
+
d.id,
|
|
2681
2681
|
{ $isNull: { attrId: a.id, isNull: s.$isNull, reverse: !o } },
|
|
2682
2682
|
Ne("time")
|
|
2683
2683
|
];
|
|
@@ -2690,15 +2690,15 @@ function io(t, e, n, r, i, s) {
|
|
|
2690
2690
|
] : [s, a.id, t(n, r), Ne("time")];
|
|
2691
2691
|
}
|
|
2692
2692
|
function so(t, e, n, r, i) {
|
|
2693
|
-
const [s, o, u] = i.reduce((a,
|
|
2694
|
-
const [
|
|
2693
|
+
const [s, o, u] = i.reduce((a, d) => {
|
|
2694
|
+
const [c, f, l] = a, [p, y, b] = zr(t, e, c, f, d);
|
|
2695
2695
|
return [p, y, [...l, b]];
|
|
2696
2696
|
}, [n, r, []]);
|
|
2697
2697
|
return [s, o, u];
|
|
2698
2698
|
}
|
|
2699
2699
|
function qt(t, e, n, r, i, s) {
|
|
2700
|
-
const o = i.slice(0, i.length - 1), u = i[i.length - 1], [a,
|
|
2701
|
-
return
|
|
2700
|
+
const o = i.slice(0, i.length - 1), u = i[i.length - 1], [a, d, c] = so(t, e, n, r, o), f = io(t, e, a, d, u, s);
|
|
2701
|
+
return c.concat([f]);
|
|
2702
2702
|
}
|
|
2703
2703
|
function oo(t, e) {
|
|
2704
2704
|
return e ? [e].concat(t) : t;
|
|
@@ -2716,9 +2716,9 @@ function co(t, e, n) {
|
|
|
2716
2716
|
};
|
|
2717
2717
|
}
|
|
2718
2718
|
function Qn(t, e, n, r, i, s) {
|
|
2719
|
-
const o = t(r, i), u = s.map((a,
|
|
2720
|
-
const
|
|
2721
|
-
return Vr(
|
|
2719
|
+
const o = t(r, i), u = s.map((a, d) => {
|
|
2720
|
+
const c = co(t, o, d);
|
|
2721
|
+
return Vr(c, n, r, i, a);
|
|
2722
2722
|
});
|
|
2723
2723
|
return { [e]: { patterns: u, joinSym: o } };
|
|
2724
2724
|
}
|
|
@@ -2743,11 +2743,11 @@ function Vr(t, e, n, r, i) {
|
|
|
2743
2743
|
return [];
|
|
2744
2744
|
const u = s.split(".");
|
|
2745
2745
|
if (o != null && o.hasOwnProperty("$ne") && (o = Object.assign(Object.assign({}, o), { $not: o.$ne }), delete o.$ne), o != null && o.hasOwnProperty("$not")) {
|
|
2746
|
-
const a = qt(t, e, n, r, u, o),
|
|
2746
|
+
const a = qt(t, e, n, r, u, o), d = Hn(t, e, n, r, u);
|
|
2747
2747
|
return [
|
|
2748
2748
|
{
|
|
2749
2749
|
or: {
|
|
2750
|
-
patterns: [a, ...
|
|
2750
|
+
patterns: [a, ...d],
|
|
2751
2751
|
joinSym: t(n, r)
|
|
2752
2752
|
}
|
|
2753
2753
|
}
|
|
@@ -2771,17 +2771,17 @@ function ho(t, e, n) {
|
|
|
2771
2771
|
return [t(e, n), t("time", n)];
|
|
2772
2772
|
}
|
|
2773
2773
|
function po(t, e, n, r, i, s) {
|
|
2774
|
-
const [o, u, a,
|
|
2775
|
-
return [o, u, f,
|
|
2774
|
+
const [o, u, a, d, c] = zr(t, e, n, r, i), f = no(a, t(n, r), s);
|
|
2775
|
+
return [o, u, f, d, c];
|
|
2776
2776
|
}
|
|
2777
2777
|
function yo(t, e, n, { etype: r, level: i, form: s }, o) {
|
|
2778
2778
|
const u = Object.keys(s).filter((a) => a !== "$");
|
|
2779
|
-
return u.length ? Object.entries(o).map(function([
|
|
2779
|
+
return u.length ? Object.entries(o).map(function([d, c]) {
|
|
2780
2780
|
return u.map(function(p) {
|
|
2781
2781
|
var y, b, _;
|
|
2782
2782
|
const w = !!(e.cardinalityInference && (!((_ = (b = (y = n.linkIndex) === null || y === void 0 ? void 0 : y[r]) === null || b === void 0 ? void 0 : b[p]) === null || _ === void 0) && _.isSingular));
|
|
2783
2783
|
try {
|
|
2784
|
-
const [g, v, A] = po(t, n, r, i, p,
|
|
2784
|
+
const [g, v, A] = po(t, n, r, i, p, d), S = Br(e, n, {
|
|
2785
2785
|
etype: g,
|
|
2786
2786
|
level: v,
|
|
2787
2787
|
form: s[p],
|
|
@@ -2795,7 +2795,7 @@ function yo(t, e, n, { etype: r, level: i, form: s }, o) {
|
|
|
2795
2795
|
}
|
|
2796
2796
|
}).reduce(function(p, y) {
|
|
2797
2797
|
return Object.assign(Object.assign({}, p), y);
|
|
2798
|
-
},
|
|
2798
|
+
}, c);
|
|
2799
2799
|
}) : Object.values(o);
|
|
2800
2800
|
}
|
|
2801
2801
|
function bo(t, e, n) {
|
|
@@ -2812,11 +2812,11 @@ function zt(t) {
|
|
|
2812
2812
|
}
|
|
2813
2813
|
function _o(t, e, n, r) {
|
|
2814
2814
|
var i;
|
|
2815
|
-
const [s, o, u, a] = t,
|
|
2815
|
+
const [s, o, u, a] = t, d = n === "desc" ? 1 : -1;
|
|
2816
2816
|
if (((i = e["forward-identity"]) === null || i === void 0 ? void 0 : i[2]) === "id")
|
|
2817
|
-
return lt(r, [s, a], null) ===
|
|
2818
|
-
const [
|
|
2819
|
-
return lt([
|
|
2817
|
+
return lt(r, [s, a], null) === d;
|
|
2818
|
+
const [c, f] = r, l = e["checked-data-type"], p = l === "date" ? zt(f) : f, y = l === "date" ? zt(u) : u;
|
|
2819
|
+
return lt([c, p], [s, y], l) === d;
|
|
2820
2820
|
}
|
|
2821
2821
|
function go(t, e) {
|
|
2822
2822
|
const n = e[1];
|
|
@@ -2849,7 +2849,7 @@ function mo(t, e, n) {
|
|
|
2849
2849
|
}
|
|
2850
2850
|
function vo(t, e, { etype: n, pageInfo: r, dq: i, form: s }) {
|
|
2851
2851
|
var o, u;
|
|
2852
|
-
const a = (o = s == null ? void 0 : s.$) === null || o === void 0 ? void 0 : o.order,
|
|
2852
|
+
const a = (o = s == null ? void 0 : s.$) === null || o === void 0 ? void 0 : o.order, d = Wr(s), c = So(s);
|
|
2853
2853
|
let f = Ns(t, i);
|
|
2854
2854
|
const l = r == null ? void 0 : r["start-cursor"], p = wo(e, n, l, a);
|
|
2855
2855
|
if (p && ((u = p == null ? void 0 : p["forward-identity"]) === null || u === void 0 ? void 0 : u[2]) !== "id") {
|
|
@@ -2860,7 +2860,7 @@ function vo(t, e, { etype: n, pageInfo: r, dq: i, form: s }) {
|
|
|
2860
2860
|
return _ && (R = zt(R)), [g, R];
|
|
2861
2861
|
});
|
|
2862
2862
|
}
|
|
2863
|
-
f.sort(
|
|
2863
|
+
f.sort(c === "asc" ? function(w, g) {
|
|
2864
2864
|
return lt(w, g, p == null ? void 0 : p["checked-data-type"]);
|
|
2865
2865
|
} : function(w, g) {
|
|
2866
2866
|
return lt(g, w, p == null ? void 0 : p["checked-data-type"]);
|
|
@@ -2869,7 +2869,7 @@ function vo(t, e, { etype: n, pageInfo: r, dq: i, form: s }) {
|
|
|
2869
2869
|
const b = mo(e, n, i);
|
|
2870
2870
|
for (const _ of f) {
|
|
2871
2871
|
const [w] = _;
|
|
2872
|
-
if (y[w] || !
|
|
2872
|
+
if (y[w] || !d && l && p && _o(l, p, c, _))
|
|
2873
2873
|
continue;
|
|
2874
2874
|
const g = js(t, b, w);
|
|
2875
2875
|
g && (y[w] = g);
|
|
@@ -2887,7 +2887,7 @@ function Wr(t) {
|
|
|
2887
2887
|
return !i && !s && !o;
|
|
2888
2888
|
}
|
|
2889
2889
|
function Oo(t, e, { etype: n, level: r, form: i, join: s, pageInfo: o }) {
|
|
2890
|
-
var u, a,
|
|
2890
|
+
var u, a, d, c, f;
|
|
2891
2891
|
if (!Wr(i) && (!o || !o["start-cursor"]))
|
|
2892
2892
|
return [];
|
|
2893
2893
|
const l = oo(lo(e, n, r, (u = i.$) === null || u === void 0 ? void 0 : u.where), s), p = ho(yt, n, r), y = (a = i.$) === null || a === void 0 ? void 0 : a.fields, b = vo(t, e, {
|
|
@@ -2895,7 +2895,7 @@ function Oo(t, e, { etype: n, level: r, form: i, join: s, pageInfo: o }) {
|
|
|
2895
2895
|
pageInfo: o,
|
|
2896
2896
|
form: i,
|
|
2897
2897
|
dq: { where: l, find: p, fields: y }
|
|
2898
|
-
}), _ = ((
|
|
2898
|
+
}), _ = ((d = i.$) === null || d === void 0 ? void 0 : d.limit) || ((c = i.$) === null || c === void 0 ? void 0 : c.first) || ((f = i.$) === null || f === void 0 ? void 0 : f.last);
|
|
2899
2899
|
if (_ != null) {
|
|
2900
2900
|
r > 0 && console.warn("WARNING: Limits in child queries are only run client-side. Data returned from the server will not have a limit.");
|
|
2901
2901
|
const w = Object.entries(b);
|
|
@@ -2928,12 +2928,12 @@ function Eo(t) {
|
|
|
2928
2928
|
return e;
|
|
2929
2929
|
}
|
|
2930
2930
|
function Gr({ store: t, attrsStore: e, pageInfo: n, aggregate: r }, i) {
|
|
2931
|
-
const o = { data: Object.keys(i).reduce(function(a,
|
|
2932
|
-
return r != null && r[
|
|
2933
|
-
etype:
|
|
2934
|
-
form: i[
|
|
2931
|
+
const o = { data: Object.keys(i).reduce(function(a, d) {
|
|
2932
|
+
return r != null && r[d] || d === "$$ruleParams" || (a[d] = Br(t, e, {
|
|
2933
|
+
etype: d,
|
|
2934
|
+
form: i[d],
|
|
2935
2935
|
level: 0,
|
|
2936
|
-
pageInfo: n == null ? void 0 : n[
|
|
2936
|
+
pageInfo: n == null ? void 0 : n[d]
|
|
2937
2937
|
})), a;
|
|
2938
2938
|
}, {}) };
|
|
2939
2939
|
return n && (o.pageInfo = Eo(n)), r && (o.aggregate = r), o;
|
|
@@ -3009,8 +3009,8 @@ function Po(t, e) {
|
|
|
3009
3009
|
if (u)
|
|
3010
3010
|
i.push(u);
|
|
3011
3011
|
else if (Array.isArray(o) && o.length == 2 && n[o[0]]) {
|
|
3012
|
-
const [a,
|
|
3013
|
-
i.push([n[a],
|
|
3012
|
+
const [a, d] = o;
|
|
3013
|
+
i.push([n[a], d]);
|
|
3014
3014
|
} else
|
|
3015
3015
|
i.push(o);
|
|
3016
3016
|
}
|
|
@@ -3072,20 +3072,20 @@ function Hr(t, e, n, r) {
|
|
|
3072
3072
|
}
|
|
3073
3073
|
function Do({ attrsStore: t }, [e, n, r]) {
|
|
3074
3074
|
const i = Object.entries(r).flatMap(([s, o]) => {
|
|
3075
|
-
const u = Array.isArray(o) ? o : [o], a = F(t, e, s),
|
|
3076
|
-
return u.map((
|
|
3075
|
+
const u = Array.isArray(o) ? o : [o], a = F(t, e, s), d = me(t, e, s);
|
|
3076
|
+
return u.map((c) => a ? [
|
|
3077
3077
|
"add-triple",
|
|
3078
3078
|
Q(t, e, n),
|
|
3079
3079
|
a.id,
|
|
3080
3080
|
// Uses `!` because if we get here, we should have created the attr if it doesn't
|
|
3081
3081
|
// already exist
|
|
3082
|
-
Q(t, a["reverse-identity"][1],
|
|
3082
|
+
Q(t, a["reverse-identity"][1], c)
|
|
3083
3083
|
] : [
|
|
3084
3084
|
"add-triple",
|
|
3085
3085
|
// Uses `!` because if we get here, we should have created the attr if it doesn't
|
|
3086
3086
|
// already exist
|
|
3087
|
-
Q(t,
|
|
3088
|
-
|
|
3087
|
+
Q(t, d["forward-identity"][1], c),
|
|
3088
|
+
d == null ? void 0 : d.id,
|
|
3089
3089
|
Q(t, e, n)
|
|
3090
3090
|
]);
|
|
3091
3091
|
});
|
|
@@ -3093,20 +3093,20 @@ function Do({ attrsStore: t }, [e, n, r]) {
|
|
|
3093
3093
|
}
|
|
3094
3094
|
function xo({ attrsStore: t }, [e, n, r]) {
|
|
3095
3095
|
const i = Object.entries(r).flatMap(([s, o]) => {
|
|
3096
|
-
const u = Array.isArray(o) ? o : [o], a = F(t, e, s),
|
|
3097
|
-
return u.map((
|
|
3096
|
+
const u = Array.isArray(o) ? o : [o], a = F(t, e, s), d = me(t, e, s);
|
|
3097
|
+
return u.map((c) => a ? [
|
|
3098
3098
|
"retract-triple",
|
|
3099
3099
|
Q(t, e, n),
|
|
3100
3100
|
a.id,
|
|
3101
3101
|
// Uses `!` because if we get here, we should have created the attr if it doesn't
|
|
3102
3102
|
// already exist
|
|
3103
|
-
Q(t, a["reverse-identity"][1],
|
|
3103
|
+
Q(t, a["reverse-identity"][1], c)
|
|
3104
3104
|
] : [
|
|
3105
3105
|
"retract-triple",
|
|
3106
3106
|
// Uses `!` because if we get here, we should have created the attr if it doesn't
|
|
3107
3107
|
// already exist
|
|
3108
|
-
Q(t,
|
|
3109
|
-
|
|
3108
|
+
Q(t, d["forward-identity"][1], c),
|
|
3109
|
+
d.id,
|
|
3110
3110
|
Q(t, e, n)
|
|
3111
3111
|
]);
|
|
3112
3112
|
});
|
|
@@ -3119,7 +3119,7 @@ function Uo(t, e, n, r) {
|
|
|
3119
3119
|
for (const u of t || []) {
|
|
3120
3120
|
const a = u == null ? void 0 : u.aev.get(s);
|
|
3121
3121
|
if (a) {
|
|
3122
|
-
for (const [
|
|
3122
|
+
for (const [d, c, f] of G(a, 2))
|
|
3123
3123
|
if (f === o)
|
|
3124
3124
|
return !0;
|
|
3125
3125
|
}
|
|
@@ -3140,13 +3140,13 @@ function Yr({ stores: t, attrsStore: e }, [n, r, i, s]) {
|
|
|
3140
3140
|
}
|
|
3141
3141
|
function Lo(t, e) {
|
|
3142
3142
|
const { attrsStore: n } = t, [r, i, s, o] = e, u = sn(s), a = Q(n, r, i);
|
|
3143
|
-
return [["id", a]].concat(Object.entries(u)).map(([
|
|
3144
|
-
const l = F(n, r,
|
|
3143
|
+
return [["id", a]].concat(Object.entries(u)).map(([c, f]) => {
|
|
3144
|
+
const l = F(n, r, c);
|
|
3145
3145
|
return l["checked-data-type"] === "date" && t.useDateObjects && (f = pt(f)), ["add-triple", a, l.id, f, { mode: "create" }];
|
|
3146
3146
|
});
|
|
3147
3147
|
}
|
|
3148
3148
|
function Fo(t, e) {
|
|
3149
|
-
const { attrsStore: n } = t, [r, i, s, o] = e, u = sn(s), a = Q(n, r, i),
|
|
3149
|
+
const { attrsStore: n } = t, [r, i, s, o] = e, u = sn(s), a = Q(n, r, i), d = Yr(t, [r, a, s, o]);
|
|
3150
3150
|
return [["id", a]].concat(Object.entries(u)).map(([f, l]) => {
|
|
3151
3151
|
const p = F(n, r, f);
|
|
3152
3152
|
return p["checked-data-type"] === "date" && t.useDateObjects && (l = pt(l)), [
|
|
@@ -3154,7 +3154,7 @@ function Fo(t, e) {
|
|
|
3154
3154
|
a,
|
|
3155
3155
|
p.id,
|
|
3156
3156
|
l,
|
|
3157
|
-
...
|
|
3157
|
+
...d ? [d] : []
|
|
3158
3158
|
];
|
|
3159
3159
|
});
|
|
3160
3160
|
}
|
|
@@ -3162,14 +3162,14 @@ function No({ attrsStore: t }, [e, n]) {
|
|
|
3162
3162
|
return [["delete-entity", Q(t, e, n), e]];
|
|
3163
3163
|
}
|
|
3164
3164
|
function Ko(t, e) {
|
|
3165
|
-
const { attrsStore: n } = t, [r, i, s, o] = e, u = sn(s), a = Q(n, r, i),
|
|
3165
|
+
const { attrsStore: n } = t, [r, i, s, o] = e, u = sn(s), a = Q(n, r, i), d = Yr(t, [r, a, s, o]), c = Object.entries(u).map(([l, p]) => {
|
|
3166
3166
|
const y = F(n, r, l);
|
|
3167
3167
|
return [
|
|
3168
3168
|
"deep-merge-triple",
|
|
3169
3169
|
a,
|
|
3170
3170
|
y.id,
|
|
3171
3171
|
p,
|
|
3172
|
-
...
|
|
3172
|
+
...d ? [d] : []
|
|
3173
3173
|
];
|
|
3174
3174
|
});
|
|
3175
3175
|
return [[
|
|
@@ -3177,8 +3177,8 @@ function Ko(t, e) {
|
|
|
3177
3177
|
a,
|
|
3178
3178
|
F(n, r, "id").id,
|
|
3179
3179
|
a,
|
|
3180
|
-
...
|
|
3181
|
-
]].concat(
|
|
3180
|
+
...d ? [d] : []
|
|
3181
|
+
]].concat(c);
|
|
3182
3182
|
}
|
|
3183
3183
|
function qo({ attrsStore: t }, [e, n, r]) {
|
|
3184
3184
|
return [["rule-params", Q(t, e, n), e, r]];
|
|
@@ -3289,9 +3289,9 @@ function eu(t) {
|
|
|
3289
3289
|
const o = Bt(i);
|
|
3290
3290
|
if (o && e.push({ etype: r, lookupPair: o }), n === "link")
|
|
3291
3291
|
for (const [u, a] of Object.entries(s)) {
|
|
3292
|
-
const
|
|
3293
|
-
for (const
|
|
3294
|
-
const f = Bt(
|
|
3292
|
+
const d = Array.isArray(a) ? a : [a];
|
|
3293
|
+
for (const c of d) {
|
|
3294
|
+
const f = Bt(c);
|
|
3295
3295
|
f && e.push({
|
|
3296
3296
|
etype: r,
|
|
3297
3297
|
lookupPair: f,
|
|
@@ -3307,13 +3307,13 @@ function tu({ attrsStore: t, schema: e }, n) {
|
|
|
3307
3307
|
function a(y, b) {
|
|
3308
3308
|
return F(t, y, b) || o.find((_) => _["forward-identity"][1] === y && _["forward-identity"][2] === b);
|
|
3309
3309
|
}
|
|
3310
|
-
function
|
|
3310
|
+
function d(y, b) {
|
|
3311
3311
|
return me(t, y, b) || o.find((_) => {
|
|
3312
3312
|
var w, g;
|
|
3313
3313
|
return ((w = _["reverse-identity"]) === null || w === void 0 ? void 0 : w[1]) === y && ((g = _["reverse-identity"]) === null || g === void 0 ? void 0 : g[2]) === b;
|
|
3314
3314
|
});
|
|
3315
3315
|
}
|
|
3316
|
-
function
|
|
3316
|
+
function c(y) {
|
|
3317
3317
|
o.push(y), u.push(["add-attr", y]), s.add(y.id);
|
|
3318
3318
|
}
|
|
3319
3319
|
function f(y) {
|
|
@@ -3325,40 +3325,40 @@ function tu({ attrsStore: t, schema: e }, n) {
|
|
|
3325
3325
|
!a(y, b);
|
|
3326
3326
|
}
|
|
3327
3327
|
function p(y, b) {
|
|
3328
|
-
const _ = a(y, b), w =
|
|
3329
|
-
f(_), f(w), !_ && !w &&
|
|
3328
|
+
const _ = a(y, b), w = d(y, b);
|
|
3329
|
+
f(_), f(w), !_ && !w && c(Yn(e, y, b, Xo));
|
|
3330
3330
|
}
|
|
3331
3331
|
for (const y of n)
|
|
3332
3332
|
for (const { etype: b, lookupPair: _, linkLabel: w } of eu(y)) {
|
|
3333
3333
|
const g = _[0];
|
|
3334
3334
|
if (w) {
|
|
3335
3335
|
p(b, w);
|
|
3336
|
-
const v = a(b, w), A =
|
|
3336
|
+
const v = a(b, w), A = d(b, w);
|
|
3337
3337
|
f(v), f(A);
|
|
3338
3338
|
const S = ((r = v == null ? void 0 : v["reverse-identity"]) === null || r === void 0 ? void 0 : r[1]) || ((i = A == null ? void 0 : A["forward-identity"]) === null || i === void 0 ? void 0 : i[1]) || w;
|
|
3339
3339
|
if (l(S, g))
|
|
3340
3340
|
p(S, Wt(g));
|
|
3341
3341
|
else {
|
|
3342
3342
|
const C = a(S, g);
|
|
3343
|
-
C ||
|
|
3343
|
+
C || c(nt(e, S, g, Gt)), f(C);
|
|
3344
3344
|
}
|
|
3345
3345
|
} else if (l(b, g))
|
|
3346
3346
|
p(b, Wt(g));
|
|
3347
3347
|
else {
|
|
3348
3348
|
const v = a(b, g);
|
|
3349
|
-
v ||
|
|
3349
|
+
v || c(nt(e, b, g, Gt)), f(v);
|
|
3350
3350
|
}
|
|
3351
3351
|
}
|
|
3352
3352
|
for (const y of n) {
|
|
3353
3353
|
const [b, _, w, g] = y;
|
|
3354
3354
|
if (Ho.has(b)) {
|
|
3355
3355
|
const v = a(_, "id");
|
|
3356
|
-
f(v), v ||
|
|
3356
|
+
f(v), v || c(nt(e, _, "id", { "unique?": !0 }));
|
|
3357
3357
|
for (const A of Object.keys(g)) {
|
|
3358
3358
|
const S = a(_, A);
|
|
3359
|
-
if (f(S), Jo.has(b) && (S ||
|
|
3360
|
-
const C =
|
|
3361
|
-
!S && !C &&
|
|
3359
|
+
if (f(S), Jo.has(b) && (S || c(nt(e, _, A, A === "id" ? { "unique?": !0 } : null))), Yo.has(b)) {
|
|
3360
|
+
const C = d(_, A);
|
|
3361
|
+
!S && !C && c(Yn(e, _, A)), f(C);
|
|
3362
3362
|
}
|
|
3363
3363
|
}
|
|
3364
3364
|
}
|
|
@@ -3382,24 +3382,24 @@ var re = function(t, e, n, r) {
|
|
|
3382
3382
|
});
|
|
3383
3383
|
}
|
|
3384
3384
|
return new (n || (n = Promise))(function(s, o) {
|
|
3385
|
-
function u(
|
|
3385
|
+
function u(c) {
|
|
3386
3386
|
try {
|
|
3387
|
-
|
|
3387
|
+
d(r.next(c));
|
|
3388
3388
|
} catch (f) {
|
|
3389
3389
|
o(f);
|
|
3390
3390
|
}
|
|
3391
3391
|
}
|
|
3392
|
-
function a(
|
|
3392
|
+
function a(c) {
|
|
3393
3393
|
try {
|
|
3394
|
-
|
|
3394
|
+
d(r.throw(c));
|
|
3395
3395
|
} catch (f) {
|
|
3396
3396
|
o(f);
|
|
3397
3397
|
}
|
|
3398
3398
|
}
|
|
3399
|
-
function c
|
|
3400
|
-
|
|
3399
|
+
function d(c) {
|
|
3400
|
+
c.done ? s(c.value) : i(c.value).then(u, a);
|
|
3401
3401
|
}
|
|
3402
|
-
|
|
3402
|
+
d((r = r.apply(t, e || [])).next());
|
|
3403
3403
|
});
|
|
3404
3404
|
};
|
|
3405
3405
|
function Jn(t, e) {
|
|
@@ -3522,12 +3522,12 @@ class Qt {
|
|
|
3522
3522
|
const y = this._persister.removeItem(p);
|
|
3523
3523
|
i.push(y.then(() => 1)), this._loadedKeys.delete(p), this._pendingSaveKeys.delete(p);
|
|
3524
3524
|
}
|
|
3525
|
-
const
|
|
3525
|
+
const d = [], c = [[Ke, o]], f = (n = o.objects) !== null && n !== void 0 ? n : {};
|
|
3526
3526
|
o.objects = f;
|
|
3527
3527
|
for (const p of a)
|
|
3528
3528
|
if (this._loadedKeys.has(p)) {
|
|
3529
3529
|
const y = this.serialize(p, this.currentValue[p]);
|
|
3530
|
-
|
|
3530
|
+
c.push([p, y]);
|
|
3531
3531
|
const b = this._objectSize(y), _ = (r = f[p]) !== null && r !== void 0 ? r : {
|
|
3532
3532
|
createdAt: Date.now(),
|
|
3533
3533
|
updatedAt: Date.now(),
|
|
@@ -3535,10 +3535,10 @@ class Qt {
|
|
|
3535
3535
|
};
|
|
3536
3536
|
_.updatedAt = Date.now(), _.size = b, f[p] = _, this._pendingSaveKeys.delete(p);
|
|
3537
3537
|
} else
|
|
3538
|
-
|
|
3539
|
-
const l = this._persister.multiSet(
|
|
3538
|
+
d.push(p);
|
|
3539
|
+
const l = this._persister.multiSet(c);
|
|
3540
3540
|
i.push(l.then(() => 1));
|
|
3541
|
-
for (const p of
|
|
3541
|
+
for (const p of d) {
|
|
3542
3542
|
const y = this._loadKey(p).then(() => this._enqueuePersist(e));
|
|
3543
3543
|
i.push(y);
|
|
3544
3544
|
}
|
|
@@ -3587,12 +3587,12 @@ class Qt {
|
|
|
3587
3587
|
if (u.length > this._gcOpts.maxEntries)
|
|
3588
3588
|
for (const [l] of a.slice(0, u.length - this._gcOpts.maxEntries))
|
|
3589
3589
|
i.push(this._persister.removeItem(l)), delete r.objects[l], s.removed.push(l), s.removedThresholdCount++;
|
|
3590
|
-
const
|
|
3591
|
-
|
|
3592
|
-
const
|
|
3593
|
-
let f =
|
|
3594
|
-
for (; f > 0 && f > this._gcOpts.maxSize &&
|
|
3595
|
-
const [[l, p]] =
|
|
3590
|
+
const d = Object.entries(r.objects);
|
|
3591
|
+
d.sort(([l, p], [y, b]) => p.updatedAt - b.updatedAt);
|
|
3592
|
+
const c = d.filter(([l]) => !n.has(l));
|
|
3593
|
+
let f = d.reduce((l, [p, y]) => l + y.size, 0);
|
|
3594
|
+
for (; f > 0 && f > this._gcOpts.maxSize && c.length; ) {
|
|
3595
|
+
const [[l, p]] = c.splice(0, 1);
|
|
3596
3596
|
f -= p.size, i.push(this._persister.removeItem(l)), delete r.objects[l], s.removed.push(l), s.removedSizeCount++;
|
|
3597
3597
|
}
|
|
3598
3598
|
for (const l of Object.keys(r.objects))
|
|
@@ -3658,24 +3658,24 @@ var ue = function(t, e, n, r) {
|
|
|
3658
3658
|
});
|
|
3659
3659
|
}
|
|
3660
3660
|
return new (n || (n = Promise))(function(s, o) {
|
|
3661
|
-
function u(
|
|
3661
|
+
function u(c) {
|
|
3662
3662
|
try {
|
|
3663
|
-
|
|
3663
|
+
d(r.next(c));
|
|
3664
3664
|
} catch (f) {
|
|
3665
3665
|
o(f);
|
|
3666
3666
|
}
|
|
3667
3667
|
}
|
|
3668
|
-
function a(
|
|
3668
|
+
function a(c) {
|
|
3669
3669
|
try {
|
|
3670
|
-
|
|
3670
|
+
d(r.throw(c));
|
|
3671
3671
|
} catch (f) {
|
|
3672
3672
|
o(f);
|
|
3673
3673
|
}
|
|
3674
3674
|
}
|
|
3675
|
-
function c
|
|
3676
|
-
|
|
3675
|
+
function d(c) {
|
|
3676
|
+
c.done ? s(c.value) : i(c.value).then(u, a);
|
|
3677
3677
|
}
|
|
3678
|
-
|
|
3678
|
+
d((r = r.apply(t, e || [])).next());
|
|
3679
3679
|
});
|
|
3680
3680
|
};
|
|
3681
3681
|
const iu = 6, su = ["kv", "querySubs", "syncSubs"];
|
|
@@ -3710,7 +3710,7 @@ function au(t, e, n) {
|
|
|
3710
3710
|
return;
|
|
3711
3711
|
const i = /* @__PURE__ */ new Set();
|
|
3712
3712
|
return new Promise((s, o) => {
|
|
3713
|
-
var u, a,
|
|
3713
|
+
var u, a, d, c;
|
|
3714
3714
|
const f = {};
|
|
3715
3715
|
for (const [y, b] of Object.entries(r)) {
|
|
3716
3716
|
const _ = typeof b == "string" ? JSON.parse(b) : b;
|
|
@@ -3718,7 +3718,7 @@ function au(t, e, n) {
|
|
|
3718
3718
|
const g = {
|
|
3719
3719
|
createdAt: _.lastAccessed,
|
|
3720
3720
|
updatedAt: _.lastAccessed,
|
|
3721
|
-
size: (
|
|
3721
|
+
size: (c = (d = (a = (u = _.result) === null || u === void 0 ? void 0 : u.store) === null || a === void 0 ? void 0 : a.triples) === null || d === void 0 ? void 0 : d.length) !== null && c !== void 0 ? c : 0
|
|
3722
3722
|
};
|
|
3723
3723
|
f[y] = g;
|
|
3724
3724
|
}
|
|
@@ -3749,7 +3749,7 @@ function cu(t, e) {
|
|
|
3749
3749
|
const n = yield uu(`instant_${t}_5`);
|
|
3750
3750
|
if (!n)
|
|
3751
3751
|
return;
|
|
3752
|
-
const r = yield new Promise((
|
|
3752
|
+
const r = yield new Promise((c, f) => {
|
|
3753
3753
|
const y = n.transaction(["kv"], "readonly").objectStore("kv").openCursor();
|
|
3754
3754
|
y.onerror = (_) => {
|
|
3755
3755
|
f(_);
|
|
@@ -3761,33 +3761,33 @@ function cu(t, e) {
|
|
|
3761
3761
|
const w = _.key, g = _.value;
|
|
3762
3762
|
b.push([w, g]), _.continue();
|
|
3763
3763
|
} else
|
|
3764
|
-
|
|
3764
|
+
c(b);
|
|
3765
3765
|
}, y.onerror = (_) => {
|
|
3766
3766
|
f(_);
|
|
3767
3767
|
};
|
|
3768
3768
|
}), i = e.transaction(["kv", "querySubs"], "readwrite"), s = i.objectStore("kv"), o = i.objectStore("querySubs"), u = [], a = { objects: {} };
|
|
3769
|
-
for (const [
|
|
3770
|
-
switch (
|
|
3769
|
+
for (const [c, f] of r)
|
|
3770
|
+
switch (c) {
|
|
3771
3771
|
case "querySubs": {
|
|
3772
|
-
const l = au(
|
|
3772
|
+
const l = au(c, f, o);
|
|
3773
3773
|
u.push(l);
|
|
3774
3774
|
break;
|
|
3775
3775
|
}
|
|
3776
3776
|
default: {
|
|
3777
|
-
const l = Zn(
|
|
3777
|
+
const l = Zn(c, f, s);
|
|
3778
3778
|
u.push(l);
|
|
3779
3779
|
const p = {
|
|
3780
3780
|
createdAt: Date.now(),
|
|
3781
3781
|
updatedAt: Date.now(),
|
|
3782
3782
|
size: 0
|
|
3783
3783
|
};
|
|
3784
|
-
a.objects[
|
|
3784
|
+
a.objects[c] = p;
|
|
3785
3785
|
break;
|
|
3786
3786
|
}
|
|
3787
3787
|
}
|
|
3788
|
-
const
|
|
3789
|
-
u.push(
|
|
3790
|
-
i.oncomplete = (l) =>
|
|
3788
|
+
const d = Zn(Ke, a, s);
|
|
3789
|
+
u.push(d), yield Promise.all(u), yield new Promise((c, f) => {
|
|
3790
|
+
i.oncomplete = (l) => c(l), i.onerror = (l) => f(l), i.onabort = (l) => f(l);
|
|
3791
3791
|
});
|
|
3792
3792
|
});
|
|
3793
3793
|
}
|
|
@@ -3805,8 +3805,8 @@ class Jr extends ru {
|
|
|
3805
3805
|
}, i.onsuccess = (s) => {
|
|
3806
3806
|
const u = s.target.result;
|
|
3807
3807
|
if (r) {
|
|
3808
|
-
const a = cu(this._appId, u).catch((
|
|
3809
|
-
ou("Error upgrading store from version 5 to 6.")(
|
|
3808
|
+
const a = cu(this._appId, u).catch((d) => {
|
|
3809
|
+
ou("Error upgrading store from version 5 to 6.")(d);
|
|
3810
3810
|
});
|
|
3811
3811
|
Xn.set(this.dbName, a), a.then(() => e(u)).catch(() => e(u));
|
|
3812
3812
|
} else {
|
|
@@ -3841,9 +3841,9 @@ class Jr extends ru {
|
|
|
3841
3841
|
const r = yield this._dbPromise;
|
|
3842
3842
|
return new Promise((i, s) => {
|
|
3843
3843
|
const a = r.transaction([this._storeName], "readwrite").objectStore(this._storeName).put(n, e);
|
|
3844
|
-
a.onerror = (
|
|
3845
|
-
s(
|
|
3846
|
-
}, a.onsuccess = (
|
|
3844
|
+
a.onerror = (d) => {
|
|
3845
|
+
s(d);
|
|
3846
|
+
}, a.onsuccess = (d) => {
|
|
3847
3847
|
i();
|
|
3848
3848
|
};
|
|
3849
3849
|
});
|
|
@@ -3855,14 +3855,14 @@ class Jr extends ru {
|
|
|
3855
3855
|
const n = yield this._dbPromise;
|
|
3856
3856
|
return new Promise((r, i) => {
|
|
3857
3857
|
const s = n.transaction([this._storeName], "readwrite"), o = s.objectStore(this._storeName), u = /* @__PURE__ */ new Set();
|
|
3858
|
-
for (const [a,
|
|
3859
|
-
const
|
|
3860
|
-
u.add(
|
|
3858
|
+
for (const [a, d] of e) {
|
|
3859
|
+
const c = o.put(d, a);
|
|
3860
|
+
u.add(c);
|
|
3861
3861
|
}
|
|
3862
3862
|
for (const a of u)
|
|
3863
|
-
a.onerror = (
|
|
3864
|
-
s.abort(), i(
|
|
3865
|
-
}, a.onsuccess = (
|
|
3863
|
+
a.onerror = (d) => {
|
|
3864
|
+
s.abort(), i(d);
|
|
3865
|
+
}, a.onsuccess = (d) => {
|
|
3866
3866
|
u.delete(a), u.size === 0 && r();
|
|
3867
3867
|
};
|
|
3868
3868
|
});
|
|
@@ -3902,24 +3902,24 @@ var du = function(t, e, n, r) {
|
|
|
3902
3902
|
});
|
|
3903
3903
|
}
|
|
3904
3904
|
return new (n || (n = Promise))(function(s, o) {
|
|
3905
|
-
function u(
|
|
3905
|
+
function u(c) {
|
|
3906
3906
|
try {
|
|
3907
|
-
|
|
3907
|
+
d(r.next(c));
|
|
3908
3908
|
} catch (f) {
|
|
3909
3909
|
o(f);
|
|
3910
3910
|
}
|
|
3911
3911
|
}
|
|
3912
|
-
function a(
|
|
3912
|
+
function a(c) {
|
|
3913
3913
|
try {
|
|
3914
|
-
|
|
3914
|
+
d(r.throw(c));
|
|
3915
3915
|
} catch (f) {
|
|
3916
3916
|
o(f);
|
|
3917
3917
|
}
|
|
3918
3918
|
}
|
|
3919
|
-
function c
|
|
3920
|
-
|
|
3919
|
+
function d(c) {
|
|
3920
|
+
c.done ? s(c.value) : i(c.value).then(u, a);
|
|
3921
3921
|
}
|
|
3922
|
-
|
|
3922
|
+
d((r = r.apply(t, e || [])).next());
|
|
3923
3923
|
});
|
|
3924
3924
|
};
|
|
3925
3925
|
class Zr {
|
|
@@ -3956,24 +3956,24 @@ var fu = function(t, e, n, r) {
|
|
|
3956
3956
|
});
|
|
3957
3957
|
}
|
|
3958
3958
|
return new (n || (n = Promise))(function(s, o) {
|
|
3959
|
-
function u(
|
|
3959
|
+
function u(c) {
|
|
3960
3960
|
try {
|
|
3961
|
-
|
|
3961
|
+
d(r.next(c));
|
|
3962
3962
|
} catch (f) {
|
|
3963
3963
|
o(f);
|
|
3964
3964
|
}
|
|
3965
3965
|
}
|
|
3966
|
-
function a(
|
|
3966
|
+
function a(c) {
|
|
3967
3967
|
try {
|
|
3968
|
-
|
|
3968
|
+
d(r.throw(c));
|
|
3969
3969
|
} catch (f) {
|
|
3970
3970
|
o(f);
|
|
3971
3971
|
}
|
|
3972
3972
|
}
|
|
3973
|
-
function c
|
|
3974
|
-
|
|
3973
|
+
function d(c) {
|
|
3974
|
+
c.done ? s(c.value) : i(c.value).then(u, a);
|
|
3975
3975
|
}
|
|
3976
|
-
|
|
3976
|
+
d((r = r.apply(t, e || [])).next());
|
|
3977
3977
|
});
|
|
3978
3978
|
};
|
|
3979
3979
|
class bt extends je {
|
|
@@ -4001,24 +4001,24 @@ var Ie = function(t, e, n, r) {
|
|
|
4001
4001
|
});
|
|
4002
4002
|
}
|
|
4003
4003
|
return new (n || (n = Promise))(function(s, o) {
|
|
4004
|
-
function u(
|
|
4004
|
+
function u(c) {
|
|
4005
4005
|
try {
|
|
4006
|
-
|
|
4006
|
+
d(r.next(c));
|
|
4007
4007
|
} catch (f) {
|
|
4008
4008
|
o(f);
|
|
4009
4009
|
}
|
|
4010
4010
|
}
|
|
4011
|
-
function a(
|
|
4011
|
+
function a(c) {
|
|
4012
4012
|
try {
|
|
4013
|
-
|
|
4013
|
+
d(r.throw(c));
|
|
4014
4014
|
} catch (f) {
|
|
4015
4015
|
o(f);
|
|
4016
4016
|
}
|
|
4017
4017
|
}
|
|
4018
|
-
function c
|
|
4019
|
-
|
|
4018
|
+
function d(c) {
|
|
4019
|
+
c.done ? s(c.value) : i(c.value).then(u, a);
|
|
4020
4020
|
}
|
|
4021
|
-
|
|
4021
|
+
d((r = r.apply(t, e || [])).next());
|
|
4022
4022
|
});
|
|
4023
4023
|
};
|
|
4024
4024
|
function lu({ apiURI: t, appId: e, email: n }) {
|
|
@@ -4114,24 +4114,24 @@ var Be = function(t, e, n, r) {
|
|
|
4114
4114
|
});
|
|
4115
4115
|
}
|
|
4116
4116
|
return new (n || (n = Promise))(function(s, o) {
|
|
4117
|
-
function u(
|
|
4117
|
+
function u(c) {
|
|
4118
4118
|
try {
|
|
4119
|
-
|
|
4119
|
+
d(r.next(c));
|
|
4120
4120
|
} catch (f) {
|
|
4121
4121
|
o(f);
|
|
4122
4122
|
}
|
|
4123
4123
|
}
|
|
4124
|
-
function a(
|
|
4124
|
+
function a(c) {
|
|
4125
4125
|
try {
|
|
4126
|
-
|
|
4126
|
+
d(r.throw(c));
|
|
4127
4127
|
} catch (f) {
|
|
4128
4128
|
o(f);
|
|
4129
4129
|
}
|
|
4130
4130
|
}
|
|
4131
|
-
function c
|
|
4132
|
-
|
|
4131
|
+
function d(c) {
|
|
4132
|
+
c.done ? s(c.value) : i(c.value).then(u, a);
|
|
4133
4133
|
}
|
|
4134
|
-
|
|
4134
|
+
d((r = r.apply(t, e || [])).next());
|
|
4135
4135
|
});
|
|
4136
4136
|
};
|
|
4137
4137
|
function gu(t) {
|
|
@@ -4220,10 +4220,10 @@ function Su(t, e, n) {
|
|
|
4220
4220
|
s.user = Object.assign(Object.assign({}, u), { peerId: n });
|
|
4221
4221
|
}
|
|
4222
4222
|
for (const u of Object.keys((i = t.peers) !== null && i !== void 0 ? i : {})) {
|
|
4223
|
-
const a = (e == null ? void 0 : e.peers) === void 0,
|
|
4224
|
-
if (a ||
|
|
4225
|
-
const
|
|
4226
|
-
s.peers[u] = Object.assign(Object.assign({},
|
|
4223
|
+
const a = (e == null ? void 0 : e.peers) === void 0, d = Array.isArray(e == null ? void 0 : e.peers) && (e == null ? void 0 : e.peers.includes(u));
|
|
4224
|
+
if (a || d) {
|
|
4225
|
+
const c = tr(t.peers[u], e == null ? void 0 : e.keys);
|
|
4226
|
+
s.peers[u] = Object.assign(Object.assign({}, c), { peerId: u });
|
|
4227
4227
|
}
|
|
4228
4228
|
}
|
|
4229
4229
|
return s;
|
|
@@ -4276,7 +4276,7 @@ function ir(t) {
|
|
|
4276
4276
|
}, e;
|
|
4277
4277
|
}, {});
|
|
4278
4278
|
}
|
|
4279
|
-
const ni = "v0.22.
|
|
4279
|
+
const ni = "v0.22.91-experimental.btnfix.20319025226.1";
|
|
4280
4280
|
function Au(t, e) {
|
|
4281
4281
|
return {
|
|
4282
4282
|
info: t ? (...n) => console.info(...n, e()) : () => {
|
|
@@ -4342,17 +4342,17 @@ const sr = [
|
|
|
4342
4342
|
return !0;
|
|
4343
4343
|
}
|
|
4344
4344
|
}, ku = (t, e, n, r, i, s, o) => {
|
|
4345
|
-
const u = s.valueType === "json", a = (
|
|
4346
|
-
if (!ri(f,
|
|
4347
|
-
throw new M(`Invalid value for operator '${
|
|
4345
|
+
const u = s.valueType === "json", a = (d, c, f) => {
|
|
4346
|
+
if (!ri(f, c, u))
|
|
4347
|
+
throw new M(`Invalid value for operator '${d}' on attribute '${r}' in entity '${i}'. Expected ${c}, but received: ${typeof f}`, o);
|
|
4348
4348
|
};
|
|
4349
4349
|
switch (t) {
|
|
4350
4350
|
case "in":
|
|
4351
4351
|
case "$in":
|
|
4352
4352
|
if (!Array.isArray(e))
|
|
4353
4353
|
throw new M(`Operator '${t}' for attribute '${r}' in entity '${i}' must be an array, but received: ${typeof e}`, o);
|
|
4354
|
-
for (const
|
|
4355
|
-
a(t, n,
|
|
4354
|
+
for (const d of e)
|
|
4355
|
+
a(t, n, d);
|
|
4356
4356
|
break;
|
|
4357
4357
|
case "$not":
|
|
4358
4358
|
case "$ne":
|
|
@@ -4379,8 +4379,8 @@ const sr = [
|
|
|
4379
4379
|
if (o)
|
|
4380
4380
|
return;
|
|
4381
4381
|
const a = t;
|
|
4382
|
-
for (const [
|
|
4383
|
-
ku(
|
|
4382
|
+
for (const [d, c] of Object.entries(a))
|
|
4383
|
+
ku(d, c, s, e, r, n, `${i}.${d}`);
|
|
4384
4384
|
} else if (!ri(t, s, o))
|
|
4385
4385
|
throw new M(`Invalid value for attribute '${e}' in entity '${r}'. Expected ${s}, but received: ${typeof t}`, i);
|
|
4386
4386
|
}, ju = (t, e, n, r, i) => {
|
|
@@ -4388,8 +4388,8 @@ const sr = [
|
|
|
4388
4388
|
if (s.length < 2)
|
|
4389
4389
|
throw new M(`Invalid dot notation path '${t}'. Must contain at least one dot.`, i);
|
|
4390
4390
|
let o = n;
|
|
4391
|
-
for (let
|
|
4392
|
-
const f = s[
|
|
4391
|
+
for (let c = 0; c < s.length - 1; c++) {
|
|
4392
|
+
const f = s[c], l = r.entities[o];
|
|
4393
4393
|
if (!l)
|
|
4394
4394
|
throw new M(`Entity '${o}' does not exist in schema while traversing dot notation path '${t}'.`, i);
|
|
4395
4395
|
const p = l.links[f];
|
|
@@ -4408,24 +4408,24 @@ const sr = [
|
|
|
4408
4408
|
Ae(e, t, new ae("string", !1, !0), n, i);
|
|
4409
4409
|
return;
|
|
4410
4410
|
}
|
|
4411
|
-
const
|
|
4411
|
+
const d = a.attrs[u];
|
|
4412
4412
|
if (Object.keys(a.links).includes(u)) {
|
|
4413
4413
|
if (typeof e == "string" && !Ee(e))
|
|
4414
4414
|
throw new M(`Invalid value for link '${u}' in entity '${o}'. Expected a UUID, but received: ${e}`, i);
|
|
4415
4415
|
Ae(e, t, new ae("string", !1, !0), n, i);
|
|
4416
4416
|
return;
|
|
4417
4417
|
}
|
|
4418
|
-
if (!
|
|
4419
|
-
const
|
|
4420
|
-
throw new M(`Attribute '${u}' does not exist on entity '${o}' in dot notation path '${t}'. Available attributes: ${
|
|
4418
|
+
if (!d) {
|
|
4419
|
+
const c = Object.keys(a.attrs);
|
|
4420
|
+
throw new M(`Attribute '${u}' does not exist on entity '${o}' in dot notation path '${t}'. Available attributes: ${c.length > 0 ? c.join(", ") + ", id" : "id"}`, i);
|
|
4421
4421
|
}
|
|
4422
|
-
Ae(e, t,
|
|
4422
|
+
Ae(e, t, d, n, i);
|
|
4423
4423
|
}, ii = (t, e, n, r) => {
|
|
4424
4424
|
for (const [i, s] of Object.entries(t)) {
|
|
4425
4425
|
if (i === "or" || i === "and") {
|
|
4426
4426
|
if (Array.isArray(s))
|
|
4427
|
-
for (const
|
|
4428
|
-
typeof
|
|
4427
|
+
for (const d of s)
|
|
4428
|
+
typeof d == "object" && d !== null && ii(d, e, n, `${r}.${i}[${d}]`);
|
|
4429
4429
|
continue;
|
|
4430
4430
|
}
|
|
4431
4431
|
if (i === "id") {
|
|
@@ -4441,16 +4441,16 @@ const sr = [
|
|
|
4441
4441
|
continue;
|
|
4442
4442
|
const u = o.attrs[i], a = o.links[i];
|
|
4443
4443
|
if (!u && !a) {
|
|
4444
|
-
const
|
|
4445
|
-
throw new M(`Attribute or link '${i}' does not exist on entity '${e}'. Available attributes: ${
|
|
4444
|
+
const d = Object.keys(o.attrs), c = Object.keys(o.links);
|
|
4445
|
+
throw new M(`Attribute or link '${i}' does not exist on entity '${e}'. Available attributes: ${d.length > 0 ? d.join(", ") : "none"}. Available links: ${c.length > 0 ? c.join(", ") : "none"}`, `${r}.${i}`);
|
|
4446
4446
|
}
|
|
4447
4447
|
if (u)
|
|
4448
4448
|
Ae(s, i, u, e, `${r}.${i}`);
|
|
4449
4449
|
else if (a) {
|
|
4450
4450
|
if (typeof s == "string" && !Ee(s))
|
|
4451
4451
|
throw new M(`Invalid value for link '${i}' in entity '${e}'. Expected a UUID, but received: ${s}`, `${r}.${i}`);
|
|
4452
|
-
const
|
|
4453
|
-
Ae(s, i,
|
|
4452
|
+
const d = new ae("string", !1, !0);
|
|
4453
|
+
Ae(s, i, d, e, `${r}.${i}`);
|
|
4454
4454
|
}
|
|
4455
4455
|
}
|
|
4456
4456
|
}, Cu = (t, e, n, r, i = 0) => {
|
|
@@ -4601,24 +4601,24 @@ var dr = function(t, e, n, r) {
|
|
|
4601
4601
|
});
|
|
4602
4602
|
}
|
|
4603
4603
|
return new (n || (n = Promise))(function(s, o) {
|
|
4604
|
-
function u(
|
|
4604
|
+
function u(c) {
|
|
4605
4605
|
try {
|
|
4606
|
-
|
|
4606
|
+
d(r.next(c));
|
|
4607
4607
|
} catch (f) {
|
|
4608
4608
|
o(f);
|
|
4609
4609
|
}
|
|
4610
4610
|
}
|
|
4611
|
-
function a(
|
|
4611
|
+
function a(c) {
|
|
4612
4612
|
try {
|
|
4613
|
-
|
|
4613
|
+
d(r.throw(c));
|
|
4614
4614
|
} catch (f) {
|
|
4615
4615
|
o(f);
|
|
4616
4616
|
}
|
|
4617
4617
|
}
|
|
4618
|
-
function c
|
|
4619
|
-
|
|
4618
|
+
function d(c) {
|
|
4619
|
+
c.done ? s(c.value) : i(c.value).then(u, a);
|
|
4620
4620
|
}
|
|
4621
|
-
|
|
4621
|
+
d((r = r.apply(t, e || [])).next());
|
|
4622
4622
|
});
|
|
4623
4623
|
};
|
|
4624
4624
|
let ai = 0;
|
|
@@ -4745,24 +4745,24 @@ var lr = function(t, e, n, r) {
|
|
|
4745
4745
|
});
|
|
4746
4746
|
}
|
|
4747
4747
|
return new (n || (n = Promise))(function(s, o) {
|
|
4748
|
-
function u(
|
|
4748
|
+
function u(c) {
|
|
4749
4749
|
try {
|
|
4750
|
-
|
|
4750
|
+
d(r.next(c));
|
|
4751
4751
|
} catch (f) {
|
|
4752
4752
|
o(f);
|
|
4753
4753
|
}
|
|
4754
4754
|
}
|
|
4755
|
-
function a(
|
|
4755
|
+
function a(c) {
|
|
4756
4756
|
try {
|
|
4757
|
-
|
|
4757
|
+
d(r.throw(c));
|
|
4758
4758
|
} catch (f) {
|
|
4759
4759
|
o(f);
|
|
4760
4760
|
}
|
|
4761
4761
|
}
|
|
4762
|
-
function c
|
|
4763
|
-
|
|
4762
|
+
function d(c) {
|
|
4763
|
+
c.done ? s(c.value) : i(c.value).then(u, a);
|
|
4764
4764
|
}
|
|
4765
|
-
|
|
4765
|
+
d((r = r.apply(t, e || [])).next());
|
|
4766
4766
|
});
|
|
4767
4767
|
};
|
|
4768
4768
|
function xu(t, e) {
|
|
@@ -4819,12 +4819,12 @@ function pr(t, e, n) {
|
|
|
4819
4819
|
function Fu(t, e, n) {
|
|
4820
4820
|
var r, i, s, o;
|
|
4821
4821
|
const u = {};
|
|
4822
|
-
for (const { action: a, triple:
|
|
4823
|
-
const [
|
|
4822
|
+
for (const { action: a, triple: d } of n) {
|
|
4823
|
+
const [c, f, l] = d, p = (i = (r = e.getAttr(f)) === null || r === void 0 ? void 0 : r["forward-identity"]) === null || i === void 0 ? void 0 : i[2];
|
|
4824
4824
|
if (!p)
|
|
4825
4825
|
continue;
|
|
4826
|
-
const y = (s = u[
|
|
4827
|
-
u[
|
|
4826
|
+
const y = (s = u[c]) !== null && s !== void 0 ? s : {};
|
|
4827
|
+
u[c] = y;
|
|
4828
4828
|
const b = (o = y[p]) !== null && o !== void 0 ? o : {};
|
|
4829
4829
|
switch (y[p] = b, a) {
|
|
4830
4830
|
case "added":
|
|
@@ -4836,8 +4836,8 @@ function Fu(t, e, n) {
|
|
|
4836
4836
|
}
|
|
4837
4837
|
}
|
|
4838
4838
|
for (const a of Object.keys(u)) {
|
|
4839
|
-
const { oldValue:
|
|
4840
|
-
|
|
4839
|
+
const { oldValue: d, newValue: c } = u[a];
|
|
4840
|
+
d === c && delete u[a];
|
|
4841
4841
|
}
|
|
4842
4842
|
return u;
|
|
4843
4843
|
}
|
|
@@ -4946,12 +4946,12 @@ class qu {
|
|
|
4946
4946
|
});
|
|
4947
4947
|
return;
|
|
4948
4948
|
}
|
|
4949
|
-
const
|
|
4949
|
+
const d = Object.keys(e)[0], c = ((u = (o = e[d]) === null || o === void 0 ? void 0 : o.$) === null || u === void 0 ? void 0 : u.order) || { serverCreatedAt: "asc" }, [f, l] = Object.entries(c)[0];
|
|
4950
4950
|
this.subs.updateInPlace((p) => {
|
|
4951
4951
|
p[n] = {
|
|
4952
4952
|
query: e,
|
|
4953
4953
|
hash: n,
|
|
4954
|
-
table:
|
|
4954
|
+
table: d,
|
|
4955
4955
|
orderDirection: l,
|
|
4956
4956
|
orderField: f,
|
|
4957
4957
|
createdAt: Date.now(),
|
|
@@ -5002,17 +5002,17 @@ class qu {
|
|
|
5002
5002
|
attrsStore: this.getAttrs()
|
|
5003
5003
|
};
|
|
5004
5004
|
u.values = a;
|
|
5005
|
-
const
|
|
5006
|
-
for (const
|
|
5007
|
-
const f = this.createStore(
|
|
5008
|
-
|
|
5005
|
+
const d = a.entities;
|
|
5006
|
+
for (const c of i) {
|
|
5007
|
+
const f = this.createStore(c), l = Ct(u, f, a.attrsStore);
|
|
5008
|
+
d.push({
|
|
5009
5009
|
store: f,
|
|
5010
5010
|
entity: l,
|
|
5011
5011
|
serverCreatedAt: hr(u, f, a.attrsStore, l.id)
|
|
5012
5012
|
}), o.push(l);
|
|
5013
5013
|
}
|
|
5014
|
-
this.subs.updateInPlace((
|
|
5015
|
-
|
|
5014
|
+
this.subs.updateInPlace((c) => {
|
|
5015
|
+
c[s] = u, c[s].updatedAt = Date.now();
|
|
5016
5016
|
}), u.values && this.notifyCbs(s, {
|
|
5017
5017
|
type: pe.InitialSyncBatch,
|
|
5018
5018
|
data: rt(u, u.values.entities),
|
|
@@ -5060,12 +5060,12 @@ class qu {
|
|
|
5060
5060
|
this.log.error("Missing state for sub", u, e);
|
|
5061
5061
|
return;
|
|
5062
5062
|
}
|
|
5063
|
-
for (const
|
|
5064
|
-
if (a.txId && a.txId >=
|
|
5063
|
+
for (const d of e.txes) {
|
|
5064
|
+
if (a.txId && a.txId >= d["tx-id"])
|
|
5065
5065
|
continue;
|
|
5066
|
-
a.txId =
|
|
5067
|
-
const
|
|
5068
|
-
for (const g of
|
|
5066
|
+
a.txId = d["tx-id"];
|
|
5067
|
+
const c = [], f = {};
|
|
5068
|
+
for (const g of d.changes) {
|
|
5069
5069
|
const v = (n = f[g.triple[0]]) !== null && n !== void 0 ? n : [];
|
|
5070
5070
|
f[g.triple[0]] = v, v.push(g);
|
|
5071
5071
|
}
|
|
@@ -5085,7 +5085,7 @@ class qu {
|
|
|
5085
5085
|
oldEntity: S.entity,
|
|
5086
5086
|
newEntity: C,
|
|
5087
5087
|
changedFields: $ || {}
|
|
5088
|
-
}), S.entity = C) :
|
|
5088
|
+
}), S.entity = C) : c.push(A), delete f[g];
|
|
5089
5089
|
continue e;
|
|
5090
5090
|
}
|
|
5091
5091
|
}
|
|
@@ -5109,7 +5109,7 @@ class qu {
|
|
|
5109
5109
|
}), b.push(S);
|
|
5110
5110
|
}
|
|
5111
5111
|
const _ = [];
|
|
5112
|
-
for (const g of
|
|
5112
|
+
for (const g of c.sort().reverse())
|
|
5113
5113
|
_.push(p[g].entity), p.splice(g, 1);
|
|
5114
5114
|
const w = Nu(u, this.getAttrs);
|
|
5115
5115
|
Ku(u, w, p), this.notifyCbs(o, {
|
|
@@ -5120,8 +5120,8 @@ class qu {
|
|
|
5120
5120
|
updated: y
|
|
5121
5121
|
});
|
|
5122
5122
|
}
|
|
5123
|
-
this.subs.updateInPlace((
|
|
5124
|
-
|
|
5123
|
+
this.subs.updateInPlace((d) => {
|
|
5124
|
+
d[o] = u, d[o].updatedAt = Date.now();
|
|
5125
5125
|
});
|
|
5126
5126
|
}
|
|
5127
5127
|
clearSubscriptionData(e, n) {
|
|
@@ -5160,24 +5160,24 @@ var L = function(t, e, n, r) {
|
|
|
5160
5160
|
});
|
|
5161
5161
|
}
|
|
5162
5162
|
return new (n || (n = Promise))(function(s, o) {
|
|
5163
|
-
function u(
|
|
5163
|
+
function u(c) {
|
|
5164
5164
|
try {
|
|
5165
|
-
|
|
5165
|
+
d(r.next(c));
|
|
5166
5166
|
} catch (f) {
|
|
5167
5167
|
o(f);
|
|
5168
5168
|
}
|
|
5169
5169
|
}
|
|
5170
|
-
function a(
|
|
5170
|
+
function a(c) {
|
|
5171
5171
|
try {
|
|
5172
|
-
|
|
5172
|
+
d(r.throw(c));
|
|
5173
5173
|
} catch (f) {
|
|
5174
5174
|
o(f);
|
|
5175
5175
|
}
|
|
5176
5176
|
}
|
|
5177
|
-
function c
|
|
5178
|
-
|
|
5177
|
+
function d(c) {
|
|
5178
|
+
c.done ? s(c.value) : i(c.value).then(u, a);
|
|
5179
5179
|
}
|
|
5180
|
-
|
|
5180
|
+
d((r = r.apply(t, e || [])).next());
|
|
5181
5181
|
});
|
|
5182
5182
|
}, ci = function(t, e) {
|
|
5183
5183
|
var n = {};
|
|
@@ -5267,39 +5267,39 @@ function br(t) {
|
|
|
5267
5267
|
class ea {
|
|
5268
5268
|
constructor(e, n = Jr, r = Zr, i, s) {
|
|
5269
5269
|
var o, u, a;
|
|
5270
|
-
if (this._isOnline = !0, this._isShutdown = !1, this.status = oe.CONNECTING, this.queryCbs = {}, this.queryOnceDfds = {}, this.authCbs = [], this.attrsCbs = [], this.mutationErrorCbs = [], this.connectionStatusCbs = [], this.mutationDeferredStore = /* @__PURE__ */ new Map(), this._reconnectTimeoutId = null, this._reconnectTimeoutMs = 0, this._transportType = "ws", this._wsOk = null, this._localIdPromises = {}, this._errorMessage = null, this._oauthCallbackResponse = null, this._linkIndex = null, this._rooms = {}, this._roomsPendingLeave = {}, this._presence = {}, this._broadcastQueue = [], this._broadcastSubs = {}, this._currentUserCached = { isLoading: !0, error: void 0, user: void 0 }, this._beforeUnloadCbs = [], this._dataForQueryCache = {}, this._inFlightMutationEventIds = /* @__PURE__ */ new Set(), this._onMergeKv = (
|
|
5270
|
+
if (this._isOnline = !0, this._isShutdown = !1, this.status = oe.CONNECTING, this.queryCbs = {}, this.queryOnceDfds = {}, this.authCbs = [], this.attrsCbs = [], this.mutationErrorCbs = [], this.connectionStatusCbs = [], this.mutationDeferredStore = /* @__PURE__ */ new Map(), this._reconnectTimeoutId = null, this._reconnectTimeoutMs = 0, this._transportType = "ws", this._wsOk = null, this._localIdPromises = {}, this._errorMessage = null, this._oauthCallbackResponse = null, this._linkIndex = null, this._rooms = {}, this._roomsPendingLeave = {}, this._presence = {}, this._broadcastQueue = [], this._broadcastSubs = {}, this._currentUserCached = { isLoading: !0, error: void 0, user: void 0 }, this._beforeUnloadCbs = [], this._dataForQueryCache = {}, this._inFlightMutationEventIds = /* @__PURE__ */ new Set(), this._onMergeKv = (d, c, f) => {
|
|
5271
5271
|
var l, p;
|
|
5272
|
-
switch (
|
|
5272
|
+
switch (d) {
|
|
5273
5273
|
case "pendingMutations": {
|
|
5274
|
-
const y = (l =
|
|
5275
|
-
return (
|
|
5274
|
+
const y = (l = c == null ? void 0 : c.entries()) !== null && l !== void 0 ? l : [], b = (p = f == null ? void 0 : f.entries()) !== null && p !== void 0 ? p : [], _ = new Map([...y, ...b]);
|
|
5275
|
+
return (c ? this._rewriteMutationsSorted(this.attrs, c) : []).forEach(([g, v]) => {
|
|
5276
5276
|
var A;
|
|
5277
5277
|
!(!((A = f == null ? void 0 : f.pendingMutations) === null || A === void 0) && A.has(g)) && !v["tx-id"] && this._sendMutation(g, v);
|
|
5278
5278
|
}), _;
|
|
5279
5279
|
}
|
|
5280
5280
|
default:
|
|
5281
|
-
return f ||
|
|
5281
|
+
return f || c;
|
|
5282
5282
|
}
|
|
5283
|
-
}, this.getPreviousResult = (
|
|
5284
|
-
var
|
|
5285
|
-
const f = q(
|
|
5286
|
-
return (
|
|
5287
|
-
}, this.notifyOne = (
|
|
5288
|
-
var
|
|
5289
|
-
const l = (
|
|
5290
|
-
y != null && y.data && (this._dataForQueryCache[
|
|
5291
|
-
}, this.notifyOneQueryOnce = (
|
|
5292
|
-
var
|
|
5293
|
-
const l = (
|
|
5283
|
+
}, this.getPreviousResult = (d) => {
|
|
5284
|
+
var c;
|
|
5285
|
+
const f = q(d);
|
|
5286
|
+
return (c = this.dataForQuery(f)) === null || c === void 0 ? void 0 : c.data;
|
|
5287
|
+
}, this.notifyOne = (d) => {
|
|
5288
|
+
var c, f;
|
|
5289
|
+
const l = (c = this.queryCbs[d]) !== null && c !== void 0 ? c : [], p = (f = this._dataForQueryCache[d]) === null || f === void 0 ? void 0 : f.data, y = this.dataForQuery(d);
|
|
5290
|
+
y != null && y.data && (this._dataForQueryCache[d] = y, !ut(y.data, p) && l.forEach((b) => b.cb(y.data)));
|
|
5291
|
+
}, this.notifyOneQueryOnce = (d) => {
|
|
5292
|
+
var c, f;
|
|
5293
|
+
const l = (c = this.queryOnceDfds[d]) !== null && c !== void 0 ? c : [], p = (f = this.dataForQuery(d)) === null || f === void 0 ? void 0 : f.data;
|
|
5294
5294
|
l.forEach((y) => {
|
|
5295
|
-
this._completeQueryOnce(y.q,
|
|
5295
|
+
this._completeQueryOnce(y.q, d, y.dfd), y.dfd.resolve(p);
|
|
5296
5296
|
});
|
|
5297
|
-
}, this.notifyQueryError = (
|
|
5298
|
-
(this.queryCbs[
|
|
5299
|
-
}, this.pushTx = (
|
|
5300
|
-
this.config.disableValidation || $u(
|
|
5297
|
+
}, this.notifyQueryError = (d, c) => {
|
|
5298
|
+
(this.queryCbs[d] || []).forEach((l) => l.cb({ error: c }));
|
|
5299
|
+
}, this.pushTx = (d) => {
|
|
5300
|
+
this.config.disableValidation || $u(d, this.config.schema);
|
|
5301
5301
|
try {
|
|
5302
|
-
const
|
|
5302
|
+
const c = nu({
|
|
5303
5303
|
attrsStore: this.optimisticAttrs(),
|
|
5304
5304
|
schema: this.config.schema,
|
|
5305
5305
|
stores: Object.values(this.querySubs.currentValue).map((f) => {
|
|
@@ -5307,17 +5307,17 @@ class ea {
|
|
|
5307
5307
|
return (l = f == null ? void 0 : f.result) === null || l === void 0 ? void 0 : l.store;
|
|
5308
5308
|
}),
|
|
5309
5309
|
useDateObjects: this.config.useDateObjects
|
|
5310
|
-
},
|
|
5311
|
-
return this.pushOps(
|
|
5312
|
-
} catch (
|
|
5313
|
-
return this.pushOps([],
|
|
5310
|
+
}, d);
|
|
5311
|
+
return this.pushOps(c);
|
|
5312
|
+
} catch (c) {
|
|
5313
|
+
return this.pushOps([], c);
|
|
5314
5314
|
}
|
|
5315
|
-
}, this.pushOps = (
|
|
5315
|
+
}, this.pushOps = (d, c) => {
|
|
5316
5316
|
const f = N(), l = [...this._pendingMutations().values()], p = Math.max(0, ...l.map((_) => _.order || 0)) + 1, y = {
|
|
5317
5317
|
op: "transact",
|
|
5318
|
-
"tx-steps":
|
|
5318
|
+
"tx-steps": d,
|
|
5319
5319
|
created: Date.now(),
|
|
5320
|
-
error:
|
|
5320
|
+
error: c,
|
|
5321
5321
|
order: p
|
|
5322
5322
|
};
|
|
5323
5323
|
this._updatePendingMutations((_) => {
|
|
@@ -5325,10 +5325,10 @@ class ea {
|
|
|
5325
5325
|
});
|
|
5326
5326
|
const b = new nr();
|
|
5327
5327
|
return this.mutationDeferredStore.set(f, b), this._sendMutation(f, y), this.notifyAll(), b.promise;
|
|
5328
|
-
}, this._transportOnOpen = (
|
|
5329
|
-
const
|
|
5330
|
-
if (this._transport !==
|
|
5331
|
-
this._log.info("[socket][open]",
|
|
5328
|
+
}, this._transportOnOpen = (d) => {
|
|
5329
|
+
const c = d.target;
|
|
5330
|
+
if (this._transport !== c) {
|
|
5331
|
+
this._log.info("[socket][open]", c.id, "skip; this is no longer the current transport");
|
|
5332
5332
|
return;
|
|
5333
5333
|
}
|
|
5334
5334
|
this._log.info("[socket][open]", this._transport.id), this._setStatus(oe.OPENED), this.getCurrentUser().then((f) => {
|
|
@@ -5346,26 +5346,26 @@ class ea {
|
|
|
5346
5346
|
"__admin-token": this.config.__adminToken
|
|
5347
5347
|
});
|
|
5348
5348
|
}).catch((f) => {
|
|
5349
|
-
this._log.error("[socket][error]",
|
|
5349
|
+
this._log.error("[socket][error]", c.id, f);
|
|
5350
5350
|
});
|
|
5351
|
-
}, this._transportOnMessage = (
|
|
5352
|
-
const
|
|
5353
|
-
if (this._transport !==
|
|
5354
|
-
this._log.info("[socket][message]",
|
|
5351
|
+
}, this._transportOnMessage = (d) => {
|
|
5352
|
+
const c = d.target, f = d.message;
|
|
5353
|
+
if (this._transport !== c) {
|
|
5354
|
+
this._log.info("[socket][message]", c.id, f, "skip; this is no longer the current transport");
|
|
5355
5355
|
return;
|
|
5356
5356
|
}
|
|
5357
|
-
if (!this._wsOk &&
|
|
5358
|
-
for (const l of
|
|
5359
|
-
this._handleReceive(
|
|
5357
|
+
if (!this._wsOk && c.type === "ws" && (this._wsOk = !0), this._transportType = "ws", Array.isArray(d.message))
|
|
5358
|
+
for (const l of d.message)
|
|
5359
|
+
this._handleReceive(c.id, l);
|
|
5360
5360
|
else
|
|
5361
|
-
this._handleReceive(
|
|
5362
|
-
}, this._transportOnError = (
|
|
5363
|
-
const
|
|
5364
|
-
if (this._transport !==
|
|
5365
|
-
this._log.info("[socket][error]",
|
|
5361
|
+
this._handleReceive(c.id, d.message);
|
|
5362
|
+
}, this._transportOnError = (d) => {
|
|
5363
|
+
const c = d.target;
|
|
5364
|
+
if (this._transport !== c) {
|
|
5365
|
+
this._log.info("[socket][error]", c.id, "skip; this is no longer the current transport");
|
|
5366
5366
|
return;
|
|
5367
5367
|
}
|
|
5368
|
-
this._log.error("[socket][error]",
|
|
5368
|
+
this._log.error("[socket][error]", c.id, d);
|
|
5369
5369
|
}, this._scheduleReconnect = () => {
|
|
5370
5370
|
!this._wsOk && this._transportType !== "sse" && (this._transportType = "sse", this._reconnectTimeoutMs = 0), setTimeout(() => {
|
|
5371
5371
|
if (this._reconnectTimeoutMs = Math.min(this._reconnectTimeoutMs + 1e3, 1e4), !this._isOnline) {
|
|
@@ -5374,29 +5374,29 @@ class ea {
|
|
|
5374
5374
|
}
|
|
5375
5375
|
this._startSocket();
|
|
5376
5376
|
}, this._reconnectTimeoutMs);
|
|
5377
|
-
}, this._transportOnClose = (
|
|
5378
|
-
const
|
|
5379
|
-
if (this._transport !==
|
|
5380
|
-
this._log.info("[socket][close]",
|
|
5377
|
+
}, this._transportOnClose = (d) => {
|
|
5378
|
+
const c = d.target;
|
|
5379
|
+
if (this._transport !== c) {
|
|
5380
|
+
this._log.info("[socket][close]", c.id, "skip; this is no longer the current transport");
|
|
5381
5381
|
return;
|
|
5382
5382
|
}
|
|
5383
5383
|
this._setStatus(oe.CLOSED);
|
|
5384
5384
|
for (const f of Object.values(this._rooms))
|
|
5385
5385
|
f.isConnected = !1;
|
|
5386
5386
|
if (this._isShutdown) {
|
|
5387
|
-
this._log.info("[socket][close]",
|
|
5387
|
+
this._log.info("[socket][close]", c.id, "Reactor has been shut down and will not reconnect");
|
|
5388
5388
|
return;
|
|
5389
5389
|
}
|
|
5390
|
-
this._log.info("[socket][close]",
|
|
5390
|
+
this._log.info("[socket][close]", c.id, "schedule reconnect, ms =", this._reconnectTimeoutMs), this._scheduleReconnect();
|
|
5391
5391
|
}, this._EventSource = s, this.config = Object.assign(Object.assign({}, Bu), e), this.queryCacheLimit = (o = this.config.queryCacheLimit) !== null && o !== void 0 ? o : 10, this._pendingTxCleanupTimeout = (u = this.config.pendingTxCleanupTimeout) !== null && u !== void 0 ? u : Vu, this._pendingMutationCleanupThreshold = (a = this.config.pendingMutationCleanupThreshold) !== null && a !== void 0 ? a : Wu, this._log = Au(e.verbose || dn || Xr, () => this._reactorStats()), this.versions = Object.assign(Object.assign({}, i || {}), { "@instantdb/core": ni }), this.config.schema && (this._linkIndex = ir(this.config.schema)), !!Qu()) {
|
|
5392
5392
|
if (!e.appId)
|
|
5393
5393
|
throw new Error("Instant must be initialized with an appId.");
|
|
5394
5394
|
if (!Ee(e.appId))
|
|
5395
5395
|
throw new Error(`Instant must be initialized with a valid appId. \`${e.appId}\` is not a valid uuid.`);
|
|
5396
|
-
typeof BroadcastChannel == "function" && (this._broadcastChannel = new BroadcastChannel("@instantdb"), this._broadcastChannel.addEventListener("message", (
|
|
5397
|
-
var
|
|
5396
|
+
typeof BroadcastChannel == "function" && (this._broadcastChannel = new BroadcastChannel("@instantdb"), this._broadcastChannel.addEventListener("message", (d) => L(this, void 0, void 0, function* () {
|
|
5397
|
+
var c;
|
|
5398
5398
|
try {
|
|
5399
|
-
if (((
|
|
5399
|
+
if (((c = d.data) === null || c === void 0 ? void 0 : c.type) === "auth") {
|
|
5400
5400
|
const f = yield this.getCurrentUser();
|
|
5401
5401
|
this.updateUser(f.user);
|
|
5402
5402
|
}
|
|
@@ -5405,9 +5405,9 @@ class ea {
|
|
|
5405
5405
|
}
|
|
5406
5406
|
}))), this._initStorage(n), this._syncTable = new qu(this._trySendAuthed.bind(this), new n(this.config.appId, "syncSubs"), {
|
|
5407
5407
|
useDateObjects: this.config.useDateObjects
|
|
5408
|
-
}, this._log, (
|
|
5409
|
-
this._isOnline =
|
|
5410
|
-
|
|
5408
|
+
}, this._log, (d) => at(this.ensureAttrs(), d, this.config.enableCardinalityInference, this.config.useDateObjects), () => this.ensureAttrs()), this._oauthCallbackResponse = this._oauthLoginInit(), this.getCurrentUser(), r.getIsOnline().then((d) => {
|
|
5409
|
+
this._isOnline = d, this._startSocket(), r.listen((c) => {
|
|
5410
|
+
c !== this._isOnline && (this._log.info("[network] online =", c), this._isOnline = c, this._isOnline ? this._startSocket() : (this._log.info("Changing status from", this.status, "to", oe.CLOSED), this._setStatus(oe.CLOSED)));
|
|
5411
5411
|
});
|
|
5412
5412
|
}), typeof addEventListener < "u" && (this._beforeUnload = this._beforeUnload.bind(this), addEventListener("beforeunload", this._beforeUnload));
|
|
5413
5413
|
}
|
|
@@ -5503,13 +5503,13 @@ class ea {
|
|
|
5503
5503
|
const i = (r = (n = this._presence[e]) === null || n === void 0 ? void 0 : n.result) === null || r === void 0 ? void 0 : r.user, s = this._broadcastQueue[e];
|
|
5504
5504
|
if (this._broadcastQueue[e] = [], i && this._trySetPresence(e, i), s)
|
|
5505
5505
|
for (const o of s) {
|
|
5506
|
-
const { topic: u, roomType: a, data:
|
|
5507
|
-
this._tryBroadcast(e, a, u,
|
|
5506
|
+
const { topic: u, roomType: a, data: d } = o;
|
|
5507
|
+
this._tryBroadcast(e, a, u, d);
|
|
5508
5508
|
}
|
|
5509
5509
|
}
|
|
5510
5510
|
_handleReceive(e, n) {
|
|
5511
5511
|
var r, i, s, o, u, a;
|
|
5512
|
-
const
|
|
5512
|
+
const d = !!this.config.schema && ("cardinalityInference" in this.config ? !!this.config.cardinalityInference : !0);
|
|
5513
5513
|
switch (yr[n.op] || this._log.info("[receive]", e, n.op, n), n.op) {
|
|
5514
5514
|
case "init-ok": {
|
|
5515
5515
|
this._setStatus(oe.AUTHENTICATED), this._reconnectTimeoutMs = 0, this._setAttrs(n.attrs), this._flushPendingMessages(), this._sessionId = n["session-id"];
|
|
@@ -5527,7 +5527,7 @@ class ea {
|
|
|
5527
5527
|
const { q: l, result: p } = n, y = q(l);
|
|
5528
5528
|
if (!this._hasQueryListeners() && !this.querySubs.currentValue[y])
|
|
5529
5529
|
break;
|
|
5530
|
-
const b = (o = (s = p == null ? void 0 : p[0]) === null || s === void 0 ? void 0 : s.data) === null || o === void 0 ? void 0 : o["page-info"], _ = (a = (u = p == null ? void 0 : p[0]) === null || u === void 0 ? void 0 : u.data) === null || a === void 0 ? void 0 : a.aggregate, w = rr(p), g = this.ensureAttrs(), v = at(g, w,
|
|
5530
|
+
const b = (o = (s = p == null ? void 0 : p[0]) === null || s === void 0 ? void 0 : s.data) === null || o === void 0 ? void 0 : o["page-info"], _ = (a = (u = p == null ? void 0 : p[0]) === null || u === void 0 ? void 0 : u.data) === null || a === void 0 ? void 0 : a.aggregate, w = rr(p), g = this.ensureAttrs(), v = at(g, w, d, this.config.useDateObjects);
|
|
5531
5531
|
this.querySubs.updateInPlace((A) => {
|
|
5532
5532
|
if (!A[y]) {
|
|
5533
5533
|
this._log.info("Missing value in querySubs", { hash: y, q: l });
|
|
@@ -5568,7 +5568,7 @@ class ea {
|
|
|
5568
5568
|
});
|
|
5569
5569
|
const _ = br(b.entries()), w = l.map((g) => {
|
|
5570
5570
|
var v, A, S, C;
|
|
5571
|
-
const $ = g["instaql-query"], R = g["instaql-result"], Pe = q($), Ge = rr(R), Qe = this.ensureAttrs(), _t = at(Qe, Ge,
|
|
5571
|
+
const $ = g["instaql-query"], R = g["instaql-result"], Pe = q($), Ge = rr(R), Qe = this.ensureAttrs(), _t = at(Qe, Ge, d, this.config.useDateObjects), { store: He, attrsStore: ne } = this._applyOptimisticUpdates(_t, Qe, _, y), se = (A = (v = R == null ? void 0 : R[0]) === null || v === void 0 ? void 0 : v.data) === null || A === void 0 ? void 0 : A["page-info"], le = (C = (S = R == null ? void 0 : R[0]) === null || S === void 0 ? void 0 : S.data) === null || C === void 0 ? void 0 : C.aggregate;
|
|
5572
5572
|
return {
|
|
5573
5573
|
q: $,
|
|
5574
5574
|
hash: Pe,
|
|
@@ -5649,8 +5649,8 @@ class ea {
|
|
|
5649
5649
|
break;
|
|
5650
5650
|
}
|
|
5651
5651
|
case "join-room-error":
|
|
5652
|
-
const
|
|
5653
|
-
f && (f.error = n.error), this._notifyPresenceSubs(
|
|
5652
|
+
const c = n["room-id"], f = this._rooms[c];
|
|
5653
|
+
f && (f.error = n.error), this._notifyPresenceSubs(c);
|
|
5654
5654
|
break;
|
|
5655
5655
|
case "error":
|
|
5656
5656
|
this._handleReceiveError(n);
|
|
@@ -5690,18 +5690,18 @@ class ea {
|
|
|
5690
5690
|
_handleReceiveError(e) {
|
|
5691
5691
|
var n, r, i, s, o, u, a;
|
|
5692
5692
|
console.log("error", e);
|
|
5693
|
-
const
|
|
5694
|
-
this._inFlightMutationEventIds.delete(
|
|
5695
|
-
const
|
|
5693
|
+
const d = e["client-event-id"];
|
|
5694
|
+
this._inFlightMutationEventIds.delete(d);
|
|
5695
|
+
const c = this._pendingMutations().get(d), f = {
|
|
5696
5696
|
message: e.message || "Uh-oh, something went wrong. Ping Joe & Stopa."
|
|
5697
5697
|
};
|
|
5698
|
-
if (e.hint && (f.hint = e.hint),
|
|
5699
|
-
this._handleMutationError("error",
|
|
5698
|
+
if (e.hint && (f.hint = e.hint), c) {
|
|
5699
|
+
this._handleMutationError("error", d, e);
|
|
5700
5700
|
return;
|
|
5701
5701
|
}
|
|
5702
5702
|
if (!((n = e["original-event"]) === null || n === void 0) && n.hasOwnProperty("q") && ((r = e["original-event"]) === null || r === void 0 ? void 0 : r.op) === "add-query") {
|
|
5703
5703
|
const y = (i = e["original-event"]) === null || i === void 0 ? void 0 : i.q, b = q(y);
|
|
5704
|
-
this.notifyQueryError(q(y), f), this.notifyQueryOnceError(y, b,
|
|
5704
|
+
this.notifyQueryError(q(y), f), this.notifyQueryOnceError(y, b, d, f);
|
|
5705
5705
|
return;
|
|
5706
5706
|
}
|
|
5707
5707
|
if (((s = e["original-event"]) === null || s === void 0 ? void 0 : s.op) === "init") {
|
|
@@ -5805,17 +5805,17 @@ class ea {
|
|
|
5805
5805
|
return n;
|
|
5806
5806
|
if (!n)
|
|
5807
5807
|
return /* @__PURE__ */ new Map();
|
|
5808
|
-
const i = (
|
|
5809
|
-
const [f, l, p] =
|
|
5808
|
+
const i = (c) => {
|
|
5809
|
+
const [f, l, p] = c["forward-identity"];
|
|
5810
5810
|
return F(e, l, p);
|
|
5811
|
-
}, s = (
|
|
5812
|
-
const [f, l, p] =
|
|
5811
|
+
}, s = (c) => {
|
|
5812
|
+
const [f, l, p] = c["forward-identity"];
|
|
5813
5813
|
return me(e, l, p);
|
|
5814
5814
|
}, o = { attrIdMap: {}, refSwapAttrIds: /* @__PURE__ */ new Set() };
|
|
5815
5815
|
let u = !1;
|
|
5816
|
-
const a = (
|
|
5816
|
+
const a = (c, f) => {
|
|
5817
5817
|
const l = [];
|
|
5818
|
-
for (const p of
|
|
5818
|
+
for (const p of c) {
|
|
5819
5819
|
const [y] = p;
|
|
5820
5820
|
if (y === "add-attr") {
|
|
5821
5821
|
const [_, w] = p, g = i(w);
|
|
@@ -5838,11 +5838,11 @@ class ea {
|
|
|
5838
5838
|
const b = u ? Po(o, p) : p;
|
|
5839
5839
|
l.push(b);
|
|
5840
5840
|
}
|
|
5841
|
-
return u ? l :
|
|
5842
|
-
},
|
|
5843
|
-
for (const [
|
|
5844
|
-
|
|
5845
|
-
return u ?
|
|
5841
|
+
return u ? l : c;
|
|
5842
|
+
}, d = /* @__PURE__ */ new Map();
|
|
5843
|
+
for (const [c, f] of n.entries())
|
|
5844
|
+
d.set(c, Object.assign(Object.assign({}, f), { "tx-steps": a(f["tx-steps"], f["tx-id"]) }));
|
|
5845
|
+
return u ? d : n;
|
|
5846
5846
|
}
|
|
5847
5847
|
_rewriteMutationsSorted(e, n) {
|
|
5848
5848
|
return br(this._rewriteMutations(e, n).entries());
|
|
@@ -5859,8 +5859,8 @@ class ea {
|
|
|
5859
5859
|
if (u === "add-attr")
|
|
5860
5860
|
s.push(a);
|
|
5861
5861
|
else if (u === "update-attr" && a.id && (!((e = this.attrs) === null || e === void 0) && e.getAttr(a.id))) {
|
|
5862
|
-
const
|
|
5863
|
-
s.push(
|
|
5862
|
+
const d = Object.assign(Object.assign({}, this.attrs.getAttr(a.id)), a);
|
|
5863
|
+
s.push(d);
|
|
5864
5864
|
}
|
|
5865
5865
|
if (!i.size && !s.length)
|
|
5866
5866
|
return this.attrs || new _e({}, this._linkIndex);
|
|
@@ -5881,10 +5881,10 @@ class ea {
|
|
|
5881
5881
|
const r = this.querySubs.version(), i = this.querySubs.currentValue, s = this.kv.version(), o = this._pendingMutations(), { q: u, result: a } = i[e] || {};
|
|
5882
5882
|
if (!a)
|
|
5883
5883
|
return;
|
|
5884
|
-
const
|
|
5885
|
-
if (
|
|
5886
|
-
return
|
|
5887
|
-
const { store:
|
|
5884
|
+
const d = this._dataForQueryCache[e];
|
|
5885
|
+
if (d && r === d.querySubVersion && s === d.pendingMutationsVersion)
|
|
5886
|
+
return d;
|
|
5887
|
+
const { store: c, attrsStore: f, pageInfo: l, aggregate: p, processedTxId: y } = a, b = this._rewriteMutationsSorted(f, o), { store: _, attrsStore: w } = this._applyOptimisticUpdates(c, f, b, y);
|
|
5888
5888
|
return { data: Gr({ store: _, attrsStore: w, pageInfo: l, aggregate: p }, u), querySubVersion: r, pendingMutationsVersion: s };
|
|
5889
5889
|
}
|
|
5890
5890
|
_applyOptimisticUpdates(e, n, r, i) {
|
|
@@ -6074,13 +6074,13 @@ class ea {
|
|
|
6074
6074
|
return null;
|
|
6075
6075
|
this._replaceUrlAfterOAuth();
|
|
6076
6076
|
try {
|
|
6077
|
-
const a = yield this._getCurrentUser(),
|
|
6077
|
+
const a = yield this._getCurrentUser(), d = (a == null ? void 0 : a.type) === "guest", { user: c } = yield er({
|
|
6078
6078
|
apiURI: this.config.apiURI,
|
|
6079
6079
|
appId: this.config.appId,
|
|
6080
6080
|
code: u,
|
|
6081
|
-
refreshToken:
|
|
6081
|
+
refreshToken: d ? a.refresh_token : void 0
|
|
6082
6082
|
});
|
|
6083
|
-
return this.setCurrentUser(
|
|
6083
|
+
return this.setCurrentUser(c), null;
|
|
6084
6084
|
} catch (a) {
|
|
6085
6085
|
return ((e = a == null ? void 0 : a.body) === null || e === void 0 ? void 0 : e.type) === "record-not-found" && ((r = (n = a == null ? void 0 : a.body) === null || n === void 0 ? void 0 : n.hint) === null || r === void 0 ? void 0 : r["record-type"]) === "app-oauth-code" && (yield this._hasCurrentUser()) ? null : { error: { message: ((i = a == null ? void 0 : a.body) === null || i === void 0 ? void 0 : i.message) || "Error logging in." } };
|
|
6086
6086
|
}
|
|
@@ -6388,8 +6388,8 @@ class ea {
|
|
|
6388
6388
|
r.initialPresence || r.initialData
|
|
6389
6389
|
), o = Object.assign(Object.assign({}, r), { roomId: n, cb: i, prev: null });
|
|
6390
6390
|
return this._presence[n] = this._presence[n] || {}, this._presence[n].handlers = this._presence[n].handlers || [], this._presence[n].handlers.push(o), this._notifyPresenceSub(n, o), () => {
|
|
6391
|
-
var u, a,
|
|
6392
|
-
this._presence[n].handlers = (
|
|
6391
|
+
var u, a, d;
|
|
6392
|
+
this._presence[n].handlers = (d = (a = (u = this._presence[n]) === null || u === void 0 ? void 0 : u.handlers) === null || a === void 0 ? void 0 : a.filter((c) => c !== o)) !== null && d !== void 0 ? d : [], s();
|
|
6393
6393
|
};
|
|
6394
6394
|
}
|
|
6395
6395
|
_notifyPresenceSubs(e) {
|
|
@@ -6405,22 +6405,22 @@ class ea {
|
|
|
6405
6405
|
_patchPresencePeers(e, n) {
|
|
6406
6406
|
var r, i, s;
|
|
6407
6407
|
const o = ((i = (r = this._presence[e]) === null || r === void 0 ? void 0 : r.result) === null || i === void 0 ? void 0 : i.peers) || {};
|
|
6408
|
-
let u = Object.fromEntries(Object.entries(o).map(([
|
|
6408
|
+
let u = Object.fromEntries(Object.entries(o).map(([d, c]) => [d, { data: c }]));
|
|
6409
6409
|
(s = this._presence[e]) === null || s === void 0 || s.result;
|
|
6410
|
-
const a = ft(u, (
|
|
6411
|
-
for (let [
|
|
6410
|
+
const a = ft(u, (d) => {
|
|
6411
|
+
for (let [c, f, l] of n)
|
|
6412
6412
|
switch (f) {
|
|
6413
6413
|
case "+":
|
|
6414
|
-
Xi(
|
|
6414
|
+
Xi(d, c, l);
|
|
6415
6415
|
break;
|
|
6416
6416
|
case "r":
|
|
6417
|
-
Kn(
|
|
6417
|
+
Kn(d, c, l);
|
|
6418
6418
|
break;
|
|
6419
6419
|
case "-":
|
|
6420
|
-
Pr(
|
|
6420
|
+
Pr(d, c);
|
|
6421
6421
|
break;
|
|
6422
6422
|
}
|
|
6423
|
-
delete
|
|
6423
|
+
delete d[this._sessionId];
|
|
6424
6424
|
});
|
|
6425
6425
|
this._setPresencePeers(e, a);
|
|
6426
6426
|
}
|
|
@@ -6463,8 +6463,8 @@ class ea {
|
|
|
6463
6463
|
_notifyBroadcastSubs(e, n, r) {
|
|
6464
6464
|
var i, s, o;
|
|
6465
6465
|
(o = (s = (i = this._broadcastSubs) === null || i === void 0 ? void 0 : i[e]) === null || s === void 0 ? void 0 : s[n]) === null || o === void 0 || o.forEach((u) => {
|
|
6466
|
-
var a,
|
|
6467
|
-
const y = (a = r.data) === null || a === void 0 ? void 0 : a.data, b = r.data["peer-id"] === this._sessionId ? (
|
|
6466
|
+
var a, d, c, f, l, p;
|
|
6467
|
+
const y = (a = r.data) === null || a === void 0 ? void 0 : a.data, b = r.data["peer-id"] === this._sessionId ? (c = (d = this._presence[e]) === null || d === void 0 ? void 0 : d.result) === null || c === void 0 ? void 0 : c.user : (p = (l = (f = this._presence[e]) === null || f === void 0 ? void 0 : f.result) === null || l === void 0 ? void 0 : l.peers) === null || p === void 0 ? void 0 : p[r.data["peer-id"]];
|
|
6468
6468
|
return u(y, b);
|
|
6469
6469
|
});
|
|
6470
6470
|
}
|
|
@@ -6520,12 +6520,12 @@ let it;
|
|
|
6520
6520
|
function ta(t, e) {
|
|
6521
6521
|
it == null || it.dispose();
|
|
6522
6522
|
const n = ua(e), r = ia(e, u), i = ra(na(t));
|
|
6523
|
-
function s(
|
|
6523
|
+
function s(c) {
|
|
6524
6524
|
var f;
|
|
6525
|
-
|
|
6525
|
+
c.source === i.element.contentWindow && ((f = c.data) === null || f === void 0 ? void 0 : f.type) === "close" && n.isVisible() && u();
|
|
6526
6526
|
}
|
|
6527
|
-
function o(
|
|
6528
|
-
const f =
|
|
6527
|
+
function o(c) {
|
|
6528
|
+
const f = c.shiftKey && c.ctrlKey && c.key === "0", l = c.key === "Escape" || c.key === "Esc";
|
|
6529
6529
|
(f || l && n.isVisible()) && u();
|
|
6530
6530
|
}
|
|
6531
6531
|
function u() {
|
|
@@ -6534,12 +6534,12 @@ function ta(t, e) {
|
|
|
6534
6534
|
function a() {
|
|
6535
6535
|
n.element.remove(), r.element.remove(), removeEventListener("keydown", o), removeEventListener("message", s);
|
|
6536
6536
|
}
|
|
6537
|
-
function
|
|
6537
|
+
function d() {
|
|
6538
6538
|
document.body.appendChild(n.element), document.body.appendChild(r.element), addEventListener("keydown", o), addEventListener("message", s), it = {
|
|
6539
6539
|
dispose: a
|
|
6540
6540
|
};
|
|
6541
6541
|
}
|
|
6542
|
-
return
|
|
6542
|
+
return d();
|
|
6543
6543
|
}
|
|
6544
6544
|
function na(t) {
|
|
6545
6545
|
return `${dn || ei ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${t}`;
|
|
@@ -6829,12 +6829,12 @@ function ya(t, e) {
|
|
|
6829
6829
|
return gr(t._reactor.config.schema) !== gr(e);
|
|
6830
6830
|
}
|
|
6831
6831
|
function ba(t, e, n, r, i) {
|
|
6832
|
-
var s;
|
|
6833
|
-
const
|
|
6834
|
-
if (
|
|
6835
|
-
return ya(
|
|
6836
|
-
const
|
|
6837
|
-
return Yt[Ht(
|
|
6832
|
+
var s, o;
|
|
6833
|
+
const u = Object.assign(Object.assign({}, t), { appId: (s = t.appId) === null || s === void 0 ? void 0 : s.trim(), useDateObjects: (o = t.useDateObjects) !== null && o !== void 0 ? o : !1 }), a = Yt[Ht(u)];
|
|
6834
|
+
if (a)
|
|
6835
|
+
return ya(a, u.schema) && a._reactor.updateSchema(u.schema), a;
|
|
6836
|
+
const d = new ea(Object.assign(Object.assign(Object.assign({}, aa), u), { cardinalityInference: !!u.schema }), e || Jr, n || Zr, Object.assign(Object.assign({}, r || {}), { "@instantdb/core": ni }), i), c = new pa(d);
|
|
6837
|
+
return Yt[Ht(u)] = c, _a(u.appId, u.devtool), c;
|
|
6838
6838
|
}
|
|
6839
6839
|
function _a(t, e) {
|
|
6840
6840
|
if (typeof window > "u" || typeof window.location > "u" || typeof document > "u" || typeof e == "boolean" && !e)
|
|
@@ -6864,16 +6864,16 @@ function Ta(t, e, n) {
|
|
|
6864
6864
|
), o = fe(
|
|
6865
6865
|
(a) => (s.current = Tr(
|
|
6866
6866
|
t._reactor.getPreviousResult(r)
|
|
6867
|
-
), r ? t.subscribeQuery(r, (
|
|
6867
|
+
), r ? t.subscribeQuery(r, (c) => {
|
|
6868
6868
|
s.current = {
|
|
6869
|
-
isLoading: !
|
|
6869
|
+
isLoading: !c,
|
|
6870
6870
|
// @ts-expect-error: ts thinks this will always be overwritten
|
|
6871
6871
|
data: void 0,
|
|
6872
6872
|
// @ts-expect-error: ts thinks this will always be overwritten
|
|
6873
6873
|
pageInfo: void 0,
|
|
6874
6874
|
// @ts-expect-error: ts thinks this will always be overwritten
|
|
6875
6875
|
error: void 0,
|
|
6876
|
-
...
|
|
6876
|
+
...c
|
|
6877
6877
|
}, a();
|
|
6878
6878
|
}) : () => {
|
|
6879
6879
|
}),
|
|
@@ -6933,8 +6933,8 @@ function Oa(t, e = {}) {
|
|
|
6933
6933
|
t.type,
|
|
6934
6934
|
t.id,
|
|
6935
6935
|
e,
|
|
6936
|
-
(
|
|
6937
|
-
r(
|
|
6936
|
+
(d) => {
|
|
6937
|
+
r(d);
|
|
6938
6938
|
}
|
|
6939
6939
|
), [t.id, e.user, (o = e.peers) == null ? void 0 : o.join(), (u = e.keys) == null ? void 0 : u.join()]);
|
|
6940
6940
|
const i = fe(
|
|
@@ -6955,18 +6955,18 @@ function Ea(t, e, n = {}) {
|
|
|
6955
6955
|
const r = wa(), i = ye.usePresence(t, {
|
|
6956
6956
|
keys: [e]
|
|
6957
6957
|
}), s = Mt(() => {
|
|
6958
|
-
const
|
|
6958
|
+
const c = t._core._reactor.getPresence(
|
|
6959
6959
|
t.type,
|
|
6960
6960
|
t.id
|
|
6961
6961
|
);
|
|
6962
|
-
return n != null && n.writeOnly ? [] : Object.values((
|
|
6962
|
+
return n != null && n.writeOnly ? [] : Object.values((c == null ? void 0 : c.peers) ?? {}).filter(
|
|
6963
6963
|
(f) => f[e] === !0
|
|
6964
6964
|
);
|
|
6965
6965
|
}, [n == null ? void 0 : n.writeOnly, i]), o = fe(
|
|
6966
|
-
(
|
|
6966
|
+
(c) => {
|
|
6967
6967
|
t.core._reactor.publishPresence(t.type, t.id, {
|
|
6968
|
-
[e]:
|
|
6969
|
-
}),
|
|
6968
|
+
[e]: c
|
|
6969
|
+
}), c && ((n == null ? void 0 : n.timeout) === null || (n == null ? void 0 : n.timeout) === 0 || r.set((n == null ? void 0 : n.timeout) ?? ma, () => {
|
|
6970
6970
|
t.core._reactor.publishPresence(t.type, t.id, {
|
|
6971
6971
|
[e]: null
|
|
6972
6972
|
});
|
|
@@ -6974,18 +6974,18 @@ function Ea(t, e, n = {}) {
|
|
|
6974
6974
|
},
|
|
6975
6975
|
[t.type, t.id, e, n == null ? void 0 : n.timeout, r]
|
|
6976
6976
|
), u = fe(
|
|
6977
|
-
(
|
|
6978
|
-
const l = !((n == null ? void 0 : n.stopOnEnter) &&
|
|
6977
|
+
(c) => {
|
|
6978
|
+
const l = !((n == null ? void 0 : n.stopOnEnter) && c.key === "Enter");
|
|
6979
6979
|
o(l);
|
|
6980
6980
|
},
|
|
6981
6981
|
[n.stopOnEnter, o]
|
|
6982
6982
|
), a = fe(() => {
|
|
6983
6983
|
o(!1);
|
|
6984
|
-
}, [o]),
|
|
6984
|
+
}, [o]), d = Mt(() => ({ onKeyDown: u, onBlur: a }), [u, a]);
|
|
6985
6985
|
return {
|
|
6986
6986
|
active: s,
|
|
6987
6987
|
setActive: o,
|
|
6988
|
-
inputProps:
|
|
6988
|
+
inputProps: d
|
|
6989
6989
|
};
|
|
6990
6990
|
}
|
|
6991
6991
|
const ye = {
|