@instantdb/react-common 0.22.87 → 0.22.88-experimental.drewh-ssr.20248709142.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 +1 -0
- package/dist/commonjs/InstantReactAbstractDatabase.js.map +1 -1
- package/dist/commonjs/useQuery.d.ts.map +1 -1
- package/dist/commonjs/useQuery.js +3 -0
- package/dist/commonjs/useQuery.js.map +1 -1
- package/dist/esm/InstantReactAbstractDatabase.d.ts.map +1 -1
- package/dist/esm/InstantReactAbstractDatabase.js +1 -0
- package/dist/esm/InstantReactAbstractDatabase.js.map +1 -1
- package/dist/esm/useQuery.d.ts.map +1 -1
- package/dist/esm/useQuery.js +3 -0
- package/dist/esm/useQuery.js.map +1 -1
- package/dist/standalone/index.js +423 -375
- package/dist/standalone/index.umd.cjs +10 -10
- package/package.json +3 -3
- package/src/InstantReactAbstractDatabase.tsx +1 -1
- package/src/useQuery.ts +3 -0
package/dist/standalone/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Sr, { useRef as
|
|
1
|
+
import Sr, { useRef as Ve, 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 I = w.map(function(j) {
|
|
61
61
|
return String(j);
|
|
62
62
|
});
|
|
63
|
-
|
|
63
|
+
I.unshift("Warning: " + _), Function.prototype.apply.call(console[h], console, I);
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
var S = !1,
|
|
67
|
-
|
|
66
|
+
var S = !1, P = !1, R = !1, q = !1, Pe = !1, He;
|
|
67
|
+
He = 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 || Pe || h === s || h === c || h === f || q || h === y || S || P || 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 === He || 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 Ye(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 Ye(_) + ".Consumer";
|
|
111
111
|
case u:
|
|
112
112
|
var w = h;
|
|
113
|
-
return
|
|
113
|
+
return Ye(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, I = C._payload, j = C._init;
|
|
121
121
|
try {
|
|
122
|
-
return ne(j(
|
|
122
|
+
return ne(j(I));
|
|
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 Je(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, Ze;
|
|
207
207
|
{
|
|
208
208
|
var yi = typeof WeakMap == "function" ? WeakMap : Map;
|
|
209
|
-
|
|
209
|
+
Ze = 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 = Ze.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 I;
|
|
224
|
+
I = 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
|
+
`), x = E.length - 1, U = z.length - 1; x >= 1 && U >= 0 && E[x] !== z[U]; )
|
|
262
|
+
U--;
|
|
263
|
+
for (; x >= 1 && U >= 0; x--, U--)
|
|
264
|
+
if (E[x] !== z[U]) {
|
|
265
|
+
if (x !== 1 || U !== 1)
|
|
266
266
|
do
|
|
267
|
-
if (
|
|
267
|
+
if (x--, U--, U < 0 || E[x] !== z[U]) {
|
|
268
268
|
var J = `
|
|
269
|
-
` + E[
|
|
270
|
-
return h.displayName && J.includes("<anonymous>") && (J = J.replace("<anonymous>", h.displayName)), typeof h == "function" &&
|
|
269
|
+
` + E[x].replace(" at new ", " at ");
|
|
270
|
+
return h.displayName && J.includes("<anonymous>") && (J = J.replace("<anonymous>", h.displayName)), typeof h == "function" && Ze.set(h, J), J;
|
|
271
271
|
}
|
|
272
|
-
while (
|
|
272
|
+
while (x >= 1 && U >= 0);
|
|
273
273
|
break;
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
276
|
} finally {
|
|
277
|
-
wt = !1, Tt.current =
|
|
277
|
+
wt = !1, Tt.current = I, 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 ? Je(ve) : "";
|
|
280
|
+
return typeof h == "function" && Ze.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 Xe(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 Je(h);
|
|
296
296
|
switch (h) {
|
|
297
297
|
case c:
|
|
298
|
-
return
|
|
298
|
+
return Je("Suspense");
|
|
299
299
|
case f:
|
|
300
|
-
return
|
|
300
|
+
return Je("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 Xe(h.type, _, w);
|
|
308
308
|
case p: {
|
|
309
|
-
var O = h, C = O._payload,
|
|
309
|
+
var O = h, C = O._payload, I = O._init;
|
|
310
310
|
try {
|
|
311
|
-
return
|
|
311
|
+
return Xe(I(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 et(h) {
|
|
320
320
|
if (h) {
|
|
321
|
-
var _ = h._owner, w =
|
|
321
|
+
var _ = h._owner, w = Xe(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 I = Function.call.bind(Re);
|
|
329
329
|
for (var j in h)
|
|
330
|
-
if (
|
|
330
|
+
if (I(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 (x) {
|
|
339
|
+
E = x;
|
|
340
340
|
}
|
|
341
|
-
E && !(E instanceof Error) && (
|
|
341
|
+
E && !(E instanceof Error) && (et(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), et(null)), E instanceof Error && !(E.message in Sn) && (Sn[E.message] = !0, et(C), v("Failed %s type: %s", w, E.message), et(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, I, 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: I
|
|
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 I, 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 (I in _)
|
|
450
|
+
Re.call(_, I) && !vi.hasOwnProperty(I) && (j[I] = _[I]);
|
|
451
451
|
if (h && h.defaultProps) {
|
|
452
|
-
var
|
|
453
|
-
for (
|
|
454
|
-
j[
|
|
452
|
+
var x = h.defaultProps;
|
|
453
|
+
for (I in x)
|
|
454
|
+
j[I] === void 0 && (j[I] = x[I]);
|
|
455
455
|
}
|
|
456
456
|
if (E || z) {
|
|
457
|
-
var
|
|
458
|
-
E && Ai(j,
|
|
457
|
+
var U = typeof h == "function" ? h.displayName || h.name || "Unknown" : h;
|
|
458
|
+
E && Ai(j, U), z && ji(j, U);
|
|
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, In = T.ReactDebugCurrentFrame;
|
|
464
464
|
function we(h) {
|
|
465
465
|
if (h) {
|
|
466
|
-
var _ = h._owner, w =
|
|
467
|
-
|
|
466
|
+
var _ = h._owner, w = Xe(h.type, h._source, _ ? _.type : null);
|
|
467
|
+
In.setExtraStackFrame(w);
|
|
468
468
|
} else
|
|
469
|
-
|
|
469
|
+
In.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 Pn() {
|
|
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 Ii(h) {
|
|
489
489
|
return "";
|
|
490
490
|
}
|
|
491
491
|
var Mn = {};
|
|
492
|
-
function
|
|
492
|
+
function Pi(h) {
|
|
493
493
|
{
|
|
494
|
-
var _ =
|
|
494
|
+
var _ = Pn();
|
|
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 = Pi(_);
|
|
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 I = C.call(h), j; !(j = I.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, I) {
|
|
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 = Ii();
|
|
581
|
+
z ? E += z : E += Pn();
|
|
582
|
+
var x;
|
|
583
|
+
h === null ? x = "null" : vt(h) ? x = "array" : h !== void 0 && h.$$typeof === n ? (x = "<" + (ne(h.type) || "Unknown") + " />", E = " Did you accidentally export a JSX literal instead of a component?") : x = 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", x, E);
|
|
584
584
|
}
|
|
585
|
-
var
|
|
586
|
-
if (
|
|
587
|
-
return
|
|
585
|
+
var U = Ci(h, _, w, C, I);
|
|
586
|
+
if (U == null)
|
|
587
|
+
return U;
|
|
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(U) : Mi(U), U;
|
|
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 tt = $t.exports;
|
|
631
|
+
function L(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 N(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 = L(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 N(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 = L(i);
|
|
661
661
|
e ^= parseInt(s, 16), e *= 16777619, e = e >>> 0;
|
|
662
|
-
const o =
|
|
662
|
+
const o = L(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 L(String(t));
|
|
668
668
|
}
|
|
669
|
-
const
|
|
669
|
+
const D = {
|
|
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__"), ot = Symbol.iterator, Y = {
|
|
674
674
|
mutable: "mutable",
|
|
675
675
|
immutable: "immutable"
|
|
676
676
|
}, Xt = {};
|
|
677
|
-
function
|
|
677
|
+
function Ke(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 || Ke(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 Qe(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 Qi = 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
|
+
Qi.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 ut(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
|
+
Qe(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 Bi(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)), Qe(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) && Bi(t, e);
|
|
976
976
|
});
|
|
977
977
|
}
|
|
978
|
-
function
|
|
978
|
+
function Gi(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: D.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: ut(a[d])
|
|
989
989
|
}), r.push({
|
|
990
|
-
op:
|
|
990
|
+
op: D.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: ut(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: D.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: ut(a[d])
|
|
1003
1003
|
});
|
|
1004
1004
|
}
|
|
1005
1005
|
if (s.length < a.length) {
|
|
@@ -1007,7 +1007,7 @@ function Qi(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: D.Replace,
|
|
1011
1011
|
path: f,
|
|
1012
1012
|
value: s.length
|
|
1013
1013
|
});
|
|
@@ -1015,7 +1015,7 @@ function Qi(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: D.Remove,
|
|
1019
1019
|
path: l
|
|
1020
1020
|
});
|
|
1021
1021
|
}
|
|
@@ -1023,11 +1023,11 @@ function Qi(t, e, n, r, i) {
|
|
|
1023
1023
|
}
|
|
1024
1024
|
function Hi({ original: t, copy: e, assignedMap: n }, r, i, s, o) {
|
|
1025
1025
|
n.forEach((u, a) => {
|
|
1026
|
-
const d = ce(t, a), c =
|
|
1027
|
-
if (ae(d, c) && f ===
|
|
1026
|
+
const d = ce(t, a), c = ut(ce(e, a)), f = u ? Ke(t, a) ? D.Replace : D.Add : D.Remove;
|
|
1027
|
+
if (ae(d, c) && f === D.Replace)
|
|
1028
1028
|
return;
|
|
1029
1029
|
const l = r.concat(a), p = be(l, o);
|
|
1030
|
-
i.push(f ===
|
|
1030
|
+
i.push(f === D.Remove ? { op: f, path: p } : { op: f, path: p, value: c }), s.push(f === D.Add ? { op: D.Remove, path: p } : f === D.Remove ? { op: D.Add, path: p, value: d } : { op: D.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: D.Remove,
|
|
1040
1040
|
path: d,
|
|
1041
1041
|
value: u
|
|
1042
1042
|
}), i.unshift({
|
|
1043
|
-
op:
|
|
1043
|
+
op: D.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: D.Add,
|
|
1054
1054
|
path: d,
|
|
1055
1055
|
value: u
|
|
1056
1056
|
}), i.unshift({
|
|
1057
|
-
op:
|
|
1057
|
+
op: D.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 We(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 Gi(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, We)), 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
|
+
[ot]: () => 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
|
+
[ot]: () => 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
|
+
[ot]() {
|
|
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, We)), 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
|
+
[ot]() {
|
|
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(), Ir = {
|
|
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(), Pr = {
|
|
|
1298
1298
|
if (d)
|
|
1299
1299
|
return d.bind(t.proxy);
|
|
1300
1300
|
}
|
|
1301
|
-
if (!
|
|
1301
|
+
if (!Ke(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(), Pr = {
|
|
|
1334
1334
|
if (s != null && s.set)
|
|
1335
1335
|
return s.set.call(t.proxy, n), !0;
|
|
1336
1336
|
const o = jt(H(t), e), u = A(o);
|
|
1337
|
-
return u && ae(u.original, n) ? (t.copy[e] = n, t.assignedMap = (r = t.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), t.assignedMap.set(e, !1), !0) : (ae(n, o) && (n !== void 0 ||
|
|
1337
|
+
return u && ae(u.original, n) ? (t.copy[e] = n, t.assignedMap = (r = t.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), t.assignedMap.set(e, !1), !0) : (ae(n, o) && (n !== void 0 || Ke(t.original, e)) || (V(t), ie(t), Ke(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, We)), !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(), Pr = {
|
|
|
1362
1362
|
},
|
|
1363
1363
|
deleteProperty(t, e) {
|
|
1364
1364
|
var n;
|
|
1365
|
-
return t.type === 1 ?
|
|
1365
|
+
return t.type === 1 ? Ir.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, Ir);
|
|
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, We, 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)), Qe(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, We, 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: D.Replace, path: [], value: e[0] }] : n,
|
|
1417
|
+
r && a ? [{ op: D.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
|
+
Qe(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 Pr(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 Ir(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 = Pr(u);
|
|
1483
|
+
a !== u && (i === t && s(), Qe(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 Ir(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 Pr(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, ...P) {
|
|
1499
|
+
return e(S, (R) => n.call(this, R, ...P), 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, P) => {
|
|
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, P);
|
|
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 P = A(m);
|
|
1536
1536
|
if (!Te(S)) {
|
|
1537
|
-
if (S !== void 0 && !ae(S, m) && (
|
|
1537
|
+
if (S !== void 0 && !ae(S, m) && (P != null && P.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 Pe = q[0];
|
|
1542
1542
|
return g.strict && typeof S == "object" && S !== null && Ft({
|
|
1543
|
-
rootDraft:
|
|
1543
|
+
rootDraft: P,
|
|
1544
1544
|
value: S,
|
|
1545
1545
|
useRawReturn: !0
|
|
1546
|
-
}), T([
|
|
1546
|
+
}), T([Pe]);
|
|
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: P, 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 at(t, e) {
|
|
1574
|
+
return typeof t != "object" || typeof e != "object" || t === null || e === null ? t === e : Mr(t, e) ? Object.keys(t).every((n) => at(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 Q(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 B(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)), Q(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) && Q(s, [d, a, u], o), Q(r, [u, a, d], o), Q(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 (Q(r, [a, d], s), cn(s) && Q(e, [a, d], s), s["primary?"] && Q(n, [a], s), c) {
|
|
2017
2017
|
const [f, l, p] = c;
|
|
2018
|
-
|
|
2018
|
+
Q(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: B(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 Fe(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 Fe(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 = B(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 = B(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) ? (Q(t.eav, [i, s], /* @__PURE__ */ new Map([[o, c]])), Q(t.aev, [s, i], /* @__PURE__ */ new Map([[o, c]]))) : (Q(t.eav, [i, s, o], c), Q(t.aev, [s, i, o], c)), an(u) && Q(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
|
+
Q(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" && B(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) && B(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 B(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 B(t, e, n = []) {
|
|
2206
2206
|
if (!t || e === 0)
|
|
2207
2207
|
return n;
|
|
2208
2208
|
if (e === 1) {
|
|
@@ -2211,10 +2211,10 @@ function G(t, e, n = []) {
|
|
|
2211
2211
|
return n;
|
|
2212
2212
|
}
|
|
2213
2213
|
for (const r of t.values())
|
|
2214
|
-
|
|
2214
|
+
B(r, e - 1, n);
|
|
2215
2215
|
return n;
|
|
2216
2216
|
}
|
|
2217
|
-
function
|
|
2217
|
+
function nt(t, e, n) {
|
|
2218
2218
|
var r;
|
|
2219
2219
|
const i = [];
|
|
2220
2220
|
if (n != null && n.hasOwnProperty("$not")) {
|
|
@@ -2239,7 +2239,7 @@ function tt(t, e, n) {
|
|
|
2239
2239
|
return i;
|
|
2240
2240
|
}
|
|
2241
2241
|
if (n != null && n.$comparator)
|
|
2242
|
-
return
|
|
2242
|
+
return B(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 Is(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 B(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 B(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 ? nt(t, u, r) : [];
|
|
2268
2268
|
}
|
|
2269
2269
|
case "ev": {
|
|
2270
2270
|
const u = t.eav.get(e);
|
|
@@ -2272,12 +2272,12 @@ function Ps(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(...nt(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 B(u, 2);
|
|
2281
2281
|
}
|
|
2282
2282
|
case "av": {
|
|
2283
2283
|
const u = t.aev.get(n);
|
|
@@ -2285,27 +2285,27 @@ function Ps(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(...nt(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(...nt(t, d, r));
|
|
2296
2296
|
return u;
|
|
2297
2297
|
}
|
|
2298
2298
|
default:
|
|
2299
|
-
return
|
|
2299
|
+
return B(t.eav, 3);
|
|
2300
2300
|
}
|
|
2301
2301
|
}
|
|
2302
|
-
function
|
|
2302
|
+
function Ps(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 = B(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 Qr(r, e, n);
|
|
2370
2370
|
}
|
|
2371
2371
|
return Object.assign(Object.assign({}, n), { [t]: e });
|
|
2372
2372
|
}
|
|
2373
|
-
function
|
|
2373
|
+
function Qn(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 : Qn;
|
|
2380
2380
|
default:
|
|
2381
|
-
return
|
|
2381
|
+
return Qn;
|
|
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 Qr(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 Qr(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 Is(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 N = [];
|
|
2430
2430
|
for (let t = 0; t < 256; ++t)
|
|
2431
|
-
|
|
2432
|
-
function
|
|
2433
|
-
return (
|
|
2431
|
+
N.push((t + 256).toString(16).slice(1));
|
|
2432
|
+
function Qs(t, e = 0) {
|
|
2433
|
+
return (N[t[e + 0]] + N[t[e + 1]] + N[t[e + 2]] + N[t[e + 3]] + "-" + N[t[e + 4]] + N[t[e + 5]] + "-" + N[t[e + 6]] + N[t[e + 7]] + "-" + N[t[e + 8]] + N[t[e + 9]] + "-" + N[t[e + 10]] + N[t[e + 11]] + N[t[e + 12]] + N[t[e + 13]] + N[t[e + 14]] + N[t[e + 15]]).toLowerCase();
|
|
2434
2434
|
}
|
|
2435
2435
|
let kt;
|
|
2436
|
-
const
|
|
2437
|
-
function
|
|
2436
|
+
const Bs = new Uint8Array(16);
|
|
2437
|
+
function Gs() {
|
|
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(Bs);
|
|
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), Bn = { randomUUID: Hs };
|
|
2446
2446
|
function Ys(t, e, n) {
|
|
2447
2447
|
var i;
|
|
2448
|
-
if (
|
|
2449
|
-
return
|
|
2448
|
+
if (Bn.randomUUID && !t)
|
|
2449
|
+
return Bn.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)) ?? Gs();
|
|
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, Qs(r);
|
|
2455
2455
|
}
|
|
2456
|
-
function
|
|
2456
|
+
function Gn(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(Gn(t), Gn(e));
|
|
2473
2473
|
}
|
|
2474
|
-
function
|
|
2474
|
+
function F() {
|
|
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 qe(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 Br(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 Gr(t, e, n, r, i) {
|
|
|
2529
2529
|
t(d, r),
|
|
2530
2530
|
u.id,
|
|
2531
2531
|
t(f, l),
|
|
2532
|
-
|
|
2532
|
+
qe("time")
|
|
2533
2533
|
] : [
|
|
2534
2534
|
t(d, l),
|
|
2535
2535
|
u.id,
|
|
2536
2536
|
t(f, r),
|
|
2537
|
-
|
|
2537
|
+
qe("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
|
+
qe("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
|
+
qe("time")
|
|
2631
|
+
] : [s, a.id, t(n, r), qe("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] = Br(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 Gr(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 Gr(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 Qr(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 ? Gr(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] = Br(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 Ne(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 Ne(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, P;
|
|
2798
|
+
let R = (P = (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 || P === void 0 ? void 0 : P[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 = Ps(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 Io() {
|
|
2881
2881
|
const e = {
|
|
2882
2882
|
__etype: 1,
|
|
2883
2883
|
__ops: 1,
|
|
@@ -2891,7 +2891,7 @@ function Po() {
|
|
|
2891
2891
|
};
|
|
2892
2892
|
return new Set(Object.keys(e));
|
|
2893
2893
|
}
|
|
2894
|
-
const
|
|
2894
|
+
const Po = Io();
|
|
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 (Po.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 Qt(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 Bt(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 (!Qt(t, e, n))
|
|
2999
2999
|
return K(t, e, n);
|
|
3000
|
-
const r =
|
|
3000
|
+
const r = Bt(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 Gt(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 G(t, e, n) {
|
|
3009
|
+
const r = Gt(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 Q(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 = G(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
|
+
G(t, e, n),
|
|
3032
3032
|
a.id,
|
|
3033
|
-
|
|
3033
|
+
G(t, a["reverse-identity"][1], c)
|
|
3034
3034
|
] : [
|
|
3035
3035
|
"add-triple",
|
|
3036
|
-
|
|
3036
|
+
G(t, d["forward-identity"][1], c),
|
|
3037
3037
|
d.id,
|
|
3038
|
-
|
|
3038
|
+
G(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
|
+
G(t, e, n),
|
|
3049
3049
|
a.id,
|
|
3050
|
-
|
|
3050
|
+
G(t, a["reverse-identity"][1], c)
|
|
3051
3051
|
] : [
|
|
3052
3052
|
"retract-triple",
|
|
3053
|
-
|
|
3053
|
+
G(t, d["forward-identity"][1], c),
|
|
3054
3054
|
d.id,
|
|
3055
|
-
|
|
3055
|
+
G(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 B(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 = G(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 = G(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", G(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 = G(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", G(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 Qo(t, e) {
|
|
3138
3138
|
const [n, ...r] = Wo(e);
|
|
3139
3139
|
switch (n) {
|
|
3140
3140
|
case "merge":
|
|
@@ -3155,7 +3155,7 @@ function Bo(t, e) {
|
|
|
3155
3155
|
throw new Error(`unsupported action ${n}`);
|
|
3156
3156
|
}
|
|
3157
3157
|
}
|
|
3158
|
-
function
|
|
3158
|
+
function Bo(t) {
|
|
3159
3159
|
switch (t) {
|
|
3160
3160
|
case "string":
|
|
3161
3161
|
case "date":
|
|
@@ -3166,22 +3166,22 @@ function Go(t) {
|
|
|
3166
3166
|
return;
|
|
3167
3167
|
}
|
|
3168
3168
|
}
|
|
3169
|
-
function
|
|
3169
|
+
function Go(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 = Bo(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 rt(t, e, n, r) {
|
|
3184
|
+
const i = t ? Go(t, e, n) : null, s = F(), u = [F(), 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": [F(), i.on, i.label],
|
|
3197
|
+
"reverse-identity": [F(), 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 = F(), o = [F(), e, n], u = [F(), 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 = Gt(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 = Gt(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 (Qt(o, T, b))
|
|
3258
|
+
c(T, Bt(b));
|
|
3259
3259
|
else {
|
|
3260
3260
|
const v = K(o, T, b);
|
|
3261
|
-
v || a(
|
|
3261
|
+
v || a(rt(e, T, b, Ht)), d(v);
|
|
3262
3262
|
}
|
|
3263
|
-
} else if (
|
|
3264
|
-
c(l,
|
|
3263
|
+
} else if (Qt(o, l, b))
|
|
3264
|
+
c(l, Bt(b));
|
|
3265
3265
|
else {
|
|
3266
3266
|
const g = K(o, l, b);
|
|
3267
|
-
g || a(
|
|
3267
|
+
g || a(rt(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(rt(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(rt(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) => Qo(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 ze = "__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(ze);
|
|
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 = [[ze, 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(ze);
|
|
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, ze);
|
|
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(ze, 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 Ie = 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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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.
|
|
4191
|
+
const oi = "v0.22.88-experimental.drewh-ssr.20248709142.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
|
+
}, Iu = (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
|
+
Iu(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
|
+
}, Pu = (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
|
+
Pu(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 It(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 it(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 Ne(o.entity.id, o.serverCreatedAt, u.entity.id, u.serverCreatedAt, r);
|
|
4766
4766
|
} : function(o, u) {
|
|
4767
|
-
return
|
|
4767
|
+
return Ne(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 Ne(o.entity.id, o.entity[i], u.entity.id, u.entity[i], r);
|
|
4774
4774
|
} : function(o, u) {
|
|
4775
|
-
return
|
|
4775
|
+
return Ne(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 = L(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(F(), {
|
|
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(F(), {
|
|
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: it(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 = L(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 = It(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: it(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: it(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 P = It(u, S.store), R = Ku(S.store, v)[T];
|
|
4993
|
+
P ? (y.push({
|
|
4994
4994
|
oldEntity: S.entity,
|
|
4995
|
-
newEntity:
|
|
4995
|
+
newEntity: P,
|
|
4996
4996
|
changedFields: R || {}
|
|
4997
|
-
}), S.entity =
|
|
4997
|
+
}), S.entity = P) : 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 = It(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: it(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 = L(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 $ = 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
|
+
}, Qu = 3e4, Bu = 3e4, Gu = 200, Hu = {
|
|
5106
5106
|
apiURI: "https://api.instantdb.com",
|
|
5107
5107
|
websocketURI: "wss://api.instantdb.com/runtime/session"
|
|
5108
|
-
},
|
|
5108
|
+
}, Pt = "_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 = L(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, !at(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 = F(), 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(F(), {
|
|
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 : Bu, this._pendingMutationCleanupThreshold = (a = this.config.pendingMutationCleanupThreshold) !== null && a !== void 0 ? a : Gu, 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) => $(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,7 +5308,12 @@ 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) =>
|
|
5311
|
+
}, this._log, (d) => Fe(this.attrs, d, this.config.enableCardinalityInference, this._linkIndex, this.config.useDateObjects)), this._oauthCallbackResponse = this._oauthLoginInit(), this.getCurrentUser().then((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) => {
|
|
5312
5317
|
this._isOnline = d, this._startSocket(), r.listen((c) => {
|
|
5313
5318
|
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)));
|
|
5314
5319
|
});
|
|
@@ -5405,6 +5410,29 @@ class ra {
|
|
|
5405
5410
|
this._tryBroadcast(e, a, u, d);
|
|
5406
5411
|
}
|
|
5407
5412
|
}
|
|
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
|
+
}
|
|
5408
5436
|
_handleReceive(e, n) {
|
|
5409
5437
|
var r, i, s, o, u, a;
|
|
5410
5438
|
const d = !!this.config.schema && ("cardinalityInference" in this.config ? !!this.config.cardinalityInference : !0);
|
|
@@ -5418,14 +5446,14 @@ class ra {
|
|
|
5418
5446
|
break;
|
|
5419
5447
|
}
|
|
5420
5448
|
case "add-query-exists": {
|
|
5421
|
-
this.notifyOneQueryOnce(
|
|
5449
|
+
this.notifyOneQueryOnce(L(n.q));
|
|
5422
5450
|
break;
|
|
5423
5451
|
}
|
|
5424
5452
|
case "add-query-ok": {
|
|
5425
|
-
const { q: l, result: p } = n, y =
|
|
5453
|
+
const { q: l, result: p } = n, y = L(l);
|
|
5426
5454
|
if (!this._hasQueryListeners() && !this.querySubs.currentValue[y])
|
|
5427
5455
|
break;
|
|
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 =
|
|
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 = Fe(this.attrs, m, d, this._linkIndex, this.config.useDateObjects);
|
|
5429
5457
|
this.querySubs.updateInPlace((v) => {
|
|
5430
5458
|
if (!v[y]) {
|
|
5431
5459
|
this._log.info("Missing value in querySubs", { hash: y, q: l });
|
|
@@ -5464,17 +5492,17 @@ class ra {
|
|
|
5464
5492
|
T.pendingMutations = b;
|
|
5465
5493
|
});
|
|
5466
5494
|
const g = Tr(b.entries()), m = l.map((T) => {
|
|
5467
|
-
var v, k, S,
|
|
5468
|
-
const R = T["instaql-query"], q = T["instaql-result"],
|
|
5469
|
-
return { q: R, hash:
|
|
5495
|
+
var v, k, S, P;
|
|
5496
|
+
const R = T["instaql-query"], q = T["instaql-result"], Pe = L(R), He = or(q), _t = Fe(this.attrs, He, d, this._linkIndex, this.config.useDateObjects), gt = this._applyOptimisticUpdates(_t, g, y), Ye = (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 = (P = (S = q == null ? void 0 : q[0]) === null || S === void 0 ? void 0 : S.data) === null || P === void 0 ? void 0 : P.aggregate;
|
|
5497
|
+
return { q: R, hash: Pe, store: gt, pageInfo: Ye, aggregate: ne };
|
|
5470
5498
|
});
|
|
5471
|
-
m.forEach(({ hash: T, q: v, store: k, pageInfo: S, aggregate:
|
|
5499
|
+
m.forEach(({ hash: T, q: v, store: k, pageInfo: S, aggregate: P }) => {
|
|
5472
5500
|
this.querySubs.updateInPlace((R) => {
|
|
5473
5501
|
if (!R[T]) {
|
|
5474
5502
|
this._log.error("Missing value in querySubs", { hash: T, q: v });
|
|
5475
5503
|
return;
|
|
5476
5504
|
}
|
|
5477
|
-
R[T].result = { store: k, pageInfo: S, aggregate:
|
|
5505
|
+
R[T].result = { store: k, pageInfo: S, aggregate: P, processedTxId: y };
|
|
5478
5506
|
});
|
|
5479
5507
|
}), this._cleanupPendingMutationsQueries(), m.forEach(({ hash: T }) => {
|
|
5480
5508
|
this.notifyOne(T);
|
|
@@ -5575,8 +5603,8 @@ class ra {
|
|
|
5575
5603
|
return;
|
|
5576
5604
|
}
|
|
5577
5605
|
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") {
|
|
5578
|
-
const y = (i = e["original-event"]) === null || i === void 0 ? void 0 : i.q, b =
|
|
5579
|
-
this.notifyQueryError(
|
|
5606
|
+
const y = (i = e["original-event"]) === null || i === void 0 ? void 0 : i.q, b = L(y);
|
|
5607
|
+
this.notifyQueryError(L(y), f), this.notifyQueryOnceError(y, b, d, f);
|
|
5580
5608
|
return;
|
|
5581
5609
|
}
|
|
5582
5610
|
if (((s = e["original-event"]) === null || s === void 0 ? void 0 : s.op) === "init") {
|
|
@@ -5608,7 +5636,7 @@ class ra {
|
|
|
5608
5636
|
this.attrs = e.reduce((n, r) => (n[r.id] = r, n), {}), this.notifyAttrsSubs();
|
|
5609
5637
|
}
|
|
5610
5638
|
_startQuerySub(e, n) {
|
|
5611
|
-
const r =
|
|
5639
|
+
const r = F();
|
|
5612
5640
|
return this.querySubs.updateInPlace((i) => {
|
|
5613
5641
|
i[n] = i[n] || { q: e, result: null, eventId: r }, i[n].lastAccessed = Date.now();
|
|
5614
5642
|
}), this._trySendAuthed(r, { op: "add-query", q: e }), r;
|
|
@@ -5629,7 +5657,7 @@ class ra {
|
|
|
5629
5657
|
subscribeQuery(e, n, r) {
|
|
5630
5658
|
var i;
|
|
5631
5659
|
this.config.disableValidation || cr(e, this.config.schema), r && "ruleParams" in r && (e = Object.assign({ $$ruleParams: r.ruleParams }, e));
|
|
5632
|
-
const s =
|
|
5660
|
+
const s = L(e), o = this.getPreviousResult(e);
|
|
5633
5661
|
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), () => {
|
|
5634
5662
|
this._unsubQuery(e, s, n);
|
|
5635
5663
|
};
|
|
@@ -5642,8 +5670,8 @@ class ra {
|
|
|
5642
5670
|
return i.reject(new Error("We can't run `queryOnce`, because the device is offline.")), i.promise;
|
|
5643
5671
|
if (!this.querySubs)
|
|
5644
5672
|
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;
|
|
5645
|
-
const 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")),
|
|
5673
|
+
const s = L(e), o = this._startQuerySub(e, 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")), Qu), i.promise;
|
|
5647
5675
|
}
|
|
5648
5676
|
_completeQueryOnce(e, n, r) {
|
|
5649
5677
|
this.queryOnceDfds[n] && (this.queryOnceDfds[n] = this.queryOnceDfds[n].filter((i) => i.dfd !== r), this._cleanupQuery(e, n));
|
|
@@ -5656,7 +5684,7 @@ class ra {
|
|
|
5656
5684
|
return !!(!((n = this.queryCbs[e]) === null || n === void 0) && n.length || !((r = this.queryOnceDfds[e]) === null || r === void 0) && r.length);
|
|
5657
5685
|
}
|
|
5658
5686
|
_cleanupQuery(e, n) {
|
|
5659
|
-
this._hasQueryListeners(n) || (delete this.queryCbs[n], delete this.queryOnceDfds[n], delete this._dataForQueryCache[n], this.querySubs.unloadKey(n), this._trySendAuthed(
|
|
5687
|
+
this._hasQueryListeners(n) || (delete this.queryCbs[n], delete this.queryOnceDfds[n], delete this._dataForQueryCache[n], this.querySubs.unloadKey(n), this._trySendAuthed(F(), { op: "remove-query", q: e }));
|
|
5660
5688
|
}
|
|
5661
5689
|
// When we `pushTx`, it's possible that we don't yet have `this.attrs`
|
|
5662
5690
|
// This means that `tx-steps` in `pendingMutations` will include `add-attr`
|
|
@@ -5735,20 +5763,21 @@ class ra {
|
|
|
5735
5763
|
return Object.fromEntries(s.map((u) => [u.id, u]));
|
|
5736
5764
|
}
|
|
5737
5765
|
/** Runs instaql on a query and a store */
|
|
5738
|
-
dataForQuery(e) {
|
|
5739
|
-
const
|
|
5740
|
-
if (
|
|
5741
|
-
return { error:
|
|
5766
|
+
dataForQuery(e, n = !0) {
|
|
5767
|
+
const r = this._errorMessage;
|
|
5768
|
+
if (r)
|
|
5769
|
+
return { error: r };
|
|
5742
5770
|
if (!this.querySubs || !this.kv.currentValue.pendingMutations)
|
|
5743
5771
|
return;
|
|
5744
|
-
const
|
|
5745
|
-
if (!
|
|
5772
|
+
const i = this.querySubs.version(), s = this.querySubs.currentValue, o = this.kv.version(), u = this._pendingMutations(), { q: a, result: d } = s[e] || {};
|
|
5773
|
+
if (!d)
|
|
5746
5774
|
return;
|
|
5747
|
-
const
|
|
5748
|
-
if (
|
|
5749
|
-
return
|
|
5750
|
-
|
|
5751
|
-
|
|
5775
|
+
const c = this._dataForQueryCache[e];
|
|
5776
|
+
if (c && i === c.querySubVersion && o === c.pendingMutationsVersion)
|
|
5777
|
+
return c;
|
|
5778
|
+
let f = d.store;
|
|
5779
|
+
const { pageInfo: l, aggregate: p, processedTxId: y } = d, b = this._rewriteMutationsSorted(f.attrs, u);
|
|
5780
|
+
return n && (f = this._applyOptimisticUpdates(f, b, y)), { data: Jr({ store: f, pageInfo: l, aggregate: p }, a), querySubVersion: i, pendingMutationsVersion: o };
|
|
5752
5781
|
}
|
|
5753
5782
|
_applyOptimisticUpdates(e, n, r) {
|
|
5754
5783
|
for (const [i, s] of n)
|
|
@@ -5878,14 +5907,14 @@ class ra {
|
|
|
5878
5907
|
*
|
|
5879
5908
|
*/
|
|
5880
5909
|
getLocalId(e) {
|
|
5881
|
-
return
|
|
5910
|
+
return $(this, void 0, void 0, function* () {
|
|
5882
5911
|
const n = `localToken_${e}`;
|
|
5883
5912
|
if (this.kv.currentValue[n])
|
|
5884
5913
|
return this.kv.currentValue[n];
|
|
5885
5914
|
const r = yield this.kv.waitForKeyToLoad(n);
|
|
5886
5915
|
if (r)
|
|
5887
5916
|
return r;
|
|
5888
|
-
const i =
|
|
5917
|
+
const i = F();
|
|
5889
5918
|
return this.kv.updateInPlace((s) => {
|
|
5890
5919
|
s[n] || (s[n] = i);
|
|
5891
5920
|
}), yield this.kv.waitForKeyToLoad(n);
|
|
@@ -5897,9 +5926,9 @@ class ra {
|
|
|
5897
5926
|
if (typeof URL > "u")
|
|
5898
5927
|
return;
|
|
5899
5928
|
const e = new URL(window.location.href);
|
|
5900
|
-
if (e.searchParams.get(
|
|
5929
|
+
if (e.searchParams.get(Pt)) {
|
|
5901
5930
|
const n = e.toString();
|
|
5902
|
-
e.searchParams.delete(
|
|
5931
|
+
e.searchParams.delete(Pt), e.searchParams.delete("code"), e.searchParams.delete("error");
|
|
5903
5932
|
const r = e.pathname + (e.searchParams.size ? "?" + e.searchParams : "") + e.hash;
|
|
5904
5933
|
if (history.replaceState(history.state, "", r), // @ts-ignore (waiting for ts support)
|
|
5905
5934
|
typeof navigation == "object" && // @ts-ignore (waiting for ts support)
|
|
@@ -5919,12 +5948,12 @@ class ra {
|
|
|
5919
5948
|
* @returns Promise<null | {error: {message: string}}>
|
|
5920
5949
|
*/
|
|
5921
5950
|
_oauthLoginInit() {
|
|
5922
|
-
return
|
|
5951
|
+
return $(this, void 0, void 0, function* () {
|
|
5923
5952
|
var e, n, r, i;
|
|
5924
5953
|
if (typeof window > "u" || typeof window.location > "u" || typeof URLSearchParams > "u")
|
|
5925
5954
|
return null;
|
|
5926
5955
|
const s = new URLSearchParams(window.location.search);
|
|
5927
|
-
if (!s.get(
|
|
5956
|
+
if (!s.get(Pt))
|
|
5928
5957
|
return null;
|
|
5929
5958
|
const o = s.get("error");
|
|
5930
5959
|
if (o)
|
|
@@ -5947,7 +5976,7 @@ class ra {
|
|
|
5947
5976
|
});
|
|
5948
5977
|
}
|
|
5949
5978
|
_waitForOAuthCallbackResponse() {
|
|
5950
|
-
return
|
|
5979
|
+
return $(this, void 0, void 0, function* () {
|
|
5951
5980
|
return yield this._oauthCallbackResponse;
|
|
5952
5981
|
});
|
|
5953
5982
|
}
|
|
@@ -5962,13 +5991,13 @@ class ra {
|
|
|
5962
5991
|
n.isLoading || e(this._currentUserCached);
|
|
5963
5992
|
let r = !1;
|
|
5964
5993
|
return this.getCurrentUser().then((i) => {
|
|
5965
|
-
r ||
|
|
5994
|
+
r || at(i, n) || e(i);
|
|
5966
5995
|
}), () => {
|
|
5967
5996
|
r = !0, this.authCbs = this.authCbs.filter((i) => i !== e);
|
|
5968
5997
|
};
|
|
5969
5998
|
}
|
|
5970
5999
|
getAuth() {
|
|
5971
|
-
return
|
|
6000
|
+
return $(this, void 0, void 0, function* () {
|
|
5972
6001
|
const { user: e, error: n } = yield this.getCurrentUser();
|
|
5973
6002
|
if (n)
|
|
5974
6003
|
throw new je("Could not get current user: " + n.message);
|
|
@@ -6001,7 +6030,7 @@ class ra {
|
|
|
6001
6030
|
this.connectionStatusCbs.forEach((n) => n(e));
|
|
6002
6031
|
}
|
|
6003
6032
|
setCurrentUser(e) {
|
|
6004
|
-
return
|
|
6033
|
+
return $(this, void 0, void 0, function* () {
|
|
6005
6034
|
this.kv.updateInPlace((n) => {
|
|
6006
6035
|
n[De] = e;
|
|
6007
6036
|
}), yield this.kv.waitForKeyToLoad(De);
|
|
@@ -6011,13 +6040,13 @@ class ra {
|
|
|
6011
6040
|
return this._currentUserCached;
|
|
6012
6041
|
}
|
|
6013
6042
|
_getCurrentUser() {
|
|
6014
|
-
return
|
|
6043
|
+
return $(this, void 0, void 0, function* () {
|
|
6015
6044
|
const e = yield this.kv.waitForKeyToLoad(De);
|
|
6016
6045
|
return typeof e == "string" ? JSON.parse(e) : e;
|
|
6017
6046
|
});
|
|
6018
6047
|
}
|
|
6019
6048
|
getCurrentUser() {
|
|
6020
|
-
return
|
|
6049
|
+
return $(this, void 0, void 0, function* () {
|
|
6021
6050
|
const e = yield this._waitForOAuthCallbackResponse();
|
|
6022
6051
|
if (e != null && e.error) {
|
|
6023
6052
|
const n = { error: e.error, user: void 0 };
|
|
@@ -6036,16 +6065,16 @@ class ra {
|
|
|
6036
6065
|
});
|
|
6037
6066
|
}
|
|
6038
6067
|
_hasCurrentUser() {
|
|
6039
|
-
return
|
|
6068
|
+
return $(this, void 0, void 0, function* () {
|
|
6040
6069
|
const e = yield this.kv.waitForKeyToLoad(De);
|
|
6041
6070
|
return typeof e == "string" ? JSON.parse(e) != null : e != null;
|
|
6042
6071
|
});
|
|
6043
6072
|
}
|
|
6044
6073
|
changeCurrentUser(e) {
|
|
6045
|
-
return
|
|
6074
|
+
return $(this, void 0, void 0, function* () {
|
|
6046
6075
|
var n;
|
|
6047
6076
|
const { user: r } = yield this.getCurrentUser();
|
|
6048
|
-
if (!
|
|
6077
|
+
if (!at(r, e)) {
|
|
6049
6078
|
yield this.setCurrentUser(e), this.updateUser(e);
|
|
6050
6079
|
try {
|
|
6051
6080
|
(n = this._broadcastChannel) === null || n === void 0 || n.postMessage({ type: "auth" });
|
|
@@ -6055,7 +6084,26 @@ class ra {
|
|
|
6055
6084
|
}
|
|
6056
6085
|
});
|
|
6057
6086
|
}
|
|
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
|
+
}
|
|
6058
6105
|
updateUser(e) {
|
|
6106
|
+
this.syncUserToEndpoint(e);
|
|
6059
6107
|
const n = { error: void 0, user: e };
|
|
6060
6108
|
this._currentUserCached = Object.assign({ isLoading: !1 }, n), this._dataForQueryCache = {}, this.querySubs.updateInPlace((r) => {
|
|
6061
6109
|
Object.keys(r).forEach((i) => {
|
|
@@ -6071,7 +6119,7 @@ class ra {
|
|
|
6071
6119
|
});
|
|
6072
6120
|
}
|
|
6073
6121
|
signInWithMagicCode(e) {
|
|
6074
|
-
return
|
|
6122
|
+
return $(this, arguments, void 0, function* ({ email: n, code: r }) {
|
|
6075
6123
|
var i;
|
|
6076
6124
|
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({
|
|
6077
6125
|
apiURI: this.config.apiURI,
|
|
@@ -6084,7 +6132,7 @@ class ra {
|
|
|
6084
6132
|
});
|
|
6085
6133
|
}
|
|
6086
6134
|
signInWithCustomToken(e) {
|
|
6087
|
-
return
|
|
6135
|
+
return $(this, void 0, void 0, function* () {
|
|
6088
6136
|
const n = yield bu({
|
|
6089
6137
|
apiURI: this.config.apiURI,
|
|
6090
6138
|
appId: this.config.appId,
|
|
@@ -6094,7 +6142,7 @@ class ra {
|
|
|
6094
6142
|
});
|
|
6095
6143
|
}
|
|
6096
6144
|
signInAsGuest() {
|
|
6097
|
-
return
|
|
6145
|
+
return $(this, void 0, void 0, function* () {
|
|
6098
6146
|
const e = yield _u({
|
|
6099
6147
|
apiURI: this.config.apiURI,
|
|
6100
6148
|
appId: this.config.appId
|
|
@@ -6121,7 +6169,7 @@ class ra {
|
|
|
6121
6169
|
});
|
|
6122
6170
|
}
|
|
6123
6171
|
signOut(e) {
|
|
6124
|
-
return
|
|
6172
|
+
return $(this, void 0, void 0, function* () {
|
|
6125
6173
|
const n = yield this.getCurrentUser();
|
|
6126
6174
|
this.potentiallyInvalidateToken(n, e), yield this.changeCurrentUser(null);
|
|
6127
6175
|
});
|
|
@@ -6144,7 +6192,7 @@ class ra {
|
|
|
6144
6192
|
* @param {string} [params.codeVerifier] - The code verifier used to generate the code challenge.
|
|
6145
6193
|
*/
|
|
6146
6194
|
exchangeCodeForToken(e) {
|
|
6147
|
-
return
|
|
6195
|
+
return $(this, arguments, void 0, function* ({ code: n, codeVerifier: r }) {
|
|
6148
6196
|
var i;
|
|
6149
6197
|
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({
|
|
6150
6198
|
apiURI: this.config.apiURI,
|
|
@@ -6167,7 +6215,7 @@ class ra {
|
|
|
6167
6215
|
* @param {string | null | undefined} [params.nonce] - The nonce used when requesting the id_token from the external service
|
|
6168
6216
|
*/
|
|
6169
6217
|
signInWithIdToken(e) {
|
|
6170
|
-
return
|
|
6218
|
+
return $(this, arguments, void 0, function* ({ idToken: n, clientName: r, nonce: i }) {
|
|
6171
6219
|
var s;
|
|
6172
6220
|
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({
|
|
6173
6221
|
apiURI: this.config.apiURI,
|
|
@@ -6222,17 +6270,17 @@ class ra {
|
|
|
6222
6270
|
s.result.user = o, i.isConnected && (this._trySetPresence(n, o), this._notifyPresenceSubs(n));
|
|
6223
6271
|
}
|
|
6224
6272
|
_trySetPresence(e, n) {
|
|
6225
|
-
this._trySendAuthed(
|
|
6273
|
+
this._trySendAuthed(F(), {
|
|
6226
6274
|
op: "set-presence",
|
|
6227
6275
|
"room-id": e,
|
|
6228
6276
|
data: n
|
|
6229
6277
|
});
|
|
6230
6278
|
}
|
|
6231
6279
|
_tryJoinRoom(e, n) {
|
|
6232
|
-
this._trySendAuthed(
|
|
6280
|
+
this._trySendAuthed(F(), { op: "join-room", "room-id": e, data: n }), delete this._roomsPendingLeave[e];
|
|
6233
6281
|
}
|
|
6234
6282
|
_tryLeaveRoom(e) {
|
|
6235
|
-
this._trySendAuthed(
|
|
6283
|
+
this._trySendAuthed(F(), { op: "leave-room", "room-id": e });
|
|
6236
6284
|
}
|
|
6237
6285
|
_trySetRoomConnected(e, n) {
|
|
6238
6286
|
const r = this._rooms[e];
|
|
@@ -6306,7 +6354,7 @@ class ra {
|
|
|
6306
6354
|
}
|
|
6307
6355
|
}
|
|
6308
6356
|
_tryBroadcast(e, n, r, i) {
|
|
6309
|
-
this._trySendAuthed(
|
|
6357
|
+
this._trySendAuthed(F(), {
|
|
6310
6358
|
op: "client-broadcast",
|
|
6311
6359
|
"room-id": e,
|
|
6312
6360
|
roomType: n,
|
|
@@ -6331,14 +6379,14 @@ class ra {
|
|
|
6331
6379
|
// --------
|
|
6332
6380
|
// Storage
|
|
6333
6381
|
uploadFile(e, n, r) {
|
|
6334
|
-
return
|
|
6382
|
+
return $(this, void 0, void 0, function* () {
|
|
6335
6383
|
var i;
|
|
6336
6384
|
const s = yield this.getCurrentUser(), o = (i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.refresh_token;
|
|
6337
6385
|
return mu(Object.assign(Object.assign({}, r), { apiURI: this.config.apiURI, appId: this.config.appId, path: e, file: n, refreshToken: o }));
|
|
6338
6386
|
});
|
|
6339
6387
|
}
|
|
6340
6388
|
deleteFile(e) {
|
|
6341
|
-
return
|
|
6389
|
+
return $(this, void 0, void 0, function* () {
|
|
6342
6390
|
var n;
|
|
6343
6391
|
const r = yield this.getCurrentUser(), i = (n = r == null ? void 0 : r.user) === null || n === void 0 ? void 0 : n.refresh_token;
|
|
6344
6392
|
return yield wu({
|
|
@@ -6352,7 +6400,7 @@ class ra {
|
|
|
6352
6400
|
// Deprecated Storage API (Jan 2025)
|
|
6353
6401
|
// ---------------------------------
|
|
6354
6402
|
upload(e, n) {
|
|
6355
|
-
return
|
|
6403
|
+
return $(this, void 0, void 0, function* () {
|
|
6356
6404
|
var r;
|
|
6357
6405
|
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({
|
|
6358
6406
|
apiURI: this.config.apiURI,
|
|
@@ -6364,7 +6412,7 @@ class ra {
|
|
|
6364
6412
|
});
|
|
6365
6413
|
}
|
|
6366
6414
|
getDownloadUrl(e) {
|
|
6367
|
-
return
|
|
6415
|
+
return $(this, void 0, void 0, function* () {
|
|
6368
6416
|
var n;
|
|
6369
6417
|
const r = yield this.getCurrentUser(), i = (n = r == null ? void 0 : r.user) === null || n === void 0 ? void 0 : n.refresh_token;
|
|
6370
6418
|
return yield Ou({
|
|
@@ -6376,9 +6424,9 @@ class ra {
|
|
|
6376
6424
|
});
|
|
6377
6425
|
}
|
|
6378
6426
|
}
|
|
6379
|
-
let
|
|
6427
|
+
let st;
|
|
6380
6428
|
function ia(t, e) {
|
|
6381
|
-
|
|
6429
|
+
st == null || st.dispose();
|
|
6382
6430
|
const n = da(e), r = ua(e, u), i = oa(sa(t));
|
|
6383
6431
|
function s(c) {
|
|
6384
6432
|
var f;
|
|
@@ -6395,7 +6443,7 @@ function ia(t, e) {
|
|
|
6395
6443
|
n.element.remove(), r.element.remove(), removeEventListener("keydown", o), removeEventListener("message", s);
|
|
6396
6444
|
}
|
|
6397
6445
|
function d() {
|
|
6398
|
-
document.body.appendChild(n.element), document.body.appendChild(r.element), addEventListener("keydown", o), addEventListener("message", s),
|
|
6446
|
+
document.body.appendChild(n.element), document.body.appendChild(r.element), addEventListener("keydown", o), addEventListener("message", s), st = {
|
|
6399
6447
|
dispose: a
|
|
6400
6448
|
};
|
|
6401
6449
|
}
|
|
@@ -6682,7 +6730,7 @@ function wr(t) {
|
|
|
6682
6730
|
const e = mr.get(t);
|
|
6683
6731
|
if (e)
|
|
6684
6732
|
return e;
|
|
6685
|
-
const n =
|
|
6733
|
+
const n = L(t);
|
|
6686
6734
|
return mr.set(t, n), n;
|
|
6687
6735
|
}
|
|
6688
6736
|
function ga(t, e) {
|
|
@@ -6719,12 +6767,12 @@ function vr(t) {
|
|
|
6719
6767
|
}
|
|
6720
6768
|
function va(t, e, n) {
|
|
6721
6769
|
e && n && "ruleParams" in n && (e = { $$ruleParams: n.ruleParams, ...e });
|
|
6722
|
-
const r = e ? ba(e) : null, i =
|
|
6770
|
+
const r = e ? ba(e) : null, i = L(r), s = Ve(
|
|
6723
6771
|
vr(t._reactor.getPreviousResult(r))
|
|
6724
6772
|
), o = de(
|
|
6725
6773
|
(a) => (s.current = vr(
|
|
6726
6774
|
t._reactor.getPreviousResult(r)
|
|
6727
|
-
), r ? t.subscribeQuery(r, (c) => {
|
|
6775
|
+
), s.current.data && a(), r ? t.subscribeQuery(r, (c) => {
|
|
6728
6776
|
s.current = {
|
|
6729
6777
|
isLoading: !c,
|
|
6730
6778
|
// @ts-expect-error: ts thinks this will always be overwritten
|
|
@@ -6747,7 +6795,7 @@ function va(t, e, n) {
|
|
|
6747
6795
|
), query: r };
|
|
6748
6796
|
}
|
|
6749
6797
|
function Sa() {
|
|
6750
|
-
const t =
|
|
6798
|
+
const t = Ve(null);
|
|
6751
6799
|
ge(() => {
|
|
6752
6800
|
n();
|
|
6753
6801
|
}, []);
|
|
@@ -6761,7 +6809,7 @@ function Sa() {
|
|
|
6761
6809
|
}
|
|
6762
6810
|
const Oa = 1e3;
|
|
6763
6811
|
function Ea(t, e, n) {
|
|
6764
|
-
const r =
|
|
6812
|
+
const r = Ve(n);
|
|
6765
6813
|
r.current = n, ge(() => t.core._reactor.subscribeTopic(
|
|
6766
6814
|
t.id,
|
|
6767
6815
|
e,
|
|
@@ -6855,14 +6903,14 @@ const ye = {
|
|
|
6855
6903
|
useSyncPresence: ka,
|
|
6856
6904
|
useTypingIndicator: Ca
|
|
6857
6905
|
};
|
|
6858
|
-
class
|
|
6906
|
+
class Ia {
|
|
6859
6907
|
constructor(e, n, r) {
|
|
6860
6908
|
this.useTopicEffect = (i, s) => {
|
|
6861
6909
|
ye.useTopicEffect(this, i, s);
|
|
6862
6910
|
}, 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;
|
|
6863
6911
|
}
|
|
6864
6912
|
}
|
|
6865
|
-
const
|
|
6913
|
+
const Pa = {
|
|
6866
6914
|
isLoading: !0,
|
|
6867
6915
|
user: void 0,
|
|
6868
6916
|
error: void 0
|
|
@@ -6878,7 +6926,7 @@ class Ra {
|
|
|
6878
6926
|
})();
|
|
6879
6927
|
}, [r]), i;
|
|
6880
6928
|
}, this.rooms = ye, this.transact = (r) => this.core.transact(r), this.useQuery = (r, i) => va(this.core, r, i).state, this.useAuth = () => {
|
|
6881
|
-
const r =
|
|
6929
|
+
const r = Ve(
|
|
6882
6930
|
this.core._reactor._currentUserCached
|
|
6883
6931
|
), i = de((o) => this.core.subscribeAuth((a) => {
|
|
6884
6932
|
r.current = { isLoading: !1, ...a }, o();
|
|
@@ -6886,7 +6934,7 @@ class Ra {
|
|
|
6886
6934
|
return Mt(
|
|
6887
6935
|
i,
|
|
6888
6936
|
() => r.current,
|
|
6889
|
-
() =>
|
|
6937
|
+
() => Pa
|
|
6890
6938
|
);
|
|
6891
6939
|
}, this.useUser = () => {
|
|
6892
6940
|
const { user: r } = this.useAuth();
|
|
@@ -6896,7 +6944,7 @@ class Ra {
|
|
|
6896
6944
|
);
|
|
6897
6945
|
return r;
|
|
6898
6946
|
}, this.useConnectionStatus = () => {
|
|
6899
|
-
const r =
|
|
6947
|
+
const r = Ve(
|
|
6900
6948
|
this.core._reactor.status
|
|
6901
6949
|
), i = de((o) => this.core.subscribeConnectionStatus((a) => {
|
|
6902
6950
|
a !== r.current && (r.current = a, o());
|
|
@@ -6909,10 +6957,10 @@ class Ra {
|
|
|
6909
6957
|
);
|
|
6910
6958
|
}, this.queryOnce = (r, i) => this.core.queryOnce(r, i), this.SignedIn = ({ children: r }) => {
|
|
6911
6959
|
const i = this.useAuth();
|
|
6912
|
-
return i.isLoading || i.error || !i.user ? null : /* @__PURE__ */
|
|
6960
|
+
return i.isLoading || i.error || !i.user ? null : /* @__PURE__ */ tt.jsx(tt.Fragment, { children: r });
|
|
6913
6961
|
}, this.SignedOut = ({ children: r }) => {
|
|
6914
6962
|
const i = this.useAuth();
|
|
6915
|
-
return i.isLoading || i.error || i.user ? null : /* @__PURE__ */
|
|
6963
|
+
return i.isLoading || i.error || i.user ? null : /* @__PURE__ */ tt.jsx(tt.Fragment, { children: r });
|
|
6916
6964
|
}, this.core = Ta(
|
|
6917
6965
|
e,
|
|
6918
6966
|
// @ts-expect-error because TS can't resolve subclass statics
|
|
@@ -6937,7 +6985,7 @@ class Ra {
|
|
|
6937
6985
|
* const { peers } = db.rooms.usePresence(room);
|
|
6938
6986
|
*/
|
|
6939
6987
|
room(e = "_defaultRoomType", n = "_defaultRoomId") {
|
|
6940
|
-
return new
|
|
6988
|
+
return new Ia(this.core, e, n);
|
|
6941
6989
|
}
|
|
6942
6990
|
/**
|
|
6943
6991
|
* One time query for the logged in state. This is useful
|