@instantdb/react-common 0.22.88-experimental.drewh-ssr.20248787082.1 → 0.22.88-experimental.drewh-fix-explorer.20248904996.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commonjs/InstantReactAbstractDatabase.d.ts.map +1 -1
- package/dist/commonjs/InstantReactAbstractDatabase.js +0 -1
- package/dist/commonjs/InstantReactAbstractDatabase.js.map +1 -1
- package/dist/commonjs/useQuery.d.ts.map +1 -1
- package/dist/commonjs/useQuery.js +0 -3
- package/dist/commonjs/useQuery.js.map +1 -1
- package/dist/esm/InstantReactAbstractDatabase.d.ts.map +1 -1
- package/dist/esm/InstantReactAbstractDatabase.js +0 -1
- package/dist/esm/InstantReactAbstractDatabase.js.map +1 -1
- package/dist/esm/useQuery.d.ts.map +1 -1
- package/dist/esm/useQuery.js +0 -3
- package/dist/esm/useQuery.js.map +1 -1
- package/dist/standalone/index.js +375 -423
- package/dist/standalone/index.umd.cjs +10 -10
- package/package.json +3 -3
- package/src/InstantReactAbstractDatabase.tsx +1 -1
- package/src/useQuery.ts +0 -3
package/dist/standalone/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Sr, { useRef as
|
|
1
|
+
import Sr, { useRef as ze, useCallback as de, useSyncExternalStore as Mt, useEffect as ge, useMemo as Rt, useState as Or } from "react";
|
|
2
2
|
var $t = { exports: {} }, $e = {};
|
|
3
3
|
/**
|
|
4
4
|
* @license React
|
|
@@ -57,20 +57,20 @@ function Ki() {
|
|
|
57
57
|
{
|
|
58
58
|
var O = T.ReactDebugCurrentFrame, C = O.getStackAddendum();
|
|
59
59
|
C !== "" && (_ += "%s", w = w.concat([C]));
|
|
60
|
-
var
|
|
60
|
+
var P = w.map(function(j) {
|
|
61
61
|
return String(j);
|
|
62
62
|
});
|
|
63
|
-
|
|
63
|
+
P.unshift("Warning: " + _), Function.prototype.apply.call(console[h], console, P);
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
var S = !1,
|
|
67
|
-
|
|
66
|
+
var S = !1, I = !1, R = !1, q = !1, Ie = !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 ||
|
|
69
|
+
return !!(typeof h == "string" || typeof h == "function" || h === i || h === o || Ie || h === s || h === c || h === f || q || h === y || S || 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
76
|
var O = h.displayName;
|
|
@@ -79,7 +79,7 @@ function Ki() {
|
|
|
79
79
|
var C = _.displayName || _.name || "";
|
|
80
80
|
return C !== "" ? w + "(" + C + ")" : w;
|
|
81
81
|
}
|
|
82
|
-
function
|
|
82
|
+
function He(h) {
|
|
83
83
|
return h.displayName || "Context";
|
|
84
84
|
}
|
|
85
85
|
function ne(h) {
|
|
@@ -107,19 +107,19 @@ function Ki() {
|
|
|
107
107
|
switch (h.$$typeof) {
|
|
108
108
|
case a:
|
|
109
109
|
var _ = h;
|
|
110
|
-
return
|
|
110
|
+
return He(_) + ".Consumer";
|
|
111
111
|
case u:
|
|
112
112
|
var w = h;
|
|
113
|
-
return
|
|
113
|
+
return He(w._context) + ".Provider";
|
|
114
114
|
case d:
|
|
115
115
|
return gt(h, h.render, "ForwardRef");
|
|
116
116
|
case l:
|
|
117
117
|
var O = h.displayName || null;
|
|
118
118
|
return O !== null ? O : ne(h.type) || "Memo";
|
|
119
119
|
case p: {
|
|
120
|
-
var C = h,
|
|
120
|
+
var C = h, P = C._payload, j = C._init;
|
|
121
121
|
try {
|
|
122
|
-
return ne(j(
|
|
122
|
+
return ne(j(P));
|
|
123
123
|
} catch {
|
|
124
124
|
return null;
|
|
125
125
|
}
|
|
@@ -190,7 +190,7 @@ function Ki() {
|
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
192
|
var Tt = T.ReactCurrentDispatcher, mt;
|
|
193
|
-
function
|
|
193
|
+
function Ye(h, _, w) {
|
|
194
194
|
{
|
|
195
195
|
if (mt === void 0)
|
|
196
196
|
try {
|
|
@@ -203,16 +203,16 @@ function Ki() {
|
|
|
203
203
|
` + mt + h;
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
|
-
var wt = !1,
|
|
206
|
+
var wt = !1, Je;
|
|
207
207
|
{
|
|
208
208
|
var yi = typeof WeakMap == "function" ? WeakMap : Map;
|
|
209
|
-
|
|
209
|
+
Je = new yi();
|
|
210
210
|
}
|
|
211
211
|
function vn(h, _) {
|
|
212
212
|
if (!h || wt)
|
|
213
213
|
return "";
|
|
214
214
|
{
|
|
215
|
-
var w =
|
|
215
|
+
var w = Je.get(h);
|
|
216
216
|
if (w !== void 0)
|
|
217
217
|
return w;
|
|
218
218
|
}
|
|
@@ -220,8 +220,8 @@ function Ki() {
|
|
|
220
220
|
wt = !0;
|
|
221
221
|
var C = Error.prepareStackTrace;
|
|
222
222
|
Error.prepareStackTrace = void 0;
|
|
223
|
-
var
|
|
224
|
-
|
|
223
|
+
var P;
|
|
224
|
+
P = Tt.current, Tt.current = null, hi();
|
|
225
225
|
try {
|
|
226
226
|
if (_) {
|
|
227
227
|
var j = function() {
|
|
@@ -258,26 +258,26 @@ function Ki() {
|
|
|
258
258
|
if (W && O && typeof W.stack == "string") {
|
|
259
259
|
for (var E = W.stack.split(`
|
|
260
260
|
`), z = O.stack.split(`
|
|
261
|
-
`),
|
|
262
|
-
|
|
263
|
-
for (;
|
|
264
|
-
if (E[
|
|
265
|
-
if (
|
|
261
|
+
`), $ = E.length - 1, D = z.length - 1; $ >= 1 && D >= 0 && E[$] !== z[D]; )
|
|
262
|
+
D--;
|
|
263
|
+
for (; $ >= 1 && D >= 0; $--, D--)
|
|
264
|
+
if (E[$] !== z[D]) {
|
|
265
|
+
if ($ !== 1 || D !== 1)
|
|
266
266
|
do
|
|
267
|
-
if (
|
|
267
|
+
if ($--, D--, D < 0 || E[$] !== z[D]) {
|
|
268
268
|
var J = `
|
|
269
|
-
` + E[
|
|
270
|
-
return h.displayName && J.includes("<anonymous>") && (J = J.replace("<anonymous>", h.displayName)), typeof h == "function" &&
|
|
269
|
+
` + E[$].replace(" at new ", " at ");
|
|
270
|
+
return h.displayName && J.includes("<anonymous>") && (J = J.replace("<anonymous>", h.displayName)), typeof h == "function" && Je.set(h, J), J;
|
|
271
271
|
}
|
|
272
|
-
while (
|
|
272
|
+
while ($ >= 1 && D >= 0);
|
|
273
273
|
break;
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
276
|
} finally {
|
|
277
|
-
wt = !1, Tt.current =
|
|
277
|
+
wt = !1, Tt.current = P, pi(), Error.prepareStackTrace = C;
|
|
278
278
|
}
|
|
279
|
-
var ve = h ? h.displayName || h.name : "", he = ve ?
|
|
280
|
-
return typeof h == "function" &&
|
|
279
|
+
var ve = h ? h.displayName || h.name : "", he = ve ? Ye(ve) : "";
|
|
280
|
+
return typeof h == "function" && Je.set(h, he), he;
|
|
281
281
|
}
|
|
282
282
|
function bi(h, _, w) {
|
|
283
283
|
return vn(h, !1);
|
|
@@ -286,29 +286,29 @@ function Ki() {
|
|
|
286
286
|
var _ = h.prototype;
|
|
287
287
|
return !!(_ && _.isReactComponent);
|
|
288
288
|
}
|
|
289
|
-
function
|
|
289
|
+
function Ze(h, _, w) {
|
|
290
290
|
if (h == null)
|
|
291
291
|
return "";
|
|
292
292
|
if (typeof h == "function")
|
|
293
293
|
return vn(h, _i(h));
|
|
294
294
|
if (typeof h == "string")
|
|
295
|
-
return
|
|
295
|
+
return Ye(h);
|
|
296
296
|
switch (h) {
|
|
297
297
|
case c:
|
|
298
|
-
return
|
|
298
|
+
return Ye("Suspense");
|
|
299
299
|
case f:
|
|
300
|
-
return
|
|
300
|
+
return Ye("SuspenseList");
|
|
301
301
|
}
|
|
302
302
|
if (typeof h == "object")
|
|
303
303
|
switch (h.$$typeof) {
|
|
304
304
|
case d:
|
|
305
305
|
return bi(h.render);
|
|
306
306
|
case l:
|
|
307
|
-
return
|
|
307
|
+
return Ze(h.type, _, w);
|
|
308
308
|
case p: {
|
|
309
|
-
var O = h, C = O._payload,
|
|
309
|
+
var O = h, C = O._payload, P = O._init;
|
|
310
310
|
try {
|
|
311
|
-
return
|
|
311
|
+
return Ze(P(C), _, w);
|
|
312
312
|
} catch {
|
|
313
313
|
}
|
|
314
314
|
}
|
|
@@ -316,18 +316,18 @@ function Ki() {
|
|
|
316
316
|
return "";
|
|
317
317
|
}
|
|
318
318
|
var Re = Object.prototype.hasOwnProperty, Sn = {}, On = T.ReactDebugCurrentFrame;
|
|
319
|
-
function
|
|
319
|
+
function Xe(h) {
|
|
320
320
|
if (h) {
|
|
321
|
-
var _ = h._owner, w =
|
|
321
|
+
var _ = h._owner, w = Ze(h.type, h._source, _ ? _.type : null);
|
|
322
322
|
On.setExtraStackFrame(w);
|
|
323
323
|
} else
|
|
324
324
|
On.setExtraStackFrame(null);
|
|
325
325
|
}
|
|
326
326
|
function gi(h, _, w, O, C) {
|
|
327
327
|
{
|
|
328
|
-
var
|
|
328
|
+
var P = Function.call.bind(Re);
|
|
329
329
|
for (var j in h)
|
|
330
|
-
if (
|
|
330
|
+
if (P(h, j)) {
|
|
331
331
|
var E = void 0;
|
|
332
332
|
try {
|
|
333
333
|
if (typeof h[j] != "function") {
|
|
@@ -335,10 +335,10 @@ function Ki() {
|
|
|
335
335
|
throw z.name = "Invariant Violation", z;
|
|
336
336
|
}
|
|
337
337
|
E = h[j](_, j, O, w, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
338
|
-
} catch (
|
|
339
|
-
E =
|
|
338
|
+
} catch ($) {
|
|
339
|
+
E = $;
|
|
340
340
|
}
|
|
341
|
-
E && !(E instanceof Error) && (
|
|
341
|
+
E && !(E instanceof Error) && (Xe(C), v("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", O || "React class", w, j, typeof E), Xe(null)), E instanceof Error && !(E.message in Sn) && (Sn[E.message] = !0, Xe(C), v("Failed %s type: %s", w, E.message), Xe(null));
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
344
|
}
|
|
@@ -413,7 +413,7 @@ function Ki() {
|
|
|
413
413
|
});
|
|
414
414
|
}
|
|
415
415
|
}
|
|
416
|
-
var ki = function(h, _, w, O, C,
|
|
416
|
+
var ki = function(h, _, w, O, 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,
|
|
@@ -423,7 +423,7 @@ function Ki() {
|
|
|
423
423
|
ref: w,
|
|
424
424
|
props: j,
|
|
425
425
|
// Record the component responsible for creating this element.
|
|
426
|
-
_owner:
|
|
426
|
+
_owner: P
|
|
427
427
|
};
|
|
428
428
|
return E._store = {}, Object.defineProperty(E._store, "validated", {
|
|
429
429
|
configurable: !1,
|
|
@@ -444,36 +444,36 @@ function Ki() {
|
|
|
444
444
|
};
|
|
445
445
|
function Ci(h, _, w, O, C) {
|
|
446
446
|
{
|
|
447
|
-
var
|
|
447
|
+
var P, j = {}, E = null, z = null;
|
|
448
448
|
w !== void 0 && (An(w), E = "" + w), Oi(_) && (An(_.key), E = "" + _.key), Si(_) && (z = _.ref, Ei(_, C));
|
|
449
|
-
for (
|
|
450
|
-
Re.call(_,
|
|
449
|
+
for (P in _)
|
|
450
|
+
Re.call(_, P) && !vi.hasOwnProperty(P) && (j[P] = _[P]);
|
|
451
451
|
if (h && h.defaultProps) {
|
|
452
|
-
var
|
|
453
|
-
for (
|
|
454
|
-
j[
|
|
452
|
+
var $ = h.defaultProps;
|
|
453
|
+
for (P in $)
|
|
454
|
+
j[P] === void 0 && (j[P] = $[P]);
|
|
455
455
|
}
|
|
456
456
|
if (E || z) {
|
|
457
|
-
var
|
|
458
|
-
E && Ai(j,
|
|
457
|
+
var D = typeof h == "function" ? h.displayName || h.name || "Unknown" : h;
|
|
458
|
+
E && Ai(j, D), z && ji(j, D);
|
|
459
459
|
}
|
|
460
460
|
return ki(h, E, z, C, O, jn.current, j);
|
|
461
461
|
}
|
|
462
462
|
}
|
|
463
|
-
var St = T.ReactCurrentOwner,
|
|
463
|
+
var St = T.ReactCurrentOwner, Pn = T.ReactDebugCurrentFrame;
|
|
464
464
|
function we(h) {
|
|
465
465
|
if (h) {
|
|
466
|
-
var _ = h._owner, w =
|
|
467
|
-
|
|
466
|
+
var _ = h._owner, w = Ze(h.type, h._source, _ ? _.type : null);
|
|
467
|
+
Pn.setExtraStackFrame(w);
|
|
468
468
|
} else
|
|
469
|
-
|
|
469
|
+
Pn.setExtraStackFrame(null);
|
|
470
470
|
}
|
|
471
471
|
var Ot;
|
|
472
472
|
Ot = !1;
|
|
473
473
|
function Et(h) {
|
|
474
474
|
return typeof h == "object" && h !== null && h.$$typeof === n;
|
|
475
475
|
}
|
|
476
|
-
function
|
|
476
|
+
function In() {
|
|
477
477
|
{
|
|
478
478
|
if (St.current) {
|
|
479
479
|
var h = ne(St.current.type);
|
|
@@ -485,13 +485,13 @@ Check the render method of \`` + h + "`.";
|
|
|
485
485
|
return "";
|
|
486
486
|
}
|
|
487
487
|
}
|
|
488
|
-
function
|
|
488
|
+
function Pi(h) {
|
|
489
489
|
return "";
|
|
490
490
|
}
|
|
491
491
|
var Mn = {};
|
|
492
|
-
function
|
|
492
|
+
function Ii(h) {
|
|
493
493
|
{
|
|
494
|
-
var _ =
|
|
494
|
+
var _ = In();
|
|
495
495
|
if (!_) {
|
|
496
496
|
var w = typeof h == "string" ? h : h.displayName || h.name;
|
|
497
497
|
w && (_ = `
|
|
@@ -506,7 +506,7 @@ Check the top-level render call using <` + w + ">.");
|
|
|
506
506
|
if (!h._store || h._store.validated || h.key != null)
|
|
507
507
|
return;
|
|
508
508
|
h._store.validated = !0;
|
|
509
|
-
var w =
|
|
509
|
+
var w = Ii(_);
|
|
510
510
|
if (Mn[w])
|
|
511
511
|
return;
|
|
512
512
|
Mn[w] = !0;
|
|
@@ -528,7 +528,7 @@ Check the top-level render call using <` + w + ">.");
|
|
|
528
528
|
else if (h) {
|
|
529
529
|
var C = m(h);
|
|
530
530
|
if (typeof C == "function" && C !== h.entries)
|
|
531
|
-
for (var
|
|
531
|
+
for (var P = C.call(h), j; !(j = P.next()).done; )
|
|
532
532
|
Et(j.value) && Rn(j.value, _);
|
|
533
533
|
}
|
|
534
534
|
}
|
|
@@ -571,20 +571,20 @@ Check the top-level render call using <` + w + ">.");
|
|
|
571
571
|
}
|
|
572
572
|
}
|
|
573
573
|
var xn = {};
|
|
574
|
-
function Dn(h, _, w, O, C,
|
|
574
|
+
function Dn(h, _, w, O, C, P) {
|
|
575
575
|
{
|
|
576
576
|
var j = _t(h);
|
|
577
577
|
if (!j) {
|
|
578
578
|
var E = "";
|
|
579
579
|
(h === void 0 || typeof h == "object" && h !== null && Object.keys(h).length === 0) && (E += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
580
|
-
var z =
|
|
581
|
-
z ? E += z : E +=
|
|
582
|
-
var
|
|
583
|
-
h === null ?
|
|
580
|
+
var z = Pi();
|
|
581
|
+
z ? E += z : E += In();
|
|
582
|
+
var $;
|
|
583
|
+
h === null ? $ = "null" : vt(h) ? $ = "array" : h !== void 0 && h.$$typeof === n ? ($ = "<" + (ne(h.type) || "Unknown") + " />", E = " Did you accidentally export a JSX literal instead of a component?") : $ = typeof h, v("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", $, E);
|
|
584
584
|
}
|
|
585
|
-
var
|
|
586
|
-
if (
|
|
587
|
-
return
|
|
585
|
+
var D = Ci(h, _, w, C, P);
|
|
586
|
+
if (D == null)
|
|
587
|
+
return D;
|
|
588
588
|
if (j) {
|
|
589
589
|
var J = _.children;
|
|
590
590
|
if (J !== void 0)
|
|
@@ -612,7 +612,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
612
612
|
<%s key={someKey} {...props} />`, At, he, Li, he), xn[he + At] = !0;
|
|
613
613
|
}
|
|
614
614
|
}
|
|
615
|
-
return h === i ? Ri(
|
|
615
|
+
return h === i ? Ri(D) : Mi(D), D;
|
|
616
616
|
}
|
|
617
617
|
}
|
|
618
618
|
function $i(h, _, w) {
|
|
@@ -627,8 +627,8 @@ React keys must be passed directly to JSX without using spread:
|
|
|
627
627
|
}
|
|
628
628
|
var qi = {};
|
|
629
629
|
qi.NODE_ENV === "production" ? $t.exports = Ni() : $t.exports = Ki();
|
|
630
|
-
var
|
|
631
|
-
function
|
|
630
|
+
var et = $t.exports;
|
|
631
|
+
function N(t) {
|
|
632
632
|
if (typeof t == "number")
|
|
633
633
|
return (Math.abs(t * 2654435761) >>> 0).toString(16);
|
|
634
634
|
if (typeof t == "boolean")
|
|
@@ -647,7 +647,7 @@ function L(t) {
|
|
|
647
647
|
let e = 2166136261;
|
|
648
648
|
for (let n = 0; n < t.length; n++) {
|
|
649
649
|
e ^= (n + 1) * 2654435761;
|
|
650
|
-
const r =
|
|
650
|
+
const r = N(t[n]);
|
|
651
651
|
for (let i = 0; i < r.length; i++)
|
|
652
652
|
e ^= r.charCodeAt(i), e *= 16777619, e = e >>> 0;
|
|
653
653
|
}
|
|
@@ -657,24 +657,24 @@ function L(t) {
|
|
|
657
657
|
let e = 2166136261;
|
|
658
658
|
const n = Object.keys(t).sort();
|
|
659
659
|
for (let r = 0; r < n.length; r++) {
|
|
660
|
-
const i = n[r], s =
|
|
660
|
+
const i = n[r], s = N(i);
|
|
661
661
|
e ^= parseInt(s, 16), e *= 16777619, e = e >>> 0;
|
|
662
|
-
const o =
|
|
662
|
+
const o = N(t[i]);
|
|
663
663
|
e ^= parseInt(o, 16), e *= 16777619, e = e >>> 0;
|
|
664
664
|
}
|
|
665
665
|
return e.toString(16);
|
|
666
666
|
}
|
|
667
|
-
return
|
|
667
|
+
return N(String(t));
|
|
668
668
|
}
|
|
669
|
-
const
|
|
669
|
+
const x = {
|
|
670
670
|
Remove: "remove",
|
|
671
671
|
Replace: "replace",
|
|
672
672
|
Add: "add"
|
|
673
|
-
}, Er = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), zi = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"),
|
|
673
|
+
}, Er = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), zi = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), st = Symbol.iterator, Y = {
|
|
674
674
|
mutable: "mutable",
|
|
675
675
|
immutable: "immutable"
|
|
676
676
|
}, Xt = {};
|
|
677
|
-
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 Fn(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 me(t) {
|
|
|
741
741
|
function ce(t, e) {
|
|
742
742
|
return me(t) === 2 ? t.get(e) : t[e];
|
|
743
743
|
}
|
|
744
|
-
function
|
|
744
|
+
function We(t, e, n) {
|
|
745
745
|
me(t) === 2 ? t.set(e, n) : t[e] = n;
|
|
746
746
|
}
|
|
747
747
|
function jt(t, e) {
|
|
@@ -786,7 +786,7 @@ function Wi(t) {
|
|
|
786
786
|
}), Reflect.defineProperty(e, n, r);
|
|
787
787
|
}), e;
|
|
788
788
|
}
|
|
789
|
-
const
|
|
789
|
+
const Bi = Object.prototype.propertyIsEnumerable;
|
|
790
790
|
function jr(t, e) {
|
|
791
791
|
let n;
|
|
792
792
|
if (Array.isArray(t))
|
|
@@ -817,7 +817,7 @@ function jr(t, e) {
|
|
|
817
817
|
return Object.keys(t).forEach((i) => {
|
|
818
818
|
r[i] = t[i];
|
|
819
819
|
}), Object.getOwnPropertySymbols(t).forEach((i) => {
|
|
820
|
-
|
|
820
|
+
Bi.call(t, i) && (r[i] = t[i]);
|
|
821
821
|
}), r;
|
|
822
822
|
} else
|
|
823
823
|
throw new Error("Please check mark() to ensure that it is a stable marker draftable function.");
|
|
@@ -854,7 +854,7 @@ function Ue(t) {
|
|
|
854
854
|
e[n] = Ue(t[n]);
|
|
855
855
|
return e;
|
|
856
856
|
}
|
|
857
|
-
function
|
|
857
|
+
function ot(t) {
|
|
858
858
|
return Te(t) ? Ue(t) : t;
|
|
859
859
|
}
|
|
860
860
|
function ie(t) {
|
|
@@ -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) {
|
|
@@ -943,7 +943,7 @@ function kr(t, e, n) {
|
|
|
943
943
|
});
|
|
944
944
|
}
|
|
945
945
|
}
|
|
946
|
-
function
|
|
946
|
+
function Gi(t, e) {
|
|
947
947
|
const n = t.type === 3 ? t.setMap : t.copy;
|
|
948
948
|
t.finalities.revoke.length > 1 && t.assignedMap.get(e) && n && kr(ce(n, e), t.finalities.handledSet, t.options);
|
|
949
949
|
}
|
|
@@ -968,38 +968,38 @@ function sn(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), Dt(t), Ut(t, r, s, o), t.options.enableAutoFreeze && (t.options.updatedValues = (u = t.options.updatedValues) !== null && u !== void 0 ? u : /* @__PURE__ */ new WeakMap(), t.options.updatedValues.set(d, i.original)),
|
|
971
|
+
i.copy && (d = i.copy), Dt(t), Ut(t, r, s, o), t.options.enableAutoFreeze && (t.options.updatedValues = (u = t.options.updatedValues) !== null && u !== void 0 ? u : /* @__PURE__ */ new WeakMap(), t.options.updatedValues.set(d, i.original)), We(a, e, d);
|
|
972
972
|
}
|
|
973
973
|
}), t.options.enableAutoFreeze && i.finalities !== t.finalities && (t.options.enableAutoFreeze = !1)), ee(n, t.options) && t.finalities.draft.push(() => {
|
|
974
974
|
const s = t.type === 3 ? t.setMap : t.copy;
|
|
975
|
-
ae(ce(s, e), n) &&
|
|
975
|
+
ae(ce(s, e), n) && Gi(t, e);
|
|
976
976
|
});
|
|
977
977
|
}
|
|
978
|
-
function
|
|
978
|
+
function Qi(t, e, n, r, i) {
|
|
979
979
|
let { original: s, assignedMap: o, options: u } = t, a = t.copy;
|
|
980
980
|
a.length < s.length && ([s, a] = [a, s], [n, r] = [r, n]);
|
|
981
981
|
for (let d = 0; d < s.length; d += 1)
|
|
982
982
|
if (o.get(d.toString()) && a[d] !== s[d]) {
|
|
983
983
|
const c = e.concat([d]), f = be(c, i);
|
|
984
984
|
n.push({
|
|
985
|
-
op:
|
|
985
|
+
op: x.Replace,
|
|
986
986
|
path: f,
|
|
987
987
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
988
|
-
value:
|
|
988
|
+
value: ot(a[d])
|
|
989
989
|
}), r.push({
|
|
990
|
-
op:
|
|
990
|
+
op: x.Replace,
|
|
991
991
|
path: f,
|
|
992
992
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
993
|
-
value:
|
|
993
|
+
value: ot(s[d])
|
|
994
994
|
});
|
|
995
995
|
}
|
|
996
996
|
for (let d = s.length; d < a.length; d += 1) {
|
|
997
997
|
const c = e.concat([d]), f = be(c, i);
|
|
998
998
|
n.push({
|
|
999
|
-
op:
|
|
999
|
+
op: x.Add,
|
|
1000
1000
|
path: f,
|
|
1001
1001
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
1002
|
-
value:
|
|
1002
|
+
value: ot(a[d])
|
|
1003
1003
|
});
|
|
1004
1004
|
}
|
|
1005
1005
|
if (s.length < a.length) {
|
|
@@ -1007,7 +1007,7 @@ function Gi(t, e, n, r, i) {
|
|
|
1007
1007
|
if (d) {
|
|
1008
1008
|
const c = e.concat(["length"]), f = be(c, i);
|
|
1009
1009
|
r.push({
|
|
1010
|
-
op:
|
|
1010
|
+
op: x.Replace,
|
|
1011
1011
|
path: f,
|
|
1012
1012
|
value: s.length
|
|
1013
1013
|
});
|
|
@@ -1015,7 +1015,7 @@ function Gi(t, e, n, r, i) {
|
|
|
1015
1015
|
for (let c = a.length; s.length < c; c -= 1) {
|
|
1016
1016
|
const f = e.concat([c - 1]), l = be(f, i);
|
|
1017
1017
|
r.push({
|
|
1018
|
-
op:
|
|
1018
|
+
op: x.Remove,
|
|
1019
1019
|
path: l
|
|
1020
1020
|
});
|
|
1021
1021
|
}
|
|
@@ -1023,11 +1023,11 @@ function Gi(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 =
|
|
1027
|
-
if (ae(d, c) && f ===
|
|
1026
|
+
const d = ce(t, a), c = ot(ce(e, a)), f = u ? Ne(t, a) ? x.Replace : x.Add : x.Remove;
|
|
1027
|
+
if (ae(d, c) && f === x.Replace)
|
|
1028
1028
|
return;
|
|
1029
1029
|
const l = r.concat(a), p = be(l, o);
|
|
1030
|
-
i.push(f ===
|
|
1030
|
+
i.push(f === x.Remove ? { op: f, path: p } : { op: f, path: p, value: c }), s.push(f === x.Add ? { op: x.Remove, path: p } : f === x.Remove ? { op: x.Add, path: p, value: d } : { op: x.Replace, path: p, value: d });
|
|
1031
1031
|
});
|
|
1032
1032
|
}
|
|
1033
1033
|
function Yi({ original: t, copy: e }, n, r, i, s) {
|
|
@@ -1036,11 +1036,11 @@ function Yi({ original: t, copy: e }, n, r, i, s) {
|
|
|
1036
1036
|
if (!e.has(u)) {
|
|
1037
1037
|
const a = n.concat([o]), d = be(a, s);
|
|
1038
1038
|
r.push({
|
|
1039
|
-
op:
|
|
1039
|
+
op: x.Remove,
|
|
1040
1040
|
path: d,
|
|
1041
1041
|
value: u
|
|
1042
1042
|
}), i.unshift({
|
|
1043
|
-
op:
|
|
1043
|
+
op: x.Add,
|
|
1044
1044
|
path: d,
|
|
1045
1045
|
value: u
|
|
1046
1046
|
});
|
|
@@ -1050,11 +1050,11 @@ function Yi({ original: t, copy: e }, n, r, i, s) {
|
|
|
1050
1050
|
if (!t.has(u)) {
|
|
1051
1051
|
const a = n.concat([o]), d = be(a, s);
|
|
1052
1052
|
r.push({
|
|
1053
|
-
op:
|
|
1053
|
+
op: x.Add,
|
|
1054
1054
|
path: d,
|
|
1055
1055
|
value: u
|
|
1056
1056
|
}), i.unshift({
|
|
1057
|
-
op:
|
|
1057
|
+
op: x.Remove,
|
|
1058
1058
|
path: d,
|
|
1059
1059
|
value: u
|
|
1060
1060
|
});
|
|
@@ -1062,14 +1062,14 @@ 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:
|
|
1069
1069
|
case 2:
|
|
1070
1070
|
return Hi(t, e, n, r, i);
|
|
1071
1071
|
case 1:
|
|
1072
|
-
return
|
|
1072
|
+
return Qi(t, e, n, r, i);
|
|
1073
1073
|
case 3:
|
|
1074
1074
|
return Yi(t, e, n, r, i);
|
|
1075
1075
|
}
|
|
@@ -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), sn(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), sn(n, t, e, Ve)), this;
|
|
1090
1090
|
},
|
|
1091
1091
|
delete(t) {
|
|
1092
1092
|
if (!this.has(t))
|
|
@@ -1129,7 +1129,7 @@ const ct = (t, e, n = !1) => {
|
|
|
1129
1129
|
values() {
|
|
1130
1130
|
const t = this.keys();
|
|
1131
1131
|
return {
|
|
1132
|
-
[
|
|
1132
|
+
[st]: () => this.values(),
|
|
1133
1133
|
next: () => {
|
|
1134
1134
|
const e = t.next();
|
|
1135
1135
|
return e.done ? e : {
|
|
@@ -1142,7 +1142,7 @@ const ct = (t, e, n = !1) => {
|
|
|
1142
1142
|
entries() {
|
|
1143
1143
|
const t = this.keys();
|
|
1144
1144
|
return {
|
|
1145
|
-
[
|
|
1145
|
+
[st]: () => this.entries(),
|
|
1146
1146
|
next: () => {
|
|
1147
1147
|
const e = t.next();
|
|
1148
1148
|
if (e.done)
|
|
@@ -1155,7 +1155,7 @@ const ct = (t, e, n = !1) => {
|
|
|
1155
1155
|
}
|
|
1156
1156
|
};
|
|
1157
1157
|
},
|
|
1158
|
-
[
|
|
1158
|
+
[st]() {
|
|
1159
1159
|
return this.entries();
|
|
1160
1160
|
}
|
|
1161
1161
|
}, Ji = Reflect.ownKeys(Lt), Kn = (t, e, { isValuesIterator: n }) => () => {
|
|
@@ -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), sn(e, t, t,
|
|
1197
|
+
return this.has(t) || (V(e), ie(e), e.assignedMap.set(t, !0), e.setMap.set(t, t), sn(e, t, t, Ve)), this;
|
|
1198
1198
|
},
|
|
1199
1199
|
delete(t) {
|
|
1200
1200
|
if (!this.has(t))
|
|
@@ -1236,7 +1236,7 @@ const ct = (t, e, n = !1) => {
|
|
|
1236
1236
|
keys() {
|
|
1237
1237
|
return this.values();
|
|
1238
1238
|
},
|
|
1239
|
-
[
|
|
1239
|
+
[st]() {
|
|
1240
1240
|
return this.values();
|
|
1241
1241
|
},
|
|
1242
1242
|
forEach(t, e) {
|
|
@@ -1269,7 +1269,7 @@ Set.prototype.difference && Object.assign(dt, {
|
|
|
1269
1269
|
return Set.prototype.isDisjointFrom.call(new Set(this.values()), t);
|
|
1270
1270
|
}
|
|
1271
1271
|
});
|
|
1272
|
-
const Zi = Reflect.ownKeys(dt), Cr = /* @__PURE__ */ new WeakSet(),
|
|
1272
|
+
const Zi = Reflect.ownKeys(dt), Cr = /* @__PURE__ */ new WeakSet(), Pr = {
|
|
1273
1273
|
get(t, e, n) {
|
|
1274
1274
|
var r, i;
|
|
1275
1275
|
const s = (r = t.copy) === null || r === void 0 ? void 0 : r[e];
|
|
@@ -1298,7 +1298,7 @@ const Zi = Reflect.ownKeys(dt), Cr = /* @__PURE__ */ new WeakSet(), Ir = {
|
|
|
1298
1298
|
if (d)
|
|
1299
1299
|
return d.bind(t.proxy);
|
|
1300
1300
|
}
|
|
1301
|
-
if (!
|
|
1301
|
+
if (!Ne(u, e)) {
|
|
1302
1302
|
const d = Fn(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(), Ir = {
|
|
|
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, sn(t, e, n, Ve)), !0);
|
|
1338
1338
|
},
|
|
1339
1339
|
has(t, e) {
|
|
1340
1340
|
return e in H(t);
|
|
@@ -1362,7 +1362,7 @@ const Zi = Reflect.ownKeys(dt), Cr = /* @__PURE__ */ new WeakSet(), Ir = {
|
|
|
1362
1362
|
},
|
|
1363
1363
|
deleteProperty(t, e) {
|
|
1364
1364
|
var n;
|
|
1365
|
-
return t.type === 1 ?
|
|
1365
|
+
return t.type === 1 ? Pr.set.call(this, t, e, void 0, t.proxy) : (jt(t.original, e) !== void 0 || e in t.original ? (V(t), ie(t), t.assignedMap.set(e, !1)) : (t.assignedMap = (n = t.assignedMap) !== null && n !== void 0 ? n : /* @__PURE__ */ new Map(), t.assignedMap.delete(e)), t.copy && delete t.copy[e], !0);
|
|
1366
1366
|
}
|
|
1367
1367
|
};
|
|
1368
1368
|
function on(t) {
|
|
@@ -1379,7 +1379,7 @@ function on(t) {
|
|
|
1379
1379
|
setMap: o === 3 ? new Map(e.entries()) : void 0
|
|
1380
1380
|
};
|
|
1381
1381
|
(r || "key" in t) && (u.key = r);
|
|
1382
|
-
const { proxy: a, revoke: d } = Proxy.revocable(o === 1 ? Object.assign([], u) : u,
|
|
1382
|
+
const { proxy: a, revoke: d } = Proxy.revocable(o === 1 ? Object.assign([], u) : u, Pr);
|
|
1383
1383
|
if (i.revoke.push(d), Cr.add(a), u.proxy = a, n) {
|
|
1384
1384
|
const c = n;
|
|
1385
1385
|
c.finalities.draft.push((f, l) => {
|
|
@@ -1389,7 +1389,7 @@ function on(t) {
|
|
|
1389
1389
|
const m = ce(g, r), T = A(m);
|
|
1390
1390
|
if (T) {
|
|
1391
1391
|
let v = T.original;
|
|
1392
|
-
T.operated && (v = nn(m)), Dt(T), Ut(T,
|
|
1392
|
+
T.operated && (v = nn(m)), Dt(T), Ut(T, Ve, f, l), c.options.enableAutoFreeze && (c.options.updatedValues = (p = c.options.updatedValues) !== null && p !== void 0 ? p : /* @__PURE__ */ new WeakMap(), c.options.updatedValues.set(v, T.original)), We(g, r, v);
|
|
1393
1393
|
}
|
|
1394
1394
|
(y = b.callbacks) === null || y === void 0 || y.forEach((v) => {
|
|
1395
1395
|
v(f, l);
|
|
@@ -1398,7 +1398,7 @@ function on(t) {
|
|
|
1398
1398
|
} else {
|
|
1399
1399
|
const c = A(a);
|
|
1400
1400
|
c.finalities.draft.push((f, l) => {
|
|
1401
|
-
Dt(c), Ut(c,
|
|
1401
|
+
Dt(c), Ut(c, Ve, f, l);
|
|
1402
1402
|
});
|
|
1403
1403
|
}
|
|
1404
1404
|
return a;
|
|
@@ -1413,8 +1413,8 @@ function Xi(t, e, n, r, i) {
|
|
|
1413
1413
|
const d = a ? e[0] : o ? o.operated ? o.copy : o.original : t;
|
|
1414
1414
|
return o && xt(o), i && Se(d, d, o == null ? void 0 : o.options.updatedValues), [
|
|
1415
1415
|
d,
|
|
1416
|
-
n && a ? [{ op:
|
|
1417
|
-
r && a ? [{ op:
|
|
1416
|
+
n && a ? [{ op: x.Replace, path: [], value: e[0] }] : n,
|
|
1417
|
+
r && a ? [{ op: x.Replace, path: [], value: u }] : r
|
|
1418
1418
|
];
|
|
1419
1419
|
}
|
|
1420
1420
|
function es(t, e) {
|
|
@@ -1451,11 +1451,11 @@ function Ft(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, Ft(t));
|
|
1456
1456
|
}), i && (t.isContainDraft || console.warn("The return value does not contain any draft, please use 'rawReturn()' to wrap the return value to improve performance."), r && console.warn("The return value contains drafts, please don't use 'rawReturn()' to wrap the return value."));
|
|
1457
1457
|
}
|
|
1458
|
-
function
|
|
1458
|
+
function Ir(t) {
|
|
1459
1459
|
var e;
|
|
1460
1460
|
const n = A(t);
|
|
1461
1461
|
if (!ee(t, n == null ? void 0 : n.options))
|
|
@@ -1479,8 +1479,8 @@ function Pr(t) {
|
|
|
1479
1479
|
if (rn(i, (o, u) => {
|
|
1480
1480
|
if (n && ae(ce(n.original, o), u))
|
|
1481
1481
|
return;
|
|
1482
|
-
const a =
|
|
1483
|
-
a !== u && (i === t && s(),
|
|
1482
|
+
const a = Ir(u);
|
|
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 en(o) ? new Set(i) : new (Object.getPrototypeOf(o)).constructor(i);
|
|
@@ -1490,24 +1490,24 @@ function Pr(t) {
|
|
|
1490
1490
|
function qn(t) {
|
|
1491
1491
|
if (!Te(t))
|
|
1492
1492
|
throw new Error(`current() is only used for Draft, parameter: ${t}`);
|
|
1493
|
-
return
|
|
1493
|
+
return Ir(t);
|
|
1494
1494
|
}
|
|
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(S, ...
|
|
1499
|
-
return e(S, (R) => n.call(this, R, ...
|
|
1498
|
+
return function(S, ...I) {
|
|
1499
|
+
return e(S, (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 = Te(a) ? qn(a) : a, l = Array.isArray(c.mark) ? (S,
|
|
1506
|
+
const f = Te(a) ? qn(a) : a, l = Array.isArray(c.mark) ? (S, I) => {
|
|
1507
1507
|
for (const R of c.mark) {
|
|
1508
1508
|
if (typeof R != "function")
|
|
1509
1509
|
throw new Error(`Invalid mark: ${R}, 'mark' should be a function.`);
|
|
1510
|
-
const q = R(S,
|
|
1510
|
+
const q = R(S, I);
|
|
1511
1511
|
if (q)
|
|
1512
1512
|
return q;
|
|
1513
1513
|
}
|
|
@@ -1532,21 +1532,21 @@ const ts = (t) => function e(n, r, i) {
|
|
|
1532
1532
|
throw xt(A(m)), S;
|
|
1533
1533
|
}
|
|
1534
1534
|
const k = (S) => {
|
|
1535
|
-
const
|
|
1535
|
+
const I = A(m);
|
|
1536
1536
|
if (!Te(S)) {
|
|
1537
|
-
if (S !== void 0 && !ae(S, m) && (
|
|
1537
|
+
if (S !== void 0 && !ae(S, m) && (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
1539
|
const q = S == null ? void 0 : S[zi];
|
|
1540
1540
|
if (q) {
|
|
1541
|
-
const
|
|
1541
|
+
const Ie = q[0];
|
|
1542
1542
|
return g.strict && typeof S == "object" && S !== null && Ft({
|
|
1543
|
-
rootDraft:
|
|
1543
|
+
rootDraft: I,
|
|
1544
1544
|
value: S,
|
|
1545
1545
|
useRawReturn: !0
|
|
1546
|
-
}), T([
|
|
1546
|
+
}), T([Ie]);
|
|
1547
1547
|
}
|
|
1548
1548
|
if (S !== void 0)
|
|
1549
|
-
return typeof S == "object" && S !== null && Ft({ rootDraft:
|
|
1549
|
+
return typeof S == "object" && S !== null && Ft({ rootDraft: I, value: S }), T([S]);
|
|
1550
1550
|
}
|
|
1551
1551
|
if (S === m || S === void 0)
|
|
1552
1552
|
return T([]);
|
|
@@ -1570,8 +1570,8 @@ function Mr(t, e) {
|
|
|
1570
1570
|
function zn(t, e) {
|
|
1571
1571
|
return Object.keys(t).length === Object.keys(e).length && Object.keys(t).every((n) => e.hasOwnProperty(n) && t[n] === e[n]);
|
|
1572
1572
|
}
|
|
1573
|
-
function
|
|
1574
|
-
return typeof t != "object" || typeof e != "object" || t === null || e === null ? t === e : Mr(t, e) ? Object.keys(t).every((n) =>
|
|
1573
|
+
function ut(t, e) {
|
|
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 un(t) {
|
|
1577
1577
|
if (!Le(t))
|
|
@@ -1985,7 +1985,7 @@ function X(t, e) {
|
|
|
1985
1985
|
const [n, ...r] = e;
|
|
1986
1986
|
t.has(n) && X(t.get(n), r);
|
|
1987
1987
|
}
|
|
1988
|
-
function
|
|
1988
|
+
function B(t, e, n) {
|
|
1989
1989
|
if (e.length === 0)
|
|
1990
1990
|
throw new Error("path must have at least one element");
|
|
1991
1991
|
if (e.length === 1) {
|
|
@@ -1994,7 +1994,7 @@ function Q(t, e, n) {
|
|
|
1994
1994
|
}
|
|
1995
1995
|
const [r, ...i] = e;
|
|
1996
1996
|
let s = t.get(r);
|
|
1997
|
-
s || (s = /* @__PURE__ */ new Map(), t.set(r, s)),
|
|
1997
|
+
s || (s = /* @__PURE__ */ new Map(), t.set(r, s)), B(s, i, n);
|
|
1998
1998
|
}
|
|
1999
1999
|
function xr(t, e, n) {
|
|
2000
2000
|
const r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
|
|
@@ -2005,7 +2005,7 @@ function xr(t, e, n) {
|
|
|
2005
2005
|
console.warn("no such attr", u, t);
|
|
2006
2006
|
continue;
|
|
2007
2007
|
}
|
|
2008
|
-
f["checked-data-type"] === "date" && n && (d = pt(d), o[2] = d), an(f) &&
|
|
2008
|
+
f["checked-data-type"] === "date" && n && (d = pt(d), o[2] = d), an(f) && B(s, [d, a, u], o), B(r, [u, a, d], o), B(i, [a, u, d], o);
|
|
2009
2009
|
}
|
|
2010
2010
|
return { eav: r, aev: i, vae: s };
|
|
2011
2011
|
}
|
|
@@ -2013,9 +2013,9 @@ function Dr(t) {
|
|
|
2013
2013
|
const e = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
|
|
2014
2014
|
for (const s of Object.values(t)) {
|
|
2015
2015
|
const o = s["forward-identity"], [u, a, d] = o, c = s["reverse-identity"];
|
|
2016
|
-
if (
|
|
2016
|
+
if (B(r, [a, d], s), cn(s) && B(e, [a, d], s), s["primary?"] && B(n, [a], s), c) {
|
|
2017
2017
|
const [f, l, p] = c;
|
|
2018
|
-
|
|
2018
|
+
B(i, [l, p], s);
|
|
2019
2019
|
}
|
|
2020
2020
|
}
|
|
2021
2021
|
return { blobAttrs: e, primaryKeys: n, forwardIdents: r, revIdents: i };
|
|
@@ -2024,14 +2024,14 @@ function Ur(t) {
|
|
|
2024
2024
|
return {
|
|
2025
2025
|
__type: t.__type,
|
|
2026
2026
|
attrs: t.attrs,
|
|
2027
|
-
triples:
|
|
2027
|
+
triples: G(t.eav, 3),
|
|
2028
2028
|
cardinalityInference: t.cardinalityInference,
|
|
2029
2029
|
linkIndex: t.linkIndex,
|
|
2030
2030
|
useDateObjects: t.useDateObjects
|
|
2031
2031
|
};
|
|
2032
2032
|
}
|
|
2033
2033
|
function Lr(t) {
|
|
2034
|
-
return
|
|
2034
|
+
return at(t.attrs, t.triples, t.cardinalityInference, t.linkIndex, t.useDateObjects);
|
|
2035
2035
|
}
|
|
2036
2036
|
function vs(t, e) {
|
|
2037
2037
|
return Ce(t.eav, [e]) !== void 0;
|
|
@@ -2039,7 +2039,7 @@ function vs(t, e) {
|
|
|
2039
2039
|
function dn(t) {
|
|
2040
2040
|
t.attrIndexes = Dr(t.attrs);
|
|
2041
2041
|
}
|
|
2042
|
-
function
|
|
2042
|
+
function at(t, e, n, r, i) {
|
|
2043
2043
|
const s = xr(t, e, i);
|
|
2044
2044
|
return s.useDateObjects = i, s.attrs = t, s.attrIndexes = Dr(t), s.cardinalityInference = n, s.linkIndex = r, s.__type = "store", s;
|
|
2045
2045
|
}
|
|
@@ -2050,7 +2050,7 @@ function Be(t, e) {
|
|
|
2050
2050
|
const [o, u] = e[0], a = t.aev.get(o);
|
|
2051
2051
|
if (!a)
|
|
2052
2052
|
return null;
|
|
2053
|
-
i = (n =
|
|
2053
|
+
i = (n = G(a, 2).find((c) => c[2] === u)) === null || n === void 0 ? void 0 : n[0];
|
|
2054
2054
|
} else
|
|
2055
2055
|
i = e[0];
|
|
2056
2056
|
if (!i)
|
|
@@ -2060,7 +2060,7 @@ function Be(t, e) {
|
|
|
2060
2060
|
const [o, u] = s, a = t.aev.get(o);
|
|
2061
2061
|
if (!a)
|
|
2062
2062
|
return null;
|
|
2063
|
-
const c = (r =
|
|
2063
|
+
const c = (r = G(a, 2).find((b) => b[2] === u)) === null || r === void 0 ? void 0 : r[0];
|
|
2064
2064
|
if (!c)
|
|
2065
2065
|
return null;
|
|
2066
2066
|
const [f, l, p, ...y] = e;
|
|
@@ -2095,7 +2095,7 @@ function Kr(t, e) {
|
|
|
2095
2095
|
return;
|
|
2096
2096
|
u["checked-data-type"] === "date" && t.useDateObjects && (o = pt(o));
|
|
2097
2097
|
const a = Ce(t.eav, [i, s, o]), d = (n = a == null ? void 0 : a[3]) !== null && n !== void 0 ? n : Nr(t, u, r), c = [i, s, o, d];
|
|
2098
|
-
ws(u) ? (
|
|
2098
|
+
ws(u) ? (B(t.eav, [i, s], /* @__PURE__ */ new Map([[o, c]])), B(t.aev, [s, i], /* @__PURE__ */ new Map([[o, c]]))) : (B(t.eav, [i, s, o], c), B(t.aev, [s, i, o], c)), an(u) && B(t.vae, [o, s, i], c);
|
|
2099
2099
|
}
|
|
2100
2100
|
function Os(t, e) {
|
|
2101
2101
|
var n;
|
|
@@ -2119,7 +2119,7 @@ function Os(t, e) {
|
|
|
2119
2119
|
f,
|
|
2120
2120
|
Nr(t, u, d)
|
|
2121
2121
|
];
|
|
2122
|
-
|
|
2122
|
+
B(t.eav, [i, s], /* @__PURE__ */ new Map([[f, l]]));
|
|
2123
2123
|
}
|
|
2124
2124
|
function Kt(t, e) {
|
|
2125
2125
|
var n, r;
|
|
@@ -2130,7 +2130,7 @@ function Kt(t, e) {
|
|
|
2130
2130
|
if (a) {
|
|
2131
2131
|
for (const c of a.keys()) {
|
|
2132
2132
|
const f = t.attrs[c];
|
|
2133
|
-
f && f["on-delete-reverse"] === "cascade" &&
|
|
2133
|
+
f && f["on-delete-reverse"] === "cascade" && G(a.get(c), 1).forEach(([l, p, y]) => {
|
|
2134
2134
|
var b;
|
|
2135
2135
|
return Kt(t, [y, (b = f["reverse-identity"]) === null || b === void 0 ? void 0 : b[1]]);
|
|
2136
2136
|
}), // Fall back to deleting everything if we've rehydrated tx-steps from
|
|
@@ -2141,7 +2141,7 @@ function Kt(t, e) {
|
|
|
2141
2141
|
}
|
|
2142
2142
|
a.size === 0 && X(t.eav, [u]);
|
|
2143
2143
|
}
|
|
2144
|
-
const d = t.vae.get(u) &&
|
|
2144
|
+
const d = t.vae.get(u) && G(t.vae.get(u), 2);
|
|
2145
2145
|
d && d.forEach((c) => {
|
|
2146
2146
|
var f, l, p;
|
|
2147
2147
|
const [y, b, g] = c, m = t.attrs[b];
|
|
@@ -2158,7 +2158,7 @@ function Es(t, [e]) {
|
|
|
2158
2158
|
t.attrs[e.id] = e, dn(t);
|
|
2159
2159
|
}
|
|
2160
2160
|
function zr(t) {
|
|
2161
|
-
return
|
|
2161
|
+
return G(t.eav, 3);
|
|
2162
2162
|
}
|
|
2163
2163
|
function As(t, [e]) {
|
|
2164
2164
|
if (!t.attrs[e])
|
|
@@ -2202,7 +2202,7 @@ function ks(t, e) {
|
|
|
2202
2202
|
throw new Error(`unhandled transaction action: ${n}`);
|
|
2203
2203
|
}
|
|
2204
2204
|
}
|
|
2205
|
-
function
|
|
2205
|
+
function G(t, e, n = []) {
|
|
2206
2206
|
if (!t || e === 0)
|
|
2207
2207
|
return n;
|
|
2208
2208
|
if (e === 1) {
|
|
@@ -2211,10 +2211,10 @@ function B(t, e, n = []) {
|
|
|
2211
2211
|
return n;
|
|
2212
2212
|
}
|
|
2213
2213
|
for (const r of t.values())
|
|
2214
|
-
|
|
2214
|
+
G(r, e - 1, n);
|
|
2215
2215
|
return n;
|
|
2216
2216
|
}
|
|
2217
|
-
function
|
|
2217
|
+
function tt(t, e, n) {
|
|
2218
2218
|
var r;
|
|
2219
2219
|
const i = [];
|
|
2220
2220
|
if (n != null && n.hasOwnProperty("$not")) {
|
|
@@ -2239,7 +2239,7 @@ function nt(t, e, n) {
|
|
|
2239
2239
|
return i;
|
|
2240
2240
|
}
|
|
2241
2241
|
if (n != null && n.$comparator)
|
|
2242
|
-
return
|
|
2242
|
+
return G(e, 1).filter(n.$op);
|
|
2243
2243
|
const s = n.in || n.$in || [n];
|
|
2244
2244
|
for (const o of s) {
|
|
2245
2245
|
const u = e.get(o);
|
|
@@ -2251,20 +2251,20 @@ function Cs(t, e, n) {
|
|
|
2251
2251
|
let r = "";
|
|
2252
2252
|
return t !== void 0 && (r += "e"), e !== void 0 && (r += "a"), n !== void 0 && (r += "v"), r;
|
|
2253
2253
|
}
|
|
2254
|
-
function
|
|
2254
|
+
function Ps(t, [e, n, r]) {
|
|
2255
2255
|
var i, s;
|
|
2256
2256
|
switch (Cs(e, n, r)) {
|
|
2257
2257
|
case "e": {
|
|
2258
2258
|
const u = t.eav.get(e);
|
|
2259
|
-
return
|
|
2259
|
+
return G(u, 2);
|
|
2260
2260
|
}
|
|
2261
2261
|
case "ea": {
|
|
2262
2262
|
const u = (i = t.eav.get(e)) === null || i === void 0 ? void 0 : i.get(n);
|
|
2263
|
-
return
|
|
2263
|
+
return G(u, 1);
|
|
2264
2264
|
}
|
|
2265
2265
|
case "eav": {
|
|
2266
2266
|
const u = (s = t.eav.get(e)) === null || s === void 0 ? void 0 : s.get(n);
|
|
2267
|
-
return u ?
|
|
2267
|
+
return u ? tt(t, u, r) : [];
|
|
2268
2268
|
}
|
|
2269
2269
|
case "ev": {
|
|
2270
2270
|
const u = t.eav.get(e);
|
|
@@ -2272,12 +2272,12 @@ function Is(t, [e, n, r]) {
|
|
|
2272
2272
|
return [];
|
|
2273
2273
|
const a = [];
|
|
2274
2274
|
for (const d of u.values())
|
|
2275
|
-
a.push(...
|
|
2275
|
+
a.push(...tt(t, d, r));
|
|
2276
2276
|
return a;
|
|
2277
2277
|
}
|
|
2278
2278
|
case "a": {
|
|
2279
2279
|
const u = t.aev.get(n);
|
|
2280
|
-
return
|
|
2280
|
+
return G(u, 2);
|
|
2281
2281
|
}
|
|
2282
2282
|
case "av": {
|
|
2283
2283
|
const u = t.aev.get(n);
|
|
@@ -2285,27 +2285,27 @@ function Is(t, [e, n, r]) {
|
|
|
2285
2285
|
return [];
|
|
2286
2286
|
const a = [];
|
|
2287
2287
|
for (const d of u.values())
|
|
2288
|
-
a.push(...
|
|
2288
|
+
a.push(...tt(t, d, r));
|
|
2289
2289
|
return a;
|
|
2290
2290
|
}
|
|
2291
2291
|
case "v": {
|
|
2292
2292
|
const u = [];
|
|
2293
2293
|
for (const a of t.eav.values())
|
|
2294
2294
|
for (const d of a.values())
|
|
2295
|
-
u.push(...
|
|
2295
|
+
u.push(...tt(t, d, r));
|
|
2296
2296
|
return u;
|
|
2297
2297
|
}
|
|
2298
2298
|
default:
|
|
2299
|
-
return
|
|
2299
|
+
return G(t.eav, 3);
|
|
2300
2300
|
}
|
|
2301
2301
|
}
|
|
2302
|
-
function
|
|
2302
|
+
function Is(t, e, n) {
|
|
2303
2303
|
var r;
|
|
2304
2304
|
const i = {};
|
|
2305
2305
|
if (!e)
|
|
2306
2306
|
return i;
|
|
2307
2307
|
for (const [s, o] of e.entries()) {
|
|
2308
|
-
const u = (r = t.eav.get(n)) === null || r === void 0 ? void 0 : r.get(o.id), a =
|
|
2308
|
+
const u = (r = t.eav.get(n)) === null || r === void 0 ? void 0 : r.get(o.id), a = G(u, 1);
|
|
2309
2309
|
for (const d of a)
|
|
2310
2310
|
i[s] = d[2];
|
|
2311
2311
|
}
|
|
@@ -2366,19 +2366,19 @@ function xs(t) {
|
|
|
2366
2366
|
function Ds(t, e, n) {
|
|
2367
2367
|
if (n.hasOwnProperty(t)) {
|
|
2368
2368
|
const r = n[t];
|
|
2369
|
-
return
|
|
2369
|
+
return Br(r, e, n);
|
|
2370
2370
|
}
|
|
2371
2371
|
return Object.assign(Object.assign({}, n), { [t]: e });
|
|
2372
2372
|
}
|
|
2373
|
-
function
|
|
2373
|
+
function Bn(t, e, n) {
|
|
2374
2374
|
return t === e ? n : null;
|
|
2375
2375
|
}
|
|
2376
2376
|
function Us(t) {
|
|
2377
2377
|
switch (typeof t) {
|
|
2378
2378
|
case "string":
|
|
2379
|
-
return t.startsWith("?") ? Ds :
|
|
2379
|
+
return t.startsWith("?") ? Ds : Bn;
|
|
2380
2380
|
default:
|
|
2381
|
-
return
|
|
2381
|
+
return Bn;
|
|
2382
2382
|
}
|
|
2383
2383
|
}
|
|
2384
2384
|
const Ls = [
|
|
@@ -2395,13 +2395,13 @@ function Fs(t) {
|
|
|
2395
2395
|
return !0;
|
|
2396
2396
|
return !1;
|
|
2397
2397
|
}
|
|
2398
|
-
function
|
|
2398
|
+
function Br(t, e, n) {
|
|
2399
2399
|
return n ? typeof t == "object" ? Fs(t) ? n : null : Us(t)(t, e, n) : null;
|
|
2400
2400
|
}
|
|
2401
2401
|
function Ns(t, e, n) {
|
|
2402
2402
|
return t.reduce((r, i, s) => {
|
|
2403
2403
|
const o = e[s];
|
|
2404
|
-
return
|
|
2404
|
+
return Br(i, o, r);
|
|
2405
2405
|
}, n);
|
|
2406
2406
|
}
|
|
2407
2407
|
function Ks(t, e, n) {
|
|
@@ -2420,40 +2420,40 @@ function zs(t, { find: e, where: n }) {
|
|
|
2420
2420
|
return qt(t, n).map((i) => fn(i, e));
|
|
2421
2421
|
}
|
|
2422
2422
|
function Vs(t, e, n) {
|
|
2423
|
-
return
|
|
2423
|
+
return Ps(t, fn(n, e));
|
|
2424
2424
|
}
|
|
2425
2425
|
const Ws = /^(?:[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;
|
|
2426
2426
|
function Ee(t) {
|
|
2427
2427
|
return typeof t == "string" && Ws.test(t);
|
|
2428
2428
|
}
|
|
2429
|
-
const
|
|
2429
|
+
const F = [];
|
|
2430
2430
|
for (let t = 0; t < 256; ++t)
|
|
2431
|
-
|
|
2432
|
-
function
|
|
2433
|
-
return (
|
|
2431
|
+
F.push((t + 256).toString(16).slice(1));
|
|
2432
|
+
function Bs(t, e = 0) {
|
|
2433
|
+
return (F[t[e + 0]] + F[t[e + 1]] + F[t[e + 2]] + F[t[e + 3]] + "-" + F[t[e + 4]] + F[t[e + 5]] + "-" + F[t[e + 6]] + F[t[e + 7]] + "-" + F[t[e + 8]] + F[t[e + 9]] + "-" + F[t[e + 10]] + F[t[e + 11]] + F[t[e + 12]] + F[t[e + 13]] + F[t[e + 14]] + F[t[e + 15]]).toLowerCase();
|
|
2434
2434
|
}
|
|
2435
2435
|
let kt;
|
|
2436
|
-
const
|
|
2437
|
-
function
|
|
2436
|
+
const Gs = new Uint8Array(16);
|
|
2437
|
+
function Qs() {
|
|
2438
2438
|
if (!kt) {
|
|
2439
2439
|
if (typeof crypto > "u" || !crypto.getRandomValues)
|
|
2440
2440
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
2441
2441
|
kt = crypto.getRandomValues.bind(crypto);
|
|
2442
2442
|
}
|
|
2443
|
-
return kt(
|
|
2443
|
+
return kt(Gs);
|
|
2444
2444
|
}
|
|
2445
|
-
const Hs = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto),
|
|
2445
|
+
const Hs = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Gn = { randomUUID: Hs };
|
|
2446
2446
|
function Ys(t, e, n) {
|
|
2447
2447
|
var i;
|
|
2448
|
-
if (
|
|
2449
|
-
return
|
|
2448
|
+
if (Gn.randomUUID && !t)
|
|
2449
|
+
return Gn.randomUUID();
|
|
2450
2450
|
t = t || {};
|
|
2451
|
-
const r = t.random ?? ((i = t.rng) == null ? void 0 : i.call(t)) ??
|
|
2451
|
+
const r = t.random ?? ((i = t.rng) == null ? void 0 : i.call(t)) ?? Qs();
|
|
2452
2452
|
if (r.length < 16)
|
|
2453
2453
|
throw new Error("Random bytes length must be >= 16");
|
|
2454
|
-
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128,
|
|
2454
|
+
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, Bs(r);
|
|
2455
2455
|
}
|
|
2456
|
-
function
|
|
2456
|
+
function Qn(t) {
|
|
2457
2457
|
const e = t.replace(/-/g, ""), n = [];
|
|
2458
2458
|
for (let r = 0; r < e.length; r += 2)
|
|
2459
2459
|
n.push(parseInt(e.substring(r, r + 2), 16));
|
|
@@ -2469,9 +2469,9 @@ function Js(t, e) {
|
|
|
2469
2469
|
return 0;
|
|
2470
2470
|
}
|
|
2471
2471
|
function Zs(t, e) {
|
|
2472
|
-
return Js(
|
|
2472
|
+
return Js(Qn(t), Qn(e));
|
|
2473
2473
|
}
|
|
2474
|
-
function
|
|
2474
|
+
function L() {
|
|
2475
2475
|
return Ys();
|
|
2476
2476
|
}
|
|
2477
2477
|
function Xs(t, e) {
|
|
@@ -2488,7 +2488,7 @@ function eo() {
|
|
|
2488
2488
|
}
|
|
2489
2489
|
const to = eo();
|
|
2490
2490
|
let no = 0;
|
|
2491
|
-
function
|
|
2491
|
+
function Ke(t) {
|
|
2492
2492
|
return yt(`_${t}`, no++);
|
|
2493
2493
|
}
|
|
2494
2494
|
function yt(t, e) {
|
|
@@ -2519,7 +2519,7 @@ function io(t, e, n, r) {
|
|
|
2519
2519
|
function so(t, e, n) {
|
|
2520
2520
|
return t.map((r) => r === e ? n : r);
|
|
2521
2521
|
}
|
|
2522
|
-
function
|
|
2522
|
+
function Gr(t, e, n, r, i) {
|
|
2523
2523
|
const s = fe(e, n, i), o = Vr(e, n, i), u = s || o;
|
|
2524
2524
|
if (!u)
|
|
2525
2525
|
throw new Ae(`Could not find attr for ${[n, i]}`);
|
|
@@ -2529,12 +2529,12 @@ function Br(t, e, n, r, i) {
|
|
|
2529
2529
|
t(d, r),
|
|
2530
2530
|
u.id,
|
|
2531
2531
|
t(f, l),
|
|
2532
|
-
|
|
2532
|
+
Ke("time")
|
|
2533
2533
|
] : [
|
|
2534
2534
|
t(d, l),
|
|
2535
2535
|
u.id,
|
|
2536
2536
|
t(f, r),
|
|
2537
|
-
|
|
2537
|
+
Ke("time")
|
|
2538
2538
|
];
|
|
2539
2539
|
return [s ? f : d, l, p, u, !!s];
|
|
2540
2540
|
}
|
|
@@ -2620,19 +2620,19 @@ function uo(t, e, n, r, i, s) {
|
|
|
2620
2620
|
t(n, r),
|
|
2621
2621
|
d.id,
|
|
2622
2622
|
{ $isNull: { attrId: a.id, isNull: s.$isNull, reverse: !o } },
|
|
2623
|
-
|
|
2623
|
+
Ke("time")
|
|
2624
2624
|
];
|
|
2625
2625
|
}
|
|
2626
2626
|
return o ? [
|
|
2627
2627
|
t(n, r),
|
|
2628
2628
|
a.id,
|
|
2629
2629
|
oo(a, s),
|
|
2630
|
-
|
|
2631
|
-
] : [s, a.id, t(n, r),
|
|
2630
|
+
Ke("time")
|
|
2631
|
+
] : [s, a.id, t(n, r), Ke("time")];
|
|
2632
2632
|
}
|
|
2633
2633
|
function ao(t, e, n, r, i) {
|
|
2634
2634
|
const [s, o, u] = i.reduce((a, d) => {
|
|
2635
|
-
const [c, f, l] = a, [p, y, b] =
|
|
2635
|
+
const [c, f, l] = a, [p, y, b] = Gr(t, e, c, f, d);
|
|
2636
2636
|
return [p, y, [...l, b]];
|
|
2637
2637
|
}, [n, r, []]);
|
|
2638
2638
|
return [s, o, u];
|
|
@@ -2659,7 +2659,7 @@ function ho(t, e, n) {
|
|
|
2659
2659
|
function Jn(t, e, n, r, i, s) {
|
|
2660
2660
|
const o = t(r, i), u = s.map((a, d) => {
|
|
2661
2661
|
const c = ho(t, o, d);
|
|
2662
|
-
return
|
|
2662
|
+
return Qr(c, n, r, i, a);
|
|
2663
2663
|
});
|
|
2664
2664
|
return { [e]: { patterns: u, joinSym: o } };
|
|
2665
2665
|
}
|
|
@@ -2672,7 +2672,7 @@ function po(t) {
|
|
|
2672
2672
|
function Zn(t, e, n, r, i) {
|
|
2673
2673
|
return po(i).map((s) => zt(t, e, n, r, s, { $isNull: !0 }));
|
|
2674
2674
|
}
|
|
2675
|
-
function
|
|
2675
|
+
function Qr(t, e, n, r, i) {
|
|
2676
2676
|
return Object.entries(i).flatMap(([s, o]) => {
|
|
2677
2677
|
if (fo([s, o]))
|
|
2678
2678
|
return Jn(t, "or", e, n, r, o);
|
|
@@ -2704,13 +2704,13 @@ function Gr(t, e, n, r, i) {
|
|
|
2704
2704
|
}
|
|
2705
2705
|
function yo(t, e, n, r) {
|
|
2706
2706
|
const i = yt;
|
|
2707
|
-
return r ?
|
|
2707
|
+
return r ? Qr(i, t, e, n, r).concat(Hn(i, t, e, n)) : Hn(i, t, e, n);
|
|
2708
2708
|
}
|
|
2709
2709
|
function bo(t, e, n) {
|
|
2710
2710
|
return [t(e, n), t("time", n)];
|
|
2711
2711
|
}
|
|
2712
2712
|
function _o(t, e, n, r, i, s) {
|
|
2713
|
-
const [o, u, a, d, c] =
|
|
2713
|
+
const [o, u, a, d, c] = Gr(t, e, n, r, i), f = so(a, t(n, r), s);
|
|
2714
2714
|
return [o, u, f, d, c];
|
|
2715
2715
|
}
|
|
2716
2716
|
function go(t, e, { etype: n, level: r, form: i }, s) {
|
|
@@ -2740,11 +2740,11 @@ function go(t, e, { etype: n, level: r, form: i }, s) {
|
|
|
2740
2740
|
function To(t, e, n) {
|
|
2741
2741
|
return n === "string" ? to(t, e) : t > e ? 1 : -1;
|
|
2742
2742
|
}
|
|
2743
|
-
function
|
|
2743
|
+
function Fe(t, e, n, r, i) {
|
|
2744
2744
|
return e === r || e == null && r == null ? Zs(t, n) : r == null ? 1 : e == null ? -1 : To(e, r, i);
|
|
2745
2745
|
}
|
|
2746
2746
|
function lt([t, e], [n, r], i) {
|
|
2747
|
-
return
|
|
2747
|
+
return Fe(t, e, n, r, i);
|
|
2748
2748
|
}
|
|
2749
2749
|
function Vt(t) {
|
|
2750
2750
|
return t == null ? t : new Date(t).getTime();
|
|
@@ -2794,8 +2794,8 @@ function Eo(t, { etype: e, pageInfo: n, dq: r, form: i }) {
|
|
|
2794
2794
|
if (l && ((o = l == null ? void 0 : l["forward-identity"]) === null || o === void 0 ? void 0 : o[2]) !== "id") {
|
|
2795
2795
|
const b = l["checked-data-type"] === "date", g = l.id;
|
|
2796
2796
|
c = c.map(([m]) => {
|
|
2797
|
-
var T, v, k, S,
|
|
2798
|
-
let R = (
|
|
2797
|
+
var T, v, k, S, I;
|
|
2798
|
+
let R = (I = (S = (k = (v = (T = t.eav.get(m)) === null || T === void 0 ? void 0 : T.get(g)) === null || v === void 0 ? void 0 : v.values()) === null || k === void 0 ? void 0 : k.next()) === null || S === void 0 ? void 0 : S.value) === null || I === void 0 ? void 0 : I[2];
|
|
2799
2799
|
return b && (R = Vt(R)), [m, R];
|
|
2800
2800
|
});
|
|
2801
2801
|
}
|
|
@@ -2810,7 +2810,7 @@ function Eo(t, { etype: e, pageInfo: n, dq: r, form: i }) {
|
|
|
2810
2810
|
const [g] = b;
|
|
2811
2811
|
if (p[g] || !a && f && l && mo(f, l, d, b))
|
|
2812
2812
|
continue;
|
|
2813
|
-
const m =
|
|
2813
|
+
const m = Is(t, y, g);
|
|
2814
2814
|
m && (p[g] = m);
|
|
2815
2815
|
}
|
|
2816
2816
|
return p;
|
|
@@ -2877,7 +2877,7 @@ function Jr({ store: t, pageInfo: e, aggregate: n }, r) {
|
|
|
2877
2877
|
}, {}) };
|
|
2878
2878
|
return e && (s.pageInfo = Co(e)), n && (s.aggregate = n), s;
|
|
2879
2879
|
}
|
|
2880
|
-
function
|
|
2880
|
+
function Po() {
|
|
2881
2881
|
const e = {
|
|
2882
2882
|
__etype: 1,
|
|
2883
2883
|
__ops: 1,
|
|
@@ -2891,7 +2891,7 @@ function Io() {
|
|
|
2891
2891
|
};
|
|
2892
2892
|
return new Set(Object.keys(e));
|
|
2893
2893
|
}
|
|
2894
|
-
const
|
|
2894
|
+
const Io = Po();
|
|
2895
2895
|
function Wt(t, e, n) {
|
|
2896
2896
|
const r = {
|
|
2897
2897
|
__etype: t,
|
|
@@ -2903,7 +2903,7 @@ function Wt(t, e, n) {
|
|
|
2903
2903
|
return n;
|
|
2904
2904
|
if (s === "__etype")
|
|
2905
2905
|
return t;
|
|
2906
|
-
if (
|
|
2906
|
+
if (Io.has(s))
|
|
2907
2907
|
return (o, u) => Wt(t, e, [
|
|
2908
2908
|
...n,
|
|
2909
2909
|
u ? [s, t, e, o, u] : [s, t, e, o]
|
|
@@ -2983,30 +2983,30 @@ function xo(t) {
|
|
|
2983
2983
|
throw new Error("lookup must be an object with a single unique attr and value.");
|
|
2984
2984
|
return e[0];
|
|
2985
2985
|
}
|
|
2986
|
-
function
|
|
2986
|
+
function Bt(t, e, n) {
|
|
2987
2987
|
return n.indexOf(".") !== -1 && // attr names can have `.` in them, so use the attr we find with a `.`
|
|
2988
2988
|
// before assuming it's a ref lookup.
|
|
2989
2989
|
!K(t, e, n);
|
|
2990
2990
|
}
|
|
2991
|
-
function
|
|
2991
|
+
function Gt(t) {
|
|
2992
2992
|
const [e, n, ...r] = t.split(".");
|
|
2993
2993
|
if (r.length > 0 || n !== "id")
|
|
2994
2994
|
throw new Error(`${t} is not a valid lookup attribute.`);
|
|
2995
2995
|
return e;
|
|
2996
2996
|
}
|
|
2997
2997
|
function Do(t, e, n) {
|
|
2998
|
-
if (!
|
|
2998
|
+
if (!Bt(t, e, n))
|
|
2999
2999
|
return K(t, e, n);
|
|
3000
|
-
const r =
|
|
3000
|
+
const r = Gt(n), i = K(t, e, r) || _e(t, e, r);
|
|
3001
3001
|
if (i && i["value-type"] !== "ref")
|
|
3002
3002
|
throw new Error(`${n} does not reference a valid link attribute.`);
|
|
3003
3003
|
return i;
|
|
3004
3004
|
}
|
|
3005
|
-
function
|
|
3005
|
+
function Qt(t) {
|
|
3006
3006
|
return typeof t == "string" && !ht(t) ? null : typeof t == "string" && ht(t) ? Zr(t) : xo(t);
|
|
3007
3007
|
}
|
|
3008
|
-
function
|
|
3009
|
-
const r =
|
|
3008
|
+
function Q(t, e, n) {
|
|
3009
|
+
const r = Qt(n);
|
|
3010
3010
|
if (r === null)
|
|
3011
3011
|
return n;
|
|
3012
3012
|
const [i, s] = r, o = Do(t, e, i);
|
|
@@ -3015,7 +3015,7 @@ function G(t, e, n) {
|
|
|
3015
3015
|
return [o.id, s];
|
|
3016
3016
|
}
|
|
3017
3017
|
function Xr(t, e, n, r) {
|
|
3018
|
-
const i =
|
|
3018
|
+
const i = Q(t, e, n);
|
|
3019
3019
|
return Array.isArray(i) ? [[
|
|
3020
3020
|
"add-triple",
|
|
3021
3021
|
i,
|
|
@@ -3028,14 +3028,14 @@ function Uo({ attrs: t }, [e, n, r]) {
|
|
|
3028
3028
|
const u = Array.isArray(o) ? o : [o], a = K(t, e, s), d = _e(t, e, s);
|
|
3029
3029
|
return u.map((c) => a ? [
|
|
3030
3030
|
"add-triple",
|
|
3031
|
-
|
|
3031
|
+
Q(t, e, n),
|
|
3032
3032
|
a.id,
|
|
3033
|
-
|
|
3033
|
+
Q(t, a["reverse-identity"][1], c)
|
|
3034
3034
|
] : [
|
|
3035
3035
|
"add-triple",
|
|
3036
|
-
|
|
3036
|
+
Q(t, d["forward-identity"][1], c),
|
|
3037
3037
|
d.id,
|
|
3038
|
-
|
|
3038
|
+
Q(t, e, n)
|
|
3039
3039
|
]);
|
|
3040
3040
|
});
|
|
3041
3041
|
return Xr(t, e, n, i);
|
|
@@ -3045,14 +3045,14 @@ function Lo({ attrs: t }, [e, n, r]) {
|
|
|
3045
3045
|
const u = Array.isArray(o) ? o : [o], a = K(t, e, s), d = _e(t, e, s);
|
|
3046
3046
|
return u.map((c) => a ? [
|
|
3047
3047
|
"retract-triple",
|
|
3048
|
-
|
|
3048
|
+
Q(t, e, n),
|
|
3049
3049
|
a.id,
|
|
3050
|
-
|
|
3050
|
+
Q(t, a["reverse-identity"][1], c)
|
|
3051
3051
|
] : [
|
|
3052
3052
|
"retract-triple",
|
|
3053
|
-
|
|
3053
|
+
Q(t, d["forward-identity"][1], c),
|
|
3054
3054
|
d.id,
|
|
3055
|
-
|
|
3055
|
+
Q(t, e, n)
|
|
3056
3056
|
]);
|
|
3057
3057
|
});
|
|
3058
3058
|
return Xr(t, e, n, i);
|
|
@@ -3063,7 +3063,7 @@ function Fo(t, e, n) {
|
|
|
3063
3063
|
for (const s of t || []) {
|
|
3064
3064
|
const o = s == null ? void 0 : s.aev.get(r);
|
|
3065
3065
|
if (o) {
|
|
3066
|
-
for (const [u, a, d] of
|
|
3066
|
+
for (const [u, a, d] of G(o, 2))
|
|
3067
3067
|
if (d === i)
|
|
3068
3068
|
return !0;
|
|
3069
3069
|
}
|
|
@@ -3083,14 +3083,14 @@ function ei({ stores: t, attrs: e }, [n, r, i, s]) {
|
|
|
3083
3083
|
return (s == null ? void 0 : s.upsert) === !1 ? { mode: "update" } : (s == null ? void 0 : s.upsert) === !0 ? null : Fo(t, n, r) ? { mode: "update" } : null;
|
|
3084
3084
|
}
|
|
3085
3085
|
function No(t, e) {
|
|
3086
|
-
const { stores: n, attrs: r } = t, [i, s, o, u] = e, a = un(o), d =
|
|
3086
|
+
const { stores: n, attrs: r } = t, [i, s, o, u] = e, a = un(o), d = Q(r, i, s);
|
|
3087
3087
|
return [["id", d]].concat(Object.entries(a)).map(([f, l]) => {
|
|
3088
3088
|
const p = K(r, i, f);
|
|
3089
3089
|
return p["checked-data-type"] === "date" && t.useDateObjects && (l = pt(l)), ["add-triple", d, p.id, l, { mode: "create" }];
|
|
3090
3090
|
});
|
|
3091
3091
|
}
|
|
3092
3092
|
function Ko(t, e) {
|
|
3093
|
-
const { stores: n, attrs: r } = t, [i, s, o, u] = e, a = un(o), d =
|
|
3093
|
+
const { stores: n, attrs: r } = t, [i, s, o, u] = e, a = un(o), d = Q(r, i, s), c = ei(t, [i, d, o, u]);
|
|
3094
3094
|
return [["id", d]].concat(Object.entries(a)).map(([l, p]) => {
|
|
3095
3095
|
const y = K(r, i, l);
|
|
3096
3096
|
return y["checked-data-type"] === "date" && t.useDateObjects && (p = pt(p)), [
|
|
@@ -3103,10 +3103,10 @@ function Ko(t, e) {
|
|
|
3103
3103
|
});
|
|
3104
3104
|
}
|
|
3105
3105
|
function qo({ attrs: t }, [e, n]) {
|
|
3106
|
-
return [["delete-entity",
|
|
3106
|
+
return [["delete-entity", Q(t, e, n), e]];
|
|
3107
3107
|
}
|
|
3108
3108
|
function zo(t, e) {
|
|
3109
|
-
const { stores: n, attrs: r } = t, [i, s, o, u] = e, a = un(o), d =
|
|
3109
|
+
const { stores: n, attrs: r } = t, [i, s, o, u] = e, a = un(o), d = Q(r, i, s), c = ei(t, [i, d, o, u]), f = Object.entries(a).map(([p, y]) => {
|
|
3110
3110
|
const b = K(r, i, p);
|
|
3111
3111
|
return [
|
|
3112
3112
|
"deep-merge-triple",
|
|
@@ -3125,7 +3125,7 @@ function zo(t, e) {
|
|
|
3125
3125
|
]].concat(f);
|
|
3126
3126
|
}
|
|
3127
3127
|
function Vo({ attrs: t }, [e, n, r]) {
|
|
3128
|
-
return [["rule-params",
|
|
3128
|
+
return [["rule-params", Q(t, e, n), e, r]];
|
|
3129
3129
|
}
|
|
3130
3130
|
function Wo(t) {
|
|
3131
3131
|
const [e, n, r, i, s] = t;
|
|
@@ -3134,7 +3134,7 @@ function Wo(t) {
|
|
|
3134
3134
|
const o = Object.assign({}, i);
|
|
3135
3135
|
return delete o.id, [e, n, r, o, ...s ? [s] : []];
|
|
3136
3136
|
}
|
|
3137
|
-
function
|
|
3137
|
+
function Bo(t, e) {
|
|
3138
3138
|
const [n, ...r] = Wo(e);
|
|
3139
3139
|
switch (n) {
|
|
3140
3140
|
case "merge":
|
|
@@ -3155,7 +3155,7 @@ function Qo(t, e) {
|
|
|
3155
3155
|
throw new Error(`unsupported action ${n}`);
|
|
3156
3156
|
}
|
|
3157
3157
|
}
|
|
3158
|
-
function
|
|
3158
|
+
function Go(t) {
|
|
3159
3159
|
switch (t) {
|
|
3160
3160
|
case "string":
|
|
3161
3161
|
case "date":
|
|
@@ -3166,22 +3166,22 @@ function Bo(t) {
|
|
|
3166
3166
|
return;
|
|
3167
3167
|
}
|
|
3168
3168
|
}
|
|
3169
|
-
function
|
|
3169
|
+
function Qo(t, e, n) {
|
|
3170
3170
|
var r, i;
|
|
3171
3171
|
const s = (i = (r = t.entities[e]) === null || r === void 0 ? void 0 : r.attrs) === null || i === void 0 ? void 0 : i[n];
|
|
3172
3172
|
if (n === "id")
|
|
3173
3173
|
return null;
|
|
3174
3174
|
if (!s)
|
|
3175
3175
|
throw new Error(`${e}.${n} does not exist in your schema`);
|
|
3176
|
-
const { unique: o, indexed: u } = s == null ? void 0 : s.config, a =
|
|
3176
|
+
const { unique: o, indexed: u } = s == null ? void 0 : s.config, a = Go(s == null ? void 0 : s.valueType);
|
|
3177
3177
|
return {
|
|
3178
3178
|
"index?": u,
|
|
3179
3179
|
"unique?": o,
|
|
3180
3180
|
"checked-data-type": a
|
|
3181
3181
|
};
|
|
3182
3182
|
}
|
|
3183
|
-
function
|
|
3184
|
-
const i = t ?
|
|
3183
|
+
function nt(t, e, n, r) {
|
|
3184
|
+
const i = t ? Qo(t, e, n) : null, s = L(), u = [L(), e, n];
|
|
3185
3185
|
return Object.assign(Object.assign({ id: s, "forward-identity": u, "value-type": "blob", cardinality: "one", "unique?": !1, "index?": !1, isUnsynced: !0 }, i || {}), r || {});
|
|
3186
3186
|
}
|
|
3187
3187
|
function Ho(t, e, n) {
|
|
@@ -3193,8 +3193,8 @@ function Yo(t, e, n) {
|
|
|
3193
3193
|
throw new Error(`Couldn't find the link ${e}.${n} in your schema`);
|
|
3194
3194
|
const { forward: i, reverse: s } = r;
|
|
3195
3195
|
return {
|
|
3196
|
-
"forward-identity": [
|
|
3197
|
-
"reverse-identity": [
|
|
3196
|
+
"forward-identity": [L(), i.on, i.label],
|
|
3197
|
+
"reverse-identity": [L(), s.on, s.label],
|
|
3198
3198
|
cardinality: i.has === "one" ? "one" : "many",
|
|
3199
3199
|
"unique?": s.has === "one",
|
|
3200
3200
|
"on-delete": i.onDelete,
|
|
@@ -3202,7 +3202,7 @@ function Yo(t, e, n) {
|
|
|
3202
3202
|
};
|
|
3203
3203
|
}
|
|
3204
3204
|
function Xn(t, e, n, r) {
|
|
3205
|
-
const i = t ? Yo(t, e, n) : null, s =
|
|
3205
|
+
const i = t ? Yo(t, e, n) : null, s = L(), o = [L(), e, n], u = [L(), n, e];
|
|
3206
3206
|
return Object.assign(Object.assign({ id: s, "forward-identity": o, "reverse-identity": u, "value-type": "ref", cardinality: "many", "unique?": !1, "index?": !1, isUnsynced: !0 }, i || {}), r || {});
|
|
3207
3207
|
}
|
|
3208
3208
|
const Jo = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink"]), Zo = /* @__PURE__ */ new Set(["link", "unlink"]), Xo = /* @__PURE__ */ new Set(["create", "update", "merge"]), eu = /* @__PURE__ */ new Set([
|
|
@@ -3218,12 +3218,12 @@ function nu(t) {
|
|
|
3218
3218
|
const e = [], [n, r, i, s] = t;
|
|
3219
3219
|
if (!eu.has(n))
|
|
3220
3220
|
return e;
|
|
3221
|
-
const o =
|
|
3221
|
+
const o = Qt(i);
|
|
3222
3222
|
if (o && e.push({ etype: r, lookupPair: o }), n === "link")
|
|
3223
3223
|
for (const [u, a] of Object.entries(s)) {
|
|
3224
3224
|
const d = Array.isArray(a) ? a : [a];
|
|
3225
3225
|
for (const c of d) {
|
|
3226
|
-
const f =
|
|
3226
|
+
const f = Qt(c);
|
|
3227
3227
|
f && e.push({
|
|
3228
3228
|
etype: r,
|
|
3229
3229
|
lookupPair: f,
|
|
@@ -3254,27 +3254,27 @@ function ru({ attrs: t, schema: e }, n) {
|
|
|
3254
3254
|
const g = K(o, l, y), m = _e(o, l, y);
|
|
3255
3255
|
d(g), d(m);
|
|
3256
3256
|
const T = ((r = g == null ? void 0 : g["reverse-identity"]) === null || r === void 0 ? void 0 : r[1]) || ((i = m == null ? void 0 : m["forward-identity"]) === null || i === void 0 ? void 0 : i[1]) || y;
|
|
3257
|
-
if (
|
|
3258
|
-
c(T,
|
|
3257
|
+
if (Bt(o, T, b))
|
|
3258
|
+
c(T, Gt(b));
|
|
3259
3259
|
else {
|
|
3260
3260
|
const v = K(o, T, b);
|
|
3261
|
-
v || a(
|
|
3261
|
+
v || a(nt(e, T, b, Ht)), d(v);
|
|
3262
3262
|
}
|
|
3263
|
-
} else if (
|
|
3264
|
-
c(l,
|
|
3263
|
+
} else if (Bt(o, l, b))
|
|
3264
|
+
c(l, Gt(b));
|
|
3265
3265
|
else {
|
|
3266
3266
|
const g = K(o, l, b);
|
|
3267
|
-
g || a(
|
|
3267
|
+
g || a(nt(e, l, b, Ht)), d(g);
|
|
3268
3268
|
}
|
|
3269
3269
|
}
|
|
3270
3270
|
for (const f of n) {
|
|
3271
3271
|
const [l, p, y, b] = f;
|
|
3272
3272
|
if (Jo.has(l)) {
|
|
3273
3273
|
const g = K(o, p, "id");
|
|
3274
|
-
d(g), g || a(
|
|
3274
|
+
d(g), g || a(nt(e, p, "id", { "unique?": !0 }));
|
|
3275
3275
|
for (const m of Object.keys(b)) {
|
|
3276
3276
|
const T = K(o, p, m);
|
|
3277
|
-
if (d(T), Xo.has(l) && (T || a(
|
|
3277
|
+
if (d(T), Xo.has(l) && (T || a(nt(e, p, m, m === "id" ? { "unique?": !0 } : null))), Zo.has(l)) {
|
|
3278
3278
|
const v = _e(o, p, m);
|
|
3279
3279
|
!T && !v && a(Xn(e, p, m)), d(v);
|
|
3280
3280
|
}
|
|
@@ -3284,7 +3284,7 @@ function ru({ attrs: t, schema: e }, n) {
|
|
|
3284
3284
|
return [o, u];
|
|
3285
3285
|
}
|
|
3286
3286
|
function iu(t, e) {
|
|
3287
|
-
const r = (Array.isArray(e) ? e : [e]).flatMap((a) => Ro(a)), [i, s] = ru(t, r), o = Object.assign(Object.assign({}, t), { attrs: i }), u = r.flatMap((a) =>
|
|
3287
|
+
const r = (Array.isArray(e) ? e : [e]).flatMap((a) => Ro(a)), [i, s] = ru(t, r), o = Object.assign(Object.assign({}, t), { attrs: i }), u = r.flatMap((a) => Bo(o, a));
|
|
3288
3288
|
return [...s, ...u];
|
|
3289
3289
|
}
|
|
3290
3290
|
var re = function(t, e, n, r) {
|
|
@@ -3317,7 +3317,7 @@ var re = function(t, e, n, r) {
|
|
|
3317
3317
|
function er(t, e) {
|
|
3318
3318
|
typeof requestIdleCallback > "u" ? t() : requestIdleCallback(t, { timeout: e });
|
|
3319
3319
|
}
|
|
3320
|
-
const
|
|
3320
|
+
const qe = "__meta";
|
|
3321
3321
|
class su {
|
|
3322
3322
|
constructor(e, n) {
|
|
3323
3323
|
}
|
|
@@ -3338,7 +3338,7 @@ class Yt {
|
|
|
3338
3338
|
var e, n, r;
|
|
3339
3339
|
this._meta.loadingPromise && (yield this._meta.loadingPromise);
|
|
3340
3340
|
try {
|
|
3341
|
-
const i = this._persister.getItem(
|
|
3341
|
+
const i = this._persister.getItem(qe);
|
|
3342
3342
|
this._meta.loadingPromise = i;
|
|
3343
3343
|
const s = yield i;
|
|
3344
3344
|
this._meta.isLoading = !1, this._meta.error = null, this._meta.loadingPromise = null, this._meta.attempts = 0;
|
|
@@ -3434,7 +3434,7 @@ class Yt {
|
|
|
3434
3434
|
const y = this._persister.removeItem(p);
|
|
3435
3435
|
i.push(y.then(() => 1)), this._loadedKeys.delete(p), this._pendingSaveKeys.delete(p);
|
|
3436
3436
|
}
|
|
3437
|
-
const d = [], c = [[
|
|
3437
|
+
const d = [], c = [[qe, o]], f = (n = o.objects) !== null && n !== void 0 ? n : {};
|
|
3438
3438
|
o.objects = f;
|
|
3439
3439
|
for (const p of a)
|
|
3440
3440
|
if (this._loadedKeys.has(p)) {
|
|
@@ -3466,7 +3466,7 @@ class Yt {
|
|
|
3466
3466
|
if (!this._gcOpts)
|
|
3467
3467
|
return;
|
|
3468
3468
|
const e = new Set(yield this._persister.getAllKeys());
|
|
3469
|
-
e.delete(
|
|
3469
|
+
e.delete(qe);
|
|
3470
3470
|
const n = new Set(Object.keys(this.currentValue));
|
|
3471
3471
|
for (const l of Object.keys(this._loadingKeys))
|
|
3472
3472
|
n.add(l);
|
|
@@ -3637,7 +3637,7 @@ function du(t, e, n) {
|
|
|
3637
3637
|
const m = n.put(g, y);
|
|
3638
3638
|
i.add(m);
|
|
3639
3639
|
}
|
|
3640
|
-
const l = { objects: f }, p = n.put(l,
|
|
3640
|
+
const l = { objects: f }, p = n.put(l, qe);
|
|
3641
3641
|
i.add(p);
|
|
3642
3642
|
for (const y of i)
|
|
3643
3643
|
y.onsuccess = () => {
|
|
@@ -3697,7 +3697,7 @@ function fu(t, e) {
|
|
|
3697
3697
|
break;
|
|
3698
3698
|
}
|
|
3699
3699
|
}
|
|
3700
|
-
const d = tr(
|
|
3700
|
+
const d = tr(qe, a, s);
|
|
3701
3701
|
u.push(d), yield Promise.all(u), yield new Promise((c, f) => {
|
|
3702
3702
|
i.oncomplete = (l) => c(l), i.onerror = (l) => f(l), i.onabort = (l) => f(l);
|
|
3703
3703
|
});
|
|
@@ -3906,7 +3906,7 @@ function te(t, e) {
|
|
|
3906
3906
|
return n.status === 200 ? Promise.resolve(r) : Promise.reject(new bt({ status: n.status, body: r }));
|
|
3907
3907
|
});
|
|
3908
3908
|
}
|
|
3909
|
-
var
|
|
3909
|
+
var Pe = function(t, e, n, r) {
|
|
3910
3910
|
function i(s) {
|
|
3911
3911
|
return s instanceof n ? s : new n(function(o) {
|
|
3912
3912
|
o(s);
|
|
@@ -3941,7 +3941,7 @@ function pu({ apiURI: t, appId: e, email: n }) {
|
|
|
3941
3941
|
});
|
|
3942
3942
|
}
|
|
3943
3943
|
function yu(t) {
|
|
3944
|
-
return
|
|
3944
|
+
return Pe(this, arguments, void 0, function* ({ apiURI: e, appId: n, email: r, code: i, refreshToken: s }) {
|
|
3945
3945
|
return yield te(`${e}/runtime/auth/verify_magic_code`, {
|
|
3946
3946
|
method: "POST",
|
|
3947
3947
|
headers: { "content-type": "application/json" },
|
|
@@ -3954,7 +3954,7 @@ function yu(t) {
|
|
|
3954
3954
|
});
|
|
3955
3955
|
}
|
|
3956
3956
|
function bu(t) {
|
|
3957
|
-
return
|
|
3957
|
+
return Pe(this, arguments, void 0, function* ({ apiURI: e, appId: n, refreshToken: r }) {
|
|
3958
3958
|
return yield te(`${e}/runtime/auth/verify_refresh_token`, {
|
|
3959
3959
|
method: "POST",
|
|
3960
3960
|
headers: { "content-type": "application/json" },
|
|
@@ -3966,7 +3966,7 @@ function bu(t) {
|
|
|
3966
3966
|
});
|
|
3967
3967
|
}
|
|
3968
3968
|
function _u(t) {
|
|
3969
|
-
return
|
|
3969
|
+
return Pe(this, arguments, void 0, function* ({ apiURI: e, appId: n }) {
|
|
3970
3970
|
return yield te(`${e}/runtime/auth/sign_in_guest`, {
|
|
3971
3971
|
method: "POST",
|
|
3972
3972
|
headers: { "content-type": "application/json" },
|
|
@@ -3977,7 +3977,7 @@ function _u(t) {
|
|
|
3977
3977
|
});
|
|
3978
3978
|
}
|
|
3979
3979
|
function rr(t) {
|
|
3980
|
-
return
|
|
3980
|
+
return Pe(this, arguments, void 0, function* ({ apiURI: e, appId: n, code: r, codeVerifier: i, refreshToken: s }) {
|
|
3981
3981
|
return yield te(`${e}/runtime/oauth/token`, {
|
|
3982
3982
|
method: "POST",
|
|
3983
3983
|
headers: { "content-type": "application/json" },
|
|
@@ -3991,7 +3991,7 @@ function rr(t) {
|
|
|
3991
3991
|
});
|
|
3992
3992
|
}
|
|
3993
3993
|
function gu(t) {
|
|
3994
|
-
return
|
|
3994
|
+
return Pe(this, arguments, void 0, function* ({ apiURI: e, appId: n, nonce: r, idToken: i, clientName: s, refreshToken: o }) {
|
|
3995
3995
|
return yield te(`${e}/runtime/oauth/id_token`, {
|
|
3996
3996
|
method: "POST",
|
|
3997
3997
|
headers: { "content-type": "application/json" },
|
|
@@ -4006,7 +4006,7 @@ function gu(t) {
|
|
|
4006
4006
|
});
|
|
4007
4007
|
}
|
|
4008
4008
|
function Tu(t) {
|
|
4009
|
-
return
|
|
4009
|
+
return Pe(this, arguments, void 0, function* ({ apiURI: e, appId: n, refreshToken: r }) {
|
|
4010
4010
|
return yield te(`${e}/runtime/signout`, {
|
|
4011
4011
|
method: "POST",
|
|
4012
4012
|
headers: {
|
|
@@ -4188,7 +4188,7 @@ function ur(t) {
|
|
|
4188
4188
|
}, e;
|
|
4189
4189
|
}, {});
|
|
4190
4190
|
}
|
|
4191
|
-
const oi = "v0.22.88-experimental.drewh-
|
|
4191
|
+
const oi = "v0.22.88-experimental.drewh-fix-explorer.20248904996.1";
|
|
4192
4192
|
function ju(t, e) {
|
|
4193
4193
|
return {
|
|
4194
4194
|
info: t ? (...n) => console.info(...n, e()) : () => {
|
|
@@ -4295,7 +4295,7 @@ const ar = [
|
|
|
4295
4295
|
Cu(d, c, s, e, r, n, `${i}.${d}`);
|
|
4296
4296
|
} else if (!ui(t, s, o))
|
|
4297
4297
|
throw new M(`Invalid value for attribute '${e}' in entity '${r}'. Expected ${s}, but received: ${typeof t}`, i);
|
|
4298
|
-
},
|
|
4298
|
+
}, Pu = (t, e, n, r, i) => {
|
|
4299
4299
|
const s = t.split(".");
|
|
4300
4300
|
if (s.length < 2)
|
|
4301
4301
|
throw new M(`Invalid dot notation path '${t}'. Must contain at least one dot.`, i);
|
|
@@ -4345,7 +4345,7 @@ const ar = [
|
|
|
4345
4345
|
continue;
|
|
4346
4346
|
}
|
|
4347
4347
|
if (i.includes(".")) {
|
|
4348
|
-
|
|
4348
|
+
Pu(i, s, e, n, `${r}.${i}`);
|
|
4349
4349
|
continue;
|
|
4350
4350
|
}
|
|
4351
4351
|
const o = n.entities[e];
|
|
@@ -4365,7 +4365,7 @@ const ar = [
|
|
|
4365
4365
|
Oe(s, i, d, e, `${r}.${i}`);
|
|
4366
4366
|
}
|
|
4367
4367
|
}
|
|
4368
|
-
},
|
|
4368
|
+
}, Iu = (t, e, n, r, i = 0) => {
|
|
4369
4369
|
for (const o of Object.keys(t))
|
|
4370
4370
|
if (!ar.includes(o))
|
|
4371
4371
|
throw new M(`Invalid query parameter '${o}' in $ object. Valid parameters are: ${ar.join(", ")}. Found: ${o}`, r);
|
|
@@ -4404,7 +4404,7 @@ const ar = [
|
|
|
4404
4404
|
const u = t[o];
|
|
4405
4405
|
if (typeof u != "object" || u === null)
|
|
4406
4406
|
throw new M(`Query parameter '$' must be an object in entity '${e}', but received: ${typeof u}`, `${r}.$`);
|
|
4407
|
-
|
|
4407
|
+
Iu(u, e, n, `${r}.$`, i);
|
|
4408
4408
|
}
|
|
4409
4409
|
}, cr = (t, e) => {
|
|
4410
4410
|
if (typeof t != "object" || t === null)
|
|
@@ -4701,7 +4701,7 @@ function Nu(t, e, n) {
|
|
|
4701
4701
|
const s = (r = e == null ? void 0 : e.state) === null || r === void 0 ? void 0 : r.txId, o = (i = n == null ? void 0 : n.state) === null || i === void 0 ? void 0 : i.txId;
|
|
4702
4702
|
return s && (!o || s > o) ? e : o && (!s || o > s) ? n : e || n;
|
|
4703
4703
|
}
|
|
4704
|
-
function
|
|
4704
|
+
function Pt(t, e) {
|
|
4705
4705
|
return Jr({ store: e, pageInfo: null, aggregate: null }, t.query).data[t.table][0];
|
|
4706
4706
|
}
|
|
4707
4707
|
function br(t, e, n) {
|
|
@@ -4748,7 +4748,7 @@ function Ku(t, e) {
|
|
|
4748
4748
|
}
|
|
4749
4749
|
return o;
|
|
4750
4750
|
}
|
|
4751
|
-
function
|
|
4751
|
+
function rt(t, e) {
|
|
4752
4752
|
return { [t.table]: e.map((n) => n.entity) };
|
|
4753
4753
|
}
|
|
4754
4754
|
function qu(t, e) {
|
|
@@ -4762,17 +4762,17 @@ function zu(t, e, n) {
|
|
|
4762
4762
|
const r = e;
|
|
4763
4763
|
if (t.orderField === "serverCreatedAt") {
|
|
4764
4764
|
n.sort(t.orderDirection === "asc" ? function(o, u) {
|
|
4765
|
-
return
|
|
4765
|
+
return Fe(o.entity.id, o.serverCreatedAt, u.entity.id, u.serverCreatedAt, r);
|
|
4766
4766
|
} : function(o, u) {
|
|
4767
|
-
return
|
|
4767
|
+
return Fe(u.entity.id, u.serverCreatedAt, o.entity.id, o.serverCreatedAt, r);
|
|
4768
4768
|
});
|
|
4769
4769
|
return;
|
|
4770
4770
|
}
|
|
4771
4771
|
const i = t.orderField;
|
|
4772
4772
|
n.sort(t.orderDirection === "asc" ? function(o, u) {
|
|
4773
|
-
return
|
|
4773
|
+
return Fe(o.entity.id, o.entity[i], u.entity.id, u.entity[i], r);
|
|
4774
4774
|
} : function(o, u) {
|
|
4775
|
-
return
|
|
4775
|
+
return Fe(u.entity.id, u.entity[i], o.entity.id, o.entity[i], r);
|
|
4776
4776
|
});
|
|
4777
4777
|
}
|
|
4778
4778
|
var pe;
|
|
@@ -4805,7 +4805,7 @@ class Vu {
|
|
|
4805
4805
|
this.subs.flush();
|
|
4806
4806
|
}
|
|
4807
4807
|
subscribe(e, n) {
|
|
4808
|
-
const r =
|
|
4808
|
+
const r = N(e);
|
|
4809
4809
|
return this.callbacks[r] = this.callbacks[r] || [], this.callbacks[r].push(n), this.initSubscription(e, r, n), (i) => {
|
|
4810
4810
|
this.unsubscribe(r, n, i == null ? void 0 : i.keepSubscription);
|
|
4811
4811
|
};
|
|
@@ -4821,7 +4821,7 @@ class Vu {
|
|
|
4821
4821
|
}
|
|
4822
4822
|
}
|
|
4823
4823
|
sendStart(e) {
|
|
4824
|
-
this.trySend(
|
|
4824
|
+
this.trySend(L(), {
|
|
4825
4825
|
op: "start-sync",
|
|
4826
4826
|
q: e
|
|
4827
4827
|
});
|
|
@@ -4835,7 +4835,7 @@ class Vu {
|
|
|
4835
4835
|
});
|
|
4836
4836
|
}
|
|
4837
4837
|
sendRemove(e, n) {
|
|
4838
|
-
this.trySend(
|
|
4838
|
+
this.trySend(L(), {
|
|
4839
4839
|
op: "remove-sync",
|
|
4840
4840
|
"subscription-id": e.subscriptionId,
|
|
4841
4841
|
"keep-subscription": n
|
|
@@ -4849,7 +4849,7 @@ class Vu {
|
|
|
4849
4849
|
if (a && a.state && a.state.txId) {
|
|
4850
4850
|
this.sendResync(a, a.state, a.state.txId), !((i = a.values) === null || i === void 0) && i.entities && r && r({
|
|
4851
4851
|
type: pe.LoadFromStorage,
|
|
4852
|
-
data:
|
|
4852
|
+
data: rt(a, (s = a.values) === null || s === void 0 ? void 0 : s.entities)
|
|
4853
4853
|
});
|
|
4854
4854
|
return;
|
|
4855
4855
|
}
|
|
@@ -4877,7 +4877,7 @@ class Vu {
|
|
|
4877
4877
|
});
|
|
4878
4878
|
}
|
|
4879
4879
|
onStartSyncOk(e) {
|
|
4880
|
-
const n = e["subscription-id"], r = e.q, i =
|
|
4880
|
+
const n = e["subscription-id"], r = e.q, i = N(r);
|
|
4881
4881
|
this.idToHash[n] = i, this.subs.updateInPlace((s) => {
|
|
4882
4882
|
const o = s[i];
|
|
4883
4883
|
if (!o)
|
|
@@ -4913,7 +4913,7 @@ class Vu {
|
|
|
4913
4913
|
for (const c of i) {
|
|
4914
4914
|
const f = this.createStore(c);
|
|
4915
4915
|
a.attrs = f.attrs;
|
|
4916
|
-
const l =
|
|
4916
|
+
const l = Pt(u, f);
|
|
4917
4917
|
d.push({
|
|
4918
4918
|
store: f,
|
|
4919
4919
|
entity: l,
|
|
@@ -4924,7 +4924,7 @@ class Vu {
|
|
|
4924
4924
|
c[s] = u, c[s].updatedAt = Date.now();
|
|
4925
4925
|
}), u.values && this.notifyCbs(s, {
|
|
4926
4926
|
type: pe.InitialSyncBatch,
|
|
4927
|
-
data:
|
|
4927
|
+
data: rt(u, u.values.entities),
|
|
4928
4928
|
batch: o
|
|
4929
4929
|
});
|
|
4930
4930
|
}
|
|
@@ -4949,7 +4949,7 @@ class Vu {
|
|
|
4949
4949
|
const s = this.subs.currentValue[i];
|
|
4950
4950
|
s && this.notifyCbs(i, {
|
|
4951
4951
|
type: pe.InitialSyncComplete,
|
|
4952
|
-
data:
|
|
4952
|
+
data: rt(s, ((n = s.values) === null || n === void 0 ? void 0 : n.entities) || [])
|
|
4953
4953
|
});
|
|
4954
4954
|
}
|
|
4955
4955
|
onSyncUpdateTriples(e) {
|
|
@@ -4989,12 +4989,12 @@ class Vu {
|
|
|
4989
4989
|
const S = p[k];
|
|
4990
4990
|
if (vs(S.store, T)) {
|
|
4991
4991
|
_r(S.store, v);
|
|
4992
|
-
const
|
|
4993
|
-
|
|
4992
|
+
const I = Pt(u, S.store), R = Ku(S.store, v)[T];
|
|
4993
|
+
I ? (y.push({
|
|
4994
4994
|
oldEntity: S.entity,
|
|
4995
|
-
newEntity:
|
|
4995
|
+
newEntity: I,
|
|
4996
4996
|
changedFields: R || {}
|
|
4997
|
-
}), S.entity =
|
|
4997
|
+
}), S.entity = I) : c.push(k), delete f[T];
|
|
4998
4998
|
continue e;
|
|
4999
4999
|
}
|
|
5000
5000
|
}
|
|
@@ -5002,7 +5002,7 @@ class Vu {
|
|
|
5002
5002
|
for (const [T, v] of Object.entries(f)) {
|
|
5003
5003
|
const k = this.createStore([]);
|
|
5004
5004
|
l.attrs = k.attrs, _r(k, v);
|
|
5005
|
-
const S =
|
|
5005
|
+
const S = Pt(u, k);
|
|
5006
5006
|
if (!S) {
|
|
5007
5007
|
this.log.error("No entity found after applying change", {
|
|
5008
5008
|
sub: u,
|
|
@@ -5023,7 +5023,7 @@ class Vu {
|
|
|
5023
5023
|
const m = qu(u, this.createStore);
|
|
5024
5024
|
zu(u, m, p), this.notifyCbs(o, {
|
|
5025
5025
|
type: pe.SyncTransaction,
|
|
5026
|
-
data:
|
|
5026
|
+
data: rt(u, (i = u.values) === null || i === void 0 ? void 0 : i.entities),
|
|
5027
5027
|
added: b,
|
|
5028
5028
|
removed: g,
|
|
5029
5029
|
updated: y
|
|
@@ -5045,7 +5045,7 @@ class Vu {
|
|
|
5045
5045
|
}
|
|
5046
5046
|
}
|
|
5047
5047
|
onStartSyncError(e) {
|
|
5048
|
-
const n =
|
|
5048
|
+
const n = N(e["original-event"].q), r = {
|
|
5049
5049
|
message: e.message || "Uh-oh, something went wrong. Ping Joe & Stopa.",
|
|
5050
5050
|
status: e.status,
|
|
5051
5051
|
type: e.type,
|
|
@@ -5062,7 +5062,7 @@ class Vu {
|
|
|
5062
5062
|
r && this.initSubscription(r.query, r.hash);
|
|
5063
5063
|
}
|
|
5064
5064
|
}
|
|
5065
|
-
var
|
|
5065
|
+
var U = function(t, e, n, r) {
|
|
5066
5066
|
function i(s) {
|
|
5067
5067
|
return s instanceof n ? s : new n(function(o) {
|
|
5068
5068
|
o(s);
|
|
@@ -5102,10 +5102,10 @@ const se = {
|
|
|
5102
5102
|
AUTHENTICATED: "authenticated",
|
|
5103
5103
|
CLOSED: "closed",
|
|
5104
5104
|
ERRORED: "errored"
|
|
5105
|
-
},
|
|
5105
|
+
}, Bu = 3e4, Gu = 3e4, Qu = 200, Hu = {
|
|
5106
5106
|
apiURI: "https://api.instantdb.com",
|
|
5107
5107
|
websocketURI: "wss://api.instantdb.com/runtime/session"
|
|
5108
|
-
},
|
|
5108
|
+
}, It = "_instant_oauth_redirect", De = "currentUser";
|
|
5109
5109
|
function Yu({ transportType: t, appId: e, apiURI: n, wsURI: r, EventSourceImpl: i }) {
|
|
5110
5110
|
if (!i)
|
|
5111
5111
|
return new pr(`${r}?app_id=${e}`);
|
|
@@ -5185,12 +5185,12 @@ class ra {
|
|
|
5185
5185
|
}
|
|
5186
5186
|
}, this.getPreviousResult = (d) => {
|
|
5187
5187
|
var c;
|
|
5188
|
-
const f =
|
|
5188
|
+
const f = N(d);
|
|
5189
5189
|
return (c = this.dataForQuery(f)) === null || c === void 0 ? void 0 : c.data;
|
|
5190
5190
|
}, this.notifyOne = (d) => {
|
|
5191
5191
|
var c, f;
|
|
5192
5192
|
const l = (c = this.queryCbs[d]) !== null && c !== void 0 ? c : [], p = (f = this._dataForQueryCache[d]) === null || f === void 0 ? void 0 : f.data, y = this.dataForQuery(d);
|
|
5193
|
-
y != null && y.data && (this._dataForQueryCache[d] = y, !
|
|
5193
|
+
y != null && y.data && (this._dataForQueryCache[d] = y, !ut(y.data, p) && l.forEach((b) => b.cb(y.data)));
|
|
5194
5194
|
}, this.notifyOneQueryOnce = (d) => {
|
|
5195
5195
|
var c, f;
|
|
5196
5196
|
const l = (c = this.queryOnceDfds[d]) !== null && c !== void 0 ? c : [], p = (f = this.dataForQuery(d)) === null || f === void 0 ? void 0 : f.data;
|
|
@@ -5216,7 +5216,7 @@ class ra {
|
|
|
5216
5216
|
return this.pushOps([], c);
|
|
5217
5217
|
}
|
|
5218
5218
|
}, this.pushOps = (d, c) => {
|
|
5219
|
-
const f =
|
|
5219
|
+
const f = L(), l = [...this._pendingMutations().values()], p = Math.max(0, ...l.map((g) => g.order || 0)) + 1, y = {
|
|
5220
5220
|
op: "transact",
|
|
5221
5221
|
"tx-steps": d,
|
|
5222
5222
|
created: Date.now(),
|
|
@@ -5236,7 +5236,7 @@ class ra {
|
|
|
5236
5236
|
}
|
|
5237
5237
|
this._log.info("[socket][open]", this._transport.id), this._setStatus(se.OPENED), this.getCurrentUser().then((f) => {
|
|
5238
5238
|
var l;
|
|
5239
|
-
this._trySend(
|
|
5239
|
+
this._trySend(L(), {
|
|
5240
5240
|
op: "init",
|
|
5241
5241
|
"app-id": this.config.appId,
|
|
5242
5242
|
"refresh-token": (l = f.user) === null || l === void 0 ? void 0 : l.refresh_token,
|
|
@@ -5291,12 +5291,12 @@ class ra {
|
|
|
5291
5291
|
return;
|
|
5292
5292
|
}
|
|
5293
5293
|
this._log.info("[socket][close]", c.id, "schedule reconnect, ms =", this._reconnectTimeoutMs), this._scheduleReconnect();
|
|
5294
|
-
}, this._EventSource = s, this.config = Object.assign(Object.assign({}, Hu), e), this.queryCacheLimit = (o = this.config.queryCacheLimit) !== null && o !== void 0 ? o : 10, this._pendingTxCleanupTimeout = (u = this.config.pendingTxCleanupTimeout) !== null && u !== void 0 ? u :
|
|
5294
|
+
}, this._EventSource = s, this.config = Object.assign(Object.assign({}, Hu), e), this.queryCacheLimit = (o = this.config.queryCacheLimit) !== null && o !== void 0 ? o : 10, this._pendingTxCleanupTimeout = (u = this.config.pendingTxCleanupTimeout) !== null && u !== void 0 ? u : Gu, this._pendingMutationCleanupThreshold = (a = this.config.pendingMutationCleanupThreshold) !== null && a !== void 0 ? a : Qu, this._log = ju(e.verbose || hn || ri, () => this._reactorStats()), this.versions = Object.assign(Object.assign({}, i || {}), { "@instantdb/core": oi }), this.config.schema && (this._linkIndex = ur(this.config.schema)), !!Ju()) {
|
|
5295
5295
|
if (!e.appId)
|
|
5296
5296
|
throw new Error("Instant must be initialized with an appId.");
|
|
5297
5297
|
if (!Ee(e.appId))
|
|
5298
5298
|
throw new Error(`Instant must be initialized with a valid appId. \`${e.appId}\` is not a valid uuid.`);
|
|
5299
|
-
typeof BroadcastChannel == "function" && (this._broadcastChannel = new BroadcastChannel("@instantdb"), this._broadcastChannel.addEventListener("message", (d) =>
|
|
5299
|
+
typeof BroadcastChannel == "function" && (this._broadcastChannel = new BroadcastChannel("@instantdb"), this._broadcastChannel.addEventListener("message", (d) => U(this, void 0, void 0, function* () {
|
|
5300
5300
|
var c;
|
|
5301
5301
|
try {
|
|
5302
5302
|
if (((c = d.data) === null || c === void 0 ? void 0 : c.type) === "auth") {
|
|
@@ -5308,12 +5308,7 @@ class ra {
|
|
|
5308
5308
|
}
|
|
5309
5309
|
}))), this._initStorage(n), this._syncTable = new Vu(this._trySendAuthed.bind(this), new n(this.config.appId, "syncSubs"), {
|
|
5310
5310
|
useDateObjects: this.config.useDateObjects
|
|
5311
|
-
}, this._log, (d) =>
|
|
5312
|
-
this.syncUserToEndpoint(d.user);
|
|
5313
|
-
}), setInterval(() => $(this, void 0, void 0, function* () {
|
|
5314
|
-
const d = yield this.getCurrentUser();
|
|
5315
|
-
this.syncUserToEndpoint(d.user);
|
|
5316
|
-
}), 1e3 * 60 * 20), r.getIsOnline().then((d) => {
|
|
5311
|
+
}, 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) => {
|
|
5317
5312
|
this._isOnline = d, this._startSocket(), r.listen((c) => {
|
|
5318
5313
|
c !== this._isOnline && (this._log.info("[network] online =", c), this._isOnline = c, this._isOnline ? this._startSocket() : (this._log.info("Changing status from", this.status, "to", se.CLOSED), this._setStatus(se.CLOSED)));
|
|
5319
5314
|
});
|
|
@@ -5410,29 +5405,6 @@ class ra {
|
|
|
5410
5405
|
this._tryBroadcast(e, a, u, d);
|
|
5411
5406
|
}
|
|
5412
5407
|
}
|
|
5413
|
-
/**
|
|
5414
|
-
* Does the same thing as add-query-ok
|
|
5415
|
-
* but called as a result of receiving query info from ssr
|
|
5416
|
-
* @param {any} q
|
|
5417
|
-
* @param {{ triples: any; pageInfo: any; }} result
|
|
5418
|
-
* @param {boolean} enableCardinalityInference
|
|
5419
|
-
*/
|
|
5420
|
-
_addQueryData(e, n, r) {
|
|
5421
|
-
if (!this.attrs)
|
|
5422
|
-
throw new Error("Attrs in reactor have not been set");
|
|
5423
|
-
const i = L(e), s = Fe(this.attrs, n.triples, r, this._linkIndex, this.config.useDateObjects);
|
|
5424
|
-
this.querySubs.updateInPlace((o) => {
|
|
5425
|
-
o[i] = {
|
|
5426
|
-
result: {
|
|
5427
|
-
store: s,
|
|
5428
|
-
pageInfo: n.pageInfo,
|
|
5429
|
-
processedTxId: void 0,
|
|
5430
|
-
isExternal: !0
|
|
5431
|
-
},
|
|
5432
|
-
q: e
|
|
5433
|
-
};
|
|
5434
|
-
}), this._cleanupPendingMutationsQueries(), this.notifyOne(i), this.notifyOneQueryOnce(i), this._cleanupPendingMutationsTimeout();
|
|
5435
|
-
}
|
|
5436
5408
|
_handleReceive(e, n) {
|
|
5437
5409
|
var r, i, s, o, u, a;
|
|
5438
5410
|
const d = !!this.config.schema && ("cardinalityInference" in this.config ? !!this.config.cardinalityInference : !0);
|
|
@@ -5446,14 +5418,14 @@ class ra {
|
|
|
5446
5418
|
break;
|
|
5447
5419
|
}
|
|
5448
5420
|
case "add-query-exists": {
|
|
5449
|
-
this.notifyOneQueryOnce(
|
|
5421
|
+
this.notifyOneQueryOnce(N(n.q));
|
|
5450
5422
|
break;
|
|
5451
5423
|
}
|
|
5452
5424
|
case "add-query-ok": {
|
|
5453
|
-
const { q: l, result: p } = n, y =
|
|
5425
|
+
const { q: l, result: p } = n, y = N(l);
|
|
5454
5426
|
if (!this._hasQueryListeners() && !this.querySubs.currentValue[y])
|
|
5455
5427
|
break;
|
|
5456
|
-
const b = (o = (s = p == null ? void 0 : p[0]) === null || s === void 0 ? void 0 : s.data) === null || o === void 0 ? void 0 : o["page-info"], g = (a = (u = p == null ? void 0 : p[0]) === null || u === void 0 ? void 0 : u.data) === null || a === void 0 ? void 0 : a.aggregate, m = or(p), T =
|
|
5428
|
+
const b = (o = (s = p == null ? void 0 : p[0]) === null || s === void 0 ? void 0 : s.data) === null || o === void 0 ? void 0 : o["page-info"], g = (a = (u = p == null ? void 0 : p[0]) === null || u === void 0 ? void 0 : u.data) === null || a === void 0 ? void 0 : a.aggregate, m = or(p), T = at(this.attrs, m, d, this._linkIndex, this.config.useDateObjects);
|
|
5457
5429
|
this.querySubs.updateInPlace((v) => {
|
|
5458
5430
|
if (!v[y]) {
|
|
5459
5431
|
this._log.info("Missing value in querySubs", { hash: y, q: l });
|
|
@@ -5492,17 +5464,17 @@ class ra {
|
|
|
5492
5464
|
T.pendingMutations = b;
|
|
5493
5465
|
});
|
|
5494
5466
|
const g = Tr(b.entries()), m = l.map((T) => {
|
|
5495
|
-
var v, k, S,
|
|
5496
|
-
const R = T["instaql-query"], q = T["instaql-result"],
|
|
5497
|
-
return { q: R, hash:
|
|
5467
|
+
var v, k, S, I;
|
|
5468
|
+
const R = T["instaql-query"], q = T["instaql-result"], Ie = N(R), Qe = or(q), _t = at(this.attrs, Qe, d, this._linkIndex, this.config.useDateObjects), gt = this._applyOptimisticUpdates(_t, g, y), He = (k = (v = q == null ? void 0 : q[0]) === null || v === void 0 ? void 0 : v.data) === null || k === void 0 ? void 0 : k["page-info"], ne = (I = (S = q == null ? void 0 : q[0]) === null || S === void 0 ? void 0 : S.data) === null || I === void 0 ? void 0 : I.aggregate;
|
|
5469
|
+
return { q: R, hash: Ie, store: gt, pageInfo: He, aggregate: ne };
|
|
5498
5470
|
});
|
|
5499
|
-
m.forEach(({ hash: T, q: v, store: k, pageInfo: S, aggregate:
|
|
5471
|
+
m.forEach(({ hash: T, q: v, store: k, pageInfo: S, aggregate: I }) => {
|
|
5500
5472
|
this.querySubs.updateInPlace((R) => {
|
|
5501
5473
|
if (!R[T]) {
|
|
5502
5474
|
this._log.error("Missing value in querySubs", { hash: T, q: v });
|
|
5503
5475
|
return;
|
|
5504
5476
|
}
|
|
5505
|
-
R[T].result = { store: k, pageInfo: S, aggregate:
|
|
5477
|
+
R[T].result = { store: k, pageInfo: S, aggregate: I, processedTxId: y };
|
|
5506
5478
|
});
|
|
5507
5479
|
}), this._cleanupPendingMutationsQueries(), m.forEach(({ hash: T }) => {
|
|
5508
5480
|
this.notifyOne(T);
|
|
@@ -5603,8 +5575,8 @@ class ra {
|
|
|
5603
5575
|
return;
|
|
5604
5576
|
}
|
|
5605
5577
|
if (!((n = e["original-event"]) === null || n === void 0) && n.hasOwnProperty("q") && ((r = e["original-event"]) === null || r === void 0 ? void 0 : r.op) === "add-query") {
|
|
5606
|
-
const y = (i = e["original-event"]) === null || i === void 0 ? void 0 : i.q, b =
|
|
5607
|
-
this.notifyQueryError(
|
|
5578
|
+
const y = (i = e["original-event"]) === null || i === void 0 ? void 0 : i.q, b = N(y);
|
|
5579
|
+
this.notifyQueryError(N(y), f), this.notifyQueryOnceError(y, b, d, f);
|
|
5608
5580
|
return;
|
|
5609
5581
|
}
|
|
5610
5582
|
if (((s = e["original-event"]) === null || s === void 0 ? void 0 : s.op) === "init") {
|
|
@@ -5636,7 +5608,7 @@ class ra {
|
|
|
5636
5608
|
this.attrs = e.reduce((n, r) => (n[r.id] = r, n), {}), this.notifyAttrsSubs();
|
|
5637
5609
|
}
|
|
5638
5610
|
_startQuerySub(e, n) {
|
|
5639
|
-
const r =
|
|
5611
|
+
const r = L();
|
|
5640
5612
|
return this.querySubs.updateInPlace((i) => {
|
|
5641
5613
|
i[n] = i[n] || { q: e, result: null, eventId: r }, i[n].lastAccessed = Date.now();
|
|
5642
5614
|
}), this._trySendAuthed(r, { op: "add-query", q: e }), r;
|
|
@@ -5657,7 +5629,7 @@ class ra {
|
|
|
5657
5629
|
subscribeQuery(e, n, r) {
|
|
5658
5630
|
var i;
|
|
5659
5631
|
this.config.disableValidation || cr(e, this.config.schema), r && "ruleParams" in r && (e = Object.assign({ $$ruleParams: r.ruleParams }, e));
|
|
5660
|
-
const s =
|
|
5632
|
+
const s = N(e), o = this.getPreviousResult(e);
|
|
5661
5633
|
return o && n(o), this.queryCbs[s] = (i = this.queryCbs[s]) !== null && i !== void 0 ? i : [], this.queryCbs[s].push({ q: e, cb: n }), this._startQuerySub(e, s), () => {
|
|
5662
5634
|
this._unsubQuery(e, s, n);
|
|
5663
5635
|
};
|
|
@@ -5670,8 +5642,8 @@ class ra {
|
|
|
5670
5642
|
return i.reject(new Error("We can't run `queryOnce`, because the device is offline.")), i.promise;
|
|
5671
5643
|
if (!this.querySubs)
|
|
5672
5644
|
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;
|
|
5673
|
-
const s =
|
|
5674
|
-
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")),
|
|
5645
|
+
const s = N(e), o = this._startQuerySub(e, s);
|
|
5646
|
+
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")), Bu), i.promise;
|
|
5675
5647
|
}
|
|
5676
5648
|
_completeQueryOnce(e, n, r) {
|
|
5677
5649
|
this.queryOnceDfds[n] && (this.queryOnceDfds[n] = this.queryOnceDfds[n].filter((i) => i.dfd !== r), this._cleanupQuery(e, n));
|
|
@@ -5684,7 +5656,7 @@ class ra {
|
|
|
5684
5656
|
return !!(!((n = this.queryCbs[e]) === null || n === void 0) && n.length || !((r = this.queryOnceDfds[e]) === null || r === void 0) && r.length);
|
|
5685
5657
|
}
|
|
5686
5658
|
_cleanupQuery(e, n) {
|
|
5687
|
-
this._hasQueryListeners(n) || (delete this.queryCbs[n], delete this.queryOnceDfds[n], delete this._dataForQueryCache[n], this.querySubs.unloadKey(n), this._trySendAuthed(
|
|
5659
|
+
this._hasQueryListeners(n) || (delete this.queryCbs[n], delete this.queryOnceDfds[n], delete this._dataForQueryCache[n], this.querySubs.unloadKey(n), this._trySendAuthed(L(), { op: "remove-query", q: e }));
|
|
5688
5660
|
}
|
|
5689
5661
|
// When we `pushTx`, it's possible that we don't yet have `this.attrs`
|
|
5690
5662
|
// This means that `tx-steps` in `pendingMutations` will include `add-attr`
|
|
@@ -5763,21 +5735,20 @@ class ra {
|
|
|
5763
5735
|
return Object.fromEntries(s.map((u) => [u.id, u]));
|
|
5764
5736
|
}
|
|
5765
5737
|
/** Runs instaql on a query and a store */
|
|
5766
|
-
dataForQuery(e
|
|
5767
|
-
const
|
|
5768
|
-
if (
|
|
5769
|
-
return { error:
|
|
5738
|
+
dataForQuery(e) {
|
|
5739
|
+
const n = this._errorMessage;
|
|
5740
|
+
if (n)
|
|
5741
|
+
return { error: n };
|
|
5770
5742
|
if (!this.querySubs || !this.kv.currentValue.pendingMutations)
|
|
5771
5743
|
return;
|
|
5772
|
-
const
|
|
5773
|
-
if (!
|
|
5744
|
+
const r = this.querySubs.version(), i = this.querySubs.currentValue, s = this.kv.version(), o = this._pendingMutations(), { q: u, result: a } = i[e] || {};
|
|
5745
|
+
if (!a)
|
|
5774
5746
|
return;
|
|
5775
|
-
const
|
|
5776
|
-
if (
|
|
5777
|
-
return
|
|
5778
|
-
|
|
5779
|
-
|
|
5780
|
-
return n && (f = this._applyOptimisticUpdates(f, b, y)), { data: Jr({ store: f, pageInfo: l, aggregate: p }, a), querySubVersion: i, pendingMutationsVersion: o };
|
|
5747
|
+
const d = this._dataForQueryCache[e];
|
|
5748
|
+
if (d && r === d.querySubVersion && s === d.pendingMutationsVersion)
|
|
5749
|
+
return d;
|
|
5750
|
+
const { store: c, pageInfo: f, aggregate: l, processedTxId: p } = a, y = this._rewriteMutationsSorted(c.attrs, o), b = this._applyOptimisticUpdates(c, y, p);
|
|
5751
|
+
return { data: Jr({ store: b, pageInfo: f, aggregate: l }, u), querySubVersion: r, pendingMutationsVersion: s };
|
|
5781
5752
|
}
|
|
5782
5753
|
_applyOptimisticUpdates(e, n, r) {
|
|
5783
5754
|
for (const [i, s] of n)
|
|
@@ -5907,14 +5878,14 @@ class ra {
|
|
|
5907
5878
|
*
|
|
5908
5879
|
*/
|
|
5909
5880
|
getLocalId(e) {
|
|
5910
|
-
return
|
|
5881
|
+
return U(this, void 0, void 0, function* () {
|
|
5911
5882
|
const n = `localToken_${e}`;
|
|
5912
5883
|
if (this.kv.currentValue[n])
|
|
5913
5884
|
return this.kv.currentValue[n];
|
|
5914
5885
|
const r = yield this.kv.waitForKeyToLoad(n);
|
|
5915
5886
|
if (r)
|
|
5916
5887
|
return r;
|
|
5917
|
-
const i =
|
|
5888
|
+
const i = L();
|
|
5918
5889
|
return this.kv.updateInPlace((s) => {
|
|
5919
5890
|
s[n] || (s[n] = i);
|
|
5920
5891
|
}), yield this.kv.waitForKeyToLoad(n);
|
|
@@ -5926,9 +5897,9 @@ class ra {
|
|
|
5926
5897
|
if (typeof URL > "u")
|
|
5927
5898
|
return;
|
|
5928
5899
|
const e = new URL(window.location.href);
|
|
5929
|
-
if (e.searchParams.get(
|
|
5900
|
+
if (e.searchParams.get(It)) {
|
|
5930
5901
|
const n = e.toString();
|
|
5931
|
-
e.searchParams.delete(
|
|
5902
|
+
e.searchParams.delete(It), e.searchParams.delete("code"), e.searchParams.delete("error");
|
|
5932
5903
|
const r = e.pathname + (e.searchParams.size ? "?" + e.searchParams : "") + e.hash;
|
|
5933
5904
|
if (history.replaceState(history.state, "", r), // @ts-ignore (waiting for ts support)
|
|
5934
5905
|
typeof navigation == "object" && // @ts-ignore (waiting for ts support)
|
|
@@ -5948,12 +5919,12 @@ class ra {
|
|
|
5948
5919
|
* @returns Promise<null | {error: {message: string}}>
|
|
5949
5920
|
*/
|
|
5950
5921
|
_oauthLoginInit() {
|
|
5951
|
-
return
|
|
5922
|
+
return U(this, void 0, void 0, function* () {
|
|
5952
5923
|
var e, n, r, i;
|
|
5953
5924
|
if (typeof window > "u" || typeof window.location > "u" || typeof URLSearchParams > "u")
|
|
5954
5925
|
return null;
|
|
5955
5926
|
const s = new URLSearchParams(window.location.search);
|
|
5956
|
-
if (!s.get(
|
|
5927
|
+
if (!s.get(It))
|
|
5957
5928
|
return null;
|
|
5958
5929
|
const o = s.get("error");
|
|
5959
5930
|
if (o)
|
|
@@ -5976,7 +5947,7 @@ class ra {
|
|
|
5976
5947
|
});
|
|
5977
5948
|
}
|
|
5978
5949
|
_waitForOAuthCallbackResponse() {
|
|
5979
|
-
return
|
|
5950
|
+
return U(this, void 0, void 0, function* () {
|
|
5980
5951
|
return yield this._oauthCallbackResponse;
|
|
5981
5952
|
});
|
|
5982
5953
|
}
|
|
@@ -5991,13 +5962,13 @@ class ra {
|
|
|
5991
5962
|
n.isLoading || e(this._currentUserCached);
|
|
5992
5963
|
let r = !1;
|
|
5993
5964
|
return this.getCurrentUser().then((i) => {
|
|
5994
|
-
r ||
|
|
5965
|
+
r || ut(i, n) || e(i);
|
|
5995
5966
|
}), () => {
|
|
5996
5967
|
r = !0, this.authCbs = this.authCbs.filter((i) => i !== e);
|
|
5997
5968
|
};
|
|
5998
5969
|
}
|
|
5999
5970
|
getAuth() {
|
|
6000
|
-
return
|
|
5971
|
+
return U(this, void 0, void 0, function* () {
|
|
6001
5972
|
const { user: e, error: n } = yield this.getCurrentUser();
|
|
6002
5973
|
if (n)
|
|
6003
5974
|
throw new je("Could not get current user: " + n.message);
|
|
@@ -6030,7 +6001,7 @@ class ra {
|
|
|
6030
6001
|
this.connectionStatusCbs.forEach((n) => n(e));
|
|
6031
6002
|
}
|
|
6032
6003
|
setCurrentUser(e) {
|
|
6033
|
-
return
|
|
6004
|
+
return U(this, void 0, void 0, function* () {
|
|
6034
6005
|
this.kv.updateInPlace((n) => {
|
|
6035
6006
|
n[De] = e;
|
|
6036
6007
|
}), yield this.kv.waitForKeyToLoad(De);
|
|
@@ -6040,13 +6011,13 @@ class ra {
|
|
|
6040
6011
|
return this._currentUserCached;
|
|
6041
6012
|
}
|
|
6042
6013
|
_getCurrentUser() {
|
|
6043
|
-
return
|
|
6014
|
+
return U(this, void 0, void 0, function* () {
|
|
6044
6015
|
const e = yield this.kv.waitForKeyToLoad(De);
|
|
6045
6016
|
return typeof e == "string" ? JSON.parse(e) : e;
|
|
6046
6017
|
});
|
|
6047
6018
|
}
|
|
6048
6019
|
getCurrentUser() {
|
|
6049
|
-
return
|
|
6020
|
+
return U(this, void 0, void 0, function* () {
|
|
6050
6021
|
const e = yield this._waitForOAuthCallbackResponse();
|
|
6051
6022
|
if (e != null && e.error) {
|
|
6052
6023
|
const n = { error: e.error, user: void 0 };
|
|
@@ -6065,16 +6036,16 @@ class ra {
|
|
|
6065
6036
|
});
|
|
6066
6037
|
}
|
|
6067
6038
|
_hasCurrentUser() {
|
|
6068
|
-
return
|
|
6039
|
+
return U(this, void 0, void 0, function* () {
|
|
6069
6040
|
const e = yield this.kv.waitForKeyToLoad(De);
|
|
6070
6041
|
return typeof e == "string" ? JSON.parse(e) != null : e != null;
|
|
6071
6042
|
});
|
|
6072
6043
|
}
|
|
6073
6044
|
changeCurrentUser(e) {
|
|
6074
|
-
return
|
|
6045
|
+
return U(this, void 0, void 0, function* () {
|
|
6075
6046
|
var n;
|
|
6076
6047
|
const { user: r } = yield this.getCurrentUser();
|
|
6077
|
-
if (!
|
|
6048
|
+
if (!ut(r, e)) {
|
|
6078
6049
|
yield this.setCurrentUser(e), this.updateUser(e);
|
|
6079
6050
|
try {
|
|
6080
6051
|
(n = this._broadcastChannel) === null || n === void 0 || n.postMessage({ type: "auth" });
|
|
@@ -6084,26 +6055,7 @@ class ra {
|
|
|
6084
6055
|
}
|
|
6085
6056
|
});
|
|
6086
6057
|
}
|
|
6087
|
-
syncUserToEndpoint(e) {
|
|
6088
|
-
return $(this, void 0, void 0, function* () {
|
|
6089
|
-
if (this.config.cookieEndpoint)
|
|
6090
|
-
try {
|
|
6091
|
-
fetch(this.config.cookieEndpoint + "/sync-auth", {
|
|
6092
|
-
method: "POST",
|
|
6093
|
-
body: JSON.stringify({
|
|
6094
|
-
user: e
|
|
6095
|
-
}),
|
|
6096
|
-
headers: {
|
|
6097
|
-
"Content-Type": "application/json"
|
|
6098
|
-
}
|
|
6099
|
-
});
|
|
6100
|
-
} catch (n) {
|
|
6101
|
-
console.error("Error syncing user with external endpoint", n);
|
|
6102
|
-
}
|
|
6103
|
-
});
|
|
6104
|
-
}
|
|
6105
6058
|
updateUser(e) {
|
|
6106
|
-
this.syncUserToEndpoint(e);
|
|
6107
6059
|
const n = { error: void 0, user: e };
|
|
6108
6060
|
this._currentUserCached = Object.assign({ isLoading: !1 }, n), this._dataForQueryCache = {}, this.querySubs.updateInPlace((r) => {
|
|
6109
6061
|
Object.keys(r).forEach((i) => {
|
|
@@ -6119,7 +6071,7 @@ class ra {
|
|
|
6119
6071
|
});
|
|
6120
6072
|
}
|
|
6121
6073
|
signInWithMagicCode(e) {
|
|
6122
|
-
return
|
|
6074
|
+
return U(this, arguments, void 0, function* ({ email: n, code: r }) {
|
|
6123
6075
|
var i;
|
|
6124
6076
|
const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", u = yield yu({
|
|
6125
6077
|
apiURI: this.config.apiURI,
|
|
@@ -6132,7 +6084,7 @@ class ra {
|
|
|
6132
6084
|
});
|
|
6133
6085
|
}
|
|
6134
6086
|
signInWithCustomToken(e) {
|
|
6135
|
-
return
|
|
6087
|
+
return U(this, void 0, void 0, function* () {
|
|
6136
6088
|
const n = yield bu({
|
|
6137
6089
|
apiURI: this.config.apiURI,
|
|
6138
6090
|
appId: this.config.appId,
|
|
@@ -6142,7 +6094,7 @@ class ra {
|
|
|
6142
6094
|
});
|
|
6143
6095
|
}
|
|
6144
6096
|
signInAsGuest() {
|
|
6145
|
-
return
|
|
6097
|
+
return U(this, void 0, void 0, function* () {
|
|
6146
6098
|
const e = yield _u({
|
|
6147
6099
|
apiURI: this.config.apiURI,
|
|
6148
6100
|
appId: this.config.appId
|
|
@@ -6169,7 +6121,7 @@ class ra {
|
|
|
6169
6121
|
});
|
|
6170
6122
|
}
|
|
6171
6123
|
signOut(e) {
|
|
6172
|
-
return
|
|
6124
|
+
return U(this, void 0, void 0, function* () {
|
|
6173
6125
|
const n = yield this.getCurrentUser();
|
|
6174
6126
|
this.potentiallyInvalidateToken(n, e), yield this.changeCurrentUser(null);
|
|
6175
6127
|
});
|
|
@@ -6192,7 +6144,7 @@ class ra {
|
|
|
6192
6144
|
* @param {string} [params.codeVerifier] - The code verifier used to generate the code challenge.
|
|
6193
6145
|
*/
|
|
6194
6146
|
exchangeCodeForToken(e) {
|
|
6195
|
-
return
|
|
6147
|
+
return U(this, arguments, void 0, function* ({ code: n, codeVerifier: r }) {
|
|
6196
6148
|
var i;
|
|
6197
6149
|
const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", u = yield rr({
|
|
6198
6150
|
apiURI: this.config.apiURI,
|
|
@@ -6215,7 +6167,7 @@ class ra {
|
|
|
6215
6167
|
* @param {string | null | undefined} [params.nonce] - The nonce used when requesting the id_token from the external service
|
|
6216
6168
|
*/
|
|
6217
6169
|
signInWithIdToken(e) {
|
|
6218
|
-
return
|
|
6170
|
+
return U(this, arguments, void 0, function* ({ idToken: n, clientName: r, nonce: i }) {
|
|
6219
6171
|
var s;
|
|
6220
6172
|
const o = yield this.getCurrentUser(), u = (s = o == null ? void 0 : o.user) === null || s === void 0 ? void 0 : s.refresh_token, a = yield gu({
|
|
6221
6173
|
apiURI: this.config.apiURI,
|
|
@@ -6270,17 +6222,17 @@ class ra {
|
|
|
6270
6222
|
s.result.user = o, i.isConnected && (this._trySetPresence(n, o), this._notifyPresenceSubs(n));
|
|
6271
6223
|
}
|
|
6272
6224
|
_trySetPresence(e, n) {
|
|
6273
|
-
this._trySendAuthed(
|
|
6225
|
+
this._trySendAuthed(L(), {
|
|
6274
6226
|
op: "set-presence",
|
|
6275
6227
|
"room-id": e,
|
|
6276
6228
|
data: n
|
|
6277
6229
|
});
|
|
6278
6230
|
}
|
|
6279
6231
|
_tryJoinRoom(e, n) {
|
|
6280
|
-
this._trySendAuthed(
|
|
6232
|
+
this._trySendAuthed(L(), { op: "join-room", "room-id": e, data: n }), delete this._roomsPendingLeave[e];
|
|
6281
6233
|
}
|
|
6282
6234
|
_tryLeaveRoom(e) {
|
|
6283
|
-
this._trySendAuthed(
|
|
6235
|
+
this._trySendAuthed(L(), { op: "leave-room", "room-id": e });
|
|
6284
6236
|
}
|
|
6285
6237
|
_trySetRoomConnected(e, n) {
|
|
6286
6238
|
const r = this._rooms[e];
|
|
@@ -6354,7 +6306,7 @@ class ra {
|
|
|
6354
6306
|
}
|
|
6355
6307
|
}
|
|
6356
6308
|
_tryBroadcast(e, n, r, i) {
|
|
6357
|
-
this._trySendAuthed(
|
|
6309
|
+
this._trySendAuthed(L(), {
|
|
6358
6310
|
op: "client-broadcast",
|
|
6359
6311
|
"room-id": e,
|
|
6360
6312
|
roomType: n,
|
|
@@ -6379,14 +6331,14 @@ class ra {
|
|
|
6379
6331
|
// --------
|
|
6380
6332
|
// Storage
|
|
6381
6333
|
uploadFile(e, n, r) {
|
|
6382
|
-
return
|
|
6334
|
+
return U(this, void 0, void 0, function* () {
|
|
6383
6335
|
var i;
|
|
6384
6336
|
const s = yield this.getCurrentUser(), o = (i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.refresh_token;
|
|
6385
6337
|
return mu(Object.assign(Object.assign({}, r), { apiURI: this.config.apiURI, appId: this.config.appId, path: e, file: n, refreshToken: o }));
|
|
6386
6338
|
});
|
|
6387
6339
|
}
|
|
6388
6340
|
deleteFile(e) {
|
|
6389
|
-
return
|
|
6341
|
+
return U(this, void 0, void 0, function* () {
|
|
6390
6342
|
var n;
|
|
6391
6343
|
const r = yield this.getCurrentUser(), i = (n = r == null ? void 0 : r.user) === null || n === void 0 ? void 0 : n.refresh_token;
|
|
6392
6344
|
return yield wu({
|
|
@@ -6400,7 +6352,7 @@ class ra {
|
|
|
6400
6352
|
// Deprecated Storage API (Jan 2025)
|
|
6401
6353
|
// ---------------------------------
|
|
6402
6354
|
upload(e, n) {
|
|
6403
|
-
return
|
|
6355
|
+
return U(this, void 0, void 0, function* () {
|
|
6404
6356
|
var r;
|
|
6405
6357
|
const i = yield this.getCurrentUser(), s = (r = i == null ? void 0 : i.user) === null || r === void 0 ? void 0 : r.refresh_token, o = e || n.name, u = yield vu({
|
|
6406
6358
|
apiURI: this.config.apiURI,
|
|
@@ -6412,7 +6364,7 @@ class ra {
|
|
|
6412
6364
|
});
|
|
6413
6365
|
}
|
|
6414
6366
|
getDownloadUrl(e) {
|
|
6415
|
-
return
|
|
6367
|
+
return U(this, void 0, void 0, function* () {
|
|
6416
6368
|
var n;
|
|
6417
6369
|
const r = yield this.getCurrentUser(), i = (n = r == null ? void 0 : r.user) === null || n === void 0 ? void 0 : n.refresh_token;
|
|
6418
6370
|
return yield Ou({
|
|
@@ -6424,9 +6376,9 @@ class ra {
|
|
|
6424
6376
|
});
|
|
6425
6377
|
}
|
|
6426
6378
|
}
|
|
6427
|
-
let
|
|
6379
|
+
let it;
|
|
6428
6380
|
function ia(t, e) {
|
|
6429
|
-
|
|
6381
|
+
it == null || it.dispose();
|
|
6430
6382
|
const n = da(e), r = ua(e, u), i = oa(sa(t));
|
|
6431
6383
|
function s(c) {
|
|
6432
6384
|
var f;
|
|
@@ -6443,7 +6395,7 @@ function ia(t, e) {
|
|
|
6443
6395
|
n.element.remove(), r.element.remove(), removeEventListener("keydown", o), removeEventListener("message", s);
|
|
6444
6396
|
}
|
|
6445
6397
|
function d() {
|
|
6446
|
-
document.body.appendChild(n.element), document.body.appendChild(r.element), addEventListener("keydown", o), addEventListener("message", s),
|
|
6398
|
+
document.body.appendChild(n.element), document.body.appendChild(r.element), addEventListener("keydown", o), addEventListener("message", s), it = {
|
|
6447
6399
|
dispose: a
|
|
6448
6400
|
};
|
|
6449
6401
|
}
|
|
@@ -6730,7 +6682,7 @@ function wr(t) {
|
|
|
6730
6682
|
const e = mr.get(t);
|
|
6731
6683
|
if (e)
|
|
6732
6684
|
return e;
|
|
6733
|
-
const n =
|
|
6685
|
+
const n = N(t);
|
|
6734
6686
|
return mr.set(t, n), n;
|
|
6735
6687
|
}
|
|
6736
6688
|
function ga(t, e) {
|
|
@@ -6767,12 +6719,12 @@ function vr(t) {
|
|
|
6767
6719
|
}
|
|
6768
6720
|
function va(t, e, n) {
|
|
6769
6721
|
e && n && "ruleParams" in n && (e = { $$ruleParams: n.ruleParams, ...e });
|
|
6770
|
-
const r = e ? ba(e) : null, i =
|
|
6722
|
+
const r = e ? ba(e) : null, i = N(r), s = ze(
|
|
6771
6723
|
vr(t._reactor.getPreviousResult(r))
|
|
6772
6724
|
), o = de(
|
|
6773
6725
|
(a) => (s.current = vr(
|
|
6774
6726
|
t._reactor.getPreviousResult(r)
|
|
6775
|
-
),
|
|
6727
|
+
), r ? t.subscribeQuery(r, (c) => {
|
|
6776
6728
|
s.current = {
|
|
6777
6729
|
isLoading: !c,
|
|
6778
6730
|
// @ts-expect-error: ts thinks this will always be overwritten
|
|
@@ -6795,7 +6747,7 @@ function va(t, e, n) {
|
|
|
6795
6747
|
), query: r };
|
|
6796
6748
|
}
|
|
6797
6749
|
function Sa() {
|
|
6798
|
-
const t =
|
|
6750
|
+
const t = ze(null);
|
|
6799
6751
|
ge(() => {
|
|
6800
6752
|
n();
|
|
6801
6753
|
}, []);
|
|
@@ -6809,7 +6761,7 @@ function Sa() {
|
|
|
6809
6761
|
}
|
|
6810
6762
|
const Oa = 1e3;
|
|
6811
6763
|
function Ea(t, e, n) {
|
|
6812
|
-
const r =
|
|
6764
|
+
const r = ze(n);
|
|
6813
6765
|
r.current = n, ge(() => t.core._reactor.subscribeTopic(
|
|
6814
6766
|
t.id,
|
|
6815
6767
|
e,
|
|
@@ -6903,14 +6855,14 @@ const ye = {
|
|
|
6903
6855
|
useSyncPresence: ka,
|
|
6904
6856
|
useTypingIndicator: Ca
|
|
6905
6857
|
};
|
|
6906
|
-
class
|
|
6858
|
+
class Pa {
|
|
6907
6859
|
constructor(e, n, r) {
|
|
6908
6860
|
this.useTopicEffect = (i, s) => {
|
|
6909
6861
|
ye.useTopicEffect(this, i, s);
|
|
6910
6862
|
}, this.usePublishTopic = (i) => ye.usePublishTopic(this, i), this.usePresence = (i = {}) => ye.usePresence(this, i), this.useSyncPresence = (i, s) => ye.useSyncPresence(this, i, s), this.useTypingIndicator = (i, s = {}) => ye.useTypingIndicator(this, i, s), this.core = e, this._core = this.core, this.type = n, this.id = r;
|
|
6911
6863
|
}
|
|
6912
6864
|
}
|
|
6913
|
-
const
|
|
6865
|
+
const Ia = {
|
|
6914
6866
|
isLoading: !0,
|
|
6915
6867
|
user: void 0,
|
|
6916
6868
|
error: void 0
|
|
@@ -6926,7 +6878,7 @@ class Ra {
|
|
|
6926
6878
|
})();
|
|
6927
6879
|
}, [r]), i;
|
|
6928
6880
|
}, this.rooms = ye, this.transact = (r) => this.core.transact(r), this.useQuery = (r, i) => va(this.core, r, i).state, this.useAuth = () => {
|
|
6929
|
-
const r =
|
|
6881
|
+
const r = ze(
|
|
6930
6882
|
this.core._reactor._currentUserCached
|
|
6931
6883
|
), i = de((o) => this.core.subscribeAuth((a) => {
|
|
6932
6884
|
r.current = { isLoading: !1, ...a }, o();
|
|
@@ -6934,7 +6886,7 @@ class Ra {
|
|
|
6934
6886
|
return Mt(
|
|
6935
6887
|
i,
|
|
6936
6888
|
() => r.current,
|
|
6937
|
-
() =>
|
|
6889
|
+
() => Ia
|
|
6938
6890
|
);
|
|
6939
6891
|
}, this.useUser = () => {
|
|
6940
6892
|
const { user: r } = this.useAuth();
|
|
@@ -6944,7 +6896,7 @@ class Ra {
|
|
|
6944
6896
|
);
|
|
6945
6897
|
return r;
|
|
6946
6898
|
}, this.useConnectionStatus = () => {
|
|
6947
|
-
const r =
|
|
6899
|
+
const r = ze(
|
|
6948
6900
|
this.core._reactor.status
|
|
6949
6901
|
), i = de((o) => this.core.subscribeConnectionStatus((a) => {
|
|
6950
6902
|
a !== r.current && (r.current = a, o());
|
|
@@ -6957,10 +6909,10 @@ class Ra {
|
|
|
6957
6909
|
);
|
|
6958
6910
|
}, this.queryOnce = (r, i) => this.core.queryOnce(r, i), this.SignedIn = ({ children: r }) => {
|
|
6959
6911
|
const i = this.useAuth();
|
|
6960
|
-
return i.isLoading || i.error || !i.user ? null : /* @__PURE__ */
|
|
6912
|
+
return i.isLoading || i.error || !i.user ? null : /* @__PURE__ */ et.jsx(et.Fragment, { children: r });
|
|
6961
6913
|
}, this.SignedOut = ({ children: r }) => {
|
|
6962
6914
|
const i = this.useAuth();
|
|
6963
|
-
return i.isLoading || i.error || i.user ? null : /* @__PURE__ */
|
|
6915
|
+
return i.isLoading || i.error || i.user ? null : /* @__PURE__ */ et.jsx(et.Fragment, { children: r });
|
|
6964
6916
|
}, this.core = Ta(
|
|
6965
6917
|
e,
|
|
6966
6918
|
// @ts-expect-error because TS can't resolve subclass statics
|
|
@@ -6985,7 +6937,7 @@ class Ra {
|
|
|
6985
6937
|
* const { peers } = db.rooms.usePresence(room);
|
|
6986
6938
|
*/
|
|
6987
6939
|
room(e = "_defaultRoomType", n = "_defaultRoomId") {
|
|
6988
|
-
return new
|
|
6940
|
+
return new Pa(this.core, e, n);
|
|
6989
6941
|
}
|
|
6990
6942
|
/**
|
|
6991
6943
|
* One time query for the logged in state. This is useful
|