@instantdb/react-common 0.22.163 → 0.22.164-branch-extra-fields.23220124983.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/standalone/index.js +816 -795
- package/dist/standalone/index.umd.cjs +10 -10
- package/package.json +3 -3
package/dist/standalone/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var h = (n, e, t) =>
|
|
4
|
-
import
|
|
5
|
-
var
|
|
1
|
+
var js = Object.defineProperty;
|
|
2
|
+
var Ds = (n, e, t) => e in n ? js(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
|
+
var h = (n, e, t) => Ds(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import wr, { useRef as Ne, useCallback as ve, useSyncExternalStore as qt, useEffect as Pe, useMemo as Wt, useState as Tr } from "react";
|
|
5
|
+
var zt = { exports: {} }, Be = {};
|
|
6
6
|
/**
|
|
7
7
|
* @license React
|
|
8
8
|
* react-jsx-runtime.production.min.js
|
|
@@ -12,11 +12,11 @@ var Wt = { exports: {} }, Be = {};
|
|
|
12
12
|
* This source code is licensed under the MIT license found in the
|
|
13
13
|
* LICENSE file in the root directory of this source tree.
|
|
14
14
|
*/
|
|
15
|
-
var
|
|
16
|
-
function
|
|
17
|
-
if (
|
|
18
|
-
|
|
19
|
-
var n =
|
|
15
|
+
var Un;
|
|
16
|
+
function $s() {
|
|
17
|
+
if (Un) return Be;
|
|
18
|
+
Un = 1;
|
|
19
|
+
var n = wr, e = Symbol.for("react.element"), t = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, s = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, i = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
20
20
|
function o(a, c, u) {
|
|
21
21
|
var l, f = {}, p = null, y = null;
|
|
22
22
|
u !== void 0 && (p = "" + u), c.key !== void 0 && (p = "" + c.key), c.ref !== void 0 && (y = c.ref);
|
|
@@ -26,10 +26,10 @@ function Ds() {
|
|
|
26
26
|
}
|
|
27
27
|
return Be.Fragment = t, Be.jsx = o, Be.jsxs = o, Be;
|
|
28
28
|
}
|
|
29
|
-
var Qe = {},
|
|
30
|
-
function
|
|
31
|
-
if (
|
|
32
|
-
|
|
29
|
+
var Qe = {}, Ln;
|
|
30
|
+
function xs() {
|
|
31
|
+
if (Ln) return Qe;
|
|
32
|
+
Ln = 1;
|
|
33
33
|
var n = {};
|
|
34
34
|
/**
|
|
35
35
|
* @license React
|
|
@@ -41,7 +41,7 @@ function $s() {
|
|
|
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 = wr, t = Symbol.for("react.element"), r = Symbol.for("react.portal"), s = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), a = Symbol.for("react.provider"), c = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), l = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), p = Symbol.for("react.memo"), y = Symbol.for("react.lazy"), b = Symbol.for("react.offscreen"), g = Symbol.iterator, T = "@@iterator";
|
|
45
45
|
function S(d) {
|
|
46
46
|
if (d === null || typeof d != "object")
|
|
47
47
|
return null;
|
|
@@ -208,10 +208,10 @@ function $s() {
|
|
|
208
208
|
}
|
|
209
209
|
var kt = !1, it;
|
|
210
210
|
{
|
|
211
|
-
var
|
|
212
|
-
it = new
|
|
211
|
+
var cs = typeof WeakMap == "function" ? WeakMap : Map;
|
|
212
|
+
it = new cs();
|
|
213
213
|
}
|
|
214
|
-
function
|
|
214
|
+
function Sn(d, m) {
|
|
215
215
|
if (!d || kt)
|
|
216
216
|
return "";
|
|
217
217
|
{
|
|
@@ -282,10 +282,10 @@ function $s() {
|
|
|
282
282
|
var $e = d ? d.displayName || d.name : "", Oe = $e ? st($e) : "";
|
|
283
283
|
return typeof d == "function" && it.set(d, Oe), Oe;
|
|
284
284
|
}
|
|
285
|
-
function
|
|
286
|
-
return
|
|
285
|
+
function us(d, m, A) {
|
|
286
|
+
return Sn(d, !1);
|
|
287
287
|
}
|
|
288
|
-
function
|
|
288
|
+
function ls(d) {
|
|
289
289
|
var m = d.prototype;
|
|
290
290
|
return !!(m && m.isReactComponent);
|
|
291
291
|
}
|
|
@@ -293,7 +293,7 @@ function $s() {
|
|
|
293
293
|
if (d == null)
|
|
294
294
|
return "";
|
|
295
295
|
if (typeof d == "function")
|
|
296
|
-
return
|
|
296
|
+
return Sn(d, ls(d));
|
|
297
297
|
if (typeof d == "string")
|
|
298
298
|
return st(d);
|
|
299
299
|
switch (d) {
|
|
@@ -305,7 +305,7 @@ function $s() {
|
|
|
305
305
|
if (typeof d == "object")
|
|
306
306
|
switch (d.$$typeof) {
|
|
307
307
|
case u:
|
|
308
|
-
return
|
|
308
|
+
return us(d.render);
|
|
309
309
|
case p:
|
|
310
310
|
return ot(d.type, m, A);
|
|
311
311
|
case y: {
|
|
@@ -318,15 +318,15 @@ function $s() {
|
|
|
318
318
|
}
|
|
319
319
|
return "";
|
|
320
320
|
}
|
|
321
|
-
var Ve = Object.prototype.hasOwnProperty,
|
|
321
|
+
var Ve = Object.prototype.hasOwnProperty, vn = {}, An = _.ReactDebugCurrentFrame;
|
|
322
322
|
function at(d) {
|
|
323
323
|
if (d) {
|
|
324
324
|
var m = d._owner, A = ot(d.type, d._source, m ? m.type : null);
|
|
325
|
-
|
|
325
|
+
An.setExtraStackFrame(A);
|
|
326
326
|
} else
|
|
327
|
-
|
|
327
|
+
An.setExtraStackFrame(null);
|
|
328
328
|
}
|
|
329
|
-
function
|
|
329
|
+
function fs(d, m, A, E, D) {
|
|
330
330
|
{
|
|
331
331
|
var $ = Function.call.bind(Ve);
|
|
332
332
|
for (var R in d)
|
|
@@ -341,41 +341,41 @@ function $s() {
|
|
|
341
341
|
} catch (N) {
|
|
342
342
|
P = N;
|
|
343
343
|
}
|
|
344
|
-
P && !(P instanceof Error) && (at(D), w("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", E || "React class", A, R, typeof P), at(null)), P instanceof Error && !(P.message in
|
|
344
|
+
P && !(P instanceof Error) && (at(D), w("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", E || "React class", A, R, typeof P), at(null)), P instanceof Error && !(P.message in vn) && (vn[P.message] = !0, at(D), w("Failed %s type: %s", A, P.message), at(null));
|
|
345
345
|
}
|
|
346
346
|
}
|
|
347
347
|
}
|
|
348
|
-
var
|
|
348
|
+
var ds = Array.isArray;
|
|
349
349
|
function Ct(d) {
|
|
350
|
-
return
|
|
350
|
+
return ds(d);
|
|
351
351
|
}
|
|
352
|
-
function
|
|
352
|
+
function hs(d) {
|
|
353
353
|
{
|
|
354
354
|
var m = typeof Symbol == "function" && Symbol.toStringTag, A = m && d[Symbol.toStringTag] || d.constructor.name || "Object";
|
|
355
355
|
return A;
|
|
356
356
|
}
|
|
357
357
|
}
|
|
358
|
-
function
|
|
358
|
+
function ps(d) {
|
|
359
359
|
try {
|
|
360
|
-
return
|
|
360
|
+
return On(d), !1;
|
|
361
361
|
} catch {
|
|
362
362
|
return !0;
|
|
363
363
|
}
|
|
364
364
|
}
|
|
365
|
-
function
|
|
365
|
+
function On(d) {
|
|
366
366
|
return "" + d;
|
|
367
367
|
}
|
|
368
|
-
function
|
|
369
|
-
if (
|
|
370
|
-
return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",
|
|
368
|
+
function En(d) {
|
|
369
|
+
if (ps(d))
|
|
370
|
+
return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", hs(d)), On(d);
|
|
371
371
|
}
|
|
372
|
-
var
|
|
372
|
+
var kn = _.ReactCurrentOwner, ys = {
|
|
373
373
|
key: !0,
|
|
374
374
|
ref: !0,
|
|
375
375
|
__self: !0,
|
|
376
376
|
__source: !0
|
|
377
|
-
},
|
|
378
|
-
function
|
|
377
|
+
}, Cn, In;
|
|
378
|
+
function bs(d) {
|
|
379
379
|
if (Ve.call(d, "ref")) {
|
|
380
380
|
var m = Object.getOwnPropertyDescriptor(d, "ref").get;
|
|
381
381
|
if (m && m.isReactWarning)
|
|
@@ -383,7 +383,7 @@ function $s() {
|
|
|
383
383
|
}
|
|
384
384
|
return d.ref !== void 0;
|
|
385
385
|
}
|
|
386
|
-
function
|
|
386
|
+
function _s(d) {
|
|
387
387
|
if (Ve.call(d, "key")) {
|
|
388
388
|
var m = Object.getOwnPropertyDescriptor(d, "key").get;
|
|
389
389
|
if (m && m.isReactWarning)
|
|
@@ -391,13 +391,13 @@ function $s() {
|
|
|
391
391
|
}
|
|
392
392
|
return d.key !== void 0;
|
|
393
393
|
}
|
|
394
|
-
function _s(d, m) {
|
|
395
|
-
typeof d.ref == "string" && En.current;
|
|
396
|
-
}
|
|
397
394
|
function gs(d, m) {
|
|
395
|
+
typeof d.ref == "string" && kn.current;
|
|
396
|
+
}
|
|
397
|
+
function ms(d, m) {
|
|
398
398
|
{
|
|
399
399
|
var A = function() {
|
|
400
|
-
|
|
400
|
+
Cn || (Cn = !0, w("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", m));
|
|
401
401
|
};
|
|
402
402
|
A.isReactWarning = !0, Object.defineProperty(d, "key", {
|
|
403
403
|
get: A,
|
|
@@ -405,10 +405,10 @@ function $s() {
|
|
|
405
405
|
});
|
|
406
406
|
}
|
|
407
407
|
}
|
|
408
|
-
function
|
|
408
|
+
function ws(d, m) {
|
|
409
409
|
{
|
|
410
410
|
var A = function() {
|
|
411
|
-
|
|
411
|
+
In || (In = !0, w("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", m));
|
|
412
412
|
};
|
|
413
413
|
A.isReactWarning = !0, Object.defineProperty(d, "ref", {
|
|
414
414
|
get: A,
|
|
@@ -416,7 +416,7 @@ function $s() {
|
|
|
416
416
|
});
|
|
417
417
|
}
|
|
418
418
|
}
|
|
419
|
-
var
|
|
419
|
+
var Ts = function(d, m, A, E, D, $, R) {
|
|
420
420
|
var P = {
|
|
421
421
|
// This tag allows us to uniquely identify this as a React Element
|
|
422
422
|
$$typeof: t,
|
|
@@ -445,12 +445,12 @@ function $s() {
|
|
|
445
445
|
value: D
|
|
446
446
|
}), Object.freeze && (Object.freeze(P.props), Object.freeze(P)), P;
|
|
447
447
|
};
|
|
448
|
-
function
|
|
448
|
+
function Ss(d, m, A, E, D) {
|
|
449
449
|
{
|
|
450
450
|
var $, R = {}, P = null, Z = null;
|
|
451
|
-
A !== void 0 && (
|
|
451
|
+
A !== void 0 && (En(A), P = "" + A), _s(m) && (En(m.key), P = "" + m.key), bs(m) && (Z = m.ref, gs(m, D));
|
|
452
452
|
for ($ in m)
|
|
453
|
-
Ve.call(m, $) && !
|
|
453
|
+
Ve.call(m, $) && !ys.hasOwnProperty($) && (R[$] = m[$]);
|
|
454
454
|
if (d && d.defaultProps) {
|
|
455
455
|
var N = d.defaultProps;
|
|
456
456
|
for ($ in N)
|
|
@@ -458,25 +458,25 @@ function $s() {
|
|
|
458
458
|
}
|
|
459
459
|
if (P || Z) {
|
|
460
460
|
var q = typeof d == "function" ? d.displayName || d.name || "Unknown" : d;
|
|
461
|
-
P &&
|
|
461
|
+
P && ms(R, q), Z && ws(R, q);
|
|
462
462
|
}
|
|
463
|
-
return
|
|
463
|
+
return Ts(d, P, Z, D, E, kn.current, R);
|
|
464
464
|
}
|
|
465
465
|
}
|
|
466
|
-
var It = _.ReactCurrentOwner,
|
|
466
|
+
var It = _.ReactCurrentOwner, Pn = _.ReactDebugCurrentFrame;
|
|
467
467
|
function De(d) {
|
|
468
468
|
if (d) {
|
|
469
469
|
var m = d._owner, A = ot(d.type, d._source, m ? m.type : null);
|
|
470
|
-
|
|
470
|
+
Pn.setExtraStackFrame(A);
|
|
471
471
|
} else
|
|
472
|
-
|
|
472
|
+
Pn.setExtraStackFrame(null);
|
|
473
473
|
}
|
|
474
474
|
var Pt;
|
|
475
475
|
Pt = !1;
|
|
476
476
|
function Mt(d) {
|
|
477
477
|
return typeof d == "object" && d !== null && d.$$typeof === t;
|
|
478
478
|
}
|
|
479
|
-
function
|
|
479
|
+
function Mn() {
|
|
480
480
|
{
|
|
481
481
|
if (It.current) {
|
|
482
482
|
var d = F(It.current.type);
|
|
@@ -488,13 +488,13 @@ Check the render method of \`` + d + "`.";
|
|
|
488
488
|
return "";
|
|
489
489
|
}
|
|
490
490
|
}
|
|
491
|
-
function
|
|
491
|
+
function vs(d) {
|
|
492
492
|
return "";
|
|
493
493
|
}
|
|
494
|
-
var
|
|
495
|
-
function
|
|
494
|
+
var Rn = {};
|
|
495
|
+
function As(d) {
|
|
496
496
|
{
|
|
497
|
-
var m =
|
|
497
|
+
var m = Mn();
|
|
498
498
|
if (!m) {
|
|
499
499
|
var A = typeof d == "string" ? d : d.displayName || d.name;
|
|
500
500
|
A && (m = `
|
|
@@ -504,27 +504,27 @@ Check the top-level render call using <` + A + ">.");
|
|
|
504
504
|
return m;
|
|
505
505
|
}
|
|
506
506
|
}
|
|
507
|
-
function
|
|
507
|
+
function jn(d, m) {
|
|
508
508
|
{
|
|
509
509
|
if (!d._store || d._store.validated || d.key != null)
|
|
510
510
|
return;
|
|
511
511
|
d._store.validated = !0;
|
|
512
|
-
var A =
|
|
513
|
-
if (
|
|
512
|
+
var A = As(m);
|
|
513
|
+
if (Rn[A])
|
|
514
514
|
return;
|
|
515
|
-
|
|
515
|
+
Rn[A] = !0;
|
|
516
516
|
var E = "";
|
|
517
517
|
d && d._owner && d._owner !== It.current && (E = " It was passed a child from " + F(d._owner.type) + "."), De(d), w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', A, E), De(null);
|
|
518
518
|
}
|
|
519
519
|
}
|
|
520
|
-
function
|
|
520
|
+
function Dn(d, m) {
|
|
521
521
|
{
|
|
522
522
|
if (typeof d != "object")
|
|
523
523
|
return;
|
|
524
524
|
if (Ct(d))
|
|
525
525
|
for (var A = 0; A < d.length; A++) {
|
|
526
526
|
var E = d[A];
|
|
527
|
-
Mt(E) &&
|
|
527
|
+
Mt(E) && jn(E, m);
|
|
528
528
|
}
|
|
529
529
|
else if (Mt(d))
|
|
530
530
|
d._store && (d._store.validated = !0);
|
|
@@ -532,11 +532,11 @@ Check the top-level render call using <` + A + ">.");
|
|
|
532
532
|
var D = S(d);
|
|
533
533
|
if (typeof D == "function" && D !== d.entries)
|
|
534
534
|
for (var $ = D.call(d), R; !(R = $.next()).done; )
|
|
535
|
-
Mt(R.value) &&
|
|
535
|
+
Mt(R.value) && jn(R.value, m);
|
|
536
536
|
}
|
|
537
537
|
}
|
|
538
538
|
}
|
|
539
|
-
function
|
|
539
|
+
function Os(d) {
|
|
540
540
|
{
|
|
541
541
|
var m = d.type;
|
|
542
542
|
if (m == null || typeof m == "string")
|
|
@@ -552,7 +552,7 @@ Check the top-level render call using <` + A + ">.");
|
|
|
552
552
|
return;
|
|
553
553
|
if (A) {
|
|
554
554
|
var E = F(m);
|
|
555
|
-
|
|
555
|
+
fs(A, d.props, "prop", E, d);
|
|
556
556
|
} else if (m.PropTypes !== void 0 && !Pt) {
|
|
557
557
|
Pt = !0;
|
|
558
558
|
var D = F(m);
|
|
@@ -561,7 +561,7 @@ Check the top-level render call using <` + A + ">.");
|
|
|
561
561
|
typeof m.getDefaultProps == "function" && !m.getDefaultProps.isReactClassApproved && w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
562
562
|
}
|
|
563
563
|
}
|
|
564
|
-
function
|
|
564
|
+
function Es(d) {
|
|
565
565
|
{
|
|
566
566
|
for (var m = Object.keys(d.props), A = 0; A < m.length; A++) {
|
|
567
567
|
var E = m[A];
|
|
@@ -573,19 +573,19 @@ Check the top-level render call using <` + A + ">.");
|
|
|
573
573
|
d.ref !== null && (De(d), w("Invalid attribute `ref` supplied to `React.Fragment`."), De(null));
|
|
574
574
|
}
|
|
575
575
|
}
|
|
576
|
-
var
|
|
577
|
-
function
|
|
576
|
+
var $n = {};
|
|
577
|
+
function xn(d, m, A, E, D, $) {
|
|
578
578
|
{
|
|
579
579
|
var R = Ae(d);
|
|
580
580
|
if (!R) {
|
|
581
581
|
var P = "";
|
|
582
582
|
(d === void 0 || typeof d == "object" && d !== null && Object.keys(d).length === 0) && (P += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
583
|
-
var Z =
|
|
584
|
-
Z ? P += Z : P +=
|
|
583
|
+
var Z = vs();
|
|
584
|
+
Z ? P += Z : P += Mn();
|
|
585
585
|
var N;
|
|
586
586
|
d === null ? N = "null" : Ct(d) ? N = "array" : d !== void 0 && d.$$typeof === t ? (N = "<" + (F(d.type) || "Unknown") + " />", P = " Did you accidentally export a JSX literal instead of a component?") : N = typeof d, w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", N, P);
|
|
587
587
|
}
|
|
588
|
-
var q =
|
|
588
|
+
var q = Ss(d, m, A, D, $);
|
|
589
589
|
if (q == null)
|
|
590
590
|
return q;
|
|
591
591
|
if (R) {
|
|
@@ -594,43 +594,43 @@ Check the top-level render call using <` + A + ">.");
|
|
|
594
594
|
if (E)
|
|
595
595
|
if (Ct(le)) {
|
|
596
596
|
for (var $e = 0; $e < le.length; $e++)
|
|
597
|
-
|
|
597
|
+
Dn(le[$e], d);
|
|
598
598
|
Object.freeze && Object.freeze(le);
|
|
599
599
|
} else
|
|
600
600
|
w("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
601
601
|
else
|
|
602
|
-
|
|
602
|
+
Dn(le, d);
|
|
603
603
|
}
|
|
604
604
|
if (Ve.call(m, "key")) {
|
|
605
|
-
var Oe = F(d), re = Object.keys(m).filter(function(
|
|
606
|
-
return
|
|
605
|
+
var Oe = F(d), re = Object.keys(m).filter(function(Rs) {
|
|
606
|
+
return Rs !== "key";
|
|
607
607
|
}), Rt = re.length > 0 ? "{key: someKey, " + re.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
608
|
-
if (
|
|
609
|
-
var
|
|
608
|
+
if (!$n[Oe + Rt]) {
|
|
609
|
+
var Ms = re.length > 0 ? "{" + re.join(": ..., ") + ": ...}" : "{}";
|
|
610
610
|
w(`A props object containing a "key" prop is being spread into JSX:
|
|
611
611
|
let props = %s;
|
|
612
612
|
<%s {...props} />
|
|
613
613
|
React keys must be passed directly to JSX without using spread:
|
|
614
614
|
let props = %s;
|
|
615
|
-
<%s key={someKey} {...props} />`, Rt, Oe,
|
|
615
|
+
<%s key={someKey} {...props} />`, Rt, Oe, Ms, Oe), $n[Oe + Rt] = !0;
|
|
616
616
|
}
|
|
617
617
|
}
|
|
618
|
-
return d === s ?
|
|
618
|
+
return d === s ? Es(q) : Os(q), q;
|
|
619
619
|
}
|
|
620
620
|
}
|
|
621
|
-
function Es(d, m, A) {
|
|
622
|
-
return $n(d, m, A, !0);
|
|
623
|
-
}
|
|
624
621
|
function ks(d, m, A) {
|
|
625
|
-
return
|
|
622
|
+
return xn(d, m, A, !0);
|
|
623
|
+
}
|
|
624
|
+
function Cs(d, m, A) {
|
|
625
|
+
return xn(d, m, A, !1);
|
|
626
626
|
}
|
|
627
|
-
var
|
|
628
|
-
Qe.Fragment = s, Qe.jsx =
|
|
627
|
+
var Is = Cs, Ps = ks;
|
|
628
|
+
Qe.Fragment = s, Qe.jsx = Is, Qe.jsxs = Ps;
|
|
629
629
|
}(), Qe;
|
|
630
630
|
}
|
|
631
|
-
var
|
|
632
|
-
|
|
633
|
-
var ct =
|
|
631
|
+
var Us = {};
|
|
632
|
+
Us.NODE_ENV === "production" ? zt.exports = $s() : zt.exports = xs();
|
|
633
|
+
var ct = zt.exports;
|
|
634
634
|
function Q(n) {
|
|
635
635
|
if (typeof n == "number")
|
|
636
636
|
return (Math.abs(n * 2654435761) >>> 0).toString(16);
|
|
@@ -673,14 +673,14 @@ const K = {
|
|
|
673
673
|
Remove: "remove",
|
|
674
674
|
Replace: "replace",
|
|
675
675
|
Add: "add"
|
|
676
|
-
},
|
|
676
|
+
}, Sr = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), Ls = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), ht = Symbol.iterator, ce = {
|
|
677
677
|
mutable: "mutable",
|
|
678
678
|
immutable: "immutable"
|
|
679
|
-
},
|
|
679
|
+
}, un = {};
|
|
680
680
|
function Ze(n, e) {
|
|
681
681
|
return n instanceof Map ? n.has(e) : Object.prototype.hasOwnProperty.call(n, e);
|
|
682
682
|
}
|
|
683
|
-
function
|
|
683
|
+
function Fn(n, e) {
|
|
684
684
|
if (e in n) {
|
|
685
685
|
let t = Reflect.getPrototypeOf(n);
|
|
686
686
|
for (; t; ) {
|
|
@@ -691,10 +691,10 @@ function Ln(n, e) {
|
|
|
691
691
|
}
|
|
692
692
|
}
|
|
693
693
|
}
|
|
694
|
-
function
|
|
694
|
+
function ln(n) {
|
|
695
695
|
return Object.getPrototypeOf(n) === Set.prototype;
|
|
696
696
|
}
|
|
697
|
-
function
|
|
697
|
+
function fn(n) {
|
|
698
698
|
return Object.getPrototypeOf(n) === Map.prototype;
|
|
699
699
|
}
|
|
700
700
|
function ae(n) {
|
|
@@ -705,9 +705,9 @@ function Me(n) {
|
|
|
705
705
|
return !!M(n);
|
|
706
706
|
}
|
|
707
707
|
function M(n) {
|
|
708
|
-
return typeof n != "object" ? null : n == null ? void 0 : n[
|
|
708
|
+
return typeof n != "object" ? null : n == null ? void 0 : n[Sr];
|
|
709
709
|
}
|
|
710
|
-
function
|
|
710
|
+
function dn(n) {
|
|
711
711
|
var e;
|
|
712
712
|
const t = M(n);
|
|
713
713
|
return t ? (e = t.copy) !== null && e !== void 0 ? e : t.original : n;
|
|
@@ -718,7 +718,7 @@ function ye(n, e) {
|
|
|
718
718
|
let t;
|
|
719
719
|
return Object.getPrototypeOf(n) === Object.prototype || Array.isArray(n) || n instanceof Map || n instanceof Set || !!(e != null && e.mark) && ((t = e.mark(n, ce)) === ce.immutable || typeof t == "function");
|
|
720
720
|
}
|
|
721
|
-
function
|
|
721
|
+
function vr(n, e = []) {
|
|
722
722
|
if (Object.hasOwnProperty.call(n, "key")) {
|
|
723
723
|
const t = n.parent.copy, r = M(Se(t, n.key));
|
|
724
724
|
if (r !== null && (r == null ? void 0 : r.original) !== n.original)
|
|
@@ -729,10 +729,10 @@ function Sr(n, e = []) {
|
|
|
729
729
|
e.push(i);
|
|
730
730
|
}
|
|
731
731
|
if (n.parent)
|
|
732
|
-
return
|
|
732
|
+
return vr(n.parent, e);
|
|
733
733
|
e.reverse();
|
|
734
734
|
try {
|
|
735
|
-
|
|
735
|
+
Fs(n.copy, e);
|
|
736
736
|
} catch {
|
|
737
737
|
return null;
|
|
738
738
|
}
|
|
@@ -754,7 +754,7 @@ function jt(n, e) {
|
|
|
754
754
|
function Te(n, e) {
|
|
755
755
|
return n === e ? n !== 0 || 1 / n === 1 / e : n !== n && e !== e;
|
|
756
756
|
}
|
|
757
|
-
function
|
|
757
|
+
function Vt(n) {
|
|
758
758
|
if (n)
|
|
759
759
|
for (; n.finalities.revoke.length > 0; )
|
|
760
760
|
n.finalities.revoke.pop()();
|
|
@@ -765,7 +765,7 @@ function Ce(n, e) {
|
|
|
765
765
|
return r.indexOf("/") === -1 && r.indexOf("~") === -1 ? r : r.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
766
766
|
}).join("/");
|
|
767
767
|
}
|
|
768
|
-
function
|
|
768
|
+
function Fs(n, e) {
|
|
769
769
|
for (let t = 0; t < e.length - 1; t += 1) {
|
|
770
770
|
const r = e[t];
|
|
771
771
|
if (n = Se(Re(n) === 3 ? Array.from(n) : n, r), typeof n != "object")
|
|
@@ -773,7 +773,7 @@ function Ls(n, e) {
|
|
|
773
773
|
}
|
|
774
774
|
return n;
|
|
775
775
|
}
|
|
776
|
-
function
|
|
776
|
+
function Ns(n) {
|
|
777
777
|
const e = Object.create(Object.getPrototypeOf(n));
|
|
778
778
|
return Reflect.ownKeys(n).forEach((t) => {
|
|
779
779
|
let r = Reflect.getOwnPropertyDescriptor(n, t);
|
|
@@ -789,26 +789,26 @@ function Fs(n) {
|
|
|
789
789
|
}), Reflect.defineProperty(e, t, r);
|
|
790
790
|
}), e;
|
|
791
791
|
}
|
|
792
|
-
const
|
|
793
|
-
function
|
|
792
|
+
const Ks = Object.prototype.propertyIsEnumerable;
|
|
793
|
+
function Ar(n, e) {
|
|
794
794
|
let t;
|
|
795
795
|
if (Array.isArray(n))
|
|
796
796
|
return Array.prototype.concat.call(n);
|
|
797
797
|
if (n instanceof Set) {
|
|
798
|
-
if (!
|
|
798
|
+
if (!ln(n)) {
|
|
799
799
|
const r = Object.getPrototypeOf(n).constructor;
|
|
800
800
|
return new r(n.values());
|
|
801
801
|
}
|
|
802
802
|
return Set.prototype.difference ? Set.prototype.difference.call(n, /* @__PURE__ */ new Set()) : new Set(n.values());
|
|
803
803
|
} else if (n instanceof Map) {
|
|
804
|
-
if (!
|
|
804
|
+
if (!fn(n)) {
|
|
805
805
|
const r = Object.getPrototypeOf(n).constructor;
|
|
806
806
|
return new r(n);
|
|
807
807
|
}
|
|
808
808
|
return new Map(n);
|
|
809
809
|
} else if (e != null && e.mark && (t = e.mark(n, ce), t !== void 0) && t !== ce.mutable) {
|
|
810
810
|
if (t === ce.immutable)
|
|
811
|
-
return
|
|
811
|
+
return Ns(n);
|
|
812
812
|
if (typeof t == "function") {
|
|
813
813
|
if (e.enablePatches || e.enableAutoFreeze)
|
|
814
814
|
throw new Error("You can't use mark and patches or auto freeze together.");
|
|
@@ -820,17 +820,17 @@ function vr(n, e) {
|
|
|
820
820
|
return Object.keys(n).forEach((s) => {
|
|
821
821
|
r[s] = n[s];
|
|
822
822
|
}), Object.getOwnPropertySymbols(n).forEach((s) => {
|
|
823
|
-
|
|
823
|
+
Ks.call(n, s) && (r[s] = n[s]);
|
|
824
824
|
}), r;
|
|
825
825
|
} else
|
|
826
826
|
throw new Error("Please check mark() to ensure that it is a stable marker draftable function.");
|
|
827
827
|
}
|
|
828
828
|
function X(n) {
|
|
829
|
-
n.copy || (n.copy =
|
|
829
|
+
n.copy || (n.copy = Ar(n.original, n.options));
|
|
830
830
|
}
|
|
831
831
|
function Ge(n) {
|
|
832
832
|
if (!ye(n))
|
|
833
|
-
return
|
|
833
|
+
return dn(n);
|
|
834
834
|
if (Array.isArray(n))
|
|
835
835
|
return n.map(Ge);
|
|
836
836
|
if (n instanceof Map) {
|
|
@@ -838,7 +838,7 @@ function Ge(n) {
|
|
|
838
838
|
r,
|
|
839
839
|
Ge(s)
|
|
840
840
|
]);
|
|
841
|
-
if (!
|
|
841
|
+
if (!fn(n)) {
|
|
842
842
|
const r = Object.getPrototypeOf(n).constructor;
|
|
843
843
|
return new r(t);
|
|
844
844
|
}
|
|
@@ -846,7 +846,7 @@ function Ge(n) {
|
|
|
846
846
|
}
|
|
847
847
|
if (n instanceof Set) {
|
|
848
848
|
const t = Array.from(n).map(Ge);
|
|
849
|
-
if (!
|
|
849
|
+
if (!ln(n)) {
|
|
850
850
|
const r = Object.getPrototypeOf(n).constructor;
|
|
851
851
|
return new r(t);
|
|
852
852
|
}
|
|
@@ -864,7 +864,7 @@ function ge(n) {
|
|
|
864
864
|
var e;
|
|
865
865
|
n.assignedMap = (e = n.assignedMap) !== null && e !== void 0 ? e : /* @__PURE__ */ new Map(), n.operated || (n.operated = !0, n.parent && ge(n.parent));
|
|
866
866
|
}
|
|
867
|
-
function
|
|
867
|
+
function Nn() {
|
|
868
868
|
throw new Error("Cannot modify frozen object");
|
|
869
869
|
}
|
|
870
870
|
function Ue(n, e, t, r, s) {
|
|
@@ -892,12 +892,12 @@ function Ue(n, e, t, r, s) {
|
|
|
892
892
|
case 2:
|
|
893
893
|
for (const [a, c] of n)
|
|
894
894
|
Ue(a, a, t, r, s), Ue(c, a, t, r, s);
|
|
895
|
-
n.set = n.clear = n.delete =
|
|
895
|
+
n.set = n.clear = n.delete = Nn;
|
|
896
896
|
break;
|
|
897
897
|
case 3:
|
|
898
898
|
for (const a of n)
|
|
899
899
|
Ue(a, a, t, r, s);
|
|
900
|
-
n.add = n.clear = n.delete =
|
|
900
|
+
n.add = n.clear = n.delete = Nn;
|
|
901
901
|
break;
|
|
902
902
|
case 1:
|
|
903
903
|
Object.freeze(n);
|
|
@@ -913,7 +913,7 @@ function Ue(n, e, t, r, s) {
|
|
|
913
913
|
}
|
|
914
914
|
r.pop(), s.pop();
|
|
915
915
|
}
|
|
916
|
-
function
|
|
916
|
+
function hn(n, e) {
|
|
917
917
|
const t = Re(n);
|
|
918
918
|
if (t === 0)
|
|
919
919
|
Reflect.ownKeys(n).forEach((r) => {
|
|
@@ -926,11 +926,11 @@ function dn(n, e) {
|
|
|
926
926
|
} else
|
|
927
927
|
n.forEach((r, s) => e(s, r, n));
|
|
928
928
|
}
|
|
929
|
-
function
|
|
929
|
+
function Or(n, e, t) {
|
|
930
930
|
if (Me(n) || !ye(n, t) || e.has(n) || Object.isFrozen(n))
|
|
931
931
|
return;
|
|
932
932
|
const r = n instanceof Set, s = r ? /* @__PURE__ */ new Map() : void 0;
|
|
933
|
-
if (e.add(n),
|
|
933
|
+
if (e.add(n), hn(n, (i, o) => {
|
|
934
934
|
var a;
|
|
935
935
|
if (Me(o)) {
|
|
936
936
|
const c = M(o);
|
|
@@ -938,7 +938,7 @@ function Ar(n, e, t) {
|
|
|
938
938
|
const u = !((a = c.assignedMap) === null || a === void 0) && a.size || c.operated ? c.copy : c.original;
|
|
939
939
|
tt(r ? s : n, i, u);
|
|
940
940
|
} else
|
|
941
|
-
|
|
941
|
+
Or(o, e, t);
|
|
942
942
|
}), s) {
|
|
943
943
|
const i = n, o = Array.from(i);
|
|
944
944
|
i.clear(), o.forEach((a) => {
|
|
@@ -946,39 +946,39 @@ function Ar(n, e, t) {
|
|
|
946
946
|
});
|
|
947
947
|
}
|
|
948
948
|
}
|
|
949
|
-
function
|
|
949
|
+
function qs(n, e) {
|
|
950
950
|
const t = n.type === 3 ? n.setMap : n.copy;
|
|
951
|
-
n.finalities.revoke.length > 1 && n.assignedMap.get(e) && t &&
|
|
951
|
+
n.finalities.revoke.length > 1 && n.assignedMap.get(e) && t && Or(Se(t, e), n.finalities.handledSet, n.options);
|
|
952
952
|
}
|
|
953
|
-
function
|
|
953
|
+
function Bt(n) {
|
|
954
954
|
n.type === 3 && n.copy && (n.copy.clear(), n.setMap.forEach((e) => {
|
|
955
|
-
n.copy.add(
|
|
955
|
+
n.copy.add(dn(e));
|
|
956
956
|
}));
|
|
957
957
|
}
|
|
958
|
-
function
|
|
958
|
+
function Qt(n, e, t, r) {
|
|
959
959
|
if (n.operated && n.assignedMap && n.assignedMap.size > 0 && !n.finalized) {
|
|
960
960
|
if (t && r) {
|
|
961
|
-
const i =
|
|
961
|
+
const i = vr(n);
|
|
962
962
|
i && e(n, i, t, r);
|
|
963
963
|
}
|
|
964
964
|
n.finalized = !0;
|
|
965
965
|
}
|
|
966
966
|
}
|
|
967
|
-
function
|
|
967
|
+
function pn(n, e, t, r) {
|
|
968
968
|
const s = M(t);
|
|
969
969
|
s && (s.callbacks || (s.callbacks = []), s.callbacks.push((i, o) => {
|
|
970
970
|
var a;
|
|
971
971
|
const c = n.type === 3 ? n.setMap : n.copy;
|
|
972
972
|
if (Te(Se(c, e), t)) {
|
|
973
973
|
let u = s.original;
|
|
974
|
-
s.copy && (u = s.copy),
|
|
974
|
+
s.copy && (u = s.copy), Bt(n), Qt(n, r, i, o), n.options.enableAutoFreeze && (n.options.updatedValues = (a = n.options.updatedValues) !== null && a !== void 0 ? a : /* @__PURE__ */ new WeakMap(), n.options.updatedValues.set(u, s.original)), tt(c, e, u);
|
|
975
975
|
}
|
|
976
976
|
}), n.options.enableAutoFreeze && s.finalities !== n.finalities && (n.options.enableAutoFreeze = !1)), ye(t, n.options) && n.finalities.draft.push(() => {
|
|
977
977
|
const i = n.type === 3 ? n.setMap : n.copy;
|
|
978
|
-
Te(Se(i, e), t) &&
|
|
978
|
+
Te(Se(i, e), t) && qs(n, e);
|
|
979
979
|
});
|
|
980
980
|
}
|
|
981
|
-
function
|
|
981
|
+
function Ws(n, e, t, r, s) {
|
|
982
982
|
let { original: i, assignedMap: o, options: a } = n, c = n.copy;
|
|
983
983
|
c.length < i.length && ([i, c] = [c, i], [t, r] = [r, t]);
|
|
984
984
|
for (let u = 0; u < i.length; u += 1)
|
|
@@ -1024,7 +1024,7 @@ function qs(n, e, t, r, s) {
|
|
|
1024
1024
|
}
|
|
1025
1025
|
}
|
|
1026
1026
|
}
|
|
1027
|
-
function
|
|
1027
|
+
function zs({ original: n, copy: e, assignedMap: t }, r, s, i, o) {
|
|
1028
1028
|
t.forEach((a, c) => {
|
|
1029
1029
|
const u = Se(n, c), l = pt(Se(e, c)), f = a ? Ze(n, c) ? K.Replace : K.Add : K.Remove;
|
|
1030
1030
|
if (Te(u, l) && f === K.Replace)
|
|
@@ -1033,7 +1033,7 @@ function Ws({ original: n, copy: e, assignedMap: t }, r, s, i, o) {
|
|
|
1033
1033
|
s.push(f === K.Remove ? { op: f, path: y } : { op: f, path: y, value: l }), i.push(f === K.Add ? { op: K.Remove, path: y } : f === K.Remove ? { op: K.Add, path: y, value: u } : { op: K.Replace, path: y, value: u });
|
|
1034
1034
|
});
|
|
1035
1035
|
}
|
|
1036
|
-
function
|
|
1036
|
+
function Vs({ original: n, copy: e }, t, r, s, i) {
|
|
1037
1037
|
let o = 0;
|
|
1038
1038
|
n.forEach((a) => {
|
|
1039
1039
|
if (!e.has(a)) {
|
|
@@ -1070,17 +1070,17 @@ function et(n, e, t, r) {
|
|
|
1070
1070
|
switch (n.type) {
|
|
1071
1071
|
case 0:
|
|
1072
1072
|
case 2:
|
|
1073
|
-
return
|
|
1073
|
+
return zs(n, e, t, r, s);
|
|
1074
1074
|
case 1:
|
|
1075
|
-
return
|
|
1075
|
+
return Ws(n, e, t, r, s);
|
|
1076
1076
|
case 3:
|
|
1077
|
-
return
|
|
1077
|
+
return Vs(n, e, t, r, s);
|
|
1078
1078
|
}
|
|
1079
1079
|
}
|
|
1080
1080
|
const _t = (n, e, t = !1) => {
|
|
1081
1081
|
if (typeof n == "object" && n !== null && (!ye(n, e) || t))
|
|
1082
1082
|
throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.");
|
|
1083
|
-
},
|
|
1083
|
+
}, Gt = {
|
|
1084
1084
|
get size() {
|
|
1085
1085
|
return ae(M(this)).size;
|
|
1086
1086
|
},
|
|
@@ -1089,7 +1089,7 @@ const _t = (n, e, t = !1) => {
|
|
|
1089
1089
|
},
|
|
1090
1090
|
set(n, e) {
|
|
1091
1091
|
const t = M(this), r = ae(t);
|
|
1092
|
-
return (!r.has(n) || !Te(r.get(n), e)) && (X(t), ge(t), t.assignedMap.set(n, !0), t.copy.set(n, e),
|
|
1092
|
+
return (!r.has(n) || !Te(r.get(n), e)) && (X(t), ge(t), t.assignedMap.set(n, !0), t.copy.set(n, e), pn(t, n, e, et)), this;
|
|
1093
1093
|
},
|
|
1094
1094
|
delete(n) {
|
|
1095
1095
|
if (!this.has(n))
|
|
@@ -1117,7 +1117,7 @@ const _t = (n, e, t = !1) => {
|
|
|
1117
1117
|
const r = M(this), s = ae(r).get(n), i = ((t = (e = r.options).mark) === null || t === void 0 ? void 0 : t.call(e, s, ce)) === ce.mutable;
|
|
1118
1118
|
if (r.options.strict && _t(s, r.options, i), i || r.finalized || !ye(s, r.options) || s !== r.original.get(n))
|
|
1119
1119
|
return s;
|
|
1120
|
-
const o =
|
|
1120
|
+
const o = un.createDraft({
|
|
1121
1121
|
original: s,
|
|
1122
1122
|
parentDraft: r,
|
|
1123
1123
|
key: n,
|
|
@@ -1161,7 +1161,7 @@ const _t = (n, e, t = !1) => {
|
|
|
1161
1161
|
[ht]() {
|
|
1162
1162
|
return this.entries();
|
|
1163
1163
|
}
|
|
1164
|
-
},
|
|
1164
|
+
}, Bs = Reflect.ownKeys(Gt), Kn = (n, e, { isValuesIterator: t }) => () => {
|
|
1165
1165
|
var r, s;
|
|
1166
1166
|
const i = e.next();
|
|
1167
1167
|
if (i.done)
|
|
@@ -1170,7 +1170,7 @@ const _t = (n, e, t = !1) => {
|
|
|
1170
1170
|
let a = n.setMap.get(o);
|
|
1171
1171
|
const c = M(a), u = ((s = (r = n.options).mark) === null || s === void 0 ? void 0 : s.call(r, a, ce)) === ce.mutable;
|
|
1172
1172
|
if (n.options.strict && _t(o, n.options, u), !u && !c && ye(o, n.options) && !n.finalized && n.original.has(o)) {
|
|
1173
|
-
const l =
|
|
1173
|
+
const l = un.createDraft({
|
|
1174
1174
|
original: o,
|
|
1175
1175
|
parentDraft: n,
|
|
1176
1176
|
key: o,
|
|
@@ -1197,7 +1197,7 @@ const _t = (n, e, t = !1) => {
|
|
|
1197
1197
|
},
|
|
1198
1198
|
add(n) {
|
|
1199
1199
|
const e = M(this);
|
|
1200
|
-
return this.has(n) || (X(e), ge(e), e.assignedMap.set(n, !0), e.setMap.set(n, n),
|
|
1200
|
+
return this.has(n) || (X(e), ge(e), e.assignedMap.set(n, !0), e.setMap.set(n, n), pn(e, n, n, et)), this;
|
|
1201
1201
|
},
|
|
1202
1202
|
delete(n) {
|
|
1203
1203
|
if (!this.has(n))
|
|
@@ -1222,7 +1222,7 @@ const _t = (n, e, t = !1) => {
|
|
|
1222
1222
|
const e = n.setMap.keys();
|
|
1223
1223
|
return {
|
|
1224
1224
|
[Symbol.iterator]: () => this.values(),
|
|
1225
|
-
next:
|
|
1225
|
+
next: Kn(n, e, { isValuesIterator: !0 })
|
|
1226
1226
|
};
|
|
1227
1227
|
},
|
|
1228
1228
|
entries() {
|
|
@@ -1231,7 +1231,7 @@ const _t = (n, e, t = !1) => {
|
|
|
1231
1231
|
const e = n.setMap.keys();
|
|
1232
1232
|
return {
|
|
1233
1233
|
[Symbol.iterator]: () => this.entries(),
|
|
1234
|
-
next:
|
|
1234
|
+
next: Kn(n, e, {
|
|
1235
1235
|
isValuesIterator: !1
|
|
1236
1236
|
})
|
|
1237
1237
|
};
|
|
@@ -1272,13 +1272,13 @@ Set.prototype.difference && Object.assign(gt, {
|
|
|
1272
1272
|
return Set.prototype.isDisjointFrom.call(new Set(this.values()), n);
|
|
1273
1273
|
}
|
|
1274
1274
|
});
|
|
1275
|
-
const
|
|
1275
|
+
const Qs = Reflect.ownKeys(gt), Er = /* @__PURE__ */ new WeakSet(), kr = {
|
|
1276
1276
|
get(n, e, t) {
|
|
1277
1277
|
var r, s;
|
|
1278
1278
|
const i = (r = n.copy) === null || r === void 0 ? void 0 : r[e];
|
|
1279
|
-
if (i &&
|
|
1279
|
+
if (i && Er.has(i))
|
|
1280
1280
|
return i;
|
|
1281
|
-
if (e ===
|
|
1281
|
+
if (e === Sr)
|
|
1282
1282
|
return n;
|
|
1283
1283
|
let o;
|
|
1284
1284
|
if (n.options.mark) {
|
|
@@ -1287,14 +1287,14 @@ const Bs = Reflect.ownKeys(gt), Or = /* @__PURE__ */ new WeakSet(), Er = {
|
|
|
1287
1287
|
return n.options.strict && _t(u, n.options, !0), u;
|
|
1288
1288
|
}
|
|
1289
1289
|
const a = ae(n);
|
|
1290
|
-
if (a instanceof Map &&
|
|
1290
|
+
if (a instanceof Map && Bs.includes(e)) {
|
|
1291
1291
|
if (e === "size")
|
|
1292
|
-
return Object.getOwnPropertyDescriptor(
|
|
1293
|
-
const u =
|
|
1292
|
+
return Object.getOwnPropertyDescriptor(Gt, "size").get.call(n.proxy);
|
|
1293
|
+
const u = Gt[e];
|
|
1294
1294
|
if (u)
|
|
1295
1295
|
return u.bind(n.proxy);
|
|
1296
1296
|
}
|
|
1297
|
-
if (a instanceof Set &&
|
|
1297
|
+
if (a instanceof Set && Qs.includes(e)) {
|
|
1298
1298
|
if (e === "size")
|
|
1299
1299
|
return Object.getOwnPropertyDescriptor(gt, "size").get.call(n.proxy);
|
|
1300
1300
|
const u = gt[e];
|
|
@@ -1302,7 +1302,7 @@ const Bs = Reflect.ownKeys(gt), Or = /* @__PURE__ */ new WeakSet(), Er = {
|
|
|
1302
1302
|
return u.bind(n.proxy);
|
|
1303
1303
|
}
|
|
1304
1304
|
if (!Ze(a, e)) {
|
|
1305
|
-
const u =
|
|
1305
|
+
const u = Fn(a, e);
|
|
1306
1306
|
return u ? "value" in u ? u.value : (
|
|
1307
1307
|
// !case: support for getter
|
|
1308
1308
|
(s = u.get) === null || s === void 0 ? void 0 : s.call(n.proxy)
|
|
@@ -1312,7 +1312,7 @@ const Bs = Reflect.ownKeys(gt), Or = /* @__PURE__ */ new WeakSet(), Er = {
|
|
|
1312
1312
|
if (n.options.strict && _t(c, n.options), n.finalized || !ye(c, n.options))
|
|
1313
1313
|
return c;
|
|
1314
1314
|
if (c === jt(n.original, e)) {
|
|
1315
|
-
if (X(n), n.copy[e] =
|
|
1315
|
+
if (X(n), n.copy[e] = yn({
|
|
1316
1316
|
original: n.original[e],
|
|
1317
1317
|
parentDraft: n,
|
|
1318
1318
|
key: n.type === 1 ? Number(e) : e,
|
|
@@ -1333,11 +1333,11 @@ const Bs = Reflect.ownKeys(gt), Or = /* @__PURE__ */ new WeakSet(), Er = {
|
|
|
1333
1333
|
let s;
|
|
1334
1334
|
if (n.type === 1 && e !== "length" && !(Number.isInteger(s = Number(e)) && s >= 0 && (e === 0 || s === 0 || String(s) === String(e))))
|
|
1335
1335
|
throw new Error("Only supports setting array indices and the 'length' property.");
|
|
1336
|
-
const i =
|
|
1336
|
+
const i = Fn(ae(n), e);
|
|
1337
1337
|
if (i != null && i.set)
|
|
1338
1338
|
return i.set.call(n.proxy, t), !0;
|
|
1339
1339
|
const o = jt(ae(n), e), a = M(o);
|
|
1340
|
-
return a && Te(a.original, t) ? (n.copy[e] = t, n.assignedMap = (r = n.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), n.assignedMap.set(e, !1), !0) : (Te(t, o) && (t !== void 0 || Ze(n.original, e)) || (X(n), ge(n), Ze(n.original, e) && Te(t, n.original[e]) ? n.assignedMap.delete(e) : n.assignedMap.set(e, !0), n.copy[e] = t,
|
|
1340
|
+
return a && Te(a.original, t) ? (n.copy[e] = t, n.assignedMap = (r = n.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), n.assignedMap.set(e, !1), !0) : (Te(t, o) && (t !== void 0 || Ze(n.original, e)) || (X(n), ge(n), Ze(n.original, e) && Te(t, n.original[e]) ? n.assignedMap.delete(e) : n.assignedMap.set(e, !0), n.copy[e] = t, pn(n, e, t, et)), !0);
|
|
1341
1341
|
},
|
|
1342
1342
|
has(n, e) {
|
|
1343
1343
|
return e in ae(n);
|
|
@@ -1365,10 +1365,10 @@ const Bs = Reflect.ownKeys(gt), Or = /* @__PURE__ */ new WeakSet(), Er = {
|
|
|
1365
1365
|
},
|
|
1366
1366
|
deleteProperty(n, e) {
|
|
1367
1367
|
var t;
|
|
1368
|
-
return n.type === 1 ?
|
|
1368
|
+
return n.type === 1 ? kr.set.call(this, n, e, void 0, n.proxy) : (jt(n.original, e) !== void 0 || e in n.original ? (X(n), ge(n), n.assignedMap.set(e, !1)) : (n.assignedMap = (t = n.assignedMap) !== null && t !== void 0 ? t : /* @__PURE__ */ new Map(), n.assignedMap.delete(e)), n.copy && delete n.copy[e], !0);
|
|
1369
1369
|
}
|
|
1370
1370
|
};
|
|
1371
|
-
function
|
|
1371
|
+
function yn(n) {
|
|
1372
1372
|
const { original: e, parentDraft: t, key: r, finalities: s, options: i } = n, o = Re(e), a = {
|
|
1373
1373
|
type: o,
|
|
1374
1374
|
finalized: !1,
|
|
@@ -1382,8 +1382,8 @@ function pn(n) {
|
|
|
1382
1382
|
setMap: o === 3 ? new Map(e.entries()) : void 0
|
|
1383
1383
|
};
|
|
1384
1384
|
(r || "key" in n) && (a.key = r);
|
|
1385
|
-
const { proxy: c, revoke: u } = Proxy.revocable(o === 1 ? Object.assign([], a) : a,
|
|
1386
|
-
if (s.revoke.push(u),
|
|
1385
|
+
const { proxy: c, revoke: u } = Proxy.revocable(o === 1 ? Object.assign([], a) : a, kr);
|
|
1386
|
+
if (s.revoke.push(u), Er.add(c), a.proxy = c, t) {
|
|
1387
1387
|
const l = t;
|
|
1388
1388
|
l.finalities.draft.push((f, p) => {
|
|
1389
1389
|
var y, b;
|
|
@@ -1392,7 +1392,7 @@ function pn(n) {
|
|
|
1392
1392
|
const S = Se(T, r), _ = M(S);
|
|
1393
1393
|
if (_) {
|
|
1394
1394
|
let w = _.original;
|
|
1395
|
-
_.operated && (w =
|
|
1395
|
+
_.operated && (w = dn(S)), Bt(_), Qt(_, et, f, p), l.options.enableAutoFreeze && (l.options.updatedValues = (y = l.options.updatedValues) !== null && y !== void 0 ? y : /* @__PURE__ */ new WeakMap(), l.options.updatedValues.set(w, _.original)), tt(T, r, w);
|
|
1396
1396
|
}
|
|
1397
1397
|
(b = g.callbacks) === null || b === void 0 || b.forEach((w) => {
|
|
1398
1398
|
w(f, p);
|
|
@@ -1401,26 +1401,26 @@ function pn(n) {
|
|
|
1401
1401
|
} else {
|
|
1402
1402
|
const l = M(c);
|
|
1403
1403
|
l.finalities.draft.push((f, p) => {
|
|
1404
|
-
|
|
1404
|
+
Bt(l), Qt(l, et, f, p);
|
|
1405
1405
|
});
|
|
1406
1406
|
}
|
|
1407
1407
|
return c;
|
|
1408
1408
|
}
|
|
1409
|
-
|
|
1410
|
-
function
|
|
1409
|
+
un.createDraft = yn;
|
|
1410
|
+
function Gs(n, e, t, r, s) {
|
|
1411
1411
|
var i;
|
|
1412
1412
|
const o = M(n), a = (i = o == null ? void 0 : o.original) !== null && i !== void 0 ? i : n, c = !!e.length;
|
|
1413
1413
|
if (o != null && o.operated)
|
|
1414
1414
|
for (; o.finalities.draft.length > 0; )
|
|
1415
1415
|
o.finalities.draft.pop()(t, r);
|
|
1416
1416
|
const u = c ? e[0] : o ? o.operated ? o.copy : o.original : n;
|
|
1417
|
-
return o &&
|
|
1417
|
+
return o && Vt(o), s && Ue(u, u, o == null ? void 0 : o.options.updatedValues), [
|
|
1418
1418
|
u,
|
|
1419
1419
|
t && c ? [{ op: K.Replace, path: [], value: e[0] }] : t,
|
|
1420
1420
|
r && c ? [{ op: K.Replace, path: [], value: a }] : r
|
|
1421
1421
|
];
|
|
1422
1422
|
}
|
|
1423
|
-
function
|
|
1423
|
+
function Hs(n, e) {
|
|
1424
1424
|
var t;
|
|
1425
1425
|
const r = {
|
|
1426
1426
|
draft: [],
|
|
@@ -1429,7 +1429,7 @@ function Gs(n, e) {
|
|
|
1429
1429
|
};
|
|
1430
1430
|
let s, i;
|
|
1431
1431
|
e.enablePatches && (s = [], i = []);
|
|
1432
|
-
const a = ((t = e.mark) === null || t === void 0 ? void 0 : t.call(e, n, ce)) === ce.mutable || !ye(n, e) ? n :
|
|
1432
|
+
const a = ((t = e.mark) === null || t === void 0 ? void 0 : t.call(e, n, ce)) === ce.mutable || !ye(n, e) ? n : yn({
|
|
1433
1433
|
original: n,
|
|
1434
1434
|
parentDraft: null,
|
|
1435
1435
|
finalities: r,
|
|
@@ -1438,14 +1438,14 @@ function Gs(n, e) {
|
|
|
1438
1438
|
return [
|
|
1439
1439
|
a,
|
|
1440
1440
|
(c = []) => {
|
|
1441
|
-
const [u, l, f] =
|
|
1441
|
+
const [u, l, f] = Gs(a, c, s, i, e.enableAutoFreeze);
|
|
1442
1442
|
return e.enablePatches ? [u, l, f] : u;
|
|
1443
1443
|
}
|
|
1444
1444
|
];
|
|
1445
1445
|
}
|
|
1446
|
-
function
|
|
1446
|
+
function Ht(n) {
|
|
1447
1447
|
const { rootDraft: e, value: t, useRawReturn: r = !1, isRoot: s = !0 } = n;
|
|
1448
|
-
|
|
1448
|
+
hn(t, (i, o, a) => {
|
|
1449
1449
|
const c = M(o);
|
|
1450
1450
|
if (c && e && c.finalities === e.finalities) {
|
|
1451
1451
|
n.isContainDraft = !0;
|
|
@@ -1455,10 +1455,10 @@ function Gt(n) {
|
|
|
1455
1455
|
a.clear(), l.forEach((f) => a.add(i === f ? u : f));
|
|
1456
1456
|
} else
|
|
1457
1457
|
tt(a, i, u);
|
|
1458
|
-
} else typeof o == "object" && o !== null && (n.value = o, n.isRoot = !1,
|
|
1458
|
+
} else typeof o == "object" && o !== null && (n.value = o, n.isRoot = !1, Ht(n));
|
|
1459
1459
|
}), s && (n.isContainDraft || console.warn("The return value does not contain any draft, please use 'rawReturn()' to wrap the return value to improve performance."), r && console.warn("The return value contains drafts, please don't use 'rawReturn()' to wrap the return value."));
|
|
1460
1460
|
}
|
|
1461
|
-
function
|
|
1461
|
+
function Cr(n) {
|
|
1462
1462
|
var e;
|
|
1463
1463
|
const t = M(n);
|
|
1464
1464
|
if (!ye(n, t == null ? void 0 : t.options))
|
|
@@ -1468,7 +1468,7 @@ function kr(n) {
|
|
|
1468
1468
|
return t.original;
|
|
1469
1469
|
let s;
|
|
1470
1470
|
function i() {
|
|
1471
|
-
s = r === 2 ?
|
|
1471
|
+
s = r === 2 ? fn(n) ? new Map(n) : new (Object.getPrototypeOf(n)).constructor(n) : r === 3 ? Array.from(t.setMap.values()) : Ar(n, t == null ? void 0 : t.options);
|
|
1472
1472
|
}
|
|
1473
1473
|
if (t) {
|
|
1474
1474
|
t.finalized = !0;
|
|
@@ -1479,23 +1479,23 @@ function kr(n) {
|
|
|
1479
1479
|
}
|
|
1480
1480
|
} else
|
|
1481
1481
|
s = n;
|
|
1482
|
-
if (
|
|
1482
|
+
if (hn(s, (o, a) => {
|
|
1483
1483
|
if (t && Te(Se(t.original, o), a))
|
|
1484
1484
|
return;
|
|
1485
|
-
const c =
|
|
1485
|
+
const c = Cr(a);
|
|
1486
1486
|
c !== a && (s === n && i(), tt(s, o, c));
|
|
1487
1487
|
}), r === 3) {
|
|
1488
1488
|
const o = (e = t == null ? void 0 : t.original) !== null && e !== void 0 ? e : s;
|
|
1489
|
-
return
|
|
1489
|
+
return ln(o) ? new Set(s) : new (Object.getPrototypeOf(o)).constructor(s);
|
|
1490
1490
|
}
|
|
1491
1491
|
return s;
|
|
1492
1492
|
}
|
|
1493
|
-
function
|
|
1493
|
+
function qn(n) {
|
|
1494
1494
|
if (!Me(n))
|
|
1495
1495
|
throw new Error(`current() is only used for Draft, parameter: ${n}`);
|
|
1496
|
-
return
|
|
1496
|
+
return Cr(n);
|
|
1497
1497
|
}
|
|
1498
|
-
const
|
|
1498
|
+
const Js = (n) => function e(t, r, s) {
|
|
1499
1499
|
var i, o, a;
|
|
1500
1500
|
if (typeof t == "function" && typeof r != "function")
|
|
1501
1501
|
return function(v, ...k) {
|
|
@@ -1506,7 +1506,7 @@ const Hs = (n) => function e(t, r, s) {
|
|
|
1506
1506
|
if (typeof r != "function" && (l = r), l !== void 0 && Object.prototype.toString.call(l) !== "[object Object]")
|
|
1507
1507
|
throw new Error(`Invalid options: ${l}, 'options' should be an object.`);
|
|
1508
1508
|
l = Object.assign(Object.assign({}, n), l);
|
|
1509
|
-
const f = Me(c) ?
|
|
1509
|
+
const f = Me(c) ? qn(c) : c, p = Array.isArray(l.mark) ? (v, k) => {
|
|
1510
1510
|
for (const j of l.mark) {
|
|
1511
1511
|
if (typeof j != "function")
|
|
1512
1512
|
throw new Error(`Invalid mark: ${j}, 'mark' should be a function.`);
|
|
@@ -1522,7 +1522,7 @@ const Hs = (n) => function e(t, r, s) {
|
|
|
1522
1522
|
};
|
|
1523
1523
|
if (!ye(f, T) && typeof f == "object" && f !== null)
|
|
1524
1524
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
1525
|
-
const [S, _] =
|
|
1525
|
+
const [S, _] = Hs(f, T);
|
|
1526
1526
|
if (typeof r != "function") {
|
|
1527
1527
|
if (!ye(f, T))
|
|
1528
1528
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
@@ -1532,24 +1532,24 @@ const Hs = (n) => function e(t, r, s) {
|
|
|
1532
1532
|
try {
|
|
1533
1533
|
w = u(S);
|
|
1534
1534
|
} catch (v) {
|
|
1535
|
-
throw
|
|
1535
|
+
throw Vt(M(S)), v;
|
|
1536
1536
|
}
|
|
1537
1537
|
const C = (v) => {
|
|
1538
1538
|
const k = M(S);
|
|
1539
1539
|
if (!Me(v)) {
|
|
1540
1540
|
if (v !== void 0 && !Te(v, S) && (k != null && k.operated))
|
|
1541
1541
|
throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");
|
|
1542
|
-
const x = v == null ? void 0 : v[
|
|
1542
|
+
const x = v == null ? void 0 : v[Ls];
|
|
1543
1543
|
if (x) {
|
|
1544
1544
|
const z = x[0];
|
|
1545
|
-
return T.strict && typeof v == "object" && v !== null &&
|
|
1545
|
+
return T.strict && typeof v == "object" && v !== null && Ht({
|
|
1546
1546
|
rootDraft: k,
|
|
1547
1547
|
value: v,
|
|
1548
1548
|
useRawReturn: !0
|
|
1549
1549
|
}), _([z]);
|
|
1550
1550
|
}
|
|
1551
1551
|
if (v !== void 0)
|
|
1552
|
-
return typeof v == "object" && v !== null &&
|
|
1552
|
+
return typeof v == "object" && v !== null && Ht({ rootDraft: k, value: v }), _([v]);
|
|
1553
1553
|
}
|
|
1554
1554
|
if (v === S || v === void 0)
|
|
1555
1555
|
return _([]);
|
|
@@ -1557,26 +1557,26 @@ const Hs = (n) => function e(t, r, s) {
|
|
|
1557
1557
|
if (T === j.options) {
|
|
1558
1558
|
if (j.operated)
|
|
1559
1559
|
throw new Error("Cannot return a modified child draft.");
|
|
1560
|
-
return _([
|
|
1560
|
+
return _([qn(v)]);
|
|
1561
1561
|
}
|
|
1562
1562
|
return _([v]);
|
|
1563
1563
|
};
|
|
1564
1564
|
return w instanceof Promise ? w.then(C, (v) => {
|
|
1565
|
-
throw
|
|
1565
|
+
throw Vt(M(S)), v;
|
|
1566
1566
|
}) : C(w);
|
|
1567
|
-
}, mt =
|
|
1567
|
+
}, mt = Js();
|
|
1568
1568
|
Object.prototype.constructor.toString();
|
|
1569
|
-
function
|
|
1569
|
+
function Ir(n, e) {
|
|
1570
1570
|
const t = Object.keys(n), r = Object.keys(e);
|
|
1571
1571
|
return t.length === r.length && Object.keys(n).every((s) => e.hasOwnProperty(s));
|
|
1572
1572
|
}
|
|
1573
|
-
function
|
|
1573
|
+
function Wn(n, e) {
|
|
1574
1574
|
return Object.keys(n).length === Object.keys(e).length && Object.keys(n).every((t) => e.hasOwnProperty(t) && n[t] === e[t]);
|
|
1575
1575
|
}
|
|
1576
1576
|
function yt(n, e) {
|
|
1577
|
-
return typeof n != "object" || typeof e != "object" || n === null || e === null ? n === e :
|
|
1577
|
+
return typeof n != "object" || typeof e != "object" || n === null || e === null ? n === e : Ir(n, e) ? Object.keys(n).every((t) => yt(n[t], e[t])) : !1;
|
|
1578
1578
|
}
|
|
1579
|
-
function
|
|
1579
|
+
function bn(n) {
|
|
1580
1580
|
if (!He(n))
|
|
1581
1581
|
return n;
|
|
1582
1582
|
const e = {};
|
|
@@ -1584,7 +1584,7 @@ function yn(n) {
|
|
|
1584
1584
|
r !== void 0 && (e[t] = r);
|
|
1585
1585
|
return e;
|
|
1586
1586
|
}
|
|
1587
|
-
function
|
|
1587
|
+
function Pr(n, e) {
|
|
1588
1588
|
if (!He(n) || !He(e))
|
|
1589
1589
|
return e;
|
|
1590
1590
|
const t = { ...n };
|
|
@@ -1596,14 +1596,14 @@ function Ir(n, e) {
|
|
|
1596
1596
|
continue;
|
|
1597
1597
|
}
|
|
1598
1598
|
const s = He(n[r]) && He(e[r]);
|
|
1599
|
-
t[r] = s ?
|
|
1599
|
+
t[r] = s ? Pr(n[r], e[r]) : e[r];
|
|
1600
1600
|
}
|
|
1601
1601
|
return t;
|
|
1602
1602
|
}
|
|
1603
1603
|
function He(n) {
|
|
1604
1604
|
return typeof n == "object" && n !== null && !Array.isArray(n);
|
|
1605
1605
|
}
|
|
1606
|
-
function
|
|
1606
|
+
function Ys(n, e, t) {
|
|
1607
1607
|
if (!n || e.length === 0)
|
|
1608
1608
|
return;
|
|
1609
1609
|
let r = n || {};
|
|
@@ -1614,7 +1614,7 @@ function Js(n, e, t) {
|
|
|
1614
1614
|
const s = e[e.length - 1];
|
|
1615
1615
|
Array.isArray(r) && typeof s == "number" ? r.splice(s, 0, t) : r[s] = t;
|
|
1616
1616
|
}
|
|
1617
|
-
function
|
|
1617
|
+
function zn(n, e, t) {
|
|
1618
1618
|
if (!n || e.length === 0)
|
|
1619
1619
|
return;
|
|
1620
1620
|
let r = n || {};
|
|
@@ -1624,7 +1624,7 @@ function Wn(n, e, t) {
|
|
|
1624
1624
|
}
|
|
1625
1625
|
r[e[e.length - 1]] = t;
|
|
1626
1626
|
}
|
|
1627
|
-
function
|
|
1627
|
+
function Mr(n, e) {
|
|
1628
1628
|
if (!n || e.length === 0)
|
|
1629
1629
|
return;
|
|
1630
1630
|
const [t, ...r] = e;
|
|
@@ -1633,13 +1633,13 @@ function Pr(n, e) {
|
|
|
1633
1633
|
Array.isArray(n) ? n.splice(t, 1) : delete n[t];
|
|
1634
1634
|
return;
|
|
1635
1635
|
}
|
|
1636
|
-
|
|
1636
|
+
Mr(n[t], r), Zs(n[t]) && delete n[t];
|
|
1637
1637
|
}
|
|
1638
1638
|
}
|
|
1639
|
-
function
|
|
1639
|
+
function Zs(n) {
|
|
1640
1640
|
return n && Object.keys(n).length === 0;
|
|
1641
1641
|
}
|
|
1642
|
-
const
|
|
1642
|
+
const Vn = /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$/, Xs = {
|
|
1643
1643
|
ZULU: 0,
|
|
1644
1644
|
YEKT: 18e3,
|
|
1645
1645
|
YEKST: 21600,
|
|
@@ -1835,39 +1835,39 @@ const zn = /ZULU|YEKT|YEKST|YAPT|YAKT|YAKST|XJT|WGT|WGST|WFT|WETDST|WET|WDT|WAT|
|
|
|
1835
1835
|
ACSST: 37800,
|
|
1836
1836
|
ACDT: 37800
|
|
1837
1837
|
};
|
|
1838
|
-
function
|
|
1838
|
+
function ei(n) {
|
|
1839
1839
|
return new Date(n);
|
|
1840
1840
|
}
|
|
1841
|
-
function
|
|
1841
|
+
function ti(n) {
|
|
1842
1842
|
return /* @__PURE__ */ new Date(n + "Z");
|
|
1843
1843
|
}
|
|
1844
|
-
const
|
|
1845
|
-
function
|
|
1846
|
-
const e = n.match(
|
|
1844
|
+
const ni = /^(\d+)[\./-](\d+)[\./-](\d+)$/;
|
|
1845
|
+
function ri(n) {
|
|
1846
|
+
const e = n.match(ni);
|
|
1847
1847
|
if (!e)
|
|
1848
1848
|
return null;
|
|
1849
1849
|
const [t, r, s, i] = e;
|
|
1850
1850
|
return r <= 0 || s <= 0 || i <= 0 ? null : r > 999 ? new Date(Date.UTC(r, s - 1, i, 0, 0, 0, 0)) : new Date(Date.UTC(i, r - 1, s, 0, 0, 0, 0));
|
|
1851
1851
|
}
|
|
1852
|
-
function
|
|
1852
|
+
function si(n) {
|
|
1853
1853
|
const [e, t] = n.split(" ");
|
|
1854
1854
|
return /* @__PURE__ */ new Date(e + "T" + t + "Z");
|
|
1855
1855
|
}
|
|
1856
|
-
function
|
|
1856
|
+
function ii(n) {
|
|
1857
1857
|
const [e, t] = n.split(" ");
|
|
1858
1858
|
return /* @__PURE__ */ new Date(e + "T" + t + "Z");
|
|
1859
1859
|
}
|
|
1860
|
-
function
|
|
1860
|
+
function oi(n) {
|
|
1861
1861
|
return new Date(n);
|
|
1862
1862
|
}
|
|
1863
|
-
function
|
|
1863
|
+
function ai(n) {
|
|
1864
1864
|
const e = /^(\w{3}) (\w{3}) (\d{2}) (\d{4})$/;
|
|
1865
1865
|
if (!n.match(e))
|
|
1866
1866
|
throw new Error(`Unable to parse \`${n}\` as a date.`);
|
|
1867
1867
|
const r = /* @__PURE__ */ new Date(n + " UTC");
|
|
1868
1868
|
return new Date(Date.UTC(r.getUTCFullYear(), r.getUTCMonth(), r.getUTCDate(), 0, 0, 0, 0));
|
|
1869
1869
|
}
|
|
1870
|
-
function
|
|
1870
|
+
function ci(n) {
|
|
1871
1871
|
const e = /^(.+T.+)([+-])(\d{2})$/, t = n.match(e);
|
|
1872
1872
|
if (t) {
|
|
1873
1873
|
const [, r, s, i] = t, o = `${r}${s}${i}:00`;
|
|
@@ -1875,7 +1875,7 @@ function ai(n) {
|
|
|
1875
1875
|
}
|
|
1876
1876
|
return null;
|
|
1877
1877
|
}
|
|
1878
|
-
function
|
|
1878
|
+
function ui(n) {
|
|
1879
1879
|
const e = /^(\d+)-(\d{1,2})-(\d{1,2})([ T])(.+)$/, t = n.match(e);
|
|
1880
1880
|
if (t) {
|
|
1881
1881
|
const [, r, s, i, o, a] = t, c = s.padStart(2, "0"), u = i.padStart(2, "0"), l = `${r}-${c}-${u}T${a}`;
|
|
@@ -1883,14 +1883,14 @@ function ci(n) {
|
|
|
1883
1883
|
}
|
|
1884
1884
|
return null;
|
|
1885
1885
|
}
|
|
1886
|
-
function
|
|
1886
|
+
function li(n) {
|
|
1887
1887
|
const [e, t] = n.split(", "), [r, s, i] = e.split("/").map(Number), o = t.match(/(\d{1,2}):(\d{2}):(\d{2}) (AM|PM)/);
|
|
1888
1888
|
if (!o)
|
|
1889
1889
|
throw new Error(`Unable to parse time from: ${n}`);
|
|
1890
1890
|
let [, a, c, u, l] = o;
|
|
1891
1891
|
return a = Number(a), c = Number(c), u = Number(u), l === "PM" && a !== 12 ? a += 12 : l === "AM" && a === 12 && (a = 0), new Date(Date.UTC(i, r - 1, s, a, c, u));
|
|
1892
1892
|
}
|
|
1893
|
-
function
|
|
1893
|
+
function fi(n) {
|
|
1894
1894
|
switch (n) {
|
|
1895
1895
|
case "epoch":
|
|
1896
1896
|
return /* @__PURE__ */ new Date(0);
|
|
@@ -1902,28 +1902,28 @@ function li(n) {
|
|
|
1902
1902
|
return null;
|
|
1903
1903
|
}
|
|
1904
1904
|
}
|
|
1905
|
-
function
|
|
1906
|
-
const e = n.match(
|
|
1905
|
+
function di(n) {
|
|
1906
|
+
const e = n.match(Vn);
|
|
1907
1907
|
if (!e)
|
|
1908
1908
|
return null;
|
|
1909
|
-
const [t] = e, r =
|
|
1909
|
+
const [t] = e, r = Xs[t], s = new Date(n.replace(Vn, "Z"));
|
|
1910
1910
|
return new Date(s.getTime() - r * 1e3);
|
|
1911
1911
|
}
|
|
1912
|
-
const
|
|
1913
|
-
|
|
1914
|
-
si,
|
|
1915
|
-
oi,
|
|
1916
|
-
ui,
|
|
1912
|
+
const hi = [
|
|
1913
|
+
ri,
|
|
1917
1914
|
ii,
|
|
1918
|
-
ei,
|
|
1919
1915
|
ai,
|
|
1920
|
-
ri,
|
|
1921
|
-
Xs,
|
|
1922
1916
|
li,
|
|
1917
|
+
oi,
|
|
1918
|
+
ti,
|
|
1919
|
+
ci,
|
|
1920
|
+
si,
|
|
1921
|
+
ei,
|
|
1923
1922
|
fi,
|
|
1924
|
-
|
|
1923
|
+
di,
|
|
1924
|
+
ui
|
|
1925
1925
|
];
|
|
1926
|
-
function
|
|
1926
|
+
function pi(n, e) {
|
|
1927
1927
|
try {
|
|
1928
1928
|
const t = n(e);
|
|
1929
1929
|
return t instanceof Date && !isNaN(t.getTime()) ? t : null;
|
|
@@ -1931,18 +1931,18 @@ function hi(n, e) {
|
|
|
1931
1931
|
return null;
|
|
1932
1932
|
}
|
|
1933
1933
|
}
|
|
1934
|
-
function
|
|
1935
|
-
for (const e of
|
|
1936
|
-
const t =
|
|
1934
|
+
function Jt(n) {
|
|
1935
|
+
for (const e of hi) {
|
|
1936
|
+
const t = pi(e, n);
|
|
1937
1937
|
if (t)
|
|
1938
1938
|
return t;
|
|
1939
1939
|
}
|
|
1940
1940
|
return null;
|
|
1941
1941
|
}
|
|
1942
|
-
function
|
|
1942
|
+
function yi(n) {
|
|
1943
1943
|
try {
|
|
1944
1944
|
const e = JSON.parse(n);
|
|
1945
|
-
return typeof e == "string" ?
|
|
1945
|
+
return typeof e == "string" ? Jt(e) : null;
|
|
1946
1946
|
} catch {
|
|
1947
1947
|
return null;
|
|
1948
1948
|
}
|
|
@@ -1954,7 +1954,7 @@ function St(n) {
|
|
|
1954
1954
|
if (n instanceof Date)
|
|
1955
1955
|
return n;
|
|
1956
1956
|
if (typeof n == "string") {
|
|
1957
|
-
const e =
|
|
1957
|
+
const e = Jt(n) || yi(n) || Jt(n.trim());
|
|
1958
1958
|
if (!e)
|
|
1959
1959
|
throw new Error(`Unable to parse \`${n}\` as a date.`);
|
|
1960
1960
|
return e;
|
|
@@ -1994,7 +1994,7 @@ class Ie {
|
|
|
1994
1994
|
return this._blobAttrs;
|
|
1995
1995
|
this._blobAttrs = /* @__PURE__ */ new Map();
|
|
1996
1996
|
for (const e of Object.values(this.attrs))
|
|
1997
|
-
if (
|
|
1997
|
+
if (gn(e)) {
|
|
1998
1998
|
const [t, r, s] = e["forward-identity"];
|
|
1999
1999
|
se(this.blobAttrs, [r, s], e);
|
|
2000
2000
|
}
|
|
@@ -2038,13 +2038,13 @@ class Ie {
|
|
|
2038
2038
|
return { attrs: this.attrs, linkIndex: this.linkIndex };
|
|
2039
2039
|
}
|
|
2040
2040
|
}
|
|
2041
|
-
function
|
|
2041
|
+
function bi(n) {
|
|
2042
2042
|
return n.cardinality === "one";
|
|
2043
2043
|
}
|
|
2044
|
-
function
|
|
2044
|
+
function _n(n) {
|
|
2045
2045
|
return n["value-type"] === "ref";
|
|
2046
2046
|
}
|
|
2047
|
-
function
|
|
2047
|
+
function gn(n) {
|
|
2048
2048
|
return n["value-type"] === "blob";
|
|
2049
2049
|
}
|
|
2050
2050
|
function We(n, e) {
|
|
@@ -2070,7 +2070,7 @@ function se(n, e, t) {
|
|
|
2070
2070
|
}
|
|
2071
2071
|
s > -1 && r.set(e[s], t);
|
|
2072
2072
|
}
|
|
2073
|
-
function
|
|
2073
|
+
function Rr(n, e, t) {
|
|
2074
2074
|
const r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
|
|
2075
2075
|
for (const o of e) {
|
|
2076
2076
|
let [a, c, u] = o;
|
|
@@ -2079,11 +2079,11 @@ function Mr(n, e, t) {
|
|
|
2079
2079
|
console.warn("no such attr", c, a);
|
|
2080
2080
|
continue;
|
|
2081
2081
|
}
|
|
2082
|
-
l["checked-data-type"] === "date" && t && (u = St(u), o[2] = u),
|
|
2082
|
+
l["checked-data-type"] === "date" && t && (u = St(u), o[2] = u), _n(l) && se(i, [u, c, a], o), se(r, [a, c, u], o), se(s, [c, a, u], o);
|
|
2083
2083
|
}
|
|
2084
2084
|
return { eav: r, aev: s, vae: i };
|
|
2085
2085
|
}
|
|
2086
|
-
function
|
|
2086
|
+
function jr(n) {
|
|
2087
2087
|
return {
|
|
2088
2088
|
triples: ie(n.eav, 3),
|
|
2089
2089
|
cardinalityInference: n.cardinalityInference,
|
|
@@ -2091,20 +2091,20 @@ function Rr(n) {
|
|
|
2091
2091
|
version: 1
|
|
2092
2092
|
};
|
|
2093
2093
|
}
|
|
2094
|
-
function
|
|
2094
|
+
function Dr(n, e) {
|
|
2095
2095
|
return Je(n, e.triples, e.cardinalityInference, e.useDateObjects);
|
|
2096
2096
|
}
|
|
2097
|
-
function
|
|
2097
|
+
function $r(n, e) {
|
|
2098
2098
|
if (n)
|
|
2099
2099
|
return new Ie(n.attrs, n.linkIndex);
|
|
2100
2100
|
if (e && "__type" in e)
|
|
2101
2101
|
return new Ie(e.attrs, e.linkIndex);
|
|
2102
2102
|
}
|
|
2103
|
-
function
|
|
2103
|
+
function _i(n, e) {
|
|
2104
2104
|
return We(n.eav, [e]) !== void 0;
|
|
2105
2105
|
}
|
|
2106
2106
|
function Je(n, e, t, r) {
|
|
2107
|
-
const s =
|
|
2107
|
+
const s = Rr(n, e, r);
|
|
2108
2108
|
return s.cardinalityInference = t, s.useDateObjects = r, s;
|
|
2109
2109
|
}
|
|
2110
2110
|
function nt(n, e) {
|
|
@@ -2134,21 +2134,21 @@ function nt(n, e) {
|
|
|
2134
2134
|
return [t, ...a];
|
|
2135
2135
|
}
|
|
2136
2136
|
}
|
|
2137
|
-
function
|
|
2137
|
+
function xr(n, e, t) {
|
|
2138
2138
|
const r = nt(n, t);
|
|
2139
2139
|
if (!r)
|
|
2140
2140
|
return;
|
|
2141
2141
|
const [s, i, o] = r, a = e.getAttr(i);
|
|
2142
|
-
a && (pe(n.eav, [s, i, o]), pe(n.aev, [i, s, o]),
|
|
2142
|
+
a && (pe(n.eav, [s, i, o]), pe(n.aev, [i, s, o]), _n(a) && pe(n.vae, [o, i, s]));
|
|
2143
2143
|
}
|
|
2144
|
-
let
|
|
2145
|
-
function
|
|
2144
|
+
let gi = 0;
|
|
2145
|
+
function Ur(n, e, t) {
|
|
2146
2146
|
const [r, s, i] = t;
|
|
2147
2147
|
let o;
|
|
2148
2148
|
const a = We(n.eav, [r, s, i]);
|
|
2149
|
-
return a && (o = a[3]), o || Date.now() * 10 +
|
|
2149
|
+
return a && (o = a[3]), o || Date.now() * 10 + gi++;
|
|
2150
2150
|
}
|
|
2151
|
-
function
|
|
2151
|
+
function Lr(n, e, t) {
|
|
2152
2152
|
const r = nt(n, t);
|
|
2153
2153
|
if (!r)
|
|
2154
2154
|
return;
|
|
@@ -2157,10 +2157,10 @@ function Ur(n, e, t) {
|
|
|
2157
2157
|
if (!a)
|
|
2158
2158
|
return;
|
|
2159
2159
|
a["checked-data-type"] === "date" && n.useDateObjects && (o = St(o));
|
|
2160
|
-
const c = We(n.eav, [s, i, o]), u = (c == null ? void 0 : c[3]) ??
|
|
2161
|
-
|
|
2160
|
+
const c = We(n.eav, [s, i, o]), u = (c == null ? void 0 : c[3]) ?? Ur(n, a, r), l = [s, i, o, u];
|
|
2161
|
+
bi(a) ? (se(n.eav, [s, i], /* @__PURE__ */ new Map([[o, l]])), se(n.aev, [i, s], /* @__PURE__ */ new Map([[o, l]]))) : (se(n.eav, [s, i, o], l), se(n.aev, [i, s, o], l)), _n(a) && se(n.vae, [o, i, s], l);
|
|
2162
2162
|
}
|
|
2163
|
-
function
|
|
2163
|
+
function mi(n, e, t) {
|
|
2164
2164
|
var y;
|
|
2165
2165
|
const r = nt(n, t);
|
|
2166
2166
|
if (!r)
|
|
@@ -2168,7 +2168,7 @@ function gi(n, e, t) {
|
|
|
2168
2168
|
const [s, i, o] = r, a = e.getAttr(i);
|
|
2169
2169
|
if (!a)
|
|
2170
2170
|
return;
|
|
2171
|
-
if (!
|
|
2171
|
+
if (!gn(a))
|
|
2172
2172
|
throw new Error("merge operation is not supported for links");
|
|
2173
2173
|
const c = We(n.eav, [s, i]);
|
|
2174
2174
|
if (!c)
|
|
@@ -2176,15 +2176,15 @@ function gi(n, e, t) {
|
|
|
2176
2176
|
const u = (y = c.values().next()) == null ? void 0 : y.value;
|
|
2177
2177
|
if (!u)
|
|
2178
2178
|
return;
|
|
2179
|
-
const l = u[2], f =
|
|
2179
|
+
const l = u[2], f = Pr(l, o), p = [
|
|
2180
2180
|
s,
|
|
2181
2181
|
i,
|
|
2182
2182
|
f,
|
|
2183
|
-
|
|
2183
|
+
Ur(n, a, u)
|
|
2184
2184
|
];
|
|
2185
2185
|
se(n.eav, [s, i], /* @__PURE__ */ new Map([[f, p]])), se(n.aev, [i, s], /* @__PURE__ */ new Map([[f, p]]));
|
|
2186
2186
|
}
|
|
2187
|
-
function
|
|
2187
|
+
function Yt(n, e, t) {
|
|
2188
2188
|
var u, l;
|
|
2189
2189
|
const [r, s] = t, i = nt(n, [r]);
|
|
2190
2190
|
if (!i)
|
|
@@ -2195,7 +2195,7 @@ function Jt(n, e, t) {
|
|
|
2195
2195
|
const p = e.getAttr(f);
|
|
2196
2196
|
p && p["on-delete-reverse"] === "cascade" && ie(a.get(f), 1).forEach(([y, b, g]) => {
|
|
2197
2197
|
var T;
|
|
2198
|
-
return
|
|
2198
|
+
return Yt(n, e, [g, (T = p["reverse-identity"]) == null ? void 0 : T[1]]);
|
|
2199
2199
|
}), // Fall back to deleting everything if we've rehydrated tx-steps from
|
|
2200
2200
|
// the store that didn't set `etype` in deleteEntity
|
|
2201
2201
|
(!s || // If we don't know about the attr, let's just get rid of it
|
|
@@ -2208,53 +2208,53 @@ function Jt(n, e, t) {
|
|
|
2208
2208
|
c && c.forEach((f) => {
|
|
2209
2209
|
var T, S, _;
|
|
2210
2210
|
const [p, y, b] = f, g = e.getAttr(y);
|
|
2211
|
-
(!s || !g || ((T = g["reverse-identity"]) == null ? void 0 : T[1]) === s) && (pe(n.eav, [p, y, b]), pe(n.aev, [y, p, b]), pe(n.vae, [b, y, p])), g && g["on-delete"] === "cascade" && ((S = g["reverse-identity"]) == null ? void 0 : S[1]) === s &&
|
|
2211
|
+
(!s || !g || ((T = g["reverse-identity"]) == null ? void 0 : T[1]) === s) && (pe(n.eav, [p, y, b]), pe(n.aev, [y, p, b]), pe(n.vae, [b, y, p])), g && g["on-delete"] === "cascade" && ((S = g["reverse-identity"]) == null ? void 0 : S[1]) === s && Yt(n, e, [p, (_ = g["forward-identity"]) == null ? void 0 : _[1]]);
|
|
2212
2212
|
}), ((l = n.vae.get(o)) == null ? void 0 : l.size) === 0 && pe(n.vae, [o]);
|
|
2213
2213
|
}
|
|
2214
|
-
function
|
|
2215
|
-
const r =
|
|
2214
|
+
function Fr(n, e, t) {
|
|
2215
|
+
const r = Rr(e, t, n.useDateObjects);
|
|
2216
2216
|
Object.keys(r).forEach((s) => {
|
|
2217
2217
|
n[s] = r[s];
|
|
2218
2218
|
});
|
|
2219
2219
|
}
|
|
2220
|
-
function
|
|
2220
|
+
function wi(n, [e]) {
|
|
2221
2221
|
n.addAttr(e);
|
|
2222
2222
|
}
|
|
2223
|
-
function
|
|
2223
|
+
function Nr(n) {
|
|
2224
2224
|
return ie(n.eav, 3);
|
|
2225
2225
|
}
|
|
2226
|
-
function
|
|
2226
|
+
function Ti(n, e, [t]) {
|
|
2227
2227
|
if (!e.getAttr(t))
|
|
2228
2228
|
return;
|
|
2229
|
-
const r =
|
|
2230
|
-
e.deleteAttr(t),
|
|
2229
|
+
const r = Nr(n).filter(([s, i]) => i !== t);
|
|
2230
|
+
e.deleteAttr(t), Fr(n, e, r);
|
|
2231
2231
|
}
|
|
2232
|
-
function
|
|
2233
|
-
e.getAttr(t.id) && (e.updateAttr(t),
|
|
2232
|
+
function Si(n, e, [t]) {
|
|
2233
|
+
e.getAttr(t.id) && (e.updateAttr(t), Fr(n, e, Nr(n)));
|
|
2234
2234
|
}
|
|
2235
|
-
function
|
|
2235
|
+
function vi(n, e, t) {
|
|
2236
2236
|
const [r, ...s] = t;
|
|
2237
2237
|
switch (r) {
|
|
2238
2238
|
case "add-triple":
|
|
2239
|
-
|
|
2239
|
+
Lr(n, e, s);
|
|
2240
2240
|
break;
|
|
2241
2241
|
case "deep-merge-triple":
|
|
2242
|
-
|
|
2242
|
+
mi(n, e, s);
|
|
2243
2243
|
break;
|
|
2244
2244
|
case "retract-triple":
|
|
2245
|
-
|
|
2245
|
+
xr(n, e, s);
|
|
2246
2246
|
break;
|
|
2247
2247
|
case "delete-entity":
|
|
2248
|
-
|
|
2248
|
+
Yt(n, e, s);
|
|
2249
2249
|
break;
|
|
2250
2250
|
case "add-attr":
|
|
2251
|
-
|
|
2251
|
+
wi(e, s);
|
|
2252
2252
|
break;
|
|
2253
2253
|
case "delete-attr":
|
|
2254
|
-
|
|
2254
|
+
Ti(n, e, s);
|
|
2255
2255
|
break;
|
|
2256
2256
|
case "update-attr":
|
|
2257
|
-
|
|
2257
|
+
Si(n, e, s);
|
|
2258
2258
|
break;
|
|
2259
2259
|
case "restore-attr":
|
|
2260
2260
|
break;
|
|
@@ -2309,13 +2309,13 @@ function ut(n, e, t) {
|
|
|
2309
2309
|
}
|
|
2310
2310
|
return r;
|
|
2311
2311
|
}
|
|
2312
|
-
function
|
|
2312
|
+
function Ai(n, e, t) {
|
|
2313
2313
|
let r = "";
|
|
2314
2314
|
return n !== void 0 && (r += "e"), e !== void 0 && (r += "a"), t !== void 0 && (r += "v"), r;
|
|
2315
2315
|
}
|
|
2316
|
-
function
|
|
2316
|
+
function Oi(n, [e, t, r]) {
|
|
2317
2317
|
var i, o;
|
|
2318
|
-
switch (
|
|
2318
|
+
switch (Ai(e, t, r)) {
|
|
2319
2319
|
case "e": {
|
|
2320
2320
|
const a = n.eav.get(e);
|
|
2321
2321
|
return ie(a, 2);
|
|
@@ -2361,7 +2361,7 @@ function Ai(n, [e, t, r]) {
|
|
|
2361
2361
|
return ie(n.eav, 3);
|
|
2362
2362
|
}
|
|
2363
2363
|
}
|
|
2364
|
-
function
|
|
2364
|
+
function Ei(n, e, t) {
|
|
2365
2365
|
var s;
|
|
2366
2366
|
const r = {};
|
|
2367
2367
|
if (!e)
|
|
@@ -2381,15 +2381,15 @@ function je(n, e, t) {
|
|
|
2381
2381
|
var r;
|
|
2382
2382
|
return (r = n.revIdents.get(e)) == null ? void 0 : r.get(t);
|
|
2383
2383
|
}
|
|
2384
|
-
function
|
|
2384
|
+
function ki(n, e) {
|
|
2385
2385
|
return n.blobAttrs.get(e);
|
|
2386
2386
|
}
|
|
2387
|
-
function
|
|
2387
|
+
function Kr(n, e) {
|
|
2388
2388
|
var r;
|
|
2389
2389
|
const t = n.primaryKeys.get(e);
|
|
2390
2390
|
return t || ((r = n.forwardIdents.get(e)) == null ? void 0 : r.get("id"));
|
|
2391
2391
|
}
|
|
2392
|
-
function
|
|
2392
|
+
function Ci(n, e, t) {
|
|
2393
2393
|
const r = nt(n, t);
|
|
2394
2394
|
if (!r)
|
|
2395
2395
|
return;
|
|
@@ -2397,7 +2397,7 @@ function ki(n, e, t) {
|
|
|
2397
2397
|
if (e.getAttr(i))
|
|
2398
2398
|
return We(n.eav, [s, i]);
|
|
2399
2399
|
}
|
|
2400
|
-
function
|
|
2400
|
+
function Ii(n, e, t) {
|
|
2401
2401
|
const r = t.filter(([s, i, o, a, c]) => {
|
|
2402
2402
|
if (s !== "add-triple" && s !== "deep-merge-triple")
|
|
2403
2403
|
return !0;
|
|
@@ -2407,8 +2407,8 @@ function Ci(n, e, t) {
|
|
|
2407
2407
|
let l = !1;
|
|
2408
2408
|
const f = e.getAttr(o);
|
|
2409
2409
|
if (f) {
|
|
2410
|
-
const p =
|
|
2411
|
-
l = !!
|
|
2410
|
+
const p = Kr(e, f["forward-identity"][1]);
|
|
2411
|
+
l = !!Ci(n, e, [
|
|
2412
2412
|
i,
|
|
2413
2413
|
p == null ? void 0 : p.id,
|
|
2414
2414
|
i
|
|
@@ -2418,7 +2418,7 @@ function Ci(n, e, t) {
|
|
|
2418
2418
|
});
|
|
2419
2419
|
return mt({ store: n, attrsStore: e }, (s) => {
|
|
2420
2420
|
r.forEach((i) => {
|
|
2421
|
-
|
|
2421
|
+
vi(s.store, s.attrsStore, i);
|
|
2422
2422
|
});
|
|
2423
2423
|
}, {
|
|
2424
2424
|
mark: (s) => {
|
|
@@ -2427,28 +2427,28 @@ function Ci(n, e, t) {
|
|
|
2427
2427
|
}
|
|
2428
2428
|
});
|
|
2429
2429
|
}
|
|
2430
|
-
function
|
|
2430
|
+
function Pi(n) {
|
|
2431
2431
|
return typeof n == "string" && n.startsWith("?");
|
|
2432
2432
|
}
|
|
2433
|
-
function
|
|
2433
|
+
function Mi(n, e, t) {
|
|
2434
2434
|
if (t.hasOwnProperty(n)) {
|
|
2435
2435
|
const r = t[n];
|
|
2436
|
-
return
|
|
2436
|
+
return qr(r, e, t);
|
|
2437
2437
|
}
|
|
2438
2438
|
return { ...t, [n]: e };
|
|
2439
2439
|
}
|
|
2440
|
-
function
|
|
2440
|
+
function Bn(n, e, t) {
|
|
2441
2441
|
return n === e ? t : null;
|
|
2442
2442
|
}
|
|
2443
|
-
function
|
|
2443
|
+
function Ri(n) {
|
|
2444
2444
|
switch (typeof n) {
|
|
2445
2445
|
case "string":
|
|
2446
|
-
return n.startsWith("?") ?
|
|
2446
|
+
return n.startsWith("?") ? Mi : Bn;
|
|
2447
2447
|
default:
|
|
2448
|
-
return
|
|
2448
|
+
return Bn;
|
|
2449
2449
|
}
|
|
2450
2450
|
}
|
|
2451
|
-
const
|
|
2451
|
+
const ji = [
|
|
2452
2452
|
"in",
|
|
2453
2453
|
"$in",
|
|
2454
2454
|
"$not",
|
|
@@ -2456,77 +2456,77 @@ const Ri = [
|
|
|
2456
2456
|
"$comparator"
|
|
2457
2457
|
// covers all of $gt, $lt, etc.
|
|
2458
2458
|
];
|
|
2459
|
-
function
|
|
2460
|
-
for (const e of
|
|
2459
|
+
function Di(n) {
|
|
2460
|
+
for (const e of ji)
|
|
2461
2461
|
if (n.hasOwnProperty(e))
|
|
2462
2462
|
return !0;
|
|
2463
2463
|
return !1;
|
|
2464
2464
|
}
|
|
2465
|
-
function
|
|
2466
|
-
return t ? typeof n == "object" ?
|
|
2465
|
+
function qr(n, e, t) {
|
|
2466
|
+
return t ? typeof n == "object" ? Di(n) ? t : null : Ri(n)(n, e, t) : null;
|
|
2467
2467
|
}
|
|
2468
|
-
function
|
|
2468
|
+
function $i(n, e, t) {
|
|
2469
2469
|
return n.reduce((r, s, i) => {
|
|
2470
2470
|
const o = e[i];
|
|
2471
|
-
return
|
|
2471
|
+
return qr(s, o, r);
|
|
2472
2472
|
}, t);
|
|
2473
2473
|
}
|
|
2474
|
-
function $i(n, e, t) {
|
|
2475
|
-
return Li(n, e, t).map((r) => Di(e, r, t)).filter((r) => r);
|
|
2476
|
-
}
|
|
2477
2474
|
function xi(n, e, t) {
|
|
2478
|
-
return
|
|
2475
|
+
return Fi(n, e, t).map((r) => $i(e, r, t)).filter((r) => r);
|
|
2479
2476
|
}
|
|
2480
|
-
function
|
|
2481
|
-
return e.reduce((r, s) =>
|
|
2477
|
+
function Ui(n, e, t) {
|
|
2478
|
+
return e.or ? e.or.patterns.flatMap((r) => Zt(n, r, t)) : e.and ? e.and.patterns.reduce((r, s) => Zt(n, s, r), t) : t.flatMap((r) => xi(n, e, r));
|
|
2482
2479
|
}
|
|
2483
|
-
function
|
|
2484
|
-
return
|
|
2480
|
+
function Zt(n, e, t = [{}]) {
|
|
2481
|
+
return e.reduce((r, s) => Ui(n, s, r), t);
|
|
2485
2482
|
}
|
|
2486
|
-
function
|
|
2487
|
-
return
|
|
2483
|
+
function mn(n, e) {
|
|
2484
|
+
return Array.isArray(e) ? e.map((t) => mn(n, t)) : Pi(e) ? n[e] : e;
|
|
2488
2485
|
}
|
|
2489
|
-
function Li(n, e, t) {
|
|
2490
|
-
return
|
|
2486
|
+
function Li(n, { find: e, where: t }) {
|
|
2487
|
+
return Zt(n, t).map((s) => mn(s, e));
|
|
2491
2488
|
}
|
|
2492
|
-
|
|
2489
|
+
function Fi(n, e, t) {
|
|
2490
|
+
return Oi(n, mn(t, e));
|
|
2491
|
+
}
|
|
2492
|
+
const Ni = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
|
|
2493
2493
|
function Ke(n) {
|
|
2494
|
-
return typeof n == "string" &&
|
|
2494
|
+
return typeof n == "string" && Ni.test(n);
|
|
2495
2495
|
}
|
|
2496
2496
|
const H = [];
|
|
2497
2497
|
for (let n = 0; n < 256; ++n)
|
|
2498
2498
|
H.push((n + 256).toString(16).slice(1));
|
|
2499
|
-
function
|
|
2499
|
+
function Ki(n, e = 0) {
|
|
2500
2500
|
return (H[n[e + 0]] + H[n[e + 1]] + H[n[e + 2]] + H[n[e + 3]] + "-" + H[n[e + 4]] + H[n[e + 5]] + "-" + H[n[e + 6]] + H[n[e + 7]] + "-" + H[n[e + 8]] + H[n[e + 9]] + "-" + H[n[e + 10]] + H[n[e + 11]] + H[n[e + 12]] + H[n[e + 13]] + H[n[e + 14]] + H[n[e + 15]]).toLowerCase();
|
|
2501
2501
|
}
|
|
2502
2502
|
let Dt;
|
|
2503
|
-
const
|
|
2504
|
-
function
|
|
2503
|
+
const qi = new Uint8Array(16);
|
|
2504
|
+
function Wi() {
|
|
2505
2505
|
if (!Dt) {
|
|
2506
2506
|
if (typeof crypto > "u" || !crypto.getRandomValues)
|
|
2507
2507
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
2508
2508
|
Dt = crypto.getRandomValues.bind(crypto);
|
|
2509
2509
|
}
|
|
2510
|
-
return Dt(
|
|
2510
|
+
return Dt(qi);
|
|
2511
2511
|
}
|
|
2512
|
-
const
|
|
2513
|
-
function
|
|
2512
|
+
const zi = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Qn = { randomUUID: zi };
|
|
2513
|
+
function Vi(n, e, t) {
|
|
2514
2514
|
var s;
|
|
2515
|
-
if (
|
|
2516
|
-
return
|
|
2515
|
+
if (Qn.randomUUID && !n)
|
|
2516
|
+
return Qn.randomUUID();
|
|
2517
2517
|
n = n || {};
|
|
2518
|
-
const r = n.random ?? ((s = n.rng) == null ? void 0 : s.call(n)) ??
|
|
2518
|
+
const r = n.random ?? ((s = n.rng) == null ? void 0 : s.call(n)) ?? Wi();
|
|
2519
2519
|
if (r.length < 16)
|
|
2520
2520
|
throw new Error("Random bytes length must be >= 16");
|
|
2521
|
-
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128,
|
|
2521
|
+
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, Ki(r);
|
|
2522
2522
|
}
|
|
2523
|
-
function
|
|
2523
|
+
function Gn(n) {
|
|
2524
2524
|
const e = n.replace(/-/g, ""), t = [];
|
|
2525
2525
|
for (let r = 0; r < e.length; r += 2)
|
|
2526
2526
|
t.push(parseInt(e.substring(r, r + 2), 16));
|
|
2527
2527
|
return t;
|
|
2528
2528
|
}
|
|
2529
|
-
function
|
|
2529
|
+
function Bi(n, e) {
|
|
2530
2530
|
for (let t = 0; t < n.length; t++) {
|
|
2531
2531
|
if (n[t] < e[t])
|
|
2532
2532
|
return -1;
|
|
@@ -2535,17 +2535,17 @@ function Vi(n, e) {
|
|
|
2535
2535
|
}
|
|
2536
2536
|
return 0;
|
|
2537
2537
|
}
|
|
2538
|
-
function
|
|
2539
|
-
return
|
|
2538
|
+
function Qi(n, e) {
|
|
2539
|
+
return Bi(Gn(n), Gn(e));
|
|
2540
2540
|
}
|
|
2541
2541
|
function L() {
|
|
2542
|
-
return
|
|
2542
|
+
return Vi();
|
|
2543
2543
|
}
|
|
2544
|
-
function
|
|
2544
|
+
function Gi(n, e) {
|
|
2545
2545
|
return n.localeCompare(e);
|
|
2546
2546
|
}
|
|
2547
|
-
function
|
|
2548
|
-
let n =
|
|
2547
|
+
function Hi() {
|
|
2548
|
+
let n = Gi;
|
|
2549
2549
|
if (typeof Intl == "object" && Intl.hasOwnProperty("Collator"))
|
|
2550
2550
|
try {
|
|
2551
2551
|
n = Intl.Collator("en-US").compare;
|
|
@@ -2553,10 +2553,10 @@ function Gi() {
|
|
|
2553
2553
|
}
|
|
2554
2554
|
return n;
|
|
2555
2555
|
}
|
|
2556
|
-
const
|
|
2557
|
-
let
|
|
2556
|
+
const Ji = Hi();
|
|
2557
|
+
let Yi = !0, Zi = 0;
|
|
2558
2558
|
function Xe(n) {
|
|
2559
|
-
return vt(`_${n}`,
|
|
2559
|
+
return vt(`_${n}`, Zi++);
|
|
2560
2560
|
}
|
|
2561
2561
|
function vt(n, e) {
|
|
2562
2562
|
return `?${n}-${e}`;
|
|
@@ -2566,27 +2566,27 @@ class qe extends Error {
|
|
|
2566
2566
|
super(e), this.name = "AttrNotFoundError";
|
|
2567
2567
|
}
|
|
2568
2568
|
}
|
|
2569
|
-
function
|
|
2570
|
-
const t =
|
|
2569
|
+
function Xi(n, e) {
|
|
2570
|
+
const t = Kr(n, e);
|
|
2571
2571
|
if (!t)
|
|
2572
2572
|
throw new qe(`Could not find id attr for ${e}`);
|
|
2573
2573
|
return t;
|
|
2574
2574
|
}
|
|
2575
|
-
function
|
|
2576
|
-
return [
|
|
2575
|
+
function Hn(n, e, t, r) {
|
|
2576
|
+
return [eo(n, e, t, r)];
|
|
2577
2577
|
}
|
|
2578
|
-
function
|
|
2578
|
+
function eo(n, e, t, r) {
|
|
2579
2579
|
return [
|
|
2580
2580
|
n(t, r),
|
|
2581
|
-
|
|
2581
|
+
Xi(e, t).id,
|
|
2582
2582
|
n(t, r),
|
|
2583
2583
|
n("time", r)
|
|
2584
2584
|
];
|
|
2585
2585
|
}
|
|
2586
|
-
function
|
|
2586
|
+
function to(n, e, t) {
|
|
2587
2587
|
return n.map((r) => r === e ? t : r);
|
|
2588
2588
|
}
|
|
2589
|
-
function
|
|
2589
|
+
function Wr(n, e, t, r, s) {
|
|
2590
2590
|
const i = W(e, t, s), o = je(e, t, s), a = i || o;
|
|
2591
2591
|
if (!a)
|
|
2592
2592
|
throw new qe(`Could not find attr for ${[t, s]}`);
|
|
@@ -2605,7 +2605,7 @@ function qr(n, e, t, r, s) {
|
|
|
2605
2605
|
];
|
|
2606
2606
|
return [i ? f : u, p, y, a, !!i];
|
|
2607
2607
|
}
|
|
2608
|
-
function
|
|
2608
|
+
function Jn(n, e) {
|
|
2609
2609
|
if (typeof e != "string")
|
|
2610
2610
|
return function(o) {
|
|
2611
2611
|
return !1;
|
|
@@ -2615,7 +2615,7 @@ function Hn(n, e) {
|
|
|
2615
2615
|
return typeof o != "string" ? !1 : s.test(o);
|
|
2616
2616
|
};
|
|
2617
2617
|
}
|
|
2618
|
-
function
|
|
2618
|
+
function no(n, e) {
|
|
2619
2619
|
if (typeof e != "object" || e.hasOwnProperty("$in") || e.hasOwnProperty("in"))
|
|
2620
2620
|
return e;
|
|
2621
2621
|
const t = n["checked-data-type"] === "date";
|
|
@@ -2656,7 +2656,7 @@ function to(n, e) {
|
|
|
2656
2656
|
}
|
|
2657
2657
|
};
|
|
2658
2658
|
if (e.hasOwnProperty("$like")) {
|
|
2659
|
-
const r =
|
|
2659
|
+
const r = Jn(!0, e.$like);
|
|
2660
2660
|
return {
|
|
2661
2661
|
$comparator: !0,
|
|
2662
2662
|
$op: function(i) {
|
|
@@ -2665,7 +2665,7 @@ function to(n, e) {
|
|
|
2665
2665
|
};
|
|
2666
2666
|
}
|
|
2667
2667
|
if (e.hasOwnProperty("$ilike")) {
|
|
2668
|
-
const r =
|
|
2668
|
+
const r = Jn(!1, e.$ilike);
|
|
2669
2669
|
return {
|
|
2670
2670
|
$comparator: !0,
|
|
2671
2671
|
$op: function(i) {
|
|
@@ -2675,7 +2675,7 @@ function to(n, e) {
|
|
|
2675
2675
|
}
|
|
2676
2676
|
return e;
|
|
2677
2677
|
}
|
|
2678
|
-
function
|
|
2678
|
+
function ro(n, e, t, r, s, i) {
|
|
2679
2679
|
const o = W(e, t, s), a = je(e, t, s), c = o || a;
|
|
2680
2680
|
if (!c)
|
|
2681
2681
|
throw new qe(`No attr for etype = ${t} label = ${s}`);
|
|
@@ -2693,65 +2693,65 @@ function no(n, e, t, r, s, i) {
|
|
|
2693
2693
|
return o ? [
|
|
2694
2694
|
n(t, r),
|
|
2695
2695
|
c.id,
|
|
2696
|
-
|
|
2696
|
+
no(c, i),
|
|
2697
2697
|
Xe("time")
|
|
2698
2698
|
] : [i, c.id, n(t, r), Xe("time")];
|
|
2699
2699
|
}
|
|
2700
|
-
function
|
|
2700
|
+
function so(n, e, t, r, s) {
|
|
2701
2701
|
const [i, o, a] = s.reduce((c, u) => {
|
|
2702
|
-
const [l, f, p] = c, [y, b, g] =
|
|
2702
|
+
const [l, f, p] = c, [y, b, g] = Wr(n, e, l, f, u);
|
|
2703
2703
|
return [y, b, [...p, g]];
|
|
2704
2704
|
}, [t, r, []]);
|
|
2705
2705
|
return [i, o, a];
|
|
2706
2706
|
}
|
|
2707
|
-
function
|
|
2708
|
-
const o = s.slice(0, s.length - 1), a = s[s.length - 1], [c, u, l] =
|
|
2707
|
+
function Xt(n, e, t, r, s, i) {
|
|
2708
|
+
const o = s.slice(0, s.length - 1), a = s[s.length - 1], [c, u, l] = so(n, e, t, r, o), f = ro(n, e, c, u, a, i);
|
|
2709
2709
|
return l.concat([f]);
|
|
2710
2710
|
}
|
|
2711
|
-
function
|
|
2711
|
+
function io(n, e) {
|
|
2712
2712
|
return e ? [e].concat(n) : n;
|
|
2713
2713
|
}
|
|
2714
|
-
function
|
|
2714
|
+
function oo([n, e]) {
|
|
2715
2715
|
return n === "or" && Array.isArray(e);
|
|
2716
2716
|
}
|
|
2717
|
-
function
|
|
2717
|
+
function ao([n, e]) {
|
|
2718
2718
|
return n === "and" && Array.isArray(e);
|
|
2719
2719
|
}
|
|
2720
|
-
function
|
|
2720
|
+
function co(n, e, t) {
|
|
2721
2721
|
return (r, s) => {
|
|
2722
2722
|
const i = n(r, s);
|
|
2723
2723
|
return e == i ? i : `${i}-${t}`;
|
|
2724
2724
|
};
|
|
2725
2725
|
}
|
|
2726
|
-
function
|
|
2726
|
+
function Yn(n, e, t, r, s, i) {
|
|
2727
2727
|
const o = n(r, s), a = i.map((c, u) => {
|
|
2728
|
-
const l =
|
|
2729
|
-
return
|
|
2728
|
+
const l = co(n, o, u);
|
|
2729
|
+
return zr(l, t, r, s, c);
|
|
2730
2730
|
});
|
|
2731
2731
|
return { [e]: { patterns: a, joinSym: o } };
|
|
2732
2732
|
}
|
|
2733
|
-
function
|
|
2733
|
+
function uo(n) {
|
|
2734
2734
|
const e = [];
|
|
2735
2735
|
for (let t = 1; t <= n.length; t++)
|
|
2736
2736
|
e.push(n.slice(0, t));
|
|
2737
2737
|
return e;
|
|
2738
2738
|
}
|
|
2739
|
-
function
|
|
2740
|
-
return
|
|
2739
|
+
function Zn(n, e, t, r, s) {
|
|
2740
|
+
return uo(s).map((i) => Xt(n, e, t, r, i, {
|
|
2741
2741
|
$isNull: !0
|
|
2742
2742
|
}));
|
|
2743
2743
|
}
|
|
2744
|
-
function
|
|
2744
|
+
function zr(n, e, t, r, s) {
|
|
2745
2745
|
return Object.entries(s).flatMap(([i, o]) => {
|
|
2746
|
-
if (io([i, o]))
|
|
2747
|
-
return Jn(n, "or", e, t, r, o);
|
|
2748
2746
|
if (oo([i, o]))
|
|
2749
|
-
return
|
|
2747
|
+
return Yn(n, "or", e, t, r, o);
|
|
2748
|
+
if (ao([i, o]))
|
|
2749
|
+
return Yn(n, "and", e, t, r, o);
|
|
2750
2750
|
if (i === "$entityIdStartsWith")
|
|
2751
2751
|
return [];
|
|
2752
2752
|
const a = i.split(".");
|
|
2753
2753
|
if (o != null && o.hasOwnProperty("$ne") && (o = { ...o, $not: o.$ne }, delete o.$ne), o != null && o.hasOwnProperty("$not")) {
|
|
2754
|
-
const c =
|
|
2754
|
+
const c = Xt(n, e, t, r, a, o), u = Zn(n, e, t, r, a);
|
|
2755
2755
|
return [
|
|
2756
2756
|
{
|
|
2757
2757
|
or: {
|
|
@@ -2764,32 +2764,32 @@ function Wr(n, e, t, r, s) {
|
|
|
2764
2764
|
return o != null && o.hasOwnProperty("$isNull") && o.$isNull === !0 && a.length > 1 ? [
|
|
2765
2765
|
{
|
|
2766
2766
|
or: {
|
|
2767
|
-
patterns:
|
|
2767
|
+
patterns: Zn(n, e, t, r, a),
|
|
2768
2768
|
joinSym: n(t, r)
|
|
2769
2769
|
}
|
|
2770
2770
|
}
|
|
2771
|
-
] :
|
|
2771
|
+
] : Xt(n, e, t, r, a, o);
|
|
2772
2772
|
});
|
|
2773
2773
|
}
|
|
2774
|
-
function
|
|
2774
|
+
function lo(n, e, t, r) {
|
|
2775
2775
|
const s = vt;
|
|
2776
|
-
return r ?
|
|
2776
|
+
return r ? zr(s, n, e, t, r).concat(Hn(s, n, e, t)) : Hn(s, n, e, t);
|
|
2777
2777
|
}
|
|
2778
|
-
function
|
|
2778
|
+
function fo(n, e, t) {
|
|
2779
2779
|
return [n(e, t), n("time", t)];
|
|
2780
2780
|
}
|
|
2781
|
-
function
|
|
2782
|
-
const [o, a, c, u, l] =
|
|
2781
|
+
function ho(n, e, t, r, s, i) {
|
|
2782
|
+
const [o, a, c, u, l] = Wr(n, e, t, r, s), f = to(c, n(t, r), i);
|
|
2783
2783
|
return [o, a, f, u, l];
|
|
2784
2784
|
}
|
|
2785
|
-
function
|
|
2785
|
+
function po(n, e, t, { etype: r, level: s, form: i }, o) {
|
|
2786
2786
|
const a = Object.keys(i).filter((c) => c !== "$");
|
|
2787
2787
|
return a.length ? Object.entries(o).map(function([u, l]) {
|
|
2788
2788
|
return a.map(function(y) {
|
|
2789
2789
|
var g, T, S;
|
|
2790
2790
|
const b = !!(e.cardinalityInference && ((S = (T = (g = t.linkIndex) == null ? void 0 : g[r]) == null ? void 0 : T[y]) != null && S.isSingular));
|
|
2791
2791
|
try {
|
|
2792
|
-
const [_, w, C] =
|
|
2792
|
+
const [_, w, C] = ho(n, t, r, s, y, u), v = Br(e, t, {
|
|
2793
2793
|
etype: _,
|
|
2794
2794
|
level: w,
|
|
2795
2795
|
form: i[y],
|
|
@@ -2806,48 +2806,48 @@ function ho(n, e, t, { etype: r, level: s, form: i }, o) {
|
|
|
2806
2806
|
}, l);
|
|
2807
2807
|
}) : Object.values(o);
|
|
2808
2808
|
}
|
|
2809
|
-
function
|
|
2810
|
-
return t === "string" ?
|
|
2809
|
+
function yo(n, e, t) {
|
|
2810
|
+
return t === "string" ? Ji(n, e) : n > e ? 1 : -1;
|
|
2811
2811
|
}
|
|
2812
2812
|
function Ye(n, e, t, r, s) {
|
|
2813
|
-
return e === r || e == null && r == null ?
|
|
2813
|
+
return e === r || e == null && r == null ? Qi(n, t) : r == null ? 1 : e == null ? -1 : yo(e, r, s);
|
|
2814
2814
|
}
|
|
2815
2815
|
function wt([n, e], [t, r], s) {
|
|
2816
2816
|
return Ye(n, e, t, r, s);
|
|
2817
2817
|
}
|
|
2818
|
-
function
|
|
2818
|
+
function en(n) {
|
|
2819
2819
|
return n == null ? n : new Date(n).getTime();
|
|
2820
2820
|
}
|
|
2821
|
-
function
|
|
2821
|
+
function bo(n, e, t, r) {
|
|
2822
2822
|
var b;
|
|
2823
2823
|
const [s, i, o, a] = n, c = t === "desc" ? 1 : -1;
|
|
2824
2824
|
if (((b = e["forward-identity"]) == null ? void 0 : b[2]) === "id")
|
|
2825
2825
|
return wt(r, [s, a], null) === c;
|
|
2826
|
-
const [u, l] = r, f = e["checked-data-type"], p = f === "date" ?
|
|
2826
|
+
const [u, l] = r, f = e["checked-data-type"], p = f === "date" ? en(l) : l, y = f === "date" ? en(o) : o;
|
|
2827
2827
|
return wt([u, p], [s, y], f) === c;
|
|
2828
2828
|
}
|
|
2829
|
-
function
|
|
2829
|
+
function _o(n, e) {
|
|
2830
2830
|
const t = e[1];
|
|
2831
2831
|
return n.getAttr(t);
|
|
2832
2832
|
}
|
|
2833
|
-
function
|
|
2833
|
+
function go(n, e, t) {
|
|
2834
2834
|
const r = Object.keys(t)[0];
|
|
2835
2835
|
return W(n, e, r);
|
|
2836
2836
|
}
|
|
2837
|
-
function
|
|
2837
|
+
function mo(n, e, t, r) {
|
|
2838
2838
|
if (t)
|
|
2839
|
-
return
|
|
2839
|
+
return _o(n, t);
|
|
2840
2840
|
if (r)
|
|
2841
|
-
return
|
|
2841
|
+
return go(n, e, r);
|
|
2842
2842
|
}
|
|
2843
|
-
function
|
|
2843
|
+
function wo(n, e, t) {
|
|
2844
2844
|
var s, i;
|
|
2845
2845
|
if (!Array.isArray(t.fields))
|
|
2846
|
-
return
|
|
2846
|
+
return ki(n, e);
|
|
2847
2847
|
const r = /* @__PURE__ */ new Map();
|
|
2848
2848
|
for (const o of t.fields) {
|
|
2849
2849
|
const a = W(n, e, o), c = (s = a == null ? void 0 : a["forward-identity"]) == null ? void 0 : s[2];
|
|
2850
|
-
c &&
|
|
2850
|
+
c && gn(a) && r.set(c, a);
|
|
2851
2851
|
}
|
|
2852
2852
|
if (!r.has("id")) {
|
|
2853
2853
|
const o = W(n, e, "id"), a = (i = o == null ? void 0 : o["forward-identity"]) == null ? void 0 : i[2];
|
|
@@ -2855,17 +2855,17 @@ function mo(n, e, t) {
|
|
|
2855
2855
|
}
|
|
2856
2856
|
return r;
|
|
2857
2857
|
}
|
|
2858
|
-
function
|
|
2858
|
+
function To(n, e, { etype: t, pageInfo: r, dq: s, form: i }) {
|
|
2859
2859
|
var b, g;
|
|
2860
|
-
const o = (b = i == null ? void 0 : i.$) == null ? void 0 : b.order, a =
|
|
2861
|
-
let u =
|
|
2862
|
-
const l = r == null ? void 0 : r["start-cursor"], f =
|
|
2860
|
+
const o = (b = i == null ? void 0 : i.$) == null ? void 0 : b.order, a = Vr(i), c = So(i);
|
|
2861
|
+
let u = Li(n, s);
|
|
2862
|
+
const l = r == null ? void 0 : r["start-cursor"], f = mo(e, t, l, o);
|
|
2863
2863
|
if (f && ((g = f == null ? void 0 : f["forward-identity"]) == null ? void 0 : g[2]) !== "id") {
|
|
2864
2864
|
const T = f["checked-data-type"] === "date", S = f.id;
|
|
2865
2865
|
u = u.map(([_]) => {
|
|
2866
2866
|
var C, v, k, j, x;
|
|
2867
2867
|
let w = (x = (j = (k = (v = (C = n.eav.get(_)) == null ? void 0 : C.get(S)) == null ? void 0 : v.values()) == null ? void 0 : k.next()) == null ? void 0 : j.value) == null ? void 0 : x[2];
|
|
2868
|
-
return T && (w =
|
|
2868
|
+
return T && (w = en(w)), [_, w];
|
|
2869
2869
|
});
|
|
2870
2870
|
}
|
|
2871
2871
|
u.sort(c === "asc" ? function(S, _) {
|
|
@@ -2874,57 +2874,57 @@ function wo(n, e, { etype: t, pageInfo: r, dq: s, form: i }) {
|
|
|
2874
2874
|
return wt(_, S, f == null ? void 0 : f["checked-data-type"]);
|
|
2875
2875
|
});
|
|
2876
2876
|
let p = {};
|
|
2877
|
-
const y =
|
|
2877
|
+
const y = wo(e, t, s);
|
|
2878
2878
|
for (const T of u) {
|
|
2879
2879
|
const [S] = T;
|
|
2880
|
-
if (p[S] || !a && l && f &&
|
|
2880
|
+
if (p[S] || !a && l && f && bo(l, f, c, T))
|
|
2881
2881
|
continue;
|
|
2882
|
-
const _ =
|
|
2882
|
+
const _ = Ei(n, y, S);
|
|
2883
2883
|
_ && (p[S] = _);
|
|
2884
2884
|
}
|
|
2885
2885
|
return p;
|
|
2886
2886
|
}
|
|
2887
|
-
function
|
|
2887
|
+
function So(n) {
|
|
2888
2888
|
var t;
|
|
2889
2889
|
const e = (t = n.$) == null ? void 0 : t.order;
|
|
2890
2890
|
return e && e[Object.keys(e)[0]] || "asc";
|
|
2891
2891
|
}
|
|
2892
|
-
function
|
|
2892
|
+
function Vr(n) {
|
|
2893
2893
|
var s, i, o;
|
|
2894
2894
|
const e = (s = n.$) == null ? void 0 : s.offset, t = (i = n.$) == null ? void 0 : i.before, r = (o = n.$) == null ? void 0 : o.after;
|
|
2895
2895
|
return !e && !t && !r;
|
|
2896
2896
|
}
|
|
2897
|
-
function
|
|
2897
|
+
function vo(n, e, { etype: t, level: r, form: s, join: i, pageInfo: o }) {
|
|
2898
2898
|
var p, y, b, g, T;
|
|
2899
|
-
if (!
|
|
2899
|
+
if (!Vr(s) && (!o || !o["start-cursor"]))
|
|
2900
2900
|
return [];
|
|
2901
|
-
const a =
|
|
2901
|
+
const a = io(lo(e, t, r, (p = s.$) == null ? void 0 : p.where), i), c = fo(vt, t, r), u = (y = s.$) == null ? void 0 : y.fields, l = To(n, e, {
|
|
2902
2902
|
etype: t,
|
|
2903
2903
|
pageInfo: o,
|
|
2904
2904
|
form: s,
|
|
2905
2905
|
dq: { where: a, find: c, fields: u }
|
|
2906
2906
|
}), f = ((b = s.$) == null ? void 0 : b.limit) || ((g = s.$) == null ? void 0 : g.first) || ((T = s.$) == null ? void 0 : T.last);
|
|
2907
2907
|
if (f != null) {
|
|
2908
|
-
r > 0 &&
|
|
2908
|
+
r > 0 && Yi && console.warn("WARNING: Limits in child queries are only run client-side. Data returned from the server will not have a limit.");
|
|
2909
2909
|
const S = Object.entries(l);
|
|
2910
2910
|
return S.length <= f ? l : Object.fromEntries(S.slice(0, f));
|
|
2911
2911
|
}
|
|
2912
2912
|
return l;
|
|
2913
2913
|
}
|
|
2914
|
-
function
|
|
2914
|
+
function Ao(n, e, t) {
|
|
2915
2915
|
try {
|
|
2916
|
-
return
|
|
2916
|
+
return vo(n, e, t);
|
|
2917
2917
|
} catch (r) {
|
|
2918
2918
|
if (r instanceof qe)
|
|
2919
2919
|
return {};
|
|
2920
2920
|
throw r;
|
|
2921
2921
|
}
|
|
2922
2922
|
}
|
|
2923
|
-
function
|
|
2924
|
-
const r =
|
|
2925
|
-
return
|
|
2923
|
+
function Br(n, e, t) {
|
|
2924
|
+
const r = Ao(n, e, t);
|
|
2925
|
+
return po(vt, n, e, t, r);
|
|
2926
2926
|
}
|
|
2927
|
-
function
|
|
2927
|
+
function Oo(n) {
|
|
2928
2928
|
const e = {};
|
|
2929
2929
|
for (const [t, r] of Object.entries(n))
|
|
2930
2930
|
e[t] = {
|
|
@@ -2935,18 +2935,18 @@ function Ao(n) {
|
|
|
2935
2935
|
};
|
|
2936
2936
|
return e;
|
|
2937
2937
|
}
|
|
2938
|
-
function
|
|
2938
|
+
function Qr({ store: n, attrsStore: e, pageInfo: t, aggregate: r }, s) {
|
|
2939
2939
|
const o = { data: Object.keys(s).reduce(function(c, u) {
|
|
2940
|
-
return r != null && r[u] || u === "$$ruleParams" || (c[u] =
|
|
2940
|
+
return r != null && r[u] || u === "$$ruleParams" || (c[u] = Br(n, e, {
|
|
2941
2941
|
etype: u,
|
|
2942
2942
|
form: s[u],
|
|
2943
2943
|
level: 0,
|
|
2944
2944
|
pageInfo: t == null ? void 0 : t[u]
|
|
2945
2945
|
})), c;
|
|
2946
2946
|
}, {}) };
|
|
2947
|
-
return t && (o.pageInfo =
|
|
2947
|
+
return t && (o.pageInfo = Oo(t)), r && (o.aggregate = r), o;
|
|
2948
2948
|
}
|
|
2949
|
-
function
|
|
2949
|
+
function Eo() {
|
|
2950
2950
|
const e = {
|
|
2951
2951
|
__etype: 1,
|
|
2952
2952
|
__ops: 1,
|
|
@@ -2960,7 +2960,7 @@ function Oo() {
|
|
|
2960
2960
|
};
|
|
2961
2961
|
return new Set(Object.keys(e));
|
|
2962
2962
|
}
|
|
2963
|
-
const
|
|
2963
|
+
const ko = Eo();
|
|
2964
2964
|
function bt(n, e, t) {
|
|
2965
2965
|
const r = {
|
|
2966
2966
|
__etype: n,
|
|
@@ -2972,7 +2972,7 @@ function bt(n, e, t) {
|
|
|
2972
2972
|
return t;
|
|
2973
2973
|
if (i === "__etype")
|
|
2974
2974
|
return n;
|
|
2975
|
-
if (
|
|
2975
|
+
if (ko.has(i))
|
|
2976
2976
|
return (o, a) => bt(n, e, [
|
|
2977
2977
|
...t,
|
|
2978
2978
|
a ? [i, n, e, o, a] : [i, n, e, o]
|
|
@@ -2980,42 +2980,42 @@ function bt(n, e, t) {
|
|
|
2980
2980
|
}
|
|
2981
2981
|
});
|
|
2982
2982
|
}
|
|
2983
|
-
function
|
|
2983
|
+
function Co(n, e) {
|
|
2984
2984
|
return `lookup__${n}__${JSON.stringify(e)}`;
|
|
2985
2985
|
}
|
|
2986
2986
|
function Tt(n) {
|
|
2987
2987
|
return n.startsWith("lookup__");
|
|
2988
2988
|
}
|
|
2989
|
-
function
|
|
2989
|
+
function tn(n) {
|
|
2990
2990
|
const [e, t, ...r] = n.split("__");
|
|
2991
2991
|
return [t, JSON.parse(r.join("__"))];
|
|
2992
2992
|
}
|
|
2993
|
-
function
|
|
2993
|
+
function Io(n) {
|
|
2994
2994
|
return new Proxy({
|
|
2995
2995
|
__etype: n
|
|
2996
2996
|
}, {
|
|
2997
2997
|
get(e, t) {
|
|
2998
2998
|
if (t === "lookup")
|
|
2999
|
-
return (s, i) => bt(n,
|
|
2999
|
+
return (s, i) => bt(n, tn(Co(s, i)), []);
|
|
3000
3000
|
if (t === "__etype")
|
|
3001
3001
|
return n;
|
|
3002
3002
|
const r = t;
|
|
3003
|
-
return Tt(r) ? bt(n,
|
|
3003
|
+
return Tt(r) ? bt(n, tn(r), []) : bt(n, r, []);
|
|
3004
3004
|
}
|
|
3005
3005
|
});
|
|
3006
3006
|
}
|
|
3007
|
-
function
|
|
3007
|
+
function wn() {
|
|
3008
3008
|
return new Proxy({}, {
|
|
3009
3009
|
get(n, e) {
|
|
3010
|
-
return
|
|
3010
|
+
return Io(e);
|
|
3011
3011
|
}
|
|
3012
3012
|
});
|
|
3013
3013
|
}
|
|
3014
|
-
|
|
3015
|
-
function
|
|
3014
|
+
wn();
|
|
3015
|
+
function Po(n) {
|
|
3016
3016
|
return n.__ops;
|
|
3017
3017
|
}
|
|
3018
|
-
function
|
|
3018
|
+
function Mo(n, e) {
|
|
3019
3019
|
const { attrIdMap: t, refSwapAttrIds: r } = n, s = [];
|
|
3020
3020
|
for (const o of e) {
|
|
3021
3021
|
const a = t[o];
|
|
@@ -3034,7 +3034,7 @@ function Po(n, e) {
|
|
|
3034
3034
|
}
|
|
3035
3035
|
return s;
|
|
3036
3036
|
}
|
|
3037
|
-
function
|
|
3037
|
+
function Ro(n) {
|
|
3038
3038
|
if (Array.isArray(n))
|
|
3039
3039
|
return n;
|
|
3040
3040
|
const e = Object.entries(n);
|
|
@@ -3042,38 +3042,38 @@ function Mo(n) {
|
|
|
3042
3042
|
throw new Error("lookup must be an object with a single unique attr and value.");
|
|
3043
3043
|
return e[0];
|
|
3044
3044
|
}
|
|
3045
|
-
function
|
|
3045
|
+
function jo(n, e, t) {
|
|
3046
3046
|
return t.indexOf(".") !== -1 && // attr names can have `.` in them, so use the attr we find with a `.`
|
|
3047
3047
|
// before assuming it's a ref lookup.
|
|
3048
3048
|
!W(n, e, t);
|
|
3049
3049
|
}
|
|
3050
|
-
function
|
|
3050
|
+
function nn(n) {
|
|
3051
3051
|
const [e, t, ...r] = n.split(".");
|
|
3052
3052
|
if (r.length > 0 || t !== "id")
|
|
3053
3053
|
throw new Error(`${n} is not a valid lookup attribute.`);
|
|
3054
3054
|
return e;
|
|
3055
3055
|
}
|
|
3056
|
-
function
|
|
3057
|
-
if (!
|
|
3056
|
+
function Do(n, e, t) {
|
|
3057
|
+
if (!jo(n, e, t))
|
|
3058
3058
|
return W(n, e, t);
|
|
3059
|
-
const r =
|
|
3059
|
+
const r = nn(t), s = W(n, e, r) || je(n, e, r);
|
|
3060
3060
|
if (s && s["value-type"] !== "ref")
|
|
3061
3061
|
throw new Error(`${t} does not reference a valid link attribute.`);
|
|
3062
3062
|
return s;
|
|
3063
3063
|
}
|
|
3064
|
-
function
|
|
3065
|
-
return typeof n == "string" && !Tt(n) ? null : typeof n == "string" && Tt(n) ?
|
|
3064
|
+
function rn(n) {
|
|
3065
|
+
return typeof n == "string" && !Tt(n) ? null : typeof n == "string" && Tt(n) ? tn(n) : Ro(n);
|
|
3066
3066
|
}
|
|
3067
3067
|
function oe(n, e, t) {
|
|
3068
|
-
const r =
|
|
3068
|
+
const r = rn(t);
|
|
3069
3069
|
if (r === null)
|
|
3070
3070
|
return t;
|
|
3071
|
-
const [s, i] = r, o =
|
|
3071
|
+
const [s, i] = r, o = Do(n, e, s);
|
|
3072
3072
|
if (!o || !o["unique?"])
|
|
3073
3073
|
throw new Error(`${s} is not a unique attribute.`);
|
|
3074
3074
|
return [o.id, i];
|
|
3075
3075
|
}
|
|
3076
|
-
function
|
|
3076
|
+
function Gr(n, e, t, r) {
|
|
3077
3077
|
var o;
|
|
3078
3078
|
const s = oe(n, e, t);
|
|
3079
3079
|
return Array.isArray(s) ? [[
|
|
@@ -3083,7 +3083,7 @@ function Qr(n, e, t, r) {
|
|
|
3083
3083
|
s
|
|
3084
3084
|
]].concat(r) : r;
|
|
3085
3085
|
}
|
|
3086
|
-
function
|
|
3086
|
+
function $o({ attrsStore: n }, [e, t, r]) {
|
|
3087
3087
|
const s = Object.entries(r).flatMap(([i, o]) => {
|
|
3088
3088
|
const a = Array.isArray(o) ? o : [o], c = W(n, e, i), u = je(n, e, i);
|
|
3089
3089
|
return a.map((l) => c ? [
|
|
@@ -3102,9 +3102,9 @@ function Do({ attrsStore: n }, [e, t, r]) {
|
|
|
3102
3102
|
oe(n, e, t)
|
|
3103
3103
|
]);
|
|
3104
3104
|
});
|
|
3105
|
-
return
|
|
3105
|
+
return Gr(n, e, t, s);
|
|
3106
3106
|
}
|
|
3107
|
-
function
|
|
3107
|
+
function xo({ attrsStore: n }, [e, t, r]) {
|
|
3108
3108
|
const s = Object.entries(r).flatMap(([i, o]) => {
|
|
3109
3109
|
const a = Array.isArray(o) ? o : [o], c = W(n, e, i), u = je(n, e, i);
|
|
3110
3110
|
return a.map((l) => c ? [
|
|
@@ -3123,9 +3123,9 @@ function $o({ attrsStore: n }, [e, t, r]) {
|
|
|
3123
3123
|
oe(n, e, t)
|
|
3124
3124
|
]);
|
|
3125
3125
|
});
|
|
3126
|
-
return
|
|
3126
|
+
return Gr(n, e, t, s);
|
|
3127
3127
|
}
|
|
3128
|
-
function
|
|
3128
|
+
function Uo(n, e, t, r) {
|
|
3129
3129
|
var s;
|
|
3130
3130
|
if (Array.isArray(r)) {
|
|
3131
3131
|
const [i, o] = r;
|
|
@@ -3148,18 +3148,18 @@ function xo(n, e, t, r) {
|
|
|
3148
3148
|
}
|
|
3149
3149
|
return !1;
|
|
3150
3150
|
}
|
|
3151
|
-
function
|
|
3152
|
-
return (i == null ? void 0 : i.upsert) === !1 ? { mode: "update" } : (i == null ? void 0 : i.upsert) === !0 ? null :
|
|
3151
|
+
function Hr({ stores: n, attrsStore: e }, [t, r, s, i]) {
|
|
3152
|
+
return (i == null ? void 0 : i.upsert) === !1 ? { mode: "update" } : (i == null ? void 0 : i.upsert) === !0 ? null : Uo(n, e, t, r) ? { mode: "update" } : null;
|
|
3153
3153
|
}
|
|
3154
|
-
function
|
|
3155
|
-
const { attrsStore: t } = n, [r, s, i, o] = e, a =
|
|
3154
|
+
function Lo(n, e) {
|
|
3155
|
+
const { attrsStore: t } = n, [r, s, i, o] = e, a = bn(i), c = oe(t, r, s);
|
|
3156
3156
|
return [["id", c]].concat(Object.entries(a)).map(([l, f]) => {
|
|
3157
3157
|
const p = W(t, r, l);
|
|
3158
3158
|
return p["checked-data-type"] === "date" && n.useDateObjects && (f = St(f)), ["add-triple", c, p.id, f, { mode: "create" }];
|
|
3159
3159
|
});
|
|
3160
3160
|
}
|
|
3161
|
-
function
|
|
3162
|
-
const { attrsStore: t } = n, [r, s, i, o] = e, a =
|
|
3161
|
+
function Fo(n, e) {
|
|
3162
|
+
const { attrsStore: t } = n, [r, s, i, o] = e, a = bn(i), c = oe(t, r, s), u = Hr(n, [r, c, i, o]);
|
|
3163
3163
|
return [["id", c]].concat(Object.entries(a)).map(([f, p]) => {
|
|
3164
3164
|
const y = W(t, r, f);
|
|
3165
3165
|
return y["checked-data-type"] === "date" && n.useDateObjects && (p = St(p)), [
|
|
@@ -3171,11 +3171,11 @@ function Lo(n, e) {
|
|
|
3171
3171
|
];
|
|
3172
3172
|
});
|
|
3173
3173
|
}
|
|
3174
|
-
function
|
|
3174
|
+
function No({ attrsStore: n }, [e, t]) {
|
|
3175
3175
|
return [["delete-entity", oe(n, e, t), e]];
|
|
3176
3176
|
}
|
|
3177
|
-
function
|
|
3178
|
-
const { attrsStore: t } = n, [r, s, i, o] = e, a =
|
|
3177
|
+
function Ko(n, e) {
|
|
3178
|
+
const { attrsStore: t } = n, [r, s, i, o] = e, a = bn(i), c = oe(t, r, s), u = Hr(n, [r, c, i, o]), l = Object.entries(a).map(([p, y]) => {
|
|
3179
3179
|
const b = W(t, r, p);
|
|
3180
3180
|
return [
|
|
3181
3181
|
"deep-merge-triple",
|
|
@@ -3193,38 +3193,38 @@ function No(n, e) {
|
|
|
3193
3193
|
...u ? [u] : []
|
|
3194
3194
|
]].concat(l);
|
|
3195
3195
|
}
|
|
3196
|
-
function
|
|
3196
|
+
function qo({ attrsStore: n }, [e, t, r]) {
|
|
3197
3197
|
return [["rule-params", oe(n, e, t), e, r]];
|
|
3198
3198
|
}
|
|
3199
|
-
function
|
|
3199
|
+
function Wo(n) {
|
|
3200
3200
|
const [e, t, r, s, i] = n;
|
|
3201
3201
|
if (!s)
|
|
3202
3202
|
return n;
|
|
3203
3203
|
const o = { ...s };
|
|
3204
3204
|
return delete o.id, [e, t, r, o, ...i ? [i] : []];
|
|
3205
3205
|
}
|
|
3206
|
-
function
|
|
3207
|
-
const [t, ...r] =
|
|
3206
|
+
function zo(n, e) {
|
|
3207
|
+
const [t, ...r] = Wo(e);
|
|
3208
3208
|
switch (t) {
|
|
3209
3209
|
case "merge":
|
|
3210
|
-
return
|
|
3210
|
+
return Ko(n, r);
|
|
3211
3211
|
case "create":
|
|
3212
|
-
return Uo(n, r);
|
|
3213
|
-
case "update":
|
|
3214
3212
|
return Lo(n, r);
|
|
3213
|
+
case "update":
|
|
3214
|
+
return Fo(n, r);
|
|
3215
3215
|
case "link":
|
|
3216
|
-
return Do(n, r);
|
|
3217
|
-
case "unlink":
|
|
3218
3216
|
return $o(n, r);
|
|
3217
|
+
case "unlink":
|
|
3218
|
+
return xo(n, r);
|
|
3219
3219
|
case "delete":
|
|
3220
|
-
return
|
|
3220
|
+
return No(n, r);
|
|
3221
3221
|
case "ruleParams":
|
|
3222
|
-
return
|
|
3222
|
+
return qo(n, r);
|
|
3223
3223
|
default:
|
|
3224
3224
|
throw new Error(`unsupported action ${t}`);
|
|
3225
3225
|
}
|
|
3226
3226
|
}
|
|
3227
|
-
function
|
|
3227
|
+
function Vo(n) {
|
|
3228
3228
|
switch (n) {
|
|
3229
3229
|
case "string":
|
|
3230
3230
|
case "date":
|
|
@@ -3235,14 +3235,14 @@ function zo(n) {
|
|
|
3235
3235
|
return;
|
|
3236
3236
|
}
|
|
3237
3237
|
}
|
|
3238
|
-
function
|
|
3238
|
+
function Bo(n, e, t) {
|
|
3239
3239
|
var a, c;
|
|
3240
3240
|
const r = (c = (a = n.entities[e]) == null ? void 0 : a.attrs) == null ? void 0 : c[t];
|
|
3241
3241
|
if (t === "id")
|
|
3242
3242
|
return null;
|
|
3243
3243
|
if (!r)
|
|
3244
3244
|
throw new Error(`${e}.${t} does not exist in your schema`);
|
|
3245
|
-
const { unique: s, indexed: i } = r == null ? void 0 : r.config, o =
|
|
3245
|
+
const { unique: s, indexed: i } = r == null ? void 0 : r.config, o = Vo(r == null ? void 0 : r.valueType);
|
|
3246
3246
|
return {
|
|
3247
3247
|
"index?": i,
|
|
3248
3248
|
"unique?": s,
|
|
@@ -3250,7 +3250,7 @@ function Vo(n, e, t) {
|
|
|
3250
3250
|
};
|
|
3251
3251
|
}
|
|
3252
3252
|
function lt(n, e, t, r) {
|
|
3253
|
-
const s = n ?
|
|
3253
|
+
const s = n ? Bo(n, e, t) : null, i = L(), a = [L(), e, t];
|
|
3254
3254
|
return {
|
|
3255
3255
|
id: i,
|
|
3256
3256
|
"forward-identity": a,
|
|
@@ -3263,11 +3263,11 @@ function lt(n, e, t, r) {
|
|
|
3263
3263
|
...r || {}
|
|
3264
3264
|
};
|
|
3265
3265
|
}
|
|
3266
|
-
function
|
|
3266
|
+
function Qo(n, e, t) {
|
|
3267
3267
|
return Object.values(n.links).find((i) => i.forward.on === e && i.forward.label === t || i.reverse.on === e && i.reverse.label === t);
|
|
3268
3268
|
}
|
|
3269
|
-
function
|
|
3270
|
-
const r =
|
|
3269
|
+
function Go(n, e, t) {
|
|
3270
|
+
const r = Qo(n, e, t);
|
|
3271
3271
|
if (!r)
|
|
3272
3272
|
throw new Error(`Couldn't find the link ${e}.${t} in your schema`);
|
|
3273
3273
|
const { forward: s, reverse: i } = r;
|
|
@@ -3280,8 +3280,8 @@ function Qo(n, e, t) {
|
|
|
3280
3280
|
"on-delete-reverse": i.onDelete
|
|
3281
3281
|
};
|
|
3282
3282
|
}
|
|
3283
|
-
function
|
|
3284
|
-
const s = n ?
|
|
3283
|
+
function Xn(n, e, t, r) {
|
|
3284
|
+
const s = n ? Go(n, e, t) : null, i = L(), o = [L(), e, t], a = [L(), t, e];
|
|
3285
3285
|
return {
|
|
3286
3286
|
id: i,
|
|
3287
3287
|
// @ts-ignore: ts thinks it's any[]
|
|
@@ -3298,7 +3298,7 @@ function Zn(n, e, t, r) {
|
|
|
3298
3298
|
...r || {}
|
|
3299
3299
|
};
|
|
3300
3300
|
}
|
|
3301
|
-
const
|
|
3301
|
+
const Ho = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink"]), Jo = /* @__PURE__ */ new Set(["link", "unlink"]), Yo = /* @__PURE__ */ new Set(["create", "update", "merge"]), Zo = /* @__PURE__ */ new Set([
|
|
3302
3302
|
"link",
|
|
3303
3303
|
"unlink",
|
|
3304
3304
|
"create",
|
|
@@ -3306,20 +3306,20 @@ const Go = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink
|
|
|
3306
3306
|
"merge",
|
|
3307
3307
|
"delete",
|
|
3308
3308
|
"ruleParams"
|
|
3309
|
-
]),
|
|
3310
|
-
...
|
|
3309
|
+
]), sn = { "unique?": !0, "index?": !0 }, Xo = {
|
|
3310
|
+
...sn,
|
|
3311
3311
|
cardinality: "one"
|
|
3312
3312
|
};
|
|
3313
|
-
function
|
|
3313
|
+
function ea(n) {
|
|
3314
3314
|
const e = [], [t, r, s, i] = n;
|
|
3315
|
-
if (!
|
|
3315
|
+
if (!Zo.has(t))
|
|
3316
3316
|
return e;
|
|
3317
|
-
const o =
|
|
3317
|
+
const o = rn(s);
|
|
3318
3318
|
if (o && e.push({ etype: r, lookupPair: o }), t === "link")
|
|
3319
3319
|
for (const [a, c] of Object.entries(i)) {
|
|
3320
3320
|
const u = Array.isArray(c) ? c : [c];
|
|
3321
3321
|
for (const l of u) {
|
|
3322
|
-
const f =
|
|
3322
|
+
const f = rn(l);
|
|
3323
3323
|
f && e.push({
|
|
3324
3324
|
etype: r,
|
|
3325
3325
|
lookupPair: f,
|
|
@@ -3329,7 +3329,7 @@ function Xo(n) {
|
|
|
3329
3329
|
}
|
|
3330
3330
|
return e;
|
|
3331
3331
|
}
|
|
3332
|
-
function
|
|
3332
|
+
function ta({ attrsStore: n, schema: e }, t) {
|
|
3333
3333
|
var p, y;
|
|
3334
3334
|
const r = /* @__PURE__ */ new Set(), s = [], i = [];
|
|
3335
3335
|
function o(b, g) {
|
|
@@ -3354,10 +3354,10 @@ function ea({ attrsStore: n, schema: e }, t) {
|
|
|
3354
3354
|
}
|
|
3355
3355
|
function f(b, g) {
|
|
3356
3356
|
const T = o(b, g), S = a(b, g);
|
|
3357
|
-
u(T), u(S), !T && !S && c(
|
|
3357
|
+
u(T), u(S), !T && !S && c(Xn(e, b, g, Xo));
|
|
3358
3358
|
}
|
|
3359
3359
|
for (const b of t)
|
|
3360
|
-
for (const { etype: g, lookupPair: T, linkLabel: S } of
|
|
3360
|
+
for (const { etype: g, lookupPair: T, linkLabel: S } of ea(b)) {
|
|
3361
3361
|
const _ = T[0];
|
|
3362
3362
|
if (S) {
|
|
3363
3363
|
f(g, S);
|
|
@@ -3365,28 +3365,28 @@ function ea({ attrsStore: n, schema: e }, t) {
|
|
|
3365
3365
|
u(w), u(C);
|
|
3366
3366
|
const v = ((p = w == null ? void 0 : w["reverse-identity"]) == null ? void 0 : p[1]) || ((y = C == null ? void 0 : C["forward-identity"]) == null ? void 0 : y[1]) || S;
|
|
3367
3367
|
if (l(v, _))
|
|
3368
|
-
f(v,
|
|
3368
|
+
f(v, nn(_));
|
|
3369
3369
|
else {
|
|
3370
3370
|
const k = o(v, _);
|
|
3371
|
-
k || c(lt(e, v, _,
|
|
3371
|
+
k || c(lt(e, v, _, sn)), u(k);
|
|
3372
3372
|
}
|
|
3373
3373
|
} else if (l(g, _))
|
|
3374
|
-
f(g,
|
|
3374
|
+
f(g, nn(_));
|
|
3375
3375
|
else {
|
|
3376
3376
|
const w = o(g, _);
|
|
3377
|
-
w || c(lt(e, g, _,
|
|
3377
|
+
w || c(lt(e, g, _, sn)), u(w);
|
|
3378
3378
|
}
|
|
3379
3379
|
}
|
|
3380
3380
|
for (const b of t) {
|
|
3381
3381
|
const [g, T, S, _] = b;
|
|
3382
|
-
if (
|
|
3382
|
+
if (Ho.has(g)) {
|
|
3383
3383
|
const w = o(T, "id");
|
|
3384
3384
|
u(w), w || c(lt(e, T, "id", { "unique?": !0 }));
|
|
3385
3385
|
for (const C of Object.keys(_)) {
|
|
3386
3386
|
const v = o(T, C);
|
|
3387
|
-
if (u(v),
|
|
3387
|
+
if (u(v), Yo.has(g) && (v || c(lt(e, T, C, C === "id" ? { "unique?": !0 } : null))), Jo.has(g)) {
|
|
3388
3388
|
const k = a(T, C);
|
|
3389
|
-
!v && !k && c(
|
|
3389
|
+
!v && !k && c(Xn(e, T, C)), u(k);
|
|
3390
3390
|
}
|
|
3391
3391
|
}
|
|
3392
3392
|
}
|
|
@@ -3399,19 +3399,19 @@ function ea({ attrsStore: n, schema: e }, t) {
|
|
|
3399
3399
|
}
|
|
3400
3400
|
return [n, i];
|
|
3401
3401
|
}
|
|
3402
|
-
function
|
|
3403
|
-
const r = (Array.isArray(e) ? e : [e]).flatMap((c) =>
|
|
3402
|
+
function na(n, e) {
|
|
3403
|
+
const r = (Array.isArray(e) ? e : [e]).flatMap((c) => Po(c)), [s, i] = ta(n, r), o = { ...n, attrsStore: s }, a = r.flatMap((c) => zo(o, c));
|
|
3404
3404
|
return [...i, ...a];
|
|
3405
3405
|
}
|
|
3406
|
-
function
|
|
3406
|
+
function er(n, e) {
|
|
3407
3407
|
typeof requestIdleCallback > "u" ? n() : requestIdleCallback(n, { timeout: e });
|
|
3408
3408
|
}
|
|
3409
3409
|
const Le = "__meta";
|
|
3410
|
-
class
|
|
3410
|
+
class ra {
|
|
3411
3411
|
constructor(e, t) {
|
|
3412
3412
|
}
|
|
3413
3413
|
}
|
|
3414
|
-
class
|
|
3414
|
+
class on {
|
|
3415
3415
|
constructor(e) {
|
|
3416
3416
|
h(this, "currentValue");
|
|
3417
3417
|
h(this, "_subs", []);
|
|
@@ -3604,7 +3604,7 @@ class sn {
|
|
|
3604
3604
|
gc() {
|
|
3605
3605
|
this._nextGc || (this._nextGc = setTimeout(
|
|
3606
3606
|
() => {
|
|
3607
|
-
|
|
3607
|
+
er(() => {
|
|
3608
3608
|
this._nextGc = null, this._gc();
|
|
3609
3609
|
}, 30 * 1e3);
|
|
3610
3610
|
},
|
|
@@ -3619,7 +3619,7 @@ class sn {
|
|
|
3619
3619
|
return;
|
|
3620
3620
|
}
|
|
3621
3621
|
this._nextSave = setTimeout(() => {
|
|
3622
|
-
|
|
3622
|
+
er(() => {
|
|
3623
3623
|
this._nextSave = null, this._writeToStorage(e).then(t).catch(r);
|
|
3624
3624
|
}, this._idleCallbackMaxWaitMs);
|
|
3625
3625
|
}, this._saveThrottleMs);
|
|
@@ -3659,13 +3659,13 @@ class sn {
|
|
|
3659
3659
|
e && await this._enqueuePersist();
|
|
3660
3660
|
}
|
|
3661
3661
|
}
|
|
3662
|
-
const
|
|
3663
|
-
function
|
|
3662
|
+
const sa = 6, ia = ["kv", "querySubs", "syncSubs"];
|
|
3663
|
+
function oa(n) {
|
|
3664
3664
|
return function(t) {
|
|
3665
3665
|
console.error("Error in IndexedDB event", { source: n, event: t });
|
|
3666
3666
|
};
|
|
3667
3667
|
}
|
|
3668
|
-
async function
|
|
3668
|
+
async function aa(n) {
|
|
3669
3669
|
return new Promise((e) => {
|
|
3670
3670
|
const t = indexedDB.open(n);
|
|
3671
3671
|
t.onerror = (r) => {
|
|
@@ -3679,7 +3679,7 @@ async function oa(n) {
|
|
|
3679
3679
|
};
|
|
3680
3680
|
});
|
|
3681
3681
|
}
|
|
3682
|
-
async function
|
|
3682
|
+
async function ca(n, e, t) {
|
|
3683
3683
|
const r = (
|
|
3684
3684
|
// Backwards compatibility for older versions where we JSON.stringified before storing
|
|
3685
3685
|
typeof e == "string" ? JSON.parse(e) : e
|
|
@@ -3713,14 +3713,14 @@ async function aa(n, e, t) {
|
|
|
3713
3713
|
};
|
|
3714
3714
|
});
|
|
3715
3715
|
}
|
|
3716
|
-
async function
|
|
3716
|
+
async function tr(n, e, t) {
|
|
3717
3717
|
const r = t.put(e, n);
|
|
3718
3718
|
return new Promise((s, i) => {
|
|
3719
3719
|
r.onsuccess = () => s(), r.onerror = (o) => i(o);
|
|
3720
3720
|
});
|
|
3721
3721
|
}
|
|
3722
|
-
async function
|
|
3723
|
-
const t = await
|
|
3722
|
+
async function ua(n, e) {
|
|
3723
|
+
const t = await aa(`instant_${n}_5`);
|
|
3724
3724
|
if (!t)
|
|
3725
3725
|
return;
|
|
3726
3726
|
const r = await new Promise((l, f) => {
|
|
@@ -3743,12 +3743,12 @@ async function ca(n, e) {
|
|
|
3743
3743
|
for (const [l, f] of r)
|
|
3744
3744
|
switch (l) {
|
|
3745
3745
|
case "querySubs": {
|
|
3746
|
-
const p =
|
|
3746
|
+
const p = ca(l, f, o);
|
|
3747
3747
|
a.push(p);
|
|
3748
3748
|
break;
|
|
3749
3749
|
}
|
|
3750
3750
|
default: {
|
|
3751
|
-
const p =
|
|
3751
|
+
const p = tr(l, f, i);
|
|
3752
3752
|
a.push(p);
|
|
3753
3753
|
const y = {
|
|
3754
3754
|
createdAt: Date.now(),
|
|
@@ -3759,13 +3759,13 @@ async function ca(n, e) {
|
|
|
3759
3759
|
break;
|
|
3760
3760
|
}
|
|
3761
3761
|
}
|
|
3762
|
-
const u =
|
|
3762
|
+
const u = tr(Le, c, i);
|
|
3763
3763
|
a.push(u), await Promise.all(a), await new Promise((l, f) => {
|
|
3764
3764
|
s.oncomplete = (p) => l(p), s.onerror = (p) => f(p), s.onabort = (p) => f(p);
|
|
3765
3765
|
});
|
|
3766
3766
|
}
|
|
3767
|
-
const
|
|
3768
|
-
class
|
|
3767
|
+
const nr = /* @__PURE__ */ new Map();
|
|
3768
|
+
class Jr extends ra {
|
|
3769
3769
|
constructor(t, r) {
|
|
3770
3770
|
super(t, r);
|
|
3771
3771
|
h(this, "dbName");
|
|
@@ -3773,7 +3773,7 @@ class Hr extends na {
|
|
|
3773
3773
|
h(this, "_appId");
|
|
3774
3774
|
h(this, "_prefix");
|
|
3775
3775
|
h(this, "_dbPromise");
|
|
3776
|
-
this.dbName = `instant_${t}_${
|
|
3776
|
+
this.dbName = `instant_${t}_${sa}`, this._storeName = r, this._appId = t, this._dbPromise = this._init();
|
|
3777
3777
|
}
|
|
3778
3778
|
_init() {
|
|
3779
3779
|
return new Promise((t, r) => {
|
|
@@ -3784,12 +3784,12 @@ class Hr extends na {
|
|
|
3784
3784
|
}, i.onsuccess = (o) => {
|
|
3785
3785
|
const c = o.target.result;
|
|
3786
3786
|
if (s) {
|
|
3787
|
-
const u =
|
|
3788
|
-
|
|
3787
|
+
const u = ua(this._appId, c).catch((l) => {
|
|
3788
|
+
oa("Error upgrading store from version 5 to 6.")(l);
|
|
3789
3789
|
});
|
|
3790
|
-
|
|
3790
|
+
nr.set(this.dbName, u), u.then(() => t(c)).catch(() => t(c));
|
|
3791
3791
|
} else {
|
|
3792
|
-
const u =
|
|
3792
|
+
const u = nr.get(this.dbName);
|
|
3793
3793
|
u ? u.then(() => t(c)).catch(() => t(c)) : t(c);
|
|
3794
3794
|
}
|
|
3795
3795
|
}, i.onupgradeneeded = (o) => {
|
|
@@ -3799,7 +3799,7 @@ class Hr extends na {
|
|
|
3799
3799
|
}
|
|
3800
3800
|
_upgradeStore(t) {
|
|
3801
3801
|
const s = t.target.result;
|
|
3802
|
-
for (const i of
|
|
3802
|
+
for (const i of ia)
|
|
3803
3803
|
s.objectStoreNames.contains(i) || s.createObjectStore(i);
|
|
3804
3804
|
}
|
|
3805
3805
|
async getItem(t) {
|
|
@@ -3864,7 +3864,7 @@ class Hr extends na {
|
|
|
3864
3864
|
});
|
|
3865
3865
|
}
|
|
3866
3866
|
}
|
|
3867
|
-
class
|
|
3867
|
+
class Yr {
|
|
3868
3868
|
static async getIsOnline() {
|
|
3869
3869
|
return navigator.onLine;
|
|
3870
3870
|
}
|
|
@@ -3910,14 +3910,14 @@ async function be(n, e) {
|
|
|
3910
3910
|
const t = await fetch(n, e), r = await t.json();
|
|
3911
3911
|
return t.status === 200 ? Promise.resolve(r) : Promise.reject(new At({ status: t.status, body: r }));
|
|
3912
3912
|
}
|
|
3913
|
-
function
|
|
3913
|
+
function la({ apiURI: n, appId: e, email: t }) {
|
|
3914
3914
|
return be(`${n}/runtime/auth/send_magic_code`, {
|
|
3915
3915
|
method: "POST",
|
|
3916
3916
|
headers: { "content-type": "application/json" },
|
|
3917
3917
|
body: JSON.stringify({ "app-id": e, email: t })
|
|
3918
3918
|
});
|
|
3919
3919
|
}
|
|
3920
|
-
async function
|
|
3920
|
+
async function fa({ apiURI: n, appId: e, email: t, code: r, refreshToken: s, extraFields: i }) {
|
|
3921
3921
|
return await be(`${n}/runtime/auth/verify_magic_code`, {
|
|
3922
3922
|
method: "POST",
|
|
3923
3923
|
headers: { "content-type": "application/json" },
|
|
@@ -3925,11 +3925,12 @@ async function la({ apiURI: n, appId: e, email: t, code: r, refreshToken: s }) {
|
|
|
3925
3925
|
"app-id": e,
|
|
3926
3926
|
email: t,
|
|
3927
3927
|
code: r,
|
|
3928
|
-
...s ? { "refresh-token": s } : {}
|
|
3928
|
+
...s ? { "refresh-token": s } : {},
|
|
3929
|
+
...i ? { "extra-fields": i } : {}
|
|
3929
3930
|
})
|
|
3930
3931
|
});
|
|
3931
3932
|
}
|
|
3932
|
-
async function
|
|
3933
|
+
async function da({ apiURI: n, appId: e, refreshToken: t }) {
|
|
3933
3934
|
return await be(`${n}/runtime/auth/verify_refresh_token`, {
|
|
3934
3935
|
method: "POST",
|
|
3935
3936
|
headers: { "content-type": "application/json" },
|
|
@@ -3939,7 +3940,7 @@ async function fa({ apiURI: n, appId: e, refreshToken: t }) {
|
|
|
3939
3940
|
})
|
|
3940
3941
|
});
|
|
3941
3942
|
}
|
|
3942
|
-
async function
|
|
3943
|
+
async function ha({ apiURI: n, appId: e }) {
|
|
3943
3944
|
return await be(`${n}/runtime/auth/sign_in_guest`, {
|
|
3944
3945
|
method: "POST",
|
|
3945
3946
|
headers: { "content-type": "application/json" },
|
|
@@ -3948,7 +3949,7 @@ async function da({ apiURI: n, appId: e }) {
|
|
|
3948
3949
|
})
|
|
3949
3950
|
});
|
|
3950
3951
|
}
|
|
3951
|
-
async function
|
|
3952
|
+
async function rr({ apiURI: n, appId: e, code: t, codeVerifier: r, refreshToken: s, extraFields: i }) {
|
|
3952
3953
|
return await be(`${n}/runtime/oauth/token`, {
|
|
3953
3954
|
method: "POST",
|
|
3954
3955
|
headers: { "content-type": "application/json" },
|
|
@@ -3956,11 +3957,12 @@ async function nr({ apiURI: n, appId: e, code: t, codeVerifier: r, refreshToken:
|
|
|
3956
3957
|
app_id: e,
|
|
3957
3958
|
code: t,
|
|
3958
3959
|
code_verifier: r,
|
|
3959
|
-
refresh_token: s
|
|
3960
|
+
refresh_token: s,
|
|
3961
|
+
...i ? { extra_fields: i } : {}
|
|
3960
3962
|
})
|
|
3961
3963
|
});
|
|
3962
3964
|
}
|
|
3963
|
-
async function
|
|
3965
|
+
async function pa({ apiURI: n, appId: e, nonce: t, idToken: r, clientName: s, refreshToken: i, extraFields: o }) {
|
|
3964
3966
|
return await be(`${n}/runtime/oauth/id_token`, {
|
|
3965
3967
|
method: "POST",
|
|
3966
3968
|
headers: { "content-type": "application/json" },
|
|
@@ -3969,11 +3971,12 @@ async function ha({ apiURI: n, appId: e, nonce: t, idToken: r, clientName: s, re
|
|
|
3969
3971
|
nonce: t,
|
|
3970
3972
|
id_token: r,
|
|
3971
3973
|
client_name: s,
|
|
3972
|
-
refresh_token: i
|
|
3974
|
+
refresh_token: i,
|
|
3975
|
+
...o ? { extra_fields: o } : {}
|
|
3973
3976
|
})
|
|
3974
3977
|
});
|
|
3975
3978
|
}
|
|
3976
|
-
async function
|
|
3979
|
+
async function ya({ apiURI: n, appId: e, refreshToken: t }) {
|
|
3977
3980
|
return await be(`${n}/runtime/signout`, {
|
|
3978
3981
|
method: "POST",
|
|
3979
3982
|
headers: {
|
|
@@ -3985,7 +3988,7 @@ async function pa({ apiURI: n, appId: e, refreshToken: t }) {
|
|
|
3985
3988
|
})
|
|
3986
3989
|
});
|
|
3987
3990
|
}
|
|
3988
|
-
async function
|
|
3991
|
+
async function ba({ apiURI: n, appId: e, path: t, file: r, refreshToken: s, contentType: i, contentDisposition: o }) {
|
|
3989
3992
|
const a = {
|
|
3990
3993
|
app_id: e,
|
|
3991
3994
|
path: t,
|
|
@@ -3998,7 +4001,7 @@ async function ya({ apiURI: n, appId: e, path: t, file: r, refreshToken: s, cont
|
|
|
3998
4001
|
body: r
|
|
3999
4002
|
});
|
|
4000
4003
|
}
|
|
4001
|
-
async function
|
|
4004
|
+
async function _a({ apiURI: n, appId: e, path: t, refreshToken: r }) {
|
|
4002
4005
|
const { data: s } = await be(`${n}/storage/files?app_id=${e}&filename=${encodeURIComponent(t)}`, {
|
|
4003
4006
|
method: "DELETE",
|
|
4004
4007
|
headers: {
|
|
@@ -4008,7 +4011,7 @@ async function ba({ apiURI: n, appId: e, path: t, refreshToken: r }) {
|
|
|
4008
4011
|
});
|
|
4009
4012
|
return s;
|
|
4010
4013
|
}
|
|
4011
|
-
async function
|
|
4014
|
+
async function ga({ apiURI: n, appId: e, fileName: t, refreshToken: r, metadata: s = {} }) {
|
|
4012
4015
|
const { data: i } = await be(`${n}/storage/signed-upload-url`, {
|
|
4013
4016
|
method: "POST",
|
|
4014
4017
|
headers: {
|
|
@@ -4022,7 +4025,7 @@ async function _a({ apiURI: n, appId: e, fileName: t, refreshToken: r, metadata:
|
|
|
4022
4025
|
});
|
|
4023
4026
|
return i;
|
|
4024
4027
|
}
|
|
4025
|
-
async function
|
|
4028
|
+
async function ma(n, e) {
|
|
4026
4029
|
return (await fetch(n, {
|
|
4027
4030
|
method: "PUT",
|
|
4028
4031
|
body: e,
|
|
@@ -4031,7 +4034,7 @@ async function ga(n, e) {
|
|
|
4031
4034
|
}
|
|
4032
4035
|
})).ok;
|
|
4033
4036
|
}
|
|
4034
|
-
async function
|
|
4037
|
+
async function wa({ apiURI: n, appId: e, path: t, refreshToken: r }) {
|
|
4035
4038
|
const { data: s } = await be(`${n}/storage/signed-download-url?app_id=${e}&filename=${encodeURIComponent(t)}`, {
|
|
4036
4039
|
method: "GET",
|
|
4037
4040
|
headers: {
|
|
@@ -4041,9 +4044,9 @@ async function ma({ apiURI: n, appId: e, path: t, refreshToken: r }) {
|
|
|
4041
4044
|
});
|
|
4042
4045
|
return s;
|
|
4043
4046
|
}
|
|
4044
|
-
let
|
|
4045
|
-
typeof window < "u" && typeof window.localStorage < "u" && (
|
|
4046
|
-
function
|
|
4047
|
+
let Tn = !1, Zr = !1, Xr = !1;
|
|
4048
|
+
typeof window < "u" && typeof window.localStorage < "u" && (Tn = !!window.localStorage.getItem("devBackend"), Zr = !!window.localStorage.getItem("__instantLogging"), Xr = !!window.localStorage.getItem("__devtoolLocalDash"));
|
|
4049
|
+
function sr(n, e) {
|
|
4047
4050
|
if (!e)
|
|
4048
4051
|
return n;
|
|
4049
4052
|
const t = {};
|
|
@@ -4051,32 +4054,32 @@ function rr(n, e) {
|
|
|
4051
4054
|
t[r] = n[r];
|
|
4052
4055
|
}), t;
|
|
4053
4056
|
}
|
|
4054
|
-
function
|
|
4057
|
+
function Ta(n, e, t) {
|
|
4055
4058
|
const r = {
|
|
4056
4059
|
peers: {}
|
|
4057
4060
|
};
|
|
4058
4061
|
if (e && "user" in e ? e.user : !0) {
|
|
4059
|
-
const i =
|
|
4062
|
+
const i = sr(n.user ?? {}, e == null ? void 0 : e.keys);
|
|
4060
4063
|
r.user = { ...i, peerId: t };
|
|
4061
4064
|
}
|
|
4062
4065
|
for (const i of Object.keys(n.peers ?? {})) {
|
|
4063
4066
|
const o = (e == null ? void 0 : e.peers) === void 0, a = Array.isArray(e == null ? void 0 : e.peers) && (e == null ? void 0 : e.peers.includes(i));
|
|
4064
4067
|
if (o || a) {
|
|
4065
|
-
const c =
|
|
4068
|
+
const c = sr(n.peers[i], e == null ? void 0 : e.keys);
|
|
4066
4069
|
r.peers[i] = { ...c, peerId: i };
|
|
4067
4070
|
}
|
|
4068
4071
|
}
|
|
4069
4072
|
return r;
|
|
4070
4073
|
}
|
|
4071
|
-
function
|
|
4072
|
-
if (n.isLoading !== e.isLoading || n.error !== e.error || (n.user || e.user) && (!n.user || !e.user || !
|
|
4074
|
+
function Sa(n, e) {
|
|
4075
|
+
if (n.isLoading !== e.isLoading || n.error !== e.error || (n.user || e.user) && (!n.user || !e.user || !Wn(n.user, e.user)) || !Ir(n.peers, e.peers))
|
|
4073
4076
|
return !0;
|
|
4074
4077
|
for (const r of Object.keys(n.peers))
|
|
4075
|
-
if (!
|
|
4078
|
+
if (!Wn(n.peers[r], e.peers[r]))
|
|
4076
4079
|
return !0;
|
|
4077
4080
|
return !1;
|
|
4078
4081
|
}
|
|
4079
|
-
class
|
|
4082
|
+
class ir {
|
|
4080
4083
|
constructor() {
|
|
4081
4084
|
h(this, "promise");
|
|
4082
4085
|
h(this, "_resolve");
|
|
@@ -4092,20 +4095,20 @@ class sr {
|
|
|
4092
4095
|
this._reject(e);
|
|
4093
4096
|
}
|
|
4094
4097
|
}
|
|
4095
|
-
function
|
|
4098
|
+
function es(n, e = []) {
|
|
4096
4099
|
n.forEach((t) => {
|
|
4097
4100
|
const { data: r } = t, { "datalog-result": s } = r, { "join-rows": i } = s;
|
|
4098
4101
|
for (const o of i)
|
|
4099
4102
|
for (const a of o)
|
|
4100
4103
|
e.push(a);
|
|
4101
|
-
|
|
4104
|
+
es(t["child-nodes"], e);
|
|
4102
4105
|
});
|
|
4103
4106
|
}
|
|
4104
|
-
function
|
|
4107
|
+
function or(n) {
|
|
4105
4108
|
const e = [];
|
|
4106
|
-
return
|
|
4109
|
+
return es(n, e), e;
|
|
4107
4110
|
}
|
|
4108
|
-
function
|
|
4111
|
+
function ar(n) {
|
|
4109
4112
|
return Object.values(n.links).reduce((e, t) => {
|
|
4110
4113
|
var r, s;
|
|
4111
4114
|
return e[r = t.forward.on] ?? (e[r] = {}), e[t.forward.on][t.forward.label] = {
|
|
@@ -4119,8 +4122,8 @@ function or(n) {
|
|
|
4119
4122
|
}, e;
|
|
4120
4123
|
}, {});
|
|
4121
4124
|
}
|
|
4122
|
-
const
|
|
4123
|
-
function
|
|
4125
|
+
const ts = "v0.22.164-branch-extra-fields.23220124983.1";
|
|
4126
|
+
function va(n, e) {
|
|
4124
4127
|
return {
|
|
4125
4128
|
info: n ? (...t) => console.info(...t, e()) : () => {
|
|
4126
4129
|
},
|
|
@@ -4169,7 +4172,7 @@ class U extends Error {
|
|
|
4169
4172
|
super(r), this.name = "QueryValidationError";
|
|
4170
4173
|
}
|
|
4171
4174
|
}
|
|
4172
|
-
const
|
|
4175
|
+
const cr = [
|
|
4173
4176
|
"where",
|
|
4174
4177
|
"order",
|
|
4175
4178
|
"limit",
|
|
@@ -4177,10 +4180,12 @@ const ar = [
|
|
|
4177
4180
|
"first",
|
|
4178
4181
|
"offset",
|
|
4179
4182
|
"after",
|
|
4183
|
+
"afterInclusive",
|
|
4180
4184
|
"before",
|
|
4185
|
+
"beforeInclusive",
|
|
4181
4186
|
"fields",
|
|
4182
4187
|
"aggregate"
|
|
4183
|
-
],
|
|
4188
|
+
], Aa = (n) => n.valueType || "unknown", ns = (n, e, t = !1) => {
|
|
4184
4189
|
if (t || n == null)
|
|
4185
4190
|
return !0;
|
|
4186
4191
|
switch (e) {
|
|
@@ -4195,9 +4200,9 @@ const ar = [
|
|
|
4195
4200
|
default:
|
|
4196
4201
|
return !0;
|
|
4197
4202
|
}
|
|
4198
|
-
},
|
|
4203
|
+
}, Oa = (n, e, t, r, s, i, o) => {
|
|
4199
4204
|
const a = i.valueType === "json", c = (u, l, f) => {
|
|
4200
|
-
if (!
|
|
4205
|
+
if (!ns(f, l, a))
|
|
4201
4206
|
throw new U(`Invalid value for operator '${u}' on attribute '${r}' in entity '${s}'. Expected ${l}, but received: ${typeof f}`, o);
|
|
4202
4207
|
};
|
|
4203
4208
|
switch (n) {
|
|
@@ -4228,16 +4233,16 @@ const ar = [
|
|
|
4228
4233
|
throw new U(`Unknown operator '${n}' for attribute '${r}' in entity '${s}'`, o);
|
|
4229
4234
|
}
|
|
4230
4235
|
}, Fe = (n, e, t, r, s) => {
|
|
4231
|
-
const i =
|
|
4236
|
+
const i = Aa(t), o = t.valueType === "json";
|
|
4232
4237
|
if (typeof n == "object" && n !== null && !Array.isArray(n)) {
|
|
4233
4238
|
if (o)
|
|
4234
4239
|
return;
|
|
4235
4240
|
const c = n;
|
|
4236
4241
|
for (const [u, l] of Object.entries(c))
|
|
4237
|
-
|
|
4238
|
-
} else if (!
|
|
4242
|
+
Oa(u, l, i, e, r, t, `${s}.${u}`);
|
|
4243
|
+
} else if (!ns(n, i, o))
|
|
4239
4244
|
throw new U(`Invalid value for attribute '${e}' in entity '${r}'. Expected ${i}, but received: ${typeof n}`, s);
|
|
4240
|
-
},
|
|
4245
|
+
}, Ea = (n, e, t, r, s) => {
|
|
4241
4246
|
const i = n.split(".");
|
|
4242
4247
|
if (i.length < 2)
|
|
4243
4248
|
throw new U(`Invalid dot notation path '${n}'. Must contain at least one dot.`, s);
|
|
@@ -4274,12 +4279,12 @@ const ar = [
|
|
|
4274
4279
|
throw new U(`Attribute '${a}' does not exist on entity '${o}' in dot notation path '${n}'. Available attributes: ${l.length > 0 ? l.join(", ") + ", id" : "id"}`, s);
|
|
4275
4280
|
}
|
|
4276
4281
|
Fe(e, n, u, t, s);
|
|
4277
|
-
},
|
|
4282
|
+
}, rs = (n, e, t, r) => {
|
|
4278
4283
|
for (const [s, i] of Object.entries(n)) {
|
|
4279
4284
|
if (s === "or" || s === "and") {
|
|
4280
4285
|
if (Array.isArray(i))
|
|
4281
4286
|
for (const u of i)
|
|
4282
|
-
typeof u == "object" && u !== null &&
|
|
4287
|
+
typeof u == "object" && u !== null && rs(u, e, t, `${r}.${s}[${u}]`);
|
|
4283
4288
|
continue;
|
|
4284
4289
|
}
|
|
4285
4290
|
if (s === "id") {
|
|
@@ -4287,7 +4292,7 @@ const ar = [
|
|
|
4287
4292
|
continue;
|
|
4288
4293
|
}
|
|
4289
4294
|
if (s.includes(".")) {
|
|
4290
|
-
|
|
4295
|
+
Ea(s, i, e, t, `${r}.${s}`);
|
|
4291
4296
|
continue;
|
|
4292
4297
|
}
|
|
4293
4298
|
const o = t.entities[e];
|
|
@@ -4307,15 +4312,17 @@ const ar = [
|
|
|
4307
4312
|
Fe(i, s, u, e, `${r}.${s}`);
|
|
4308
4313
|
}
|
|
4309
4314
|
}
|
|
4310
|
-
},
|
|
4315
|
+
}, ka = (n, e, t, r, s = 0) => {
|
|
4311
4316
|
for (const o of Object.keys(n))
|
|
4312
|
-
if (!
|
|
4313
|
-
throw new U(`Invalid query parameter '${o}' in $ object. Valid parameters are: ${
|
|
4317
|
+
if (!cr.includes(o))
|
|
4318
|
+
throw new U(`Invalid query parameter '${o}' in $ object. Valid parameters are: ${cr.join(", ")}. Found: ${o}`, r);
|
|
4314
4319
|
const i = [
|
|
4315
4320
|
// 'limit', // only supported client side
|
|
4316
4321
|
"offset",
|
|
4317
4322
|
"before",
|
|
4323
|
+
"beforeInclusive",
|
|
4318
4324
|
"after",
|
|
4325
|
+
"afterInclusive",
|
|
4319
4326
|
"first",
|
|
4320
4327
|
"last"
|
|
4321
4328
|
];
|
|
@@ -4325,9 +4332,9 @@ const ar = [
|
|
|
4325
4332
|
if (n.where && t) {
|
|
4326
4333
|
if (typeof n.where != "object" || n.where === null)
|
|
4327
4334
|
throw new U(`'where' clause must be an object in entity '${e}', but received: ${typeof n.where}`, r ? `${r}.where` : void 0);
|
|
4328
|
-
|
|
4335
|
+
rs(n.where, e, t, r ? `${r}.where` : "where");
|
|
4329
4336
|
}
|
|
4330
|
-
},
|
|
4337
|
+
}, ss = (n, e, t, r, s = 0) => {
|
|
4331
4338
|
var i;
|
|
4332
4339
|
if (!n || typeof n != "object")
|
|
4333
4340
|
throw new U(`Query part for entity '${e}' must be an object, but received: ${typeof n}`, r);
|
|
@@ -4340,15 +4347,15 @@ const ar = [
|
|
|
4340
4347
|
const a = n[o];
|
|
4341
4348
|
if (typeof a == "object" && a !== null) {
|
|
4342
4349
|
const c = (i = t == null ? void 0 : t.entities[e].links[o]) == null ? void 0 : i.entityName;
|
|
4343
|
-
c &&
|
|
4350
|
+
c && ss(a, c, t, `${r}.${o}`, s + 1);
|
|
4344
4351
|
}
|
|
4345
4352
|
} else {
|
|
4346
4353
|
const a = n[o];
|
|
4347
4354
|
if (typeof a != "object" || a === null)
|
|
4348
4355
|
throw new U(`Query parameter '$' must be an object in entity '${e}', but received: ${typeof a}`, `${r}.$`);
|
|
4349
|
-
|
|
4356
|
+
ka(a, e, t, `${r}.$`, s);
|
|
4350
4357
|
}
|
|
4351
|
-
},
|
|
4358
|
+
}, ur = (n, e) => {
|
|
4352
4359
|
if (typeof n != "object" || n === null)
|
|
4353
4360
|
throw new U(`Query must be an object, but received: ${typeof n}${n === null ? " (null)" : ""}`);
|
|
4354
4361
|
if (Array.isArray(n))
|
|
@@ -4364,67 +4371,67 @@ const ar = [
|
|
|
4364
4371
|
const s = Object.keys(e.entities);
|
|
4365
4372
|
throw new U(`Entity '${r}' does not exist in schema. Available entities: ${s.length > 0 ? s.join(", ") : "none"}`, r);
|
|
4366
4373
|
}
|
|
4367
|
-
|
|
4374
|
+
ss(t[r], r, e, r, 0);
|
|
4368
4375
|
}
|
|
4369
4376
|
}
|
|
4370
|
-
},
|
|
4377
|
+
}, lr = (n) => typeof n != "string" ? !1 : Tt(n) ? !0 : Ke(n);
|
|
4371
4378
|
class fe extends Error {
|
|
4372
4379
|
constructor(e) {
|
|
4373
4380
|
super(e), this.name = "TransactionValidationError";
|
|
4374
4381
|
}
|
|
4375
4382
|
}
|
|
4376
|
-
const
|
|
4383
|
+
const is = (n) => n.length > 0 ? n.join(", ") : "none", Ca = (n, e) => new fe(`Entity '${n}' does not exist in schema. Available entities: ${is(e)}`), $t = {
|
|
4377
4384
|
string: (n) => typeof n == "string",
|
|
4378
4385
|
number: (n) => typeof n == "number" && !isNaN(n),
|
|
4379
4386
|
boolean: (n) => typeof n == "boolean",
|
|
4380
4387
|
date: (n) => n instanceof Date || typeof n == "string" || typeof n == "number",
|
|
4381
4388
|
json: () => !0
|
|
4382
|
-
},
|
|
4389
|
+
}, Ia = (n, e) => {
|
|
4383
4390
|
var t;
|
|
4384
4391
|
return n == null ? !0 : ((t = $t[e.valueType]) == null ? void 0 : t.call($t, n)) ?? !1;
|
|
4385
|
-
},
|
|
4392
|
+
}, os = (n, e) => {
|
|
4386
4393
|
const t = e.entities[n];
|
|
4387
4394
|
if (!t)
|
|
4388
|
-
throw
|
|
4395
|
+
throw Ca(n, Object.keys(e.entities));
|
|
4389
4396
|
return t;
|
|
4390
4397
|
}, xt = (n, e, t) => {
|
|
4391
|
-
const r =
|
|
4398
|
+
const r = os(n, t);
|
|
4392
4399
|
if (typeof e != "object" || e === null)
|
|
4393
4400
|
throw new fe(`Arguments for data operation on entity '${n}' must be an object, but received: ${typeof e}`);
|
|
4394
4401
|
for (const [s, i] of Object.entries(e)) {
|
|
4395
4402
|
if (s === "id")
|
|
4396
4403
|
continue;
|
|
4397
4404
|
const o = r.attrs[s];
|
|
4398
|
-
if (o && !
|
|
4405
|
+
if (o && !Ia(i, o))
|
|
4399
4406
|
throw new fe(`Invalid value for attribute '${s}' in entity '${n}'. Expected ${o.valueType}, but received: ${typeof i}`);
|
|
4400
4407
|
}
|
|
4401
|
-
},
|
|
4402
|
-
const r =
|
|
4408
|
+
}, fr = (n, e, t) => {
|
|
4409
|
+
const r = os(n, t);
|
|
4403
4410
|
if (typeof e != "object" || e === null)
|
|
4404
4411
|
throw new fe(`Arguments for link operation on entity '${n}' must be an object, but received: ${typeof e}`);
|
|
4405
4412
|
for (const [s, i] of Object.entries(e)) {
|
|
4406
4413
|
if (!r.links[s]) {
|
|
4407
4414
|
const a = Object.keys(r.links);
|
|
4408
|
-
throw new fe(`Link '${s}' does not exist on entity '${n}'. Available links: ${
|
|
4415
|
+
throw new fe(`Link '${s}' does not exist on entity '${n}'. Available links: ${is(a)}`);
|
|
4409
4416
|
}
|
|
4410
4417
|
if (i != null) {
|
|
4411
4418
|
if (Array.isArray(i)) {
|
|
4412
4419
|
for (const a of i)
|
|
4413
|
-
if (!
|
|
4420
|
+
if (!lr(a))
|
|
4414
4421
|
throw new fe(`Invalid entity ID in link '${s}' for entity '${n}'. Expected a UUID or a lookup, but received: ${a}`);
|
|
4415
|
-
} else if (!
|
|
4422
|
+
} else if (!lr(i))
|
|
4416
4423
|
throw new fe(`Invalid UUID in link '${s}' for entity '${n}'. Expected a UUID, but received: ${i}`);
|
|
4417
4424
|
}
|
|
4418
4425
|
}
|
|
4419
|
-
},
|
|
4426
|
+
}, Pa = {
|
|
4420
4427
|
create: xt,
|
|
4421
4428
|
update: xt,
|
|
4422
4429
|
merge: xt,
|
|
4423
|
-
link:
|
|
4424
|
-
unlink:
|
|
4430
|
+
link: fr,
|
|
4431
|
+
unlink: fr,
|
|
4425
4432
|
delete: () => {
|
|
4426
4433
|
}
|
|
4427
|
-
},
|
|
4434
|
+
}, Ma = (n, e) => {
|
|
4428
4435
|
if (!e)
|
|
4429
4436
|
return;
|
|
4430
4437
|
const [t, r, s, i] = n;
|
|
@@ -4432,9 +4439,9 @@ const ss = (n) => n.length > 0 ? n.join(", ") : "none", ka = (n, e) => new fe(`E
|
|
|
4432
4439
|
throw new fe(`Invalid id for entity '${r}'. Expected a UUID, but received: ${s}`);
|
|
4433
4440
|
if (typeof r != "string")
|
|
4434
4441
|
throw new fe(`Entity name must be a string, but received: ${typeof r}`);
|
|
4435
|
-
const o =
|
|
4442
|
+
const o = Pa[t];
|
|
4436
4443
|
o && i !== void 0 && o(r, i, e);
|
|
4437
|
-
},
|
|
4444
|
+
}, Ra = (n, e) => {
|
|
4438
4445
|
const t = Array.isArray(n) ? n : [n];
|
|
4439
4446
|
for (const r of t) {
|
|
4440
4447
|
if (!r || typeof r != "object")
|
|
@@ -4444,12 +4451,12 @@ const ss = (n) => n.length > 0 ? n.join(", ") : "none", ka = (n, e) => new fe(`E
|
|
|
4444
4451
|
for (const s of r.__ops) {
|
|
4445
4452
|
if (!Array.isArray(s))
|
|
4446
4453
|
throw new fe(`Transaction operation must be an array, but received: ${typeof s}`);
|
|
4447
|
-
|
|
4454
|
+
Ma(s, e);
|
|
4448
4455
|
}
|
|
4449
4456
|
}
|
|
4450
4457
|
};
|
|
4451
|
-
let
|
|
4452
|
-
class
|
|
4458
|
+
let as = 0;
|
|
4459
|
+
class dr {
|
|
4453
4460
|
constructor(e) {
|
|
4454
4461
|
h(this, "type", "ws");
|
|
4455
4462
|
h(this, "conn");
|
|
@@ -4458,7 +4465,7 @@ class fr {
|
|
|
4458
4465
|
h(this, "onmessage");
|
|
4459
4466
|
h(this, "onclose");
|
|
4460
4467
|
h(this, "onerror");
|
|
4461
|
-
this.id = `${this.type}_${
|
|
4468
|
+
this.id = `${this.type}_${as++}`, this.conn = new WebSocket(e), this.conn.onopen = (t) => {
|
|
4462
4469
|
this.onopen && this.onopen({ target: this });
|
|
4463
4470
|
}, this.conn.onmessage = (t) => {
|
|
4464
4471
|
this.onmessage && this.onmessage({
|
|
@@ -4484,7 +4491,7 @@ class fr {
|
|
|
4484
4491
|
return this.conn.send(JSON.stringify(e));
|
|
4485
4492
|
}
|
|
4486
4493
|
}
|
|
4487
|
-
class
|
|
4494
|
+
class ja {
|
|
4488
4495
|
constructor(e, t, r) {
|
|
4489
4496
|
h(this, "type", "sse");
|
|
4490
4497
|
h(this, "initParams", null);
|
|
@@ -4501,7 +4508,7 @@ class Ra {
|
|
|
4501
4508
|
h(this, "onmessage");
|
|
4502
4509
|
h(this, "onclose");
|
|
4503
4510
|
h(this, "onerror");
|
|
4504
|
-
this.id = `${this.type}_${
|
|
4511
|
+
this.id = `${this.type}_${as++}`, this.url = t, this.messageUrl = r || this.url, this.ES = e, this.conn = new e(t), this.sseInitTimeout = setTimeout(() => {
|
|
4505
4512
|
this.initParams || this.handleError();
|
|
4506
4513
|
}, 1e4), this.conn.onmessage = (s) => {
|
|
4507
4514
|
const i = JSON.parse(s.data);
|
|
@@ -4581,24 +4588,24 @@ class Ra {
|
|
|
4581
4588
|
this.handleClose();
|
|
4582
4589
|
}
|
|
4583
4590
|
}
|
|
4584
|
-
function
|
|
4591
|
+
function Da(n, e) {
|
|
4585
4592
|
const t = n.values;
|
|
4586
4593
|
if (t) {
|
|
4587
|
-
const r =
|
|
4594
|
+
const r = $r(t.attrsStore, null);
|
|
4588
4595
|
if (r) {
|
|
4589
4596
|
for (const s of t.entities || [])
|
|
4590
|
-
s.store.useDateObjects = e, s.store =
|
|
4597
|
+
s.store.useDateObjects = e, s.store = Dr(r, s.store);
|
|
4591
4598
|
t.attrsStore = r;
|
|
4592
4599
|
}
|
|
4593
4600
|
}
|
|
4594
4601
|
return n;
|
|
4595
4602
|
}
|
|
4596
|
-
function
|
|
4603
|
+
function $a(n, e) {
|
|
4597
4604
|
var t;
|
|
4598
4605
|
if (e.values) {
|
|
4599
4606
|
const r = [];
|
|
4600
4607
|
for (const s of (t = e.values) == null ? void 0 : t.entities) {
|
|
4601
|
-
const i =
|
|
4608
|
+
const i = jr(s.store);
|
|
4602
4609
|
r.push({ ...s, store: i });
|
|
4603
4610
|
}
|
|
4604
4611
|
return {
|
|
@@ -4608,15 +4615,15 @@ function Da(n, e) {
|
|
|
4608
4615
|
} else
|
|
4609
4616
|
return e;
|
|
4610
4617
|
}
|
|
4611
|
-
function
|
|
4618
|
+
function xa(n, e, t) {
|
|
4612
4619
|
var i, o;
|
|
4613
4620
|
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;
|
|
4614
4621
|
return r && (!s || r > s) ? e : s && (!r || s > r) ? t : e || t;
|
|
4615
4622
|
}
|
|
4616
4623
|
function Ut(n, e, t) {
|
|
4617
|
-
return
|
|
4624
|
+
return Qr({ store: e, attrsStore: t, pageInfo: null, aggregate: null }, n.query).data[n.table][0];
|
|
4618
4625
|
}
|
|
4619
|
-
function
|
|
4626
|
+
function hr(n, e, t, r) {
|
|
4620
4627
|
var o;
|
|
4621
4628
|
const s = (o = W(t, n.table, "id")) == null ? void 0 : o.id;
|
|
4622
4629
|
if (!s)
|
|
@@ -4624,18 +4631,18 @@ function dr(n, e, t, r) {
|
|
|
4624
4631
|
const i = We(e.eav, [r, s, r]);
|
|
4625
4632
|
return i ? i[3] : -1;
|
|
4626
4633
|
}
|
|
4627
|
-
function
|
|
4634
|
+
function pr(n, e, t) {
|
|
4628
4635
|
for (const { action: r, triple: s } of t)
|
|
4629
4636
|
switch (r) {
|
|
4630
4637
|
case "added":
|
|
4631
|
-
|
|
4638
|
+
Lr(n, e, s);
|
|
4632
4639
|
break;
|
|
4633
4640
|
case "removed":
|
|
4634
|
-
|
|
4641
|
+
xr(n, e, s);
|
|
4635
4642
|
break;
|
|
4636
4643
|
}
|
|
4637
4644
|
}
|
|
4638
|
-
function
|
|
4645
|
+
function Ua(n, e, t) {
|
|
4639
4646
|
var s, i;
|
|
4640
4647
|
const r = {};
|
|
4641
4648
|
for (const { action: o, triple: a } of t) {
|
|
@@ -4663,14 +4670,14 @@ function xa(n, e, t) {
|
|
|
4663
4670
|
function ft(n, e) {
|
|
4664
4671
|
return { [n.table]: e.map((t) => t.entity) };
|
|
4665
4672
|
}
|
|
4666
|
-
function
|
|
4673
|
+
function La(n, e) {
|
|
4667
4674
|
var r;
|
|
4668
4675
|
if (n.orderFieldType)
|
|
4669
4676
|
return n.orderFieldType;
|
|
4670
4677
|
const t = n.orderField === "serverCreatedAt" ? "number" : (r = W(e(), n.table, n.orderField)) == null ? void 0 : r["checked-data-type"];
|
|
4671
4678
|
return n.orderFieldType = t, t;
|
|
4672
4679
|
}
|
|
4673
|
-
function
|
|
4680
|
+
function Fa(n, e, t) {
|
|
4674
4681
|
const r = e;
|
|
4675
4682
|
if (n.orderField === "serverCreatedAt") {
|
|
4676
4683
|
t.sort(n.orderDirection === "asc" ? function(o, a) {
|
|
@@ -4691,7 +4698,7 @@ var Ee;
|
|
|
4691
4698
|
(function(n) {
|
|
4692
4699
|
n.InitialSyncBatch = "InitialSyncBatch", n.InitialSyncComplete = "InitialSyncComplete", n.LoadFromStorage = "LoadFromStorage", n.SyncTransaction = "SyncTransaction", n.Error = "Error";
|
|
4693
4700
|
})(Ee || (Ee = {}));
|
|
4694
|
-
class
|
|
4701
|
+
class Na {
|
|
4695
4702
|
constructor(e, t, r, s, i, o) {
|
|
4696
4703
|
h(this, "trySend");
|
|
4697
4704
|
h(this, "subs");
|
|
@@ -4702,11 +4709,11 @@ class Fa {
|
|
|
4702
4709
|
h(this, "log");
|
|
4703
4710
|
h(this, "createStore");
|
|
4704
4711
|
h(this, "getAttrs");
|
|
4705
|
-
this.trySend = e, this.config = r, this.log = s, this.createStore = i, this.getAttrs = o, this.subs = new
|
|
4712
|
+
this.trySend = e, this.config = r, this.log = s, this.createStore = i, this.getAttrs = o, this.subs = new on({
|
|
4706
4713
|
persister: t,
|
|
4707
|
-
merge:
|
|
4708
|
-
serialize:
|
|
4709
|
-
parse: (a, c) =>
|
|
4714
|
+
merge: xa,
|
|
4715
|
+
serialize: $a,
|
|
4716
|
+
parse: (a, c) => Da(c, this.config.useDateObjects),
|
|
4710
4717
|
objectSize: (a) => {
|
|
4711
4718
|
var c;
|
|
4712
4719
|
return ((c = a.values) == null ? void 0 : c.entities.length) || 0;
|
|
@@ -4831,7 +4838,7 @@ class Fa {
|
|
|
4831
4838
|
c.push({
|
|
4832
4839
|
store: l,
|
|
4833
4840
|
entity: f,
|
|
4834
|
-
serverCreatedAt:
|
|
4841
|
+
serverCreatedAt: hr(o, l, a.attrsStore, f.id)
|
|
4835
4842
|
}), i.push(f);
|
|
4836
4843
|
}
|
|
4837
4844
|
this.subs.updateInPlace((u) => {
|
|
@@ -4901,9 +4908,9 @@ class Fa {
|
|
|
4901
4908
|
e: for (const [T, S] of Object.entries(u))
|
|
4902
4909
|
for (let _ = 0; _ < f.length; _++) {
|
|
4903
4910
|
const w = f[_];
|
|
4904
|
-
if (
|
|
4905
|
-
|
|
4906
|
-
const C = Ut(s, w.store, l.attrsStore), v =
|
|
4911
|
+
if (_i(w.store, T)) {
|
|
4912
|
+
pr(w.store, l.attrsStore, S);
|
|
4913
|
+
const C = Ut(s, w.store, l.attrsStore), v = Ua(w.store, l.attrsStore, S)[T];
|
|
4907
4914
|
C ? (p.push({
|
|
4908
4915
|
oldEntity: w.entity,
|
|
4909
4916
|
newEntity: C,
|
|
@@ -4915,7 +4922,7 @@ class Fa {
|
|
|
4915
4922
|
const y = [];
|
|
4916
4923
|
for (const [T, S] of Object.entries(u)) {
|
|
4917
4924
|
const _ = this.createStore([]);
|
|
4918
|
-
|
|
4925
|
+
pr(_, l.attrsStore, S);
|
|
4919
4926
|
const w = Ut(s, _, l.attrsStore);
|
|
4920
4927
|
if (!w) {
|
|
4921
4928
|
this.log.error("No entity found after applying change", {
|
|
@@ -4928,14 +4935,14 @@ class Fa {
|
|
|
4928
4935
|
f.push({
|
|
4929
4936
|
store: _,
|
|
4930
4937
|
entity: w,
|
|
4931
|
-
serverCreatedAt:
|
|
4938
|
+
serverCreatedAt: hr(s, _, l.attrsStore, w.id)
|
|
4932
4939
|
}), y.push(w);
|
|
4933
4940
|
}
|
|
4934
4941
|
const b = [];
|
|
4935
4942
|
for (const T of c.sort().reverse())
|
|
4936
4943
|
b.push(f[T].entity), f.splice(T, 1);
|
|
4937
|
-
const g =
|
|
4938
|
-
|
|
4944
|
+
const g = La(s, this.getAttrs);
|
|
4945
|
+
Fa(s, g, f), this.notifyCbs(r, {
|
|
4939
4946
|
type: Ee.SyncTransaction,
|
|
4940
4947
|
data: ft(s, (o = s.values) == null ? void 0 : o.entities),
|
|
4941
4948
|
added: y,
|
|
@@ -4976,7 +4983,7 @@ class Fa {
|
|
|
4976
4983
|
r && this.initSubscription(r.query, r.hash);
|
|
4977
4984
|
}
|
|
4978
4985
|
}
|
|
4979
|
-
function
|
|
4986
|
+
function Ka({ WStream: n, opts: e, startStream: t, appendStream: r, registerStream: s }) {
|
|
4980
4987
|
const i = e.clientId;
|
|
4981
4988
|
let o = null, a = null, c = null;
|
|
4982
4989
|
const u = L();
|
|
@@ -5175,7 +5182,7 @@ function Na({ WStream: n, opts: e, startStream: t, appendStream: r, registerStre
|
|
|
5175
5182
|
}
|
|
5176
5183
|
};
|
|
5177
5184
|
}
|
|
5178
|
-
class
|
|
5185
|
+
class qa {
|
|
5179
5186
|
constructor() {
|
|
5180
5187
|
h(this, "items", []);
|
|
5181
5188
|
h(this, "resolvers", []);
|
|
@@ -5209,7 +5216,7 @@ class Ka {
|
|
|
5209
5216
|
}
|
|
5210
5217
|
}
|
|
5211
5218
|
}
|
|
5212
|
-
function
|
|
5219
|
+
function Wa({ RStream: n, opts: e, startStream: t, cancelStream: r }) {
|
|
5213
5220
|
let s = e.byteOffset || 0, i = !1;
|
|
5214
5221
|
const o = new TextDecoder("utf-8"), a = new TextEncoder();
|
|
5215
5222
|
let c, u = !1;
|
|
@@ -5335,7 +5342,7 @@ function qa({ RStream: n, opts: e, startStream: t, cancelStream: r }) {
|
|
|
5335
5342
|
}
|
|
5336
5343
|
};
|
|
5337
5344
|
}
|
|
5338
|
-
class
|
|
5345
|
+
class za {
|
|
5339
5346
|
constructor({ WStream: e, RStream: t, trySend: r, log: s }) {
|
|
5340
5347
|
h(this, "trySend");
|
|
5341
5348
|
h(this, "WStream");
|
|
@@ -5348,7 +5355,7 @@ class Wa {
|
|
|
5348
5355
|
this.WStream = e, this.RStream = t, this.trySend = r, this.log = s;
|
|
5349
5356
|
}
|
|
5350
5357
|
createWriteStream(e) {
|
|
5351
|
-
const { stream: t, addCompleteCb: r } =
|
|
5358
|
+
const { stream: t, addCompleteCb: r } = Ka({
|
|
5352
5359
|
WStream: this.WStream,
|
|
5353
5360
|
startStream: this.startWriteStream.bind(this),
|
|
5354
5361
|
appendStream: this.appendStream.bind(this),
|
|
@@ -5360,7 +5367,7 @@ class Wa {
|
|
|
5360
5367
|
}), t;
|
|
5361
5368
|
}
|
|
5362
5369
|
createReadStream(e) {
|
|
5363
|
-
const { stream: t, addCloseCb: r } =
|
|
5370
|
+
const { stream: t, addCloseCb: r } = Wa({
|
|
5364
5371
|
RStream: this.RStream,
|
|
5365
5372
|
opts: e,
|
|
5366
5373
|
startStream: this.startReadStream.bind(this),
|
|
@@ -5422,7 +5429,7 @@ class Wa {
|
|
|
5422
5429
|
if (!r && !t)
|
|
5423
5430
|
throw new Error("Must provide one of streamId or clientId to subscribe to the stream.");
|
|
5424
5431
|
r && (o["stream-id"] = r), t && (o["client-id"] = t), s && (o.offset = s), i && (o["rule-params"] = i);
|
|
5425
|
-
const a = new
|
|
5432
|
+
const a = new qa();
|
|
5426
5433
|
return this.readStreamIterators[e] = a, this.trySend(e, o), a;
|
|
5427
5434
|
}
|
|
5428
5435
|
cancelReadStream({ eventId: e }) {
|
|
@@ -5503,39 +5510,39 @@ const _e = {
|
|
|
5503
5510
|
AUTHENTICATED: "authenticated",
|
|
5504
5511
|
CLOSED: "closed",
|
|
5505
5512
|
ERRORED: "errored"
|
|
5506
|
-
},
|
|
5513
|
+
}, Va = 3e4, Ba = 3e4, Qa = 200, Ga = 1e3 * 60, Ha = {
|
|
5507
5514
|
apiURI: "https://api.instantdb.com",
|
|
5508
5515
|
websocketURI: "wss://api.instantdb.com/runtime/session"
|
|
5509
|
-
}, Lt = "_instant_oauth_redirect", xe = "currentUser";
|
|
5510
|
-
function
|
|
5516
|
+
}, Lt = "_instant_oauth_redirect", Ft = "oauthExtraFields", xe = "currentUser";
|
|
5517
|
+
function Ja({ transportType: n, appId: e, apiURI: t, wsURI: r, EventSourceImpl: s }) {
|
|
5511
5518
|
if (!s)
|
|
5512
|
-
return new
|
|
5519
|
+
return new dr(`${r}?app_id=${e}`);
|
|
5513
5520
|
switch (n) {
|
|
5514
5521
|
case "ws":
|
|
5515
|
-
return new
|
|
5522
|
+
return new dr(`${r}?app_id=${e}`);
|
|
5516
5523
|
case "sse":
|
|
5517
|
-
return new
|
|
5524
|
+
return new ja(s, `${t}/runtime/sse?app_id=${e}`);
|
|
5518
5525
|
default:
|
|
5519
5526
|
throw new Error("Unknown transport type " + n);
|
|
5520
5527
|
}
|
|
5521
5528
|
}
|
|
5522
|
-
function
|
|
5529
|
+
function Ya() {
|
|
5523
5530
|
return typeof window < "u" || typeof chrome < "u";
|
|
5524
5531
|
}
|
|
5525
|
-
const
|
|
5532
|
+
const yr = {
|
|
5526
5533
|
"set-presence": !0,
|
|
5527
5534
|
"set-presence-ok": !0,
|
|
5528
5535
|
"refresh-presence": !0,
|
|
5529
5536
|
"patch-presence": !0
|
|
5530
5537
|
};
|
|
5531
|
-
function
|
|
5538
|
+
function Za(n, e) {
|
|
5532
5539
|
var r;
|
|
5533
5540
|
const t = typeof n == "string" ? JSON.parse(n) : n;
|
|
5534
5541
|
if ((r = t == null ? void 0 : t.result) != null && r.store) {
|
|
5535
|
-
const s =
|
|
5542
|
+
const s = $r(t.result.attrsStore, t.result.store);
|
|
5536
5543
|
if (s) {
|
|
5537
5544
|
const i = t.result.store;
|
|
5538
|
-
t.result.store =
|
|
5545
|
+
t.result.store = Dr(s, {
|
|
5539
5546
|
...i,
|
|
5540
5547
|
useDateObjects: e
|
|
5541
5548
|
}), t.result.attrsStore = s;
|
|
@@ -5543,7 +5550,7 @@ function Ya(n, e) {
|
|
|
5543
5550
|
}
|
|
5544
5551
|
return t;
|
|
5545
5552
|
}
|
|
5546
|
-
function
|
|
5553
|
+
function Xa(n, e) {
|
|
5547
5554
|
const { result: t, ...r } = e, s = (
|
|
5548
5555
|
/** @type {import('./reactorTypes.ts').QuerySubInStorage} */
|
|
5549
5556
|
r
|
|
@@ -5551,14 +5558,14 @@ function Za(n, e) {
|
|
|
5551
5558
|
if (t) {
|
|
5552
5559
|
const i = {
|
|
5553
5560
|
...t,
|
|
5554
|
-
store:
|
|
5561
|
+
store: jr(t.store),
|
|
5555
5562
|
attrsStore: t.attrsStore.toJSON()
|
|
5556
5563
|
};
|
|
5557
5564
|
s.result = i;
|
|
5558
5565
|
}
|
|
5559
5566
|
return s;
|
|
5560
5567
|
}
|
|
5561
|
-
function
|
|
5568
|
+
function ec(n, e) {
|
|
5562
5569
|
switch (n) {
|
|
5563
5570
|
case "pendingMutations":
|
|
5564
5571
|
return new Map(typeof e == "string" ? JSON.parse(e) : e);
|
|
@@ -5566,7 +5573,7 @@ function Xa(n, e) {
|
|
|
5566
5573
|
return e;
|
|
5567
5574
|
}
|
|
5568
5575
|
}
|
|
5569
|
-
function
|
|
5576
|
+
function tc(n, e) {
|
|
5570
5577
|
switch (n) {
|
|
5571
5578
|
case "pendingMutations":
|
|
5572
5579
|
return [...e.entries()];
|
|
@@ -5574,18 +5581,18 @@ function ec(n, e) {
|
|
|
5574
5581
|
return e;
|
|
5575
5582
|
}
|
|
5576
5583
|
}
|
|
5577
|
-
function
|
|
5584
|
+
function nc(n, e, t) {
|
|
5578
5585
|
const r = e == null ? void 0 : e.result, s = t == null ? void 0 : t.result;
|
|
5579
5586
|
return r && !s && t && (t.result = r), t || e;
|
|
5580
5587
|
}
|
|
5581
|
-
function
|
|
5588
|
+
function Nt(n) {
|
|
5582
5589
|
return [...n].sort((e, t) => {
|
|
5583
5590
|
const [r, s] = e, [i, o] = t, a = s.order || 0, c = o.order || 0;
|
|
5584
5591
|
return a == c ? r < i ? -1 : r > i ? 1 : 0 : a - c;
|
|
5585
5592
|
});
|
|
5586
5593
|
}
|
|
5587
|
-
class
|
|
5588
|
-
constructor(e, t =
|
|
5594
|
+
class rc {
|
|
5595
|
+
constructor(e, t = Jr, r = Yr, s, i) {
|
|
5589
5596
|
/** @type {s.AttrsStore | undefined} */
|
|
5590
5597
|
h(this, "attrs");
|
|
5591
5598
|
h(this, "_isOnline", !0);
|
|
@@ -5683,9 +5690,9 @@ class nc {
|
|
|
5683
5690
|
});
|
|
5684
5691
|
/** Applies transactions locally and sends transact message to server */
|
|
5685
5692
|
h(this, "pushTx", (e) => {
|
|
5686
|
-
this.config.disableValidation ||
|
|
5693
|
+
this.config.disableValidation || Ra(e, this.config.schema);
|
|
5687
5694
|
try {
|
|
5688
|
-
const t =
|
|
5695
|
+
const t = na({
|
|
5689
5696
|
attrsStore: this.optimisticAttrs(),
|
|
5690
5697
|
schema: this.config.schema,
|
|
5691
5698
|
stores: Object.values(this.querySubs.currentValue).map((r) => {
|
|
@@ -5715,7 +5722,7 @@ class nc {
|
|
|
5715
5722
|
this._updatePendingMutations((c) => {
|
|
5716
5723
|
c.set(r, o);
|
|
5717
5724
|
});
|
|
5718
|
-
const a = new
|
|
5725
|
+
const a = new ir();
|
|
5719
5726
|
return this.mutationDeferredStore.set(r, a), this._sendMutation(r, o), this.notifyAll(), a.promise;
|
|
5720
5727
|
});
|
|
5721
5728
|
h(this, "_transportOnOpen", (e) => {
|
|
@@ -5786,7 +5793,7 @@ class nc {
|
|
|
5786
5793
|
}
|
|
5787
5794
|
this._log.info("[socket][close]", t.id, "schedule reconnect, ms =", this._reconnectTimeoutMs), this._scheduleReconnect();
|
|
5788
5795
|
});
|
|
5789
|
-
if (this._EventSource = i, this.config = { ...
|
|
5796
|
+
if (this._EventSource = i, this.config = { ...Ha, ...e }, this.queryCacheLimit = this.config.queryCacheLimit ?? 10, this._pendingTxCleanupTimeout = this.config.pendingTxCleanupTimeout ?? Ba, this._pendingMutationCleanupThreshold = this.config.pendingMutationCleanupThreshold ?? Qa, this._log = va(e.verbose || Tn || Zr, () => this._reactorStats()), this.versions = { ...s || {}, "@instantdb/core": ts }, this.config.schema && (this._linkIndex = ar(this.config.schema)), !!Ya()) {
|
|
5790
5797
|
if (!e.appId)
|
|
5791
5798
|
throw new Error("Instant must be initialized with an appId.");
|
|
5792
5799
|
if (!Ke(e.appId))
|
|
@@ -5805,9 +5812,9 @@ class nc {
|
|
|
5805
5812
|
} catch (c) {
|
|
5806
5813
|
this._log.error("[error] handle broadcast channel", c);
|
|
5807
5814
|
}
|
|
5808
|
-
})), this._initStorage(t), this._syncTable = new
|
|
5815
|
+
})), this._initStorage(t), this._syncTable = new Na(this._trySendAuthed.bind(this), new t(this.config.appId, "syncSubs"), {
|
|
5809
5816
|
useDateObjects: this.config.useDateObjects
|
|
5810
|
-
}, this._log, (o) => Je(this.ensureAttrs(), o, this.config.enableCardinalityInference, this.config.useDateObjects), () => this.ensureAttrs()), this._instantStream = new
|
|
5817
|
+
}, this._log, (o) => Je(this.ensureAttrs(), o, this.config.enableCardinalityInference, this.config.useDateObjects), () => this.ensureAttrs()), this._instantStream = new za({
|
|
5811
5818
|
WStream: this.config.WritableStream || WritableStream,
|
|
5812
5819
|
RStream: this.config.ReadableStream || ReadableStream,
|
|
5813
5820
|
trySend: this._trySendAuthed.bind(this),
|
|
@@ -5817,7 +5824,7 @@ class nc {
|
|
|
5817
5824
|
}), setInterval(async () => {
|
|
5818
5825
|
const o = await this.getCurrentUser();
|
|
5819
5826
|
this.syncUserToEndpoint(o.user);
|
|
5820
|
-
},
|
|
5827
|
+
}, Ga), r.getIsOnline().then((o) => {
|
|
5821
5828
|
this._isOnline = o, this._startSocket(), r.listen((a) => {
|
|
5822
5829
|
a !== this._isOnline && (this._log.info("[network] online =", a), this._isOnline = a, this._isOnline ? this._startSocket() : (this._log.info("Changing status from", this.status, "to", _e.CLOSED), this._setStatus(_e.CLOSED)));
|
|
5823
5830
|
});
|
|
@@ -5841,7 +5848,7 @@ class nc {
|
|
|
5841
5848
|
...this.config,
|
|
5842
5849
|
schema: e,
|
|
5843
5850
|
cardinalityInference: !!e
|
|
5844
|
-
}, this._linkIndex = e ?
|
|
5851
|
+
}, this._linkIndex = e ? ar(this.config.schema) : null;
|
|
5845
5852
|
}
|
|
5846
5853
|
_reactorStats() {
|
|
5847
5854
|
return {
|
|
@@ -5854,11 +5861,11 @@ class nc {
|
|
|
5854
5861
|
this.kv.waitForKeyToLoad("pendingMutations").then(() => this.notifyOne(e));
|
|
5855
5862
|
}
|
|
5856
5863
|
_initStorage(e) {
|
|
5857
|
-
this.querySubs = new
|
|
5864
|
+
this.querySubs = new on({
|
|
5858
5865
|
persister: new e(this.config.appId, "querySubs"),
|
|
5859
|
-
merge:
|
|
5860
|
-
serialize:
|
|
5861
|
-
parse: (t, r) =>
|
|
5866
|
+
merge: nc,
|
|
5867
|
+
serialize: Xa,
|
|
5868
|
+
parse: (t, r) => Za(r, this.config.useDateObjects),
|
|
5862
5869
|
// objectSize
|
|
5863
5870
|
objectSize: (t) => {
|
|
5864
5871
|
var r, s, i;
|
|
@@ -5874,11 +5881,11 @@ class nc {
|
|
|
5874
5881
|
maxSize: 1e6
|
|
5875
5882
|
// 1 million triples
|
|
5876
5883
|
}
|
|
5877
|
-
}), this.querySubs.onKeyLoaded = (t) => this._onQuerySubLoaded(t), this.kv = new
|
|
5884
|
+
}), this.querySubs.onKeyLoaded = (t) => this._onQuerySubLoaded(t), this.kv = new on({
|
|
5878
5885
|
persister: new e(this.config.appId, "kv"),
|
|
5879
5886
|
merge: this._onMergeKv,
|
|
5880
|
-
serialize:
|
|
5881
|
-
parse:
|
|
5887
|
+
serialize: tc,
|
|
5888
|
+
parse: ec,
|
|
5882
5889
|
objectSize: () => 0,
|
|
5883
5890
|
logger: this._log,
|
|
5884
5891
|
saveThrottleMs: 100,
|
|
@@ -5957,7 +5964,7 @@ class nc {
|
|
|
5957
5964
|
_handleReceive(e, t) {
|
|
5958
5965
|
var s, i, o, a, c, u, l;
|
|
5959
5966
|
const r = !!this.config.schema && ("cardinalityInference" in this.config ? !!this.config.cardinalityInference : !0);
|
|
5960
|
-
switch (
|
|
5967
|
+
switch (yr[t.op] || this._log.info("[receive]", e, t.op, t), t.op) {
|
|
5961
5968
|
case "init-ok": {
|
|
5962
5969
|
this._setStatus(_e.AUTHENTICATED), this._reconnectTimeoutMs = 0, this._setAttrs(t.attrs), this._flushPendingMessages(), this._sessionId = t["session-id"];
|
|
5963
5970
|
for (const y of Object.keys(this._rooms)) {
|
|
@@ -5974,7 +5981,7 @@ class nc {
|
|
|
5974
5981
|
const { q: y, result: b } = t, g = Q(y);
|
|
5975
5982
|
if (!this._hasQueryListeners() && !this.querySubs.currentValue[g])
|
|
5976
5983
|
break;
|
|
5977
|
-
const T = (c = (a = b == null ? void 0 : b[0]) == null ? void 0 : a.data) == null ? void 0 : c["page-info"], S = (l = (u = b == null ? void 0 : b[0]) == null ? void 0 : u.data) == null ? void 0 : l.aggregate, _ =
|
|
5984
|
+
const T = (c = (a = b == null ? void 0 : b[0]) == null ? void 0 : a.data) == null ? void 0 : c["page-info"], S = (l = (u = b == null ? void 0 : b[0]) == null ? void 0 : u.data) == null ? void 0 : l.aggregate, _ = or(b), w = this.ensureAttrs(), C = Je(w, _, r, this.config.useDateObjects);
|
|
5978
5985
|
this.querySubs.updateInPlace((v) => {
|
|
5979
5986
|
if (!v[g]) {
|
|
5980
5987
|
this._log.info("Missing value in querySubs", { hash: g, q: y });
|
|
@@ -6029,9 +6036,9 @@ class nc {
|
|
|
6029
6036
|
T !== this._pendingMutations() && this.kv.updateInPlace((w) => {
|
|
6030
6037
|
w.pendingMutations = T;
|
|
6031
6038
|
});
|
|
6032
|
-
const S =
|
|
6039
|
+
const S = Nt(T.entries()), _ = y.map((w) => {
|
|
6033
6040
|
var F, V, J, me;
|
|
6034
|
-
const C = w["instaql-query"], v = w["instaql-result"], k = Q(C), j =
|
|
6041
|
+
const C = w["instaql-query"], v = w["instaql-result"], k = Q(C), j = or(v), x = this.ensureAttrs(), z = Je(x, j, r, this.config.useDateObjects), { store: ue, attrsStore: Ae } = this._applyOptimisticUpdates(z, x, S, g), Y = (V = (F = v == null ? void 0 : v[0]) == null ? void 0 : F.data) == null ? void 0 : V["page-info"], te = (me = (J = v == null ? void 0 : v[0]) == null ? void 0 : J.data) == null ? void 0 : me.aggregate;
|
|
6035
6042
|
return {
|
|
6036
6043
|
q: C,
|
|
6037
6044
|
hash: k,
|
|
@@ -6232,21 +6239,21 @@ class nc {
|
|
|
6232
6239
|
* Returns an unsubscribe function
|
|
6233
6240
|
*/
|
|
6234
6241
|
subscribeQuery(e, t, r) {
|
|
6235
|
-
this.config.disableValidation ||
|
|
6242
|
+
this.config.disableValidation || ur(e, this.config.schema), r && "ruleParams" in r && (e = { $$ruleParams: r.ruleParams, ...e });
|
|
6236
6243
|
const s = Q(e), i = this.getPreviousResult(e);
|
|
6237
6244
|
return i && t(i), this.queryCbs[s] = this.queryCbs[s] ?? [], this.queryCbs[s].push({ q: e, cb: t }), this._startQuerySub(e, s), () => {
|
|
6238
6245
|
this._unsubQuery(e, s, t);
|
|
6239
6246
|
};
|
|
6240
6247
|
}
|
|
6241
6248
|
queryOnce(e, t) {
|
|
6242
|
-
this.config.disableValidation ||
|
|
6243
|
-
const r = new
|
|
6249
|
+
this.config.disableValidation || ur(e, this.config.schema), t && "ruleParams" in t && (e = { $$ruleParams: t.ruleParams, ...e });
|
|
6250
|
+
const r = new ir();
|
|
6244
6251
|
if (!this._isOnline)
|
|
6245
6252
|
return r.reject(new Error("We can't run `queryOnce`, because the device is offline.")), r.promise;
|
|
6246
6253
|
if (!this.querySubs)
|
|
6247
6254
|
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;
|
|
6248
6255
|
const s = Q(e), i = this._startQuerySub(e, s);
|
|
6249
|
-
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")),
|
|
6256
|
+
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")), Va), r.promise;
|
|
6250
6257
|
}
|
|
6251
6258
|
_completeQueryOnce(e, t, r) {
|
|
6252
6259
|
this.queryOnceDfds[t] && (this.queryOnceDfds[t] = this.queryOnceDfds[t].filter((s) => s.dfd !== r), this._cleanupQuery(e, t));
|
|
@@ -6313,7 +6320,7 @@ class nc {
|
|
|
6313
6320
|
a = !0;
|
|
6314
6321
|
continue;
|
|
6315
6322
|
}
|
|
6316
|
-
const g = a ?
|
|
6323
|
+
const g = a ? Mo(o, y) : y;
|
|
6317
6324
|
p.push(g);
|
|
6318
6325
|
}
|
|
6319
6326
|
return a ? p : l;
|
|
@@ -6326,7 +6333,7 @@ class nc {
|
|
|
6326
6333
|
return a ? u : t;
|
|
6327
6334
|
}
|
|
6328
6335
|
_rewriteMutationsSorted(e, t) {
|
|
6329
|
-
return
|
|
6336
|
+
return Nt(this._rewriteMutations(e, t).entries());
|
|
6330
6337
|
}
|
|
6331
6338
|
// ---------------------------
|
|
6332
6339
|
// Transact
|
|
@@ -6371,12 +6378,12 @@ class nc {
|
|
|
6371
6378
|
const _ = this._applyOptimisticUpdates(f, p, T, g);
|
|
6372
6379
|
f = _.store, p = _.attrsStore;
|
|
6373
6380
|
}
|
|
6374
|
-
return { data:
|
|
6381
|
+
return { data: Qr({ store: f, attrsStore: p, pageInfo: y, aggregate: b }, c), querySubVersion: s, pendingMutationsVersion: o };
|
|
6375
6382
|
}
|
|
6376
6383
|
_applyOptimisticUpdates(e, t, r, s) {
|
|
6377
6384
|
for (const [i, o] of r)
|
|
6378
6385
|
if (!o["tx-id"] || s && o["tx-id"] > s) {
|
|
6379
|
-
const a =
|
|
6386
|
+
const a = Ii(e, t, o["tx-steps"]);
|
|
6380
6387
|
e = a.store, t = a.attrsStore;
|
|
6381
6388
|
}
|
|
6382
6389
|
return { store: e, attrsStore: t };
|
|
@@ -6435,7 +6442,7 @@ class nc {
|
|
|
6435
6442
|
const r = this._rewriteMutations(this.ensureAttrs(), this._pendingMutations());
|
|
6436
6443
|
r !== this._pendingMutations() && this.kv.updateInPlace((i) => {
|
|
6437
6444
|
i.pendingMutations = r;
|
|
6438
|
-
}),
|
|
6445
|
+
}), Nt(r.entries()).forEach(([i, o]) => {
|
|
6439
6446
|
o["tx-id"] || this._sendMutation(i, o);
|
|
6440
6447
|
}), this._syncTable.flushPending();
|
|
6441
6448
|
}
|
|
@@ -6470,7 +6477,7 @@ class nc {
|
|
|
6470
6477
|
}
|
|
6471
6478
|
_trySend(e, t, r) {
|
|
6472
6479
|
if (this._transport.isOpen()) {
|
|
6473
|
-
switch (
|
|
6480
|
+
switch (yr[t.op] || this._log.info("[send]", this._transport.id, t.op, {
|
|
6474
6481
|
"client-event-id": e,
|
|
6475
6482
|
...t
|
|
6476
6483
|
}), t.op) {
|
|
@@ -6494,7 +6501,7 @@ class nc {
|
|
|
6494
6501
|
return;
|
|
6495
6502
|
}
|
|
6496
6503
|
const e = this._transport;
|
|
6497
|
-
this._transport =
|
|
6504
|
+
this._transport = Ja({
|
|
6498
6505
|
transportType: this._transportType,
|
|
6499
6506
|
appId: this.config.appId,
|
|
6500
6507
|
apiURI: this.config.apiURI,
|
|
@@ -6564,13 +6571,18 @@ class nc {
|
|
|
6564
6571
|
return null;
|
|
6565
6572
|
this._replaceUrlAfterOAuth();
|
|
6566
6573
|
try {
|
|
6567
|
-
const c = await this.
|
|
6574
|
+
const c = await this.kv.waitForKeyToLoad(Ft);
|
|
6575
|
+
c && this.kv.updateInPlace((p) => {
|
|
6576
|
+
delete p[Ft];
|
|
6577
|
+
});
|
|
6578
|
+
const u = await this._getCurrentUser(), l = (u == null ? void 0 : u.type) === "guest", { user: f } = await rr({
|
|
6568
6579
|
apiURI: this.config.apiURI,
|
|
6569
6580
|
appId: this.config.appId,
|
|
6570
6581
|
code: r,
|
|
6571
|
-
refreshToken:
|
|
6582
|
+
refreshToken: l ? u.refresh_token : void 0,
|
|
6583
|
+
extraFields: c
|
|
6572
6584
|
});
|
|
6573
|
-
return this.setCurrentUser(
|
|
6585
|
+
return this.setCurrentUser(f), null;
|
|
6574
6586
|
} catch (c) {
|
|
6575
6587
|
return ((s = c == null ? void 0 : c.body) == null ? void 0 : s.type) === "record-not-found" && ((o = (i = c == null ? void 0 : c.body) == null ? void 0 : i.hint) == null ? void 0 : o["record-type"]) === "app-oauth-code" && await this._hasCurrentUser() ? null : { error: { message: ((a = c == null ? void 0 : c.body) == null ? void 0 : a.message) || "Error logging in." } };
|
|
6576
6588
|
}
|
|
@@ -6721,25 +6733,26 @@ class nc {
|
|
|
6721
6733
|
}), this._reconnectTimeoutMs = 0, this._transport.close(), this._oauthCallbackResponse = null, this.notifyAuthSubs(t);
|
|
6722
6734
|
}
|
|
6723
6735
|
sendMagicCode({ email: e }) {
|
|
6724
|
-
return
|
|
6736
|
+
return la({
|
|
6725
6737
|
apiURI: this.config.apiURI,
|
|
6726
6738
|
appId: this.config.appId,
|
|
6727
6739
|
email: e
|
|
6728
6740
|
});
|
|
6729
6741
|
}
|
|
6730
|
-
async signInWithMagicCode(
|
|
6731
|
-
var
|
|
6732
|
-
const
|
|
6742
|
+
async signInWithMagicCode(e) {
|
|
6743
|
+
var i, o;
|
|
6744
|
+
const t = await this.getCurrentUser(), r = ((i = t == null ? void 0 : t.user) == null ? void 0 : i.type) === "guest", s = await fa({
|
|
6733
6745
|
apiURI: this.config.apiURI,
|
|
6734
6746
|
appId: this.config.appId,
|
|
6735
|
-
email: e,
|
|
6736
|
-
code:
|
|
6737
|
-
refreshToken:
|
|
6747
|
+
email: e.email,
|
|
6748
|
+
code: e.code,
|
|
6749
|
+
refreshToken: r ? (o = t == null ? void 0 : t.user) == null ? void 0 : o.refresh_token : void 0,
|
|
6750
|
+
extraFields: e.extraFields
|
|
6738
6751
|
});
|
|
6739
|
-
return await this.changeCurrentUser(
|
|
6752
|
+
return await this.changeCurrentUser(s.user), s;
|
|
6740
6753
|
}
|
|
6741
6754
|
async signInWithCustomToken(e) {
|
|
6742
|
-
const t = await
|
|
6755
|
+
const t = await da({
|
|
6743
6756
|
apiURI: this.config.apiURI,
|
|
6744
6757
|
appId: this.config.appId,
|
|
6745
6758
|
refreshToken: e
|
|
@@ -6747,7 +6760,7 @@ class nc {
|
|
|
6747
6760
|
return await this.changeCurrentUser(t.user), t;
|
|
6748
6761
|
}
|
|
6749
6762
|
async signInAsGuest() {
|
|
6750
|
-
const e = await
|
|
6763
|
+
const e = await ha({
|
|
6751
6764
|
apiURI: this.config.apiURI,
|
|
6752
6765
|
appId: this.config.appId
|
|
6753
6766
|
});
|
|
@@ -6762,7 +6775,7 @@ class nc {
|
|
|
6762
6775
|
this._log.info("[auth-invalidate] skipped invalidateToken");
|
|
6763
6776
|
return;
|
|
6764
6777
|
}
|
|
6765
|
-
|
|
6778
|
+
ya({
|
|
6766
6779
|
apiURI: this.config.apiURI,
|
|
6767
6780
|
appId: this.config.appId,
|
|
6768
6781
|
refreshToken: r
|
|
@@ -6781,27 +6794,33 @@ class nc {
|
|
|
6781
6794
|
* @param {Object} params - The parameters to create the authorization URL.
|
|
6782
6795
|
* @param {string} params.clientName - The name of the client requesting authorization.
|
|
6783
6796
|
* @param {string} params.redirectURL - The URL to redirect users to after authorization.
|
|
6797
|
+
* @param {Record<string, any>} [params.extraFields] - Extra fields to write to $users on creation
|
|
6784
6798
|
* @returns {string} The created authorization URL.
|
|
6785
6799
|
*/
|
|
6786
|
-
createAuthorizationURL({ clientName: e, redirectURL: t }) {
|
|
6787
|
-
|
|
6788
|
-
|
|
6800
|
+
createAuthorizationURL({ clientName: e, redirectURL: t, extraFields: r }) {
|
|
6801
|
+
r && this.kv.updateInPlace((o) => {
|
|
6802
|
+
o[Ft] = r;
|
|
6803
|
+
});
|
|
6804
|
+
const { apiURI: s, appId: i } = this.config;
|
|
6805
|
+
return `${s}/runtime/oauth/start?app_id=${i}&client_name=${e}&redirect_uri=${t}`;
|
|
6789
6806
|
}
|
|
6790
6807
|
/**
|
|
6791
6808
|
* @param {Object} params
|
|
6792
6809
|
* @param {string} params.code - The code received from the OAuth service.
|
|
6793
6810
|
* @param {string} [params.codeVerifier] - The code verifier used to generate the code challenge.
|
|
6811
|
+
* @param {Record<string, any>} [params.extraFields] - Extra fields to write to $users on creation
|
|
6794
6812
|
*/
|
|
6795
|
-
async exchangeCodeForToken({ code: e, codeVerifier: t }) {
|
|
6796
|
-
var
|
|
6797
|
-
const
|
|
6813
|
+
async exchangeCodeForToken({ code: e, codeVerifier: t, extraFields: r }) {
|
|
6814
|
+
var a, c;
|
|
6815
|
+
const s = await this.getCurrentUser(), i = ((a = s == null ? void 0 : s.user) == null ? void 0 : a.type) === "guest", o = await rr({
|
|
6798
6816
|
apiURI: this.config.apiURI,
|
|
6799
6817
|
appId: this.config.appId,
|
|
6800
6818
|
code: e,
|
|
6801
6819
|
codeVerifier: t,
|
|
6802
|
-
refreshToken:
|
|
6820
|
+
refreshToken: i ? (c = s == null ? void 0 : s.user) == null ? void 0 : c.refresh_token : void 0,
|
|
6821
|
+
extraFields: r
|
|
6803
6822
|
});
|
|
6804
|
-
return await this.changeCurrentUser(
|
|
6823
|
+
return await this.changeCurrentUser(o.user), o;
|
|
6805
6824
|
}
|
|
6806
6825
|
issuerURI() {
|
|
6807
6826
|
const { apiURI: e, appId: t } = this.config;
|
|
@@ -6812,18 +6831,20 @@ class nc {
|
|
|
6812
6831
|
* @param {string} params.clientName - The name of the client requesting authorization.
|
|
6813
6832
|
* @param {string} params.idToken - The id_token from the external service
|
|
6814
6833
|
* @param {string | null | undefined} [params.nonce] - The nonce used when requesting the id_token from the external service
|
|
6834
|
+
* @param {Record<string, any>} [params.extraFields] - Extra fields to write to $users on creation
|
|
6815
6835
|
*/
|
|
6816
|
-
async signInWithIdToken(
|
|
6817
|
-
var
|
|
6818
|
-
const
|
|
6836
|
+
async signInWithIdToken(e) {
|
|
6837
|
+
var i;
|
|
6838
|
+
const t = await this.getCurrentUser(), r = (i = t == null ? void 0 : t.user) == null ? void 0 : i.refresh_token, s = await pa({
|
|
6819
6839
|
apiURI: this.config.apiURI,
|
|
6820
6840
|
appId: this.config.appId,
|
|
6821
|
-
idToken: e,
|
|
6822
|
-
clientName:
|
|
6823
|
-
nonce:
|
|
6824
|
-
refreshToken:
|
|
6841
|
+
idToken: e.idToken,
|
|
6842
|
+
clientName: e.clientName,
|
|
6843
|
+
nonce: e.nonce,
|
|
6844
|
+
refreshToken: r,
|
|
6845
|
+
extraFields: e.extraFields
|
|
6825
6846
|
});
|
|
6826
|
-
return await this.changeCurrentUser(
|
|
6847
|
+
return await this.changeCurrentUser(s.user), s;
|
|
6827
6848
|
}
|
|
6828
6849
|
// --------
|
|
6829
6850
|
// Rooms
|
|
@@ -6858,7 +6879,7 @@ class nc {
|
|
|
6858
6879
|
getPresence(e, t, r = {}) {
|
|
6859
6880
|
const s = this._rooms[t], i = this._presence[t];
|
|
6860
6881
|
return !s || !i || !i.result ? null : {
|
|
6861
|
-
...
|
|
6882
|
+
...Ta(i.result, r, this._sessionId),
|
|
6862
6883
|
isLoading: !s.isConnected,
|
|
6863
6884
|
error: s.error
|
|
6864
6885
|
};
|
|
@@ -6920,7 +6941,7 @@ class nc {
|
|
|
6920
6941
|
}
|
|
6921
6942
|
_notifyPresenceSub(e, t) {
|
|
6922
6943
|
const r = this.getPresence("", e, t);
|
|
6923
|
-
r && (t.prev && !
|
|
6944
|
+
r && (t.prev && !Sa(r, t.prev) || (t.prev = r, t.cb(r)));
|
|
6924
6945
|
}
|
|
6925
6946
|
_patchPresencePeers(e, t) {
|
|
6926
6947
|
var o, a, c;
|
|
@@ -6931,13 +6952,13 @@ class nc {
|
|
|
6931
6952
|
for (let [l, f, p] of t)
|
|
6932
6953
|
switch (f) {
|
|
6933
6954
|
case "+":
|
|
6934
|
-
|
|
6955
|
+
Ys(u, l, p);
|
|
6935
6956
|
break;
|
|
6936
6957
|
case "r":
|
|
6937
|
-
|
|
6958
|
+
zn(u, l, p);
|
|
6938
6959
|
break;
|
|
6939
6960
|
case "-":
|
|
6940
|
-
|
|
6961
|
+
Mr(u, l);
|
|
6941
6962
|
break;
|
|
6942
6963
|
}
|
|
6943
6964
|
delete u[this._sessionId];
|
|
@@ -6949,7 +6970,7 @@ class nc {
|
|
|
6949
6970
|
delete r[this._sessionId];
|
|
6950
6971
|
const s = Object.fromEntries(Object.entries(r).map(([i, o]) => [i, o.data]));
|
|
6951
6972
|
this._presence = mt(this._presence, (i) => {
|
|
6952
|
-
|
|
6973
|
+
zn(i, [e, "result", "peers"], s);
|
|
6953
6974
|
});
|
|
6954
6975
|
}
|
|
6955
6976
|
// --------
|
|
@@ -6992,7 +7013,7 @@ class nc {
|
|
|
6992
7013
|
async uploadFile(e, t, r) {
|
|
6993
7014
|
var o;
|
|
6994
7015
|
const s = await this.getCurrentUser(), i = (o = s == null ? void 0 : s.user) == null ? void 0 : o.refresh_token;
|
|
6995
|
-
return
|
|
7016
|
+
return ba({
|
|
6996
7017
|
...r,
|
|
6997
7018
|
apiURI: this.config.apiURI,
|
|
6998
7019
|
appId: this.config.appId,
|
|
@@ -7004,7 +7025,7 @@ class nc {
|
|
|
7004
7025
|
async deleteFile(e) {
|
|
7005
7026
|
var i;
|
|
7006
7027
|
const t = await this.getCurrentUser(), r = (i = t == null ? void 0 : t.user) == null ? void 0 : i.refresh_token;
|
|
7007
|
-
return await
|
|
7028
|
+
return await _a({
|
|
7008
7029
|
apiURI: this.config.apiURI,
|
|
7009
7030
|
appId: this.config.appId,
|
|
7010
7031
|
path: e,
|
|
@@ -7015,18 +7036,18 @@ class nc {
|
|
|
7015
7036
|
// ---------------------------------
|
|
7016
7037
|
async upload(e, t) {
|
|
7017
7038
|
var c;
|
|
7018
|
-
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
|
|
7039
|
+
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 ga({
|
|
7019
7040
|
apiURI: this.config.apiURI,
|
|
7020
7041
|
appId: this.config.appId,
|
|
7021
7042
|
fileName: i,
|
|
7022
7043
|
refreshToken: s
|
|
7023
7044
|
});
|
|
7024
|
-
return await
|
|
7045
|
+
return await ma(o, t);
|
|
7025
7046
|
}
|
|
7026
7047
|
async getDownloadUrl(e) {
|
|
7027
7048
|
var i;
|
|
7028
7049
|
const t = await this.getCurrentUser(), r = (i = t == null ? void 0 : t.user) == null ? void 0 : i.refresh_token;
|
|
7029
|
-
return await
|
|
7050
|
+
return await wa({
|
|
7030
7051
|
apiURI: this.config.apiURI,
|
|
7031
7052
|
appId: this.config.appId,
|
|
7032
7053
|
path: e,
|
|
@@ -7035,9 +7056,9 @@ class nc {
|
|
|
7035
7056
|
}
|
|
7036
7057
|
}
|
|
7037
7058
|
let dt;
|
|
7038
|
-
function
|
|
7059
|
+
function sc(n, e) {
|
|
7039
7060
|
dt == null || dt.dispose();
|
|
7040
|
-
const t =
|
|
7061
|
+
const t = lc(e), r = ac(e, a), s = oc(ic(n));
|
|
7041
7062
|
function i(l) {
|
|
7042
7063
|
var f;
|
|
7043
7064
|
l.source === s.element.contentWindow && ((f = l.data) == null ? void 0 : f.type) === "close" && t.isVisible() && a();
|
|
@@ -7059,10 +7080,10 @@ function rc(n, e) {
|
|
|
7059
7080
|
}
|
|
7060
7081
|
return u();
|
|
7061
7082
|
}
|
|
7062
|
-
function sc(n) {
|
|
7063
|
-
return `${wn || Zr ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${n}`;
|
|
7064
|
-
}
|
|
7065
7083
|
function ic(n) {
|
|
7084
|
+
return `${Tn || Xr ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${n}`;
|
|
7085
|
+
}
|
|
7086
|
+
function oc(n) {
|
|
7066
7087
|
const e = document.createElement("iframe");
|
|
7067
7088
|
return e.src = n, e.className = "instant-devtool-iframe", Object.assign(e.style, {
|
|
7068
7089
|
width: "100%",
|
|
@@ -7071,7 +7092,7 @@ function ic(n) {
|
|
|
7071
7092
|
border: "none"
|
|
7072
7093
|
}), { element: e };
|
|
7073
7094
|
}
|
|
7074
|
-
function
|
|
7095
|
+
function ac(n, e) {
|
|
7075
7096
|
const t = `
|
|
7076
7097
|
<svg width="32" height="32" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
7077
7098
|
<rect width="512" height="512" fill="black"/>
|
|
@@ -7081,7 +7102,7 @@ function oc(n, e) {
|
|
|
7081
7102
|
return r.innerHTML = t, r.className = "instant-devtool-toggler", Object.assign(r.style, {
|
|
7082
7103
|
// pos
|
|
7083
7104
|
position: "fixed",
|
|
7084
|
-
...
|
|
7105
|
+
...cc(n.position),
|
|
7085
7106
|
height: "32px",
|
|
7086
7107
|
width: "32px",
|
|
7087
7108
|
// layout
|
|
@@ -7096,7 +7117,7 @@ function oc(n, e) {
|
|
|
7096
7117
|
cursor: "pointer"
|
|
7097
7118
|
}), r.addEventListener("click", e), { element: r };
|
|
7098
7119
|
}
|
|
7099
|
-
function
|
|
7120
|
+
function cc(n) {
|
|
7100
7121
|
switch (n) {
|
|
7101
7122
|
case "bottom-left":
|
|
7102
7123
|
return { bottom: "24px", left: "24px" };
|
|
@@ -7108,7 +7129,7 @@ function ac(n) {
|
|
|
7108
7129
|
return { top: "24px", left: "24px" };
|
|
7109
7130
|
}
|
|
7110
7131
|
}
|
|
7111
|
-
function
|
|
7132
|
+
function uc(n) {
|
|
7112
7133
|
switch (n) {
|
|
7113
7134
|
case "bottom-left":
|
|
7114
7135
|
return { bottom: "24px", right: "24px", left: "60px", top: "72px" };
|
|
@@ -7120,11 +7141,11 @@ function cc(n) {
|
|
|
7120
7141
|
return { top: "24px", right: "24px", left: "60px", bottom: "72px" };
|
|
7121
7142
|
}
|
|
7122
7143
|
}
|
|
7123
|
-
function
|
|
7144
|
+
function lc(n) {
|
|
7124
7145
|
const e = document.createElement("div");
|
|
7125
7146
|
Object.assign(e.style, {
|
|
7126
7147
|
position: "fixed",
|
|
7127
|
-
...
|
|
7148
|
+
...uc(n.position),
|
|
7128
7149
|
display: "block",
|
|
7129
7150
|
borderRadius: "4px",
|
|
7130
7151
|
border: "1px #ccc solid",
|
|
@@ -7137,22 +7158,22 @@ function uc(n) {
|
|
|
7137
7158
|
}
|
|
7138
7159
|
return { element: e, isVisible: t };
|
|
7139
7160
|
}
|
|
7140
|
-
const
|
|
7161
|
+
const fc = {
|
|
7141
7162
|
apiURI: "https://api.instantdb.com",
|
|
7142
7163
|
websocketURI: "wss://api.instantdb.com/runtime/session"
|
|
7143
7164
|
};
|
|
7144
|
-
function
|
|
7165
|
+
function dc() {
|
|
7145
7166
|
return globalThis.__instantDbSchemaHashStore = globalThis.__instantDbSchemaHashStore ?? /* @__PURE__ */ new WeakMap(), globalThis.__instantDbSchemaHashStore;
|
|
7146
7167
|
}
|
|
7147
|
-
function
|
|
7168
|
+
function hc() {
|
|
7148
7169
|
return globalThis.__instantDbStore = globalThis.__instantDbStore ?? {}, globalThis.__instantDbStore;
|
|
7149
7170
|
}
|
|
7150
|
-
function
|
|
7171
|
+
function an(n) {
|
|
7151
7172
|
const e = n.__adminToken;
|
|
7152
7173
|
return n.appId + "_" + (n.websocketURI || "default_ws_uri") + "_" + (n.apiURI || "default_api_uri") + "_" + (e || "client_only") + "_" + n.useDateObjects;
|
|
7153
7174
|
}
|
|
7154
|
-
const
|
|
7155
|
-
class
|
|
7175
|
+
const cn = hc(), br = dc();
|
|
7176
|
+
class pc {
|
|
7156
7177
|
constructor(e) {
|
|
7157
7178
|
h(this, "db");
|
|
7158
7179
|
/**
|
|
@@ -7269,7 +7290,7 @@ class hc {
|
|
|
7269
7290
|
this.db = e;
|
|
7270
7291
|
}
|
|
7271
7292
|
}
|
|
7272
|
-
class
|
|
7293
|
+
class yc {
|
|
7273
7294
|
constructor(e) {
|
|
7274
7295
|
h(this, "db");
|
|
7275
7296
|
/**
|
|
@@ -7327,7 +7348,7 @@ class pc {
|
|
|
7327
7348
|
this.db = e;
|
|
7328
7349
|
}
|
|
7329
7350
|
}
|
|
7330
|
-
class
|
|
7351
|
+
class bc {
|
|
7331
7352
|
constructor(e) {
|
|
7332
7353
|
h(this, "db");
|
|
7333
7354
|
/**
|
|
@@ -7353,17 +7374,17 @@ class yc {
|
|
|
7353
7374
|
this.db = e;
|
|
7354
7375
|
}
|
|
7355
7376
|
}
|
|
7356
|
-
function
|
|
7377
|
+
function _c(n) {
|
|
7357
7378
|
return JSON.parse(JSON.stringify(n));
|
|
7358
7379
|
}
|
|
7359
|
-
class
|
|
7380
|
+
class gc {
|
|
7360
7381
|
constructor(e) {
|
|
7361
7382
|
h(this, "_reactor");
|
|
7362
7383
|
h(this, "auth");
|
|
7363
7384
|
h(this, "storage");
|
|
7364
7385
|
h(this, "streams");
|
|
7365
|
-
h(this, "tx",
|
|
7366
|
-
this._reactor = e, this.auth = new
|
|
7386
|
+
h(this, "tx", wn());
|
|
7387
|
+
this._reactor = e, this.auth = new pc(this._reactor), this.storage = new yc(this._reactor), this.streams = new bc(this._reactor);
|
|
7367
7388
|
}
|
|
7368
7389
|
/**
|
|
7369
7390
|
* Use this to write data! You can create, update, delete, and link objects
|
|
@@ -7504,7 +7525,7 @@ class _c {
|
|
|
7504
7525
|
};
|
|
7505
7526
|
}
|
|
7506
7527
|
shutdown() {
|
|
7507
|
-
delete an
|
|
7528
|
+
delete cn[an(this._reactor.config)], this._reactor.shutdown();
|
|
7508
7529
|
}
|
|
7509
7530
|
/**
|
|
7510
7531
|
* Use this for one-off queries.
|
|
@@ -7537,35 +7558,35 @@ class _c {
|
|
|
7537
7558
|
return this._reactor.subscribeTable(e, t);
|
|
7538
7559
|
}
|
|
7539
7560
|
}
|
|
7540
|
-
function
|
|
7561
|
+
function _r(n) {
|
|
7541
7562
|
if (!n)
|
|
7542
7563
|
return "0";
|
|
7543
|
-
const e =
|
|
7564
|
+
const e = br.get(n);
|
|
7544
7565
|
if (e)
|
|
7545
7566
|
return e;
|
|
7546
7567
|
const t = Q(n);
|
|
7547
|
-
return
|
|
7568
|
+
return br.set(n, t), t;
|
|
7548
7569
|
}
|
|
7549
|
-
function
|
|
7550
|
-
return
|
|
7570
|
+
function mc(n, e) {
|
|
7571
|
+
return _r(n._reactor.config.schema) !== _r(e);
|
|
7551
7572
|
}
|
|
7552
|
-
function
|
|
7573
|
+
function wc(n, e, t, r, s) {
|
|
7553
7574
|
var u;
|
|
7554
7575
|
const i = {
|
|
7555
7576
|
...n,
|
|
7556
7577
|
appId: (u = n.appId) == null ? void 0 : u.trim(),
|
|
7557
7578
|
useDateObjects: n.useDateObjects ?? !1
|
|
7558
|
-
}, o = an
|
|
7579
|
+
}, o = cn[an(i)];
|
|
7559
7580
|
if (o)
|
|
7560
|
-
return
|
|
7561
|
-
const a = new
|
|
7562
|
-
...
|
|
7581
|
+
return mc(o, i.schema) && o._reactor.updateSchema(i.schema), o;
|
|
7582
|
+
const a = new rc({
|
|
7583
|
+
...fc,
|
|
7563
7584
|
...i,
|
|
7564
7585
|
cardinalityInference: !!i.schema
|
|
7565
|
-
}, e ||
|
|
7566
|
-
return an
|
|
7586
|
+
}, e || Jr, t || Yr, { ...r || {}, "@instantdb/core": ts }, s), c = new gc(a);
|
|
7587
|
+
return cn[an(i)] = c, Tc(i.appId, i.devtool), c;
|
|
7567
7588
|
}
|
|
7568
|
-
function
|
|
7589
|
+
function Tc(n, e) {
|
|
7569
7590
|
if (typeof window > "u" || typeof window.location > "u" || typeof document > "u" || typeof e == "boolean" && !e)
|
|
7570
7591
|
return;
|
|
7571
7592
|
const t = {
|
|
@@ -7573,15 +7594,15 @@ function wc(n, e) {
|
|
|
7573
7594
|
allowedHosts: ["localhost"],
|
|
7574
7595
|
...typeof e == "object" ? e : {}
|
|
7575
7596
|
};
|
|
7576
|
-
t.allowedHosts.includes(window.location.hostname) &&
|
|
7597
|
+
t.allowedHosts.includes(window.location.hostname) && sc(n, t);
|
|
7577
7598
|
}
|
|
7578
|
-
const
|
|
7599
|
+
const gr = {
|
|
7579
7600
|
isLoading: !0,
|
|
7580
7601
|
data: void 0,
|
|
7581
7602
|
pageInfo: void 0,
|
|
7582
7603
|
error: void 0
|
|
7583
7604
|
};
|
|
7584
|
-
function
|
|
7605
|
+
function mr(n) {
|
|
7585
7606
|
return {
|
|
7586
7607
|
isLoading: !n,
|
|
7587
7608
|
data: void 0,
|
|
@@ -7590,12 +7611,12 @@ function gr(n) {
|
|
|
7590
7611
|
...n || {}
|
|
7591
7612
|
};
|
|
7592
7613
|
}
|
|
7593
|
-
function
|
|
7614
|
+
function Sc(n, e, t, r) {
|
|
7594
7615
|
e && t && "ruleParams" in t && (e = { $$ruleParams: t.ruleParams, ...e });
|
|
7595
|
-
const s = e ?
|
|
7596
|
-
|
|
7597
|
-
), a = Ne(
|
|
7598
|
-
(l) => (o.current =
|
|
7616
|
+
const s = e ? _c(e) : null, i = Q(s), o = Ne(
|
|
7617
|
+
mr(n._reactor.getPreviousResult(s))
|
|
7618
|
+
), a = Ne(gr), c = ve(
|
|
7619
|
+
(l) => (o.current = mr(
|
|
7599
7620
|
n._reactor.getPreviousResult(s)
|
|
7600
7621
|
), l(), s ? n.subscribeQuery(s, (p) => {
|
|
7601
7622
|
o.current = {
|
|
@@ -7613,11 +7634,11 @@ function Tc(n, e, t, r) {
|
|
|
7613
7634
|
// Build a new subscribe function if the query changes
|
|
7614
7635
|
[i]
|
|
7615
7636
|
);
|
|
7616
|
-
return { state:
|
|
7637
|
+
return { state: qt(
|
|
7617
7638
|
c,
|
|
7618
7639
|
() => o.current,
|
|
7619
7640
|
() => {
|
|
7620
|
-
if (r && a.current ===
|
|
7641
|
+
if (r && a.current === gr) {
|
|
7621
7642
|
const l = r();
|
|
7622
7643
|
l && (a.current = l);
|
|
7623
7644
|
}
|
|
@@ -7625,7 +7646,7 @@ function Tc(n, e, t, r) {
|
|
|
7625
7646
|
}
|
|
7626
7647
|
), query: s, queryHash: i };
|
|
7627
7648
|
}
|
|
7628
|
-
function
|
|
7649
|
+
function vc() {
|
|
7629
7650
|
const n = Ne(null);
|
|
7630
7651
|
Pe(() => {
|
|
7631
7652
|
t();
|
|
@@ -7638,8 +7659,8 @@ function Sc() {
|
|
|
7638
7659
|
}
|
|
7639
7660
|
return { set: e, clear: t };
|
|
7640
7661
|
}
|
|
7641
|
-
const
|
|
7642
|
-
function
|
|
7662
|
+
const Ac = 1e3;
|
|
7663
|
+
function Oc(n, e, t) {
|
|
7643
7664
|
const r = Ne(t);
|
|
7644
7665
|
r.current = t, Pe(() => n.core._reactor.subscribeTopic(
|
|
7645
7666
|
n.type,
|
|
@@ -7650,7 +7671,7 @@ function Ac(n, e, t) {
|
|
|
7650
7671
|
}
|
|
7651
7672
|
), [n.id, e]);
|
|
7652
7673
|
}
|
|
7653
|
-
function
|
|
7674
|
+
function Ec(n, e) {
|
|
7654
7675
|
return Pe(() => n.core._reactor.joinRoom(n.type, n.id), [n.id]), ve(
|
|
7655
7676
|
(r) => {
|
|
7656
7677
|
n.core._reactor.publishTopic({
|
|
@@ -7663,9 +7684,9 @@ function Oc(n, e) {
|
|
|
7663
7684
|
[n.id, e]
|
|
7664
7685
|
);
|
|
7665
7686
|
}
|
|
7666
|
-
function
|
|
7687
|
+
function kc(n, e = {}) {
|
|
7667
7688
|
var o, a;
|
|
7668
|
-
const [t, r] =
|
|
7689
|
+
const [t, r] = Tr(() => n.core._reactor.getPresence(n.type, n.id, e) ?? {
|
|
7669
7690
|
peers: {},
|
|
7670
7691
|
isLoading: !0
|
|
7671
7692
|
});
|
|
@@ -7683,21 +7704,21 @@ function Ec(n, e = {}) {
|
|
|
7683
7704
|
},
|
|
7684
7705
|
[n.type, n.id]
|
|
7685
7706
|
);
|
|
7686
|
-
return
|
|
7707
|
+
return Wt(() => ({
|
|
7687
7708
|
...t,
|
|
7688
7709
|
publishPresence: s
|
|
7689
7710
|
}), [t, s]);
|
|
7690
7711
|
}
|
|
7691
|
-
function
|
|
7712
|
+
function Cc(n, e, t) {
|
|
7692
7713
|
Pe(
|
|
7693
7714
|
() => n.core._reactor.joinRoom(n.type, n.id, e),
|
|
7694
7715
|
[n.id]
|
|
7695
7716
|
), Pe(() => n.core._reactor.publishPresence(n.type, n.id, e), [n.type, n.id, t ?? JSON.stringify(e)]);
|
|
7696
7717
|
}
|
|
7697
|
-
function
|
|
7698
|
-
const r =
|
|
7718
|
+
function Ic(n, e, t = {}) {
|
|
7719
|
+
const r = vc(), s = ke.usePresence(n, {
|
|
7699
7720
|
keys: [e]
|
|
7700
|
-
}), i =
|
|
7721
|
+
}), i = Wt(() => {
|
|
7701
7722
|
const l = n._core._reactor.getPresence(
|
|
7702
7723
|
n.type,
|
|
7703
7724
|
n.id
|
|
@@ -7709,7 +7730,7 @@ function Cc(n, e, t = {}) {
|
|
|
7709
7730
|
(l) => {
|
|
7710
7731
|
n.core._reactor.publishPresence(n.type, n.id, {
|
|
7711
7732
|
[e]: l
|
|
7712
|
-
}), l && ((t == null ? void 0 : t.timeout) === null || (t == null ? void 0 : t.timeout) === 0 || r.set((t == null ? void 0 : t.timeout) ??
|
|
7733
|
+
}), l && ((t == null ? void 0 : t.timeout) === null || (t == null ? void 0 : t.timeout) === 0 || r.set((t == null ? void 0 : t.timeout) ?? Ac, () => {
|
|
7713
7734
|
n.core._reactor.publishPresence(n.type, n.id, {
|
|
7714
7735
|
[e]: null
|
|
7715
7736
|
});
|
|
@@ -7724,7 +7745,7 @@ function Cc(n, e, t = {}) {
|
|
|
7724
7745
|
[t.stopOnEnter, o]
|
|
7725
7746
|
), c = ve(() => {
|
|
7726
7747
|
o(!1);
|
|
7727
|
-
}, [o]), u =
|
|
7748
|
+
}, [o]), u = Wt(() => ({ onKeyDown: a, onBlur: c }), [a, c]);
|
|
7728
7749
|
return {
|
|
7729
7750
|
active: i,
|
|
7730
7751
|
setActive: o,
|
|
@@ -7732,13 +7753,13 @@ function Cc(n, e, t = {}) {
|
|
|
7732
7753
|
};
|
|
7733
7754
|
}
|
|
7734
7755
|
const ke = {
|
|
7735
|
-
useTopicEffect:
|
|
7736
|
-
usePublishTopic:
|
|
7737
|
-
usePresence:
|
|
7738
|
-
useSyncPresence:
|
|
7739
|
-
useTypingIndicator:
|
|
7756
|
+
useTopicEffect: Oc,
|
|
7757
|
+
usePublishTopic: Ec,
|
|
7758
|
+
usePresence: kc,
|
|
7759
|
+
useSyncPresence: Cc,
|
|
7760
|
+
useTypingIndicator: Ic
|
|
7740
7761
|
};
|
|
7741
|
-
class
|
|
7762
|
+
class Pc {
|
|
7742
7763
|
constructor(e, t, r) {
|
|
7743
7764
|
h(this, "core");
|
|
7744
7765
|
/** @deprecated use `core` instead */
|
|
@@ -7825,14 +7846,14 @@ class Ic {
|
|
|
7825
7846
|
this.core = e, this._core = this.core, this.type = t, this.id = r;
|
|
7826
7847
|
}
|
|
7827
7848
|
}
|
|
7828
|
-
const
|
|
7849
|
+
const Mc = {
|
|
7829
7850
|
isLoading: !0,
|
|
7830
7851
|
user: void 0,
|
|
7831
7852
|
error: void 0
|
|
7832
7853
|
};
|
|
7833
|
-
class
|
|
7854
|
+
class Kt {
|
|
7834
7855
|
constructor(e, t) {
|
|
7835
|
-
h(this, "tx",
|
|
7856
|
+
h(this, "tx", wn());
|
|
7836
7857
|
h(this, "auth");
|
|
7837
7858
|
h(this, "storage");
|
|
7838
7859
|
h(this, "streams");
|
|
@@ -7861,7 +7882,7 @@ class Nt {
|
|
|
7861
7882
|
* console.log('Device ID:', deviceId)
|
|
7862
7883
|
*/
|
|
7863
7884
|
h(this, "useLocalId", (e) => {
|
|
7864
|
-
const [t, r] =
|
|
7885
|
+
const [t, r] = Tr(null);
|
|
7865
7886
|
return Pe(() => {
|
|
7866
7887
|
(async () => {
|
|
7867
7888
|
const i = await this.getLocalId(e);
|
|
@@ -7929,7 +7950,7 @@ class Nt {
|
|
|
7929
7950
|
* auth.user ? { goals: {} } : null,
|
|
7930
7951
|
* );
|
|
7931
7952
|
*/
|
|
7932
|
-
h(this, "useQuery", (e, t) =>
|
|
7953
|
+
h(this, "useQuery", (e, t) => Sc(this.core, e, t).state);
|
|
7933
7954
|
/**
|
|
7934
7955
|
* Listen for the logged in state. This is useful
|
|
7935
7956
|
* for deciding when to show a login screen.
|
|
@@ -8009,7 +8030,7 @@ class Nt {
|
|
|
8009
8030
|
), t = ve((s) => this.core.subscribeConnectionStatus((o) => {
|
|
8010
8031
|
o !== e.current && (e.current = o, s());
|
|
8011
8032
|
}), []);
|
|
8012
|
-
return
|
|
8033
|
+
return qt(
|
|
8013
8034
|
t,
|
|
8014
8035
|
() => e.current,
|
|
8015
8036
|
// For SSR, always return 'connecting' as the initial state
|
|
@@ -8058,7 +8079,7 @@ class Nt {
|
|
|
8058
8079
|
const t = this.useAuth();
|
|
8059
8080
|
return t.isLoading || t.error || t.user ? null : /* @__PURE__ */ ct.jsx(ct.Fragment, { children: e });
|
|
8060
8081
|
});
|
|
8061
|
-
this.core =
|
|
8082
|
+
this.core = wc(
|
|
8062
8083
|
e,
|
|
8063
8084
|
// @ts-expect-error because TS can't resolve subclass statics
|
|
8064
8085
|
e.Store || this.constructor.Store,
|
|
@@ -8082,7 +8103,7 @@ class Nt {
|
|
|
8082
8103
|
* const { peers } = db.rooms.usePresence(room);
|
|
8083
8104
|
*/
|
|
8084
8105
|
room(e = "_defaultRoomType", t = "_defaultRoomId") {
|
|
8085
|
-
return new
|
|
8106
|
+
return new Pc(this.core, e, t);
|
|
8086
8107
|
}
|
|
8087
8108
|
_useAuth() {
|
|
8088
8109
|
const e = Ne(
|
|
@@ -8090,10 +8111,10 @@ class Nt {
|
|
|
8090
8111
|
), t = ve((s) => this.core.subscribeAuth((o) => {
|
|
8091
8112
|
e.current = { isLoading: !1, ...o }, s();
|
|
8092
8113
|
}), []);
|
|
8093
|
-
return
|
|
8114
|
+
return qt(
|
|
8094
8115
|
t,
|
|
8095
8116
|
() => e.current,
|
|
8096
|
-
() =>
|
|
8117
|
+
() => Mc
|
|
8097
8118
|
);
|
|
8098
8119
|
}
|
|
8099
8120
|
/**
|
|
@@ -8110,8 +8131,8 @@ class Nt {
|
|
|
8110
8131
|
return this.core.getAuth();
|
|
8111
8132
|
}
|
|
8112
8133
|
}
|
|
8113
|
-
h(
|
|
8134
|
+
h(Kt, "Store"), h(Kt, "NetworkListener"), h(Kt, "EventSourceImpl");
|
|
8114
8135
|
export {
|
|
8115
|
-
|
|
8116
|
-
|
|
8136
|
+
Kt as InstantReactAbstractDatabase,
|
|
8137
|
+
Sc as useQueryInternal
|
|
8117
8138
|
};
|