@instantdb/react-common 1.0.40 → 1.0.41
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/useInfiniteQuerySubscription.d.ts.map +1 -1
- package/dist/commonjs/useInfiniteQuerySubscription.js +3 -4
- package/dist/commonjs/useInfiniteQuerySubscription.js.map +1 -1
- package/dist/esm/useInfiniteQuerySubscription.d.ts.map +1 -1
- package/dist/esm/useInfiniteQuerySubscription.js +3 -4
- package/dist/esm/useInfiniteQuerySubscription.js.map +1 -1
- package/dist/standalone/index.js +542 -542
- package/dist/standalone/index.umd.cjs +8 -8
- package/package.json +3 -3
- package/src/useInfiniteQuerySubscription.ts +5 -4
package/dist/standalone/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var p = (n, e, t) =>
|
|
4
|
-
import
|
|
1
|
+
var Bs = Object.defineProperty;
|
|
2
|
+
var Gs = (n, e, t) => e in n ? Bs(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
|
+
var p = (n, e, t) => Gs(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import Pr, { useRef as ke, useCallback as Ae, useSyncExternalStore as At, useEffect as je, useMemo as Jt, useState as Rr } from "react";
|
|
5
5
|
var Yt = { exports: {} }, Je = {};
|
|
6
6
|
/**
|
|
7
7
|
* @license React
|
|
@@ -13,10 +13,10 @@ var Yt = { exports: {} }, Je = {};
|
|
|
13
13
|
* LICENSE file in the root directory of this source tree.
|
|
14
14
|
*/
|
|
15
15
|
var zn;
|
|
16
|
-
function
|
|
16
|
+
function Hs() {
|
|
17
17
|
if (zn) return Je;
|
|
18
18
|
zn = 1;
|
|
19
|
-
var n =
|
|
19
|
+
var n = Pr, 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 = {}, h = null, y = null;
|
|
22
22
|
u !== void 0 && (h = "" + u), c.key !== void 0 && (h = "" + c.key), c.ref !== void 0 && (y = c.ref);
|
|
@@ -27,7 +27,7 @@ function Gs() {
|
|
|
27
27
|
return Je.Fragment = t, Je.jsx = o, Je.jsxs = o, Je;
|
|
28
28
|
}
|
|
29
29
|
var Ye = {}, Vn;
|
|
30
|
-
function
|
|
30
|
+
function Js() {
|
|
31
31
|
if (Vn) return Ye;
|
|
32
32
|
Vn = 1;
|
|
33
33
|
var n = {};
|
|
@@ -41,7 +41,7 @@ function Hs() {
|
|
|
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 = Pr, 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"), h = Symbol.for("react.memo"), y = Symbol.for("react.lazy"), b = Symbol.for("react.offscreen"), g = Symbol.iterator, m = "@@iterator";
|
|
45
45
|
function S(d) {
|
|
46
46
|
if (d === null || typeof d != "object")
|
|
47
47
|
return null;
|
|
@@ -208,8 +208,8 @@ function Hs() {
|
|
|
208
208
|
}
|
|
209
209
|
var $t = !1, lt;
|
|
210
210
|
{
|
|
211
|
-
var
|
|
212
|
-
lt = new
|
|
211
|
+
var Ss = typeof WeakMap == "function" ? WeakMap : Map;
|
|
212
|
+
lt = new Ss();
|
|
213
213
|
}
|
|
214
214
|
function In(d, w) {
|
|
215
215
|
if (!d || $t)
|
|
@@ -282,10 +282,10 @@ function Hs() {
|
|
|
282
282
|
var Le = d ? d.displayName || d.name : "", Ce = Le ? ut(Le) : "";
|
|
283
283
|
return typeof d == "function" && lt.set(d, Ce), Ce;
|
|
284
284
|
}
|
|
285
|
-
function
|
|
285
|
+
function vs(d, w, v) {
|
|
286
286
|
return In(d, !1);
|
|
287
287
|
}
|
|
288
|
-
function
|
|
288
|
+
function As(d) {
|
|
289
289
|
var w = d.prototype;
|
|
290
290
|
return !!(w && w.isReactComponent);
|
|
291
291
|
}
|
|
@@ -293,7 +293,7 @@ function Hs() {
|
|
|
293
293
|
if (d == null)
|
|
294
294
|
return "";
|
|
295
295
|
if (typeof d == "function")
|
|
296
|
-
return In(d,
|
|
296
|
+
return In(d, As(d));
|
|
297
297
|
if (typeof d == "string")
|
|
298
298
|
return ut(d);
|
|
299
299
|
switch (d) {
|
|
@@ -305,7 +305,7 @@ function Hs() {
|
|
|
305
305
|
if (typeof d == "object")
|
|
306
306
|
switch (d.$$typeof) {
|
|
307
307
|
case u:
|
|
308
|
-
return
|
|
308
|
+
return vs(d.render);
|
|
309
309
|
case h:
|
|
310
310
|
return ft(d.type, w, v);
|
|
311
311
|
case y: {
|
|
@@ -326,7 +326,7 @@ function Hs() {
|
|
|
326
326
|
} else
|
|
327
327
|
Rn.setExtraStackFrame(null);
|
|
328
328
|
}
|
|
329
|
-
function
|
|
329
|
+
function Os(d, w, v, I, W) {
|
|
330
330
|
{
|
|
331
331
|
var V = Function.call.bind(He);
|
|
332
332
|
for (var D in d)
|
|
@@ -345,17 +345,17 @@ function Hs() {
|
|
|
345
345
|
}
|
|
346
346
|
}
|
|
347
347
|
}
|
|
348
|
-
var
|
|
348
|
+
var Es = Array.isArray;
|
|
349
349
|
function xt(d) {
|
|
350
|
-
return
|
|
350
|
+
return Es(d);
|
|
351
351
|
}
|
|
352
|
-
function
|
|
352
|
+
function ks(d) {
|
|
353
353
|
{
|
|
354
354
|
var w = typeof Symbol == "function" && Symbol.toStringTag, v = w && d[Symbol.toStringTag] || d.constructor.name || "Object";
|
|
355
355
|
return v;
|
|
356
356
|
}
|
|
357
357
|
}
|
|
358
|
-
function
|
|
358
|
+
function Cs(d) {
|
|
359
359
|
try {
|
|
360
360
|
return Mn(d), !1;
|
|
361
361
|
} catch {
|
|
@@ -366,16 +366,16 @@ function Hs() {
|
|
|
366
366
|
return "" + d;
|
|
367
367
|
}
|
|
368
368
|
function jn(d) {
|
|
369
|
-
if (
|
|
370
|
-
return T("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",
|
|
369
|
+
if (Cs(d))
|
|
370
|
+
return T("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", ks(d)), Mn(d);
|
|
371
371
|
}
|
|
372
|
-
var $n = _.ReactCurrentOwner,
|
|
372
|
+
var $n = _.ReactCurrentOwner, Is = {
|
|
373
373
|
key: !0,
|
|
374
374
|
ref: !0,
|
|
375
375
|
__self: !0,
|
|
376
376
|
__source: !0
|
|
377
377
|
}, xn, Dn;
|
|
378
|
-
function
|
|
378
|
+
function Ps(d) {
|
|
379
379
|
if (He.call(d, "ref")) {
|
|
380
380
|
var w = Object.getOwnPropertyDescriptor(d, "ref").get;
|
|
381
381
|
if (w && w.isReactWarning)
|
|
@@ -383,7 +383,7 @@ function Hs() {
|
|
|
383
383
|
}
|
|
384
384
|
return d.ref !== void 0;
|
|
385
385
|
}
|
|
386
|
-
function
|
|
386
|
+
function Rs(d) {
|
|
387
387
|
if (He.call(d, "key")) {
|
|
388
388
|
var w = Object.getOwnPropertyDescriptor(d, "key").get;
|
|
389
389
|
if (w && w.isReactWarning)
|
|
@@ -391,10 +391,10 @@ function Hs() {
|
|
|
391
391
|
}
|
|
392
392
|
return d.key !== void 0;
|
|
393
393
|
}
|
|
394
|
-
function
|
|
394
|
+
function Ms(d, w) {
|
|
395
395
|
typeof d.ref == "string" && $n.current;
|
|
396
396
|
}
|
|
397
|
-
function
|
|
397
|
+
function js(d, w) {
|
|
398
398
|
{
|
|
399
399
|
var v = function() {
|
|
400
400
|
xn || (xn = !0, T("%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)", w));
|
|
@@ -405,7 +405,7 @@ function Hs() {
|
|
|
405
405
|
});
|
|
406
406
|
}
|
|
407
407
|
}
|
|
408
|
-
function
|
|
408
|
+
function $s(d, w) {
|
|
409
409
|
{
|
|
410
410
|
var v = function() {
|
|
411
411
|
Dn || (Dn = !0, T("%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)", w));
|
|
@@ -416,7 +416,7 @@ function Hs() {
|
|
|
416
416
|
});
|
|
417
417
|
}
|
|
418
418
|
}
|
|
419
|
-
var
|
|
419
|
+
var xs = function(d, w, v, I, W, V, D) {
|
|
420
420
|
var $ = {
|
|
421
421
|
// This tag allows us to uniquely identify this as a React Element
|
|
422
422
|
$$typeof: t,
|
|
@@ -445,12 +445,12 @@ function Hs() {
|
|
|
445
445
|
value: W
|
|
446
446
|
}), Object.freeze && (Object.freeze($.props), Object.freeze($)), $;
|
|
447
447
|
};
|
|
448
|
-
function
|
|
448
|
+
function Ds(d, w, v, I, W) {
|
|
449
449
|
{
|
|
450
450
|
var V, D = {}, $ = null, ae = null;
|
|
451
|
-
v !== void 0 && (jn(v), $ = "" + v),
|
|
451
|
+
v !== void 0 && (jn(v), $ = "" + v), Rs(w) && (jn(w.key), $ = "" + w.key), Ps(w) && (ae = w.ref, Ms(w, W));
|
|
452
452
|
for (V in w)
|
|
453
|
-
He.call(w, V) && !
|
|
453
|
+
He.call(w, V) && !Is.hasOwnProperty(V) && (D[V] = w[V]);
|
|
454
454
|
if (d && d.defaultProps) {
|
|
455
455
|
var Z = d.defaultProps;
|
|
456
456
|
for (V in Z)
|
|
@@ -458,9 +458,9 @@ function Hs() {
|
|
|
458
458
|
}
|
|
459
459
|
if ($ || ae) {
|
|
460
460
|
var te = typeof d == "function" ? d.displayName || d.name || "Unknown" : d;
|
|
461
|
-
$ &&
|
|
461
|
+
$ && js(D, te), ae && $s(D, te);
|
|
462
462
|
}
|
|
463
|
-
return
|
|
463
|
+
return xs(d, $, ae, W, I, $n.current, D);
|
|
464
464
|
}
|
|
465
465
|
}
|
|
466
466
|
var Dt = _.ReactCurrentOwner, Un = _.ReactDebugCurrentFrame;
|
|
@@ -488,11 +488,11 @@ Check the render method of \`` + d + "`.";
|
|
|
488
488
|
return "";
|
|
489
489
|
}
|
|
490
490
|
}
|
|
491
|
-
function
|
|
491
|
+
function Us(d) {
|
|
492
492
|
return "";
|
|
493
493
|
}
|
|
494
494
|
var Fn = {};
|
|
495
|
-
function
|
|
495
|
+
function Ls(d) {
|
|
496
496
|
{
|
|
497
497
|
var w = Ln();
|
|
498
498
|
if (!w) {
|
|
@@ -509,7 +509,7 @@ Check the top-level render call using <` + v + ">.");
|
|
|
509
509
|
if (!d._store || d._store.validated || d.key != null)
|
|
510
510
|
return;
|
|
511
511
|
d._store.validated = !0;
|
|
512
|
-
var v =
|
|
512
|
+
var v = Ls(w);
|
|
513
513
|
if (Fn[v])
|
|
514
514
|
return;
|
|
515
515
|
Fn[v] = !0;
|
|
@@ -536,7 +536,7 @@ Check the top-level render call using <` + v + ">.");
|
|
|
536
536
|
}
|
|
537
537
|
}
|
|
538
538
|
}
|
|
539
|
-
function
|
|
539
|
+
function Fs(d) {
|
|
540
540
|
{
|
|
541
541
|
var w = d.type;
|
|
542
542
|
if (w == null || typeof w == "string")
|
|
@@ -552,7 +552,7 @@ Check the top-level render call using <` + v + ">.");
|
|
|
552
552
|
return;
|
|
553
553
|
if (v) {
|
|
554
554
|
var I = q(w);
|
|
555
|
-
|
|
555
|
+
Os(v, d.props, "prop", I, d);
|
|
556
556
|
} else if (w.PropTypes !== void 0 && !Ut) {
|
|
557
557
|
Ut = !0;
|
|
558
558
|
var W = q(w);
|
|
@@ -561,7 +561,7 @@ Check the top-level render call using <` + v + ">.");
|
|
|
561
561
|
typeof w.getDefaultProps == "function" && !w.getDefaultProps.isReactClassApproved && T("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
562
562
|
}
|
|
563
563
|
}
|
|
564
|
-
function
|
|
564
|
+
function Ns(d) {
|
|
565
565
|
{
|
|
566
566
|
for (var w = Object.keys(d.props), v = 0; v < w.length; v++) {
|
|
567
567
|
var I = w[v];
|
|
@@ -580,12 +580,12 @@ Check the top-level render call using <` + v + ">.");
|
|
|
580
580
|
if (!D) {
|
|
581
581
|
var $ = "";
|
|
582
582
|
(d === void 0 || typeof d == "object" && d !== null && Object.keys(d).length === 0) && ($ += " 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 ae =
|
|
583
|
+
var ae = Us();
|
|
584
584
|
ae ? $ += ae : $ += Ln();
|
|
585
585
|
var Z;
|
|
586
586
|
d === null ? Z = "null" : xt(d) ? Z = "array" : d !== void 0 && d.$$typeof === t ? (Z = "<" + (q(d.type) || "Unknown") + " />", $ = " Did you accidentally export a JSX literal instead of a component?") : Z = typeof d, T("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", Z, $);
|
|
587
587
|
}
|
|
588
|
-
var te =
|
|
588
|
+
var te = Ds(d, w, v, W, V);
|
|
589
589
|
if (te == null)
|
|
590
590
|
return te;
|
|
591
591
|
if (D) {
|
|
@@ -602,34 +602,34 @@ Check the top-level render call using <` + v + ">.");
|
|
|
602
602
|
Kn(ye, d);
|
|
603
603
|
}
|
|
604
604
|
if (He.call(w, "key")) {
|
|
605
|
-
var Ce = q(d), ue = Object.keys(w).filter(function(
|
|
606
|
-
return
|
|
605
|
+
var Ce = q(d), ue = Object.keys(w).filter(function(Qs) {
|
|
606
|
+
return Qs !== "key";
|
|
607
607
|
}), Ft = ue.length > 0 ? "{key: someKey, " + ue.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
608
608
|
if (!qn[Ce + Ft]) {
|
|
609
|
-
var
|
|
609
|
+
var Vs = ue.length > 0 ? "{" + ue.join(": ..., ") + ": ...}" : "{}";
|
|
610
610
|
T(`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} />`, Ft, Ce,
|
|
615
|
+
<%s key={someKey} {...props} />`, Ft, Ce, Vs, Ce), qn[Ce + Ft] = !0;
|
|
616
616
|
}
|
|
617
617
|
}
|
|
618
|
-
return d === s ?
|
|
618
|
+
return d === s ? Ns(te) : Fs(te), te;
|
|
619
619
|
}
|
|
620
620
|
}
|
|
621
|
-
function
|
|
621
|
+
function Ks(d, w, v) {
|
|
622
622
|
return Wn(d, w, v, !0);
|
|
623
623
|
}
|
|
624
|
-
function
|
|
624
|
+
function qs(d, w, v) {
|
|
625
625
|
return Wn(d, w, v, !1);
|
|
626
626
|
}
|
|
627
|
-
var
|
|
628
|
-
Ye.Fragment = s, Ye.jsx =
|
|
627
|
+
var Ws = qs, zs = Ks;
|
|
628
|
+
Ye.Fragment = s, Ye.jsx = Ws, Ye.jsxs = zs;
|
|
629
629
|
}(), Ye;
|
|
630
630
|
}
|
|
631
|
-
var
|
|
632
|
-
|
|
631
|
+
var Ys = {};
|
|
632
|
+
Ys.NODE_ENV === "production" ? Yt.exports = Hs() : Yt.exports = Js();
|
|
633
633
|
var ht = Yt.exports;
|
|
634
634
|
function se(n) {
|
|
635
635
|
const e = mt(n);
|
|
@@ -706,7 +706,7 @@ const X = {
|
|
|
706
706
|
Remove: "remove",
|
|
707
707
|
Replace: "replace",
|
|
708
708
|
Add: "add"
|
|
709
|
-
},
|
|
709
|
+
}, Mr = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), Zs = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), wt = Symbol.iterator, pe = {
|
|
710
710
|
mutable: "mutable",
|
|
711
711
|
immutable: "immutable"
|
|
712
712
|
}, bn = {};
|
|
@@ -738,7 +738,7 @@ function $e(n) {
|
|
|
738
738
|
return !!x(n);
|
|
739
739
|
}
|
|
740
740
|
function x(n) {
|
|
741
|
-
return typeof n != "object" ? null : n == null ? void 0 : n[
|
|
741
|
+
return typeof n != "object" ? null : n == null ? void 0 : n[Mr];
|
|
742
742
|
}
|
|
743
743
|
function mn(n) {
|
|
744
744
|
var e;
|
|
@@ -751,7 +751,7 @@ function me(n, e) {
|
|
|
751
751
|
let t;
|
|
752
752
|
return Object.getPrototypeOf(n) === Object.prototype || Array.isArray(n) || n instanceof Map || n instanceof Set || !!(e != null && e.mark) && ((t = e.mark(n, pe)) === pe.immutable || typeof t == "function");
|
|
753
753
|
}
|
|
754
|
-
function
|
|
754
|
+
function jr(n, e = []) {
|
|
755
755
|
if (Object.hasOwnProperty.call(n, "key")) {
|
|
756
756
|
const t = n.parent.copy, r = x(Ee(t, n.key));
|
|
757
757
|
if (r !== null && (r == null ? void 0 : r.original) !== n.original)
|
|
@@ -762,10 +762,10 @@ function Mr(n, e = []) {
|
|
|
762
762
|
e.push(i);
|
|
763
763
|
}
|
|
764
764
|
if (n.parent)
|
|
765
|
-
return
|
|
765
|
+
return jr(n.parent, e);
|
|
766
766
|
e.reverse();
|
|
767
767
|
try {
|
|
768
|
-
|
|
768
|
+
Xs(n.copy, e);
|
|
769
769
|
} catch {
|
|
770
770
|
return null;
|
|
771
771
|
}
|
|
@@ -798,7 +798,7 @@ function Re(n, e) {
|
|
|
798
798
|
return r.indexOf("/") === -1 && r.indexOf("~") === -1 ? r : r.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
799
799
|
}).join("/");
|
|
800
800
|
}
|
|
801
|
-
function
|
|
801
|
+
function Xs(n, e) {
|
|
802
802
|
for (let t = 0; t < e.length - 1; t += 1) {
|
|
803
803
|
const r = e[t];
|
|
804
804
|
if (n = Ee(xe(n) === 3 ? Array.from(n) : n, r), typeof n != "object")
|
|
@@ -806,7 +806,7 @@ function Zs(n, e) {
|
|
|
806
806
|
}
|
|
807
807
|
return n;
|
|
808
808
|
}
|
|
809
|
-
function
|
|
809
|
+
function ei(n) {
|
|
810
810
|
const e = Object.create(Object.getPrototypeOf(n));
|
|
811
811
|
return Reflect.ownKeys(n).forEach((t) => {
|
|
812
812
|
let r = Reflect.getOwnPropertyDescriptor(n, t);
|
|
@@ -822,8 +822,8 @@ function Xs(n) {
|
|
|
822
822
|
}), Reflect.defineProperty(e, t, r);
|
|
823
823
|
}), e;
|
|
824
824
|
}
|
|
825
|
-
const
|
|
826
|
-
function
|
|
825
|
+
const ti = Object.prototype.propertyIsEnumerable;
|
|
826
|
+
function $r(n, e) {
|
|
827
827
|
let t;
|
|
828
828
|
if (Array.isArray(n))
|
|
829
829
|
return Array.prototype.concat.call(n);
|
|
@@ -841,7 +841,7 @@ function jr(n, e) {
|
|
|
841
841
|
return new Map(n);
|
|
842
842
|
} else if (e != null && e.mark && (t = e.mark(n, pe), t !== void 0) && t !== pe.mutable) {
|
|
843
843
|
if (t === pe.immutable)
|
|
844
|
-
return
|
|
844
|
+
return ei(n);
|
|
845
845
|
if (typeof t == "function") {
|
|
846
846
|
if (e.enablePatches || e.enableAutoFreeze)
|
|
847
847
|
throw new Error("You can't use mark and patches or auto freeze together.");
|
|
@@ -853,13 +853,13 @@ function jr(n, e) {
|
|
|
853
853
|
return Object.keys(n).forEach((s) => {
|
|
854
854
|
r[s] = n[s];
|
|
855
855
|
}), Object.getOwnPropertySymbols(n).forEach((s) => {
|
|
856
|
-
|
|
856
|
+
ti.call(n, s) && (r[s] = n[s]);
|
|
857
857
|
}), r;
|
|
858
858
|
} else
|
|
859
859
|
throw new Error("Please check mark() to ensure that it is a stable marker draftable function.");
|
|
860
860
|
}
|
|
861
861
|
function ce(n) {
|
|
862
|
-
n.copy || (n.copy =
|
|
862
|
+
n.copy || (n.copy = $r(n.original, n.options));
|
|
863
863
|
}
|
|
864
864
|
function Xe(n) {
|
|
865
865
|
if (!me(n))
|
|
@@ -959,7 +959,7 @@ function wn(n, e) {
|
|
|
959
959
|
} else
|
|
960
960
|
n.forEach((r, s) => e(s, r, n));
|
|
961
961
|
}
|
|
962
|
-
function
|
|
962
|
+
function xr(n, e, t) {
|
|
963
963
|
if ($e(n) || !me(n, t) || e.has(n) || Object.isFrozen(n))
|
|
964
964
|
return;
|
|
965
965
|
const r = n instanceof Set, s = r ? /* @__PURE__ */ new Map() : void 0;
|
|
@@ -971,7 +971,7 @@ function $r(n, e, t) {
|
|
|
971
971
|
const u = !((a = c.assignedMap) === null || a === void 0) && a.size || c.operated ? c.copy : c.original;
|
|
972
972
|
at(r ? s : n, i, u);
|
|
973
973
|
} else
|
|
974
|
-
|
|
974
|
+
xr(o, e, t);
|
|
975
975
|
}), s) {
|
|
976
976
|
const i = n, o = Array.from(i);
|
|
977
977
|
i.clear(), o.forEach((a) => {
|
|
@@ -979,9 +979,9 @@ function $r(n, e, t) {
|
|
|
979
979
|
});
|
|
980
980
|
}
|
|
981
981
|
}
|
|
982
|
-
function
|
|
982
|
+
function ni(n, e) {
|
|
983
983
|
const t = n.type === 3 ? n.setMap : n.copy;
|
|
984
|
-
n.finalities.revoke.length > 1 && n.assignedMap.get(e) && t &&
|
|
984
|
+
n.finalities.revoke.length > 1 && n.assignedMap.get(e) && t && xr(Ee(t, e), n.finalities.handledSet, n.options);
|
|
985
985
|
}
|
|
986
986
|
function Xt(n) {
|
|
987
987
|
n.type === 3 && n.copy && (n.copy.clear(), n.setMap.forEach((e) => {
|
|
@@ -991,7 +991,7 @@ function Xt(n) {
|
|
|
991
991
|
function en(n, e, t, r) {
|
|
992
992
|
if (n.operated && n.assignedMap && n.assignedMap.size > 0 && !n.finalized) {
|
|
993
993
|
if (t && r) {
|
|
994
|
-
const i =
|
|
994
|
+
const i = jr(n);
|
|
995
995
|
i && e(n, i, t, r);
|
|
996
996
|
}
|
|
997
997
|
n.finalized = !0;
|
|
@@ -1008,10 +1008,10 @@ function Tn(n, e, t, r) {
|
|
|
1008
1008
|
}
|
|
1009
1009
|
}), n.options.enableAutoFreeze && s.finalities !== n.finalities && (n.options.enableAutoFreeze = !1)), me(t, n.options) && n.finalities.draft.push(() => {
|
|
1010
1010
|
const i = n.type === 3 ? n.setMap : n.copy;
|
|
1011
|
-
Oe(Ee(i, e), t) &&
|
|
1011
|
+
Oe(Ee(i, e), t) && ni(n, e);
|
|
1012
1012
|
});
|
|
1013
1013
|
}
|
|
1014
|
-
function
|
|
1014
|
+
function ri(n, e, t, r, s) {
|
|
1015
1015
|
let { original: i, assignedMap: o, options: a } = n, c = n.copy;
|
|
1016
1016
|
c.length < i.length && ([i, c] = [c, i], [t, r] = [r, t]);
|
|
1017
1017
|
for (let u = 0; u < i.length; u += 1)
|
|
@@ -1057,7 +1057,7 @@ function ni(n, e, t, r, s) {
|
|
|
1057
1057
|
}
|
|
1058
1058
|
}
|
|
1059
1059
|
}
|
|
1060
|
-
function
|
|
1060
|
+
function si({ original: n, copy: e, assignedMap: t }, r, s, i, o) {
|
|
1061
1061
|
t.forEach((a, c) => {
|
|
1062
1062
|
const u = Ee(n, c), l = Tt(Ee(e, c)), f = a ? st(n, c) ? X.Replace : X.Add : X.Remove;
|
|
1063
1063
|
if (Oe(u, l) && f === X.Replace)
|
|
@@ -1066,7 +1066,7 @@ function ri({ original: n, copy: e, assignedMap: t }, r, s, i, o) {
|
|
|
1066
1066
|
s.push(f === X.Remove ? { op: f, path: y } : { op: f, path: y, value: l }), i.push(f === X.Add ? { op: X.Remove, path: y } : f === X.Remove ? { op: X.Add, path: y, value: u } : { op: X.Replace, path: y, value: u });
|
|
1067
1067
|
});
|
|
1068
1068
|
}
|
|
1069
|
-
function
|
|
1069
|
+
function ii({ original: n, copy: e }, t, r, s, i) {
|
|
1070
1070
|
let o = 0;
|
|
1071
1071
|
n.forEach((a) => {
|
|
1072
1072
|
if (!e.has(a)) {
|
|
@@ -1103,11 +1103,11 @@ function ot(n, e, t, r) {
|
|
|
1103
1103
|
switch (n.type) {
|
|
1104
1104
|
case 0:
|
|
1105
1105
|
case 2:
|
|
1106
|
-
return
|
|
1106
|
+
return si(n, e, t, r, s);
|
|
1107
1107
|
case 1:
|
|
1108
|
-
return
|
|
1108
|
+
return ri(n, e, t, r, s);
|
|
1109
1109
|
case 3:
|
|
1110
|
-
return
|
|
1110
|
+
return ii(n, e, t, r, s);
|
|
1111
1111
|
}
|
|
1112
1112
|
}
|
|
1113
1113
|
const Ot = (n, e, t = !1) => {
|
|
@@ -1194,7 +1194,7 @@ const Ot = (n, e, t = !1) => {
|
|
|
1194
1194
|
[wt]() {
|
|
1195
1195
|
return this.entries();
|
|
1196
1196
|
}
|
|
1197
|
-
},
|
|
1197
|
+
}, oi = Reflect.ownKeys(tn), Gn = (n, e, { isValuesIterator: t }) => () => {
|
|
1198
1198
|
var r, s;
|
|
1199
1199
|
const i = e.next();
|
|
1200
1200
|
if (i.done)
|
|
@@ -1305,13 +1305,13 @@ Set.prototype.difference && Object.assign(Et, {
|
|
|
1305
1305
|
return Set.prototype.isDisjointFrom.call(new Set(this.values()), n);
|
|
1306
1306
|
}
|
|
1307
1307
|
});
|
|
1308
|
-
const
|
|
1308
|
+
const ai = Reflect.ownKeys(Et), Dr = /* @__PURE__ */ new WeakSet(), Ur = {
|
|
1309
1309
|
get(n, e, t) {
|
|
1310
1310
|
var r, s;
|
|
1311
1311
|
const i = (r = n.copy) === null || r === void 0 ? void 0 : r[e];
|
|
1312
|
-
if (i &&
|
|
1312
|
+
if (i && Dr.has(i))
|
|
1313
1313
|
return i;
|
|
1314
|
-
if (e ===
|
|
1314
|
+
if (e === Mr)
|
|
1315
1315
|
return n;
|
|
1316
1316
|
let o;
|
|
1317
1317
|
if (n.options.mark) {
|
|
@@ -1320,14 +1320,14 @@ const oi = Reflect.ownKeys(Et), xr = /* @__PURE__ */ new WeakSet(), Dr = {
|
|
|
1320
1320
|
return n.options.strict && Ot(u, n.options, !0), u;
|
|
1321
1321
|
}
|
|
1322
1322
|
const a = he(n);
|
|
1323
|
-
if (a instanceof Map &&
|
|
1323
|
+
if (a instanceof Map && oi.includes(e)) {
|
|
1324
1324
|
if (e === "size")
|
|
1325
1325
|
return Object.getOwnPropertyDescriptor(tn, "size").get.call(n.proxy);
|
|
1326
1326
|
const u = tn[e];
|
|
1327
1327
|
if (u)
|
|
1328
1328
|
return u.bind(n.proxy);
|
|
1329
1329
|
}
|
|
1330
|
-
if (a instanceof Set &&
|
|
1330
|
+
if (a instanceof Set && ai.includes(e)) {
|
|
1331
1331
|
if (e === "size")
|
|
1332
1332
|
return Object.getOwnPropertyDescriptor(Et, "size").get.call(n.proxy);
|
|
1333
1333
|
const u = Et[e];
|
|
@@ -1398,7 +1398,7 @@ const oi = Reflect.ownKeys(Et), xr = /* @__PURE__ */ new WeakSet(), Dr = {
|
|
|
1398
1398
|
},
|
|
1399
1399
|
deleteProperty(n, e) {
|
|
1400
1400
|
var t;
|
|
1401
|
-
return n.type === 1 ?
|
|
1401
|
+
return n.type === 1 ? Ur.set.call(this, n, e, void 0, n.proxy) : (Nt(n.original, e) !== void 0 || e in n.original ? (ce(n), Se(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);
|
|
1402
1402
|
}
|
|
1403
1403
|
};
|
|
1404
1404
|
function Sn(n) {
|
|
@@ -1415,8 +1415,8 @@ function Sn(n) {
|
|
|
1415
1415
|
setMap: o === 3 ? new Map(e.entries()) : void 0
|
|
1416
1416
|
};
|
|
1417
1417
|
(r || "key" in n) && (a.key = r);
|
|
1418
|
-
const { proxy: c, revoke: u } = Proxy.revocable(o === 1 ? Object.assign([], a) : a,
|
|
1419
|
-
if (s.revoke.push(u),
|
|
1418
|
+
const { proxy: c, revoke: u } = Proxy.revocable(o === 1 ? Object.assign([], a) : a, Ur);
|
|
1419
|
+
if (s.revoke.push(u), Dr.add(c), a.proxy = c, t) {
|
|
1420
1420
|
const l = t;
|
|
1421
1421
|
l.finalities.draft.push((f, h) => {
|
|
1422
1422
|
var y, b;
|
|
@@ -1440,7 +1440,7 @@ function Sn(n) {
|
|
|
1440
1440
|
return c;
|
|
1441
1441
|
}
|
|
1442
1442
|
bn.createDraft = Sn;
|
|
1443
|
-
function
|
|
1443
|
+
function ci(n, e, t, r, s) {
|
|
1444
1444
|
var i;
|
|
1445
1445
|
const o = x(n), a = (i = o == null ? void 0 : o.original) !== null && i !== void 0 ? i : n, c = !!e.length;
|
|
1446
1446
|
if (o != null && o.operated)
|
|
@@ -1453,7 +1453,7 @@ function ai(n, e, t, r, s) {
|
|
|
1453
1453
|
r && c ? [{ op: X.Replace, path: [], value: a }] : r
|
|
1454
1454
|
];
|
|
1455
1455
|
}
|
|
1456
|
-
function
|
|
1456
|
+
function ui(n, e) {
|
|
1457
1457
|
var t;
|
|
1458
1458
|
const r = {
|
|
1459
1459
|
draft: [],
|
|
@@ -1471,7 +1471,7 @@ function ci(n, e) {
|
|
|
1471
1471
|
return [
|
|
1472
1472
|
a,
|
|
1473
1473
|
(c = []) => {
|
|
1474
|
-
const [u, l, f] =
|
|
1474
|
+
const [u, l, f] = ci(a, c, s, i, e.enableAutoFreeze);
|
|
1475
1475
|
return e.enablePatches ? [u, l, f] : u;
|
|
1476
1476
|
}
|
|
1477
1477
|
];
|
|
@@ -1491,7 +1491,7 @@ function nn(n) {
|
|
|
1491
1491
|
} else typeof o == "object" && o !== null && (n.value = o, n.isRoot = !1, nn(n));
|
|
1492
1492
|
}), 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."));
|
|
1493
1493
|
}
|
|
1494
|
-
function
|
|
1494
|
+
function Lr(n) {
|
|
1495
1495
|
var e;
|
|
1496
1496
|
const t = x(n);
|
|
1497
1497
|
if (!me(n, t == null ? void 0 : t.options))
|
|
@@ -1501,7 +1501,7 @@ function Ur(n) {
|
|
|
1501
1501
|
return t.original;
|
|
1502
1502
|
let s;
|
|
1503
1503
|
function i() {
|
|
1504
|
-
s = r === 2 ? _n(n) ? new Map(n) : new (Object.getPrototypeOf(n)).constructor(n) : r === 3 ? Array.from(t.setMap.values()) :
|
|
1504
|
+
s = r === 2 ? _n(n) ? new Map(n) : new (Object.getPrototypeOf(n)).constructor(n) : r === 3 ? Array.from(t.setMap.values()) : $r(n, t == null ? void 0 : t.options);
|
|
1505
1505
|
}
|
|
1506
1506
|
if (t) {
|
|
1507
1507
|
t.finalized = !0;
|
|
@@ -1515,7 +1515,7 @@ function Ur(n) {
|
|
|
1515
1515
|
if (wn(s, (o, a) => {
|
|
1516
1516
|
if (t && Oe(Ee(t.original, o), a))
|
|
1517
1517
|
return;
|
|
1518
|
-
const c =
|
|
1518
|
+
const c = Lr(a);
|
|
1519
1519
|
c !== a && (s === n && i(), at(s, o, c));
|
|
1520
1520
|
}), r === 3) {
|
|
1521
1521
|
const o = (e = t == null ? void 0 : t.original) !== null && e !== void 0 ? e : s;
|
|
@@ -1526,9 +1526,9 @@ function Ur(n) {
|
|
|
1526
1526
|
function Hn(n) {
|
|
1527
1527
|
if (!$e(n))
|
|
1528
1528
|
throw new Error(`current() is only used for Draft, parameter: ${n}`);
|
|
1529
|
-
return
|
|
1529
|
+
return Lr(n);
|
|
1530
1530
|
}
|
|
1531
|
-
const
|
|
1531
|
+
const li = (n) => function e(t, r, s) {
|
|
1532
1532
|
var i, o, a;
|
|
1533
1533
|
if (typeof t == "function" && typeof r != "function")
|
|
1534
1534
|
return function(O, ...F) {
|
|
@@ -1555,7 +1555,7 @@ const ui = (n) => function e(t, r, s) {
|
|
|
1555
1555
|
};
|
|
1556
1556
|
if (!me(f, m) && typeof f == "object" && f !== null)
|
|
1557
1557
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
1558
|
-
const [S, _] =
|
|
1558
|
+
const [S, _] = ui(f, m);
|
|
1559
1559
|
if (typeof r != "function") {
|
|
1560
1560
|
if (!me(f, m))
|
|
1561
1561
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
@@ -1572,7 +1572,7 @@ const ui = (n) => function e(t, r, s) {
|
|
|
1572
1572
|
if (!$e(O)) {
|
|
1573
1573
|
if (O !== void 0 && !Oe(O, S) && (F != null && F.operated))
|
|
1574
1574
|
throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");
|
|
1575
|
-
const C = O == null ? void 0 : O[
|
|
1575
|
+
const C = O == null ? void 0 : O[Zs];
|
|
1576
1576
|
if (C) {
|
|
1577
1577
|
const G = C[0];
|
|
1578
1578
|
return m.strict && typeof O == "object" && O !== null && nn({
|
|
@@ -1597,9 +1597,9 @@ const ui = (n) => function e(t, r, s) {
|
|
|
1597
1597
|
return T instanceof Promise ? T.then(R, (O) => {
|
|
1598
1598
|
throw Zt(x(S)), O;
|
|
1599
1599
|
}) : R(T);
|
|
1600
|
-
}, kt =
|
|
1600
|
+
}, kt = li();
|
|
1601
1601
|
Object.prototype.constructor.toString();
|
|
1602
|
-
function
|
|
1602
|
+
function Fr(n, e) {
|
|
1603
1603
|
const t = Object.keys(n), r = Object.keys(e);
|
|
1604
1604
|
return t.length === r.length && Object.keys(n).every((s) => e.hasOwnProperty(s));
|
|
1605
1605
|
}
|
|
@@ -1607,7 +1607,7 @@ function Jn(n, e) {
|
|
|
1607
1607
|
return Object.keys(n).length === Object.keys(e).length && Object.keys(n).every((t) => e.hasOwnProperty(t) && n[t] === e[t]);
|
|
1608
1608
|
}
|
|
1609
1609
|
function St(n, e) {
|
|
1610
|
-
return typeof n != "object" || typeof e != "object" || n === null || e === null ? n === e :
|
|
1610
|
+
return typeof n != "object" || typeof e != "object" || n === null || e === null ? n === e : Fr(n, e) ? Object.keys(n).every((t) => St(n[t], e[t])) : !1;
|
|
1611
1611
|
}
|
|
1612
1612
|
function vn(n) {
|
|
1613
1613
|
if (!et(n))
|
|
@@ -1617,7 +1617,7 @@ function vn(n) {
|
|
|
1617
1617
|
r !== void 0 && (e[t] = r);
|
|
1618
1618
|
return e;
|
|
1619
1619
|
}
|
|
1620
|
-
function
|
|
1620
|
+
function Nr(n, e) {
|
|
1621
1621
|
if (!et(n) || !et(e))
|
|
1622
1622
|
return e;
|
|
1623
1623
|
const t = { ...n };
|
|
@@ -1629,14 +1629,14 @@ function Fr(n, e) {
|
|
|
1629
1629
|
continue;
|
|
1630
1630
|
}
|
|
1631
1631
|
const s = et(n[r]) && et(e[r]);
|
|
1632
|
-
t[r] = s ?
|
|
1632
|
+
t[r] = s ? Nr(n[r], e[r]) : e[r];
|
|
1633
1633
|
}
|
|
1634
1634
|
return t;
|
|
1635
1635
|
}
|
|
1636
1636
|
function et(n) {
|
|
1637
1637
|
return typeof n == "object" && n !== null && !Array.isArray(n);
|
|
1638
1638
|
}
|
|
1639
|
-
function
|
|
1639
|
+
function fi(n, e, t) {
|
|
1640
1640
|
if (!n || e.length === 0)
|
|
1641
1641
|
return;
|
|
1642
1642
|
let r = n || {};
|
|
@@ -1657,7 +1657,7 @@ function Yn(n, e, t) {
|
|
|
1657
1657
|
}
|
|
1658
1658
|
r[e[e.length - 1]] = t;
|
|
1659
1659
|
}
|
|
1660
|
-
function
|
|
1660
|
+
function Kr(n, e) {
|
|
1661
1661
|
if (!n || e.length === 0)
|
|
1662
1662
|
return;
|
|
1663
1663
|
const [t, ...r] = e;
|
|
@@ -1666,13 +1666,13 @@ function Nr(n, e) {
|
|
|
1666
1666
|
Array.isArray(n) ? n.splice(t, 1) : delete n[t];
|
|
1667
1667
|
return;
|
|
1668
1668
|
}
|
|
1669
|
-
|
|
1669
|
+
Kr(n[t], r), di(n[t]) && delete n[t];
|
|
1670
1670
|
}
|
|
1671
1671
|
}
|
|
1672
|
-
function
|
|
1672
|
+
function di(n) {
|
|
1673
1673
|
return n && Object.keys(n).length === 0;
|
|
1674
1674
|
}
|
|
1675
|
-
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$/,
|
|
1675
|
+
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$/, hi = {
|
|
1676
1676
|
ZULU: 0,
|
|
1677
1677
|
YEKT: 18e3,
|
|
1678
1678
|
YEKST: 21600,
|
|
@@ -1868,39 +1868,39 @@ const Zn = /ZULU|YEKT|YEKST|YAPT|YAKT|YAKST|XJT|WGT|WGST|WFT|WETDST|WET|WDT|WAT|
|
|
|
1868
1868
|
ACSST: 37800,
|
|
1869
1869
|
ACDT: 37800
|
|
1870
1870
|
};
|
|
1871
|
-
function
|
|
1871
|
+
function pi(n) {
|
|
1872
1872
|
return new Date(n);
|
|
1873
1873
|
}
|
|
1874
|
-
function
|
|
1874
|
+
function yi(n) {
|
|
1875
1875
|
return /* @__PURE__ */ new Date(n + "Z");
|
|
1876
1876
|
}
|
|
1877
|
-
const
|
|
1878
|
-
function
|
|
1879
|
-
const e = n.match(
|
|
1877
|
+
const bi = /^(\d+)[\./-](\d+)[\./-](\d+)$/;
|
|
1878
|
+
function gi(n) {
|
|
1879
|
+
const e = n.match(bi);
|
|
1880
1880
|
if (!e)
|
|
1881
1881
|
return null;
|
|
1882
1882
|
const [t, r, s, i] = e;
|
|
1883
1883
|
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));
|
|
1884
1884
|
}
|
|
1885
|
-
function
|
|
1885
|
+
function _i(n) {
|
|
1886
1886
|
const [e, t] = n.split(" ");
|
|
1887
1887
|
return /* @__PURE__ */ new Date(e + "T" + t + "Z");
|
|
1888
1888
|
}
|
|
1889
|
-
function
|
|
1889
|
+
function mi(n) {
|
|
1890
1890
|
const [e, t] = n.split(" ");
|
|
1891
1891
|
return /* @__PURE__ */ new Date(e + "T" + t + "Z");
|
|
1892
1892
|
}
|
|
1893
|
-
function
|
|
1893
|
+
function wi(n) {
|
|
1894
1894
|
return new Date(n);
|
|
1895
1895
|
}
|
|
1896
|
-
function
|
|
1896
|
+
function Ti(n) {
|
|
1897
1897
|
const e = /^(\w{3}) (\w{3}) (\d{2}) (\d{4})$/;
|
|
1898
1898
|
if (!n.match(e))
|
|
1899
1899
|
throw new Error(`Unable to parse \`${n}\` as a date.`);
|
|
1900
1900
|
const r = /* @__PURE__ */ new Date(n + " UTC");
|
|
1901
1901
|
return new Date(Date.UTC(r.getUTCFullYear(), r.getUTCMonth(), r.getUTCDate(), 0, 0, 0, 0));
|
|
1902
1902
|
}
|
|
1903
|
-
function
|
|
1903
|
+
function Si(n) {
|
|
1904
1904
|
const e = /^(.+T.+)([+-])(\d{2})$/, t = n.match(e);
|
|
1905
1905
|
if (t) {
|
|
1906
1906
|
const [, r, s, i] = t, o = `${r}${s}${i}:00`;
|
|
@@ -1908,7 +1908,7 @@ function Ti(n) {
|
|
|
1908
1908
|
}
|
|
1909
1909
|
return null;
|
|
1910
1910
|
}
|
|
1911
|
-
function
|
|
1911
|
+
function vi(n) {
|
|
1912
1912
|
const e = /^(\d+)-(\d{1,2})-(\d{1,2})([ T])(\d{1,2})(?::(\d{1,2}))?(?::(\d{1,2}))?(.*)$/, t = n.match(e);
|
|
1913
1913
|
if (t) {
|
|
1914
1914
|
const [, r, s, i, o, a, c, u, l] = t, f = s.padStart(2, "0"), h = i.padStart(2, "0");
|
|
@@ -1919,14 +1919,14 @@ function Si(n) {
|
|
|
1919
1919
|
}
|
|
1920
1920
|
return null;
|
|
1921
1921
|
}
|
|
1922
|
-
function
|
|
1922
|
+
function Ai(n) {
|
|
1923
1923
|
const [e, t] = n.split(", "), [r, s, i] = e.split("/").map(Number), o = t.match(/(\d{1,2}):(\d{2}):(\d{2}) (AM|PM)/);
|
|
1924
1924
|
if (!o)
|
|
1925
1925
|
throw new Error(`Unable to parse time from: ${n}`);
|
|
1926
1926
|
let [, a, c, u, l] = o;
|
|
1927
1927
|
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));
|
|
1928
1928
|
}
|
|
1929
|
-
function
|
|
1929
|
+
function Oi(n) {
|
|
1930
1930
|
switch (n) {
|
|
1931
1931
|
case "epoch":
|
|
1932
1932
|
return /* @__PURE__ */ new Date(0);
|
|
@@ -1938,28 +1938,28 @@ function Ai(n) {
|
|
|
1938
1938
|
return null;
|
|
1939
1939
|
}
|
|
1940
1940
|
}
|
|
1941
|
-
function
|
|
1941
|
+
function Ei(n) {
|
|
1942
1942
|
const e = n.match(Zn);
|
|
1943
1943
|
if (!e)
|
|
1944
1944
|
return null;
|
|
1945
|
-
const [t] = e, r =
|
|
1945
|
+
const [t] = e, r = hi[t], s = new Date(n.replace(Zn, "Z"));
|
|
1946
1946
|
return new Date(s.getTime() - r * 1e3);
|
|
1947
1947
|
}
|
|
1948
|
-
const
|
|
1949
|
-
bi,
|
|
1950
|
-
_i,
|
|
1951
|
-
wi,
|
|
1952
|
-
vi,
|
|
1953
|
-
pi,
|
|
1954
|
-
Ti,
|
|
1948
|
+
const ki = [
|
|
1955
1949
|
gi,
|
|
1956
|
-
|
|
1950
|
+
mi,
|
|
1951
|
+
Ti,
|
|
1957
1952
|
Ai,
|
|
1958
|
-
|
|
1953
|
+
yi,
|
|
1959
1954
|
Si,
|
|
1960
|
-
|
|
1955
|
+
_i,
|
|
1956
|
+
pi,
|
|
1957
|
+
Oi,
|
|
1958
|
+
Ei,
|
|
1959
|
+
vi,
|
|
1960
|
+
wi
|
|
1961
1961
|
];
|
|
1962
|
-
function
|
|
1962
|
+
function Ci(n, e) {
|
|
1963
1963
|
try {
|
|
1964
1964
|
const t = n(e);
|
|
1965
1965
|
return t instanceof Date && !isNaN(t.getTime()) ? t : null;
|
|
@@ -1968,14 +1968,14 @@ function ki(n, e) {
|
|
|
1968
1968
|
}
|
|
1969
1969
|
}
|
|
1970
1970
|
function rn(n) {
|
|
1971
|
-
for (const e of
|
|
1972
|
-
const t =
|
|
1971
|
+
for (const e of ki) {
|
|
1972
|
+
const t = Ci(e, n);
|
|
1973
1973
|
if (t)
|
|
1974
1974
|
return t;
|
|
1975
1975
|
}
|
|
1976
1976
|
return null;
|
|
1977
1977
|
}
|
|
1978
|
-
function
|
|
1978
|
+
function Ii(n) {
|
|
1979
1979
|
try {
|
|
1980
1980
|
const e = JSON.parse(n);
|
|
1981
1981
|
return typeof e == "string" ? rn(e) : null;
|
|
@@ -1990,7 +1990,7 @@ function Pt(n) {
|
|
|
1990
1990
|
if (n instanceof Date)
|
|
1991
1991
|
return n;
|
|
1992
1992
|
if (typeof n == "string") {
|
|
1993
|
-
const e = rn(n) ||
|
|
1993
|
+
const e = rn(n) || Ii(n) || rn(n.trim());
|
|
1994
1994
|
if (!e)
|
|
1995
1995
|
throw new Error(`Unable to parse \`${n}\` as a date.`);
|
|
1996
1996
|
return e;
|
|
@@ -2074,7 +2074,7 @@ class Me {
|
|
|
2074
2074
|
return { attrs: this.attrs, linkIndex: this.linkIndex };
|
|
2075
2075
|
}
|
|
2076
2076
|
}
|
|
2077
|
-
function
|
|
2077
|
+
function Pi(n) {
|
|
2078
2078
|
return n.cardinality === "one";
|
|
2079
2079
|
}
|
|
2080
2080
|
function An(n) {
|
|
@@ -2106,7 +2106,7 @@ function le(n, e, t) {
|
|
|
2106
2106
|
}
|
|
2107
2107
|
s > -1 && r.set(e[s], t);
|
|
2108
2108
|
}
|
|
2109
|
-
function
|
|
2109
|
+
function qr(n, e, t) {
|
|
2110
2110
|
const r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
|
|
2111
2111
|
for (const o of e) {
|
|
2112
2112
|
let [a, c, u] = o;
|
|
@@ -2119,7 +2119,7 @@ function Kr(n, e, t) {
|
|
|
2119
2119
|
}
|
|
2120
2120
|
return { eav: r, aev: s, vae: i };
|
|
2121
2121
|
}
|
|
2122
|
-
function
|
|
2122
|
+
function Wr(n) {
|
|
2123
2123
|
return {
|
|
2124
2124
|
triples: fe(n.eav, 3),
|
|
2125
2125
|
cardinalityInference: n.cardinalityInference,
|
|
@@ -2127,20 +2127,20 @@ function qr(n) {
|
|
|
2127
2127
|
version: 1
|
|
2128
2128
|
};
|
|
2129
2129
|
}
|
|
2130
|
-
function
|
|
2130
|
+
function zr(n, e) {
|
|
2131
2131
|
return tt(n, e.triples, e.cardinalityInference, e.useDateObjects);
|
|
2132
2132
|
}
|
|
2133
|
-
function
|
|
2133
|
+
function Vr(n, e) {
|
|
2134
2134
|
if (n)
|
|
2135
2135
|
return new Me(n.attrs, n.linkIndex);
|
|
2136
2136
|
if (e && "__type" in e)
|
|
2137
2137
|
return new Me(e.attrs, e.linkIndex);
|
|
2138
2138
|
}
|
|
2139
|
-
function
|
|
2139
|
+
function Ri(n, e) {
|
|
2140
2140
|
return Be(n.eav, [e]) !== void 0;
|
|
2141
2141
|
}
|
|
2142
2142
|
function tt(n, e, t, r) {
|
|
2143
|
-
const s =
|
|
2143
|
+
const s = qr(n, e, r);
|
|
2144
2144
|
return s.cardinalityInference = t, s.useDateObjects = r, s;
|
|
2145
2145
|
}
|
|
2146
2146
|
function ct(n, e) {
|
|
@@ -2170,21 +2170,21 @@ function ct(n, e) {
|
|
|
2170
2170
|
return [t, ...a];
|
|
2171
2171
|
}
|
|
2172
2172
|
}
|
|
2173
|
-
function
|
|
2173
|
+
function Qr(n, e, t) {
|
|
2174
2174
|
const r = ct(n, t);
|
|
2175
2175
|
if (!r)
|
|
2176
2176
|
return;
|
|
2177
2177
|
const [s, i, o] = r, a = e.getAttr(i);
|
|
2178
2178
|
a && (_e(n.eav, [s, i, o]), _e(n.aev, [i, s, o]), An(a) && _e(n.vae, [o, i, s]));
|
|
2179
2179
|
}
|
|
2180
|
-
let
|
|
2181
|
-
function
|
|
2180
|
+
let Mi = 0;
|
|
2181
|
+
function Br(n, e, t) {
|
|
2182
2182
|
const [r, s, i] = t;
|
|
2183
2183
|
let o;
|
|
2184
2184
|
const a = Be(n.eav, [r, s, i]);
|
|
2185
|
-
return a && (o = a[3]), o || Date.now() * 10 +
|
|
2185
|
+
return a && (o = a[3]), o || Date.now() * 10 + Mi++;
|
|
2186
2186
|
}
|
|
2187
|
-
function
|
|
2187
|
+
function Gr(n, e, t) {
|
|
2188
2188
|
const r = ct(n, t);
|
|
2189
2189
|
if (!r)
|
|
2190
2190
|
return;
|
|
@@ -2193,10 +2193,10 @@ function Br(n, e, t) {
|
|
|
2193
2193
|
if (!a)
|
|
2194
2194
|
return;
|
|
2195
2195
|
a["checked-data-type"] === "date" && n.useDateObjects && (o = Pt(o));
|
|
2196
|
-
const c = Be(n.eav, [s, i, o]), u = (c == null ? void 0 : c[3]) ??
|
|
2197
|
-
|
|
2196
|
+
const c = Be(n.eav, [s, i, o]), u = (c == null ? void 0 : c[3]) ?? Br(n, a, r), l = [s, i, o, u];
|
|
2197
|
+
Pi(a) ? (le(n.eav, [s, i], /* @__PURE__ */ new Map([[o, l]])), le(n.aev, [i, s], /* @__PURE__ */ new Map([[o, l]]))) : (le(n.eav, [s, i, o], l), le(n.aev, [i, s, o], l)), An(a) && le(n.vae, [o, i, s], l);
|
|
2198
2198
|
}
|
|
2199
|
-
function
|
|
2199
|
+
function ji(n, e, t) {
|
|
2200
2200
|
var y;
|
|
2201
2201
|
const r = ct(n, t);
|
|
2202
2202
|
if (!r)
|
|
@@ -2212,11 +2212,11 @@ function Mi(n, e, t) {
|
|
|
2212
2212
|
const u = (y = c.values().next()) == null ? void 0 : y.value;
|
|
2213
2213
|
if (!u)
|
|
2214
2214
|
return;
|
|
2215
|
-
const l = u[2], f =
|
|
2215
|
+
const l = u[2], f = Nr(l, o), h = [
|
|
2216
2216
|
s,
|
|
2217
2217
|
i,
|
|
2218
2218
|
f,
|
|
2219
|
-
|
|
2219
|
+
Br(n, a, u)
|
|
2220
2220
|
];
|
|
2221
2221
|
le(n.eav, [s, i], /* @__PURE__ */ new Map([[f, h]])), le(n.aev, [i, s], /* @__PURE__ */ new Map([[f, h]]));
|
|
2222
2222
|
}
|
|
@@ -2247,50 +2247,50 @@ function sn(n, e, t) {
|
|
|
2247
2247
|
(!s || !g || ((m = g["reverse-identity"]) == null ? void 0 : m[1]) === s) && (_e(n.eav, [h, y, b]), _e(n.aev, [y, h, b]), _e(n.vae, [b, y, h])), g && g["on-delete"] === "cascade" && ((S = g["reverse-identity"]) == null ? void 0 : S[1]) === s && sn(n, e, [h, (_ = g["forward-identity"]) == null ? void 0 : _[1]]);
|
|
2248
2248
|
}), ((l = n.vae.get(o)) == null ? void 0 : l.size) === 0 && _e(n.vae, [o]);
|
|
2249
2249
|
}
|
|
2250
|
-
function
|
|
2251
|
-
const r =
|
|
2250
|
+
function Hr(n, e, t) {
|
|
2251
|
+
const r = qr(e, t, n.useDateObjects);
|
|
2252
2252
|
Object.keys(r).forEach((s) => {
|
|
2253
2253
|
n[s] = r[s];
|
|
2254
2254
|
});
|
|
2255
2255
|
}
|
|
2256
|
-
function
|
|
2256
|
+
function $i(n, [e]) {
|
|
2257
2257
|
n.addAttr(e);
|
|
2258
2258
|
}
|
|
2259
|
-
function
|
|
2259
|
+
function Jr(n) {
|
|
2260
2260
|
return fe(n.eav, 3);
|
|
2261
2261
|
}
|
|
2262
|
-
function
|
|
2262
|
+
function xi(n, e, [t]) {
|
|
2263
2263
|
if (!e.getAttr(t))
|
|
2264
2264
|
return;
|
|
2265
|
-
const r =
|
|
2266
|
-
e.deleteAttr(t),
|
|
2265
|
+
const r = Jr(n).filter(([s, i]) => i !== t);
|
|
2266
|
+
e.deleteAttr(t), Hr(n, e, r);
|
|
2267
2267
|
}
|
|
2268
|
-
function
|
|
2269
|
-
e.getAttr(t.id) && (e.updateAttr(t),
|
|
2268
|
+
function Di(n, e, [t]) {
|
|
2269
|
+
e.getAttr(t.id) && (e.updateAttr(t), Hr(n, e, Jr(n)));
|
|
2270
2270
|
}
|
|
2271
|
-
function
|
|
2271
|
+
function Ui(n, e, t) {
|
|
2272
2272
|
const [r, ...s] = t;
|
|
2273
2273
|
switch (r) {
|
|
2274
2274
|
case "add-triple":
|
|
2275
|
-
|
|
2275
|
+
Gr(n, e, s);
|
|
2276
2276
|
break;
|
|
2277
2277
|
case "deep-merge-triple":
|
|
2278
|
-
|
|
2278
|
+
ji(n, e, s);
|
|
2279
2279
|
break;
|
|
2280
2280
|
case "retract-triple":
|
|
2281
|
-
|
|
2281
|
+
Qr(n, e, s);
|
|
2282
2282
|
break;
|
|
2283
2283
|
case "delete-entity":
|
|
2284
2284
|
sn(n, e, s);
|
|
2285
2285
|
break;
|
|
2286
2286
|
case "add-attr":
|
|
2287
|
-
|
|
2287
|
+
$i(e, s);
|
|
2288
2288
|
break;
|
|
2289
2289
|
case "delete-attr":
|
|
2290
|
-
|
|
2290
|
+
xi(n, e, s);
|
|
2291
2291
|
break;
|
|
2292
2292
|
case "update-attr":
|
|
2293
|
-
|
|
2293
|
+
Di(n, e, s);
|
|
2294
2294
|
break;
|
|
2295
2295
|
case "restore-attr":
|
|
2296
2296
|
break;
|
|
@@ -2345,13 +2345,13 @@ function pt(n, e, t) {
|
|
|
2345
2345
|
}
|
|
2346
2346
|
return r;
|
|
2347
2347
|
}
|
|
2348
|
-
function
|
|
2348
|
+
function Li(n, e, t) {
|
|
2349
2349
|
let r = "";
|
|
2350
2350
|
return n !== void 0 && (r += "e"), e !== void 0 && (r += "a"), t !== void 0 && (r += "v"), r;
|
|
2351
2351
|
}
|
|
2352
|
-
function
|
|
2352
|
+
function Fi(n, [e, t, r]) {
|
|
2353
2353
|
var i, o;
|
|
2354
|
-
switch (
|
|
2354
|
+
switch (Li(e, t, r)) {
|
|
2355
2355
|
case "e": {
|
|
2356
2356
|
const a = n.eav.get(e);
|
|
2357
2357
|
return fe(a, 2);
|
|
@@ -2397,7 +2397,7 @@ function Li(n, [e, t, r]) {
|
|
|
2397
2397
|
return fe(n.eav, 3);
|
|
2398
2398
|
}
|
|
2399
2399
|
}
|
|
2400
|
-
function
|
|
2400
|
+
function Ni(n, e, t) {
|
|
2401
2401
|
var s;
|
|
2402
2402
|
const r = {};
|
|
2403
2403
|
if (!e)
|
|
@@ -2417,15 +2417,15 @@ function De(n, e, t) {
|
|
|
2417
2417
|
var r;
|
|
2418
2418
|
return (r = n.revIdents.get(e)) == null ? void 0 : r.get(t);
|
|
2419
2419
|
}
|
|
2420
|
-
function
|
|
2420
|
+
function Ki(n, e) {
|
|
2421
2421
|
return n.blobAttrs.get(e);
|
|
2422
2422
|
}
|
|
2423
|
-
function
|
|
2423
|
+
function Yr(n, e) {
|
|
2424
2424
|
var r;
|
|
2425
2425
|
const t = n.primaryKeys.get(e);
|
|
2426
2426
|
return t || ((r = n.forwardIdents.get(e)) == null ? void 0 : r.get("id"));
|
|
2427
2427
|
}
|
|
2428
|
-
function
|
|
2428
|
+
function qi(n, e, t) {
|
|
2429
2429
|
const r = ct(n, t);
|
|
2430
2430
|
if (!r)
|
|
2431
2431
|
return;
|
|
@@ -2433,7 +2433,7 @@ function Ki(n, e, t) {
|
|
|
2433
2433
|
if (e.getAttr(i))
|
|
2434
2434
|
return Be(n.eav, [s, i]);
|
|
2435
2435
|
}
|
|
2436
|
-
function
|
|
2436
|
+
function Wi(n, e, t) {
|
|
2437
2437
|
const r = t.filter(([s, i, o, a, c]) => {
|
|
2438
2438
|
if (s !== "add-triple" && s !== "deep-merge-triple")
|
|
2439
2439
|
return !0;
|
|
@@ -2443,8 +2443,8 @@ function qi(n, e, t) {
|
|
|
2443
2443
|
let l = !1;
|
|
2444
2444
|
const f = e.getAttr(o);
|
|
2445
2445
|
if (f) {
|
|
2446
|
-
const h =
|
|
2447
|
-
l = !!
|
|
2446
|
+
const h = Yr(e, f["forward-identity"][1]);
|
|
2447
|
+
l = !!qi(n, e, [
|
|
2448
2448
|
i,
|
|
2449
2449
|
h == null ? void 0 : h.id,
|
|
2450
2450
|
i
|
|
@@ -2454,7 +2454,7 @@ function qi(n, e, t) {
|
|
|
2454
2454
|
});
|
|
2455
2455
|
return kt({ store: n, attrsStore: e }, (s) => {
|
|
2456
2456
|
r.forEach((i) => {
|
|
2457
|
-
|
|
2457
|
+
Ui(s.store, s.attrsStore, i);
|
|
2458
2458
|
});
|
|
2459
2459
|
}, {
|
|
2460
2460
|
mark: (s) => {
|
|
@@ -2463,28 +2463,28 @@ function qi(n, e, t) {
|
|
|
2463
2463
|
}
|
|
2464
2464
|
});
|
|
2465
2465
|
}
|
|
2466
|
-
function
|
|
2466
|
+
function zi(n) {
|
|
2467
2467
|
return typeof n == "string" && n.startsWith("?");
|
|
2468
2468
|
}
|
|
2469
|
-
function
|
|
2469
|
+
function Vi(n, e, t) {
|
|
2470
2470
|
if (t.hasOwnProperty(n)) {
|
|
2471
2471
|
const r = t[n];
|
|
2472
|
-
return
|
|
2472
|
+
return Zr(r, e, t);
|
|
2473
2473
|
}
|
|
2474
2474
|
return { ...t, [n]: e };
|
|
2475
2475
|
}
|
|
2476
2476
|
function Xn(n, e, t) {
|
|
2477
2477
|
return n === e ? t : null;
|
|
2478
2478
|
}
|
|
2479
|
-
function
|
|
2479
|
+
function Qi(n) {
|
|
2480
2480
|
switch (typeof n) {
|
|
2481
2481
|
case "string":
|
|
2482
|
-
return n.startsWith("?") ?
|
|
2482
|
+
return n.startsWith("?") ? Vi : Xn;
|
|
2483
2483
|
default:
|
|
2484
2484
|
return Xn;
|
|
2485
2485
|
}
|
|
2486
2486
|
}
|
|
2487
|
-
const
|
|
2487
|
+
const Bi = [
|
|
2488
2488
|
"in",
|
|
2489
2489
|
"$in",
|
|
2490
2490
|
"$not",
|
|
@@ -2492,69 +2492,69 @@ const Qi = [
|
|
|
2492
2492
|
"$comparator"
|
|
2493
2493
|
// covers all of $gt, $lt, etc.
|
|
2494
2494
|
];
|
|
2495
|
-
function
|
|
2496
|
-
for (const e of
|
|
2495
|
+
function Gi(n) {
|
|
2496
|
+
for (const e of Bi)
|
|
2497
2497
|
if (n.hasOwnProperty(e))
|
|
2498
2498
|
return !0;
|
|
2499
2499
|
return !1;
|
|
2500
2500
|
}
|
|
2501
|
-
function
|
|
2502
|
-
return t ? typeof n == "object" ?
|
|
2501
|
+
function Zr(n, e, t) {
|
|
2502
|
+
return t ? typeof n == "object" ? Gi(n) ? t : null : Qi(n)(n, e, t) : null;
|
|
2503
2503
|
}
|
|
2504
|
-
function
|
|
2504
|
+
function Hi(n, e, t) {
|
|
2505
2505
|
return n.reduce((r, s, i) => {
|
|
2506
2506
|
const o = e[i];
|
|
2507
|
-
return
|
|
2507
|
+
return Zr(s, o, r);
|
|
2508
2508
|
}, t);
|
|
2509
2509
|
}
|
|
2510
|
-
function Hi(n, e, t) {
|
|
2511
|
-
return Zi(n, e, t).map((r) => Gi(e, r, t)).filter((r) => r);
|
|
2512
|
-
}
|
|
2513
2510
|
function Ji(n, e, t) {
|
|
2514
|
-
return
|
|
2511
|
+
return Xi(n, e, t).map((r) => Hi(e, r, t)).filter((r) => r);
|
|
2512
|
+
}
|
|
2513
|
+
function Yi(n, e, t) {
|
|
2514
|
+
return e.or ? e.or.patterns.flatMap((r) => on(n, r, t)) : e.and ? e.and.patterns.reduce((r, s) => on(n, s, r), t) : t.flatMap((r) => Ji(n, e, r));
|
|
2515
2515
|
}
|
|
2516
2516
|
function on(n, e, t = [{}]) {
|
|
2517
|
-
return e.reduce((r, s) =>
|
|
2517
|
+
return e.reduce((r, s) => Yi(n, s, r), t);
|
|
2518
2518
|
}
|
|
2519
2519
|
function En(n, e) {
|
|
2520
|
-
return Array.isArray(e) ? e.map((t) => En(n, t)) :
|
|
2520
|
+
return Array.isArray(e) ? e.map((t) => En(n, t)) : zi(e) ? n[e] : e;
|
|
2521
2521
|
}
|
|
2522
|
-
function
|
|
2522
|
+
function Zi(n, { find: e, where: t }) {
|
|
2523
2523
|
return on(n, t).map((s) => En(s, e));
|
|
2524
2524
|
}
|
|
2525
|
-
function
|
|
2526
|
-
return
|
|
2525
|
+
function Xi(n, e, t) {
|
|
2526
|
+
return Fi(n, En(t, e));
|
|
2527
2527
|
}
|
|
2528
|
-
const
|
|
2528
|
+
const eo = /^(?:[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;
|
|
2529
2529
|
function Ve(n) {
|
|
2530
|
-
return typeof n == "string" &&
|
|
2530
|
+
return typeof n == "string" && eo.test(n);
|
|
2531
2531
|
}
|
|
2532
2532
|
const re = [];
|
|
2533
2533
|
for (let n = 0; n < 256; ++n)
|
|
2534
2534
|
re.push((n + 256).toString(16).slice(1));
|
|
2535
|
-
function
|
|
2535
|
+
function to(n, e = 0) {
|
|
2536
2536
|
return (re[n[e + 0]] + re[n[e + 1]] + re[n[e + 2]] + re[n[e + 3]] + "-" + re[n[e + 4]] + re[n[e + 5]] + "-" + re[n[e + 6]] + re[n[e + 7]] + "-" + re[n[e + 8]] + re[n[e + 9]] + "-" + re[n[e + 10]] + re[n[e + 11]] + re[n[e + 12]] + re[n[e + 13]] + re[n[e + 14]] + re[n[e + 15]]).toLowerCase();
|
|
2537
2537
|
}
|
|
2538
2538
|
let Kt;
|
|
2539
|
-
const
|
|
2540
|
-
function
|
|
2539
|
+
const no = new Uint8Array(16);
|
|
2540
|
+
function ro() {
|
|
2541
2541
|
if (!Kt) {
|
|
2542
2542
|
if (typeof crypto > "u" || !crypto.getRandomValues)
|
|
2543
2543
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
2544
2544
|
Kt = crypto.getRandomValues.bind(crypto);
|
|
2545
2545
|
}
|
|
2546
|
-
return Kt(
|
|
2546
|
+
return Kt(no);
|
|
2547
2547
|
}
|
|
2548
|
-
const
|
|
2549
|
-
function
|
|
2548
|
+
const so = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), er = { randomUUID: so };
|
|
2549
|
+
function io(n, e, t) {
|
|
2550
2550
|
var s;
|
|
2551
2551
|
if (er.randomUUID && !n)
|
|
2552
2552
|
return er.randomUUID();
|
|
2553
2553
|
n = n || {};
|
|
2554
|
-
const r = n.random ?? ((s = n.rng) == null ? void 0 : s.call(n)) ??
|
|
2554
|
+
const r = n.random ?? ((s = n.rng) == null ? void 0 : s.call(n)) ?? ro();
|
|
2555
2555
|
if (r.length < 16)
|
|
2556
2556
|
throw new Error("Random bytes length must be >= 16");
|
|
2557
|
-
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128,
|
|
2557
|
+
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, to(r);
|
|
2558
2558
|
}
|
|
2559
2559
|
function tr(n) {
|
|
2560
2560
|
const e = n.replace(/-/g, ""), t = [];
|
|
@@ -2562,7 +2562,7 @@ function tr(n) {
|
|
|
2562
2562
|
t.push(parseInt(e.substring(r, r + 2), 16));
|
|
2563
2563
|
return t;
|
|
2564
2564
|
}
|
|
2565
|
-
function
|
|
2565
|
+
function oo(n, e) {
|
|
2566
2566
|
for (let t = 0; t < n.length; t++) {
|
|
2567
2567
|
if (n[t] < e[t])
|
|
2568
2568
|
return -1;
|
|
@@ -2571,17 +2571,17 @@ function io(n, e) {
|
|
|
2571
2571
|
}
|
|
2572
2572
|
return 0;
|
|
2573
2573
|
}
|
|
2574
|
-
function
|
|
2575
|
-
return
|
|
2574
|
+
function ao(n, e) {
|
|
2575
|
+
return oo(tr(n), tr(e));
|
|
2576
2576
|
}
|
|
2577
2577
|
function J() {
|
|
2578
|
-
return
|
|
2578
|
+
return io();
|
|
2579
2579
|
}
|
|
2580
|
-
function
|
|
2580
|
+
function co(n, e) {
|
|
2581
2581
|
return n.localeCompare(e);
|
|
2582
2582
|
}
|
|
2583
|
-
function
|
|
2584
|
-
let n =
|
|
2583
|
+
function uo() {
|
|
2584
|
+
let n = co;
|
|
2585
2585
|
if (typeof Intl == "object" && Intl.hasOwnProperty("Collator"))
|
|
2586
2586
|
try {
|
|
2587
2587
|
n = Intl.Collator("en-US").compare;
|
|
@@ -2589,10 +2589,10 @@ function co() {
|
|
|
2589
2589
|
}
|
|
2590
2590
|
return n;
|
|
2591
2591
|
}
|
|
2592
|
-
const
|
|
2593
|
-
let
|
|
2592
|
+
const lo = uo();
|
|
2593
|
+
let fo = !0, ho = 0;
|
|
2594
2594
|
function it(n) {
|
|
2595
|
-
return Rt(`_${n}`,
|
|
2595
|
+
return Rt(`_${n}`, ho++);
|
|
2596
2596
|
}
|
|
2597
2597
|
function Rt(n, e) {
|
|
2598
2598
|
return `?${n}-${e}`;
|
|
@@ -2602,27 +2602,27 @@ class Qe extends Error {
|
|
|
2602
2602
|
super(e), this.name = "AttrNotFoundError";
|
|
2603
2603
|
}
|
|
2604
2604
|
}
|
|
2605
|
-
function
|
|
2606
|
-
const t =
|
|
2605
|
+
function po(n, e) {
|
|
2606
|
+
const t = Yr(n, e);
|
|
2607
2607
|
if (!t)
|
|
2608
2608
|
throw new Qe(`Could not find id attr for ${e}`);
|
|
2609
2609
|
return t;
|
|
2610
2610
|
}
|
|
2611
2611
|
function nr(n, e, t, r) {
|
|
2612
|
-
return [
|
|
2612
|
+
return [yo(n, e, t, r)];
|
|
2613
2613
|
}
|
|
2614
|
-
function
|
|
2614
|
+
function yo(n, e, t, r) {
|
|
2615
2615
|
return [
|
|
2616
2616
|
n(t, r),
|
|
2617
|
-
|
|
2617
|
+
po(e, t).id,
|
|
2618
2618
|
n(t, r),
|
|
2619
2619
|
n("time", r)
|
|
2620
2620
|
];
|
|
2621
2621
|
}
|
|
2622
|
-
function
|
|
2622
|
+
function bo(n, e, t) {
|
|
2623
2623
|
return n.map((r) => r === e ? t : r);
|
|
2624
2624
|
}
|
|
2625
|
-
function
|
|
2625
|
+
function Xr(n, e, t, r, s) {
|
|
2626
2626
|
const i = ne(e, t, s), o = De(e, t, s), a = i || o;
|
|
2627
2627
|
if (!a)
|
|
2628
2628
|
throw new Qe(`Could not find attr for ${[t, s]}`);
|
|
@@ -2651,7 +2651,7 @@ function rr(n, e) {
|
|
|
2651
2651
|
return typeof o != "string" ? !1 : s.test(o);
|
|
2652
2652
|
};
|
|
2653
2653
|
}
|
|
2654
|
-
function
|
|
2654
|
+
function go(n, e) {
|
|
2655
2655
|
if (typeof e != "object" || e.hasOwnProperty("$in") || e.hasOwnProperty("in"))
|
|
2656
2656
|
return e;
|
|
2657
2657
|
const t = n["checked-data-type"] === "date";
|
|
@@ -2711,7 +2711,7 @@ function bo(n, e) {
|
|
|
2711
2711
|
}
|
|
2712
2712
|
return e;
|
|
2713
2713
|
}
|
|
2714
|
-
function
|
|
2714
|
+
function _o(n, e, t, r, s, i) {
|
|
2715
2715
|
const o = ne(e, t, s), a = De(e, t, s), c = o || a;
|
|
2716
2716
|
if (!c)
|
|
2717
2717
|
throw new Qe(`No attr for etype = ${t} label = ${s}`);
|
|
@@ -2729,31 +2729,31 @@ function go(n, e, t, r, s, i) {
|
|
|
2729
2729
|
return o ? [
|
|
2730
2730
|
n(t, r),
|
|
2731
2731
|
c.id,
|
|
2732
|
-
|
|
2732
|
+
go(c, i),
|
|
2733
2733
|
it("time")
|
|
2734
2734
|
] : [i, c.id, n(t, r), it("time")];
|
|
2735
2735
|
}
|
|
2736
|
-
function
|
|
2736
|
+
function mo(n, e, t, r, s) {
|
|
2737
2737
|
const [i, o, a] = s.reduce((c, u) => {
|
|
2738
|
-
const [l, f, h] = c, [y, b, g] =
|
|
2738
|
+
const [l, f, h] = c, [y, b, g] = Xr(n, e, l, f, u);
|
|
2739
2739
|
return [y, b, [...h, g]];
|
|
2740
2740
|
}, [t, r, []]);
|
|
2741
2741
|
return [i, o, a];
|
|
2742
2742
|
}
|
|
2743
2743
|
function an(n, e, t, r, s, i) {
|
|
2744
|
-
const o = s.slice(0, s.length - 1), a = s[s.length - 1], [c, u, l] =
|
|
2744
|
+
const o = s.slice(0, s.length - 1), a = s[s.length - 1], [c, u, l] = mo(n, e, t, r, o), f = _o(n, e, c, u, a, i);
|
|
2745
2745
|
return l.concat([f]);
|
|
2746
2746
|
}
|
|
2747
|
-
function
|
|
2747
|
+
function wo(n, e) {
|
|
2748
2748
|
return e ? [e].concat(n) : n;
|
|
2749
2749
|
}
|
|
2750
|
-
function
|
|
2750
|
+
function To([n, e]) {
|
|
2751
2751
|
return n === "or" && Array.isArray(e);
|
|
2752
2752
|
}
|
|
2753
|
-
function
|
|
2753
|
+
function So([n, e]) {
|
|
2754
2754
|
return n === "and" && Array.isArray(e);
|
|
2755
2755
|
}
|
|
2756
|
-
function
|
|
2756
|
+
function vo(n, e, t) {
|
|
2757
2757
|
return (r, s) => {
|
|
2758
2758
|
const i = n(r, s);
|
|
2759
2759
|
return e == i ? i : `${i}-${t}`;
|
|
@@ -2761,27 +2761,27 @@ function So(n, e, t) {
|
|
|
2761
2761
|
}
|
|
2762
2762
|
function sr(n, e, t, r, s, i) {
|
|
2763
2763
|
const o = n(r, s), a = i.map((c, u) => {
|
|
2764
|
-
const l =
|
|
2765
|
-
return
|
|
2764
|
+
const l = vo(n, o, u);
|
|
2765
|
+
return es(l, t, r, s, c);
|
|
2766
2766
|
});
|
|
2767
2767
|
return { [e]: { patterns: a, joinSym: o } };
|
|
2768
2768
|
}
|
|
2769
|
-
function
|
|
2769
|
+
function Ao(n) {
|
|
2770
2770
|
const e = [];
|
|
2771
2771
|
for (let t = 1; t <= n.length; t++)
|
|
2772
2772
|
e.push(n.slice(0, t));
|
|
2773
2773
|
return e;
|
|
2774
2774
|
}
|
|
2775
2775
|
function ir(n, e, t, r, s) {
|
|
2776
|
-
return
|
|
2776
|
+
return Ao(s).map((i) => an(n, e, t, r, i, {
|
|
2777
2777
|
$isNull: !0
|
|
2778
2778
|
}));
|
|
2779
2779
|
}
|
|
2780
|
-
function
|
|
2780
|
+
function es(n, e, t, r, s) {
|
|
2781
2781
|
return Object.entries(s).flatMap(([i, o]) => {
|
|
2782
|
-
if (wo([i, o]))
|
|
2783
|
-
return sr(n, "or", e, t, r, o);
|
|
2784
2782
|
if (To([i, o]))
|
|
2783
|
+
return sr(n, "or", e, t, r, o);
|
|
2784
|
+
if (So([i, o]))
|
|
2785
2785
|
return sr(n, "and", e, t, r, o);
|
|
2786
2786
|
if (i === "$entityIdStartsWith")
|
|
2787
2787
|
return [];
|
|
@@ -2807,25 +2807,25 @@ function Xr(n, e, t, r, s) {
|
|
|
2807
2807
|
] : an(n, e, t, r, a, o);
|
|
2808
2808
|
});
|
|
2809
2809
|
}
|
|
2810
|
-
function
|
|
2810
|
+
function Oo(n, e, t, r) {
|
|
2811
2811
|
const s = Rt;
|
|
2812
|
-
return r ?
|
|
2812
|
+
return r ? es(s, n, e, t, r).concat(nr(s, n, e, t)) : nr(s, n, e, t);
|
|
2813
2813
|
}
|
|
2814
|
-
function
|
|
2814
|
+
function Eo(n, e, t) {
|
|
2815
2815
|
return [n(e, t), n("time", t)];
|
|
2816
2816
|
}
|
|
2817
|
-
function
|
|
2818
|
-
const [o, a, c, u, l] =
|
|
2817
|
+
function ko(n, e, t, r, s, i) {
|
|
2818
|
+
const [o, a, c, u, l] = Xr(n, e, t, r, s), f = bo(c, n(t, r), i);
|
|
2819
2819
|
return [o, a, f, u, l];
|
|
2820
2820
|
}
|
|
2821
|
-
function
|
|
2821
|
+
function Co(n, e, t, { etype: r, level: s, form: i }, o) {
|
|
2822
2822
|
const a = Object.keys(i).filter((c) => c !== "$");
|
|
2823
2823
|
return a.length ? Object.entries(o).map(function([u, l]) {
|
|
2824
2824
|
return a.map(function(y) {
|
|
2825
2825
|
var g, m, S;
|
|
2826
2826
|
const b = !!(e.cardinalityInference && ((S = (m = (g = t.linkIndex) == null ? void 0 : g[r]) == null ? void 0 : m[y]) != null && S.isSingular));
|
|
2827
2827
|
try {
|
|
2828
|
-
const [_, T, R] =
|
|
2828
|
+
const [_, T, R] = ko(n, t, r, s, y, u), O = rs(e, t, {
|
|
2829
2829
|
etype: _,
|
|
2830
2830
|
level: T,
|
|
2831
2831
|
form: i[y],
|
|
@@ -2842,11 +2842,11 @@ function ko(n, e, t, { etype: r, level: s, form: i }, o) {
|
|
|
2842
2842
|
}, l);
|
|
2843
2843
|
}) : Object.values(o);
|
|
2844
2844
|
}
|
|
2845
|
-
function
|
|
2846
|
-
return t === "string" ?
|
|
2845
|
+
function Io(n, e, t) {
|
|
2846
|
+
return t === "string" ? lo(n, e) : n > e ? 1 : -1;
|
|
2847
2847
|
}
|
|
2848
2848
|
function nt(n, e, t, r, s) {
|
|
2849
|
-
return e === r || e == null && r == null ?
|
|
2849
|
+
return e === r || e == null && r == null ? ao(n, t) : r == null ? 1 : e == null ? -1 : Io(e, r, s);
|
|
2850
2850
|
}
|
|
2851
2851
|
function Ct([n, e], [t, r], s) {
|
|
2852
2852
|
return nt(n, e, t, r, s);
|
|
@@ -2854,7 +2854,7 @@ function Ct([n, e], [t, r], s) {
|
|
|
2854
2854
|
function cn(n) {
|
|
2855
2855
|
return n == null ? n : new Date(n).getTime();
|
|
2856
2856
|
}
|
|
2857
|
-
function
|
|
2857
|
+
function ts(n, e, t) {
|
|
2858
2858
|
var h;
|
|
2859
2859
|
const [r, s, i, o] = n;
|
|
2860
2860
|
if (((h = e["forward-identity"]) == null ? void 0 : h[2]) === "id")
|
|
@@ -2862,32 +2862,32 @@ function es(n, e, t) {
|
|
|
2862
2862
|
const [a, c] = t, u = e["checked-data-type"], l = u === "date" ? cn(c) : c, f = u === "date" ? cn(i) : i;
|
|
2863
2863
|
return Ct([a, l], [r, f], u);
|
|
2864
2864
|
}
|
|
2865
|
-
function
|
|
2866
|
-
const s =
|
|
2865
|
+
function Po(n, e, t, r) {
|
|
2866
|
+
const s = ts(n, e, r);
|
|
2867
2867
|
return t === "desc" ? s > 0 : s < 0;
|
|
2868
2868
|
}
|
|
2869
|
-
function
|
|
2870
|
-
const s =
|
|
2869
|
+
function Ro(n, e, t, r) {
|
|
2870
|
+
const s = ts(n, e, r);
|
|
2871
2871
|
return t === "desc" ? s < 0 : s > 0;
|
|
2872
2872
|
}
|
|
2873
|
-
function
|
|
2873
|
+
function Mo(n, e) {
|
|
2874
2874
|
const t = e[1];
|
|
2875
2875
|
return n.getAttr(t);
|
|
2876
2876
|
}
|
|
2877
|
-
function
|
|
2877
|
+
function jo(n, e, t) {
|
|
2878
2878
|
const r = Object.keys(t)[0];
|
|
2879
2879
|
return ne(n, e, r);
|
|
2880
2880
|
}
|
|
2881
|
-
function
|
|
2881
|
+
function $o(n, e, t, r) {
|
|
2882
2882
|
if (t)
|
|
2883
|
-
return
|
|
2883
|
+
return Mo(n, t);
|
|
2884
2884
|
if (r)
|
|
2885
|
-
return
|
|
2885
|
+
return jo(n, e, r);
|
|
2886
2886
|
}
|
|
2887
|
-
function
|
|
2887
|
+
function xo(n, e, t) {
|
|
2888
2888
|
var s, i;
|
|
2889
2889
|
if (!Array.isArray(t.fields))
|
|
2890
|
-
return
|
|
2890
|
+
return Ki(n, e);
|
|
2891
2891
|
const r = /* @__PURE__ */ new Map();
|
|
2892
2892
|
for (const o of t.fields) {
|
|
2893
2893
|
const a = ne(n, e, o), c = (s = a == null ? void 0 : a["forward-identity"]) == null ? void 0 : s[2];
|
|
@@ -2899,11 +2899,11 @@ function $o(n, e, t) {
|
|
|
2899
2899
|
}
|
|
2900
2900
|
return r;
|
|
2901
2901
|
}
|
|
2902
|
-
function
|
|
2902
|
+
function Do(n, e, { etype: t, pageInfo: r, dq: s, form: i }) {
|
|
2903
2903
|
var g, m;
|
|
2904
|
-
const o = (g = i == null ? void 0 : i.$) == null ? void 0 : g.order, a =
|
|
2905
|
-
let u =
|
|
2906
|
-
const l = r == null ? void 0 : r["start-cursor"], f = r == null ? void 0 : r["end-cursor"], h =
|
|
2904
|
+
const o = (g = i == null ? void 0 : i.$) == null ? void 0 : g.order, a = ns(i), c = Uo(i);
|
|
2905
|
+
let u = Zi(n, s);
|
|
2906
|
+
const l = r == null ? void 0 : r["start-cursor"], f = r == null ? void 0 : r["end-cursor"], h = $o(e, t, l, o);
|
|
2907
2907
|
if (h && ((m = h == null ? void 0 : h["forward-identity"]) == null ? void 0 : m[2]) !== "id") {
|
|
2908
2908
|
const S = h["checked-data-type"] === "date", _ = h.id;
|
|
2909
2909
|
u = u.map(([T]) => {
|
|
@@ -2918,57 +2918,57 @@ function xo(n, e, { etype: t, pageInfo: r, dq: s, form: i }) {
|
|
|
2918
2918
|
return Ct(T, _, h == null ? void 0 : h["checked-data-type"]);
|
|
2919
2919
|
});
|
|
2920
2920
|
let y = {};
|
|
2921
|
-
const b =
|
|
2921
|
+
const b = xo(e, t, s);
|
|
2922
2922
|
for (const S of u) {
|
|
2923
2923
|
const [_] = S;
|
|
2924
|
-
if (y[_] || !a && l && h &&
|
|
2924
|
+
if (y[_] || !a && l && h && Po(l, h, c, S) || !a && f && h && Ro(f, h, c, S))
|
|
2925
2925
|
continue;
|
|
2926
|
-
const T =
|
|
2926
|
+
const T = Ni(n, b, _);
|
|
2927
2927
|
T && (y[_] = T);
|
|
2928
2928
|
}
|
|
2929
2929
|
return y;
|
|
2930
2930
|
}
|
|
2931
|
-
function
|
|
2931
|
+
function Uo(n) {
|
|
2932
2932
|
var t;
|
|
2933
2933
|
const e = (t = n.$) == null ? void 0 : t.order;
|
|
2934
2934
|
return e && e[Object.keys(e)[0]] || "asc";
|
|
2935
2935
|
}
|
|
2936
|
-
function
|
|
2936
|
+
function ns(n) {
|
|
2937
2937
|
var s, i, o;
|
|
2938
2938
|
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;
|
|
2939
2939
|
return !e && !t && !r;
|
|
2940
2940
|
}
|
|
2941
|
-
function
|
|
2941
|
+
function Lo(n, e, { etype: t, level: r, form: s, join: i, pageInfo: o }) {
|
|
2942
2942
|
var h, y, b, g, m;
|
|
2943
|
-
if (!
|
|
2943
|
+
if (!ns(s) && (!o || !o["start-cursor"]))
|
|
2944
2944
|
return [];
|
|
2945
|
-
const a =
|
|
2945
|
+
const a = wo(Oo(e, t, r, (h = s.$) == null ? void 0 : h.where), i), c = Eo(Rt, t, r), u = (y = s.$) == null ? void 0 : y.fields, l = Do(n, e, {
|
|
2946
2946
|
etype: t,
|
|
2947
2947
|
pageInfo: o,
|
|
2948
2948
|
form: s,
|
|
2949
2949
|
dq: { where: a, find: c, fields: u }
|
|
2950
2950
|
}), f = ((b = s.$) == null ? void 0 : b.limit) || ((g = s.$) == null ? void 0 : g.first) || ((m = s.$) == null ? void 0 : m.last);
|
|
2951
2951
|
if (f != null) {
|
|
2952
|
-
r > 0 &&
|
|
2952
|
+
r > 0 && fo && console.warn("WARNING: Limits in child queries are only run client-side. Data returned from the server will not have a limit.");
|
|
2953
2953
|
const S = Object.entries(l);
|
|
2954
2954
|
return S.length <= f ? l : Object.fromEntries(S.slice(0, f));
|
|
2955
2955
|
}
|
|
2956
2956
|
return l;
|
|
2957
2957
|
}
|
|
2958
|
-
function
|
|
2958
|
+
function Fo(n, e, t) {
|
|
2959
2959
|
try {
|
|
2960
|
-
return
|
|
2960
|
+
return Lo(n, e, t);
|
|
2961
2961
|
} catch (r) {
|
|
2962
2962
|
if (r instanceof Qe)
|
|
2963
2963
|
return {};
|
|
2964
2964
|
throw r;
|
|
2965
2965
|
}
|
|
2966
2966
|
}
|
|
2967
|
-
function
|
|
2968
|
-
const r =
|
|
2969
|
-
return
|
|
2967
|
+
function rs(n, e, t) {
|
|
2968
|
+
const r = Fo(n, e, t);
|
|
2969
|
+
return Co(Rt, n, e, t, r);
|
|
2970
2970
|
}
|
|
2971
|
-
function
|
|
2971
|
+
function No(n) {
|
|
2972
2972
|
const e = {};
|
|
2973
2973
|
for (const [t, r] of Object.entries(n))
|
|
2974
2974
|
e[t] = {
|
|
@@ -2979,18 +2979,18 @@ function Fo(n) {
|
|
|
2979
2979
|
};
|
|
2980
2980
|
return e;
|
|
2981
2981
|
}
|
|
2982
|
-
function
|
|
2982
|
+
function ss({ store: n, attrsStore: e, pageInfo: t, aggregate: r }, s) {
|
|
2983
2983
|
const o = { data: Object.keys(s).reduce(function(c, u) {
|
|
2984
|
-
return r != null && r[u] || u === "$$ruleParams" || (c[u] =
|
|
2984
|
+
return r != null && r[u] || u === "$$ruleParams" || (c[u] = rs(n, e, {
|
|
2985
2985
|
etype: u,
|
|
2986
2986
|
form: s[u],
|
|
2987
2987
|
level: 0,
|
|
2988
2988
|
pageInfo: t == null ? void 0 : t[u]
|
|
2989
2989
|
})), c;
|
|
2990
2990
|
}, {}) };
|
|
2991
|
-
return t && (o.pageInfo =
|
|
2991
|
+
return t && (o.pageInfo = No(t)), r && (o.aggregate = r), o;
|
|
2992
2992
|
}
|
|
2993
|
-
function
|
|
2993
|
+
function Ko() {
|
|
2994
2994
|
const e = {
|
|
2995
2995
|
__etype: 1,
|
|
2996
2996
|
__ops: 1,
|
|
@@ -3004,7 +3004,7 @@ function No() {
|
|
|
3004
3004
|
};
|
|
3005
3005
|
return new Set(Object.keys(e));
|
|
3006
3006
|
}
|
|
3007
|
-
const
|
|
3007
|
+
const qo = Ko();
|
|
3008
3008
|
function vt(n, e, t) {
|
|
3009
3009
|
const r = {
|
|
3010
3010
|
__etype: n,
|
|
@@ -3016,7 +3016,7 @@ function vt(n, e, t) {
|
|
|
3016
3016
|
return t;
|
|
3017
3017
|
if (i === "__etype")
|
|
3018
3018
|
return n;
|
|
3019
|
-
if (
|
|
3019
|
+
if (qo.has(i))
|
|
3020
3020
|
return (o, a) => vt(n, e, [
|
|
3021
3021
|
...t,
|
|
3022
3022
|
a ? [i, n, e, o, a] : [i, n, e, o]
|
|
@@ -3024,7 +3024,7 @@ function vt(n, e, t) {
|
|
|
3024
3024
|
}
|
|
3025
3025
|
});
|
|
3026
3026
|
}
|
|
3027
|
-
function
|
|
3027
|
+
function Wo(n, e) {
|
|
3028
3028
|
return `lookup__${n}__${JSON.stringify(e)}`;
|
|
3029
3029
|
}
|
|
3030
3030
|
function It(n) {
|
|
@@ -3034,13 +3034,13 @@ function un(n) {
|
|
|
3034
3034
|
const [e, t, ...r] = n.split("__");
|
|
3035
3035
|
return [t, JSON.parse(r.join("__"))];
|
|
3036
3036
|
}
|
|
3037
|
-
function
|
|
3037
|
+
function zo(n) {
|
|
3038
3038
|
return new Proxy({
|
|
3039
3039
|
__etype: n
|
|
3040
3040
|
}, {
|
|
3041
3041
|
get(e, t) {
|
|
3042
3042
|
if (t === "lookup")
|
|
3043
|
-
return (s, i) => vt(n, un(
|
|
3043
|
+
return (s, i) => vt(n, un(Wo(s, i)), []);
|
|
3044
3044
|
if (t === "__etype")
|
|
3045
3045
|
return n;
|
|
3046
3046
|
const r = t;
|
|
@@ -3051,15 +3051,15 @@ function Wo(n) {
|
|
|
3051
3051
|
function kn() {
|
|
3052
3052
|
return new Proxy({}, {
|
|
3053
3053
|
get(n, e) {
|
|
3054
|
-
return
|
|
3054
|
+
return zo(e);
|
|
3055
3055
|
}
|
|
3056
3056
|
});
|
|
3057
3057
|
}
|
|
3058
3058
|
kn();
|
|
3059
|
-
function
|
|
3059
|
+
function Vo(n) {
|
|
3060
3060
|
return n.__ops;
|
|
3061
3061
|
}
|
|
3062
|
-
function
|
|
3062
|
+
function Qo(n, e) {
|
|
3063
3063
|
const { attrIdMap: t, refSwapAttrIds: r } = n, s = [];
|
|
3064
3064
|
for (const o of e) {
|
|
3065
3065
|
const a = t[o];
|
|
@@ -3078,7 +3078,7 @@ function Vo(n, e) {
|
|
|
3078
3078
|
}
|
|
3079
3079
|
return s;
|
|
3080
3080
|
}
|
|
3081
|
-
function
|
|
3081
|
+
function Bo(n) {
|
|
3082
3082
|
if (Array.isArray(n))
|
|
3083
3083
|
return n;
|
|
3084
3084
|
const e = Object.entries(n);
|
|
@@ -3086,7 +3086,7 @@ function Qo(n) {
|
|
|
3086
3086
|
throw new Error("lookup must be an object with a single unique attr and value.");
|
|
3087
3087
|
return e[0];
|
|
3088
3088
|
}
|
|
3089
|
-
function
|
|
3089
|
+
function Go(n, e, t) {
|
|
3090
3090
|
return t.indexOf(".") !== -1 && // attr names can have `.` in them, so use the attr we find with a `.`
|
|
3091
3091
|
// before assuming it's a ref lookup.
|
|
3092
3092
|
!ne(n, e, t);
|
|
@@ -3097,8 +3097,8 @@ function ln(n) {
|
|
|
3097
3097
|
throw new Error(`${n} is not a valid lookup attribute.`);
|
|
3098
3098
|
return e;
|
|
3099
3099
|
}
|
|
3100
|
-
function
|
|
3101
|
-
if (!
|
|
3100
|
+
function Ho(n, e, t) {
|
|
3101
|
+
if (!Go(n, e, t))
|
|
3102
3102
|
return ne(n, e, t);
|
|
3103
3103
|
const r = ln(t), s = ne(n, e, r) || De(n, e, r);
|
|
3104
3104
|
if (s && s["value-type"] !== "ref")
|
|
@@ -3106,18 +3106,18 @@ function Go(n, e, t) {
|
|
|
3106
3106
|
return s;
|
|
3107
3107
|
}
|
|
3108
3108
|
function fn(n) {
|
|
3109
|
-
return typeof n == "string" && !It(n) ? null : typeof n == "string" && It(n) ? un(n) :
|
|
3109
|
+
return typeof n == "string" && !It(n) ? null : typeof n == "string" && It(n) ? un(n) : Bo(n);
|
|
3110
3110
|
}
|
|
3111
3111
|
function de(n, e, t) {
|
|
3112
3112
|
const r = fn(t);
|
|
3113
3113
|
if (r === null)
|
|
3114
3114
|
return t;
|
|
3115
|
-
const [s, i] = r, o =
|
|
3115
|
+
const [s, i] = r, o = Ho(n, e, s);
|
|
3116
3116
|
if (!o || !o["unique?"])
|
|
3117
3117
|
throw new Error(`${s} is not a unique attribute.`);
|
|
3118
3118
|
return [o.id, i];
|
|
3119
3119
|
}
|
|
3120
|
-
function
|
|
3120
|
+
function is(n, e, t, r) {
|
|
3121
3121
|
var o;
|
|
3122
3122
|
const s = de(n, e, t);
|
|
3123
3123
|
return Array.isArray(s) ? [[
|
|
@@ -3127,7 +3127,7 @@ function ss(n, e, t, r) {
|
|
|
3127
3127
|
s
|
|
3128
3128
|
]].concat(r) : r;
|
|
3129
3129
|
}
|
|
3130
|
-
function
|
|
3130
|
+
function Jo({ attrsStore: n }, [e, t, r]) {
|
|
3131
3131
|
const s = Object.entries(r).flatMap(([i, o]) => {
|
|
3132
3132
|
const a = Array.isArray(o) ? o : [o], c = ne(n, e, i), u = De(n, e, i);
|
|
3133
3133
|
return a.map((l) => c ? [
|
|
@@ -3146,9 +3146,9 @@ function Ho({ attrsStore: n }, [e, t, r]) {
|
|
|
3146
3146
|
de(n, e, t)
|
|
3147
3147
|
]);
|
|
3148
3148
|
});
|
|
3149
|
-
return
|
|
3149
|
+
return is(n, e, t, s);
|
|
3150
3150
|
}
|
|
3151
|
-
function
|
|
3151
|
+
function Yo({ attrsStore: n }, [e, t, r]) {
|
|
3152
3152
|
const s = Object.entries(r).flatMap(([i, o]) => {
|
|
3153
3153
|
const a = Array.isArray(o) ? o : [o], c = ne(n, e, i), u = De(n, e, i);
|
|
3154
3154
|
return a.map((l) => c ? [
|
|
@@ -3167,9 +3167,9 @@ function Jo({ attrsStore: n }, [e, t, r]) {
|
|
|
3167
3167
|
de(n, e, t)
|
|
3168
3168
|
]);
|
|
3169
3169
|
});
|
|
3170
|
-
return
|
|
3170
|
+
return is(n, e, t, s);
|
|
3171
3171
|
}
|
|
3172
|
-
function
|
|
3172
|
+
function Zo(n, e, t, r) {
|
|
3173
3173
|
var s;
|
|
3174
3174
|
if (Array.isArray(r)) {
|
|
3175
3175
|
const [i, o] = r;
|
|
@@ -3192,18 +3192,18 @@ function Yo(n, e, t, r) {
|
|
|
3192
3192
|
}
|
|
3193
3193
|
return !1;
|
|
3194
3194
|
}
|
|
3195
|
-
function
|
|
3196
|
-
return (i == null ? void 0 : i.upsert) === !1 ? { mode: "update" } : (i == null ? void 0 : i.upsert) === !0 ? null :
|
|
3195
|
+
function os({ stores: n, attrsStore: e }, [t, r, s, i]) {
|
|
3196
|
+
return (i == null ? void 0 : i.upsert) === !1 ? { mode: "update" } : (i == null ? void 0 : i.upsert) === !0 ? null : Zo(n, e, t, r) ? { mode: "update" } : null;
|
|
3197
3197
|
}
|
|
3198
|
-
function
|
|
3198
|
+
function Xo(n, e) {
|
|
3199
3199
|
const { attrsStore: t } = n, [r, s, i, o] = e, a = vn(i), c = de(t, r, s);
|
|
3200
3200
|
return [["id", c]].concat(Object.entries(a)).map(([l, f]) => {
|
|
3201
3201
|
const h = ne(t, r, l);
|
|
3202
3202
|
return h["checked-data-type"] === "date" && n.useDateObjects && (f = Pt(f)), ["add-triple", c, h.id, f, { mode: "create" }];
|
|
3203
3203
|
});
|
|
3204
3204
|
}
|
|
3205
|
-
function
|
|
3206
|
-
const { attrsStore: t } = n, [r, s, i, o] = e, a = vn(i), c = de(t, r, s), u =
|
|
3205
|
+
function ea(n, e) {
|
|
3206
|
+
const { attrsStore: t } = n, [r, s, i, o] = e, a = vn(i), c = de(t, r, s), u = os(n, [r, c, i, o]);
|
|
3207
3207
|
return [["id", c]].concat(Object.entries(a)).map(([f, h]) => {
|
|
3208
3208
|
const y = ne(t, r, f);
|
|
3209
3209
|
return y["checked-data-type"] === "date" && n.useDateObjects && (h = Pt(h)), [
|
|
@@ -3215,11 +3215,11 @@ function Xo(n, e) {
|
|
|
3215
3215
|
];
|
|
3216
3216
|
});
|
|
3217
3217
|
}
|
|
3218
|
-
function
|
|
3218
|
+
function ta({ attrsStore: n }, [e, t]) {
|
|
3219
3219
|
return [["delete-entity", de(n, e, t), e]];
|
|
3220
3220
|
}
|
|
3221
|
-
function
|
|
3222
|
-
const { attrsStore: t } = n, [r, s, i, o] = e, a = vn(i), c = de(t, r, s), u =
|
|
3221
|
+
function na(n, e) {
|
|
3222
|
+
const { attrsStore: t } = n, [r, s, i, o] = e, a = vn(i), c = de(t, r, s), u = os(n, [r, c, i, o]), l = Object.entries(a).map(([h, y]) => {
|
|
3223
3223
|
const b = ne(t, r, h);
|
|
3224
3224
|
return [
|
|
3225
3225
|
"deep-merge-triple",
|
|
@@ -3237,38 +3237,38 @@ function ta(n, e) {
|
|
|
3237
3237
|
...u ? [u] : []
|
|
3238
3238
|
]].concat(l);
|
|
3239
3239
|
}
|
|
3240
|
-
function
|
|
3240
|
+
function ra({ attrsStore: n }, [e, t, r]) {
|
|
3241
3241
|
return [["rule-params", de(n, e, t), e, r]];
|
|
3242
3242
|
}
|
|
3243
|
-
function
|
|
3243
|
+
function sa(n) {
|
|
3244
3244
|
const [e, t, r, s, i] = n;
|
|
3245
3245
|
if (!s)
|
|
3246
3246
|
return n;
|
|
3247
3247
|
const o = { ...s };
|
|
3248
3248
|
return delete o.id, [e, t, r, o, ...i ? [i] : []];
|
|
3249
3249
|
}
|
|
3250
|
-
function
|
|
3251
|
-
const [t, ...r] =
|
|
3250
|
+
function ia(n, e) {
|
|
3251
|
+
const [t, ...r] = sa(e);
|
|
3252
3252
|
switch (t) {
|
|
3253
3253
|
case "merge":
|
|
3254
|
-
return
|
|
3254
|
+
return na(n, r);
|
|
3255
3255
|
case "create":
|
|
3256
|
-
return Zo(n, r);
|
|
3257
|
-
case "update":
|
|
3258
3256
|
return Xo(n, r);
|
|
3257
|
+
case "update":
|
|
3258
|
+
return ea(n, r);
|
|
3259
3259
|
case "link":
|
|
3260
|
-
return Ho(n, r);
|
|
3261
|
-
case "unlink":
|
|
3262
3260
|
return Jo(n, r);
|
|
3261
|
+
case "unlink":
|
|
3262
|
+
return Yo(n, r);
|
|
3263
3263
|
case "delete":
|
|
3264
|
-
return
|
|
3264
|
+
return ta(n, r);
|
|
3265
3265
|
case "ruleParams":
|
|
3266
|
-
return
|
|
3266
|
+
return ra(n, r);
|
|
3267
3267
|
default:
|
|
3268
3268
|
throw new Error(`unsupported action ${t}`);
|
|
3269
3269
|
}
|
|
3270
3270
|
}
|
|
3271
|
-
function
|
|
3271
|
+
function oa(n) {
|
|
3272
3272
|
switch (n) {
|
|
3273
3273
|
case "string":
|
|
3274
3274
|
case "date":
|
|
@@ -3279,14 +3279,14 @@ function ia(n) {
|
|
|
3279
3279
|
return;
|
|
3280
3280
|
}
|
|
3281
3281
|
}
|
|
3282
|
-
function
|
|
3282
|
+
function aa(n, e, t) {
|
|
3283
3283
|
var a, c;
|
|
3284
3284
|
const r = (c = (a = n.entities[e]) == null ? void 0 : a.attrs) == null ? void 0 : c[t];
|
|
3285
3285
|
if (t === "id")
|
|
3286
3286
|
return null;
|
|
3287
3287
|
if (!r)
|
|
3288
3288
|
throw new Error(`${e}.${t} does not exist in your schema`);
|
|
3289
|
-
const { unique: s, indexed: i } = r == null ? void 0 : r.config, o =
|
|
3289
|
+
const { unique: s, indexed: i } = r == null ? void 0 : r.config, o = oa(r == null ? void 0 : r.valueType);
|
|
3290
3290
|
return {
|
|
3291
3291
|
"index?": i,
|
|
3292
3292
|
"unique?": s,
|
|
@@ -3294,7 +3294,7 @@ function oa(n, e, t) {
|
|
|
3294
3294
|
};
|
|
3295
3295
|
}
|
|
3296
3296
|
function yt(n, e, t, r) {
|
|
3297
|
-
const s = n ?
|
|
3297
|
+
const s = n ? aa(n, e, t) : null, i = J(), a = [J(), e, t];
|
|
3298
3298
|
return {
|
|
3299
3299
|
id: i,
|
|
3300
3300
|
"forward-identity": a,
|
|
@@ -3307,11 +3307,11 @@ function yt(n, e, t, r) {
|
|
|
3307
3307
|
...r || {}
|
|
3308
3308
|
};
|
|
3309
3309
|
}
|
|
3310
|
-
function
|
|
3310
|
+
function ca(n, e, t) {
|
|
3311
3311
|
return Object.values(n.links).find((i) => i.forward.on === e && i.forward.label === t || i.reverse.on === e && i.reverse.label === t);
|
|
3312
3312
|
}
|
|
3313
|
-
function
|
|
3314
|
-
const r =
|
|
3313
|
+
function ua(n, e, t) {
|
|
3314
|
+
const r = ca(n, e, t);
|
|
3315
3315
|
if (!r)
|
|
3316
3316
|
throw new Error(`Couldn't find the link ${e}.${t} in your schema`);
|
|
3317
3317
|
const { forward: s, reverse: i } = r;
|
|
@@ -3325,7 +3325,7 @@ function ca(n, e, t) {
|
|
|
3325
3325
|
};
|
|
3326
3326
|
}
|
|
3327
3327
|
function or(n, e, t, r) {
|
|
3328
|
-
const s = n ?
|
|
3328
|
+
const s = n ? ua(n, e, t) : null, i = J(), o = [J(), e, t], a = [J(), t, e];
|
|
3329
3329
|
return {
|
|
3330
3330
|
id: i,
|
|
3331
3331
|
// @ts-ignore: ts thinks it's any[]
|
|
@@ -3342,7 +3342,7 @@ function or(n, e, t, r) {
|
|
|
3342
3342
|
...r || {}
|
|
3343
3343
|
};
|
|
3344
3344
|
}
|
|
3345
|
-
const
|
|
3345
|
+
const la = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink"]), fa = /* @__PURE__ */ new Set(["link", "unlink"]), da = /* @__PURE__ */ new Set(["create", "update", "merge"]), ha = /* @__PURE__ */ new Set([
|
|
3346
3346
|
"link",
|
|
3347
3347
|
"unlink",
|
|
3348
3348
|
"create",
|
|
@@ -3350,13 +3350,13 @@ const ua = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink
|
|
|
3350
3350
|
"merge",
|
|
3351
3351
|
"delete",
|
|
3352
3352
|
"ruleParams"
|
|
3353
|
-
]), dn = { "unique?": !0, "index?": !0 },
|
|
3353
|
+
]), dn = { "unique?": !0, "index?": !0 }, pa = {
|
|
3354
3354
|
...dn,
|
|
3355
3355
|
cardinality: "one"
|
|
3356
3356
|
};
|
|
3357
|
-
function
|
|
3357
|
+
function ya(n) {
|
|
3358
3358
|
const e = [], [t, r, s, i] = n;
|
|
3359
|
-
if (!
|
|
3359
|
+
if (!ha.has(t))
|
|
3360
3360
|
return e;
|
|
3361
3361
|
const o = fn(s);
|
|
3362
3362
|
if (o && e.push({ etype: r, lookupPair: o }), t === "link")
|
|
@@ -3373,7 +3373,7 @@ function pa(n) {
|
|
|
3373
3373
|
}
|
|
3374
3374
|
return e;
|
|
3375
3375
|
}
|
|
3376
|
-
function
|
|
3376
|
+
function ba({ attrsStore: n, schema: e }, t) {
|
|
3377
3377
|
var h, y;
|
|
3378
3378
|
const r = /* @__PURE__ */ new Set(), s = [], i = [];
|
|
3379
3379
|
function o(b, g) {
|
|
@@ -3398,10 +3398,10 @@ function ya({ attrsStore: n, schema: e }, t) {
|
|
|
3398
3398
|
}
|
|
3399
3399
|
function f(b, g) {
|
|
3400
3400
|
const m = o(b, g), S = a(b, g);
|
|
3401
|
-
u(m), u(S), !m && !S && c(or(e, b, g,
|
|
3401
|
+
u(m), u(S), !m && !S && c(or(e, b, g, pa));
|
|
3402
3402
|
}
|
|
3403
3403
|
for (const b of t)
|
|
3404
|
-
for (const { etype: g, lookupPair: m, linkLabel: S } of
|
|
3404
|
+
for (const { etype: g, lookupPair: m, linkLabel: S } of ya(b)) {
|
|
3405
3405
|
const _ = m[0];
|
|
3406
3406
|
if (S) {
|
|
3407
3407
|
f(g, S);
|
|
@@ -3423,12 +3423,12 @@ function ya({ attrsStore: n, schema: e }, t) {
|
|
|
3423
3423
|
}
|
|
3424
3424
|
for (const b of t) {
|
|
3425
3425
|
const [g, m, S, _] = b;
|
|
3426
|
-
if (
|
|
3426
|
+
if (la.has(g)) {
|
|
3427
3427
|
const T = o(m, "id");
|
|
3428
3428
|
u(T), T || c(yt(e, m, "id", { "unique?": !0 }));
|
|
3429
3429
|
for (const R of Object.keys(_)) {
|
|
3430
3430
|
const O = o(m, R);
|
|
3431
|
-
if (u(O),
|
|
3431
|
+
if (u(O), da.has(g) && (O || c(yt(e, m, R, R === "id" ? { "unique?": !0 } : null))), fa.has(g)) {
|
|
3432
3432
|
const F = a(m, R);
|
|
3433
3433
|
!O && !F && c(or(e, m, R)), u(F);
|
|
3434
3434
|
}
|
|
@@ -3443,15 +3443,15 @@ function ya({ attrsStore: n, schema: e }, t) {
|
|
|
3443
3443
|
}
|
|
3444
3444
|
return [n, i];
|
|
3445
3445
|
}
|
|
3446
|
-
function
|
|
3447
|
-
const r = (Array.isArray(e) ? e : [e]).flatMap((c) =>
|
|
3446
|
+
function ga(n, e) {
|
|
3447
|
+
const r = (Array.isArray(e) ? e : [e]).flatMap((c) => Vo(c)), [s, i] = ba(n, r), o = { ...n, attrsStore: s }, a = r.flatMap((c) => ia(o, c));
|
|
3448
3448
|
return [...i, ...a];
|
|
3449
3449
|
}
|
|
3450
3450
|
function ar(n, e) {
|
|
3451
3451
|
typeof requestIdleCallback > "u" ? n() : requestIdleCallback(n, { timeout: e });
|
|
3452
3452
|
}
|
|
3453
3453
|
const We = "__meta";
|
|
3454
|
-
class
|
|
3454
|
+
class _a {
|
|
3455
3455
|
constructor(e, t) {
|
|
3456
3456
|
}
|
|
3457
3457
|
}
|
|
@@ -3703,13 +3703,13 @@ class hn {
|
|
|
3703
3703
|
e && await this._enqueuePersist();
|
|
3704
3704
|
}
|
|
3705
3705
|
}
|
|
3706
|
-
const
|
|
3707
|
-
function
|
|
3706
|
+
const ma = 6, wa = ["kv", "querySubs", "syncSubs"];
|
|
3707
|
+
function Ta(n) {
|
|
3708
3708
|
return function(t) {
|
|
3709
3709
|
console.error("Error in IndexedDB event", { source: n, event: t });
|
|
3710
3710
|
};
|
|
3711
3711
|
}
|
|
3712
|
-
async function
|
|
3712
|
+
async function Sa(n) {
|
|
3713
3713
|
return new Promise((e) => {
|
|
3714
3714
|
const t = indexedDB.open(n);
|
|
3715
3715
|
t.onerror = (r) => {
|
|
@@ -3723,7 +3723,7 @@ async function Ta(n) {
|
|
|
3723
3723
|
};
|
|
3724
3724
|
});
|
|
3725
3725
|
}
|
|
3726
|
-
async function
|
|
3726
|
+
async function va(n, e, t) {
|
|
3727
3727
|
const r = (
|
|
3728
3728
|
// Backwards compatibility for older versions where we JSON.stringified before storing
|
|
3729
3729
|
typeof e == "string" ? JSON.parse(e) : e
|
|
@@ -3763,8 +3763,8 @@ async function cr(n, e, t) {
|
|
|
3763
3763
|
r.onsuccess = () => s(), r.onerror = (o) => i(o);
|
|
3764
3764
|
});
|
|
3765
3765
|
}
|
|
3766
|
-
async function
|
|
3767
|
-
const t = await
|
|
3766
|
+
async function Aa(n, e) {
|
|
3767
|
+
const t = await Sa(`instant_${n}_5`);
|
|
3768
3768
|
if (!t)
|
|
3769
3769
|
return;
|
|
3770
3770
|
const r = await new Promise((l, f) => {
|
|
@@ -3787,7 +3787,7 @@ async function va(n, e) {
|
|
|
3787
3787
|
for (const [l, f] of r)
|
|
3788
3788
|
switch (l) {
|
|
3789
3789
|
case "querySubs": {
|
|
3790
|
-
const h =
|
|
3790
|
+
const h = va(l, f, o);
|
|
3791
3791
|
a.push(h);
|
|
3792
3792
|
break;
|
|
3793
3793
|
}
|
|
@@ -3809,7 +3809,7 @@ async function va(n, e) {
|
|
|
3809
3809
|
});
|
|
3810
3810
|
}
|
|
3811
3811
|
const ur = /* @__PURE__ */ new Map();
|
|
3812
|
-
class
|
|
3812
|
+
class as extends _a {
|
|
3813
3813
|
constructor(t, r) {
|
|
3814
3814
|
super(t, r);
|
|
3815
3815
|
p(this, "dbName");
|
|
@@ -3817,7 +3817,7 @@ class os extends ga {
|
|
|
3817
3817
|
p(this, "_appId");
|
|
3818
3818
|
p(this, "_prefix");
|
|
3819
3819
|
p(this, "_dbPromise");
|
|
3820
|
-
this.dbName = `instant_${t}_${
|
|
3820
|
+
this.dbName = `instant_${t}_${ma}`, this._storeName = r, this._appId = t, this._dbPromise = this._init();
|
|
3821
3821
|
}
|
|
3822
3822
|
_init() {
|
|
3823
3823
|
return new Promise((t, r) => {
|
|
@@ -3832,8 +3832,8 @@ class os extends ga {
|
|
|
3832
3832
|
}, c.onversionchange = () => {
|
|
3833
3833
|
c.close();
|
|
3834
3834
|
}, s) {
|
|
3835
|
-
const u =
|
|
3836
|
-
|
|
3835
|
+
const u = Aa(this._appId, c).catch((l) => {
|
|
3836
|
+
Ta("Error upgrading store from version 5 to 6.")(l);
|
|
3837
3837
|
});
|
|
3838
3838
|
ur.set(this.dbName, u), u.then(() => t(c)).catch(() => t(c));
|
|
3839
3839
|
} else {
|
|
@@ -3847,7 +3847,7 @@ class os extends ga {
|
|
|
3847
3847
|
}
|
|
3848
3848
|
_upgradeStore(t) {
|
|
3849
3849
|
const s = t.target.result;
|
|
3850
|
-
for (const i of
|
|
3850
|
+
for (const i of wa)
|
|
3851
3851
|
s.objectStoreNames.contains(i) || s.createObjectStore(i);
|
|
3852
3852
|
}
|
|
3853
3853
|
// Browsers can close IndexedDB connections unexpectedly (backgrounded tabs,
|
|
@@ -3908,7 +3908,7 @@ class os extends ga {
|
|
|
3908
3908
|
}));
|
|
3909
3909
|
}
|
|
3910
3910
|
}
|
|
3911
|
-
class
|
|
3911
|
+
class cs {
|
|
3912
3912
|
static async getIsOnline() {
|
|
3913
3913
|
return navigator.onLine;
|
|
3914
3914
|
}
|
|
@@ -3954,14 +3954,14 @@ async function we(n, e) {
|
|
|
3954
3954
|
const t = await fetch(n, e), r = await t.json();
|
|
3955
3955
|
return t.status === 200 ? Promise.resolve(r) : Promise.reject(new Mt({ status: t.status, body: r }));
|
|
3956
3956
|
}
|
|
3957
|
-
function
|
|
3957
|
+
function Oa({ apiURI: n, appId: e, email: t }) {
|
|
3958
3958
|
return we(`${n}/runtime/auth/send_magic_code`, {
|
|
3959
3959
|
method: "POST",
|
|
3960
3960
|
headers: { "content-type": "application/json" },
|
|
3961
3961
|
body: JSON.stringify({ "app-id": e, email: t })
|
|
3962
3962
|
});
|
|
3963
3963
|
}
|
|
3964
|
-
async function
|
|
3964
|
+
async function Ea({ apiURI: n, appId: e, email: t, code: r, refreshToken: s, extraFields: i }) {
|
|
3965
3965
|
return await we(`${n}/runtime/auth/verify_magic_code`, {
|
|
3966
3966
|
method: "POST",
|
|
3967
3967
|
headers: { "content-type": "application/json" },
|
|
@@ -3974,7 +3974,7 @@ async function Oa({ apiURI: n, appId: e, email: t, code: r, refreshToken: s, ext
|
|
|
3974
3974
|
})
|
|
3975
3975
|
});
|
|
3976
3976
|
}
|
|
3977
|
-
async function
|
|
3977
|
+
async function ka({ apiURI: n, appId: e, refreshToken: t }) {
|
|
3978
3978
|
return await we(`${n}/runtime/auth/verify_refresh_token`, {
|
|
3979
3979
|
method: "POST",
|
|
3980
3980
|
headers: { "content-type": "application/json" },
|
|
@@ -3984,7 +3984,7 @@ async function Ea({ apiURI: n, appId: e, refreshToken: t }) {
|
|
|
3984
3984
|
})
|
|
3985
3985
|
});
|
|
3986
3986
|
}
|
|
3987
|
-
async function
|
|
3987
|
+
async function Ca({ apiURI: n, appId: e }) {
|
|
3988
3988
|
return await we(`${n}/runtime/auth/sign_in_guest`, {
|
|
3989
3989
|
method: "POST",
|
|
3990
3990
|
headers: { "content-type": "application/json" },
|
|
@@ -4006,7 +4006,7 @@ async function lr({ apiURI: n, appId: e, code: t, codeVerifier: r, refreshToken:
|
|
|
4006
4006
|
})
|
|
4007
4007
|
});
|
|
4008
4008
|
}
|
|
4009
|
-
async function
|
|
4009
|
+
async function Ia({ apiURI: n, appId: e, nonce: t, idToken: r, clientName: s, refreshToken: i, extraFields: o }) {
|
|
4010
4010
|
return await we(`${n}/runtime/oauth/id_token`, {
|
|
4011
4011
|
method: "POST",
|
|
4012
4012
|
headers: { "content-type": "application/json" },
|
|
@@ -4020,7 +4020,7 @@ async function Ca({ apiURI: n, appId: e, nonce: t, idToken: r, clientName: s, re
|
|
|
4020
4020
|
})
|
|
4021
4021
|
});
|
|
4022
4022
|
}
|
|
4023
|
-
async function
|
|
4023
|
+
async function Pa({ apiURI: n, appId: e, refreshToken: t }) {
|
|
4024
4024
|
return await we(`${n}/runtime/signout`, {
|
|
4025
4025
|
method: "POST",
|
|
4026
4026
|
headers: {
|
|
@@ -4032,7 +4032,7 @@ async function Ia({ apiURI: n, appId: e, refreshToken: t }) {
|
|
|
4032
4032
|
})
|
|
4033
4033
|
});
|
|
4034
4034
|
}
|
|
4035
|
-
async function
|
|
4035
|
+
async function Ra({ apiURI: n, appId: e, path: t, file: r, refreshToken: s, contentType: i, contentDisposition: o }) {
|
|
4036
4036
|
const a = {
|
|
4037
4037
|
app_id: e,
|
|
4038
4038
|
path: t,
|
|
@@ -4045,7 +4045,7 @@ async function Pa({ apiURI: n, appId: e, path: t, file: r, refreshToken: s, cont
|
|
|
4045
4045
|
body: r
|
|
4046
4046
|
});
|
|
4047
4047
|
}
|
|
4048
|
-
async function
|
|
4048
|
+
async function Ma({ apiURI: n, appId: e, path: t, refreshToken: r }) {
|
|
4049
4049
|
const { data: s } = await we(`${n}/storage/files?app_id=${e}&filename=${encodeURIComponent(t)}`, {
|
|
4050
4050
|
method: "DELETE",
|
|
4051
4051
|
headers: {
|
|
@@ -4055,7 +4055,7 @@ async function Ra({ apiURI: n, appId: e, path: t, refreshToken: r }) {
|
|
|
4055
4055
|
});
|
|
4056
4056
|
return s;
|
|
4057
4057
|
}
|
|
4058
|
-
async function
|
|
4058
|
+
async function ja({ apiURI: n, appId: e, fileName: t, refreshToken: r, metadata: s = {} }) {
|
|
4059
4059
|
const { data: i } = await we(`${n}/storage/signed-upload-url`, {
|
|
4060
4060
|
method: "POST",
|
|
4061
4061
|
headers: {
|
|
@@ -4069,7 +4069,7 @@ async function Ma({ apiURI: n, appId: e, fileName: t, refreshToken: r, metadata:
|
|
|
4069
4069
|
});
|
|
4070
4070
|
return i;
|
|
4071
4071
|
}
|
|
4072
|
-
async function
|
|
4072
|
+
async function $a(n, e) {
|
|
4073
4073
|
return (await fetch(n, {
|
|
4074
4074
|
method: "PUT",
|
|
4075
4075
|
body: e,
|
|
@@ -4078,7 +4078,7 @@ async function ja(n, e) {
|
|
|
4078
4078
|
}
|
|
4079
4079
|
})).ok;
|
|
4080
4080
|
}
|
|
4081
|
-
async function
|
|
4081
|
+
async function xa({ apiURI: n, appId: e, path: t, refreshToken: r }) {
|
|
4082
4082
|
const { data: s } = await we(`${n}/storage/signed-download-url?app_id=${e}&filename=${encodeURIComponent(t)}`, {
|
|
4083
4083
|
method: "GET",
|
|
4084
4084
|
headers: {
|
|
@@ -4088,8 +4088,8 @@ async function $a({ apiURI: n, appId: e, path: t, refreshToken: r }) {
|
|
|
4088
4088
|
});
|
|
4089
4089
|
return s;
|
|
4090
4090
|
}
|
|
4091
|
-
let Cn = !1,
|
|
4092
|
-
typeof window < "u" && typeof window.localStorage < "u" && (Cn = !!window.localStorage.getItem("devBackend"),
|
|
4091
|
+
let Cn = !1, us = !1, ls = !1;
|
|
4092
|
+
typeof window < "u" && typeof window.localStorage < "u" && (Cn = !!window.localStorage.getItem("devBackend"), us = !!window.localStorage.getItem("__instantLogging"), ls = !!window.localStorage.getItem("__devtoolLocalDash"));
|
|
4093
4093
|
function fr(n, e) {
|
|
4094
4094
|
if (!e)
|
|
4095
4095
|
return n;
|
|
@@ -4098,7 +4098,7 @@ function fr(n, e) {
|
|
|
4098
4098
|
t[r] = n[r];
|
|
4099
4099
|
}), t;
|
|
4100
4100
|
}
|
|
4101
|
-
function
|
|
4101
|
+
function Da(n, e, t) {
|
|
4102
4102
|
const r = {
|
|
4103
4103
|
peers: {}
|
|
4104
4104
|
};
|
|
@@ -4115,8 +4115,8 @@ function xa(n, e, t) {
|
|
|
4115
4115
|
}
|
|
4116
4116
|
return r;
|
|
4117
4117
|
}
|
|
4118
|
-
function
|
|
4119
|
-
if (n.isLoading !== e.isLoading || n.error !== e.error || (n.user || e.user) && (!n.user || !e.user || !Jn(n.user, e.user)) || !
|
|
4118
|
+
function Ua(n, e) {
|
|
4119
|
+
if (n.isLoading !== e.isLoading || n.error !== e.error || (n.user || e.user) && (!n.user || !e.user || !Jn(n.user, e.user)) || !Fr(n.peers, e.peers))
|
|
4120
4120
|
return !0;
|
|
4121
4121
|
for (const r of Object.keys(n.peers))
|
|
4122
4122
|
if (!Jn(n.peers[r], e.peers[r]))
|
|
@@ -4139,18 +4139,18 @@ class dr {
|
|
|
4139
4139
|
this._reject(e);
|
|
4140
4140
|
}
|
|
4141
4141
|
}
|
|
4142
|
-
function
|
|
4142
|
+
function fs(n, e = []) {
|
|
4143
4143
|
n.forEach((t) => {
|
|
4144
4144
|
const { data: r } = t, { "datalog-result": s } = r, { "join-rows": i } = s;
|
|
4145
4145
|
for (const o of i)
|
|
4146
4146
|
for (const a of o)
|
|
4147
4147
|
e.push(a);
|
|
4148
|
-
|
|
4148
|
+
fs(t["child-nodes"], e);
|
|
4149
4149
|
});
|
|
4150
4150
|
}
|
|
4151
4151
|
function hr(n) {
|
|
4152
4152
|
const e = [];
|
|
4153
|
-
return
|
|
4153
|
+
return fs(n, e), e;
|
|
4154
4154
|
}
|
|
4155
4155
|
function pr(n) {
|
|
4156
4156
|
return Object.values(n.links).reduce((e, t) => {
|
|
@@ -4166,8 +4166,8 @@ function pr(n) {
|
|
|
4166
4166
|
}, e;
|
|
4167
4167
|
}, {});
|
|
4168
4168
|
}
|
|
4169
|
-
const
|
|
4170
|
-
function
|
|
4169
|
+
const ds = "v1.0.41";
|
|
4170
|
+
function La(n, e) {
|
|
4171
4171
|
return {
|
|
4172
4172
|
info: n ? (...t) => console.info(...t, e()) : () => {
|
|
4173
4173
|
},
|
|
@@ -4229,7 +4229,7 @@ const yr = [
|
|
|
4229
4229
|
"beforeInclusive",
|
|
4230
4230
|
"fields",
|
|
4231
4231
|
"aggregate"
|
|
4232
|
-
],
|
|
4232
|
+
], Fa = (n) => n.valueType || "unknown", hs = (n, e, t = !1) => {
|
|
4233
4233
|
if (t || n == null)
|
|
4234
4234
|
return !0;
|
|
4235
4235
|
switch (e) {
|
|
@@ -4244,9 +4244,9 @@ const yr = [
|
|
|
4244
4244
|
default:
|
|
4245
4245
|
return !0;
|
|
4246
4246
|
}
|
|
4247
|
-
},
|
|
4247
|
+
}, Na = (n, e, t, r, s, i, o) => {
|
|
4248
4248
|
const a = i.valueType === "json", c = (u, l, f) => {
|
|
4249
|
-
if (!
|
|
4249
|
+
if (!hs(f, l, a))
|
|
4250
4250
|
throw new Q(`Invalid value for operator '${u}' on attribute '${r}' in entity '${s}'. Expected ${l}, but received: ${typeof f}`, o);
|
|
4251
4251
|
};
|
|
4252
4252
|
switch (n) {
|
|
@@ -4277,16 +4277,16 @@ const yr = [
|
|
|
4277
4277
|
throw new Q(`Unknown operator '${n}' for attribute '${r}' in entity '${s}'`, o);
|
|
4278
4278
|
}
|
|
4279
4279
|
}, ze = (n, e, t, r, s) => {
|
|
4280
|
-
const i =
|
|
4280
|
+
const i = Fa(t), o = t.valueType === "json";
|
|
4281
4281
|
if (typeof n == "object" && n !== null && !Array.isArray(n)) {
|
|
4282
4282
|
if (o)
|
|
4283
4283
|
return;
|
|
4284
4284
|
const c = n;
|
|
4285
4285
|
for (const [u, l] of Object.entries(c))
|
|
4286
|
-
|
|
4287
|
-
} else if (!
|
|
4286
|
+
Na(u, l, i, e, r, t, `${s}.${u}`);
|
|
4287
|
+
} else if (!hs(n, i, o))
|
|
4288
4288
|
throw new Q(`Invalid value for attribute '${e}' in entity '${r}'. Expected ${i}, but received: ${typeof n}`, s);
|
|
4289
|
-
},
|
|
4289
|
+
}, Ka = (n, e, t, r, s) => {
|
|
4290
4290
|
const i = n.split(".");
|
|
4291
4291
|
if (i.length < 2)
|
|
4292
4292
|
throw new Q(`Invalid dot notation path '${n}'. Must contain at least one dot.`, s);
|
|
@@ -4323,12 +4323,12 @@ const yr = [
|
|
|
4323
4323
|
throw new Q(`Attribute '${a}' does not exist on entity '${o}' in dot notation path '${n}'. Available attributes: ${l.length > 0 ? l.join(", ") + ", id" : "id"}`, s);
|
|
4324
4324
|
}
|
|
4325
4325
|
ze(e, n, u, t, s);
|
|
4326
|
-
},
|
|
4326
|
+
}, ps = (n, e, t, r) => {
|
|
4327
4327
|
for (const [s, i] of Object.entries(n)) {
|
|
4328
4328
|
if (s === "or" || s === "and") {
|
|
4329
4329
|
if (Array.isArray(i))
|
|
4330
4330
|
for (const u of i)
|
|
4331
|
-
typeof u == "object" && u !== null &&
|
|
4331
|
+
typeof u == "object" && u !== null && ps(u, e, t, `${r}.${s}[${u}]`);
|
|
4332
4332
|
continue;
|
|
4333
4333
|
}
|
|
4334
4334
|
if (s === "id") {
|
|
@@ -4336,7 +4336,7 @@ const yr = [
|
|
|
4336
4336
|
continue;
|
|
4337
4337
|
}
|
|
4338
4338
|
if (s.includes(".")) {
|
|
4339
|
-
|
|
4339
|
+
Ka(s, i, e, t, `${r}.${s}`);
|
|
4340
4340
|
continue;
|
|
4341
4341
|
}
|
|
4342
4342
|
const o = t.entities[e];
|
|
@@ -4356,7 +4356,7 @@ const yr = [
|
|
|
4356
4356
|
ze(i, s, u, e, `${r}.${s}`);
|
|
4357
4357
|
}
|
|
4358
4358
|
}
|
|
4359
|
-
},
|
|
4359
|
+
}, qa = (n, e, t, r, s = 0) => {
|
|
4360
4360
|
for (const o of Object.keys(n))
|
|
4361
4361
|
if (!yr.includes(o))
|
|
4362
4362
|
throw new Q(`Invalid query parameter '${o}' in $ object. Valid parameters are: ${yr.join(", ")}. Found: ${o}`, r);
|
|
@@ -4376,9 +4376,9 @@ const yr = [
|
|
|
4376
4376
|
if (n.where && t) {
|
|
4377
4377
|
if (typeof n.where != "object" || n.where === null)
|
|
4378
4378
|
throw new Q(`'where' clause must be an object in entity '${e}', but received: ${typeof n.where}`, r ? `${r}.where` : void 0);
|
|
4379
|
-
|
|
4379
|
+
ps(n.where, e, t, r ? `${r}.where` : "where");
|
|
4380
4380
|
}
|
|
4381
|
-
},
|
|
4381
|
+
}, ys = (n, e, t, r, s = 0) => {
|
|
4382
4382
|
var i;
|
|
4383
4383
|
if (!n || typeof n != "object")
|
|
4384
4384
|
throw new Q(`Query part for entity '${e}' must be an object, but received: ${typeof n}`, r);
|
|
@@ -4391,13 +4391,13 @@ const yr = [
|
|
|
4391
4391
|
const a = n[o];
|
|
4392
4392
|
if (typeof a == "object" && a !== null) {
|
|
4393
4393
|
const c = (i = t == null ? void 0 : t.entities[e].links[o]) == null ? void 0 : i.entityName;
|
|
4394
|
-
c &&
|
|
4394
|
+
c && ys(a, c, t, `${r}.${o}`, s + 1);
|
|
4395
4395
|
}
|
|
4396
4396
|
} else {
|
|
4397
4397
|
const a = n[o];
|
|
4398
4398
|
if (typeof a != "object" || a === null)
|
|
4399
4399
|
throw new Q(`Query parameter '$' must be an object in entity '${e}', but received: ${typeof a}`, `${r}.$`);
|
|
4400
|
-
|
|
4400
|
+
qa(a, e, t, `${r}.$`, s);
|
|
4401
4401
|
}
|
|
4402
4402
|
}, br = (n, e) => {
|
|
4403
4403
|
if (typeof n != "object" || n === null)
|
|
@@ -4415,7 +4415,7 @@ const yr = [
|
|
|
4415
4415
|
const s = Object.keys(e.entities);
|
|
4416
4416
|
throw new Q(`Entity '${r}' does not exist in schema. Available entities: ${s.length > 0 ? s.join(", ") : "none"}`, r);
|
|
4417
4417
|
}
|
|
4418
|
-
|
|
4418
|
+
ys(t[r], r, e, r, 0);
|
|
4419
4419
|
}
|
|
4420
4420
|
}
|
|
4421
4421
|
}, gr = (n) => typeof n != "string" ? !1 : It(n) ? !0 : Ve(n);
|
|
@@ -4424,39 +4424,39 @@ class be extends Error {
|
|
|
4424
4424
|
super(e), this.name = "TransactionValidationError";
|
|
4425
4425
|
}
|
|
4426
4426
|
}
|
|
4427
|
-
const
|
|
4427
|
+
const bs = (n) => n.length > 0 ? n.join(", ") : "none", Wa = (n, e) => new be(`Entity '${n}' does not exist in schema. Available entities: ${bs(e)}`), qt = {
|
|
4428
4428
|
string: (n) => typeof n == "string",
|
|
4429
4429
|
number: (n) => typeof n == "number" && !isNaN(n),
|
|
4430
4430
|
boolean: (n) => typeof n == "boolean",
|
|
4431
4431
|
date: (n) => n instanceof Date || typeof n == "string" || typeof n == "number",
|
|
4432
4432
|
json: () => !0
|
|
4433
|
-
},
|
|
4433
|
+
}, za = (n, e) => {
|
|
4434
4434
|
var t;
|
|
4435
4435
|
return n == null ? !0 : ((t = qt[e.valueType]) == null ? void 0 : t.call(qt, n)) ?? !1;
|
|
4436
|
-
},
|
|
4436
|
+
}, gs = (n, e) => {
|
|
4437
4437
|
const t = e.entities[n];
|
|
4438
4438
|
if (!t)
|
|
4439
|
-
throw
|
|
4439
|
+
throw Wa(n, Object.keys(e.entities));
|
|
4440
4440
|
return t;
|
|
4441
4441
|
}, Wt = (n, e, t) => {
|
|
4442
|
-
const r =
|
|
4442
|
+
const r = gs(n, t);
|
|
4443
4443
|
if (typeof e != "object" || e === null)
|
|
4444
4444
|
throw new be(`Arguments for data operation on entity '${n}' must be an object, but received: ${typeof e}`);
|
|
4445
4445
|
for (const [s, i] of Object.entries(e)) {
|
|
4446
4446
|
if (s === "id")
|
|
4447
4447
|
continue;
|
|
4448
4448
|
const o = r.attrs[s];
|
|
4449
|
-
if (o && !
|
|
4449
|
+
if (o && !za(i, o))
|
|
4450
4450
|
throw new be(`Invalid value for attribute '${s}' in entity '${n}'. Expected ${o.valueType}, but received: ${typeof i}`);
|
|
4451
4451
|
}
|
|
4452
4452
|
}, _r = (n, e, t) => {
|
|
4453
|
-
const r =
|
|
4453
|
+
const r = gs(n, t);
|
|
4454
4454
|
if (typeof e != "object" || e === null)
|
|
4455
4455
|
throw new be(`Arguments for link operation on entity '${n}' must be an object, but received: ${typeof e}`);
|
|
4456
4456
|
for (const [s, i] of Object.entries(e)) {
|
|
4457
4457
|
if (!r.links[s]) {
|
|
4458
4458
|
const a = Object.keys(r.links);
|
|
4459
|
-
throw new be(`Link '${s}' does not exist on entity '${n}'. Available links: ${
|
|
4459
|
+
throw new be(`Link '${s}' does not exist on entity '${n}'. Available links: ${bs(a)}`);
|
|
4460
4460
|
}
|
|
4461
4461
|
if (i != null) {
|
|
4462
4462
|
if (Array.isArray(i)) {
|
|
@@ -4467,7 +4467,7 @@ const ys = (n) => n.length > 0 ? n.join(", ") : "none", qa = (n, e) => new be(`E
|
|
|
4467
4467
|
throw new be(`Invalid UUID in link '${s}' for entity '${n}'. Expected a UUID, but received: ${i}`);
|
|
4468
4468
|
}
|
|
4469
4469
|
}
|
|
4470
|
-
},
|
|
4470
|
+
}, Va = {
|
|
4471
4471
|
create: Wt,
|
|
4472
4472
|
update: Wt,
|
|
4473
4473
|
merge: Wt,
|
|
@@ -4475,7 +4475,7 @@ const ys = (n) => n.length > 0 ? n.join(", ") : "none", qa = (n, e) => new be(`E
|
|
|
4475
4475
|
unlink: _r,
|
|
4476
4476
|
delete: () => {
|
|
4477
4477
|
}
|
|
4478
|
-
},
|
|
4478
|
+
}, Qa = (n, e) => {
|
|
4479
4479
|
if (!e)
|
|
4480
4480
|
return;
|
|
4481
4481
|
const [t, r, s, i] = n;
|
|
@@ -4483,9 +4483,9 @@ const ys = (n) => n.length > 0 ? n.join(", ") : "none", qa = (n, e) => new be(`E
|
|
|
4483
4483
|
throw new be(`Invalid id for entity '${r}'. Expected a UUID, but received: ${s}`);
|
|
4484
4484
|
if (typeof r != "string")
|
|
4485
4485
|
throw new be(`Entity name must be a string, but received: ${typeof r}`);
|
|
4486
|
-
const o =
|
|
4486
|
+
const o = Va[t];
|
|
4487
4487
|
o && i !== void 0 && o(r, i, e);
|
|
4488
|
-
},
|
|
4488
|
+
}, Ba = (n, e) => {
|
|
4489
4489
|
const t = Array.isArray(n) ? n : [n];
|
|
4490
4490
|
for (const r of t) {
|
|
4491
4491
|
if (!r || typeof r != "object")
|
|
@@ -4495,11 +4495,11 @@ const ys = (n) => n.length > 0 ? n.join(", ") : "none", qa = (n, e) => new be(`E
|
|
|
4495
4495
|
for (const s of r.__ops) {
|
|
4496
4496
|
if (!Array.isArray(s))
|
|
4497
4497
|
throw new be(`Transaction operation must be an array, but received: ${typeof s}`);
|
|
4498
|
-
|
|
4498
|
+
Qa(s, e);
|
|
4499
4499
|
}
|
|
4500
4500
|
}
|
|
4501
4501
|
};
|
|
4502
|
-
let
|
|
4502
|
+
let _s = 0;
|
|
4503
4503
|
class mr {
|
|
4504
4504
|
constructor(e) {
|
|
4505
4505
|
p(this, "type", "ws");
|
|
@@ -4509,7 +4509,7 @@ class mr {
|
|
|
4509
4509
|
p(this, "onmessage");
|
|
4510
4510
|
p(this, "onclose");
|
|
4511
4511
|
p(this, "onerror");
|
|
4512
|
-
this.id = `${this.type}_${
|
|
4512
|
+
this.id = `${this.type}_${_s++}`, this.conn = new WebSocket(e), this.conn.onopen = (t) => {
|
|
4513
4513
|
this.onopen && this.onopen({ target: this });
|
|
4514
4514
|
}, this.conn.onmessage = (t) => {
|
|
4515
4515
|
this.onmessage && this.onmessage({
|
|
@@ -4535,7 +4535,7 @@ class mr {
|
|
|
4535
4535
|
return this.conn.send(JSON.stringify(e));
|
|
4536
4536
|
}
|
|
4537
4537
|
}
|
|
4538
|
-
class
|
|
4538
|
+
class Ga {
|
|
4539
4539
|
constructor(e, t, r) {
|
|
4540
4540
|
p(this, "type", "sse");
|
|
4541
4541
|
p(this, "initParams", null);
|
|
@@ -4552,7 +4552,7 @@ class Ba {
|
|
|
4552
4552
|
p(this, "onmessage");
|
|
4553
4553
|
p(this, "onclose");
|
|
4554
4554
|
p(this, "onerror");
|
|
4555
|
-
this.id = `${this.type}_${
|
|
4555
|
+
this.id = `${this.type}_${_s++}`, this.url = t, this.messageUrl = r || this.url, this.ES = e, this.conn = new e(t), this.sseInitTimeout = setTimeout(() => {
|
|
4556
4556
|
this.initParams || this.handleError();
|
|
4557
4557
|
}, 1e4), this.conn.onmessage = (s) => {
|
|
4558
4558
|
const i = JSON.parse(s.data);
|
|
@@ -4632,24 +4632,24 @@ class Ba {
|
|
|
4632
4632
|
this.handleClose();
|
|
4633
4633
|
}
|
|
4634
4634
|
}
|
|
4635
|
-
function
|
|
4635
|
+
function Ha(n, e) {
|
|
4636
4636
|
const t = n.values;
|
|
4637
4637
|
if (t) {
|
|
4638
|
-
const r =
|
|
4638
|
+
const r = Vr(t.attrsStore, null);
|
|
4639
4639
|
if (r) {
|
|
4640
4640
|
for (const s of t.entities || [])
|
|
4641
|
-
s.store.useDateObjects = e, s.store =
|
|
4641
|
+
s.store.useDateObjects = e, s.store = zr(r, s.store);
|
|
4642
4642
|
t.attrsStore = r;
|
|
4643
4643
|
}
|
|
4644
4644
|
}
|
|
4645
4645
|
return n;
|
|
4646
4646
|
}
|
|
4647
|
-
function
|
|
4647
|
+
function Ja(n, e) {
|
|
4648
4648
|
var t;
|
|
4649
4649
|
if (e.values) {
|
|
4650
4650
|
const r = [];
|
|
4651
4651
|
for (const s of (t = e.values) == null ? void 0 : t.entities) {
|
|
4652
|
-
const i =
|
|
4652
|
+
const i = Wr(s.store);
|
|
4653
4653
|
r.push({ ...s, store: i });
|
|
4654
4654
|
}
|
|
4655
4655
|
return {
|
|
@@ -4659,13 +4659,13 @@ function Ha(n, e) {
|
|
|
4659
4659
|
} else
|
|
4660
4660
|
return e;
|
|
4661
4661
|
}
|
|
4662
|
-
function
|
|
4662
|
+
function Ya(n, e, t) {
|
|
4663
4663
|
var i, o;
|
|
4664
4664
|
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;
|
|
4665
4665
|
return r && (!s || r > s) ? e : s && (!r || s > r) ? t : e || t;
|
|
4666
4666
|
}
|
|
4667
4667
|
function zt(n, e, t) {
|
|
4668
|
-
return
|
|
4668
|
+
return ss({ store: e, attrsStore: t, pageInfo: null, aggregate: null }, n.query).data[n.table][0];
|
|
4669
4669
|
}
|
|
4670
4670
|
function wr(n, e, t, r) {
|
|
4671
4671
|
var o;
|
|
@@ -4679,14 +4679,14 @@ function Tr(n, e, t) {
|
|
|
4679
4679
|
for (const { action: r, triple: s } of t)
|
|
4680
4680
|
switch (r) {
|
|
4681
4681
|
case "added":
|
|
4682
|
-
|
|
4682
|
+
Gr(n, e, s);
|
|
4683
4683
|
break;
|
|
4684
4684
|
case "removed":
|
|
4685
|
-
|
|
4685
|
+
Qr(n, e, s);
|
|
4686
4686
|
break;
|
|
4687
4687
|
}
|
|
4688
4688
|
}
|
|
4689
|
-
function
|
|
4689
|
+
function Za(n, e, t) {
|
|
4690
4690
|
var s, i;
|
|
4691
4691
|
const r = {};
|
|
4692
4692
|
for (const { action: o, triple: a } of t) {
|
|
@@ -4714,14 +4714,14 @@ function Ya(n, e, t) {
|
|
|
4714
4714
|
function bt(n, e) {
|
|
4715
4715
|
return { [n.table]: e.map((t) => t.entity) };
|
|
4716
4716
|
}
|
|
4717
|
-
function
|
|
4717
|
+
function Xa(n, e) {
|
|
4718
4718
|
var r;
|
|
4719
4719
|
if (n.orderFieldType)
|
|
4720
4720
|
return n.orderFieldType;
|
|
4721
4721
|
const t = n.orderField === "serverCreatedAt" ? "number" : (r = ne(e(), n.table, n.orderField)) == null ? void 0 : r["checked-data-type"];
|
|
4722
4722
|
return n.orderFieldType = t, t;
|
|
4723
4723
|
}
|
|
4724
|
-
function
|
|
4724
|
+
function ec(n, e, t) {
|
|
4725
4725
|
const r = e;
|
|
4726
4726
|
if (n.orderField === "serverCreatedAt") {
|
|
4727
4727
|
t.sort(n.orderDirection === "asc" ? function(o, a) {
|
|
@@ -4742,7 +4742,7 @@ var Ie;
|
|
|
4742
4742
|
(function(n) {
|
|
4743
4743
|
n.InitialSyncBatch = "InitialSyncBatch", n.InitialSyncComplete = "InitialSyncComplete", n.LoadFromStorage = "LoadFromStorage", n.SyncTransaction = "SyncTransaction", n.Error = "Error";
|
|
4744
4744
|
})(Ie || (Ie = {}));
|
|
4745
|
-
class
|
|
4745
|
+
class tc {
|
|
4746
4746
|
constructor(e, t, r, s, i, o) {
|
|
4747
4747
|
p(this, "trySend");
|
|
4748
4748
|
p(this, "subs");
|
|
@@ -4755,9 +4755,9 @@ class ec {
|
|
|
4755
4755
|
p(this, "getAttrs");
|
|
4756
4756
|
this.trySend = e, this.config = r, this.log = s, this.createStore = i, this.getAttrs = o, this.subs = new hn({
|
|
4757
4757
|
persister: t,
|
|
4758
|
-
merge:
|
|
4759
|
-
serialize:
|
|
4760
|
-
parse: (a, c) =>
|
|
4758
|
+
merge: Ya,
|
|
4759
|
+
serialize: Ja,
|
|
4760
|
+
parse: (a, c) => Ha(c, this.config.useDateObjects),
|
|
4761
4761
|
objectSize: (a) => {
|
|
4762
4762
|
var c;
|
|
4763
4763
|
return ((c = a.values) == null ? void 0 : c.entities.length) || 0;
|
|
@@ -4952,9 +4952,9 @@ class ec {
|
|
|
4952
4952
|
e: for (const [m, S] of Object.entries(u))
|
|
4953
4953
|
for (let _ = 0; _ < f.length; _++) {
|
|
4954
4954
|
const T = f[_];
|
|
4955
|
-
if (
|
|
4955
|
+
if (Ri(T.store, m)) {
|
|
4956
4956
|
Tr(T.store, l.attrsStore, S);
|
|
4957
|
-
const R = zt(s, T.store, l.attrsStore), O =
|
|
4957
|
+
const R = zt(s, T.store, l.attrsStore), O = Za(T.store, l.attrsStore, S)[m];
|
|
4958
4958
|
R ? (h.push({
|
|
4959
4959
|
oldEntity: T.entity,
|
|
4960
4960
|
newEntity: R,
|
|
@@ -4985,8 +4985,8 @@ class ec {
|
|
|
4985
4985
|
const b = [];
|
|
4986
4986
|
for (const m of c.sort().reverse())
|
|
4987
4987
|
b.push(f[m].entity), f.splice(m, 1);
|
|
4988
|
-
const g =
|
|
4989
|
-
|
|
4988
|
+
const g = Xa(s, this.getAttrs);
|
|
4989
|
+
ec(s, g, f), this.notifyCbs(r, {
|
|
4990
4990
|
type: Ie.SyncTransaction,
|
|
4991
4991
|
data: bt(s, (o = s.values) == null ? void 0 : o.entities),
|
|
4992
4992
|
added: y,
|
|
@@ -5027,7 +5027,7 @@ class ec {
|
|
|
5027
5027
|
r && this.initSubscription(r.query, r.hash);
|
|
5028
5028
|
}
|
|
5029
5029
|
}
|
|
5030
|
-
function
|
|
5030
|
+
function nc({ WStream: n, opts: e, startStream: t, appendStream: r, registerStream: s }) {
|
|
5031
5031
|
const i = e.clientId;
|
|
5032
5032
|
let o = null, a = null, c = null;
|
|
5033
5033
|
const u = J();
|
|
@@ -5226,7 +5226,7 @@ function tc({ WStream: n, opts: e, startStream: t, appendStream: r, registerStre
|
|
|
5226
5226
|
}
|
|
5227
5227
|
};
|
|
5228
5228
|
}
|
|
5229
|
-
class
|
|
5229
|
+
class rc {
|
|
5230
5230
|
constructor() {
|
|
5231
5231
|
p(this, "items", []);
|
|
5232
5232
|
p(this, "resolvers", []);
|
|
@@ -5260,7 +5260,7 @@ class nc {
|
|
|
5260
5260
|
}
|
|
5261
5261
|
}
|
|
5262
5262
|
}
|
|
5263
|
-
function
|
|
5263
|
+
function sc({ RStream: n, opts: e, startStream: t, cancelStream: r }) {
|
|
5264
5264
|
let s = e.byteOffset || 0, i = !1;
|
|
5265
5265
|
const o = new TextDecoder("utf-8"), a = new TextEncoder();
|
|
5266
5266
|
let c, u = !1;
|
|
@@ -5418,7 +5418,7 @@ function rc({ RStream: n, opts: e, startStream: t, cancelStream: r }) {
|
|
|
5418
5418
|
}
|
|
5419
5419
|
};
|
|
5420
5420
|
}
|
|
5421
|
-
class
|
|
5421
|
+
class ic {
|
|
5422
5422
|
constructor({ WStream: e, RStream: t, trySend: r, log: s }) {
|
|
5423
5423
|
p(this, "trySend");
|
|
5424
5424
|
p(this, "WStream");
|
|
@@ -5431,7 +5431,7 @@ class sc {
|
|
|
5431
5431
|
this.WStream = e, this.RStream = t, this.trySend = r, this.log = s;
|
|
5432
5432
|
}
|
|
5433
5433
|
createWriteStream(e) {
|
|
5434
|
-
const { stream: t, addCompleteCb: r } =
|
|
5434
|
+
const { stream: t, addCompleteCb: r } = nc({
|
|
5435
5435
|
WStream: this.WStream,
|
|
5436
5436
|
startStream: this.startWriteStream.bind(this),
|
|
5437
5437
|
appendStream: this.appendStream.bind(this),
|
|
@@ -5443,7 +5443,7 @@ class sc {
|
|
|
5443
5443
|
}), t;
|
|
5444
5444
|
}
|
|
5445
5445
|
createReadStream(e) {
|
|
5446
|
-
const { stream: t, addCloseCb: r } =
|
|
5446
|
+
const { stream: t, addCloseCb: r } = sc({
|
|
5447
5447
|
RStream: this.RStream,
|
|
5448
5448
|
opts: e,
|
|
5449
5449
|
startStream: this.startReadStream.bind(this),
|
|
@@ -5505,7 +5505,7 @@ class sc {
|
|
|
5505
5505
|
if (!r && !t)
|
|
5506
5506
|
throw new Error("Must provide one of streamId or clientId to subscribe to the stream.");
|
|
5507
5507
|
r && (o["stream-id"] = r), t && (o["client-id"] = t), s && (o.offset = s), i && (o["rule-params"] = i);
|
|
5508
|
-
const a = new
|
|
5508
|
+
const a = new rc();
|
|
5509
5509
|
return this.readStreamIterators[e] = a, this.trySend(e, o), a;
|
|
5510
5510
|
}
|
|
5511
5511
|
cancelReadStream({ eventId: e }) {
|
|
@@ -5586,23 +5586,23 @@ const Te = {
|
|
|
5586
5586
|
AUTHENTICATED: "authenticated",
|
|
5587
5587
|
CLOSED: "closed",
|
|
5588
5588
|
ERRORED: "errored"
|
|
5589
|
-
},
|
|
5589
|
+
}, oc = 3e4, ac = 3e4, cc = 200, uc = 1e3 * 60, lc = {
|
|
5590
5590
|
apiURI: "https://api.instantdb.com",
|
|
5591
5591
|
websocketURI: "wss://api.instantdb.com/runtime/session"
|
|
5592
5592
|
}, Vt = "_instant_oauth_redirect", Qt = "_instant_extra_fields_id", gt = "oauthExtraFields", Fe = "currentUser";
|
|
5593
|
-
function
|
|
5593
|
+
function fc({ transportType: n, appId: e, apiURI: t, wsURI: r, EventSourceImpl: s }) {
|
|
5594
5594
|
if (!s)
|
|
5595
5595
|
return new mr(`${r}?app_id=${e}`);
|
|
5596
5596
|
switch (n) {
|
|
5597
5597
|
case "ws":
|
|
5598
5598
|
return new mr(`${r}?app_id=${e}`);
|
|
5599
5599
|
case "sse":
|
|
5600
|
-
return new
|
|
5600
|
+
return new Ga(s, `${t}/runtime/sse?app_id=${e}`);
|
|
5601
5601
|
default:
|
|
5602
5602
|
throw new Error("Unknown transport type " + n);
|
|
5603
5603
|
}
|
|
5604
5604
|
}
|
|
5605
|
-
function
|
|
5605
|
+
function dc() {
|
|
5606
5606
|
return typeof window < "u" || typeof chrome < "u";
|
|
5607
5607
|
}
|
|
5608
5608
|
const Sr = {
|
|
@@ -5611,14 +5611,14 @@ const Sr = {
|
|
|
5611
5611
|
"refresh-presence": !0,
|
|
5612
5612
|
"patch-presence": !0
|
|
5613
5613
|
};
|
|
5614
|
-
function
|
|
5614
|
+
function hc(n, e) {
|
|
5615
5615
|
var r;
|
|
5616
5616
|
const t = typeof n == "string" ? JSON.parse(n) : n;
|
|
5617
5617
|
if ((r = t == null ? void 0 : t.result) != null && r.store) {
|
|
5618
|
-
const s =
|
|
5618
|
+
const s = Vr(t.result.attrsStore, t.result.store);
|
|
5619
5619
|
if (s) {
|
|
5620
5620
|
const i = t.result.store;
|
|
5621
|
-
t.result.store =
|
|
5621
|
+
t.result.store = zr(s, {
|
|
5622
5622
|
...i,
|
|
5623
5623
|
useDateObjects: e
|
|
5624
5624
|
}), t.result.attrsStore = s;
|
|
@@ -5626,7 +5626,7 @@ function dc(n, e) {
|
|
|
5626
5626
|
}
|
|
5627
5627
|
return t;
|
|
5628
5628
|
}
|
|
5629
|
-
function
|
|
5629
|
+
function pc(n, e) {
|
|
5630
5630
|
const { result: t, ...r } = e, s = (
|
|
5631
5631
|
/** @type {import('./reactorTypes.ts').QuerySubInStorage} */
|
|
5632
5632
|
r
|
|
@@ -5634,14 +5634,14 @@ function hc(n, e) {
|
|
|
5634
5634
|
if (t) {
|
|
5635
5635
|
const i = {
|
|
5636
5636
|
...t,
|
|
5637
|
-
store:
|
|
5637
|
+
store: Wr(t.store),
|
|
5638
5638
|
attrsStore: t.attrsStore.toJSON()
|
|
5639
5639
|
};
|
|
5640
5640
|
s.result = i;
|
|
5641
5641
|
}
|
|
5642
5642
|
return s;
|
|
5643
5643
|
}
|
|
5644
|
-
function
|
|
5644
|
+
function yc(n, e) {
|
|
5645
5645
|
switch (n) {
|
|
5646
5646
|
case "pendingMutations":
|
|
5647
5647
|
return new Map(typeof e == "string" ? JSON.parse(e) : e);
|
|
@@ -5649,7 +5649,7 @@ function pc(n, e) {
|
|
|
5649
5649
|
return e;
|
|
5650
5650
|
}
|
|
5651
5651
|
}
|
|
5652
|
-
function
|
|
5652
|
+
function bc(n, e) {
|
|
5653
5653
|
switch (n) {
|
|
5654
5654
|
case "pendingMutations":
|
|
5655
5655
|
return [...e.entries()];
|
|
@@ -5657,7 +5657,7 @@ function yc(n, e) {
|
|
|
5657
5657
|
return e;
|
|
5658
5658
|
}
|
|
5659
5659
|
}
|
|
5660
|
-
function
|
|
5660
|
+
function gc(n, e, t) {
|
|
5661
5661
|
const r = e == null ? void 0 : e.result, s = t == null ? void 0 : t.result;
|
|
5662
5662
|
return r && !s && t && (t.result = r), t || e;
|
|
5663
5663
|
}
|
|
@@ -5667,8 +5667,8 @@ function Bt(n) {
|
|
|
5667
5667
|
return a == c ? r < i ? -1 : r > i ? 1 : 0 : a - c;
|
|
5668
5668
|
});
|
|
5669
5669
|
}
|
|
5670
|
-
class
|
|
5671
|
-
constructor(e, t =
|
|
5670
|
+
class _c {
|
|
5671
|
+
constructor(e, t = as, r = cs, s, i) {
|
|
5672
5672
|
/** @type {s.AttrsStore | undefined} */
|
|
5673
5673
|
p(this, "attrs");
|
|
5674
5674
|
p(this, "_isOnline", !0);
|
|
@@ -5766,9 +5766,9 @@ class gc {
|
|
|
5766
5766
|
});
|
|
5767
5767
|
/** Applies transactions locally and sends transact message to server */
|
|
5768
5768
|
p(this, "pushTx", (e) => {
|
|
5769
|
-
this.config.disableValidation ||
|
|
5769
|
+
this.config.disableValidation || Ba(e, this.config.schema);
|
|
5770
5770
|
try {
|
|
5771
|
-
const t =
|
|
5771
|
+
const t = ga({
|
|
5772
5772
|
attrsStore: this.optimisticAttrs(),
|
|
5773
5773
|
schema: this.config.schema,
|
|
5774
5774
|
stores: Object.values(this.querySubs.currentValue).map((r) => {
|
|
@@ -5869,7 +5869,7 @@ class gc {
|
|
|
5869
5869
|
}
|
|
5870
5870
|
this._log.info("[socket][close]", t.id, "schedule reconnect, ms =", this._reconnectTimeoutMs), this._scheduleReconnect();
|
|
5871
5871
|
});
|
|
5872
|
-
if (this._EventSource = i, this.config = { ...
|
|
5872
|
+
if (this._EventSource = i, this.config = { ...lc, ...e }, this.queryCacheLimit = this.config.queryCacheLimit ?? 10, this._pendingTxCleanupTimeout = this.config.pendingTxCleanupTimeout ?? ac, this._pendingMutationCleanupThreshold = this.config.pendingMutationCleanupThreshold ?? cc, this._log = La(e.verbose || Cn || us, () => this._reactorStats()), this.versions = { ...s || {}, "@instantdb/core": ds }, this.config.schema && (this._linkIndex = pr(this.config.schema)), !!dc()) {
|
|
5873
5873
|
if (!e.appId)
|
|
5874
5874
|
throw new Error("Instant must be initialized with an appId.");
|
|
5875
5875
|
if (!Ve(e.appId))
|
|
@@ -5888,9 +5888,9 @@ class gc {
|
|
|
5888
5888
|
} catch (c) {
|
|
5889
5889
|
this._log.error("[error] handle broadcast channel", c);
|
|
5890
5890
|
}
|
|
5891
|
-
})), this._initStorage(t), this._syncTable = new
|
|
5891
|
+
})), this._initStorage(t), this._syncTable = new tc(this._trySendAuthed.bind(this), new t(this.config.appId, "syncSubs"), {
|
|
5892
5892
|
useDateObjects: this.config.useDateObjects
|
|
5893
|
-
}, this._log, (o) => tt(this.ensureAttrs(), o, this.config.enableCardinalityInference, this.config.useDateObjects), () => this.ensureAttrs()), this._instantStream = new
|
|
5893
|
+
}, this._log, (o) => tt(this.ensureAttrs(), o, this.config.enableCardinalityInference, this.config.useDateObjects), () => this.ensureAttrs()), this._instantStream = new ic({
|
|
5894
5894
|
WStream: this.config.WritableStream || WritableStream,
|
|
5895
5895
|
RStream: this.config.ReadableStream || ReadableStream,
|
|
5896
5896
|
trySend: this._trySendAuthed.bind(this),
|
|
@@ -5900,7 +5900,7 @@ class gc {
|
|
|
5900
5900
|
}), setInterval(async () => {
|
|
5901
5901
|
const o = await this.getCurrentUser();
|
|
5902
5902
|
this.syncUserToEndpoint(o.user);
|
|
5903
|
-
},
|
|
5903
|
+
}, uc), r.getIsOnline().then((o) => {
|
|
5904
5904
|
this._isOnline = o, this._startSocket(), r.listen((a) => {
|
|
5905
5905
|
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", Te.CLOSED), this._setStatus(Te.CLOSED)));
|
|
5906
5906
|
});
|
|
@@ -5939,9 +5939,9 @@ class gc {
|
|
|
5939
5939
|
_initStorage(e) {
|
|
5940
5940
|
this.querySubs = new hn({
|
|
5941
5941
|
persister: new e(this.config.appId, "querySubs"),
|
|
5942
|
-
merge:
|
|
5943
|
-
serialize:
|
|
5944
|
-
parse: (t, r) =>
|
|
5942
|
+
merge: gc,
|
|
5943
|
+
serialize: pc,
|
|
5944
|
+
parse: (t, r) => hc(r, this.config.useDateObjects),
|
|
5945
5945
|
// objectSize
|
|
5946
5946
|
objectSize: (t) => {
|
|
5947
5947
|
var r, s, i;
|
|
@@ -5960,8 +5960,8 @@ class gc {
|
|
|
5960
5960
|
}), this.querySubs.onKeyLoaded = (t) => this._onQuerySubLoaded(t), this.kv = new hn({
|
|
5961
5961
|
persister: new e(this.config.appId, "kv"),
|
|
5962
5962
|
merge: this._onMergeKv,
|
|
5963
|
-
serialize:
|
|
5964
|
-
parse:
|
|
5963
|
+
serialize: bc,
|
|
5964
|
+
parse: yc,
|
|
5965
5965
|
objectSize: () => 0,
|
|
5966
5966
|
logger: this._log,
|
|
5967
5967
|
saveThrottleMs: 100,
|
|
@@ -6356,7 +6356,7 @@ class gc {
|
|
|
6356
6356
|
if (!this.querySubs)
|
|
6357
6357
|
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;
|
|
6358
6358
|
const s = se(e), i = this._startQuerySub(e, s);
|
|
6359
|
-
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")),
|
|
6359
|
+
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")), oc), r.promise;
|
|
6360
6360
|
}
|
|
6361
6361
|
_completeQueryOnce(e, t, r) {
|
|
6362
6362
|
this.queryOnceDfds[t] && (this.queryOnceDfds[t] = this.queryOnceDfds[t].filter((s) => s.dfd !== r), this._cleanupQuery(e, t));
|
|
@@ -6423,7 +6423,7 @@ class gc {
|
|
|
6423
6423
|
a = !0;
|
|
6424
6424
|
continue;
|
|
6425
6425
|
}
|
|
6426
|
-
const g = a ?
|
|
6426
|
+
const g = a ? Qo(o, y) : y;
|
|
6427
6427
|
h.push(g);
|
|
6428
6428
|
}
|
|
6429
6429
|
return a ? h : l;
|
|
@@ -6481,12 +6481,12 @@ class gc {
|
|
|
6481
6481
|
const _ = this._applyOptimisticUpdates(f, h, m, g);
|
|
6482
6482
|
f = _.store, h = _.attrsStore;
|
|
6483
6483
|
}
|
|
6484
|
-
return { data:
|
|
6484
|
+
return { data: ss({ store: f, attrsStore: h, pageInfo: y, aggregate: b }, c), querySubVersion: s, pendingMutationsVersion: o };
|
|
6485
6485
|
}
|
|
6486
6486
|
_applyOptimisticUpdates(e, t, r, s) {
|
|
6487
6487
|
for (const [i, o] of r)
|
|
6488
6488
|
if (!o["tx-id"] || s && o["tx-id"] > s) {
|
|
6489
|
-
const a =
|
|
6489
|
+
const a = Wi(e, t, o["tx-steps"]);
|
|
6490
6490
|
e = a.store, t = a.attrsStore;
|
|
6491
6491
|
}
|
|
6492
6492
|
return { store: e, attrsStore: t };
|
|
@@ -6604,7 +6604,7 @@ class gc {
|
|
|
6604
6604
|
return;
|
|
6605
6605
|
}
|
|
6606
6606
|
const e = this._transport;
|
|
6607
|
-
this._transport =
|
|
6607
|
+
this._transport = fc({
|
|
6608
6608
|
transportType: this._transportType,
|
|
6609
6609
|
appId: this.config.appId,
|
|
6610
6610
|
apiURI: this.config.apiURI,
|
|
@@ -6838,7 +6838,7 @@ class gc {
|
|
|
6838
6838
|
}), this._reconnectTimeoutMs = 0, this._transport.close(), this._oauthCallbackResponse = null, this.notifyAuthSubs(t);
|
|
6839
6839
|
}
|
|
6840
6840
|
sendMagicCode({ email: e }) {
|
|
6841
|
-
return
|
|
6841
|
+
return Oa({
|
|
6842
6842
|
apiURI: this.config.apiURI,
|
|
6843
6843
|
appId: this.config.appId,
|
|
6844
6844
|
email: e
|
|
@@ -6846,7 +6846,7 @@ class gc {
|
|
|
6846
6846
|
}
|
|
6847
6847
|
async signInWithMagicCode(e) {
|
|
6848
6848
|
var i, o;
|
|
6849
|
-
const t = await this.getCurrentUser(), r = ((i = t == null ? void 0 : t.user) == null ? void 0 : i.type) === "guest", s = await
|
|
6849
|
+
const t = await this.getCurrentUser(), r = ((i = t == null ? void 0 : t.user) == null ? void 0 : i.type) === "guest", s = await Ea({
|
|
6850
6850
|
apiURI: this.config.apiURI,
|
|
6851
6851
|
appId: this.config.appId,
|
|
6852
6852
|
email: e.email,
|
|
@@ -6857,7 +6857,7 @@ class gc {
|
|
|
6857
6857
|
return await this.changeCurrentUser(s.user), s;
|
|
6858
6858
|
}
|
|
6859
6859
|
async signInWithCustomToken(e) {
|
|
6860
|
-
const t = await
|
|
6860
|
+
const t = await ka({
|
|
6861
6861
|
apiURI: this.config.apiURI,
|
|
6862
6862
|
appId: this.config.appId,
|
|
6863
6863
|
refreshToken: e
|
|
@@ -6865,7 +6865,7 @@ class gc {
|
|
|
6865
6865
|
return await this.changeCurrentUser(t.user), t;
|
|
6866
6866
|
}
|
|
6867
6867
|
async signInAsGuest() {
|
|
6868
|
-
const e = await
|
|
6868
|
+
const e = await Ca({
|
|
6869
6869
|
apiURI: this.config.apiURI,
|
|
6870
6870
|
appId: this.config.appId
|
|
6871
6871
|
});
|
|
@@ -6880,7 +6880,7 @@ class gc {
|
|
|
6880
6880
|
this._log.info("[auth-invalidate] skipped invalidateToken");
|
|
6881
6881
|
return;
|
|
6882
6882
|
}
|
|
6883
|
-
|
|
6883
|
+
Pa({
|
|
6884
6884
|
apiURI: this.config.apiURI,
|
|
6885
6885
|
appId: this.config.appId,
|
|
6886
6886
|
refreshToken: r
|
|
@@ -6945,7 +6945,7 @@ class gc {
|
|
|
6945
6945
|
*/
|
|
6946
6946
|
async signInWithIdToken(e) {
|
|
6947
6947
|
var i;
|
|
6948
|
-
const t = await this.getCurrentUser(), r = (i = t == null ? void 0 : t.user) == null ? void 0 : i.refresh_token, s = await
|
|
6948
|
+
const t = await this.getCurrentUser(), r = (i = t == null ? void 0 : t.user) == null ? void 0 : i.refresh_token, s = await Ia({
|
|
6949
6949
|
apiURI: this.config.apiURI,
|
|
6950
6950
|
appId: this.config.appId,
|
|
6951
6951
|
idToken: e.idToken,
|
|
@@ -6989,7 +6989,7 @@ class gc {
|
|
|
6989
6989
|
getPresence(e, t, r = {}) {
|
|
6990
6990
|
const s = this._rooms[t], i = this._presence[t];
|
|
6991
6991
|
return !s || !i || !i.result ? null : {
|
|
6992
|
-
...
|
|
6992
|
+
...Da(i.result, r, this._sessionId),
|
|
6993
6993
|
isLoading: !s.isConnected,
|
|
6994
6994
|
error: s.error
|
|
6995
6995
|
};
|
|
@@ -7051,7 +7051,7 @@ class gc {
|
|
|
7051
7051
|
}
|
|
7052
7052
|
_notifyPresenceSub(e, t) {
|
|
7053
7053
|
const r = this.getPresence("", e, t);
|
|
7054
|
-
r && (t.prev && !
|
|
7054
|
+
r && (t.prev && !Ua(r, t.prev) || (t.prev = r, t.cb(r)));
|
|
7055
7055
|
}
|
|
7056
7056
|
_patchPresencePeers(e, t) {
|
|
7057
7057
|
var o, a, c;
|
|
@@ -7062,13 +7062,13 @@ class gc {
|
|
|
7062
7062
|
for (let [l, f, h] of t)
|
|
7063
7063
|
switch (f) {
|
|
7064
7064
|
case "+":
|
|
7065
|
-
|
|
7065
|
+
fi(u, l, h);
|
|
7066
7066
|
break;
|
|
7067
7067
|
case "r":
|
|
7068
7068
|
Yn(u, l, h);
|
|
7069
7069
|
break;
|
|
7070
7070
|
case "-":
|
|
7071
|
-
|
|
7071
|
+
Kr(u, l);
|
|
7072
7072
|
break;
|
|
7073
7073
|
}
|
|
7074
7074
|
delete u[this._sessionId];
|
|
@@ -7123,7 +7123,7 @@ class gc {
|
|
|
7123
7123
|
async uploadFile(e, t, r) {
|
|
7124
7124
|
var o;
|
|
7125
7125
|
const s = await this.getCurrentUser(), i = (o = s == null ? void 0 : s.user) == null ? void 0 : o.refresh_token;
|
|
7126
|
-
return
|
|
7126
|
+
return Ra({
|
|
7127
7127
|
...r,
|
|
7128
7128
|
apiURI: this.config.apiURI,
|
|
7129
7129
|
appId: this.config.appId,
|
|
@@ -7135,7 +7135,7 @@ class gc {
|
|
|
7135
7135
|
async deleteFile(e) {
|
|
7136
7136
|
var i;
|
|
7137
7137
|
const t = await this.getCurrentUser(), r = (i = t == null ? void 0 : t.user) == null ? void 0 : i.refresh_token;
|
|
7138
|
-
return await
|
|
7138
|
+
return await Ma({
|
|
7139
7139
|
apiURI: this.config.apiURI,
|
|
7140
7140
|
appId: this.config.appId,
|
|
7141
7141
|
path: e,
|
|
@@ -7146,18 +7146,18 @@ class gc {
|
|
|
7146
7146
|
// ---------------------------------
|
|
7147
7147
|
async upload(e, t) {
|
|
7148
7148
|
var c;
|
|
7149
|
-
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
|
|
7149
|
+
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 ja({
|
|
7150
7150
|
apiURI: this.config.apiURI,
|
|
7151
7151
|
appId: this.config.appId,
|
|
7152
7152
|
fileName: i,
|
|
7153
7153
|
refreshToken: s
|
|
7154
7154
|
});
|
|
7155
|
-
return await
|
|
7155
|
+
return await $a(o, t);
|
|
7156
7156
|
}
|
|
7157
7157
|
async getDownloadUrl(e) {
|
|
7158
7158
|
var i;
|
|
7159
7159
|
const t = await this.getCurrentUser(), r = (i = t == null ? void 0 : t.user) == null ? void 0 : i.refresh_token;
|
|
7160
|
-
return await
|
|
7160
|
+
return await xa({
|
|
7161
7161
|
apiURI: this.config.apiURI,
|
|
7162
7162
|
appId: this.config.appId,
|
|
7163
7163
|
path: e,
|
|
@@ -7166,9 +7166,9 @@ class gc {
|
|
|
7166
7166
|
}
|
|
7167
7167
|
}
|
|
7168
7168
|
let _t;
|
|
7169
|
-
function
|
|
7169
|
+
function mc(n, e) {
|
|
7170
7170
|
_t == null || _t.dispose();
|
|
7171
|
-
const t =
|
|
7171
|
+
const t = Oc(e), r = Sc(e, a), s = Tc(wc(n));
|
|
7172
7172
|
function i(l) {
|
|
7173
7173
|
var f;
|
|
7174
7174
|
l.source === s.element.contentWindow && ((f = l.data) == null ? void 0 : f.type) === "close" && t.isVisible() && a();
|
|
@@ -7190,10 +7190,10 @@ function _c(n, e) {
|
|
|
7190
7190
|
}
|
|
7191
7191
|
return u();
|
|
7192
7192
|
}
|
|
7193
|
-
function mc(n) {
|
|
7194
|
-
return `${Cn || us ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${n}`;
|
|
7195
|
-
}
|
|
7196
7193
|
function wc(n) {
|
|
7194
|
+
return `${Cn || ls ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${n}`;
|
|
7195
|
+
}
|
|
7196
|
+
function Tc(n) {
|
|
7197
7197
|
const e = document.createElement("iframe");
|
|
7198
7198
|
return e.src = n, e.className = "instant-devtool-iframe", Object.assign(e.style, {
|
|
7199
7199
|
width: "100%",
|
|
@@ -7202,7 +7202,7 @@ function wc(n) {
|
|
|
7202
7202
|
border: "none"
|
|
7203
7203
|
}), { element: e };
|
|
7204
7204
|
}
|
|
7205
|
-
function
|
|
7205
|
+
function Sc(n, e) {
|
|
7206
7206
|
const t = `
|
|
7207
7207
|
<svg width="32" height="32" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
7208
7208
|
<rect width="512" height="512" fill="black"/>
|
|
@@ -7212,7 +7212,7 @@ function Tc(n, e) {
|
|
|
7212
7212
|
return r.innerHTML = t, r.className = "instant-devtool-toggler", Object.assign(r.style, {
|
|
7213
7213
|
// pos
|
|
7214
7214
|
position: "fixed",
|
|
7215
|
-
...
|
|
7215
|
+
...vc(n.position),
|
|
7216
7216
|
height: "32px",
|
|
7217
7217
|
width: "32px",
|
|
7218
7218
|
// layout
|
|
@@ -7227,7 +7227,7 @@ function Tc(n, e) {
|
|
|
7227
7227
|
cursor: "pointer"
|
|
7228
7228
|
}), r.addEventListener("click", e), { element: r };
|
|
7229
7229
|
}
|
|
7230
|
-
function
|
|
7230
|
+
function vc(n) {
|
|
7231
7231
|
switch (n) {
|
|
7232
7232
|
case "bottom-left":
|
|
7233
7233
|
return { bottom: "24px", left: "24px" };
|
|
@@ -7239,7 +7239,7 @@ function Sc(n) {
|
|
|
7239
7239
|
return { top: "24px", left: "24px" };
|
|
7240
7240
|
}
|
|
7241
7241
|
}
|
|
7242
|
-
function
|
|
7242
|
+
function Ac(n) {
|
|
7243
7243
|
switch (n) {
|
|
7244
7244
|
case "bottom-left":
|
|
7245
7245
|
return { bottom: "24px", right: "24px", left: "60px", top: "72px" };
|
|
@@ -7251,11 +7251,11 @@ function vc(n) {
|
|
|
7251
7251
|
return { top: "24px", right: "24px", left: "60px", bottom: "72px" };
|
|
7252
7252
|
}
|
|
7253
7253
|
}
|
|
7254
|
-
function
|
|
7254
|
+
function Oc(n) {
|
|
7255
7255
|
const e = document.createElement("div");
|
|
7256
7256
|
Object.assign(e.style, {
|
|
7257
7257
|
position: "fixed",
|
|
7258
|
-
...
|
|
7258
|
+
...Ac(n.position),
|
|
7259
7259
|
display: "block",
|
|
7260
7260
|
borderRadius: "4px",
|
|
7261
7261
|
border: "1px #ccc solid",
|
|
@@ -7272,10 +7272,10 @@ function Ze(n, e) {
|
|
|
7272
7272
|
if (!n)
|
|
7273
7273
|
throw new Error("[assertion error] " + e);
|
|
7274
7274
|
}
|
|
7275
|
-
const
|
|
7275
|
+
const Ec = (n) => JSON.stringify(n), rt = (n, e = !1) => JSON.stringify([n, e]), vr = (n) => {
|
|
7276
7276
|
const [e, t] = JSON.parse(n);
|
|
7277
7277
|
return { cursor: e, afterInclusive: t };
|
|
7278
|
-
}, Ne = (n, e, t = !1) => `${n}:${rt(e, t)}`,
|
|
7278
|
+
}, Ne = (n, e, t = !1) => `${n}:${rt(e, t)}`, kc = (n) => !!n.endCursor, Cc = (n) => {
|
|
7279
7279
|
var t;
|
|
7280
7280
|
const e = Array.from(n.values());
|
|
7281
7281
|
return e.length === 0 ? !1 : ((t = e[e.length - 1]) == null ? void 0 : t.hasMore) || !1;
|
|
@@ -7290,9 +7290,9 @@ const Oc = (n) => JSON.stringify(n), rt = (n, e = !1) => JSON.stringify([n, e]),
|
|
|
7290
7290
|
} : {
|
|
7291
7291
|
serverCreatedAt: "asc"
|
|
7292
7292
|
};
|
|
7293
|
-
},
|
|
7293
|
+
}, ms = (n) => n && Object.keys(n).length > 0 ? n : {
|
|
7294
7294
|
serverCreatedAt: "asc"
|
|
7295
|
-
},
|
|
7295
|
+
}, Ic = (n, e) => {
|
|
7296
7296
|
const t = [
|
|
7297
7297
|
...Array.from(e.values()).slice().reverse(),
|
|
7298
7298
|
...Array.from(n.values())
|
|
@@ -7301,21 +7301,21 @@ const Oc = (n) => JSON.stringify(n), rt = (n, e = !1) => JSON.stringify([n, e]),
|
|
|
7301
7301
|
...Array.from(n.values()).flatMap((s) => s.data)
|
|
7302
7302
|
];
|
|
7303
7303
|
return { chunks: t, data: r };
|
|
7304
|
-
}, Gt = ["bootstrap", "bootstrap", "bootstrap", 1],
|
|
7304
|
+
}, Gt = ["bootstrap", "bootstrap", "bootstrap", 1], Pc = (n, e, t, r) => {
|
|
7305
7305
|
var B, z, ee, q;
|
|
7306
|
-
const { entityName: s, entityQuery: i } =
|
|
7306
|
+
const { entityName: s, entityQuery: i } = ws(e), o = ((B = i.$) == null ? void 0 : B.limit) || 10, a = s, c = ms((z = i.$) == null ? void 0 : z.order), u = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map();
|
|
7307
7307
|
let h = !1, y = !0, b = null, g = null;
|
|
7308
7308
|
const m = (E) => {
|
|
7309
7309
|
t({ error: E, data: void 0, canLoadNextPage: !1 });
|
|
7310
7310
|
}, S = () => {
|
|
7311
7311
|
if (!y)
|
|
7312
7312
|
return;
|
|
7313
|
-
const { chunks: E, data: j } =
|
|
7313
|
+
const { chunks: E, data: j } = Ic(u, l);
|
|
7314
7314
|
t({
|
|
7315
7315
|
data: { [a]: j },
|
|
7316
7316
|
// @ts-expect-error hidden debug variable
|
|
7317
7317
|
chunks: E,
|
|
7318
|
-
canLoadNextPage:
|
|
7318
|
+
canLoadNextPage: Cc(u)
|
|
7319
7319
|
});
|
|
7320
7320
|
}, _ = (E, j) => {
|
|
7321
7321
|
u.set(rt(E, j.afterInclusive), j), S();
|
|
@@ -7439,9 +7439,9 @@ const Oc = (n) => JSON.stringify(n), rt = (n, e = !1) => JSON.stringify([n, e]),
|
|
|
7439
7439
|
if (!E)
|
|
7440
7440
|
return;
|
|
7441
7441
|
const [j, M] = E;
|
|
7442
|
-
if (!(M != null && M.hasMore) || !
|
|
7442
|
+
if (!(M != null && M.hasMore) || !kc(M))
|
|
7443
7443
|
return;
|
|
7444
|
-
const U = `${j}:${
|
|
7444
|
+
const U = `${j}:${Ec(M.endCursor)}`;
|
|
7445
7445
|
U != b && (b = U, R(j, M), O(M.endCursor));
|
|
7446
7446
|
}, G = () => {
|
|
7447
7447
|
const E = Array.from(u.entries()).at(-1);
|
|
@@ -7497,7 +7497,7 @@ const Oc = (n) => JSON.stringify(n), rt = (n, e = !1) => JSON.stringify([n, e]),
|
|
|
7497
7497
|
},
|
|
7498
7498
|
loadNextPage: G
|
|
7499
7499
|
};
|
|
7500
|
-
},
|
|
7500
|
+
}, Or = (n, e, t) => {
|
|
7501
7501
|
var u, l, f, h;
|
|
7502
7502
|
if (!e)
|
|
7503
7503
|
return {
|
|
@@ -7505,8 +7505,8 @@ const Oc = (n) => JSON.stringify(n), rt = (n, e = !1) => JSON.stringify([n, e]),
|
|
|
7505
7505
|
data: void 0,
|
|
7506
7506
|
error: void 0
|
|
7507
7507
|
};
|
|
7508
|
-
const { entityName: r, entityQuery: s } =
|
|
7509
|
-
let a = e ?
|
|
7508
|
+
const { entityName: r, entityQuery: s } = ws(e), i = ((u = s.$) == null ? void 0 : u.limit) || 10, o = ms((l = s.$) == null ? void 0 : l.order);
|
|
7509
|
+
let a = e ? Ts({
|
|
7510
7510
|
[r]: {
|
|
7511
7511
|
...s,
|
|
7512
7512
|
$: {
|
|
@@ -7527,7 +7527,7 @@ const Oc = (n) => JSON.stringify(n), rt = (n, e = !1) => JSON.stringify([n, e]),
|
|
|
7527
7527
|
data: (c == null ? void 0 : c.data) || void 0,
|
|
7528
7528
|
error: void 0
|
|
7529
7529
|
};
|
|
7530
|
-
},
|
|
7530
|
+
}, ws = (n) => {
|
|
7531
7531
|
if (Object.keys(n).length !== 1)
|
|
7532
7532
|
throw new Q("subscribeInfiniteQuery expects exactly one entity");
|
|
7533
7533
|
const [t, r] = Object.entries(n)[0];
|
|
@@ -7548,7 +7548,7 @@ function pn(n) {
|
|
|
7548
7548
|
const e = n.__adminToken, t = n.__extraDedupeKey;
|
|
7549
7549
|
return n.appId + "_" + (n.websocketURI || "default_ws_uri") + "_" + (n.apiURI || "default_api_uri") + "_" + (e || "client_only") + "_" + n.useDateObjects + "_" + (t || "");
|
|
7550
7550
|
}
|
|
7551
|
-
const yn = jc(),
|
|
7551
|
+
const yn = jc(), Er = Mc();
|
|
7552
7552
|
class $c {
|
|
7553
7553
|
constructor(e) {
|
|
7554
7554
|
p(this, "db");
|
|
@@ -7750,7 +7750,7 @@ class Dc {
|
|
|
7750
7750
|
this.db = e;
|
|
7751
7751
|
}
|
|
7752
7752
|
}
|
|
7753
|
-
function
|
|
7753
|
+
function Ts(n) {
|
|
7754
7754
|
return JSON.parse(JSON.stringify(n));
|
|
7755
7755
|
}
|
|
7756
7756
|
class Uc {
|
|
@@ -7838,7 +7838,7 @@ class Uc {
|
|
|
7838
7838
|
* });
|
|
7839
7839
|
*/
|
|
7840
7840
|
subscribeInfiniteQuery(e, t, r) {
|
|
7841
|
-
return
|
|
7841
|
+
return Pc(this, e, t, r);
|
|
7842
7842
|
}
|
|
7843
7843
|
/**
|
|
7844
7844
|
* Listen for the logged in state. This is useful
|
|
@@ -7956,17 +7956,17 @@ class Uc {
|
|
|
7956
7956
|
return this._reactor.subscribeTable(e, t);
|
|
7957
7957
|
}
|
|
7958
7958
|
}
|
|
7959
|
-
function
|
|
7959
|
+
function kr(n) {
|
|
7960
7960
|
if (!n)
|
|
7961
7961
|
return "0";
|
|
7962
|
-
const e =
|
|
7962
|
+
const e = Er.get(n);
|
|
7963
7963
|
if (e)
|
|
7964
7964
|
return e;
|
|
7965
7965
|
const t = se(n);
|
|
7966
|
-
return
|
|
7966
|
+
return Er.set(n, t), t;
|
|
7967
7967
|
}
|
|
7968
7968
|
function Lc(n, e) {
|
|
7969
|
-
return
|
|
7969
|
+
return kr(n._reactor.config.schema) !== kr(e);
|
|
7970
7970
|
}
|
|
7971
7971
|
function Fc(n, e, t, r, s) {
|
|
7972
7972
|
var u;
|
|
@@ -7977,11 +7977,11 @@ function Fc(n, e, t, r, s) {
|
|
|
7977
7977
|
}, o = yn[pn(i)];
|
|
7978
7978
|
if (o)
|
|
7979
7979
|
return Lc(o, i.schema) && o._reactor.updateSchema(i.schema), o;
|
|
7980
|
-
const a = new
|
|
7980
|
+
const a = new _c({
|
|
7981
7981
|
...Rc,
|
|
7982
7982
|
...i,
|
|
7983
7983
|
cardinalityInference: !!i.schema
|
|
7984
|
-
}, e ||
|
|
7984
|
+
}, e || as, t || cs, { ...r || {}, "@instantdb/core": ds }, s), c = new Uc(a);
|
|
7985
7985
|
return yn[pn(i)] = c, Nc(i.appId, i.devtool), c;
|
|
7986
7986
|
}
|
|
7987
7987
|
function Nc(n, e) {
|
|
@@ -7992,15 +7992,15 @@ function Nc(n, e) {
|
|
|
7992
7992
|
allowedHosts: ["localhost"],
|
|
7993
7993
|
...typeof e == "object" ? e : {}
|
|
7994
7994
|
};
|
|
7995
|
-
t.allowedHosts.includes(window.location.hostname) &&
|
|
7995
|
+
t.allowedHosts.includes(window.location.hostname) && mc(n, t);
|
|
7996
7996
|
}
|
|
7997
|
-
const
|
|
7997
|
+
const Cr = {
|
|
7998
7998
|
isLoading: !0,
|
|
7999
7999
|
data: void 0,
|
|
8000
8000
|
pageInfo: void 0,
|
|
8001
8001
|
error: void 0
|
|
8002
8002
|
};
|
|
8003
|
-
function
|
|
8003
|
+
function Ir(n) {
|
|
8004
8004
|
return {
|
|
8005
8005
|
isLoading: !n,
|
|
8006
8006
|
data: void 0,
|
|
@@ -8011,10 +8011,10 @@ function Cr(n) {
|
|
|
8011
8011
|
}
|
|
8012
8012
|
function Kc(n, e, t, r) {
|
|
8013
8013
|
e && t && "ruleParams" in t && (e = { $$ruleParams: t.ruleParams, ...e });
|
|
8014
|
-
const s = e ?
|
|
8015
|
-
|
|
8016
|
-
), a = ke(
|
|
8017
|
-
(l) => (o.current =
|
|
8014
|
+
const s = e ? Ts(e) : null, i = se(s), o = ke(
|
|
8015
|
+
Ir(n._reactor.getPreviousResult(s))
|
|
8016
|
+
), a = ke(Cr), c = Ae(
|
|
8017
|
+
(l) => (o.current = Ir(
|
|
8018
8018
|
n._reactor.getPreviousResult(s)
|
|
8019
8019
|
), l(), s ? n.subscribeQuery(s, (h) => {
|
|
8020
8020
|
o.current = {
|
|
@@ -8036,7 +8036,7 @@ function Kc(n, e, t, r) {
|
|
|
8036
8036
|
c,
|
|
8037
8037
|
() => o.current,
|
|
8038
8038
|
() => {
|
|
8039
|
-
if (r && a.current ===
|
|
8039
|
+
if (r && a.current === Cr) {
|
|
8040
8040
|
const l = r();
|
|
8041
8041
|
l && (a.current = l);
|
|
8042
8042
|
}
|
|
@@ -8055,31 +8055,31 @@ function Wc({
|
|
|
8055
8055
|
query: e,
|
|
8056
8056
|
opts: t
|
|
8057
8057
|
}) {
|
|
8058
|
-
const r = ke(null), s = se(e), i = se(t), o =
|
|
8058
|
+
const r = ke(null), s = se(e), i = se(t), o = Or(n, e, t), a = ke({
|
|
8059
8059
|
...o,
|
|
8060
8060
|
isLoading: !o.data && !o.error
|
|
8061
8061
|
}), c = Ae(
|
|
8062
8062
|
(f) => {
|
|
8063
|
-
|
|
8064
|
-
|
|
8065
|
-
|
|
8066
|
-
|
|
8067
|
-
|
|
8063
|
+
r.current = null;
|
|
8064
|
+
const h = Or(n, e, t);
|
|
8065
|
+
if (a.current = {
|
|
8066
|
+
...h,
|
|
8067
|
+
isLoading: !h.data && !h.error
|
|
8068
8068
|
}, f(), !e)
|
|
8069
8069
|
return () => {
|
|
8070
8070
|
};
|
|
8071
|
-
const
|
|
8071
|
+
const y = n.subscribeInfiniteQuery(
|
|
8072
8072
|
e,
|
|
8073
|
-
(
|
|
8073
|
+
(b) => {
|
|
8074
8074
|
a.current = {
|
|
8075
|
-
...
|
|
8075
|
+
...b,
|
|
8076
8076
|
isLoading: !1
|
|
8077
8077
|
}, f();
|
|
8078
8078
|
},
|
|
8079
8079
|
t
|
|
8080
8080
|
);
|
|
8081
|
-
return r.current =
|
|
8082
|
-
|
|
8081
|
+
return r.current = y, () => {
|
|
8082
|
+
y.unsubscribe(), r.current === y && (r.current = null);
|
|
8083
8083
|
};
|
|
8084
8084
|
},
|
|
8085
8085
|
[s, i]
|
|
@@ -8136,7 +8136,7 @@ function Bc(n, e) {
|
|
|
8136
8136
|
}
|
|
8137
8137
|
function Gc(n, e = {}) {
|
|
8138
8138
|
var o, a;
|
|
8139
|
-
const [t, r] =
|
|
8139
|
+
const [t, r] = Rr(() => n.core._reactor.getPresence(n.type, n.id, e) ?? {
|
|
8140
8140
|
peers: {},
|
|
8141
8141
|
isLoading: !0
|
|
8142
8142
|
});
|
|
@@ -8332,7 +8332,7 @@ class Ht {
|
|
|
8332
8332
|
* console.log('Device ID:', deviceId)
|
|
8333
8333
|
*/
|
|
8334
8334
|
p(this, "useLocalId", (e) => {
|
|
8335
|
-
const [t, r] =
|
|
8335
|
+
const [t, r] = Rr(null);
|
|
8336
8336
|
return je(() => {
|
|
8337
8337
|
(async () => {
|
|
8338
8338
|
const i = await this.getLocalId(e);
|