@instantdb/react-common 0.22.155 → 0.22.156
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/index.d.ts +2 -1
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +3 -1
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/useQuery.d.ts +2 -1
- package/dist/commonjs/useQuery.d.ts.map +1 -1
- package/dist/commonjs/useQuery.js +15 -3
- package/dist/commonjs/useQuery.js.map +1 -1
- package/dist/esm/index.d.ts +2 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/useQuery.d.ts +2 -1
- package/dist/esm/useQuery.d.ts.map +1 -1
- package/dist/esm/useQuery.js +15 -3
- package/dist/esm/useQuery.js.map +1 -1
- package/dist/standalone/index.js +636 -619
- package/dist/standalone/index.umd.cjs +11 -11
- package/package.json +3 -3
- package/src/index.ts +6 -1
- package/src/useQuery.ts +22 -2
package/dist/standalone/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var h = (n, e, t) =>
|
|
4
|
-
import
|
|
5
|
-
var Wt = { exports: {} },
|
|
1
|
+
var Rs = Object.defineProperty;
|
|
2
|
+
var js = (n, e, t) => e in n ? Rs(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
|
+
var h = (n, e, t) => js(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import mr, { useRef as Fe, useCallback as ve, useSyncExternalStore as Kt, useEffect as Pe, useMemo as qt, useState as wr } from "react";
|
|
5
|
+
var Wt = { exports: {} }, Ve = {};
|
|
6
6
|
/**
|
|
7
7
|
* @license React
|
|
8
8
|
* react-jsx-runtime.production.min.js
|
|
@@ -13,10 +13,10 @@ var Wt = { exports: {} }, ze = {};
|
|
|
13
13
|
* LICENSE file in the root directory of this source tree.
|
|
14
14
|
*/
|
|
15
15
|
var xn;
|
|
16
|
-
function
|
|
17
|
-
if (xn) return
|
|
16
|
+
function Ds() {
|
|
17
|
+
if (xn) return Ve;
|
|
18
18
|
xn = 1;
|
|
19
|
-
var n =
|
|
19
|
+
var n = mr, e = Symbol.for("react.element"), t = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, s = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, i = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
20
20
|
function o(a, c, u) {
|
|
21
21
|
var l, f = {}, p = null, y = null;
|
|
22
22
|
u !== void 0 && (p = "" + u), c.key !== void 0 && (p = "" + c.key), c.ref !== void 0 && (y = c.ref);
|
|
@@ -24,11 +24,11 @@ function js() {
|
|
|
24
24
|
if (a && a.defaultProps) for (l in c = a.defaultProps, c) f[l] === void 0 && (f[l] = c[l]);
|
|
25
25
|
return { $$typeof: e, type: a, key: p, ref: y, props: f, _owner: s.current };
|
|
26
26
|
}
|
|
27
|
-
return
|
|
27
|
+
return Ve.Fragment = t, Ve.jsx = o, Ve.jsxs = o, Ve;
|
|
28
28
|
}
|
|
29
|
-
var
|
|
30
|
-
function
|
|
31
|
-
if (Un) return
|
|
29
|
+
var Be = {}, Un;
|
|
30
|
+
function $s() {
|
|
31
|
+
if (Un) return Be;
|
|
32
32
|
Un = 1;
|
|
33
33
|
var n = {};
|
|
34
34
|
/**
|
|
@@ -41,7 +41,7 @@ function Ds() {
|
|
|
41
41
|
* LICENSE file in the root directory of this source tree.
|
|
42
42
|
*/
|
|
43
43
|
return n.NODE_ENV !== "production" && function() {
|
|
44
|
-
var e =
|
|
44
|
+
var e = mr, t = Symbol.for("react.element"), r = Symbol.for("react.portal"), s = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), a = Symbol.for("react.provider"), c = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), l = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), p = Symbol.for("react.memo"), y = Symbol.for("react.lazy"), b = Symbol.for("react.offscreen"), g = Symbol.iterator, T = "@@iterator";
|
|
45
45
|
function S(d) {
|
|
46
46
|
if (d === null || typeof d != "object")
|
|
47
47
|
return null;
|
|
@@ -157,7 +157,7 @@ function Ds() {
|
|
|
157
157
|
J++;
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
|
-
function
|
|
160
|
+
function We() {
|
|
161
161
|
{
|
|
162
162
|
if (J--, J === 0) {
|
|
163
163
|
var d = {
|
|
@@ -208,8 +208,8 @@ function Ds() {
|
|
|
208
208
|
}
|
|
209
209
|
var kt = !1, it;
|
|
210
210
|
{
|
|
211
|
-
var
|
|
212
|
-
it = new
|
|
211
|
+
var as = typeof WeakMap == "function" ? WeakMap : Map;
|
|
212
|
+
it = new as();
|
|
213
213
|
}
|
|
214
214
|
function Tn(d, m) {
|
|
215
215
|
if (!d || kt)
|
|
@@ -277,15 +277,15 @@ function Ds() {
|
|
|
277
277
|
}
|
|
278
278
|
}
|
|
279
279
|
} finally {
|
|
280
|
-
kt = !1, he.current = $,
|
|
280
|
+
kt = !1, he.current = $, We(), Error.prepareStackTrace = D;
|
|
281
281
|
}
|
|
282
282
|
var $e = d ? d.displayName || d.name : "", Oe = $e ? st($e) : "";
|
|
283
283
|
return typeof d == "function" && it.set(d, Oe), Oe;
|
|
284
284
|
}
|
|
285
|
-
function
|
|
285
|
+
function cs(d, m, A) {
|
|
286
286
|
return Tn(d, !1);
|
|
287
287
|
}
|
|
288
|
-
function
|
|
288
|
+
function us(d) {
|
|
289
289
|
var m = d.prototype;
|
|
290
290
|
return !!(m && m.isReactComponent);
|
|
291
291
|
}
|
|
@@ -293,7 +293,7 @@ function Ds() {
|
|
|
293
293
|
if (d == null)
|
|
294
294
|
return "";
|
|
295
295
|
if (typeof d == "function")
|
|
296
|
-
return Tn(d,
|
|
296
|
+
return Tn(d, us(d));
|
|
297
297
|
if (typeof d == "string")
|
|
298
298
|
return st(d);
|
|
299
299
|
switch (d) {
|
|
@@ -305,7 +305,7 @@ function Ds() {
|
|
|
305
305
|
if (typeof d == "object")
|
|
306
306
|
switch (d.$$typeof) {
|
|
307
307
|
case u:
|
|
308
|
-
return
|
|
308
|
+
return cs(d.render);
|
|
309
309
|
case p:
|
|
310
310
|
return ot(d.type, m, A);
|
|
311
311
|
case y: {
|
|
@@ -318,7 +318,7 @@ function Ds() {
|
|
|
318
318
|
}
|
|
319
319
|
return "";
|
|
320
320
|
}
|
|
321
|
-
var
|
|
321
|
+
var ze = Object.prototype.hasOwnProperty, Sn = {}, vn = _.ReactDebugCurrentFrame;
|
|
322
322
|
function at(d) {
|
|
323
323
|
if (d) {
|
|
324
324
|
var m = d._owner, A = ot(d.type, d._source, m ? m.type : null);
|
|
@@ -326,9 +326,9 @@ function Ds() {
|
|
|
326
326
|
} else
|
|
327
327
|
vn.setExtraStackFrame(null);
|
|
328
328
|
}
|
|
329
|
-
function
|
|
329
|
+
function ls(d, m, A, E, D) {
|
|
330
330
|
{
|
|
331
|
-
var $ = Function.call.bind(
|
|
331
|
+
var $ = Function.call.bind(ze);
|
|
332
332
|
for (var R in d)
|
|
333
333
|
if ($(d, R)) {
|
|
334
334
|
var P = void 0;
|
|
@@ -345,17 +345,17 @@ function Ds() {
|
|
|
345
345
|
}
|
|
346
346
|
}
|
|
347
347
|
}
|
|
348
|
-
var
|
|
348
|
+
var fs = Array.isArray;
|
|
349
349
|
function Ct(d) {
|
|
350
|
-
return
|
|
350
|
+
return fs(d);
|
|
351
351
|
}
|
|
352
|
-
function
|
|
352
|
+
function ds(d) {
|
|
353
353
|
{
|
|
354
354
|
var m = typeof Symbol == "function" && Symbol.toStringTag, A = m && d[Symbol.toStringTag] || d.constructor.name || "Object";
|
|
355
355
|
return A;
|
|
356
356
|
}
|
|
357
357
|
}
|
|
358
|
-
function
|
|
358
|
+
function hs(d) {
|
|
359
359
|
try {
|
|
360
360
|
return An(d), !1;
|
|
361
361
|
} catch {
|
|
@@ -366,35 +366,35 @@ function Ds() {
|
|
|
366
366
|
return "" + d;
|
|
367
367
|
}
|
|
368
368
|
function On(d) {
|
|
369
|
-
if (
|
|
370
|
-
return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",
|
|
369
|
+
if (hs(d))
|
|
370
|
+
return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", ds(d)), An(d);
|
|
371
371
|
}
|
|
372
|
-
var En = _.ReactCurrentOwner,
|
|
372
|
+
var En = _.ReactCurrentOwner, ps = {
|
|
373
373
|
key: !0,
|
|
374
374
|
ref: !0,
|
|
375
375
|
__self: !0,
|
|
376
376
|
__source: !0
|
|
377
377
|
}, kn, Cn;
|
|
378
|
-
function
|
|
379
|
-
if (
|
|
378
|
+
function ys(d) {
|
|
379
|
+
if (ze.call(d, "ref")) {
|
|
380
380
|
var m = Object.getOwnPropertyDescriptor(d, "ref").get;
|
|
381
381
|
if (m && m.isReactWarning)
|
|
382
382
|
return !1;
|
|
383
383
|
}
|
|
384
384
|
return d.ref !== void 0;
|
|
385
385
|
}
|
|
386
|
-
function
|
|
387
|
-
if (
|
|
386
|
+
function bs(d) {
|
|
387
|
+
if (ze.call(d, "key")) {
|
|
388
388
|
var m = Object.getOwnPropertyDescriptor(d, "key").get;
|
|
389
389
|
if (m && m.isReactWarning)
|
|
390
390
|
return !1;
|
|
391
391
|
}
|
|
392
392
|
return d.key !== void 0;
|
|
393
393
|
}
|
|
394
|
-
function
|
|
394
|
+
function _s(d, m) {
|
|
395
395
|
typeof d.ref == "string" && En.current;
|
|
396
396
|
}
|
|
397
|
-
function
|
|
397
|
+
function gs(d, m) {
|
|
398
398
|
{
|
|
399
399
|
var A = function() {
|
|
400
400
|
kn || (kn = !0, w("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", m));
|
|
@@ -405,7 +405,7 @@ function Ds() {
|
|
|
405
405
|
});
|
|
406
406
|
}
|
|
407
407
|
}
|
|
408
|
-
function
|
|
408
|
+
function ms(d, m) {
|
|
409
409
|
{
|
|
410
410
|
var A = function() {
|
|
411
411
|
Cn || (Cn = !0, w("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", m));
|
|
@@ -416,7 +416,7 @@ function Ds() {
|
|
|
416
416
|
});
|
|
417
417
|
}
|
|
418
418
|
}
|
|
419
|
-
var
|
|
419
|
+
var ws = function(d, m, A, E, D, $, R) {
|
|
420
420
|
var P = {
|
|
421
421
|
// This tag allows us to uniquely identify this as a React Element
|
|
422
422
|
$$typeof: t,
|
|
@@ -445,12 +445,12 @@ function Ds() {
|
|
|
445
445
|
value: D
|
|
446
446
|
}), Object.freeze && (Object.freeze(P.props), Object.freeze(P)), P;
|
|
447
447
|
};
|
|
448
|
-
function
|
|
448
|
+
function Ts(d, m, A, E, D) {
|
|
449
449
|
{
|
|
450
450
|
var $, R = {}, P = null, Z = null;
|
|
451
|
-
A !== void 0 && (On(A), P = "" + A),
|
|
451
|
+
A !== void 0 && (On(A), P = "" + A), bs(m) && (On(m.key), P = "" + m.key), ys(m) && (Z = m.ref, _s(m, D));
|
|
452
452
|
for ($ in m)
|
|
453
|
-
|
|
453
|
+
ze.call(m, $) && !ps.hasOwnProperty($) && (R[$] = m[$]);
|
|
454
454
|
if (d && d.defaultProps) {
|
|
455
455
|
var N = d.defaultProps;
|
|
456
456
|
for ($ in N)
|
|
@@ -458,9 +458,9 @@ function Ds() {
|
|
|
458
458
|
}
|
|
459
459
|
if (P || Z) {
|
|
460
460
|
var q = typeof d == "function" ? d.displayName || d.name || "Unknown" : d;
|
|
461
|
-
P &&
|
|
461
|
+
P && gs(R, q), Z && ms(R, q);
|
|
462
462
|
}
|
|
463
|
-
return
|
|
463
|
+
return ws(d, P, Z, D, E, En.current, R);
|
|
464
464
|
}
|
|
465
465
|
}
|
|
466
466
|
var It = _.ReactCurrentOwner, In = _.ReactDebugCurrentFrame;
|
|
@@ -488,11 +488,11 @@ Check the render method of \`` + d + "`.";
|
|
|
488
488
|
return "";
|
|
489
489
|
}
|
|
490
490
|
}
|
|
491
|
-
function
|
|
491
|
+
function Ss(d) {
|
|
492
492
|
return "";
|
|
493
493
|
}
|
|
494
494
|
var Mn = {};
|
|
495
|
-
function
|
|
495
|
+
function vs(d) {
|
|
496
496
|
{
|
|
497
497
|
var m = Pn();
|
|
498
498
|
if (!m) {
|
|
@@ -509,7 +509,7 @@ Check the top-level render call using <` + A + ">.");
|
|
|
509
509
|
if (!d._store || d._store.validated || d.key != null)
|
|
510
510
|
return;
|
|
511
511
|
d._store.validated = !0;
|
|
512
|
-
var A =
|
|
512
|
+
var A = vs(m);
|
|
513
513
|
if (Mn[A])
|
|
514
514
|
return;
|
|
515
515
|
Mn[A] = !0;
|
|
@@ -536,7 +536,7 @@ Check the top-level render call using <` + A + ">.");
|
|
|
536
536
|
}
|
|
537
537
|
}
|
|
538
538
|
}
|
|
539
|
-
function
|
|
539
|
+
function As(d) {
|
|
540
540
|
{
|
|
541
541
|
var m = d.type;
|
|
542
542
|
if (m == null || typeof m == "string")
|
|
@@ -552,7 +552,7 @@ Check the top-level render call using <` + A + ">.");
|
|
|
552
552
|
return;
|
|
553
553
|
if (A) {
|
|
554
554
|
var E = F(m);
|
|
555
|
-
|
|
555
|
+
ls(A, d.props, "prop", E, d);
|
|
556
556
|
} else if (m.PropTypes !== void 0 && !Pt) {
|
|
557
557
|
Pt = !0;
|
|
558
558
|
var D = F(m);
|
|
@@ -561,7 +561,7 @@ Check the top-level render call using <` + A + ">.");
|
|
|
561
561
|
typeof m.getDefaultProps == "function" && !m.getDefaultProps.isReactClassApproved && w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
562
562
|
}
|
|
563
563
|
}
|
|
564
|
-
function
|
|
564
|
+
function Os(d) {
|
|
565
565
|
{
|
|
566
566
|
for (var m = Object.keys(d.props), A = 0; A < m.length; A++) {
|
|
567
567
|
var E = m[A];
|
|
@@ -580,12 +580,12 @@ Check the top-level render call using <` + A + ">.");
|
|
|
580
580
|
if (!R) {
|
|
581
581
|
var P = "";
|
|
582
582
|
(d === void 0 || typeof d == "object" && d !== null && Object.keys(d).length === 0) && (P += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
583
|
-
var Z =
|
|
583
|
+
var Z = Ss();
|
|
584
584
|
Z ? P += Z : P += Pn();
|
|
585
585
|
var N;
|
|
586
586
|
d === null ? N = "null" : Ct(d) ? N = "array" : d !== void 0 && d.$$typeof === t ? (N = "<" + (F(d.type) || "Unknown") + " />", P = " Did you accidentally export a JSX literal instead of a component?") : N = typeof d, w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", N, P);
|
|
587
587
|
}
|
|
588
|
-
var q =
|
|
588
|
+
var q = Ts(d, m, A, D, $);
|
|
589
589
|
if (q == null)
|
|
590
590
|
return q;
|
|
591
591
|
if (R) {
|
|
@@ -601,35 +601,35 @@ Check the top-level render call using <` + A + ">.");
|
|
|
601
601
|
else
|
|
602
602
|
jn(le, d);
|
|
603
603
|
}
|
|
604
|
-
if (
|
|
605
|
-
var Oe = F(d), re = Object.keys(m).filter(function(
|
|
606
|
-
return
|
|
604
|
+
if (ze.call(m, "key")) {
|
|
605
|
+
var Oe = F(d), re = Object.keys(m).filter(function(Ms) {
|
|
606
|
+
return Ms !== "key";
|
|
607
607
|
}), Rt = re.length > 0 ? "{key: someKey, " + re.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
608
608
|
if (!Dn[Oe + Rt]) {
|
|
609
|
-
var
|
|
609
|
+
var Ps = re.length > 0 ? "{" + re.join(": ..., ") + ": ...}" : "{}";
|
|
610
610
|
w(`A props object containing a "key" prop is being spread into JSX:
|
|
611
611
|
let props = %s;
|
|
612
612
|
<%s {...props} />
|
|
613
613
|
React keys must be passed directly to JSX without using spread:
|
|
614
614
|
let props = %s;
|
|
615
|
-
<%s key={someKey} {...props} />`, Rt, Oe,
|
|
615
|
+
<%s key={someKey} {...props} />`, Rt, Oe, Ps, Oe), Dn[Oe + Rt] = !0;
|
|
616
616
|
}
|
|
617
617
|
}
|
|
618
|
-
return d === s ?
|
|
618
|
+
return d === s ? Os(q) : As(q), q;
|
|
619
619
|
}
|
|
620
620
|
}
|
|
621
|
-
function
|
|
621
|
+
function Es(d, m, A) {
|
|
622
622
|
return $n(d, m, A, !0);
|
|
623
623
|
}
|
|
624
|
-
function
|
|
624
|
+
function ks(d, m, A) {
|
|
625
625
|
return $n(d, m, A, !1);
|
|
626
626
|
}
|
|
627
|
-
var
|
|
628
|
-
|
|
629
|
-
}(),
|
|
627
|
+
var Cs = ks, Is = Es;
|
|
628
|
+
Be.Fragment = s, Be.jsx = Cs, Be.jsxs = Is;
|
|
629
|
+
}(), Be;
|
|
630
630
|
}
|
|
631
|
-
var
|
|
632
|
-
|
|
631
|
+
var xs = {};
|
|
632
|
+
xs.NODE_ENV === "production" ? Wt.exports = Ds() : Wt.exports = $s();
|
|
633
633
|
var ct = Wt.exports;
|
|
634
634
|
function Q(n) {
|
|
635
635
|
if (typeof n == "number")
|
|
@@ -673,11 +673,11 @@ const K = {
|
|
|
673
673
|
Remove: "remove",
|
|
674
674
|
Replace: "replace",
|
|
675
675
|
Add: "add"
|
|
676
|
-
},
|
|
676
|
+
}, Tr = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), Us = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), ht = Symbol.iterator, ce = {
|
|
677
677
|
mutable: "mutable",
|
|
678
678
|
immutable: "immutable"
|
|
679
679
|
}, cn = {};
|
|
680
|
-
function
|
|
680
|
+
function Ye(n, e) {
|
|
681
681
|
return n instanceof Map ? n.has(e) : Object.prototype.hasOwnProperty.call(n, e);
|
|
682
682
|
}
|
|
683
683
|
function Ln(n, e) {
|
|
@@ -705,7 +705,7 @@ function Me(n) {
|
|
|
705
705
|
return !!M(n);
|
|
706
706
|
}
|
|
707
707
|
function M(n) {
|
|
708
|
-
return typeof n != "object" ? null : n == null ? void 0 : n[
|
|
708
|
+
return typeof n != "object" ? null : n == null ? void 0 : n[Tr];
|
|
709
709
|
}
|
|
710
710
|
function fn(n) {
|
|
711
711
|
var e;
|
|
@@ -718,21 +718,21 @@ function ye(n, e) {
|
|
|
718
718
|
let t;
|
|
719
719
|
return Object.getPrototypeOf(n) === Object.prototype || Array.isArray(n) || n instanceof Map || n instanceof Set || !!(e != null && e.mark) && ((t = e.mark(n, ce)) === ce.immutable || typeof t == "function");
|
|
720
720
|
}
|
|
721
|
-
function
|
|
721
|
+
function Sr(n, e = []) {
|
|
722
722
|
if (Object.hasOwnProperty.call(n, "key")) {
|
|
723
723
|
const t = n.parent.copy, r = M(Se(t, n.key));
|
|
724
724
|
if (r !== null && (r == null ? void 0 : r.original) !== n.original)
|
|
725
725
|
return null;
|
|
726
726
|
const s = n.parent.type === 3, i = s ? Array.from(n.parent.setMap.keys()).indexOf(n.key) : n.key;
|
|
727
|
-
if (!(s && t.size > i ||
|
|
727
|
+
if (!(s && t.size > i || Ye(t, i)))
|
|
728
728
|
return null;
|
|
729
729
|
e.push(i);
|
|
730
730
|
}
|
|
731
731
|
if (n.parent)
|
|
732
|
-
return
|
|
732
|
+
return Sr(n.parent, e);
|
|
733
733
|
e.reverse();
|
|
734
734
|
try {
|
|
735
|
-
|
|
735
|
+
Ls(n.copy, e);
|
|
736
736
|
} catch {
|
|
737
737
|
return null;
|
|
738
738
|
}
|
|
@@ -765,7 +765,7 @@ function Ce(n, e) {
|
|
|
765
765
|
return r.indexOf("/") === -1 && r.indexOf("~") === -1 ? r : r.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
766
766
|
}).join("/");
|
|
767
767
|
}
|
|
768
|
-
function
|
|
768
|
+
function Ls(n, e) {
|
|
769
769
|
for (let t = 0; t < e.length - 1; t += 1) {
|
|
770
770
|
const r = e[t];
|
|
771
771
|
if (n = Se(Re(n) === 3 ? Array.from(n) : n, r), typeof n != "object")
|
|
@@ -773,7 +773,7 @@ function Us(n, e) {
|
|
|
773
773
|
}
|
|
774
774
|
return n;
|
|
775
775
|
}
|
|
776
|
-
function
|
|
776
|
+
function Fs(n) {
|
|
777
777
|
const e = Object.create(Object.getPrototypeOf(n));
|
|
778
778
|
return Reflect.ownKeys(n).forEach((t) => {
|
|
779
779
|
let r = Reflect.getOwnPropertyDescriptor(n, t);
|
|
@@ -789,8 +789,8 @@ function Ls(n) {
|
|
|
789
789
|
}), Reflect.defineProperty(e, t, r);
|
|
790
790
|
}), e;
|
|
791
791
|
}
|
|
792
|
-
const
|
|
793
|
-
function
|
|
792
|
+
const Ns = Object.prototype.propertyIsEnumerable;
|
|
793
|
+
function vr(n, e) {
|
|
794
794
|
let t;
|
|
795
795
|
if (Array.isArray(n))
|
|
796
796
|
return Array.prototype.concat.call(n);
|
|
@@ -808,7 +808,7 @@ function Sr(n, e) {
|
|
|
808
808
|
return new Map(n);
|
|
809
809
|
} else if (e != null && e.mark && (t = e.mark(n, ce), t !== void 0) && t !== ce.mutable) {
|
|
810
810
|
if (t === ce.immutable)
|
|
811
|
-
return
|
|
811
|
+
return Fs(n);
|
|
812
812
|
if (typeof t == "function") {
|
|
813
813
|
if (e.enablePatches || e.enableAutoFreeze)
|
|
814
814
|
throw new Error("You can't use mark and patches or auto freeze together.");
|
|
@@ -820,23 +820,23 @@ function Sr(n, e) {
|
|
|
820
820
|
return Object.keys(n).forEach((s) => {
|
|
821
821
|
r[s] = n[s];
|
|
822
822
|
}), Object.getOwnPropertySymbols(n).forEach((s) => {
|
|
823
|
-
|
|
823
|
+
Ns.call(n, s) && (r[s] = n[s]);
|
|
824
824
|
}), r;
|
|
825
825
|
} else
|
|
826
826
|
throw new Error("Please check mark() to ensure that it is a stable marker draftable function.");
|
|
827
827
|
}
|
|
828
828
|
function X(n) {
|
|
829
|
-
n.copy || (n.copy =
|
|
829
|
+
n.copy || (n.copy = vr(n.original, n.options));
|
|
830
830
|
}
|
|
831
|
-
function
|
|
831
|
+
function Qe(n) {
|
|
832
832
|
if (!ye(n))
|
|
833
833
|
return fn(n);
|
|
834
834
|
if (Array.isArray(n))
|
|
835
|
-
return n.map(
|
|
835
|
+
return n.map(Qe);
|
|
836
836
|
if (n instanceof Map) {
|
|
837
837
|
const t = Array.from(n.entries()).map(([r, s]) => [
|
|
838
838
|
r,
|
|
839
|
-
|
|
839
|
+
Qe(s)
|
|
840
840
|
]);
|
|
841
841
|
if (!ln(n)) {
|
|
842
842
|
const r = Object.getPrototypeOf(n).constructor;
|
|
@@ -845,7 +845,7 @@ function Be(n) {
|
|
|
845
845
|
return new Map(t);
|
|
846
846
|
}
|
|
847
847
|
if (n instanceof Set) {
|
|
848
|
-
const t = Array.from(n).map(
|
|
848
|
+
const t = Array.from(n).map(Qe);
|
|
849
849
|
if (!un(n)) {
|
|
850
850
|
const r = Object.getPrototypeOf(n).constructor;
|
|
851
851
|
return new r(t);
|
|
@@ -854,11 +854,11 @@ function Be(n) {
|
|
|
854
854
|
}
|
|
855
855
|
const e = Object.create(Object.getPrototypeOf(n));
|
|
856
856
|
for (const t in n)
|
|
857
|
-
e[t] =
|
|
857
|
+
e[t] = Qe(n[t]);
|
|
858
858
|
return e;
|
|
859
859
|
}
|
|
860
860
|
function pt(n) {
|
|
861
|
-
return Me(n) ?
|
|
861
|
+
return Me(n) ? Qe(n) : n;
|
|
862
862
|
}
|
|
863
863
|
function ge(n) {
|
|
864
864
|
var e;
|
|
@@ -926,7 +926,7 @@ function dn(n, e) {
|
|
|
926
926
|
} else
|
|
927
927
|
n.forEach((r, s) => e(s, r, n));
|
|
928
928
|
}
|
|
929
|
-
function
|
|
929
|
+
function Ar(n, e, t) {
|
|
930
930
|
if (Me(n) || !ye(n, t) || e.has(n) || Object.isFrozen(n))
|
|
931
931
|
return;
|
|
932
932
|
const r = n instanceof Set, s = r ? /* @__PURE__ */ new Map() : void 0;
|
|
@@ -938,7 +938,7 @@ function vr(n, e, t) {
|
|
|
938
938
|
const u = !((a = c.assignedMap) === null || a === void 0) && a.size || c.operated ? c.copy : c.original;
|
|
939
939
|
tt(r ? s : n, i, u);
|
|
940
940
|
} else
|
|
941
|
-
|
|
941
|
+
Ar(o, e, t);
|
|
942
942
|
}), s) {
|
|
943
943
|
const i = n, o = Array.from(i);
|
|
944
944
|
i.clear(), o.forEach((a) => {
|
|
@@ -946,9 +946,9 @@ function vr(n, e, t) {
|
|
|
946
946
|
});
|
|
947
947
|
}
|
|
948
948
|
}
|
|
949
|
-
function
|
|
949
|
+
function Ks(n, e) {
|
|
950
950
|
const t = n.type === 3 ? n.setMap : n.copy;
|
|
951
|
-
n.finalities.revoke.length > 1 && n.assignedMap.get(e) && t &&
|
|
951
|
+
n.finalities.revoke.length > 1 && n.assignedMap.get(e) && t && Ar(Se(t, e), n.finalities.handledSet, n.options);
|
|
952
952
|
}
|
|
953
953
|
function Vt(n) {
|
|
954
954
|
n.type === 3 && n.copy && (n.copy.clear(), n.setMap.forEach((e) => {
|
|
@@ -958,7 +958,7 @@ function Vt(n) {
|
|
|
958
958
|
function Bt(n, e, t, r) {
|
|
959
959
|
if (n.operated && n.assignedMap && n.assignedMap.size > 0 && !n.finalized) {
|
|
960
960
|
if (t && r) {
|
|
961
|
-
const i =
|
|
961
|
+
const i = Sr(n);
|
|
962
962
|
i && e(n, i, t, r);
|
|
963
963
|
}
|
|
964
964
|
n.finalized = !0;
|
|
@@ -975,10 +975,10 @@ function hn(n, e, t, r) {
|
|
|
975
975
|
}
|
|
976
976
|
}), n.options.enableAutoFreeze && s.finalities !== n.finalities && (n.options.enableAutoFreeze = !1)), ye(t, n.options) && n.finalities.draft.push(() => {
|
|
977
977
|
const i = n.type === 3 ? n.setMap : n.copy;
|
|
978
|
-
Te(Se(i, e), t) &&
|
|
978
|
+
Te(Se(i, e), t) && Ks(n, e);
|
|
979
979
|
});
|
|
980
980
|
}
|
|
981
|
-
function
|
|
981
|
+
function qs(n, e, t, r, s) {
|
|
982
982
|
let { original: i, assignedMap: o, options: a } = n, c = n.copy;
|
|
983
983
|
c.length < i.length && ([i, c] = [c, i], [t, r] = [r, t]);
|
|
984
984
|
for (let u = 0; u < i.length; u += 1)
|
|
@@ -1024,16 +1024,16 @@ function Ks(n, e, t, r, s) {
|
|
|
1024
1024
|
}
|
|
1025
1025
|
}
|
|
1026
1026
|
}
|
|
1027
|
-
function
|
|
1027
|
+
function Ws({ original: n, copy: e, assignedMap: t }, r, s, i, o) {
|
|
1028
1028
|
t.forEach((a, c) => {
|
|
1029
|
-
const u = Se(n, c), l = pt(Se(e, c)), f = a ?
|
|
1029
|
+
const u = Se(n, c), l = pt(Se(e, c)), f = a ? Ye(n, c) ? K.Replace : K.Add : K.Remove;
|
|
1030
1030
|
if (Te(u, l) && f === K.Replace)
|
|
1031
1031
|
return;
|
|
1032
1032
|
const p = r.concat(c), y = Ce(p, o);
|
|
1033
1033
|
s.push(f === K.Remove ? { op: f, path: y } : { op: f, path: y, value: l }), i.push(f === K.Add ? { op: K.Remove, path: y } : f === K.Remove ? { op: K.Add, path: y, value: u } : { op: K.Replace, path: y, value: u });
|
|
1034
1034
|
});
|
|
1035
1035
|
}
|
|
1036
|
-
function
|
|
1036
|
+
function zs({ original: n, copy: e }, t, r, s, i) {
|
|
1037
1037
|
let o = 0;
|
|
1038
1038
|
n.forEach((a) => {
|
|
1039
1039
|
if (!e.has(a)) {
|
|
@@ -1070,11 +1070,11 @@ function et(n, e, t, r) {
|
|
|
1070
1070
|
switch (n.type) {
|
|
1071
1071
|
case 0:
|
|
1072
1072
|
case 2:
|
|
1073
|
-
return
|
|
1073
|
+
return Ws(n, e, t, r, s);
|
|
1074
1074
|
case 1:
|
|
1075
|
-
return
|
|
1075
|
+
return qs(n, e, t, r, s);
|
|
1076
1076
|
case 3:
|
|
1077
|
-
return
|
|
1077
|
+
return zs(n, e, t, r, s);
|
|
1078
1078
|
}
|
|
1079
1079
|
}
|
|
1080
1080
|
const _t = (n, e, t = !1) => {
|
|
@@ -1161,7 +1161,7 @@ const _t = (n, e, t = !1) => {
|
|
|
1161
1161
|
[ht]() {
|
|
1162
1162
|
return this.entries();
|
|
1163
1163
|
}
|
|
1164
|
-
},
|
|
1164
|
+
}, Vs = Reflect.ownKeys(Qt), Nn = (n, e, { isValuesIterator: t }) => () => {
|
|
1165
1165
|
var r, s;
|
|
1166
1166
|
const i = e.next();
|
|
1167
1167
|
if (i.done)
|
|
@@ -1272,13 +1272,13 @@ Set.prototype.difference && Object.assign(gt, {
|
|
|
1272
1272
|
return Set.prototype.isDisjointFrom.call(new Set(this.values()), n);
|
|
1273
1273
|
}
|
|
1274
1274
|
});
|
|
1275
|
-
const
|
|
1275
|
+
const Bs = Reflect.ownKeys(gt), Or = /* @__PURE__ */ new WeakSet(), Er = {
|
|
1276
1276
|
get(n, e, t) {
|
|
1277
1277
|
var r, s;
|
|
1278
1278
|
const i = (r = n.copy) === null || r === void 0 ? void 0 : r[e];
|
|
1279
|
-
if (i &&
|
|
1279
|
+
if (i && Or.has(i))
|
|
1280
1280
|
return i;
|
|
1281
|
-
if (e ===
|
|
1281
|
+
if (e === Tr)
|
|
1282
1282
|
return n;
|
|
1283
1283
|
let o;
|
|
1284
1284
|
if (n.options.mark) {
|
|
@@ -1287,21 +1287,21 @@ const Vs = Reflect.ownKeys(gt), Ar = /* @__PURE__ */ new WeakSet(), Or = {
|
|
|
1287
1287
|
return n.options.strict && _t(u, n.options, !0), u;
|
|
1288
1288
|
}
|
|
1289
1289
|
const a = ae(n);
|
|
1290
|
-
if (a instanceof Map &&
|
|
1290
|
+
if (a instanceof Map && Vs.includes(e)) {
|
|
1291
1291
|
if (e === "size")
|
|
1292
1292
|
return Object.getOwnPropertyDescriptor(Qt, "size").get.call(n.proxy);
|
|
1293
1293
|
const u = Qt[e];
|
|
1294
1294
|
if (u)
|
|
1295
1295
|
return u.bind(n.proxy);
|
|
1296
1296
|
}
|
|
1297
|
-
if (a instanceof Set &&
|
|
1297
|
+
if (a instanceof Set && Bs.includes(e)) {
|
|
1298
1298
|
if (e === "size")
|
|
1299
1299
|
return Object.getOwnPropertyDescriptor(gt, "size").get.call(n.proxy);
|
|
1300
1300
|
const u = gt[e];
|
|
1301
1301
|
if (u)
|
|
1302
1302
|
return u.bind(n.proxy);
|
|
1303
1303
|
}
|
|
1304
|
-
if (!
|
|
1304
|
+
if (!Ye(a, e)) {
|
|
1305
1305
|
const u = Ln(a, e);
|
|
1306
1306
|
return u ? "value" in u ? u.value : (
|
|
1307
1307
|
// !case: support for getter
|
|
@@ -1337,7 +1337,7 @@ const Vs = Reflect.ownKeys(gt), Ar = /* @__PURE__ */ new WeakSet(), Or = {
|
|
|
1337
1337
|
if (i != null && i.set)
|
|
1338
1338
|
return i.set.call(n.proxy, t), !0;
|
|
1339
1339
|
const o = jt(ae(n), e), a = M(o);
|
|
1340
|
-
return a && Te(a.original, t) ? (n.copy[e] = t, n.assignedMap = (r = n.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), n.assignedMap.set(e, !1), !0) : (Te(t, o) && (t !== void 0 ||
|
|
1340
|
+
return a && Te(a.original, t) ? (n.copy[e] = t, n.assignedMap = (r = n.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), n.assignedMap.set(e, !1), !0) : (Te(t, o) && (t !== void 0 || Ye(n.original, e)) || (X(n), ge(n), Ye(n.original, e) && Te(t, n.original[e]) ? n.assignedMap.delete(e) : n.assignedMap.set(e, !0), n.copy[e] = t, hn(n, e, t, et)), !0);
|
|
1341
1341
|
},
|
|
1342
1342
|
has(n, e) {
|
|
1343
1343
|
return e in ae(n);
|
|
@@ -1365,7 +1365,7 @@ const Vs = Reflect.ownKeys(gt), Ar = /* @__PURE__ */ new WeakSet(), Or = {
|
|
|
1365
1365
|
},
|
|
1366
1366
|
deleteProperty(n, e) {
|
|
1367
1367
|
var t;
|
|
1368
|
-
return n.type === 1 ?
|
|
1368
|
+
return n.type === 1 ? Er.set.call(this, n, e, void 0, n.proxy) : (jt(n.original, e) !== void 0 || e in n.original ? (X(n), ge(n), n.assignedMap.set(e, !1)) : (n.assignedMap = (t = n.assignedMap) !== null && t !== void 0 ? t : /* @__PURE__ */ new Map(), n.assignedMap.delete(e)), n.copy && delete n.copy[e], !0);
|
|
1369
1369
|
}
|
|
1370
1370
|
};
|
|
1371
1371
|
function pn(n) {
|
|
@@ -1382,8 +1382,8 @@ function pn(n) {
|
|
|
1382
1382
|
setMap: o === 3 ? new Map(e.entries()) : void 0
|
|
1383
1383
|
};
|
|
1384
1384
|
(r || "key" in n) && (a.key = r);
|
|
1385
|
-
const { proxy: c, revoke: u } = Proxy.revocable(o === 1 ? Object.assign([], a) : a,
|
|
1386
|
-
if (s.revoke.push(u),
|
|
1385
|
+
const { proxy: c, revoke: u } = Proxy.revocable(o === 1 ? Object.assign([], a) : a, Er);
|
|
1386
|
+
if (s.revoke.push(u), Or.add(c), a.proxy = c, t) {
|
|
1387
1387
|
const l = t;
|
|
1388
1388
|
l.finalities.draft.push((f, p) => {
|
|
1389
1389
|
var y, b;
|
|
@@ -1407,7 +1407,7 @@ function pn(n) {
|
|
|
1407
1407
|
return c;
|
|
1408
1408
|
}
|
|
1409
1409
|
cn.createDraft = pn;
|
|
1410
|
-
function
|
|
1410
|
+
function Qs(n, e, t, r, s) {
|
|
1411
1411
|
var i;
|
|
1412
1412
|
const o = M(n), a = (i = o == null ? void 0 : o.original) !== null && i !== void 0 ? i : n, c = !!e.length;
|
|
1413
1413
|
if (o != null && o.operated)
|
|
@@ -1420,7 +1420,7 @@ function Bs(n, e, t, r, s) {
|
|
|
1420
1420
|
r && c ? [{ op: K.Replace, path: [], value: a }] : r
|
|
1421
1421
|
];
|
|
1422
1422
|
}
|
|
1423
|
-
function
|
|
1423
|
+
function Gs(n, e) {
|
|
1424
1424
|
var t;
|
|
1425
1425
|
const r = {
|
|
1426
1426
|
draft: [],
|
|
@@ -1438,7 +1438,7 @@ function Qs(n, e) {
|
|
|
1438
1438
|
return [
|
|
1439
1439
|
a,
|
|
1440
1440
|
(c = []) => {
|
|
1441
|
-
const [u, l, f] =
|
|
1441
|
+
const [u, l, f] = Qs(a, c, s, i, e.enableAutoFreeze);
|
|
1442
1442
|
return e.enablePatches ? [u, l, f] : u;
|
|
1443
1443
|
}
|
|
1444
1444
|
];
|
|
@@ -1458,7 +1458,7 @@ function Gt(n) {
|
|
|
1458
1458
|
} else typeof o == "object" && o !== null && (n.value = o, n.isRoot = !1, Gt(n));
|
|
1459
1459
|
}), s && (n.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."));
|
|
1460
1460
|
}
|
|
1461
|
-
function
|
|
1461
|
+
function kr(n) {
|
|
1462
1462
|
var e;
|
|
1463
1463
|
const t = M(n);
|
|
1464
1464
|
if (!ye(n, t == null ? void 0 : t.options))
|
|
@@ -1468,7 +1468,7 @@ function Er(n) {
|
|
|
1468
1468
|
return t.original;
|
|
1469
1469
|
let s;
|
|
1470
1470
|
function i() {
|
|
1471
|
-
s = r === 2 ? ln(n) ? new Map(n) : new (Object.getPrototypeOf(n)).constructor(n) : r === 3 ? Array.from(t.setMap.values()) :
|
|
1471
|
+
s = r === 2 ? ln(n) ? new Map(n) : new (Object.getPrototypeOf(n)).constructor(n) : r === 3 ? Array.from(t.setMap.values()) : vr(n, t == null ? void 0 : t.options);
|
|
1472
1472
|
}
|
|
1473
1473
|
if (t) {
|
|
1474
1474
|
t.finalized = !0;
|
|
@@ -1482,7 +1482,7 @@ function Er(n) {
|
|
|
1482
1482
|
if (dn(s, (o, a) => {
|
|
1483
1483
|
if (t && Te(Se(t.original, o), a))
|
|
1484
1484
|
return;
|
|
1485
|
-
const c =
|
|
1485
|
+
const c = kr(a);
|
|
1486
1486
|
c !== a && (s === n && i(), tt(s, o, c));
|
|
1487
1487
|
}), r === 3) {
|
|
1488
1488
|
const o = (e = t == null ? void 0 : t.original) !== null && e !== void 0 ? e : s;
|
|
@@ -1493,9 +1493,9 @@ function Er(n) {
|
|
|
1493
1493
|
function Kn(n) {
|
|
1494
1494
|
if (!Me(n))
|
|
1495
1495
|
throw new Error(`current() is only used for Draft, parameter: ${n}`);
|
|
1496
|
-
return
|
|
1496
|
+
return kr(n);
|
|
1497
1497
|
}
|
|
1498
|
-
const
|
|
1498
|
+
const Hs = (n) => function e(t, r, s) {
|
|
1499
1499
|
var i, o, a;
|
|
1500
1500
|
if (typeof t == "function" && typeof r != "function")
|
|
1501
1501
|
return function(v, ...k) {
|
|
@@ -1522,7 +1522,7 @@ const Gs = (n) => function e(t, r, s) {
|
|
|
1522
1522
|
};
|
|
1523
1523
|
if (!ye(f, T) && typeof f == "object" && f !== null)
|
|
1524
1524
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
1525
|
-
const [S, _] =
|
|
1525
|
+
const [S, _] = Gs(f, T);
|
|
1526
1526
|
if (typeof r != "function") {
|
|
1527
1527
|
if (!ye(f, T))
|
|
1528
1528
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
@@ -1539,7 +1539,7 @@ const Gs = (n) => function e(t, r, s) {
|
|
|
1539
1539
|
if (!Me(v)) {
|
|
1540
1540
|
if (v !== void 0 && !Te(v, S) && (k != null && k.operated))
|
|
1541
1541
|
throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");
|
|
1542
|
-
const x = v == null ? void 0 : v[
|
|
1542
|
+
const x = v == null ? void 0 : v[Us];
|
|
1543
1543
|
if (x) {
|
|
1544
1544
|
const z = x[0];
|
|
1545
1545
|
return T.strict && typeof v == "object" && v !== null && Gt({
|
|
@@ -1564,9 +1564,9 @@ const Gs = (n) => function e(t, r, s) {
|
|
|
1564
1564
|
return w instanceof Promise ? w.then(C, (v) => {
|
|
1565
1565
|
throw zt(M(S)), v;
|
|
1566
1566
|
}) : C(w);
|
|
1567
|
-
}, mt =
|
|
1567
|
+
}, mt = Hs();
|
|
1568
1568
|
Object.prototype.constructor.toString();
|
|
1569
|
-
function
|
|
1569
|
+
function Cr(n, e) {
|
|
1570
1570
|
const t = Object.keys(n), r = Object.keys(e);
|
|
1571
1571
|
return t.length === r.length && Object.keys(n).every((s) => e.hasOwnProperty(s));
|
|
1572
1572
|
}
|
|
@@ -1574,18 +1574,18 @@ function qn(n, e) {
|
|
|
1574
1574
|
return Object.keys(n).length === Object.keys(e).length && Object.keys(n).every((t) => e.hasOwnProperty(t) && n[t] === e[t]);
|
|
1575
1575
|
}
|
|
1576
1576
|
function yt(n, e) {
|
|
1577
|
-
return typeof n != "object" || typeof e != "object" || n === null || e === null ? n === e :
|
|
1577
|
+
return typeof n != "object" || typeof e != "object" || n === null || e === null ? n === e : Cr(n, e) ? Object.keys(n).every((t) => yt(n[t], e[t])) : !1;
|
|
1578
1578
|
}
|
|
1579
1579
|
function yn(n) {
|
|
1580
|
-
if (!
|
|
1580
|
+
if (!Ge(n))
|
|
1581
1581
|
return n;
|
|
1582
1582
|
const e = {};
|
|
1583
1583
|
for (const [t, r] of Object.entries(n))
|
|
1584
1584
|
r !== void 0 && (e[t] = r);
|
|
1585
1585
|
return e;
|
|
1586
1586
|
}
|
|
1587
|
-
function
|
|
1588
|
-
if (!
|
|
1587
|
+
function Ir(n, e) {
|
|
1588
|
+
if (!Ge(n) || !Ge(e))
|
|
1589
1589
|
return e;
|
|
1590
1590
|
const t = { ...n };
|
|
1591
1591
|
for (const r of Object.keys(e)) {
|
|
@@ -1595,15 +1595,15 @@ function Cr(n, e) {
|
|
|
1595
1595
|
delete t[r];
|
|
1596
1596
|
continue;
|
|
1597
1597
|
}
|
|
1598
|
-
const s =
|
|
1599
|
-
t[r] = s ?
|
|
1598
|
+
const s = Ge(n[r]) && Ge(e[r]);
|
|
1599
|
+
t[r] = s ? Ir(n[r], e[r]) : e[r];
|
|
1600
1600
|
}
|
|
1601
1601
|
return t;
|
|
1602
1602
|
}
|
|
1603
|
-
function
|
|
1603
|
+
function Ge(n) {
|
|
1604
1604
|
return typeof n == "object" && n !== null && !Array.isArray(n);
|
|
1605
1605
|
}
|
|
1606
|
-
function
|
|
1606
|
+
function Js(n, e, t) {
|
|
1607
1607
|
if (!n || e.length === 0)
|
|
1608
1608
|
return;
|
|
1609
1609
|
let r = n || {};
|
|
@@ -1624,7 +1624,7 @@ function Wn(n, e, t) {
|
|
|
1624
1624
|
}
|
|
1625
1625
|
r[e[e.length - 1]] = t;
|
|
1626
1626
|
}
|
|
1627
|
-
function
|
|
1627
|
+
function Pr(n, e) {
|
|
1628
1628
|
if (!n || e.length === 0)
|
|
1629
1629
|
return;
|
|
1630
1630
|
const [t, ...r] = e;
|
|
@@ -1633,13 +1633,13 @@ function Ir(n, e) {
|
|
|
1633
1633
|
Array.isArray(n) ? n.splice(t, 1) : delete n[t];
|
|
1634
1634
|
return;
|
|
1635
1635
|
}
|
|
1636
|
-
|
|
1636
|
+
Pr(n[t], r), Ys(n[t]) && delete n[t];
|
|
1637
1637
|
}
|
|
1638
1638
|
}
|
|
1639
|
-
function
|
|
1639
|
+
function Ys(n) {
|
|
1640
1640
|
return n && Object.keys(n).length === 0;
|
|
1641
1641
|
}
|
|
1642
|
-
const zn = /ZULU|YEKT|YEKST|YAPT|YAKT|YAKST|XJT|WGT|WGST|WFT|WETDST|WET|WDT|WAT|WAST|WAKT|WADT|VUT|VOLT|VLAT|VLAST|VET|UZT|UZST|UYT|UYST|UTC|UT|ULAT|ULAST|UCT|TVT|TRUT|TOT|TMT|TKT|TJT|TFT|TAHT|SGT|SCT|SAST|SADT|RET|PYT|PYST|PWT|PST|PONT|PMST|PMDT|PKT|PKST|PHT|PGT|PETT|PETST|PET|PDT|OMST|OMSST|NZT|NZST|NZDT|NUT|NST|NPT|NOVT|NOVST|NFT|NDT|MYT|MVT|MUT|MUST|MST|MSK|MSD|MPT|MMT|MHT|MEZ|METDST|MET|MESZ|MEST|MDT|MAWT|MART|MAGT|MAGST|LKT|LINT|LIGT|LHST|LHDT|KST|KRAT|KRAST|KOST|KGT|KGST|KDT|JST|JAYT|IST|IRT|IRKT|IRKST|IOT|IDT|ICT|HST|HKT|GYT|GMT|GILT|GFT|GET|GEST|GAMT|GALT|FNT|FNST|FKT|FKST|FJT|FJST|FET|EST|EGT|EGST|EETDST|EET|EEST|EDT|EAT|EAST|EASST|DDUT|DAVT|CXT|CST|COT|CLT|CLST|CKT|CHUT|CHAST|CHADT|CETDST|CET|CEST|CDT|CCT|CAST|CADT|BTT|BST|BRT|BRST|BRA|BOT|BORT|BNT|BDT|BDST|AZT|AZST|AZOT|AZOST|AWST|AWSST|AST|ART|ARST|ANAT|ANAST|AMT|AMST|ALMT|ALMST|AKST|AKDT|AFT|AEST|AESST|AEDT|ADT|ACWST|ACT|ACST|ACSST|ACDT$/,
|
|
1642
|
+
const zn = /ZULU|YEKT|YEKST|YAPT|YAKT|YAKST|XJT|WGT|WGST|WFT|WETDST|WET|WDT|WAT|WAST|WAKT|WADT|VUT|VOLT|VLAT|VLAST|VET|UZT|UZST|UYT|UYST|UTC|UT|ULAT|ULAST|UCT|TVT|TRUT|TOT|TMT|TKT|TJT|TFT|TAHT|SGT|SCT|SAST|SADT|RET|PYT|PYST|PWT|PST|PONT|PMST|PMDT|PKT|PKST|PHT|PGT|PETT|PETST|PET|PDT|OMST|OMSST|NZT|NZST|NZDT|NUT|NST|NPT|NOVT|NOVST|NFT|NDT|MYT|MVT|MUT|MUST|MST|MSK|MSD|MPT|MMT|MHT|MEZ|METDST|MET|MESZ|MEST|MDT|MAWT|MART|MAGT|MAGST|LKT|LINT|LIGT|LHST|LHDT|KST|KRAT|KRAST|KOST|KGT|KGST|KDT|JST|JAYT|IST|IRT|IRKT|IRKST|IOT|IDT|ICT|HST|HKT|GYT|GMT|GILT|GFT|GET|GEST|GAMT|GALT|FNT|FNST|FKT|FKST|FJT|FJST|FET|EST|EGT|EGST|EETDST|EET|EEST|EDT|EAT|EAST|EASST|DDUT|DAVT|CXT|CST|COT|CLT|CLST|CKT|CHUT|CHAST|CHADT|CETDST|CET|CEST|CDT|CCT|CAST|CADT|BTT|BST|BRT|BRST|BRA|BOT|BORT|BNT|BDT|BDST|AZT|AZST|AZOT|AZOST|AWST|AWSST|AST|ART|ARST|ANAT|ANAST|AMT|AMST|ALMT|ALMST|AKST|AKDT|AFT|AEST|AESST|AEDT|ADT|ACWST|ACT|ACST|ACSST|ACDT$/, Zs = {
|
|
1643
1643
|
ZULU: 0,
|
|
1644
1644
|
YEKT: 18e3,
|
|
1645
1645
|
YEKST: 21600,
|
|
@@ -1835,39 +1835,39 @@ const zn = /ZULU|YEKT|YEKST|YAPT|YAKT|YAKST|XJT|WGT|WGST|WFT|WETDST|WET|WDT|WAT|
|
|
|
1835
1835
|
ACSST: 37800,
|
|
1836
1836
|
ACDT: 37800
|
|
1837
1837
|
};
|
|
1838
|
-
function
|
|
1838
|
+
function Xs(n) {
|
|
1839
1839
|
return new Date(n);
|
|
1840
1840
|
}
|
|
1841
|
-
function
|
|
1841
|
+
function ei(n) {
|
|
1842
1842
|
return /* @__PURE__ */ new Date(n + "Z");
|
|
1843
1843
|
}
|
|
1844
|
-
const
|
|
1845
|
-
function
|
|
1846
|
-
const e = n.match(
|
|
1844
|
+
const ti = /^(\d+)[\./-](\d+)[\./-](\d+)$/;
|
|
1845
|
+
function ni(n) {
|
|
1846
|
+
const e = n.match(ti);
|
|
1847
1847
|
if (!e)
|
|
1848
1848
|
return null;
|
|
1849
1849
|
const [t, r, s, i] = e;
|
|
1850
1850
|
return r <= 0 || s <= 0 || i <= 0 ? null : r > 999 ? new Date(Date.UTC(r, s - 1, i, 0, 0, 0, 0)) : new Date(Date.UTC(i, r - 1, s, 0, 0, 0, 0));
|
|
1851
1851
|
}
|
|
1852
|
-
function
|
|
1852
|
+
function ri(n) {
|
|
1853
1853
|
const [e, t] = n.split(" ");
|
|
1854
1854
|
return /* @__PURE__ */ new Date(e + "T" + t + "Z");
|
|
1855
1855
|
}
|
|
1856
|
-
function
|
|
1856
|
+
function si(n) {
|
|
1857
1857
|
const [e, t] = n.split(" ");
|
|
1858
1858
|
return /* @__PURE__ */ new Date(e + "T" + t + "Z");
|
|
1859
1859
|
}
|
|
1860
|
-
function
|
|
1860
|
+
function ii(n) {
|
|
1861
1861
|
return new Date(n);
|
|
1862
1862
|
}
|
|
1863
|
-
function
|
|
1863
|
+
function oi(n) {
|
|
1864
1864
|
const e = /^(\w{3}) (\w{3}) (\d{2}) (\d{4})$/;
|
|
1865
1865
|
if (!n.match(e))
|
|
1866
1866
|
throw new Error(`Unable to parse \`${n}\` as a date.`);
|
|
1867
1867
|
const r = /* @__PURE__ */ new Date(n + " UTC");
|
|
1868
1868
|
return new Date(Date.UTC(r.getUTCFullYear(), r.getUTCMonth(), r.getUTCDate(), 0, 0, 0, 0));
|
|
1869
1869
|
}
|
|
1870
|
-
function
|
|
1870
|
+
function ai(n) {
|
|
1871
1871
|
const e = /^(.+T.+)([+-])(\d{2})$/, t = n.match(e);
|
|
1872
1872
|
if (t) {
|
|
1873
1873
|
const [, r, s, i] = t, o = `${r}${s}${i}:00`;
|
|
@@ -1875,7 +1875,7 @@ function oi(n) {
|
|
|
1875
1875
|
}
|
|
1876
1876
|
return null;
|
|
1877
1877
|
}
|
|
1878
|
-
function
|
|
1878
|
+
function ci(n) {
|
|
1879
1879
|
const e = /^(\d+)-(\d{1,2})-(\d{1,2})([ T])(.+)$/, t = n.match(e);
|
|
1880
1880
|
if (t) {
|
|
1881
1881
|
const [, r, s, i, o, a] = t, c = s.padStart(2, "0"), u = i.padStart(2, "0"), l = `${r}-${c}-${u}T${a}`;
|
|
@@ -1883,14 +1883,14 @@ function ai(n) {
|
|
|
1883
1883
|
}
|
|
1884
1884
|
return null;
|
|
1885
1885
|
}
|
|
1886
|
-
function
|
|
1886
|
+
function ui(n) {
|
|
1887
1887
|
const [e, t] = n.split(", "), [r, s, i] = e.split("/").map(Number), o = t.match(/(\d{1,2}):(\d{2}):(\d{2}) (AM|PM)/);
|
|
1888
1888
|
if (!o)
|
|
1889
1889
|
throw new Error(`Unable to parse time from: ${n}`);
|
|
1890
1890
|
let [, a, c, u, l] = o;
|
|
1891
1891
|
return a = Number(a), c = Number(c), u = Number(u), l === "PM" && a !== 12 ? a += 12 : l === "AM" && a === 12 && (a = 0), new Date(Date.UTC(i, r - 1, s, a, c, u));
|
|
1892
1892
|
}
|
|
1893
|
-
function
|
|
1893
|
+
function li(n) {
|
|
1894
1894
|
switch (n) {
|
|
1895
1895
|
case "epoch":
|
|
1896
1896
|
return /* @__PURE__ */ new Date(0);
|
|
@@ -1902,28 +1902,28 @@ function ui(n) {
|
|
|
1902
1902
|
return null;
|
|
1903
1903
|
}
|
|
1904
1904
|
}
|
|
1905
|
-
function
|
|
1905
|
+
function fi(n) {
|
|
1906
1906
|
const e = n.match(zn);
|
|
1907
1907
|
if (!e)
|
|
1908
1908
|
return null;
|
|
1909
|
-
const [t] = e, r =
|
|
1909
|
+
const [t] = e, r = Zs[t], s = new Date(n.replace(zn, "Z"));
|
|
1910
1910
|
return new Date(s.getTime() - r * 1e3);
|
|
1911
1911
|
}
|
|
1912
|
-
const
|
|
1913
|
-
|
|
1914
|
-
ri,
|
|
1915
|
-
ii,
|
|
1916
|
-
ci,
|
|
1912
|
+
const di = [
|
|
1913
|
+
ni,
|
|
1917
1914
|
si,
|
|
1918
|
-
Xs,
|
|
1919
1915
|
oi,
|
|
1920
|
-
ni,
|
|
1921
|
-
Zs,
|
|
1922
1916
|
ui,
|
|
1917
|
+
ii,
|
|
1918
|
+
ei,
|
|
1919
|
+
ai,
|
|
1920
|
+
ri,
|
|
1921
|
+
Xs,
|
|
1923
1922
|
li,
|
|
1924
|
-
|
|
1923
|
+
fi,
|
|
1924
|
+
ci
|
|
1925
1925
|
];
|
|
1926
|
-
function
|
|
1926
|
+
function hi(n, e) {
|
|
1927
1927
|
try {
|
|
1928
1928
|
const t = n(e);
|
|
1929
1929
|
return t instanceof Date && !isNaN(t.getTime()) ? t : null;
|
|
@@ -1932,14 +1932,14 @@ function di(n, e) {
|
|
|
1932
1932
|
}
|
|
1933
1933
|
}
|
|
1934
1934
|
function Ht(n) {
|
|
1935
|
-
for (const e of
|
|
1936
|
-
const t =
|
|
1935
|
+
for (const e of di) {
|
|
1936
|
+
const t = hi(e, n);
|
|
1937
1937
|
if (t)
|
|
1938
1938
|
return t;
|
|
1939
1939
|
}
|
|
1940
1940
|
return null;
|
|
1941
1941
|
}
|
|
1942
|
-
function
|
|
1942
|
+
function pi(n) {
|
|
1943
1943
|
try {
|
|
1944
1944
|
const e = JSON.parse(n);
|
|
1945
1945
|
return typeof e == "string" ? Ht(e) : null;
|
|
@@ -1954,7 +1954,7 @@ function St(n) {
|
|
|
1954
1954
|
if (n instanceof Date)
|
|
1955
1955
|
return n;
|
|
1956
1956
|
if (typeof n == "string") {
|
|
1957
|
-
const e = Ht(n) ||
|
|
1957
|
+
const e = Ht(n) || pi(n) || Ht(n.trim());
|
|
1958
1958
|
if (!e)
|
|
1959
1959
|
throw new Error(`Unable to parse \`${n}\` as a date.`);
|
|
1960
1960
|
return e;
|
|
@@ -2038,7 +2038,7 @@ class Ie {
|
|
|
2038
2038
|
return { attrs: this.attrs, linkIndex: this.linkIndex };
|
|
2039
2039
|
}
|
|
2040
2040
|
}
|
|
2041
|
-
function
|
|
2041
|
+
function yi(n) {
|
|
2042
2042
|
return n.cardinality === "one";
|
|
2043
2043
|
}
|
|
2044
2044
|
function bn(n) {
|
|
@@ -2047,7 +2047,7 @@ function bn(n) {
|
|
|
2047
2047
|
function _n(n) {
|
|
2048
2048
|
return n["value-type"] === "blob";
|
|
2049
2049
|
}
|
|
2050
|
-
function
|
|
2050
|
+
function qe(n, e) {
|
|
2051
2051
|
return e.reduce((t, r) => t && t.get(r), n);
|
|
2052
2052
|
}
|
|
2053
2053
|
function pe(n, e) {
|
|
@@ -2070,7 +2070,7 @@ function se(n, e, t) {
|
|
|
2070
2070
|
}
|
|
2071
2071
|
s > -1 && r.set(e[s], t);
|
|
2072
2072
|
}
|
|
2073
|
-
function
|
|
2073
|
+
function Mr(n, e, t) {
|
|
2074
2074
|
const r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
|
|
2075
2075
|
for (const o of e) {
|
|
2076
2076
|
let [a, c, u] = o;
|
|
@@ -2083,7 +2083,7 @@ function Pr(n, e, t) {
|
|
|
2083
2083
|
}
|
|
2084
2084
|
return { eav: r, aev: s, vae: i };
|
|
2085
2085
|
}
|
|
2086
|
-
function
|
|
2086
|
+
function Rr(n) {
|
|
2087
2087
|
return {
|
|
2088
2088
|
triples: ie(n.eav, 3),
|
|
2089
2089
|
cardinalityInference: n.cardinalityInference,
|
|
@@ -2091,20 +2091,20 @@ function Mr(n) {
|
|
|
2091
2091
|
version: 1
|
|
2092
2092
|
};
|
|
2093
2093
|
}
|
|
2094
|
-
function Rr(n, e) {
|
|
2095
|
-
return Ge(n, e.triples, e.cardinalityInference, e.useDateObjects);
|
|
2096
|
-
}
|
|
2097
2094
|
function jr(n, e) {
|
|
2095
|
+
return He(n, e.triples, e.cardinalityInference, e.useDateObjects);
|
|
2096
|
+
}
|
|
2097
|
+
function Dr(n, e) {
|
|
2098
2098
|
if (n)
|
|
2099
2099
|
return new Ie(n.attrs, n.linkIndex);
|
|
2100
2100
|
if (e && "__type" in e)
|
|
2101
2101
|
return new Ie(e.attrs, e.linkIndex);
|
|
2102
2102
|
}
|
|
2103
|
-
function
|
|
2104
|
-
return
|
|
2103
|
+
function bi(n, e) {
|
|
2104
|
+
return qe(n.eav, [e]) !== void 0;
|
|
2105
2105
|
}
|
|
2106
|
-
function
|
|
2107
|
-
const s =
|
|
2106
|
+
function He(n, e, t, r) {
|
|
2107
|
+
const s = Mr(n, e, r);
|
|
2108
2108
|
return s.cardinalityInference = t, s.useDateObjects = r, s;
|
|
2109
2109
|
}
|
|
2110
2110
|
function nt(n, e) {
|
|
@@ -2134,21 +2134,21 @@ function nt(n, e) {
|
|
|
2134
2134
|
return [t, ...a];
|
|
2135
2135
|
}
|
|
2136
2136
|
}
|
|
2137
|
-
function
|
|
2137
|
+
function $r(n, e, t) {
|
|
2138
2138
|
const r = nt(n, t);
|
|
2139
2139
|
if (!r)
|
|
2140
2140
|
return;
|
|
2141
2141
|
const [s, i, o] = r, a = e.getAttr(i);
|
|
2142
2142
|
a && (pe(n.eav, [s, i, o]), pe(n.aev, [i, s, o]), bn(a) && pe(n.vae, [o, i, s]));
|
|
2143
2143
|
}
|
|
2144
|
-
let
|
|
2145
|
-
function
|
|
2144
|
+
let _i = 0;
|
|
2145
|
+
function xr(n, e, t) {
|
|
2146
2146
|
const [r, s, i] = t;
|
|
2147
2147
|
let o;
|
|
2148
|
-
const a =
|
|
2149
|
-
return a && (o = a[3]), o || Date.now() * 10 +
|
|
2148
|
+
const a = qe(n.eav, [r, s, i]);
|
|
2149
|
+
return a && (o = a[3]), o || Date.now() * 10 + _i++;
|
|
2150
2150
|
}
|
|
2151
|
-
function
|
|
2151
|
+
function Ur(n, e, t) {
|
|
2152
2152
|
const r = nt(n, t);
|
|
2153
2153
|
if (!r)
|
|
2154
2154
|
return;
|
|
@@ -2157,10 +2157,10 @@ function xr(n, e, t) {
|
|
|
2157
2157
|
if (!a)
|
|
2158
2158
|
return;
|
|
2159
2159
|
a["checked-data-type"] === "date" && n.useDateObjects && (o = St(o));
|
|
2160
|
-
const c =
|
|
2161
|
-
|
|
2160
|
+
const c = qe(n.eav, [s, i, o]), u = (c == null ? void 0 : c[3]) ?? xr(n, a, r), l = [s, i, o, u];
|
|
2161
|
+
yi(a) ? (se(n.eav, [s, i], /* @__PURE__ */ new Map([[o, l]])), se(n.aev, [i, s], /* @__PURE__ */ new Map([[o, l]]))) : (se(n.eav, [s, i, o], l), se(n.aev, [i, s, o], l)), bn(a) && se(n.vae, [o, i, s], l);
|
|
2162
2162
|
}
|
|
2163
|
-
function
|
|
2163
|
+
function gi(n, e, t) {
|
|
2164
2164
|
var y;
|
|
2165
2165
|
const r = nt(n, t);
|
|
2166
2166
|
if (!r)
|
|
@@ -2170,17 +2170,17 @@ function _i(n, e, t) {
|
|
|
2170
2170
|
return;
|
|
2171
2171
|
if (!_n(a))
|
|
2172
2172
|
throw new Error("merge operation is not supported for links");
|
|
2173
|
-
const c =
|
|
2173
|
+
const c = qe(n.eav, [s, i]);
|
|
2174
2174
|
if (!c)
|
|
2175
2175
|
return;
|
|
2176
2176
|
const u = (y = c.values().next()) == null ? void 0 : y.value;
|
|
2177
2177
|
if (!u)
|
|
2178
2178
|
return;
|
|
2179
|
-
const l = u[2], f =
|
|
2179
|
+
const l = u[2], f = Ir(l, o), p = [
|
|
2180
2180
|
s,
|
|
2181
2181
|
i,
|
|
2182
2182
|
f,
|
|
2183
|
-
|
|
2183
|
+
xr(n, a, u)
|
|
2184
2184
|
];
|
|
2185
2185
|
se(n.eav, [s, i], /* @__PURE__ */ new Map([[f, p]])), se(n.aev, [i, s], /* @__PURE__ */ new Map([[f, p]]));
|
|
2186
2186
|
}
|
|
@@ -2211,50 +2211,50 @@ function Jt(n, e, t) {
|
|
|
2211
2211
|
(!s || !g || ((T = g["reverse-identity"]) == null ? void 0 : T[1]) === s) && (pe(n.eav, [p, y, b]), pe(n.aev, [y, p, b]), pe(n.vae, [b, y, p])), g && g["on-delete"] === "cascade" && ((S = g["reverse-identity"]) == null ? void 0 : S[1]) === s && Jt(n, e, [p, (_ = g["forward-identity"]) == null ? void 0 : _[1]]);
|
|
2212
2212
|
}), ((l = n.vae.get(o)) == null ? void 0 : l.size) === 0 && pe(n.vae, [o]);
|
|
2213
2213
|
}
|
|
2214
|
-
function
|
|
2215
|
-
const r =
|
|
2214
|
+
function Lr(n, e, t) {
|
|
2215
|
+
const r = Mr(e, t, n.useDateObjects);
|
|
2216
2216
|
Object.keys(r).forEach((s) => {
|
|
2217
2217
|
n[s] = r[s];
|
|
2218
2218
|
});
|
|
2219
2219
|
}
|
|
2220
|
-
function
|
|
2220
|
+
function mi(n, [e]) {
|
|
2221
2221
|
n.addAttr(e);
|
|
2222
2222
|
}
|
|
2223
|
-
function
|
|
2223
|
+
function Fr(n) {
|
|
2224
2224
|
return ie(n.eav, 3);
|
|
2225
2225
|
}
|
|
2226
|
-
function
|
|
2226
|
+
function wi(n, e, [t]) {
|
|
2227
2227
|
if (!e.getAttr(t))
|
|
2228
2228
|
return;
|
|
2229
|
-
const r =
|
|
2230
|
-
e.deleteAttr(t),
|
|
2229
|
+
const r = Fr(n).filter(([s, i]) => i !== t);
|
|
2230
|
+
e.deleteAttr(t), Lr(n, e, r);
|
|
2231
2231
|
}
|
|
2232
|
-
function
|
|
2233
|
-
e.getAttr(t.id) && (e.updateAttr(t),
|
|
2232
|
+
function Ti(n, e, [t]) {
|
|
2233
|
+
e.getAttr(t.id) && (e.updateAttr(t), Lr(n, e, Fr(n)));
|
|
2234
2234
|
}
|
|
2235
|
-
function
|
|
2235
|
+
function Si(n, e, t) {
|
|
2236
2236
|
const [r, ...s] = t;
|
|
2237
2237
|
switch (r) {
|
|
2238
2238
|
case "add-triple":
|
|
2239
|
-
|
|
2239
|
+
Ur(n, e, s);
|
|
2240
2240
|
break;
|
|
2241
2241
|
case "deep-merge-triple":
|
|
2242
|
-
|
|
2242
|
+
gi(n, e, s);
|
|
2243
2243
|
break;
|
|
2244
2244
|
case "retract-triple":
|
|
2245
|
-
|
|
2245
|
+
$r(n, e, s);
|
|
2246
2246
|
break;
|
|
2247
2247
|
case "delete-entity":
|
|
2248
2248
|
Jt(n, e, s);
|
|
2249
2249
|
break;
|
|
2250
2250
|
case "add-attr":
|
|
2251
|
-
|
|
2251
|
+
mi(e, s);
|
|
2252
2252
|
break;
|
|
2253
2253
|
case "delete-attr":
|
|
2254
|
-
|
|
2254
|
+
wi(n, e, s);
|
|
2255
2255
|
break;
|
|
2256
2256
|
case "update-attr":
|
|
2257
|
-
|
|
2257
|
+
Ti(n, e, s);
|
|
2258
2258
|
break;
|
|
2259
2259
|
case "restore-attr":
|
|
2260
2260
|
break;
|
|
@@ -2309,13 +2309,13 @@ function ut(n, e, t) {
|
|
|
2309
2309
|
}
|
|
2310
2310
|
return r;
|
|
2311
2311
|
}
|
|
2312
|
-
function
|
|
2312
|
+
function vi(n, e, t) {
|
|
2313
2313
|
let r = "";
|
|
2314
2314
|
return n !== void 0 && (r += "e"), e !== void 0 && (r += "a"), t !== void 0 && (r += "v"), r;
|
|
2315
2315
|
}
|
|
2316
|
-
function
|
|
2316
|
+
function Ai(n, [e, t, r]) {
|
|
2317
2317
|
var i, o;
|
|
2318
|
-
switch (
|
|
2318
|
+
switch (vi(e, t, r)) {
|
|
2319
2319
|
case "e": {
|
|
2320
2320
|
const a = n.eav.get(e);
|
|
2321
2321
|
return ie(a, 2);
|
|
@@ -2361,7 +2361,7 @@ function vi(n, [e, t, r]) {
|
|
|
2361
2361
|
return ie(n.eav, 3);
|
|
2362
2362
|
}
|
|
2363
2363
|
}
|
|
2364
|
-
function
|
|
2364
|
+
function Oi(n, e, t) {
|
|
2365
2365
|
var s;
|
|
2366
2366
|
const r = {};
|
|
2367
2367
|
if (!e)
|
|
@@ -2381,23 +2381,23 @@ function je(n, e, t) {
|
|
|
2381
2381
|
var r;
|
|
2382
2382
|
return (r = n.revIdents.get(e)) == null ? void 0 : r.get(t);
|
|
2383
2383
|
}
|
|
2384
|
-
function
|
|
2384
|
+
function Ei(n, e) {
|
|
2385
2385
|
return n.blobAttrs.get(e);
|
|
2386
2386
|
}
|
|
2387
|
-
function
|
|
2387
|
+
function Nr(n, e) {
|
|
2388
2388
|
var r;
|
|
2389
2389
|
const t = n.primaryKeys.get(e);
|
|
2390
2390
|
return t || ((r = n.forwardIdents.get(e)) == null ? void 0 : r.get("id"));
|
|
2391
2391
|
}
|
|
2392
|
-
function
|
|
2392
|
+
function ki(n, e, t) {
|
|
2393
2393
|
const r = nt(n, t);
|
|
2394
2394
|
if (!r)
|
|
2395
2395
|
return;
|
|
2396
2396
|
const [s, i, o] = r;
|
|
2397
2397
|
if (e.getAttr(i))
|
|
2398
|
-
return
|
|
2398
|
+
return qe(n.eav, [s, i]);
|
|
2399
2399
|
}
|
|
2400
|
-
function
|
|
2400
|
+
function Ci(n, e, t) {
|
|
2401
2401
|
const r = t.filter(([s, i, o, a, c]) => {
|
|
2402
2402
|
if (s !== "add-triple" && s !== "deep-merge-triple")
|
|
2403
2403
|
return !0;
|
|
@@ -2407,8 +2407,8 @@ function ki(n, e, t) {
|
|
|
2407
2407
|
let l = !1;
|
|
2408
2408
|
const f = e.getAttr(o);
|
|
2409
2409
|
if (f) {
|
|
2410
|
-
const p =
|
|
2411
|
-
l = !!
|
|
2410
|
+
const p = Nr(e, f["forward-identity"][1]);
|
|
2411
|
+
l = !!ki(n, e, [
|
|
2412
2412
|
i,
|
|
2413
2413
|
p == null ? void 0 : p.id,
|
|
2414
2414
|
i
|
|
@@ -2418,7 +2418,7 @@ function ki(n, e, t) {
|
|
|
2418
2418
|
});
|
|
2419
2419
|
return mt({ store: n, attrsStore: e }, (s) => {
|
|
2420
2420
|
r.forEach((i) => {
|
|
2421
|
-
|
|
2421
|
+
Si(s.store, s.attrsStore, i);
|
|
2422
2422
|
});
|
|
2423
2423
|
}, {
|
|
2424
2424
|
mark: (s) => {
|
|
@@ -2427,28 +2427,28 @@ function ki(n, e, t) {
|
|
|
2427
2427
|
}
|
|
2428
2428
|
});
|
|
2429
2429
|
}
|
|
2430
|
-
function
|
|
2430
|
+
function Ii(n) {
|
|
2431
2431
|
return typeof n == "string" && n.startsWith("?");
|
|
2432
2432
|
}
|
|
2433
|
-
function
|
|
2433
|
+
function Pi(n, e, t) {
|
|
2434
2434
|
if (t.hasOwnProperty(n)) {
|
|
2435
2435
|
const r = t[n];
|
|
2436
|
-
return
|
|
2436
|
+
return Kr(r, e, t);
|
|
2437
2437
|
}
|
|
2438
2438
|
return { ...t, [n]: e };
|
|
2439
2439
|
}
|
|
2440
2440
|
function Vn(n, e, t) {
|
|
2441
2441
|
return n === e ? t : null;
|
|
2442
2442
|
}
|
|
2443
|
-
function
|
|
2443
|
+
function Mi(n) {
|
|
2444
2444
|
switch (typeof n) {
|
|
2445
2445
|
case "string":
|
|
2446
|
-
return n.startsWith("?") ?
|
|
2446
|
+
return n.startsWith("?") ? Pi : Vn;
|
|
2447
2447
|
default:
|
|
2448
2448
|
return Vn;
|
|
2449
2449
|
}
|
|
2450
2450
|
}
|
|
2451
|
-
const
|
|
2451
|
+
const Ri = [
|
|
2452
2452
|
"in",
|
|
2453
2453
|
"$in",
|
|
2454
2454
|
"$not",
|
|
@@ -2456,69 +2456,69 @@ const Mi = [
|
|
|
2456
2456
|
"$comparator"
|
|
2457
2457
|
// covers all of $gt, $lt, etc.
|
|
2458
2458
|
];
|
|
2459
|
-
function
|
|
2460
|
-
for (const e of
|
|
2459
|
+
function ji(n) {
|
|
2460
|
+
for (const e of Ri)
|
|
2461
2461
|
if (n.hasOwnProperty(e))
|
|
2462
2462
|
return !0;
|
|
2463
2463
|
return !1;
|
|
2464
2464
|
}
|
|
2465
|
-
function
|
|
2466
|
-
return t ? typeof n == "object" ?
|
|
2465
|
+
function Kr(n, e, t) {
|
|
2466
|
+
return t ? typeof n == "object" ? ji(n) ? t : null : Mi(n)(n, e, t) : null;
|
|
2467
2467
|
}
|
|
2468
|
-
function
|
|
2468
|
+
function Di(n, e, t) {
|
|
2469
2469
|
return n.reduce((r, s, i) => {
|
|
2470
2470
|
const o = e[i];
|
|
2471
|
-
return
|
|
2471
|
+
return Kr(s, o, r);
|
|
2472
2472
|
}, t);
|
|
2473
2473
|
}
|
|
2474
|
-
function Di(n, e, t) {
|
|
2475
|
-
return Ui(n, e, t).map((r) => ji(e, r, t)).filter((r) => r);
|
|
2476
|
-
}
|
|
2477
2474
|
function $i(n, e, t) {
|
|
2478
|
-
return
|
|
2475
|
+
return Li(n, e, t).map((r) => Di(e, r, t)).filter((r) => r);
|
|
2476
|
+
}
|
|
2477
|
+
function xi(n, e, t) {
|
|
2478
|
+
return e.or ? e.or.patterns.flatMap((r) => Yt(n, r, t)) : e.and ? e.and.patterns.reduce((r, s) => Yt(n, s, r), t) : t.flatMap((r) => $i(n, e, r));
|
|
2479
2479
|
}
|
|
2480
2480
|
function Yt(n, e, t = [{}]) {
|
|
2481
|
-
return e.reduce((r, s) =>
|
|
2481
|
+
return e.reduce((r, s) => xi(n, s, r), t);
|
|
2482
2482
|
}
|
|
2483
2483
|
function gn(n, e) {
|
|
2484
|
-
return Array.isArray(e) ? e.map((t) => gn(n, t)) :
|
|
2484
|
+
return Array.isArray(e) ? e.map((t) => gn(n, t)) : Ii(e) ? n[e] : e;
|
|
2485
2485
|
}
|
|
2486
|
-
function
|
|
2486
|
+
function Ui(n, { find: e, where: t }) {
|
|
2487
2487
|
return Yt(n, t).map((s) => gn(s, e));
|
|
2488
2488
|
}
|
|
2489
|
-
function
|
|
2490
|
-
return
|
|
2489
|
+
function Li(n, e, t) {
|
|
2490
|
+
return Ai(n, gn(t, e));
|
|
2491
2491
|
}
|
|
2492
|
-
const
|
|
2493
|
-
function
|
|
2494
|
-
return typeof n == "string" &&
|
|
2492
|
+
const Fi = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
|
|
2493
|
+
function Ne(n) {
|
|
2494
|
+
return typeof n == "string" && Fi.test(n);
|
|
2495
2495
|
}
|
|
2496
2496
|
const H = [];
|
|
2497
2497
|
for (let n = 0; n < 256; ++n)
|
|
2498
2498
|
H.push((n + 256).toString(16).slice(1));
|
|
2499
|
-
function
|
|
2499
|
+
function Ni(n, e = 0) {
|
|
2500
2500
|
return (H[n[e + 0]] + H[n[e + 1]] + H[n[e + 2]] + H[n[e + 3]] + "-" + H[n[e + 4]] + H[n[e + 5]] + "-" + H[n[e + 6]] + H[n[e + 7]] + "-" + H[n[e + 8]] + H[n[e + 9]] + "-" + H[n[e + 10]] + H[n[e + 11]] + H[n[e + 12]] + H[n[e + 13]] + H[n[e + 14]] + H[n[e + 15]]).toLowerCase();
|
|
2501
2501
|
}
|
|
2502
2502
|
let Dt;
|
|
2503
|
-
const
|
|
2504
|
-
function
|
|
2503
|
+
const Ki = new Uint8Array(16);
|
|
2504
|
+
function qi() {
|
|
2505
2505
|
if (!Dt) {
|
|
2506
2506
|
if (typeof crypto > "u" || !crypto.getRandomValues)
|
|
2507
2507
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
2508
2508
|
Dt = crypto.getRandomValues.bind(crypto);
|
|
2509
2509
|
}
|
|
2510
|
-
return Dt(
|
|
2510
|
+
return Dt(Ki);
|
|
2511
2511
|
}
|
|
2512
|
-
const
|
|
2513
|
-
function
|
|
2512
|
+
const Wi = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Bn = { randomUUID: Wi };
|
|
2513
|
+
function zi(n, e, t) {
|
|
2514
2514
|
var s;
|
|
2515
2515
|
if (Bn.randomUUID && !n)
|
|
2516
2516
|
return Bn.randomUUID();
|
|
2517
2517
|
n = n || {};
|
|
2518
|
-
const r = n.random ?? ((s = n.rng) == null ? void 0 : s.call(n)) ??
|
|
2518
|
+
const r = n.random ?? ((s = n.rng) == null ? void 0 : s.call(n)) ?? qi();
|
|
2519
2519
|
if (r.length < 16)
|
|
2520
2520
|
throw new Error("Random bytes length must be >= 16");
|
|
2521
|
-
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128,
|
|
2521
|
+
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, Ni(r);
|
|
2522
2522
|
}
|
|
2523
2523
|
function Qn(n) {
|
|
2524
2524
|
const e = n.replace(/-/g, ""), t = [];
|
|
@@ -2526,7 +2526,7 @@ function Qn(n) {
|
|
|
2526
2526
|
t.push(parseInt(e.substring(r, r + 2), 16));
|
|
2527
2527
|
return t;
|
|
2528
2528
|
}
|
|
2529
|
-
function
|
|
2529
|
+
function Vi(n, e) {
|
|
2530
2530
|
for (let t = 0; t < n.length; t++) {
|
|
2531
2531
|
if (n[t] < e[t])
|
|
2532
2532
|
return -1;
|
|
@@ -2535,17 +2535,17 @@ function zi(n, e) {
|
|
|
2535
2535
|
}
|
|
2536
2536
|
return 0;
|
|
2537
2537
|
}
|
|
2538
|
-
function
|
|
2539
|
-
return
|
|
2538
|
+
function Bi(n, e) {
|
|
2539
|
+
return Vi(Qn(n), Qn(e));
|
|
2540
2540
|
}
|
|
2541
2541
|
function L() {
|
|
2542
|
-
return
|
|
2542
|
+
return zi();
|
|
2543
2543
|
}
|
|
2544
|
-
function
|
|
2544
|
+
function Qi(n, e) {
|
|
2545
2545
|
return n.localeCompare(e);
|
|
2546
2546
|
}
|
|
2547
|
-
function
|
|
2548
|
-
let n =
|
|
2547
|
+
function Gi() {
|
|
2548
|
+
let n = Qi;
|
|
2549
2549
|
if (typeof Intl == "object" && Intl.hasOwnProperty("Collator"))
|
|
2550
2550
|
try {
|
|
2551
2551
|
n = Intl.Collator("en-US").compare;
|
|
@@ -2553,55 +2553,55 @@ function Qi() {
|
|
|
2553
2553
|
}
|
|
2554
2554
|
return n;
|
|
2555
2555
|
}
|
|
2556
|
-
const
|
|
2557
|
-
let
|
|
2558
|
-
function
|
|
2559
|
-
return vt(`_${n}`,
|
|
2556
|
+
const Hi = Gi();
|
|
2557
|
+
let Ji = !0, Yi = 0;
|
|
2558
|
+
function Ze(n) {
|
|
2559
|
+
return vt(`_${n}`, Yi++);
|
|
2560
2560
|
}
|
|
2561
2561
|
function vt(n, e) {
|
|
2562
2562
|
return `?${n}-${e}`;
|
|
2563
2563
|
}
|
|
2564
|
-
class
|
|
2564
|
+
class Ke extends Error {
|
|
2565
2565
|
constructor(e) {
|
|
2566
2566
|
super(e), this.name = "AttrNotFoundError";
|
|
2567
2567
|
}
|
|
2568
2568
|
}
|
|
2569
|
-
function
|
|
2570
|
-
const t =
|
|
2569
|
+
function Zi(n, e) {
|
|
2570
|
+
const t = Nr(n, e);
|
|
2571
2571
|
if (!t)
|
|
2572
|
-
throw new
|
|
2572
|
+
throw new Ke(`Could not find id attr for ${e}`);
|
|
2573
2573
|
return t;
|
|
2574
2574
|
}
|
|
2575
2575
|
function Gn(n, e, t, r) {
|
|
2576
|
-
return [
|
|
2576
|
+
return [Xi(n, e, t, r)];
|
|
2577
2577
|
}
|
|
2578
|
-
function
|
|
2578
|
+
function Xi(n, e, t, r) {
|
|
2579
2579
|
return [
|
|
2580
2580
|
n(t, r),
|
|
2581
|
-
|
|
2581
|
+
Zi(e, t).id,
|
|
2582
2582
|
n(t, r),
|
|
2583
2583
|
n("time", r)
|
|
2584
2584
|
];
|
|
2585
2585
|
}
|
|
2586
|
-
function
|
|
2586
|
+
function eo(n, e, t) {
|
|
2587
2587
|
return n.map((r) => r === e ? t : r);
|
|
2588
2588
|
}
|
|
2589
|
-
function
|
|
2589
|
+
function qr(n, e, t, r, s) {
|
|
2590
2590
|
const i = W(e, t, s), o = je(e, t, s), a = i || o;
|
|
2591
2591
|
if (!a)
|
|
2592
|
-
throw new
|
|
2592
|
+
throw new Ke(`Could not find attr for ${[t, s]}`);
|
|
2593
2593
|
if (a["value-type"] !== "ref")
|
|
2594
2594
|
throw new Error(`Attr ${a.id} is not a ref`);
|
|
2595
2595
|
const [c, u] = a["forward-identity"], [l, f] = a["reverse-identity"], p = r + 1, y = i ? [
|
|
2596
2596
|
n(u, r),
|
|
2597
2597
|
a.id,
|
|
2598
2598
|
n(f, p),
|
|
2599
|
-
|
|
2599
|
+
Ze("time")
|
|
2600
2600
|
] : [
|
|
2601
2601
|
n(u, p),
|
|
2602
2602
|
a.id,
|
|
2603
2603
|
n(f, r),
|
|
2604
|
-
|
|
2604
|
+
Ze("time")
|
|
2605
2605
|
];
|
|
2606
2606
|
return [i ? f : u, p, y, a, !!i];
|
|
2607
2607
|
}
|
|
@@ -2615,7 +2615,7 @@ function Hn(n, e) {
|
|
|
2615
2615
|
return typeof o != "string" ? !1 : s.test(o);
|
|
2616
2616
|
};
|
|
2617
2617
|
}
|
|
2618
|
-
function
|
|
2618
|
+
function to(n, e) {
|
|
2619
2619
|
if (typeof e != "object" || e.hasOwnProperty("$in") || e.hasOwnProperty("in"))
|
|
2620
2620
|
return e;
|
|
2621
2621
|
const t = n["checked-data-type"] === "date";
|
|
@@ -2675,49 +2675,49 @@ function eo(n, e) {
|
|
|
2675
2675
|
}
|
|
2676
2676
|
return e;
|
|
2677
2677
|
}
|
|
2678
|
-
function
|
|
2678
|
+
function no(n, e, t, r, s, i) {
|
|
2679
2679
|
const o = W(e, t, s), a = je(e, t, s), c = o || a;
|
|
2680
2680
|
if (!c)
|
|
2681
|
-
throw new
|
|
2681
|
+
throw new Ke(`No attr for etype = ${t} label = ${s}`);
|
|
2682
2682
|
if (i != null && i.hasOwnProperty("$isNull")) {
|
|
2683
2683
|
const u = W(e, t, "id");
|
|
2684
2684
|
if (!u)
|
|
2685
|
-
throw new
|
|
2685
|
+
throw new Ke(`No attr for etype = ${t} label = id`);
|
|
2686
2686
|
return [
|
|
2687
2687
|
n(t, r),
|
|
2688
2688
|
u.id,
|
|
2689
2689
|
{ $isNull: { attrId: c.id, isNull: i.$isNull, reverse: !o } },
|
|
2690
|
-
|
|
2690
|
+
Ze("time")
|
|
2691
2691
|
];
|
|
2692
2692
|
}
|
|
2693
2693
|
return o ? [
|
|
2694
2694
|
n(t, r),
|
|
2695
2695
|
c.id,
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
] : [i, c.id, n(t, r),
|
|
2696
|
+
to(c, i),
|
|
2697
|
+
Ze("time")
|
|
2698
|
+
] : [i, c.id, n(t, r), Ze("time")];
|
|
2699
2699
|
}
|
|
2700
|
-
function
|
|
2700
|
+
function ro(n, e, t, r, s) {
|
|
2701
2701
|
const [i, o, a] = s.reduce((c, u) => {
|
|
2702
|
-
const [l, f, p] = c, [y, b, g] =
|
|
2702
|
+
const [l, f, p] = c, [y, b, g] = qr(n, e, l, f, u);
|
|
2703
2703
|
return [y, b, [...p, g]];
|
|
2704
2704
|
}, [t, r, []]);
|
|
2705
2705
|
return [i, o, a];
|
|
2706
2706
|
}
|
|
2707
2707
|
function Zt(n, e, t, r, s, i) {
|
|
2708
|
-
const o = s.slice(0, s.length - 1), a = s[s.length - 1], [c, u, l] =
|
|
2708
|
+
const o = s.slice(0, s.length - 1), a = s[s.length - 1], [c, u, l] = ro(n, e, t, r, o), f = no(n, e, c, u, a, i);
|
|
2709
2709
|
return l.concat([f]);
|
|
2710
2710
|
}
|
|
2711
|
-
function
|
|
2711
|
+
function so(n, e) {
|
|
2712
2712
|
return e ? [e].concat(n) : n;
|
|
2713
2713
|
}
|
|
2714
|
-
function
|
|
2714
|
+
function io([n, e]) {
|
|
2715
2715
|
return n === "or" && Array.isArray(e);
|
|
2716
2716
|
}
|
|
2717
|
-
function
|
|
2717
|
+
function oo([n, e]) {
|
|
2718
2718
|
return n === "and" && Array.isArray(e);
|
|
2719
2719
|
}
|
|
2720
|
-
function
|
|
2720
|
+
function ao(n, e, t) {
|
|
2721
2721
|
return (r, s) => {
|
|
2722
2722
|
const i = n(r, s);
|
|
2723
2723
|
return e == i ? i : `${i}-${t}`;
|
|
@@ -2725,27 +2725,27 @@ function oo(n, e, t) {
|
|
|
2725
2725
|
}
|
|
2726
2726
|
function Jn(n, e, t, r, s, i) {
|
|
2727
2727
|
const o = n(r, s), a = i.map((c, u) => {
|
|
2728
|
-
const l =
|
|
2729
|
-
return
|
|
2728
|
+
const l = ao(n, o, u);
|
|
2729
|
+
return Wr(l, t, r, s, c);
|
|
2730
2730
|
});
|
|
2731
2731
|
return { [e]: { patterns: a, joinSym: o } };
|
|
2732
2732
|
}
|
|
2733
|
-
function
|
|
2733
|
+
function co(n) {
|
|
2734
2734
|
const e = [];
|
|
2735
2735
|
for (let t = 1; t <= n.length; t++)
|
|
2736
2736
|
e.push(n.slice(0, t));
|
|
2737
2737
|
return e;
|
|
2738
2738
|
}
|
|
2739
2739
|
function Yn(n, e, t, r, s) {
|
|
2740
|
-
return
|
|
2740
|
+
return co(s).map((i) => Zt(n, e, t, r, i, {
|
|
2741
2741
|
$isNull: !0
|
|
2742
2742
|
}));
|
|
2743
2743
|
}
|
|
2744
|
-
function
|
|
2744
|
+
function Wr(n, e, t, r, s) {
|
|
2745
2745
|
return Object.entries(s).flatMap(([i, o]) => {
|
|
2746
|
-
if (so([i, o]))
|
|
2747
|
-
return Jn(n, "or", e, t, r, o);
|
|
2748
2746
|
if (io([i, o]))
|
|
2747
|
+
return Jn(n, "or", e, t, r, o);
|
|
2748
|
+
if (oo([i, o]))
|
|
2749
2749
|
return Jn(n, "and", e, t, r, o);
|
|
2750
2750
|
if (i === "$entityIdStartsWith")
|
|
2751
2751
|
return [];
|
|
@@ -2771,25 +2771,25 @@ function qr(n, e, t, r, s) {
|
|
|
2771
2771
|
] : Zt(n, e, t, r, a, o);
|
|
2772
2772
|
});
|
|
2773
2773
|
}
|
|
2774
|
-
function
|
|
2774
|
+
function uo(n, e, t, r) {
|
|
2775
2775
|
const s = vt;
|
|
2776
|
-
return r ?
|
|
2776
|
+
return r ? Wr(s, n, e, t, r).concat(Gn(s, n, e, t)) : Gn(s, n, e, t);
|
|
2777
2777
|
}
|
|
2778
|
-
function
|
|
2778
|
+
function lo(n, e, t) {
|
|
2779
2779
|
return [n(e, t), n("time", t)];
|
|
2780
2780
|
}
|
|
2781
|
-
function
|
|
2782
|
-
const [o, a, c, u, l] =
|
|
2781
|
+
function fo(n, e, t, r, s, i) {
|
|
2782
|
+
const [o, a, c, u, l] = qr(n, e, t, r, s), f = eo(c, n(t, r), i);
|
|
2783
2783
|
return [o, a, f, u, l];
|
|
2784
2784
|
}
|
|
2785
|
-
function
|
|
2785
|
+
function ho(n, e, t, { etype: r, level: s, form: i }, o) {
|
|
2786
2786
|
const a = Object.keys(i).filter((c) => c !== "$");
|
|
2787
2787
|
return a.length ? Object.entries(o).map(function([u, l]) {
|
|
2788
2788
|
return a.map(function(y) {
|
|
2789
2789
|
var g, T, S;
|
|
2790
2790
|
const b = !!(e.cardinalityInference && ((S = (T = (g = t.linkIndex) == null ? void 0 : g[r]) == null ? void 0 : T[y]) != null && S.isSingular));
|
|
2791
2791
|
try {
|
|
2792
|
-
const [_, w, C] =
|
|
2792
|
+
const [_, w, C] = fo(n, t, r, s, y, u), v = Vr(e, t, {
|
|
2793
2793
|
etype: _,
|
|
2794
2794
|
level: w,
|
|
2795
2795
|
form: i[y],
|
|
@@ -2797,7 +2797,7 @@ function fo(n, e, t, { etype: r, level: s, form: i }, o) {
|
|
|
2797
2797
|
}), k = b ? v[0] : v;
|
|
2798
2798
|
return { [y]: k };
|
|
2799
2799
|
} catch (_) {
|
|
2800
|
-
if (_ instanceof
|
|
2800
|
+
if (_ instanceof Ke)
|
|
2801
2801
|
return { [y]: b ? void 0 : [] };
|
|
2802
2802
|
throw _;
|
|
2803
2803
|
}
|
|
@@ -2806,19 +2806,19 @@ function fo(n, e, t, { etype: r, level: s, form: i }, o) {
|
|
|
2806
2806
|
}, l);
|
|
2807
2807
|
}) : Object.values(o);
|
|
2808
2808
|
}
|
|
2809
|
-
function
|
|
2810
|
-
return t === "string" ?
|
|
2809
|
+
function po(n, e, t) {
|
|
2810
|
+
return t === "string" ? Hi(n, e) : n > e ? 1 : -1;
|
|
2811
2811
|
}
|
|
2812
|
-
function
|
|
2813
|
-
return e === r || e == null && r == null ?
|
|
2812
|
+
function Je(n, e, t, r, s) {
|
|
2813
|
+
return e === r || e == null && r == null ? Bi(n, t) : r == null ? 1 : e == null ? -1 : po(e, r, s);
|
|
2814
2814
|
}
|
|
2815
2815
|
function wt([n, e], [t, r], s) {
|
|
2816
|
-
return
|
|
2816
|
+
return Je(n, e, t, r, s);
|
|
2817
2817
|
}
|
|
2818
2818
|
function Xt(n) {
|
|
2819
2819
|
return n == null ? n : new Date(n).getTime();
|
|
2820
2820
|
}
|
|
2821
|
-
function
|
|
2821
|
+
function yo(n, e, t, r) {
|
|
2822
2822
|
var b;
|
|
2823
2823
|
const [s, i, o, a] = n, c = t === "desc" ? 1 : -1;
|
|
2824
2824
|
if (((b = e["forward-identity"]) == null ? void 0 : b[2]) === "id")
|
|
@@ -2826,24 +2826,24 @@ function po(n, e, t, r) {
|
|
|
2826
2826
|
const [u, l] = r, f = e["checked-data-type"], p = f === "date" ? Xt(l) : l, y = f === "date" ? Xt(o) : o;
|
|
2827
2827
|
return wt([u, p], [s, y], f) === c;
|
|
2828
2828
|
}
|
|
2829
|
-
function
|
|
2829
|
+
function bo(n, e) {
|
|
2830
2830
|
const t = e[1];
|
|
2831
2831
|
return n.getAttr(t);
|
|
2832
2832
|
}
|
|
2833
|
-
function
|
|
2833
|
+
function _o(n, e, t) {
|
|
2834
2834
|
const r = Object.keys(t)[0];
|
|
2835
2835
|
return W(n, e, r);
|
|
2836
2836
|
}
|
|
2837
|
-
function
|
|
2837
|
+
function go(n, e, t, r) {
|
|
2838
2838
|
if (t)
|
|
2839
|
-
return
|
|
2839
|
+
return bo(n, t);
|
|
2840
2840
|
if (r)
|
|
2841
|
-
return
|
|
2841
|
+
return _o(n, e, r);
|
|
2842
2842
|
}
|
|
2843
|
-
function
|
|
2843
|
+
function mo(n, e, t) {
|
|
2844
2844
|
var s, i;
|
|
2845
2845
|
if (!Array.isArray(t.fields))
|
|
2846
|
-
return
|
|
2846
|
+
return Ei(n, e);
|
|
2847
2847
|
const r = /* @__PURE__ */ new Map();
|
|
2848
2848
|
for (const o of t.fields) {
|
|
2849
2849
|
const a = W(n, e, o), c = (s = a == null ? void 0 : a["forward-identity"]) == null ? void 0 : s[2];
|
|
@@ -2855,11 +2855,11 @@ function go(n, e, t) {
|
|
|
2855
2855
|
}
|
|
2856
2856
|
return r;
|
|
2857
2857
|
}
|
|
2858
|
-
function
|
|
2858
|
+
function wo(n, e, { etype: t, pageInfo: r, dq: s, form: i }) {
|
|
2859
2859
|
var b, g;
|
|
2860
|
-
const o = (b = i == null ? void 0 : i.$) == null ? void 0 : b.order, a =
|
|
2861
|
-
let u =
|
|
2862
|
-
const l = r == null ? void 0 : r["start-cursor"], f =
|
|
2860
|
+
const o = (b = i == null ? void 0 : i.$) == null ? void 0 : b.order, a = zr(i), c = To(i);
|
|
2861
|
+
let u = Ui(n, s);
|
|
2862
|
+
const l = r == null ? void 0 : r["start-cursor"], f = go(e, t, l, o);
|
|
2863
2863
|
if (f && ((g = f == null ? void 0 : f["forward-identity"]) == null ? void 0 : g[2]) !== "id") {
|
|
2864
2864
|
const T = f["checked-data-type"] === "date", S = f.id;
|
|
2865
2865
|
u = u.map(([_]) => {
|
|
@@ -2874,57 +2874,57 @@ function mo(n, e, { etype: t, pageInfo: r, dq: s, form: i }) {
|
|
|
2874
2874
|
return wt(_, S, f == null ? void 0 : f["checked-data-type"]);
|
|
2875
2875
|
});
|
|
2876
2876
|
let p = {};
|
|
2877
|
-
const y =
|
|
2877
|
+
const y = mo(e, t, s);
|
|
2878
2878
|
for (const T of u) {
|
|
2879
2879
|
const [S] = T;
|
|
2880
|
-
if (p[S] || !a && l && f &&
|
|
2880
|
+
if (p[S] || !a && l && f && yo(l, f, c, T))
|
|
2881
2881
|
continue;
|
|
2882
|
-
const _ =
|
|
2882
|
+
const _ = Oi(n, y, S);
|
|
2883
2883
|
_ && (p[S] = _);
|
|
2884
2884
|
}
|
|
2885
2885
|
return p;
|
|
2886
2886
|
}
|
|
2887
|
-
function
|
|
2887
|
+
function To(n) {
|
|
2888
2888
|
var t;
|
|
2889
2889
|
const e = (t = n.$) == null ? void 0 : t.order;
|
|
2890
2890
|
return e && e[Object.keys(e)[0]] || "asc";
|
|
2891
2891
|
}
|
|
2892
|
-
function
|
|
2892
|
+
function zr(n) {
|
|
2893
2893
|
var s, i, o;
|
|
2894
2894
|
const e = (s = n.$) == null ? void 0 : s.offset, t = (i = n.$) == null ? void 0 : i.before, r = (o = n.$) == null ? void 0 : o.after;
|
|
2895
2895
|
return !e && !t && !r;
|
|
2896
2896
|
}
|
|
2897
|
-
function
|
|
2897
|
+
function So(n, e, { etype: t, level: r, form: s, join: i, pageInfo: o }) {
|
|
2898
2898
|
var p, y, b, g, T;
|
|
2899
|
-
if (!
|
|
2899
|
+
if (!zr(s) && (!o || !o["start-cursor"]))
|
|
2900
2900
|
return [];
|
|
2901
|
-
const a =
|
|
2901
|
+
const a = so(uo(e, t, r, (p = s.$) == null ? void 0 : p.where), i), c = lo(vt, t, r), u = (y = s.$) == null ? void 0 : y.fields, l = wo(n, e, {
|
|
2902
2902
|
etype: t,
|
|
2903
2903
|
pageInfo: o,
|
|
2904
2904
|
form: s,
|
|
2905
2905
|
dq: { where: a, find: c, fields: u }
|
|
2906
2906
|
}), f = ((b = s.$) == null ? void 0 : b.limit) || ((g = s.$) == null ? void 0 : g.first) || ((T = s.$) == null ? void 0 : T.last);
|
|
2907
2907
|
if (f != null) {
|
|
2908
|
-
r > 0 &&
|
|
2908
|
+
r > 0 && Ji && console.warn("WARNING: Limits in child queries are only run client-side. Data returned from the server will not have a limit.");
|
|
2909
2909
|
const S = Object.entries(l);
|
|
2910
2910
|
return S.length <= f ? l : Object.fromEntries(S.slice(0, f));
|
|
2911
2911
|
}
|
|
2912
2912
|
return l;
|
|
2913
2913
|
}
|
|
2914
|
-
function
|
|
2914
|
+
function vo(n, e, t) {
|
|
2915
2915
|
try {
|
|
2916
|
-
return
|
|
2916
|
+
return So(n, e, t);
|
|
2917
2917
|
} catch (r) {
|
|
2918
|
-
if (r instanceof
|
|
2918
|
+
if (r instanceof Ke)
|
|
2919
2919
|
return {};
|
|
2920
2920
|
throw r;
|
|
2921
2921
|
}
|
|
2922
2922
|
}
|
|
2923
|
-
function
|
|
2924
|
-
const r =
|
|
2925
|
-
return
|
|
2923
|
+
function Vr(n, e, t) {
|
|
2924
|
+
const r = vo(n, e, t);
|
|
2925
|
+
return ho(vt, n, e, t, r);
|
|
2926
2926
|
}
|
|
2927
|
-
function
|
|
2927
|
+
function Ao(n) {
|
|
2928
2928
|
const e = {};
|
|
2929
2929
|
for (const [t, r] of Object.entries(n))
|
|
2930
2930
|
e[t] = {
|
|
@@ -2935,18 +2935,18 @@ function vo(n) {
|
|
|
2935
2935
|
};
|
|
2936
2936
|
return e;
|
|
2937
2937
|
}
|
|
2938
|
-
function
|
|
2938
|
+
function Br({ store: n, attrsStore: e, pageInfo: t, aggregate: r }, s) {
|
|
2939
2939
|
const o = { data: Object.keys(s).reduce(function(c, u) {
|
|
2940
|
-
return r != null && r[u] || u === "$$ruleParams" || (c[u] =
|
|
2940
|
+
return r != null && r[u] || u === "$$ruleParams" || (c[u] = Vr(n, e, {
|
|
2941
2941
|
etype: u,
|
|
2942
2942
|
form: s[u],
|
|
2943
2943
|
level: 0,
|
|
2944
2944
|
pageInfo: t == null ? void 0 : t[u]
|
|
2945
2945
|
})), c;
|
|
2946
2946
|
}, {}) };
|
|
2947
|
-
return t && (o.pageInfo =
|
|
2947
|
+
return t && (o.pageInfo = Ao(t)), r && (o.aggregate = r), o;
|
|
2948
2948
|
}
|
|
2949
|
-
function
|
|
2949
|
+
function Oo() {
|
|
2950
2950
|
const e = {
|
|
2951
2951
|
__etype: 1,
|
|
2952
2952
|
__ops: 1,
|
|
@@ -2960,7 +2960,7 @@ function Ao() {
|
|
|
2960
2960
|
};
|
|
2961
2961
|
return new Set(Object.keys(e));
|
|
2962
2962
|
}
|
|
2963
|
-
const
|
|
2963
|
+
const Eo = Oo();
|
|
2964
2964
|
function bt(n, e, t) {
|
|
2965
2965
|
const r = {
|
|
2966
2966
|
__etype: n,
|
|
@@ -2972,7 +2972,7 @@ function bt(n, e, t) {
|
|
|
2972
2972
|
return t;
|
|
2973
2973
|
if (i === "__etype")
|
|
2974
2974
|
return n;
|
|
2975
|
-
if (
|
|
2975
|
+
if (Eo.has(i))
|
|
2976
2976
|
return (o, a) => bt(n, e, [
|
|
2977
2977
|
...t,
|
|
2978
2978
|
a ? [i, n, e, o, a] : [i, n, e, o]
|
|
@@ -2980,7 +2980,7 @@ function bt(n, e, t) {
|
|
|
2980
2980
|
}
|
|
2981
2981
|
});
|
|
2982
2982
|
}
|
|
2983
|
-
function
|
|
2983
|
+
function ko(n, e) {
|
|
2984
2984
|
return `lookup__${n}__${JSON.stringify(e)}`;
|
|
2985
2985
|
}
|
|
2986
2986
|
function Tt(n) {
|
|
@@ -2990,13 +2990,13 @@ function en(n) {
|
|
|
2990
2990
|
const [e, t, ...r] = n.split("__");
|
|
2991
2991
|
return [t, JSON.parse(r.join("__"))];
|
|
2992
2992
|
}
|
|
2993
|
-
function
|
|
2993
|
+
function Co(n) {
|
|
2994
2994
|
return new Proxy({
|
|
2995
2995
|
__etype: n
|
|
2996
2996
|
}, {
|
|
2997
2997
|
get(e, t) {
|
|
2998
2998
|
if (t === "lookup")
|
|
2999
|
-
return (s, i) => bt(n, en(
|
|
2999
|
+
return (s, i) => bt(n, en(ko(s, i)), []);
|
|
3000
3000
|
if (t === "__etype")
|
|
3001
3001
|
return n;
|
|
3002
3002
|
const r = t;
|
|
@@ -3007,15 +3007,15 @@ function ko(n) {
|
|
|
3007
3007
|
function mn() {
|
|
3008
3008
|
return new Proxy({}, {
|
|
3009
3009
|
get(n, e) {
|
|
3010
|
-
return
|
|
3010
|
+
return Co(e);
|
|
3011
3011
|
}
|
|
3012
3012
|
});
|
|
3013
3013
|
}
|
|
3014
3014
|
mn();
|
|
3015
|
-
function
|
|
3015
|
+
function Io(n) {
|
|
3016
3016
|
return n.__ops;
|
|
3017
3017
|
}
|
|
3018
|
-
function
|
|
3018
|
+
function Po(n, e) {
|
|
3019
3019
|
const { attrIdMap: t, refSwapAttrIds: r } = n, s = [];
|
|
3020
3020
|
for (const o of e) {
|
|
3021
3021
|
const a = t[o];
|
|
@@ -3034,7 +3034,7 @@ function Io(n, e) {
|
|
|
3034
3034
|
}
|
|
3035
3035
|
return s;
|
|
3036
3036
|
}
|
|
3037
|
-
function
|
|
3037
|
+
function Mo(n) {
|
|
3038
3038
|
if (Array.isArray(n))
|
|
3039
3039
|
return n;
|
|
3040
3040
|
const e = Object.entries(n);
|
|
@@ -3042,7 +3042,7 @@ function Po(n) {
|
|
|
3042
3042
|
throw new Error("lookup must be an object with a single unique attr and value.");
|
|
3043
3043
|
return e[0];
|
|
3044
3044
|
}
|
|
3045
|
-
function
|
|
3045
|
+
function Ro(n, e, t) {
|
|
3046
3046
|
return t.indexOf(".") !== -1 && // attr names can have `.` in them, so use the attr we find with a `.`
|
|
3047
3047
|
// before assuming it's a ref lookup.
|
|
3048
3048
|
!W(n, e, t);
|
|
@@ -3053,8 +3053,8 @@ function tn(n) {
|
|
|
3053
3053
|
throw new Error(`${n} is not a valid lookup attribute.`);
|
|
3054
3054
|
return e;
|
|
3055
3055
|
}
|
|
3056
|
-
function
|
|
3057
|
-
if (!
|
|
3056
|
+
function jo(n, e, t) {
|
|
3057
|
+
if (!Ro(n, e, t))
|
|
3058
3058
|
return W(n, e, t);
|
|
3059
3059
|
const r = tn(t), s = W(n, e, r) || je(n, e, r);
|
|
3060
3060
|
if (s && s["value-type"] !== "ref")
|
|
@@ -3062,18 +3062,18 @@ function Ro(n, e, t) {
|
|
|
3062
3062
|
return s;
|
|
3063
3063
|
}
|
|
3064
3064
|
function nn(n) {
|
|
3065
|
-
return typeof n == "string" && !Tt(n) ? null : typeof n == "string" && Tt(n) ? en(n) :
|
|
3065
|
+
return typeof n == "string" && !Tt(n) ? null : typeof n == "string" && Tt(n) ? en(n) : Mo(n);
|
|
3066
3066
|
}
|
|
3067
3067
|
function oe(n, e, t) {
|
|
3068
3068
|
const r = nn(t);
|
|
3069
3069
|
if (r === null)
|
|
3070
3070
|
return t;
|
|
3071
|
-
const [s, i] = r, o =
|
|
3071
|
+
const [s, i] = r, o = jo(n, e, s);
|
|
3072
3072
|
if (!o || !o["unique?"])
|
|
3073
3073
|
throw new Error(`${s} is not a unique attribute.`);
|
|
3074
3074
|
return [o.id, i];
|
|
3075
3075
|
}
|
|
3076
|
-
function
|
|
3076
|
+
function Qr(n, e, t, r) {
|
|
3077
3077
|
var o;
|
|
3078
3078
|
const s = oe(n, e, t);
|
|
3079
3079
|
return Array.isArray(s) ? [[
|
|
@@ -3083,7 +3083,7 @@ function Br(n, e, t, r) {
|
|
|
3083
3083
|
s
|
|
3084
3084
|
]].concat(r) : r;
|
|
3085
3085
|
}
|
|
3086
|
-
function
|
|
3086
|
+
function Do({ attrsStore: n }, [e, t, r]) {
|
|
3087
3087
|
const s = Object.entries(r).flatMap(([i, o]) => {
|
|
3088
3088
|
const a = Array.isArray(o) ? o : [o], c = W(n, e, i), u = je(n, e, i);
|
|
3089
3089
|
return a.map((l) => c ? [
|
|
@@ -3102,9 +3102,9 @@ function jo({ attrsStore: n }, [e, t, r]) {
|
|
|
3102
3102
|
oe(n, e, t)
|
|
3103
3103
|
]);
|
|
3104
3104
|
});
|
|
3105
|
-
return
|
|
3105
|
+
return Qr(n, e, t, s);
|
|
3106
3106
|
}
|
|
3107
|
-
function
|
|
3107
|
+
function $o({ attrsStore: n }, [e, t, r]) {
|
|
3108
3108
|
const s = Object.entries(r).flatMap(([i, o]) => {
|
|
3109
3109
|
const a = Array.isArray(o) ? o : [o], c = W(n, e, i), u = je(n, e, i);
|
|
3110
3110
|
return a.map((l) => c ? [
|
|
@@ -3123,9 +3123,9 @@ function Do({ attrsStore: n }, [e, t, r]) {
|
|
|
3123
3123
|
oe(n, e, t)
|
|
3124
3124
|
]);
|
|
3125
3125
|
});
|
|
3126
|
-
return
|
|
3126
|
+
return Qr(n, e, t, s);
|
|
3127
3127
|
}
|
|
3128
|
-
function
|
|
3128
|
+
function xo(n, e, t, r) {
|
|
3129
3129
|
var s;
|
|
3130
3130
|
if (Array.isArray(r)) {
|
|
3131
3131
|
const [i, o] = r;
|
|
@@ -3148,18 +3148,18 @@ function $o(n, e, t, r) {
|
|
|
3148
3148
|
}
|
|
3149
3149
|
return !1;
|
|
3150
3150
|
}
|
|
3151
|
-
function
|
|
3152
|
-
return (i == null ? void 0 : i.upsert) === !1 ? { mode: "update" } : (i == null ? void 0 : i.upsert) === !0 ? null :
|
|
3151
|
+
function Gr({ stores: n, attrsStore: e }, [t, r, s, i]) {
|
|
3152
|
+
return (i == null ? void 0 : i.upsert) === !1 ? { mode: "update" } : (i == null ? void 0 : i.upsert) === !0 ? null : xo(n, e, t, r) ? { mode: "update" } : null;
|
|
3153
3153
|
}
|
|
3154
|
-
function
|
|
3154
|
+
function Uo(n, e) {
|
|
3155
3155
|
const { attrsStore: t } = n, [r, s, i, o] = e, a = yn(i), c = oe(t, r, s);
|
|
3156
3156
|
return [["id", c]].concat(Object.entries(a)).map(([l, f]) => {
|
|
3157
3157
|
const p = W(t, r, l);
|
|
3158
3158
|
return p["checked-data-type"] === "date" && n.useDateObjects && (f = St(f)), ["add-triple", c, p.id, f, { mode: "create" }];
|
|
3159
3159
|
});
|
|
3160
3160
|
}
|
|
3161
|
-
function
|
|
3162
|
-
const { attrsStore: t } = n, [r, s, i, o] = e, a = yn(i), c = oe(t, r, s), u =
|
|
3161
|
+
function Lo(n, e) {
|
|
3162
|
+
const { attrsStore: t } = n, [r, s, i, o] = e, a = yn(i), c = oe(t, r, s), u = Gr(n, [r, c, i, o]);
|
|
3163
3163
|
return [["id", c]].concat(Object.entries(a)).map(([f, p]) => {
|
|
3164
3164
|
const y = W(t, r, f);
|
|
3165
3165
|
return y["checked-data-type"] === "date" && n.useDateObjects && (p = St(p)), [
|
|
@@ -3171,11 +3171,11 @@ function Uo(n, e) {
|
|
|
3171
3171
|
];
|
|
3172
3172
|
});
|
|
3173
3173
|
}
|
|
3174
|
-
function
|
|
3174
|
+
function Fo({ attrsStore: n }, [e, t]) {
|
|
3175
3175
|
return [["delete-entity", oe(n, e, t), e]];
|
|
3176
3176
|
}
|
|
3177
|
-
function
|
|
3178
|
-
const { attrsStore: t } = n, [r, s, i, o] = e, a = yn(i), c = oe(t, r, s), u =
|
|
3177
|
+
function No(n, e) {
|
|
3178
|
+
const { attrsStore: t } = n, [r, s, i, o] = e, a = yn(i), c = oe(t, r, s), u = Gr(n, [r, c, i, o]), l = Object.entries(a).map(([p, y]) => {
|
|
3179
3179
|
const b = W(t, r, p);
|
|
3180
3180
|
return [
|
|
3181
3181
|
"deep-merge-triple",
|
|
@@ -3193,38 +3193,38 @@ function Fo(n, e) {
|
|
|
3193
3193
|
...u ? [u] : []
|
|
3194
3194
|
]].concat(l);
|
|
3195
3195
|
}
|
|
3196
|
-
function
|
|
3196
|
+
function Ko({ attrsStore: n }, [e, t, r]) {
|
|
3197
3197
|
return [["rule-params", oe(n, e, t), e, r]];
|
|
3198
3198
|
}
|
|
3199
|
-
function
|
|
3199
|
+
function qo(n) {
|
|
3200
3200
|
const [e, t, r, s, i] = n;
|
|
3201
3201
|
if (!s)
|
|
3202
3202
|
return n;
|
|
3203
3203
|
const o = { ...s };
|
|
3204
3204
|
return delete o.id, [e, t, r, o, ...i ? [i] : []];
|
|
3205
3205
|
}
|
|
3206
|
-
function
|
|
3207
|
-
const [t, ...r] =
|
|
3206
|
+
function Wo(n, e) {
|
|
3207
|
+
const [t, ...r] = qo(e);
|
|
3208
3208
|
switch (t) {
|
|
3209
3209
|
case "merge":
|
|
3210
|
-
return
|
|
3210
|
+
return No(n, r);
|
|
3211
3211
|
case "create":
|
|
3212
|
-
return xo(n, r);
|
|
3213
|
-
case "update":
|
|
3214
3212
|
return Uo(n, r);
|
|
3213
|
+
case "update":
|
|
3214
|
+
return Lo(n, r);
|
|
3215
3215
|
case "link":
|
|
3216
|
-
return jo(n, r);
|
|
3217
|
-
case "unlink":
|
|
3218
3216
|
return Do(n, r);
|
|
3217
|
+
case "unlink":
|
|
3218
|
+
return $o(n, r);
|
|
3219
3219
|
case "delete":
|
|
3220
|
-
return
|
|
3220
|
+
return Fo(n, r);
|
|
3221
3221
|
case "ruleParams":
|
|
3222
|
-
return
|
|
3222
|
+
return Ko(n, r);
|
|
3223
3223
|
default:
|
|
3224
3224
|
throw new Error(`unsupported action ${t}`);
|
|
3225
3225
|
}
|
|
3226
3226
|
}
|
|
3227
|
-
function
|
|
3227
|
+
function zo(n) {
|
|
3228
3228
|
switch (n) {
|
|
3229
3229
|
case "string":
|
|
3230
3230
|
case "date":
|
|
@@ -3235,14 +3235,14 @@ function Wo(n) {
|
|
|
3235
3235
|
return;
|
|
3236
3236
|
}
|
|
3237
3237
|
}
|
|
3238
|
-
function
|
|
3238
|
+
function Vo(n, e, t) {
|
|
3239
3239
|
var a, c;
|
|
3240
3240
|
const r = (c = (a = n.entities[e]) == null ? void 0 : a.attrs) == null ? void 0 : c[t];
|
|
3241
3241
|
if (t === "id")
|
|
3242
3242
|
return null;
|
|
3243
3243
|
if (!r)
|
|
3244
3244
|
throw new Error(`${e}.${t} does not exist in your schema`);
|
|
3245
|
-
const { unique: s, indexed: i } = r == null ? void 0 : r.config, o =
|
|
3245
|
+
const { unique: s, indexed: i } = r == null ? void 0 : r.config, o = zo(r == null ? void 0 : r.valueType);
|
|
3246
3246
|
return {
|
|
3247
3247
|
"index?": i,
|
|
3248
3248
|
"unique?": s,
|
|
@@ -3250,7 +3250,7 @@ function zo(n, e, t) {
|
|
|
3250
3250
|
};
|
|
3251
3251
|
}
|
|
3252
3252
|
function lt(n, e, t, r) {
|
|
3253
|
-
const s = n ?
|
|
3253
|
+
const s = n ? Vo(n, e, t) : null, i = L(), a = [L(), e, t];
|
|
3254
3254
|
return {
|
|
3255
3255
|
id: i,
|
|
3256
3256
|
"forward-identity": a,
|
|
@@ -3263,11 +3263,11 @@ function lt(n, e, t, r) {
|
|
|
3263
3263
|
...r || {}
|
|
3264
3264
|
};
|
|
3265
3265
|
}
|
|
3266
|
-
function
|
|
3266
|
+
function Bo(n, e, t) {
|
|
3267
3267
|
return Object.values(n.links).find((i) => i.forward.on === e && i.forward.label === t || i.reverse.on === e && i.reverse.label === t);
|
|
3268
3268
|
}
|
|
3269
|
-
function
|
|
3270
|
-
const r =
|
|
3269
|
+
function Qo(n, e, t) {
|
|
3270
|
+
const r = Bo(n, e, t);
|
|
3271
3271
|
if (!r)
|
|
3272
3272
|
throw new Error(`Couldn't find the link ${e}.${t} in your schema`);
|
|
3273
3273
|
const { forward: s, reverse: i } = r;
|
|
@@ -3281,7 +3281,7 @@ function Bo(n, e, t) {
|
|
|
3281
3281
|
};
|
|
3282
3282
|
}
|
|
3283
3283
|
function Zn(n, e, t, r) {
|
|
3284
|
-
const s = n ?
|
|
3284
|
+
const s = n ? Qo(n, e, t) : null, i = L(), o = [L(), e, t], a = [L(), t, e];
|
|
3285
3285
|
return {
|
|
3286
3286
|
id: i,
|
|
3287
3287
|
// @ts-ignore: ts thinks it's any[]
|
|
@@ -3298,7 +3298,7 @@ function Zn(n, e, t, r) {
|
|
|
3298
3298
|
...r || {}
|
|
3299
3299
|
};
|
|
3300
3300
|
}
|
|
3301
|
-
const
|
|
3301
|
+
const Go = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink"]), Ho = /* @__PURE__ */ new Set(["link", "unlink"]), Jo = /* @__PURE__ */ new Set(["create", "update", "merge"]), Yo = /* @__PURE__ */ new Set([
|
|
3302
3302
|
"link",
|
|
3303
3303
|
"unlink",
|
|
3304
3304
|
"create",
|
|
@@ -3306,13 +3306,13 @@ const Qo = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink
|
|
|
3306
3306
|
"merge",
|
|
3307
3307
|
"delete",
|
|
3308
3308
|
"ruleParams"
|
|
3309
|
-
]), rn = { "unique?": !0, "index?": !0 },
|
|
3309
|
+
]), rn = { "unique?": !0, "index?": !0 }, Zo = {
|
|
3310
3310
|
...rn,
|
|
3311
3311
|
cardinality: "one"
|
|
3312
3312
|
};
|
|
3313
|
-
function
|
|
3313
|
+
function Xo(n) {
|
|
3314
3314
|
const e = [], [t, r, s, i] = n;
|
|
3315
|
-
if (!
|
|
3315
|
+
if (!Yo.has(t))
|
|
3316
3316
|
return e;
|
|
3317
3317
|
const o = nn(s);
|
|
3318
3318
|
if (o && e.push({ etype: r, lookupPair: o }), t === "link")
|
|
@@ -3329,7 +3329,7 @@ function Zo(n) {
|
|
|
3329
3329
|
}
|
|
3330
3330
|
return e;
|
|
3331
3331
|
}
|
|
3332
|
-
function
|
|
3332
|
+
function ea({ attrsStore: n, schema: e }, t) {
|
|
3333
3333
|
var p, y;
|
|
3334
3334
|
const r = /* @__PURE__ */ new Set(), s = [], i = [];
|
|
3335
3335
|
function o(b, g) {
|
|
@@ -3354,10 +3354,10 @@ function Xo({ attrsStore: n, schema: e }, t) {
|
|
|
3354
3354
|
}
|
|
3355
3355
|
function f(b, g) {
|
|
3356
3356
|
const T = o(b, g), S = a(b, g);
|
|
3357
|
-
u(T), u(S), !T && !S && c(Zn(e, b, g,
|
|
3357
|
+
u(T), u(S), !T && !S && c(Zn(e, b, g, Zo));
|
|
3358
3358
|
}
|
|
3359
3359
|
for (const b of t)
|
|
3360
|
-
for (const { etype: g, lookupPair: T, linkLabel: S } of
|
|
3360
|
+
for (const { etype: g, lookupPair: T, linkLabel: S } of Xo(b)) {
|
|
3361
3361
|
const _ = T[0];
|
|
3362
3362
|
if (S) {
|
|
3363
3363
|
f(g, S);
|
|
@@ -3379,12 +3379,12 @@ function Xo({ attrsStore: n, schema: e }, t) {
|
|
|
3379
3379
|
}
|
|
3380
3380
|
for (const b of t) {
|
|
3381
3381
|
const [g, T, S, _] = b;
|
|
3382
|
-
if (
|
|
3382
|
+
if (Go.has(g)) {
|
|
3383
3383
|
const w = o(T, "id");
|
|
3384
3384
|
u(w), w || c(lt(e, T, "id", { "unique?": !0 }));
|
|
3385
3385
|
for (const C of Object.keys(_)) {
|
|
3386
3386
|
const v = o(T, C);
|
|
3387
|
-
if (u(v),
|
|
3387
|
+
if (u(v), Jo.has(g) && (v || c(lt(e, T, C, C === "id" ? { "unique?": !0 } : null))), Ho.has(g)) {
|
|
3388
3388
|
const k = a(T, C);
|
|
3389
3389
|
!v && !k && c(Zn(e, T, C)), u(k);
|
|
3390
3390
|
}
|
|
@@ -3399,15 +3399,15 @@ function Xo({ attrsStore: n, schema: e }, t) {
|
|
|
3399
3399
|
}
|
|
3400
3400
|
return [n, i];
|
|
3401
3401
|
}
|
|
3402
|
-
function
|
|
3403
|
-
const r = (Array.isArray(e) ? e : [e]).flatMap((c) =>
|
|
3402
|
+
function ta(n, e) {
|
|
3403
|
+
const r = (Array.isArray(e) ? e : [e]).flatMap((c) => Io(c)), [s, i] = ea(n, r), o = { ...n, attrsStore: s }, a = r.flatMap((c) => Wo(o, c));
|
|
3404
3404
|
return [...i, ...a];
|
|
3405
3405
|
}
|
|
3406
3406
|
function Xn(n, e) {
|
|
3407
3407
|
typeof requestIdleCallback > "u" ? n() : requestIdleCallback(n, { timeout: e });
|
|
3408
3408
|
}
|
|
3409
|
-
const
|
|
3410
|
-
class
|
|
3409
|
+
const Xe = "__meta";
|
|
3410
|
+
class na {
|
|
3411
3411
|
constructor(e, t) {
|
|
3412
3412
|
}
|
|
3413
3413
|
}
|
|
@@ -3444,7 +3444,7 @@ class sn {
|
|
|
3444
3444
|
var e;
|
|
3445
3445
|
this._meta.loadingPromise && await this._meta.loadingPromise;
|
|
3446
3446
|
try {
|
|
3447
|
-
const t = this._persister.getItem(
|
|
3447
|
+
const t = this._persister.getItem(Xe);
|
|
3448
3448
|
this._meta.loadingPromise = t;
|
|
3449
3449
|
const r = await t;
|
|
3450
3450
|
this._meta.isLoading = !1, this._meta.error = null, this._meta.loadingPromise = null, this._meta.attempts = 0;
|
|
@@ -3526,7 +3526,7 @@ class sn {
|
|
|
3526
3526
|
const p = this._persister.removeItem(f);
|
|
3527
3527
|
t.push(p.then(() => 1)), this._loadedKeys.delete(f), this._pendingSaveKeys.delete(f);
|
|
3528
3528
|
}
|
|
3529
|
-
const a = [], c = [[
|
|
3529
|
+
const a = [], c = [[Xe, s]], u = s.objects ?? {};
|
|
3530
3530
|
s.objects = u;
|
|
3531
3531
|
for (const f of o)
|
|
3532
3532
|
if (this._loadedKeys.has(f)) {
|
|
@@ -3555,7 +3555,7 @@ class sn {
|
|
|
3555
3555
|
if (!this._gcOpts)
|
|
3556
3556
|
return;
|
|
3557
3557
|
const e = new Set(await this._persister.getAllKeys());
|
|
3558
|
-
e.delete(
|
|
3558
|
+
e.delete(Xe);
|
|
3559
3559
|
const t = new Set(Object.keys(this.currentValue));
|
|
3560
3560
|
for (const p of Object.keys(this._loadingKeys))
|
|
3561
3561
|
t.add(p);
|
|
@@ -3651,13 +3651,13 @@ class sn {
|
|
|
3651
3651
|
};
|
|
3652
3652
|
}
|
|
3653
3653
|
}
|
|
3654
|
-
const
|
|
3655
|
-
function
|
|
3654
|
+
const ra = 6, sa = ["kv", "querySubs", "syncSubs"];
|
|
3655
|
+
function ia(n) {
|
|
3656
3656
|
return function(t) {
|
|
3657
3657
|
console.error("Error in IndexedDB event", { source: n, event: t });
|
|
3658
3658
|
};
|
|
3659
3659
|
}
|
|
3660
|
-
async function
|
|
3660
|
+
async function oa(n) {
|
|
3661
3661
|
return new Promise((e) => {
|
|
3662
3662
|
const t = indexedDB.open(n);
|
|
3663
3663
|
t.onerror = (r) => {
|
|
@@ -3671,7 +3671,7 @@ async function ia(n) {
|
|
|
3671
3671
|
};
|
|
3672
3672
|
});
|
|
3673
3673
|
}
|
|
3674
|
-
async function
|
|
3674
|
+
async function aa(n, e, t) {
|
|
3675
3675
|
const r = (
|
|
3676
3676
|
// Backwards compatibility for older versions where we JSON.stringified before storing
|
|
3677
3677
|
typeof e == "string" ? JSON.parse(e) : e
|
|
@@ -3695,7 +3695,7 @@ async function oa(n, e, t) {
|
|
|
3695
3695
|
const T = t.put(g, y);
|
|
3696
3696
|
s.add(T);
|
|
3697
3697
|
}
|
|
3698
|
-
const c = { objects: a }, u = t.put(c,
|
|
3698
|
+
const c = { objects: a }, u = t.put(c, Xe);
|
|
3699
3699
|
s.add(u);
|
|
3700
3700
|
for (const y of s)
|
|
3701
3701
|
y.onsuccess = () => {
|
|
@@ -3711,8 +3711,8 @@ async function er(n, e, t) {
|
|
|
3711
3711
|
r.onsuccess = () => s(), r.onerror = (o) => i(o);
|
|
3712
3712
|
});
|
|
3713
3713
|
}
|
|
3714
|
-
async function
|
|
3715
|
-
const t = await
|
|
3714
|
+
async function ca(n, e) {
|
|
3715
|
+
const t = await oa(`instant_${n}_5`);
|
|
3716
3716
|
if (!t)
|
|
3717
3717
|
return;
|
|
3718
3718
|
const r = await new Promise((l, f) => {
|
|
@@ -3735,7 +3735,7 @@ async function aa(n, e) {
|
|
|
3735
3735
|
for (const [l, f] of r)
|
|
3736
3736
|
switch (l) {
|
|
3737
3737
|
case "querySubs": {
|
|
3738
|
-
const p =
|
|
3738
|
+
const p = aa(l, f, o);
|
|
3739
3739
|
a.push(p);
|
|
3740
3740
|
break;
|
|
3741
3741
|
}
|
|
@@ -3751,13 +3751,13 @@ async function aa(n, e) {
|
|
|
3751
3751
|
break;
|
|
3752
3752
|
}
|
|
3753
3753
|
}
|
|
3754
|
-
const u = er(
|
|
3754
|
+
const u = er(Xe, c, i);
|
|
3755
3755
|
a.push(u), await Promise.all(a), await new Promise((l, f) => {
|
|
3756
3756
|
s.oncomplete = (p) => l(p), s.onerror = (p) => f(p), s.onabort = (p) => f(p);
|
|
3757
3757
|
});
|
|
3758
3758
|
}
|
|
3759
3759
|
const tr = /* @__PURE__ */ new Map();
|
|
3760
|
-
class
|
|
3760
|
+
class Hr extends na {
|
|
3761
3761
|
constructor(t, r) {
|
|
3762
3762
|
super(t, r);
|
|
3763
3763
|
h(this, "dbName");
|
|
@@ -3765,7 +3765,7 @@ class Gr extends ta {
|
|
|
3765
3765
|
h(this, "_appId");
|
|
3766
3766
|
h(this, "_prefix");
|
|
3767
3767
|
h(this, "_dbPromise");
|
|
3768
|
-
this.dbName = `instant_${t}_${
|
|
3768
|
+
this.dbName = `instant_${t}_${ra}`, this._storeName = r, this._appId = t, this._dbPromise = this._init();
|
|
3769
3769
|
}
|
|
3770
3770
|
_init() {
|
|
3771
3771
|
return new Promise((t, r) => {
|
|
@@ -3776,8 +3776,8 @@ class Gr extends ta {
|
|
|
3776
3776
|
}, i.onsuccess = (o) => {
|
|
3777
3777
|
const c = o.target.result;
|
|
3778
3778
|
if (s) {
|
|
3779
|
-
const u =
|
|
3780
|
-
|
|
3779
|
+
const u = ca(this._appId, c).catch((l) => {
|
|
3780
|
+
ia("Error upgrading store from version 5 to 6.")(l);
|
|
3781
3781
|
});
|
|
3782
3782
|
tr.set(this.dbName, u), u.then(() => t(c)).catch(() => t(c));
|
|
3783
3783
|
} else {
|
|
@@ -3791,7 +3791,7 @@ class Gr extends ta {
|
|
|
3791
3791
|
}
|
|
3792
3792
|
_upgradeStore(t) {
|
|
3793
3793
|
const s = t.target.result;
|
|
3794
|
-
for (const i of
|
|
3794
|
+
for (const i of sa)
|
|
3795
3795
|
s.objectStoreNames.contains(i) || s.createObjectStore(i);
|
|
3796
3796
|
}
|
|
3797
3797
|
async getItem(t) {
|
|
@@ -3856,7 +3856,7 @@ class Gr extends ta {
|
|
|
3856
3856
|
});
|
|
3857
3857
|
}
|
|
3858
3858
|
}
|
|
3859
|
-
class
|
|
3859
|
+
class Jr {
|
|
3860
3860
|
static async getIsOnline() {
|
|
3861
3861
|
return navigator.onLine;
|
|
3862
3862
|
}
|
|
@@ -3872,12 +3872,13 @@ class Hr {
|
|
|
3872
3872
|
}
|
|
3873
3873
|
}
|
|
3874
3874
|
class ee extends Error {
|
|
3875
|
-
constructor(t, r) {
|
|
3875
|
+
constructor(t, r, s) {
|
|
3876
3876
|
super(t);
|
|
3877
3877
|
h(this, "hint");
|
|
3878
|
-
this
|
|
3879
|
-
|
|
3880
|
-
|
|
3878
|
+
h(this, "traceId");
|
|
3879
|
+
this.hint = r, s && (this.traceId = s);
|
|
3880
|
+
const i = new.target.prototype;
|
|
3881
|
+
Object.setPrototypeOf && Object.setPrototypeOf(this, i), Error.captureStackTrace && Error.captureStackTrace(this, ee), this.name = "InstantError";
|
|
3881
3882
|
}
|
|
3882
3883
|
get [Symbol.toStringTag]() {
|
|
3883
3884
|
return "InstantError";
|
|
@@ -3887,7 +3888,7 @@ class At extends ee {
|
|
|
3887
3888
|
constructor(t) {
|
|
3888
3889
|
var i;
|
|
3889
3890
|
const r = ((i = t.body) == null ? void 0 : i.message) || `API Error (${t.status})`;
|
|
3890
|
-
super(r, t.body.hint);
|
|
3891
|
+
super(r, t.body.hint, t.body["trace-id"]);
|
|
3891
3892
|
h(this, "body");
|
|
3892
3893
|
h(this, "status");
|
|
3893
3894
|
const s = new.target.prototype;
|
|
@@ -3901,14 +3902,14 @@ async function be(n, e) {
|
|
|
3901
3902
|
const t = await fetch(n, e), r = await t.json();
|
|
3902
3903
|
return t.status === 200 ? Promise.resolve(r) : Promise.reject(new At({ status: t.status, body: r }));
|
|
3903
3904
|
}
|
|
3904
|
-
function
|
|
3905
|
+
function ua({ apiURI: n, appId: e, email: t }) {
|
|
3905
3906
|
return be(`${n}/runtime/auth/send_magic_code`, {
|
|
3906
3907
|
method: "POST",
|
|
3907
3908
|
headers: { "content-type": "application/json" },
|
|
3908
3909
|
body: JSON.stringify({ "app-id": e, email: t })
|
|
3909
3910
|
});
|
|
3910
3911
|
}
|
|
3911
|
-
async function
|
|
3912
|
+
async function la({ apiURI: n, appId: e, email: t, code: r, refreshToken: s }) {
|
|
3912
3913
|
return await be(`${n}/runtime/auth/verify_magic_code`, {
|
|
3913
3914
|
method: "POST",
|
|
3914
3915
|
headers: { "content-type": "application/json" },
|
|
@@ -3920,7 +3921,7 @@ async function ua({ apiURI: n, appId: e, email: t, code: r, refreshToken: s }) {
|
|
|
3920
3921
|
})
|
|
3921
3922
|
});
|
|
3922
3923
|
}
|
|
3923
|
-
async function
|
|
3924
|
+
async function fa({ apiURI: n, appId: e, refreshToken: t }) {
|
|
3924
3925
|
return await be(`${n}/runtime/auth/verify_refresh_token`, {
|
|
3925
3926
|
method: "POST",
|
|
3926
3927
|
headers: { "content-type": "application/json" },
|
|
@@ -3930,7 +3931,7 @@ async function la({ apiURI: n, appId: e, refreshToken: t }) {
|
|
|
3930
3931
|
})
|
|
3931
3932
|
});
|
|
3932
3933
|
}
|
|
3933
|
-
async function
|
|
3934
|
+
async function da({ apiURI: n, appId: e }) {
|
|
3934
3935
|
return await be(`${n}/runtime/auth/sign_in_guest`, {
|
|
3935
3936
|
method: "POST",
|
|
3936
3937
|
headers: { "content-type": "application/json" },
|
|
@@ -3951,7 +3952,7 @@ async function nr({ apiURI: n, appId: e, code: t, codeVerifier: r, refreshToken:
|
|
|
3951
3952
|
})
|
|
3952
3953
|
});
|
|
3953
3954
|
}
|
|
3954
|
-
async function
|
|
3955
|
+
async function ha({ apiURI: n, appId: e, nonce: t, idToken: r, clientName: s, refreshToken: i }) {
|
|
3955
3956
|
return await be(`${n}/runtime/oauth/id_token`, {
|
|
3956
3957
|
method: "POST",
|
|
3957
3958
|
headers: { "content-type": "application/json" },
|
|
@@ -3964,7 +3965,7 @@ async function da({ apiURI: n, appId: e, nonce: t, idToken: r, clientName: s, re
|
|
|
3964
3965
|
})
|
|
3965
3966
|
});
|
|
3966
3967
|
}
|
|
3967
|
-
async function
|
|
3968
|
+
async function pa({ apiURI: n, appId: e, refreshToken: t }) {
|
|
3968
3969
|
return await be(`${n}/runtime/signout`, {
|
|
3969
3970
|
method: "POST",
|
|
3970
3971
|
headers: {
|
|
@@ -3976,7 +3977,7 @@ async function ha({ apiURI: n, appId: e, refreshToken: t }) {
|
|
|
3976
3977
|
})
|
|
3977
3978
|
});
|
|
3978
3979
|
}
|
|
3979
|
-
async function
|
|
3980
|
+
async function ya({ apiURI: n, appId: e, path: t, file: r, refreshToken: s, contentType: i, contentDisposition: o }) {
|
|
3980
3981
|
const a = {
|
|
3981
3982
|
app_id: e,
|
|
3982
3983
|
path: t,
|
|
@@ -3989,7 +3990,7 @@ async function pa({ apiURI: n, appId: e, path: t, file: r, refreshToken: s, cont
|
|
|
3989
3990
|
body: r
|
|
3990
3991
|
});
|
|
3991
3992
|
}
|
|
3992
|
-
async function
|
|
3993
|
+
async function ba({ apiURI: n, appId: e, path: t, refreshToken: r }) {
|
|
3993
3994
|
const { data: s } = await be(`${n}/storage/files?app_id=${e}&filename=${encodeURIComponent(t)}`, {
|
|
3994
3995
|
method: "DELETE",
|
|
3995
3996
|
headers: {
|
|
@@ -3999,7 +4000,7 @@ async function ya({ apiURI: n, appId: e, path: t, refreshToken: r }) {
|
|
|
3999
4000
|
});
|
|
4000
4001
|
return s;
|
|
4001
4002
|
}
|
|
4002
|
-
async function
|
|
4003
|
+
async function _a({ apiURI: n, appId: e, fileName: t, refreshToken: r, metadata: s = {} }) {
|
|
4003
4004
|
const { data: i } = await be(`${n}/storage/signed-upload-url`, {
|
|
4004
4005
|
method: "POST",
|
|
4005
4006
|
headers: {
|
|
@@ -4013,7 +4014,7 @@ async function ba({ apiURI: n, appId: e, fileName: t, refreshToken: r, metadata:
|
|
|
4013
4014
|
});
|
|
4014
4015
|
return i;
|
|
4015
4016
|
}
|
|
4016
|
-
async function
|
|
4017
|
+
async function ga(n, e) {
|
|
4017
4018
|
return (await fetch(n, {
|
|
4018
4019
|
method: "PUT",
|
|
4019
4020
|
body: e,
|
|
@@ -4022,7 +4023,7 @@ async function _a(n, e) {
|
|
|
4022
4023
|
}
|
|
4023
4024
|
})).ok;
|
|
4024
4025
|
}
|
|
4025
|
-
async function
|
|
4026
|
+
async function ma({ apiURI: n, appId: e, path: t, refreshToken: r }) {
|
|
4026
4027
|
const { data: s } = await be(`${n}/storage/signed-download-url?app_id=${e}&filename=${encodeURIComponent(t)}`, {
|
|
4027
4028
|
method: "GET",
|
|
4028
4029
|
headers: {
|
|
@@ -4032,8 +4033,8 @@ async function ga({ apiURI: n, appId: e, path: t, refreshToken: r }) {
|
|
|
4032
4033
|
});
|
|
4033
4034
|
return s;
|
|
4034
4035
|
}
|
|
4035
|
-
let wn = !1,
|
|
4036
|
-
typeof window < "u" && typeof window.localStorage < "u" && (wn = !!window.localStorage.getItem("devBackend"),
|
|
4036
|
+
let wn = !1, Yr = !1, Zr = !1;
|
|
4037
|
+
typeof window < "u" && typeof window.localStorage < "u" && (wn = !!window.localStorage.getItem("devBackend"), Yr = !!window.localStorage.getItem("__instantLogging"), Zr = !!window.localStorage.getItem("__devtoolLocalDash"));
|
|
4037
4038
|
function rr(n, e) {
|
|
4038
4039
|
if (!e)
|
|
4039
4040
|
return n;
|
|
@@ -4042,7 +4043,7 @@ function rr(n, e) {
|
|
|
4042
4043
|
t[r] = n[r];
|
|
4043
4044
|
}), t;
|
|
4044
4045
|
}
|
|
4045
|
-
function
|
|
4046
|
+
function wa(n, e, t) {
|
|
4046
4047
|
const r = {
|
|
4047
4048
|
peers: {}
|
|
4048
4049
|
};
|
|
@@ -4059,8 +4060,8 @@ function ma(n, e, t) {
|
|
|
4059
4060
|
}
|
|
4060
4061
|
return r;
|
|
4061
4062
|
}
|
|
4062
|
-
function
|
|
4063
|
-
if (n.isLoading !== e.isLoading || n.error !== e.error || (n.user || e.user) && (!n.user || !e.user || !qn(n.user, e.user)) || !
|
|
4063
|
+
function Ta(n, e) {
|
|
4064
|
+
if (n.isLoading !== e.isLoading || n.error !== e.error || (n.user || e.user) && (!n.user || !e.user || !qn(n.user, e.user)) || !Cr(n.peers, e.peers))
|
|
4064
4065
|
return !0;
|
|
4065
4066
|
for (const r of Object.keys(n.peers))
|
|
4066
4067
|
if (!qn(n.peers[r], e.peers[r]))
|
|
@@ -4083,18 +4084,18 @@ class sr {
|
|
|
4083
4084
|
this._reject(e);
|
|
4084
4085
|
}
|
|
4085
4086
|
}
|
|
4086
|
-
function
|
|
4087
|
+
function Xr(n, e = []) {
|
|
4087
4088
|
n.forEach((t) => {
|
|
4088
4089
|
const { data: r } = t, { "datalog-result": s } = r, { "join-rows": i } = s;
|
|
4089
4090
|
for (const o of i)
|
|
4090
4091
|
for (const a of o)
|
|
4091
4092
|
e.push(a);
|
|
4092
|
-
|
|
4093
|
+
Xr(t["child-nodes"], e);
|
|
4093
4094
|
});
|
|
4094
4095
|
}
|
|
4095
4096
|
function ir(n) {
|
|
4096
4097
|
const e = [];
|
|
4097
|
-
return
|
|
4098
|
+
return Xr(n, e), e;
|
|
4098
4099
|
}
|
|
4099
4100
|
function or(n) {
|
|
4100
4101
|
return Object.values(n.links).reduce((e, t) => {
|
|
@@ -4110,8 +4111,8 @@ function or(n) {
|
|
|
4110
4111
|
}, e;
|
|
4111
4112
|
}, {});
|
|
4112
4113
|
}
|
|
4113
|
-
const
|
|
4114
|
-
function
|
|
4114
|
+
const es = "v0.22.156";
|
|
4115
|
+
function Sa(n, e) {
|
|
4115
4116
|
return {
|
|
4116
4117
|
info: n ? (...t) => console.info(...t, e()) : () => {
|
|
4117
4118
|
},
|
|
@@ -4171,7 +4172,7 @@ const ar = [
|
|
|
4171
4172
|
"before",
|
|
4172
4173
|
"fields",
|
|
4173
4174
|
"aggregate"
|
|
4174
|
-
],
|
|
4175
|
+
], va = (n) => n.valueType || "unknown", ts = (n, e, t = !1) => {
|
|
4175
4176
|
if (t || n == null)
|
|
4176
4177
|
return !0;
|
|
4177
4178
|
switch (e) {
|
|
@@ -4186,9 +4187,9 @@ const ar = [
|
|
|
4186
4187
|
default:
|
|
4187
4188
|
return !0;
|
|
4188
4189
|
}
|
|
4189
|
-
},
|
|
4190
|
+
}, Aa = (n, e, t, r, s, i, o) => {
|
|
4190
4191
|
const a = i.valueType === "json", c = (u, l, f) => {
|
|
4191
|
-
if (!
|
|
4192
|
+
if (!ts(f, l, a))
|
|
4192
4193
|
throw new U(`Invalid value for operator '${u}' on attribute '${r}' in entity '${s}'. Expected ${l}, but received: ${typeof f}`, o);
|
|
4193
4194
|
};
|
|
4194
4195
|
switch (n) {
|
|
@@ -4219,16 +4220,16 @@ const ar = [
|
|
|
4219
4220
|
throw new U(`Unknown operator '${n}' for attribute '${r}' in entity '${s}'`, o);
|
|
4220
4221
|
}
|
|
4221
4222
|
}, Le = (n, e, t, r, s) => {
|
|
4222
|
-
const i =
|
|
4223
|
+
const i = va(t), o = t.valueType === "json";
|
|
4223
4224
|
if (typeof n == "object" && n !== null && !Array.isArray(n)) {
|
|
4224
4225
|
if (o)
|
|
4225
4226
|
return;
|
|
4226
4227
|
const c = n;
|
|
4227
4228
|
for (const [u, l] of Object.entries(c))
|
|
4228
|
-
|
|
4229
|
-
} else if (!
|
|
4229
|
+
Aa(u, l, i, e, r, t, `${s}.${u}`);
|
|
4230
|
+
} else if (!ts(n, i, o))
|
|
4230
4231
|
throw new U(`Invalid value for attribute '${e}' in entity '${r}'. Expected ${i}, but received: ${typeof n}`, s);
|
|
4231
|
-
},
|
|
4232
|
+
}, Oa = (n, e, t, r, s) => {
|
|
4232
4233
|
const i = n.split(".");
|
|
4233
4234
|
if (i.length < 2)
|
|
4234
4235
|
throw new U(`Invalid dot notation path '${n}'. Must contain at least one dot.`, s);
|
|
@@ -4248,14 +4249,14 @@ const ar = [
|
|
|
4248
4249
|
if (!c)
|
|
4249
4250
|
throw new U(`Target entity '${o}' does not exist in schema for dot notation path '${n}'.`, s);
|
|
4250
4251
|
if (a === "id") {
|
|
4251
|
-
if (typeof e == "string" && !
|
|
4252
|
+
if (typeof e == "string" && !Ne(e))
|
|
4252
4253
|
throw new U(`Invalid value for id field in entity '${o}'. Expected a UUID, but received: ${e}`, s);
|
|
4253
4254
|
Le(e, n, new we("string", !1, !0), t, s);
|
|
4254
4255
|
return;
|
|
4255
4256
|
}
|
|
4256
4257
|
const u = c.attrs[a];
|
|
4257
4258
|
if (Object.keys(c.links).includes(a)) {
|
|
4258
|
-
if (typeof e == "string" && !
|
|
4259
|
+
if (typeof e == "string" && !Ne(e))
|
|
4259
4260
|
throw new U(`Invalid value for link '${a}' in entity '${o}'. Expected a UUID, but received: ${e}`, s);
|
|
4260
4261
|
Le(e, n, new we("string", !1, !0), t, s);
|
|
4261
4262
|
return;
|
|
@@ -4265,12 +4266,12 @@ const ar = [
|
|
|
4265
4266
|
throw new U(`Attribute '${a}' does not exist on entity '${o}' in dot notation path '${n}'. Available attributes: ${l.length > 0 ? l.join(", ") + ", id" : "id"}`, s);
|
|
4266
4267
|
}
|
|
4267
4268
|
Le(e, n, u, t, s);
|
|
4268
|
-
},
|
|
4269
|
+
}, ns = (n, e, t, r) => {
|
|
4269
4270
|
for (const [s, i] of Object.entries(n)) {
|
|
4270
4271
|
if (s === "or" || s === "and") {
|
|
4271
4272
|
if (Array.isArray(i))
|
|
4272
4273
|
for (const u of i)
|
|
4273
|
-
typeof u == "object" && u !== null &&
|
|
4274
|
+
typeof u == "object" && u !== null && ns(u, e, t, `${r}.${s}[${u}]`);
|
|
4274
4275
|
continue;
|
|
4275
4276
|
}
|
|
4276
4277
|
if (s === "id") {
|
|
@@ -4278,7 +4279,7 @@ const ar = [
|
|
|
4278
4279
|
continue;
|
|
4279
4280
|
}
|
|
4280
4281
|
if (s.includes(".")) {
|
|
4281
|
-
|
|
4282
|
+
Oa(s, i, e, t, `${r}.${s}`);
|
|
4282
4283
|
continue;
|
|
4283
4284
|
}
|
|
4284
4285
|
const o = t.entities[e];
|
|
@@ -4292,13 +4293,13 @@ const ar = [
|
|
|
4292
4293
|
if (a)
|
|
4293
4294
|
Le(i, s, a, e, `${r}.${s}`);
|
|
4294
4295
|
else if (c) {
|
|
4295
|
-
if (typeof i == "string" && !
|
|
4296
|
+
if (typeof i == "string" && !Ne(i))
|
|
4296
4297
|
throw new U(`Invalid value for link '${s}' in entity '${e}'. Expected a UUID, but received: ${i}`, `${r}.${s}`);
|
|
4297
4298
|
const u = new we("string", !1, !0);
|
|
4298
4299
|
Le(i, s, u, e, `${r}.${s}`);
|
|
4299
4300
|
}
|
|
4300
4301
|
}
|
|
4301
|
-
},
|
|
4302
|
+
}, Ea = (n, e, t, r, s = 0) => {
|
|
4302
4303
|
for (const o of Object.keys(n))
|
|
4303
4304
|
if (!ar.includes(o))
|
|
4304
4305
|
throw new U(`Invalid query parameter '${o}' in $ object. Valid parameters are: ${ar.join(", ")}. Found: ${o}`, r);
|
|
@@ -4316,9 +4317,9 @@ const ar = [
|
|
|
4316
4317
|
if (n.where && t) {
|
|
4317
4318
|
if (typeof n.where != "object" || n.where === null)
|
|
4318
4319
|
throw new U(`'where' clause must be an object in entity '${e}', but received: ${typeof n.where}`, r ? `${r}.where` : void 0);
|
|
4319
|
-
|
|
4320
|
+
ns(n.where, e, t, r ? `${r}.where` : "where");
|
|
4320
4321
|
}
|
|
4321
|
-
},
|
|
4322
|
+
}, rs = (n, e, t, r, s = 0) => {
|
|
4322
4323
|
var i;
|
|
4323
4324
|
if (!n || typeof n != "object")
|
|
4324
4325
|
throw new U(`Query part for entity '${e}' must be an object, but received: ${typeof n}`, r);
|
|
@@ -4331,13 +4332,13 @@ const ar = [
|
|
|
4331
4332
|
const a = n[o];
|
|
4332
4333
|
if (typeof a == "object" && a !== null) {
|
|
4333
4334
|
const c = (i = t == null ? void 0 : t.entities[e].links[o]) == null ? void 0 : i.entityName;
|
|
4334
|
-
c &&
|
|
4335
|
+
c && rs(a, c, t, `${r}.${o}`, s + 1);
|
|
4335
4336
|
}
|
|
4336
4337
|
} else {
|
|
4337
4338
|
const a = n[o];
|
|
4338
4339
|
if (typeof a != "object" || a === null)
|
|
4339
4340
|
throw new U(`Query parameter '$' must be an object in entity '${e}', but received: ${typeof a}`, `${r}.$`);
|
|
4340
|
-
|
|
4341
|
+
Ea(a, e, t, `${r}.$`, s);
|
|
4341
4342
|
}
|
|
4342
4343
|
}, cr = (n, e) => {
|
|
4343
4344
|
if (typeof n != "object" || n === null)
|
|
@@ -4355,48 +4356,48 @@ const ar = [
|
|
|
4355
4356
|
const s = Object.keys(e.entities);
|
|
4356
4357
|
throw new U(`Entity '${r}' does not exist in schema. Available entities: ${s.length > 0 ? s.join(", ") : "none"}`, r);
|
|
4357
4358
|
}
|
|
4358
|
-
|
|
4359
|
+
rs(t[r], r, e, r, 0);
|
|
4359
4360
|
}
|
|
4360
4361
|
}
|
|
4361
|
-
}, ur = (n) => typeof n != "string" ? !1 : Tt(n) ? !0 :
|
|
4362
|
+
}, ur = (n) => typeof n != "string" ? !1 : Tt(n) ? !0 : Ne(n);
|
|
4362
4363
|
class fe extends Error {
|
|
4363
4364
|
constructor(e) {
|
|
4364
4365
|
super(e), this.name = "TransactionValidationError";
|
|
4365
4366
|
}
|
|
4366
4367
|
}
|
|
4367
|
-
const
|
|
4368
|
+
const ss = (n) => n.length > 0 ? n.join(", ") : "none", ka = (n, e) => new fe(`Entity '${n}' does not exist in schema. Available entities: ${ss(e)}`), $t = {
|
|
4368
4369
|
string: (n) => typeof n == "string",
|
|
4369
4370
|
number: (n) => typeof n == "number" && !isNaN(n),
|
|
4370
4371
|
boolean: (n) => typeof n == "boolean",
|
|
4371
4372
|
date: (n) => n instanceof Date || typeof n == "string" || typeof n == "number",
|
|
4372
4373
|
json: () => !0
|
|
4373
|
-
},
|
|
4374
|
+
}, Ca = (n, e) => {
|
|
4374
4375
|
var t;
|
|
4375
4376
|
return n == null ? !0 : ((t = $t[e.valueType]) == null ? void 0 : t.call($t, n)) ?? !1;
|
|
4376
|
-
},
|
|
4377
|
+
}, is = (n, e) => {
|
|
4377
4378
|
const t = e.entities[n];
|
|
4378
4379
|
if (!t)
|
|
4379
|
-
throw
|
|
4380
|
+
throw ka(n, Object.keys(e.entities));
|
|
4380
4381
|
return t;
|
|
4381
4382
|
}, xt = (n, e, t) => {
|
|
4382
|
-
const r =
|
|
4383
|
+
const r = is(n, t);
|
|
4383
4384
|
if (typeof e != "object" || e === null)
|
|
4384
4385
|
throw new fe(`Arguments for data operation on entity '${n}' must be an object, but received: ${typeof e}`);
|
|
4385
4386
|
for (const [s, i] of Object.entries(e)) {
|
|
4386
4387
|
if (s === "id")
|
|
4387
4388
|
continue;
|
|
4388
4389
|
const o = r.attrs[s];
|
|
4389
|
-
if (o && !
|
|
4390
|
+
if (o && !Ca(i, o))
|
|
4390
4391
|
throw new fe(`Invalid value for attribute '${s}' in entity '${n}'. Expected ${o.valueType}, but received: ${typeof i}`);
|
|
4391
4392
|
}
|
|
4392
4393
|
}, lr = (n, e, t) => {
|
|
4393
|
-
const r =
|
|
4394
|
+
const r = is(n, t);
|
|
4394
4395
|
if (typeof e != "object" || e === null)
|
|
4395
4396
|
throw new fe(`Arguments for link operation on entity '${n}' must be an object, but received: ${typeof e}`);
|
|
4396
4397
|
for (const [s, i] of Object.entries(e)) {
|
|
4397
4398
|
if (!r.links[s]) {
|
|
4398
4399
|
const a = Object.keys(r.links);
|
|
4399
|
-
throw new fe(`Link '${s}' does not exist on entity '${n}'. Available links: ${
|
|
4400
|
+
throw new fe(`Link '${s}' does not exist on entity '${n}'. Available links: ${ss(a)}`);
|
|
4400
4401
|
}
|
|
4401
4402
|
if (i != null) {
|
|
4402
4403
|
if (Array.isArray(i)) {
|
|
@@ -4407,7 +4408,7 @@ const rs = (n) => n.length > 0 ? n.join(", ") : "none", Ea = (n, e) => new fe(`E
|
|
|
4407
4408
|
throw new fe(`Invalid UUID in link '${s}' for entity '${n}'. Expected a UUID, but received: ${i}`);
|
|
4408
4409
|
}
|
|
4409
4410
|
}
|
|
4410
|
-
},
|
|
4411
|
+
}, Ia = {
|
|
4411
4412
|
create: xt,
|
|
4412
4413
|
update: xt,
|
|
4413
4414
|
merge: xt,
|
|
@@ -4415,17 +4416,17 @@ const rs = (n) => n.length > 0 ? n.join(", ") : "none", Ea = (n, e) => new fe(`E
|
|
|
4415
4416
|
unlink: lr,
|
|
4416
4417
|
delete: () => {
|
|
4417
4418
|
}
|
|
4418
|
-
},
|
|
4419
|
+
}, Pa = (n, e) => {
|
|
4419
4420
|
if (!e)
|
|
4420
4421
|
return;
|
|
4421
4422
|
const [t, r, s, i] = n;
|
|
4422
|
-
if (!Array.isArray(s) && !
|
|
4423
|
+
if (!Array.isArray(s) && !Ne(s))
|
|
4423
4424
|
throw new fe(`Invalid id for entity '${r}'. Expected a UUID, but received: ${s}`);
|
|
4424
4425
|
if (typeof r != "string")
|
|
4425
4426
|
throw new fe(`Entity name must be a string, but received: ${typeof r}`);
|
|
4426
|
-
const o =
|
|
4427
|
+
const o = Ia[t];
|
|
4427
4428
|
o && i !== void 0 && o(r, i, e);
|
|
4428
|
-
},
|
|
4429
|
+
}, Ma = (n, e) => {
|
|
4429
4430
|
const t = Array.isArray(n) ? n : [n];
|
|
4430
4431
|
for (const r of t) {
|
|
4431
4432
|
if (!r || typeof r != "object")
|
|
@@ -4435,11 +4436,11 @@ const rs = (n) => n.length > 0 ? n.join(", ") : "none", Ea = (n, e) => new fe(`E
|
|
|
4435
4436
|
for (const s of r.__ops) {
|
|
4436
4437
|
if (!Array.isArray(s))
|
|
4437
4438
|
throw new fe(`Transaction operation must be an array, but received: ${typeof s}`);
|
|
4438
|
-
|
|
4439
|
+
Pa(s, e);
|
|
4439
4440
|
}
|
|
4440
4441
|
}
|
|
4441
4442
|
};
|
|
4442
|
-
let
|
|
4443
|
+
let os = 0;
|
|
4443
4444
|
class fr {
|
|
4444
4445
|
constructor(e) {
|
|
4445
4446
|
h(this, "type", "ws");
|
|
@@ -4449,7 +4450,7 @@ class fr {
|
|
|
4449
4450
|
h(this, "onmessage");
|
|
4450
4451
|
h(this, "onclose");
|
|
4451
4452
|
h(this, "onerror");
|
|
4452
|
-
this.id = `${this.type}_${
|
|
4453
|
+
this.id = `${this.type}_${os++}`, this.conn = new WebSocket(e), this.conn.onopen = (t) => {
|
|
4453
4454
|
this.onopen && this.onopen({ target: this });
|
|
4454
4455
|
}, this.conn.onmessage = (t) => {
|
|
4455
4456
|
this.onmessage && this.onmessage({
|
|
@@ -4475,7 +4476,7 @@ class fr {
|
|
|
4475
4476
|
return this.conn.send(JSON.stringify(e));
|
|
4476
4477
|
}
|
|
4477
4478
|
}
|
|
4478
|
-
class
|
|
4479
|
+
class Ra {
|
|
4479
4480
|
constructor(e, t, r) {
|
|
4480
4481
|
h(this, "type", "sse");
|
|
4481
4482
|
h(this, "initParams", null);
|
|
@@ -4492,7 +4493,7 @@ class Ma {
|
|
|
4492
4493
|
h(this, "onmessage");
|
|
4493
4494
|
h(this, "onclose");
|
|
4494
4495
|
h(this, "onerror");
|
|
4495
|
-
this.id = `${this.type}_${
|
|
4496
|
+
this.id = `${this.type}_${os++}`, this.url = t, this.messageUrl = r || this.url, this.ES = e, this.conn = new e(t), this.sseInitTimeout = setTimeout(() => {
|
|
4496
4497
|
this.initParams || this.handleError();
|
|
4497
4498
|
}, 1e4), this.conn.onmessage = (s) => {
|
|
4498
4499
|
const i = JSON.parse(s.data);
|
|
@@ -4572,24 +4573,24 @@ class Ma {
|
|
|
4572
4573
|
this.handleClose();
|
|
4573
4574
|
}
|
|
4574
4575
|
}
|
|
4575
|
-
function
|
|
4576
|
+
function ja(n, e) {
|
|
4576
4577
|
const t = n.values;
|
|
4577
4578
|
if (t) {
|
|
4578
|
-
const r =
|
|
4579
|
+
const r = Dr(t.attrsStore, null);
|
|
4579
4580
|
if (r) {
|
|
4580
4581
|
for (const s of t.entities || [])
|
|
4581
|
-
s.store.useDateObjects = e, s.store =
|
|
4582
|
+
s.store.useDateObjects = e, s.store = jr(r, s.store);
|
|
4582
4583
|
t.attrsStore = r;
|
|
4583
4584
|
}
|
|
4584
4585
|
}
|
|
4585
4586
|
return n;
|
|
4586
4587
|
}
|
|
4587
|
-
function
|
|
4588
|
+
function Da(n, e) {
|
|
4588
4589
|
var t;
|
|
4589
4590
|
if (e.values) {
|
|
4590
4591
|
const r = [];
|
|
4591
4592
|
for (const s of (t = e.values) == null ? void 0 : t.entities) {
|
|
4592
|
-
const i =
|
|
4593
|
+
const i = Rr(s.store);
|
|
4593
4594
|
r.push({ ...s, store: i });
|
|
4594
4595
|
}
|
|
4595
4596
|
return {
|
|
@@ -4599,34 +4600,34 @@ function ja(n, e) {
|
|
|
4599
4600
|
} else
|
|
4600
4601
|
return e;
|
|
4601
4602
|
}
|
|
4602
|
-
function
|
|
4603
|
+
function $a(n, e, t) {
|
|
4603
4604
|
var i, o;
|
|
4604
4605
|
const r = (i = e == null ? void 0 : e.state) == null ? void 0 : i.txId, s = (o = t == null ? void 0 : t.state) == null ? void 0 : o.txId;
|
|
4605
4606
|
return r && (!s || r > s) ? e : s && (!r || s > r) ? t : e || t;
|
|
4606
4607
|
}
|
|
4607
4608
|
function Ut(n, e, t) {
|
|
4608
|
-
return
|
|
4609
|
+
return Br({ store: e, attrsStore: t, pageInfo: null, aggregate: null }, n.query).data[n.table][0];
|
|
4609
4610
|
}
|
|
4610
4611
|
function dr(n, e, t, r) {
|
|
4611
4612
|
var o;
|
|
4612
4613
|
const s = (o = W(t, n.table, "id")) == null ? void 0 : o.id;
|
|
4613
4614
|
if (!s)
|
|
4614
4615
|
return -1;
|
|
4615
|
-
const i =
|
|
4616
|
+
const i = qe(e.eav, [r, s, r]);
|
|
4616
4617
|
return i ? i[3] : -1;
|
|
4617
4618
|
}
|
|
4618
4619
|
function hr(n, e, t) {
|
|
4619
4620
|
for (const { action: r, triple: s } of t)
|
|
4620
4621
|
switch (r) {
|
|
4621
4622
|
case "added":
|
|
4622
|
-
|
|
4623
|
+
Ur(n, e, s);
|
|
4623
4624
|
break;
|
|
4624
4625
|
case "removed":
|
|
4625
|
-
|
|
4626
|
+
$r(n, e, s);
|
|
4626
4627
|
break;
|
|
4627
4628
|
}
|
|
4628
4629
|
}
|
|
4629
|
-
function
|
|
4630
|
+
function xa(n, e, t) {
|
|
4630
4631
|
var s, i;
|
|
4631
4632
|
const r = {};
|
|
4632
4633
|
for (const { action: o, triple: a } of t) {
|
|
@@ -4654,35 +4655,35 @@ function $a(n, e, t) {
|
|
|
4654
4655
|
function ft(n, e) {
|
|
4655
4656
|
return { [n.table]: e.map((t) => t.entity) };
|
|
4656
4657
|
}
|
|
4657
|
-
function
|
|
4658
|
+
function Ua(n, e) {
|
|
4658
4659
|
var r;
|
|
4659
4660
|
if (n.orderFieldType)
|
|
4660
4661
|
return n.orderFieldType;
|
|
4661
4662
|
const t = n.orderField === "serverCreatedAt" ? "number" : (r = W(e(), n.table, n.orderField)) == null ? void 0 : r["checked-data-type"];
|
|
4662
4663
|
return n.orderFieldType = t, t;
|
|
4663
4664
|
}
|
|
4664
|
-
function
|
|
4665
|
+
function La(n, e, t) {
|
|
4665
4666
|
const r = e;
|
|
4666
4667
|
if (n.orderField === "serverCreatedAt") {
|
|
4667
4668
|
t.sort(n.orderDirection === "asc" ? function(o, a) {
|
|
4668
|
-
return
|
|
4669
|
+
return Je(o.entity.id, o.serverCreatedAt, a.entity.id, a.serverCreatedAt, r);
|
|
4669
4670
|
} : function(o, a) {
|
|
4670
|
-
return
|
|
4671
|
+
return Je(a.entity.id, a.serverCreatedAt, o.entity.id, o.serverCreatedAt, r);
|
|
4671
4672
|
});
|
|
4672
4673
|
return;
|
|
4673
4674
|
}
|
|
4674
4675
|
const s = n.orderField;
|
|
4675
4676
|
t.sort(n.orderDirection === "asc" ? function(o, a) {
|
|
4676
|
-
return
|
|
4677
|
+
return Je(o.entity.id, o.entity[s], a.entity.id, a.entity[s], r);
|
|
4677
4678
|
} : function(o, a) {
|
|
4678
|
-
return
|
|
4679
|
+
return Je(a.entity.id, a.entity[s], o.entity.id, o.entity[s], r);
|
|
4679
4680
|
});
|
|
4680
4681
|
}
|
|
4681
4682
|
var Ee;
|
|
4682
4683
|
(function(n) {
|
|
4683
4684
|
n.InitialSyncBatch = "InitialSyncBatch", n.InitialSyncComplete = "InitialSyncComplete", n.LoadFromStorage = "LoadFromStorage", n.SyncTransaction = "SyncTransaction", n.Error = "Error";
|
|
4684
4685
|
})(Ee || (Ee = {}));
|
|
4685
|
-
class
|
|
4686
|
+
class Fa {
|
|
4686
4687
|
constructor(e, t, r, s, i, o) {
|
|
4687
4688
|
h(this, "trySend");
|
|
4688
4689
|
h(this, "subs");
|
|
@@ -4695,9 +4696,9 @@ class La {
|
|
|
4695
4696
|
h(this, "getAttrs");
|
|
4696
4697
|
this.trySend = e, this.config = r, this.log = s, this.createStore = i, this.getAttrs = o, this.subs = new sn({
|
|
4697
4698
|
persister: t,
|
|
4698
|
-
merge:
|
|
4699
|
-
serialize:
|
|
4700
|
-
parse: (a, c) =>
|
|
4699
|
+
merge: $a,
|
|
4700
|
+
serialize: Da,
|
|
4701
|
+
parse: (a, c) => ja(c, this.config.useDateObjects),
|
|
4701
4702
|
objectSize: (a) => {
|
|
4702
4703
|
var c;
|
|
4703
4704
|
return ((c = a.values) == null ? void 0 : c.entities.length) || 0;
|
|
@@ -4892,9 +4893,9 @@ class La {
|
|
|
4892
4893
|
e: for (const [T, S] of Object.entries(u))
|
|
4893
4894
|
for (let _ = 0; _ < f.length; _++) {
|
|
4894
4895
|
const w = f[_];
|
|
4895
|
-
if (
|
|
4896
|
+
if (bi(w.store, T)) {
|
|
4896
4897
|
hr(w.store, l.attrsStore, S);
|
|
4897
|
-
const C = Ut(s, w.store, l.attrsStore), v =
|
|
4898
|
+
const C = Ut(s, w.store, l.attrsStore), v = xa(w.store, l.attrsStore, S)[T];
|
|
4898
4899
|
C ? (p.push({
|
|
4899
4900
|
oldEntity: w.entity,
|
|
4900
4901
|
newEntity: C,
|
|
@@ -4925,8 +4926,8 @@ class La {
|
|
|
4925
4926
|
const b = [];
|
|
4926
4927
|
for (const T of c.sort().reverse())
|
|
4927
4928
|
b.push(f[T].entity), f.splice(T, 1);
|
|
4928
|
-
const g =
|
|
4929
|
-
|
|
4929
|
+
const g = Ua(s, this.getAttrs);
|
|
4930
|
+
La(s, g, f), this.notifyCbs(r, {
|
|
4930
4931
|
type: Ee.SyncTransaction,
|
|
4931
4932
|
data: ft(s, (o = s.values) == null ? void 0 : o.entities),
|
|
4932
4933
|
added: y,
|
|
@@ -4967,7 +4968,7 @@ class La {
|
|
|
4967
4968
|
r && this.initSubscription(r.query, r.hash);
|
|
4968
4969
|
}
|
|
4969
4970
|
}
|
|
4970
|
-
function
|
|
4971
|
+
function Na({ WStream: n, opts: e, startStream: t, appendStream: r, registerStream: s }) {
|
|
4971
4972
|
const i = e.clientId;
|
|
4972
4973
|
let o = null, a = null, c = null;
|
|
4973
4974
|
const u = L();
|
|
@@ -5077,8 +5078,8 @@ function Fa({ WStream: n, opts: e, startStream: t, appendStream: r, registerStre
|
|
|
5077
5078
|
});
|
|
5078
5079
|
switch (ne.type) {
|
|
5079
5080
|
case "ok": {
|
|
5080
|
-
const { streamId: de, offset:
|
|
5081
|
-
if (
|
|
5081
|
+
const { streamId: de, offset: We } = ne;
|
|
5082
|
+
if (We !== 0) {
|
|
5082
5083
|
const he = new ee("Write stream is corrupted");
|
|
5083
5084
|
Y(O, he);
|
|
5084
5085
|
return;
|
|
@@ -5115,10 +5116,10 @@ function Fa({ WStream: n, opts: e, startStream: t, appendStream: r, registerStre
|
|
|
5115
5116
|
he();
|
|
5116
5117
|
}, de = (he) => {
|
|
5117
5118
|
I(he), ne();
|
|
5118
|
-
},
|
|
5119
|
+
}, We = (he) => {
|
|
5119
5120
|
B(he || new ee("Stream is closed.")), ne();
|
|
5120
5121
|
};
|
|
5121
|
-
G.push(x(de)), G.push(v(
|
|
5122
|
+
G.push(x(de)), G.push(v(We));
|
|
5122
5123
|
});
|
|
5123
5124
|
}
|
|
5124
5125
|
}
|
|
@@ -5166,7 +5167,7 @@ function Fa({ WStream: n, opts: e, startStream: t, appendStream: r, registerStre
|
|
|
5166
5167
|
}
|
|
5167
5168
|
};
|
|
5168
5169
|
}
|
|
5169
|
-
class
|
|
5170
|
+
class Ka {
|
|
5170
5171
|
constructor() {
|
|
5171
5172
|
h(this, "items", []);
|
|
5172
5173
|
h(this, "resolvers", []);
|
|
@@ -5200,7 +5201,7 @@ class Na {
|
|
|
5200
5201
|
}
|
|
5201
5202
|
}
|
|
5202
5203
|
}
|
|
5203
|
-
function
|
|
5204
|
+
function qa({ RStream: n, opts: e, startStream: t, cancelStream: r }) {
|
|
5204
5205
|
let s = e.byteOffset || 0, i = !1;
|
|
5205
5206
|
const o = new TextDecoder("utf-8"), a = new TextEncoder();
|
|
5206
5207
|
let c, u = !1;
|
|
@@ -5326,7 +5327,7 @@ function Ka({ RStream: n, opts: e, startStream: t, cancelStream: r }) {
|
|
|
5326
5327
|
}
|
|
5327
5328
|
};
|
|
5328
5329
|
}
|
|
5329
|
-
class
|
|
5330
|
+
class Wa {
|
|
5330
5331
|
constructor({ WStream: e, RStream: t, trySend: r, log: s }) {
|
|
5331
5332
|
h(this, "trySend");
|
|
5332
5333
|
h(this, "WStream");
|
|
@@ -5339,7 +5340,7 @@ class qa {
|
|
|
5339
5340
|
this.WStream = e, this.RStream = t, this.trySend = r, this.log = s;
|
|
5340
5341
|
}
|
|
5341
5342
|
createWriteStream(e) {
|
|
5342
|
-
const { stream: t, addCompleteCb: r } =
|
|
5343
|
+
const { stream: t, addCompleteCb: r } = Na({
|
|
5343
5344
|
WStream: this.WStream,
|
|
5344
5345
|
startStream: this.startWriteStream.bind(this),
|
|
5345
5346
|
appendStream: this.appendStream.bind(this),
|
|
@@ -5351,7 +5352,7 @@ class qa {
|
|
|
5351
5352
|
}), t;
|
|
5352
5353
|
}
|
|
5353
5354
|
createReadStream(e) {
|
|
5354
|
-
const { stream: t, addCloseCb: r } =
|
|
5355
|
+
const { stream: t, addCloseCb: r } = qa({
|
|
5355
5356
|
RStream: this.RStream,
|
|
5356
5357
|
opts: e,
|
|
5357
5358
|
startStream: this.startReadStream.bind(this),
|
|
@@ -5413,7 +5414,7 @@ class qa {
|
|
|
5413
5414
|
if (!r && !t)
|
|
5414
5415
|
throw new Error("Must provide one of streamId or clientId to subscribe to the stream.");
|
|
5415
5416
|
r && (o["stream-id"] = r), t && (o["client-id"] = t), s && (o.offset = s), i && (o["rule-params"] = i);
|
|
5416
|
-
const a = new
|
|
5417
|
+
const a = new Ka();
|
|
5417
5418
|
return this.readStreamIterators[e] = a, this.trySend(e, o), a;
|
|
5418
5419
|
}
|
|
5419
5420
|
cancelReadStream({ eventId: e }) {
|
|
@@ -5494,23 +5495,23 @@ const _e = {
|
|
|
5494
5495
|
AUTHENTICATED: "authenticated",
|
|
5495
5496
|
CLOSED: "closed",
|
|
5496
5497
|
ERRORED: "errored"
|
|
5497
|
-
},
|
|
5498
|
+
}, za = 3e4, Va = 3e4, Ba = 200, Qa = 1e3 * 60, Ga = {
|
|
5498
5499
|
apiURI: "https://api.instantdb.com",
|
|
5499
5500
|
websocketURI: "wss://api.instantdb.com/runtime/session"
|
|
5500
5501
|
}, Lt = "_instant_oauth_redirect", xe = "currentUser";
|
|
5501
|
-
function
|
|
5502
|
+
function Ha({ transportType: n, appId: e, apiURI: t, wsURI: r, EventSourceImpl: s }) {
|
|
5502
5503
|
if (!s)
|
|
5503
5504
|
return new fr(`${r}?app_id=${e}`);
|
|
5504
5505
|
switch (n) {
|
|
5505
5506
|
case "ws":
|
|
5506
5507
|
return new fr(`${r}?app_id=${e}`);
|
|
5507
5508
|
case "sse":
|
|
5508
|
-
return new
|
|
5509
|
+
return new Ra(s, `${t}/runtime/sse?app_id=${e}`);
|
|
5509
5510
|
default:
|
|
5510
5511
|
throw new Error("Unknown transport type " + n);
|
|
5511
5512
|
}
|
|
5512
5513
|
}
|
|
5513
|
-
function
|
|
5514
|
+
function Ja() {
|
|
5514
5515
|
return typeof window < "u" || typeof chrome < "u";
|
|
5515
5516
|
}
|
|
5516
5517
|
const pr = {
|
|
@@ -5519,14 +5520,14 @@ const pr = {
|
|
|
5519
5520
|
"refresh-presence": !0,
|
|
5520
5521
|
"patch-presence": !0
|
|
5521
5522
|
};
|
|
5522
|
-
function
|
|
5523
|
+
function Ya(n, e) {
|
|
5523
5524
|
var r;
|
|
5524
5525
|
const t = typeof n == "string" ? JSON.parse(n) : n;
|
|
5525
5526
|
if ((r = t == null ? void 0 : t.result) != null && r.store) {
|
|
5526
|
-
const s =
|
|
5527
|
+
const s = Dr(t.result.attrsStore, t.result.store);
|
|
5527
5528
|
if (s) {
|
|
5528
5529
|
const i = t.result.store;
|
|
5529
|
-
t.result.store =
|
|
5530
|
+
t.result.store = jr(s, {
|
|
5530
5531
|
...i,
|
|
5531
5532
|
useDateObjects: e
|
|
5532
5533
|
}), t.result.attrsStore = s;
|
|
@@ -5534,7 +5535,7 @@ function Ja(n, e) {
|
|
|
5534
5535
|
}
|
|
5535
5536
|
return t;
|
|
5536
5537
|
}
|
|
5537
|
-
function
|
|
5538
|
+
function Za(n, e) {
|
|
5538
5539
|
const { result: t, ...r } = e, s = (
|
|
5539
5540
|
/** @type {import('./reactorTypes.ts').QuerySubInStorage} */
|
|
5540
5541
|
r
|
|
@@ -5542,14 +5543,14 @@ function Ya(n, e) {
|
|
|
5542
5543
|
if (t) {
|
|
5543
5544
|
const i = {
|
|
5544
5545
|
...t,
|
|
5545
|
-
store:
|
|
5546
|
+
store: Rr(t.store),
|
|
5546
5547
|
attrsStore: t.attrsStore.toJSON()
|
|
5547
5548
|
};
|
|
5548
5549
|
s.result = i;
|
|
5549
5550
|
}
|
|
5550
5551
|
return s;
|
|
5551
5552
|
}
|
|
5552
|
-
function
|
|
5553
|
+
function Xa(n, e) {
|
|
5553
5554
|
switch (n) {
|
|
5554
5555
|
case "pendingMutations":
|
|
5555
5556
|
return new Map(typeof e == "string" ? JSON.parse(e) : e);
|
|
@@ -5557,7 +5558,7 @@ function Za(n, e) {
|
|
|
5557
5558
|
return e;
|
|
5558
5559
|
}
|
|
5559
5560
|
}
|
|
5560
|
-
function
|
|
5561
|
+
function ec(n, e) {
|
|
5561
5562
|
switch (n) {
|
|
5562
5563
|
case "pendingMutations":
|
|
5563
5564
|
return [...e.entries()];
|
|
@@ -5565,7 +5566,7 @@ function Xa(n, e) {
|
|
|
5565
5566
|
return e;
|
|
5566
5567
|
}
|
|
5567
5568
|
}
|
|
5568
|
-
function
|
|
5569
|
+
function tc(n, e, t) {
|
|
5569
5570
|
const r = e == null ? void 0 : e.result, s = t == null ? void 0 : t.result;
|
|
5570
5571
|
return r && !s && t && (t.result = r), t || e;
|
|
5571
5572
|
}
|
|
@@ -5575,8 +5576,8 @@ function Ft(n) {
|
|
|
5575
5576
|
return a == c ? r < i ? -1 : r > i ? 1 : 0 : a - c;
|
|
5576
5577
|
});
|
|
5577
5578
|
}
|
|
5578
|
-
class
|
|
5579
|
-
constructor(e, t =
|
|
5579
|
+
class nc {
|
|
5580
|
+
constructor(e, t = Hr, r = Jr, s, i) {
|
|
5580
5581
|
/** @type {s.AttrsStore | undefined} */
|
|
5581
5582
|
h(this, "attrs");
|
|
5582
5583
|
h(this, "_isOnline", !0);
|
|
@@ -5634,6 +5635,8 @@ class tc {
|
|
|
5634
5635
|
h(this, "_pendingTxCleanupTimeout");
|
|
5635
5636
|
h(this, "_pendingMutationCleanupThreshold");
|
|
5636
5637
|
h(this, "_inFlightMutationEventIds", /* @__PURE__ */ new Set());
|
|
5638
|
+
/** @type FrameworkClient | null */
|
|
5639
|
+
h(this, "_frameworkClient", null);
|
|
5637
5640
|
h(this, "_onMergeKv", (e, t, r) => {
|
|
5638
5641
|
switch (e) {
|
|
5639
5642
|
case "pendingMutations": {
|
|
@@ -5672,9 +5675,9 @@ class tc {
|
|
|
5672
5675
|
});
|
|
5673
5676
|
/** Applies transactions locally and sends transact message to server */
|
|
5674
5677
|
h(this, "pushTx", (e) => {
|
|
5675
|
-
this.config.disableValidation ||
|
|
5678
|
+
this.config.disableValidation || Ma(e, this.config.schema);
|
|
5676
5679
|
try {
|
|
5677
|
-
const t =
|
|
5680
|
+
const t = ta({
|
|
5678
5681
|
attrsStore: this.optimisticAttrs(),
|
|
5679
5682
|
schema: this.config.schema,
|
|
5680
5683
|
stores: Object.values(this.querySubs.currentValue).map((r) => {
|
|
@@ -5775,10 +5778,10 @@ class tc {
|
|
|
5775
5778
|
}
|
|
5776
5779
|
this._log.info("[socket][close]", t.id, "schedule reconnect, ms =", this._reconnectTimeoutMs), this._scheduleReconnect();
|
|
5777
5780
|
});
|
|
5778
|
-
if (this._EventSource = i, this.config = { ...
|
|
5781
|
+
if (this._EventSource = i, this.config = { ...Ga, ...e }, this.queryCacheLimit = this.config.queryCacheLimit ?? 10, this._pendingTxCleanupTimeout = this.config.pendingTxCleanupTimeout ?? Va, this._pendingMutationCleanupThreshold = this.config.pendingMutationCleanupThreshold ?? Ba, this._log = Sa(e.verbose || wn || Yr, () => this._reactorStats()), this.versions = { ...s || {}, "@instantdb/core": es }, this.config.schema && (this._linkIndex = or(this.config.schema)), !!Ja()) {
|
|
5779
5782
|
if (!e.appId)
|
|
5780
5783
|
throw new Error("Instant must be initialized with an appId.");
|
|
5781
|
-
if (!
|
|
5784
|
+
if (!Ne(e.appId))
|
|
5782
5785
|
throw new Error(`Instant must be initialized with a valid appId. \`${e.appId}\` is not a valid uuid.`);
|
|
5783
5786
|
typeof BroadcastChannel == "function" && (this._broadcastChannel = new BroadcastChannel("@instantdb"), this._broadcastChannel.addEventListener("message", async (o) => {
|
|
5784
5787
|
var a;
|
|
@@ -5794,9 +5797,9 @@ class tc {
|
|
|
5794
5797
|
} catch (c) {
|
|
5795
5798
|
this._log.error("[error] handle broadcast channel", c);
|
|
5796
5799
|
}
|
|
5797
|
-
})), this._initStorage(t), this._syncTable = new
|
|
5800
|
+
})), this._initStorage(t), this._syncTable = new Fa(this._trySendAuthed.bind(this), new t(this.config.appId, "syncSubs"), {
|
|
5798
5801
|
useDateObjects: this.config.useDateObjects
|
|
5799
|
-
}, this._log, (o) =>
|
|
5802
|
+
}, this._log, (o) => He(this.ensureAttrs(), o, this.config.enableCardinalityInference, this.config.useDateObjects), () => this.ensureAttrs()), this._instantStream = new Wa({
|
|
5800
5803
|
WStream: this.config.WritableStream || WritableStream,
|
|
5801
5804
|
RStream: this.config.ReadableStream || ReadableStream,
|
|
5802
5805
|
trySend: this._trySendAuthed.bind(this),
|
|
@@ -5806,13 +5809,20 @@ class tc {
|
|
|
5806
5809
|
}), setInterval(async () => {
|
|
5807
5810
|
const o = await this.getCurrentUser();
|
|
5808
5811
|
this.syncUserToEndpoint(o.user);
|
|
5809
|
-
},
|
|
5812
|
+
}, Qa), r.getIsOnline().then((o) => {
|
|
5810
5813
|
this._isOnline = o, this._startSocket(), r.listen((a) => {
|
|
5811
5814
|
a !== this._isOnline && (this._log.info("[network] online =", a), this._isOnline = a, this._isOnline ? this._startSocket() : (this._log.info("Changing status from", this.status, "to", _e.CLOSED), this._setStatus(_e.CLOSED)));
|
|
5812
5815
|
});
|
|
5813
5816
|
}), typeof addEventListener < "u" && (this._beforeUnload = this._beforeUnload.bind(this), addEventListener("beforeunload", this._beforeUnload));
|
|
5814
5817
|
}
|
|
5815
5818
|
}
|
|
5819
|
+
getFrameworkClient() {
|
|
5820
|
+
return this._frameworkClient;
|
|
5821
|
+
}
|
|
5822
|
+
/** @param {FrameworkClient} client */
|
|
5823
|
+
setFrameworkClient(e) {
|
|
5824
|
+
this._frameworkClient = e;
|
|
5825
|
+
}
|
|
5816
5826
|
ensureAttrs() {
|
|
5817
5827
|
if (!this.attrs)
|
|
5818
5828
|
throw new Error("attrs have not loaded.");
|
|
@@ -5838,9 +5848,9 @@ class tc {
|
|
|
5838
5848
|
_initStorage(e) {
|
|
5839
5849
|
this.querySubs = new sn({
|
|
5840
5850
|
persister: new e(this.config.appId, "querySubs"),
|
|
5841
|
-
merge:
|
|
5842
|
-
serialize:
|
|
5843
|
-
parse: (t, r) =>
|
|
5851
|
+
merge: tc,
|
|
5852
|
+
serialize: Za,
|
|
5853
|
+
parse: (t, r) => Ya(r, this.config.useDateObjects),
|
|
5844
5854
|
// objectSize
|
|
5845
5855
|
objectSize: (t) => {
|
|
5846
5856
|
var r, s, i;
|
|
@@ -5859,8 +5869,8 @@ class tc {
|
|
|
5859
5869
|
}), this.querySubs.onKeyLoaded = (t) => this._onQuerySubLoaded(t), this.kv = new sn({
|
|
5860
5870
|
persister: new e(this.config.appId, "kv"),
|
|
5861
5871
|
merge: this._onMergeKv,
|
|
5862
|
-
serialize:
|
|
5863
|
-
parse:
|
|
5872
|
+
serialize: ec,
|
|
5873
|
+
parse: Xa,
|
|
5864
5874
|
objectSize: () => 0,
|
|
5865
5875
|
logger: this._log,
|
|
5866
5876
|
saveThrottleMs: 100,
|
|
@@ -5922,7 +5932,7 @@ class tc {
|
|
|
5922
5932
|
_addQueryData(e, t, r) {
|
|
5923
5933
|
if (!this.attrs)
|
|
5924
5934
|
throw new Error("Attrs in reactor have not been set");
|
|
5925
|
-
const s = Q(e), i = this.ensureAttrs(), o =
|
|
5935
|
+
const s = Q(e), i = this.ensureAttrs(), o = He(this.attrs, t.triples, r, this.config.useDateObjects);
|
|
5926
5936
|
this.querySubs.updateInPlace((a) => {
|
|
5927
5937
|
a[s] = {
|
|
5928
5938
|
result: {
|
|
@@ -5956,7 +5966,7 @@ class tc {
|
|
|
5956
5966
|
const { q: y, result: b } = t, g = Q(y);
|
|
5957
5967
|
if (!this._hasQueryListeners() && !this.querySubs.currentValue[g])
|
|
5958
5968
|
break;
|
|
5959
|
-
const T = (c = (a = b == null ? void 0 : b[0]) == null ? void 0 : a.data) == null ? void 0 : c["page-info"], S = (l = (u = b == null ? void 0 : b[0]) == null ? void 0 : u.data) == null ? void 0 : l.aggregate, _ = ir(b), w = this.ensureAttrs(), C =
|
|
5969
|
+
const T = (c = (a = b == null ? void 0 : b[0]) == null ? void 0 : a.data) == null ? void 0 : c["page-info"], S = (l = (u = b == null ? void 0 : b[0]) == null ? void 0 : u.data) == null ? void 0 : l.aggregate, _ = ir(b), w = this.ensureAttrs(), C = He(w, _, r, this.config.useDateObjects);
|
|
5960
5970
|
this.querySubs.updateInPlace((v) => {
|
|
5961
5971
|
if (!v[g]) {
|
|
5962
5972
|
this._log.info("Missing value in querySubs", { hash: g, q: y });
|
|
@@ -6013,7 +6023,7 @@ class tc {
|
|
|
6013
6023
|
});
|
|
6014
6024
|
const S = Ft(T.entries()), _ = y.map((w) => {
|
|
6015
6025
|
var F, V, J, me;
|
|
6016
|
-
const C = w["instaql-query"], v = w["instaql-result"], k = Q(C), j = ir(v), x = this.ensureAttrs(), z =
|
|
6026
|
+
const C = w["instaql-query"], v = w["instaql-result"], k = Q(C), j = ir(v), x = this.ensureAttrs(), z = He(x, j, r, this.config.useDateObjects), { store: ue, attrsStore: Ae } = this._applyOptimisticUpdates(z, x, S, g), Y = (V = (F = v == null ? void 0 : v[0]) == null ? void 0 : F.data) == null ? void 0 : V["page-info"], te = (me = (J = v == null ? void 0 : v[0]) == null ? void 0 : J.data) == null ? void 0 : me.aggregate;
|
|
6017
6027
|
return {
|
|
6018
6028
|
q: C,
|
|
6019
6029
|
hash: k,
|
|
@@ -6228,7 +6238,7 @@ class tc {
|
|
|
6228
6238
|
if (!this.querySubs)
|
|
6229
6239
|
return r.reject(new Error("We can't run `queryOnce` on the backend. Use adminAPI.query instead: https://www.instantdb.com/docs/backend#query")), r.promise;
|
|
6230
6240
|
const s = Q(e), i = this._startQuerySub(e, s);
|
|
6231
|
-
return this.queryOnceDfds[s] = this.queryOnceDfds[s] ?? [], this.queryOnceDfds[s].push({ q: e, dfd: r, eventId: i }), setTimeout(() => r.reject(new Error("Query timed out")),
|
|
6241
|
+
return this.queryOnceDfds[s] = this.queryOnceDfds[s] ?? [], this.queryOnceDfds[s].push({ q: e, dfd: r, eventId: i }), setTimeout(() => r.reject(new Error("Query timed out")), za), r.promise;
|
|
6232
6242
|
}
|
|
6233
6243
|
_completeQueryOnce(e, t, r) {
|
|
6234
6244
|
this.queryOnceDfds[t] && (this.queryOnceDfds[t] = this.queryOnceDfds[t].filter((s) => s.dfd !== r), this._cleanupQuery(e, t));
|
|
@@ -6295,7 +6305,7 @@ class tc {
|
|
|
6295
6305
|
a = !0;
|
|
6296
6306
|
continue;
|
|
6297
6307
|
}
|
|
6298
|
-
const g = a ?
|
|
6308
|
+
const g = a ? Po(o, y) : y;
|
|
6299
6309
|
p.push(g);
|
|
6300
6310
|
}
|
|
6301
6311
|
return a ? p : l;
|
|
@@ -6353,12 +6363,12 @@ class tc {
|
|
|
6353
6363
|
const _ = this._applyOptimisticUpdates(f, p, T, g);
|
|
6354
6364
|
f = _.store, p = _.attrsStore;
|
|
6355
6365
|
}
|
|
6356
|
-
return { data:
|
|
6366
|
+
return { data: Br({ store: f, attrsStore: p, pageInfo: y, aggregate: b }, c), querySubVersion: s, pendingMutationsVersion: o };
|
|
6357
6367
|
}
|
|
6358
6368
|
_applyOptimisticUpdates(e, t, r, s) {
|
|
6359
6369
|
for (const [i, o] of r)
|
|
6360
6370
|
if (!o["tx-id"] || s && o["tx-id"] > s) {
|
|
6361
|
-
const a =
|
|
6371
|
+
const a = Ci(e, t, o["tx-steps"]);
|
|
6362
6372
|
e = a.store, t = a.attrsStore;
|
|
6363
6373
|
}
|
|
6364
6374
|
return { store: e, attrsStore: t };
|
|
@@ -6476,7 +6486,7 @@ class tc {
|
|
|
6476
6486
|
return;
|
|
6477
6487
|
}
|
|
6478
6488
|
const e = this._transport;
|
|
6479
|
-
this._transport =
|
|
6489
|
+
this._transport = Ha({
|
|
6480
6490
|
transportType: this._transportType,
|
|
6481
6491
|
appId: this.config.appId,
|
|
6482
6492
|
apiURI: this.config.apiURI,
|
|
@@ -6656,7 +6666,7 @@ class tc {
|
|
|
6656
6666
|
var r;
|
|
6657
6667
|
const { user: t } = await this.getCurrentUser();
|
|
6658
6668
|
if (!yt(t, e)) {
|
|
6659
|
-
await this.setCurrentUser(e), await this.updateUser(e);
|
|
6669
|
+
this._frameworkClient = null, await this.setCurrentUser(e), await this.updateUser(e);
|
|
6660
6670
|
try {
|
|
6661
6671
|
await this.kv.flush(), (r = this._broadcastChannel) == null || r.postMessage({ type: "auth" });
|
|
6662
6672
|
} catch (s) {
|
|
@@ -6696,7 +6706,7 @@ class tc {
|
|
|
6696
6706
|
}), this._reconnectTimeoutMs = 0, this._transport.close(), this._oauthCallbackResponse = null, this.notifyAuthSubs(t);
|
|
6697
6707
|
}
|
|
6698
6708
|
sendMagicCode({ email: e }) {
|
|
6699
|
-
return
|
|
6709
|
+
return ua({
|
|
6700
6710
|
apiURI: this.config.apiURI,
|
|
6701
6711
|
appId: this.config.appId,
|
|
6702
6712
|
email: e
|
|
@@ -6704,7 +6714,7 @@ class tc {
|
|
|
6704
6714
|
}
|
|
6705
6715
|
async signInWithMagicCode({ email: e, code: t }) {
|
|
6706
6716
|
var o, a;
|
|
6707
|
-
const r = await this.getCurrentUser(), s = ((o = r == null ? void 0 : r.user) == null ? void 0 : o.type) === "guest", i = await
|
|
6717
|
+
const r = await this.getCurrentUser(), s = ((o = r == null ? void 0 : r.user) == null ? void 0 : o.type) === "guest", i = await la({
|
|
6708
6718
|
apiURI: this.config.apiURI,
|
|
6709
6719
|
appId: this.config.appId,
|
|
6710
6720
|
email: e,
|
|
@@ -6714,7 +6724,7 @@ class tc {
|
|
|
6714
6724
|
return await this.changeCurrentUser(i.user), i;
|
|
6715
6725
|
}
|
|
6716
6726
|
async signInWithCustomToken(e) {
|
|
6717
|
-
const t = await
|
|
6727
|
+
const t = await fa({
|
|
6718
6728
|
apiURI: this.config.apiURI,
|
|
6719
6729
|
appId: this.config.appId,
|
|
6720
6730
|
refreshToken: e
|
|
@@ -6722,7 +6732,7 @@ class tc {
|
|
|
6722
6732
|
return await this.changeCurrentUser(t.user), t;
|
|
6723
6733
|
}
|
|
6724
6734
|
async signInAsGuest() {
|
|
6725
|
-
const e = await
|
|
6735
|
+
const e = await da({
|
|
6726
6736
|
apiURI: this.config.apiURI,
|
|
6727
6737
|
appId: this.config.appId
|
|
6728
6738
|
});
|
|
@@ -6737,7 +6747,7 @@ class tc {
|
|
|
6737
6747
|
this._log.info("[auth-invalidate] skipped invalidateToken");
|
|
6738
6748
|
return;
|
|
6739
6749
|
}
|
|
6740
|
-
|
|
6750
|
+
pa({
|
|
6741
6751
|
apiURI: this.config.apiURI,
|
|
6742
6752
|
appId: this.config.appId,
|
|
6743
6753
|
refreshToken: r
|
|
@@ -6790,7 +6800,7 @@ class tc {
|
|
|
6790
6800
|
*/
|
|
6791
6801
|
async signInWithIdToken({ idToken: e, clientName: t, nonce: r }) {
|
|
6792
6802
|
var a;
|
|
6793
|
-
const s = await this.getCurrentUser(), i = (a = s == null ? void 0 : s.user) == null ? void 0 : a.refresh_token, o = await
|
|
6803
|
+
const s = await this.getCurrentUser(), i = (a = s == null ? void 0 : s.user) == null ? void 0 : a.refresh_token, o = await ha({
|
|
6794
6804
|
apiURI: this.config.apiURI,
|
|
6795
6805
|
appId: this.config.appId,
|
|
6796
6806
|
idToken: e,
|
|
@@ -6833,7 +6843,7 @@ class tc {
|
|
|
6833
6843
|
getPresence(e, t, r = {}) {
|
|
6834
6844
|
const s = this._rooms[t], i = this._presence[t];
|
|
6835
6845
|
return !s || !i || !i.result ? null : {
|
|
6836
|
-
...
|
|
6846
|
+
...wa(i.result, r, this._sessionId),
|
|
6837
6847
|
isLoading: !s.isConnected,
|
|
6838
6848
|
error: s.error
|
|
6839
6849
|
};
|
|
@@ -6895,7 +6905,7 @@ class tc {
|
|
|
6895
6905
|
}
|
|
6896
6906
|
_notifyPresenceSub(e, t) {
|
|
6897
6907
|
const r = this.getPresence("", e, t);
|
|
6898
|
-
r && (t.prev && !
|
|
6908
|
+
r && (t.prev && !Ta(r, t.prev) || (t.prev = r, t.cb(r)));
|
|
6899
6909
|
}
|
|
6900
6910
|
_patchPresencePeers(e, t) {
|
|
6901
6911
|
var o, a, c;
|
|
@@ -6906,13 +6916,13 @@ class tc {
|
|
|
6906
6916
|
for (let [l, f, p] of t)
|
|
6907
6917
|
switch (f) {
|
|
6908
6918
|
case "+":
|
|
6909
|
-
|
|
6919
|
+
Js(u, l, p);
|
|
6910
6920
|
break;
|
|
6911
6921
|
case "r":
|
|
6912
6922
|
Wn(u, l, p);
|
|
6913
6923
|
break;
|
|
6914
6924
|
case "-":
|
|
6915
|
-
|
|
6925
|
+
Pr(u, l);
|
|
6916
6926
|
break;
|
|
6917
6927
|
}
|
|
6918
6928
|
delete u[this._sessionId];
|
|
@@ -6967,7 +6977,7 @@ class tc {
|
|
|
6967
6977
|
async uploadFile(e, t, r) {
|
|
6968
6978
|
var o;
|
|
6969
6979
|
const s = await this.getCurrentUser(), i = (o = s == null ? void 0 : s.user) == null ? void 0 : o.refresh_token;
|
|
6970
|
-
return
|
|
6980
|
+
return ya({
|
|
6971
6981
|
...r,
|
|
6972
6982
|
apiURI: this.config.apiURI,
|
|
6973
6983
|
appId: this.config.appId,
|
|
@@ -6979,7 +6989,7 @@ class tc {
|
|
|
6979
6989
|
async deleteFile(e) {
|
|
6980
6990
|
var i;
|
|
6981
6991
|
const t = await this.getCurrentUser(), r = (i = t == null ? void 0 : t.user) == null ? void 0 : i.refresh_token;
|
|
6982
|
-
return await
|
|
6992
|
+
return await ba({
|
|
6983
6993
|
apiURI: this.config.apiURI,
|
|
6984
6994
|
appId: this.config.appId,
|
|
6985
6995
|
path: e,
|
|
@@ -6990,18 +7000,18 @@ class tc {
|
|
|
6990
7000
|
// ---------------------------------
|
|
6991
7001
|
async upload(e, t) {
|
|
6992
7002
|
var c;
|
|
6993
|
-
const r = await this.getCurrentUser(), s = (c = r == null ? void 0 : r.user) == null ? void 0 : c.refresh_token, i = e || t.name, o = await
|
|
7003
|
+
const r = await this.getCurrentUser(), s = (c = r == null ? void 0 : r.user) == null ? void 0 : c.refresh_token, i = e || t.name, o = await _a({
|
|
6994
7004
|
apiURI: this.config.apiURI,
|
|
6995
7005
|
appId: this.config.appId,
|
|
6996
7006
|
fileName: i,
|
|
6997
7007
|
refreshToken: s
|
|
6998
7008
|
});
|
|
6999
|
-
return await
|
|
7009
|
+
return await ga(o, t);
|
|
7000
7010
|
}
|
|
7001
7011
|
async getDownloadUrl(e) {
|
|
7002
7012
|
var i;
|
|
7003
7013
|
const t = await this.getCurrentUser(), r = (i = t == null ? void 0 : t.user) == null ? void 0 : i.refresh_token;
|
|
7004
|
-
return await
|
|
7014
|
+
return await ma({
|
|
7005
7015
|
apiURI: this.config.apiURI,
|
|
7006
7016
|
appId: this.config.appId,
|
|
7007
7017
|
path: e,
|
|
@@ -7010,9 +7020,9 @@ class tc {
|
|
|
7010
7020
|
}
|
|
7011
7021
|
}
|
|
7012
7022
|
let dt;
|
|
7013
|
-
function
|
|
7023
|
+
function rc(n, e) {
|
|
7014
7024
|
dt == null || dt.dispose();
|
|
7015
|
-
const t =
|
|
7025
|
+
const t = uc(e), r = oc(e, a), s = ic(sc(n));
|
|
7016
7026
|
function i(l) {
|
|
7017
7027
|
var f;
|
|
7018
7028
|
l.source === s.element.contentWindow && ((f = l.data) == null ? void 0 : f.type) === "close" && t.isVisible() && a();
|
|
@@ -7034,10 +7044,10 @@ function nc(n, e) {
|
|
|
7034
7044
|
}
|
|
7035
7045
|
return u();
|
|
7036
7046
|
}
|
|
7037
|
-
function rc(n) {
|
|
7038
|
-
return `${wn || Yr ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${n}`;
|
|
7039
|
-
}
|
|
7040
7047
|
function sc(n) {
|
|
7048
|
+
return `${wn || Zr ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${n}`;
|
|
7049
|
+
}
|
|
7050
|
+
function ic(n) {
|
|
7041
7051
|
const e = document.createElement("iframe");
|
|
7042
7052
|
return e.src = n, e.className = "instant-devtool-iframe", Object.assign(e.style, {
|
|
7043
7053
|
width: "100%",
|
|
@@ -7046,7 +7056,7 @@ function sc(n) {
|
|
|
7046
7056
|
border: "none"
|
|
7047
7057
|
}), { element: e };
|
|
7048
7058
|
}
|
|
7049
|
-
function
|
|
7059
|
+
function oc(n, e) {
|
|
7050
7060
|
const t = `
|
|
7051
7061
|
<svg width="32" height="32" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
7052
7062
|
<rect width="512" height="512" fill="black"/>
|
|
@@ -7056,7 +7066,7 @@ function ic(n, e) {
|
|
|
7056
7066
|
return r.innerHTML = t, r.className = "instant-devtool-toggler", Object.assign(r.style, {
|
|
7057
7067
|
// pos
|
|
7058
7068
|
position: "fixed",
|
|
7059
|
-
...
|
|
7069
|
+
...ac(n.position),
|
|
7060
7070
|
height: "32px",
|
|
7061
7071
|
width: "32px",
|
|
7062
7072
|
// layout
|
|
@@ -7071,7 +7081,7 @@ function ic(n, e) {
|
|
|
7071
7081
|
cursor: "pointer"
|
|
7072
7082
|
}), r.addEventListener("click", e), { element: r };
|
|
7073
7083
|
}
|
|
7074
|
-
function
|
|
7084
|
+
function ac(n) {
|
|
7075
7085
|
switch (n) {
|
|
7076
7086
|
case "bottom-left":
|
|
7077
7087
|
return { bottom: "24px", left: "24px" };
|
|
@@ -7083,7 +7093,7 @@ function oc(n) {
|
|
|
7083
7093
|
return { top: "24px", left: "24px" };
|
|
7084
7094
|
}
|
|
7085
7095
|
}
|
|
7086
|
-
function
|
|
7096
|
+
function cc(n) {
|
|
7087
7097
|
switch (n) {
|
|
7088
7098
|
case "bottom-left":
|
|
7089
7099
|
return { bottom: "24px", right: "24px", left: "60px", top: "72px" };
|
|
@@ -7095,11 +7105,11 @@ function ac(n) {
|
|
|
7095
7105
|
return { top: "24px", right: "24px", left: "60px", bottom: "72px" };
|
|
7096
7106
|
}
|
|
7097
7107
|
}
|
|
7098
|
-
function
|
|
7108
|
+
function uc(n) {
|
|
7099
7109
|
const e = document.createElement("div");
|
|
7100
7110
|
Object.assign(e.style, {
|
|
7101
7111
|
position: "fixed",
|
|
7102
|
-
...
|
|
7112
|
+
...cc(n.position),
|
|
7103
7113
|
display: "block",
|
|
7104
7114
|
borderRadius: "4px",
|
|
7105
7115
|
border: "1px #ccc solid",
|
|
@@ -7112,22 +7122,22 @@ function cc(n) {
|
|
|
7112
7122
|
}
|
|
7113
7123
|
return { element: e, isVisible: t };
|
|
7114
7124
|
}
|
|
7115
|
-
const
|
|
7125
|
+
const lc = {
|
|
7116
7126
|
apiURI: "https://api.instantdb.com",
|
|
7117
7127
|
websocketURI: "wss://api.instantdb.com/runtime/session"
|
|
7118
7128
|
};
|
|
7119
|
-
function
|
|
7129
|
+
function fc() {
|
|
7120
7130
|
return globalThis.__instantDbSchemaHashStore = globalThis.__instantDbSchemaHashStore ?? /* @__PURE__ */ new WeakMap(), globalThis.__instantDbSchemaHashStore;
|
|
7121
7131
|
}
|
|
7122
|
-
function
|
|
7132
|
+
function dc() {
|
|
7123
7133
|
return globalThis.__instantDbStore = globalThis.__instantDbStore ?? {}, globalThis.__instantDbStore;
|
|
7124
7134
|
}
|
|
7125
7135
|
function on(n) {
|
|
7126
7136
|
const e = n.__adminToken;
|
|
7127
7137
|
return n.appId + "_" + (n.websocketURI || "default_ws_uri") + "_" + (n.apiURI || "default_api_uri") + "_" + (e || "client_only") + "_" + n.useDateObjects;
|
|
7128
7138
|
}
|
|
7129
|
-
const an =
|
|
7130
|
-
class
|
|
7139
|
+
const an = dc(), yr = fc();
|
|
7140
|
+
class hc {
|
|
7131
7141
|
constructor(e) {
|
|
7132
7142
|
h(this, "db");
|
|
7133
7143
|
/**
|
|
@@ -7244,7 +7254,7 @@ class dc {
|
|
|
7244
7254
|
this.db = e;
|
|
7245
7255
|
}
|
|
7246
7256
|
}
|
|
7247
|
-
class
|
|
7257
|
+
class pc {
|
|
7248
7258
|
constructor(e) {
|
|
7249
7259
|
h(this, "db");
|
|
7250
7260
|
/**
|
|
@@ -7302,7 +7312,7 @@ class hc {
|
|
|
7302
7312
|
this.db = e;
|
|
7303
7313
|
}
|
|
7304
7314
|
}
|
|
7305
|
-
class
|
|
7315
|
+
class yc {
|
|
7306
7316
|
constructor(e) {
|
|
7307
7317
|
h(this, "db");
|
|
7308
7318
|
/**
|
|
@@ -7328,17 +7338,17 @@ class pc {
|
|
|
7328
7338
|
this.db = e;
|
|
7329
7339
|
}
|
|
7330
7340
|
}
|
|
7331
|
-
function
|
|
7341
|
+
function bc(n) {
|
|
7332
7342
|
return JSON.parse(JSON.stringify(n));
|
|
7333
7343
|
}
|
|
7334
|
-
class
|
|
7344
|
+
class _c {
|
|
7335
7345
|
constructor(e) {
|
|
7336
7346
|
h(this, "_reactor");
|
|
7337
7347
|
h(this, "auth");
|
|
7338
7348
|
h(this, "storage");
|
|
7339
7349
|
h(this, "streams");
|
|
7340
7350
|
h(this, "tx", mn());
|
|
7341
|
-
this._reactor = e, this.auth = new
|
|
7351
|
+
this._reactor = e, this.auth = new hc(this._reactor), this.storage = new pc(this._reactor), this.streams = new yc(this._reactor);
|
|
7342
7352
|
}
|
|
7343
7353
|
/**
|
|
7344
7354
|
* Use this to write data! You can create, update, delete, and link objects
|
|
@@ -7521,10 +7531,10 @@ function br(n) {
|
|
|
7521
7531
|
const t = Q(n);
|
|
7522
7532
|
return yr.set(n, t), t;
|
|
7523
7533
|
}
|
|
7524
|
-
function
|
|
7534
|
+
function gc(n, e) {
|
|
7525
7535
|
return br(n._reactor.config.schema) !== br(e);
|
|
7526
7536
|
}
|
|
7527
|
-
function
|
|
7537
|
+
function mc(n, e, t, r, s) {
|
|
7528
7538
|
var u;
|
|
7529
7539
|
const i = {
|
|
7530
7540
|
...n,
|
|
@@ -7532,15 +7542,15 @@ function gc(n, e, t, r, s) {
|
|
|
7532
7542
|
useDateObjects: n.useDateObjects ?? !1
|
|
7533
7543
|
}, o = an[on(i)];
|
|
7534
7544
|
if (o)
|
|
7535
|
-
return
|
|
7536
|
-
const a = new
|
|
7537
|
-
...
|
|
7545
|
+
return gc(o, i.schema) && o._reactor.updateSchema(i.schema), o;
|
|
7546
|
+
const a = new nc({
|
|
7547
|
+
...lc,
|
|
7538
7548
|
...i,
|
|
7539
7549
|
cardinalityInference: !!i.schema
|
|
7540
|
-
}, e ||
|
|
7541
|
-
return an[on(i)] = c,
|
|
7550
|
+
}, e || Hr, t || Jr, { ...r || {}, "@instantdb/core": es }, s), c = new _c(a);
|
|
7551
|
+
return an[on(i)] = c, wc(i.appId, i.devtool), c;
|
|
7542
7552
|
}
|
|
7543
|
-
function
|
|
7553
|
+
function wc(n, e) {
|
|
7544
7554
|
if (typeof window > "u" || typeof window.location > "u" || typeof document > "u" || typeof e == "boolean" && !e)
|
|
7545
7555
|
return;
|
|
7546
7556
|
const t = {
|
|
@@ -7548,15 +7558,15 @@ function mc(n, e) {
|
|
|
7548
7558
|
allowedHosts: ["localhost"],
|
|
7549
7559
|
...typeof e == "object" ? e : {}
|
|
7550
7560
|
};
|
|
7551
|
-
t.allowedHosts.includes(window.location.hostname) &&
|
|
7561
|
+
t.allowedHosts.includes(window.location.hostname) && rc(n, t);
|
|
7552
7562
|
}
|
|
7553
|
-
const
|
|
7563
|
+
const _r = {
|
|
7554
7564
|
isLoading: !0,
|
|
7555
7565
|
data: void 0,
|
|
7556
7566
|
pageInfo: void 0,
|
|
7557
7567
|
error: void 0
|
|
7558
7568
|
};
|
|
7559
|
-
function
|
|
7569
|
+
function gr(n) {
|
|
7560
7570
|
return {
|
|
7561
7571
|
isLoading: !n,
|
|
7562
7572
|
data: void 0,
|
|
@@ -7565,37 +7575,43 @@ function _r(n) {
|
|
|
7565
7575
|
...n || {}
|
|
7566
7576
|
};
|
|
7567
7577
|
}
|
|
7568
|
-
function Tc(n, e, t) {
|
|
7578
|
+
function Tc(n, e, t, r) {
|
|
7569
7579
|
e && t && "ruleParams" in t && (e = { $$ruleParams: t.ruleParams, ...e });
|
|
7570
|
-
const
|
|
7571
|
-
|
|
7572
|
-
),
|
|
7573
|
-
(
|
|
7574
|
-
n._reactor.getPreviousResult(
|
|
7575
|
-
),
|
|
7576
|
-
|
|
7577
|
-
isLoading: !
|
|
7580
|
+
const s = e ? bc(e) : null, i = Q(s), o = Fe(
|
|
7581
|
+
gr(n._reactor.getPreviousResult(s))
|
|
7582
|
+
), a = Fe(_r), c = ve(
|
|
7583
|
+
(l) => (o.current = gr(
|
|
7584
|
+
n._reactor.getPreviousResult(s)
|
|
7585
|
+
), l(), s ? n.subscribeQuery(s, (p) => {
|
|
7586
|
+
o.current = {
|
|
7587
|
+
isLoading: !p,
|
|
7578
7588
|
// @ts-expect-error: ts thinks this will always be overwritten
|
|
7579
7589
|
data: void 0,
|
|
7580
7590
|
// @ts-expect-error: ts thinks this will always be overwritten
|
|
7581
7591
|
pageInfo: void 0,
|
|
7582
7592
|
// @ts-expect-error: ts thinks this will always be overwritten
|
|
7583
7593
|
error: void 0,
|
|
7584
|
-
...
|
|
7585
|
-
},
|
|
7594
|
+
...p
|
|
7595
|
+
}, l();
|
|
7586
7596
|
}) : () => {
|
|
7587
7597
|
}),
|
|
7588
7598
|
// Build a new subscribe function if the query changes
|
|
7589
|
-
[
|
|
7599
|
+
[i]
|
|
7590
7600
|
);
|
|
7591
7601
|
return { state: Kt(
|
|
7592
|
-
|
|
7593
|
-
() =>
|
|
7594
|
-
() =>
|
|
7595
|
-
|
|
7602
|
+
c,
|
|
7603
|
+
() => o.current,
|
|
7604
|
+
() => {
|
|
7605
|
+
if (r && a.current === _r) {
|
|
7606
|
+
const l = r();
|
|
7607
|
+
l && (a.current = l);
|
|
7608
|
+
}
|
|
7609
|
+
return a.current;
|
|
7610
|
+
}
|
|
7611
|
+
), query: s, queryHash: i };
|
|
7596
7612
|
}
|
|
7597
7613
|
function Sc() {
|
|
7598
|
-
const n =
|
|
7614
|
+
const n = Fe(null);
|
|
7599
7615
|
Pe(() => {
|
|
7600
7616
|
t();
|
|
7601
7617
|
}, []);
|
|
@@ -7609,7 +7625,7 @@ function Sc() {
|
|
|
7609
7625
|
}
|
|
7610
7626
|
const vc = 1e3;
|
|
7611
7627
|
function Ac(n, e, t) {
|
|
7612
|
-
const r =
|
|
7628
|
+
const r = Fe(t);
|
|
7613
7629
|
r.current = t, Pe(() => n.core._reactor.subscribeTopic(
|
|
7614
7630
|
n.type,
|
|
7615
7631
|
n.id,
|
|
@@ -7634,7 +7650,7 @@ function Oc(n, e) {
|
|
|
7634
7650
|
}
|
|
7635
7651
|
function Ec(n, e = {}) {
|
|
7636
7652
|
var o, a;
|
|
7637
|
-
const [t, r] =
|
|
7653
|
+
const [t, r] = wr(() => n.core._reactor.getPresence(n.type, n.id, e) ?? {
|
|
7638
7654
|
peers: {},
|
|
7639
7655
|
isLoading: !0
|
|
7640
7656
|
});
|
|
@@ -7830,7 +7846,7 @@ class Nt {
|
|
|
7830
7846
|
* console.log('Device ID:', deviceId)
|
|
7831
7847
|
*/
|
|
7832
7848
|
h(this, "useLocalId", (e) => {
|
|
7833
|
-
const [t, r] =
|
|
7849
|
+
const [t, r] = wr(null);
|
|
7834
7850
|
return Pe(() => {
|
|
7835
7851
|
(async () => {
|
|
7836
7852
|
const i = await this.getLocalId(e);
|
|
@@ -7973,7 +7989,7 @@ class Nt {
|
|
|
7973
7989
|
* }
|
|
7974
7990
|
*/
|
|
7975
7991
|
h(this, "useConnectionStatus", () => {
|
|
7976
|
-
const e =
|
|
7992
|
+
const e = Fe(
|
|
7977
7993
|
this.core._reactor.status
|
|
7978
7994
|
), t = ve((s) => this.core.subscribeConnectionStatus((o) => {
|
|
7979
7995
|
o !== e.current && (e.current = o, s());
|
|
@@ -8027,7 +8043,7 @@ class Nt {
|
|
|
8027
8043
|
const t = this.useAuth();
|
|
8028
8044
|
return t.isLoading || t.error || t.user ? null : /* @__PURE__ */ ct.jsx(ct.Fragment, { children: e });
|
|
8029
8045
|
});
|
|
8030
|
-
this.core =
|
|
8046
|
+
this.core = mc(
|
|
8031
8047
|
e,
|
|
8032
8048
|
// @ts-expect-error because TS can't resolve subclass statics
|
|
8033
8049
|
e.Store || this.constructor.Store,
|
|
@@ -8054,7 +8070,7 @@ class Nt {
|
|
|
8054
8070
|
return new Ic(this.core, e, t);
|
|
8055
8071
|
}
|
|
8056
8072
|
_useAuth() {
|
|
8057
|
-
const e =
|
|
8073
|
+
const e = Fe(
|
|
8058
8074
|
this.core._reactor._currentUserCached
|
|
8059
8075
|
), t = ve((s) => this.core.subscribeAuth((o) => {
|
|
8060
8076
|
e.current = { isLoading: !1, ...o }, s();
|
|
@@ -8081,5 +8097,6 @@ class Nt {
|
|
|
8081
8097
|
}
|
|
8082
8098
|
h(Nt, "Store"), h(Nt, "NetworkListener"), h(Nt, "EventSourceImpl");
|
|
8083
8099
|
export {
|
|
8084
|
-
Nt as InstantReactAbstractDatabase
|
|
8100
|
+
Nt as InstantReactAbstractDatabase,
|
|
8101
|
+
Tc as useQueryInternal
|
|
8085
8102
|
};
|