@instantdb/react-common 0.22.69 → 0.22.70
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commonjs/InstantReactAbstractDatabase.d.ts +2 -2
- package/dist/commonjs/InstantReactAbstractDatabase.d.ts.map +1 -1
- package/dist/commonjs/InstantReactAbstractDatabase.js.map +1 -1
- package/dist/esm/InstantReactAbstractDatabase.d.ts +2 -2
- package/dist/esm/InstantReactAbstractDatabase.d.ts.map +1 -1
- package/dist/esm/InstantReactAbstractDatabase.js.map +1 -1
- package/dist/standalone/index.js +291 -289
- package/dist/standalone/index.umd.cjs +8 -8
- package/package.json +3 -3
- package/src/InstantReactAbstractDatabase.tsx +5 -6
package/dist/standalone/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import Sr, { useRef as ze, useCallback as de, useSyncExternalStore as
|
|
2
|
-
var
|
|
1
|
+
import Sr, { useRef as ze, useCallback as de, useSyncExternalStore as Mt, useEffect as ge, useMemo as Rt, useState as Or } from "react";
|
|
2
|
+
var $t = { exports: {} }, $e = {};
|
|
3
3
|
/**
|
|
4
4
|
* @license React
|
|
5
5
|
* react-jsx-runtime.production.min.js
|
|
@@ -9,10 +9,10 @@ var xt = { exports: {} }, $e = {};
|
|
|
9
9
|
* This source code is licensed under the MIT license found in the
|
|
10
10
|
* LICENSE file in the root directory of this source tree.
|
|
11
11
|
*/
|
|
12
|
-
var
|
|
12
|
+
var Un;
|
|
13
13
|
function Ni() {
|
|
14
|
-
if (
|
|
15
|
-
|
|
14
|
+
if (Un) return $e;
|
|
15
|
+
Un = 1;
|
|
16
16
|
var t = Sr, e = Symbol.for("react.element"), n = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, i = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
17
17
|
function o(u, a, d) {
|
|
18
18
|
var c, f = {}, l = null, p = null;
|
|
@@ -23,10 +23,10 @@ function Ni() {
|
|
|
23
23
|
}
|
|
24
24
|
return $e.Fragment = n, $e.jsx = o, $e.jsxs = o, $e;
|
|
25
25
|
}
|
|
26
|
-
var xe = {},
|
|
26
|
+
var xe = {}, Ln;
|
|
27
27
|
function Ki() {
|
|
28
|
-
if (
|
|
29
|
-
|
|
28
|
+
if (Ln) return xe;
|
|
29
|
+
Ln = 1;
|
|
30
30
|
var t = {};
|
|
31
31
|
/**
|
|
32
32
|
* @license React
|
|
@@ -127,18 +127,18 @@ function Ki() {
|
|
|
127
127
|
}
|
|
128
128
|
return null;
|
|
129
129
|
}
|
|
130
|
-
var le = Object.assign, Me = 0, yn, bn, _n, gn, Tn, mn
|
|
131
|
-
function
|
|
130
|
+
var le = Object.assign, Me = 0, pn, yn, bn, _n, gn, Tn, mn;
|
|
131
|
+
function wn() {
|
|
132
132
|
}
|
|
133
|
-
|
|
133
|
+
wn.__reactDisabledLog = !0;
|
|
134
134
|
function hi() {
|
|
135
135
|
{
|
|
136
136
|
if (Me === 0) {
|
|
137
|
-
|
|
137
|
+
pn = console.log, yn = console.info, bn = console.warn, _n = console.error, gn = console.group, Tn = console.groupCollapsed, mn = console.groupEnd;
|
|
138
138
|
var h = {
|
|
139
139
|
configurable: !0,
|
|
140
140
|
enumerable: !0,
|
|
141
|
-
value:
|
|
141
|
+
value: wn,
|
|
142
142
|
writable: !0
|
|
143
143
|
};
|
|
144
144
|
Object.defineProperties(console, {
|
|
@@ -164,25 +164,25 @@ function Ki() {
|
|
|
164
164
|
};
|
|
165
165
|
Object.defineProperties(console, {
|
|
166
166
|
log: le({}, h, {
|
|
167
|
-
value:
|
|
167
|
+
value: pn
|
|
168
168
|
}),
|
|
169
169
|
info: le({}, h, {
|
|
170
|
-
value:
|
|
170
|
+
value: yn
|
|
171
171
|
}),
|
|
172
172
|
warn: le({}, h, {
|
|
173
|
-
value:
|
|
173
|
+
value: bn
|
|
174
174
|
}),
|
|
175
175
|
error: le({}, h, {
|
|
176
|
-
value:
|
|
176
|
+
value: _n
|
|
177
177
|
}),
|
|
178
178
|
group: le({}, h, {
|
|
179
|
-
value:
|
|
179
|
+
value: gn
|
|
180
180
|
}),
|
|
181
181
|
groupCollapsed: le({}, h, {
|
|
182
|
-
value:
|
|
182
|
+
value: Tn
|
|
183
183
|
}),
|
|
184
184
|
groupEnd: le({}, h, {
|
|
185
|
-
value:
|
|
185
|
+
value: mn
|
|
186
186
|
})
|
|
187
187
|
});
|
|
188
188
|
}
|
|
@@ -208,7 +208,7 @@ function Ki() {
|
|
|
208
208
|
var yi = typeof WeakMap == "function" ? WeakMap : Map;
|
|
209
209
|
Je = new yi();
|
|
210
210
|
}
|
|
211
|
-
function
|
|
211
|
+
function vn(h, _) {
|
|
212
212
|
if (!h || wt)
|
|
213
213
|
return "";
|
|
214
214
|
{
|
|
@@ -280,7 +280,7 @@ function Ki() {
|
|
|
280
280
|
return typeof h == "function" && Je.set(h, he), he;
|
|
281
281
|
}
|
|
282
282
|
function bi(h, _, w) {
|
|
283
|
-
return
|
|
283
|
+
return vn(h, !1);
|
|
284
284
|
}
|
|
285
285
|
function _i(h) {
|
|
286
286
|
var _ = h.prototype;
|
|
@@ -290,7 +290,7 @@ function Ki() {
|
|
|
290
290
|
if (h == null)
|
|
291
291
|
return "";
|
|
292
292
|
if (typeof h == "function")
|
|
293
|
-
return
|
|
293
|
+
return vn(h, _i(h));
|
|
294
294
|
if (typeof h == "string")
|
|
295
295
|
return Ye(h);
|
|
296
296
|
switch (h) {
|
|
@@ -315,13 +315,13 @@ function Ki() {
|
|
|
315
315
|
}
|
|
316
316
|
return "";
|
|
317
317
|
}
|
|
318
|
-
var Re = Object.prototype.hasOwnProperty,
|
|
318
|
+
var Re = Object.prototype.hasOwnProperty, Sn = {}, On = T.ReactDebugCurrentFrame;
|
|
319
319
|
function Xe(h) {
|
|
320
320
|
if (h) {
|
|
321
321
|
var _ = h._owner, w = Ze(h.type, h._source, _ ? _.type : null);
|
|
322
|
-
|
|
322
|
+
On.setExtraStackFrame(w);
|
|
323
323
|
} else
|
|
324
|
-
|
|
324
|
+
On.setExtraStackFrame(null);
|
|
325
325
|
}
|
|
326
326
|
function gi(h, _, w, O, C) {
|
|
327
327
|
{
|
|
@@ -338,7 +338,7 @@ function Ki() {
|
|
|
338
338
|
} catch ($) {
|
|
339
339
|
E = $;
|
|
340
340
|
}
|
|
341
|
-
E && !(E instanceof Error) && (Xe(C), v("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", O || "React class", w, k, typeof E), Xe(null)), E instanceof Error && !(E.message in
|
|
341
|
+
E && !(E instanceof Error) && (Xe(C), v("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", O || "React class", w, k, typeof E), Xe(null)), E instanceof Error && !(E.message in Sn) && (Sn[E.message] = !0, Xe(C), v("Failed %s type: %s", w, E.message), Xe(null));
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
344
|
}
|
|
@@ -354,24 +354,24 @@ function Ki() {
|
|
|
354
354
|
}
|
|
355
355
|
function wi(h) {
|
|
356
356
|
try {
|
|
357
|
-
return
|
|
357
|
+
return En(h), !1;
|
|
358
358
|
} catch {
|
|
359
359
|
return !0;
|
|
360
360
|
}
|
|
361
361
|
}
|
|
362
|
-
function
|
|
362
|
+
function En(h) {
|
|
363
363
|
return "" + h;
|
|
364
364
|
}
|
|
365
|
-
function
|
|
365
|
+
function An(h) {
|
|
366
366
|
if (wi(h))
|
|
367
|
-
return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", mi(h)),
|
|
367
|
+
return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", mi(h)), En(h);
|
|
368
368
|
}
|
|
369
|
-
var
|
|
369
|
+
var kn = T.ReactCurrentOwner, vi = {
|
|
370
370
|
key: !0,
|
|
371
371
|
ref: !0,
|
|
372
372
|
__self: !0,
|
|
373
373
|
__source: !0
|
|
374
|
-
},
|
|
374
|
+
}, jn, Cn;
|
|
375
375
|
function Si(h) {
|
|
376
376
|
if (Re.call(h, "ref")) {
|
|
377
377
|
var _ = Object.getOwnPropertyDescriptor(h, "ref").get;
|
|
@@ -389,12 +389,12 @@ function Ki() {
|
|
|
389
389
|
return h.key !== void 0;
|
|
390
390
|
}
|
|
391
391
|
function Ei(h, _) {
|
|
392
|
-
typeof h.ref == "string" &&
|
|
392
|
+
typeof h.ref == "string" && kn.current;
|
|
393
393
|
}
|
|
394
394
|
function Ai(h, _) {
|
|
395
395
|
{
|
|
396
396
|
var w = function() {
|
|
397
|
-
|
|
397
|
+
jn || (jn = !0, v("%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)", _));
|
|
398
398
|
};
|
|
399
399
|
w.isReactWarning = !0, Object.defineProperty(h, "key", {
|
|
400
400
|
get: w,
|
|
@@ -405,7 +405,7 @@ function Ki() {
|
|
|
405
405
|
function ki(h, _) {
|
|
406
406
|
{
|
|
407
407
|
var w = function() {
|
|
408
|
-
|
|
408
|
+
Cn || (Cn = !0, v("%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)", _));
|
|
409
409
|
};
|
|
410
410
|
w.isReactWarning = !0, Object.defineProperty(h, "ref", {
|
|
411
411
|
get: w,
|
|
@@ -445,7 +445,7 @@ function Ki() {
|
|
|
445
445
|
function Ci(h, _, w, O, C) {
|
|
446
446
|
{
|
|
447
447
|
var P, k = {}, E = null, z = null;
|
|
448
|
-
w !== void 0 && (
|
|
448
|
+
w !== void 0 && (An(w), E = "" + w), Oi(_) && (An(_.key), E = "" + _.key), Si(_) && (z = _.ref, Ei(_, C));
|
|
449
449
|
for (P in _)
|
|
450
450
|
Re.call(_, P) && !vi.hasOwnProperty(P) && (k[P] = _[P]);
|
|
451
451
|
if (h && h.defaultProps) {
|
|
@@ -457,23 +457,23 @@ function Ki() {
|
|
|
457
457
|
var D = typeof h == "function" ? h.displayName || h.name || "Unknown" : h;
|
|
458
458
|
E && Ai(k, D), z && ki(k, D);
|
|
459
459
|
}
|
|
460
|
-
return ji(h, E, z, C, O,
|
|
460
|
+
return ji(h, E, z, C, O, kn.current, k);
|
|
461
461
|
}
|
|
462
462
|
}
|
|
463
|
-
var St = T.ReactCurrentOwner,
|
|
463
|
+
var St = T.ReactCurrentOwner, Pn = T.ReactDebugCurrentFrame;
|
|
464
464
|
function we(h) {
|
|
465
465
|
if (h) {
|
|
466
466
|
var _ = h._owner, w = Ze(h.type, h._source, _ ? _.type : null);
|
|
467
|
-
|
|
467
|
+
Pn.setExtraStackFrame(w);
|
|
468
468
|
} else
|
|
469
|
-
|
|
469
|
+
Pn.setExtraStackFrame(null);
|
|
470
470
|
}
|
|
471
471
|
var Ot;
|
|
472
472
|
Ot = !1;
|
|
473
473
|
function Et(h) {
|
|
474
474
|
return typeof h == "object" && h !== null && h.$$typeof === n;
|
|
475
475
|
}
|
|
476
|
-
function
|
|
476
|
+
function In() {
|
|
477
477
|
{
|
|
478
478
|
if (St.current) {
|
|
479
479
|
var h = ne(St.current.type);
|
|
@@ -488,10 +488,10 @@ Check the render method of \`` + h + "`.";
|
|
|
488
488
|
function Pi(h) {
|
|
489
489
|
return "";
|
|
490
490
|
}
|
|
491
|
-
var
|
|
491
|
+
var Mn = {};
|
|
492
492
|
function Ii(h) {
|
|
493
493
|
{
|
|
494
|
-
var _ =
|
|
494
|
+
var _ = In();
|
|
495
495
|
if (!_) {
|
|
496
496
|
var w = typeof h == "string" ? h : h.displayName || h.name;
|
|
497
497
|
w && (_ = `
|
|
@@ -501,27 +501,27 @@ Check the top-level render call using <` + w + ">.");
|
|
|
501
501
|
return _;
|
|
502
502
|
}
|
|
503
503
|
}
|
|
504
|
-
function
|
|
504
|
+
function Rn(h, _) {
|
|
505
505
|
{
|
|
506
506
|
if (!h._store || h._store.validated || h.key != null)
|
|
507
507
|
return;
|
|
508
508
|
h._store.validated = !0;
|
|
509
509
|
var w = Ii(_);
|
|
510
|
-
if (
|
|
510
|
+
if (Mn[w])
|
|
511
511
|
return;
|
|
512
|
-
|
|
512
|
+
Mn[w] = !0;
|
|
513
513
|
var O = "";
|
|
514
514
|
h && h._owner && h._owner !== St.current && (O = " It was passed a child from " + ne(h._owner.type) + "."), we(h), v('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', w, O), we(null);
|
|
515
515
|
}
|
|
516
516
|
}
|
|
517
|
-
function
|
|
517
|
+
function $n(h, _) {
|
|
518
518
|
{
|
|
519
519
|
if (typeof h != "object")
|
|
520
520
|
return;
|
|
521
521
|
if (vt(h))
|
|
522
522
|
for (var w = 0; w < h.length; w++) {
|
|
523
523
|
var O = h[w];
|
|
524
|
-
Et(O) &&
|
|
524
|
+
Et(O) && Rn(O, _);
|
|
525
525
|
}
|
|
526
526
|
else if (Et(h))
|
|
527
527
|
h._store && (h._store.validated = !0);
|
|
@@ -529,7 +529,7 @@ Check the top-level render call using <` + w + ">.");
|
|
|
529
529
|
var C = m(h);
|
|
530
530
|
if (typeof C == "function" && C !== h.entries)
|
|
531
531
|
for (var P = C.call(h), k; !(k = P.next()).done; )
|
|
532
|
-
Et(k.value) &&
|
|
532
|
+
Et(k.value) && Rn(k.value, _);
|
|
533
533
|
}
|
|
534
534
|
}
|
|
535
535
|
}
|
|
@@ -570,15 +570,15 @@ Check the top-level render call using <` + w + ">.");
|
|
|
570
570
|
h.ref !== null && (we(h), v("Invalid attribute `ref` supplied to `React.Fragment`."), we(null));
|
|
571
571
|
}
|
|
572
572
|
}
|
|
573
|
-
var
|
|
574
|
-
function
|
|
573
|
+
var xn = {};
|
|
574
|
+
function Dn(h, _, w, O, C, P) {
|
|
575
575
|
{
|
|
576
576
|
var k = _t(h);
|
|
577
577
|
if (!k) {
|
|
578
578
|
var E = "";
|
|
579
579
|
(h === void 0 || typeof h == "object" && h !== null && Object.keys(h).length === 0) && (E += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
580
580
|
var z = Pi();
|
|
581
|
-
z ? E += z : E +=
|
|
581
|
+
z ? E += z : E += In();
|
|
582
582
|
var $;
|
|
583
583
|
h === null ? $ = "null" : vt(h) ? $ = "array" : h !== void 0 && h.$$typeof === n ? ($ = "<" + (ne(h.type) || "Unknown") + " />", E = " Did you accidentally export a JSX literal instead of a component?") : $ = typeof h, v("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", $, E);
|
|
584
584
|
}
|
|
@@ -591,43 +591,43 @@ Check the top-level render call using <` + w + ">.");
|
|
|
591
591
|
if (O)
|
|
592
592
|
if (vt(J)) {
|
|
593
593
|
for (var ve = 0; ve < J.length; ve++)
|
|
594
|
-
|
|
594
|
+
$n(J[ve], h);
|
|
595
595
|
Object.freeze && Object.freeze(J);
|
|
596
596
|
} else
|
|
597
597
|
v("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
598
598
|
else
|
|
599
|
-
|
|
599
|
+
$n(J, h);
|
|
600
600
|
}
|
|
601
601
|
if (Re.call(_, "key")) {
|
|
602
602
|
var he = ne(h), W = Object.keys(_).filter(function(Fi) {
|
|
603
603
|
return Fi !== "key";
|
|
604
604
|
}), At = W.length > 0 ? "{key: someKey, " + W.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
605
|
-
if (!
|
|
605
|
+
if (!xn[he + At]) {
|
|
606
606
|
var Li = W.length > 0 ? "{" + W.join(": ..., ") + ": ...}" : "{}";
|
|
607
607
|
v(`A props object containing a "key" prop is being spread into JSX:
|
|
608
608
|
let props = %s;
|
|
609
609
|
<%s {...props} />
|
|
610
610
|
React keys must be passed directly to JSX without using spread:
|
|
611
611
|
let props = %s;
|
|
612
|
-
<%s key={someKey} {...props} />`, At, he, Li, he),
|
|
612
|
+
<%s key={someKey} {...props} />`, At, he, Li, he), xn[he + At] = !0;
|
|
613
613
|
}
|
|
614
614
|
}
|
|
615
615
|
return h === i ? Ri(D) : Mi(D), D;
|
|
616
616
|
}
|
|
617
617
|
}
|
|
618
618
|
function $i(h, _, w) {
|
|
619
|
-
return
|
|
619
|
+
return Dn(h, _, w, !0);
|
|
620
620
|
}
|
|
621
621
|
function xi(h, _, w) {
|
|
622
|
-
return
|
|
622
|
+
return Dn(h, _, w, !1);
|
|
623
623
|
}
|
|
624
624
|
var Di = xi, Ui = $i;
|
|
625
625
|
xe.Fragment = i, xe.jsx = Di, xe.jsxs = Ui;
|
|
626
626
|
}(), xe;
|
|
627
627
|
}
|
|
628
628
|
var qi = {};
|
|
629
|
-
qi.NODE_ENV === "production" ?
|
|
630
|
-
var et =
|
|
629
|
+
qi.NODE_ENV === "production" ? $t.exports = Ni() : $t.exports = Ki();
|
|
630
|
+
var et = $t.exports;
|
|
631
631
|
function N(t) {
|
|
632
632
|
if (typeof t == "number")
|
|
633
633
|
return (Math.abs(t * 2654435761) >>> 0).toString(16);
|
|
@@ -673,11 +673,11 @@ const x = {
|
|
|
673
673
|
}, Er = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), zi = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), st = Symbol.iterator, Y = {
|
|
674
674
|
mutable: "mutable",
|
|
675
675
|
immutable: "immutable"
|
|
676
|
-
},
|
|
676
|
+
}, Xt = {};
|
|
677
677
|
function Ne(t, e) {
|
|
678
678
|
return t instanceof Map ? t.has(e) : Object.prototype.hasOwnProperty.call(t, e);
|
|
679
679
|
}
|
|
680
|
-
function
|
|
680
|
+
function Fn(t, e) {
|
|
681
681
|
if (e in t) {
|
|
682
682
|
let n = Reflect.getPrototypeOf(t);
|
|
683
683
|
for (; n; ) {
|
|
@@ -688,10 +688,10 @@ function Nn(t, e) {
|
|
|
688
688
|
}
|
|
689
689
|
}
|
|
690
690
|
}
|
|
691
|
-
function
|
|
691
|
+
function en(t) {
|
|
692
692
|
return Object.getPrototypeOf(t) === Set.prototype;
|
|
693
693
|
}
|
|
694
|
-
function
|
|
694
|
+
function tn(t) {
|
|
695
695
|
return Object.getPrototypeOf(t) === Map.prototype;
|
|
696
696
|
}
|
|
697
697
|
function H(t) {
|
|
@@ -704,7 +704,7 @@ function Te(t) {
|
|
|
704
704
|
function A(t) {
|
|
705
705
|
return typeof t != "object" ? null : t == null ? void 0 : t[Er];
|
|
706
706
|
}
|
|
707
|
-
function
|
|
707
|
+
function nn(t) {
|
|
708
708
|
var e;
|
|
709
709
|
const n = A(t);
|
|
710
710
|
return n ? (e = n.copy) !== null && e !== void 0 ? e : n.original : t;
|
|
@@ -751,7 +751,7 @@ function kt(t, e) {
|
|
|
751
751
|
function ae(t, e) {
|
|
752
752
|
return t === e ? t !== 0 || 1 / t === 1 / e : t !== t && e !== e;
|
|
753
753
|
}
|
|
754
|
-
function
|
|
754
|
+
function xt(t) {
|
|
755
755
|
if (t)
|
|
756
756
|
for (; t.finalities.revoke.length > 0; )
|
|
757
757
|
t.finalities.revoke.pop()();
|
|
@@ -792,13 +792,13 @@ function kr(t, e) {
|
|
|
792
792
|
if (Array.isArray(t))
|
|
793
793
|
return Array.prototype.concat.call(t);
|
|
794
794
|
if (t instanceof Set) {
|
|
795
|
-
if (!
|
|
795
|
+
if (!en(t)) {
|
|
796
796
|
const r = Object.getPrototypeOf(t).constructor;
|
|
797
797
|
return new r(t.values());
|
|
798
798
|
}
|
|
799
799
|
return Set.prototype.difference ? Set.prototype.difference.call(t, /* @__PURE__ */ new Set()) : new Set(t.values());
|
|
800
800
|
} else if (t instanceof Map) {
|
|
801
|
-
if (!
|
|
801
|
+
if (!tn(t)) {
|
|
802
802
|
const r = Object.getPrototypeOf(t).constructor;
|
|
803
803
|
return new r(t);
|
|
804
804
|
}
|
|
@@ -827,7 +827,7 @@ function V(t) {
|
|
|
827
827
|
}
|
|
828
828
|
function Ue(t) {
|
|
829
829
|
if (!ee(t))
|
|
830
|
-
return
|
|
830
|
+
return nn(t);
|
|
831
831
|
if (Array.isArray(t))
|
|
832
832
|
return t.map(Ue);
|
|
833
833
|
if (t instanceof Map) {
|
|
@@ -835,7 +835,7 @@ function Ue(t) {
|
|
|
835
835
|
r,
|
|
836
836
|
Ue(i)
|
|
837
837
|
]);
|
|
838
|
-
if (!
|
|
838
|
+
if (!tn(t)) {
|
|
839
839
|
const r = Object.getPrototypeOf(t).constructor;
|
|
840
840
|
return new r(n);
|
|
841
841
|
}
|
|
@@ -843,7 +843,7 @@ function Ue(t) {
|
|
|
843
843
|
}
|
|
844
844
|
if (t instanceof Set) {
|
|
845
845
|
const n = Array.from(t).map(Ue);
|
|
846
|
-
if (!
|
|
846
|
+
if (!en(t)) {
|
|
847
847
|
const r = Object.getPrototypeOf(t).constructor;
|
|
848
848
|
return new r(n);
|
|
849
849
|
}
|
|
@@ -861,7 +861,7 @@ function ie(t) {
|
|
|
861
861
|
var e;
|
|
862
862
|
t.assignedMap = (e = t.assignedMap) !== null && e !== void 0 ? e : /* @__PURE__ */ new Map(), t.operated || (t.operated = !0, t.parent && ie(t.parent));
|
|
863
863
|
}
|
|
864
|
-
function
|
|
864
|
+
function Nn() {
|
|
865
865
|
throw new Error("Cannot modify frozen object");
|
|
866
866
|
}
|
|
867
867
|
function Se(t, e, n, r, i) {
|
|
@@ -889,12 +889,12 @@ function Se(t, e, n, r, i) {
|
|
|
889
889
|
case 2:
|
|
890
890
|
for (const [u, a] of t)
|
|
891
891
|
Se(u, u, n, r, i), Se(a, u, n, r, i);
|
|
892
|
-
t.set = t.clear = t.delete =
|
|
892
|
+
t.set = t.clear = t.delete = Nn;
|
|
893
893
|
break;
|
|
894
894
|
case 3:
|
|
895
895
|
for (const u of t)
|
|
896
896
|
Se(u, u, n, r, i);
|
|
897
|
-
t.add = t.clear = t.delete =
|
|
897
|
+
t.add = t.clear = t.delete = Nn;
|
|
898
898
|
break;
|
|
899
899
|
case 1:
|
|
900
900
|
Object.freeze(t);
|
|
@@ -910,7 +910,7 @@ function Se(t, e, n, r, i) {
|
|
|
910
910
|
}
|
|
911
911
|
r.pop(), i.pop();
|
|
912
912
|
}
|
|
913
|
-
function
|
|
913
|
+
function rn(t, e) {
|
|
914
914
|
const n = me(t);
|
|
915
915
|
if (n === 0)
|
|
916
916
|
Reflect.ownKeys(t).forEach((r) => {
|
|
@@ -927,7 +927,7 @@ function jr(t, e, n) {
|
|
|
927
927
|
if (Te(t) || !ee(t, n) || e.has(t) || Object.isFrozen(t))
|
|
928
928
|
return;
|
|
929
929
|
const r = t instanceof Set, i = r ? /* @__PURE__ */ new Map() : void 0;
|
|
930
|
-
if (e.add(t),
|
|
930
|
+
if (e.add(t), rn(t, (s, o) => {
|
|
931
931
|
var u;
|
|
932
932
|
if (Te(o)) {
|
|
933
933
|
const a = A(o);
|
|
@@ -947,12 +947,12 @@ function Gi(t, e) {
|
|
|
947
947
|
const n = t.type === 3 ? t.setMap : t.copy;
|
|
948
948
|
t.finalities.revoke.length > 1 && t.assignedMap.get(e) && n && jr(ce(n, e), t.finalities.handledSet, t.options);
|
|
949
949
|
}
|
|
950
|
-
function
|
|
950
|
+
function Dt(t) {
|
|
951
951
|
t.type === 3 && t.copy && (t.copy.clear(), t.setMap.forEach((e) => {
|
|
952
|
-
t.copy.add(
|
|
952
|
+
t.copy.add(nn(e));
|
|
953
953
|
}));
|
|
954
954
|
}
|
|
955
|
-
function
|
|
955
|
+
function Ut(t, e, n, r) {
|
|
956
956
|
if (t.operated && t.assignedMap && t.assignedMap.size > 0 && !t.finalized) {
|
|
957
957
|
if (n && r) {
|
|
958
958
|
const s = Ar(t);
|
|
@@ -961,14 +961,14 @@ function Lt(t, e, n, r) {
|
|
|
961
961
|
t.finalized = !0;
|
|
962
962
|
}
|
|
963
963
|
}
|
|
964
|
-
function
|
|
964
|
+
function sn(t, e, n, r) {
|
|
965
965
|
const i = A(n);
|
|
966
966
|
i && (i.callbacks || (i.callbacks = []), i.callbacks.push((s, o) => {
|
|
967
967
|
var u;
|
|
968
968
|
const a = t.type === 3 ? t.setMap : t.copy;
|
|
969
969
|
if (ae(ce(a, e), n)) {
|
|
970
970
|
let d = i.original;
|
|
971
|
-
i.copy && (d = i.copy),
|
|
971
|
+
i.copy && (d = i.copy), Dt(t), Ut(t, r, s, o), t.options.enableAutoFreeze && (t.options.updatedValues = (u = t.options.updatedValues) !== null && u !== void 0 ? u : /* @__PURE__ */ new WeakMap(), t.options.updatedValues.set(d, i.original)), We(a, e, d);
|
|
972
972
|
}
|
|
973
973
|
}), t.options.enableAutoFreeze && i.finalities !== t.finalities && (t.options.enableAutoFreeze = !1)), ee(n, t.options) && t.finalities.draft.push(() => {
|
|
974
974
|
const s = t.type === 3 ? t.setMap : t.copy;
|
|
@@ -1077,7 +1077,7 @@ function Ve(t, e, n, r) {
|
|
|
1077
1077
|
const ct = (t, e, n = !1) => {
|
|
1078
1078
|
if (typeof t == "object" && t !== null && (!ee(t, e) || n))
|
|
1079
1079
|
throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.");
|
|
1080
|
-
},
|
|
1080
|
+
}, Lt = {
|
|
1081
1081
|
get size() {
|
|
1082
1082
|
return H(A(this)).size;
|
|
1083
1083
|
},
|
|
@@ -1086,7 +1086,7 @@ const ct = (t, e, n = !1) => {
|
|
|
1086
1086
|
},
|
|
1087
1087
|
set(t, e) {
|
|
1088
1088
|
const n = A(this), r = H(n);
|
|
1089
|
-
return (!r.has(t) || !ae(r.get(t), e)) && (V(n), ie(n), n.assignedMap.set(t, !0), n.copy.set(t, e),
|
|
1089
|
+
return (!r.has(t) || !ae(r.get(t), e)) && (V(n), ie(n), n.assignedMap.set(t, !0), n.copy.set(t, e), sn(n, t, e, Ve)), this;
|
|
1090
1090
|
},
|
|
1091
1091
|
delete(t) {
|
|
1092
1092
|
if (!this.has(t))
|
|
@@ -1114,7 +1114,7 @@ const ct = (t, e, n = !1) => {
|
|
|
1114
1114
|
const r = A(this), i = H(r).get(t), s = ((n = (e = r.options).mark) === null || n === void 0 ? void 0 : n.call(e, i, Y)) === Y.mutable;
|
|
1115
1115
|
if (r.options.strict && ct(i, r.options, s), s || r.finalized || !ee(i, r.options) || i !== r.original.get(t))
|
|
1116
1116
|
return i;
|
|
1117
|
-
const o =
|
|
1117
|
+
const o = Xt.createDraft({
|
|
1118
1118
|
original: i,
|
|
1119
1119
|
parentDraft: r,
|
|
1120
1120
|
key: t,
|
|
@@ -1158,7 +1158,7 @@ const ct = (t, e, n = !1) => {
|
|
|
1158
1158
|
[st]() {
|
|
1159
1159
|
return this.entries();
|
|
1160
1160
|
}
|
|
1161
|
-
}, Ji = Reflect.ownKeys(
|
|
1161
|
+
}, Ji = Reflect.ownKeys(Lt), Kn = (t, e, { isValuesIterator: n }) => () => {
|
|
1162
1162
|
var r, i;
|
|
1163
1163
|
const s = e.next();
|
|
1164
1164
|
if (s.done)
|
|
@@ -1167,7 +1167,7 @@ const ct = (t, e, n = !1) => {
|
|
|
1167
1167
|
let u = t.setMap.get(o);
|
|
1168
1168
|
const a = A(u), d = ((i = (r = t.options).mark) === null || i === void 0 ? void 0 : i.call(r, u, Y)) === Y.mutable;
|
|
1169
1169
|
if (t.options.strict && ct(o, t.options, d), !d && !a && ee(o, t.options) && !t.finalized && t.original.has(o)) {
|
|
1170
|
-
const c =
|
|
1170
|
+
const c = Xt.createDraft({
|
|
1171
1171
|
original: o,
|
|
1172
1172
|
parentDraft: t,
|
|
1173
1173
|
key: o,
|
|
@@ -1194,7 +1194,7 @@ const ct = (t, e, n = !1) => {
|
|
|
1194
1194
|
},
|
|
1195
1195
|
add(t) {
|
|
1196
1196
|
const e = A(this);
|
|
1197
|
-
return this.has(t) || (V(e), ie(e), e.assignedMap.set(t, !0), e.setMap.set(t, t),
|
|
1197
|
+
return this.has(t) || (V(e), ie(e), e.assignedMap.set(t, !0), e.setMap.set(t, t), sn(e, t, t, Ve)), this;
|
|
1198
1198
|
},
|
|
1199
1199
|
delete(t) {
|
|
1200
1200
|
if (!this.has(t))
|
|
@@ -1219,7 +1219,7 @@ const ct = (t, e, n = !1) => {
|
|
|
1219
1219
|
const e = t.setMap.keys();
|
|
1220
1220
|
return {
|
|
1221
1221
|
[Symbol.iterator]: () => this.values(),
|
|
1222
|
-
next:
|
|
1222
|
+
next: Kn(t, e, { isValuesIterator: !0 })
|
|
1223
1223
|
};
|
|
1224
1224
|
},
|
|
1225
1225
|
entries() {
|
|
@@ -1228,7 +1228,7 @@ const ct = (t, e, n = !1) => {
|
|
|
1228
1228
|
const e = t.setMap.keys();
|
|
1229
1229
|
return {
|
|
1230
1230
|
[Symbol.iterator]: () => this.entries(),
|
|
1231
|
-
next:
|
|
1231
|
+
next: Kn(t, e, {
|
|
1232
1232
|
isValuesIterator: !1
|
|
1233
1233
|
})
|
|
1234
1234
|
};
|
|
@@ -1286,8 +1286,8 @@ const Zi = Reflect.ownKeys(dt), Cr = /* @__PURE__ */ new WeakSet(), Pr = {
|
|
|
1286
1286
|
const u = H(t);
|
|
1287
1287
|
if (u instanceof Map && Ji.includes(e)) {
|
|
1288
1288
|
if (e === "size")
|
|
1289
|
-
return Object.getOwnPropertyDescriptor(
|
|
1290
|
-
const d =
|
|
1289
|
+
return Object.getOwnPropertyDescriptor(Lt, "size").get.call(t.proxy);
|
|
1290
|
+
const d = Lt[e];
|
|
1291
1291
|
if (d)
|
|
1292
1292
|
return d.bind(t.proxy);
|
|
1293
1293
|
}
|
|
@@ -1299,7 +1299,7 @@ const Zi = Reflect.ownKeys(dt), Cr = /* @__PURE__ */ new WeakSet(), Pr = {
|
|
|
1299
1299
|
return d.bind(t.proxy);
|
|
1300
1300
|
}
|
|
1301
1301
|
if (!Ne(u, e)) {
|
|
1302
|
-
const d =
|
|
1302
|
+
const d = Fn(u, e);
|
|
1303
1303
|
return d ? "value" in d ? d.value : (
|
|
1304
1304
|
// !case: support for getter
|
|
1305
1305
|
(i = d.get) === null || i === void 0 ? void 0 : i.call(t.proxy)
|
|
@@ -1309,7 +1309,7 @@ const Zi = Reflect.ownKeys(dt), Cr = /* @__PURE__ */ new WeakSet(), Pr = {
|
|
|
1309
1309
|
if (t.options.strict && ct(a, t.options), t.finalized || !ee(a, t.options))
|
|
1310
1310
|
return a;
|
|
1311
1311
|
if (a === kt(t.original, e)) {
|
|
1312
|
-
if (V(t), t.copy[e] =
|
|
1312
|
+
if (V(t), t.copy[e] = on({
|
|
1313
1313
|
original: t.original[e],
|
|
1314
1314
|
parentDraft: t,
|
|
1315
1315
|
key: t.type === 1 ? Number(e) : e,
|
|
@@ -1330,11 +1330,11 @@ const Zi = Reflect.ownKeys(dt), Cr = /* @__PURE__ */ new WeakSet(), Pr = {
|
|
|
1330
1330
|
let i;
|
|
1331
1331
|
if (t.type === 1 && e !== "length" && !(Number.isInteger(i = Number(e)) && i >= 0 && (e === 0 || i === 0 || String(i) === String(e))))
|
|
1332
1332
|
throw new Error("Only supports setting array indices and the 'length' property.");
|
|
1333
|
-
const s =
|
|
1333
|
+
const s = Fn(H(t), e);
|
|
1334
1334
|
if (s != null && s.set)
|
|
1335
1335
|
return s.set.call(t.proxy, n), !0;
|
|
1336
1336
|
const o = kt(H(t), e), u = A(o);
|
|
1337
|
-
return u && ae(u.original, n) ? (t.copy[e] = n, t.assignedMap = (r = t.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), t.assignedMap.set(e, !1), !0) : (ae(n, o) && (n !== void 0 || Ne(t.original, e)) || (V(t), ie(t), Ne(t.original, e) && ae(n, t.original[e]) ? t.assignedMap.delete(e) : t.assignedMap.set(e, !0), t.copy[e] = n,
|
|
1337
|
+
return u && ae(u.original, n) ? (t.copy[e] = n, t.assignedMap = (r = t.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), t.assignedMap.set(e, !1), !0) : (ae(n, o) && (n !== void 0 || Ne(t.original, e)) || (V(t), ie(t), Ne(t.original, e) && ae(n, t.original[e]) ? t.assignedMap.delete(e) : t.assignedMap.set(e, !0), t.copy[e] = n, sn(t, e, n, Ve)), !0);
|
|
1338
1338
|
},
|
|
1339
1339
|
has(t, e) {
|
|
1340
1340
|
return e in H(t);
|
|
@@ -1365,7 +1365,7 @@ const Zi = Reflect.ownKeys(dt), Cr = /* @__PURE__ */ new WeakSet(), Pr = {
|
|
|
1365
1365
|
return t.type === 1 ? Pr.set.call(this, t, e, void 0, t.proxy) : (kt(t.original, e) !== void 0 || e in t.original ? (V(t), ie(t), t.assignedMap.set(e, !1)) : (t.assignedMap = (n = t.assignedMap) !== null && n !== void 0 ? n : /* @__PURE__ */ new Map(), t.assignedMap.delete(e)), t.copy && delete t.copy[e], !0);
|
|
1366
1366
|
}
|
|
1367
1367
|
};
|
|
1368
|
-
function
|
|
1368
|
+
function on(t) {
|
|
1369
1369
|
const { original: e, parentDraft: n, key: r, finalities: i, options: s } = t, o = me(e), u = {
|
|
1370
1370
|
type: o,
|
|
1371
1371
|
finalized: !1,
|
|
@@ -1389,7 +1389,7 @@ function un(t) {
|
|
|
1389
1389
|
const m = ce(g, r), T = A(m);
|
|
1390
1390
|
if (T) {
|
|
1391
1391
|
let v = T.original;
|
|
1392
|
-
T.operated && (v =
|
|
1392
|
+
T.operated && (v = nn(m)), Dt(T), Ut(T, Ve, f, l), c.options.enableAutoFreeze && (c.options.updatedValues = (p = c.options.updatedValues) !== null && p !== void 0 ? p : /* @__PURE__ */ new WeakMap(), c.options.updatedValues.set(v, T.original)), We(g, r, v);
|
|
1393
1393
|
}
|
|
1394
1394
|
(y = b.callbacks) === null || y === void 0 || y.forEach((v) => {
|
|
1395
1395
|
v(f, l);
|
|
@@ -1398,12 +1398,12 @@ function un(t) {
|
|
|
1398
1398
|
} else {
|
|
1399
1399
|
const c = A(a);
|
|
1400
1400
|
c.finalities.draft.push((f, l) => {
|
|
1401
|
-
|
|
1401
|
+
Dt(c), Ut(c, Ve, f, l);
|
|
1402
1402
|
});
|
|
1403
1403
|
}
|
|
1404
1404
|
return a;
|
|
1405
1405
|
}
|
|
1406
|
-
|
|
1406
|
+
Xt.createDraft = on;
|
|
1407
1407
|
function Xi(t, e, n, r, i) {
|
|
1408
1408
|
var s;
|
|
1409
1409
|
const o = A(t), u = (s = o == null ? void 0 : o.original) !== null && s !== void 0 ? s : t, a = !!e.length;
|
|
@@ -1411,7 +1411,7 @@ function Xi(t, e, n, r, i) {
|
|
|
1411
1411
|
for (; o.finalities.draft.length > 0; )
|
|
1412
1412
|
o.finalities.draft.pop()(n, r);
|
|
1413
1413
|
const d = a ? e[0] : o ? o.operated ? o.copy : o.original : t;
|
|
1414
|
-
return o &&
|
|
1414
|
+
return o && xt(o), i && Se(d, d, o == null ? void 0 : o.options.updatedValues), [
|
|
1415
1415
|
d,
|
|
1416
1416
|
n && a ? [{ op: x.Replace, path: [], value: e[0] }] : n,
|
|
1417
1417
|
r && a ? [{ op: x.Replace, path: [], value: u }] : r
|
|
@@ -1426,7 +1426,7 @@ function es(t, e) {
|
|
|
1426
1426
|
};
|
|
1427
1427
|
let i, s;
|
|
1428
1428
|
e.enablePatches && (i = [], s = []);
|
|
1429
|
-
const u = ((n = e.mark) === null || n === void 0 ? void 0 : n.call(e, t, Y)) === Y.mutable || !ee(t, e) ? t :
|
|
1429
|
+
const u = ((n = e.mark) === null || n === void 0 ? void 0 : n.call(e, t, Y)) === Y.mutable || !ee(t, e) ? t : on({
|
|
1430
1430
|
original: t,
|
|
1431
1431
|
parentDraft: null,
|
|
1432
1432
|
finalities: r,
|
|
@@ -1440,9 +1440,9 @@ function es(t, e) {
|
|
|
1440
1440
|
}
|
|
1441
1441
|
];
|
|
1442
1442
|
}
|
|
1443
|
-
function
|
|
1443
|
+
function Ft(t) {
|
|
1444
1444
|
const { rootDraft: e, value: n, useRawReturn: r = !1, isRoot: i = !0 } = t;
|
|
1445
|
-
|
|
1445
|
+
rn(n, (s, o, u) => {
|
|
1446
1446
|
const a = A(o);
|
|
1447
1447
|
if (a && e && a.finalities === e.finalities) {
|
|
1448
1448
|
t.isContainDraft = !0;
|
|
@@ -1452,7 +1452,7 @@ function Nt(t) {
|
|
|
1452
1452
|
u.clear(), c.forEach((f) => u.add(s === f ? d : f));
|
|
1453
1453
|
} else
|
|
1454
1454
|
We(u, s, d);
|
|
1455
|
-
} else typeof o == "object" && o !== null && (t.value = o, t.isRoot = !1,
|
|
1455
|
+
} else typeof o == "object" && o !== null && (t.value = o, t.isRoot = !1, Ft(t));
|
|
1456
1456
|
}), i && (t.isContainDraft || console.warn("The return value does not contain any draft, please use 'rawReturn()' to wrap the return value to improve performance."), r && console.warn("The return value contains drafts, please don't use 'rawReturn()' to wrap the return value."));
|
|
1457
1457
|
}
|
|
1458
1458
|
function Ir(t) {
|
|
@@ -1465,7 +1465,7 @@ function Ir(t) {
|
|
|
1465
1465
|
return n.original;
|
|
1466
1466
|
let i;
|
|
1467
1467
|
function s() {
|
|
1468
|
-
i = r === 2 ?
|
|
1468
|
+
i = r === 2 ? tn(t) ? new Map(t) : new (Object.getPrototypeOf(t)).constructor(t) : r === 3 ? Array.from(n.setMap.values()) : kr(t, n == null ? void 0 : n.options);
|
|
1469
1469
|
}
|
|
1470
1470
|
if (n) {
|
|
1471
1471
|
n.finalized = !0;
|
|
@@ -1476,18 +1476,18 @@ function Ir(t) {
|
|
|
1476
1476
|
}
|
|
1477
1477
|
} else
|
|
1478
1478
|
i = t;
|
|
1479
|
-
if (
|
|
1479
|
+
if (rn(i, (o, u) => {
|
|
1480
1480
|
if (n && ae(ce(n.original, o), u))
|
|
1481
1481
|
return;
|
|
1482
1482
|
const a = Ir(u);
|
|
1483
1483
|
a !== u && (i === t && s(), We(i, o, a));
|
|
1484
1484
|
}), r === 3) {
|
|
1485
1485
|
const o = (e = n == null ? void 0 : n.original) !== null && e !== void 0 ? e : i;
|
|
1486
|
-
return
|
|
1486
|
+
return en(o) ? new Set(i) : new (Object.getPrototypeOf(o)).constructor(i);
|
|
1487
1487
|
}
|
|
1488
1488
|
return i;
|
|
1489
1489
|
}
|
|
1490
|
-
function
|
|
1490
|
+
function qn(t) {
|
|
1491
1491
|
if (!Te(t))
|
|
1492
1492
|
throw new Error(`current() is only used for Draft, parameter: ${t}`);
|
|
1493
1493
|
return Ir(t);
|
|
@@ -1503,7 +1503,7 @@ const ts = (t) => function e(n, r, i) {
|
|
|
1503
1503
|
if (typeof r != "function" && (c = r), c !== void 0 && Object.prototype.toString.call(c) !== "[object Object]")
|
|
1504
1504
|
throw new Error(`Invalid options: ${c}, 'options' should be an object.`);
|
|
1505
1505
|
c = Object.assign(Object.assign({}, t), c);
|
|
1506
|
-
const f = Te(a) ?
|
|
1506
|
+
const f = Te(a) ? qn(a) : a, l = Array.isArray(c.mark) ? (S, I) => {
|
|
1507
1507
|
for (const R of c.mark) {
|
|
1508
1508
|
if (typeof R != "function")
|
|
1509
1509
|
throw new Error(`Invalid mark: ${R}, 'mark' should be a function.`);
|
|
@@ -1529,7 +1529,7 @@ const ts = (t) => function e(n, r, i) {
|
|
|
1529
1529
|
try {
|
|
1530
1530
|
v = d(m);
|
|
1531
1531
|
} catch (S) {
|
|
1532
|
-
throw
|
|
1532
|
+
throw xt(A(m)), S;
|
|
1533
1533
|
}
|
|
1534
1534
|
const j = (S) => {
|
|
1535
1535
|
const I = A(m);
|
|
@@ -1539,14 +1539,14 @@ const ts = (t) => function e(n, r, i) {
|
|
|
1539
1539
|
const q = S == null ? void 0 : S[zi];
|
|
1540
1540
|
if (q) {
|
|
1541
1541
|
const Ie = q[0];
|
|
1542
|
-
return g.strict && typeof S == "object" && S !== null &&
|
|
1542
|
+
return g.strict && typeof S == "object" && S !== null && Ft({
|
|
1543
1543
|
rootDraft: I,
|
|
1544
1544
|
value: S,
|
|
1545
1545
|
useRawReturn: !0
|
|
1546
1546
|
}), T([Ie]);
|
|
1547
1547
|
}
|
|
1548
1548
|
if (S !== void 0)
|
|
1549
|
-
return typeof S == "object" && S !== null &&
|
|
1549
|
+
return typeof S == "object" && S !== null && Ft({ rootDraft: I, value: S }), T([S]);
|
|
1550
1550
|
}
|
|
1551
1551
|
if (S === m || S === void 0)
|
|
1552
1552
|
return T([]);
|
|
@@ -1554,12 +1554,12 @@ const ts = (t) => function e(n, r, i) {
|
|
|
1554
1554
|
if (g === R.options) {
|
|
1555
1555
|
if (R.operated)
|
|
1556
1556
|
throw new Error("Cannot return a modified child draft.");
|
|
1557
|
-
return T([
|
|
1557
|
+
return T([qn(S)]);
|
|
1558
1558
|
}
|
|
1559
1559
|
return T([S]);
|
|
1560
1560
|
};
|
|
1561
1561
|
return v instanceof Promise ? v.then(j, (S) => {
|
|
1562
|
-
throw
|
|
1562
|
+
throw xt(A(m)), S;
|
|
1563
1563
|
}) : j(v);
|
|
1564
1564
|
}, ft = ts();
|
|
1565
1565
|
Object.prototype.constructor.toString();
|
|
@@ -1567,13 +1567,13 @@ function Mr(t, e) {
|
|
|
1567
1567
|
const n = Object.keys(t), r = Object.keys(e);
|
|
1568
1568
|
return n.length === r.length && Object.keys(t).every((i) => e.hasOwnProperty(i));
|
|
1569
1569
|
}
|
|
1570
|
-
function
|
|
1570
|
+
function zn(t, e) {
|
|
1571
1571
|
return Object.keys(t).length === Object.keys(e).length && Object.keys(t).every((n) => e.hasOwnProperty(n) && t[n] === e[n]);
|
|
1572
1572
|
}
|
|
1573
1573
|
function ut(t, e) {
|
|
1574
1574
|
return typeof t != "object" || typeof e != "object" || t === null || e === null ? t === e : Mr(t, e) ? Object.keys(t).every((n) => ut(t[n], e[n])) : !1;
|
|
1575
1575
|
}
|
|
1576
|
-
function
|
|
1576
|
+
function un(t) {
|
|
1577
1577
|
if (!Le(t))
|
|
1578
1578
|
return t;
|
|
1579
1579
|
const e = {};
|
|
@@ -1611,7 +1611,7 @@ function ns(t, e, n) {
|
|
|
1611
1611
|
const i = e[e.length - 1];
|
|
1612
1612
|
Array.isArray(r) && typeof i == "number" ? r.splice(i, 0, n) : r[i] = n;
|
|
1613
1613
|
}
|
|
1614
|
-
function
|
|
1614
|
+
function Vn(t, e, n) {
|
|
1615
1615
|
if (!t || e.length === 0)
|
|
1616
1616
|
return;
|
|
1617
1617
|
let r = t || {};
|
|
@@ -1636,7 +1636,7 @@ function $r(t, e) {
|
|
|
1636
1636
|
function rs(t) {
|
|
1637
1637
|
return t && Object.keys(t).length === 0;
|
|
1638
1638
|
}
|
|
1639
|
-
const
|
|
1639
|
+
const Wn = /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$/, is = {
|
|
1640
1640
|
ZULU: 0,
|
|
1641
1641
|
YEKT: 18e3,
|
|
1642
1642
|
YEKST: 21600,
|
|
@@ -1892,10 +1892,10 @@ function ys(t) {
|
|
|
1892
1892
|
}
|
|
1893
1893
|
}
|
|
1894
1894
|
function bs(t) {
|
|
1895
|
-
const e = t.match(
|
|
1895
|
+
const e = t.match(Wn);
|
|
1896
1896
|
if (!e)
|
|
1897
1897
|
return null;
|
|
1898
|
-
const [n] = e, r = is[n], i = new Date(t.replace(
|
|
1898
|
+
const [n] = e, r = is[n], i = new Date(t.replace(Wn, "Z"));
|
|
1899
1899
|
return new Date(i.getTime() - r * 1e3);
|
|
1900
1900
|
}
|
|
1901
1901
|
const _s = [
|
|
@@ -1919,7 +1919,7 @@ function gs(t, e) {
|
|
|
1919
1919
|
return null;
|
|
1920
1920
|
}
|
|
1921
1921
|
}
|
|
1922
|
-
function
|
|
1922
|
+
function Nt(t) {
|
|
1923
1923
|
for (const e of _s) {
|
|
1924
1924
|
const n = gs(e, t);
|
|
1925
1925
|
if (n)
|
|
@@ -1930,7 +1930,7 @@ function Kt(t) {
|
|
|
1930
1930
|
function Ts(t) {
|
|
1931
1931
|
try {
|
|
1932
1932
|
const e = JSON.parse(t);
|
|
1933
|
-
return typeof e == "string" ?
|
|
1933
|
+
return typeof e == "string" ? Nt(e) : null;
|
|
1934
1934
|
} catch {
|
|
1935
1935
|
return null;
|
|
1936
1936
|
}
|
|
@@ -1942,7 +1942,7 @@ function pt(t) {
|
|
|
1942
1942
|
if (t instanceof Date)
|
|
1943
1943
|
return t;
|
|
1944
1944
|
if (typeof t == "string") {
|
|
1945
|
-
const e =
|
|
1945
|
+
const e = Nt(t) || Ts(t) || Nt(t.trim());
|
|
1946
1946
|
if (!e)
|
|
1947
1947
|
throw new Error(`Unable to parse \`${t}\` as a date.`);
|
|
1948
1948
|
return e;
|
|
@@ -1954,10 +1954,10 @@ function pt(t) {
|
|
|
1954
1954
|
function ms(t) {
|
|
1955
1955
|
return t.cardinality === "one";
|
|
1956
1956
|
}
|
|
1957
|
-
function
|
|
1957
|
+
function an(t) {
|
|
1958
1958
|
return t["value-type"] === "ref";
|
|
1959
1959
|
}
|
|
1960
|
-
function
|
|
1960
|
+
function cn(t) {
|
|
1961
1961
|
return t["value-type"] === "blob";
|
|
1962
1962
|
}
|
|
1963
1963
|
function je(t, e) {
|
|
@@ -1996,7 +1996,7 @@ function xr(t, e, n) {
|
|
|
1996
1996
|
console.warn("no such attr", u, t);
|
|
1997
1997
|
continue;
|
|
1998
1998
|
}
|
|
1999
|
-
f["checked-data-type"] === "date" && n && (d = pt(d), o[2] = d),
|
|
1999
|
+
f["checked-data-type"] === "date" && n && (d = pt(d), o[2] = d), an(f) && B(s, [d, a, u], o), B(r, [u, a, d], o), B(i, [a, u, d], o);
|
|
2000
2000
|
}
|
|
2001
2001
|
return { eav: r, aev: i, vae: s };
|
|
2002
2002
|
}
|
|
@@ -2004,7 +2004,7 @@ function Dr(t) {
|
|
|
2004
2004
|
const e = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
|
|
2005
2005
|
for (const s of Object.values(t)) {
|
|
2006
2006
|
const o = s["forward-identity"], [u, a, d] = o, c = s["reverse-identity"];
|
|
2007
|
-
if (B(r, [a, d], s),
|
|
2007
|
+
if (B(r, [a, d], s), cn(s) && B(e, [a, d], s), s["primary?"] && B(n, [a], s), c) {
|
|
2008
2008
|
const [f, l, p] = c;
|
|
2009
2009
|
B(i, [l, p], s);
|
|
2010
2010
|
}
|
|
@@ -2027,7 +2027,7 @@ function Lr(t) {
|
|
|
2027
2027
|
function ws(t, e) {
|
|
2028
2028
|
return Ce(t.eav, [e]) !== void 0;
|
|
2029
2029
|
}
|
|
2030
|
-
function
|
|
2030
|
+
function dn(t) {
|
|
2031
2031
|
t.attrIndexes = Dr(t.attrs);
|
|
2032
2032
|
}
|
|
2033
2033
|
function at(t, e, n, r, i) {
|
|
@@ -2066,7 +2066,7 @@ function Fr(t, e) {
|
|
|
2066
2066
|
if (!n)
|
|
2067
2067
|
return;
|
|
2068
2068
|
const [r, i, s] = n, o = je(t.attrs, i);
|
|
2069
|
-
o && (X(t.eav, [r, i, s]), X(t.aev, [i, r, s]),
|
|
2069
|
+
o && (X(t.eav, [r, i, s]), X(t.aev, [i, r, s]), an(o) && X(t.vae, [s, i, r]));
|
|
2070
2070
|
}
|
|
2071
2071
|
let vs = 0;
|
|
2072
2072
|
function Nr(t, e, n) {
|
|
@@ -2086,7 +2086,7 @@ function Kr(t, e) {
|
|
|
2086
2086
|
return;
|
|
2087
2087
|
u["checked-data-type"] === "date" && t.useDateObjects && (o = pt(o));
|
|
2088
2088
|
const a = Ce(t.eav, [i, s, o]), d = (n = a == null ? void 0 : a[3]) !== null && n !== void 0 ? n : Nr(t, u, r), c = [i, s, o, d];
|
|
2089
|
-
ms(u) ? (B(t.eav, [i, s], /* @__PURE__ */ new Map([[o, c]])), B(t.aev, [s, i], /* @__PURE__ */ new Map([[o, c]]))) : (B(t.eav, [i, s, o], c), B(t.aev, [s, i, o], c)),
|
|
2089
|
+
ms(u) ? (B(t.eav, [i, s], /* @__PURE__ */ new Map([[o, c]])), B(t.aev, [s, i], /* @__PURE__ */ new Map([[o, c]]))) : (B(t.eav, [i, s, o], c), B(t.aev, [s, i, o], c)), an(u) && B(t.vae, [o, s, i], c);
|
|
2090
2090
|
}
|
|
2091
2091
|
function Ss(t, e) {
|
|
2092
2092
|
var n;
|
|
@@ -2096,7 +2096,7 @@ function Ss(t, e) {
|
|
|
2096
2096
|
const [i, s, o] = r, u = je(t.attrs, s);
|
|
2097
2097
|
if (!u)
|
|
2098
2098
|
return;
|
|
2099
|
-
if (!
|
|
2099
|
+
if (!cn(u))
|
|
2100
2100
|
throw new Error("merge operation is not supported for links");
|
|
2101
2101
|
const a = Ce(t.eav, [i, s]);
|
|
2102
2102
|
if (!a)
|
|
@@ -2112,7 +2112,7 @@ function Ss(t, e) {
|
|
|
2112
2112
|
];
|
|
2113
2113
|
B(t.eav, [i, s], /* @__PURE__ */ new Map([[f, l]]));
|
|
2114
2114
|
}
|
|
2115
|
-
function
|
|
2115
|
+
function Kt(t, e) {
|
|
2116
2116
|
var n, r;
|
|
2117
2117
|
const [i, s] = e, o = Be(t, [i]);
|
|
2118
2118
|
if (!o)
|
|
@@ -2123,7 +2123,7 @@ function qt(t, e) {
|
|
|
2123
2123
|
const f = t.attrs[c];
|
|
2124
2124
|
f && f["on-delete-reverse"] === "cascade" && G(a.get(c), 1).forEach(([l, p, y]) => {
|
|
2125
2125
|
var b;
|
|
2126
|
-
return
|
|
2126
|
+
return Kt(t, [y, (b = f["reverse-identity"]) === null || b === void 0 ? void 0 : b[1]]);
|
|
2127
2127
|
}), // Fall back to deleting everything if we've rehydrated tx-steps from
|
|
2128
2128
|
// the store that didn't set `etype` in deleteEntity
|
|
2129
2129
|
(!s || // If we don't know about the attr, let's just get rid of it
|
|
@@ -2136,7 +2136,7 @@ function qt(t, e) {
|
|
|
2136
2136
|
d && d.forEach((c) => {
|
|
2137
2137
|
var f, l, p;
|
|
2138
2138
|
const [y, b, g] = c, m = t.attrs[b];
|
|
2139
|
-
(!s || !m || ((f = m["reverse-identity"]) === null || f === void 0 ? void 0 : f[1]) === s) && (X(t.eav, [y, b, g]), X(t.aev, [b, y, g]), X(t.vae, [g, b, y])), m && m["on-delete"] === "cascade" && ((l = m["reverse-identity"]) === null || l === void 0 ? void 0 : l[1]) === s &&
|
|
2139
|
+
(!s || !m || ((f = m["reverse-identity"]) === null || f === void 0 ? void 0 : f[1]) === s) && (X(t.eav, [y, b, g]), X(t.aev, [b, y, g]), X(t.vae, [g, b, y])), m && m["on-delete"] === "cascade" && ((l = m["reverse-identity"]) === null || l === void 0 ? void 0 : l[1]) === s && Kt(t, [y, (p = m["forward-identity"]) === null || p === void 0 ? void 0 : p[1]]);
|
|
2140
2140
|
}), ((r = t.vae.get(u)) === null || r === void 0 ? void 0 : r.size) === 0 && X(t.vae, [u]);
|
|
2141
2141
|
}
|
|
2142
2142
|
function qr(t, e) {
|
|
@@ -2146,7 +2146,7 @@ function qr(t, e) {
|
|
|
2146
2146
|
});
|
|
2147
2147
|
}
|
|
2148
2148
|
function Os(t, [e]) {
|
|
2149
|
-
t.attrs[e.id] = e,
|
|
2149
|
+
t.attrs[e.id] = e, dn(t);
|
|
2150
2150
|
}
|
|
2151
2151
|
function zr(t) {
|
|
2152
2152
|
return G(t.eav, 3);
|
|
@@ -2155,11 +2155,11 @@ function Es(t, [e]) {
|
|
|
2155
2155
|
if (!t.attrs[e])
|
|
2156
2156
|
return;
|
|
2157
2157
|
const n = zr(t).filter(([r, i]) => i !== e);
|
|
2158
|
-
delete t.attrs[e],
|
|
2158
|
+
delete t.attrs[e], dn(t), qr(t, n);
|
|
2159
2159
|
}
|
|
2160
2160
|
function As(t, [e]) {
|
|
2161
2161
|
const n = t.attrs[e.id];
|
|
2162
|
-
n && (t.attrs[e.id] = Object.assign(Object.assign({}, n), e),
|
|
2162
|
+
n && (t.attrs[e.id] = Object.assign(Object.assign({}, n), e), dn(t), qr(t, zr(t)));
|
|
2163
2163
|
}
|
|
2164
2164
|
function ks(t, e) {
|
|
2165
2165
|
const [n, ...r] = e;
|
|
@@ -2174,7 +2174,7 @@ function ks(t, e) {
|
|
|
2174
2174
|
Fr(t, r);
|
|
2175
2175
|
break;
|
|
2176
2176
|
case "delete-entity":
|
|
2177
|
-
|
|
2177
|
+
Kt(t, r);
|
|
2178
2178
|
break;
|
|
2179
2179
|
case "add-attr":
|
|
2180
2180
|
Os(t, r);
|
|
@@ -2355,15 +2355,15 @@ function xs(t, e, n) {
|
|
|
2355
2355
|
}
|
|
2356
2356
|
return Object.assign(Object.assign({}, n), { [t]: e });
|
|
2357
2357
|
}
|
|
2358
|
-
function
|
|
2358
|
+
function Bn(t, e, n) {
|
|
2359
2359
|
return t === e ? n : null;
|
|
2360
2360
|
}
|
|
2361
2361
|
function Ds(t) {
|
|
2362
2362
|
switch (typeof t) {
|
|
2363
2363
|
case "string":
|
|
2364
|
-
return t.startsWith("?") ? xs :
|
|
2364
|
+
return t.startsWith("?") ? xs : Bn;
|
|
2365
2365
|
default:
|
|
2366
|
-
return
|
|
2366
|
+
return Bn;
|
|
2367
2367
|
}
|
|
2368
2368
|
}
|
|
2369
2369
|
const Us = [
|
|
@@ -2393,19 +2393,19 @@ function Ns(t, e, n) {
|
|
|
2393
2393
|
return zs(t, e, n).map((r) => Fs(e, r, n)).filter((r) => r);
|
|
2394
2394
|
}
|
|
2395
2395
|
function Ks(t, e, n) {
|
|
2396
|
-
return e.or ? e.or.patterns.flatMap((r) =>
|
|
2396
|
+
return e.or ? e.or.patterns.flatMap((r) => qt(t, r, n)) : e.and ? e.and.patterns.reduce((r, i) => qt(t, i, r), n) : n.flatMap((r) => Ns(t, e, r));
|
|
2397
2397
|
}
|
|
2398
|
-
function
|
|
2398
|
+
function qt(t, e, n = [{}]) {
|
|
2399
2399
|
return e.reduce((r, i) => Ks(t, i, r), n);
|
|
2400
2400
|
}
|
|
2401
|
-
function
|
|
2402
|
-
return Array.isArray(e) ? e.map((n) =>
|
|
2401
|
+
function fn(t, e) {
|
|
2402
|
+
return Array.isArray(e) ? e.map((n) => fn(t, n)) : $s(e) ? t[e] : e;
|
|
2403
2403
|
}
|
|
2404
2404
|
function qs(t, { find: e, where: n }) {
|
|
2405
|
-
return
|
|
2405
|
+
return qt(t, n).map((i) => fn(i, e));
|
|
2406
2406
|
}
|
|
2407
2407
|
function zs(t, e, n) {
|
|
2408
|
-
return Cs(t,
|
|
2408
|
+
return Cs(t, fn(n, e));
|
|
2409
2409
|
}
|
|
2410
2410
|
const Vs = /^(?:[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;
|
|
2411
2411
|
function Ee(t) {
|
|
@@ -2427,18 +2427,18 @@ function Gs() {
|
|
|
2427
2427
|
}
|
|
2428
2428
|
return jt(Bs);
|
|
2429
2429
|
}
|
|
2430
|
-
const Qs = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto),
|
|
2430
|
+
const Qs = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Gn = { randomUUID: Qs };
|
|
2431
2431
|
function Hs(t, e, n) {
|
|
2432
2432
|
var i;
|
|
2433
|
-
if (
|
|
2434
|
-
return
|
|
2433
|
+
if (Gn.randomUUID && !t)
|
|
2434
|
+
return Gn.randomUUID();
|
|
2435
2435
|
t = t || {};
|
|
2436
2436
|
const r = t.random ?? ((i = t.rng) == null ? void 0 : i.call(t)) ?? Gs();
|
|
2437
2437
|
if (r.length < 16)
|
|
2438
2438
|
throw new Error("Random bytes length must be >= 16");
|
|
2439
2439
|
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, Ws(r);
|
|
2440
2440
|
}
|
|
2441
|
-
function
|
|
2441
|
+
function Qn(t) {
|
|
2442
2442
|
const e = t.replace(/-/g, ""), n = [];
|
|
2443
2443
|
for (let r = 0; r < e.length; r += 2)
|
|
2444
2444
|
n.push(parseInt(e.substring(r, r + 2), 16));
|
|
@@ -2454,7 +2454,7 @@ function Ys(t, e) {
|
|
|
2454
2454
|
return 0;
|
|
2455
2455
|
}
|
|
2456
2456
|
function Js(t, e) {
|
|
2457
|
-
return Ys(
|
|
2457
|
+
return Ys(Qn(t), Qn(e));
|
|
2458
2458
|
}
|
|
2459
2459
|
function L() {
|
|
2460
2460
|
return Hs();
|
|
@@ -2490,7 +2490,7 @@ function no(t, e) {
|
|
|
2490
2490
|
throw new Ae(`Could not find id attr for ${e}`);
|
|
2491
2491
|
return n;
|
|
2492
2492
|
}
|
|
2493
|
-
function
|
|
2493
|
+
function Hn(t, e, n, r) {
|
|
2494
2494
|
return [ro(t, e, n, r)];
|
|
2495
2495
|
}
|
|
2496
2496
|
function ro(t, e, n, r) {
|
|
@@ -2523,7 +2523,7 @@ function Gr(t, e, n, r, i) {
|
|
|
2523
2523
|
];
|
|
2524
2524
|
return [s ? f : d, l, p, u, !!s];
|
|
2525
2525
|
}
|
|
2526
|
-
function
|
|
2526
|
+
function Yn(t, e) {
|
|
2527
2527
|
if (typeof e != "string")
|
|
2528
2528
|
return function(o) {
|
|
2529
2529
|
return !1;
|
|
@@ -2574,7 +2574,7 @@ function so(t, e) {
|
|
|
2574
2574
|
}
|
|
2575
2575
|
};
|
|
2576
2576
|
if (e.hasOwnProperty("$like")) {
|
|
2577
|
-
const r =
|
|
2577
|
+
const r = Yn(!0, e.$like);
|
|
2578
2578
|
return {
|
|
2579
2579
|
$comparator: !0,
|
|
2580
2580
|
$op: function(s) {
|
|
@@ -2583,7 +2583,7 @@ function so(t, e) {
|
|
|
2583
2583
|
};
|
|
2584
2584
|
}
|
|
2585
2585
|
if (e.hasOwnProperty("$ilike")) {
|
|
2586
|
-
const r =
|
|
2586
|
+
const r = Yn(!1, e.$ilike);
|
|
2587
2587
|
return {
|
|
2588
2588
|
$comparator: !0,
|
|
2589
2589
|
$op: function(s) {
|
|
@@ -2622,7 +2622,7 @@ function uo(t, e, n, r, i) {
|
|
|
2622
2622
|
}, [n, r, []]);
|
|
2623
2623
|
return [s, o, u];
|
|
2624
2624
|
}
|
|
2625
|
-
function
|
|
2625
|
+
function zt(t, e, n, r, i, s) {
|
|
2626
2626
|
const o = i.slice(0, i.length - 1), u = i[i.length - 1], [a, d, c] = uo(t, e, n, r, o), f = oo(t, e, a, d, u, s);
|
|
2627
2627
|
return c.concat([f]);
|
|
2628
2628
|
}
|
|
@@ -2641,7 +2641,7 @@ function lo(t, e, n) {
|
|
|
2641
2641
|
return e == s ? s : `${s}-${n}`;
|
|
2642
2642
|
};
|
|
2643
2643
|
}
|
|
2644
|
-
function
|
|
2644
|
+
function Jn(t, e, n, r, i, s) {
|
|
2645
2645
|
const o = t(r, i), u = s.map((a, d) => {
|
|
2646
2646
|
const c = lo(t, o, d);
|
|
2647
2647
|
return Qr(c, n, r, i, a);
|
|
@@ -2654,20 +2654,20 @@ function ho(t) {
|
|
|
2654
2654
|
e.push(t.slice(0, n));
|
|
2655
2655
|
return e;
|
|
2656
2656
|
}
|
|
2657
|
-
function
|
|
2658
|
-
return ho(i).map((s) =>
|
|
2657
|
+
function Zn(t, e, n, r, i) {
|
|
2658
|
+
return ho(i).map((s) => zt(t, e, n, r, s, { $isNull: !0 }));
|
|
2659
2659
|
}
|
|
2660
2660
|
function Qr(t, e, n, r, i) {
|
|
2661
2661
|
return Object.entries(i).flatMap(([s, o]) => {
|
|
2662
2662
|
if (co([s, o]))
|
|
2663
|
-
return
|
|
2663
|
+
return Jn(t, "or", e, n, r, o);
|
|
2664
2664
|
if (fo([s, o]))
|
|
2665
|
-
return
|
|
2665
|
+
return Jn(t, "and", e, n, r, o);
|
|
2666
2666
|
if (s === "$entityIdStartsWith")
|
|
2667
2667
|
return [];
|
|
2668
2668
|
const u = s.split(".");
|
|
2669
2669
|
if (o != null && o.hasOwnProperty("$ne") && (o = Object.assign(Object.assign({}, o), { $not: o.$ne }), delete o.$ne), o != null && o.hasOwnProperty("$not")) {
|
|
2670
|
-
const a =
|
|
2670
|
+
const a = zt(t, e, n, r, u, o), d = Zn(t, e, n, r, u);
|
|
2671
2671
|
return [
|
|
2672
2672
|
{
|
|
2673
2673
|
or: {
|
|
@@ -2680,16 +2680,16 @@ function Qr(t, e, n, r, i) {
|
|
|
2680
2680
|
return o != null && o.hasOwnProperty("$isNull") && o.$isNull === !0 && u.length > 1 ? [
|
|
2681
2681
|
{
|
|
2682
2682
|
or: {
|
|
2683
|
-
patterns:
|
|
2683
|
+
patterns: Zn(t, e, n, r, u),
|
|
2684
2684
|
joinSym: t(n, r)
|
|
2685
2685
|
}
|
|
2686
2686
|
}
|
|
2687
|
-
] :
|
|
2687
|
+
] : zt(t, e, n, r, u, o);
|
|
2688
2688
|
});
|
|
2689
2689
|
}
|
|
2690
2690
|
function po(t, e, n, r) {
|
|
2691
2691
|
const i = yt;
|
|
2692
|
-
return r ? Qr(i, t, e, n, r).concat(
|
|
2692
|
+
return r ? Qr(i, t, e, n, r).concat(Hn(i, t, e, n)) : Hn(i, t, e, n);
|
|
2693
2693
|
}
|
|
2694
2694
|
function yo(t, e, n) {
|
|
2695
2695
|
return [t(e, n), t("time", n)];
|
|
@@ -2731,7 +2731,7 @@ function Fe(t, e, n, r, i) {
|
|
|
2731
2731
|
function lt([t, e], [n, r], i) {
|
|
2732
2732
|
return Fe(t, e, n, r, i);
|
|
2733
2733
|
}
|
|
2734
|
-
function
|
|
2734
|
+
function Vt(t) {
|
|
2735
2735
|
return t == null ? t : new Date(t).getTime();
|
|
2736
2736
|
}
|
|
2737
2737
|
function To(t, e, n, r) {
|
|
@@ -2739,7 +2739,7 @@ function To(t, e, n, r) {
|
|
|
2739
2739
|
const [s, o, u, a] = t, d = n === "desc" ? 1 : -1;
|
|
2740
2740
|
if (((i = e["forward-identity"]) === null || i === void 0 ? void 0 : i[2]) === "id")
|
|
2741
2741
|
return lt(r, [s, a], null) === d;
|
|
2742
|
-
const [c, f] = r, l = e["checked-data-type"], p = l === "date" ?
|
|
2742
|
+
const [c, f] = r, l = e["checked-data-type"], p = l === "date" ? Vt(f) : f, y = l === "date" ? Vt(u) : u;
|
|
2743
2743
|
return lt([c, p], [s, y], l) === d;
|
|
2744
2744
|
}
|
|
2745
2745
|
function mo(t, e) {
|
|
@@ -2763,7 +2763,7 @@ function So(t, e, n) {
|
|
|
2763
2763
|
const s = /* @__PURE__ */ new Map();
|
|
2764
2764
|
for (const o of n.fields) {
|
|
2765
2765
|
const u = fe(t, e, o), a = (r = u == null ? void 0 : u["forward-identity"]) === null || r === void 0 ? void 0 : r[2];
|
|
2766
|
-
a &&
|
|
2766
|
+
a && cn(u) && s.set(a, u);
|
|
2767
2767
|
}
|
|
2768
2768
|
if (!s.has("id")) {
|
|
2769
2769
|
const o = fe(t, e, "id"), u = (i = o == null ? void 0 : o["forward-identity"]) === null || i === void 0 ? void 0 : i[2];
|
|
@@ -2781,7 +2781,7 @@ function Oo(t, { etype: e, pageInfo: n, dq: r, form: i }) {
|
|
|
2781
2781
|
c = c.map(([m]) => {
|
|
2782
2782
|
var T, v, j, S, I;
|
|
2783
2783
|
let R = (I = (S = (j = (v = (T = t.eav.get(m)) === null || T === void 0 ? void 0 : T.get(g)) === null || v === void 0 ? void 0 : v.values()) === null || j === void 0 ? void 0 : j.next()) === null || S === void 0 ? void 0 : S.value) === null || I === void 0 ? void 0 : I[2];
|
|
2784
|
-
return b && (R =
|
|
2784
|
+
return b && (R = Vt(R)), [m, R];
|
|
2785
2785
|
});
|
|
2786
2786
|
}
|
|
2787
2787
|
c.sort(d === "asc" ? function(g, m) {
|
|
@@ -2877,7 +2877,7 @@ function Co() {
|
|
|
2877
2877
|
return new Set(Object.keys(e));
|
|
2878
2878
|
}
|
|
2879
2879
|
const Po = Co();
|
|
2880
|
-
function
|
|
2880
|
+
function Wt(t, e, n) {
|
|
2881
2881
|
const r = {
|
|
2882
2882
|
__etype: t,
|
|
2883
2883
|
__ops: n
|
|
@@ -2889,7 +2889,7 @@ function Bt(t, e, n) {
|
|
|
2889
2889
|
if (s === "__etype")
|
|
2890
2890
|
return t;
|
|
2891
2891
|
if (Po.has(s))
|
|
2892
|
-
return (o, u) =>
|
|
2892
|
+
return (o, u) => Wt(t, e, [
|
|
2893
2893
|
...n,
|
|
2894
2894
|
u ? [s, t, e, o, u] : [s, t, e, o]
|
|
2895
2895
|
]);
|
|
@@ -2911,18 +2911,18 @@ function Io(t) {
|
|
|
2911
2911
|
if (n === "__etype")
|
|
2912
2912
|
return t;
|
|
2913
2913
|
const r = n;
|
|
2914
|
-
return ht(r) ?
|
|
2914
|
+
return ht(r) ? Wt(t, Zr(r), []) : Wt(t, r, []);
|
|
2915
2915
|
}
|
|
2916
2916
|
});
|
|
2917
2917
|
}
|
|
2918
|
-
function
|
|
2918
|
+
function ln() {
|
|
2919
2919
|
return new Proxy({}, {
|
|
2920
2920
|
get(t, e) {
|
|
2921
2921
|
return Io(e);
|
|
2922
2922
|
}
|
|
2923
2923
|
});
|
|
2924
2924
|
}
|
|
2925
|
-
|
|
2925
|
+
ln();
|
|
2926
2926
|
function Mo(t) {
|
|
2927
2927
|
return t.__ops;
|
|
2928
2928
|
}
|
|
@@ -2968,30 +2968,30 @@ function $o(t) {
|
|
|
2968
2968
|
throw new Error("lookup must be an object with a single unique attr and value.");
|
|
2969
2969
|
return e[0];
|
|
2970
2970
|
}
|
|
2971
|
-
function
|
|
2971
|
+
function Bt(t, e, n) {
|
|
2972
2972
|
return n.indexOf(".") !== -1 && // attr names can have `.` in them, so use the attr we find with a `.`
|
|
2973
2973
|
// before assuming it's a ref lookup.
|
|
2974
2974
|
!K(t, e, n);
|
|
2975
2975
|
}
|
|
2976
|
-
function
|
|
2976
|
+
function Gt(t) {
|
|
2977
2977
|
const [e, n, ...r] = t.split(".");
|
|
2978
2978
|
if (r.length > 0 || n !== "id")
|
|
2979
2979
|
throw new Error(`${t} is not a valid lookup attribute.`);
|
|
2980
2980
|
return e;
|
|
2981
2981
|
}
|
|
2982
2982
|
function xo(t, e, n) {
|
|
2983
|
-
if (!
|
|
2983
|
+
if (!Bt(t, e, n))
|
|
2984
2984
|
return K(t, e, n);
|
|
2985
|
-
const r =
|
|
2985
|
+
const r = Gt(n), i = K(t, e, r) || _e(t, e, r);
|
|
2986
2986
|
if (i && i["value-type"] !== "ref")
|
|
2987
2987
|
throw new Error(`${n} does not reference a valid link attribute.`);
|
|
2988
2988
|
return i;
|
|
2989
2989
|
}
|
|
2990
|
-
function
|
|
2990
|
+
function Qt(t) {
|
|
2991
2991
|
return typeof t == "string" && !ht(t) ? null : typeof t == "string" && ht(t) ? Zr(t) : $o(t);
|
|
2992
2992
|
}
|
|
2993
2993
|
function Q(t, e, n) {
|
|
2994
|
-
const r =
|
|
2994
|
+
const r = Qt(n);
|
|
2995
2995
|
if (r === null)
|
|
2996
2996
|
return n;
|
|
2997
2997
|
const [i, s] = r, o = xo(t, e, i);
|
|
@@ -3068,14 +3068,14 @@ function ei({ stores: t, attrs: e }, [n, r, i, s]) {
|
|
|
3068
3068
|
return (s == null ? void 0 : s.upsert) === !1 ? { mode: "update" } : (s == null ? void 0 : s.upsert) === !0 ? null : Lo(t, n, r) ? { mode: "update" } : null;
|
|
3069
3069
|
}
|
|
3070
3070
|
function Fo(t, e) {
|
|
3071
|
-
const { stores: n, attrs: r } = t, [i, s, o, u] = e, a =
|
|
3071
|
+
const { stores: n, attrs: r } = t, [i, s, o, u] = e, a = un(o), d = Q(r, i, s);
|
|
3072
3072
|
return [["id", d]].concat(Object.entries(a)).map(([f, l]) => {
|
|
3073
3073
|
const p = K(r, i, f);
|
|
3074
3074
|
return p["checked-data-type"] === "date" && t.useDateObjects && (l = pt(l)), ["add-triple", d, p.id, l, { mode: "create" }];
|
|
3075
3075
|
});
|
|
3076
3076
|
}
|
|
3077
3077
|
function No(t, e) {
|
|
3078
|
-
const { stores: n, attrs: r } = t, [i, s, o, u] = e, a =
|
|
3078
|
+
const { stores: n, attrs: r } = t, [i, s, o, u] = e, a = un(o), d = Q(r, i, s), c = ei(t, [i, d, o, u]);
|
|
3079
3079
|
return [["id", d]].concat(Object.entries(a)).map(([l, p]) => {
|
|
3080
3080
|
const y = K(r, i, l);
|
|
3081
3081
|
return y["checked-data-type"] === "date" && t.useDateObjects && (p = pt(p)), [
|
|
@@ -3091,7 +3091,7 @@ function Ko({ attrs: t }, [e, n]) {
|
|
|
3091
3091
|
return [["delete-entity", Q(t, e, n), e]];
|
|
3092
3092
|
}
|
|
3093
3093
|
function qo(t, e) {
|
|
3094
|
-
const { stores: n, attrs: r } = t, [i, s, o, u] = e, a =
|
|
3094
|
+
const { stores: n, attrs: r } = t, [i, s, o, u] = e, a = un(o), d = Q(r, i, s), c = ei(t, [i, d, o, u]), f = Object.entries(a).map(([p, y]) => {
|
|
3095
3095
|
const b = K(r, i, p);
|
|
3096
3096
|
return [
|
|
3097
3097
|
"deep-merge-triple",
|
|
@@ -3186,7 +3186,7 @@ function Ho(t, e, n) {
|
|
|
3186
3186
|
"on-delete-reverse": s.onDelete
|
|
3187
3187
|
};
|
|
3188
3188
|
}
|
|
3189
|
-
function
|
|
3189
|
+
function Xn(t, e, n, r) {
|
|
3190
3190
|
const i = t ? Ho(t, e, n) : null, s = L(), o = [L(), e, n], u = [L(), n, e];
|
|
3191
3191
|
return Object.assign(Object.assign({ id: s, "forward-identity": o, "reverse-identity": u, "value-type": "ref", cardinality: "many", "unique?": !1, "index?": !1, isUnsynced: !0 }, i || {}), r || {});
|
|
3192
3192
|
}
|
|
@@ -3198,17 +3198,17 @@ const Yo = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink
|
|
|
3198
3198
|
"merge",
|
|
3199
3199
|
"delete",
|
|
3200
3200
|
"ruleParams"
|
|
3201
|
-
]),
|
|
3201
|
+
]), Ht = { "unique?": !0, "index?": !0 }, eu = Object.assign(Object.assign({}, Ht), { cardinality: "one" });
|
|
3202
3202
|
function tu(t) {
|
|
3203
3203
|
const e = [], [n, r, i, s] = t;
|
|
3204
3204
|
if (!Xo.has(n))
|
|
3205
3205
|
return e;
|
|
3206
|
-
const o =
|
|
3206
|
+
const o = Qt(i);
|
|
3207
3207
|
if (o && e.push({ etype: r, lookupPair: o }), n === "link")
|
|
3208
3208
|
for (const [u, a] of Object.entries(s)) {
|
|
3209
3209
|
const d = Array.isArray(a) ? a : [a];
|
|
3210
3210
|
for (const c of d) {
|
|
3211
|
-
const f =
|
|
3211
|
+
const f = Qt(c);
|
|
3212
3212
|
f && e.push({
|
|
3213
3213
|
etype: r,
|
|
3214
3214
|
lookupPair: f,
|
|
@@ -3229,7 +3229,7 @@ function nu({ attrs: t, schema: e }, n) {
|
|
|
3229
3229
|
}
|
|
3230
3230
|
function c(f, l) {
|
|
3231
3231
|
const p = K(o, f, l), y = _e(o, f, l);
|
|
3232
|
-
d(p), d(y), !p && !y && a(
|
|
3232
|
+
d(p), d(y), !p && !y && a(Xn(e, f, l, eu));
|
|
3233
3233
|
}
|
|
3234
3234
|
for (const f of n)
|
|
3235
3235
|
for (const { etype: l, lookupPair: p, linkLabel: y } of tu(f)) {
|
|
@@ -3239,17 +3239,17 @@ function nu({ attrs: t, schema: e }, n) {
|
|
|
3239
3239
|
const g = K(o, l, y), m = _e(o, l, y);
|
|
3240
3240
|
d(g), d(m);
|
|
3241
3241
|
const T = ((r = g == null ? void 0 : g["reverse-identity"]) === null || r === void 0 ? void 0 : r[1]) || ((i = m == null ? void 0 : m["forward-identity"]) === null || i === void 0 ? void 0 : i[1]) || y;
|
|
3242
|
-
if (
|
|
3243
|
-
c(T,
|
|
3242
|
+
if (Bt(o, T, b))
|
|
3243
|
+
c(T, Gt(b));
|
|
3244
3244
|
else {
|
|
3245
3245
|
const v = K(o, T, b);
|
|
3246
|
-
v || a(nt(e, T, b,
|
|
3246
|
+
v || a(nt(e, T, b, Ht)), d(v);
|
|
3247
3247
|
}
|
|
3248
|
-
} else if (
|
|
3249
|
-
c(l,
|
|
3248
|
+
} else if (Bt(o, l, b))
|
|
3249
|
+
c(l, Gt(b));
|
|
3250
3250
|
else {
|
|
3251
3251
|
const g = K(o, l, b);
|
|
3252
|
-
g || a(nt(e, l, b,
|
|
3252
|
+
g || a(nt(e, l, b, Ht)), d(g);
|
|
3253
3253
|
}
|
|
3254
3254
|
}
|
|
3255
3255
|
for (const f of n) {
|
|
@@ -3261,7 +3261,7 @@ function nu({ attrs: t, schema: e }, n) {
|
|
|
3261
3261
|
const T = K(o, p, m);
|
|
3262
3262
|
if (d(T), Zo.has(l) && (T || a(nt(e, p, m, m === "id" ? { "unique?": !0 } : null))), Jo.has(l)) {
|
|
3263
3263
|
const v = _e(o, p, m);
|
|
3264
|
-
!T && !v && a(
|
|
3264
|
+
!T && !v && a(Xn(e, p, m)), d(v);
|
|
3265
3265
|
}
|
|
3266
3266
|
}
|
|
3267
3267
|
}
|
|
@@ -3299,7 +3299,7 @@ var re = function(t, e, n, r) {
|
|
|
3299
3299
|
d((r = r.apply(t, e || [])).next());
|
|
3300
3300
|
});
|
|
3301
3301
|
};
|
|
3302
|
-
function
|
|
3302
|
+
function er(t, e) {
|
|
3303
3303
|
typeof requestIdleCallback > "u" ? t() : requestIdleCallback(t, { timeout: e });
|
|
3304
3304
|
}
|
|
3305
3305
|
const qe = "__meta";
|
|
@@ -3307,7 +3307,7 @@ class iu {
|
|
|
3307
3307
|
constructor(e, n) {
|
|
3308
3308
|
}
|
|
3309
3309
|
}
|
|
3310
|
-
class
|
|
3310
|
+
class Yt {
|
|
3311
3311
|
constructor(e) {
|
|
3312
3312
|
var n, r;
|
|
3313
3313
|
this._subs = [], this._nextSave = null, this._nextGc = null, this._pendingSaveKeys = /* @__PURE__ */ new Set(), this._loadedKeys = /* @__PURE__ */ new Set(), this._version = 0, this._meta = {
|
|
@@ -3501,7 +3501,7 @@ class Jt {
|
|
|
3501
3501
|
gc() {
|
|
3502
3502
|
this._nextGc || (this._nextGc = setTimeout(
|
|
3503
3503
|
() => {
|
|
3504
|
-
|
|
3504
|
+
er(() => {
|
|
3505
3505
|
this._nextGc = null, this._gc();
|
|
3506
3506
|
}, 30 * 1e3);
|
|
3507
3507
|
},
|
|
@@ -3516,7 +3516,7 @@ class Jt {
|
|
|
3516
3516
|
return;
|
|
3517
3517
|
}
|
|
3518
3518
|
this._nextSave = setTimeout(() => {
|
|
3519
|
-
|
|
3519
|
+
er(() => {
|
|
3520
3520
|
this._nextSave = null, this._writeToStorage(e).then(n).catch(r);
|
|
3521
3521
|
}, this._idleCallbackMaxWaitMs);
|
|
3522
3522
|
}, this._saveThrottleMs);
|
|
@@ -3636,7 +3636,7 @@ function cu(t, e, n) {
|
|
|
3636
3636
|
});
|
|
3637
3637
|
});
|
|
3638
3638
|
}
|
|
3639
|
-
function
|
|
3639
|
+
function tr(t, e, n) {
|
|
3640
3640
|
return oe(this, void 0, void 0, function* () {
|
|
3641
3641
|
const r = n.put(e, t);
|
|
3642
3642
|
return new Promise((i, s) => {
|
|
@@ -3674,7 +3674,7 @@ function du(t, e) {
|
|
|
3674
3674
|
break;
|
|
3675
3675
|
}
|
|
3676
3676
|
default: {
|
|
3677
|
-
const l =
|
|
3677
|
+
const l = tr(c, f, s);
|
|
3678
3678
|
u.push(l);
|
|
3679
3679
|
const p = {
|
|
3680
3680
|
createdAt: Date.now(),
|
|
@@ -3685,13 +3685,13 @@ function du(t, e) {
|
|
|
3685
3685
|
break;
|
|
3686
3686
|
}
|
|
3687
3687
|
}
|
|
3688
|
-
const d =
|
|
3688
|
+
const d = tr(qe, a, s);
|
|
3689
3689
|
u.push(d), yield Promise.all(u), yield new Promise((c, f) => {
|
|
3690
3690
|
i.oncomplete = (l) => c(l), i.onerror = (l) => f(l), i.onabort = (l) => f(l);
|
|
3691
3691
|
});
|
|
3692
3692
|
});
|
|
3693
3693
|
}
|
|
3694
|
-
const
|
|
3694
|
+
const nr = /* @__PURE__ */ new Map();
|
|
3695
3695
|
class ti extends iu {
|
|
3696
3696
|
constructor(e, n) {
|
|
3697
3697
|
super(e, n), this.dbName = `instant_${e}_${su}`, this._storeName = n, this._appId = e, this._dbPromise = this._init();
|
|
@@ -3708,9 +3708,9 @@ class ti extends iu {
|
|
|
3708
3708
|
const a = du(this._appId, u).catch((d) => {
|
|
3709
3709
|
uu("Error upgrading store from version 5 to 6.")(d);
|
|
3710
3710
|
});
|
|
3711
|
-
|
|
3711
|
+
nr.set(this.dbName, a), a.then(() => e(u)).catch(() => e(u));
|
|
3712
3712
|
} else {
|
|
3713
|
-
const a =
|
|
3713
|
+
const a = nr.get(this.dbName);
|
|
3714
3714
|
a ? a.then(() => e(u)).catch(() => e(u)) : e(u);
|
|
3715
3715
|
}
|
|
3716
3716
|
}, i.onupgradeneeded = (s) => {
|
|
@@ -3964,7 +3964,7 @@ function bu(t) {
|
|
|
3964
3964
|
});
|
|
3965
3965
|
});
|
|
3966
3966
|
}
|
|
3967
|
-
function
|
|
3967
|
+
function rr(t) {
|
|
3968
3968
|
return Pe(this, arguments, void 0, function* ({ apiURI: e, appId: n, code: r, codeVerifier: i, refreshToken: s }) {
|
|
3969
3969
|
return yield te(`${e}/runtime/oauth/token`, {
|
|
3970
3970
|
method: "POST",
|
|
@@ -4100,9 +4100,9 @@ function Su(t) {
|
|
|
4100
4100
|
return s;
|
|
4101
4101
|
});
|
|
4102
4102
|
}
|
|
4103
|
-
let
|
|
4104
|
-
typeof window < "u" && typeof window.localStorage < "u" && (
|
|
4105
|
-
function
|
|
4103
|
+
let hn = !1, ri = !1, ii = !1;
|
|
4104
|
+
typeof window < "u" && typeof window.localStorage < "u" && (hn = !!window.localStorage.getItem("devBackend"), ri = !!window.localStorage.getItem("__instantLogging"), ii = !!window.localStorage.getItem("__devtoolLocalDash"));
|
|
4105
|
+
function ir(t, e) {
|
|
4106
4106
|
if (!e)
|
|
4107
4107
|
return t;
|
|
4108
4108
|
const n = {};
|
|
@@ -4116,27 +4116,27 @@ function Ou(t, e, n) {
|
|
|
4116
4116
|
peers: {}
|
|
4117
4117
|
};
|
|
4118
4118
|
if (e && "user" in e ? e.user : !0) {
|
|
4119
|
-
const u =
|
|
4119
|
+
const u = ir((r = t.user) !== null && r !== void 0 ? r : {}, e == null ? void 0 : e.keys);
|
|
4120
4120
|
s.user = Object.assign(Object.assign({}, u), { peerId: n });
|
|
4121
4121
|
}
|
|
4122
4122
|
for (const u of Object.keys((i = t.peers) !== null && i !== void 0 ? i : {})) {
|
|
4123
4123
|
const a = (e == null ? void 0 : e.peers) === void 0, d = Array.isArray(e == null ? void 0 : e.peers) && (e == null ? void 0 : e.peers.includes(u));
|
|
4124
4124
|
if (a || d) {
|
|
4125
|
-
const c =
|
|
4125
|
+
const c = ir(t.peers[u], e == null ? void 0 : e.keys);
|
|
4126
4126
|
s.peers[u] = Object.assign(Object.assign({}, c), { peerId: u });
|
|
4127
4127
|
}
|
|
4128
4128
|
}
|
|
4129
4129
|
return s;
|
|
4130
4130
|
}
|
|
4131
4131
|
function Eu(t, e) {
|
|
4132
|
-
if (t.isLoading !== e.isLoading || t.error !== e.error || (t.user || e.user) && (!t.user || !e.user || !
|
|
4132
|
+
if (t.isLoading !== e.isLoading || t.error !== e.error || (t.user || e.user) && (!t.user || !e.user || !zn(t.user, e.user)) || !Mr(t.peers, e.peers))
|
|
4133
4133
|
return !0;
|
|
4134
4134
|
for (const r of Object.keys(t.peers))
|
|
4135
|
-
if (!
|
|
4135
|
+
if (!zn(t.peers[r], e.peers[r]))
|
|
4136
4136
|
return !0;
|
|
4137
4137
|
return !1;
|
|
4138
4138
|
}
|
|
4139
|
-
class
|
|
4139
|
+
class sr {
|
|
4140
4140
|
constructor() {
|
|
4141
4141
|
this.promise = new Promise((e, n) => {
|
|
4142
4142
|
this._resolve = e, this._reject = n;
|
|
@@ -4158,11 +4158,11 @@ function si(t, e = []) {
|
|
|
4158
4158
|
si(n["child-nodes"], e);
|
|
4159
4159
|
});
|
|
4160
4160
|
}
|
|
4161
|
-
function
|
|
4161
|
+
function or(t) {
|
|
4162
4162
|
const e = [];
|
|
4163
4163
|
return si(t, e), e;
|
|
4164
4164
|
}
|
|
4165
|
-
function
|
|
4165
|
+
function ur(t) {
|
|
4166
4166
|
return Object.values(t.links).reduce((e, n) => {
|
|
4167
4167
|
var r, i, s, o;
|
|
4168
4168
|
return (r = e[s = n.forward.on]) !== null && r !== void 0 || (e[s] = {}), e[n.forward.on][n.forward.label] = {
|
|
@@ -4176,7 +4176,7 @@ function ar(t) {
|
|
|
4176
4176
|
}, e;
|
|
4177
4177
|
}, {});
|
|
4178
4178
|
}
|
|
4179
|
-
const oi = "v0.22.
|
|
4179
|
+
const oi = "v0.22.70";
|
|
4180
4180
|
function Au(t, e) {
|
|
4181
4181
|
return {
|
|
4182
4182
|
info: t ? (...n) => console.info(...n, e()) : () => {
|
|
@@ -4215,7 +4215,7 @@ class M extends Error {
|
|
|
4215
4215
|
super(r), this.name = "QueryValidationError";
|
|
4216
4216
|
}
|
|
4217
4217
|
}
|
|
4218
|
-
const
|
|
4218
|
+
const ar = [
|
|
4219
4219
|
"where",
|
|
4220
4220
|
"order",
|
|
4221
4221
|
"limit",
|
|
@@ -4355,8 +4355,8 @@ const cr = [
|
|
|
4355
4355
|
}
|
|
4356
4356
|
}, Pu = (t, e, n, r, i = 0) => {
|
|
4357
4357
|
for (const o of Object.keys(t))
|
|
4358
|
-
if (!
|
|
4359
|
-
throw new M(`Invalid query parameter '${o}' in $ object. Valid parameters are: ${
|
|
4358
|
+
if (!ar.includes(o))
|
|
4359
|
+
throw new M(`Invalid query parameter '${o}' in $ object. Valid parameters are: ${ar.join(", ")}. Found: ${o}`, r);
|
|
4360
4360
|
const s = [
|
|
4361
4361
|
// 'limit', // only supported client side
|
|
4362
4362
|
"offset",
|
|
@@ -4394,7 +4394,7 @@ const cr = [
|
|
|
4394
4394
|
throw new M(`Query parameter '$' must be an object in entity '${e}', but received: ${typeof u}`, `${r}.$`);
|
|
4395
4395
|
Pu(u, e, n, `${r}.$`, i);
|
|
4396
4396
|
}
|
|
4397
|
-
},
|
|
4397
|
+
}, cr = (t, e) => {
|
|
4398
4398
|
if (typeof t != "object" || t === null)
|
|
4399
4399
|
throw new M(`Query must be an object, but received: ${typeof t}${t === null ? " (null)" : ""}`);
|
|
4400
4400
|
if (Array.isArray(t))
|
|
@@ -4413,13 +4413,13 @@ const cr = [
|
|
|
4413
4413
|
ci(n[r], r, e, r, 0);
|
|
4414
4414
|
}
|
|
4415
4415
|
}
|
|
4416
|
-
},
|
|
4416
|
+
}, dr = (t) => typeof t != "string" ? !1 : ht(t) ? !0 : Ee(t);
|
|
4417
4417
|
class Z extends Error {
|
|
4418
4418
|
constructor(e) {
|
|
4419
4419
|
super(e), this.name = "TransactionValidationError";
|
|
4420
4420
|
}
|
|
4421
4421
|
}
|
|
4422
|
-
const di = (t) => t.length > 0 ? t.join(", ") : "none", Iu = (t, e) => new Z(`Entity '${t}' does not exist in schema. Available entities: ${di(e)}`),
|
|
4422
|
+
const di = (t) => t.length > 0 ? t.join(", ") : "none", Iu = (t, e) => new Z(`Entity '${t}' does not exist in schema. Available entities: ${di(e)}`), fr = {
|
|
4423
4423
|
string: (t) => typeof t == "string",
|
|
4424
4424
|
number: (t) => typeof t == "number" && !isNaN(t),
|
|
4425
4425
|
boolean: (t) => typeof t == "boolean",
|
|
@@ -4427,7 +4427,7 @@ const di = (t) => t.length > 0 ? t.join(", ") : "none", Iu = (t, e) => new Z(`En
|
|
|
4427
4427
|
json: () => !0
|
|
4428
4428
|
}, Mu = (t, e) => {
|
|
4429
4429
|
var n, r;
|
|
4430
|
-
return t == null ? !0 : (r = (n =
|
|
4430
|
+
return t == null ? !0 : (r = (n = fr[e.valueType]) === null || n === void 0 ? void 0 : n.call(fr, t)) !== null && r !== void 0 ? r : !1;
|
|
4431
4431
|
}, fi = (t, e) => {
|
|
4432
4432
|
const n = e.entities[t];
|
|
4433
4433
|
if (!n)
|
|
@@ -4444,7 +4444,7 @@ const di = (t) => t.length > 0 ? t.join(", ") : "none", Iu = (t, e) => new Z(`En
|
|
|
4444
4444
|
if (o && !Mu(s, o))
|
|
4445
4445
|
throw new Z(`Invalid value for attribute '${i}' in entity '${t}'. Expected ${o.valueType}, but received: ${typeof s}`);
|
|
4446
4446
|
}
|
|
4447
|
-
},
|
|
4447
|
+
}, lr = (t, e, n) => {
|
|
4448
4448
|
const r = fi(t, n);
|
|
4449
4449
|
if (typeof e != "object" || e === null)
|
|
4450
4450
|
throw new Z(`Arguments for link operation on entity '${t}' must be an object, but received: ${typeof e}`);
|
|
@@ -4456,9 +4456,9 @@ const di = (t) => t.length > 0 ? t.join(", ") : "none", Iu = (t, e) => new Z(`En
|
|
|
4456
4456
|
if (s != null) {
|
|
4457
4457
|
if (Array.isArray(s)) {
|
|
4458
4458
|
for (const u of s)
|
|
4459
|
-
if (!
|
|
4459
|
+
if (!dr(u))
|
|
4460
4460
|
throw new Z(`Invalid entity ID in link '${i}' for entity '${t}'. Expected a UUID or a lookup, but received: ${u}`);
|
|
4461
|
-
} else if (!
|
|
4461
|
+
} else if (!dr(s))
|
|
4462
4462
|
throw new Z(`Invalid UUID in link '${i}' for entity '${t}'. Expected a UUID, but received: ${s}`);
|
|
4463
4463
|
}
|
|
4464
4464
|
}
|
|
@@ -4466,8 +4466,8 @@ const di = (t) => t.length > 0 ? t.join(", ") : "none", Iu = (t, e) => new Z(`En
|
|
|
4466
4466
|
create: Ct,
|
|
4467
4467
|
update: Ct,
|
|
4468
4468
|
merge: Ct,
|
|
4469
|
-
link:
|
|
4470
|
-
unlink:
|
|
4469
|
+
link: lr,
|
|
4470
|
+
unlink: lr,
|
|
4471
4471
|
delete: () => {
|
|
4472
4472
|
}
|
|
4473
4473
|
}, $u = (t, e) => {
|
|
@@ -4494,7 +4494,7 @@ const di = (t) => t.length > 0 ? t.join(", ") : "none", Iu = (t, e) => new Z(`En
|
|
|
4494
4494
|
}
|
|
4495
4495
|
}
|
|
4496
4496
|
};
|
|
4497
|
-
var
|
|
4497
|
+
var hr = function(t, e, n, r) {
|
|
4498
4498
|
function i(s) {
|
|
4499
4499
|
return s instanceof n ? s : new n(function(o) {
|
|
4500
4500
|
o(s);
|
|
@@ -4522,7 +4522,7 @@ var pr = function(t, e, n, r) {
|
|
|
4522
4522
|
});
|
|
4523
4523
|
};
|
|
4524
4524
|
let li = 0;
|
|
4525
|
-
class
|
|
4525
|
+
class pr {
|
|
4526
4526
|
constructor(e) {
|
|
4527
4527
|
this.type = "ws", this.id = `${this.type}_${li++}`, this.conn = new WebSocket(e), this.conn.onopen = (n) => {
|
|
4528
4528
|
this.onopen && this.onopen({ target: this });
|
|
@@ -4554,7 +4554,7 @@ class yr {
|
|
|
4554
4554
|
}
|
|
4555
4555
|
class Du {
|
|
4556
4556
|
constructor(e, n) {
|
|
4557
|
-
this.type = "sse", this.initParams = null, this.sendQueue = [], this.closeFired = !1, this.sseInitTimeout =
|
|
4557
|
+
this.type = "sse", this.initParams = null, this.sendQueue = [], this.closeFired = !1, this.sseInitTimeout = void 0, this.id = `${this.type}_${li++}`, this.url = n, this.ES = e, this.conn = new e(n), this.sseInitTimeout = setTimeout(() => {
|
|
4558
4558
|
this.initParams || this.handleError();
|
|
4559
4559
|
}, 1e4), this.conn.onmessage = (r) => {
|
|
4560
4560
|
const i = JSON.parse(r.data);
|
|
@@ -4586,15 +4586,16 @@ class Du {
|
|
|
4586
4586
|
this.conn.close(), this.onclose && !this.closeFired && (this.closeFired = !0, this.onclose({ target: this }));
|
|
4587
4587
|
}
|
|
4588
4588
|
postMessages(e) {
|
|
4589
|
-
return
|
|
4589
|
+
return hr(this, void 0, void 0, function* () {
|
|
4590
|
+
var n, r, i;
|
|
4590
4591
|
try {
|
|
4591
4592
|
(yield fetch(this.url, {
|
|
4592
4593
|
method: "POST",
|
|
4593
4594
|
headers: { "Content-Type": "application/json" },
|
|
4594
4595
|
body: JSON.stringify({
|
|
4595
|
-
machine_id: this.initParams.machineId,
|
|
4596
|
-
session_id: this.initParams.sessionId,
|
|
4597
|
-
sse_token: this.initParams.sseToken,
|
|
4596
|
+
machine_id: (n = this.initParams) === null || n === void 0 ? void 0 : n.machineId,
|
|
4597
|
+
session_id: (r = this.initParams) === null || r === void 0 ? void 0 : r.sessionId,
|
|
4598
|
+
sse_token: (i = this.initParams) === null || i === void 0 ? void 0 : i.sseToken,
|
|
4598
4599
|
messages: e
|
|
4599
4600
|
})
|
|
4600
4601
|
})).ok || this.handleError();
|
|
@@ -4604,7 +4605,7 @@ class Du {
|
|
|
4604
4605
|
});
|
|
4605
4606
|
}
|
|
4606
4607
|
flushQueue() {
|
|
4607
|
-
return
|
|
4608
|
+
return hr(this, void 0, void 0, function* () {
|
|
4608
4609
|
if (this.sendPromise || !this.sendQueue.length)
|
|
4609
4610
|
return;
|
|
4610
4611
|
const e = this.sendQueue;
|
|
@@ -4630,7 +4631,7 @@ class Du {
|
|
|
4630
4631
|
this.handleClose();
|
|
4631
4632
|
}
|
|
4632
4633
|
}
|
|
4633
|
-
var
|
|
4634
|
+
var yr = function(t, e, n, r) {
|
|
4634
4635
|
function i(s) {
|
|
4635
4636
|
return s instanceof n ? s : new n(function(o) {
|
|
4636
4637
|
o(s);
|
|
@@ -4684,7 +4685,7 @@ function Fu(t, e, n) {
|
|
|
4684
4685
|
function Pt(t, e) {
|
|
4685
4686
|
return Jr({ store: e, pageInfo: null, aggregate: null }, t.query).data[t.table][0];
|
|
4686
4687
|
}
|
|
4687
|
-
function
|
|
4688
|
+
function br(t, e, n) {
|
|
4688
4689
|
var r;
|
|
4689
4690
|
const i = (r = fe(e, t.table, "id")) === null || r === void 0 ? void 0 : r.id;
|
|
4690
4691
|
if (!i)
|
|
@@ -4692,7 +4693,7 @@ function _r(t, e, n) {
|
|
|
4692
4693
|
const s = Ce(e.eav, [n, i, n]);
|
|
4693
4694
|
return s ? s[3] : -1;
|
|
4694
4695
|
}
|
|
4695
|
-
function
|
|
4696
|
+
function _r(t, e) {
|
|
4696
4697
|
for (const { action: n, triple: r } of e)
|
|
4697
4698
|
switch (n) {
|
|
4698
4699
|
case "added":
|
|
@@ -4761,7 +4762,7 @@ var pe;
|
|
|
4761
4762
|
})(pe || (pe = {}));
|
|
4762
4763
|
class zu {
|
|
4763
4764
|
constructor(e, n, r, i, s) {
|
|
4764
|
-
this.callbacks = {}, this.idToHash = {}, this.trySend = e, this.config = r, this.log = i, this.createStore = s, this.subs = new
|
|
4765
|
+
this.callbacks = {}, this.idToHash = {}, this.trySend = e, this.config = r, this.log = i, this.createStore = s, this.subs = new Yt({
|
|
4765
4766
|
persister: n,
|
|
4766
4767
|
merge: Fu,
|
|
4767
4768
|
serialize: Lu,
|
|
@@ -4822,7 +4823,7 @@ class zu {
|
|
|
4822
4823
|
});
|
|
4823
4824
|
}
|
|
4824
4825
|
initSubscription(e, n, r) {
|
|
4825
|
-
return
|
|
4826
|
+
return yr(this, void 0, void 0, function* () {
|
|
4826
4827
|
var i, s, o, u;
|
|
4827
4828
|
yield this.subs.waitForKeyToLoad(n);
|
|
4828
4829
|
const a = this.subs.currentValue[n];
|
|
@@ -4848,7 +4849,7 @@ class zu {
|
|
|
4848
4849
|
});
|
|
4849
4850
|
}
|
|
4850
4851
|
flushPending() {
|
|
4851
|
-
return
|
|
4852
|
+
return yr(this, void 0, void 0, function* () {
|
|
4852
4853
|
for (const e of Object.keys(this.callbacks)) {
|
|
4853
4854
|
yield this.subs.waitForKeyToLoad(e);
|
|
4854
4855
|
const n = this.subs.currentValue[e];
|
|
@@ -4897,7 +4898,7 @@ class zu {
|
|
|
4897
4898
|
d.push({
|
|
4898
4899
|
store: f,
|
|
4899
4900
|
entity: l,
|
|
4900
|
-
serverCreatedAt:
|
|
4901
|
+
serverCreatedAt: br(u, f, l.id)
|
|
4901
4902
|
}), o.push(l);
|
|
4902
4903
|
}
|
|
4903
4904
|
this.subs.updateInPlace((c) => {
|
|
@@ -4968,7 +4969,7 @@ class zu {
|
|
|
4968
4969
|
for (let j = 0; j < p.length; j++) {
|
|
4969
4970
|
const S = p[j];
|
|
4970
4971
|
if (ws(S.store, T)) {
|
|
4971
|
-
|
|
4972
|
+
_r(S.store, v);
|
|
4972
4973
|
const I = Pt(u, S.store), R = Nu(S.store, v)[T];
|
|
4973
4974
|
I ? (y.push({
|
|
4974
4975
|
oldEntity: S.entity,
|
|
@@ -4981,7 +4982,7 @@ class zu {
|
|
|
4981
4982
|
const b = [];
|
|
4982
4983
|
for (const [T, v] of Object.entries(f)) {
|
|
4983
4984
|
const j = this.createStore([]);
|
|
4984
|
-
l.attrs = j.attrs,
|
|
4985
|
+
l.attrs = j.attrs, _r(j, v);
|
|
4985
4986
|
const S = Pt(u, j);
|
|
4986
4987
|
if (!S) {
|
|
4987
4988
|
this.log.error("No entity found after applying change", {
|
|
@@ -4994,7 +4995,7 @@ class zu {
|
|
|
4994
4995
|
p.push({
|
|
4995
4996
|
store: j,
|
|
4996
4997
|
entity: S,
|
|
4997
|
-
serverCreatedAt:
|
|
4998
|
+
serverCreatedAt: br(u, j, S.id)
|
|
4998
4999
|
}), b.push(S);
|
|
4999
5000
|
}
|
|
5000
5001
|
const g = [];
|
|
@@ -5088,10 +5089,10 @@ const se = {
|
|
|
5088
5089
|
}, It = "_instant_oauth_redirect", De = "currentUser";
|
|
5089
5090
|
function Hu({ transportType: t, appId: e, apiURI: n, wsURI: r, EventSourceImpl: i }) {
|
|
5090
5091
|
if (!i)
|
|
5091
|
-
return new
|
|
5092
|
+
return new pr(`${r}?app_id=${e}`);
|
|
5092
5093
|
switch (t) {
|
|
5093
5094
|
case "ws":
|
|
5094
|
-
return new
|
|
5095
|
+
return new pr(`${r}?app_id=${e}`);
|
|
5095
5096
|
case "sse":
|
|
5096
5097
|
return new Du(i, `${n}/runtime/sse?app_id=${e}`);
|
|
5097
5098
|
default:
|
|
@@ -5101,7 +5102,7 @@ function Hu({ transportType: t, appId: e, apiURI: n, wsURI: r, EventSourceImpl:
|
|
|
5101
5102
|
function Yu() {
|
|
5102
5103
|
return typeof window < "u" || typeof chrome < "u";
|
|
5103
5104
|
}
|
|
5104
|
-
const
|
|
5105
|
+
const gr = {
|
|
5105
5106
|
"set-presence": !0,
|
|
5106
5107
|
"set-presence-ok": !0,
|
|
5107
5108
|
"refresh-presence": !0,
|
|
@@ -5141,7 +5142,7 @@ function ta(t, e, n) {
|
|
|
5141
5142
|
const r = e == null ? void 0 : e.result, i = n == null ? void 0 : n.result;
|
|
5142
5143
|
return r && !i && n && (n.result = r), n || e;
|
|
5143
5144
|
}
|
|
5144
|
-
function
|
|
5145
|
+
function Tr(t) {
|
|
5145
5146
|
return [...t].sort((e, n) => {
|
|
5146
5147
|
const [r, i] = e, [s, o] = n, u = i.order || 0, a = o.order || 0;
|
|
5147
5148
|
return u == a ? r < s ? -1 : r > s ? 1 : 0 : u - a;
|
|
@@ -5205,7 +5206,7 @@ class na {
|
|
|
5205
5206
|
this._updatePendingMutations((g) => {
|
|
5206
5207
|
g.set(f, y);
|
|
5207
5208
|
});
|
|
5208
|
-
const b = new
|
|
5209
|
+
const b = new sr();
|
|
5209
5210
|
return this.mutationDeferredStore.set(f, b), this._sendMutation(f, y), this.notifyAll(), b.promise;
|
|
5210
5211
|
}, this._transportOnOpen = (d) => {
|
|
5211
5212
|
const c = d.target;
|
|
@@ -5266,7 +5267,7 @@ class na {
|
|
|
5266
5267
|
return;
|
|
5267
5268
|
}
|
|
5268
5269
|
this._log.info("[socket][close]", c.id, "schedule reconnect, ms =", this._reconnectTimeoutMs), this._scheduleReconnect();
|
|
5269
|
-
}, this._EventSource = s, this.config = Object.assign(Object.assign({}, Qu), e), this.queryCacheLimit = (o = this.config.queryCacheLimit) !== null && o !== void 0 ? o : 10, this._pendingTxCleanupTimeout = (u = this.config.pendingTxCleanupTimeout) !== null && u !== void 0 ? u : Bu, this._pendingMutationCleanupThreshold = (a = this.config.pendingMutationCleanupThreshold) !== null && a !== void 0 ? a : Gu, this._log = Au(e.verbose ||
|
|
5270
|
+
}, this._EventSource = s, this.config = Object.assign(Object.assign({}, Qu), e), this.queryCacheLimit = (o = this.config.queryCacheLimit) !== null && o !== void 0 ? o : 10, this._pendingTxCleanupTimeout = (u = this.config.pendingTxCleanupTimeout) !== null && u !== void 0 ? u : Bu, this._pendingMutationCleanupThreshold = (a = this.config.pendingMutationCleanupThreshold) !== null && a !== void 0 ? a : Gu, this._log = Au(e.verbose || hn || ri, () => this._reactorStats()), this.versions = Object.assign(Object.assign({}, i || {}), { "@instantdb/core": oi }), this.config.schema && (this._linkIndex = ur(this.config.schema)), !!Yu()) {
|
|
5270
5271
|
if (!e.appId)
|
|
5271
5272
|
throw new Error("Instant must be initialized with an appId.");
|
|
5272
5273
|
if (!Ee(e.appId))
|
|
@@ -5291,7 +5292,7 @@ class na {
|
|
|
5291
5292
|
}
|
|
5292
5293
|
}
|
|
5293
5294
|
updateSchema(e) {
|
|
5294
|
-
this.config = Object.assign(Object.assign({}, this.config), { schema: e, cardinalityInference: !!e }), this._linkIndex = e ?
|
|
5295
|
+
this.config = Object.assign(Object.assign({}, this.config), { schema: e, cardinalityInference: !!e }), this._linkIndex = e ? ur(this.config.schema) : null;
|
|
5295
5296
|
}
|
|
5296
5297
|
_reactorStats() {
|
|
5297
5298
|
return {
|
|
@@ -5304,7 +5305,7 @@ class na {
|
|
|
5304
5305
|
this.kv.waitForKeyToLoad("pendingMutations").then(() => this.notifyOne(e));
|
|
5305
5306
|
}
|
|
5306
5307
|
_initStorage(e) {
|
|
5307
|
-
this.querySubs = new
|
|
5308
|
+
this.querySubs = new Yt({
|
|
5308
5309
|
persister: new e(this.config.appId, "querySubs"),
|
|
5309
5310
|
merge: ta,
|
|
5310
5311
|
serialize: Zu,
|
|
@@ -5324,7 +5325,7 @@ class na {
|
|
|
5324
5325
|
maxSize: 1e6
|
|
5325
5326
|
// 1 million triples
|
|
5326
5327
|
}
|
|
5327
|
-
}), this.querySubs.onKeyLoaded = (n) => this._onQuerySubLoaded(n), this.kv = new
|
|
5328
|
+
}), this.querySubs.onKeyLoaded = (n) => this._onQuerySubLoaded(n), this.kv = new Yt({
|
|
5328
5329
|
persister: new e(this.config.appId, "kv"),
|
|
5329
5330
|
merge: this._onMergeKv,
|
|
5330
5331
|
serialize: ea,
|
|
@@ -5383,7 +5384,7 @@ class na {
|
|
|
5383
5384
|
_handleReceive(e, n) {
|
|
5384
5385
|
var r, i, s, o, u, a;
|
|
5385
5386
|
const d = !!this.config.schema && ("cardinalityInference" in this.config ? !!this.config.cardinalityInference : !0);
|
|
5386
|
-
switch (
|
|
5387
|
+
switch (gr[n.op] || this._log.info("[receive]", e, n.op, n), n.op) {
|
|
5387
5388
|
case "init-ok": {
|
|
5388
5389
|
this._setStatus(se.AUTHENTICATED), this._reconnectTimeoutMs = 0, this._setAttrs(n.attrs), this._flushPendingMessages(), this._sessionId = n["session-id"];
|
|
5389
5390
|
for (const l of Object.keys(this._rooms)) {
|
|
@@ -5400,7 +5401,7 @@ class na {
|
|
|
5400
5401
|
const { q: l, result: p } = n, y = N(l);
|
|
5401
5402
|
if (!this._hasQueryListeners() && !this.querySubs.currentValue[y])
|
|
5402
5403
|
break;
|
|
5403
|
-
const b = (o = (s = p == null ? void 0 : p[0]) === null || s === void 0 ? void 0 : s.data) === null || o === void 0 ? void 0 : o["page-info"], g = (a = (u = p == null ? void 0 : p[0]) === null || u === void 0 ? void 0 : u.data) === null || a === void 0 ? void 0 : a.aggregate, m =
|
|
5404
|
+
const b = (o = (s = p == null ? void 0 : p[0]) === null || s === void 0 ? void 0 : s.data) === null || o === void 0 ? void 0 : o["page-info"], g = (a = (u = p == null ? void 0 : p[0]) === null || u === void 0 ? void 0 : u.data) === null || a === void 0 ? void 0 : a.aggregate, m = or(p), T = at(this.attrs, m, d, this._linkIndex, this.config.useDateObjects);
|
|
5404
5405
|
this.querySubs.updateInPlace((v) => {
|
|
5405
5406
|
if (!v[y]) {
|
|
5406
5407
|
this._log.info("Missing value in querySubs", { hash: y, q: l });
|
|
@@ -5438,9 +5439,9 @@ class na {
|
|
|
5438
5439
|
b !== this._pendingMutations() && this.kv.updateInPlace((T) => {
|
|
5439
5440
|
T.pendingMutations = b;
|
|
5440
5441
|
});
|
|
5441
|
-
const g =
|
|
5442
|
+
const g = Tr(b.entries()), m = l.map((T) => {
|
|
5442
5443
|
var v, j, S, I;
|
|
5443
|
-
const R = T["instaql-query"], q = T["instaql-result"], Ie = N(R), Qe =
|
|
5444
|
+
const R = T["instaql-query"], q = T["instaql-result"], Ie = N(R), Qe = or(q), _t = at(this.attrs, Qe, d, this._linkIndex, this.config.useDateObjects), gt = this._applyOptimisticUpdates(_t, g, y), He = (j = (v = q == null ? void 0 : q[0]) === null || v === void 0 ? void 0 : v.data) === null || j === void 0 ? void 0 : j["page-info"], ne = (I = (S = q == null ? void 0 : q[0]) === null || S === void 0 ? void 0 : S.data) === null || I === void 0 ? void 0 : I.aggregate;
|
|
5444
5445
|
return { q: R, hash: Ie, store: gt, pageInfo: He, aggregate: ne };
|
|
5445
5446
|
});
|
|
5446
5447
|
m.forEach(({ hash: T, q: v, store: j, pageInfo: S, aggregate: I }) => {
|
|
@@ -5603,7 +5604,7 @@ class na {
|
|
|
5603
5604
|
*/
|
|
5604
5605
|
subscribeQuery(e, n, r) {
|
|
5605
5606
|
var i;
|
|
5606
|
-
this.config.disableValidation ||
|
|
5607
|
+
this.config.disableValidation || cr(e, this.config.schema), r && "ruleParams" in r && (e = Object.assign({ $$ruleParams: r.ruleParams }, e));
|
|
5607
5608
|
const s = N(e), o = this.getPreviousResult(e);
|
|
5608
5609
|
return o && n(o), this.queryCbs[s] = (i = this.queryCbs[s]) !== null && i !== void 0 ? i : [], this.queryCbs[s].push({ q: e, cb: n }), this._startQuerySub(e, s), () => {
|
|
5609
5610
|
this._unsubQuery(e, s, n);
|
|
@@ -5611,8 +5612,8 @@ class na {
|
|
|
5611
5612
|
}
|
|
5612
5613
|
queryOnce(e, n) {
|
|
5613
5614
|
var r;
|
|
5614
|
-
this.config.disableValidation ||
|
|
5615
|
-
const i = new
|
|
5615
|
+
this.config.disableValidation || cr(e, this.config.schema), n && "ruleParams" in n && (e = Object.assign({ $$ruleParams: n.ruleParams }, e));
|
|
5616
|
+
const i = new sr();
|
|
5616
5617
|
if (!this._isOnline)
|
|
5617
5618
|
return i.reject(new Error("We can't run `queryOnce`, because the device is offline.")), i.promise;
|
|
5618
5619
|
if (!this.querySubs)
|
|
@@ -5689,7 +5690,7 @@ class na {
|
|
|
5689
5690
|
return u ? d : n;
|
|
5690
5691
|
}
|
|
5691
5692
|
_rewriteMutationsSorted(e, n) {
|
|
5692
|
-
return
|
|
5693
|
+
return Tr(this._rewriteMutations(e, n).entries());
|
|
5693
5694
|
}
|
|
5694
5695
|
// ---------------------------
|
|
5695
5696
|
// Transact
|
|
@@ -5819,7 +5820,7 @@ class na {
|
|
|
5819
5820
|
}
|
|
5820
5821
|
_trySend(e, n, r) {
|
|
5821
5822
|
if (this._transport.isOpen()) {
|
|
5822
|
-
switch (
|
|
5823
|
+
switch (gr[n.op] || this._log.info("[send]", this._transport.id, n.op, n), n.op) {
|
|
5823
5824
|
case "transact": {
|
|
5824
5825
|
this._inFlightMutationEventIds.add(e);
|
|
5825
5826
|
break;
|
|
@@ -5913,7 +5914,7 @@ class na {
|
|
|
5913
5914
|
return null;
|
|
5914
5915
|
this._replaceUrlAfterOAuth();
|
|
5915
5916
|
try {
|
|
5916
|
-
const a = yield this._getCurrentUser(), d = (a == null ? void 0 : a.type) === "guest", { user: c } = yield
|
|
5917
|
+
const a = yield this._getCurrentUser(), d = (a == null ? void 0 : a.type) === "guest", { user: c } = yield rr({
|
|
5917
5918
|
apiURI: this.config.apiURI,
|
|
5918
5919
|
appId: this.config.appId,
|
|
5919
5920
|
code: u,
|
|
@@ -6125,7 +6126,7 @@ class na {
|
|
|
6125
6126
|
exchangeCodeForToken(e) {
|
|
6126
6127
|
return U(this, arguments, void 0, function* ({ code: n, codeVerifier: r }) {
|
|
6127
6128
|
var i;
|
|
6128
|
-
const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", u = yield
|
|
6129
|
+
const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", u = yield rr({
|
|
6129
6130
|
apiURI: this.config.apiURI,
|
|
6130
6131
|
appId: this.config.appId,
|
|
6131
6132
|
code: n,
|
|
@@ -6253,7 +6254,7 @@ class na {
|
|
|
6253
6254
|
ns(d, c, l);
|
|
6254
6255
|
break;
|
|
6255
6256
|
case "r":
|
|
6256
|
-
|
|
6257
|
+
Vn(d, c, l);
|
|
6257
6258
|
break;
|
|
6258
6259
|
case "-":
|
|
6259
6260
|
$r(d, c);
|
|
@@ -6268,7 +6269,7 @@ class na {
|
|
|
6268
6269
|
delete r[this._sessionId];
|
|
6269
6270
|
const i = Object.fromEntries(Object.entries(r).map(([s, o]) => [s, o.data]));
|
|
6270
6271
|
this._presence = ft(this._presence, (s) => {
|
|
6271
|
-
|
|
6272
|
+
Vn(s, [e, "result", "peers"], i);
|
|
6272
6273
|
});
|
|
6273
6274
|
}
|
|
6274
6275
|
// --------
|
|
@@ -6381,7 +6382,7 @@ function ra(t, e) {
|
|
|
6381
6382
|
return d();
|
|
6382
6383
|
}
|
|
6383
6384
|
function ia(t) {
|
|
6384
|
-
return `${
|
|
6385
|
+
return `${hn || ii ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${t}`;
|
|
6385
6386
|
}
|
|
6386
6387
|
function sa(t) {
|
|
6387
6388
|
const e = document.createElement("iframe");
|
|
@@ -6461,11 +6462,11 @@ function la() {
|
|
|
6461
6462
|
var t;
|
|
6462
6463
|
return globalThis.__instantDbStore = (t = globalThis.__instantDbStore) !== null && t !== void 0 ? t : {}, globalThis.__instantDbStore;
|
|
6463
6464
|
}
|
|
6464
|
-
function
|
|
6465
|
+
function Jt(t) {
|
|
6465
6466
|
const e = t.__adminToken;
|
|
6466
6467
|
return t.appId + "_" + (t.websocketURI || "default_ws_uri") + "_" + (t.apiURI || "default_api_uri") + "_" + (e || "client_only") + "_" + t.useDateObjects;
|
|
6467
6468
|
}
|
|
6468
|
-
const
|
|
6469
|
+
const Zt = la(), mr = fa();
|
|
6469
6470
|
class ha {
|
|
6470
6471
|
constructor(e) {
|
|
6471
6472
|
this.db = e, this.sendMagicCode = (n) => this.db.sendMagicCode(n), this.signInWithMagicCode = (n) => this.db.signInWithMagicCode(n), this.signInWithToken = (n) => this.db.signInWithCustomToken(n), this.signInAsGuest = () => this.db.signInAsGuest(), this.createAuthorizationURL = (n) => this.db.createAuthorizationURL(n), this.signInWithIdToken = (n) => this.db.signInWithIdToken(n), this.exchangeOAuthCode = (n) => this.db.exchangeCodeForToken(n), this.issuerURI = () => this.db.issuerURI(), this.signOut = (n = { invalidateToken: !0 }) => this.db.signOut(n);
|
|
@@ -6481,7 +6482,7 @@ function ya(t) {
|
|
|
6481
6482
|
}
|
|
6482
6483
|
class ba {
|
|
6483
6484
|
constructor(e) {
|
|
6484
|
-
this.tx =
|
|
6485
|
+
this.tx = ln(), this._reactor = e, this.auth = new ha(this._reactor), this.storage = new pa(this._reactor);
|
|
6485
6486
|
}
|
|
6486
6487
|
/**
|
|
6487
6488
|
* Use this to write data! You can create, update, delete, and link objects
|
|
@@ -6622,7 +6623,7 @@ class ba {
|
|
|
6622
6623
|
};
|
|
6623
6624
|
}
|
|
6624
6625
|
shutdown() {
|
|
6625
|
-
delete
|
|
6626
|
+
delete Zt[Jt(this._reactor.config)], this._reactor.shutdown();
|
|
6626
6627
|
}
|
|
6627
6628
|
/**
|
|
6628
6629
|
* Use this for one-off queries.
|
|
@@ -6658,20 +6659,21 @@ class ba {
|
|
|
6658
6659
|
function wr(t) {
|
|
6659
6660
|
if (!t)
|
|
6660
6661
|
return "0";
|
|
6661
|
-
|
|
6662
|
-
|
|
6663
|
-
|
|
6664
|
-
|
|
6662
|
+
const e = mr.get(t);
|
|
6663
|
+
if (e)
|
|
6664
|
+
return e;
|
|
6665
|
+
const n = N(t);
|
|
6666
|
+
return mr.set(t, n), n;
|
|
6665
6667
|
}
|
|
6666
6668
|
function _a(t, e) {
|
|
6667
6669
|
return wr(t._reactor.config.schema) !== wr(e);
|
|
6668
6670
|
}
|
|
6669
6671
|
function ga(t, e, n, r, i) {
|
|
6670
|
-
const s =
|
|
6672
|
+
const s = Zt[Jt(t)];
|
|
6671
6673
|
if (s)
|
|
6672
6674
|
return _a(s, t.schema) && s._reactor.updateSchema(t.schema), s;
|
|
6673
6675
|
const o = new na(Object.assign(Object.assign(Object.assign({}, da), t), { cardinalityInference: !!t.schema }), e || ti, n || ni, Object.assign(Object.assign({}, r || {}), { "@instantdb/core": oi }), i), u = new ba(o);
|
|
6674
|
-
return
|
|
6676
|
+
return Zt[Jt(t)] = u, Ta(t.appId, t.devtool), u;
|
|
6675
6677
|
}
|
|
6676
6678
|
function Ta(t, e) {
|
|
6677
6679
|
if (typeof window > "u" || typeof window.location > "u" || typeof document > "u" || typeof e == "boolean" && !e)
|
|
@@ -6714,7 +6716,7 @@ function wa(t, e, n) {
|
|
|
6714
6716
|
// Build a new subscribe function if the query changes
|
|
6715
6717
|
[i]
|
|
6716
6718
|
);
|
|
6717
|
-
return { state:
|
|
6719
|
+
return { state: Mt(
|
|
6718
6720
|
o,
|
|
6719
6721
|
() => s.current,
|
|
6720
6722
|
() => ma
|
|
@@ -6777,7 +6779,7 @@ function Aa(t, e = {}) {
|
|
|
6777
6779
|
},
|
|
6778
6780
|
[t.type, t.id]
|
|
6779
6781
|
);
|
|
6780
|
-
return
|
|
6782
|
+
return Rt(() => ({
|
|
6781
6783
|
...n,
|
|
6782
6784
|
publishPresence: i
|
|
6783
6785
|
}), [n, i]);
|
|
@@ -6788,7 +6790,7 @@ function ka(t, e, n) {
|
|
|
6788
6790
|
function ja(t, e, n = {}) {
|
|
6789
6791
|
const r = va(), i = ye.usePresence(t, {
|
|
6790
6792
|
keys: [e]
|
|
6791
|
-
}), s =
|
|
6793
|
+
}), s = Rt(() => {
|
|
6792
6794
|
const c = t._core._reactor.getPresence(
|
|
6793
6795
|
t.type,
|
|
6794
6796
|
t.id
|
|
@@ -6815,7 +6817,7 @@ function ja(t, e, n = {}) {
|
|
|
6815
6817
|
[n.stopOnEnter, o]
|
|
6816
6818
|
), a = de(() => {
|
|
6817
6819
|
o(!1);
|
|
6818
|
-
}, [o]), d =
|
|
6820
|
+
}, [o]), d = Rt(() => ({ onKeyDown: u, onBlur: a }), [u, a]);
|
|
6819
6821
|
return {
|
|
6820
6822
|
active: s,
|
|
6821
6823
|
setActive: o,
|
|
@@ -6843,7 +6845,7 @@ const Pa = {
|
|
|
6843
6845
|
};
|
|
6844
6846
|
class Ma {
|
|
6845
6847
|
constructor(e, n) {
|
|
6846
|
-
this.tx =
|
|
6848
|
+
this.tx = ln(), this.getLocalId = (r) => this.core.getLocalId(r), this.useLocalId = (r) => {
|
|
6847
6849
|
const [i, s] = Or(null);
|
|
6848
6850
|
return ge(() => {
|
|
6849
6851
|
(async () => {
|
|
@@ -6861,7 +6863,7 @@ class Ma {
|
|
|
6861
6863
|
), i = de((o) => this.core.subscribeAuth((a) => {
|
|
6862
6864
|
r.current = { isLoading: !1, ...a }, o();
|
|
6863
6865
|
}), []);
|
|
6864
|
-
return
|
|
6866
|
+
return Mt(
|
|
6865
6867
|
i,
|
|
6866
6868
|
() => r.current,
|
|
6867
6869
|
() => Pa
|
|
@@ -6879,7 +6881,7 @@ class Ma {
|
|
|
6879
6881
|
), i = de((o) => this.core.subscribeConnectionStatus((a) => {
|
|
6880
6882
|
a !== r.current && (r.current = a, o());
|
|
6881
6883
|
}), []);
|
|
6882
|
-
return
|
|
6884
|
+
return Mt(
|
|
6883
6885
|
i,
|
|
6884
6886
|
() => r.current,
|
|
6885
6887
|
// For SSR, always return 'connecting' as the initial state
|