@instantdb/react-common 0.22.89 → 0.22.90-experimental.drewh-ssr.20286580593.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commonjs/InstantReactAbstractDatabase.d.ts +1 -0
- package/dist/commonjs/InstantReactAbstractDatabase.d.ts.map +1 -1
- package/dist/commonjs/InstantReactAbstractDatabase.js +21 -17
- package/dist/commonjs/InstantReactAbstractDatabase.js.map +1 -1
- package/dist/commonjs/useQuery.d.ts.map +1 -1
- package/dist/commonjs/useQuery.js +1 -0
- package/dist/commonjs/useQuery.js.map +1 -1
- package/dist/esm/InstantReactAbstractDatabase.d.ts +1 -0
- package/dist/esm/InstantReactAbstractDatabase.d.ts.map +1 -1
- package/dist/esm/InstantReactAbstractDatabase.js +21 -17
- package/dist/esm/InstantReactAbstractDatabase.js.map +1 -1
- package/dist/esm/useQuery.d.ts.map +1 -1
- package/dist/esm/useQuery.js +1 -0
- package/dist/esm/useQuery.js.map +1 -1
- package/dist/standalone/index.js +535 -481
- package/dist/standalone/index.umd.cjs +10 -10
- package/package.json +3 -3
- package/src/InstantReactAbstractDatabase.tsx +6 -2
- package/src/useQuery.ts +1 -0
package/dist/standalone/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import wr, { useRef as
|
|
1
|
+
import wr, { useRef as ze, useCallback as fe, useSyncExternalStore as Pt, useEffect as ge, useMemo as Mt, useState as mr } from "react";
|
|
2
2
|
var Rt = { exports: {} }, Re = {};
|
|
3
3
|
/**
|
|
4
4
|
* @license React
|
|
@@ -23,10 +23,10 @@ function Ui() {
|
|
|
23
23
|
}
|
|
24
24
|
return Re.Fragment = n, Re.jsx = o, Re.jsxs = o, Re;
|
|
25
25
|
}
|
|
26
|
-
var $e = {},
|
|
26
|
+
var $e = {}, xn;
|
|
27
27
|
function Li() {
|
|
28
|
-
if (
|
|
29
|
-
|
|
28
|
+
if (xn) return $e;
|
|
29
|
+
xn = 1;
|
|
30
30
|
var t = {};
|
|
31
31
|
/**
|
|
32
32
|
* @license React
|
|
@@ -38,14 +38,14 @@ 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"), c = Symbol.for("react.forward_ref"), d = 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,
|
|
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"), c = Symbol.for("react.forward_ref"), d = 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, g = "@@iterator";
|
|
42
42
|
function w(h) {
|
|
43
43
|
if (h === null || typeof h != "object")
|
|
44
44
|
return null;
|
|
45
|
-
var T = b && h[b] || h[
|
|
45
|
+
var T = b && h[b] || h[g];
|
|
46
46
|
return typeof T == "function" ? T : null;
|
|
47
47
|
}
|
|
48
|
-
var
|
|
48
|
+
var _ = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
49
49
|
function v(h) {
|
|
50
50
|
{
|
|
51
51
|
for (var T = arguments.length, m = new Array(T > 1 ? T - 1 : 0), O = 1; O < T; O++)
|
|
@@ -55,7 +55,7 @@ function Li() {
|
|
|
55
55
|
}
|
|
56
56
|
function A(h, T, m) {
|
|
57
57
|
{
|
|
58
|
-
var O =
|
|
58
|
+
var O = _.ReactDebugCurrentFrame, I = O.getStackAddendum();
|
|
59
59
|
I !== "" && (T += "%s", m = m.concat([I]));
|
|
60
60
|
var P = m.map(function(j) {
|
|
61
61
|
return String(j);
|
|
@@ -63,10 +63,10 @@ function Li() {
|
|
|
63
63
|
P.unshift("Warning: " + T), Function.prototype.apply.call(console[h], console, P);
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
var S = !1, C = !1,
|
|
66
|
+
var S = !1, C = !1, x = !1, R = !1, Pe = !1, Ge;
|
|
67
67
|
Ge = Symbol.for("react.module.reference");
|
|
68
|
-
function
|
|
69
|
-
return !!(typeof h == "string" || typeof h == "function" || h === i || h === o || Pe || h === s || h === d || h === f || R || h === y || S || C ||
|
|
68
|
+
function He(h) {
|
|
69
|
+
return !!(typeof h == "string" || typeof h == "function" || h === i || h === o || Pe || h === s || h === d || h === f || R || h === y || S || C || x || typeof h == "object" && h !== null && (h.$$typeof === p || h.$$typeof === l || h.$$typeof === u || h.$$typeof === a || h.$$typeof === c || // 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.
|
|
@@ -79,7 +79,7 @@ function Li() {
|
|
|
79
79
|
var I = T.displayName || T.name || "";
|
|
80
80
|
return I !== "" ? m + "(" + I + ")" : m;
|
|
81
81
|
}
|
|
82
|
-
function
|
|
82
|
+
function Ye(h) {
|
|
83
83
|
return h.displayName || "Context";
|
|
84
84
|
}
|
|
85
85
|
function ne(h) {
|
|
@@ -107,10 +107,10 @@ function Li() {
|
|
|
107
107
|
switch (h.$$typeof) {
|
|
108
108
|
case a:
|
|
109
109
|
var T = h;
|
|
110
|
-
return
|
|
110
|
+
return Ye(T) + ".Consumer";
|
|
111
111
|
case u:
|
|
112
112
|
var m = h;
|
|
113
|
-
return
|
|
113
|
+
return Ye(m._context) + ".Provider";
|
|
114
114
|
case c:
|
|
115
115
|
return _t(h, h.render, "ForwardRef");
|
|
116
116
|
case l:
|
|
@@ -189,8 +189,8 @@ function Li() {
|
|
|
189
189
|
le < 0 && v("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
|
-
var gt =
|
|
193
|
-
function
|
|
192
|
+
var gt = _.ReactCurrentDispatcher, Tt;
|
|
193
|
+
function Je(h, T, m) {
|
|
194
194
|
{
|
|
195
195
|
if (Tt === void 0)
|
|
196
196
|
try {
|
|
@@ -203,16 +203,16 @@ function Li() {
|
|
|
203
203
|
` + Tt + h;
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
|
-
var wt = !1,
|
|
206
|
+
var wt = !1, Ze;
|
|
207
207
|
{
|
|
208
208
|
var li = typeof WeakMap == "function" ? WeakMap : Map;
|
|
209
|
-
|
|
209
|
+
Ze = new li();
|
|
210
210
|
}
|
|
211
211
|
function Tn(h, T) {
|
|
212
212
|
if (!h || wt)
|
|
213
213
|
return "";
|
|
214
214
|
{
|
|
215
|
-
var m =
|
|
215
|
+
var m = Ze.get(h);
|
|
216
216
|
if (m !== void 0)
|
|
217
217
|
return m;
|
|
218
218
|
}
|
|
@@ -258,26 +258,26 @@ function Li() {
|
|
|
258
258
|
if (W && O && typeof W.stack == "string") {
|
|
259
259
|
for (var E = W.stack.split(`
|
|
260
260
|
`), z = O.stack.split(`
|
|
261
|
-
`), D = E.length - 1,
|
|
262
|
-
|
|
263
|
-
for (; D >= 1 &&
|
|
264
|
-
if (E[D] !== z[
|
|
265
|
-
if (D !== 1 ||
|
|
261
|
+
`), D = E.length - 1, L = z.length - 1; D >= 1 && L >= 0 && E[D] !== z[L]; )
|
|
262
|
+
L--;
|
|
263
|
+
for (; D >= 1 && L >= 0; D--, L--)
|
|
264
|
+
if (E[D] !== z[L]) {
|
|
265
|
+
if (D !== 1 || L !== 1)
|
|
266
266
|
do
|
|
267
|
-
if (D--,
|
|
267
|
+
if (D--, L--, L < 0 || E[D] !== z[L]) {
|
|
268
268
|
var J = `
|
|
269
269
|
` + E[D].replace(" at new ", " at ");
|
|
270
|
-
return h.displayName && J.includes("<anonymous>") && (J = J.replace("<anonymous>", h.displayName)), typeof h == "function" &&
|
|
270
|
+
return h.displayName && J.includes("<anonymous>") && (J = J.replace("<anonymous>", h.displayName)), typeof h == "function" && Ze.set(h, J), J;
|
|
271
271
|
}
|
|
272
|
-
while (D >= 1 &&
|
|
272
|
+
while (D >= 1 && L >= 0);
|
|
273
273
|
break;
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
276
|
} finally {
|
|
277
277
|
wt = !1, gt.current = P, fi(), Error.prepareStackTrace = I;
|
|
278
278
|
}
|
|
279
|
-
var Se = h ? h.displayName || h.name : "", he = Se ?
|
|
280
|
-
return typeof h == "function" &&
|
|
279
|
+
var Se = h ? h.displayName || h.name : "", he = Se ? Je(Se) : "";
|
|
280
|
+
return typeof h == "function" && Ze.set(h, he), he;
|
|
281
281
|
}
|
|
282
282
|
function hi(h, T, m) {
|
|
283
283
|
return Tn(h, !1);
|
|
@@ -286,39 +286,39 @@ function Li() {
|
|
|
286
286
|
var T = h.prototype;
|
|
287
287
|
return !!(T && T.isReactComponent);
|
|
288
288
|
}
|
|
289
|
-
function
|
|
289
|
+
function Xe(h, T, m) {
|
|
290
290
|
if (h == null)
|
|
291
291
|
return "";
|
|
292
292
|
if (typeof h == "function")
|
|
293
293
|
return Tn(h, pi(h));
|
|
294
294
|
if (typeof h == "string")
|
|
295
|
-
return
|
|
295
|
+
return Je(h);
|
|
296
296
|
switch (h) {
|
|
297
297
|
case d:
|
|
298
|
-
return
|
|
298
|
+
return Je("Suspense");
|
|
299
299
|
case f:
|
|
300
|
-
return
|
|
300
|
+
return Je("SuspenseList");
|
|
301
301
|
}
|
|
302
302
|
if (typeof h == "object")
|
|
303
303
|
switch (h.$$typeof) {
|
|
304
304
|
case c:
|
|
305
305
|
return hi(h.render);
|
|
306
306
|
case l:
|
|
307
|
-
return
|
|
307
|
+
return Xe(h.type, T, m);
|
|
308
308
|
case p: {
|
|
309
309
|
var O = h, I = O._payload, P = O._init;
|
|
310
310
|
try {
|
|
311
|
-
return
|
|
311
|
+
return Xe(P(I), T, m);
|
|
312
312
|
} catch {
|
|
313
313
|
}
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
316
|
return "";
|
|
317
317
|
}
|
|
318
|
-
var Me = Object.prototype.hasOwnProperty, wn = {}, mn =
|
|
319
|
-
function
|
|
318
|
+
var Me = Object.prototype.hasOwnProperty, wn = {}, mn = _.ReactDebugCurrentFrame;
|
|
319
|
+
function et(h) {
|
|
320
320
|
if (h) {
|
|
321
|
-
var T = h._owner, m =
|
|
321
|
+
var T = h._owner, m = Xe(h.type, h._source, T ? T.type : null);
|
|
322
322
|
mn.setExtraStackFrame(m);
|
|
323
323
|
} else
|
|
324
324
|
mn.setExtraStackFrame(null);
|
|
@@ -338,7 +338,7 @@ function Li() {
|
|
|
338
338
|
} catch (D) {
|
|
339
339
|
E = D;
|
|
340
340
|
}
|
|
341
|
-
E && !(E instanceof Error) && (
|
|
341
|
+
E && !(E instanceof Error) && (et(I), v("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", O || "React class", m, j, typeof E), et(null)), E instanceof Error && !(E.message in wn) && (wn[E.message] = !0, et(I), v("Failed %s type: %s", m, E.message), et(null));
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
344
|
}
|
|
@@ -366,7 +366,7 @@ function Li() {
|
|
|
366
366
|
if (gi(h))
|
|
367
367
|
return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", _i(h)), vn(h);
|
|
368
368
|
}
|
|
369
|
-
var On =
|
|
369
|
+
var On = _.ReactCurrentOwner, Ti = {
|
|
370
370
|
key: !0,
|
|
371
371
|
ref: !0,
|
|
372
372
|
__self: !0,
|
|
@@ -454,16 +454,16 @@ function Li() {
|
|
|
454
454
|
j[P] === void 0 && (j[P] = D[P]);
|
|
455
455
|
}
|
|
456
456
|
if (E || z) {
|
|
457
|
-
var
|
|
458
|
-
E && Si(j,
|
|
457
|
+
var L = typeof h == "function" ? h.displayName || h.name || "Unknown" : h;
|
|
458
|
+
E && Si(j, L), z && Oi(j, L);
|
|
459
459
|
}
|
|
460
460
|
return Ai(h, E, z, I, O, On.current, j);
|
|
461
461
|
}
|
|
462
462
|
}
|
|
463
|
-
var vt =
|
|
463
|
+
var vt = _.ReactCurrentOwner, kn = _.ReactDebugCurrentFrame;
|
|
464
464
|
function ve(h) {
|
|
465
465
|
if (h) {
|
|
466
|
-
var T = h._owner, m =
|
|
466
|
+
var T = h._owner, m = Xe(h.type, h._source, T ? T.type : null);
|
|
467
467
|
kn.setExtraStackFrame(m);
|
|
468
468
|
} else
|
|
469
469
|
kn.setExtraStackFrame(null);
|
|
@@ -573,7 +573,7 @@ Check the top-level render call using <` + m + ">.");
|
|
|
573
573
|
var Mn = {};
|
|
574
574
|
function Rn(h, T, m, O, I, P) {
|
|
575
575
|
{
|
|
576
|
-
var j =
|
|
576
|
+
var j = He(h);
|
|
577
577
|
if (!j) {
|
|
578
578
|
var E = "";
|
|
579
579
|
(h === void 0 || typeof h == "object" && h !== null && Object.keys(h).length === 0) && (E += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
@@ -582,9 +582,9 @@ Check the top-level render call using <` + m + ">.");
|
|
|
582
582
|
var D;
|
|
583
583
|
h === null ? D = "null" : mt(h) ? D = "array" : h !== void 0 && h.$$typeof === n ? (D = "<" + (ne(h.type) || "Unknown") + " />", E = " Did you accidentally export a JSX literal instead of a component?") : D = typeof h, v("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", D, E);
|
|
584
584
|
}
|
|
585
|
-
var
|
|
586
|
-
if (
|
|
587
|
-
return
|
|
585
|
+
var L = Ei(h, T, m, I, P);
|
|
586
|
+
if (L == null)
|
|
587
|
+
return L;
|
|
588
588
|
if (j) {
|
|
589
589
|
var J = T.children;
|
|
590
590
|
if (J !== void 0)
|
|
@@ -599,20 +599,20 @@ Check the top-level render call using <` + m + ">.");
|
|
|
599
599
|
Pn(J, h);
|
|
600
600
|
}
|
|
601
601
|
if (Me.call(T, "key")) {
|
|
602
|
-
var he = ne(h), W = Object.keys(T).filter(function(
|
|
603
|
-
return
|
|
602
|
+
var he = ne(h), W = Object.keys(T).filter(function(Di) {
|
|
603
|
+
return Di !== "key";
|
|
604
604
|
}), At = W.length > 0 ? "{key: someKey, " + W.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
605
605
|
if (!Mn[he + At]) {
|
|
606
|
-
var
|
|
606
|
+
var xi = W.length > 0 ? "{" + W.join(": ..., ") + ": ...}" : "{}";
|
|
607
607
|
v(`A props object containing a "key" prop is being spread into JSX:
|
|
608
608
|
let props = %s;
|
|
609
609
|
<%s {...props} />
|
|
610
610
|
React keys must be passed directly to JSX without using spread:
|
|
611
611
|
let props = %s;
|
|
612
|
-
<%s key={someKey} {...props} />`, At, he,
|
|
612
|
+
<%s key={someKey} {...props} />`, At, he, xi, he), Mn[he + At] = !0;
|
|
613
613
|
}
|
|
614
614
|
}
|
|
615
|
-
return h === i ? Ii(
|
|
615
|
+
return h === i ? Ii(L) : Ci(L), L;
|
|
616
616
|
}
|
|
617
617
|
}
|
|
618
618
|
function Pi(h, T, m) {
|
|
@@ -627,8 +627,8 @@ React keys must be passed directly to JSX without using spread:
|
|
|
627
627
|
}
|
|
628
628
|
var Fi = {};
|
|
629
629
|
Fi.NODE_ENV === "production" ? Rt.exports = Ui() : Rt.exports = Li();
|
|
630
|
-
var
|
|
631
|
-
function
|
|
630
|
+
var tt = Rt.exports;
|
|
631
|
+
function N(t) {
|
|
632
632
|
if (typeof t == "number")
|
|
633
633
|
return (Math.abs(t * 2654435761) >>> 0).toString(16);
|
|
634
634
|
if (typeof t == "boolean")
|
|
@@ -647,7 +647,7 @@ function q(t) {
|
|
|
647
647
|
let e = 2166136261;
|
|
648
648
|
for (let n = 0; n < t.length; n++) {
|
|
649
649
|
e ^= (n + 1) * 2654435761;
|
|
650
|
-
const r =
|
|
650
|
+
const r = N(t[n]);
|
|
651
651
|
for (let i = 0; i < r.length; i++)
|
|
652
652
|
e ^= r.charCodeAt(i), e *= 16777619, e = e >>> 0;
|
|
653
653
|
}
|
|
@@ -657,27 +657,27 @@ function q(t) {
|
|
|
657
657
|
let e = 2166136261;
|
|
658
658
|
const n = Object.keys(t).sort();
|
|
659
659
|
for (let r = 0; r < n.length; r++) {
|
|
660
|
-
const i = n[r], s =
|
|
660
|
+
const i = n[r], s = N(i);
|
|
661
661
|
e ^= parseInt(s, 16), e *= 16777619, e = e >>> 0;
|
|
662
|
-
const o =
|
|
662
|
+
const o = N(t[i]);
|
|
663
663
|
e ^= parseInt(o, 16), e *= 16777619, e = e >>> 0;
|
|
664
664
|
}
|
|
665
665
|
return e.toString(16);
|
|
666
666
|
}
|
|
667
|
-
return
|
|
667
|
+
return N(String(t));
|
|
668
668
|
}
|
|
669
|
-
const
|
|
669
|
+
const U = {
|
|
670
670
|
Remove: "remove",
|
|
671
671
|
Replace: "replace",
|
|
672
672
|
Add: "add"
|
|
673
|
-
}, vr = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), Ni = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"),
|
|
673
|
+
}, vr = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), Ni = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), ot = Symbol.iterator, Y = {
|
|
674
674
|
mutable: "mutable",
|
|
675
675
|
immutable: "immutable"
|
|
676
676
|
}, Jt = {};
|
|
677
|
-
function
|
|
677
|
+
function Ne(t, e) {
|
|
678
678
|
return t instanceof Map ? t.has(e) : Object.prototype.hasOwnProperty.call(t, e);
|
|
679
679
|
}
|
|
680
|
-
function
|
|
680
|
+
function Dn(t, e) {
|
|
681
681
|
if (e in t) {
|
|
682
682
|
let n = Reflect.getPrototypeOf(t);
|
|
683
683
|
for (; n; ) {
|
|
@@ -721,7 +721,7 @@ function Sr(t, e = []) {
|
|
|
721
721
|
if (r !== null && (r == null ? void 0 : r.original) !== t.original)
|
|
722
722
|
return null;
|
|
723
723
|
const i = t.parent.type === 3, s = i ? Array.from(t.parent.setMap.keys()).indexOf(t.key) : t.key;
|
|
724
|
-
if (!(i && n.size > s ||
|
|
724
|
+
if (!(i && n.size > s || Ne(n, s)))
|
|
725
725
|
return null;
|
|
726
726
|
e.push(s);
|
|
727
727
|
}
|
|
@@ -741,7 +741,7 @@ function we(t) {
|
|
|
741
741
|
function de(t, e) {
|
|
742
742
|
return we(t) === 2 ? t.get(e) : t[e];
|
|
743
743
|
}
|
|
744
|
-
function
|
|
744
|
+
function We(t, e, n) {
|
|
745
745
|
we(t) === 2 ? t.set(e, n) : t[e] = n;
|
|
746
746
|
}
|
|
747
747
|
function Et(t, e) {
|
|
@@ -825,15 +825,15 @@ function Or(t, e) {
|
|
|
825
825
|
function V(t) {
|
|
826
826
|
t.copy || (t.copy = Or(t.original, t.options));
|
|
827
827
|
}
|
|
828
|
-
function
|
|
828
|
+
function De(t) {
|
|
829
829
|
if (!ee(t))
|
|
830
830
|
return en(t);
|
|
831
831
|
if (Array.isArray(t))
|
|
832
|
-
return t.map(
|
|
832
|
+
return t.map(De);
|
|
833
833
|
if (t instanceof Map) {
|
|
834
834
|
const n = Array.from(t.entries()).map(([r, i]) => [
|
|
835
835
|
r,
|
|
836
|
-
|
|
836
|
+
De(i)
|
|
837
837
|
]);
|
|
838
838
|
if (!Xt(t)) {
|
|
839
839
|
const r = Object.getPrototypeOf(t).constructor;
|
|
@@ -842,7 +842,7 @@ function xe(t) {
|
|
|
842
842
|
return new Map(n);
|
|
843
843
|
}
|
|
844
844
|
if (t instanceof Set) {
|
|
845
|
-
const n = Array.from(t).map(
|
|
845
|
+
const n = Array.from(t).map(De);
|
|
846
846
|
if (!Zt(t)) {
|
|
847
847
|
const r = Object.getPrototypeOf(t).constructor;
|
|
848
848
|
return new r(n);
|
|
@@ -851,11 +851,11 @@ function xe(t) {
|
|
|
851
851
|
}
|
|
852
852
|
const e = Object.create(Object.getPrototypeOf(t));
|
|
853
853
|
for (const n in t)
|
|
854
|
-
e[n] =
|
|
854
|
+
e[n] = De(t[n]);
|
|
855
855
|
return e;
|
|
856
856
|
}
|
|
857
|
-
function
|
|
858
|
-
return Te(t) ?
|
|
857
|
+
function ut(t) {
|
|
858
|
+
return Te(t) ? De(t) : t;
|
|
859
859
|
}
|
|
860
860
|
function ie(t) {
|
|
861
861
|
var e;
|
|
@@ -933,7 +933,7 @@ function Ar(t, e, n) {
|
|
|
933
933
|
const a = k(o);
|
|
934
934
|
V(a);
|
|
935
935
|
const c = !((u = a.assignedMap) === null || u === void 0) && u.size || a.operated ? a.copy : a.original;
|
|
936
|
-
|
|
936
|
+
We(r ? i : t, s, c);
|
|
937
937
|
} else
|
|
938
938
|
Ar(o, e, n);
|
|
939
939
|
}), i) {
|
|
@@ -947,12 +947,12 @@ function Vi(t, e) {
|
|
|
947
947
|
const n = t.type === 3 ? t.setMap : t.copy;
|
|
948
948
|
t.finalities.revoke.length > 1 && t.assignedMap.get(e) && n && Ar(de(n, e), t.finalities.handledSet, t.options);
|
|
949
949
|
}
|
|
950
|
-
function
|
|
950
|
+
function xt(t) {
|
|
951
951
|
t.type === 3 && t.copy && (t.copy.clear(), t.setMap.forEach((e) => {
|
|
952
952
|
t.copy.add(en(e));
|
|
953
953
|
}));
|
|
954
954
|
}
|
|
955
|
-
function
|
|
955
|
+
function Dt(t, e, n, r) {
|
|
956
956
|
if (t.operated && t.assignedMap && t.assignedMap.size > 0 && !t.finalized) {
|
|
957
957
|
if (n && r) {
|
|
958
958
|
const s = Sr(t);
|
|
@@ -968,7 +968,7 @@ function nn(t, e, n, r) {
|
|
|
968
968
|
const a = t.type === 3 ? t.setMap : t.copy;
|
|
969
969
|
if (ce(de(a, e), n)) {
|
|
970
970
|
let c = i.original;
|
|
971
|
-
i.copy && (c = i.copy),
|
|
971
|
+
i.copy && (c = i.copy), xt(t), Dt(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(c, i.original)), We(a, e, c);
|
|
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;
|
|
@@ -982,24 +982,24 @@ function Wi(t, e, n, r, i) {
|
|
|
982
982
|
if (o.get(c.toString()) && a[c] !== s[c]) {
|
|
983
983
|
const d = e.concat([c]), f = be(d, i);
|
|
984
984
|
n.push({
|
|
985
|
-
op:
|
|
985
|
+
op: U.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:
|
|
988
|
+
value: ut(a[c])
|
|
989
989
|
}), r.push({
|
|
990
|
-
op:
|
|
990
|
+
op: U.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:
|
|
993
|
+
value: ut(s[c])
|
|
994
994
|
});
|
|
995
995
|
}
|
|
996
996
|
for (let c = s.length; c < a.length; c += 1) {
|
|
997
997
|
const d = e.concat([c]), f = be(d, i);
|
|
998
998
|
n.push({
|
|
999
|
-
op:
|
|
999
|
+
op: U.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:
|
|
1002
|
+
value: ut(a[c])
|
|
1003
1003
|
});
|
|
1004
1004
|
}
|
|
1005
1005
|
if (s.length < a.length) {
|
|
@@ -1007,7 +1007,7 @@ function Wi(t, e, n, r, i) {
|
|
|
1007
1007
|
if (c) {
|
|
1008
1008
|
const d = e.concat(["length"]), f = be(d, i);
|
|
1009
1009
|
r.push({
|
|
1010
|
-
op:
|
|
1010
|
+
op: U.Replace,
|
|
1011
1011
|
path: f,
|
|
1012
1012
|
value: s.length
|
|
1013
1013
|
});
|
|
@@ -1015,32 +1015,32 @@ function Wi(t, e, n, r, i) {
|
|
|
1015
1015
|
for (let d = a.length; s.length < d; d -= 1) {
|
|
1016
1016
|
const f = e.concat([d - 1]), l = be(f, i);
|
|
1017
1017
|
r.push({
|
|
1018
|
-
op:
|
|
1018
|
+
op: U.Remove,
|
|
1019
1019
|
path: l
|
|
1020
1020
|
});
|
|
1021
1021
|
}
|
|
1022
1022
|
}
|
|
1023
1023
|
}
|
|
1024
|
-
function
|
|
1024
|
+
function Qi({ original: t, copy: e, assignedMap: n }, r, i, s, o) {
|
|
1025
1025
|
n.forEach((u, a) => {
|
|
1026
|
-
const c = de(t, a), d =
|
|
1027
|
-
if (ce(c, d) && f ===
|
|
1026
|
+
const c = de(t, a), d = ut(de(e, a)), f = u ? Ne(t, a) ? U.Replace : U.Add : U.Remove;
|
|
1027
|
+
if (ce(c, d) && f === U.Replace)
|
|
1028
1028
|
return;
|
|
1029
1029
|
const l = r.concat(a), p = be(l, o);
|
|
1030
|
-
i.push(f ===
|
|
1030
|
+
i.push(f === U.Remove ? { op: f, path: p } : { op: f, path: p, value: d }), s.push(f === U.Add ? { op: U.Remove, path: p } : f === U.Remove ? { op: U.Add, path: p, value: c } : { op: U.Replace, path: p, value: c });
|
|
1031
1031
|
});
|
|
1032
1032
|
}
|
|
1033
|
-
function
|
|
1033
|
+
function Bi({ 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
1037
|
const a = n.concat([o]), c = be(a, s);
|
|
1038
1038
|
r.push({
|
|
1039
|
-
op:
|
|
1039
|
+
op: U.Remove,
|
|
1040
1040
|
path: c,
|
|
1041
1041
|
value: u
|
|
1042
1042
|
}), i.unshift({
|
|
1043
|
-
op:
|
|
1043
|
+
op: U.Add,
|
|
1044
1044
|
path: c,
|
|
1045
1045
|
value: u
|
|
1046
1046
|
});
|
|
@@ -1050,11 +1050,11 @@ function Gi({ original: t, copy: e }, n, r, i, s) {
|
|
|
1050
1050
|
if (!t.has(u)) {
|
|
1051
1051
|
const a = n.concat([o]), c = be(a, s);
|
|
1052
1052
|
r.push({
|
|
1053
|
-
op:
|
|
1053
|
+
op: U.Add,
|
|
1054
1054
|
path: c,
|
|
1055
1055
|
value: u
|
|
1056
1056
|
}), i.unshift({
|
|
1057
|
-
op:
|
|
1057
|
+
op: U.Remove,
|
|
1058
1058
|
path: c,
|
|
1059
1059
|
value: u
|
|
1060
1060
|
});
|
|
@@ -1062,16 +1062,16 @@ function Gi({ original: t, copy: e }, n, r, i, s) {
|
|
|
1062
1062
|
o += 1;
|
|
1063
1063
|
});
|
|
1064
1064
|
}
|
|
1065
|
-
function
|
|
1065
|
+
function Ve(t, e, n, r) {
|
|
1066
1066
|
const { pathAsArray: i = !0 } = t.options.enablePatches;
|
|
1067
1067
|
switch (t.type) {
|
|
1068
1068
|
case 0:
|
|
1069
1069
|
case 2:
|
|
1070
|
-
return
|
|
1070
|
+
return Qi(t, e, n, r, i);
|
|
1071
1071
|
case 1:
|
|
1072
1072
|
return Wi(t, e, n, r, i);
|
|
1073
1073
|
case 3:
|
|
1074
|
-
return
|
|
1074
|
+
return Bi(t, e, n, r, i);
|
|
1075
1075
|
}
|
|
1076
1076
|
}
|
|
1077
1077
|
const ct = (t, e, n = !1) => {
|
|
@@ -1086,7 +1086,7 @@ const ct = (t, e, n = !1) => {
|
|
|
1086
1086
|
},
|
|
1087
1087
|
set(t, e) {
|
|
1088
1088
|
const n = k(this), r = H(n);
|
|
1089
|
-
return (!r.has(t) || !ce(r.get(t), e)) && (V(n), ie(n), n.assignedMap.set(t, !0), n.copy.set(t, e), nn(n, t, e,
|
|
1089
|
+
return (!r.has(t) || !ce(r.get(t), e)) && (V(n), ie(n), n.assignedMap.set(t, !0), n.copy.set(t, e), nn(n, t, e, Ve)), this;
|
|
1090
1090
|
},
|
|
1091
1091
|
delete(t) {
|
|
1092
1092
|
if (!this.has(t))
|
|
@@ -1129,7 +1129,7 @@ const ct = (t, e, n = !1) => {
|
|
|
1129
1129
|
values() {
|
|
1130
1130
|
const t = this.keys();
|
|
1131
1131
|
return {
|
|
1132
|
-
[
|
|
1132
|
+
[ot]: () => this.values(),
|
|
1133
1133
|
next: () => {
|
|
1134
1134
|
const e = t.next();
|
|
1135
1135
|
return e.done ? e : {
|
|
@@ -1142,7 +1142,7 @@ const ct = (t, e, n = !1) => {
|
|
|
1142
1142
|
entries() {
|
|
1143
1143
|
const t = this.keys();
|
|
1144
1144
|
return {
|
|
1145
|
-
[
|
|
1145
|
+
[ot]: () => this.entries(),
|
|
1146
1146
|
next: () => {
|
|
1147
1147
|
const e = t.next();
|
|
1148
1148
|
if (e.done)
|
|
@@ -1155,10 +1155,10 @@ const ct = (t, e, n = !1) => {
|
|
|
1155
1155
|
}
|
|
1156
1156
|
};
|
|
1157
1157
|
},
|
|
1158
|
-
[
|
|
1158
|
+
[ot]() {
|
|
1159
1159
|
return this.entries();
|
|
1160
1160
|
}
|
|
1161
|
-
},
|
|
1161
|
+
}, Gi = Reflect.ownKeys(Ut), Ln = (t, e, { isValuesIterator: n }) => () => {
|
|
1162
1162
|
var r, i;
|
|
1163
1163
|
const s = e.next();
|
|
1164
1164
|
if (s.done)
|
|
@@ -1194,7 +1194,7 @@ const ct = (t, e, n = !1) => {
|
|
|
1194
1194
|
},
|
|
1195
1195
|
add(t) {
|
|
1196
1196
|
const e = k(this);
|
|
1197
|
-
return this.has(t) || (V(e), ie(e), e.assignedMap.set(t, !0), e.setMap.set(t, t), nn(e, t, t,
|
|
1197
|
+
return this.has(t) || (V(e), ie(e), e.assignedMap.set(t, !0), e.setMap.set(t, t), nn(e, t, t, Ve)), this;
|
|
1198
1198
|
},
|
|
1199
1199
|
delete(t) {
|
|
1200
1200
|
if (!this.has(t))
|
|
@@ -1236,7 +1236,7 @@ const ct = (t, e, n = !1) => {
|
|
|
1236
1236
|
keys() {
|
|
1237
1237
|
return this.values();
|
|
1238
1238
|
},
|
|
1239
|
-
[
|
|
1239
|
+
[ot]() {
|
|
1240
1240
|
return this.values();
|
|
1241
1241
|
},
|
|
1242
1242
|
forEach(t, e) {
|
|
@@ -1284,7 +1284,7 @@ const Hi = Reflect.ownKeys(dt), Er = /* @__PURE__ */ new WeakSet(), kr = {
|
|
|
1284
1284
|
return t.options.strict && ct(c, t.options, !0), c;
|
|
1285
1285
|
}
|
|
1286
1286
|
const u = H(t);
|
|
1287
|
-
if (u instanceof Map &&
|
|
1287
|
+
if (u instanceof Map && Gi.includes(e)) {
|
|
1288
1288
|
if (e === "size")
|
|
1289
1289
|
return Object.getOwnPropertyDescriptor(Ut, "size").get.call(t.proxy);
|
|
1290
1290
|
const c = Ut[e];
|
|
@@ -1298,8 +1298,8 @@ const Hi = Reflect.ownKeys(dt), Er = /* @__PURE__ */ new WeakSet(), kr = {
|
|
|
1298
1298
|
if (c)
|
|
1299
1299
|
return c.bind(t.proxy);
|
|
1300
1300
|
}
|
|
1301
|
-
if (!
|
|
1302
|
-
const c =
|
|
1301
|
+
if (!Ne(u, e)) {
|
|
1302
|
+
const c = Dn(u, e);
|
|
1303
1303
|
return c ? "value" in c ? c.value : (
|
|
1304
1304
|
// !case: support for getter
|
|
1305
1305
|
(i = c.get) === null || i === void 0 ? void 0 : i.call(t.proxy)
|
|
@@ -1330,11 +1330,11 @@ const Hi = Reflect.ownKeys(dt), Er = /* @__PURE__ */ new WeakSet(), kr = {
|
|
|
1330
1330
|
let i;
|
|
1331
1331
|
if (t.type === 1 && e !== "length" && !(Number.isInteger(i = Number(e)) && i >= 0 && (e === 0 || i === 0 || String(i) === String(e))))
|
|
1332
1332
|
throw new Error("Only supports setting array indices and the 'length' property.");
|
|
1333
|
-
const s =
|
|
1333
|
+
const s = Dn(H(t), e);
|
|
1334
1334
|
if (s != null && s.set)
|
|
1335
1335
|
return s.set.call(t.proxy, n), !0;
|
|
1336
1336
|
const o = Et(H(t), e), u = k(o);
|
|
1337
|
-
return u && ce(u.original, n) ? (t.copy[e] = n, t.assignedMap = (r = t.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), t.assignedMap.set(e, !1), !0) : (ce(n, o) && (n !== void 0 ||
|
|
1337
|
+
return u && ce(u.original, n) ? (t.copy[e] = n, t.assignedMap = (r = t.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), t.assignedMap.set(e, !1), !0) : (ce(n, o) && (n !== void 0 || Ne(t.original, e)) || (V(t), ie(t), Ne(t.original, e) && ce(n, t.original[e]) ? t.assignedMap.delete(e) : t.assignedMap.set(e, !0), t.copy[e] = n, nn(t, e, n, Ve)), !0);
|
|
1338
1338
|
},
|
|
1339
1339
|
has(t, e) {
|
|
1340
1340
|
return e in H(t);
|
|
@@ -1385,11 +1385,11 @@ function rn(t) {
|
|
|
1385
1385
|
d.finalities.draft.push((f, l) => {
|
|
1386
1386
|
var p, y;
|
|
1387
1387
|
const b = k(a);
|
|
1388
|
-
let
|
|
1389
|
-
const w = de(
|
|
1390
|
-
if (
|
|
1391
|
-
let v =
|
|
1392
|
-
|
|
1388
|
+
let g = d.type === 3 ? d.setMap : d.copy;
|
|
1389
|
+
const w = de(g, r), _ = k(w);
|
|
1390
|
+
if (_) {
|
|
1391
|
+
let v = _.original;
|
|
1392
|
+
_.operated && (v = en(w)), xt(_), Dt(_, Ve, f, l), d.options.enableAutoFreeze && (d.options.updatedValues = (p = d.options.updatedValues) !== null && p !== void 0 ? p : /* @__PURE__ */ new WeakMap(), d.options.updatedValues.set(v, _.original)), We(g, r, v);
|
|
1393
1393
|
}
|
|
1394
1394
|
(y = b.callbacks) === null || y === void 0 || y.forEach((v) => {
|
|
1395
1395
|
v(f, l);
|
|
@@ -1398,7 +1398,7 @@ function rn(t) {
|
|
|
1398
1398
|
} else {
|
|
1399
1399
|
const d = k(a);
|
|
1400
1400
|
d.finalities.draft.push((f, l) => {
|
|
1401
|
-
|
|
1401
|
+
xt(d), Dt(d, Ve, f, l);
|
|
1402
1402
|
});
|
|
1403
1403
|
}
|
|
1404
1404
|
return a;
|
|
@@ -1413,8 +1413,8 @@ function Yi(t, e, n, r, i) {
|
|
|
1413
1413
|
const c = a ? e[0] : o ? o.operated ? o.copy : o.original : t;
|
|
1414
1414
|
return o && $t(o), i && Oe(c, c, o == null ? void 0 : o.options.updatedValues), [
|
|
1415
1415
|
c,
|
|
1416
|
-
n && a ? [{ op:
|
|
1417
|
-
r && a ? [{ op:
|
|
1416
|
+
n && a ? [{ op: U.Replace, path: [], value: e[0] }] : n,
|
|
1417
|
+
r && a ? [{ op: U.Replace, path: [], value: u }] : r
|
|
1418
1418
|
];
|
|
1419
1419
|
}
|
|
1420
1420
|
function Ji(t, e) {
|
|
@@ -1451,7 +1451,7 @@ function Lt(t) {
|
|
|
1451
1451
|
const d = Array.from(u);
|
|
1452
1452
|
u.clear(), d.forEach((f) => u.add(s === f ? c : f));
|
|
1453
1453
|
} else
|
|
1454
|
-
|
|
1454
|
+
We(u, s, c);
|
|
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
|
}
|
|
@@ -1480,7 +1480,7 @@ function jr(t) {
|
|
|
1480
1480
|
if (n && ce(de(n.original, o), u))
|
|
1481
1481
|
return;
|
|
1482
1482
|
const a = jr(u);
|
|
1483
|
-
a !== u && (i === t && s(),
|
|
1483
|
+
a !== u && (i === t && s(), We(i, o, a));
|
|
1484
1484
|
}), r === 3) {
|
|
1485
1485
|
const o = (e = n == null ? void 0 : n.original) !== null && e !== void 0 ? e : i;
|
|
1486
1486
|
return Zt(o) ? new Set(i) : new (Object.getPrototypeOf(o)).constructor(i);
|
|
@@ -1496,7 +1496,7 @@ const Zi = (t) => function e(n, r, i) {
|
|
|
1496
1496
|
var s, o, u;
|
|
1497
1497
|
if (typeof n == "function" && typeof r != "function")
|
|
1498
1498
|
return function(S, ...C) {
|
|
1499
|
-
return e(S, (
|
|
1499
|
+
return e(S, (x) => n.call(this, x, ...C), r);
|
|
1500
1500
|
};
|
|
1501
1501
|
const a = n, c = r;
|
|
1502
1502
|
let d = i;
|
|
@@ -1504,26 +1504,26 @@ const Zi = (t) => function e(n, r, i) {
|
|
|
1504
1504
|
throw new Error(`Invalid options: ${d}, 'options' should be an object.`);
|
|
1505
1505
|
d = Object.assign(Object.assign({}, t), d);
|
|
1506
1506
|
const f = Te(a) ? Fn(a) : a, l = Array.isArray(d.mark) ? (S, C) => {
|
|
1507
|
-
for (const
|
|
1508
|
-
if (typeof
|
|
1509
|
-
throw new Error(`Invalid mark: ${
|
|
1510
|
-
const R =
|
|
1507
|
+
for (const x of d.mark) {
|
|
1508
|
+
if (typeof x != "function")
|
|
1509
|
+
throw new Error(`Invalid mark: ${x}, 'mark' should be a function.`);
|
|
1510
|
+
const R = x(S, C);
|
|
1511
1511
|
if (R)
|
|
1512
1512
|
return R;
|
|
1513
1513
|
}
|
|
1514
|
-
} : d.mark, p = (s = d.enablePatches) !== null && s !== void 0 ? s : !1, y = (o = d.strict) !== null && o !== void 0 ? o : !1,
|
|
1514
|
+
} : d.mark, p = (s = d.enablePatches) !== null && s !== void 0 ? s : !1, y = (o = d.strict) !== null && o !== void 0 ? o : !1, g = {
|
|
1515
1515
|
enableAutoFreeze: (u = d.enableAutoFreeze) !== null && u !== void 0 ? u : !1,
|
|
1516
1516
|
mark: l,
|
|
1517
1517
|
strict: y,
|
|
1518
1518
|
enablePatches: p
|
|
1519
1519
|
};
|
|
1520
|
-
if (!ee(f,
|
|
1520
|
+
if (!ee(f, g) && typeof f == "object" && f !== null)
|
|
1521
1521
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
1522
|
-
const [w,
|
|
1522
|
+
const [w, _] = Ji(f, g);
|
|
1523
1523
|
if (typeof r != "function") {
|
|
1524
|
-
if (!ee(f,
|
|
1524
|
+
if (!ee(f, g))
|
|
1525
1525
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
1526
|
-
return [w,
|
|
1526
|
+
return [w, _];
|
|
1527
1527
|
}
|
|
1528
1528
|
let v;
|
|
1529
1529
|
try {
|
|
@@ -1539,24 +1539,24 @@ const Zi = (t) => function e(n, r, i) {
|
|
|
1539
1539
|
const R = S == null ? void 0 : S[Ni];
|
|
1540
1540
|
if (R) {
|
|
1541
1541
|
const Pe = R[0];
|
|
1542
|
-
return
|
|
1542
|
+
return g.strict && typeof S == "object" && S !== null && Lt({
|
|
1543
1543
|
rootDraft: C,
|
|
1544
1544
|
value: S,
|
|
1545
1545
|
useRawReturn: !0
|
|
1546
|
-
}),
|
|
1546
|
+
}), _([Pe]);
|
|
1547
1547
|
}
|
|
1548
1548
|
if (S !== void 0)
|
|
1549
|
-
return typeof S == "object" && S !== null && Lt({ rootDraft: C, value: S }),
|
|
1549
|
+
return typeof S == "object" && S !== null && Lt({ rootDraft: C, value: S }), _([S]);
|
|
1550
1550
|
}
|
|
1551
1551
|
if (S === w || S === void 0)
|
|
1552
|
-
return
|
|
1553
|
-
const
|
|
1554
|
-
if (
|
|
1555
|
-
if (
|
|
1552
|
+
return _([]);
|
|
1553
|
+
const x = k(S);
|
|
1554
|
+
if (g === x.options) {
|
|
1555
|
+
if (x.operated)
|
|
1556
1556
|
throw new Error("Cannot return a modified child draft.");
|
|
1557
|
-
return
|
|
1557
|
+
return _([Fn(S)]);
|
|
1558
1558
|
}
|
|
1559
|
-
return
|
|
1559
|
+
return _([S]);
|
|
1560
1560
|
};
|
|
1561
1561
|
return v instanceof Promise ? v.then(A, (S) => {
|
|
1562
1562
|
throw $t(k(w)), S;
|
|
@@ -1570,8 +1570,8 @@ function Cr(t, e) {
|
|
|
1570
1570
|
function Nn(t, e) {
|
|
1571
1571
|
return Object.keys(t).length === Object.keys(e).length && Object.keys(t).every((n) => e.hasOwnProperty(n) && t[n] === e[n]);
|
|
1572
1572
|
}
|
|
1573
|
-
function
|
|
1574
|
-
return typeof t != "object" || typeof e != "object" || t === null || e === null ? t === e : Cr(t, e) ? Object.keys(t).every((n) =>
|
|
1573
|
+
function at(t, e) {
|
|
1574
|
+
return typeof t != "object" || typeof e != "object" || t === null || e === null ? t === e : Cr(t, e) ? Object.keys(t).every((n) => at(t[n], e[n])) : !1;
|
|
1575
1575
|
}
|
|
1576
1576
|
function sn(t) {
|
|
1577
1577
|
if (!Ue(t))
|
|
@@ -1987,7 +1987,7 @@ class _e {
|
|
|
1987
1987
|
for (const e of Object.values(this.attrs))
|
|
1988
1988
|
if (un(e)) {
|
|
1989
1989
|
const [n, r, i] = e["forward-identity"];
|
|
1990
|
-
|
|
1990
|
+
Q(this.blobAttrs, [r, i], e);
|
|
1991
1991
|
}
|
|
1992
1992
|
return this._blobAttrs;
|
|
1993
1993
|
}
|
|
@@ -1998,7 +1998,7 @@ class _e {
|
|
|
1998
1998
|
for (const e of Object.values(this.attrs))
|
|
1999
1999
|
if (e["primary?"]) {
|
|
2000
2000
|
const [n, r] = e["forward-identity"];
|
|
2001
|
-
|
|
2001
|
+
Q(this._primaryKeys, [r], e);
|
|
2002
2002
|
}
|
|
2003
2003
|
return this._primaryKeys;
|
|
2004
2004
|
}
|
|
@@ -2008,7 +2008,7 @@ class _e {
|
|
|
2008
2008
|
this._forwardIdents = /* @__PURE__ */ new Map();
|
|
2009
2009
|
for (const e of Object.values(this.attrs)) {
|
|
2010
2010
|
const n = e["forward-identity"], [r, i, s] = n;
|
|
2011
|
-
|
|
2011
|
+
Q(this._forwardIdents, [i, s], e);
|
|
2012
2012
|
}
|
|
2013
2013
|
return this._forwardIdents;
|
|
2014
2014
|
}
|
|
@@ -2020,7 +2020,7 @@ class _e {
|
|
|
2020
2020
|
const n = e["reverse-identity"];
|
|
2021
2021
|
if (n) {
|
|
2022
2022
|
const [r, i, s] = n;
|
|
2023
|
-
|
|
2023
|
+
Q(this._revIdents, [i, s], e);
|
|
2024
2024
|
}
|
|
2025
2025
|
}
|
|
2026
2026
|
return this._revIdents;
|
|
@@ -2051,7 +2051,7 @@ function X(t, e) {
|
|
|
2051
2051
|
const [n, ...r] = e;
|
|
2052
2052
|
t.has(n) && X(t.get(n), r);
|
|
2053
2053
|
}
|
|
2054
|
-
function
|
|
2054
|
+
function Q(t, e, n) {
|
|
2055
2055
|
let r = t;
|
|
2056
2056
|
const i = e.length - 1;
|
|
2057
2057
|
for (let s = 0; s < i; s++) {
|
|
@@ -2070,22 +2070,22 @@ function Mr(t, e, n) {
|
|
|
2070
2070
|
console.warn("no such attr", a, u);
|
|
2071
2071
|
continue;
|
|
2072
2072
|
}
|
|
2073
|
-
d["checked-data-type"] === "date" && n && (c = pt(c), o[2] = c), on(d) &&
|
|
2073
|
+
d["checked-data-type"] === "date" && n && (c = pt(c), o[2] = c), on(d) && Q(s, [c, a, u], o), Q(r, [u, a, c], o), Q(i, [a, u, c], o);
|
|
2074
2074
|
}
|
|
2075
2075
|
return { eav: r, aev: i, vae: s };
|
|
2076
2076
|
}
|
|
2077
2077
|
function Rr(t) {
|
|
2078
2078
|
return {
|
|
2079
|
-
triples:
|
|
2079
|
+
triples: B(t.eav, 3),
|
|
2080
2080
|
cardinalityInference: t.cardinalityInference,
|
|
2081
2081
|
useDateObjects: t.useDateObjects,
|
|
2082
2082
|
version: 1
|
|
2083
2083
|
};
|
|
2084
2084
|
}
|
|
2085
2085
|
function $r(t, e) {
|
|
2086
|
-
return
|
|
2086
|
+
return Le(t, e.triples, e.cardinalityInference, e.useDateObjects);
|
|
2087
2087
|
}
|
|
2088
|
-
function
|
|
2088
|
+
function xr(t, e) {
|
|
2089
2089
|
if (t)
|
|
2090
2090
|
return new _e(t.attrs, t.linkIndex);
|
|
2091
2091
|
if (e && "__type" in e)
|
|
@@ -2094,18 +2094,18 @@ function Dr(t, e) {
|
|
|
2094
2094
|
function Ts(t, e) {
|
|
2095
2095
|
return Ce(t.eav, [e]) !== void 0;
|
|
2096
2096
|
}
|
|
2097
|
-
function
|
|
2097
|
+
function Le(t, e, n, r) {
|
|
2098
2098
|
const i = Mr(t, e, r);
|
|
2099
2099
|
return i.cardinalityInference = n, i.useDateObjects = r, i;
|
|
2100
2100
|
}
|
|
2101
|
-
function
|
|
2101
|
+
function Qe(t, e) {
|
|
2102
2102
|
var n, r;
|
|
2103
2103
|
let i;
|
|
2104
2104
|
if (Array.isArray(e[0])) {
|
|
2105
2105
|
const [o, u] = e[0], a = t.aev.get(o);
|
|
2106
2106
|
if (!a)
|
|
2107
2107
|
return null;
|
|
2108
|
-
i = (n =
|
|
2108
|
+
i = (n = B(a, 2).find((d) => d[2] === u)) === null || n === void 0 ? void 0 : n[0];
|
|
2109
2109
|
} else
|
|
2110
2110
|
i = e[0];
|
|
2111
2111
|
if (!i)
|
|
@@ -2115,7 +2115,7 @@ 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 d = (r =
|
|
2118
|
+
const d = (r = B(a, 2).find((b) => b[2] === u)) === null || r === void 0 ? void 0 : r[0];
|
|
2119
2119
|
if (!d)
|
|
2120
2120
|
return null;
|
|
2121
2121
|
const [f, l, p, ...y] = e;
|
|
@@ -2125,8 +2125,8 @@ function We(t, e) {
|
|
|
2125
2125
|
return [i, ...u];
|
|
2126
2126
|
}
|
|
2127
2127
|
}
|
|
2128
|
-
function
|
|
2129
|
-
const r =
|
|
2128
|
+
function Dr(t, e, n) {
|
|
2129
|
+
const r = Qe(t, n);
|
|
2130
2130
|
if (!r)
|
|
2131
2131
|
return;
|
|
2132
2132
|
const [i, s, o] = r, u = e.getAttr(s);
|
|
@@ -2141,7 +2141,7 @@ function Ur(t, e, n) {
|
|
|
2141
2141
|
}
|
|
2142
2142
|
function Lr(t, e, n) {
|
|
2143
2143
|
var r;
|
|
2144
|
-
const i =
|
|
2144
|
+
const i = Qe(t, n);
|
|
2145
2145
|
if (!i)
|
|
2146
2146
|
return;
|
|
2147
2147
|
let [s, o, u] = i;
|
|
@@ -2150,11 +2150,11 @@ function Lr(t, e, n) {
|
|
|
2150
2150
|
return;
|
|
2151
2151
|
a["checked-data-type"] === "date" && t.useDateObjects && (u = pt(u));
|
|
2152
2152
|
const c = Ce(t.eav, [s, o, u]), d = (r = c == null ? void 0 : c[3]) !== null && r !== void 0 ? r : Ur(t, a, i), f = [s, o, u, d];
|
|
2153
|
-
gs(a) ? (
|
|
2153
|
+
gs(a) ? (Q(t.eav, [s, o], /* @__PURE__ */ new Map([[u, f]])), Q(t.aev, [o, s], /* @__PURE__ */ new Map([[u, f]]))) : (Q(t.eav, [s, o, u], f), Q(t.aev, [o, s, u], f)), on(a) && Q(t.vae, [u, o, s], f);
|
|
2154
2154
|
}
|
|
2155
2155
|
function ms(t, e, n) {
|
|
2156
2156
|
var r;
|
|
2157
|
-
const i =
|
|
2157
|
+
const i = Qe(t, n);
|
|
2158
2158
|
if (!i)
|
|
2159
2159
|
return;
|
|
2160
2160
|
const [s, o, u] = i, a = e.getAttr(o);
|
|
@@ -2174,20 +2174,20 @@ function ms(t, e, n) {
|
|
|
2174
2174
|
l,
|
|
2175
2175
|
Ur(t, a, d)
|
|
2176
2176
|
];
|
|
2177
|
-
|
|
2177
|
+
Q(t.eav, [s, o], /* @__PURE__ */ new Map([[l, p]])), Q(t.aev, [o, s], /* @__PURE__ */ new Map([[l, p]]));
|
|
2178
2178
|
}
|
|
2179
2179
|
function Nt(t, e, n) {
|
|
2180
2180
|
var r, i;
|
|
2181
|
-
const [s, o] = n, u =
|
|
2181
|
+
const [s, o] = n, u = Qe(t, [s]);
|
|
2182
2182
|
if (!u)
|
|
2183
2183
|
return;
|
|
2184
2184
|
const [a] = u, c = t.eav.get(a);
|
|
2185
2185
|
if (c) {
|
|
2186
2186
|
for (const f of c.keys()) {
|
|
2187
2187
|
const l = e.getAttr(f);
|
|
2188
|
-
l && l["on-delete-reverse"] === "cascade" &&
|
|
2189
|
-
var
|
|
2190
|
-
return Nt(t, e, [b, (
|
|
2188
|
+
l && l["on-delete-reverse"] === "cascade" && B(c.get(f), 1).forEach(([p, y, b]) => {
|
|
2189
|
+
var g;
|
|
2190
|
+
return Nt(t, e, [b, (g = l["reverse-identity"]) === null || g === void 0 ? void 0 : g[1]]);
|
|
2191
2191
|
}), // Fall back to deleting everything if we've rehydrated tx-steps from
|
|
2192
2192
|
// the store that didn't set `etype` in deleteEntity
|
|
2193
2193
|
(!o || // If we don't know about the attr, let's just get rid of it
|
|
@@ -2196,11 +2196,11 @@ function Nt(t, e, n) {
|
|
|
2196
2196
|
}
|
|
2197
2197
|
c.size === 0 && X(t.eav, [a]);
|
|
2198
2198
|
}
|
|
2199
|
-
const d = t.vae.get(a) &&
|
|
2199
|
+
const d = t.vae.get(a) && B(t.vae.get(a), 2);
|
|
2200
2200
|
d && d.forEach((f) => {
|
|
2201
2201
|
var l, p, y;
|
|
2202
|
-
const [b,
|
|
2203
|
-
(!o || !
|
|
2202
|
+
const [b, g, w] = f, _ = e.getAttr(g);
|
|
2203
|
+
(!o || !_ || ((l = _["reverse-identity"]) === null || l === void 0 ? void 0 : l[1]) === o) && (X(t.eav, [b, g, w]), X(t.aev, [g, b, w]), X(t.vae, [w, g, b])), _ && _["on-delete"] === "cascade" && ((p = _["reverse-identity"]) === null || p === void 0 ? void 0 : p[1]) === o && Nt(t, e, [b, (y = _["forward-identity"]) === null || y === void 0 ? void 0 : y[1]]);
|
|
2204
2204
|
}), ((i = t.vae.get(a)) === null || i === void 0 ? void 0 : i.size) === 0 && X(t.vae, [a]);
|
|
2205
2205
|
}
|
|
2206
2206
|
function Fr(t, e, n) {
|
|
@@ -2213,7 +2213,7 @@ function vs(t, [e]) {
|
|
|
2213
2213
|
t.addAttr(e);
|
|
2214
2214
|
}
|
|
2215
2215
|
function Nr(t) {
|
|
2216
|
-
return
|
|
2216
|
+
return B(t.eav, 3);
|
|
2217
2217
|
}
|
|
2218
2218
|
function Ss(t, e, [n]) {
|
|
2219
2219
|
if (!e.getAttr(n))
|
|
@@ -2234,7 +2234,7 @@ function As(t, e, n) {
|
|
|
2234
2234
|
ms(t, e, i);
|
|
2235
2235
|
break;
|
|
2236
2236
|
case "retract-triple":
|
|
2237
|
-
|
|
2237
|
+
Dr(t, e, i);
|
|
2238
2238
|
break;
|
|
2239
2239
|
case "delete-entity":
|
|
2240
2240
|
Nt(t, e, i);
|
|
@@ -2256,7 +2256,7 @@ function As(t, e, n) {
|
|
|
2256
2256
|
throw new Error(`unhandled transaction action: ${r}`);
|
|
2257
2257
|
}
|
|
2258
2258
|
}
|
|
2259
|
-
function
|
|
2259
|
+
function B(t, e, n = []) {
|
|
2260
2260
|
if (!t || e === 0)
|
|
2261
2261
|
return n;
|
|
2262
2262
|
if (e === 1) {
|
|
@@ -2265,10 +2265,10 @@ function G(t, e, n = []) {
|
|
|
2265
2265
|
return n;
|
|
2266
2266
|
}
|
|
2267
2267
|
for (const r of t.values())
|
|
2268
|
-
|
|
2268
|
+
B(r, e - 1, n);
|
|
2269
2269
|
return n;
|
|
2270
2270
|
}
|
|
2271
|
-
function
|
|
2271
|
+
function nt(t, e, n) {
|
|
2272
2272
|
var r;
|
|
2273
2273
|
const i = [];
|
|
2274
2274
|
if (n != null && n.hasOwnProperty("$not")) {
|
|
@@ -2293,7 +2293,7 @@ function tt(t, e, n) {
|
|
|
2293
2293
|
return i;
|
|
2294
2294
|
}
|
|
2295
2295
|
if (n != null && n.$comparator)
|
|
2296
|
-
return
|
|
2296
|
+
return B(e, 1).filter(n.$op);
|
|
2297
2297
|
const s = n.in || n.$in || [n];
|
|
2298
2298
|
for (const o of s) {
|
|
2299
2299
|
const u = e.get(o);
|
|
@@ -2310,15 +2310,15 @@ function ks(t, [e, n, r]) {
|
|
|
2310
2310
|
switch (Es(e, n, r)) {
|
|
2311
2311
|
case "e": {
|
|
2312
2312
|
const u = t.eav.get(e);
|
|
2313
|
-
return
|
|
2313
|
+
return B(u, 2);
|
|
2314
2314
|
}
|
|
2315
2315
|
case "ea": {
|
|
2316
2316
|
const u = (i = t.eav.get(e)) === null || i === void 0 ? void 0 : i.get(n);
|
|
2317
|
-
return
|
|
2317
|
+
return B(u, 1);
|
|
2318
2318
|
}
|
|
2319
2319
|
case "eav": {
|
|
2320
2320
|
const u = (s = t.eav.get(e)) === null || s === void 0 ? void 0 : s.get(n);
|
|
2321
|
-
return u ?
|
|
2321
|
+
return u ? nt(t, u, r) : [];
|
|
2322
2322
|
}
|
|
2323
2323
|
case "ev": {
|
|
2324
2324
|
const u = t.eav.get(e);
|
|
@@ -2326,12 +2326,12 @@ function ks(t, [e, n, r]) {
|
|
|
2326
2326
|
return [];
|
|
2327
2327
|
const a = [];
|
|
2328
2328
|
for (const c of u.values())
|
|
2329
|
-
a.push(...
|
|
2329
|
+
a.push(...nt(t, c, r));
|
|
2330
2330
|
return a;
|
|
2331
2331
|
}
|
|
2332
2332
|
case "a": {
|
|
2333
2333
|
const u = t.aev.get(n);
|
|
2334
|
-
return
|
|
2334
|
+
return B(u, 2);
|
|
2335
2335
|
}
|
|
2336
2336
|
case "av": {
|
|
2337
2337
|
const u = t.aev.get(n);
|
|
@@ -2339,18 +2339,18 @@ function ks(t, [e, n, r]) {
|
|
|
2339
2339
|
return [];
|
|
2340
2340
|
const a = [];
|
|
2341
2341
|
for (const c of u.values())
|
|
2342
|
-
a.push(...
|
|
2342
|
+
a.push(...nt(t, c, 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
2348
|
for (const c of a.values())
|
|
2349
|
-
u.push(...
|
|
2349
|
+
u.push(...nt(t, c, r));
|
|
2350
2350
|
return u;
|
|
2351
2351
|
}
|
|
2352
2352
|
default:
|
|
2353
|
-
return
|
|
2353
|
+
return B(t.eav, 3);
|
|
2354
2354
|
}
|
|
2355
2355
|
}
|
|
2356
2356
|
function js(t, e, n) {
|
|
@@ -2359,7 +2359,7 @@ function js(t, e, n) {
|
|
|
2359
2359
|
if (!e)
|
|
2360
2360
|
return i;
|
|
2361
2361
|
for (const [s, o] of e.entries()) {
|
|
2362
|
-
const u = (r = t.eav.get(n)) === null || r === void 0 ? void 0 : r.get(o.id), a =
|
|
2362
|
+
const u = (r = t.eav.get(n)) === null || r === void 0 ? void 0 : r.get(o.id), a = B(u, 1);
|
|
2363
2363
|
for (const c of a)
|
|
2364
2364
|
i[s] = c[2];
|
|
2365
2365
|
}
|
|
@@ -2382,7 +2382,7 @@ function Kr(t, e) {
|
|
|
2382
2382
|
return r || ((n = t.forwardIdents.get(e)) === null || n === void 0 ? void 0 : n.get("id"));
|
|
2383
2383
|
}
|
|
2384
2384
|
function Is(t, e, n) {
|
|
2385
|
-
const r =
|
|
2385
|
+
const r = Qe(t, n);
|
|
2386
2386
|
if (!r)
|
|
2387
2387
|
return;
|
|
2388
2388
|
const [i, s, o] = r;
|
|
@@ -2440,7 +2440,7 @@ function $s(t) {
|
|
|
2440
2440
|
return zn;
|
|
2441
2441
|
}
|
|
2442
2442
|
}
|
|
2443
|
-
const
|
|
2443
|
+
const xs = [
|
|
2444
2444
|
"in",
|
|
2445
2445
|
"$in",
|
|
2446
2446
|
"$not",
|
|
@@ -2448,14 +2448,14 @@ const Ds = [
|
|
|
2448
2448
|
"$comparator"
|
|
2449
2449
|
// covers all of $gt, $lt, etc.
|
|
2450
2450
|
];
|
|
2451
|
-
function
|
|
2452
|
-
for (const e of
|
|
2451
|
+
function Ds(t) {
|
|
2452
|
+
for (const e of xs)
|
|
2453
2453
|
if (t.hasOwnProperty(e))
|
|
2454
2454
|
return !0;
|
|
2455
2455
|
return !1;
|
|
2456
2456
|
}
|
|
2457
2457
|
function qr(t, e, n) {
|
|
2458
|
-
return n ? typeof t == "object" ?
|
|
2458
|
+
return n ? typeof t == "object" ? Ds(t) ? n : null : $s(t)(t, e, n) : null;
|
|
2459
2459
|
}
|
|
2460
2460
|
function Us(t, e, n) {
|
|
2461
2461
|
return t.reduce((r, i, s) => {
|
|
@@ -2485,11 +2485,11 @@ const qs = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a
|
|
|
2485
2485
|
function Ee(t) {
|
|
2486
2486
|
return typeof t == "string" && qs.test(t);
|
|
2487
2487
|
}
|
|
2488
|
-
const
|
|
2488
|
+
const q = [];
|
|
2489
2489
|
for (let t = 0; t < 256; ++t)
|
|
2490
|
-
|
|
2490
|
+
q.push((t + 256).toString(16).slice(1));
|
|
2491
2491
|
function zs(t, e = 0) {
|
|
2492
|
-
return (
|
|
2492
|
+
return (q[t[e + 0]] + q[t[e + 1]] + q[t[e + 2]] + q[t[e + 3]] + "-" + q[t[e + 4]] + q[t[e + 5]] + "-" + q[t[e + 6]] + q[t[e + 7]] + "-" + q[t[e + 8]] + q[t[e + 9]] + "-" + q[t[e + 10]] + q[t[e + 11]] + q[t[e + 12]] + q[t[e + 13]] + q[t[e + 14]] + q[t[e + 15]]).toLowerCase();
|
|
2493
2493
|
}
|
|
2494
2494
|
let kt;
|
|
2495
2495
|
const Vs = new Uint8Array(16);
|
|
@@ -2501,8 +2501,8 @@ function Ws() {
|
|
|
2501
2501
|
}
|
|
2502
2502
|
return kt(Vs);
|
|
2503
2503
|
}
|
|
2504
|
-
const
|
|
2505
|
-
function
|
|
2504
|
+
const Qs = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Vn = { randomUUID: Qs };
|
|
2505
|
+
function Bs(t, e, n) {
|
|
2506
2506
|
var i;
|
|
2507
2507
|
if (Vn.randomUUID && !t)
|
|
2508
2508
|
return Vn.randomUUID();
|
|
@@ -2518,7 +2518,7 @@ function Wn(t) {
|
|
|
2518
2518
|
n.push(parseInt(e.substring(r, r + 2), 16));
|
|
2519
2519
|
return n;
|
|
2520
2520
|
}
|
|
2521
|
-
function
|
|
2521
|
+
function Gs(t, e) {
|
|
2522
2522
|
for (let n = 0; n < t.length; n++) {
|
|
2523
2523
|
if (t[n] < e[n])
|
|
2524
2524
|
return -1;
|
|
@@ -2528,10 +2528,10 @@ function Qs(t, e) {
|
|
|
2528
2528
|
return 0;
|
|
2529
2529
|
}
|
|
2530
2530
|
function Hs(t, e) {
|
|
2531
|
-
return
|
|
2531
|
+
return Gs(Wn(t), Wn(e));
|
|
2532
2532
|
}
|
|
2533
|
-
function
|
|
2534
|
-
return
|
|
2533
|
+
function K() {
|
|
2534
|
+
return Bs();
|
|
2535
2535
|
}
|
|
2536
2536
|
function Ys(t, e) {
|
|
2537
2537
|
return t.localeCompare(e);
|
|
@@ -2547,7 +2547,7 @@ function Js() {
|
|
|
2547
2547
|
}
|
|
2548
2548
|
const Zs = Js();
|
|
2549
2549
|
let Xs = 0;
|
|
2550
|
-
function
|
|
2550
|
+
function Ke(t) {
|
|
2551
2551
|
return yt(`_${t}`, Xs++);
|
|
2552
2552
|
}
|
|
2553
2553
|
function yt(t, e) {
|
|
@@ -2564,7 +2564,7 @@ function eo(t, e) {
|
|
|
2564
2564
|
throw new ke(`Could not find id attr for ${e}`);
|
|
2565
2565
|
return n;
|
|
2566
2566
|
}
|
|
2567
|
-
function
|
|
2567
|
+
function Qn(t, e, n, r) {
|
|
2568
2568
|
return [to(t, e, n, r)];
|
|
2569
2569
|
}
|
|
2570
2570
|
function to(t, e, n, r) {
|
|
@@ -2588,16 +2588,16 @@ function zr(t, e, n, r, i) {
|
|
|
2588
2588
|
t(c, r),
|
|
2589
2589
|
u.id,
|
|
2590
2590
|
t(f, l),
|
|
2591
|
-
|
|
2591
|
+
Ke("time")
|
|
2592
2592
|
] : [
|
|
2593
2593
|
t(c, l),
|
|
2594
2594
|
u.id,
|
|
2595
2595
|
t(f, r),
|
|
2596
|
-
|
|
2596
|
+
Ke("time")
|
|
2597
2597
|
];
|
|
2598
2598
|
return [s ? f : c, l, p, u, !!s];
|
|
2599
2599
|
}
|
|
2600
|
-
function
|
|
2600
|
+
function Bn(t, e) {
|
|
2601
2601
|
if (typeof e != "string")
|
|
2602
2602
|
return function(o) {
|
|
2603
2603
|
return !1;
|
|
@@ -2648,7 +2648,7 @@ function ro(t, e) {
|
|
|
2648
2648
|
}
|
|
2649
2649
|
};
|
|
2650
2650
|
if (e.hasOwnProperty("$like")) {
|
|
2651
|
-
const r =
|
|
2651
|
+
const r = Bn(!0, e.$like);
|
|
2652
2652
|
return {
|
|
2653
2653
|
$comparator: !0,
|
|
2654
2654
|
$op: function(s) {
|
|
@@ -2657,7 +2657,7 @@ function ro(t, e) {
|
|
|
2657
2657
|
};
|
|
2658
2658
|
}
|
|
2659
2659
|
if (e.hasOwnProperty("$ilike")) {
|
|
2660
|
-
const r =
|
|
2660
|
+
const r = Bn(!1, e.$ilike);
|
|
2661
2661
|
return {
|
|
2662
2662
|
$comparator: !0,
|
|
2663
2663
|
$op: function(s) {
|
|
@@ -2679,15 +2679,15 @@ function io(t, e, n, r, i, s) {
|
|
|
2679
2679
|
t(n, r),
|
|
2680
2680
|
c.id,
|
|
2681
2681
|
{ $isNull: { attrId: a.id, isNull: s.$isNull, reverse: !o } },
|
|
2682
|
-
|
|
2682
|
+
Ke("time")
|
|
2683
2683
|
];
|
|
2684
2684
|
}
|
|
2685
2685
|
return o ? [
|
|
2686
2686
|
t(n, r),
|
|
2687
2687
|
a.id,
|
|
2688
2688
|
ro(a, s),
|
|
2689
|
-
|
|
2690
|
-
] : [s, a.id, t(n, r),
|
|
2689
|
+
Ke("time")
|
|
2690
|
+
] : [s, a.id, t(n, r), Ke("time")];
|
|
2691
2691
|
}
|
|
2692
2692
|
function so(t, e, n, r, i) {
|
|
2693
2693
|
const [s, o, u] = i.reduce((a, c) => {
|
|
@@ -2715,7 +2715,7 @@ function co(t, e, n) {
|
|
|
2715
2715
|
return e == s ? s : `${s}-${n}`;
|
|
2716
2716
|
};
|
|
2717
2717
|
}
|
|
2718
|
-
function
|
|
2718
|
+
function Gn(t, e, n, r, i, s) {
|
|
2719
2719
|
const o = t(r, i), u = s.map((a, c) => {
|
|
2720
2720
|
const d = co(t, o, c);
|
|
2721
2721
|
return Vr(d, n, r, i, a);
|
|
@@ -2736,9 +2736,9 @@ function Hn(t, e, n, r, i) {
|
|
|
2736
2736
|
function Vr(t, e, n, r, i) {
|
|
2737
2737
|
return Object.entries(i).flatMap(([s, o]) => {
|
|
2738
2738
|
if (uo([s, o]))
|
|
2739
|
-
return
|
|
2739
|
+
return Gn(t, "or", e, n, r, o);
|
|
2740
2740
|
if (ao([s, o]))
|
|
2741
|
-
return
|
|
2741
|
+
return Gn(t, "and", e, n, r, o);
|
|
2742
2742
|
if (s === "$entityIdStartsWith")
|
|
2743
2743
|
return [];
|
|
2744
2744
|
const u = s.split(".");
|
|
@@ -2765,7 +2765,7 @@ function Vr(t, e, n, r, i) {
|
|
|
2765
2765
|
}
|
|
2766
2766
|
function lo(t, e, n, r) {
|
|
2767
2767
|
const i = yt;
|
|
2768
|
-
return r ? Vr(i, t, e, n, r).concat(
|
|
2768
|
+
return r ? Vr(i, t, e, n, r).concat(Qn(i, t, e, n)) : Qn(i, t, e, n);
|
|
2769
2769
|
}
|
|
2770
2770
|
function ho(t, e, n) {
|
|
2771
2771
|
return [t(e, n), t("time", n)];
|
|
@@ -2778,20 +2778,20 @@ function yo(t, e, n, { etype: r, level: i, form: s }, o) {
|
|
|
2778
2778
|
const u = Object.keys(s).filter((a) => a !== "$");
|
|
2779
2779
|
return u.length ? Object.entries(o).map(function([c, d]) {
|
|
2780
2780
|
return u.map(function(p) {
|
|
2781
|
-
var y, b,
|
|
2782
|
-
const w = !!(e.cardinalityInference && (!((
|
|
2781
|
+
var y, b, g;
|
|
2782
|
+
const w = !!(e.cardinalityInference && (!((g = (b = (y = n.linkIndex) === null || y === void 0 ? void 0 : y[r]) === null || b === void 0 ? void 0 : b[p]) === null || g === void 0) && g.isSingular));
|
|
2783
2783
|
try {
|
|
2784
|
-
const [
|
|
2785
|
-
etype:
|
|
2784
|
+
const [_, v, A] = po(t, n, r, i, p, c), S = Qr(e, n, {
|
|
2785
|
+
etype: _,
|
|
2786
2786
|
level: v,
|
|
2787
2787
|
form: s[p],
|
|
2788
2788
|
join: A
|
|
2789
2789
|
}), C = w ? S[0] : S;
|
|
2790
2790
|
return { [p]: C };
|
|
2791
|
-
} catch (
|
|
2792
|
-
if (
|
|
2791
|
+
} catch (_) {
|
|
2792
|
+
if (_ instanceof ke)
|
|
2793
2793
|
return { [p]: w ? void 0 : [] };
|
|
2794
|
-
throw
|
|
2794
|
+
throw _;
|
|
2795
2795
|
}
|
|
2796
2796
|
}).reduce(function(p, y) {
|
|
2797
2797
|
return Object.assign(Object.assign({}, p), y);
|
|
@@ -2801,11 +2801,11 @@ function yo(t, e, n, { etype: r, level: i, form: s }, o) {
|
|
|
2801
2801
|
function bo(t, e, n) {
|
|
2802
2802
|
return n === "string" ? Zs(t, e) : t > e ? 1 : -1;
|
|
2803
2803
|
}
|
|
2804
|
-
function
|
|
2804
|
+
function Fe(t, e, n, r, i) {
|
|
2805
2805
|
return e === r || e == null && r == null ? Hs(t, n) : r == null ? 1 : e == null ? -1 : bo(e, r, i);
|
|
2806
2806
|
}
|
|
2807
2807
|
function lt([t, e], [n, r], i) {
|
|
2808
|
-
return
|
|
2808
|
+
return Fe(t, e, n, r, i);
|
|
2809
2809
|
}
|
|
2810
2810
|
function zt(t) {
|
|
2811
2811
|
return t == null ? t : new Date(t).getTime();
|
|
@@ -2853,26 +2853,26 @@ function vo(t, e, { etype: n, pageInfo: r, dq: i, form: 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") {
|
|
2856
|
-
const
|
|
2857
|
-
f = f.map(([
|
|
2858
|
-
var v, A, S, C,
|
|
2859
|
-
let R = (
|
|
2860
|
-
return
|
|
2856
|
+
const g = p["checked-data-type"] === "date", w = p.id;
|
|
2857
|
+
f = f.map(([_]) => {
|
|
2858
|
+
var v, A, S, C, x;
|
|
2859
|
+
let R = (x = (C = (S = (A = (v = t.eav.get(_)) === null || v === void 0 ? void 0 : v.get(w)) === null || A === void 0 ? void 0 : A.values()) === null || S === void 0 ? void 0 : S.next()) === null || C === void 0 ? void 0 : C.value) === null || x === void 0 ? void 0 : x[2];
|
|
2860
|
+
return g && (R = zt(R)), [_, R];
|
|
2861
2861
|
});
|
|
2862
2862
|
}
|
|
2863
|
-
f.sort(d === "asc" ? function(w,
|
|
2864
|
-
return lt(w,
|
|
2865
|
-
} : function(w,
|
|
2866
|
-
return lt(
|
|
2863
|
+
f.sort(d === "asc" ? function(w, _) {
|
|
2864
|
+
return lt(w, _, p == null ? void 0 : p["checked-data-type"]);
|
|
2865
|
+
} : function(w, _) {
|
|
2866
|
+
return lt(_, w, p == null ? void 0 : p["checked-data-type"]);
|
|
2867
2867
|
});
|
|
2868
2868
|
let y = {};
|
|
2869
2869
|
const b = mo(e, n, i);
|
|
2870
|
-
for (const
|
|
2871
|
-
const [w] =
|
|
2872
|
-
if (y[w] || !c && l && p && _o(l, p, d,
|
|
2870
|
+
for (const g of f) {
|
|
2871
|
+
const [w] = g;
|
|
2872
|
+
if (y[w] || !c && l && p && _o(l, p, d, g))
|
|
2873
2873
|
continue;
|
|
2874
|
-
const
|
|
2875
|
-
|
|
2874
|
+
const _ = js(t, b, w);
|
|
2875
|
+
_ && (y[w] = _);
|
|
2876
2876
|
}
|
|
2877
2877
|
return y;
|
|
2878
2878
|
}
|
|
@@ -2895,11 +2895,11 @@ 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
|
-
}),
|
|
2899
|
-
if (
|
|
2898
|
+
}), g = ((c = i.$) === null || c === void 0 ? void 0 : c.limit) || ((d = i.$) === null || d === void 0 ? void 0 : d.first) || ((f = i.$) === null || f === void 0 ? void 0 : f.last);
|
|
2899
|
+
if (g != 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);
|
|
2902
|
-
return w.length <=
|
|
2902
|
+
return w.length <= g ? b : Object.fromEntries(w.slice(0, g));
|
|
2903
2903
|
}
|
|
2904
2904
|
return b;
|
|
2905
2905
|
}
|
|
@@ -2912,7 +2912,7 @@ function Ao(t, e, n) {
|
|
|
2912
2912
|
throw r;
|
|
2913
2913
|
}
|
|
2914
2914
|
}
|
|
2915
|
-
function
|
|
2915
|
+
function Qr(t, e, n) {
|
|
2916
2916
|
const r = Ao(t, e, n);
|
|
2917
2917
|
return yo(yt, t, e, n, r);
|
|
2918
2918
|
}
|
|
@@ -2927,9 +2927,9 @@ function Eo(t) {
|
|
|
2927
2927
|
};
|
|
2928
2928
|
return e;
|
|
2929
2929
|
}
|
|
2930
|
-
function
|
|
2930
|
+
function Br({ store: t, attrsStore: e, pageInfo: n, aggregate: r }, i) {
|
|
2931
2931
|
const o = { data: Object.keys(i).reduce(function(a, c) {
|
|
2932
|
-
return r != null && r[c] || c === "$$ruleParams" || (a[c] =
|
|
2932
|
+
return r != null && r[c] || c === "$$ruleParams" || (a[c] = Qr(t, e, {
|
|
2933
2933
|
etype: c,
|
|
2934
2934
|
form: i[c],
|
|
2935
2935
|
level: 0,
|
|
@@ -2975,7 +2975,7 @@ function Vt(t, e, n) {
|
|
|
2975
2975
|
function ht(t) {
|
|
2976
2976
|
return t.startsWith("lookup__");
|
|
2977
2977
|
}
|
|
2978
|
-
function
|
|
2978
|
+
function Gr(t) {
|
|
2979
2979
|
const [e, n, ...r] = t.split("__");
|
|
2980
2980
|
return [n, JSON.parse(r.join("__"))];
|
|
2981
2981
|
}
|
|
@@ -2987,7 +2987,7 @@ function Co(t) {
|
|
|
2987
2987
|
if (n === "__etype")
|
|
2988
2988
|
return t;
|
|
2989
2989
|
const r = n;
|
|
2990
|
-
return ht(r) ? Vt(t,
|
|
2990
|
+
return ht(r) ? Vt(t, Gr(r), []) : Vt(t, r, []);
|
|
2991
2991
|
}
|
|
2992
2992
|
});
|
|
2993
2993
|
}
|
|
@@ -3048,11 +3048,11 @@ function $o(t, e, n) {
|
|
|
3048
3048
|
throw new Error(`${n} does not reference a valid link attribute.`);
|
|
3049
3049
|
return i;
|
|
3050
3050
|
}
|
|
3051
|
-
function
|
|
3052
|
-
return typeof t == "string" && !ht(t) ? null : typeof t == "string" && ht(t) ?
|
|
3051
|
+
function Qt(t) {
|
|
3052
|
+
return typeof t == "string" && !ht(t) ? null : typeof t == "string" && ht(t) ? Gr(t) : Mo(t);
|
|
3053
3053
|
}
|
|
3054
|
-
function
|
|
3055
|
-
const r =
|
|
3054
|
+
function G(t, e, n) {
|
|
3055
|
+
const r = Qt(n);
|
|
3056
3056
|
if (r === null)
|
|
3057
3057
|
return n;
|
|
3058
3058
|
const [i, s] = r, o = $o(t, e, i);
|
|
@@ -3062,7 +3062,7 @@ function Q(t, e, n) {
|
|
|
3062
3062
|
}
|
|
3063
3063
|
function Hr(t, e, n, r) {
|
|
3064
3064
|
var i;
|
|
3065
|
-
const s =
|
|
3065
|
+
const s = G(t, e, n);
|
|
3066
3066
|
return Array.isArray(s) ? [[
|
|
3067
3067
|
"add-triple",
|
|
3068
3068
|
s,
|
|
@@ -3070,44 +3070,44 @@ function Hr(t, e, n, r) {
|
|
|
3070
3070
|
s
|
|
3071
3071
|
]].concat(r) : r;
|
|
3072
3072
|
}
|
|
3073
|
-
function
|
|
3073
|
+
function xo({ attrsStore: t }, [e, n, r]) {
|
|
3074
3074
|
const i = Object.entries(r).flatMap(([s, o]) => {
|
|
3075
3075
|
const u = Array.isArray(o) ? o : [o], a = F(t, e, s), c = me(t, e, s);
|
|
3076
3076
|
return u.map((d) => a ? [
|
|
3077
3077
|
"add-triple",
|
|
3078
|
-
|
|
3078
|
+
G(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
|
-
|
|
3082
|
+
G(t, a["reverse-identity"][1], d)
|
|
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
|
-
|
|
3087
|
+
G(t, c["forward-identity"][1], d),
|
|
3088
3088
|
c == null ? void 0 : c.id,
|
|
3089
|
-
|
|
3089
|
+
G(t, e, n)
|
|
3090
3090
|
]);
|
|
3091
3091
|
});
|
|
3092
3092
|
return Hr(t, e, n, i);
|
|
3093
3093
|
}
|
|
3094
|
-
function
|
|
3094
|
+
function Do({ attrsStore: t }, [e, n, r]) {
|
|
3095
3095
|
const i = Object.entries(r).flatMap(([s, o]) => {
|
|
3096
3096
|
const u = Array.isArray(o) ? o : [o], a = F(t, e, s), c = me(t, e, s);
|
|
3097
3097
|
return u.map((d) => a ? [
|
|
3098
3098
|
"retract-triple",
|
|
3099
|
-
|
|
3099
|
+
G(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
|
-
|
|
3103
|
+
G(t, a["reverse-identity"][1], d)
|
|
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
|
-
|
|
3108
|
+
G(t, c["forward-identity"][1], d),
|
|
3109
3109
|
c.id,
|
|
3110
|
-
|
|
3110
|
+
G(t, e, n)
|
|
3111
3111
|
]);
|
|
3112
3112
|
});
|
|
3113
3113
|
return Hr(t, e, n, i);
|
|
@@ -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 [c, d, f] of
|
|
3122
|
+
for (const [c, d, f] of B(a, 2))
|
|
3123
3123
|
if (f === o)
|
|
3124
3124
|
return !0;
|
|
3125
3125
|
}
|
|
@@ -3139,14 +3139,14 @@ function Yr({ stores: t, attrsStore: e }, [n, r, i, s]) {
|
|
|
3139
3139
|
return (s == null ? void 0 : s.upsert) === !1 ? { mode: "update" } : (s == null ? void 0 : s.upsert) === !0 ? null : Uo(t, e, n, r) ? { mode: "update" } : null;
|
|
3140
3140
|
}
|
|
3141
3141
|
function Lo(t, e) {
|
|
3142
|
-
const { attrsStore: n } = t, [r, i, s, o] = e, u = sn(s), a =
|
|
3142
|
+
const { attrsStore: n } = t, [r, i, s, o] = e, u = sn(s), a = G(n, r, i);
|
|
3143
3143
|
return [["id", a]].concat(Object.entries(u)).map(([d, f]) => {
|
|
3144
3144
|
const l = F(n, r, d);
|
|
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 =
|
|
3149
|
+
const { attrsStore: n } = t, [r, i, s, o] = e, u = sn(s), a = G(n, r, i), c = 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)), [
|
|
@@ -3159,10 +3159,10 @@ function Fo(t, e) {
|
|
|
3159
3159
|
});
|
|
3160
3160
|
}
|
|
3161
3161
|
function No({ attrsStore: t }, [e, n]) {
|
|
3162
|
-
return [["delete-entity",
|
|
3162
|
+
return [["delete-entity", G(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 =
|
|
3165
|
+
const { attrsStore: n } = t, [r, i, s, o] = e, u = sn(s), a = G(n, r, i), c = Yr(t, [r, a, s, o]), d = Object.entries(u).map(([l, p]) => {
|
|
3166
3166
|
const y = F(n, r, l);
|
|
3167
3167
|
return [
|
|
3168
3168
|
"deep-merge-triple",
|
|
@@ -3181,7 +3181,7 @@ function Ko(t, e) {
|
|
|
3181
3181
|
]].concat(d);
|
|
3182
3182
|
}
|
|
3183
3183
|
function qo({ attrsStore: t }, [e, n, r]) {
|
|
3184
|
-
return [["rule-params",
|
|
3184
|
+
return [["rule-params", G(t, e, n), e, r]];
|
|
3185
3185
|
}
|
|
3186
3186
|
function zo(t) {
|
|
3187
3187
|
const [e, n, r, i, s] = t;
|
|
@@ -3200,9 +3200,9 @@ function Vo(t, e) {
|
|
|
3200
3200
|
case "update":
|
|
3201
3201
|
return Fo(t, r);
|
|
3202
3202
|
case "link":
|
|
3203
|
-
return Do(t, r);
|
|
3204
|
-
case "unlink":
|
|
3205
3203
|
return xo(t, r);
|
|
3204
|
+
case "unlink":
|
|
3205
|
+
return Do(t, r);
|
|
3206
3206
|
case "delete":
|
|
3207
3207
|
return No(t, r);
|
|
3208
3208
|
case "ruleParams":
|
|
@@ -3222,7 +3222,7 @@ function Wo(t) {
|
|
|
3222
3222
|
return;
|
|
3223
3223
|
}
|
|
3224
3224
|
}
|
|
3225
|
-
function
|
|
3225
|
+
function Qo(t, e, n) {
|
|
3226
3226
|
var r, i;
|
|
3227
3227
|
const s = (i = (r = t.entities[e]) === null || r === void 0 ? void 0 : r.attrs) === null || i === void 0 ? void 0 : i[n];
|
|
3228
3228
|
if (n === "id")
|
|
@@ -3236,21 +3236,21 @@ function Bo(t, e, n) {
|
|
|
3236
3236
|
"checked-data-type": a
|
|
3237
3237
|
};
|
|
3238
3238
|
}
|
|
3239
|
-
function
|
|
3240
|
-
const i = t ?
|
|
3239
|
+
function rt(t, e, n, r) {
|
|
3240
|
+
const i = t ? Qo(t, e, n) : null, s = K(), u = [K(), e, n];
|
|
3241
3241
|
return Object.assign(Object.assign({ id: s, "forward-identity": u, "value-type": "blob", cardinality: "one", "unique?": !1, "index?": !1, isUnsynced: !0 }, i || {}), r || {});
|
|
3242
3242
|
}
|
|
3243
|
-
function
|
|
3243
|
+
function Bo(t, e, n) {
|
|
3244
3244
|
return Object.values(t.links).find((s) => s.forward.on === e && s.forward.label === n || s.reverse.on === e && s.reverse.label === n);
|
|
3245
3245
|
}
|
|
3246
|
-
function
|
|
3247
|
-
const r =
|
|
3246
|
+
function Go(t, e, n) {
|
|
3247
|
+
const r = Bo(t, e, n);
|
|
3248
3248
|
if (!r)
|
|
3249
3249
|
throw new Error(`Couldn't find the link ${e}.${n} in your schema`);
|
|
3250
3250
|
const { forward: i, reverse: s } = r;
|
|
3251
3251
|
return {
|
|
3252
|
-
"forward-identity": [
|
|
3253
|
-
"reverse-identity": [
|
|
3252
|
+
"forward-identity": [K(), i.on, i.label],
|
|
3253
|
+
"reverse-identity": [K(), s.on, s.label],
|
|
3254
3254
|
cardinality: i.has === "one" ? "one" : "many",
|
|
3255
3255
|
"unique?": s.has === "one",
|
|
3256
3256
|
"on-delete": i.onDelete,
|
|
@@ -3258,7 +3258,7 @@ function Qo(t, e, n) {
|
|
|
3258
3258
|
};
|
|
3259
3259
|
}
|
|
3260
3260
|
function Yn(t, e, n, r) {
|
|
3261
|
-
const i = t ?
|
|
3261
|
+
const i = t ? Go(t, e, n) : null, s = K(), o = [K(), e, n], u = [K(), n, e];
|
|
3262
3262
|
return Object.assign(Object.assign({
|
|
3263
3263
|
id: s,
|
|
3264
3264
|
// @ts-ignore: ts thinks it's any[]
|
|
@@ -3281,17 +3281,17 @@ const Ho = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink
|
|
|
3281
3281
|
"merge",
|
|
3282
3282
|
"delete",
|
|
3283
3283
|
"ruleParams"
|
|
3284
|
-
]),
|
|
3284
|
+
]), Bt = { "unique?": !0, "index?": !0 }, Xo = Object.assign(Object.assign({}, Bt), { cardinality: "one" });
|
|
3285
3285
|
function eu(t) {
|
|
3286
3286
|
const e = [], [n, r, i, s] = t;
|
|
3287
3287
|
if (!Zo.has(n))
|
|
3288
3288
|
return e;
|
|
3289
|
-
const o =
|
|
3289
|
+
const o = Qt(i);
|
|
3290
3290
|
if (o && e.push({ etype: r, lookupPair: o }), n === "link")
|
|
3291
3291
|
for (const [u, a] of Object.entries(s)) {
|
|
3292
3292
|
const c = Array.isArray(a) ? a : [a];
|
|
3293
3293
|
for (const d of c) {
|
|
3294
|
-
const f =
|
|
3294
|
+
const f = Qt(d);
|
|
3295
3295
|
f && e.push({
|
|
3296
3296
|
etype: r,
|
|
3297
3297
|
lookupPair: f,
|
|
@@ -3305,12 +3305,12 @@ function tu({ attrsStore: t, schema: e }, n) {
|
|
|
3305
3305
|
var r, i;
|
|
3306
3306
|
const s = /* @__PURE__ */ new Set(), o = [], u = [];
|
|
3307
3307
|
function a(y, b) {
|
|
3308
|
-
return F(t, y, b) || o.find((
|
|
3308
|
+
return F(t, y, b) || o.find((g) => g["forward-identity"][1] === y && g["forward-identity"][2] === b);
|
|
3309
3309
|
}
|
|
3310
3310
|
function c(y, b) {
|
|
3311
|
-
return me(t, y, b) || o.find((
|
|
3312
|
-
var w,
|
|
3313
|
-
return ((w =
|
|
3311
|
+
return me(t, y, b) || o.find((g) => {
|
|
3312
|
+
var w, _;
|
|
3313
|
+
return ((w = g["reverse-identity"]) === null || w === void 0 ? void 0 : w[1]) === y && ((_ = g["reverse-identity"]) === null || _ === void 0 ? void 0 : _[2]) === b;
|
|
3314
3314
|
});
|
|
3315
3315
|
}
|
|
3316
3316
|
function d(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
|
|
3329
|
-
f(
|
|
3328
|
+
const g = a(y, b), w = c(y, b);
|
|
3329
|
+
f(g), f(w), !g && !w && d(Yn(e, y, b, Xo));
|
|
3330
3330
|
}
|
|
3331
3331
|
for (const y of n)
|
|
3332
|
-
for (const { etype: b, lookupPair:
|
|
3333
|
-
const
|
|
3332
|
+
for (const { etype: b, lookupPair: g, linkLabel: w } of eu(y)) {
|
|
3333
|
+
const _ = g[0];
|
|
3334
3334
|
if (w) {
|
|
3335
3335
|
p(b, w);
|
|
3336
3336
|
const v = a(b, w), A = c(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
|
-
if (l(S,
|
|
3340
|
-
p(S, Wt(
|
|
3339
|
+
if (l(S, _))
|
|
3340
|
+
p(S, Wt(_));
|
|
3341
3341
|
else {
|
|
3342
|
-
const C = a(S,
|
|
3343
|
-
C || d(
|
|
3342
|
+
const C = a(S, _);
|
|
3343
|
+
C || d(rt(e, S, _, Bt)), f(C);
|
|
3344
3344
|
}
|
|
3345
|
-
} else if (l(b,
|
|
3346
|
-
p(b, Wt(
|
|
3345
|
+
} else if (l(b, _))
|
|
3346
|
+
p(b, Wt(_));
|
|
3347
3347
|
else {
|
|
3348
|
-
const v = a(b,
|
|
3349
|
-
v || d(
|
|
3348
|
+
const v = a(b, _);
|
|
3349
|
+
v || d(rt(e, b, _, Bt)), f(v);
|
|
3350
3350
|
}
|
|
3351
3351
|
}
|
|
3352
3352
|
for (const y of n) {
|
|
3353
|
-
const [b,
|
|
3353
|
+
const [b, g, w, _] = y;
|
|
3354
3354
|
if (Ho.has(b)) {
|
|
3355
|
-
const v = a(
|
|
3356
|
-
f(v), v || d(
|
|
3357
|
-
for (const A of Object.keys(
|
|
3358
|
-
const S = a(
|
|
3359
|
-
if (f(S), Jo.has(b) && (S || d(
|
|
3360
|
-
const C = c(
|
|
3361
|
-
!S && !C && d(Yn(e,
|
|
3355
|
+
const v = a(g, "id");
|
|
3356
|
+
f(v), v || d(rt(e, g, "id", { "unique?": !0 }));
|
|
3357
|
+
for (const A of Object.keys(_)) {
|
|
3358
|
+
const S = a(g, A);
|
|
3359
|
+
if (f(S), Jo.has(b) && (S || d(rt(e, g, A, A === "id" ? { "unique?": !0 } : null))), Yo.has(b)) {
|
|
3360
|
+
const C = c(g, A);
|
|
3361
|
+
!S && !C && d(Yn(e, g, A)), f(C);
|
|
3362
3362
|
}
|
|
3363
3363
|
}
|
|
3364
3364
|
}
|
|
@@ -3405,12 +3405,12 @@ var re = function(t, e, n, r) {
|
|
|
3405
3405
|
function Jn(t, e) {
|
|
3406
3406
|
typeof requestIdleCallback > "u" ? t() : requestIdleCallback(t, { timeout: e });
|
|
3407
3407
|
}
|
|
3408
|
-
const
|
|
3408
|
+
const qe = "__meta";
|
|
3409
3409
|
class ru {
|
|
3410
3410
|
constructor(e, n) {
|
|
3411
3411
|
}
|
|
3412
3412
|
}
|
|
3413
|
-
class
|
|
3413
|
+
class Gt {
|
|
3414
3414
|
constructor(e) {
|
|
3415
3415
|
var n, r;
|
|
3416
3416
|
this._subs = [], this._nextSave = null, this._nextGc = null, this._pendingSaveKeys = /* @__PURE__ */ new Set(), this._loadedKeys = /* @__PURE__ */ new Set(), this._version = 0, this._meta = {
|
|
@@ -3426,7 +3426,7 @@ class Qt {
|
|
|
3426
3426
|
var e, n, r;
|
|
3427
3427
|
this._meta.loadingPromise && (yield this._meta.loadingPromise);
|
|
3428
3428
|
try {
|
|
3429
|
-
const i = this._persister.getItem(
|
|
3429
|
+
const i = this._persister.getItem(qe);
|
|
3430
3430
|
this._meta.loadingPromise = i;
|
|
3431
3431
|
const s = yield i;
|
|
3432
3432
|
this._meta.isLoading = !1, this._meta.error = null, this._meta.loadingPromise = null, this._meta.attempts = 0;
|
|
@@ -3507,10 +3507,10 @@ class Qt {
|
|
|
3507
3507
|
const i = [], s = e == null ? void 0 : e.skipGc;
|
|
3508
3508
|
if (this._meta.isLoading) {
|
|
3509
3509
|
const p = new Promise((y, b) => {
|
|
3510
|
-
var
|
|
3511
|
-
setTimeout(() => this._enqueuePersist(e ? Object.assign(Object.assign({}, e), { attempts: (e.attempts || 0) + 1 }) : { attempts: 1 }).then(y).catch(b), 10 + ((
|
|
3510
|
+
var g;
|
|
3511
|
+
setTimeout(() => this._enqueuePersist(e ? Object.assign(Object.assign({}, e), { attempts: (e.attempts || 0) + 1 }) : { attempts: 1 }).then(y).catch(b), 10 + ((g = e == null ? void 0 : e.attempts) !== null && g !== void 0 ? g : 0) * 1e3);
|
|
3512
3512
|
});
|
|
3513
|
-
return i.push(p), Promise.all(i).then((y) => y.reduce((b,
|
|
3513
|
+
return i.push(p), Promise.all(i).then((y) => y.reduce((b, g) => b + g, 0));
|
|
3514
3514
|
}
|
|
3515
3515
|
const o = this._meta.value;
|
|
3516
3516
|
if (!o)
|
|
@@ -3522,18 +3522,18 @@ 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 c = [], d = [[
|
|
3525
|
+
const c = [], d = [[qe, 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
|
d.push([p, y]);
|
|
3531
|
-
const b = this._objectSize(y),
|
|
3531
|
+
const b = this._objectSize(y), g = (r = f[p]) !== null && r !== void 0 ? r : {
|
|
3532
3532
|
createdAt: Date.now(),
|
|
3533
3533
|
updatedAt: Date.now(),
|
|
3534
3534
|
size: b
|
|
3535
3535
|
};
|
|
3536
|
-
|
|
3536
|
+
g.updatedAt = Date.now(), g.size = b, f[p] = g, this._pendingSaveKeys.delete(p);
|
|
3537
3537
|
} else
|
|
3538
3538
|
c.push(p);
|
|
3539
3539
|
const l = this._persister.multiSet(d);
|
|
@@ -3554,7 +3554,7 @@ class Qt {
|
|
|
3554
3554
|
if (!this._gcOpts)
|
|
3555
3555
|
return;
|
|
3556
3556
|
const e = new Set(yield this._persister.getAllKeys());
|
|
3557
|
-
e.delete(
|
|
3557
|
+
e.delete(qe);
|
|
3558
3558
|
const n = new Set(Object.keys(this.currentValue));
|
|
3559
3559
|
for (const l of Object.keys(this._loadingKeys))
|
|
3560
3560
|
n.add(l);
|
|
@@ -3713,19 +3713,19 @@ function au(t, e, n) {
|
|
|
3713
3713
|
var u, a, c, d;
|
|
3714
3714
|
const f = {};
|
|
3715
3715
|
for (const [y, b] of Object.entries(r)) {
|
|
3716
|
-
const
|
|
3717
|
-
if (
|
|
3718
|
-
const
|
|
3719
|
-
createdAt:
|
|
3720
|
-
updatedAt:
|
|
3721
|
-
size: (d = (c = (a = (u =
|
|
3716
|
+
const g = typeof b == "string" ? JSON.parse(b) : b;
|
|
3717
|
+
if (g.lastAccessed) {
|
|
3718
|
+
const _ = {
|
|
3719
|
+
createdAt: g.lastAccessed,
|
|
3720
|
+
updatedAt: g.lastAccessed,
|
|
3721
|
+
size: (d = (c = (a = (u = g.result) === null || u === void 0 ? void 0 : u.store) === null || a === void 0 ? void 0 : a.triples) === null || c === void 0 ? void 0 : c.length) !== null && d !== void 0 ? d : 0
|
|
3722
3722
|
};
|
|
3723
|
-
f[y] =
|
|
3723
|
+
f[y] = _;
|
|
3724
3724
|
}
|
|
3725
|
-
const w = n.put(
|
|
3725
|
+
const w = n.put(g, y);
|
|
3726
3726
|
i.add(w);
|
|
3727
3727
|
}
|
|
3728
|
-
const l = { objects: f }, p = n.put(l,
|
|
3728
|
+
const l = { objects: f }, p = n.put(l, qe);
|
|
3729
3729
|
i.add(p);
|
|
3730
3730
|
for (const y of i)
|
|
3731
3731
|
y.onsuccess = () => {
|
|
@@ -3751,19 +3751,19 @@ function cu(t, e) {
|
|
|
3751
3751
|
return;
|
|
3752
3752
|
const r = yield new Promise((d, f) => {
|
|
3753
3753
|
const y = n.transaction(["kv"], "readonly").objectStore("kv").openCursor();
|
|
3754
|
-
y.onerror = (
|
|
3755
|
-
f(
|
|
3754
|
+
y.onerror = (g) => {
|
|
3755
|
+
f(g);
|
|
3756
3756
|
};
|
|
3757
3757
|
const b = [];
|
|
3758
3758
|
y.onsuccess = () => {
|
|
3759
|
-
const
|
|
3760
|
-
if (
|
|
3761
|
-
const w =
|
|
3762
|
-
b.push([w,
|
|
3759
|
+
const g = y.result;
|
|
3760
|
+
if (g) {
|
|
3761
|
+
const w = g.key, _ = g.value;
|
|
3762
|
+
b.push([w, _]), g.continue();
|
|
3763
3763
|
} else
|
|
3764
3764
|
d(b);
|
|
3765
|
-
}, y.onerror = (
|
|
3766
|
-
f(
|
|
3765
|
+
}, y.onerror = (g) => {
|
|
3766
|
+
f(g);
|
|
3767
3767
|
};
|
|
3768
3768
|
}), i = e.transaction(["kv", "querySubs"], "readwrite"), s = i.objectStore("kv"), o = i.objectStore("querySubs"), u = [], a = { objects: {} };
|
|
3769
3769
|
for (const [d, f] of r)
|
|
@@ -3785,7 +3785,7 @@ function cu(t, e) {
|
|
|
3785
3785
|
break;
|
|
3786
3786
|
}
|
|
3787
3787
|
}
|
|
3788
|
-
const c = Zn(
|
|
3788
|
+
const c = Zn(qe, a, s);
|
|
3789
3789
|
u.push(c), yield Promise.all(u), yield new Promise((d, f) => {
|
|
3790
3790
|
i.oncomplete = (l) => d(l), i.onerror = (l) => f(l), i.onabort = (l) => f(l);
|
|
3791
3791
|
});
|
|
@@ -4276,7 +4276,7 @@ function ir(t) {
|
|
|
4276
4276
|
}, e;
|
|
4277
4277
|
}, {});
|
|
4278
4278
|
}
|
|
4279
|
-
const ni = "v0.22.
|
|
4279
|
+
const ni = "v0.22.90-experimental.drewh-ssr.20286580593.1";
|
|
4280
4280
|
function Au(t, e) {
|
|
4281
4281
|
return {
|
|
4282
4282
|
info: t ? (...n) => console.info(...n, e()) : () => {
|
|
@@ -4652,7 +4652,7 @@ class fr {
|
|
|
4652
4652
|
return this.conn.send(JSON.stringify(e));
|
|
4653
4653
|
}
|
|
4654
4654
|
}
|
|
4655
|
-
class
|
|
4655
|
+
class xu {
|
|
4656
4656
|
constructor(e, n) {
|
|
4657
4657
|
this.type = "sse", this.initParams = null, this.sendQueue = [], this.closeFired = !1, this.sseInitTimeout = void 0, this.id = `${this.type}_${ai++}`, this.url = n, this.ES = e, this.conn = new e(n), this.sseInitTimeout = setTimeout(() => {
|
|
4658
4658
|
this.initParams || this.handleError();
|
|
@@ -4765,10 +4765,10 @@ var lr = function(t, e, n, r) {
|
|
|
4765
4765
|
c((r = r.apply(t, e || [])).next());
|
|
4766
4766
|
});
|
|
4767
4767
|
};
|
|
4768
|
-
function
|
|
4768
|
+
function Du(t, e) {
|
|
4769
4769
|
const n = t.values;
|
|
4770
4770
|
if (n) {
|
|
4771
|
-
const r =
|
|
4771
|
+
const r = xr(n.attrsStore, null);
|
|
4772
4772
|
if (r) {
|
|
4773
4773
|
for (const i of n.entities || [])
|
|
4774
4774
|
i.store.useDateObjects = e, i.store = $r(r, i.store);
|
|
@@ -4795,7 +4795,7 @@ function Lu(t, e, n) {
|
|
|
4795
4795
|
return s && (!o || s > o) ? e : o && (!s || o > s) ? n : e || n;
|
|
4796
4796
|
}
|
|
4797
4797
|
function Ct(t, e, n) {
|
|
4798
|
-
return
|
|
4798
|
+
return Br({ store: e, attrsStore: n, pageInfo: null, aggregate: null }, t.query).data[t.table][0];
|
|
4799
4799
|
}
|
|
4800
4800
|
function hr(t, e, n, r) {
|
|
4801
4801
|
var i;
|
|
@@ -4812,7 +4812,7 @@ function pr(t, e, n) {
|
|
|
4812
4812
|
Lr(t, e, i);
|
|
4813
4813
|
break;
|
|
4814
4814
|
case "removed":
|
|
4815
|
-
|
|
4815
|
+
Dr(t, e, i);
|
|
4816
4816
|
break;
|
|
4817
4817
|
}
|
|
4818
4818
|
}
|
|
@@ -4841,7 +4841,7 @@ function Fu(t, e, n) {
|
|
|
4841
4841
|
}
|
|
4842
4842
|
return u;
|
|
4843
4843
|
}
|
|
4844
|
-
function
|
|
4844
|
+
function it(t, e) {
|
|
4845
4845
|
return { [t.table]: e.map((n) => n.entity) };
|
|
4846
4846
|
}
|
|
4847
4847
|
function Nu(t, e) {
|
|
@@ -4855,17 +4855,17 @@ function Ku(t, e, n) {
|
|
|
4855
4855
|
const r = e;
|
|
4856
4856
|
if (t.orderField === "serverCreatedAt") {
|
|
4857
4857
|
n.sort(t.orderDirection === "asc" ? function(o, u) {
|
|
4858
|
-
return
|
|
4858
|
+
return Fe(o.entity.id, o.serverCreatedAt, u.entity.id, u.serverCreatedAt, r);
|
|
4859
4859
|
} : function(o, u) {
|
|
4860
|
-
return
|
|
4860
|
+
return Fe(u.entity.id, u.serverCreatedAt, o.entity.id, o.serverCreatedAt, r);
|
|
4861
4861
|
});
|
|
4862
4862
|
return;
|
|
4863
4863
|
}
|
|
4864
4864
|
const i = t.orderField;
|
|
4865
4865
|
n.sort(t.orderDirection === "asc" ? function(o, u) {
|
|
4866
|
-
return
|
|
4866
|
+
return Fe(o.entity.id, o.entity[i], u.entity.id, u.entity[i], r);
|
|
4867
4867
|
} : function(o, u) {
|
|
4868
|
-
return
|
|
4868
|
+
return Fe(u.entity.id, u.entity[i], o.entity.id, o.entity[i], r);
|
|
4869
4869
|
});
|
|
4870
4870
|
}
|
|
4871
4871
|
var pe;
|
|
@@ -4874,11 +4874,11 @@ var pe;
|
|
|
4874
4874
|
})(pe || (pe = {}));
|
|
4875
4875
|
class qu {
|
|
4876
4876
|
constructor(e, n, r, i, s, o) {
|
|
4877
|
-
this.callbacks = {}, this.idToHash = {}, this.trySend = e, this.config = r, this.log = i, this.createStore = s, this.getAttrs = o, this.subs = new
|
|
4877
|
+
this.callbacks = {}, this.idToHash = {}, this.trySend = e, this.config = r, this.log = i, this.createStore = s, this.getAttrs = o, this.subs = new Gt({
|
|
4878
4878
|
persister: n,
|
|
4879
4879
|
merge: Lu,
|
|
4880
4880
|
serialize: Uu,
|
|
4881
|
-
parse: (u, a) =>
|
|
4881
|
+
parse: (u, a) => Du(a, this.config.useDateObjects),
|
|
4882
4882
|
objectSize: (u) => {
|
|
4883
4883
|
var a;
|
|
4884
4884
|
return ((a = u.values) === null || a === void 0 ? void 0 : a.entities.length) || 0;
|
|
@@ -4898,7 +4898,7 @@ class qu {
|
|
|
4898
4898
|
this.subs.flush();
|
|
4899
4899
|
}
|
|
4900
4900
|
subscribe(e, n) {
|
|
4901
|
-
const r =
|
|
4901
|
+
const r = N(e);
|
|
4902
4902
|
return this.callbacks[r] = this.callbacks[r] || [], this.callbacks[r].push(n), this.initSubscription(e, r, n), (i) => {
|
|
4903
4903
|
this.unsubscribe(r, n, i == null ? void 0 : i.keepSubscription);
|
|
4904
4904
|
};
|
|
@@ -4914,7 +4914,7 @@ class qu {
|
|
|
4914
4914
|
}
|
|
4915
4915
|
}
|
|
4916
4916
|
sendStart(e) {
|
|
4917
|
-
this.trySend(
|
|
4917
|
+
this.trySend(K(), {
|
|
4918
4918
|
op: "start-sync",
|
|
4919
4919
|
q: e
|
|
4920
4920
|
});
|
|
@@ -4928,7 +4928,7 @@ class qu {
|
|
|
4928
4928
|
});
|
|
4929
4929
|
}
|
|
4930
4930
|
sendRemove(e, n) {
|
|
4931
|
-
this.trySend(
|
|
4931
|
+
this.trySend(K(), {
|
|
4932
4932
|
op: "remove-sync",
|
|
4933
4933
|
"subscription-id": e.subscriptionId,
|
|
4934
4934
|
"keep-subscription": n
|
|
@@ -4942,7 +4942,7 @@ class qu {
|
|
|
4942
4942
|
if (a && a.state && a.state.txId) {
|
|
4943
4943
|
this.sendResync(a, a.state, a.state.txId), !((i = a.values) === null || i === void 0) && i.entities && r && r({
|
|
4944
4944
|
type: pe.LoadFromStorage,
|
|
4945
|
-
data:
|
|
4945
|
+
data: it(a, (s = a.values) === null || s === void 0 ? void 0 : s.entities)
|
|
4946
4946
|
});
|
|
4947
4947
|
return;
|
|
4948
4948
|
}
|
|
@@ -4970,7 +4970,7 @@ class qu {
|
|
|
4970
4970
|
});
|
|
4971
4971
|
}
|
|
4972
4972
|
onStartSyncOk(e) {
|
|
4973
|
-
const n = e["subscription-id"], r = e.q, i =
|
|
4973
|
+
const n = e["subscription-id"], r = e.q, i = N(r);
|
|
4974
4974
|
this.idToHash[n] = i, this.subs.updateInPlace((s) => {
|
|
4975
4975
|
const o = s[i];
|
|
4976
4976
|
if (!o)
|
|
@@ -5015,7 +5015,7 @@ class qu {
|
|
|
5015
5015
|
d[s] = u, d[s].updatedAt = Date.now();
|
|
5016
5016
|
}), u.values && this.notifyCbs(s, {
|
|
5017
5017
|
type: pe.InitialSyncBatch,
|
|
5018
|
-
data:
|
|
5018
|
+
data: it(u, u.values.entities),
|
|
5019
5019
|
batch: o
|
|
5020
5020
|
});
|
|
5021
5021
|
}
|
|
@@ -5040,7 +5040,7 @@ class qu {
|
|
|
5040
5040
|
const s = this.subs.currentValue[i];
|
|
5041
5041
|
s && this.notifyCbs(i, {
|
|
5042
5042
|
type: pe.InitialSyncComplete,
|
|
5043
|
-
data:
|
|
5043
|
+
data: it(s, ((n = s.values) === null || n === void 0 ? void 0 : n.entities) || [])
|
|
5044
5044
|
});
|
|
5045
5045
|
}
|
|
5046
5046
|
onSyncUpdateTriples(e) {
|
|
@@ -5065,9 +5065,9 @@ class qu {
|
|
|
5065
5065
|
continue;
|
|
5066
5066
|
a.txId = c["tx-id"];
|
|
5067
5067
|
const d = [], f = {};
|
|
5068
|
-
for (const
|
|
5069
|
-
const v = (n = f[
|
|
5070
|
-
f[
|
|
5068
|
+
for (const _ of c.changes) {
|
|
5069
|
+
const v = (n = f[_.triple[0]]) !== null && n !== void 0 ? n : [];
|
|
5070
|
+
f[_.triple[0]] = v, v.push(_);
|
|
5071
5071
|
}
|
|
5072
5072
|
const l = (r = u.values) !== null && r !== void 0 ? r : {
|
|
5073
5073
|
entities: [],
|
|
@@ -5075,22 +5075,22 @@ class qu {
|
|
|
5075
5075
|
}, p = l.entities;
|
|
5076
5076
|
u.values = l;
|
|
5077
5077
|
const y = [];
|
|
5078
|
-
e: for (const [
|
|
5078
|
+
e: for (const [_, v] of Object.entries(f))
|
|
5079
5079
|
for (let A = 0; A < p.length; A++) {
|
|
5080
5080
|
const S = p[A];
|
|
5081
|
-
if (Ts(S.store,
|
|
5081
|
+
if (Ts(S.store, _)) {
|
|
5082
5082
|
pr(S.store, l.attrsStore, v);
|
|
5083
|
-
const C = Ct(u, S.store, l.attrsStore),
|
|
5083
|
+
const C = Ct(u, S.store, l.attrsStore), x = Fu(S.store, l.attrsStore, v)[_];
|
|
5084
5084
|
C ? (y.push({
|
|
5085
5085
|
oldEntity: S.entity,
|
|
5086
5086
|
newEntity: C,
|
|
5087
|
-
changedFields:
|
|
5088
|
-
}), S.entity = C) : d.push(A), delete f[
|
|
5087
|
+
changedFields: x || {}
|
|
5088
|
+
}), S.entity = C) : d.push(A), delete f[_];
|
|
5089
5089
|
continue e;
|
|
5090
5090
|
}
|
|
5091
5091
|
}
|
|
5092
5092
|
const b = [];
|
|
5093
|
-
for (const [
|
|
5093
|
+
for (const [_, v] of Object.entries(f)) {
|
|
5094
5094
|
const A = this.createStore([]);
|
|
5095
5095
|
pr(A, l.attrsStore, v);
|
|
5096
5096
|
const S = Ct(u, A, l.attrsStore);
|
|
@@ -5108,15 +5108,15 @@ class qu {
|
|
|
5108
5108
|
serverCreatedAt: hr(u, A, l.attrsStore, S.id)
|
|
5109
5109
|
}), b.push(S);
|
|
5110
5110
|
}
|
|
5111
|
-
const
|
|
5112
|
-
for (const
|
|
5113
|
-
|
|
5111
|
+
const g = [];
|
|
5112
|
+
for (const _ of d.sort().reverse())
|
|
5113
|
+
g.push(p[_].entity), p.splice(_, 1);
|
|
5114
5114
|
const w = Nu(u, this.getAttrs);
|
|
5115
5115
|
Ku(u, w, p), this.notifyCbs(o, {
|
|
5116
5116
|
type: pe.SyncTransaction,
|
|
5117
|
-
data:
|
|
5117
|
+
data: it(u, (i = u.values) === null || i === void 0 ? void 0 : i.entities),
|
|
5118
5118
|
added: b,
|
|
5119
|
-
removed:
|
|
5119
|
+
removed: g,
|
|
5120
5120
|
updated: y
|
|
5121
5121
|
});
|
|
5122
5122
|
}
|
|
@@ -5136,7 +5136,7 @@ class qu {
|
|
|
5136
5136
|
}
|
|
5137
5137
|
}
|
|
5138
5138
|
onStartSyncError(e) {
|
|
5139
|
-
const n =
|
|
5139
|
+
const n = N(e["original-event"].q), r = {
|
|
5140
5140
|
message: e.message || "Uh-oh, something went wrong. Ping Joe & Stopa.",
|
|
5141
5141
|
status: e.status,
|
|
5142
5142
|
type: e.type,
|
|
@@ -5153,7 +5153,7 @@ class qu {
|
|
|
5153
5153
|
r && this.initSubscription(r.query, r.hash);
|
|
5154
5154
|
}
|
|
5155
5155
|
}
|
|
5156
|
-
var
|
|
5156
|
+
var $ = function(t, e, n, r) {
|
|
5157
5157
|
function i(s) {
|
|
5158
5158
|
return s instanceof n ? s : new n(function(o) {
|
|
5159
5159
|
o(s);
|
|
@@ -5193,23 +5193,23 @@ const oe = {
|
|
|
5193
5193
|
AUTHENTICATED: "authenticated",
|
|
5194
5194
|
CLOSED: "closed",
|
|
5195
5195
|
ERRORED: "errored"
|
|
5196
|
-
}, zu = 3e4, Vu = 3e4, Wu = 200,
|
|
5196
|
+
}, zu = 3e4, Vu = 3e4, Wu = 200, Qu = {
|
|
5197
5197
|
apiURI: "https://api.instantdb.com",
|
|
5198
5198
|
websocketURI: "wss://api.instantdb.com/runtime/session"
|
|
5199
|
-
}, It = "_instant_oauth_redirect",
|
|
5200
|
-
function
|
|
5199
|
+
}, It = "_instant_oauth_redirect", xe = "currentUser";
|
|
5200
|
+
function Bu({ transportType: t, appId: e, apiURI: n, wsURI: r, EventSourceImpl: i }) {
|
|
5201
5201
|
if (!i)
|
|
5202
5202
|
return new fr(`${r}?app_id=${e}`);
|
|
5203
5203
|
switch (t) {
|
|
5204
5204
|
case "ws":
|
|
5205
5205
|
return new fr(`${r}?app_id=${e}`);
|
|
5206
5206
|
case "sse":
|
|
5207
|
-
return new
|
|
5207
|
+
return new xu(i, `${n}/runtime/sse?app_id=${e}`);
|
|
5208
5208
|
default:
|
|
5209
5209
|
throw new Error("Unknown transport type " + t);
|
|
5210
5210
|
}
|
|
5211
5211
|
}
|
|
5212
|
-
function
|
|
5212
|
+
function Gu() {
|
|
5213
5213
|
return typeof window < "u" || typeof chrome < "u";
|
|
5214
5214
|
}
|
|
5215
5215
|
const yr = {
|
|
@@ -5222,7 +5222,7 @@ function Hu(t, e) {
|
|
|
5222
5222
|
var n;
|
|
5223
5223
|
const r = typeof t == "string" ? JSON.parse(t) : t;
|
|
5224
5224
|
if (!((n = r == null ? void 0 : r.result) === null || n === void 0) && n.store) {
|
|
5225
|
-
const i =
|
|
5225
|
+
const i = xr(r.result.attrsStore, r.result.store);
|
|
5226
5226
|
if (i) {
|
|
5227
5227
|
const s = r.result.store;
|
|
5228
5228
|
r.result.store = $r(i, Object.assign(Object.assign({}, s), { useDateObjects: e })), r.result.attrsStore = i;
|
|
@@ -5271,23 +5271,23 @@ class ea {
|
|
|
5271
5271
|
var l, p;
|
|
5272
5272
|
switch (c) {
|
|
5273
5273
|
case "pendingMutations": {
|
|
5274
|
-
const y = (l = d == null ? void 0 : d.entries()) !== null && l !== void 0 ? l : [], b = (p = f == null ? void 0 : f.entries()) !== null && p !== void 0 ? p : [],
|
|
5275
|
-
return (d ? this._rewriteMutationsSorted(this.attrs, d) : []).forEach(([
|
|
5274
|
+
const y = (l = d == null ? void 0 : d.entries()) !== null && l !== void 0 ? l : [], b = (p = f == null ? void 0 : f.entries()) !== null && p !== void 0 ? p : [], g = new Map([...y, ...b]);
|
|
5275
|
+
return (d ? this._rewriteMutationsSorted(this.attrs, d) : []).forEach(([_, v]) => {
|
|
5276
5276
|
var A;
|
|
5277
|
-
!(!((A = f == null ? void 0 : f.pendingMutations) === null || A === void 0) && A.has(
|
|
5278
|
-
}),
|
|
5277
|
+
!(!((A = f == null ? void 0 : f.pendingMutations) === null || A === void 0) && A.has(_)) && !v["tx-id"] && this._sendMutation(_, v);
|
|
5278
|
+
}), g;
|
|
5279
5279
|
}
|
|
5280
5280
|
default:
|
|
5281
5281
|
return f || d;
|
|
5282
5282
|
}
|
|
5283
5283
|
}, this.getPreviousResult = (c) => {
|
|
5284
5284
|
var d;
|
|
5285
|
-
const f =
|
|
5285
|
+
const f = N(c);
|
|
5286
5286
|
return (d = this.dataForQuery(f)) === null || d === void 0 ? void 0 : d.data;
|
|
5287
5287
|
}, this.notifyOne = (c) => {
|
|
5288
5288
|
var d, f;
|
|
5289
5289
|
const l = (d = this.queryCbs[c]) !== null && d !== void 0 ? d : [], p = (f = this._dataForQueryCache[c]) === null || f === void 0 ? void 0 : f.data, y = this.dataForQuery(c);
|
|
5290
|
-
y != null && y.data && (this._dataForQueryCache[c] = y, !
|
|
5290
|
+
y != null && y.data && (this._dataForQueryCache[c] = y, !at(y.data, p) && l.forEach((b) => b.cb(y.data)));
|
|
5291
5291
|
}, this.notifyOneQueryOnce = (c) => {
|
|
5292
5292
|
var d, f;
|
|
5293
5293
|
const l = (d = this.queryOnceDfds[c]) !== null && d !== void 0 ? d : [], p = (f = this.dataForQuery(c)) === null || f === void 0 ? void 0 : f.data;
|
|
@@ -5313,15 +5313,15 @@ class ea {
|
|
|
5313
5313
|
return this.pushOps([], d);
|
|
5314
5314
|
}
|
|
5315
5315
|
}, this.pushOps = (c, d) => {
|
|
5316
|
-
const f =
|
|
5316
|
+
const f = K(), l = [...this._pendingMutations().values()], p = Math.max(0, ...l.map((g) => g.order || 0)) + 1, y = {
|
|
5317
5317
|
op: "transact",
|
|
5318
5318
|
"tx-steps": c,
|
|
5319
5319
|
created: Date.now(),
|
|
5320
5320
|
error: d,
|
|
5321
5321
|
order: p
|
|
5322
5322
|
};
|
|
5323
|
-
this._updatePendingMutations((
|
|
5324
|
-
|
|
5323
|
+
this._updatePendingMutations((g) => {
|
|
5324
|
+
g.set(f, y);
|
|
5325
5325
|
});
|
|
5326
5326
|
const b = new nr();
|
|
5327
5327
|
return this.mutationDeferredStore.set(f, b), this._sendMutation(f, y), this.notifyAll(), b.promise;
|
|
@@ -5333,7 +5333,7 @@ class ea {
|
|
|
5333
5333
|
}
|
|
5334
5334
|
this._log.info("[socket][open]", this._transport.id), this._setStatus(oe.OPENED), this.getCurrentUser().then((f) => {
|
|
5335
5335
|
var l;
|
|
5336
|
-
this._trySend(
|
|
5336
|
+
this._trySend(K(), {
|
|
5337
5337
|
op: "init",
|
|
5338
5338
|
"app-id": this.config.appId,
|
|
5339
5339
|
"refresh-token": (l = f.user) === null || l === void 0 ? void 0 : l.refresh_token,
|
|
@@ -5388,12 +5388,12 @@ class ea {
|
|
|
5388
5388
|
return;
|
|
5389
5389
|
}
|
|
5390
5390
|
this._log.info("[socket][close]", d.id, "schedule reconnect, ms =", this._reconnectTimeoutMs), this._scheduleReconnect();
|
|
5391
|
-
}, this._EventSource = s, this.config = Object.assign(Object.assign({},
|
|
5391
|
+
}, this._EventSource = s, this.config = Object.assign(Object.assign({}, Qu), 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)), !!Gu()) {
|
|
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", (c) =>
|
|
5396
|
+
typeof BroadcastChannel == "function" && (this._broadcastChannel = new BroadcastChannel("@instantdb"), this._broadcastChannel.addEventListener("message", (c) => $(this, void 0, void 0, function* () {
|
|
5397
5397
|
var d;
|
|
5398
5398
|
try {
|
|
5399
5399
|
if (((d = c.data) === null || d === void 0 ? void 0 : d.type) === "auth") {
|
|
@@ -5405,7 +5405,12 @@ 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, (c) =>
|
|
5408
|
+
}, this._log, (c) => Le(this.ensureAttrs(), c, this.config.enableCardinalityInference, this.config.useDateObjects), () => this.ensureAttrs()), this._oauthCallbackResponse = this._oauthLoginInit(), this.getCurrentUser().then((c) => {
|
|
5409
|
+
this.syncUserToEndpoint(c.user);
|
|
5410
|
+
}), setInterval(() => $(this, void 0, void 0, function* () {
|
|
5411
|
+
const c = yield this.getCurrentUser();
|
|
5412
|
+
this.syncUserToEndpoint(c.user);
|
|
5413
|
+
}), 1e3 * 60 * 20), r.getIsOnline().then((c) => {
|
|
5409
5414
|
this._isOnline = c, this._startSocket(), r.listen((d) => {
|
|
5410
5415
|
d !== this._isOnline && (this._log.info("[network] online =", d), this._isOnline = d, this._isOnline ? this._startSocket() : (this._log.info("Changing status from", this.status, "to", oe.CLOSED), this._setStatus(oe.CLOSED)));
|
|
5411
5416
|
});
|
|
@@ -5431,7 +5436,7 @@ class ea {
|
|
|
5431
5436
|
this.kv.waitForKeyToLoad("pendingMutations").then(() => this.notifyOne(e));
|
|
5432
5437
|
}
|
|
5433
5438
|
_initStorage(e) {
|
|
5434
|
-
this.querySubs = new
|
|
5439
|
+
this.querySubs = new Gt({
|
|
5435
5440
|
persister: new e(this.config.appId, "querySubs"),
|
|
5436
5441
|
merge: Xu,
|
|
5437
5442
|
serialize: Yu,
|
|
@@ -5451,7 +5456,7 @@ class ea {
|
|
|
5451
5456
|
maxSize: 1e6
|
|
5452
5457
|
// 1 million triples
|
|
5453
5458
|
}
|
|
5454
|
-
}), this.querySubs.onKeyLoaded = (n) => this._onQuerySubLoaded(n), this.kv = new
|
|
5459
|
+
}), this.querySubs.onKeyLoaded = (n) => this._onQuerySubLoaded(n), this.kv = new Gt({
|
|
5455
5460
|
persister: new e(this.config.appId, "kv"),
|
|
5456
5461
|
merge: this._onMergeKv,
|
|
5457
5462
|
serialize: Zu,
|
|
@@ -5464,7 +5469,7 @@ class ea {
|
|
|
5464
5469
|
gc: null
|
|
5465
5470
|
}), this.kv.onKeyLoaded = (n) => {
|
|
5466
5471
|
n === "pendingMutations" && this.notifyAll();
|
|
5467
|
-
}, this.kv.waitForKeyToLoad("pendingMutations"), this.kv.waitForKeyToLoad(
|
|
5472
|
+
}, this.kv.waitForKeyToLoad("pendingMutations"), this.kv.waitForKeyToLoad(xe), this._beforeUnloadCbs.push(() => {
|
|
5468
5473
|
this.kv.flush(), this.querySubs.flush();
|
|
5469
5474
|
});
|
|
5470
5475
|
}
|
|
@@ -5507,6 +5512,30 @@ class ea {
|
|
|
5507
5512
|
this._tryBroadcast(e, a, u, c);
|
|
5508
5513
|
}
|
|
5509
5514
|
}
|
|
5515
|
+
/**
|
|
5516
|
+
* Does the same thing as add-query-ok
|
|
5517
|
+
* but called as a result of receiving query info from ssr
|
|
5518
|
+
* @param {any} q
|
|
5519
|
+
* @param {{ triples: any; pageInfo: any; }} result
|
|
5520
|
+
* @param {boolean} enableCardinalityInference
|
|
5521
|
+
*/
|
|
5522
|
+
_addQueryData(e, n, r) {
|
|
5523
|
+
if (!this.attrs)
|
|
5524
|
+
throw new Error("Attrs in reactor have not been set");
|
|
5525
|
+
const i = N(e), s = this.ensureAttrs(), o = Le(this.attrs, n.triples, r, this.config.useDateObjects);
|
|
5526
|
+
this.querySubs.updateInPlace((u) => {
|
|
5527
|
+
u[i] = {
|
|
5528
|
+
result: {
|
|
5529
|
+
store: o,
|
|
5530
|
+
attrsStore: s,
|
|
5531
|
+
pageInfo: n.pageInfo,
|
|
5532
|
+
processedTxId: void 0,
|
|
5533
|
+
isExternal: !0
|
|
5534
|
+
},
|
|
5535
|
+
q: e
|
|
5536
|
+
};
|
|
5537
|
+
}), this._cleanupPendingMutationsQueries(), this.notifyOne(i), this.notifyOneQueryOnce(i), this._cleanupPendingMutationsTimeout();
|
|
5538
|
+
}
|
|
5510
5539
|
_handleReceive(e, n) {
|
|
5511
5540
|
var r, i, s, o, u, a;
|
|
5512
5541
|
const c = !!this.config.schema && ("cardinalityInference" in this.config ? !!this.config.cardinalityInference : !0);
|
|
@@ -5520,14 +5549,14 @@ class ea {
|
|
|
5520
5549
|
break;
|
|
5521
5550
|
}
|
|
5522
5551
|
case "add-query-exists": {
|
|
5523
|
-
this.notifyOneQueryOnce(
|
|
5552
|
+
this.notifyOneQueryOnce(N(n.q));
|
|
5524
5553
|
break;
|
|
5525
5554
|
}
|
|
5526
5555
|
case "add-query-ok": {
|
|
5527
|
-
const { q: l, result: p } = n, y =
|
|
5556
|
+
const { q: l, result: p } = n, y = N(l);
|
|
5528
5557
|
if (!this._hasQueryListeners() && !this.querySubs.currentValue[y])
|
|
5529
5558
|
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"],
|
|
5559
|
+
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"], g = (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), _ = this.ensureAttrs(), v = Le(_, w, c, this.config.useDateObjects);
|
|
5531
5560
|
this.querySubs.updateInPlace((A) => {
|
|
5532
5561
|
if (!A[y]) {
|
|
5533
5562
|
this._log.info("Missing value in querySubs", { hash: y, q: l });
|
|
@@ -5535,9 +5564,9 @@ class ea {
|
|
|
5535
5564
|
}
|
|
5536
5565
|
A[y].result = {
|
|
5537
5566
|
store: v,
|
|
5538
|
-
attrsStore:
|
|
5567
|
+
attrsStore: _,
|
|
5539
5568
|
pageInfo: b,
|
|
5540
|
-
aggregate:
|
|
5569
|
+
aggregate: g,
|
|
5541
5570
|
processedTxId: n["processed-tx-id"]
|
|
5542
5571
|
};
|
|
5543
5572
|
}), this._cleanupPendingMutationsQueries(), this.notifyOne(y), this.notifyOneQueryOnce(y), this._cleanupPendingMutationsTimeout();
|
|
@@ -5563,37 +5592,37 @@ class ea {
|
|
|
5563
5592
|
const { computations: l, attrs: p } = n, y = n["processed-tx-id"];
|
|
5564
5593
|
p && this._setAttrs(p), this._cleanupPendingMutationsTimeout();
|
|
5565
5594
|
const b = this._rewriteMutations(this.ensureAttrs(), this._pendingMutations(), y);
|
|
5566
|
-
b !== this._pendingMutations() && this.kv.updateInPlace((
|
|
5567
|
-
|
|
5595
|
+
b !== this._pendingMutations() && this.kv.updateInPlace((_) => {
|
|
5596
|
+
_.pendingMutations = b;
|
|
5568
5597
|
});
|
|
5569
|
-
const
|
|
5598
|
+
const g = br(b.entries()), w = l.map((_) => {
|
|
5570
5599
|
var v, A, S, C;
|
|
5571
|
-
const
|
|
5600
|
+
const x = _["instaql-query"], R = _["instaql-result"], Pe = N(x), Ge = rr(R), He = this.ensureAttrs(), _t = Le(He, Ge, c, this.config.useDateObjects), { store: Ye, attrsStore: ne } = this._applyOptimisticUpdates(_t, He, g, 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
5601
|
return {
|
|
5573
|
-
q:
|
|
5602
|
+
q: x,
|
|
5574
5603
|
hash: Pe,
|
|
5575
|
-
store:
|
|
5604
|
+
store: Ye,
|
|
5576
5605
|
attrsStore: ne,
|
|
5577
5606
|
pageInfo: se,
|
|
5578
5607
|
aggregate: le
|
|
5579
5608
|
};
|
|
5580
5609
|
});
|
|
5581
|
-
w.forEach(({ hash:
|
|
5610
|
+
w.forEach(({ hash: _, q: v, store: A, attrsStore: S, pageInfo: C, aggregate: x }) => {
|
|
5582
5611
|
this.querySubs.updateInPlace((R) => {
|
|
5583
|
-
if (!R[
|
|
5584
|
-
this._log.error("Missing value in querySubs", { hash:
|
|
5612
|
+
if (!R[_]) {
|
|
5613
|
+
this._log.error("Missing value in querySubs", { hash: _, q: v });
|
|
5585
5614
|
return;
|
|
5586
5615
|
}
|
|
5587
|
-
R[
|
|
5616
|
+
R[_].result = {
|
|
5588
5617
|
store: A,
|
|
5589
5618
|
attrsStore: S,
|
|
5590
5619
|
pageInfo: C,
|
|
5591
|
-
aggregate:
|
|
5620
|
+
aggregate: x,
|
|
5592
5621
|
processedTxId: y
|
|
5593
5622
|
};
|
|
5594
5623
|
});
|
|
5595
|
-
}), this._cleanupPendingMutationsQueries(), w.forEach(({ hash:
|
|
5596
|
-
this.notifyOne(
|
|
5624
|
+
}), this._cleanupPendingMutationsQueries(), w.forEach(({ hash: _ }) => {
|
|
5625
|
+
this.notifyOne(_);
|
|
5597
5626
|
});
|
|
5598
5627
|
break;
|
|
5599
5628
|
}
|
|
@@ -5606,15 +5635,15 @@ class ea {
|
|
|
5606
5635
|
this._updatePendingMutations((w) => {
|
|
5607
5636
|
w.set(l, Object.assign(Object.assign({}, w.get(l)), { "tx-id": p, confirmed: Date.now() }));
|
|
5608
5637
|
});
|
|
5609
|
-
const
|
|
5638
|
+
const g = [];
|
|
5610
5639
|
for (const w of b["tx-steps"])
|
|
5611
5640
|
if (w[0] === "add-attr") {
|
|
5612
|
-
const
|
|
5613
|
-
|
|
5641
|
+
const _ = w[1];
|
|
5642
|
+
g.push(_);
|
|
5614
5643
|
}
|
|
5615
|
-
if (
|
|
5644
|
+
if (g.length) {
|
|
5616
5645
|
const w = Object.values(this.ensureAttrs().attrs);
|
|
5617
|
-
this._setAttrs([...w, ...
|
|
5646
|
+
this._setAttrs([...w, ...g]);
|
|
5618
5647
|
}
|
|
5619
5648
|
this._finishTransaction("synced", l), this._cleanupPendingMutationsTimeout();
|
|
5620
5649
|
break;
|
|
@@ -5700,8 +5729,8 @@ class ea {
|
|
|
5700
5729
|
return;
|
|
5701
5730
|
}
|
|
5702
5731
|
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
|
-
const y = (i = e["original-event"]) === null || i === void 0 ? void 0 : i.q, b =
|
|
5704
|
-
this.notifyQueryError(
|
|
5732
|
+
const y = (i = e["original-event"]) === null || i === void 0 ? void 0 : i.q, b = N(y);
|
|
5733
|
+
this.notifyQueryError(N(y), f), this.notifyQueryOnceError(y, b, c, f);
|
|
5705
5734
|
return;
|
|
5706
5735
|
}
|
|
5707
5736
|
if (((s = e["original-event"]) === null || s === void 0 ? void 0 : s.op) === "init") {
|
|
@@ -5733,7 +5762,7 @@ class ea {
|
|
|
5733
5762
|
this.attrs = new _e(e.reduce((n, r) => (n[r.id] = r, n), {}), this._linkIndex), this.notifyAttrsSubs();
|
|
5734
5763
|
}
|
|
5735
5764
|
_startQuerySub(e, n) {
|
|
5736
|
-
const r =
|
|
5765
|
+
const r = K();
|
|
5737
5766
|
return this.querySubs.updateInPlace((i) => {
|
|
5738
5767
|
i[n] = i[n] || { q: e, result: null, eventId: r }, i[n].lastAccessed = Date.now();
|
|
5739
5768
|
}), this._trySendAuthed(r, { op: "add-query", q: e }), r;
|
|
@@ -5754,7 +5783,7 @@ class ea {
|
|
|
5754
5783
|
subscribeQuery(e, n, r) {
|
|
5755
5784
|
var i;
|
|
5756
5785
|
this.config.disableValidation || or(e, this.config.schema), r && "ruleParams" in r && (e = Object.assign({ $$ruleParams: r.ruleParams }, e));
|
|
5757
|
-
const s =
|
|
5786
|
+
const s = N(e), o = this.getPreviousResult(e);
|
|
5758
5787
|
return o && n(o), this.queryCbs[s] = (i = this.queryCbs[s]) !== null && i !== void 0 ? i : [], this.queryCbs[s].push({ q: e, cb: n }), this._startQuerySub(e, s), () => {
|
|
5759
5788
|
this._unsubQuery(e, s, n);
|
|
5760
5789
|
};
|
|
@@ -5767,7 +5796,7 @@ class ea {
|
|
|
5767
5796
|
return i.reject(new Error("We can't run `queryOnce`, because the device is offline.")), i.promise;
|
|
5768
5797
|
if (!this.querySubs)
|
|
5769
5798
|
return i.reject(new Error("We can't run `queryOnce` on the backend. Use adminAPI.query instead: https://www.instantdb.com/docs/backend#query")), i.promise;
|
|
5770
|
-
const s =
|
|
5799
|
+
const s = N(e), o = this._startQuerySub(e, s);
|
|
5771
5800
|
return this.queryOnceDfds[s] = (r = this.queryOnceDfds[s]) !== null && r !== void 0 ? r : [], this.queryOnceDfds[s].push({ q: e, dfd: i, eventId: o }), setTimeout(() => i.reject(new Error("Query timed out")), zu), i.promise;
|
|
5772
5801
|
}
|
|
5773
5802
|
_completeQueryOnce(e, n, r) {
|
|
@@ -5781,7 +5810,7 @@ class ea {
|
|
|
5781
5810
|
return !!(!((n = this.queryCbs[e]) === null || n === void 0) && n.length || !((r = this.queryOnceDfds[e]) === null || r === void 0) && r.length);
|
|
5782
5811
|
}
|
|
5783
5812
|
_cleanupQuery(e, n) {
|
|
5784
|
-
this._hasQueryListeners(n) || (delete this.queryCbs[n], delete this.queryOnceDfds[n], delete this._dataForQueryCache[n], this.querySubs.unloadKey(n), this._trySendAuthed(
|
|
5813
|
+
this._hasQueryListeners(n) || (delete this.queryCbs[n], delete this.queryOnceDfds[n], delete this._dataForQueryCache[n], this.querySubs.unloadKey(n), this._trySendAuthed(K(), { op: "remove-query", q: e }));
|
|
5785
5814
|
}
|
|
5786
5815
|
// When we `pushTx`, it's possible that we don't yet have `this.attrs`
|
|
5787
5816
|
// This means that `tx-steps` in `pendingMutations` will include `add-attr`
|
|
@@ -5818,9 +5847,9 @@ class ea {
|
|
|
5818
5847
|
for (const p of d) {
|
|
5819
5848
|
const [y] = p;
|
|
5820
5849
|
if (y === "add-attr") {
|
|
5821
|
-
const [
|
|
5822
|
-
if (
|
|
5823
|
-
o.attrIdMap[w.id] =
|
|
5850
|
+
const [g, w] = p, _ = i(w);
|
|
5851
|
+
if (_ && w.id !== _.id) {
|
|
5852
|
+
o.attrIdMap[w.id] = _.id, u = !0;
|
|
5824
5853
|
continue;
|
|
5825
5854
|
}
|
|
5826
5855
|
if (w["value-type"] === "ref") {
|
|
@@ -5872,20 +5901,25 @@ class ea {
|
|
|
5872
5901
|
return new _e(o, this._linkIndex);
|
|
5873
5902
|
}
|
|
5874
5903
|
/** Runs instaql on a query and a store */
|
|
5875
|
-
dataForQuery(e) {
|
|
5876
|
-
const
|
|
5877
|
-
if (
|
|
5878
|
-
return { error:
|
|
5904
|
+
dataForQuery(e, n = !0) {
|
|
5905
|
+
const r = this._errorMessage;
|
|
5906
|
+
if (r)
|
|
5907
|
+
return { error: r };
|
|
5879
5908
|
if (!this.querySubs || !this.kv.currentValue.pendingMutations)
|
|
5880
5909
|
return;
|
|
5881
|
-
const
|
|
5882
|
-
if (!
|
|
5910
|
+
const i = this.querySubs.version(), s = this.querySubs.currentValue, o = this.kv.version(), u = this._pendingMutations(), { q: a, result: c } = s[e] || {};
|
|
5911
|
+
if (!c)
|
|
5883
5912
|
return;
|
|
5884
|
-
const
|
|
5885
|
-
if (
|
|
5886
|
-
return
|
|
5887
|
-
|
|
5888
|
-
|
|
5913
|
+
const d = this._dataForQueryCache[e];
|
|
5914
|
+
if (d && i === d.querySubVersion && o === d.pendingMutationsVersion)
|
|
5915
|
+
return d;
|
|
5916
|
+
let f = c.store, l = c.attrsStore;
|
|
5917
|
+
const { pageInfo: p, aggregate: y, processedTxId: b } = c, g = this._rewriteMutationsSorted(l, u);
|
|
5918
|
+
if (n) {
|
|
5919
|
+
const _ = this._applyOptimisticUpdates(f, l, g, b);
|
|
5920
|
+
f = _.store, l = _.attrsStore;
|
|
5921
|
+
}
|
|
5922
|
+
return { data: Br({ store: f, attrsStore: l, pageInfo: p, aggregate: y }, a), querySubVersion: i, pendingMutationsVersion: o };
|
|
5889
5923
|
}
|
|
5890
5924
|
_applyOptimisticUpdates(e, n, r, i) {
|
|
5891
5925
|
for (const [s, o] of r)
|
|
@@ -6001,7 +6035,7 @@ class ea {
|
|
|
6001
6035
|
return;
|
|
6002
6036
|
}
|
|
6003
6037
|
const e = this._transport;
|
|
6004
|
-
this._transport =
|
|
6038
|
+
this._transport = Bu({
|
|
6005
6039
|
transportType: this._transportType,
|
|
6006
6040
|
appId: this.config.appId,
|
|
6007
6041
|
apiURI: this.config.apiURI,
|
|
@@ -6018,14 +6052,14 @@ class ea {
|
|
|
6018
6052
|
*
|
|
6019
6053
|
*/
|
|
6020
6054
|
getLocalId(e) {
|
|
6021
|
-
return
|
|
6055
|
+
return $(this, void 0, void 0, function* () {
|
|
6022
6056
|
const n = `localToken_${e}`;
|
|
6023
6057
|
if (this.kv.currentValue[n])
|
|
6024
6058
|
return this.kv.currentValue[n];
|
|
6025
6059
|
const r = yield this.kv.waitForKeyToLoad(n);
|
|
6026
6060
|
if (r)
|
|
6027
6061
|
return r;
|
|
6028
|
-
const i =
|
|
6062
|
+
const i = K();
|
|
6029
6063
|
return this.kv.updateInPlace((s) => {
|
|
6030
6064
|
s[n] || (s[n] = i);
|
|
6031
6065
|
}), yield this.kv.waitForKeyToLoad(n);
|
|
@@ -6059,7 +6093,7 @@ class ea {
|
|
|
6059
6093
|
* @returns Promise<null | {error: {message: string}}>
|
|
6060
6094
|
*/
|
|
6061
6095
|
_oauthLoginInit() {
|
|
6062
|
-
return
|
|
6096
|
+
return $(this, void 0, void 0, function* () {
|
|
6063
6097
|
var e, n, r, i;
|
|
6064
6098
|
if (typeof window > "u" || typeof window.location > "u" || typeof URLSearchParams > "u")
|
|
6065
6099
|
return null;
|
|
@@ -6087,7 +6121,7 @@ class ea {
|
|
|
6087
6121
|
});
|
|
6088
6122
|
}
|
|
6089
6123
|
_waitForOAuthCallbackResponse() {
|
|
6090
|
-
return
|
|
6124
|
+
return $(this, void 0, void 0, function* () {
|
|
6091
6125
|
return yield this._oauthCallbackResponse;
|
|
6092
6126
|
});
|
|
6093
6127
|
}
|
|
@@ -6102,13 +6136,13 @@ class ea {
|
|
|
6102
6136
|
n.isLoading || e(this._currentUserCached);
|
|
6103
6137
|
let r = !1;
|
|
6104
6138
|
return this.getCurrentUser().then((i) => {
|
|
6105
|
-
r ||
|
|
6139
|
+
r || at(i, n) || e(i);
|
|
6106
6140
|
}), () => {
|
|
6107
6141
|
r = !0, this.authCbs = this.authCbs.filter((i) => i !== e);
|
|
6108
6142
|
};
|
|
6109
6143
|
}
|
|
6110
6144
|
getAuth() {
|
|
6111
|
-
return
|
|
6145
|
+
return $(this, void 0, void 0, function* () {
|
|
6112
6146
|
const { user: e, error: n } = yield this.getCurrentUser();
|
|
6113
6147
|
if (n)
|
|
6114
6148
|
throw new je("Could not get current user: " + n.message);
|
|
@@ -6141,23 +6175,23 @@ class ea {
|
|
|
6141
6175
|
this.connectionStatusCbs.forEach((n) => n(e));
|
|
6142
6176
|
}
|
|
6143
6177
|
setCurrentUser(e) {
|
|
6144
|
-
return
|
|
6178
|
+
return $(this, void 0, void 0, function* () {
|
|
6145
6179
|
this.kv.updateInPlace((n) => {
|
|
6146
|
-
n[
|
|
6147
|
-
}), yield this.kv.waitForKeyToLoad(
|
|
6180
|
+
n[xe] = e;
|
|
6181
|
+
}), yield this.kv.waitForKeyToLoad(xe);
|
|
6148
6182
|
});
|
|
6149
6183
|
}
|
|
6150
6184
|
getCurrentUserCached() {
|
|
6151
6185
|
return this._currentUserCached;
|
|
6152
6186
|
}
|
|
6153
6187
|
_getCurrentUser() {
|
|
6154
|
-
return
|
|
6155
|
-
const e = yield this.kv.waitForKeyToLoad(
|
|
6188
|
+
return $(this, void 0, void 0, function* () {
|
|
6189
|
+
const e = yield this.kv.waitForKeyToLoad(xe);
|
|
6156
6190
|
return typeof e == "string" ? JSON.parse(e) : e;
|
|
6157
6191
|
});
|
|
6158
6192
|
}
|
|
6159
6193
|
getCurrentUser() {
|
|
6160
|
-
return
|
|
6194
|
+
return $(this, void 0, void 0, function* () {
|
|
6161
6195
|
const e = yield this._waitForOAuthCallbackResponse();
|
|
6162
6196
|
if (e != null && e.error) {
|
|
6163
6197
|
const n = { error: e.error, user: void 0 };
|
|
@@ -6176,16 +6210,16 @@ class ea {
|
|
|
6176
6210
|
});
|
|
6177
6211
|
}
|
|
6178
6212
|
_hasCurrentUser() {
|
|
6179
|
-
return
|
|
6180
|
-
const e = yield this.kv.waitForKeyToLoad(
|
|
6213
|
+
return $(this, void 0, void 0, function* () {
|
|
6214
|
+
const e = yield this.kv.waitForKeyToLoad(xe);
|
|
6181
6215
|
return typeof e == "string" ? JSON.parse(e) != null : e != null;
|
|
6182
6216
|
});
|
|
6183
6217
|
}
|
|
6184
6218
|
changeCurrentUser(e) {
|
|
6185
|
-
return
|
|
6219
|
+
return $(this, void 0, void 0, function* () {
|
|
6186
6220
|
var n;
|
|
6187
6221
|
const { user: r } = yield this.getCurrentUser();
|
|
6188
|
-
if (!
|
|
6222
|
+
if (!at(r, e)) {
|
|
6189
6223
|
yield this.setCurrentUser(e), this.updateUser(e);
|
|
6190
6224
|
try {
|
|
6191
6225
|
(n = this._broadcastChannel) === null || n === void 0 || n.postMessage({ type: "auth" });
|
|
@@ -6195,7 +6229,26 @@ class ea {
|
|
|
6195
6229
|
}
|
|
6196
6230
|
});
|
|
6197
6231
|
}
|
|
6232
|
+
syncUserToEndpoint(e) {
|
|
6233
|
+
return $(this, void 0, void 0, function* () {
|
|
6234
|
+
if (this.config.cookieEndpoint)
|
|
6235
|
+
try {
|
|
6236
|
+
fetch(this.config.cookieEndpoint + "/sync-auth", {
|
|
6237
|
+
method: "POST",
|
|
6238
|
+
body: JSON.stringify({
|
|
6239
|
+
user: e
|
|
6240
|
+
}),
|
|
6241
|
+
headers: {
|
|
6242
|
+
"Content-Type": "application/json"
|
|
6243
|
+
}
|
|
6244
|
+
});
|
|
6245
|
+
} catch (n) {
|
|
6246
|
+
console.error("Error syncing user with external endpoint", n);
|
|
6247
|
+
}
|
|
6248
|
+
});
|
|
6249
|
+
}
|
|
6198
6250
|
updateUser(e) {
|
|
6251
|
+
this.syncUserToEndpoint(e);
|
|
6199
6252
|
const n = { error: void 0, user: e };
|
|
6200
6253
|
this._currentUserCached = Object.assign({ isLoading: !1 }, n), this._dataForQueryCache = {}, this.querySubs.updateInPlace((r) => {
|
|
6201
6254
|
Object.keys(r).forEach((i) => {
|
|
@@ -6211,7 +6264,7 @@ class ea {
|
|
|
6211
6264
|
});
|
|
6212
6265
|
}
|
|
6213
6266
|
signInWithMagicCode(e) {
|
|
6214
|
-
return
|
|
6267
|
+
return $(this, arguments, void 0, function* ({ email: n, code: r }) {
|
|
6215
6268
|
var i;
|
|
6216
6269
|
const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", u = yield hu({
|
|
6217
6270
|
apiURI: this.config.apiURI,
|
|
@@ -6224,7 +6277,7 @@ class ea {
|
|
|
6224
6277
|
});
|
|
6225
6278
|
}
|
|
6226
6279
|
signInWithCustomToken(e) {
|
|
6227
|
-
return
|
|
6280
|
+
return $(this, void 0, void 0, function* () {
|
|
6228
6281
|
const n = yield pu({
|
|
6229
6282
|
apiURI: this.config.apiURI,
|
|
6230
6283
|
appId: this.config.appId,
|
|
@@ -6234,7 +6287,7 @@ class ea {
|
|
|
6234
6287
|
});
|
|
6235
6288
|
}
|
|
6236
6289
|
signInAsGuest() {
|
|
6237
|
-
return
|
|
6290
|
+
return $(this, void 0, void 0, function* () {
|
|
6238
6291
|
const e = yield yu({
|
|
6239
6292
|
apiURI: this.config.apiURI,
|
|
6240
6293
|
appId: this.config.appId
|
|
@@ -6261,7 +6314,7 @@ class ea {
|
|
|
6261
6314
|
});
|
|
6262
6315
|
}
|
|
6263
6316
|
signOut(e) {
|
|
6264
|
-
return
|
|
6317
|
+
return $(this, void 0, void 0, function* () {
|
|
6265
6318
|
const n = yield this.getCurrentUser();
|
|
6266
6319
|
this.potentiallyInvalidateToken(n, e), yield this.changeCurrentUser(null);
|
|
6267
6320
|
});
|
|
@@ -6284,7 +6337,7 @@ class ea {
|
|
|
6284
6337
|
* @param {string} [params.codeVerifier] - The code verifier used to generate the code challenge.
|
|
6285
6338
|
*/
|
|
6286
6339
|
exchangeCodeForToken(e) {
|
|
6287
|
-
return
|
|
6340
|
+
return $(this, arguments, void 0, function* ({ code: n, codeVerifier: r }) {
|
|
6288
6341
|
var i;
|
|
6289
6342
|
const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", u = yield er({
|
|
6290
6343
|
apiURI: this.config.apiURI,
|
|
@@ -6307,7 +6360,7 @@ class ea {
|
|
|
6307
6360
|
* @param {string | null | undefined} [params.nonce] - The nonce used when requesting the id_token from the external service
|
|
6308
6361
|
*/
|
|
6309
6362
|
signInWithIdToken(e) {
|
|
6310
|
-
return
|
|
6363
|
+
return $(this, arguments, void 0, function* ({ idToken: n, clientName: r, nonce: i }) {
|
|
6311
6364
|
var s;
|
|
6312
6365
|
const o = yield this.getCurrentUser(), u = (s = o == null ? void 0 : o.user) === null || s === void 0 ? void 0 : s.refresh_token, a = yield bu({
|
|
6313
6366
|
apiURI: this.config.apiURI,
|
|
@@ -6362,17 +6415,17 @@ class ea {
|
|
|
6362
6415
|
s.result.user = o, i.isConnected && (this._trySetPresence(n, o), this._notifyPresenceSubs(n));
|
|
6363
6416
|
}
|
|
6364
6417
|
_trySetPresence(e, n) {
|
|
6365
|
-
this._trySendAuthed(
|
|
6418
|
+
this._trySendAuthed(K(), {
|
|
6366
6419
|
op: "set-presence",
|
|
6367
6420
|
"room-id": e,
|
|
6368
6421
|
data: n
|
|
6369
6422
|
});
|
|
6370
6423
|
}
|
|
6371
6424
|
_tryJoinRoom(e, n) {
|
|
6372
|
-
this._trySendAuthed(
|
|
6425
|
+
this._trySendAuthed(K(), { op: "join-room", "room-id": e, data: n }), delete this._roomsPendingLeave[e];
|
|
6373
6426
|
}
|
|
6374
6427
|
_tryLeaveRoom(e) {
|
|
6375
|
-
this._trySendAuthed(
|
|
6428
|
+
this._trySendAuthed(K(), { op: "leave-room", "room-id": e });
|
|
6376
6429
|
}
|
|
6377
6430
|
_trySetRoomConnected(e, n) {
|
|
6378
6431
|
const r = this._rooms[e];
|
|
@@ -6446,7 +6499,7 @@ class ea {
|
|
|
6446
6499
|
}
|
|
6447
6500
|
}
|
|
6448
6501
|
_tryBroadcast(e, n, r, i) {
|
|
6449
|
-
this._trySendAuthed(
|
|
6502
|
+
this._trySendAuthed(K(), {
|
|
6450
6503
|
op: "client-broadcast",
|
|
6451
6504
|
"room-id": e,
|
|
6452
6505
|
roomType: n,
|
|
@@ -6471,14 +6524,14 @@ class ea {
|
|
|
6471
6524
|
// --------
|
|
6472
6525
|
// Storage
|
|
6473
6526
|
uploadFile(e, n, r) {
|
|
6474
|
-
return
|
|
6527
|
+
return $(this, void 0, void 0, function* () {
|
|
6475
6528
|
var i;
|
|
6476
6529
|
const s = yield this.getCurrentUser(), o = (i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.refresh_token;
|
|
6477
6530
|
return gu(Object.assign(Object.assign({}, r), { apiURI: this.config.apiURI, appId: this.config.appId, path: e, file: n, refreshToken: o }));
|
|
6478
6531
|
});
|
|
6479
6532
|
}
|
|
6480
6533
|
deleteFile(e) {
|
|
6481
|
-
return
|
|
6534
|
+
return $(this, void 0, void 0, function* () {
|
|
6482
6535
|
var n;
|
|
6483
6536
|
const r = yield this.getCurrentUser(), i = (n = r == null ? void 0 : r.user) === null || n === void 0 ? void 0 : n.refresh_token;
|
|
6484
6537
|
return yield Tu({
|
|
@@ -6492,7 +6545,7 @@ class ea {
|
|
|
6492
6545
|
// Deprecated Storage API (Jan 2025)
|
|
6493
6546
|
// ---------------------------------
|
|
6494
6547
|
upload(e, n) {
|
|
6495
|
-
return
|
|
6548
|
+
return $(this, void 0, void 0, function* () {
|
|
6496
6549
|
var r;
|
|
6497
6550
|
const i = yield this.getCurrentUser(), s = (r = i == null ? void 0 : i.user) === null || r === void 0 ? void 0 : r.refresh_token, o = e || n.name, u = yield wu({
|
|
6498
6551
|
apiURI: this.config.apiURI,
|
|
@@ -6504,7 +6557,7 @@ class ea {
|
|
|
6504
6557
|
});
|
|
6505
6558
|
}
|
|
6506
6559
|
getDownloadUrl(e) {
|
|
6507
|
-
return
|
|
6560
|
+
return $(this, void 0, void 0, function* () {
|
|
6508
6561
|
var n;
|
|
6509
6562
|
const r = yield this.getCurrentUser(), i = (n = r == null ? void 0 : r.user) === null || n === void 0 ? void 0 : n.refresh_token;
|
|
6510
6563
|
return yield vu({
|
|
@@ -6516,9 +6569,9 @@ class ea {
|
|
|
6516
6569
|
});
|
|
6517
6570
|
}
|
|
6518
6571
|
}
|
|
6519
|
-
let
|
|
6572
|
+
let st;
|
|
6520
6573
|
function ta(t, e) {
|
|
6521
|
-
|
|
6574
|
+
st == null || st.dispose();
|
|
6522
6575
|
const n = ua(e), r = ia(e, u), i = ra(na(t));
|
|
6523
6576
|
function s(d) {
|
|
6524
6577
|
var f;
|
|
@@ -6535,7 +6588,7 @@ function ta(t, e) {
|
|
|
6535
6588
|
n.element.remove(), r.element.remove(), removeEventListener("keydown", o), removeEventListener("message", s);
|
|
6536
6589
|
}
|
|
6537
6590
|
function c() {
|
|
6538
|
-
document.body.appendChild(n.element), document.body.appendChild(r.element), addEventListener("keydown", o), addEventListener("message", s),
|
|
6591
|
+
document.body.appendChild(n.element), document.body.appendChild(r.element), addEventListener("keydown", o), addEventListener("message", s), st = {
|
|
6539
6592
|
dispose: a
|
|
6540
6593
|
};
|
|
6541
6594
|
}
|
|
@@ -6822,7 +6875,7 @@ function gr(t) {
|
|
|
6822
6875
|
const e = _r.get(t);
|
|
6823
6876
|
if (e)
|
|
6824
6877
|
return e;
|
|
6825
|
-
const n =
|
|
6878
|
+
const n = N(t);
|
|
6826
6879
|
return _r.set(t, n), n;
|
|
6827
6880
|
}
|
|
6828
6881
|
function ya(t, e) {
|
|
@@ -6859,12 +6912,12 @@ function Tr(t) {
|
|
|
6859
6912
|
}
|
|
6860
6913
|
function Ta(t, e, n) {
|
|
6861
6914
|
e && n && "ruleParams" in n && (e = { $$ruleParams: n.ruleParams, ...e });
|
|
6862
|
-
const r = e ? ha(e) : null, i =
|
|
6915
|
+
const r = e ? ha(e) : null, i = N(r), s = ze(
|
|
6863
6916
|
Tr(t._reactor.getPreviousResult(r))
|
|
6864
6917
|
), o = fe(
|
|
6865
6918
|
(a) => (s.current = Tr(
|
|
6866
6919
|
t._reactor.getPreviousResult(r)
|
|
6867
|
-
), r ? t.subscribeQuery(r, (d) => {
|
|
6920
|
+
), a(), r ? t.subscribeQuery(r, (d) => {
|
|
6868
6921
|
s.current = {
|
|
6869
6922
|
isLoading: !d,
|
|
6870
6923
|
// @ts-expect-error: ts thinks this will always be overwritten
|
|
@@ -6887,7 +6940,7 @@ function Ta(t, e, n) {
|
|
|
6887
6940
|
), query: r };
|
|
6888
6941
|
}
|
|
6889
6942
|
function wa() {
|
|
6890
|
-
const t =
|
|
6943
|
+
const t = ze(null);
|
|
6891
6944
|
ge(() => {
|
|
6892
6945
|
n();
|
|
6893
6946
|
}, []);
|
|
@@ -6901,7 +6954,7 @@ function wa() {
|
|
|
6901
6954
|
}
|
|
6902
6955
|
const ma = 1e3;
|
|
6903
6956
|
function va(t, e, n) {
|
|
6904
|
-
const r =
|
|
6957
|
+
const r = ze(n);
|
|
6905
6958
|
r.current = n, ge(() => t.core._reactor.subscribeTopic(
|
|
6906
6959
|
t.id,
|
|
6907
6960
|
e,
|
|
@@ -7017,18 +7070,7 @@ class Ia {
|
|
|
7017
7070
|
s(u);
|
|
7018
7071
|
})();
|
|
7019
7072
|
}, [r]), i;
|
|
7020
|
-
}, this.rooms = ye, this.transact = (r) => this.core.transact(r), this.useQuery = (r, i) => Ta(this.core, r, i).state, this.useAuth = () => {
|
|
7021
|
-
const r = qe(
|
|
7022
|
-
this.core._reactor._currentUserCached
|
|
7023
|
-
), i = fe((o) => this.core.subscribeAuth((a) => {
|
|
7024
|
-
r.current = { isLoading: !1, ...a }, o();
|
|
7025
|
-
}), []);
|
|
7026
|
-
return Pt(
|
|
7027
|
-
i,
|
|
7028
|
-
() => r.current,
|
|
7029
|
-
() => ja
|
|
7030
|
-
);
|
|
7031
|
-
}, this.useUser = () => {
|
|
7073
|
+
}, this.rooms = ye, this.transact = (r) => this.core.transact(r), this.useQuery = (r, i) => Ta(this.core, r, i).state, this.useAuth = () => this._useAuth(), this.useUser = () => {
|
|
7032
7074
|
const { user: r } = this.useAuth();
|
|
7033
7075
|
if (!r)
|
|
7034
7076
|
throw new je(
|
|
@@ -7036,7 +7078,7 @@ class Ia {
|
|
|
7036
7078
|
);
|
|
7037
7079
|
return r;
|
|
7038
7080
|
}, this.useConnectionStatus = () => {
|
|
7039
|
-
const r =
|
|
7081
|
+
const r = ze(
|
|
7040
7082
|
this.core._reactor.status
|
|
7041
7083
|
), i = fe((o) => this.core.subscribeConnectionStatus((a) => {
|
|
7042
7084
|
a !== r.current && (r.current = a, o());
|
|
@@ -7049,10 +7091,10 @@ class Ia {
|
|
|
7049
7091
|
);
|
|
7050
7092
|
}, this.queryOnce = (r, i) => this.core.queryOnce(r, i), this.SignedIn = ({ children: r }) => {
|
|
7051
7093
|
const i = this.useAuth();
|
|
7052
|
-
return i.isLoading || i.error || !i.user ? null : /* @__PURE__ */
|
|
7094
|
+
return i.isLoading || i.error || !i.user ? null : /* @__PURE__ */ tt.jsx(tt.Fragment, { children: r });
|
|
7053
7095
|
}, this.SignedOut = ({ children: r }) => {
|
|
7054
7096
|
const i = this.useAuth();
|
|
7055
|
-
return i.isLoading || i.error || i.user ? null : /* @__PURE__ */
|
|
7097
|
+
return i.isLoading || i.error || i.user ? null : /* @__PURE__ */ tt.jsx(tt.Fragment, { children: r });
|
|
7056
7098
|
}, this.core = ba(
|
|
7057
7099
|
e,
|
|
7058
7100
|
// @ts-expect-error because TS can't resolve subclass statics
|
|
@@ -7079,6 +7121,18 @@ class Ia {
|
|
|
7079
7121
|
room(e = "_defaultRoomType", n = "_defaultRoomId") {
|
|
7080
7122
|
return new ka(this.core, e, n);
|
|
7081
7123
|
}
|
|
7124
|
+
_useAuth() {
|
|
7125
|
+
const e = ze(
|
|
7126
|
+
this.core._reactor._currentUserCached
|
|
7127
|
+
), n = fe((i) => this.core.subscribeAuth((o) => {
|
|
7128
|
+
e.current = { isLoading: !1, ...o }, i();
|
|
7129
|
+
}), []);
|
|
7130
|
+
return Pt(
|
|
7131
|
+
n,
|
|
7132
|
+
() => e.current,
|
|
7133
|
+
() => ja
|
|
7134
|
+
);
|
|
7135
|
+
}
|
|
7082
7136
|
/**
|
|
7083
7137
|
* One time query for the logged in state. This is useful
|
|
7084
7138
|
* for scenarios where you want to know the current auth
|