@instantdb/react-common 0.22.61-experimental.delay-looking-at-store.19555739599.1 → 0.22.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/standalone/index.js +398 -405
- package/dist/standalone/index.umd.cjs +11 -11
- package/package.json +3 -3
package/dist/standalone/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import Sr, { useRef as
|
|
2
|
-
var xt = { exports: {} },
|
|
1
|
+
import Sr, { useRef as ze, useCallback as de, useSyncExternalStore as Rt, useEffect as Te, useMemo as $t, useState as Or } from "react";
|
|
2
|
+
var xt = { exports: {} }, $e = {};
|
|
3
3
|
/**
|
|
4
4
|
* @license React
|
|
5
5
|
* react-jsx-runtime.production.min.js
|
|
@@ -11,7 +11,7 @@ var xt = { exports: {} }, xe = {};
|
|
|
11
11
|
*/
|
|
12
12
|
var Ln;
|
|
13
13
|
function Ni() {
|
|
14
|
-
if (Ln) return
|
|
14
|
+
if (Ln) return $e;
|
|
15
15
|
Ln = 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) {
|
|
@@ -21,11 +21,11 @@ function Ni() {
|
|
|
21
21
|
if (u && u.defaultProps) for (c in a = u.defaultProps, a) f[c] === void 0 && (f[c] = a[c]);
|
|
22
22
|
return { $$typeof: e, type: u, key: l, ref: p, props: f, _owner: i.current };
|
|
23
23
|
}
|
|
24
|
-
return
|
|
24
|
+
return $e.Fragment = n, $e.jsx = o, $e.jsxs = o, $e;
|
|
25
25
|
}
|
|
26
|
-
var
|
|
26
|
+
var xe = {}, Fn;
|
|
27
27
|
function Ki() {
|
|
28
|
-
if (Fn) return
|
|
28
|
+
if (Fn) return xe;
|
|
29
29
|
Fn = 1;
|
|
30
30
|
var t = {};
|
|
31
31
|
/**
|
|
@@ -39,23 +39,23 @@ function Ki() {
|
|
|
39
39
|
*/
|
|
40
40
|
return t.NODE_ENV !== "production" && function() {
|
|
41
41
|
var e = Sr, n = Symbol.for("react.element"), r = Symbol.for("react.portal"), i = Symbol.for("react.fragment"), s = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), u = Symbol.for("react.provider"), a = Symbol.for("react.context"), d = Symbol.for("react.forward_ref"), c = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), l = Symbol.for("react.memo"), p = Symbol.for("react.lazy"), y = Symbol.for("react.offscreen"), b = Symbol.iterator, g = "@@iterator";
|
|
42
|
-
function
|
|
42
|
+
function T(h) {
|
|
43
43
|
if (h === null || typeof h != "object")
|
|
44
44
|
return null;
|
|
45
45
|
var _ = b && h[b] || h[g];
|
|
46
46
|
return typeof _ == "function" ? _ : null;
|
|
47
47
|
}
|
|
48
|
-
var
|
|
48
|
+
var m = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
49
49
|
function v(h) {
|
|
50
50
|
{
|
|
51
|
-
for (var _ = arguments.length, w = new Array(_ > 1 ? _ - 1 : 0),
|
|
52
|
-
w[
|
|
51
|
+
for (var _ = arguments.length, w = new Array(_ > 1 ? _ - 1 : 0), S = 1; S < _; S++)
|
|
52
|
+
w[S - 1] = arguments[S];
|
|
53
53
|
k("error", h, w);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
function k(h, _, w) {
|
|
57
57
|
{
|
|
58
|
-
var
|
|
58
|
+
var S = m.ReactDebugCurrentFrame, C = S.getStackAddendum();
|
|
59
59
|
C !== "" && (_ += "%s", w = w.concat([C]));
|
|
60
60
|
var P = w.map(function(j) {
|
|
61
61
|
return String(j);
|
|
@@ -63,19 +63,19 @@ function Ki() {
|
|
|
63
63
|
P.unshift("Warning: " + _), Function.prototype.apply.call(console[h], console, P);
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
var
|
|
67
|
-
|
|
66
|
+
var O = !1, I = !1, R = !1, F = !1, le = !1, Qe;
|
|
67
|
+
Qe = Symbol.for("react.module.reference");
|
|
68
68
|
function _t(h) {
|
|
69
|
-
return !!(typeof h == "string" || typeof h == "function" || h === i || h === o || le || h === s || h === c || h === f || F || h === y ||
|
|
69
|
+
return !!(typeof h == "string" || typeof h == "function" || h === i || h === o || le || h === s || h === c || h === f || F || h === y || O || I || R || typeof h == "object" && h !== null && (h.$$typeof === p || h.$$typeof === l || h.$$typeof === u || h.$$typeof === a || h.$$typeof === d || // This needs to include all possible module reference object
|
|
70
70
|
// types supported by any Flight configuration anywhere since
|
|
71
71
|
// we don't know which Flight build this will end up being used
|
|
72
72
|
// with.
|
|
73
|
-
h.$$typeof ===
|
|
73
|
+
h.$$typeof === Qe || h.getModuleId !== void 0));
|
|
74
74
|
}
|
|
75
75
|
function gt(h, _, w) {
|
|
76
|
-
var
|
|
77
|
-
if (
|
|
78
|
-
return
|
|
76
|
+
var S = h.displayName;
|
|
77
|
+
if (S)
|
|
78
|
+
return S;
|
|
79
79
|
var C = _.displayName || _.name || "";
|
|
80
80
|
return C !== "" ? w + "(" + C + ")" : w;
|
|
81
81
|
}
|
|
@@ -114,8 +114,8 @@ function Ki() {
|
|
|
114
114
|
case d:
|
|
115
115
|
return gt(h, h.render, "ForwardRef");
|
|
116
116
|
case l:
|
|
117
|
-
var
|
|
118
|
-
return
|
|
117
|
+
var S = h.displayName || null;
|
|
118
|
+
return S !== null ? S : ne(h.type) || "Memo";
|
|
119
119
|
case p: {
|
|
120
120
|
var C = h, P = C._payload, j = C._init;
|
|
121
121
|
try {
|
|
@@ -127,13 +127,13 @@ function Ki() {
|
|
|
127
127
|
}
|
|
128
128
|
return null;
|
|
129
129
|
}
|
|
130
|
-
var he = Object.assign,
|
|
130
|
+
var he = Object.assign, Me = 0, yn, bn, _n, gn, Tn, mn, wn;
|
|
131
131
|
function vn() {
|
|
132
132
|
}
|
|
133
133
|
vn.__reactDisabledLog = !0;
|
|
134
134
|
function hi() {
|
|
135
135
|
{
|
|
136
|
-
if (
|
|
136
|
+
if (Me === 0) {
|
|
137
137
|
yn = console.log, bn = console.info, _n = console.warn, gn = console.error, Tn = console.group, mn = console.groupCollapsed, wn = console.groupEnd;
|
|
138
138
|
var h = {
|
|
139
139
|
configurable: !0,
|
|
@@ -151,12 +151,12 @@ function Ki() {
|
|
|
151
151
|
groupEnd: h
|
|
152
152
|
});
|
|
153
153
|
}
|
|
154
|
-
|
|
154
|
+
Me++;
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
function pi() {
|
|
158
158
|
{
|
|
159
|
-
if (
|
|
159
|
+
if (Me--, Me === 0) {
|
|
160
160
|
var h = {
|
|
161
161
|
configurable: !0,
|
|
162
162
|
enumerable: !0,
|
|
@@ -186,18 +186,18 @@ function Ki() {
|
|
|
186
186
|
})
|
|
187
187
|
});
|
|
188
188
|
}
|
|
189
|
-
|
|
189
|
+
Me < 0 && v("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
|
-
var Tt =
|
|
192
|
+
var Tt = m.ReactCurrentDispatcher, mt;
|
|
193
193
|
function Ye(h, _, w) {
|
|
194
194
|
{
|
|
195
195
|
if (mt === void 0)
|
|
196
196
|
try {
|
|
197
197
|
throw Error();
|
|
198
198
|
} catch (C) {
|
|
199
|
-
var
|
|
200
|
-
mt =
|
|
199
|
+
var S = C.stack.trim().match(/\n( *(at )?)/);
|
|
200
|
+
mt = S && S[1] || "";
|
|
201
201
|
}
|
|
202
202
|
return `
|
|
203
203
|
` + mt + h;
|
|
@@ -216,7 +216,7 @@ function Ki() {
|
|
|
216
216
|
if (w !== void 0)
|
|
217
217
|
return w;
|
|
218
218
|
}
|
|
219
|
-
var
|
|
219
|
+
var S;
|
|
220
220
|
wt = !0;
|
|
221
221
|
var C = Error.prepareStackTrace;
|
|
222
222
|
Error.prepareStackTrace = void 0;
|
|
@@ -235,14 +235,14 @@ function Ki() {
|
|
|
235
235
|
try {
|
|
236
236
|
Reflect.construct(j, []);
|
|
237
237
|
} catch (W) {
|
|
238
|
-
|
|
238
|
+
S = W;
|
|
239
239
|
}
|
|
240
240
|
Reflect.construct(h, [], j);
|
|
241
241
|
} else {
|
|
242
242
|
try {
|
|
243
243
|
j.call();
|
|
244
244
|
} catch (W) {
|
|
245
|
-
|
|
245
|
+
S = W;
|
|
246
246
|
}
|
|
247
247
|
h.call(j.prototype);
|
|
248
248
|
}
|
|
@@ -250,14 +250,14 @@ function Ki() {
|
|
|
250
250
|
try {
|
|
251
251
|
throw Error();
|
|
252
252
|
} catch (W) {
|
|
253
|
-
|
|
253
|
+
S = W;
|
|
254
254
|
}
|
|
255
255
|
h();
|
|
256
256
|
}
|
|
257
257
|
} catch (W) {
|
|
258
|
-
if (W &&
|
|
258
|
+
if (W && S && typeof W.stack == "string") {
|
|
259
259
|
for (var E = W.stack.split(`
|
|
260
|
-
`), z =
|
|
260
|
+
`), z = S.stack.split(`
|
|
261
261
|
`), $ = E.length - 1, D = z.length - 1; $ >= 1 && D >= 0 && E[$] !== z[D]; )
|
|
262
262
|
D--;
|
|
263
263
|
for (; $ >= 1 && D >= 0; $--, D--)
|
|
@@ -276,7 +276,7 @@ function Ki() {
|
|
|
276
276
|
} finally {
|
|
277
277
|
wt = !1, Tt.current = P, pi(), Error.prepareStackTrace = C;
|
|
278
278
|
}
|
|
279
|
-
var
|
|
279
|
+
var Se = h ? h.displayName || h.name : "", pe = Se ? Ye(Se) : "";
|
|
280
280
|
return typeof h == "function" && Je.set(h, pe), pe;
|
|
281
281
|
}
|
|
282
282
|
function bi(h, _, w) {
|
|
@@ -306,7 +306,7 @@ function Ki() {
|
|
|
306
306
|
case l:
|
|
307
307
|
return Ze(h.type, _, w);
|
|
308
308
|
case p: {
|
|
309
|
-
var
|
|
309
|
+
var S = h, C = S._payload, P = S._init;
|
|
310
310
|
try {
|
|
311
311
|
return Ze(P(C), _, w);
|
|
312
312
|
} catch {
|
|
@@ -315,7 +315,7 @@ function Ki() {
|
|
|
315
315
|
}
|
|
316
316
|
return "";
|
|
317
317
|
}
|
|
318
|
-
var
|
|
318
|
+
var Re = Object.prototype.hasOwnProperty, On = {}, En = m.ReactDebugCurrentFrame;
|
|
319
319
|
function Xe(h) {
|
|
320
320
|
if (h) {
|
|
321
321
|
var _ = h._owner, w = Ze(h.type, h._source, _ ? _.type : null);
|
|
@@ -323,22 +323,22 @@ function Ki() {
|
|
|
323
323
|
} else
|
|
324
324
|
En.setExtraStackFrame(null);
|
|
325
325
|
}
|
|
326
|
-
function gi(h, _, w,
|
|
326
|
+
function gi(h, _, w, S, C) {
|
|
327
327
|
{
|
|
328
|
-
var P = Function.call.bind(
|
|
328
|
+
var P = Function.call.bind(Re);
|
|
329
329
|
for (var j in h)
|
|
330
330
|
if (P(h, j)) {
|
|
331
331
|
var E = void 0;
|
|
332
332
|
try {
|
|
333
333
|
if (typeof h[j] != "function") {
|
|
334
|
-
var z = Error((
|
|
334
|
+
var z = Error((S || "React class") + ": " + w + " type `" + j + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof h[j] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
335
335
|
throw z.name = "Invariant Violation", z;
|
|
336
336
|
}
|
|
337
|
-
E = h[j](_, j,
|
|
337
|
+
E = h[j](_, j, S, w, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
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).",
|
|
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).", S || "React class", w, j, typeof E), Xe(null)), E instanceof Error && !(E.message in On) && (On[E.message] = !0, Xe(C), v("Failed %s type: %s", w, E.message), Xe(null));
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
344
|
}
|
|
@@ -366,14 +366,14 @@ function Ki() {
|
|
|
366
366
|
if (wi(h))
|
|
367
367
|
return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", mi(h)), An(h);
|
|
368
368
|
}
|
|
369
|
-
var kn =
|
|
369
|
+
var kn = m.ReactCurrentOwner, vi = {
|
|
370
370
|
key: !0,
|
|
371
371
|
ref: !0,
|
|
372
372
|
__self: !0,
|
|
373
373
|
__source: !0
|
|
374
374
|
}, Cn, Pn;
|
|
375
375
|
function Si(h) {
|
|
376
|
-
if (
|
|
376
|
+
if (Re.call(h, "ref")) {
|
|
377
377
|
var _ = Object.getOwnPropertyDescriptor(h, "ref").get;
|
|
378
378
|
if (_ && _.isReactWarning)
|
|
379
379
|
return !1;
|
|
@@ -381,7 +381,7 @@ function Ki() {
|
|
|
381
381
|
return h.ref !== void 0;
|
|
382
382
|
}
|
|
383
383
|
function Oi(h) {
|
|
384
|
-
if (
|
|
384
|
+
if (Re.call(h, "key")) {
|
|
385
385
|
var _ = Object.getOwnPropertyDescriptor(h, "key").get;
|
|
386
386
|
if (_ && _.isReactWarning)
|
|
387
387
|
return !1;
|
|
@@ -413,7 +413,7 @@ function Ki() {
|
|
|
413
413
|
});
|
|
414
414
|
}
|
|
415
415
|
}
|
|
416
|
-
var ki = function(h, _, w,
|
|
416
|
+
var ki = function(h, _, w, S, C, P, j) {
|
|
417
417
|
var E = {
|
|
418
418
|
// This tag allows us to uniquely identify this as a React Element
|
|
419
419
|
$$typeof: n,
|
|
@@ -434,7 +434,7 @@ function Ki() {
|
|
|
434
434
|
configurable: !1,
|
|
435
435
|
enumerable: !1,
|
|
436
436
|
writable: !1,
|
|
437
|
-
value:
|
|
437
|
+
value: S
|
|
438
438
|
}), Object.defineProperty(E, "_source", {
|
|
439
439
|
configurable: !1,
|
|
440
440
|
enumerable: !1,
|
|
@@ -442,12 +442,12 @@ function Ki() {
|
|
|
442
442
|
value: C
|
|
443
443
|
}), Object.freeze && (Object.freeze(E.props), Object.freeze(E)), E;
|
|
444
444
|
};
|
|
445
|
-
function Ci(h, _, w,
|
|
445
|
+
function Ci(h, _, w, S, C) {
|
|
446
446
|
{
|
|
447
447
|
var P, j = {}, E = null, z = null;
|
|
448
448
|
w !== void 0 && (jn(w), E = "" + w), Oi(_) && (jn(_.key), E = "" + _.key), Si(_) && (z = _.ref, Ei(_, C));
|
|
449
449
|
for (P in _)
|
|
450
|
-
|
|
450
|
+
Re.call(_, P) && !vi.hasOwnProperty(P) && (j[P] = _[P]);
|
|
451
451
|
if (h && h.defaultProps) {
|
|
452
452
|
var $ = h.defaultProps;
|
|
453
453
|
for (P in $)
|
|
@@ -457,11 +457,11 @@ function Ki() {
|
|
|
457
457
|
var D = typeof h == "function" ? h.displayName || h.name || "Unknown" : h;
|
|
458
458
|
E && Ai(j, D), z && ji(j, D);
|
|
459
459
|
}
|
|
460
|
-
return ki(h, E, z, C,
|
|
460
|
+
return ki(h, E, z, C, S, kn.current, j);
|
|
461
461
|
}
|
|
462
462
|
}
|
|
463
|
-
var St =
|
|
464
|
-
function
|
|
463
|
+
var St = m.ReactCurrentOwner, In = m.ReactDebugCurrentFrame;
|
|
464
|
+
function ve(h) {
|
|
465
465
|
if (h) {
|
|
466
466
|
var _ = h._owner, w = Ze(h.type, h._source, _ ? _.type : null);
|
|
467
467
|
In.setExtraStackFrame(w);
|
|
@@ -510,8 +510,8 @@ Check the top-level render call using <` + w + ">.");
|
|
|
510
510
|
if (Rn[w])
|
|
511
511
|
return;
|
|
512
512
|
Rn[w] = !0;
|
|
513
|
-
var
|
|
514
|
-
h && h._owner && h._owner !== St.current && (
|
|
513
|
+
var S = "";
|
|
514
|
+
h && h._owner && h._owner !== St.current && (S = " It was passed a child from " + ne(h._owner.type) + "."), ve(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, S), ve(null);
|
|
515
515
|
}
|
|
516
516
|
}
|
|
517
517
|
function xn(h, _) {
|
|
@@ -520,13 +520,13 @@ Check the top-level render call using <` + w + ">.");
|
|
|
520
520
|
return;
|
|
521
521
|
if (vt(h))
|
|
522
522
|
for (var w = 0; w < h.length; w++) {
|
|
523
|
-
var
|
|
524
|
-
Et(
|
|
523
|
+
var S = h[w];
|
|
524
|
+
Et(S) && $n(S, _);
|
|
525
525
|
}
|
|
526
526
|
else if (Et(h))
|
|
527
527
|
h._store && (h._store.validated = !0);
|
|
528
528
|
else if (h) {
|
|
529
|
-
var C =
|
|
529
|
+
var C = T(h);
|
|
530
530
|
if (typeof C == "function" && C !== h.entries)
|
|
531
531
|
for (var P = C.call(h), j; !(j = P.next()).done; )
|
|
532
532
|
Et(j.value) && $n(j.value, _);
|
|
@@ -548,8 +548,8 @@ Check the top-level render call using <` + w + ">.");
|
|
|
548
548
|
else
|
|
549
549
|
return;
|
|
550
550
|
if (w) {
|
|
551
|
-
var
|
|
552
|
-
gi(w, h.props, "prop",
|
|
551
|
+
var S = ne(_);
|
|
552
|
+
gi(w, h.props, "prop", S, h);
|
|
553
553
|
} else if (_.PropTypes !== void 0 && !Ot) {
|
|
554
554
|
Ot = !0;
|
|
555
555
|
var C = ne(_);
|
|
@@ -561,17 +561,17 @@ Check the top-level render call using <` + w + ">.");
|
|
|
561
561
|
function Ri(h) {
|
|
562
562
|
{
|
|
563
563
|
for (var _ = Object.keys(h.props), w = 0; w < _.length; w++) {
|
|
564
|
-
var
|
|
565
|
-
if (
|
|
566
|
-
|
|
564
|
+
var S = _[w];
|
|
565
|
+
if (S !== "children" && S !== "key") {
|
|
566
|
+
ve(h), v("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", S), ve(null);
|
|
567
567
|
break;
|
|
568
568
|
}
|
|
569
569
|
}
|
|
570
|
-
h.ref !== null && (
|
|
570
|
+
h.ref !== null && (ve(h), v("Invalid attribute `ref` supplied to `React.Fragment`."), ve(null));
|
|
571
571
|
}
|
|
572
572
|
}
|
|
573
573
|
var Dn = {};
|
|
574
|
-
function Un(h, _, w,
|
|
574
|
+
function Un(h, _, w, S, C, P) {
|
|
575
575
|
{
|
|
576
576
|
var j = _t(h);
|
|
577
577
|
if (!j) {
|
|
@@ -588,17 +588,17 @@ Check the top-level render call using <` + w + ">.");
|
|
|
588
588
|
if (j) {
|
|
589
589
|
var J = _.children;
|
|
590
590
|
if (J !== void 0)
|
|
591
|
-
if (
|
|
591
|
+
if (S)
|
|
592
592
|
if (vt(J)) {
|
|
593
|
-
for (var
|
|
594
|
-
xn(J[
|
|
593
|
+
for (var Se = 0; Se < J.length; Se++)
|
|
594
|
+
xn(J[Se], 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
|
xn(J, h);
|
|
600
600
|
}
|
|
601
|
-
if (
|
|
601
|
+
if (Re.call(_, "key")) {
|
|
602
602
|
var pe = 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}";
|
|
@@ -622,8 +622,8 @@ React keys must be passed directly to JSX without using spread:
|
|
|
622
622
|
return Un(h, _, w, !1);
|
|
623
623
|
}
|
|
624
624
|
var Di = xi, Ui = $i;
|
|
625
|
-
|
|
626
|
-
}(),
|
|
625
|
+
xe.Fragment = i, xe.jsx = Di, xe.jsxs = Ui;
|
|
626
|
+
}(), xe;
|
|
627
627
|
}
|
|
628
628
|
var qi = {};
|
|
629
629
|
qi.NODE_ENV === "production" ? xt.exports = Ni() : xt.exports = Ki();
|
|
@@ -674,7 +674,7 @@ const x = {
|
|
|
674
674
|
mutable: "mutable",
|
|
675
675
|
immutable: "immutable"
|
|
676
676
|
}, en = {};
|
|
677
|
-
function
|
|
677
|
+
function Ne(t, e) {
|
|
678
678
|
return t instanceof Map ? t.has(e) : Object.prototype.hasOwnProperty.call(t, e);
|
|
679
679
|
}
|
|
680
680
|
function Nn(t, e) {
|
|
@@ -721,7 +721,7 @@ function Ar(t, e = []) {
|
|
|
721
721
|
if (r !== null && (r == null ? void 0 : r.original) !== t.original)
|
|
722
722
|
return null;
|
|
723
723
|
const i = t.parent.type === 3, s = i ? Array.from(t.parent.setMap.keys()).indexOf(t.key) : t.key;
|
|
724
|
-
if (!(i && n.size > s ||
|
|
724
|
+
if (!(i && n.size > s || Ne(n, s)))
|
|
725
725
|
return null;
|
|
726
726
|
e.push(s);
|
|
727
727
|
}
|
|
@@ -741,7 +741,7 @@ function we(t) {
|
|
|
741
741
|
function ce(t, e) {
|
|
742
742
|
return we(t) === 2 ? t.get(e) : t[e];
|
|
743
743
|
}
|
|
744
|
-
function
|
|
744
|
+
function We(t, e, n) {
|
|
745
745
|
we(t) === 2 ? t.set(e, n) : t[e] = n;
|
|
746
746
|
}
|
|
747
747
|
function jt(t, e) {
|
|
@@ -825,15 +825,15 @@ function jr(t, e) {
|
|
|
825
825
|
function V(t) {
|
|
826
826
|
t.copy || (t.copy = jr(t.original, t.options));
|
|
827
827
|
}
|
|
828
|
-
function
|
|
828
|
+
function Ue(t) {
|
|
829
829
|
if (!ee(t))
|
|
830
830
|
return rn(t);
|
|
831
831
|
if (Array.isArray(t))
|
|
832
|
-
return t.map(
|
|
832
|
+
return t.map(Ue);
|
|
833
833
|
if (t instanceof Map) {
|
|
834
834
|
const n = Array.from(t.entries()).map(([r, i]) => [
|
|
835
835
|
r,
|
|
836
|
-
|
|
836
|
+
Ue(i)
|
|
837
837
|
]);
|
|
838
838
|
if (!nn(t)) {
|
|
839
839
|
const r = Object.getPrototypeOf(t).constructor;
|
|
@@ -842,7 +842,7 @@ function Le(t) {
|
|
|
842
842
|
return new Map(n);
|
|
843
843
|
}
|
|
844
844
|
if (t instanceof Set) {
|
|
845
|
-
const n = Array.from(t).map(
|
|
845
|
+
const n = Array.from(t).map(Ue);
|
|
846
846
|
if (!tn(t)) {
|
|
847
847
|
const r = Object.getPrototypeOf(t).constructor;
|
|
848
848
|
return new r(n);
|
|
@@ -851,11 +851,11 @@ function Le(t) {
|
|
|
851
851
|
}
|
|
852
852
|
const e = Object.create(Object.getPrototypeOf(t));
|
|
853
853
|
for (const n in t)
|
|
854
|
-
e[n] =
|
|
854
|
+
e[n] = Ue(t[n]);
|
|
855
855
|
return e;
|
|
856
856
|
}
|
|
857
857
|
function ot(t) {
|
|
858
|
-
return me(t) ?
|
|
858
|
+
return me(t) ? Ue(t) : t;
|
|
859
859
|
}
|
|
860
860
|
function ie(t) {
|
|
861
861
|
var e;
|
|
@@ -864,7 +864,7 @@ function ie(t) {
|
|
|
864
864
|
function Kn() {
|
|
865
865
|
throw new Error("Cannot modify frozen object");
|
|
866
866
|
}
|
|
867
|
-
function
|
|
867
|
+
function Oe(t, e, n, r, i) {
|
|
868
868
|
{
|
|
869
869
|
n = n ?? /* @__PURE__ */ new WeakMap(), r = r ?? [], i = i ?? [];
|
|
870
870
|
const o = n.has(t) ? n.get(t) : t;
|
|
@@ -888,24 +888,24 @@ function Ee(t, e, n, r, i) {
|
|
|
888
888
|
switch (we(t)) {
|
|
889
889
|
case 2:
|
|
890
890
|
for (const [u, a] of t)
|
|
891
|
-
|
|
891
|
+
Oe(u, u, n, r, i), Oe(a, u, n, r, i);
|
|
892
892
|
t.set = t.clear = t.delete = Kn;
|
|
893
893
|
break;
|
|
894
894
|
case 3:
|
|
895
895
|
for (const u of t)
|
|
896
|
-
|
|
896
|
+
Oe(u, u, n, r, i);
|
|
897
897
|
t.add = t.clear = t.delete = Kn;
|
|
898
898
|
break;
|
|
899
899
|
case 1:
|
|
900
900
|
Object.freeze(t);
|
|
901
901
|
let o = 0;
|
|
902
902
|
for (const u of t)
|
|
903
|
-
|
|
903
|
+
Oe(u, o, n, r, i), o += 1;
|
|
904
904
|
break;
|
|
905
905
|
default:
|
|
906
906
|
Object.freeze(t), Object.keys(t).forEach((u) => {
|
|
907
907
|
const a = t[u];
|
|
908
|
-
|
|
908
|
+
Oe(a, u, n, r, i);
|
|
909
909
|
});
|
|
910
910
|
}
|
|
911
911
|
r.pop(), i.pop();
|
|
@@ -933,7 +933,7 @@ function kr(t, e, n) {
|
|
|
933
933
|
const a = A(o);
|
|
934
934
|
V(a);
|
|
935
935
|
const d = !((u = a.assignedMap) === null || u === void 0) && u.size || a.operated ? a.copy : a.original;
|
|
936
|
-
|
|
936
|
+
We(r ? i : t, s, d);
|
|
937
937
|
} else
|
|
938
938
|
kr(o, e, n);
|
|
939
939
|
}), i) {
|
|
@@ -968,7 +968,7 @@ function on(t, e, n, r) {
|
|
|
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), Ut(t), Lt(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)),
|
|
971
|
+
i.copy && (d = i.copy), Ut(t), Lt(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;
|
|
@@ -1023,7 +1023,7 @@ function Qi(t, e, n, r, i) {
|
|
|
1023
1023
|
}
|
|
1024
1024
|
function Hi({ original: t, copy: e, assignedMap: n }, r, i, s, o) {
|
|
1025
1025
|
n.forEach((u, a) => {
|
|
1026
|
-
const d = ce(t, a), c = ot(ce(e, a)), f = u ?
|
|
1026
|
+
const d = ce(t, a), c = ot(ce(e, a)), f = u ? Ne(t, a) ? x.Replace : x.Add : x.Remove;
|
|
1027
1027
|
if (ae(d, c) && f === x.Replace)
|
|
1028
1028
|
return;
|
|
1029
1029
|
const l = r.concat(a), p = _e(l, o);
|
|
@@ -1062,7 +1062,7 @@ function Yi({ original: t, copy: e }, n, r, i, s) {
|
|
|
1062
1062
|
o += 1;
|
|
1063
1063
|
});
|
|
1064
1064
|
}
|
|
1065
|
-
function
|
|
1065
|
+
function Ve(t, e, n, r) {
|
|
1066
1066
|
const { pathAsArray: i = !0 } = t.options.enablePatches;
|
|
1067
1067
|
switch (t.type) {
|
|
1068
1068
|
case 0:
|
|
@@ -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), on(n, 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), on(n, t, e, Ve)), this;
|
|
1090
1090
|
},
|
|
1091
1091
|
delete(t) {
|
|
1092
1092
|
if (!this.has(t))
|
|
@@ -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), on(e, t, t,
|
|
1197
|
+
return this.has(t) || (V(e), ie(e), e.assignedMap.set(t, !0), e.setMap.set(t, t), on(e, t, t, Ve)), this;
|
|
1198
1198
|
},
|
|
1199
1199
|
delete(t) {
|
|
1200
1200
|
if (!this.has(t))
|
|
@@ -1298,7 +1298,7 @@ const Zi = Reflect.ownKeys(dt), Cr = /* @__PURE__ */ new WeakSet(), Pr = {
|
|
|
1298
1298
|
if (d)
|
|
1299
1299
|
return d.bind(t.proxy);
|
|
1300
1300
|
}
|
|
1301
|
-
if (!
|
|
1301
|
+
if (!Ne(u, e)) {
|
|
1302
1302
|
const d = Nn(u, e);
|
|
1303
1303
|
return d ? "value" in d ? d.value : (
|
|
1304
1304
|
// !case: support for getter
|
|
@@ -1334,7 +1334,7 @@ const Zi = Reflect.ownKeys(dt), Cr = /* @__PURE__ */ new WeakSet(), Pr = {
|
|
|
1334
1334
|
if (s != null && s.set)
|
|
1335
1335
|
return s.set.call(t.proxy, n), !0;
|
|
1336
1336
|
const o = jt(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 ||
|
|
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, on(t, e, n, Ve)), !0);
|
|
1338
1338
|
},
|
|
1339
1339
|
has(t, e) {
|
|
1340
1340
|
return e in H(t);
|
|
@@ -1386,10 +1386,10 @@ function un(t) {
|
|
|
1386
1386
|
var p, y;
|
|
1387
1387
|
const b = A(a);
|
|
1388
1388
|
let g = c.type === 3 ? c.setMap : c.copy;
|
|
1389
|
-
const
|
|
1390
|
-
if (
|
|
1391
|
-
let v =
|
|
1392
|
-
|
|
1389
|
+
const T = ce(g, r), m = A(T);
|
|
1390
|
+
if (m) {
|
|
1391
|
+
let v = m.original;
|
|
1392
|
+
m.operated && (v = rn(T)), Ut(m), Lt(m, 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, m.original)), We(g, r, v);
|
|
1393
1393
|
}
|
|
1394
1394
|
(y = b.callbacks) === null || y === void 0 || y.forEach((v) => {
|
|
1395
1395
|
v(f, l);
|
|
@@ -1398,7 +1398,7 @@ function un(t) {
|
|
|
1398
1398
|
} else {
|
|
1399
1399
|
const c = A(a);
|
|
1400
1400
|
c.finalities.draft.push((f, l) => {
|
|
1401
|
-
Ut(c), Lt(c,
|
|
1401
|
+
Ut(c), Lt(c, Ve, f, l);
|
|
1402
1402
|
});
|
|
1403
1403
|
}
|
|
1404
1404
|
return a;
|
|
@@ -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 && Dt(o), i &&
|
|
1414
|
+
return o && Dt(o), i && Oe(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
|
|
@@ -1451,7 +1451,7 @@ function Nt(t) {
|
|
|
1451
1451
|
const c = Array.from(u);
|
|
1452
1452
|
u.clear(), c.forEach((f) => u.add(s === f ? d : f));
|
|
1453
1453
|
} else
|
|
1454
|
-
|
|
1454
|
+
We(u, s, d);
|
|
1455
1455
|
} else typeof o == "object" && o !== null && (t.value = o, t.isRoot = !1, Nt(t));
|
|
1456
1456
|
}), i && (t.isContainDraft || console.warn("The return value does not contain any draft, please use 'rawReturn()' to wrap the return value to improve performance."), r && console.warn("The return value contains drafts, please don't use 'rawReturn()' to wrap the return value."));
|
|
1457
1457
|
}
|
|
@@ -1480,7 +1480,7 @@ function Ir(t) {
|
|
|
1480
1480
|
if (n && ae(ce(n.original, o), u))
|
|
1481
1481
|
return;
|
|
1482
1482
|
const a = Ir(u);
|
|
1483
|
-
a !== u && (i === t && s(),
|
|
1483
|
+
a !== u && (i === t && s(), We(i, o, a));
|
|
1484
1484
|
}), r === 3) {
|
|
1485
1485
|
const o = (e = n == null ? void 0 : n.original) !== null && e !== void 0 ? e : i;
|
|
1486
1486
|
return tn(o) ? new Set(i) : new (Object.getPrototypeOf(o)).constructor(i);
|
|
@@ -1495,19 +1495,19 @@ function zn(t) {
|
|
|
1495
1495
|
const ts = (t) => function e(n, r, i) {
|
|
1496
1496
|
var s, o, u;
|
|
1497
1497
|
if (typeof n == "function" && typeof r != "function")
|
|
1498
|
-
return function(
|
|
1499
|
-
return e(
|
|
1498
|
+
return function(O, ...I) {
|
|
1499
|
+
return e(O, (R) => n.call(this, R, ...I), r);
|
|
1500
1500
|
};
|
|
1501
1501
|
const a = n, d = r;
|
|
1502
1502
|
let c = 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 = me(a) ? zn(a) : a, l = Array.isArray(c.mark) ? (
|
|
1506
|
+
const f = me(a) ? zn(a) : a, l = Array.isArray(c.mark) ? (O, 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.`);
|
|
1510
|
-
const F = R(
|
|
1510
|
+
const F = R(O, I);
|
|
1511
1511
|
if (F)
|
|
1512
1512
|
return F;
|
|
1513
1513
|
}
|
|
@@ -1519,47 +1519,47 @@ const ts = (t) => function e(n, r, i) {
|
|
|
1519
1519
|
};
|
|
1520
1520
|
if (!ee(f, g) && typeof f == "object" && f !== null)
|
|
1521
1521
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
1522
|
-
const [
|
|
1522
|
+
const [T, m] = es(f, g);
|
|
1523
1523
|
if (typeof r != "function") {
|
|
1524
1524
|
if (!ee(f, g))
|
|
1525
1525
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
1526
|
-
return [
|
|
1526
|
+
return [T, m];
|
|
1527
1527
|
}
|
|
1528
1528
|
let v;
|
|
1529
1529
|
try {
|
|
1530
|
-
v = d(
|
|
1531
|
-
} catch (
|
|
1532
|
-
throw Dt(A(
|
|
1533
|
-
}
|
|
1534
|
-
const k = (
|
|
1535
|
-
const I = A(
|
|
1536
|
-
if (!me(
|
|
1537
|
-
if (
|
|
1530
|
+
v = d(T);
|
|
1531
|
+
} catch (O) {
|
|
1532
|
+
throw Dt(A(T)), O;
|
|
1533
|
+
}
|
|
1534
|
+
const k = (O) => {
|
|
1535
|
+
const I = A(T);
|
|
1536
|
+
if (!me(O)) {
|
|
1537
|
+
if (O !== void 0 && !ae(O, T) && (I != null && I.operated))
|
|
1538
1538
|
throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");
|
|
1539
|
-
const F =
|
|
1539
|
+
const F = O == null ? void 0 : O[zi];
|
|
1540
1540
|
if (F) {
|
|
1541
1541
|
const le = F[0];
|
|
1542
|
-
return g.strict && typeof
|
|
1542
|
+
return g.strict && typeof O == "object" && O !== null && Nt({
|
|
1543
1543
|
rootDraft: I,
|
|
1544
|
-
value:
|
|
1544
|
+
value: O,
|
|
1545
1545
|
useRawReturn: !0
|
|
1546
|
-
}),
|
|
1546
|
+
}), m([le]);
|
|
1547
1547
|
}
|
|
1548
|
-
if (
|
|
1549
|
-
return typeof
|
|
1548
|
+
if (O !== void 0)
|
|
1549
|
+
return typeof O == "object" && O !== null && Nt({ rootDraft: I, value: O }), m([O]);
|
|
1550
1550
|
}
|
|
1551
|
-
if (
|
|
1552
|
-
return
|
|
1553
|
-
const R = A(
|
|
1551
|
+
if (O === T || O === void 0)
|
|
1552
|
+
return m([]);
|
|
1553
|
+
const R = A(O);
|
|
1554
1554
|
if (g === R.options) {
|
|
1555
1555
|
if (R.operated)
|
|
1556
1556
|
throw new Error("Cannot return a modified child draft.");
|
|
1557
|
-
return
|
|
1557
|
+
return m([zn(O)]);
|
|
1558
1558
|
}
|
|
1559
|
-
return
|
|
1559
|
+
return m([O]);
|
|
1560
1560
|
};
|
|
1561
|
-
return v instanceof Promise ? v.then(k, (
|
|
1562
|
-
throw Dt(A(
|
|
1561
|
+
return v instanceof Promise ? v.then(k, (O) => {
|
|
1562
|
+
throw Dt(A(T)), O;
|
|
1563
1563
|
}) : k(v);
|
|
1564
1564
|
}, ft = ts();
|
|
1565
1565
|
Object.prototype.constructor.toString();
|
|
@@ -1574,7 +1574,7 @@ 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
1576
|
function an(t) {
|
|
1577
|
-
if (!
|
|
1577
|
+
if (!Le(t))
|
|
1578
1578
|
return t;
|
|
1579
1579
|
const e = {};
|
|
1580
1580
|
for (const [n, r] of Object.entries(t))
|
|
@@ -1582,7 +1582,7 @@ function an(t) {
|
|
|
1582
1582
|
return e;
|
|
1583
1583
|
}
|
|
1584
1584
|
function Rr(t, e) {
|
|
1585
|
-
if (!
|
|
1585
|
+
if (!Le(t) || !Le(e))
|
|
1586
1586
|
return e;
|
|
1587
1587
|
const n = Object.assign({}, t);
|
|
1588
1588
|
for (const r of Object.keys(e)) {
|
|
@@ -1592,12 +1592,12 @@ function Rr(t, e) {
|
|
|
1592
1592
|
delete n[r];
|
|
1593
1593
|
continue;
|
|
1594
1594
|
}
|
|
1595
|
-
const i =
|
|
1595
|
+
const i = Le(t[r]) && Le(e[r]);
|
|
1596
1596
|
n[r] = i ? Rr(t[r], e[r]) : e[r];
|
|
1597
1597
|
}
|
|
1598
1598
|
return n;
|
|
1599
1599
|
}
|
|
1600
|
-
function
|
|
1600
|
+
function Le(t) {
|
|
1601
1601
|
return typeof t == "object" && t !== null && !Array.isArray(t);
|
|
1602
1602
|
}
|
|
1603
1603
|
function ns(t, e, n) {
|
|
@@ -1960,10 +1960,10 @@ function cn(t) {
|
|
|
1960
1960
|
function dn(t) {
|
|
1961
1961
|
return t["value-type"] === "blob";
|
|
1962
1962
|
}
|
|
1963
|
-
function
|
|
1963
|
+
function Ce(t, e) {
|
|
1964
1964
|
return t[e];
|
|
1965
1965
|
}
|
|
1966
|
-
function
|
|
1966
|
+
function Pe(t, e) {
|
|
1967
1967
|
return e.reduce((n, r) => n && n.get(r), t);
|
|
1968
1968
|
}
|
|
1969
1969
|
function X(t, e) {
|
|
@@ -1991,7 +1991,7 @@ function xr(t, e, n) {
|
|
|
1991
1991
|
const r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
|
|
1992
1992
|
for (const o of e) {
|
|
1993
1993
|
let [u, a, d, c] = o;
|
|
1994
|
-
const f =
|
|
1994
|
+
const f = Ce(t, a);
|
|
1995
1995
|
if (!f) {
|
|
1996
1996
|
console.warn("no such attr", u, t);
|
|
1997
1997
|
continue;
|
|
@@ -2025,7 +2025,7 @@ function Lr(t) {
|
|
|
2025
2025
|
return at(t.attrs, t.triples, t.cardinalityInference, t.linkIndex, t.useDateObjects);
|
|
2026
2026
|
}
|
|
2027
2027
|
function ws(t, e) {
|
|
2028
|
-
return
|
|
2028
|
+
return Pe(t.eav, [e]) !== void 0;
|
|
2029
2029
|
}
|
|
2030
2030
|
function fn(t) {
|
|
2031
2031
|
t.attrIndexes = Dr(t.attrs);
|
|
@@ -2034,7 +2034,7 @@ function at(t, e, n, r, i) {
|
|
|
2034
2034
|
const s = xr(t, e, i);
|
|
2035
2035
|
return s.useDateObjects = i, s.attrs = t, s.attrIndexes = Dr(t), s.cardinalityInference = n, s.linkIndex = r, s.__type = "store", s;
|
|
2036
2036
|
}
|
|
2037
|
-
function
|
|
2037
|
+
function Be(t, e) {
|
|
2038
2038
|
var n, r;
|
|
2039
2039
|
let i;
|
|
2040
2040
|
if (Array.isArray(e[0])) {
|
|
@@ -2062,43 +2062,43 @@ function Ge(t, e) {
|
|
|
2062
2062
|
}
|
|
2063
2063
|
}
|
|
2064
2064
|
function Fr(t, e) {
|
|
2065
|
-
const n =
|
|
2065
|
+
const n = Be(t, e);
|
|
2066
2066
|
if (!n)
|
|
2067
2067
|
return;
|
|
2068
|
-
const [r, i, s] = n, o =
|
|
2068
|
+
const [r, i, s] = n, o = Ce(t.attrs, i);
|
|
2069
2069
|
o && (X(t.eav, [r, i, s]), X(t.aev, [i, r, s]), cn(o) && X(t.vae, [s, i, r]));
|
|
2070
2070
|
}
|
|
2071
2071
|
let vs = 0;
|
|
2072
2072
|
function Nr(t, e, n) {
|
|
2073
2073
|
const [r, i, s] = n;
|
|
2074
2074
|
let o;
|
|
2075
|
-
const u =
|
|
2075
|
+
const u = Pe(t.ea, [r, i, s]);
|
|
2076
2076
|
return u && (o = u[3]), o || Date.now() * 10 + vs++;
|
|
2077
2077
|
}
|
|
2078
2078
|
function Kr(t, e) {
|
|
2079
2079
|
var n;
|
|
2080
|
-
const r =
|
|
2080
|
+
const r = Be(t, e);
|
|
2081
2081
|
if (!r)
|
|
2082
2082
|
return;
|
|
2083
2083
|
let [i, s, o] = r;
|
|
2084
|
-
const u =
|
|
2084
|
+
const u = Ce(t.attrs, s);
|
|
2085
2085
|
if (!u)
|
|
2086
2086
|
return;
|
|
2087
2087
|
u["checked-data-type"] === "date" && t.useDateObjects && (o = pt(o));
|
|
2088
|
-
const a =
|
|
2088
|
+
const a = Pe(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
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)), cn(u) && B(t.vae, [o, s, i], c);
|
|
2090
2090
|
}
|
|
2091
2091
|
function Ss(t, e) {
|
|
2092
2092
|
var n;
|
|
2093
|
-
const r =
|
|
2093
|
+
const r = Be(t, e);
|
|
2094
2094
|
if (!r)
|
|
2095
2095
|
return;
|
|
2096
|
-
const [i, s, o] = r, u =
|
|
2096
|
+
const [i, s, o] = r, u = Ce(t.attrs, s);
|
|
2097
2097
|
if (!u)
|
|
2098
2098
|
return;
|
|
2099
2099
|
if (!dn(u))
|
|
2100
2100
|
throw new Error("merge operation is not supported for links");
|
|
2101
|
-
const a =
|
|
2101
|
+
const a = Pe(t.eav, [i, s]);
|
|
2102
2102
|
if (!a)
|
|
2103
2103
|
return;
|
|
2104
2104
|
const d = (n = a.values().next()) === null || n === void 0 ? void 0 : n.value;
|
|
@@ -2114,7 +2114,7 @@ function Ss(t, e) {
|
|
|
2114
2114
|
}
|
|
2115
2115
|
function qt(t, e) {
|
|
2116
2116
|
var n, r;
|
|
2117
|
-
const [i, s] = e, o =
|
|
2117
|
+
const [i, s] = e, o = Be(t, [i]);
|
|
2118
2118
|
if (!o)
|
|
2119
2119
|
return;
|
|
2120
2120
|
const [u] = o, a = t.eav.get(u);
|
|
@@ -2135,8 +2135,8 @@ function qt(t, e) {
|
|
|
2135
2135
|
const d = t.vae.get(u) && G(t.vae.get(u), 2);
|
|
2136
2136
|
d && d.forEach((c) => {
|
|
2137
2137
|
var f, l, p;
|
|
2138
|
-
const [y, b, g] = c,
|
|
2139
|
-
(!s || !
|
|
2138
|
+
const [y, b, g] = c, T = t.attrs[b];
|
|
2139
|
+
(!s || !T || ((f = T["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])), T && T["on-delete"] === "cascade" && ((l = T["reverse-identity"]) === null || l === void 0 ? void 0 : l[1]) === s && qt(t, [y, (p = T["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) {
|
|
@@ -2317,12 +2317,12 @@ function Wr(t, e) {
|
|
|
2317
2317
|
return r || ((n = t.attrIndexes.forwardIdents.get(e)) === null || n === void 0 ? void 0 : n.get("id"));
|
|
2318
2318
|
}
|
|
2319
2319
|
function Ms(t, e) {
|
|
2320
|
-
const n =
|
|
2320
|
+
const n = Be(t, e);
|
|
2321
2321
|
if (!n)
|
|
2322
2322
|
return;
|
|
2323
2323
|
const [r, i, s] = n;
|
|
2324
|
-
if (
|
|
2325
|
-
return
|
|
2324
|
+
if (Ce(t.attrs, i))
|
|
2325
|
+
return Pe(t.eav, [r, i]);
|
|
2326
2326
|
}
|
|
2327
2327
|
function Rs(t, e) {
|
|
2328
2328
|
const n = e.filter(([r, i, s, o, u]) => {
|
|
@@ -2332,7 +2332,7 @@ function Rs(t, e) {
|
|
|
2332
2332
|
if (a !== "create" && a !== "update")
|
|
2333
2333
|
return !0;
|
|
2334
2334
|
let d = !1;
|
|
2335
|
-
const c =
|
|
2335
|
+
const c = Ce(t.attrs, s);
|
|
2336
2336
|
if (c) {
|
|
2337
2337
|
const f = Wr(t, c["forward-identity"][1]);
|
|
2338
2338
|
d = !!Ms(t, [i, f.id, i]);
|
|
@@ -2408,7 +2408,7 @@ function zs(t, e, n) {
|
|
|
2408
2408
|
return Cs(t, ln(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
|
-
function
|
|
2411
|
+
function Ae(t) {
|
|
2412
2412
|
return typeof t == "string" && Vs.test(t);
|
|
2413
2413
|
}
|
|
2414
2414
|
const N = [];
|
|
@@ -2473,13 +2473,13 @@ function Xs() {
|
|
|
2473
2473
|
}
|
|
2474
2474
|
const eo = Xs();
|
|
2475
2475
|
let to = 0;
|
|
2476
|
-
function
|
|
2476
|
+
function Ke(t) {
|
|
2477
2477
|
return yt(`_${t}`, to++);
|
|
2478
2478
|
}
|
|
2479
2479
|
function yt(t, e) {
|
|
2480
2480
|
return `?${t}-${e}`;
|
|
2481
2481
|
}
|
|
2482
|
-
class
|
|
2482
|
+
class je extends Error {
|
|
2483
2483
|
constructor(e) {
|
|
2484
2484
|
super(e), this.name = "AttrNotFoundError";
|
|
2485
2485
|
}
|
|
@@ -2487,7 +2487,7 @@ class ke extends Error {
|
|
|
2487
2487
|
function no(t, e) {
|
|
2488
2488
|
const n = Wr(t, e);
|
|
2489
2489
|
if (!n)
|
|
2490
|
-
throw new
|
|
2490
|
+
throw new je(`Could not find id attr for ${e}`);
|
|
2491
2491
|
return n;
|
|
2492
2492
|
}
|
|
2493
2493
|
function Yn(t, e, n, r) {
|
|
@@ -2507,19 +2507,19 @@ function io(t, e, n) {
|
|
|
2507
2507
|
function Gr(t, e, n, r, i) {
|
|
2508
2508
|
const s = fe(e, n, i), o = Vr(e, n, i), u = s || o;
|
|
2509
2509
|
if (!u)
|
|
2510
|
-
throw new
|
|
2510
|
+
throw new je(`Could not find attr for ${[n, i]}`);
|
|
2511
2511
|
if (u["value-type"] !== "ref")
|
|
2512
2512
|
throw new Error(`Attr ${u.id} is not a ref`);
|
|
2513
2513
|
const [a, d] = u["forward-identity"], [c, f] = u["reverse-identity"], l = r + 1, p = s ? [
|
|
2514
2514
|
t(d, r),
|
|
2515
2515
|
u.id,
|
|
2516
2516
|
t(f, l),
|
|
2517
|
-
|
|
2517
|
+
Ke("time")
|
|
2518
2518
|
] : [
|
|
2519
2519
|
t(d, l),
|
|
2520
2520
|
u.id,
|
|
2521
2521
|
t(f, r),
|
|
2522
|
-
|
|
2522
|
+
Ke("time")
|
|
2523
2523
|
];
|
|
2524
2524
|
return [s ? f : d, l, p, u, !!s];
|
|
2525
2525
|
}
|
|
@@ -2596,24 +2596,24 @@ function so(t, e) {
|
|
|
2596
2596
|
function oo(t, e, n, r, i, s) {
|
|
2597
2597
|
const o = fe(e, n, i), u = Vr(e, n, i), a = o || u;
|
|
2598
2598
|
if (!a)
|
|
2599
|
-
throw new
|
|
2599
|
+
throw new je(`No attr for etype = ${n} label = ${i}`);
|
|
2600
2600
|
if (s != null && s.hasOwnProperty("$isNull")) {
|
|
2601
2601
|
const d = fe(e, n, "id");
|
|
2602
2602
|
if (!d)
|
|
2603
|
-
throw new
|
|
2603
|
+
throw new je(`No attr for etype = ${n} label = id`);
|
|
2604
2604
|
return [
|
|
2605
2605
|
t(n, r),
|
|
2606
2606
|
d.id,
|
|
2607
2607
|
{ $isNull: { attrId: a.id, isNull: s.$isNull, reverse: !o } },
|
|
2608
|
-
|
|
2608
|
+
Ke("time")
|
|
2609
2609
|
];
|
|
2610
2610
|
}
|
|
2611
2611
|
return o ? [
|
|
2612
2612
|
t(n, r),
|
|
2613
2613
|
a.id,
|
|
2614
2614
|
so(a, s),
|
|
2615
|
-
|
|
2616
|
-
] : [s, a.id, t(n, r),
|
|
2615
|
+
Ke("time")
|
|
2616
|
+
] : [s, a.id, t(n, r), Ke("time")];
|
|
2617
2617
|
}
|
|
2618
2618
|
function uo(t, e, n, r, i) {
|
|
2619
2619
|
const [s, o, u] = i.reduce((a, d) => {
|
|
@@ -2705,17 +2705,17 @@ function _o(t, e, { etype: n, level: r, form: i }, s) {
|
|
|
2705
2705
|
var p, y, b;
|
|
2706
2706
|
const g = !!(e.cardinalityInference && (!((b = (y = (p = e.linkIndex) === null || p === void 0 ? void 0 : p[n]) === null || y === void 0 ? void 0 : y[l]) === null || b === void 0) && b.isSingular));
|
|
2707
2707
|
try {
|
|
2708
|
-
const [
|
|
2709
|
-
etype:
|
|
2710
|
-
level:
|
|
2708
|
+
const [T, m, v] = bo(t, e, n, r, l, a), k = Yr(e, {
|
|
2709
|
+
etype: T,
|
|
2710
|
+
level: m,
|
|
2711
2711
|
form: i[l],
|
|
2712
2712
|
join: v
|
|
2713
|
-
}),
|
|
2714
|
-
return { [l]:
|
|
2715
|
-
} catch (
|
|
2716
|
-
if (
|
|
2713
|
+
}), O = g ? k[0] : k;
|
|
2714
|
+
return { [l]: O };
|
|
2715
|
+
} catch (T) {
|
|
2716
|
+
if (T instanceof je)
|
|
2717
2717
|
return { [l]: g ? void 0 : [] };
|
|
2718
|
-
throw
|
|
2718
|
+
throw T;
|
|
2719
2719
|
}
|
|
2720
2720
|
}).reduce(function(l, p) {
|
|
2721
2721
|
return Object.assign(Object.assign({}, l), p);
|
|
@@ -2725,11 +2725,11 @@ function _o(t, e, { etype: n, level: r, form: i }, s) {
|
|
|
2725
2725
|
function go(t, e, n) {
|
|
2726
2726
|
return n === "string" ? eo(t, e) : t > e ? 1 : -1;
|
|
2727
2727
|
}
|
|
2728
|
-
function
|
|
2728
|
+
function Fe(t, e, n, r, i) {
|
|
2729
2729
|
return e === r || e == null && r == null ? Js(t, n) : r == null ? 1 : e == null ? -1 : go(e, r, i);
|
|
2730
2730
|
}
|
|
2731
2731
|
function lt([t, e], [n, r], i) {
|
|
2732
|
-
return
|
|
2732
|
+
return Fe(t, e, n, r, i);
|
|
2733
2733
|
}
|
|
2734
2734
|
function Wt(t) {
|
|
2735
2735
|
return t == null ? t : new Date(t).getTime();
|
|
@@ -2778,16 +2778,16 @@ function Oo(t, { etype: e, pageInfo: n, dq: r, form: i }) {
|
|
|
2778
2778
|
const f = n == null ? void 0 : n["start-cursor"], l = vo(t, e, f, u);
|
|
2779
2779
|
if (l && ((o = l == null ? void 0 : l["forward-identity"]) === null || o === void 0 ? void 0 : o[2]) !== "id") {
|
|
2780
2780
|
const b = l["checked-data-type"] === "date", g = l.id;
|
|
2781
|
-
c = c.map(([
|
|
2782
|
-
var
|
|
2783
|
-
let R = (I = (
|
|
2784
|
-
return b && (R = Wt(R)), [
|
|
2781
|
+
c = c.map(([T]) => {
|
|
2782
|
+
var m, v, k, O, I;
|
|
2783
|
+
let R = (I = (O = (k = (v = (m = t.eav.get(T)) === null || m === void 0 ? void 0 : m.get(g)) === null || v === void 0 ? void 0 : v.values()) === null || k === void 0 ? void 0 : k.next()) === null || O === void 0 ? void 0 : O.value) === null || I === void 0 ? void 0 : I[2];
|
|
2784
|
+
return b && (R = Wt(R)), [T, R];
|
|
2785
2785
|
});
|
|
2786
2786
|
}
|
|
2787
|
-
c.sort(d === "asc" ? function(g,
|
|
2788
|
-
return lt(g,
|
|
2789
|
-
} : function(g,
|
|
2790
|
-
return lt(
|
|
2787
|
+
c.sort(d === "asc" ? function(g, T) {
|
|
2788
|
+
return lt(g, T, l == null ? void 0 : l["checked-data-type"]);
|
|
2789
|
+
} : function(g, T) {
|
|
2790
|
+
return lt(T, g, l == null ? void 0 : l["checked-data-type"]);
|
|
2791
2791
|
});
|
|
2792
2792
|
let p = {};
|
|
2793
2793
|
const y = So(t, e, r);
|
|
@@ -2795,8 +2795,8 @@ function Oo(t, { etype: e, pageInfo: n, dq: r, form: i }) {
|
|
|
2795
2795
|
const [g] = b;
|
|
2796
2796
|
if (p[g] || !a && f && l && To(f, l, d, b))
|
|
2797
2797
|
continue;
|
|
2798
|
-
const
|
|
2799
|
-
|
|
2798
|
+
const T = Ps(t, y, g);
|
|
2799
|
+
T && (p[g] = T);
|
|
2800
2800
|
}
|
|
2801
2801
|
return p;
|
|
2802
2802
|
}
|
|
@@ -2831,7 +2831,7 @@ function jo(t, e) {
|
|
|
2831
2831
|
try {
|
|
2832
2832
|
return Ao(t, e);
|
|
2833
2833
|
} catch (n) {
|
|
2834
|
-
if (n instanceof
|
|
2834
|
+
if (n instanceof je)
|
|
2835
2835
|
return {};
|
|
2836
2836
|
throw n;
|
|
2837
2837
|
}
|
|
@@ -3236,14 +3236,14 @@ function nu({ attrs: t, schema: e }, n) {
|
|
|
3236
3236
|
const b = p[0];
|
|
3237
3237
|
if (y) {
|
|
3238
3238
|
c(l, y);
|
|
3239
|
-
const g = q(o, l, y),
|
|
3240
|
-
d(g), d(
|
|
3241
|
-
const
|
|
3242
|
-
if (Gt(o,
|
|
3243
|
-
c(
|
|
3239
|
+
const g = q(o, l, y), T = ge(o, l, y);
|
|
3240
|
+
d(g), d(T);
|
|
3241
|
+
const m = ((r = g == null ? void 0 : g["reverse-identity"]) === null || r === void 0 ? void 0 : r[1]) || ((i = T == null ? void 0 : T["forward-identity"]) === null || i === void 0 ? void 0 : i[1]) || y;
|
|
3242
|
+
if (Gt(o, m, b))
|
|
3243
|
+
c(m, Qt(b));
|
|
3244
3244
|
else {
|
|
3245
|
-
const v = q(o,
|
|
3246
|
-
v || a(nt(e,
|
|
3245
|
+
const v = q(o, m, b);
|
|
3246
|
+
v || a(nt(e, m, b, Yt)), d(v);
|
|
3247
3247
|
}
|
|
3248
3248
|
} else if (Gt(o, l, b))
|
|
3249
3249
|
c(l, Qt(b));
|
|
@@ -3257,11 +3257,11 @@ function nu({ attrs: t, schema: e }, n) {
|
|
|
3257
3257
|
if (Yo.has(l)) {
|
|
3258
3258
|
const g = q(o, p, "id");
|
|
3259
3259
|
d(g), g || a(nt(e, p, "id", { "unique?": !0 }));
|
|
3260
|
-
for (const
|
|
3261
|
-
const
|
|
3262
|
-
if (d(
|
|
3263
|
-
const v = ge(o, p,
|
|
3264
|
-
!
|
|
3260
|
+
for (const T of Object.keys(b)) {
|
|
3261
|
+
const m = q(o, p, T);
|
|
3262
|
+
if (d(m), Zo.has(l) && (m || a(nt(e, p, T, T === "id" ? { "unique?": !0 } : null))), Jo.has(l)) {
|
|
3263
|
+
const v = ge(o, p, T);
|
|
3264
|
+
!m && !v && a(er(e, p, T)), d(v);
|
|
3265
3265
|
}
|
|
3266
3266
|
}
|
|
3267
3267
|
}
|
|
@@ -3302,7 +3302,7 @@ var re = function(t, e, n, r) {
|
|
|
3302
3302
|
function tr(t, e) {
|
|
3303
3303
|
typeof requestIdleCallback > "u" ? t() : requestIdleCallback(t, { timeout: e });
|
|
3304
3304
|
}
|
|
3305
|
-
const
|
|
3305
|
+
const qe = "__meta";
|
|
3306
3306
|
class iu {
|
|
3307
3307
|
constructor(e, n) {
|
|
3308
3308
|
}
|
|
@@ -3323,7 +3323,7 @@ class Jt {
|
|
|
3323
3323
|
var e, n, r;
|
|
3324
3324
|
this._meta.loadingPromise && (yield this._meta.loadingPromise);
|
|
3325
3325
|
try {
|
|
3326
|
-
const i = this._persister.getItem(
|
|
3326
|
+
const i = this._persister.getItem(qe);
|
|
3327
3327
|
this._meta.loadingPromise = i;
|
|
3328
3328
|
const s = yield i;
|
|
3329
3329
|
this._meta.isLoading = !1, this._meta.error = null, this._meta.loadingPromise = null, this._meta.attempts = 0;
|
|
@@ -3416,7 +3416,7 @@ class Jt {
|
|
|
3416
3416
|
const y = this._persister.removeItem(p);
|
|
3417
3417
|
i.push(y.then(() => 1)), this._loadedKeys.delete(p), this._pendingSaveKeys.delete(p);
|
|
3418
3418
|
}
|
|
3419
|
-
const d = [], c = [[
|
|
3419
|
+
const d = [], c = [[qe, o]], f = (n = o.objects) !== null && n !== void 0 ? n : {};
|
|
3420
3420
|
o.objects = f;
|
|
3421
3421
|
for (const p of a)
|
|
3422
3422
|
if (this._loadedKeys.has(p)) {
|
|
@@ -3448,7 +3448,7 @@ class Jt {
|
|
|
3448
3448
|
if (!this._gcOpts)
|
|
3449
3449
|
return;
|
|
3450
3450
|
const e = new Set(yield this._persister.getAllKeys());
|
|
3451
|
-
e.delete(
|
|
3451
|
+
e.delete(qe);
|
|
3452
3452
|
const n = new Set(Object.keys(this.currentValue));
|
|
3453
3453
|
for (const l of Object.keys(this._loadingKeys))
|
|
3454
3454
|
n.add(l);
|
|
@@ -3611,17 +3611,17 @@ function cu(t, e, n) {
|
|
|
3611
3611
|
for (const [y, b] of Object.entries(r)) {
|
|
3612
3612
|
const g = typeof b == "string" ? JSON.parse(b) : b;
|
|
3613
3613
|
if (g.lastAccessed) {
|
|
3614
|
-
const
|
|
3614
|
+
const m = {
|
|
3615
3615
|
createdAt: g.lastAccessed,
|
|
3616
3616
|
updatedAt: g.lastAccessed,
|
|
3617
3617
|
size: (c = (d = (a = (u = g.result) === null || u === void 0 ? void 0 : u.store) === null || a === void 0 ? void 0 : a.triples) === null || d === void 0 ? void 0 : d.length) !== null && c !== void 0 ? c : 0
|
|
3618
3618
|
};
|
|
3619
|
-
f[y] =
|
|
3619
|
+
f[y] = m;
|
|
3620
3620
|
}
|
|
3621
|
-
const
|
|
3622
|
-
i.add(
|
|
3621
|
+
const T = n.put(g, y);
|
|
3622
|
+
i.add(T);
|
|
3623
3623
|
}
|
|
3624
|
-
const l = { objects: f }, p = n.put(l,
|
|
3624
|
+
const l = { objects: f }, p = n.put(l, qe);
|
|
3625
3625
|
i.add(p);
|
|
3626
3626
|
for (const y of i)
|
|
3627
3627
|
y.onsuccess = () => {
|
|
@@ -3654,8 +3654,8 @@ function du(t, e) {
|
|
|
3654
3654
|
y.onsuccess = () => {
|
|
3655
3655
|
const g = y.result;
|
|
3656
3656
|
if (g) {
|
|
3657
|
-
const
|
|
3658
|
-
b.push([
|
|
3657
|
+
const T = g.key, m = g.value;
|
|
3658
|
+
b.push([T, m]), g.continue();
|
|
3659
3659
|
} else
|
|
3660
3660
|
c(b);
|
|
3661
3661
|
}, y.onerror = (g) => {
|
|
@@ -3681,7 +3681,7 @@ function du(t, e) {
|
|
|
3681
3681
|
break;
|
|
3682
3682
|
}
|
|
3683
3683
|
}
|
|
3684
|
-
const d = nr(
|
|
3684
|
+
const d = nr(qe, a, s);
|
|
3685
3685
|
u.push(d), yield Promise.all(u), yield new Promise((c, f) => {
|
|
3686
3686
|
i.oncomplete = (l) => c(l), i.onerror = (l) => f(l), i.onabort = (l) => f(l);
|
|
3687
3687
|
});
|
|
@@ -3835,11 +3835,11 @@ class ni {
|
|
|
3835
3835
|
};
|
|
3836
3836
|
}
|
|
3837
3837
|
}
|
|
3838
|
-
class
|
|
3838
|
+
class ke extends Error {
|
|
3839
3839
|
constructor(e, n) {
|
|
3840
3840
|
super(e), this.hint = n;
|
|
3841
3841
|
const r = new.target.prototype;
|
|
3842
|
-
Object.setPrototypeOf && Object.setPrototypeOf(this, r), Error.captureStackTrace && Error.captureStackTrace(this,
|
|
3842
|
+
Object.setPrototypeOf && Object.setPrototypeOf(this, r), Error.captureStackTrace && Error.captureStackTrace(this, ke), this.name = "InstantError";
|
|
3843
3843
|
}
|
|
3844
3844
|
get [Symbol.toStringTag]() {
|
|
3845
3845
|
return "InstantError";
|
|
@@ -3872,7 +3872,7 @@ var lu = function(t, e, n, r) {
|
|
|
3872
3872
|
d((r = r.apply(t, e || [])).next());
|
|
3873
3873
|
});
|
|
3874
3874
|
};
|
|
3875
|
-
class bt extends
|
|
3875
|
+
class bt extends ke {
|
|
3876
3876
|
constructor(e) {
|
|
3877
3877
|
var n;
|
|
3878
3878
|
const r = ((n = e.body) === null || n === void 0 ? void 0 : n.message) || `API Error (${e.status})`;
|
|
@@ -3890,7 +3890,7 @@ function te(t, e) {
|
|
|
3890
3890
|
return n.status === 200 ? Promise.resolve(r) : Promise.reject(new bt({ status: n.status, body: r }));
|
|
3891
3891
|
});
|
|
3892
3892
|
}
|
|
3893
|
-
var
|
|
3893
|
+
var Ie = function(t, e, n, r) {
|
|
3894
3894
|
function i(s) {
|
|
3895
3895
|
return s instanceof n ? s : new n(function(o) {
|
|
3896
3896
|
o(s);
|
|
@@ -3925,7 +3925,7 @@ function hu({ apiURI: t, appId: e, email: n }) {
|
|
|
3925
3925
|
});
|
|
3926
3926
|
}
|
|
3927
3927
|
function pu(t) {
|
|
3928
|
-
return
|
|
3928
|
+
return Ie(this, arguments, void 0, function* ({ apiURI: e, appId: n, email: r, code: i, refreshToken: s }) {
|
|
3929
3929
|
return yield te(`${e}/runtime/auth/verify_magic_code`, {
|
|
3930
3930
|
method: "POST",
|
|
3931
3931
|
headers: { "content-type": "application/json" },
|
|
@@ -3938,7 +3938,7 @@ function pu(t) {
|
|
|
3938
3938
|
});
|
|
3939
3939
|
}
|
|
3940
3940
|
function yu(t) {
|
|
3941
|
-
return
|
|
3941
|
+
return Ie(this, arguments, void 0, function* ({ apiURI: e, appId: n, refreshToken: r }) {
|
|
3942
3942
|
return yield te(`${e}/runtime/auth/verify_refresh_token`, {
|
|
3943
3943
|
method: "POST",
|
|
3944
3944
|
headers: { "content-type": "application/json" },
|
|
@@ -3950,7 +3950,7 @@ function yu(t) {
|
|
|
3950
3950
|
});
|
|
3951
3951
|
}
|
|
3952
3952
|
function bu(t) {
|
|
3953
|
-
return
|
|
3953
|
+
return Ie(this, arguments, void 0, function* ({ apiURI: e, appId: n }) {
|
|
3954
3954
|
return yield te(`${e}/runtime/auth/sign_in_guest`, {
|
|
3955
3955
|
method: "POST",
|
|
3956
3956
|
headers: { "content-type": "application/json" },
|
|
@@ -3961,7 +3961,7 @@ function bu(t) {
|
|
|
3961
3961
|
});
|
|
3962
3962
|
}
|
|
3963
3963
|
function ir(t) {
|
|
3964
|
-
return
|
|
3964
|
+
return Ie(this, arguments, void 0, function* ({ apiURI: e, appId: n, code: r, codeVerifier: i, refreshToken: s }) {
|
|
3965
3965
|
return yield te(`${e}/runtime/oauth/token`, {
|
|
3966
3966
|
method: "POST",
|
|
3967
3967
|
headers: { "content-type": "application/json" },
|
|
@@ -3975,7 +3975,7 @@ function ir(t) {
|
|
|
3975
3975
|
});
|
|
3976
3976
|
}
|
|
3977
3977
|
function _u(t) {
|
|
3978
|
-
return
|
|
3978
|
+
return Ie(this, arguments, void 0, function* ({ apiURI: e, appId: n, nonce: r, idToken: i, clientName: s, refreshToken: o }) {
|
|
3979
3979
|
return yield te(`${e}/runtime/oauth/id_token`, {
|
|
3980
3980
|
method: "POST",
|
|
3981
3981
|
headers: { "content-type": "application/json" },
|
|
@@ -3990,7 +3990,7 @@ function _u(t) {
|
|
|
3990
3990
|
});
|
|
3991
3991
|
}
|
|
3992
3992
|
function gu(t) {
|
|
3993
|
-
return
|
|
3993
|
+
return Ie(this, arguments, void 0, function* ({ apiURI: e, appId: n, refreshToken: r }) {
|
|
3994
3994
|
return yield te(`${e}/runtime/signout`, {
|
|
3995
3995
|
method: "POST",
|
|
3996
3996
|
headers: {
|
|
@@ -4003,7 +4003,7 @@ function gu(t) {
|
|
|
4003
4003
|
});
|
|
4004
4004
|
});
|
|
4005
4005
|
}
|
|
4006
|
-
var
|
|
4006
|
+
var Ge = function(t, e, n, r) {
|
|
4007
4007
|
function i(s) {
|
|
4008
4008
|
return s instanceof n ? s : new n(function(o) {
|
|
4009
4009
|
o(s);
|
|
@@ -4031,7 +4031,7 @@ var Qe = function(t, e, n, r) {
|
|
|
4031
4031
|
});
|
|
4032
4032
|
};
|
|
4033
4033
|
function Tu(t) {
|
|
4034
|
-
return
|
|
4034
|
+
return Ge(this, arguments, void 0, function* ({ apiURI: e, appId: n, path: r, file: i, refreshToken: s, contentType: o, contentDisposition: u }) {
|
|
4035
4035
|
const a = {
|
|
4036
4036
|
app_id: n,
|
|
4037
4037
|
path: r,
|
|
@@ -4046,7 +4046,7 @@ function Tu(t) {
|
|
|
4046
4046
|
});
|
|
4047
4047
|
}
|
|
4048
4048
|
function mu(t) {
|
|
4049
|
-
return
|
|
4049
|
+
return Ge(this, arguments, void 0, function* ({ apiURI: e, appId: n, path: r, refreshToken: i }) {
|
|
4050
4050
|
const { data: s } = yield te(`${e}/storage/files?app_id=${n}&filename=${encodeURIComponent(r)}`, {
|
|
4051
4051
|
method: "DELETE",
|
|
4052
4052
|
headers: {
|
|
@@ -4058,7 +4058,7 @@ function mu(t) {
|
|
|
4058
4058
|
});
|
|
4059
4059
|
}
|
|
4060
4060
|
function wu(t) {
|
|
4061
|
-
return
|
|
4061
|
+
return Ge(this, arguments, void 0, function* ({ apiURI: e, appId: n, fileName: r, refreshToken: i, metadata: s = {} }) {
|
|
4062
4062
|
const { data: o } = yield te(`${e}/storage/signed-upload-url`, {
|
|
4063
4063
|
method: "POST",
|
|
4064
4064
|
headers: {
|
|
@@ -4074,7 +4074,7 @@ function wu(t) {
|
|
|
4074
4074
|
});
|
|
4075
4075
|
}
|
|
4076
4076
|
function vu(t, e) {
|
|
4077
|
-
return
|
|
4077
|
+
return Ge(this, void 0, void 0, function* () {
|
|
4078
4078
|
return (yield fetch(t, {
|
|
4079
4079
|
method: "PUT",
|
|
4080
4080
|
body: e,
|
|
@@ -4085,7 +4085,7 @@ function vu(t, e) {
|
|
|
4085
4085
|
});
|
|
4086
4086
|
}
|
|
4087
4087
|
function Su(t) {
|
|
4088
|
-
return
|
|
4088
|
+
return Ge(this, arguments, void 0, function* ({ apiURI: e, appId: n, path: r, refreshToken: i }) {
|
|
4089
4089
|
const { data: s } = yield te(`${e}/storage/signed-download-url?app_id=${n}&filename=${encodeURIComponent(r)}`, {
|
|
4090
4090
|
method: "GET",
|
|
4091
4091
|
headers: {
|
|
@@ -4172,7 +4172,7 @@ function ar(t) {
|
|
|
4172
4172
|
}, e;
|
|
4173
4173
|
}, {});
|
|
4174
4174
|
}
|
|
4175
|
-
const oi = "v0.22.61
|
|
4175
|
+
const oi = "v0.22.61";
|
|
4176
4176
|
function Au(t, e) {
|
|
4177
4177
|
return {
|
|
4178
4178
|
info: t ? (...n) => console.info(...n, e()) : () => {
|
|
@@ -4269,7 +4269,7 @@ const cr = [
|
|
|
4269
4269
|
default:
|
|
4270
4270
|
throw new M(`Unknown operator '${t}' for attribute '${r}' in entity '${i}'`, o);
|
|
4271
4271
|
}
|
|
4272
|
-
},
|
|
4272
|
+
}, Ee = (t, e, n, r, i) => {
|
|
4273
4273
|
const s = ju(n), o = n.valueType === "json";
|
|
4274
4274
|
if (typeof t == "object" && t !== null && !Array.isArray(t)) {
|
|
4275
4275
|
if (o)
|
|
@@ -4299,23 +4299,23 @@ const cr = [
|
|
|
4299
4299
|
if (!a)
|
|
4300
4300
|
throw new M(`Target entity '${o}' does not exist in schema for dot notation path '${t}'.`, i);
|
|
4301
4301
|
if (u === "id") {
|
|
4302
|
-
if (typeof e == "string" && !
|
|
4302
|
+
if (typeof e == "string" && !Ae(e))
|
|
4303
4303
|
throw new M(`Invalid value for id field in entity '${o}'. Expected a UUID, but received: ${e}`, i);
|
|
4304
|
-
|
|
4304
|
+
Ee(e, t, new ue("string", !1, !0), n, i);
|
|
4305
4305
|
return;
|
|
4306
4306
|
}
|
|
4307
4307
|
const d = a.attrs[u];
|
|
4308
4308
|
if (Object.keys(a.links).includes(u)) {
|
|
4309
|
-
if (typeof e == "string" && !
|
|
4309
|
+
if (typeof e == "string" && !Ae(e))
|
|
4310
4310
|
throw new M(`Invalid value for link '${u}' in entity '${o}'. Expected a UUID, but received: ${e}`, i);
|
|
4311
|
-
|
|
4311
|
+
Ee(e, t, new ue("string", !1, !0), n, i);
|
|
4312
4312
|
return;
|
|
4313
4313
|
}
|
|
4314
4314
|
if (!d) {
|
|
4315
4315
|
const c = Object.keys(a.attrs);
|
|
4316
4316
|
throw new M(`Attribute '${u}' does not exist on entity '${o}' in dot notation path '${t}'. Available attributes: ${c.length > 0 ? c.join(", ") + ", id" : "id"}`, i);
|
|
4317
4317
|
}
|
|
4318
|
-
|
|
4318
|
+
Ee(e, t, d, n, i);
|
|
4319
4319
|
}, ai = (t, e, n, r) => {
|
|
4320
4320
|
for (const [i, s] of Object.entries(t)) {
|
|
4321
4321
|
if (i === "or" || i === "and") {
|
|
@@ -4325,7 +4325,7 @@ const cr = [
|
|
|
4325
4325
|
continue;
|
|
4326
4326
|
}
|
|
4327
4327
|
if (i === "id") {
|
|
4328
|
-
|
|
4328
|
+
Ee(s, "id", new ue("string", !1, !0), e, `${r}.id`);
|
|
4329
4329
|
continue;
|
|
4330
4330
|
}
|
|
4331
4331
|
if (i.includes(".")) {
|
|
@@ -4341,12 +4341,12 @@ const cr = [
|
|
|
4341
4341
|
throw new M(`Attribute or link '${i}' does not exist on entity '${e}'. Available attributes: ${d.length > 0 ? d.join(", ") : "none"}. Available links: ${c.length > 0 ? c.join(", ") : "none"}`, `${r}.${i}`);
|
|
4342
4342
|
}
|
|
4343
4343
|
if (u)
|
|
4344
|
-
|
|
4344
|
+
Ee(s, i, u, e, `${r}.${i}`);
|
|
4345
4345
|
else if (a) {
|
|
4346
|
-
if (typeof s == "string" && !
|
|
4346
|
+
if (typeof s == "string" && !Ae(s))
|
|
4347
4347
|
throw new M(`Invalid value for link '${i}' in entity '${e}'. Expected a UUID, but received: ${s}`, `${r}.${i}`);
|
|
4348
4348
|
const d = new ue("string", !1, !0);
|
|
4349
|
-
|
|
4349
|
+
Ee(s, i, d, e, `${r}.${i}`);
|
|
4350
4350
|
}
|
|
4351
4351
|
}
|
|
4352
4352
|
}, Pu = (t, e, n, r, i = 0) => {
|
|
@@ -4409,7 +4409,7 @@ const cr = [
|
|
|
4409
4409
|
ci(n[r], r, e, r, 0);
|
|
4410
4410
|
}
|
|
4411
4411
|
}
|
|
4412
|
-
}, fr = (t) => typeof t != "string" ? !1 : ht(t) ? !0 :
|
|
4412
|
+
}, fr = (t) => typeof t != "string" ? !1 : ht(t) ? !0 : Ae(t);
|
|
4413
4413
|
class Z extends Error {
|
|
4414
4414
|
constructor(e) {
|
|
4415
4415
|
super(e), this.name = "TransactionValidationError";
|
|
@@ -4470,7 +4470,7 @@ const di = (t) => t.length > 0 ? t.join(", ") : "none", Iu = (t, e) => new Z(`En
|
|
|
4470
4470
|
if (!e)
|
|
4471
4471
|
return;
|
|
4472
4472
|
const [n, r, i, s] = t;
|
|
4473
|
-
if (!Array.isArray(i) && !
|
|
4473
|
+
if (!Array.isArray(i) && !Ae(i))
|
|
4474
4474
|
throw new Z(`Invalid id for entity '${r}'. Expected a UUID, but received: ${i}`);
|
|
4475
4475
|
if (typeof r != "string")
|
|
4476
4476
|
throw new Z(`Entity name must be a string, but received: ${typeof r}`);
|
|
@@ -4684,7 +4684,7 @@ function _r(t, e, n) {
|
|
|
4684
4684
|
const i = (r = fe(e, t.table, "id")) === null || r === void 0 ? void 0 : r.id;
|
|
4685
4685
|
if (!i)
|
|
4686
4686
|
return -1;
|
|
4687
|
-
const s =
|
|
4687
|
+
const s = Pe(e.eav, [n, i, n]);
|
|
4688
4688
|
return s ? s[3] : -1;
|
|
4689
4689
|
}
|
|
4690
4690
|
function gr(t, e) {
|
|
@@ -4723,34 +4723,27 @@ function rt(t, e) {
|
|
|
4723
4723
|
return { [t.table]: e.map((n) => n.entity) };
|
|
4724
4724
|
}
|
|
4725
4725
|
function Ku(t, e) {
|
|
4726
|
-
|
|
4727
|
-
if (t.orderFieldType)
|
|
4728
|
-
return t.orderFieldType;
|
|
4729
|
-
const r = t.orderField === "serverCreatedAt" ? "number" : (n = fe(e([]), t.table, t.orderField)) === null || n === void 0 ? void 0 : n["checked-data-type"];
|
|
4730
|
-
return t.orderFieldType = r, r;
|
|
4731
|
-
}
|
|
4732
|
-
function qu(t, e, n) {
|
|
4733
|
-
const r = e;
|
|
4726
|
+
const n = t.orderFieldType;
|
|
4734
4727
|
if (t.orderField === "serverCreatedAt") {
|
|
4735
|
-
|
|
4736
|
-
return
|
|
4737
|
-
} : function(
|
|
4738
|
-
return
|
|
4728
|
+
e.sort(t.orderDirection === "asc" ? function(s, o) {
|
|
4729
|
+
return Fe(s.entity.id, s.serverCreatedAt, o.entity.id, o.serverCreatedAt, n);
|
|
4730
|
+
} : function(s, o) {
|
|
4731
|
+
return Fe(o.entity.id, o.serverCreatedAt, s.entity.id, s.serverCreatedAt, n);
|
|
4739
4732
|
});
|
|
4740
4733
|
return;
|
|
4741
4734
|
}
|
|
4742
|
-
const
|
|
4743
|
-
|
|
4744
|
-
return
|
|
4745
|
-
} : function(
|
|
4746
|
-
return
|
|
4735
|
+
const r = t.orderField;
|
|
4736
|
+
e.sort(t.orderDirection === "asc" ? function(s, o) {
|
|
4737
|
+
return Fe(s.entity.id, s.entity[r], o.entity.id, o.entity[r], n);
|
|
4738
|
+
} : function(s, o) {
|
|
4739
|
+
return Fe(o.entity.id, o.entity[r], s.entity.id, s.entity[r], n);
|
|
4747
4740
|
});
|
|
4748
4741
|
}
|
|
4749
4742
|
var ye;
|
|
4750
4743
|
(function(t) {
|
|
4751
4744
|
t.InitialSyncBatch = "InitialSyncBatch", t.InitialSyncComplete = "InitialSyncComplete", t.LoadFromStorage = "LoadFromStorage", t.SyncTransaction = "SyncTransaction", t.Error = "Error";
|
|
4752
4745
|
})(ye || (ye = {}));
|
|
4753
|
-
class
|
|
4746
|
+
class qu {
|
|
4754
4747
|
constructor(e, n, r, i, s) {
|
|
4755
4748
|
this.callbacks = {}, this.idToHash = {}, this.trySend = e, this.config = r, this.log = i, this.createStore = s, this.subs = new Jt({
|
|
4756
4749
|
persister: n,
|
|
@@ -4814,24 +4807,25 @@ class zu {
|
|
|
4814
4807
|
}
|
|
4815
4808
|
initSubscription(e, n, r) {
|
|
4816
4809
|
return br(this, void 0, void 0, function* () {
|
|
4817
|
-
var i, s, o, u;
|
|
4810
|
+
var i, s, o, u, a;
|
|
4818
4811
|
yield this.subs.waitForKeyToLoad(n);
|
|
4819
|
-
const
|
|
4820
|
-
if (
|
|
4821
|
-
this.sendResync(
|
|
4812
|
+
const d = this.subs.currentValue[n];
|
|
4813
|
+
if (d && d.state && d.state.txId) {
|
|
4814
|
+
this.sendResync(d, d.state), !((i = d.values) === null || i === void 0) && i.entities && r && (Object.keys(e)[0], r({
|
|
4822
4815
|
type: ye.LoadFromStorage,
|
|
4823
|
-
data: rt(
|
|
4816
|
+
data: rt(d, (s = d.values) === null || s === void 0 ? void 0 : s.entities)
|
|
4824
4817
|
}));
|
|
4825
4818
|
return;
|
|
4826
4819
|
}
|
|
4827
|
-
const
|
|
4828
|
-
this.subs.updateInPlace((
|
|
4829
|
-
|
|
4820
|
+
const c = Object.keys(e)[0], f = ((u = (o = e[c]) === null || o === void 0 ? void 0 : o.$) === null || u === void 0 ? void 0 : u.order) || { serverCreatedAt: "asc" }, [l, p] = Object.entries(f)[0], y = l === "serverCreatedAt" ? "number" : (a = fe(this.createStore([]), c, l)) === null || a === void 0 ? void 0 : a["checked-data-type"];
|
|
4821
|
+
this.subs.updateInPlace((b) => {
|
|
4822
|
+
b[n] = {
|
|
4830
4823
|
query: e,
|
|
4831
4824
|
hash: n,
|
|
4832
|
-
table:
|
|
4833
|
-
orderDirection:
|
|
4834
|
-
orderField:
|
|
4825
|
+
table: c,
|
|
4826
|
+
orderDirection: p,
|
|
4827
|
+
orderField: l,
|
|
4828
|
+
orderFieldType: y,
|
|
4835
4829
|
createdAt: Date.now(),
|
|
4836
4830
|
updatedAt: Date.now()
|
|
4837
4831
|
};
|
|
@@ -4946,8 +4940,8 @@ class zu {
|
|
|
4946
4940
|
a.txId = d["tx-id"];
|
|
4947
4941
|
const c = [], f = {};
|
|
4948
4942
|
for (const T of d.changes) {
|
|
4949
|
-
const
|
|
4950
|
-
f[T.triple[0]] =
|
|
4943
|
+
const m = (n = f[T.triple[0]]) !== null && n !== void 0 ? n : [];
|
|
4944
|
+
f[T.triple[0]] = m, m.push(T);
|
|
4951
4945
|
}
|
|
4952
4946
|
const l = (r = u.values) !== null && r !== void 0 ? r : {
|
|
4953
4947
|
entities: [],
|
|
@@ -4955,44 +4949,43 @@ class zu {
|
|
|
4955
4949
|
}, p = l.entities;
|
|
4956
4950
|
u.values = l;
|
|
4957
4951
|
const y = [];
|
|
4958
|
-
e: for (const [T,
|
|
4959
|
-
for (const [
|
|
4960
|
-
if (ws(
|
|
4961
|
-
gr(
|
|
4962
|
-
const
|
|
4963
|
-
for (const [
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
oldEntity:
|
|
4967
|
-
newEntity:
|
|
4968
|
-
changedFields:
|
|
4969
|
-
}),
|
|
4952
|
+
e: for (const [T, m] of Object.entries(f))
|
|
4953
|
+
for (const [v, k] of Object.entries(p))
|
|
4954
|
+
if (ws(k.store, T)) {
|
|
4955
|
+
gr(k.store, m);
|
|
4956
|
+
const O = Pt(u, k.store), I = Nu(k.store, m)[T];
|
|
4957
|
+
for (const [R, { oldValue: F, newValue: le }] of Object.entries(I || {}))
|
|
4958
|
+
F === le && delete I[R];
|
|
4959
|
+
O ? (y.push({
|
|
4960
|
+
oldEntity: k.entity,
|
|
4961
|
+
newEntity: O,
|
|
4962
|
+
changedFields: I || {}
|
|
4963
|
+
}), k.entity = O) : c.push(v), delete f[T];
|
|
4970
4964
|
continue e;
|
|
4971
4965
|
}
|
|
4972
4966
|
const b = [];
|
|
4973
|
-
for (const [T,
|
|
4974
|
-
const
|
|
4975
|
-
l.attrs =
|
|
4976
|
-
const
|
|
4977
|
-
if (!
|
|
4967
|
+
for (const [T, m] of Object.entries(f)) {
|
|
4968
|
+
const v = this.createStore([]);
|
|
4969
|
+
l.attrs = v.attrs, gr(v, m);
|
|
4970
|
+
const k = Pt(u, v);
|
|
4971
|
+
if (!k) {
|
|
4978
4972
|
this.log.error("No entity found after applying change", {
|
|
4979
4973
|
sub: u,
|
|
4980
|
-
changes:
|
|
4981
|
-
store:
|
|
4974
|
+
changes: m,
|
|
4975
|
+
store: v
|
|
4982
4976
|
});
|
|
4983
4977
|
continue;
|
|
4984
4978
|
}
|
|
4985
4979
|
p.push({
|
|
4986
|
-
store:
|
|
4987
|
-
entity:
|
|
4988
|
-
serverCreatedAt: _r(u,
|
|
4989
|
-
}), b.push(
|
|
4980
|
+
store: v,
|
|
4981
|
+
entity: k,
|
|
4982
|
+
serverCreatedAt: _r(u, v, k.id)
|
|
4983
|
+
}), b.push(k);
|
|
4990
4984
|
}
|
|
4991
4985
|
const g = [];
|
|
4992
4986
|
for (const T of c.sort().reverse())
|
|
4993
4987
|
g.push(p[T].entity), p.splice(T, 1);
|
|
4994
|
-
|
|
4995
|
-
qu(u, m, p), this.notifyCbs(o, {
|
|
4988
|
+
Ku(u, p), this.notifyCbs(o, {
|
|
4996
4989
|
type: ye.SyncTransaction,
|
|
4997
4990
|
data: rt(u, (i = u.values) === null || i === void 0 ? void 0 : i.entities),
|
|
4998
4991
|
added: b,
|
|
@@ -5059,7 +5052,7 @@ var U = function(t, e, n, r) {
|
|
|
5059
5052
|
}
|
|
5060
5053
|
d((r = r.apply(t, e || [])).next());
|
|
5061
5054
|
});
|
|
5062
|
-
},
|
|
5055
|
+
}, zu = function(t, e) {
|
|
5063
5056
|
var n = {};
|
|
5064
5057
|
for (var r in t) Object.prototype.hasOwnProperty.call(t, r) && e.indexOf(r) < 0 && (n[r] = t[r]);
|
|
5065
5058
|
if (t != null && typeof Object.getOwnPropertySymbols == "function")
|
|
@@ -5073,11 +5066,11 @@ const se = {
|
|
|
5073
5066
|
AUTHENTICATED: "authenticated",
|
|
5074
5067
|
CLOSED: "closed",
|
|
5075
5068
|
ERRORED: "errored"
|
|
5076
|
-
},
|
|
5069
|
+
}, Vu = 3e4, Wu = 3e4, Bu = 200, Gu = {
|
|
5077
5070
|
apiURI: "https://api.instantdb.com",
|
|
5078
5071
|
websocketURI: "wss://api.instantdb.com/runtime/session"
|
|
5079
|
-
}, It = "_instant_oauth_redirect",
|
|
5080
|
-
function
|
|
5072
|
+
}, It = "_instant_oauth_redirect", De = "currentUser";
|
|
5073
|
+
function Qu({ transportType: t, appId: e, apiURI: n, wsURI: r, EventSourceImpl: i }) {
|
|
5081
5074
|
if (!i)
|
|
5082
5075
|
return new yr(`${r}?app_id=${e}`);
|
|
5083
5076
|
switch (t) {
|
|
@@ -5089,7 +5082,7 @@ function Hu({ transportType: t, appId: e, apiURI: n, wsURI: r, EventSourceImpl:
|
|
|
5089
5082
|
throw new Error("Unknown transport type " + t);
|
|
5090
5083
|
}
|
|
5091
5084
|
}
|
|
5092
|
-
function
|
|
5085
|
+
function Hu() {
|
|
5093
5086
|
return typeof window < "u" || typeof chrome < "u";
|
|
5094
5087
|
}
|
|
5095
5088
|
const Tr = {
|
|
@@ -5098,7 +5091,7 @@ const Tr = {
|
|
|
5098
5091
|
"refresh-presence": !0,
|
|
5099
5092
|
"patch-presence": !0
|
|
5100
5093
|
};
|
|
5101
|
-
function
|
|
5094
|
+
function Yu(t, e) {
|
|
5102
5095
|
var n;
|
|
5103
5096
|
const r = typeof t == "string" ? JSON.parse(t) : t;
|
|
5104
5097
|
if (!((n = r == null ? void 0 : r.result) === null || n === void 0) && n.store) {
|
|
@@ -5107,12 +5100,12 @@ function Ju(t, e) {
|
|
|
5107
5100
|
}
|
|
5108
5101
|
return r;
|
|
5109
5102
|
}
|
|
5110
|
-
function
|
|
5103
|
+
function Ju(t, e) {
|
|
5111
5104
|
var n;
|
|
5112
5105
|
const r = Object.assign({}, e);
|
|
5113
5106
|
return !((n = e.result) === null || n === void 0) && n.store && (r.result = Object.assign(Object.assign({}, e.result), { store: Ur(e.result.store) })), r;
|
|
5114
5107
|
}
|
|
5115
|
-
function
|
|
5108
|
+
function Zu(t, e) {
|
|
5116
5109
|
switch (t) {
|
|
5117
5110
|
case "pendingMutations":
|
|
5118
5111
|
return new Map(typeof e == "string" ? JSON.parse(e) : e);
|
|
@@ -5120,7 +5113,7 @@ function Xu(t, e) {
|
|
|
5120
5113
|
return e;
|
|
5121
5114
|
}
|
|
5122
5115
|
}
|
|
5123
|
-
function
|
|
5116
|
+
function Xu(t, e) {
|
|
5124
5117
|
switch (t) {
|
|
5125
5118
|
case "pendingMutations":
|
|
5126
5119
|
return [...e.entries()];
|
|
@@ -5128,7 +5121,7 @@ function ea(t, e) {
|
|
|
5128
5121
|
return e;
|
|
5129
5122
|
}
|
|
5130
5123
|
}
|
|
5131
|
-
function
|
|
5124
|
+
function ea(t, e, n) {
|
|
5132
5125
|
const r = e == null ? void 0 : e.result, i = n == null ? void 0 : n.result;
|
|
5133
5126
|
return r && !i && n && (n.result = r), n || e;
|
|
5134
5127
|
}
|
|
@@ -5138,7 +5131,7 @@ function mr(t) {
|
|
|
5138
5131
|
return u == a ? r < s ? -1 : r > s ? 1 : 0 : u - a;
|
|
5139
5132
|
});
|
|
5140
5133
|
}
|
|
5141
|
-
class
|
|
5134
|
+
class ta {
|
|
5142
5135
|
constructor(e, n = ti, r = ni, i, s) {
|
|
5143
5136
|
var o, u, a;
|
|
5144
5137
|
if (this._isOnline = !0, this._isShutdown = !1, this.status = se.CONNECTING, this.queryCbs = {}, this.queryOnceDfds = {}, this.authCbs = [], this.attrsCbs = [], this.mutationErrorCbs = [], this.connectionStatusCbs = [], this.mutationDeferredStore = /* @__PURE__ */ new Map(), this._reconnectTimeoutId = null, this._reconnectTimeoutMs = 0, this._transportType = "ws", this._wsOk = null, this._localIdPromises = {}, this._errorMessage = null, this._oauthCallbackResponse = null, this._linkIndex = null, this._rooms = {}, this._roomsPendingLeave = {}, this._presence = {}, this._broadcastQueue = [], this._broadcastSubs = {}, this._currentUserCached = { isLoading: !0, error: void 0, user: void 0 }, this._beforeUnloadCbs = [], this._dataForQueryCache = {}, this._inFlightMutationEventIds = /* @__PURE__ */ new Set(), this._onMergeKv = (d, c, f) => {
|
|
@@ -5146,9 +5139,9 @@ class na {
|
|
|
5146
5139
|
switch (d) {
|
|
5147
5140
|
case "pendingMutations": {
|
|
5148
5141
|
const y = (l = c == null ? void 0 : c.entries()) !== null && l !== void 0 ? l : [], b = (p = f == null ? void 0 : f.entries()) !== null && p !== void 0 ? p : [], g = new Map([...y, ...b]);
|
|
5149
|
-
return (c ? this._rewriteMutationsSorted(this.attrs, c) : []).forEach(([
|
|
5142
|
+
return (c ? this._rewriteMutationsSorted(this.attrs, c) : []).forEach(([m, v]) => {
|
|
5150
5143
|
var k;
|
|
5151
|
-
!(!((k = f == null ? void 0 : f.pendingMutations) === null || k === void 0) && k.has(
|
|
5144
|
+
!(!((k = f == null ? void 0 : f.pendingMutations) === null || k === void 0) && k.has(m)) && !v["tx-id"] && this._sendMutation(m, v);
|
|
5152
5145
|
}), g;
|
|
5153
5146
|
}
|
|
5154
5147
|
default:
|
|
@@ -5257,10 +5250,10 @@ class na {
|
|
|
5257
5250
|
return;
|
|
5258
5251
|
}
|
|
5259
5252
|
this._log.info("[socket][close]", c.id, "schedule reconnect, ms =", this._reconnectTimeoutMs), this._scheduleReconnect();
|
|
5260
|
-
}, this._EventSource = s, this.config = Object.assign(Object.assign({},
|
|
5253
|
+
}, this._EventSource = s, this.config = Object.assign(Object.assign({}, Gu), e), this.queryCacheLimit = (o = this.config.queryCacheLimit) !== null && o !== void 0 ? o : 10, this._pendingTxCleanupTimeout = (u = this.config.pendingTxCleanupTimeout) !== null && u !== void 0 ? u : Wu, this._pendingMutationCleanupThreshold = (a = this.config.pendingMutationCleanupThreshold) !== null && a !== void 0 ? a : Bu, this._log = Au(e.verbose || pn || ri, () => this._reactorStats()), this.versions = Object.assign(Object.assign({}, i || {}), { "@instantdb/core": oi }), this.config.schema && (this._linkIndex = ar(this.config.schema)), !!Hu()) {
|
|
5261
5254
|
if (!e.appId)
|
|
5262
5255
|
throw new Error("Instant must be initialized with an appId.");
|
|
5263
|
-
if (!
|
|
5256
|
+
if (!Ae(e.appId))
|
|
5264
5257
|
throw new Error(`Instant must be initialized with a valid appId. \`${e.appId}\` is not a valid uuid.`);
|
|
5265
5258
|
typeof BroadcastChannel == "function" && (this._broadcastChannel = new BroadcastChannel("@instantdb"), this._broadcastChannel.addEventListener("message", (d) => U(this, void 0, void 0, function* () {
|
|
5266
5259
|
var c;
|
|
@@ -5272,7 +5265,7 @@ class na {
|
|
|
5272
5265
|
} catch (f) {
|
|
5273
5266
|
this._log.error("[error] handle broadcast channel", f);
|
|
5274
5267
|
}
|
|
5275
|
-
}))), this._initStorage(n), this._syncTable = new
|
|
5268
|
+
}))), this._initStorage(n), this._syncTable = new qu(this._trySendAuthed.bind(this), new n(this.config.appId, "syncSubs"), {
|
|
5276
5269
|
useDateObjects: this.config.useDateObjects
|
|
5277
5270
|
}, this._log, (d) => at(this.attrs, d, this.config.enableCardinalityInference, this._linkIndex, this.config.useDateObjects)), this._oauthCallbackResponse = this._oauthLoginInit(), this.getCurrentUser(), r.getIsOnline().then((d) => {
|
|
5278
5271
|
this._isOnline = d, this._startSocket(), r.listen((c) => {
|
|
@@ -5297,9 +5290,9 @@ class na {
|
|
|
5297
5290
|
_initStorage(e) {
|
|
5298
5291
|
this.querySubs = new Jt({
|
|
5299
5292
|
persister: new e(this.config.appId, "querySubs"),
|
|
5300
|
-
merge:
|
|
5301
|
-
serialize:
|
|
5302
|
-
parse: (n, r) =>
|
|
5293
|
+
merge: ea,
|
|
5294
|
+
serialize: Ju,
|
|
5295
|
+
parse: (n, r) => Yu(r, this.config.useDateObjects),
|
|
5303
5296
|
// objectSize
|
|
5304
5297
|
objectSize: (n) => {
|
|
5305
5298
|
var r, i, s, o;
|
|
@@ -5318,8 +5311,8 @@ class na {
|
|
|
5318
5311
|
}), this.querySubs.onKeyLoaded = (n) => this._onQuerySubLoaded(n), this.kv = new Jt({
|
|
5319
5312
|
persister: new e(this.config.appId, "kv"),
|
|
5320
5313
|
merge: this._onMergeKv,
|
|
5321
|
-
serialize:
|
|
5322
|
-
parse:
|
|
5314
|
+
serialize: Xu,
|
|
5315
|
+
parse: Zu,
|
|
5323
5316
|
objectSize: () => 0,
|
|
5324
5317
|
logger: this._log,
|
|
5325
5318
|
saveThrottleMs: 100,
|
|
@@ -5328,7 +5321,7 @@ class na {
|
|
|
5328
5321
|
gc: null
|
|
5329
5322
|
}), this.kv.onKeyLoaded = (n) => {
|
|
5330
5323
|
n === "pendingMutations" && this.notifyAll();
|
|
5331
|
-
}, this.kv.waitForKeyToLoad("pendingMutations"), this.kv.waitForKeyToLoad(
|
|
5324
|
+
}, this.kv.waitForKeyToLoad("pendingMutations"), this.kv.waitForKeyToLoad(De), this._beforeUnloadCbs.push(() => {
|
|
5332
5325
|
this.kv.flush(), this.querySubs.flush();
|
|
5333
5326
|
});
|
|
5334
5327
|
}
|
|
@@ -5350,14 +5343,14 @@ class na {
|
|
|
5350
5343
|
if (s)
|
|
5351
5344
|
i.resolve({ status: e, eventId: n });
|
|
5352
5345
|
else if (r.type) {
|
|
5353
|
-
const { status: o } = r, u =
|
|
5346
|
+
const { status: o } = r, u = zu(r, ["status"]);
|
|
5354
5347
|
i.reject(new bt({
|
|
5355
5348
|
// @ts-expect-error body.type is not constant typed
|
|
5356
5349
|
body: u,
|
|
5357
5350
|
status: o
|
|
5358
5351
|
}));
|
|
5359
5352
|
} else
|
|
5360
|
-
i.reject(new
|
|
5353
|
+
i.reject(new ke(r.message, r.hint));
|
|
5361
5354
|
}
|
|
5362
5355
|
_setStatus(e, n) {
|
|
5363
5356
|
this.status = e, this._errorMessage = n, this.notifyConnectionStatusSubs(e);
|
|
@@ -5391,14 +5384,14 @@ class na {
|
|
|
5391
5384
|
const { q: l, result: p } = n, y = K(l);
|
|
5392
5385
|
if (!this._hasQueryListeners() && !this.querySubs.currentValue[y])
|
|
5393
5386
|
break;
|
|
5394
|
-
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,
|
|
5387
|
+
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, T = ur(p), m = at(this.attrs, T, d, this._linkIndex, this.config.useDateObjects);
|
|
5395
5388
|
this.querySubs.updateInPlace((v) => {
|
|
5396
5389
|
if (!v[y]) {
|
|
5397
5390
|
this._log.info("Missing value in querySubs", { hash: y, q: l });
|
|
5398
5391
|
return;
|
|
5399
5392
|
}
|
|
5400
5393
|
v[y].result = {
|
|
5401
|
-
store:
|
|
5394
|
+
store: m,
|
|
5402
5395
|
pageInfo: b,
|
|
5403
5396
|
aggregate: g,
|
|
5404
5397
|
processedTxId: n["processed-tx-id"]
|
|
@@ -5426,24 +5419,24 @@ class na {
|
|
|
5426
5419
|
const { computations: l, attrs: p } = n, y = n["processed-tx-id"];
|
|
5427
5420
|
p && this._setAttrs(p), this._cleanupPendingMutationsTimeout();
|
|
5428
5421
|
const b = this._rewriteMutations(this.attrs, this._pendingMutations(), y);
|
|
5429
|
-
b !== this._pendingMutations() && this.kv.updateInPlace((
|
|
5430
|
-
|
|
5422
|
+
b !== this._pendingMutations() && this.kv.updateInPlace((m) => {
|
|
5423
|
+
m.pendingMutations = b;
|
|
5431
5424
|
});
|
|
5432
|
-
const g = mr(b.entries()),
|
|
5433
|
-
var v, k,
|
|
5434
|
-
const R =
|
|
5425
|
+
const g = mr(b.entries()), T = l.map((m) => {
|
|
5426
|
+
var v, k, O, I;
|
|
5427
|
+
const R = m["instaql-query"], F = m["instaql-result"], le = K(R), Qe = ur(F), _t = at(this.attrs, Qe, d, this._linkIndex, this.config.useDateObjects), gt = this._applyOptimisticUpdates(_t, g, y), He = (k = (v = F == null ? void 0 : F[0]) === null || v === void 0 ? void 0 : v.data) === null || k === void 0 ? void 0 : k["page-info"], ne = (I = (O = F == null ? void 0 : F[0]) === null || O === void 0 ? void 0 : O.data) === null || I === void 0 ? void 0 : I.aggregate;
|
|
5435
5428
|
return { q: R, hash: le, store: gt, pageInfo: He, aggregate: ne };
|
|
5436
5429
|
});
|
|
5437
|
-
|
|
5430
|
+
T.forEach(({ hash: m, q: v, store: k, pageInfo: O, aggregate: I }) => {
|
|
5438
5431
|
this.querySubs.updateInPlace((R) => {
|
|
5439
|
-
if (!R[
|
|
5440
|
-
this._log.error("Missing value in querySubs", { hash:
|
|
5432
|
+
if (!R[m]) {
|
|
5433
|
+
this._log.error("Missing value in querySubs", { hash: m, q: v });
|
|
5441
5434
|
return;
|
|
5442
5435
|
}
|
|
5443
|
-
R[
|
|
5436
|
+
R[m].result = { store: k, pageInfo: O, aggregate: I, processedTxId: y };
|
|
5444
5437
|
});
|
|
5445
|
-
}), this._cleanupPendingMutationsQueries(),
|
|
5446
|
-
this.notifyOne(
|
|
5438
|
+
}), this._cleanupPendingMutationsQueries(), T.forEach(({ hash: m }) => {
|
|
5439
|
+
this.notifyOne(m);
|
|
5447
5440
|
});
|
|
5448
5441
|
break;
|
|
5449
5442
|
}
|
|
@@ -5453,10 +5446,10 @@ class na {
|
|
|
5453
5446
|
const b = this._rewriteMutations(this.attrs, this._pendingMutations()).get(l);
|
|
5454
5447
|
if (!b)
|
|
5455
5448
|
break;
|
|
5456
|
-
this._updatePendingMutations((
|
|
5457
|
-
|
|
5449
|
+
this._updatePendingMutations((T) => {
|
|
5450
|
+
T.set(l, Object.assign(Object.assign({}, T.get(l)), { "tx-id": p, confirmed: Date.now() }));
|
|
5458
5451
|
});
|
|
5459
|
-
const g = b["tx-steps"].filter(([
|
|
5452
|
+
const g = b["tx-steps"].filter(([T, ...m]) => T === "add-attr").map(([T, m]) => m).concat(Object.values(this.attrs));
|
|
5460
5453
|
this._setAttrs(g), this._finishTransaction("synced", l), this._cleanupPendingMutationsTimeout();
|
|
5461
5454
|
break;
|
|
5462
5455
|
}
|
|
@@ -5609,7 +5602,7 @@ class na {
|
|
|
5609
5602
|
if (!this.querySubs)
|
|
5610
5603
|
return i.reject(new Error("We can't run `queryOnce` on the backend. Use adminAPI.query instead: https://www.instantdb.com/docs/backend#query")), i.promise;
|
|
5611
5604
|
const s = K(e), o = this._startQuerySub(e, s);
|
|
5612
|
-
return this.queryOnceDfds[s] = (r = this.queryOnceDfds[s]) !== null && r !== void 0 ? r : [], this.queryOnceDfds[s].push({ q: e, dfd: i, eventId: o }), setTimeout(() => i.reject(new Error("Query timed out")),
|
|
5605
|
+
return this.queryOnceDfds[s] = (r = this.queryOnceDfds[s]) !== null && r !== void 0 ? r : [], this.queryOnceDfds[s].push({ q: e, dfd: i, eventId: o }), setTimeout(() => i.reject(new Error("Query timed out")), Vu), i.promise;
|
|
5613
5606
|
}
|
|
5614
5607
|
_completeQueryOnce(e, n, r) {
|
|
5615
5608
|
this.queryOnceDfds[n] && (this.queryOnceDfds[n] = this.queryOnceDfds[n].filter((i) => i.dfd !== r), this._cleanupQuery(e, n));
|
|
@@ -5653,15 +5646,15 @@ class na {
|
|
|
5653
5646
|
for (const p of c) {
|
|
5654
5647
|
const [y] = p;
|
|
5655
5648
|
if (y === "add-attr") {
|
|
5656
|
-
const [g,
|
|
5657
|
-
if (
|
|
5658
|
-
o.attrIdMap[
|
|
5649
|
+
const [g, T] = p, m = i(T);
|
|
5650
|
+
if (m && T.id !== m.id) {
|
|
5651
|
+
o.attrIdMap[T.id] = m.id, u = !0;
|
|
5659
5652
|
continue;
|
|
5660
5653
|
}
|
|
5661
|
-
if (
|
|
5662
|
-
const v = s(
|
|
5654
|
+
if (T["value-type"] === "ref") {
|
|
5655
|
+
const v = s(T);
|
|
5663
5656
|
if (v) {
|
|
5664
|
-
o.attrIdMap[
|
|
5657
|
+
o.attrIdMap[T.id] = v.id, o.refSwapAttrIds.add(T.id), u = !0;
|
|
5665
5658
|
continue;
|
|
5666
5659
|
}
|
|
5667
5660
|
}
|
|
@@ -5831,7 +5824,7 @@ class na {
|
|
|
5831
5824
|
return;
|
|
5832
5825
|
}
|
|
5833
5826
|
const e = this._transport;
|
|
5834
|
-
this._transport =
|
|
5827
|
+
this._transport = Qu({
|
|
5835
5828
|
transportType: this._transportType,
|
|
5836
5829
|
appId: this.config.appId,
|
|
5837
5830
|
apiURI: this.config.apiURI,
|
|
@@ -5941,7 +5934,7 @@ class na {
|
|
|
5941
5934
|
return U(this, void 0, void 0, function* () {
|
|
5942
5935
|
const { user: e, error: n } = yield this.getCurrentUser();
|
|
5943
5936
|
if (n)
|
|
5944
|
-
throw new
|
|
5937
|
+
throw new ke("Could not get current user: " + n.message);
|
|
5945
5938
|
return e;
|
|
5946
5939
|
});
|
|
5947
5940
|
}
|
|
@@ -5973,8 +5966,8 @@ class na {
|
|
|
5973
5966
|
setCurrentUser(e) {
|
|
5974
5967
|
return U(this, void 0, void 0, function* () {
|
|
5975
5968
|
this.kv.updateInPlace((n) => {
|
|
5976
|
-
n[
|
|
5977
|
-
}), yield this.kv.waitForKeyToLoad(
|
|
5969
|
+
n[De] = e;
|
|
5970
|
+
}), yield this.kv.waitForKeyToLoad(De);
|
|
5978
5971
|
});
|
|
5979
5972
|
}
|
|
5980
5973
|
getCurrentUserCached() {
|
|
@@ -5982,7 +5975,7 @@ class na {
|
|
|
5982
5975
|
}
|
|
5983
5976
|
_getCurrentUser() {
|
|
5984
5977
|
return U(this, void 0, void 0, function* () {
|
|
5985
|
-
const e = yield this.kv.waitForKeyToLoad(
|
|
5978
|
+
const e = yield this.kv.waitForKeyToLoad(De);
|
|
5986
5979
|
return typeof e == "string" ? JSON.parse(e) : e;
|
|
5987
5980
|
});
|
|
5988
5981
|
}
|
|
@@ -6007,7 +6000,7 @@ class na {
|
|
|
6007
6000
|
}
|
|
6008
6001
|
_hasCurrentUser() {
|
|
6009
6002
|
return U(this, void 0, void 0, function* () {
|
|
6010
|
-
const e = yield this.kv.waitForKeyToLoad(
|
|
6003
|
+
const e = yield this.kv.waitForKeyToLoad(De);
|
|
6011
6004
|
return typeof e == "string" ? JSON.parse(e) != null : e != null;
|
|
6012
6005
|
});
|
|
6013
6006
|
}
|
|
@@ -6347,9 +6340,9 @@ class na {
|
|
|
6347
6340
|
}
|
|
6348
6341
|
}
|
|
6349
6342
|
let it;
|
|
6350
|
-
function
|
|
6343
|
+
function na(t, e) {
|
|
6351
6344
|
it == null || it.dispose();
|
|
6352
|
-
const n =
|
|
6345
|
+
const n = aa(e), r = sa(e, u), i = ia(ra(t));
|
|
6353
6346
|
function s(c) {
|
|
6354
6347
|
var f;
|
|
6355
6348
|
c.source === i.element.contentWindow && ((f = c.data) === null || f === void 0 ? void 0 : f.type) === "close" && n.isVisible() && u();
|
|
@@ -6371,10 +6364,10 @@ function ra(t, e) {
|
|
|
6371
6364
|
}
|
|
6372
6365
|
return d();
|
|
6373
6366
|
}
|
|
6374
|
-
function
|
|
6367
|
+
function ra(t) {
|
|
6375
6368
|
return `${pn || ii ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${t}`;
|
|
6376
6369
|
}
|
|
6377
|
-
function
|
|
6370
|
+
function ia(t) {
|
|
6378
6371
|
const e = document.createElement("iframe");
|
|
6379
6372
|
return e.src = t, e.className = "instant-devtool-iframe", Object.assign(e.style, {
|
|
6380
6373
|
width: "100%",
|
|
@@ -6383,7 +6376,7 @@ function sa(t) {
|
|
|
6383
6376
|
border: "none"
|
|
6384
6377
|
}), { element: e };
|
|
6385
6378
|
}
|
|
6386
|
-
function
|
|
6379
|
+
function sa(t, e) {
|
|
6387
6380
|
const n = `
|
|
6388
6381
|
<svg width="32" height="32" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
6389
6382
|
<rect width="512" height="512" fill="black"/>
|
|
@@ -6393,7 +6386,7 @@ function oa(t, e) {
|
|
|
6393
6386
|
return r.innerHTML = n, r.className = "instant-devtool-toggler", Object.assign(r.style, Object.assign(Object.assign({
|
|
6394
6387
|
// pos
|
|
6395
6388
|
position: "fixed"
|
|
6396
|
-
},
|
|
6389
|
+
}, oa(t.position)), {
|
|
6397
6390
|
height: "32px",
|
|
6398
6391
|
width: "32px",
|
|
6399
6392
|
// layout
|
|
@@ -6408,7 +6401,7 @@ function oa(t, e) {
|
|
|
6408
6401
|
cursor: "pointer"
|
|
6409
6402
|
})), r.addEventListener("click", e), { element: r };
|
|
6410
6403
|
}
|
|
6411
|
-
function
|
|
6404
|
+
function oa(t) {
|
|
6412
6405
|
switch (t) {
|
|
6413
6406
|
case "bottom-left":
|
|
6414
6407
|
return { bottom: "24px", left: "24px" };
|
|
@@ -6420,7 +6413,7 @@ function ua(t) {
|
|
|
6420
6413
|
return { top: "24px", left: "24px" };
|
|
6421
6414
|
}
|
|
6422
6415
|
}
|
|
6423
|
-
function
|
|
6416
|
+
function ua(t) {
|
|
6424
6417
|
switch (t) {
|
|
6425
6418
|
case "bottom-left":
|
|
6426
6419
|
return { bottom: "24px", right: "24px", left: "60px", top: "72px" };
|
|
@@ -6432,23 +6425,23 @@ function aa(t) {
|
|
|
6432
6425
|
return { top: "24px", right: "24px", left: "60px", bottom: "72px" };
|
|
6433
6426
|
}
|
|
6434
6427
|
}
|
|
6435
|
-
function
|
|
6428
|
+
function aa(t) {
|
|
6436
6429
|
const e = document.createElement("div");
|
|
6437
|
-
Object.assign(e.style, Object.assign(Object.assign({ position: "fixed" },
|
|
6430
|
+
Object.assign(e.style, Object.assign(Object.assign({ position: "fixed" }, ua(t.position)), { display: "block", borderRadius: "4px", border: "1px #ccc solid", boxShadow: "0px 0px 8px #00000044", backgroundColor: "#eee", zIndex: "999990" })), e.style.display = "none", e.className = "instant-devtool-container";
|
|
6438
6431
|
function n() {
|
|
6439
6432
|
return e.style.display !== "none";
|
|
6440
6433
|
}
|
|
6441
6434
|
return { element: e, isVisible: n };
|
|
6442
6435
|
}
|
|
6443
|
-
const
|
|
6436
|
+
const ca = {
|
|
6444
6437
|
apiURI: "https://api.instantdb.com",
|
|
6445
6438
|
websocketURI: "wss://api.instantdb.com/runtime/session"
|
|
6446
6439
|
};
|
|
6447
|
-
function
|
|
6440
|
+
function da() {
|
|
6448
6441
|
var t;
|
|
6449
6442
|
return globalThis.__instantDbSchemaHashStore = (t = globalThis.__instantDbSchemaHashStore) !== null && t !== void 0 ? t : /* @__PURE__ */ new WeakMap(), globalThis.__instantDbSchemaHashStore;
|
|
6450
6443
|
}
|
|
6451
|
-
function
|
|
6444
|
+
function fa() {
|
|
6452
6445
|
var t;
|
|
6453
6446
|
return globalThis.__instantDbStore = (t = globalThis.__instantDbStore) !== null && t !== void 0 ? t : {}, globalThis.__instantDbStore;
|
|
6454
6447
|
}
|
|
@@ -6456,23 +6449,23 @@ function Zt(t) {
|
|
|
6456
6449
|
const e = t.__adminToken;
|
|
6457
6450
|
return t.appId + "_" + (t.websocketURI || "default_ws_uri") + "_" + (t.apiURI || "default_api_uri") + "_" + (e || "client_only") + "_" + t.useDateObjects;
|
|
6458
6451
|
}
|
|
6459
|
-
const Xt =
|
|
6460
|
-
class
|
|
6452
|
+
const Xt = fa(), Mt = da();
|
|
6453
|
+
class la {
|
|
6461
6454
|
constructor(e) {
|
|
6462
6455
|
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);
|
|
6463
6456
|
}
|
|
6464
6457
|
}
|
|
6465
|
-
class
|
|
6458
|
+
class ha {
|
|
6466
6459
|
constructor(e) {
|
|
6467
6460
|
this.db = e, this.uploadFile = (n, r, i = {}) => this.db.uploadFile(n, r, i), this.delete = (n) => this.db.deleteFile(n), this.upload = (n, r) => this.db.upload(n, r), this.put = this.upload, this.getDownloadUrl = (n) => this.db.getDownloadUrl(n);
|
|
6468
6461
|
}
|
|
6469
6462
|
}
|
|
6470
|
-
function
|
|
6463
|
+
function pa(t) {
|
|
6471
6464
|
return JSON.parse(JSON.stringify(t));
|
|
6472
6465
|
}
|
|
6473
|
-
class
|
|
6466
|
+
class ya {
|
|
6474
6467
|
constructor(e) {
|
|
6475
|
-
this.tx = hn(), this._reactor = e, this.auth = new
|
|
6468
|
+
this.tx = hn(), this._reactor = e, this.auth = new la(this._reactor), this.storage = new ha(this._reactor);
|
|
6476
6469
|
}
|
|
6477
6470
|
/**
|
|
6478
6471
|
* Use this to write data! You can create, update, delete, and link objects
|
|
@@ -6654,23 +6647,23 @@ function wr(t) {
|
|
|
6654
6647
|
const e = K(t);
|
|
6655
6648
|
return Mt.set(t, e), e;
|
|
6656
6649
|
}
|
|
6657
|
-
function
|
|
6650
|
+
function ba(t, e) {
|
|
6658
6651
|
return wr(t._reactor.config.schema) !== wr(e);
|
|
6659
6652
|
}
|
|
6660
|
-
function
|
|
6653
|
+
function _a(t, e, n, r, i) {
|
|
6661
6654
|
const s = Xt[Zt(t)];
|
|
6662
6655
|
if (s)
|
|
6663
|
-
return
|
|
6664
|
-
const o = new
|
|
6665
|
-
return Xt[Zt(t)] = u,
|
|
6656
|
+
return ba(s, t.schema) && s._reactor.updateSchema(t.schema), s;
|
|
6657
|
+
const o = new ta(Object.assign(Object.assign(Object.assign({}, ca), t), { cardinalityInference: !!t.schema }), e || ti, n || ni, Object.assign(Object.assign({}, r || {}), { "@instantdb/core": oi }), i), u = new ya(o);
|
|
6658
|
+
return Xt[Zt(t)] = u, ga(t.appId, t.devtool), u;
|
|
6666
6659
|
}
|
|
6667
|
-
function
|
|
6660
|
+
function ga(t, e) {
|
|
6668
6661
|
if (typeof window > "u" || typeof window.location > "u" || typeof document > "u" || typeof e == "boolean" && !e)
|
|
6669
6662
|
return;
|
|
6670
6663
|
const n = Object.assign({ position: "bottom-right", allowedHosts: ["localhost"] }, typeof e == "object" ? e : {});
|
|
6671
|
-
n.allowedHosts.includes(window.location.hostname) &&
|
|
6664
|
+
n.allowedHosts.includes(window.location.hostname) && na(t, n);
|
|
6672
6665
|
}
|
|
6673
|
-
const
|
|
6666
|
+
const Ta = {
|
|
6674
6667
|
isLoading: !0,
|
|
6675
6668
|
data: void 0,
|
|
6676
6669
|
pageInfo: void 0,
|
|
@@ -6685,9 +6678,9 @@ function vr(t) {
|
|
|
6685
6678
|
...t || {}
|
|
6686
6679
|
};
|
|
6687
6680
|
}
|
|
6688
|
-
function
|
|
6681
|
+
function ma(t, e, n) {
|
|
6689
6682
|
e && n && "ruleParams" in n && (e = { $$ruleParams: n.ruleParams, ...e });
|
|
6690
|
-
const r = e ?
|
|
6683
|
+
const r = e ? pa(e) : null, i = K(r), s = ze(
|
|
6691
6684
|
vr(t._reactor.getPreviousResult(r))
|
|
6692
6685
|
), o = de(
|
|
6693
6686
|
(a) => (s.current = vr(
|
|
@@ -6708,11 +6701,11 @@ function wa(t, e, n) {
|
|
|
6708
6701
|
return { state: Rt(
|
|
6709
6702
|
o,
|
|
6710
6703
|
() => s.current,
|
|
6711
|
-
() =>
|
|
6704
|
+
() => Ta
|
|
6712
6705
|
), query: r };
|
|
6713
6706
|
}
|
|
6714
|
-
function
|
|
6715
|
-
const t =
|
|
6707
|
+
function wa() {
|
|
6708
|
+
const t = ze(null);
|
|
6716
6709
|
Te(() => {
|
|
6717
6710
|
n();
|
|
6718
6711
|
}, []);
|
|
@@ -6724,9 +6717,9 @@ function va() {
|
|
|
6724
6717
|
}
|
|
6725
6718
|
return { set: e, clear: n };
|
|
6726
6719
|
}
|
|
6727
|
-
const
|
|
6728
|
-
function
|
|
6729
|
-
const r =
|
|
6720
|
+
const va = 1e3;
|
|
6721
|
+
function Sa(t, e, n) {
|
|
6722
|
+
const r = ze(n);
|
|
6730
6723
|
r.current = n, Te(() => t.core._reactor.subscribeTopic(
|
|
6731
6724
|
t.id,
|
|
6732
6725
|
e,
|
|
@@ -6735,7 +6728,7 @@ function Oa(t, e, n) {
|
|
|
6735
6728
|
}
|
|
6736
6729
|
), [t.id, e]);
|
|
6737
6730
|
}
|
|
6738
|
-
function
|
|
6731
|
+
function Oa(t, e) {
|
|
6739
6732
|
return Te(() => t.core._reactor.joinRoom(t.id), [t.id]), de(
|
|
6740
6733
|
(r) => {
|
|
6741
6734
|
t.core._reactor.publishTopic({
|
|
@@ -6748,7 +6741,7 @@ function Ea(t, e) {
|
|
|
6748
6741
|
[t.id, e]
|
|
6749
6742
|
);
|
|
6750
6743
|
}
|
|
6751
|
-
function
|
|
6744
|
+
function Ea(t, e = {}) {
|
|
6752
6745
|
var o, u;
|
|
6753
6746
|
const [n, r] = Or(() => t.core._reactor.getPresence(t.type, t.id, e) ?? {
|
|
6754
6747
|
peers: {},
|
|
@@ -6773,11 +6766,11 @@ function Aa(t, e = {}) {
|
|
|
6773
6766
|
publishPresence: i
|
|
6774
6767
|
}), [n, i]);
|
|
6775
6768
|
}
|
|
6776
|
-
function
|
|
6769
|
+
function Aa(t, e, n) {
|
|
6777
6770
|
Te(() => t.core._reactor.joinRoom(t.id, e), [t.id]), Te(() => t.core._reactor.publishPresence(t.type, t.id, e), [t.type, t.id, n ?? JSON.stringify(e)]);
|
|
6778
6771
|
}
|
|
6779
|
-
function
|
|
6780
|
-
const r =
|
|
6772
|
+
function ja(t, e, n = {}) {
|
|
6773
|
+
const r = wa(), i = be.usePresence(t, {
|
|
6781
6774
|
keys: [e]
|
|
6782
6775
|
}), s = $t(() => {
|
|
6783
6776
|
const c = t._core._reactor.getPresence(
|
|
@@ -6791,7 +6784,7 @@ function ka(t, e, n = {}) {
|
|
|
6791
6784
|
(c) => {
|
|
6792
6785
|
t.core._reactor.publishPresence(t.type, t.id, {
|
|
6793
6786
|
[e]: c
|
|
6794
|
-
}), c && ((n == null ? void 0 : n.timeout) === null || (n == null ? void 0 : n.timeout) === 0 || r.set((n == null ? void 0 : n.timeout) ??
|
|
6787
|
+
}), c && ((n == null ? void 0 : n.timeout) === null || (n == null ? void 0 : n.timeout) === 0 || r.set((n == null ? void 0 : n.timeout) ?? va, () => {
|
|
6795
6788
|
t.core._reactor.publishPresence(t.type, t.id, {
|
|
6796
6789
|
[e]: null
|
|
6797
6790
|
});
|
|
@@ -6814,25 +6807,25 @@ function ka(t, e, n = {}) {
|
|
|
6814
6807
|
};
|
|
6815
6808
|
}
|
|
6816
6809
|
const be = {
|
|
6817
|
-
useTopicEffect:
|
|
6818
|
-
usePublishTopic:
|
|
6819
|
-
usePresence:
|
|
6820
|
-
useSyncPresence:
|
|
6821
|
-
useTypingIndicator:
|
|
6810
|
+
useTopicEffect: Sa,
|
|
6811
|
+
usePublishTopic: Oa,
|
|
6812
|
+
usePresence: Ea,
|
|
6813
|
+
useSyncPresence: Aa,
|
|
6814
|
+
useTypingIndicator: ja
|
|
6822
6815
|
};
|
|
6823
|
-
class
|
|
6816
|
+
class ka {
|
|
6824
6817
|
constructor(e, n, r) {
|
|
6825
6818
|
this.useTopicEffect = (i, s) => {
|
|
6826
6819
|
be.useTopicEffect(this, i, s);
|
|
6827
6820
|
}, this.usePublishTopic = (i) => be.usePublishTopic(this, i), this.usePresence = (i = {}) => be.usePresence(this, i), this.useSyncPresence = (i, s) => be.useSyncPresence(this, i, s), this.useTypingIndicator = (i, s = {}) => be.useTypingIndicator(this, i, s), this.core = e, this._core = this.core, this.type = n, this.id = r;
|
|
6828
6821
|
}
|
|
6829
6822
|
}
|
|
6830
|
-
const
|
|
6823
|
+
const Ca = {
|
|
6831
6824
|
isLoading: !0,
|
|
6832
6825
|
user: void 0,
|
|
6833
6826
|
error: void 0
|
|
6834
6827
|
};
|
|
6835
|
-
class
|
|
6828
|
+
class Ia {
|
|
6836
6829
|
constructor(e, n) {
|
|
6837
6830
|
this.tx = hn(), this.getLocalId = (r) => this.core.getLocalId(r), this.useLocalId = (r) => {
|
|
6838
6831
|
const [i, s] = Or(null);
|
|
@@ -6842,12 +6835,12 @@ class Ma {
|
|
|
6842
6835
|
s(u);
|
|
6843
6836
|
})();
|
|
6844
6837
|
}, [r]), i;
|
|
6845
|
-
}, this.rooms = be, this.transact = (r) => this.core.transact(r), this.useQuery = (r, i) =>
|
|
6838
|
+
}, this.rooms = be, this.transact = (r) => this.core.transact(r), this.useQuery = (r, i) => ma(
|
|
6846
6839
|
this.core,
|
|
6847
6840
|
r,
|
|
6848
6841
|
i
|
|
6849
6842
|
).state, this.useAuth = () => {
|
|
6850
|
-
const r =
|
|
6843
|
+
const r = ze(
|
|
6851
6844
|
this.core._reactor._currentUserCached
|
|
6852
6845
|
), i = de((o) => this.core.subscribeAuth((a) => {
|
|
6853
6846
|
r.current = { isLoading: !1, ...a }, o();
|
|
@@ -6855,17 +6848,17 @@ class Ma {
|
|
|
6855
6848
|
return Rt(
|
|
6856
6849
|
i,
|
|
6857
6850
|
() => r.current,
|
|
6858
|
-
() =>
|
|
6851
|
+
() => Ca
|
|
6859
6852
|
);
|
|
6860
6853
|
}, this.useUser = () => {
|
|
6861
6854
|
const { user: r } = this.useAuth();
|
|
6862
6855
|
if (!r)
|
|
6863
|
-
throw new
|
|
6856
|
+
throw new ke(
|
|
6864
6857
|
"useUser must be used within an auth-protected route"
|
|
6865
6858
|
);
|
|
6866
6859
|
return r;
|
|
6867
6860
|
}, this.useConnectionStatus = () => {
|
|
6868
|
-
const r =
|
|
6861
|
+
const r = ze(
|
|
6869
6862
|
this.core._reactor.status
|
|
6870
6863
|
), i = de((o) => this.core.subscribeConnectionStatus((a) => {
|
|
6871
6864
|
a !== r.current && (r.current = a, o());
|
|
@@ -6882,7 +6875,7 @@ class Ma {
|
|
|
6882
6875
|
}, this.SignedOut = ({ children: r }) => {
|
|
6883
6876
|
const i = this.useAuth();
|
|
6884
6877
|
return i.isLoading || i.error || i.user ? null : /* @__PURE__ */ et.jsx(et.Fragment, { children: r });
|
|
6885
|
-
}, this.core =
|
|
6878
|
+
}, this.core = _a(
|
|
6886
6879
|
e,
|
|
6887
6880
|
// @ts-expect-error because TS can't resolve subclass statics
|
|
6888
6881
|
this.constructor.Storage,
|
|
@@ -6906,7 +6899,7 @@ class Ma {
|
|
|
6906
6899
|
* const { peers } = db.rooms.usePresence(room);
|
|
6907
6900
|
*/
|
|
6908
6901
|
room(e = "_defaultRoomType", n = "_defaultRoomId") {
|
|
6909
|
-
return new
|
|
6902
|
+
return new ka(this.core, e, n);
|
|
6910
6903
|
}
|
|
6911
6904
|
/**
|
|
6912
6905
|
* One time query for the logged in state. This is useful
|
|
@@ -6923,5 +6916,5 @@ class Ma {
|
|
|
6923
6916
|
}
|
|
6924
6917
|
}
|
|
6925
6918
|
export {
|
|
6926
|
-
|
|
6919
|
+
Ia as InstantReactAbstractDatabase
|
|
6927
6920
|
};
|