@instantdb/react-common 0.22.90-experimental.drewh-ssr.20347747146.1 → 0.22.90-experimental.trim-env-vars.20312148351.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 +0 -1
- package/dist/commonjs/InstantReactAbstractDatabase.d.ts.map +1 -1
- package/dist/commonjs/InstantReactAbstractDatabase.js +17 -20
- package/dist/commonjs/InstantReactAbstractDatabase.js.map +1 -1
- package/dist/commonjs/useQuery.d.ts.map +1 -1
- package/dist/commonjs/useQuery.js +0 -1
- package/dist/commonjs/useQuery.js.map +1 -1
- package/dist/esm/InstantReactAbstractDatabase.d.ts +0 -1
- package/dist/esm/InstantReactAbstractDatabase.d.ts.map +1 -1
- package/dist/esm/InstantReactAbstractDatabase.js +17 -20
- package/dist/esm/InstantReactAbstractDatabase.js.map +1 -1
- package/dist/esm/useQuery.d.ts.map +1 -1
- package/dist/esm/useQuery.js +0 -1
- package/dist/esm/useQuery.js.map +1 -1
- package/dist/standalone/index.js +962 -1018
- package/dist/standalone/index.umd.cjs +9 -9
- package/package.json +3 -3
- package/src/InstantReactAbstractDatabase.tsx +2 -5
- package/src/useQuery.ts +0 -1
package/dist/standalone/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import wr, { useRef as
|
|
1
|
+
import wr, { useRef as qe, useCallback as fe, useSyncExternalStore as Pt, useEffect as ge, useMemo as Mt, useState as mr } from "react";
|
|
2
2
|
var Rt = { exports: {} }, Re = {};
|
|
3
3
|
/**
|
|
4
4
|
* @license React
|
|
@@ -14,19 +14,19 @@ function Ui() {
|
|
|
14
14
|
if ($n) return Re;
|
|
15
15
|
$n = 1;
|
|
16
16
|
var t = wr, e = Symbol.for("react.element"), n = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, i = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
17
|
-
function o(u, a,
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
for (
|
|
21
|
-
if (u && u.defaultProps) for (
|
|
17
|
+
function o(u, a, d) {
|
|
18
|
+
var c, f = {}, l = null, p = null;
|
|
19
|
+
d !== void 0 && (l = "" + d), a.key !== void 0 && (l = "" + a.key), a.ref !== void 0 && (p = a.ref);
|
|
20
|
+
for (c in a) r.call(a, c) && !s.hasOwnProperty(c) && (f[c] = a[c]);
|
|
21
|
+
if (u && u.defaultProps) for (c in a = u.defaultProps, a) f[c] === void 0 && (f[c] = a[c]);
|
|
22
22
|
return { $$typeof: e, type: u, key: l, ref: p, props: f, _owner: i.current };
|
|
23
23
|
}
|
|
24
24
|
return Re.Fragment = n, Re.jsx = o, Re.jsxs = o, Re;
|
|
25
25
|
}
|
|
26
|
-
var $e = {},
|
|
26
|
+
var $e = {}, Dn;
|
|
27
27
|
function Li() {
|
|
28
|
-
if (
|
|
29
|
-
|
|
28
|
+
if (Dn) return $e;
|
|
29
|
+
Dn = 1;
|
|
30
30
|
var t = {};
|
|
31
31
|
/**
|
|
32
32
|
* @license React
|
|
@@ -38,14 +38,14 @@ function Li() {
|
|
|
38
38
|
* LICENSE file in the root directory of this source tree.
|
|
39
39
|
*/
|
|
40
40
|
return t.NODE_ENV !== "production" && function() {
|
|
41
|
-
var e = wr, n = Symbol.for("react.element"), r = Symbol.for("react.portal"), i = Symbol.for("react.fragment"), s = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), u = Symbol.for("react.provider"), a = Symbol.for("react.context"),
|
|
41
|
+
var e = wr, n = Symbol.for("react.element"), r = Symbol.for("react.portal"), i = Symbol.for("react.fragment"), s = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), u = Symbol.for("react.provider"), a = Symbol.for("react.context"), d = Symbol.for("react.forward_ref"), c = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), l = Symbol.for("react.memo"), p = Symbol.for("react.lazy"), y = Symbol.for("react.offscreen"), b = Symbol.iterator, _ = "@@iterator";
|
|
42
42
|
function w(h) {
|
|
43
43
|
if (h === null || typeof h != "object")
|
|
44
44
|
return null;
|
|
45
|
-
var T = b && h[b] || h[
|
|
45
|
+
var T = b && h[b] || h[_];
|
|
46
46
|
return typeof T == "function" ? T : null;
|
|
47
47
|
}
|
|
48
|
-
var
|
|
48
|
+
var g = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
49
49
|
function v(h) {
|
|
50
50
|
{
|
|
51
51
|
for (var T = arguments.length, m = new Array(T > 1 ? T - 1 : 0), O = 1; O < T; O++)
|
|
@@ -55,18 +55,18 @@ function Li() {
|
|
|
55
55
|
}
|
|
56
56
|
function A(h, T, m) {
|
|
57
57
|
{
|
|
58
|
-
var O =
|
|
59
|
-
|
|
58
|
+
var O = g.ReactDebugCurrentFrame, I = O.getStackAddendum();
|
|
59
|
+
I !== "" && (T += "%s", m = m.concat([I]));
|
|
60
60
|
var P = m.map(function(j) {
|
|
61
61
|
return String(j);
|
|
62
62
|
});
|
|
63
63
|
P.unshift("Warning: " + T), Function.prototype.apply.call(console[h], console, P);
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
var S = !1,
|
|
66
|
+
var S = !1, C = !1, $ = !1, R = !1, Pe = !1, Ge;
|
|
67
67
|
Ge = Symbol.for("react.module.reference");
|
|
68
|
-
function
|
|
69
|
-
return !!(typeof h == "string" || typeof h == "function" || h === i || h === o || Pe || h === s || h ===
|
|
68
|
+
function Qe(h) {
|
|
69
|
+
return !!(typeof h == "string" || typeof h == "function" || h === i || h === o || Pe || h === s || h === c || h === f || R || h === y || S || C || $ || 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.
|
|
@@ -76,10 +76,10 @@ function Li() {
|
|
|
76
76
|
var O = h.displayName;
|
|
77
77
|
if (O)
|
|
78
78
|
return O;
|
|
79
|
-
var
|
|
80
|
-
return
|
|
79
|
+
var I = T.displayName || T.name || "";
|
|
80
|
+
return I !== "" ? m + "(" + I + ")" : m;
|
|
81
81
|
}
|
|
82
|
-
function
|
|
82
|
+
function He(h) {
|
|
83
83
|
return h.displayName || "Context";
|
|
84
84
|
}
|
|
85
85
|
function ne(h) {
|
|
@@ -98,7 +98,7 @@ function Li() {
|
|
|
98
98
|
return "Profiler";
|
|
99
99
|
case s:
|
|
100
100
|
return "StrictMode";
|
|
101
|
-
case
|
|
101
|
+
case c:
|
|
102
102
|
return "Suspense";
|
|
103
103
|
case f:
|
|
104
104
|
return "SuspenseList";
|
|
@@ -107,17 +107,17 @@ function Li() {
|
|
|
107
107
|
switch (h.$$typeof) {
|
|
108
108
|
case a:
|
|
109
109
|
var T = h;
|
|
110
|
-
return
|
|
110
|
+
return He(T) + ".Consumer";
|
|
111
111
|
case u:
|
|
112
112
|
var m = h;
|
|
113
|
-
return
|
|
114
|
-
case
|
|
113
|
+
return He(m._context) + ".Provider";
|
|
114
|
+
case d:
|
|
115
115
|
return _t(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
|
|
120
|
+
var I = h, P = I._payload, j = I._init;
|
|
121
121
|
try {
|
|
122
122
|
return ne(j(P));
|
|
123
123
|
} catch {
|
|
@@ -189,36 +189,36 @@ function Li() {
|
|
|
189
189
|
le < 0 && v("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
|
-
var gt =
|
|
193
|
-
function
|
|
192
|
+
var gt = g.ReactCurrentDispatcher, Tt;
|
|
193
|
+
function Ye(h, T, m) {
|
|
194
194
|
{
|
|
195
195
|
if (Tt === void 0)
|
|
196
196
|
try {
|
|
197
197
|
throw Error();
|
|
198
|
-
} catch (
|
|
199
|
-
var O =
|
|
198
|
+
} catch (I) {
|
|
199
|
+
var O = I.stack.trim().match(/\n( *(at )?)/);
|
|
200
200
|
Tt = O && O[1] || "";
|
|
201
201
|
}
|
|
202
202
|
return `
|
|
203
203
|
` + Tt + h;
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
|
-
var wt = !1,
|
|
206
|
+
var wt = !1, Je;
|
|
207
207
|
{
|
|
208
208
|
var li = typeof WeakMap == "function" ? WeakMap : Map;
|
|
209
|
-
|
|
209
|
+
Je = new li();
|
|
210
210
|
}
|
|
211
211
|
function Tn(h, T) {
|
|
212
212
|
if (!h || wt)
|
|
213
213
|
return "";
|
|
214
214
|
{
|
|
215
|
-
var m =
|
|
215
|
+
var m = Je.get(h);
|
|
216
216
|
if (m !== void 0)
|
|
217
217
|
return m;
|
|
218
218
|
}
|
|
219
219
|
var O;
|
|
220
220
|
wt = !0;
|
|
221
|
-
var
|
|
221
|
+
var I = Error.prepareStackTrace;
|
|
222
222
|
Error.prepareStackTrace = void 0;
|
|
223
223
|
var P;
|
|
224
224
|
P = gt.current, gt.current = null, di();
|
|
@@ -258,26 +258,26 @@ function Li() {
|
|
|
258
258
|
if (W && O && typeof W.stack == "string") {
|
|
259
259
|
for (var E = W.stack.split(`
|
|
260
260
|
`), z = O.stack.split(`
|
|
261
|
-
`), D = E.length - 1,
|
|
262
|
-
|
|
263
|
-
for (; D >= 1 &&
|
|
264
|
-
if (E[D] !== z[
|
|
265
|
-
if (D !== 1 ||
|
|
261
|
+
`), D = E.length - 1, U = z.length - 1; D >= 1 && U >= 0 && E[D] !== z[U]; )
|
|
262
|
+
U--;
|
|
263
|
+
for (; D >= 1 && U >= 0; D--, U--)
|
|
264
|
+
if (E[D] !== z[U]) {
|
|
265
|
+
if (D !== 1 || U !== 1)
|
|
266
266
|
do
|
|
267
|
-
if (D--,
|
|
267
|
+
if (D--, U--, U < 0 || E[D] !== z[U]) {
|
|
268
268
|
var J = `
|
|
269
269
|
` + E[D].replace(" at new ", " at ");
|
|
270
|
-
return h.displayName && J.includes("<anonymous>") && (J = J.replace("<anonymous>", h.displayName)), typeof h == "function" &&
|
|
270
|
+
return h.displayName && J.includes("<anonymous>") && (J = J.replace("<anonymous>", h.displayName)), typeof h == "function" && Je.set(h, J), J;
|
|
271
271
|
}
|
|
272
|
-
while (D >= 1 &&
|
|
272
|
+
while (D >= 1 && U >= 0);
|
|
273
273
|
break;
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
276
|
} finally {
|
|
277
|
-
wt = !1, gt.current = P, fi(), Error.prepareStackTrace =
|
|
277
|
+
wt = !1, gt.current = P, fi(), Error.prepareStackTrace = I;
|
|
278
278
|
}
|
|
279
|
-
var Se = h ? h.displayName || h.name : "", he = Se ?
|
|
280
|
-
return typeof h == "function" &&
|
|
279
|
+
var Se = h ? h.displayName || h.name : "", he = Se ? Ye(Se) : "";
|
|
280
|
+
return typeof h == "function" && Je.set(h, he), he;
|
|
281
281
|
}
|
|
282
282
|
function hi(h, T, m) {
|
|
283
283
|
return Tn(h, !1);
|
|
@@ -286,44 +286,44 @@ function Li() {
|
|
|
286
286
|
var T = h.prototype;
|
|
287
287
|
return !!(T && T.isReactComponent);
|
|
288
288
|
}
|
|
289
|
-
function
|
|
289
|
+
function Ze(h, T, m) {
|
|
290
290
|
if (h == null)
|
|
291
291
|
return "";
|
|
292
292
|
if (typeof h == "function")
|
|
293
293
|
return Tn(h, pi(h));
|
|
294
294
|
if (typeof h == "string")
|
|
295
|
-
return
|
|
295
|
+
return Ye(h);
|
|
296
296
|
switch (h) {
|
|
297
|
-
case
|
|
298
|
-
return
|
|
297
|
+
case c:
|
|
298
|
+
return Ye("Suspense");
|
|
299
299
|
case f:
|
|
300
|
-
return
|
|
300
|
+
return Ye("SuspenseList");
|
|
301
301
|
}
|
|
302
302
|
if (typeof h == "object")
|
|
303
303
|
switch (h.$$typeof) {
|
|
304
|
-
case
|
|
304
|
+
case d:
|
|
305
305
|
return hi(h.render);
|
|
306
306
|
case l:
|
|
307
|
-
return
|
|
307
|
+
return Ze(h.type, T, m);
|
|
308
308
|
case p: {
|
|
309
|
-
var O = h,
|
|
309
|
+
var O = h, I = O._payload, P = O._init;
|
|
310
310
|
try {
|
|
311
|
-
return
|
|
311
|
+
return Ze(P(I), T, m);
|
|
312
312
|
} catch {
|
|
313
313
|
}
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
316
|
return "";
|
|
317
317
|
}
|
|
318
|
-
var Me = Object.prototype.hasOwnProperty, wn = {}, mn =
|
|
319
|
-
function
|
|
318
|
+
var Me = Object.prototype.hasOwnProperty, wn = {}, mn = g.ReactDebugCurrentFrame;
|
|
319
|
+
function Xe(h) {
|
|
320
320
|
if (h) {
|
|
321
|
-
var T = h._owner, m =
|
|
321
|
+
var T = h._owner, m = Ze(h.type, h._source, T ? T.type : null);
|
|
322
322
|
mn.setExtraStackFrame(m);
|
|
323
323
|
} else
|
|
324
324
|
mn.setExtraStackFrame(null);
|
|
325
325
|
}
|
|
326
|
-
function yi(h, T, m, O,
|
|
326
|
+
function yi(h, T, m, O, I) {
|
|
327
327
|
{
|
|
328
328
|
var P = Function.call.bind(Me);
|
|
329
329
|
for (var j in h)
|
|
@@ -338,7 +338,7 @@ function Li() {
|
|
|
338
338
|
} catch (D) {
|
|
339
339
|
E = D;
|
|
340
340
|
}
|
|
341
|
-
E && !(E instanceof Error) && (
|
|
341
|
+
E && !(E instanceof Error) && (Xe(I), 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", m, j, typeof E), Xe(null)), E instanceof Error && !(E.message in wn) && (wn[E.message] = !0, Xe(I), v("Failed %s type: %s", m, E.message), Xe(null));
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
344
|
}
|
|
@@ -366,7 +366,7 @@ function Li() {
|
|
|
366
366
|
if (gi(h))
|
|
367
367
|
return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", _i(h)), vn(h);
|
|
368
368
|
}
|
|
369
|
-
var On =
|
|
369
|
+
var On = g.ReactCurrentOwner, Ti = {
|
|
370
370
|
key: !0,
|
|
371
371
|
ref: !0,
|
|
372
372
|
__self: !0,
|
|
@@ -413,7 +413,7 @@ function Li() {
|
|
|
413
413
|
});
|
|
414
414
|
}
|
|
415
415
|
}
|
|
416
|
-
var Ai = function(h, T, m, O,
|
|
416
|
+
var Ai = function(h, T, m, O, I, P, j) {
|
|
417
417
|
var E = {
|
|
418
418
|
// This tag allows us to uniquely identify this as a React Element
|
|
419
419
|
$$typeof: n,
|
|
@@ -439,13 +439,13 @@ function Li() {
|
|
|
439
439
|
configurable: !1,
|
|
440
440
|
enumerable: !1,
|
|
441
441
|
writable: !1,
|
|
442
|
-
value:
|
|
442
|
+
value: I
|
|
443
443
|
}), Object.freeze && (Object.freeze(E.props), Object.freeze(E)), E;
|
|
444
444
|
};
|
|
445
|
-
function Ei(h, T, m, O,
|
|
445
|
+
function Ei(h, T, m, O, I) {
|
|
446
446
|
{
|
|
447
447
|
var P, j = {}, E = null, z = null;
|
|
448
|
-
m !== void 0 && (Sn(m), E = "" + m), mi(T) && (Sn(T.key), E = "" + T.key), wi(T) && (z = T.ref, vi(T,
|
|
448
|
+
m !== void 0 && (Sn(m), E = "" + m), mi(T) && (Sn(T.key), E = "" + T.key), wi(T) && (z = T.ref, vi(T, I));
|
|
449
449
|
for (P in T)
|
|
450
450
|
Me.call(T, P) && !Ti.hasOwnProperty(P) && (j[P] = T[P]);
|
|
451
451
|
if (h && h.defaultProps) {
|
|
@@ -454,16 +454,16 @@ function Li() {
|
|
|
454
454
|
j[P] === void 0 && (j[P] = D[P]);
|
|
455
455
|
}
|
|
456
456
|
if (E || z) {
|
|
457
|
-
var
|
|
458
|
-
E && Si(j,
|
|
457
|
+
var U = typeof h == "function" ? h.displayName || h.name || "Unknown" : h;
|
|
458
|
+
E && Si(j, U), z && Oi(j, U);
|
|
459
459
|
}
|
|
460
|
-
return Ai(h, E, z,
|
|
460
|
+
return Ai(h, E, z, I, O, On.current, j);
|
|
461
461
|
}
|
|
462
462
|
}
|
|
463
|
-
var vt =
|
|
463
|
+
var vt = g.ReactCurrentOwner, kn = g.ReactDebugCurrentFrame;
|
|
464
464
|
function ve(h) {
|
|
465
465
|
if (h) {
|
|
466
|
-
var T = h._owner, m =
|
|
466
|
+
var T = h._owner, m = Ze(h.type, h._source, T ? T.type : null);
|
|
467
467
|
kn.setExtraStackFrame(m);
|
|
468
468
|
} else
|
|
469
469
|
kn.setExtraStackFrame(null);
|
|
@@ -488,7 +488,7 @@ Check the render method of \`` + h + "`.";
|
|
|
488
488
|
function ki(h) {
|
|
489
489
|
return "";
|
|
490
490
|
}
|
|
491
|
-
var
|
|
491
|
+
var Cn = {};
|
|
492
492
|
function ji(h) {
|
|
493
493
|
{
|
|
494
494
|
var T = jn();
|
|
@@ -501,15 +501,15 @@ Check the top-level render call using <` + m + ">.");
|
|
|
501
501
|
return T;
|
|
502
502
|
}
|
|
503
503
|
}
|
|
504
|
-
function
|
|
504
|
+
function In(h, T) {
|
|
505
505
|
{
|
|
506
506
|
if (!h._store || h._store.validated || h.key != null)
|
|
507
507
|
return;
|
|
508
508
|
h._store.validated = !0;
|
|
509
509
|
var m = ji(T);
|
|
510
|
-
if (
|
|
510
|
+
if (Cn[m])
|
|
511
511
|
return;
|
|
512
|
-
|
|
512
|
+
Cn[m] = !0;
|
|
513
513
|
var O = "";
|
|
514
514
|
h && h._owner && h._owner !== vt.current && (O = " It was passed a child from " + ne(h._owner.type) + "."), ve(h), v('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', m, O), ve(null);
|
|
515
515
|
}
|
|
@@ -521,19 +521,19 @@ Check the top-level render call using <` + m + ">.");
|
|
|
521
521
|
if (mt(h))
|
|
522
522
|
for (var m = 0; m < h.length; m++) {
|
|
523
523
|
var O = h[m];
|
|
524
|
-
Ot(O) &&
|
|
524
|
+
Ot(O) && In(O, T);
|
|
525
525
|
}
|
|
526
526
|
else if (Ot(h))
|
|
527
527
|
h._store && (h._store.validated = !0);
|
|
528
528
|
else if (h) {
|
|
529
|
-
var
|
|
530
|
-
if (typeof
|
|
531
|
-
for (var P =
|
|
532
|
-
Ot(j.value) &&
|
|
529
|
+
var I = w(h);
|
|
530
|
+
if (typeof I == "function" && I !== h.entries)
|
|
531
|
+
for (var P = I.call(h), j; !(j = P.next()).done; )
|
|
532
|
+
Ot(j.value) && In(j.value, T);
|
|
533
533
|
}
|
|
534
534
|
}
|
|
535
535
|
}
|
|
536
|
-
function
|
|
536
|
+
function Ci(h) {
|
|
537
537
|
{
|
|
538
538
|
var T = h.type;
|
|
539
539
|
if (T == null || typeof T == "string")
|
|
@@ -541,7 +541,7 @@ Check the top-level render call using <` + m + ">.");
|
|
|
541
541
|
var m;
|
|
542
542
|
if (typeof T == "function")
|
|
543
543
|
m = T.propTypes;
|
|
544
|
-
else if (typeof T == "object" && (T.$$typeof ===
|
|
544
|
+
else if (typeof T == "object" && (T.$$typeof === d || // Note: Memo only checks outer props here.
|
|
545
545
|
// Inner props are checked in the reconciler.
|
|
546
546
|
T.$$typeof === l))
|
|
547
547
|
m = T.propTypes;
|
|
@@ -552,13 +552,13 @@ Check the top-level render call using <` + m + ">.");
|
|
|
552
552
|
yi(m, h.props, "prop", O, h);
|
|
553
553
|
} else if (T.PropTypes !== void 0 && !St) {
|
|
554
554
|
St = !0;
|
|
555
|
-
var
|
|
556
|
-
v("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",
|
|
555
|
+
var I = ne(T);
|
|
556
|
+
v("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", I || "Unknown");
|
|
557
557
|
}
|
|
558
558
|
typeof T.getDefaultProps == "function" && !T.getDefaultProps.isReactClassApproved && v("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
559
559
|
}
|
|
560
560
|
}
|
|
561
|
-
function
|
|
561
|
+
function Ii(h) {
|
|
562
562
|
{
|
|
563
563
|
for (var T = Object.keys(h.props), m = 0; m < T.length; m++) {
|
|
564
564
|
var O = T[m];
|
|
@@ -571,9 +571,9 @@ Check the top-level render call using <` + m + ">.");
|
|
|
571
571
|
}
|
|
572
572
|
}
|
|
573
573
|
var Mn = {};
|
|
574
|
-
function Rn(h, T, m, O,
|
|
574
|
+
function Rn(h, T, m, O, I, P) {
|
|
575
575
|
{
|
|
576
|
-
var j =
|
|
576
|
+
var j = Qe(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.");
|
|
@@ -582,9 +582,9 @@ Check the top-level render call using <` + m + ">.");
|
|
|
582
582
|
var D;
|
|
583
583
|
h === null ? D = "null" : mt(h) ? D = "array" : h !== void 0 && h.$$typeof === n ? (D = "<" + (ne(h.type) || "Unknown") + " />", E = " Did you accidentally export a JSX literal instead of a component?") : D = 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", D, E);
|
|
584
584
|
}
|
|
585
|
-
var
|
|
586
|
-
if (
|
|
587
|
-
return
|
|
585
|
+
var U = Ei(h, T, m, I, P);
|
|
586
|
+
if (U == null)
|
|
587
|
+
return U;
|
|
588
588
|
if (j) {
|
|
589
589
|
var J = T.children;
|
|
590
590
|
if (J !== void 0)
|
|
@@ -599,20 +599,20 @@ Check the top-level render call using <` + m + ">.");
|
|
|
599
599
|
Pn(J, h);
|
|
600
600
|
}
|
|
601
601
|
if (Me.call(T, "key")) {
|
|
602
|
-
var he = ne(h), W = Object.keys(T).filter(function(
|
|
603
|
-
return
|
|
602
|
+
var he = ne(h), W = Object.keys(T).filter(function(xi) {
|
|
603
|
+
return xi !== "key";
|
|
604
604
|
}), At = W.length > 0 ? "{key: someKey, " + W.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
605
605
|
if (!Mn[he + At]) {
|
|
606
|
-
var
|
|
606
|
+
var Di = W.length > 0 ? "{" + W.join(": ..., ") + ": ...}" : "{}";
|
|
607
607
|
v(`A props object containing a "key" prop is being spread into JSX:
|
|
608
608
|
let props = %s;
|
|
609
609
|
<%s {...props} />
|
|
610
610
|
React keys must be passed directly to JSX without using spread:
|
|
611
611
|
let props = %s;
|
|
612
|
-
<%s key={someKey} {...props} />`, At, he,
|
|
612
|
+
<%s key={someKey} {...props} />`, At, he, Di, he), Mn[he + At] = !0;
|
|
613
613
|
}
|
|
614
614
|
}
|
|
615
|
-
return h === i ?
|
|
615
|
+
return h === i ? Ii(U) : Ci(U), U;
|
|
616
616
|
}
|
|
617
617
|
}
|
|
618
618
|
function Pi(h, T, m) {
|
|
@@ -627,8 +627,8 @@ React keys must be passed directly to JSX without using spread:
|
|
|
627
627
|
}
|
|
628
628
|
var Fi = {};
|
|
629
629
|
Fi.NODE_ENV === "production" ? Rt.exports = Ui() : Rt.exports = Li();
|
|
630
|
-
var
|
|
631
|
-
function
|
|
630
|
+
var et = Rt.exports;
|
|
631
|
+
function q(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 = q(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,27 +657,27 @@ 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 = q(i);
|
|
661
661
|
e ^= parseInt(s, 16), e *= 16777619, e = e >>> 0;
|
|
662
|
-
const o =
|
|
662
|
+
const o = q(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 q(String(t));
|
|
668
668
|
}
|
|
669
|
-
const
|
|
669
|
+
const x = {
|
|
670
670
|
Remove: "remove",
|
|
671
671
|
Replace: "replace",
|
|
672
672
|
Add: "add"
|
|
673
|
-
}, vr = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), Ni = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"),
|
|
673
|
+
}, vr = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), Ni = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), st = Symbol.iterator, Y = {
|
|
674
674
|
mutable: "mutable",
|
|
675
675
|
immutable: "immutable"
|
|
676
676
|
}, Jt = {};
|
|
677
|
-
function
|
|
677
|
+
function Fe(t, e) {
|
|
678
678
|
return t instanceof Map ? t.has(e) : Object.prototype.hasOwnProperty.call(t, e);
|
|
679
679
|
}
|
|
680
|
-
function
|
|
680
|
+
function xn(t, e) {
|
|
681
681
|
if (e in t) {
|
|
682
682
|
let n = Reflect.getPrototypeOf(t);
|
|
683
683
|
for (; n; ) {
|
|
@@ -721,7 +721,7 @@ function Sr(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 || Fe(n, s)))
|
|
725
725
|
return null;
|
|
726
726
|
e.push(s);
|
|
727
727
|
}
|
|
@@ -741,7 +741,7 @@ function we(t) {
|
|
|
741
741
|
function de(t, e) {
|
|
742
742
|
return we(t) === 2 ? t.get(e) : t[e];
|
|
743
743
|
}
|
|
744
|
-
function
|
|
744
|
+
function Ve(t, e, n) {
|
|
745
745
|
we(t) === 2 ? t.set(e, n) : t[e] = n;
|
|
746
746
|
}
|
|
747
747
|
function Et(t, e) {
|
|
@@ -825,15 +825,15 @@ function Or(t, e) {
|
|
|
825
825
|
function V(t) {
|
|
826
826
|
t.copy || (t.copy = Or(t.original, t.options));
|
|
827
827
|
}
|
|
828
|
-
function
|
|
828
|
+
function xe(t) {
|
|
829
829
|
if (!ee(t))
|
|
830
830
|
return en(t);
|
|
831
831
|
if (Array.isArray(t))
|
|
832
|
-
return t.map(
|
|
832
|
+
return t.map(xe);
|
|
833
833
|
if (t instanceof Map) {
|
|
834
834
|
const n = Array.from(t.entries()).map(([r, i]) => [
|
|
835
835
|
r,
|
|
836
|
-
|
|
836
|
+
xe(i)
|
|
837
837
|
]);
|
|
838
838
|
if (!Xt(t)) {
|
|
839
839
|
const r = Object.getPrototypeOf(t).constructor;
|
|
@@ -842,7 +842,7 @@ function De(t) {
|
|
|
842
842
|
return new Map(n);
|
|
843
843
|
}
|
|
844
844
|
if (t instanceof Set) {
|
|
845
|
-
const n = Array.from(t).map(
|
|
845
|
+
const n = Array.from(t).map(xe);
|
|
846
846
|
if (!Zt(t)) {
|
|
847
847
|
const r = Object.getPrototypeOf(t).constructor;
|
|
848
848
|
return new r(n);
|
|
@@ -851,11 +851,11 @@ function De(t) {
|
|
|
851
851
|
}
|
|
852
852
|
const e = Object.create(Object.getPrototypeOf(t));
|
|
853
853
|
for (const n in t)
|
|
854
|
-
e[n] =
|
|
854
|
+
e[n] = xe(t[n]);
|
|
855
855
|
return e;
|
|
856
856
|
}
|
|
857
|
-
function
|
|
858
|
-
return Te(t) ?
|
|
857
|
+
function ot(t) {
|
|
858
|
+
return Te(t) ? xe(t) : t;
|
|
859
859
|
}
|
|
860
860
|
function ie(t) {
|
|
861
861
|
var e;
|
|
@@ -871,11 +871,11 @@ function Oe(t, e, n, r, i) {
|
|
|
871
871
|
if (r.length > 0) {
|
|
872
872
|
const u = r.indexOf(o);
|
|
873
873
|
if (o && typeof o == "object" && u !== -1)
|
|
874
|
-
throw r[0] === o ? new Error("Forbids circular reference") : new Error(`Forbids circular reference: ~/${i.slice(0, u).map((a,
|
|
874
|
+
throw r[0] === o ? new Error("Forbids circular reference") : new Error(`Forbids circular reference: ~/${i.slice(0, u).map((a, d) => {
|
|
875
875
|
if (typeof a == "symbol")
|
|
876
876
|
return `[${a.toString()}]`;
|
|
877
|
-
const
|
|
878
|
-
return typeof a == "object" && (
|
|
877
|
+
const c = r[d];
|
|
878
|
+
return typeof a == "object" && (c instanceof Map || c instanceof Set) ? Array.from(c.keys()).indexOf(a) : a;
|
|
879
879
|
}).join("/")}`);
|
|
880
880
|
r.push(o), i.push(e);
|
|
881
881
|
} else
|
|
@@ -932,8 +932,8 @@ function Ar(t, e, n) {
|
|
|
932
932
|
if (Te(o)) {
|
|
933
933
|
const a = k(o);
|
|
934
934
|
V(a);
|
|
935
|
-
const
|
|
936
|
-
|
|
935
|
+
const d = !((u = a.assignedMap) === null || u === void 0) && u.size || a.operated ? a.copy : a.original;
|
|
936
|
+
Ve(r ? i : t, s, d);
|
|
937
937
|
} else
|
|
938
938
|
Ar(o, e, n);
|
|
939
939
|
}), i) {
|
|
@@ -947,12 +947,12 @@ function Vi(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 && Ar(de(n, e), t.finalities.handledSet, t.options);
|
|
949
949
|
}
|
|
950
|
-
function
|
|
950
|
+
function Dt(t) {
|
|
951
951
|
t.type === 3 && t.copy && (t.copy.clear(), t.setMap.forEach((e) => {
|
|
952
952
|
t.copy.add(en(e));
|
|
953
953
|
}));
|
|
954
954
|
}
|
|
955
|
-
function
|
|
955
|
+
function xt(t, e, n, r) {
|
|
956
956
|
if (t.operated && t.assignedMap && t.assignedMap.size > 0 && !t.finalized) {
|
|
957
957
|
if (n && r) {
|
|
958
958
|
const s = Sr(t);
|
|
@@ -967,8 +967,8 @@ function nn(t, e, n, r) {
|
|
|
967
967
|
var u;
|
|
968
968
|
const a = t.type === 3 ? t.setMap : t.copy;
|
|
969
969
|
if (ce(de(a, e), n)) {
|
|
970
|
-
let
|
|
971
|
-
i.copy && (
|
|
970
|
+
let d = i.original;
|
|
971
|
+
i.copy && (d = i.copy), Dt(t), xt(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)), Ve(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;
|
|
@@ -978,100 +978,100 @@ function nn(t, e, n, r) {
|
|
|
978
978
|
function Wi(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
|
-
for (let
|
|
982
|
-
if (o.get(
|
|
983
|
-
const
|
|
981
|
+
for (let d = 0; d < s.length; d += 1)
|
|
982
|
+
if (o.get(d.toString()) && a[d] !== s[d]) {
|
|
983
|
+
const c = e.concat([d]), f = be(c, i);
|
|
984
984
|
n.push({
|
|
985
|
-
op:
|
|
985
|
+
op: x.Replace,
|
|
986
986
|
path: f,
|
|
987
987
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
988
|
-
value:
|
|
988
|
+
value: ot(a[d])
|
|
989
989
|
}), r.push({
|
|
990
|
-
op:
|
|
990
|
+
op: x.Replace,
|
|
991
991
|
path: f,
|
|
992
992
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
993
|
-
value:
|
|
993
|
+
value: ot(s[d])
|
|
994
994
|
});
|
|
995
995
|
}
|
|
996
|
-
for (let
|
|
997
|
-
const
|
|
996
|
+
for (let d = s.length; d < a.length; d += 1) {
|
|
997
|
+
const c = e.concat([d]), f = be(c, i);
|
|
998
998
|
n.push({
|
|
999
|
-
op:
|
|
999
|
+
op: x.Add,
|
|
1000
1000
|
path: f,
|
|
1001
1001
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
1002
|
-
value:
|
|
1002
|
+
value: ot(a[d])
|
|
1003
1003
|
});
|
|
1004
1004
|
}
|
|
1005
1005
|
if (s.length < a.length) {
|
|
1006
|
-
const { arrayLengthAssignment:
|
|
1007
|
-
if (
|
|
1008
|
-
const
|
|
1006
|
+
const { arrayLengthAssignment: d = !0 } = u.enablePatches;
|
|
1007
|
+
if (d) {
|
|
1008
|
+
const c = e.concat(["length"]), f = be(c, i);
|
|
1009
1009
|
r.push({
|
|
1010
|
-
op:
|
|
1010
|
+
op: x.Replace,
|
|
1011
1011
|
path: f,
|
|
1012
1012
|
value: s.length
|
|
1013
1013
|
});
|
|
1014
1014
|
} else
|
|
1015
|
-
for (let
|
|
1016
|
-
const f = e.concat([
|
|
1015
|
+
for (let c = a.length; s.length < c; c -= 1) {
|
|
1016
|
+
const f = e.concat([c - 1]), l = be(f, i);
|
|
1017
1017
|
r.push({
|
|
1018
|
-
op:
|
|
1018
|
+
op: x.Remove,
|
|
1019
1019
|
path: l
|
|
1020
1020
|
});
|
|
1021
1021
|
}
|
|
1022
1022
|
}
|
|
1023
1023
|
}
|
|
1024
|
-
function
|
|
1024
|
+
function Bi({ original: t, copy: e, assignedMap: n }, r, i, s, o) {
|
|
1025
1025
|
n.forEach((u, a) => {
|
|
1026
|
-
const
|
|
1027
|
-
if (ce(
|
|
1026
|
+
const d = de(t, a), c = ot(de(e, a)), f = u ? Fe(t, a) ? x.Replace : x.Add : x.Remove;
|
|
1027
|
+
if (ce(d, c) && f === x.Replace)
|
|
1028
1028
|
return;
|
|
1029
1029
|
const l = r.concat(a), p = be(l, o);
|
|
1030
|
-
i.push(f ===
|
|
1030
|
+
i.push(f === x.Remove ? { op: f, path: p } : { op: f, path: p, value: c }), s.push(f === x.Add ? { op: x.Remove, path: p } : f === x.Remove ? { op: x.Add, path: p, value: d } : { op: x.Replace, path: p, value: d });
|
|
1031
1031
|
});
|
|
1032
1032
|
}
|
|
1033
|
-
function
|
|
1033
|
+
function Gi({ original: t, copy: e }, n, r, i, s) {
|
|
1034
1034
|
let o = 0;
|
|
1035
1035
|
t.forEach((u) => {
|
|
1036
1036
|
if (!e.has(u)) {
|
|
1037
|
-
const a = n.concat([o]),
|
|
1037
|
+
const a = n.concat([o]), d = be(a, s);
|
|
1038
1038
|
r.push({
|
|
1039
|
-
op:
|
|
1040
|
-
path:
|
|
1039
|
+
op: x.Remove,
|
|
1040
|
+
path: d,
|
|
1041
1041
|
value: u
|
|
1042
1042
|
}), i.unshift({
|
|
1043
|
-
op:
|
|
1044
|
-
path:
|
|
1043
|
+
op: x.Add,
|
|
1044
|
+
path: d,
|
|
1045
1045
|
value: u
|
|
1046
1046
|
});
|
|
1047
1047
|
}
|
|
1048
1048
|
o += 1;
|
|
1049
1049
|
}), o = 0, e.forEach((u) => {
|
|
1050
1050
|
if (!t.has(u)) {
|
|
1051
|
-
const a = n.concat([o]),
|
|
1051
|
+
const a = n.concat([o]), d = be(a, s);
|
|
1052
1052
|
r.push({
|
|
1053
|
-
op:
|
|
1054
|
-
path:
|
|
1053
|
+
op: x.Add,
|
|
1054
|
+
path: d,
|
|
1055
1055
|
value: u
|
|
1056
1056
|
}), i.unshift({
|
|
1057
|
-
op:
|
|
1058
|
-
path:
|
|
1057
|
+
op: x.Remove,
|
|
1058
|
+
path: d,
|
|
1059
1059
|
value: u
|
|
1060
1060
|
});
|
|
1061
1061
|
}
|
|
1062
1062
|
o += 1;
|
|
1063
1063
|
});
|
|
1064
1064
|
}
|
|
1065
|
-
function
|
|
1065
|
+
function ze(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
|
-
return
|
|
1070
|
+
return Bi(t, e, n, r, i);
|
|
1071
1071
|
case 1:
|
|
1072
1072
|
return Wi(t, e, n, r, i);
|
|
1073
1073
|
case 3:
|
|
1074
|
-
return
|
|
1074
|
+
return Gi(t, e, n, r, i);
|
|
1075
1075
|
}
|
|
1076
1076
|
}
|
|
1077
1077
|
const ct = (t, e, n = !1) => {
|
|
@@ -1086,7 +1086,7 @@ const ct = (t, e, n = !1) => {
|
|
|
1086
1086
|
},
|
|
1087
1087
|
set(t, e) {
|
|
1088
1088
|
const n = k(this), r = H(n);
|
|
1089
|
-
return (!r.has(t) || !ce(r.get(t), e)) && (V(n), ie(n), n.assignedMap.set(t, !0), n.copy.set(t, e), nn(n, t, e,
|
|
1089
|
+
return (!r.has(t) || !ce(r.get(t), e)) && (V(n), ie(n), n.assignedMap.set(t, !0), n.copy.set(t, e), nn(n, t, e, ze)), this;
|
|
1090
1090
|
},
|
|
1091
1091
|
delete(t) {
|
|
1092
1092
|
if (!this.has(t))
|
|
@@ -1129,7 +1129,7 @@ const ct = (t, e, n = !1) => {
|
|
|
1129
1129
|
values() {
|
|
1130
1130
|
const t = this.keys();
|
|
1131
1131
|
return {
|
|
1132
|
-
[
|
|
1132
|
+
[st]: () => this.values(),
|
|
1133
1133
|
next: () => {
|
|
1134
1134
|
const e = t.next();
|
|
1135
1135
|
return e.done ? e : {
|
|
@@ -1142,7 +1142,7 @@ const ct = (t, e, n = !1) => {
|
|
|
1142
1142
|
entries() {
|
|
1143
1143
|
const t = this.keys();
|
|
1144
1144
|
return {
|
|
1145
|
-
[
|
|
1145
|
+
[st]: () => this.entries(),
|
|
1146
1146
|
next: () => {
|
|
1147
1147
|
const e = t.next();
|
|
1148
1148
|
if (e.done)
|
|
@@ -1155,26 +1155,26 @@ const ct = (t, e, n = !1) => {
|
|
|
1155
1155
|
}
|
|
1156
1156
|
};
|
|
1157
1157
|
},
|
|
1158
|
-
[
|
|
1158
|
+
[st]() {
|
|
1159
1159
|
return this.entries();
|
|
1160
1160
|
}
|
|
1161
|
-
},
|
|
1161
|
+
}, Qi = Reflect.ownKeys(Ut), Ln = (t, e, { isValuesIterator: n }) => () => {
|
|
1162
1162
|
var r, i;
|
|
1163
1163
|
const s = e.next();
|
|
1164
1164
|
if (s.done)
|
|
1165
1165
|
return s;
|
|
1166
1166
|
const o = s.value;
|
|
1167
1167
|
let u = t.setMap.get(o);
|
|
1168
|
-
const a = k(u),
|
|
1169
|
-
if (t.options.strict && ct(o, t.options,
|
|
1170
|
-
const
|
|
1168
|
+
const a = k(u), d = ((i = (r = t.options).mark) === null || i === void 0 ? void 0 : i.call(r, u, Y)) === Y.mutable;
|
|
1169
|
+
if (t.options.strict && ct(o, t.options, d), !d && !a && ee(o, t.options) && !t.finalized && t.original.has(o)) {
|
|
1170
|
+
const c = Jt.createDraft({
|
|
1171
1171
|
original: o,
|
|
1172
1172
|
parentDraft: t,
|
|
1173
1173
|
key: o,
|
|
1174
1174
|
finalities: t.finalities,
|
|
1175
1175
|
options: t.options
|
|
1176
1176
|
});
|
|
1177
|
-
t.setMap.set(o,
|
|
1177
|
+
t.setMap.set(o, c), u = c;
|
|
1178
1178
|
} else a && (u = a.proxy);
|
|
1179
1179
|
return {
|
|
1180
1180
|
done: !1,
|
|
@@ -1194,7 +1194,7 @@ const ct = (t, e, n = !1) => {
|
|
|
1194
1194
|
},
|
|
1195
1195
|
add(t) {
|
|
1196
1196
|
const e = k(this);
|
|
1197
|
-
return this.has(t) || (V(e), ie(e), e.assignedMap.set(t, !0), e.setMap.set(t, t), nn(e, t, t,
|
|
1197
|
+
return this.has(t) || (V(e), ie(e), e.assignedMap.set(t, !0), e.setMap.set(t, t), nn(e, t, t, ze)), this;
|
|
1198
1198
|
},
|
|
1199
1199
|
delete(t) {
|
|
1200
1200
|
if (!this.has(t))
|
|
@@ -1236,7 +1236,7 @@ const ct = (t, e, n = !1) => {
|
|
|
1236
1236
|
keys() {
|
|
1237
1237
|
return this.values();
|
|
1238
1238
|
},
|
|
1239
|
-
[
|
|
1239
|
+
[st]() {
|
|
1240
1240
|
return this.values();
|
|
1241
1241
|
},
|
|
1242
1242
|
forEach(t, e) {
|
|
@@ -1279,30 +1279,30 @@ const Hi = Reflect.ownKeys(dt), Er = /* @__PURE__ */ new WeakSet(), kr = {
|
|
|
1279
1279
|
return t;
|
|
1280
1280
|
let o;
|
|
1281
1281
|
if (t.options.mark) {
|
|
1282
|
-
const
|
|
1283
|
-
if (o = t.options.mark(
|
|
1284
|
-
return t.options.strict && ct(
|
|
1282
|
+
const d = e === "size" && (t.original instanceof Map || t.original instanceof Set) ? Reflect.get(t.original, e) : Reflect.get(t.original, e, n);
|
|
1283
|
+
if (o = t.options.mark(d, Y), o === Y.mutable)
|
|
1284
|
+
return t.options.strict && ct(d, t.options, !0), d;
|
|
1285
1285
|
}
|
|
1286
1286
|
const u = H(t);
|
|
1287
|
-
if (u instanceof Map &&
|
|
1287
|
+
if (u instanceof Map && Qi.includes(e)) {
|
|
1288
1288
|
if (e === "size")
|
|
1289
1289
|
return Object.getOwnPropertyDescriptor(Ut, "size").get.call(t.proxy);
|
|
1290
|
-
const
|
|
1291
|
-
if (
|
|
1292
|
-
return
|
|
1290
|
+
const d = Ut[e];
|
|
1291
|
+
if (d)
|
|
1292
|
+
return d.bind(t.proxy);
|
|
1293
1293
|
}
|
|
1294
1294
|
if (u instanceof Set && Hi.includes(e)) {
|
|
1295
1295
|
if (e === "size")
|
|
1296
1296
|
return Object.getOwnPropertyDescriptor(dt, "size").get.call(t.proxy);
|
|
1297
|
-
const
|
|
1298
|
-
if (
|
|
1299
|
-
return
|
|
1297
|
+
const d = dt[e];
|
|
1298
|
+
if (d)
|
|
1299
|
+
return d.bind(t.proxy);
|
|
1300
1300
|
}
|
|
1301
|
-
if (!
|
|
1302
|
-
const
|
|
1303
|
-
return
|
|
1301
|
+
if (!Fe(u, e)) {
|
|
1302
|
+
const d = xn(u, e);
|
|
1303
|
+
return d ? "value" in d ? d.value : (
|
|
1304
1304
|
// !case: support for getter
|
|
1305
|
-
(i =
|
|
1305
|
+
(i = d.get) === null || i === void 0 ? void 0 : i.call(t.proxy)
|
|
1306
1306
|
) : void 0;
|
|
1307
1307
|
}
|
|
1308
1308
|
const a = u[e];
|
|
@@ -1316,8 +1316,8 @@ const Hi = Reflect.ownKeys(dt), Er = /* @__PURE__ */ new WeakSet(), kr = {
|
|
|
1316
1316
|
finalities: t.finalities,
|
|
1317
1317
|
options: t.options
|
|
1318
1318
|
}), typeof o == "function") {
|
|
1319
|
-
const
|
|
1320
|
-
return V(
|
|
1319
|
+
const d = k(t.copy[e]);
|
|
1320
|
+
return V(d), ie(d), d.copy;
|
|
1321
1321
|
}
|
|
1322
1322
|
return t.copy[e];
|
|
1323
1323
|
}
|
|
@@ -1330,11 +1330,11 @@ const Hi = Reflect.ownKeys(dt), Er = /* @__PURE__ */ new WeakSet(), kr = {
|
|
|
1330
1330
|
let i;
|
|
1331
1331
|
if (t.type === 1 && e !== "length" && !(Number.isInteger(i = Number(e)) && i >= 0 && (e === 0 || i === 0 || String(i) === String(e))))
|
|
1332
1332
|
throw new Error("Only supports setting array indices and the 'length' property.");
|
|
1333
|
-
const s =
|
|
1333
|
+
const s = xn(H(t), e);
|
|
1334
1334
|
if (s != null && s.set)
|
|
1335
1335
|
return s.set.call(t.proxy, n), !0;
|
|
1336
1336
|
const o = Et(H(t), e), u = k(o);
|
|
1337
|
-
return u && ce(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) : (ce(n, o) && (n !== void 0 ||
|
|
1337
|
+
return u && ce(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) : (ce(n, o) && (n !== void 0 || Fe(t.original, e)) || (V(t), ie(t), Fe(t.original, e) && ce(n, t.original[e]) ? t.assignedMap.delete(e) : t.assignedMap.set(e, !0), t.copy[e] = n, nn(t, e, n, ze)), !0);
|
|
1338
1338
|
},
|
|
1339
1339
|
has(t, e) {
|
|
1340
1340
|
return e in H(t);
|
|
@@ -1379,26 +1379,26 @@ function rn(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:
|
|
1383
|
-
if (i.revoke.push(
|
|
1384
|
-
const
|
|
1385
|
-
|
|
1382
|
+
const { proxy: a, revoke: d } = Proxy.revocable(o === 1 ? Object.assign([], u) : u, kr);
|
|
1383
|
+
if (i.revoke.push(d), Er.add(a), u.proxy = a, n) {
|
|
1384
|
+
const c = n;
|
|
1385
|
+
c.finalities.draft.push((f, l) => {
|
|
1386
1386
|
var p, y;
|
|
1387
1387
|
const b = k(a);
|
|
1388
|
-
let
|
|
1389
|
-
const w = de(
|
|
1390
|
-
if (
|
|
1391
|
-
let v =
|
|
1392
|
-
|
|
1388
|
+
let _ = c.type === 3 ? c.setMap : c.copy;
|
|
1389
|
+
const w = de(_, r), g = k(w);
|
|
1390
|
+
if (g) {
|
|
1391
|
+
let v = g.original;
|
|
1392
|
+
g.operated && (v = en(w)), Dt(g), xt(g, ze, 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, g.original)), Ve(_, r, v);
|
|
1393
1393
|
}
|
|
1394
1394
|
(y = b.callbacks) === null || y === void 0 || y.forEach((v) => {
|
|
1395
1395
|
v(f, l);
|
|
1396
1396
|
});
|
|
1397
1397
|
});
|
|
1398
1398
|
} else {
|
|
1399
|
-
const
|
|
1400
|
-
|
|
1401
|
-
|
|
1399
|
+
const c = k(a);
|
|
1400
|
+
c.finalities.draft.push((f, l) => {
|
|
1401
|
+
Dt(c), xt(c, ze, f, l);
|
|
1402
1402
|
});
|
|
1403
1403
|
}
|
|
1404
1404
|
return a;
|
|
@@ -1410,11 +1410,11 @@ function Yi(t, e, n, r, i) {
|
|
|
1410
1410
|
if (o != null && o.operated)
|
|
1411
1411
|
for (; o.finalities.draft.length > 0; )
|
|
1412
1412
|
o.finalities.draft.pop()(n, r);
|
|
1413
|
-
const
|
|
1414
|
-
return o && $t(o), i && Oe(
|
|
1415
|
-
|
|
1416
|
-
n && a ? [{ op:
|
|
1417
|
-
r && a ? [{ op:
|
|
1413
|
+
const d = a ? e[0] : o ? o.operated ? o.copy : o.original : t;
|
|
1414
|
+
return o && $t(o), i && Oe(d, d, o == null ? void 0 : o.options.updatedValues), [
|
|
1415
|
+
d,
|
|
1416
|
+
n && a ? [{ op: x.Replace, path: [], value: e[0] }] : n,
|
|
1417
|
+
r && a ? [{ op: x.Replace, path: [], value: u }] : r
|
|
1418
1418
|
];
|
|
1419
1419
|
}
|
|
1420
1420
|
function Ji(t, e) {
|
|
@@ -1435,8 +1435,8 @@ function Ji(t, e) {
|
|
|
1435
1435
|
return [
|
|
1436
1436
|
u,
|
|
1437
1437
|
(a = []) => {
|
|
1438
|
-
const [
|
|
1439
|
-
return e.enablePatches ? [
|
|
1438
|
+
const [d, c, f] = Yi(u, a, i, s, e.enableAutoFreeze);
|
|
1439
|
+
return e.enablePatches ? [d, c, f] : d;
|
|
1440
1440
|
}
|
|
1441
1441
|
];
|
|
1442
1442
|
}
|
|
@@ -1446,12 +1446,12 @@ function Lt(t) {
|
|
|
1446
1446
|
const a = k(o);
|
|
1447
1447
|
if (a && e && a.finalities === e.finalities) {
|
|
1448
1448
|
t.isContainDraft = !0;
|
|
1449
|
-
const
|
|
1449
|
+
const d = a.original;
|
|
1450
1450
|
if (u instanceof Set) {
|
|
1451
|
-
const
|
|
1452
|
-
u.clear(),
|
|
1451
|
+
const c = Array.from(u);
|
|
1452
|
+
u.clear(), c.forEach((f) => u.add(s === f ? d : f));
|
|
1453
1453
|
} else
|
|
1454
|
-
|
|
1454
|
+
Ve(u, s, d);
|
|
1455
1455
|
} else typeof o == "object" && o !== null && (t.value = o, t.isRoot = !1, Lt(t));
|
|
1456
1456
|
}), i && (t.isContainDraft || console.warn("The return value does not contain any draft, please use 'rawReturn()' to wrap the return value to improve performance."), r && console.warn("The return value contains drafts, please don't use 'rawReturn()' to wrap the return value."));
|
|
1457
1457
|
}
|
|
@@ -1480,7 +1480,7 @@ function jr(t) {
|
|
|
1480
1480
|
if (n && ce(de(n.original, o), u))
|
|
1481
1481
|
return;
|
|
1482
1482
|
const a = jr(u);
|
|
1483
|
-
a !== u && (i === t && s(),
|
|
1483
|
+
a !== u && (i === t && s(), Ve(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 Zt(o) ? new Set(i) : new (Object.getPrototypeOf(o)).constructor(i);
|
|
@@ -1495,83 +1495,83 @@ function Fn(t) {
|
|
|
1495
1495
|
const Zi = (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, (
|
|
1498
|
+
return function(S, ...C) {
|
|
1499
|
+
return e(S, ($) => n.call(this, $, ...C), r);
|
|
1500
1500
|
};
|
|
1501
|
-
const a = n,
|
|
1502
|
-
let
|
|
1503
|
-
if (typeof r != "function" && (
|
|
1504
|
-
throw new Error(`Invalid options: ${
|
|
1505
|
-
|
|
1506
|
-
const f = Te(a) ? Fn(a) : a, l = Array.isArray(
|
|
1507
|
-
for (const
|
|
1508
|
-
if (typeof
|
|
1509
|
-
throw new Error(`Invalid mark: ${
|
|
1510
|
-
const R =
|
|
1501
|
+
const a = n, d = r;
|
|
1502
|
+
let c = i;
|
|
1503
|
+
if (typeof r != "function" && (c = r), c !== void 0 && Object.prototype.toString.call(c) !== "[object Object]")
|
|
1504
|
+
throw new Error(`Invalid options: ${c}, 'options' should be an object.`);
|
|
1505
|
+
c = Object.assign(Object.assign({}, t), c);
|
|
1506
|
+
const f = Te(a) ? Fn(a) : a, l = Array.isArray(c.mark) ? (S, C) => {
|
|
1507
|
+
for (const $ of c.mark) {
|
|
1508
|
+
if (typeof $ != "function")
|
|
1509
|
+
throw new Error(`Invalid mark: ${$}, 'mark' should be a function.`);
|
|
1510
|
+
const R = $(S, C);
|
|
1511
1511
|
if (R)
|
|
1512
1512
|
return R;
|
|
1513
1513
|
}
|
|
1514
|
-
} :
|
|
1515
|
-
enableAutoFreeze: (u =
|
|
1514
|
+
} : c.mark, p = (s = c.enablePatches) !== null && s !== void 0 ? s : !1, y = (o = c.strict) !== null && o !== void 0 ? o : !1, _ = {
|
|
1515
|
+
enableAutoFreeze: (u = c.enableAutoFreeze) !== null && u !== void 0 ? u : !1,
|
|
1516
1516
|
mark: l,
|
|
1517
1517
|
strict: y,
|
|
1518
1518
|
enablePatches: p
|
|
1519
1519
|
};
|
|
1520
|
-
if (!ee(f,
|
|
1520
|
+
if (!ee(f, _) && typeof f == "object" && f !== null)
|
|
1521
1521
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
1522
|
-
const [w,
|
|
1522
|
+
const [w, g] = Ji(f, _);
|
|
1523
1523
|
if (typeof r != "function") {
|
|
1524
|
-
if (!ee(f,
|
|
1524
|
+
if (!ee(f, _))
|
|
1525
1525
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
1526
|
-
return [w,
|
|
1526
|
+
return [w, g];
|
|
1527
1527
|
}
|
|
1528
1528
|
let v;
|
|
1529
1529
|
try {
|
|
1530
|
-
v =
|
|
1530
|
+
v = d(w);
|
|
1531
1531
|
} catch (S) {
|
|
1532
1532
|
throw $t(k(w)), S;
|
|
1533
1533
|
}
|
|
1534
1534
|
const A = (S) => {
|
|
1535
|
-
const
|
|
1535
|
+
const C = k(w);
|
|
1536
1536
|
if (!Te(S)) {
|
|
1537
|
-
if (S !== void 0 && !ce(S, w) && (
|
|
1537
|
+
if (S !== void 0 && !ce(S, w) && (C != null && C.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 R = S == null ? void 0 : S[Ni];
|
|
1540
1540
|
if (R) {
|
|
1541
1541
|
const Pe = R[0];
|
|
1542
|
-
return
|
|
1543
|
-
rootDraft:
|
|
1542
|
+
return _.strict && typeof S == "object" && S !== null && Lt({
|
|
1543
|
+
rootDraft: C,
|
|
1544
1544
|
value: S,
|
|
1545
1545
|
useRawReturn: !0
|
|
1546
|
-
}),
|
|
1546
|
+
}), g([Pe]);
|
|
1547
1547
|
}
|
|
1548
1548
|
if (S !== void 0)
|
|
1549
|
-
return typeof S == "object" && S !== null && Lt({ rootDraft:
|
|
1549
|
+
return typeof S == "object" && S !== null && Lt({ rootDraft: C, value: S }), g([S]);
|
|
1550
1550
|
}
|
|
1551
1551
|
if (S === w || S === void 0)
|
|
1552
|
-
return
|
|
1553
|
-
const
|
|
1554
|
-
if (
|
|
1555
|
-
if (
|
|
1552
|
+
return g([]);
|
|
1553
|
+
const $ = k(S);
|
|
1554
|
+
if (_ === $.options) {
|
|
1555
|
+
if ($.operated)
|
|
1556
1556
|
throw new Error("Cannot return a modified child draft.");
|
|
1557
|
-
return
|
|
1557
|
+
return g([Fn(S)]);
|
|
1558
1558
|
}
|
|
1559
|
-
return
|
|
1559
|
+
return g([S]);
|
|
1560
1560
|
};
|
|
1561
1561
|
return v instanceof Promise ? v.then(A, (S) => {
|
|
1562
1562
|
throw $t(k(w)), S;
|
|
1563
1563
|
}) : A(v);
|
|
1564
1564
|
}, ft = Zi();
|
|
1565
1565
|
Object.prototype.constructor.toString();
|
|
1566
|
-
function
|
|
1566
|
+
function Cr(t, e) {
|
|
1567
1567
|
const n = Object.keys(t), r = Object.keys(e);
|
|
1568
1568
|
return n.length === r.length && Object.keys(t).every((i) => e.hasOwnProperty(i));
|
|
1569
1569
|
}
|
|
1570
1570
|
function Nn(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 :
|
|
1573
|
+
function ut(t, e) {
|
|
1574
|
+
return typeof t != "object" || typeof e != "object" || t === null || e === null ? t === e : Cr(t, e) ? Object.keys(t).every((n) => ut(t[n], e[n])) : !1;
|
|
1575
1575
|
}
|
|
1576
1576
|
function sn(t) {
|
|
1577
1577
|
if (!Ue(t))
|
|
@@ -1581,7 +1581,7 @@ function sn(t) {
|
|
|
1581
1581
|
r !== void 0 && (e[n] = r);
|
|
1582
1582
|
return e;
|
|
1583
1583
|
}
|
|
1584
|
-
function
|
|
1584
|
+
function Ir(t, e) {
|
|
1585
1585
|
if (!Ue(t) || !Ue(e))
|
|
1586
1586
|
return e;
|
|
1587
1587
|
const n = Object.assign({}, t);
|
|
@@ -1593,7 +1593,7 @@ function Cr(t, e) {
|
|
|
1593
1593
|
continue;
|
|
1594
1594
|
}
|
|
1595
1595
|
const i = Ue(t[r]) && Ue(e[r]);
|
|
1596
|
-
n[r] = i ?
|
|
1596
|
+
n[r] = i ? Ir(t[r], e[r]) : e[r];
|
|
1597
1597
|
}
|
|
1598
1598
|
return n;
|
|
1599
1599
|
}
|
|
@@ -1875,8 +1875,8 @@ function ds(t) {
|
|
|
1875
1875
|
function fs(t) {
|
|
1876
1876
|
const e = /^(\d+)-(\d{1,2})-(\d{1,2})([ T])(.+)$/, n = t.match(e);
|
|
1877
1877
|
if (n) {
|
|
1878
|
-
const [, r, i, s, o, u] = n, a = i.padStart(2, "0"),
|
|
1879
|
-
return new Date(
|
|
1878
|
+
const [, r, i, s, o, u] = n, a = i.padStart(2, "0"), d = s.padStart(2, "0"), c = `${r}-${a}-${d}T${u}`;
|
|
1879
|
+
return new Date(c);
|
|
1880
1880
|
}
|
|
1881
1881
|
return null;
|
|
1882
1882
|
}
|
|
@@ -1884,8 +1884,8 @@ function ls(t) {
|
|
|
1884
1884
|
const [e, n] = t.split(", "), [r, i, s] = e.split("/").map(Number), o = n.match(/(\d{1,2}):(\d{2}):(\d{2}) (AM|PM)/);
|
|
1885
1885
|
if (!o)
|
|
1886
1886
|
throw new Error(`Unable to parse time from: ${t}`);
|
|
1887
|
-
let [, u, a,
|
|
1888
|
-
return u = Number(u), a = Number(a),
|
|
1887
|
+
let [, u, a, d, c] = o;
|
|
1888
|
+
return u = Number(u), a = Number(a), d = Number(d), c === "PM" && u !== 12 ? u += 12 : c === "AM" && u === 12 && (u = 0), new Date(Date.UTC(s, r - 1, i, u, a, d));
|
|
1889
1889
|
}
|
|
1890
1890
|
function hs(t) {
|
|
1891
1891
|
switch (t) {
|
|
@@ -1987,7 +1987,7 @@ class _e {
|
|
|
1987
1987
|
for (const e of Object.values(this.attrs))
|
|
1988
1988
|
if (un(e)) {
|
|
1989
1989
|
const [n, r, i] = e["forward-identity"];
|
|
1990
|
-
|
|
1990
|
+
B(this.blobAttrs, [r, i], e);
|
|
1991
1991
|
}
|
|
1992
1992
|
return this._blobAttrs;
|
|
1993
1993
|
}
|
|
@@ -1998,7 +1998,7 @@ class _e {
|
|
|
1998
1998
|
for (const e of Object.values(this.attrs))
|
|
1999
1999
|
if (e["primary?"]) {
|
|
2000
2000
|
const [n, r] = e["forward-identity"];
|
|
2001
|
-
|
|
2001
|
+
B(this._primaryKeys, [r], e);
|
|
2002
2002
|
}
|
|
2003
2003
|
return this._primaryKeys;
|
|
2004
2004
|
}
|
|
@@ -2008,7 +2008,7 @@ class _e {
|
|
|
2008
2008
|
this._forwardIdents = /* @__PURE__ */ new Map();
|
|
2009
2009
|
for (const e of Object.values(this.attrs)) {
|
|
2010
2010
|
const n = e["forward-identity"], [r, i, s] = n;
|
|
2011
|
-
|
|
2011
|
+
B(this._forwardIdents, [i, s], e);
|
|
2012
2012
|
}
|
|
2013
2013
|
return this._forwardIdents;
|
|
2014
2014
|
}
|
|
@@ -2020,7 +2020,7 @@ class _e {
|
|
|
2020
2020
|
const n = e["reverse-identity"];
|
|
2021
2021
|
if (n) {
|
|
2022
2022
|
const [r, i, s] = n;
|
|
2023
|
-
|
|
2023
|
+
B(this._revIdents, [i, s], e);
|
|
2024
2024
|
}
|
|
2025
2025
|
}
|
|
2026
2026
|
return this._revIdents;
|
|
@@ -2038,7 +2038,7 @@ function on(t) {
|
|
|
2038
2038
|
function un(t) {
|
|
2039
2039
|
return t["value-type"] === "blob";
|
|
2040
2040
|
}
|
|
2041
|
-
function
|
|
2041
|
+
function Ce(t, e) {
|
|
2042
2042
|
return e.reduce((n, r) => n && n.get(r), t);
|
|
2043
2043
|
}
|
|
2044
2044
|
function X(t, e) {
|
|
@@ -2051,7 +2051,7 @@ function X(t, e) {
|
|
|
2051
2051
|
const [n, ...r] = e;
|
|
2052
2052
|
t.has(n) && X(t.get(n), r);
|
|
2053
2053
|
}
|
|
2054
|
-
function
|
|
2054
|
+
function B(t, e, n) {
|
|
2055
2055
|
let r = t;
|
|
2056
2056
|
const i = e.length - 1;
|
|
2057
2057
|
for (let s = 0; s < i; s++) {
|
|
@@ -2064,48 +2064,48 @@ function Q(t, e, n) {
|
|
|
2064
2064
|
function Mr(t, e, n) {
|
|
2065
2065
|
const r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
|
|
2066
2066
|
for (const o of e) {
|
|
2067
|
-
let [u, a,
|
|
2068
|
-
const
|
|
2069
|
-
if (!
|
|
2067
|
+
let [u, a, d] = o;
|
|
2068
|
+
const c = t.getAttr(a);
|
|
2069
|
+
if (!c) {
|
|
2070
2070
|
console.warn("no such attr", a, u);
|
|
2071
2071
|
continue;
|
|
2072
2072
|
}
|
|
2073
|
-
|
|
2073
|
+
c["checked-data-type"] === "date" && n && (d = pt(d), o[2] = d), on(c) && B(s, [d, a, u], o), B(r, [u, a, d], o), B(i, [a, u, d], o);
|
|
2074
2074
|
}
|
|
2075
2075
|
return { eav: r, aev: i, vae: s };
|
|
2076
2076
|
}
|
|
2077
2077
|
function Rr(t) {
|
|
2078
2078
|
return {
|
|
2079
|
-
triples:
|
|
2079
|
+
triples: G(t.eav, 3),
|
|
2080
2080
|
cardinalityInference: t.cardinalityInference,
|
|
2081
2081
|
useDateObjects: t.useDateObjects,
|
|
2082
2082
|
version: 1
|
|
2083
2083
|
};
|
|
2084
2084
|
}
|
|
2085
2085
|
function $r(t, e) {
|
|
2086
|
-
return
|
|
2086
|
+
return at(t, e.triples, e.cardinalityInference, e.useDateObjects);
|
|
2087
2087
|
}
|
|
2088
|
-
function
|
|
2088
|
+
function Dr(t, e) {
|
|
2089
2089
|
if (t)
|
|
2090
2090
|
return new _e(t.attrs, t.linkIndex);
|
|
2091
2091
|
if (e && "__type" in e)
|
|
2092
2092
|
return new _e(e.attrs, e.linkIndex);
|
|
2093
2093
|
}
|
|
2094
2094
|
function Ts(t, e) {
|
|
2095
|
-
return
|
|
2095
|
+
return Ce(t.eav, [e]) !== void 0;
|
|
2096
2096
|
}
|
|
2097
|
-
function
|
|
2097
|
+
function at(t, e, n, r) {
|
|
2098
2098
|
const i = Mr(t, e, r);
|
|
2099
2099
|
return i.cardinalityInference = n, i.useDateObjects = r, i;
|
|
2100
2100
|
}
|
|
2101
|
-
function
|
|
2101
|
+
function We(t, e) {
|
|
2102
2102
|
var n, r;
|
|
2103
2103
|
let i;
|
|
2104
2104
|
if (Array.isArray(e[0])) {
|
|
2105
2105
|
const [o, u] = e[0], a = t.aev.get(o);
|
|
2106
2106
|
if (!a)
|
|
2107
2107
|
return null;
|
|
2108
|
-
i = (n =
|
|
2108
|
+
i = (n = G(a, 2).find((c) => c[2] === u)) === null || n === void 0 ? void 0 : n[0];
|
|
2109
2109
|
} else
|
|
2110
2110
|
i = e[0];
|
|
2111
2111
|
if (!i)
|
|
@@ -2115,18 +2115,18 @@ function Qe(t, e) {
|
|
|
2115
2115
|
const [o, u] = s, a = t.aev.get(o);
|
|
2116
2116
|
if (!a)
|
|
2117
2117
|
return null;
|
|
2118
|
-
const
|
|
2119
|
-
if (!
|
|
2118
|
+
const c = (r = G(a, 2).find((b) => b[2] === u)) === null || r === void 0 ? void 0 : r[0];
|
|
2119
|
+
if (!c)
|
|
2120
2120
|
return null;
|
|
2121
2121
|
const [f, l, p, ...y] = e;
|
|
2122
|
-
return [i, l,
|
|
2122
|
+
return [i, l, c, ...y];
|
|
2123
2123
|
} else {
|
|
2124
2124
|
const [o, ...u] = e;
|
|
2125
2125
|
return [i, ...u];
|
|
2126
2126
|
}
|
|
2127
2127
|
}
|
|
2128
|
-
function
|
|
2129
|
-
const r =
|
|
2128
|
+
function xr(t, e, n) {
|
|
2129
|
+
const r = We(t, n);
|
|
2130
2130
|
if (!r)
|
|
2131
2131
|
return;
|
|
2132
2132
|
const [i, s, o] = r, u = e.getAttr(s);
|
|
@@ -2136,12 +2136,12 @@ let ws = 0;
|
|
|
2136
2136
|
function Ur(t, e, n) {
|
|
2137
2137
|
const [r, i, s] = n;
|
|
2138
2138
|
let o;
|
|
2139
|
-
const u =
|
|
2139
|
+
const u = Ce(t.eav, [r, i, s]);
|
|
2140
2140
|
return u && (o = u[3]), o || Date.now() * 10 + ws++;
|
|
2141
2141
|
}
|
|
2142
2142
|
function Lr(t, e, n) {
|
|
2143
2143
|
var r;
|
|
2144
|
-
const i =
|
|
2144
|
+
const i = We(t, n);
|
|
2145
2145
|
if (!i)
|
|
2146
2146
|
return;
|
|
2147
2147
|
let [s, o, u] = i;
|
|
@@ -2149,12 +2149,12 @@ function Lr(t, e, n) {
|
|
|
2149
2149
|
if (!a)
|
|
2150
2150
|
return;
|
|
2151
2151
|
a["checked-data-type"] === "date" && t.useDateObjects && (u = pt(u));
|
|
2152
|
-
const
|
|
2153
|
-
gs(a) ? (
|
|
2152
|
+
const d = Ce(t.eav, [s, o, u]), c = (r = d == null ? void 0 : d[3]) !== null && r !== void 0 ? r : Ur(t, a, i), f = [s, o, u, c];
|
|
2153
|
+
gs(a) ? (B(t.eav, [s, o], /* @__PURE__ */ new Map([[u, f]])), B(t.aev, [o, s], /* @__PURE__ */ new Map([[u, f]]))) : (B(t.eav, [s, o, u], f), B(t.aev, [o, s, u], f)), on(a) && B(t.vae, [u, o, s], f);
|
|
2154
2154
|
}
|
|
2155
2155
|
function ms(t, e, n) {
|
|
2156
2156
|
var r;
|
|
2157
|
-
const i =
|
|
2157
|
+
const i = We(t, n);
|
|
2158
2158
|
if (!i)
|
|
2159
2159
|
return;
|
|
2160
2160
|
const [s, o, u] = i, a = e.getAttr(o);
|
|
@@ -2162,45 +2162,45 @@ function ms(t, e, n) {
|
|
|
2162
2162
|
return;
|
|
2163
2163
|
if (!un(a))
|
|
2164
2164
|
throw new Error("merge operation is not supported for links");
|
|
2165
|
-
const
|
|
2166
|
-
if (!c)
|
|
2167
|
-
return;
|
|
2168
|
-
const d = (r = c.values().next()) === null || r === void 0 ? void 0 : r.value;
|
|
2165
|
+
const d = Ce(t.eav, [s, o]);
|
|
2169
2166
|
if (!d)
|
|
2170
2167
|
return;
|
|
2171
|
-
const
|
|
2168
|
+
const c = (r = d.values().next()) === null || r === void 0 ? void 0 : r.value;
|
|
2169
|
+
if (!c)
|
|
2170
|
+
return;
|
|
2171
|
+
const f = c[2], l = Ir(f, u), p = [
|
|
2172
2172
|
s,
|
|
2173
2173
|
o,
|
|
2174
2174
|
l,
|
|
2175
|
-
Ur(t, a,
|
|
2175
|
+
Ur(t, a, c)
|
|
2176
2176
|
];
|
|
2177
|
-
|
|
2177
|
+
B(t.eav, [s, o], /* @__PURE__ */ new Map([[l, p]])), B(t.aev, [o, s], /* @__PURE__ */ new Map([[l, p]]));
|
|
2178
2178
|
}
|
|
2179
2179
|
function Nt(t, e, n) {
|
|
2180
2180
|
var r, i;
|
|
2181
|
-
const [s, o] = n, u =
|
|
2181
|
+
const [s, o] = n, u = We(t, [s]);
|
|
2182
2182
|
if (!u)
|
|
2183
2183
|
return;
|
|
2184
|
-
const [a] = u,
|
|
2185
|
-
if (
|
|
2186
|
-
for (const f of
|
|
2184
|
+
const [a] = u, d = t.eav.get(a);
|
|
2185
|
+
if (d) {
|
|
2186
|
+
for (const f of d.keys()) {
|
|
2187
2187
|
const l = e.getAttr(f);
|
|
2188
|
-
l && l["on-delete-reverse"] === "cascade" &&
|
|
2189
|
-
var
|
|
2190
|
-
return Nt(t, e, [b, (
|
|
2188
|
+
l && l["on-delete-reverse"] === "cascade" && G(d.get(f), 1).forEach(([p, y, b]) => {
|
|
2189
|
+
var _;
|
|
2190
|
+
return Nt(t, e, [b, (_ = l["reverse-identity"]) === null || _ === void 0 ? void 0 : _[1]]);
|
|
2191
2191
|
}), // Fall back to deleting everything if we've rehydrated tx-steps from
|
|
2192
2192
|
// the store that didn't set `etype` in deleteEntity
|
|
2193
2193
|
(!o || // If we don't know about the attr, let's just get rid of it
|
|
2194
2194
|
!l || // Make sure it matches the etype
|
|
2195
2195
|
((r = l["forward-identity"]) === null || r === void 0 ? void 0 : r[1]) === o) && (X(t.aev, [f, a]), X(t.eav, [a, f]));
|
|
2196
2196
|
}
|
|
2197
|
-
|
|
2197
|
+
d.size === 0 && X(t.eav, [a]);
|
|
2198
2198
|
}
|
|
2199
|
-
const
|
|
2200
|
-
|
|
2199
|
+
const c = t.vae.get(a) && G(t.vae.get(a), 2);
|
|
2200
|
+
c && c.forEach((f) => {
|
|
2201
2201
|
var l, p, y;
|
|
2202
|
-
const [b,
|
|
2203
|
-
(!o || !
|
|
2202
|
+
const [b, _, w] = f, g = e.getAttr(_);
|
|
2203
|
+
(!o || !g || ((l = g["reverse-identity"]) === null || l === void 0 ? void 0 : l[1]) === o) && (X(t.eav, [b, _, w]), X(t.aev, [_, b, w]), X(t.vae, [w, _, b])), g && g["on-delete"] === "cascade" && ((p = g["reverse-identity"]) === null || p === void 0 ? void 0 : p[1]) === o && Nt(t, e, [b, (y = g["forward-identity"]) === null || y === void 0 ? void 0 : y[1]]);
|
|
2204
2204
|
}), ((i = t.vae.get(a)) === null || i === void 0 ? void 0 : i.size) === 0 && X(t.vae, [a]);
|
|
2205
2205
|
}
|
|
2206
2206
|
function Fr(t, e, n) {
|
|
@@ -2213,7 +2213,7 @@ function vs(t, [e]) {
|
|
|
2213
2213
|
t.addAttr(e);
|
|
2214
2214
|
}
|
|
2215
2215
|
function Nr(t) {
|
|
2216
|
-
return
|
|
2216
|
+
return G(t.eav, 3);
|
|
2217
2217
|
}
|
|
2218
2218
|
function Ss(t, e, [n]) {
|
|
2219
2219
|
if (!e.getAttr(n))
|
|
@@ -2234,7 +2234,7 @@ function As(t, e, n) {
|
|
|
2234
2234
|
ms(t, e, i);
|
|
2235
2235
|
break;
|
|
2236
2236
|
case "retract-triple":
|
|
2237
|
-
|
|
2237
|
+
xr(t, e, i);
|
|
2238
2238
|
break;
|
|
2239
2239
|
case "delete-entity":
|
|
2240
2240
|
Nt(t, e, i);
|
|
@@ -2256,7 +2256,7 @@ function As(t, e, n) {
|
|
|
2256
2256
|
throw new Error(`unhandled transaction action: ${r}`);
|
|
2257
2257
|
}
|
|
2258
2258
|
}
|
|
2259
|
-
function
|
|
2259
|
+
function G(t, e, n = []) {
|
|
2260
2260
|
if (!t || e === 0)
|
|
2261
2261
|
return n;
|
|
2262
2262
|
if (e === 1) {
|
|
@@ -2265,10 +2265,10 @@ function B(t, e, n = []) {
|
|
|
2265
2265
|
return n;
|
|
2266
2266
|
}
|
|
2267
2267
|
for (const r of t.values())
|
|
2268
|
-
|
|
2268
|
+
G(r, e - 1, n);
|
|
2269
2269
|
return n;
|
|
2270
2270
|
}
|
|
2271
|
-
function
|
|
2271
|
+
function tt(t, e, n) {
|
|
2272
2272
|
var r;
|
|
2273
2273
|
const i = [];
|
|
2274
2274
|
if (n != null && n.hasOwnProperty("$not")) {
|
|
@@ -2279,21 +2279,21 @@ function nt(t, e, n) {
|
|
|
2279
2279
|
if (n != null && n.hasOwnProperty("$isNull")) {
|
|
2280
2280
|
const { attrId: o, isNull: u, reverse: a } = n.$isNull;
|
|
2281
2281
|
if (a)
|
|
2282
|
-
for (const c of e.keys()) {
|
|
2283
|
-
const d = t.vae.get(c), f = !d || !d.get(o);
|
|
2284
|
-
(u ? f : !f) && i.push(e.get(c));
|
|
2285
|
-
}
|
|
2286
|
-
else {
|
|
2287
|
-
const c = t.aev.get(o);
|
|
2288
2282
|
for (const d of e.keys()) {
|
|
2289
|
-
const
|
|
2283
|
+
const c = t.vae.get(d), f = !c || !c.get(o);
|
|
2290
2284
|
(u ? f : !f) && i.push(e.get(d));
|
|
2291
2285
|
}
|
|
2286
|
+
else {
|
|
2287
|
+
const d = t.aev.get(o);
|
|
2288
|
+
for (const c of e.keys()) {
|
|
2289
|
+
const f = !d || ((r = d.get(c)) === null || r === void 0 ? void 0 : r.get(null)) || !d.get(c);
|
|
2290
|
+
(u ? f : !f) && i.push(e.get(c));
|
|
2291
|
+
}
|
|
2292
2292
|
}
|
|
2293
2293
|
return i;
|
|
2294
2294
|
}
|
|
2295
2295
|
if (n != null && n.$comparator)
|
|
2296
|
-
return
|
|
2296
|
+
return G(e, 1).filter(n.$op);
|
|
2297
2297
|
const s = n.in || n.$in || [n];
|
|
2298
2298
|
for (const o of s) {
|
|
2299
2299
|
const u = e.get(o);
|
|
@@ -2310,47 +2310,47 @@ function ks(t, [e, n, r]) {
|
|
|
2310
2310
|
switch (Es(e, n, r)) {
|
|
2311
2311
|
case "e": {
|
|
2312
2312
|
const u = t.eav.get(e);
|
|
2313
|
-
return
|
|
2313
|
+
return G(u, 2);
|
|
2314
2314
|
}
|
|
2315
2315
|
case "ea": {
|
|
2316
2316
|
const u = (i = t.eav.get(e)) === null || i === void 0 ? void 0 : i.get(n);
|
|
2317
|
-
return
|
|
2317
|
+
return G(u, 1);
|
|
2318
2318
|
}
|
|
2319
2319
|
case "eav": {
|
|
2320
2320
|
const u = (s = t.eav.get(e)) === null || s === void 0 ? void 0 : s.get(n);
|
|
2321
|
-
return u ?
|
|
2321
|
+
return u ? tt(t, u, r) : [];
|
|
2322
2322
|
}
|
|
2323
2323
|
case "ev": {
|
|
2324
2324
|
const u = t.eav.get(e);
|
|
2325
2325
|
if (!u)
|
|
2326
2326
|
return [];
|
|
2327
2327
|
const a = [];
|
|
2328
|
-
for (const
|
|
2329
|
-
a.push(...
|
|
2328
|
+
for (const d of u.values())
|
|
2329
|
+
a.push(...tt(t, d, r));
|
|
2330
2330
|
return a;
|
|
2331
2331
|
}
|
|
2332
2332
|
case "a": {
|
|
2333
2333
|
const u = t.aev.get(n);
|
|
2334
|
-
return
|
|
2334
|
+
return G(u, 2);
|
|
2335
2335
|
}
|
|
2336
2336
|
case "av": {
|
|
2337
2337
|
const u = t.aev.get(n);
|
|
2338
2338
|
if (!u)
|
|
2339
2339
|
return [];
|
|
2340
2340
|
const a = [];
|
|
2341
|
-
for (const
|
|
2342
|
-
a.push(...
|
|
2341
|
+
for (const d of u.values())
|
|
2342
|
+
a.push(...tt(t, d, r));
|
|
2343
2343
|
return a;
|
|
2344
2344
|
}
|
|
2345
2345
|
case "v": {
|
|
2346
2346
|
const u = [];
|
|
2347
2347
|
for (const a of t.eav.values())
|
|
2348
|
-
for (const
|
|
2349
|
-
u.push(...
|
|
2348
|
+
for (const d of a.values())
|
|
2349
|
+
u.push(...tt(t, d, r));
|
|
2350
2350
|
return u;
|
|
2351
2351
|
}
|
|
2352
2352
|
default:
|
|
2353
|
-
return
|
|
2353
|
+
return G(t.eav, 3);
|
|
2354
2354
|
}
|
|
2355
2355
|
}
|
|
2356
2356
|
function js(t, e, n) {
|
|
@@ -2359,9 +2359,9 @@ function js(t, e, n) {
|
|
|
2359
2359
|
if (!e)
|
|
2360
2360
|
return i;
|
|
2361
2361
|
for (const [s, o] of e.entries()) {
|
|
2362
|
-
const u = (r = t.eav.get(n)) === null || r === void 0 ? void 0 : r.get(o.id), a =
|
|
2363
|
-
for (const
|
|
2364
|
-
i[s] =
|
|
2362
|
+
const u = (r = t.eav.get(n)) === null || r === void 0 ? void 0 : r.get(o.id), a = G(u, 1);
|
|
2363
|
+
for (const d of a)
|
|
2364
|
+
i[s] = d[2];
|
|
2365
2365
|
}
|
|
2366
2366
|
return i;
|
|
2367
2367
|
}
|
|
@@ -2373,7 +2373,7 @@ function me(t, e, n) {
|
|
|
2373
2373
|
var r;
|
|
2374
2374
|
return (r = t.revIdents.get(e)) === null || r === void 0 ? void 0 : r.get(n);
|
|
2375
2375
|
}
|
|
2376
|
-
function
|
|
2376
|
+
function Cs(t, e) {
|
|
2377
2377
|
return t.blobAttrs.get(e);
|
|
2378
2378
|
}
|
|
2379
2379
|
function Kr(t, e) {
|
|
@@ -2381,32 +2381,32 @@ function Kr(t, e) {
|
|
|
2381
2381
|
const r = t.primaryKeys.get(e);
|
|
2382
2382
|
return r || ((n = t.forwardIdents.get(e)) === null || n === void 0 ? void 0 : n.get("id"));
|
|
2383
2383
|
}
|
|
2384
|
-
function
|
|
2385
|
-
const r =
|
|
2384
|
+
function Is(t, e, n) {
|
|
2385
|
+
const r = We(t, n);
|
|
2386
2386
|
if (!r)
|
|
2387
2387
|
return;
|
|
2388
2388
|
const [i, s, o] = r;
|
|
2389
2389
|
if (e.getAttr(s))
|
|
2390
|
-
return
|
|
2390
|
+
return Ce(t.eav, [i, s]);
|
|
2391
2391
|
}
|
|
2392
2392
|
function Ps(t, e, n) {
|
|
2393
2393
|
const r = n.filter(([i, s, o, u, a]) => {
|
|
2394
2394
|
if (i !== "add-triple" && i !== "deep-merge-triple")
|
|
2395
2395
|
return !0;
|
|
2396
|
-
const
|
|
2397
|
-
if (
|
|
2396
|
+
const d = a == null ? void 0 : a.mode;
|
|
2397
|
+
if (d !== "create" && d !== "update")
|
|
2398
2398
|
return !0;
|
|
2399
|
-
let
|
|
2399
|
+
let c = !1;
|
|
2400
2400
|
const f = e.getAttr(o);
|
|
2401
2401
|
if (f) {
|
|
2402
2402
|
const l = Kr(e, f["forward-identity"][1]);
|
|
2403
|
-
|
|
2403
|
+
c = !!Is(t, e, [
|
|
2404
2404
|
s,
|
|
2405
2405
|
l == null ? void 0 : l.id,
|
|
2406
2406
|
s
|
|
2407
2407
|
]);
|
|
2408
2408
|
}
|
|
2409
|
-
return !(
|
|
2409
|
+
return !(d === "create" && c || d === "update" && !c);
|
|
2410
2410
|
});
|
|
2411
2411
|
return ft({ store: t, attrsStore: e }, (i) => {
|
|
2412
2412
|
r.forEach((s) => {
|
|
@@ -2440,7 +2440,7 @@ function $s(t) {
|
|
|
2440
2440
|
return zn;
|
|
2441
2441
|
}
|
|
2442
2442
|
}
|
|
2443
|
-
const
|
|
2443
|
+
const Ds = [
|
|
2444
2444
|
"in",
|
|
2445
2445
|
"$in",
|
|
2446
2446
|
"$not",
|
|
@@ -2448,14 +2448,14 @@ const xs = [
|
|
|
2448
2448
|
"$comparator"
|
|
2449
2449
|
// covers all of $gt, $lt, etc.
|
|
2450
2450
|
];
|
|
2451
|
-
function
|
|
2452
|
-
for (const e of
|
|
2451
|
+
function xs(t) {
|
|
2452
|
+
for (const e of Ds)
|
|
2453
2453
|
if (t.hasOwnProperty(e))
|
|
2454
2454
|
return !0;
|
|
2455
2455
|
return !1;
|
|
2456
2456
|
}
|
|
2457
2457
|
function qr(t, e, n) {
|
|
2458
|
-
return n ? typeof t == "object" ?
|
|
2458
|
+
return n ? typeof t == "object" ? xs(t) ? n : null : $s(t)(t, e, n) : null;
|
|
2459
2459
|
}
|
|
2460
2460
|
function Us(t, e, n) {
|
|
2461
2461
|
return t.reduce((r, i, s) => {
|
|
@@ -2485,11 +2485,11 @@ const qs = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a
|
|
|
2485
2485
|
function Ee(t) {
|
|
2486
2486
|
return typeof t == "string" && qs.test(t);
|
|
2487
2487
|
}
|
|
2488
|
-
const
|
|
2488
|
+
const K = [];
|
|
2489
2489
|
for (let t = 0; t < 256; ++t)
|
|
2490
|
-
|
|
2490
|
+
K.push((t + 256).toString(16).slice(1));
|
|
2491
2491
|
function zs(t, e = 0) {
|
|
2492
|
-
return (
|
|
2492
|
+
return (K[t[e + 0]] + K[t[e + 1]] + K[t[e + 2]] + K[t[e + 3]] + "-" + K[t[e + 4]] + K[t[e + 5]] + "-" + K[t[e + 6]] + K[t[e + 7]] + "-" + K[t[e + 8]] + K[t[e + 9]] + "-" + K[t[e + 10]] + K[t[e + 11]] + K[t[e + 12]] + K[t[e + 13]] + K[t[e + 14]] + K[t[e + 15]]).toLowerCase();
|
|
2493
2493
|
}
|
|
2494
2494
|
let kt;
|
|
2495
2495
|
const Vs = new Uint8Array(16);
|
|
@@ -2501,8 +2501,8 @@ function Ws() {
|
|
|
2501
2501
|
}
|
|
2502
2502
|
return kt(Vs);
|
|
2503
2503
|
}
|
|
2504
|
-
const
|
|
2505
|
-
function
|
|
2504
|
+
const Bs = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Vn = { randomUUID: Bs };
|
|
2505
|
+
function Gs(t, e, n) {
|
|
2506
2506
|
var i;
|
|
2507
2507
|
if (Vn.randomUUID && !t)
|
|
2508
2508
|
return Vn.randomUUID();
|
|
@@ -2518,7 +2518,7 @@ function Wn(t) {
|
|
|
2518
2518
|
n.push(parseInt(e.substring(r, r + 2), 16));
|
|
2519
2519
|
return n;
|
|
2520
2520
|
}
|
|
2521
|
-
function
|
|
2521
|
+
function Qs(t, e) {
|
|
2522
2522
|
for (let n = 0; n < t.length; n++) {
|
|
2523
2523
|
if (t[n] < e[n])
|
|
2524
2524
|
return -1;
|
|
@@ -2528,10 +2528,10 @@ function Gs(t, e) {
|
|
|
2528
2528
|
return 0;
|
|
2529
2529
|
}
|
|
2530
2530
|
function Hs(t, e) {
|
|
2531
|
-
return
|
|
2531
|
+
return Qs(Wn(t), Wn(e));
|
|
2532
2532
|
}
|
|
2533
|
-
function
|
|
2534
|
-
return
|
|
2533
|
+
function N() {
|
|
2534
|
+
return Gs();
|
|
2535
2535
|
}
|
|
2536
2536
|
function Ys(t, e) {
|
|
2537
2537
|
return t.localeCompare(e);
|
|
@@ -2547,7 +2547,7 @@ function Js() {
|
|
|
2547
2547
|
}
|
|
2548
2548
|
const Zs = Js();
|
|
2549
2549
|
let Xs = 0;
|
|
2550
|
-
function
|
|
2550
|
+
function Ne(t) {
|
|
2551
2551
|
return yt(`_${t}`, Xs++);
|
|
2552
2552
|
}
|
|
2553
2553
|
function yt(t, e) {
|
|
@@ -2564,7 +2564,7 @@ function eo(t, e) {
|
|
|
2564
2564
|
throw new ke(`Could not find id attr for ${e}`);
|
|
2565
2565
|
return n;
|
|
2566
2566
|
}
|
|
2567
|
-
function
|
|
2567
|
+
function Bn(t, e, n, r) {
|
|
2568
2568
|
return [to(t, e, n, r)];
|
|
2569
2569
|
}
|
|
2570
2570
|
function to(t, e, n, r) {
|
|
@@ -2584,20 +2584,20 @@ function zr(t, e, n, r, i) {
|
|
|
2584
2584
|
throw new ke(`Could not find attr for ${[n, i]}`);
|
|
2585
2585
|
if (u["value-type"] !== "ref")
|
|
2586
2586
|
throw new Error(`Attr ${u.id} is not a ref`);
|
|
2587
|
-
const [a,
|
|
2588
|
-
t(
|
|
2587
|
+
const [a, d] = u["forward-identity"], [c, f] = u["reverse-identity"], l = r + 1, p = s ? [
|
|
2588
|
+
t(d, r),
|
|
2589
2589
|
u.id,
|
|
2590
2590
|
t(f, l),
|
|
2591
|
-
|
|
2591
|
+
Ne("time")
|
|
2592
2592
|
] : [
|
|
2593
|
-
t(
|
|
2593
|
+
t(d, l),
|
|
2594
2594
|
u.id,
|
|
2595
2595
|
t(f, r),
|
|
2596
|
-
|
|
2596
|
+
Ne("time")
|
|
2597
2597
|
];
|
|
2598
|
-
return [s ? f :
|
|
2598
|
+
return [s ? f : d, l, p, u, !!s];
|
|
2599
2599
|
}
|
|
2600
|
-
function
|
|
2600
|
+
function Gn(t, e) {
|
|
2601
2601
|
if (typeof e != "string")
|
|
2602
2602
|
return function(o) {
|
|
2603
2603
|
return !1;
|
|
@@ -2648,7 +2648,7 @@ function ro(t, e) {
|
|
|
2648
2648
|
}
|
|
2649
2649
|
};
|
|
2650
2650
|
if (e.hasOwnProperty("$like")) {
|
|
2651
|
-
const r =
|
|
2651
|
+
const r = Gn(!0, e.$like);
|
|
2652
2652
|
return {
|
|
2653
2653
|
$comparator: !0,
|
|
2654
2654
|
$op: function(s) {
|
|
@@ -2657,7 +2657,7 @@ function ro(t, e) {
|
|
|
2657
2657
|
};
|
|
2658
2658
|
}
|
|
2659
2659
|
if (e.hasOwnProperty("$ilike")) {
|
|
2660
|
-
const r =
|
|
2660
|
+
const r = Gn(!1, e.$ilike);
|
|
2661
2661
|
return {
|
|
2662
2662
|
$comparator: !0,
|
|
2663
2663
|
$op: function(s) {
|
|
@@ -2672,33 +2672,33 @@ function io(t, e, n, r, i, s) {
|
|
|
2672
2672
|
if (!a)
|
|
2673
2673
|
throw new ke(`No attr for etype = ${n} label = ${i}`);
|
|
2674
2674
|
if (s != null && s.hasOwnProperty("$isNull")) {
|
|
2675
|
-
const
|
|
2676
|
-
if (!
|
|
2675
|
+
const d = F(e, n, "id");
|
|
2676
|
+
if (!d)
|
|
2677
2677
|
throw new ke(`No attr for etype = ${n} label = id`);
|
|
2678
2678
|
return [
|
|
2679
2679
|
t(n, r),
|
|
2680
|
-
|
|
2680
|
+
d.id,
|
|
2681
2681
|
{ $isNull: { attrId: a.id, isNull: s.$isNull, reverse: !o } },
|
|
2682
|
-
|
|
2682
|
+
Ne("time")
|
|
2683
2683
|
];
|
|
2684
2684
|
}
|
|
2685
2685
|
return o ? [
|
|
2686
2686
|
t(n, r),
|
|
2687
2687
|
a.id,
|
|
2688
2688
|
ro(a, s),
|
|
2689
|
-
|
|
2690
|
-
] : [s, a.id, t(n, r),
|
|
2689
|
+
Ne("time")
|
|
2690
|
+
] : [s, a.id, t(n, r), Ne("time")];
|
|
2691
2691
|
}
|
|
2692
2692
|
function so(t, e, n, r, i) {
|
|
2693
|
-
const [s, o, u] = i.reduce((a,
|
|
2694
|
-
const [
|
|
2693
|
+
const [s, o, u] = i.reduce((a, d) => {
|
|
2694
|
+
const [c, f, l] = a, [p, y, b] = zr(t, e, c, f, d);
|
|
2695
2695
|
return [p, y, [...l, b]];
|
|
2696
2696
|
}, [n, r, []]);
|
|
2697
2697
|
return [s, o, u];
|
|
2698
2698
|
}
|
|
2699
2699
|
function qt(t, e, n, r, i, s) {
|
|
2700
|
-
const o = i.slice(0, i.length - 1), u = i[i.length - 1], [a,
|
|
2701
|
-
return
|
|
2700
|
+
const o = i.slice(0, i.length - 1), u = i[i.length - 1], [a, d, c] = so(t, e, n, r, o), f = io(t, e, a, d, u, s);
|
|
2701
|
+
return c.concat([f]);
|
|
2702
2702
|
}
|
|
2703
2703
|
function oo(t, e) {
|
|
2704
2704
|
return e ? [e].concat(t) : t;
|
|
@@ -2715,10 +2715,10 @@ function co(t, e, n) {
|
|
|
2715
2715
|
return e == s ? s : `${s}-${n}`;
|
|
2716
2716
|
};
|
|
2717
2717
|
}
|
|
2718
|
-
function
|
|
2719
|
-
const o = t(r, i), u = s.map((a,
|
|
2720
|
-
const
|
|
2721
|
-
return Vr(
|
|
2718
|
+
function Qn(t, e, n, r, i, s) {
|
|
2719
|
+
const o = t(r, i), u = s.map((a, d) => {
|
|
2720
|
+
const c = co(t, o, d);
|
|
2721
|
+
return Vr(c, n, r, i, a);
|
|
2722
2722
|
});
|
|
2723
2723
|
return { [e]: { patterns: u, joinSym: o } };
|
|
2724
2724
|
}
|
|
@@ -2736,18 +2736,18 @@ function Hn(t, e, n, r, i) {
|
|
|
2736
2736
|
function Vr(t, e, n, r, i) {
|
|
2737
2737
|
return Object.entries(i).flatMap(([s, o]) => {
|
|
2738
2738
|
if (uo([s, o]))
|
|
2739
|
-
return
|
|
2739
|
+
return Qn(t, "or", e, n, r, o);
|
|
2740
2740
|
if (ao([s, o]))
|
|
2741
|
-
return
|
|
2741
|
+
return Qn(t, "and", e, n, r, o);
|
|
2742
2742
|
if (s === "$entityIdStartsWith")
|
|
2743
2743
|
return [];
|
|
2744
2744
|
const u = s.split(".");
|
|
2745
2745
|
if (o != null && o.hasOwnProperty("$ne") && (o = Object.assign(Object.assign({}, o), { $not: o.$ne }), delete o.$ne), o != null && o.hasOwnProperty("$not")) {
|
|
2746
|
-
const a = qt(t, e, n, r, u, o),
|
|
2746
|
+
const a = qt(t, e, n, r, u, o), d = Hn(t, e, n, r, u);
|
|
2747
2747
|
return [
|
|
2748
2748
|
{
|
|
2749
2749
|
or: {
|
|
2750
|
-
patterns: [a, ...
|
|
2750
|
+
patterns: [a, ...d],
|
|
2751
2751
|
joinSym: t(n, r)
|
|
2752
2752
|
}
|
|
2753
2753
|
}
|
|
@@ -2765,58 +2765,58 @@ function Vr(t, e, n, r, i) {
|
|
|
2765
2765
|
}
|
|
2766
2766
|
function lo(t, e, n, r) {
|
|
2767
2767
|
const i = yt;
|
|
2768
|
-
return r ? Vr(i, t, e, n, r).concat(
|
|
2768
|
+
return r ? Vr(i, t, e, n, r).concat(Bn(i, t, e, n)) : Bn(i, t, e, n);
|
|
2769
2769
|
}
|
|
2770
2770
|
function ho(t, e, n) {
|
|
2771
2771
|
return [t(e, n), t("time", n)];
|
|
2772
2772
|
}
|
|
2773
2773
|
function po(t, e, n, r, i, s) {
|
|
2774
|
-
const [o, u, a,
|
|
2775
|
-
return [o, u, f,
|
|
2774
|
+
const [o, u, a, d, c] = zr(t, e, n, r, i), f = no(a, t(n, r), s);
|
|
2775
|
+
return [o, u, f, d, c];
|
|
2776
2776
|
}
|
|
2777
2777
|
function yo(t, e, n, { etype: r, level: i, form: s }, o) {
|
|
2778
2778
|
const u = Object.keys(s).filter((a) => a !== "$");
|
|
2779
|
-
return u.length ? Object.entries(o).map(function([
|
|
2779
|
+
return u.length ? Object.entries(o).map(function([d, c]) {
|
|
2780
2780
|
return u.map(function(p) {
|
|
2781
|
-
var y, b,
|
|
2782
|
-
const w = !!(e.cardinalityInference && (!((
|
|
2781
|
+
var y, b, _;
|
|
2782
|
+
const w = !!(e.cardinalityInference && (!((_ = (b = (y = n.linkIndex) === null || y === void 0 ? void 0 : y[r]) === null || b === void 0 ? void 0 : b[p]) === null || _ === void 0) && _.isSingular));
|
|
2783
2783
|
try {
|
|
2784
|
-
const [
|
|
2785
|
-
etype:
|
|
2784
|
+
const [g, v, A] = po(t, n, r, i, p, d), S = Br(e, n, {
|
|
2785
|
+
etype: g,
|
|
2786
2786
|
level: v,
|
|
2787
2787
|
form: s[p],
|
|
2788
2788
|
join: A
|
|
2789
|
-
}),
|
|
2790
|
-
return { [p]:
|
|
2791
|
-
} catch (
|
|
2792
|
-
if (
|
|
2789
|
+
}), C = w ? S[0] : S;
|
|
2790
|
+
return { [p]: C };
|
|
2791
|
+
} catch (g) {
|
|
2792
|
+
if (g instanceof ke)
|
|
2793
2793
|
return { [p]: w ? void 0 : [] };
|
|
2794
|
-
throw
|
|
2794
|
+
throw g;
|
|
2795
2795
|
}
|
|
2796
2796
|
}).reduce(function(p, y) {
|
|
2797
2797
|
return Object.assign(Object.assign({}, p), y);
|
|
2798
|
-
},
|
|
2798
|
+
}, c);
|
|
2799
2799
|
}) : Object.values(o);
|
|
2800
2800
|
}
|
|
2801
2801
|
function bo(t, e, n) {
|
|
2802
2802
|
return n === "string" ? Zs(t, e) : t > e ? 1 : -1;
|
|
2803
2803
|
}
|
|
2804
|
-
function
|
|
2804
|
+
function Le(t, e, n, r, i) {
|
|
2805
2805
|
return e === r || e == null && r == null ? Hs(t, n) : r == null ? 1 : e == null ? -1 : bo(e, r, i);
|
|
2806
2806
|
}
|
|
2807
2807
|
function lt([t, e], [n, r], i) {
|
|
2808
|
-
return
|
|
2808
|
+
return Le(t, e, n, r, i);
|
|
2809
2809
|
}
|
|
2810
2810
|
function zt(t) {
|
|
2811
2811
|
return t == null ? t : new Date(t).getTime();
|
|
2812
2812
|
}
|
|
2813
2813
|
function _o(t, e, n, r) {
|
|
2814
2814
|
var i;
|
|
2815
|
-
const [s, o, u, a] = t,
|
|
2815
|
+
const [s, o, u, a] = t, d = n === "desc" ? 1 : -1;
|
|
2816
2816
|
if (((i = e["forward-identity"]) === null || i === void 0 ? void 0 : i[2]) === "id")
|
|
2817
|
-
return lt(r, [s, a], null) ===
|
|
2818
|
-
const [
|
|
2819
|
-
return lt([
|
|
2817
|
+
return lt(r, [s, a], null) === d;
|
|
2818
|
+
const [c, f] = r, l = e["checked-data-type"], p = l === "date" ? zt(f) : f, y = l === "date" ? zt(u) : u;
|
|
2819
|
+
return lt([c, p], [s, y], l) === d;
|
|
2820
2820
|
}
|
|
2821
2821
|
function go(t, e) {
|
|
2822
2822
|
const n = e[1];
|
|
@@ -2835,7 +2835,7 @@ function wo(t, e, n, r) {
|
|
|
2835
2835
|
function mo(t, e, n) {
|
|
2836
2836
|
var r, i;
|
|
2837
2837
|
if (!Array.isArray(n.fields))
|
|
2838
|
-
return
|
|
2838
|
+
return Cs(t, e);
|
|
2839
2839
|
const s = /* @__PURE__ */ new Map();
|
|
2840
2840
|
for (const o of n.fields) {
|
|
2841
2841
|
const u = F(t, e, o), a = (r = u == null ? void 0 : u["forward-identity"]) === null || r === void 0 ? void 0 : r[2];
|
|
@@ -2849,30 +2849,30 @@ function mo(t, e, n) {
|
|
|
2849
2849
|
}
|
|
2850
2850
|
function vo(t, e, { etype: n, pageInfo: r, dq: i, form: s }) {
|
|
2851
2851
|
var o, u;
|
|
2852
|
-
const a = (o = s == null ? void 0 : s.$) === null || o === void 0 ? void 0 : o.order,
|
|
2852
|
+
const a = (o = s == null ? void 0 : s.$) === null || o === void 0 ? void 0 : o.order, d = Wr(s), c = So(s);
|
|
2853
2853
|
let f = Ns(t, i);
|
|
2854
2854
|
const l = r == null ? void 0 : r["start-cursor"], p = wo(e, n, l, a);
|
|
2855
2855
|
if (p && ((u = p == null ? void 0 : p["forward-identity"]) === null || u === void 0 ? void 0 : u[2]) !== "id") {
|
|
2856
|
-
const
|
|
2857
|
-
f = f.map(([
|
|
2858
|
-
var v, A, S,
|
|
2859
|
-
let R = (
|
|
2860
|
-
return
|
|
2856
|
+
const _ = p["checked-data-type"] === "date", w = p.id;
|
|
2857
|
+
f = f.map(([g]) => {
|
|
2858
|
+
var v, A, S, C, $;
|
|
2859
|
+
let R = ($ = (C = (S = (A = (v = t.eav.get(g)) === null || v === void 0 ? void 0 : v.get(w)) === null || A === void 0 ? void 0 : A.values()) === null || S === void 0 ? void 0 : S.next()) === null || C === void 0 ? void 0 : C.value) === null || $ === void 0 ? void 0 : $[2];
|
|
2860
|
+
return _ && (R = zt(R)), [g, R];
|
|
2861
2861
|
});
|
|
2862
2862
|
}
|
|
2863
|
-
f.sort(
|
|
2864
|
-
return lt(w,
|
|
2865
|
-
} : function(w,
|
|
2866
|
-
return lt(
|
|
2863
|
+
f.sort(c === "asc" ? function(w, g) {
|
|
2864
|
+
return lt(w, g, p == null ? void 0 : p["checked-data-type"]);
|
|
2865
|
+
} : function(w, g) {
|
|
2866
|
+
return lt(g, w, p == null ? void 0 : p["checked-data-type"]);
|
|
2867
2867
|
});
|
|
2868
2868
|
let y = {};
|
|
2869
2869
|
const b = mo(e, n, i);
|
|
2870
|
-
for (const
|
|
2871
|
-
const [w] =
|
|
2872
|
-
if (y[w] || !
|
|
2870
|
+
for (const _ of f) {
|
|
2871
|
+
const [w] = _;
|
|
2872
|
+
if (y[w] || !d && l && p && _o(l, p, c, _))
|
|
2873
2873
|
continue;
|
|
2874
|
-
const
|
|
2875
|
-
|
|
2874
|
+
const g = js(t, b, w);
|
|
2875
|
+
g && (y[w] = g);
|
|
2876
2876
|
}
|
|
2877
2877
|
return y;
|
|
2878
2878
|
}
|
|
@@ -2887,7 +2887,7 @@ function Wr(t) {
|
|
|
2887
2887
|
return !i && !s && !o;
|
|
2888
2888
|
}
|
|
2889
2889
|
function Oo(t, e, { etype: n, level: r, form: i, join: s, pageInfo: o }) {
|
|
2890
|
-
var u, a,
|
|
2890
|
+
var u, a, d, c, f;
|
|
2891
2891
|
if (!Wr(i) && (!o || !o["start-cursor"]))
|
|
2892
2892
|
return [];
|
|
2893
2893
|
const l = oo(lo(e, n, r, (u = i.$) === null || u === void 0 ? void 0 : u.where), s), p = ho(yt, n, r), y = (a = i.$) === null || a === void 0 ? void 0 : a.fields, b = vo(t, e, {
|
|
@@ -2895,11 +2895,11 @@ function Oo(t, e, { etype: n, level: r, form: i, join: s, pageInfo: o }) {
|
|
|
2895
2895
|
pageInfo: o,
|
|
2896
2896
|
form: i,
|
|
2897
2897
|
dq: { where: l, find: p, fields: y }
|
|
2898
|
-
}),
|
|
2899
|
-
if (
|
|
2898
|
+
}), _ = ((d = i.$) === null || d === void 0 ? void 0 : d.limit) || ((c = i.$) === null || c === void 0 ? void 0 : c.first) || ((f = i.$) === null || f === void 0 ? void 0 : f.last);
|
|
2899
|
+
if (_ != null) {
|
|
2900
2900
|
r > 0 && console.warn("WARNING: Limits in child queries are only run client-side. Data returned from the server will not have a limit.");
|
|
2901
2901
|
const w = Object.entries(b);
|
|
2902
|
-
return w.length <=
|
|
2902
|
+
return w.length <= _ ? b : Object.fromEntries(w.slice(0, _));
|
|
2903
2903
|
}
|
|
2904
2904
|
return b;
|
|
2905
2905
|
}
|
|
@@ -2912,7 +2912,7 @@ function Ao(t, e, n) {
|
|
|
2912
2912
|
throw r;
|
|
2913
2913
|
}
|
|
2914
2914
|
}
|
|
2915
|
-
function
|
|
2915
|
+
function Br(t, e, n) {
|
|
2916
2916
|
const r = Ao(t, e, n);
|
|
2917
2917
|
return yo(yt, t, e, n, r);
|
|
2918
2918
|
}
|
|
@@ -2927,13 +2927,13 @@ function Eo(t) {
|
|
|
2927
2927
|
};
|
|
2928
2928
|
return e;
|
|
2929
2929
|
}
|
|
2930
|
-
function
|
|
2931
|
-
const o = { data: Object.keys(i).reduce(function(a,
|
|
2932
|
-
return r != null && r[
|
|
2933
|
-
etype:
|
|
2934
|
-
form: i[
|
|
2930
|
+
function Gr({ store: t, attrsStore: e, pageInfo: n, aggregate: r }, i) {
|
|
2931
|
+
const o = { data: Object.keys(i).reduce(function(a, d) {
|
|
2932
|
+
return r != null && r[d] || d === "$$ruleParams" || (a[d] = Br(t, e, {
|
|
2933
|
+
etype: d,
|
|
2934
|
+
form: i[d],
|
|
2935
2935
|
level: 0,
|
|
2936
|
-
pageInfo: n == null ? void 0 : n[
|
|
2936
|
+
pageInfo: n == null ? void 0 : n[d]
|
|
2937
2937
|
})), a;
|
|
2938
2938
|
}, {}) };
|
|
2939
2939
|
return n && (o.pageInfo = Eo(n)), r && (o.aggregate = r), o;
|
|
@@ -2975,11 +2975,11 @@ function Vt(t, e, n) {
|
|
|
2975
2975
|
function ht(t) {
|
|
2976
2976
|
return t.startsWith("lookup__");
|
|
2977
2977
|
}
|
|
2978
|
-
function
|
|
2978
|
+
function Qr(t) {
|
|
2979
2979
|
const [e, n, ...r] = t.split("__");
|
|
2980
2980
|
return [n, JSON.parse(r.join("__"))];
|
|
2981
2981
|
}
|
|
2982
|
-
function
|
|
2982
|
+
function Co(t) {
|
|
2983
2983
|
return new Proxy({
|
|
2984
2984
|
__etype: t
|
|
2985
2985
|
}, {
|
|
@@ -2987,19 +2987,19 @@ function Io(t) {
|
|
|
2987
2987
|
if (n === "__etype")
|
|
2988
2988
|
return t;
|
|
2989
2989
|
const r = n;
|
|
2990
|
-
return ht(r) ? Vt(t,
|
|
2990
|
+
return ht(r) ? Vt(t, Qr(r), []) : Vt(t, r, []);
|
|
2991
2991
|
}
|
|
2992
2992
|
});
|
|
2993
2993
|
}
|
|
2994
2994
|
function cn() {
|
|
2995
2995
|
return new Proxy({}, {
|
|
2996
2996
|
get(t, e) {
|
|
2997
|
-
return
|
|
2997
|
+
return Co(e);
|
|
2998
2998
|
}
|
|
2999
2999
|
});
|
|
3000
3000
|
}
|
|
3001
3001
|
cn();
|
|
3002
|
-
function
|
|
3002
|
+
function Io(t) {
|
|
3003
3003
|
return t.__ops;
|
|
3004
3004
|
}
|
|
3005
3005
|
function Po(t, e) {
|
|
@@ -3009,8 +3009,8 @@ function Po(t, e) {
|
|
|
3009
3009
|
if (u)
|
|
3010
3010
|
i.push(u);
|
|
3011
3011
|
else if (Array.isArray(o) && o.length == 2 && n[o[0]]) {
|
|
3012
|
-
const [a,
|
|
3013
|
-
i.push([n[a],
|
|
3012
|
+
const [a, d] = o;
|
|
3013
|
+
i.push([n[a], d]);
|
|
3014
3014
|
} else
|
|
3015
3015
|
i.push(o);
|
|
3016
3016
|
}
|
|
@@ -3048,11 +3048,11 @@ function $o(t, e, n) {
|
|
|
3048
3048
|
throw new Error(`${n} does not reference a valid link attribute.`);
|
|
3049
3049
|
return i;
|
|
3050
3050
|
}
|
|
3051
|
-
function
|
|
3052
|
-
return typeof t == "string" && !ht(t) ? null : typeof t == "string" && ht(t) ?
|
|
3051
|
+
function Bt(t) {
|
|
3052
|
+
return typeof t == "string" && !ht(t) ? null : typeof t == "string" && ht(t) ? Qr(t) : Mo(t);
|
|
3053
3053
|
}
|
|
3054
|
-
function
|
|
3055
|
-
const r =
|
|
3054
|
+
function Q(t, e, n) {
|
|
3055
|
+
const r = Bt(n);
|
|
3056
3056
|
if (r === null)
|
|
3057
3057
|
return n;
|
|
3058
3058
|
const [i, s] = r, o = $o(t, e, i);
|
|
@@ -3062,7 +3062,7 @@ function G(t, e, n) {
|
|
|
3062
3062
|
}
|
|
3063
3063
|
function Hr(t, e, n, r) {
|
|
3064
3064
|
var i;
|
|
3065
|
-
const s =
|
|
3065
|
+
const s = Q(t, e, n);
|
|
3066
3066
|
return Array.isArray(s) ? [[
|
|
3067
3067
|
"add-triple",
|
|
3068
3068
|
s,
|
|
@@ -3070,44 +3070,44 @@ function Hr(t, e, n, r) {
|
|
|
3070
3070
|
s
|
|
3071
3071
|
]].concat(r) : r;
|
|
3072
3072
|
}
|
|
3073
|
-
function
|
|
3073
|
+
function Do({ attrsStore: t }, [e, n, r]) {
|
|
3074
3074
|
const i = Object.entries(r).flatMap(([s, o]) => {
|
|
3075
|
-
const u = Array.isArray(o) ? o : [o], a = F(t, e, s),
|
|
3076
|
-
return u.map((
|
|
3075
|
+
const u = Array.isArray(o) ? o : [o], a = F(t, e, s), d = me(t, e, s);
|
|
3076
|
+
return u.map((c) => a ? [
|
|
3077
3077
|
"add-triple",
|
|
3078
|
-
|
|
3078
|
+
Q(t, e, n),
|
|
3079
3079
|
a.id,
|
|
3080
3080
|
// Uses `!` because if we get here, we should have created the attr if it doesn't
|
|
3081
3081
|
// already exist
|
|
3082
|
-
|
|
3082
|
+
Q(t, a["reverse-identity"][1], c)
|
|
3083
3083
|
] : [
|
|
3084
3084
|
"add-triple",
|
|
3085
3085
|
// Uses `!` because if we get here, we should have created the attr if it doesn't
|
|
3086
3086
|
// already exist
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3087
|
+
Q(t, d["forward-identity"][1], c),
|
|
3088
|
+
d == null ? void 0 : d.id,
|
|
3089
|
+
Q(t, e, n)
|
|
3090
3090
|
]);
|
|
3091
3091
|
});
|
|
3092
3092
|
return Hr(t, e, n, i);
|
|
3093
3093
|
}
|
|
3094
|
-
function
|
|
3094
|
+
function xo({ attrsStore: t }, [e, n, r]) {
|
|
3095
3095
|
const i = Object.entries(r).flatMap(([s, o]) => {
|
|
3096
|
-
const u = Array.isArray(o) ? o : [o], a = F(t, e, s),
|
|
3097
|
-
return u.map((
|
|
3096
|
+
const u = Array.isArray(o) ? o : [o], a = F(t, e, s), d = me(t, e, s);
|
|
3097
|
+
return u.map((c) => a ? [
|
|
3098
3098
|
"retract-triple",
|
|
3099
|
-
|
|
3099
|
+
Q(t, e, n),
|
|
3100
3100
|
a.id,
|
|
3101
3101
|
// Uses `!` because if we get here, we should have created the attr if it doesn't
|
|
3102
3102
|
// already exist
|
|
3103
|
-
|
|
3103
|
+
Q(t, a["reverse-identity"][1], c)
|
|
3104
3104
|
] : [
|
|
3105
3105
|
"retract-triple",
|
|
3106
3106
|
// Uses `!` because if we get here, we should have created the attr if it doesn't
|
|
3107
3107
|
// already exist
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3108
|
+
Q(t, d["forward-identity"][1], c),
|
|
3109
|
+
d.id,
|
|
3110
|
+
Q(t, e, n)
|
|
3111
3111
|
]);
|
|
3112
3112
|
});
|
|
3113
3113
|
return Hr(t, e, n, i);
|
|
@@ -3119,7 +3119,7 @@ function Uo(t, e, n, r) {
|
|
|
3119
3119
|
for (const u of t || []) {
|
|
3120
3120
|
const a = u == null ? void 0 : u.aev.get(s);
|
|
3121
3121
|
if (a) {
|
|
3122
|
-
for (const [
|
|
3122
|
+
for (const [d, c, f] of G(a, 2))
|
|
3123
3123
|
if (f === o)
|
|
3124
3124
|
return !0;
|
|
3125
3125
|
}
|
|
@@ -3139,14 +3139,14 @@ function Yr({ stores: t, attrsStore: e }, [n, r, i, s]) {
|
|
|
3139
3139
|
return (s == null ? void 0 : s.upsert) === !1 ? { mode: "update" } : (s == null ? void 0 : s.upsert) === !0 ? null : Uo(t, e, n, r) ? { mode: "update" } : null;
|
|
3140
3140
|
}
|
|
3141
3141
|
function Lo(t, e) {
|
|
3142
|
-
const { attrsStore: n } = t, [r, i, s, o] = e, u = sn(s), a =
|
|
3143
|
-
return [["id", a]].concat(Object.entries(u)).map(([
|
|
3144
|
-
const l = F(n, r,
|
|
3142
|
+
const { attrsStore: n } = t, [r, i, s, o] = e, u = sn(s), a = Q(n, r, i);
|
|
3143
|
+
return [["id", a]].concat(Object.entries(u)).map(([c, f]) => {
|
|
3144
|
+
const l = F(n, r, c);
|
|
3145
3145
|
return l["checked-data-type"] === "date" && t.useDateObjects && (f = pt(f)), ["add-triple", a, l.id, f, { mode: "create" }];
|
|
3146
3146
|
});
|
|
3147
3147
|
}
|
|
3148
3148
|
function Fo(t, e) {
|
|
3149
|
-
const { attrsStore: n } = t, [r, i, s, o] = e, u = sn(s), a =
|
|
3149
|
+
const { attrsStore: n } = t, [r, i, s, o] = e, u = sn(s), a = Q(n, r, i), d = Yr(t, [r, a, s, o]);
|
|
3150
3150
|
return [["id", a]].concat(Object.entries(u)).map(([f, l]) => {
|
|
3151
3151
|
const p = F(n, r, f);
|
|
3152
3152
|
return p["checked-data-type"] === "date" && t.useDateObjects && (l = pt(l)), [
|
|
@@ -3154,22 +3154,22 @@ function Fo(t, e) {
|
|
|
3154
3154
|
a,
|
|
3155
3155
|
p.id,
|
|
3156
3156
|
l,
|
|
3157
|
-
...
|
|
3157
|
+
...d ? [d] : []
|
|
3158
3158
|
];
|
|
3159
3159
|
});
|
|
3160
3160
|
}
|
|
3161
3161
|
function No({ attrsStore: t }, [e, n]) {
|
|
3162
|
-
return [["delete-entity",
|
|
3162
|
+
return [["delete-entity", Q(t, e, n), e]];
|
|
3163
3163
|
}
|
|
3164
3164
|
function Ko(t, e) {
|
|
3165
|
-
const { attrsStore: n } = t, [r, i, s, o] = e, u = sn(s), a =
|
|
3165
|
+
const { attrsStore: n } = t, [r, i, s, o] = e, u = sn(s), a = Q(n, r, i), d = Yr(t, [r, a, s, o]), c = Object.entries(u).map(([l, p]) => {
|
|
3166
3166
|
const y = F(n, r, l);
|
|
3167
3167
|
return [
|
|
3168
3168
|
"deep-merge-triple",
|
|
3169
3169
|
a,
|
|
3170
3170
|
y.id,
|
|
3171
3171
|
p,
|
|
3172
|
-
...
|
|
3172
|
+
...d ? [d] : []
|
|
3173
3173
|
];
|
|
3174
3174
|
});
|
|
3175
3175
|
return [[
|
|
@@ -3177,11 +3177,11 @@ function Ko(t, e) {
|
|
|
3177
3177
|
a,
|
|
3178
3178
|
F(n, r, "id").id,
|
|
3179
3179
|
a,
|
|
3180
|
-
...
|
|
3181
|
-
]].concat(
|
|
3180
|
+
...d ? [d] : []
|
|
3181
|
+
]].concat(c);
|
|
3182
3182
|
}
|
|
3183
3183
|
function qo({ attrsStore: t }, [e, n, r]) {
|
|
3184
|
-
return [["rule-params",
|
|
3184
|
+
return [["rule-params", Q(t, e, n), e, r]];
|
|
3185
3185
|
}
|
|
3186
3186
|
function zo(t) {
|
|
3187
3187
|
const [e, n, r, i, s] = t;
|
|
@@ -3200,9 +3200,9 @@ function Vo(t, e) {
|
|
|
3200
3200
|
case "update":
|
|
3201
3201
|
return Fo(t, r);
|
|
3202
3202
|
case "link":
|
|
3203
|
-
return xo(t, r);
|
|
3204
|
-
case "unlink":
|
|
3205
3203
|
return Do(t, r);
|
|
3204
|
+
case "unlink":
|
|
3205
|
+
return xo(t, r);
|
|
3206
3206
|
case "delete":
|
|
3207
3207
|
return No(t, r);
|
|
3208
3208
|
case "ruleParams":
|
|
@@ -3222,7 +3222,7 @@ function Wo(t) {
|
|
|
3222
3222
|
return;
|
|
3223
3223
|
}
|
|
3224
3224
|
}
|
|
3225
|
-
function
|
|
3225
|
+
function Bo(t, e, n) {
|
|
3226
3226
|
var r, i;
|
|
3227
3227
|
const s = (i = (r = t.entities[e]) === null || r === void 0 ? void 0 : r.attrs) === null || i === void 0 ? void 0 : i[n];
|
|
3228
3228
|
if (n === "id")
|
|
@@ -3236,21 +3236,21 @@ function Qo(t, e, n) {
|
|
|
3236
3236
|
"checked-data-type": a
|
|
3237
3237
|
};
|
|
3238
3238
|
}
|
|
3239
|
-
function
|
|
3240
|
-
const i = t ?
|
|
3239
|
+
function nt(t, e, n, r) {
|
|
3240
|
+
const i = t ? Bo(t, e, n) : null, s = N(), u = [N(), e, n];
|
|
3241
3241
|
return Object.assign(Object.assign({ id: s, "forward-identity": u, "value-type": "blob", cardinality: "one", "unique?": !1, "index?": !1, isUnsynced: !0 }, i || {}), r || {});
|
|
3242
3242
|
}
|
|
3243
|
-
function
|
|
3243
|
+
function Go(t, e, n) {
|
|
3244
3244
|
return Object.values(t.links).find((s) => s.forward.on === e && s.forward.label === n || s.reverse.on === e && s.reverse.label === n);
|
|
3245
3245
|
}
|
|
3246
|
-
function
|
|
3247
|
-
const r =
|
|
3246
|
+
function Qo(t, e, n) {
|
|
3247
|
+
const r = Go(t, e, n);
|
|
3248
3248
|
if (!r)
|
|
3249
3249
|
throw new Error(`Couldn't find the link ${e}.${n} in your schema`);
|
|
3250
3250
|
const { forward: i, reverse: s } = r;
|
|
3251
3251
|
return {
|
|
3252
|
-
"forward-identity": [
|
|
3253
|
-
"reverse-identity": [
|
|
3252
|
+
"forward-identity": [N(), i.on, i.label],
|
|
3253
|
+
"reverse-identity": [N(), s.on, s.label],
|
|
3254
3254
|
cardinality: i.has === "one" ? "one" : "many",
|
|
3255
3255
|
"unique?": s.has === "one",
|
|
3256
3256
|
"on-delete": i.onDelete,
|
|
@@ -3258,7 +3258,7 @@ function Go(t, e, n) {
|
|
|
3258
3258
|
};
|
|
3259
3259
|
}
|
|
3260
3260
|
function Yn(t, e, n, r) {
|
|
3261
|
-
const i = t ?
|
|
3261
|
+
const i = t ? Qo(t, e, n) : null, s = N(), o = [N(), e, n], u = [N(), n, e];
|
|
3262
3262
|
return Object.assign(Object.assign({
|
|
3263
3263
|
id: s,
|
|
3264
3264
|
// @ts-ignore: ts thinks it's any[]
|
|
@@ -3281,17 +3281,17 @@ const Ho = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink
|
|
|
3281
3281
|
"merge",
|
|
3282
3282
|
"delete",
|
|
3283
3283
|
"ruleParams"
|
|
3284
|
-
]),
|
|
3284
|
+
]), Gt = { "unique?": !0, "index?": !0 }, Xo = Object.assign(Object.assign({}, Gt), { cardinality: "one" });
|
|
3285
3285
|
function eu(t) {
|
|
3286
3286
|
const e = [], [n, r, i, s] = t;
|
|
3287
3287
|
if (!Zo.has(n))
|
|
3288
3288
|
return e;
|
|
3289
|
-
const o =
|
|
3289
|
+
const o = Bt(i);
|
|
3290
3290
|
if (o && e.push({ etype: r, lookupPair: o }), n === "link")
|
|
3291
3291
|
for (const [u, a] of Object.entries(s)) {
|
|
3292
|
-
const
|
|
3293
|
-
for (const
|
|
3294
|
-
const f =
|
|
3292
|
+
const d = Array.isArray(a) ? a : [a];
|
|
3293
|
+
for (const c of d) {
|
|
3294
|
+
const f = Bt(c);
|
|
3295
3295
|
f && e.push({
|
|
3296
3296
|
etype: r,
|
|
3297
3297
|
lookupPair: f,
|
|
@@ -3305,15 +3305,15 @@ function tu({ attrsStore: t, schema: e }, n) {
|
|
|
3305
3305
|
var r, i;
|
|
3306
3306
|
const s = /* @__PURE__ */ new Set(), o = [], u = [];
|
|
3307
3307
|
function a(y, b) {
|
|
3308
|
-
return F(t, y, b) || o.find((
|
|
3308
|
+
return F(t, y, b) || o.find((_) => _["forward-identity"][1] === y && _["forward-identity"][2] === b);
|
|
3309
3309
|
}
|
|
3310
|
-
function
|
|
3311
|
-
return me(t, y, b) || o.find((
|
|
3312
|
-
var w,
|
|
3313
|
-
return ((w =
|
|
3310
|
+
function d(y, b) {
|
|
3311
|
+
return me(t, y, b) || o.find((_) => {
|
|
3312
|
+
var w, g;
|
|
3313
|
+
return ((w = _["reverse-identity"]) === null || w === void 0 ? void 0 : w[1]) === y && ((g = _["reverse-identity"]) === null || g === void 0 ? void 0 : g[2]) === b;
|
|
3314
3314
|
});
|
|
3315
3315
|
}
|
|
3316
|
-
function
|
|
3316
|
+
function c(y) {
|
|
3317
3317
|
o.push(y), u.push(["add-attr", y]), s.add(y.id);
|
|
3318
3318
|
}
|
|
3319
3319
|
function f(y) {
|
|
@@ -3325,40 +3325,40 @@ function tu({ attrsStore: t, schema: e }, n) {
|
|
|
3325
3325
|
!a(y, b);
|
|
3326
3326
|
}
|
|
3327
3327
|
function p(y, b) {
|
|
3328
|
-
const
|
|
3329
|
-
f(
|
|
3328
|
+
const _ = a(y, b), w = d(y, b);
|
|
3329
|
+
f(_), f(w), !_ && !w && c(Yn(e, y, b, Xo));
|
|
3330
3330
|
}
|
|
3331
3331
|
for (const y of n)
|
|
3332
|
-
for (const { etype: b, lookupPair:
|
|
3333
|
-
const
|
|
3332
|
+
for (const { etype: b, lookupPair: _, linkLabel: w } of eu(y)) {
|
|
3333
|
+
const g = _[0];
|
|
3334
3334
|
if (w) {
|
|
3335
3335
|
p(b, w);
|
|
3336
|
-
const v = a(b, w), A =
|
|
3336
|
+
const v = a(b, w), A = d(b, w);
|
|
3337
3337
|
f(v), f(A);
|
|
3338
3338
|
const S = ((r = v == null ? void 0 : v["reverse-identity"]) === null || r === void 0 ? void 0 : r[1]) || ((i = A == null ? void 0 : A["forward-identity"]) === null || i === void 0 ? void 0 : i[1]) || w;
|
|
3339
|
-
if (l(S,
|
|
3340
|
-
p(S, Wt(
|
|
3339
|
+
if (l(S, g))
|
|
3340
|
+
p(S, Wt(g));
|
|
3341
3341
|
else {
|
|
3342
|
-
const
|
|
3343
|
-
|
|
3342
|
+
const C = a(S, g);
|
|
3343
|
+
C || c(nt(e, S, g, Gt)), f(C);
|
|
3344
3344
|
}
|
|
3345
|
-
} else if (l(b,
|
|
3346
|
-
p(b, Wt(
|
|
3345
|
+
} else if (l(b, g))
|
|
3346
|
+
p(b, Wt(g));
|
|
3347
3347
|
else {
|
|
3348
|
-
const v = a(b,
|
|
3349
|
-
v ||
|
|
3348
|
+
const v = a(b, g);
|
|
3349
|
+
v || c(nt(e, b, g, Gt)), f(v);
|
|
3350
3350
|
}
|
|
3351
3351
|
}
|
|
3352
3352
|
for (const y of n) {
|
|
3353
|
-
const [b,
|
|
3353
|
+
const [b, _, w, g] = y;
|
|
3354
3354
|
if (Ho.has(b)) {
|
|
3355
|
-
const v = a(
|
|
3356
|
-
f(v), v ||
|
|
3357
|
-
for (const A of Object.keys(
|
|
3358
|
-
const S = a(
|
|
3359
|
-
if (f(S), Jo.has(b) && (S ||
|
|
3360
|
-
const
|
|
3361
|
-
!S && !
|
|
3355
|
+
const v = a(_, "id");
|
|
3356
|
+
f(v), v || c(nt(e, _, "id", { "unique?": !0 }));
|
|
3357
|
+
for (const A of Object.keys(g)) {
|
|
3358
|
+
const S = a(_, A);
|
|
3359
|
+
if (f(S), Jo.has(b) && (S || c(nt(e, _, A, A === "id" ? { "unique?": !0 } : null))), Yo.has(b)) {
|
|
3360
|
+
const C = d(_, A);
|
|
3361
|
+
!S && !C && c(Yn(e, _, A)), f(C);
|
|
3362
3362
|
}
|
|
3363
3363
|
}
|
|
3364
3364
|
}
|
|
@@ -3372,7 +3372,7 @@ function tu({ attrsStore: t, schema: e }, n) {
|
|
|
3372
3372
|
return [t, u];
|
|
3373
3373
|
}
|
|
3374
3374
|
function nu(t, e) {
|
|
3375
|
-
const r = (Array.isArray(e) ? e : [e]).flatMap((a) =>
|
|
3375
|
+
const r = (Array.isArray(e) ? e : [e]).flatMap((a) => Io(a)), [i, s] = tu(t, r), o = Object.assign(Object.assign({}, t), { attrsStore: i }), u = r.flatMap((a) => Vo(o, a));
|
|
3376
3376
|
return [...s, ...u];
|
|
3377
3377
|
}
|
|
3378
3378
|
var re = function(t, e, n, r) {
|
|
@@ -3382,35 +3382,35 @@ var re = function(t, e, n, r) {
|
|
|
3382
3382
|
});
|
|
3383
3383
|
}
|
|
3384
3384
|
return new (n || (n = Promise))(function(s, o) {
|
|
3385
|
-
function u(
|
|
3385
|
+
function u(c) {
|
|
3386
3386
|
try {
|
|
3387
|
-
|
|
3387
|
+
d(r.next(c));
|
|
3388
3388
|
} catch (f) {
|
|
3389
3389
|
o(f);
|
|
3390
3390
|
}
|
|
3391
3391
|
}
|
|
3392
|
-
function a(
|
|
3392
|
+
function a(c) {
|
|
3393
3393
|
try {
|
|
3394
|
-
|
|
3394
|
+
d(r.throw(c));
|
|
3395
3395
|
} catch (f) {
|
|
3396
3396
|
o(f);
|
|
3397
3397
|
}
|
|
3398
3398
|
}
|
|
3399
|
-
function c
|
|
3400
|
-
|
|
3399
|
+
function d(c) {
|
|
3400
|
+
c.done ? s(c.value) : i(c.value).then(u, a);
|
|
3401
3401
|
}
|
|
3402
|
-
|
|
3402
|
+
d((r = r.apply(t, e || [])).next());
|
|
3403
3403
|
});
|
|
3404
3404
|
};
|
|
3405
3405
|
function Jn(t, e) {
|
|
3406
3406
|
typeof requestIdleCallback > "u" ? t() : requestIdleCallback(t, { timeout: e });
|
|
3407
3407
|
}
|
|
3408
|
-
const
|
|
3408
|
+
const Ke = "__meta";
|
|
3409
3409
|
class ru {
|
|
3410
3410
|
constructor(e, n) {
|
|
3411
3411
|
}
|
|
3412
3412
|
}
|
|
3413
|
-
class
|
|
3413
|
+
class Qt {
|
|
3414
3414
|
constructor(e) {
|
|
3415
3415
|
var n, r;
|
|
3416
3416
|
this._subs = [], this._nextSave = null, this._nextGc = null, this._pendingSaveKeys = /* @__PURE__ */ new Set(), this._loadedKeys = /* @__PURE__ */ new Set(), this._version = 0, this._meta = {
|
|
@@ -3426,7 +3426,7 @@ class Gt {
|
|
|
3426
3426
|
var e, n, r;
|
|
3427
3427
|
this._meta.loadingPromise && (yield this._meta.loadingPromise);
|
|
3428
3428
|
try {
|
|
3429
|
-
const i = this._persister.getItem(
|
|
3429
|
+
const i = this._persister.getItem(Ke);
|
|
3430
3430
|
this._meta.loadingPromise = i;
|
|
3431
3431
|
const s = yield i;
|
|
3432
3432
|
this._meta.isLoading = !1, this._meta.error = null, this._meta.loadingPromise = null, this._meta.attempts = 0;
|
|
@@ -3507,10 +3507,10 @@ class Gt {
|
|
|
3507
3507
|
const i = [], s = e == null ? void 0 : e.skipGc;
|
|
3508
3508
|
if (this._meta.isLoading) {
|
|
3509
3509
|
const p = new Promise((y, b) => {
|
|
3510
|
-
var
|
|
3511
|
-
setTimeout(() => this._enqueuePersist(e ? Object.assign(Object.assign({}, e), { attempts: (e.attempts || 0) + 1 }) : { attempts: 1 }).then(y).catch(b), 10 + ((
|
|
3510
|
+
var _;
|
|
3511
|
+
setTimeout(() => this._enqueuePersist(e ? Object.assign(Object.assign({}, e), { attempts: (e.attempts || 0) + 1 }) : { attempts: 1 }).then(y).catch(b), 10 + ((_ = e == null ? void 0 : e.attempts) !== null && _ !== void 0 ? _ : 0) * 1e3);
|
|
3512
3512
|
});
|
|
3513
|
-
return i.push(p), Promise.all(i).then((y) => y.reduce((b,
|
|
3513
|
+
return i.push(p), Promise.all(i).then((y) => y.reduce((b, _) => b + _, 0));
|
|
3514
3514
|
}
|
|
3515
3515
|
const o = this._meta.value;
|
|
3516
3516
|
if (!o)
|
|
@@ -3522,23 +3522,23 @@ class Gt {
|
|
|
3522
3522
|
const y = this._persister.removeItem(p);
|
|
3523
3523
|
i.push(y.then(() => 1)), this._loadedKeys.delete(p), this._pendingSaveKeys.delete(p);
|
|
3524
3524
|
}
|
|
3525
|
-
const
|
|
3525
|
+
const d = [], c = [[Ke, o]], f = (n = o.objects) !== null && n !== void 0 ? n : {};
|
|
3526
3526
|
o.objects = f;
|
|
3527
3527
|
for (const p of a)
|
|
3528
3528
|
if (this._loadedKeys.has(p)) {
|
|
3529
3529
|
const y = this.serialize(p, this.currentValue[p]);
|
|
3530
|
-
|
|
3531
|
-
const b = this._objectSize(y),
|
|
3530
|
+
c.push([p, y]);
|
|
3531
|
+
const b = this._objectSize(y), _ = (r = f[p]) !== null && r !== void 0 ? r : {
|
|
3532
3532
|
createdAt: Date.now(),
|
|
3533
3533
|
updatedAt: Date.now(),
|
|
3534
3534
|
size: b
|
|
3535
3535
|
};
|
|
3536
|
-
|
|
3536
|
+
_.updatedAt = Date.now(), _.size = b, f[p] = _, this._pendingSaveKeys.delete(p);
|
|
3537
3537
|
} else
|
|
3538
|
-
|
|
3539
|
-
const l = this._persister.multiSet(
|
|
3538
|
+
d.push(p);
|
|
3539
|
+
const l = this._persister.multiSet(c);
|
|
3540
3540
|
i.push(l.then(() => 1));
|
|
3541
|
-
for (const p of
|
|
3541
|
+
for (const p of d) {
|
|
3542
3542
|
const y = this._loadKey(p).then(() => this._enqueuePersist(e));
|
|
3543
3543
|
i.push(y);
|
|
3544
3544
|
}
|
|
@@ -3554,7 +3554,7 @@ class Gt {
|
|
|
3554
3554
|
if (!this._gcOpts)
|
|
3555
3555
|
return;
|
|
3556
3556
|
const e = new Set(yield this._persister.getAllKeys());
|
|
3557
|
-
e.delete(
|
|
3557
|
+
e.delete(Ke);
|
|
3558
3558
|
const n = new Set(Object.keys(this.currentValue));
|
|
3559
3559
|
for (const l of Object.keys(this._loadingKeys))
|
|
3560
3560
|
n.add(l);
|
|
@@ -3587,12 +3587,12 @@ class Gt {
|
|
|
3587
3587
|
if (u.length > this._gcOpts.maxEntries)
|
|
3588
3588
|
for (const [l] of a.slice(0, u.length - this._gcOpts.maxEntries))
|
|
3589
3589
|
i.push(this._persister.removeItem(l)), delete r.objects[l], s.removed.push(l), s.removedThresholdCount++;
|
|
3590
|
-
const
|
|
3591
|
-
|
|
3592
|
-
const
|
|
3593
|
-
let f =
|
|
3594
|
-
for (; f > 0 && f > this._gcOpts.maxSize &&
|
|
3595
|
-
const [[l, p]] =
|
|
3590
|
+
const d = Object.entries(r.objects);
|
|
3591
|
+
d.sort(([l, p], [y, b]) => p.updatedAt - b.updatedAt);
|
|
3592
|
+
const c = d.filter(([l]) => !n.has(l));
|
|
3593
|
+
let f = d.reduce((l, [p, y]) => l + y.size, 0);
|
|
3594
|
+
for (; f > 0 && f > this._gcOpts.maxSize && c.length; ) {
|
|
3595
|
+
const [[l, p]] = c.splice(0, 1);
|
|
3596
3596
|
f -= p.size, i.push(this._persister.removeItem(l)), delete r.objects[l], s.removed.push(l), s.removedSizeCount++;
|
|
3597
3597
|
}
|
|
3598
3598
|
for (const l of Object.keys(r.objects))
|
|
@@ -3658,24 +3658,24 @@ var ue = function(t, e, n, r) {
|
|
|
3658
3658
|
});
|
|
3659
3659
|
}
|
|
3660
3660
|
return new (n || (n = Promise))(function(s, o) {
|
|
3661
|
-
function u(
|
|
3661
|
+
function u(c) {
|
|
3662
3662
|
try {
|
|
3663
|
-
|
|
3663
|
+
d(r.next(c));
|
|
3664
3664
|
} catch (f) {
|
|
3665
3665
|
o(f);
|
|
3666
3666
|
}
|
|
3667
3667
|
}
|
|
3668
|
-
function a(
|
|
3668
|
+
function a(c) {
|
|
3669
3669
|
try {
|
|
3670
|
-
|
|
3670
|
+
d(r.throw(c));
|
|
3671
3671
|
} catch (f) {
|
|
3672
3672
|
o(f);
|
|
3673
3673
|
}
|
|
3674
3674
|
}
|
|
3675
|
-
function c
|
|
3676
|
-
|
|
3675
|
+
function d(c) {
|
|
3676
|
+
c.done ? s(c.value) : i(c.value).then(u, a);
|
|
3677
3677
|
}
|
|
3678
|
-
|
|
3678
|
+
d((r = r.apply(t, e || [])).next());
|
|
3679
3679
|
});
|
|
3680
3680
|
};
|
|
3681
3681
|
const iu = 6, su = ["kv", "querySubs", "syncSubs"];
|
|
@@ -3710,22 +3710,22 @@ function au(t, e, n) {
|
|
|
3710
3710
|
return;
|
|
3711
3711
|
const i = /* @__PURE__ */ new Set();
|
|
3712
3712
|
return new Promise((s, o) => {
|
|
3713
|
-
var u, a,
|
|
3713
|
+
var u, a, d, c;
|
|
3714
3714
|
const f = {};
|
|
3715
3715
|
for (const [y, b] of Object.entries(r)) {
|
|
3716
|
-
const
|
|
3717
|
-
if (
|
|
3718
|
-
const
|
|
3719
|
-
createdAt:
|
|
3720
|
-
updatedAt:
|
|
3721
|
-
size: (
|
|
3716
|
+
const _ = typeof b == "string" ? JSON.parse(b) : b;
|
|
3717
|
+
if (_.lastAccessed) {
|
|
3718
|
+
const g = {
|
|
3719
|
+
createdAt: _.lastAccessed,
|
|
3720
|
+
updatedAt: _.lastAccessed,
|
|
3721
|
+
size: (c = (d = (a = (u = _.result) === null || u === void 0 ? void 0 : u.store) === null || a === void 0 ? void 0 : a.triples) === null || d === void 0 ? void 0 : d.length) !== null && c !== void 0 ? c : 0
|
|
3722
3722
|
};
|
|
3723
|
-
f[y] =
|
|
3723
|
+
f[y] = g;
|
|
3724
3724
|
}
|
|
3725
|
-
const w = n.put(
|
|
3725
|
+
const w = n.put(_, y);
|
|
3726
3726
|
i.add(w);
|
|
3727
3727
|
}
|
|
3728
|
-
const l = { objects: f }, p = n.put(l,
|
|
3728
|
+
const l = { objects: f }, p = n.put(l, Ke);
|
|
3729
3729
|
i.add(p);
|
|
3730
3730
|
for (const y of i)
|
|
3731
3731
|
y.onsuccess = () => {
|
|
@@ -3749,45 +3749,45 @@ function cu(t, e) {
|
|
|
3749
3749
|
const n = yield uu(`instant_${t}_5`);
|
|
3750
3750
|
if (!n)
|
|
3751
3751
|
return;
|
|
3752
|
-
const r = yield new Promise((
|
|
3752
|
+
const r = yield new Promise((c, f) => {
|
|
3753
3753
|
const y = n.transaction(["kv"], "readonly").objectStore("kv").openCursor();
|
|
3754
|
-
y.onerror = (
|
|
3755
|
-
f(
|
|
3754
|
+
y.onerror = (_) => {
|
|
3755
|
+
f(_);
|
|
3756
3756
|
};
|
|
3757
3757
|
const b = [];
|
|
3758
3758
|
y.onsuccess = () => {
|
|
3759
|
-
const
|
|
3760
|
-
if (
|
|
3761
|
-
const w =
|
|
3762
|
-
b.push([w,
|
|
3759
|
+
const _ = y.result;
|
|
3760
|
+
if (_) {
|
|
3761
|
+
const w = _.key, g = _.value;
|
|
3762
|
+
b.push([w, g]), _.continue();
|
|
3763
3763
|
} else
|
|
3764
|
-
|
|
3765
|
-
}, y.onerror = (
|
|
3766
|
-
f(
|
|
3764
|
+
c(b);
|
|
3765
|
+
}, y.onerror = (_) => {
|
|
3766
|
+
f(_);
|
|
3767
3767
|
};
|
|
3768
3768
|
}), i = e.transaction(["kv", "querySubs"], "readwrite"), s = i.objectStore("kv"), o = i.objectStore("querySubs"), u = [], a = { objects: {} };
|
|
3769
|
-
for (const [
|
|
3770
|
-
switch (
|
|
3769
|
+
for (const [c, f] of r)
|
|
3770
|
+
switch (c) {
|
|
3771
3771
|
case "querySubs": {
|
|
3772
|
-
const l = au(
|
|
3772
|
+
const l = au(c, f, o);
|
|
3773
3773
|
u.push(l);
|
|
3774
3774
|
break;
|
|
3775
3775
|
}
|
|
3776
3776
|
default: {
|
|
3777
|
-
const l = Zn(
|
|
3777
|
+
const l = Zn(c, f, s);
|
|
3778
3778
|
u.push(l);
|
|
3779
3779
|
const p = {
|
|
3780
3780
|
createdAt: Date.now(),
|
|
3781
3781
|
updatedAt: Date.now(),
|
|
3782
3782
|
size: 0
|
|
3783
3783
|
};
|
|
3784
|
-
a.objects[
|
|
3784
|
+
a.objects[c] = p;
|
|
3785
3785
|
break;
|
|
3786
3786
|
}
|
|
3787
3787
|
}
|
|
3788
|
-
const
|
|
3789
|
-
u.push(
|
|
3790
|
-
i.oncomplete = (l) =>
|
|
3788
|
+
const d = Zn(Ke, a, s);
|
|
3789
|
+
u.push(d), yield Promise.all(u), yield new Promise((c, f) => {
|
|
3790
|
+
i.oncomplete = (l) => c(l), i.onerror = (l) => f(l), i.onabort = (l) => f(l);
|
|
3791
3791
|
});
|
|
3792
3792
|
});
|
|
3793
3793
|
}
|
|
@@ -3805,8 +3805,8 @@ class Jr extends ru {
|
|
|
3805
3805
|
}, i.onsuccess = (s) => {
|
|
3806
3806
|
const u = s.target.result;
|
|
3807
3807
|
if (r) {
|
|
3808
|
-
const a = cu(this._appId, u).catch((
|
|
3809
|
-
ou("Error upgrading store from version 5 to 6.")(
|
|
3808
|
+
const a = cu(this._appId, u).catch((d) => {
|
|
3809
|
+
ou("Error upgrading store from version 5 to 6.")(d);
|
|
3810
3810
|
});
|
|
3811
3811
|
Xn.set(this.dbName, a), a.then(() => e(u)).catch(() => e(u));
|
|
3812
3812
|
} else {
|
|
@@ -3841,9 +3841,9 @@ class Jr extends ru {
|
|
|
3841
3841
|
const r = yield this._dbPromise;
|
|
3842
3842
|
return new Promise((i, s) => {
|
|
3843
3843
|
const a = r.transaction([this._storeName], "readwrite").objectStore(this._storeName).put(n, e);
|
|
3844
|
-
a.onerror = (
|
|
3845
|
-
s(
|
|
3846
|
-
}, a.onsuccess = (
|
|
3844
|
+
a.onerror = (d) => {
|
|
3845
|
+
s(d);
|
|
3846
|
+
}, a.onsuccess = (d) => {
|
|
3847
3847
|
i();
|
|
3848
3848
|
};
|
|
3849
3849
|
});
|
|
@@ -3855,14 +3855,14 @@ class Jr extends ru {
|
|
|
3855
3855
|
const n = yield this._dbPromise;
|
|
3856
3856
|
return new Promise((r, i) => {
|
|
3857
3857
|
const s = n.transaction([this._storeName], "readwrite"), o = s.objectStore(this._storeName), u = /* @__PURE__ */ new Set();
|
|
3858
|
-
for (const [a,
|
|
3859
|
-
const
|
|
3860
|
-
u.add(
|
|
3858
|
+
for (const [a, d] of e) {
|
|
3859
|
+
const c = o.put(d, a);
|
|
3860
|
+
u.add(c);
|
|
3861
3861
|
}
|
|
3862
3862
|
for (const a of u)
|
|
3863
|
-
a.onerror = (
|
|
3864
|
-
s.abort(), i(
|
|
3865
|
-
}, a.onsuccess = (
|
|
3863
|
+
a.onerror = (d) => {
|
|
3864
|
+
s.abort(), i(d);
|
|
3865
|
+
}, a.onsuccess = (d) => {
|
|
3866
3866
|
u.delete(a), u.size === 0 && r();
|
|
3867
3867
|
};
|
|
3868
3868
|
});
|
|
@@ -3902,24 +3902,24 @@ var du = function(t, e, n, r) {
|
|
|
3902
3902
|
});
|
|
3903
3903
|
}
|
|
3904
3904
|
return new (n || (n = Promise))(function(s, o) {
|
|
3905
|
-
function u(
|
|
3905
|
+
function u(c) {
|
|
3906
3906
|
try {
|
|
3907
|
-
|
|
3907
|
+
d(r.next(c));
|
|
3908
3908
|
} catch (f) {
|
|
3909
3909
|
o(f);
|
|
3910
3910
|
}
|
|
3911
3911
|
}
|
|
3912
|
-
function a(
|
|
3912
|
+
function a(c) {
|
|
3913
3913
|
try {
|
|
3914
|
-
|
|
3914
|
+
d(r.throw(c));
|
|
3915
3915
|
} catch (f) {
|
|
3916
3916
|
o(f);
|
|
3917
3917
|
}
|
|
3918
3918
|
}
|
|
3919
|
-
function c
|
|
3920
|
-
|
|
3919
|
+
function d(c) {
|
|
3920
|
+
c.done ? s(c.value) : i(c.value).then(u, a);
|
|
3921
3921
|
}
|
|
3922
|
-
|
|
3922
|
+
d((r = r.apply(t, e || [])).next());
|
|
3923
3923
|
});
|
|
3924
3924
|
};
|
|
3925
3925
|
class Zr {
|
|
@@ -3956,24 +3956,24 @@ var fu = function(t, e, n, r) {
|
|
|
3956
3956
|
});
|
|
3957
3957
|
}
|
|
3958
3958
|
return new (n || (n = Promise))(function(s, o) {
|
|
3959
|
-
function u(
|
|
3959
|
+
function u(c) {
|
|
3960
3960
|
try {
|
|
3961
|
-
|
|
3961
|
+
d(r.next(c));
|
|
3962
3962
|
} catch (f) {
|
|
3963
3963
|
o(f);
|
|
3964
3964
|
}
|
|
3965
3965
|
}
|
|
3966
|
-
function a(
|
|
3966
|
+
function a(c) {
|
|
3967
3967
|
try {
|
|
3968
|
-
|
|
3968
|
+
d(r.throw(c));
|
|
3969
3969
|
} catch (f) {
|
|
3970
3970
|
o(f);
|
|
3971
3971
|
}
|
|
3972
3972
|
}
|
|
3973
|
-
function c
|
|
3974
|
-
|
|
3973
|
+
function d(c) {
|
|
3974
|
+
c.done ? s(c.value) : i(c.value).then(u, a);
|
|
3975
3975
|
}
|
|
3976
|
-
|
|
3976
|
+
d((r = r.apply(t, e || [])).next());
|
|
3977
3977
|
});
|
|
3978
3978
|
};
|
|
3979
3979
|
class bt extends je {
|
|
@@ -3994,31 +3994,31 @@ function te(t, e) {
|
|
|
3994
3994
|
return n.status === 200 ? Promise.resolve(r) : Promise.reject(new bt({ status: n.status, body: r }));
|
|
3995
3995
|
});
|
|
3996
3996
|
}
|
|
3997
|
-
var
|
|
3997
|
+
var Ie = function(t, e, n, r) {
|
|
3998
3998
|
function i(s) {
|
|
3999
3999
|
return s instanceof n ? s : new n(function(o) {
|
|
4000
4000
|
o(s);
|
|
4001
4001
|
});
|
|
4002
4002
|
}
|
|
4003
4003
|
return new (n || (n = Promise))(function(s, o) {
|
|
4004
|
-
function u(
|
|
4004
|
+
function u(c) {
|
|
4005
4005
|
try {
|
|
4006
|
-
|
|
4006
|
+
d(r.next(c));
|
|
4007
4007
|
} catch (f) {
|
|
4008
4008
|
o(f);
|
|
4009
4009
|
}
|
|
4010
4010
|
}
|
|
4011
|
-
function a(
|
|
4011
|
+
function a(c) {
|
|
4012
4012
|
try {
|
|
4013
|
-
|
|
4013
|
+
d(r.throw(c));
|
|
4014
4014
|
} catch (f) {
|
|
4015
4015
|
o(f);
|
|
4016
4016
|
}
|
|
4017
4017
|
}
|
|
4018
|
-
function c
|
|
4019
|
-
|
|
4018
|
+
function d(c) {
|
|
4019
|
+
c.done ? s(c.value) : i(c.value).then(u, a);
|
|
4020
4020
|
}
|
|
4021
|
-
|
|
4021
|
+
d((r = r.apply(t, e || [])).next());
|
|
4022
4022
|
});
|
|
4023
4023
|
};
|
|
4024
4024
|
function lu({ apiURI: t, appId: e, email: n }) {
|
|
@@ -4029,7 +4029,7 @@ function lu({ apiURI: t, appId: e, email: n }) {
|
|
|
4029
4029
|
});
|
|
4030
4030
|
}
|
|
4031
4031
|
function hu(t) {
|
|
4032
|
-
return
|
|
4032
|
+
return Ie(this, arguments, void 0, function* ({ apiURI: e, appId: n, email: r, code: i, refreshToken: s }) {
|
|
4033
4033
|
return yield te(`${e}/runtime/auth/verify_magic_code`, {
|
|
4034
4034
|
method: "POST",
|
|
4035
4035
|
headers: { "content-type": "application/json" },
|
|
@@ -4042,7 +4042,7 @@ function hu(t) {
|
|
|
4042
4042
|
});
|
|
4043
4043
|
}
|
|
4044
4044
|
function pu(t) {
|
|
4045
|
-
return
|
|
4045
|
+
return Ie(this, arguments, void 0, function* ({ apiURI: e, appId: n, refreshToken: r }) {
|
|
4046
4046
|
return yield te(`${e}/runtime/auth/verify_refresh_token`, {
|
|
4047
4047
|
method: "POST",
|
|
4048
4048
|
headers: { "content-type": "application/json" },
|
|
@@ -4054,7 +4054,7 @@ function pu(t) {
|
|
|
4054
4054
|
});
|
|
4055
4055
|
}
|
|
4056
4056
|
function yu(t) {
|
|
4057
|
-
return
|
|
4057
|
+
return Ie(this, arguments, void 0, function* ({ apiURI: e, appId: n }) {
|
|
4058
4058
|
return yield te(`${e}/runtime/auth/sign_in_guest`, {
|
|
4059
4059
|
method: "POST",
|
|
4060
4060
|
headers: { "content-type": "application/json" },
|
|
@@ -4065,7 +4065,7 @@ function yu(t) {
|
|
|
4065
4065
|
});
|
|
4066
4066
|
}
|
|
4067
4067
|
function er(t) {
|
|
4068
|
-
return
|
|
4068
|
+
return Ie(this, arguments, void 0, function* ({ apiURI: e, appId: n, code: r, codeVerifier: i, refreshToken: s }) {
|
|
4069
4069
|
return yield te(`${e}/runtime/oauth/token`, {
|
|
4070
4070
|
method: "POST",
|
|
4071
4071
|
headers: { "content-type": "application/json" },
|
|
@@ -4079,7 +4079,7 @@ function er(t) {
|
|
|
4079
4079
|
});
|
|
4080
4080
|
}
|
|
4081
4081
|
function bu(t) {
|
|
4082
|
-
return
|
|
4082
|
+
return Ie(this, arguments, void 0, function* ({ apiURI: e, appId: n, nonce: r, idToken: i, clientName: s, refreshToken: o }) {
|
|
4083
4083
|
return yield te(`${e}/runtime/oauth/id_token`, {
|
|
4084
4084
|
method: "POST",
|
|
4085
4085
|
headers: { "content-type": "application/json" },
|
|
@@ -4094,7 +4094,7 @@ function bu(t) {
|
|
|
4094
4094
|
});
|
|
4095
4095
|
}
|
|
4096
4096
|
function _u(t) {
|
|
4097
|
-
return
|
|
4097
|
+
return Ie(this, arguments, void 0, function* ({ apiURI: e, appId: n, refreshToken: r }) {
|
|
4098
4098
|
return yield te(`${e}/runtime/signout`, {
|
|
4099
4099
|
method: "POST",
|
|
4100
4100
|
headers: {
|
|
@@ -4114,24 +4114,24 @@ var Be = function(t, e, n, r) {
|
|
|
4114
4114
|
});
|
|
4115
4115
|
}
|
|
4116
4116
|
return new (n || (n = Promise))(function(s, o) {
|
|
4117
|
-
function u(
|
|
4117
|
+
function u(c) {
|
|
4118
4118
|
try {
|
|
4119
|
-
|
|
4119
|
+
d(r.next(c));
|
|
4120
4120
|
} catch (f) {
|
|
4121
4121
|
o(f);
|
|
4122
4122
|
}
|
|
4123
4123
|
}
|
|
4124
|
-
function a(
|
|
4124
|
+
function a(c) {
|
|
4125
4125
|
try {
|
|
4126
|
-
|
|
4126
|
+
d(r.throw(c));
|
|
4127
4127
|
} catch (f) {
|
|
4128
4128
|
o(f);
|
|
4129
4129
|
}
|
|
4130
4130
|
}
|
|
4131
|
-
function c
|
|
4132
|
-
|
|
4131
|
+
function d(c) {
|
|
4132
|
+
c.done ? s(c.value) : i(c.value).then(u, a);
|
|
4133
4133
|
}
|
|
4134
|
-
|
|
4134
|
+
d((r = r.apply(t, e || [])).next());
|
|
4135
4135
|
});
|
|
4136
4136
|
};
|
|
4137
4137
|
function gu(t) {
|
|
@@ -4220,16 +4220,16 @@ function Su(t, e, n) {
|
|
|
4220
4220
|
s.user = Object.assign(Object.assign({}, u), { peerId: n });
|
|
4221
4221
|
}
|
|
4222
4222
|
for (const u of Object.keys((i = t.peers) !== null && i !== void 0 ? i : {})) {
|
|
4223
|
-
const a = (e == null ? void 0 : e.peers) === void 0,
|
|
4224
|
-
if (a ||
|
|
4225
|
-
const
|
|
4226
|
-
s.peers[u] = Object.assign(Object.assign({},
|
|
4223
|
+
const a = (e == null ? void 0 : e.peers) === void 0, d = Array.isArray(e == null ? void 0 : e.peers) && (e == null ? void 0 : e.peers.includes(u));
|
|
4224
|
+
if (a || d) {
|
|
4225
|
+
const c = tr(t.peers[u], e == null ? void 0 : e.keys);
|
|
4226
|
+
s.peers[u] = Object.assign(Object.assign({}, c), { peerId: u });
|
|
4227
4227
|
}
|
|
4228
4228
|
}
|
|
4229
4229
|
return s;
|
|
4230
4230
|
}
|
|
4231
4231
|
function Ou(t, e) {
|
|
4232
|
-
if (t.isLoading !== e.isLoading || t.error !== e.error || (t.user || e.user) && (!t.user || !e.user || !Nn(t.user, e.user)) || !
|
|
4232
|
+
if (t.isLoading !== e.isLoading || t.error !== e.error || (t.user || e.user) && (!t.user || !e.user || !Nn(t.user, e.user)) || !Cr(t.peers, e.peers))
|
|
4233
4233
|
return !0;
|
|
4234
4234
|
for (const r of Object.keys(t.peers))
|
|
4235
4235
|
if (!Nn(t.peers[r], e.peers[r]))
|
|
@@ -4276,7 +4276,7 @@ function ir(t) {
|
|
|
4276
4276
|
}, e;
|
|
4277
4277
|
}, {});
|
|
4278
4278
|
}
|
|
4279
|
-
const ni = "v0.22.90-experimental.
|
|
4279
|
+
const ni = "v0.22.90-experimental.trim-env-vars.20312148351.1";
|
|
4280
4280
|
function Au(t, e) {
|
|
4281
4281
|
return {
|
|
4282
4282
|
info: t ? (...n) => console.info(...n, e()) : () => {
|
|
@@ -4342,17 +4342,17 @@ const sr = [
|
|
|
4342
4342
|
return !0;
|
|
4343
4343
|
}
|
|
4344
4344
|
}, ku = (t, e, n, r, i, s, o) => {
|
|
4345
|
-
const u = s.valueType === "json", a = (
|
|
4346
|
-
if (!ri(f,
|
|
4347
|
-
throw new M(`Invalid value for operator '${
|
|
4345
|
+
const u = s.valueType === "json", a = (d, c, f) => {
|
|
4346
|
+
if (!ri(f, c, u))
|
|
4347
|
+
throw new M(`Invalid value for operator '${d}' on attribute '${r}' in entity '${i}'. Expected ${c}, but received: ${typeof f}`, o);
|
|
4348
4348
|
};
|
|
4349
4349
|
switch (t) {
|
|
4350
4350
|
case "in":
|
|
4351
4351
|
case "$in":
|
|
4352
4352
|
if (!Array.isArray(e))
|
|
4353
4353
|
throw new M(`Operator '${t}' for attribute '${r}' in entity '${i}' must be an array, but received: ${typeof e}`, o);
|
|
4354
|
-
for (const
|
|
4355
|
-
a(t, n,
|
|
4354
|
+
for (const d of e)
|
|
4355
|
+
a(t, n, d);
|
|
4356
4356
|
break;
|
|
4357
4357
|
case "$not":
|
|
4358
4358
|
case "$ne":
|
|
@@ -4379,8 +4379,8 @@ const sr = [
|
|
|
4379
4379
|
if (o)
|
|
4380
4380
|
return;
|
|
4381
4381
|
const a = t;
|
|
4382
|
-
for (const [
|
|
4383
|
-
ku(
|
|
4382
|
+
for (const [d, c] of Object.entries(a))
|
|
4383
|
+
ku(d, c, s, e, r, n, `${i}.${d}`);
|
|
4384
4384
|
} else if (!ri(t, s, o))
|
|
4385
4385
|
throw new M(`Invalid value for attribute '${e}' in entity '${r}'. Expected ${s}, but received: ${typeof t}`, i);
|
|
4386
4386
|
}, ju = (t, e, n, r, i) => {
|
|
@@ -4388,8 +4388,8 @@ const sr = [
|
|
|
4388
4388
|
if (s.length < 2)
|
|
4389
4389
|
throw new M(`Invalid dot notation path '${t}'. Must contain at least one dot.`, i);
|
|
4390
4390
|
let o = n;
|
|
4391
|
-
for (let
|
|
4392
|
-
const f = s[
|
|
4391
|
+
for (let c = 0; c < s.length - 1; c++) {
|
|
4392
|
+
const f = s[c], l = r.entities[o];
|
|
4393
4393
|
if (!l)
|
|
4394
4394
|
throw new M(`Entity '${o}' does not exist in schema while traversing dot notation path '${t}'.`, i);
|
|
4395
4395
|
const p = l.links[f];
|
|
@@ -4408,24 +4408,24 @@ const sr = [
|
|
|
4408
4408
|
Ae(e, t, new ae("string", !1, !0), n, i);
|
|
4409
4409
|
return;
|
|
4410
4410
|
}
|
|
4411
|
-
const
|
|
4411
|
+
const d = a.attrs[u];
|
|
4412
4412
|
if (Object.keys(a.links).includes(u)) {
|
|
4413
4413
|
if (typeof e == "string" && !Ee(e))
|
|
4414
4414
|
throw new M(`Invalid value for link '${u}' in entity '${o}'. Expected a UUID, but received: ${e}`, i);
|
|
4415
4415
|
Ae(e, t, new ae("string", !1, !0), n, i);
|
|
4416
4416
|
return;
|
|
4417
4417
|
}
|
|
4418
|
-
if (!
|
|
4419
|
-
const
|
|
4420
|
-
throw new M(`Attribute '${u}' does not exist on entity '${o}' in dot notation path '${t}'. Available attributes: ${
|
|
4418
|
+
if (!d) {
|
|
4419
|
+
const c = Object.keys(a.attrs);
|
|
4420
|
+
throw new M(`Attribute '${u}' does not exist on entity '${o}' in dot notation path '${t}'. Available attributes: ${c.length > 0 ? c.join(", ") + ", id" : "id"}`, i);
|
|
4421
4421
|
}
|
|
4422
|
-
Ae(e, t,
|
|
4422
|
+
Ae(e, t, d, n, i);
|
|
4423
4423
|
}, ii = (t, e, n, r) => {
|
|
4424
4424
|
for (const [i, s] of Object.entries(t)) {
|
|
4425
4425
|
if (i === "or" || i === "and") {
|
|
4426
4426
|
if (Array.isArray(s))
|
|
4427
|
-
for (const
|
|
4428
|
-
typeof
|
|
4427
|
+
for (const d of s)
|
|
4428
|
+
typeof d == "object" && d !== null && ii(d, e, n, `${r}.${i}[${d}]`);
|
|
4429
4429
|
continue;
|
|
4430
4430
|
}
|
|
4431
4431
|
if (i === "id") {
|
|
@@ -4441,19 +4441,19 @@ const sr = [
|
|
|
4441
4441
|
continue;
|
|
4442
4442
|
const u = o.attrs[i], a = o.links[i];
|
|
4443
4443
|
if (!u && !a) {
|
|
4444
|
-
const
|
|
4445
|
-
throw new M(`Attribute or link '${i}' does not exist on entity '${e}'. Available attributes: ${
|
|
4444
|
+
const d = Object.keys(o.attrs), c = Object.keys(o.links);
|
|
4445
|
+
throw new M(`Attribute or link '${i}' does not exist on entity '${e}'. Available attributes: ${d.length > 0 ? d.join(", ") : "none"}. Available links: ${c.length > 0 ? c.join(", ") : "none"}`, `${r}.${i}`);
|
|
4446
4446
|
}
|
|
4447
4447
|
if (u)
|
|
4448
4448
|
Ae(s, i, u, e, `${r}.${i}`);
|
|
4449
4449
|
else if (a) {
|
|
4450
4450
|
if (typeof s == "string" && !Ee(s))
|
|
4451
4451
|
throw new M(`Invalid value for link '${i}' in entity '${e}'. Expected a UUID, but received: ${s}`, `${r}.${i}`);
|
|
4452
|
-
const
|
|
4453
|
-
Ae(s, i,
|
|
4452
|
+
const d = new ae("string", !1, !0);
|
|
4453
|
+
Ae(s, i, d, e, `${r}.${i}`);
|
|
4454
4454
|
}
|
|
4455
4455
|
}
|
|
4456
|
-
},
|
|
4456
|
+
}, Cu = (t, e, n, r, i = 0) => {
|
|
4457
4457
|
for (const o of Object.keys(t))
|
|
4458
4458
|
if (!sr.includes(o))
|
|
4459
4459
|
throw new M(`Invalid query parameter '${o}' in $ object. Valid parameters are: ${sr.join(", ")}. Found: ${o}`, r);
|
|
@@ -4492,7 +4492,7 @@ const sr = [
|
|
|
4492
4492
|
const u = t[o];
|
|
4493
4493
|
if (typeof u != "object" || u === null)
|
|
4494
4494
|
throw new M(`Query parameter '$' must be an object in entity '${e}', but received: ${typeof u}`, `${r}.$`);
|
|
4495
|
-
|
|
4495
|
+
Cu(u, e, n, `${r}.$`, i);
|
|
4496
4496
|
}
|
|
4497
4497
|
}, or = (t, e) => {
|
|
4498
4498
|
if (typeof t != "object" || t === null)
|
|
@@ -4519,7 +4519,7 @@ class Z extends Error {
|
|
|
4519
4519
|
super(e), this.name = "TransactionValidationError";
|
|
4520
4520
|
}
|
|
4521
4521
|
}
|
|
4522
|
-
const oi = (t) => t.length > 0 ? t.join(", ") : "none",
|
|
4522
|
+
const oi = (t) => t.length > 0 ? t.join(", ") : "none", Iu = (t, e) => new Z(`Entity '${t}' does not exist in schema. Available entities: ${oi(e)}`), ar = {
|
|
4523
4523
|
string: (t) => typeof t == "string",
|
|
4524
4524
|
number: (t) => typeof t == "number" && !isNaN(t),
|
|
4525
4525
|
boolean: (t) => typeof t == "boolean",
|
|
@@ -4531,7 +4531,7 @@ const oi = (t) => t.length > 0 ? t.join(", ") : "none", Cu = (t, e) => new Z(`En
|
|
|
4531
4531
|
}, ui = (t, e) => {
|
|
4532
4532
|
const n = e.entities[t];
|
|
4533
4533
|
if (!n)
|
|
4534
|
-
throw
|
|
4534
|
+
throw Iu(t, Object.keys(e.entities));
|
|
4535
4535
|
return n;
|
|
4536
4536
|
}, jt = (t, e, n) => {
|
|
4537
4537
|
const r = ui(t, n);
|
|
@@ -4601,24 +4601,24 @@ var dr = function(t, e, n, r) {
|
|
|
4601
4601
|
});
|
|
4602
4602
|
}
|
|
4603
4603
|
return new (n || (n = Promise))(function(s, o) {
|
|
4604
|
-
function u(
|
|
4604
|
+
function u(c) {
|
|
4605
4605
|
try {
|
|
4606
|
-
|
|
4606
|
+
d(r.next(c));
|
|
4607
4607
|
} catch (f) {
|
|
4608
4608
|
o(f);
|
|
4609
4609
|
}
|
|
4610
4610
|
}
|
|
4611
|
-
function a(
|
|
4611
|
+
function a(c) {
|
|
4612
4612
|
try {
|
|
4613
|
-
|
|
4613
|
+
d(r.throw(c));
|
|
4614
4614
|
} catch (f) {
|
|
4615
4615
|
o(f);
|
|
4616
4616
|
}
|
|
4617
4617
|
}
|
|
4618
|
-
function c
|
|
4619
|
-
|
|
4618
|
+
function d(c) {
|
|
4619
|
+
c.done ? s(c.value) : i(c.value).then(u, a);
|
|
4620
4620
|
}
|
|
4621
|
-
|
|
4621
|
+
d((r = r.apply(t, e || [])).next());
|
|
4622
4622
|
});
|
|
4623
4623
|
};
|
|
4624
4624
|
let ai = 0;
|
|
@@ -4652,7 +4652,7 @@ class fr {
|
|
|
4652
4652
|
return this.conn.send(JSON.stringify(e));
|
|
4653
4653
|
}
|
|
4654
4654
|
}
|
|
4655
|
-
class
|
|
4655
|
+
class Du {
|
|
4656
4656
|
constructor(e, n) {
|
|
4657
4657
|
this.type = "sse", this.initParams = null, this.sendQueue = [], this.closeFired = !1, this.sseInitTimeout = void 0, this.id = `${this.type}_${ai++}`, this.url = n, this.ES = e, this.conn = new e(n), this.sseInitTimeout = setTimeout(() => {
|
|
4658
4658
|
this.initParams || this.handleError();
|
|
@@ -4745,30 +4745,30 @@ var lr = function(t, e, n, r) {
|
|
|
4745
4745
|
});
|
|
4746
4746
|
}
|
|
4747
4747
|
return new (n || (n = Promise))(function(s, o) {
|
|
4748
|
-
function u(
|
|
4748
|
+
function u(c) {
|
|
4749
4749
|
try {
|
|
4750
|
-
|
|
4750
|
+
d(r.next(c));
|
|
4751
4751
|
} catch (f) {
|
|
4752
4752
|
o(f);
|
|
4753
4753
|
}
|
|
4754
4754
|
}
|
|
4755
|
-
function a(
|
|
4755
|
+
function a(c) {
|
|
4756
4756
|
try {
|
|
4757
|
-
|
|
4757
|
+
d(r.throw(c));
|
|
4758
4758
|
} catch (f) {
|
|
4759
4759
|
o(f);
|
|
4760
4760
|
}
|
|
4761
4761
|
}
|
|
4762
|
-
function c
|
|
4763
|
-
|
|
4762
|
+
function d(c) {
|
|
4763
|
+
c.done ? s(c.value) : i(c.value).then(u, a);
|
|
4764
4764
|
}
|
|
4765
|
-
|
|
4765
|
+
d((r = r.apply(t, e || [])).next());
|
|
4766
4766
|
});
|
|
4767
4767
|
};
|
|
4768
|
-
function
|
|
4768
|
+
function xu(t, e) {
|
|
4769
4769
|
const n = t.values;
|
|
4770
4770
|
if (n) {
|
|
4771
|
-
const r =
|
|
4771
|
+
const r = Dr(n.attrsStore, null);
|
|
4772
4772
|
if (r) {
|
|
4773
4773
|
for (const i of n.entities || [])
|
|
4774
4774
|
i.store.useDateObjects = e, i.store = $r(r, i.store);
|
|
@@ -4794,15 +4794,15 @@ function Lu(t, e, n) {
|
|
|
4794
4794
|
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;
|
|
4795
4795
|
return s && (!o || s > o) ? e : o && (!s || o > s) ? n : e || n;
|
|
4796
4796
|
}
|
|
4797
|
-
function
|
|
4798
|
-
return
|
|
4797
|
+
function Ct(t, e, n) {
|
|
4798
|
+
return Gr({ store: e, attrsStore: n, pageInfo: null, aggregate: null }, t.query).data[t.table][0];
|
|
4799
4799
|
}
|
|
4800
4800
|
function hr(t, e, n, r) {
|
|
4801
4801
|
var i;
|
|
4802
4802
|
const s = (i = F(n, t.table, "id")) === null || i === void 0 ? void 0 : i.id;
|
|
4803
4803
|
if (!s)
|
|
4804
4804
|
return -1;
|
|
4805
|
-
const o =
|
|
4805
|
+
const o = Ce(e.eav, [r, s, r]);
|
|
4806
4806
|
return o ? o[3] : -1;
|
|
4807
4807
|
}
|
|
4808
4808
|
function pr(t, e, n) {
|
|
@@ -4812,19 +4812,19 @@ function pr(t, e, n) {
|
|
|
4812
4812
|
Lr(t, e, i);
|
|
4813
4813
|
break;
|
|
4814
4814
|
case "removed":
|
|
4815
|
-
|
|
4815
|
+
xr(t, e, i);
|
|
4816
4816
|
break;
|
|
4817
4817
|
}
|
|
4818
4818
|
}
|
|
4819
4819
|
function Fu(t, e, n) {
|
|
4820
4820
|
var r, i, s, o;
|
|
4821
4821
|
const u = {};
|
|
4822
|
-
for (const { action: a, triple:
|
|
4823
|
-
const [
|
|
4822
|
+
for (const { action: a, triple: d } of n) {
|
|
4823
|
+
const [c, f, l] = d, p = (i = (r = e.getAttr(f)) === null || r === void 0 ? void 0 : r["forward-identity"]) === null || i === void 0 ? void 0 : i[2];
|
|
4824
4824
|
if (!p)
|
|
4825
4825
|
continue;
|
|
4826
|
-
const y = (s = u[
|
|
4827
|
-
u[
|
|
4826
|
+
const y = (s = u[c]) !== null && s !== void 0 ? s : {};
|
|
4827
|
+
u[c] = y;
|
|
4828
4828
|
const b = (o = y[p]) !== null && o !== void 0 ? o : {};
|
|
4829
4829
|
switch (y[p] = b, a) {
|
|
4830
4830
|
case "added":
|
|
@@ -4836,12 +4836,12 @@ function Fu(t, e, n) {
|
|
|
4836
4836
|
}
|
|
4837
4837
|
}
|
|
4838
4838
|
for (const a of Object.keys(u)) {
|
|
4839
|
-
const { oldValue:
|
|
4840
|
-
|
|
4839
|
+
const { oldValue: d, newValue: c } = u[a];
|
|
4840
|
+
d === c && delete u[a];
|
|
4841
4841
|
}
|
|
4842
4842
|
return u;
|
|
4843
4843
|
}
|
|
4844
|
-
function
|
|
4844
|
+
function rt(t, e) {
|
|
4845
4845
|
return { [t.table]: e.map((n) => n.entity) };
|
|
4846
4846
|
}
|
|
4847
4847
|
function Nu(t, e) {
|
|
@@ -4855,17 +4855,17 @@ function Ku(t, e, n) {
|
|
|
4855
4855
|
const r = e;
|
|
4856
4856
|
if (t.orderField === "serverCreatedAt") {
|
|
4857
4857
|
n.sort(t.orderDirection === "asc" ? function(o, u) {
|
|
4858
|
-
return
|
|
4858
|
+
return Le(o.entity.id, o.serverCreatedAt, u.entity.id, u.serverCreatedAt, r);
|
|
4859
4859
|
} : function(o, u) {
|
|
4860
|
-
return
|
|
4860
|
+
return Le(u.entity.id, u.serverCreatedAt, o.entity.id, o.serverCreatedAt, r);
|
|
4861
4861
|
});
|
|
4862
4862
|
return;
|
|
4863
4863
|
}
|
|
4864
4864
|
const i = t.orderField;
|
|
4865
4865
|
n.sort(t.orderDirection === "asc" ? function(o, u) {
|
|
4866
|
-
return
|
|
4866
|
+
return Le(o.entity.id, o.entity[i], u.entity.id, u.entity[i], r);
|
|
4867
4867
|
} : function(o, u) {
|
|
4868
|
-
return
|
|
4868
|
+
return Le(u.entity.id, u.entity[i], o.entity.id, o.entity[i], r);
|
|
4869
4869
|
});
|
|
4870
4870
|
}
|
|
4871
4871
|
var pe;
|
|
@@ -4874,11 +4874,11 @@ var pe;
|
|
|
4874
4874
|
})(pe || (pe = {}));
|
|
4875
4875
|
class qu {
|
|
4876
4876
|
constructor(e, n, r, i, s, o) {
|
|
4877
|
-
this.callbacks = {}, this.idToHash = {}, this.trySend = e, this.config = r, this.log = i, this.createStore = s, this.getAttrs = o, this.subs = new
|
|
4877
|
+
this.callbacks = {}, this.idToHash = {}, this.trySend = e, this.config = r, this.log = i, this.createStore = s, this.getAttrs = o, this.subs = new Qt({
|
|
4878
4878
|
persister: n,
|
|
4879
4879
|
merge: Lu,
|
|
4880
4880
|
serialize: Uu,
|
|
4881
|
-
parse: (u, a) =>
|
|
4881
|
+
parse: (u, a) => xu(a, this.config.useDateObjects),
|
|
4882
4882
|
objectSize: (u) => {
|
|
4883
4883
|
var a;
|
|
4884
4884
|
return ((a = u.values) === null || a === void 0 ? void 0 : a.entities.length) || 0;
|
|
@@ -4898,7 +4898,7 @@ class qu {
|
|
|
4898
4898
|
this.subs.flush();
|
|
4899
4899
|
}
|
|
4900
4900
|
subscribe(e, n) {
|
|
4901
|
-
const r =
|
|
4901
|
+
const r = q(e);
|
|
4902
4902
|
return this.callbacks[r] = this.callbacks[r] || [], this.callbacks[r].push(n), this.initSubscription(e, r, n), (i) => {
|
|
4903
4903
|
this.unsubscribe(r, n, i == null ? void 0 : i.keepSubscription);
|
|
4904
4904
|
};
|
|
@@ -4914,7 +4914,7 @@ class qu {
|
|
|
4914
4914
|
}
|
|
4915
4915
|
}
|
|
4916
4916
|
sendStart(e) {
|
|
4917
|
-
this.trySend(
|
|
4917
|
+
this.trySend(N(), {
|
|
4918
4918
|
op: "start-sync",
|
|
4919
4919
|
q: e
|
|
4920
4920
|
});
|
|
@@ -4928,7 +4928,7 @@ class qu {
|
|
|
4928
4928
|
});
|
|
4929
4929
|
}
|
|
4930
4930
|
sendRemove(e, n) {
|
|
4931
|
-
this.trySend(
|
|
4931
|
+
this.trySend(N(), {
|
|
4932
4932
|
op: "remove-sync",
|
|
4933
4933
|
"subscription-id": e.subscriptionId,
|
|
4934
4934
|
"keep-subscription": n
|
|
@@ -4942,16 +4942,16 @@ class qu {
|
|
|
4942
4942
|
if (a && a.state && a.state.txId) {
|
|
4943
4943
|
this.sendResync(a, a.state, a.state.txId), !((i = a.values) === null || i === void 0) && i.entities && r && r({
|
|
4944
4944
|
type: pe.LoadFromStorage,
|
|
4945
|
-
data:
|
|
4945
|
+
data: rt(a, (s = a.values) === null || s === void 0 ? void 0 : s.entities)
|
|
4946
4946
|
});
|
|
4947
4947
|
return;
|
|
4948
4948
|
}
|
|
4949
|
-
const
|
|
4949
|
+
const d = Object.keys(e)[0], c = ((u = (o = e[d]) === null || o === void 0 ? void 0 : o.$) === null || u === void 0 ? void 0 : u.order) || { serverCreatedAt: "asc" }, [f, l] = Object.entries(c)[0];
|
|
4950
4950
|
this.subs.updateInPlace((p) => {
|
|
4951
4951
|
p[n] = {
|
|
4952
4952
|
query: e,
|
|
4953
4953
|
hash: n,
|
|
4954
|
-
table:
|
|
4954
|
+
table: d,
|
|
4955
4955
|
orderDirection: l,
|
|
4956
4956
|
orderField: f,
|
|
4957
4957
|
createdAt: Date.now(),
|
|
@@ -4970,7 +4970,7 @@ class qu {
|
|
|
4970
4970
|
});
|
|
4971
4971
|
}
|
|
4972
4972
|
onStartSyncOk(e) {
|
|
4973
|
-
const n = e["subscription-id"], r = e.q, i =
|
|
4973
|
+
const n = e["subscription-id"], r = e.q, i = q(r);
|
|
4974
4974
|
this.idToHash[n] = i, this.subs.updateInPlace((s) => {
|
|
4975
4975
|
const o = s[i];
|
|
4976
4976
|
if (!o)
|
|
@@ -5002,20 +5002,20 @@ class qu {
|
|
|
5002
5002
|
attrsStore: this.getAttrs()
|
|
5003
5003
|
};
|
|
5004
5004
|
u.values = a;
|
|
5005
|
-
const
|
|
5006
|
-
for (const
|
|
5007
|
-
const f = this.createStore(
|
|
5008
|
-
|
|
5005
|
+
const d = a.entities;
|
|
5006
|
+
for (const c of i) {
|
|
5007
|
+
const f = this.createStore(c), l = Ct(u, f, a.attrsStore);
|
|
5008
|
+
d.push({
|
|
5009
5009
|
store: f,
|
|
5010
5010
|
entity: l,
|
|
5011
5011
|
serverCreatedAt: hr(u, f, a.attrsStore, l.id)
|
|
5012
5012
|
}), o.push(l);
|
|
5013
5013
|
}
|
|
5014
|
-
this.subs.updateInPlace((
|
|
5015
|
-
|
|
5014
|
+
this.subs.updateInPlace((c) => {
|
|
5015
|
+
c[s] = u, c[s].updatedAt = Date.now();
|
|
5016
5016
|
}), u.values && this.notifyCbs(s, {
|
|
5017
5017
|
type: pe.InitialSyncBatch,
|
|
5018
|
-
data:
|
|
5018
|
+
data: rt(u, u.values.entities),
|
|
5019
5019
|
batch: o
|
|
5020
5020
|
});
|
|
5021
5021
|
}
|
|
@@ -5040,7 +5040,7 @@ class qu {
|
|
|
5040
5040
|
const s = this.subs.currentValue[i];
|
|
5041
5041
|
s && this.notifyCbs(i, {
|
|
5042
5042
|
type: pe.InitialSyncComplete,
|
|
5043
|
-
data:
|
|
5043
|
+
data: rt(s, ((n = s.values) === null || n === void 0 ? void 0 : n.entities) || [])
|
|
5044
5044
|
});
|
|
5045
5045
|
}
|
|
5046
5046
|
onSyncUpdateTriples(e) {
|
|
@@ -5060,14 +5060,14 @@ class qu {
|
|
|
5060
5060
|
this.log.error("Missing state for sub", u, e);
|
|
5061
5061
|
return;
|
|
5062
5062
|
}
|
|
5063
|
-
for (const
|
|
5064
|
-
if (a.txId && a.txId >=
|
|
5063
|
+
for (const d of e.txes) {
|
|
5064
|
+
if (a.txId && a.txId >= d["tx-id"])
|
|
5065
5065
|
continue;
|
|
5066
|
-
a.txId =
|
|
5067
|
-
const
|
|
5068
|
-
for (const
|
|
5069
|
-
const v = (n = f[
|
|
5070
|
-
f[
|
|
5066
|
+
a.txId = d["tx-id"];
|
|
5067
|
+
const c = [], f = {};
|
|
5068
|
+
for (const g of d.changes) {
|
|
5069
|
+
const v = (n = f[g.triple[0]]) !== null && n !== void 0 ? n : [];
|
|
5070
|
+
f[g.triple[0]] = v, v.push(g);
|
|
5071
5071
|
}
|
|
5072
5072
|
const l = (r = u.values) !== null && r !== void 0 ? r : {
|
|
5073
5073
|
entities: [],
|
|
@@ -5075,25 +5075,25 @@ class qu {
|
|
|
5075
5075
|
}, p = l.entities;
|
|
5076
5076
|
u.values = l;
|
|
5077
5077
|
const y = [];
|
|
5078
|
-
e: for (const [
|
|
5078
|
+
e: for (const [g, v] of Object.entries(f))
|
|
5079
5079
|
for (let A = 0; A < p.length; A++) {
|
|
5080
5080
|
const S = p[A];
|
|
5081
|
-
if (Ts(S.store,
|
|
5081
|
+
if (Ts(S.store, g)) {
|
|
5082
5082
|
pr(S.store, l.attrsStore, v);
|
|
5083
|
-
const
|
|
5084
|
-
|
|
5083
|
+
const C = Ct(u, S.store, l.attrsStore), $ = Fu(S.store, l.attrsStore, v)[g];
|
|
5084
|
+
C ? (y.push({
|
|
5085
5085
|
oldEntity: S.entity,
|
|
5086
|
-
newEntity:
|
|
5087
|
-
changedFields:
|
|
5088
|
-
}), S.entity =
|
|
5086
|
+
newEntity: C,
|
|
5087
|
+
changedFields: $ || {}
|
|
5088
|
+
}), S.entity = C) : c.push(A), delete f[g];
|
|
5089
5089
|
continue e;
|
|
5090
5090
|
}
|
|
5091
5091
|
}
|
|
5092
5092
|
const b = [];
|
|
5093
|
-
for (const [
|
|
5093
|
+
for (const [g, v] of Object.entries(f)) {
|
|
5094
5094
|
const A = this.createStore([]);
|
|
5095
5095
|
pr(A, l.attrsStore, v);
|
|
5096
|
-
const S =
|
|
5096
|
+
const S = Ct(u, A, l.attrsStore);
|
|
5097
5097
|
if (!S) {
|
|
5098
5098
|
this.log.error("No entity found after applying change", {
|
|
5099
5099
|
sub: u,
|
|
@@ -5108,20 +5108,20 @@ class qu {
|
|
|
5108
5108
|
serverCreatedAt: hr(u, A, l.attrsStore, S.id)
|
|
5109
5109
|
}), b.push(S);
|
|
5110
5110
|
}
|
|
5111
|
-
const
|
|
5112
|
-
for (const
|
|
5113
|
-
|
|
5111
|
+
const _ = [];
|
|
5112
|
+
for (const g of c.sort().reverse())
|
|
5113
|
+
_.push(p[g].entity), p.splice(g, 1);
|
|
5114
5114
|
const w = Nu(u, this.getAttrs);
|
|
5115
5115
|
Ku(u, w, p), this.notifyCbs(o, {
|
|
5116
5116
|
type: pe.SyncTransaction,
|
|
5117
|
-
data:
|
|
5117
|
+
data: rt(u, (i = u.values) === null || i === void 0 ? void 0 : i.entities),
|
|
5118
5118
|
added: b,
|
|
5119
|
-
removed:
|
|
5119
|
+
removed: _,
|
|
5120
5120
|
updated: y
|
|
5121
5121
|
});
|
|
5122
5122
|
}
|
|
5123
|
-
this.subs.updateInPlace((
|
|
5124
|
-
|
|
5123
|
+
this.subs.updateInPlace((d) => {
|
|
5124
|
+
d[o] = u, d[o].updatedAt = Date.now();
|
|
5125
5125
|
});
|
|
5126
5126
|
}
|
|
5127
5127
|
clearSubscriptionData(e, n) {
|
|
@@ -5136,7 +5136,7 @@ class qu {
|
|
|
5136
5136
|
}
|
|
5137
5137
|
}
|
|
5138
5138
|
onStartSyncError(e) {
|
|
5139
|
-
const n =
|
|
5139
|
+
const n = q(e["original-event"].q), r = {
|
|
5140
5140
|
message: e.message || "Uh-oh, something went wrong. Ping Joe & Stopa.",
|
|
5141
5141
|
status: e.status,
|
|
5142
5142
|
type: e.type,
|
|
@@ -5153,31 +5153,31 @@ class qu {
|
|
|
5153
5153
|
r && this.initSubscription(r.query, r.hash);
|
|
5154
5154
|
}
|
|
5155
5155
|
}
|
|
5156
|
-
var
|
|
5156
|
+
var L = function(t, e, n, r) {
|
|
5157
5157
|
function i(s) {
|
|
5158
5158
|
return s instanceof n ? s : new n(function(o) {
|
|
5159
5159
|
o(s);
|
|
5160
5160
|
});
|
|
5161
5161
|
}
|
|
5162
5162
|
return new (n || (n = Promise))(function(s, o) {
|
|
5163
|
-
function u(
|
|
5163
|
+
function u(c) {
|
|
5164
5164
|
try {
|
|
5165
|
-
|
|
5165
|
+
d(r.next(c));
|
|
5166
5166
|
} catch (f) {
|
|
5167
5167
|
o(f);
|
|
5168
5168
|
}
|
|
5169
5169
|
}
|
|
5170
|
-
function a(
|
|
5170
|
+
function a(c) {
|
|
5171
5171
|
try {
|
|
5172
|
-
|
|
5172
|
+
d(r.throw(c));
|
|
5173
5173
|
} catch (f) {
|
|
5174
5174
|
o(f);
|
|
5175
5175
|
}
|
|
5176
5176
|
}
|
|
5177
|
-
function c
|
|
5178
|
-
|
|
5177
|
+
function d(c) {
|
|
5178
|
+
c.done ? s(c.value) : i(c.value).then(u, a);
|
|
5179
5179
|
}
|
|
5180
|
-
|
|
5180
|
+
d((r = r.apply(t, e || [])).next());
|
|
5181
5181
|
});
|
|
5182
5182
|
}, ci = function(t, e) {
|
|
5183
5183
|
var n = {};
|
|
@@ -5193,23 +5193,23 @@ const oe = {
|
|
|
5193
5193
|
AUTHENTICATED: "authenticated",
|
|
5194
5194
|
CLOSED: "closed",
|
|
5195
5195
|
ERRORED: "errored"
|
|
5196
|
-
}, zu = 3e4, Vu = 3e4, Wu = 200,
|
|
5196
|
+
}, zu = 3e4, Vu = 3e4, Wu = 200, Bu = {
|
|
5197
5197
|
apiURI: "https://api.instantdb.com",
|
|
5198
5198
|
websocketURI: "wss://api.instantdb.com/runtime/session"
|
|
5199
|
-
},
|
|
5200
|
-
function
|
|
5199
|
+
}, It = "_instant_oauth_redirect", De = "currentUser";
|
|
5200
|
+
function Gu({ transportType: t, appId: e, apiURI: n, wsURI: r, EventSourceImpl: i }) {
|
|
5201
5201
|
if (!i)
|
|
5202
5202
|
return new fr(`${r}?app_id=${e}`);
|
|
5203
5203
|
switch (t) {
|
|
5204
5204
|
case "ws":
|
|
5205
5205
|
return new fr(`${r}?app_id=${e}`);
|
|
5206
5206
|
case "sse":
|
|
5207
|
-
return new
|
|
5207
|
+
return new Du(i, `${n}/runtime/sse?app_id=${e}`);
|
|
5208
5208
|
default:
|
|
5209
5209
|
throw new Error("Unknown transport type " + t);
|
|
5210
5210
|
}
|
|
5211
5211
|
}
|
|
5212
|
-
function
|
|
5212
|
+
function Qu() {
|
|
5213
5213
|
return typeof window < "u" || typeof chrome < "u";
|
|
5214
5214
|
}
|
|
5215
5215
|
const yr = {
|
|
@@ -5222,7 +5222,7 @@ function Hu(t, e) {
|
|
|
5222
5222
|
var n;
|
|
5223
5223
|
const r = typeof t == "string" ? JSON.parse(t) : t;
|
|
5224
5224
|
if (!((n = r == null ? void 0 : r.result) === null || n === void 0) && n.store) {
|
|
5225
|
-
const i =
|
|
5225
|
+
const i = Dr(r.result.attrsStore, r.result.store);
|
|
5226
5226
|
if (i) {
|
|
5227
5227
|
const s = r.result.store;
|
|
5228
5228
|
r.result.store = $r(i, Object.assign(Object.assign({}, s), { useDateObjects: e })), r.result.attrsStore = i;
|
|
@@ -5267,39 +5267,39 @@ function br(t) {
|
|
|
5267
5267
|
class ea {
|
|
5268
5268
|
constructor(e, n = Jr, r = Zr, i, s) {
|
|
5269
5269
|
var o, u, a;
|
|
5270
|
-
if (this._isOnline = !0, this._isShutdown = !1, this.status = oe.CONNECTING, this.queryCbs = {}, this.queryOnceDfds = {}, this.authCbs = [], this.attrsCbs = [], this.mutationErrorCbs = [], this.connectionStatusCbs = [], this.mutationDeferredStore = /* @__PURE__ */ new Map(), this._reconnectTimeoutId = null, this._reconnectTimeoutMs = 0, this._transportType = "ws", this._wsOk = null, this._localIdPromises = {}, this._errorMessage = null, this._oauthCallbackResponse = null, this._linkIndex = null, this._rooms = {}, this._roomsPendingLeave = {}, this._presence = {}, this._broadcastQueue = [], this._broadcastSubs = {}, this._currentUserCached = { isLoading: !0, error: void 0, user: void 0 }, this._beforeUnloadCbs = [], this._dataForQueryCache = {}, this._inFlightMutationEventIds = /* @__PURE__ */ new Set(), this._onMergeKv = (
|
|
5270
|
+
if (this._isOnline = !0, this._isShutdown = !1, this.status = oe.CONNECTING, this.queryCbs = {}, this.queryOnceDfds = {}, this.authCbs = [], this.attrsCbs = [], this.mutationErrorCbs = [], this.connectionStatusCbs = [], this.mutationDeferredStore = /* @__PURE__ */ new Map(), this._reconnectTimeoutId = null, this._reconnectTimeoutMs = 0, this._transportType = "ws", this._wsOk = null, this._localIdPromises = {}, this._errorMessage = null, this._oauthCallbackResponse = null, this._linkIndex = null, this._rooms = {}, this._roomsPendingLeave = {}, this._presence = {}, this._broadcastQueue = [], this._broadcastSubs = {}, this._currentUserCached = { isLoading: !0, error: void 0, user: void 0 }, this._beforeUnloadCbs = [], this._dataForQueryCache = {}, this._inFlightMutationEventIds = /* @__PURE__ */ new Set(), this._onMergeKv = (d, c, f) => {
|
|
5271
5271
|
var l, p;
|
|
5272
|
-
switch (
|
|
5272
|
+
switch (d) {
|
|
5273
5273
|
case "pendingMutations": {
|
|
5274
|
-
const y = (l =
|
|
5275
|
-
return (
|
|
5274
|
+
const y = (l = c == null ? void 0 : c.entries()) !== null && l !== void 0 ? l : [], b = (p = f == null ? void 0 : f.entries()) !== null && p !== void 0 ? p : [], _ = new Map([...y, ...b]);
|
|
5275
|
+
return (c ? this._rewriteMutationsSorted(this.attrs, c) : []).forEach(([g, v]) => {
|
|
5276
5276
|
var A;
|
|
5277
|
-
!(!((A = f == null ? void 0 : f.pendingMutations) === null || A === void 0) && A.has(
|
|
5278
|
-
}),
|
|
5277
|
+
!(!((A = f == null ? void 0 : f.pendingMutations) === null || A === void 0) && A.has(g)) && !v["tx-id"] && this._sendMutation(g, v);
|
|
5278
|
+
}), _;
|
|
5279
5279
|
}
|
|
5280
5280
|
default:
|
|
5281
|
-
return f ||
|
|
5281
|
+
return f || c;
|
|
5282
5282
|
}
|
|
5283
|
-
}, this.getPreviousResult = (
|
|
5284
|
-
var
|
|
5285
|
-
const f =
|
|
5286
|
-
return (
|
|
5287
|
-
}, this.notifyOne = (
|
|
5288
|
-
var
|
|
5289
|
-
const l = (
|
|
5290
|
-
y != null && y.data && (this._dataForQueryCache[
|
|
5291
|
-
}, this.notifyOneQueryOnce = (
|
|
5292
|
-
var
|
|
5293
|
-
const l = (
|
|
5283
|
+
}, this.getPreviousResult = (d) => {
|
|
5284
|
+
var c;
|
|
5285
|
+
const f = q(d);
|
|
5286
|
+
return (c = this.dataForQuery(f)) === null || c === void 0 ? void 0 : c.data;
|
|
5287
|
+
}, this.notifyOne = (d) => {
|
|
5288
|
+
var c, f;
|
|
5289
|
+
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);
|
|
5290
|
+
y != null && y.data && (this._dataForQueryCache[d] = y, !ut(y.data, p) && l.forEach((b) => b.cb(y.data)));
|
|
5291
|
+
}, this.notifyOneQueryOnce = (d) => {
|
|
5292
|
+
var c, f;
|
|
5293
|
+
const l = (c = this.queryOnceDfds[d]) !== null && c !== void 0 ? c : [], p = (f = this.dataForQuery(d)) === null || f === void 0 ? void 0 : f.data;
|
|
5294
5294
|
l.forEach((y) => {
|
|
5295
|
-
this._completeQueryOnce(y.q,
|
|
5295
|
+
this._completeQueryOnce(y.q, d, y.dfd), y.dfd.resolve(p);
|
|
5296
5296
|
});
|
|
5297
|
-
}, this.notifyQueryError = (
|
|
5298
|
-
(this.queryCbs[
|
|
5299
|
-
}, this.pushTx = (
|
|
5300
|
-
this.config.disableValidation || $u(
|
|
5297
|
+
}, this.notifyQueryError = (d, c) => {
|
|
5298
|
+
(this.queryCbs[d] || []).forEach((l) => l.cb({ error: c }));
|
|
5299
|
+
}, this.pushTx = (d) => {
|
|
5300
|
+
this.config.disableValidation || $u(d, this.config.schema);
|
|
5301
5301
|
try {
|
|
5302
|
-
const
|
|
5302
|
+
const c = nu({
|
|
5303
5303
|
attrsStore: this.optimisticAttrs(),
|
|
5304
5304
|
schema: this.config.schema,
|
|
5305
5305
|
stores: Object.values(this.querySubs.currentValue).map((f) => {
|
|
@@ -5307,33 +5307,33 @@ class ea {
|
|
|
5307
5307
|
return (l = f == null ? void 0 : f.result) === null || l === void 0 ? void 0 : l.store;
|
|
5308
5308
|
}),
|
|
5309
5309
|
useDateObjects: this.config.useDateObjects
|
|
5310
|
-
},
|
|
5311
|
-
return this.pushOps(
|
|
5312
|
-
} catch (
|
|
5313
|
-
return this.pushOps([],
|
|
5310
|
+
}, d);
|
|
5311
|
+
return this.pushOps(c);
|
|
5312
|
+
} catch (c) {
|
|
5313
|
+
return this.pushOps([], c);
|
|
5314
5314
|
}
|
|
5315
|
-
}, this.pushOps = (
|
|
5316
|
-
const f =
|
|
5315
|
+
}, this.pushOps = (d, c) => {
|
|
5316
|
+
const f = N(), l = [...this._pendingMutations().values()], p = Math.max(0, ...l.map((_) => _.order || 0)) + 1, y = {
|
|
5317
5317
|
op: "transact",
|
|
5318
|
-
"tx-steps":
|
|
5318
|
+
"tx-steps": d,
|
|
5319
5319
|
created: Date.now(),
|
|
5320
|
-
error:
|
|
5320
|
+
error: c,
|
|
5321
5321
|
order: p
|
|
5322
5322
|
};
|
|
5323
|
-
this._updatePendingMutations((
|
|
5324
|
-
|
|
5323
|
+
this._updatePendingMutations((_) => {
|
|
5324
|
+
_.set(f, y);
|
|
5325
5325
|
});
|
|
5326
5326
|
const b = new nr();
|
|
5327
5327
|
return this.mutationDeferredStore.set(f, b), this._sendMutation(f, y), this.notifyAll(), b.promise;
|
|
5328
|
-
}, this._transportOnOpen = (
|
|
5329
|
-
const
|
|
5330
|
-
if (this._transport !==
|
|
5331
|
-
this._log.info("[socket][open]",
|
|
5328
|
+
}, this._transportOnOpen = (d) => {
|
|
5329
|
+
const c = d.target;
|
|
5330
|
+
if (this._transport !== c) {
|
|
5331
|
+
this._log.info("[socket][open]", c.id, "skip; this is no longer the current transport");
|
|
5332
5332
|
return;
|
|
5333
5333
|
}
|
|
5334
5334
|
this._log.info("[socket][open]", this._transport.id), this._setStatus(oe.OPENED), this.getCurrentUser().then((f) => {
|
|
5335
5335
|
var l;
|
|
5336
|
-
this._trySend(
|
|
5336
|
+
this._trySend(N(), {
|
|
5337
5337
|
op: "init",
|
|
5338
5338
|
"app-id": this.config.appId,
|
|
5339
5339
|
"refresh-token": (l = f.user) === null || l === void 0 ? void 0 : l.refresh_token,
|
|
@@ -5346,26 +5346,26 @@ class ea {
|
|
|
5346
5346
|
"__admin-token": this.config.__adminToken
|
|
5347
5347
|
});
|
|
5348
5348
|
}).catch((f) => {
|
|
5349
|
-
this._log.error("[socket][error]",
|
|
5349
|
+
this._log.error("[socket][error]", c.id, f);
|
|
5350
5350
|
});
|
|
5351
|
-
}, this._transportOnMessage = (
|
|
5352
|
-
const
|
|
5353
|
-
if (this._transport !==
|
|
5354
|
-
this._log.info("[socket][message]",
|
|
5351
|
+
}, this._transportOnMessage = (d) => {
|
|
5352
|
+
const c = d.target, f = d.message;
|
|
5353
|
+
if (this._transport !== c) {
|
|
5354
|
+
this._log.info("[socket][message]", c.id, f, "skip; this is no longer the current transport");
|
|
5355
5355
|
return;
|
|
5356
5356
|
}
|
|
5357
|
-
if (!this._wsOk &&
|
|
5358
|
-
for (const l of
|
|
5359
|
-
this._handleReceive(
|
|
5357
|
+
if (!this._wsOk && c.type === "ws" && (this._wsOk = !0), this._transportType = "ws", Array.isArray(d.message))
|
|
5358
|
+
for (const l of d.message)
|
|
5359
|
+
this._handleReceive(c.id, l);
|
|
5360
5360
|
else
|
|
5361
|
-
this._handleReceive(
|
|
5362
|
-
}, this._transportOnError = (
|
|
5363
|
-
const
|
|
5364
|
-
if (this._transport !==
|
|
5365
|
-
this._log.info("[socket][error]",
|
|
5361
|
+
this._handleReceive(c.id, d.message);
|
|
5362
|
+
}, this._transportOnError = (d) => {
|
|
5363
|
+
const c = d.target;
|
|
5364
|
+
if (this._transport !== c) {
|
|
5365
|
+
this._log.info("[socket][error]", c.id, "skip; this is no longer the current transport");
|
|
5366
5366
|
return;
|
|
5367
5367
|
}
|
|
5368
|
-
this._log.error("[socket][error]",
|
|
5368
|
+
this._log.error("[socket][error]", c.id, d);
|
|
5369
5369
|
}, this._scheduleReconnect = () => {
|
|
5370
5370
|
!this._wsOk && this._transportType !== "sse" && (this._transportType = "sse", this._reconnectTimeoutMs = 0), setTimeout(() => {
|
|
5371
5371
|
if (this._reconnectTimeoutMs = Math.min(this._reconnectTimeoutMs + 1e3, 1e4), !this._isOnline) {
|
|
@@ -5374,29 +5374,29 @@ class ea {
|
|
|
5374
5374
|
}
|
|
5375
5375
|
this._startSocket();
|
|
5376
5376
|
}, this._reconnectTimeoutMs);
|
|
5377
|
-
}, this._transportOnClose = (
|
|
5378
|
-
const
|
|
5379
|
-
if (this._transport !==
|
|
5380
|
-
this._log.info("[socket][close]",
|
|
5377
|
+
}, this._transportOnClose = (d) => {
|
|
5378
|
+
const c = d.target;
|
|
5379
|
+
if (this._transport !== c) {
|
|
5380
|
+
this._log.info("[socket][close]", c.id, "skip; this is no longer the current transport");
|
|
5381
5381
|
return;
|
|
5382
5382
|
}
|
|
5383
5383
|
this._setStatus(oe.CLOSED);
|
|
5384
5384
|
for (const f of Object.values(this._rooms))
|
|
5385
5385
|
f.isConnected = !1;
|
|
5386
5386
|
if (this._isShutdown) {
|
|
5387
|
-
this._log.info("[socket][close]",
|
|
5387
|
+
this._log.info("[socket][close]", c.id, "Reactor has been shut down and will not reconnect");
|
|
5388
5388
|
return;
|
|
5389
5389
|
}
|
|
5390
|
-
this._log.info("[socket][close]",
|
|
5391
|
-
}, this._EventSource = s, this.config = Object.assign(Object.assign({},
|
|
5390
|
+
this._log.info("[socket][close]", c.id, "schedule reconnect, ms =", this._reconnectTimeoutMs), this._scheduleReconnect();
|
|
5391
|
+
}, this._EventSource = s, this.config = Object.assign(Object.assign({}, Bu), e), this.queryCacheLimit = (o = this.config.queryCacheLimit) !== null && o !== void 0 ? o : 10, this._pendingTxCleanupTimeout = (u = this.config.pendingTxCleanupTimeout) !== null && u !== void 0 ? u : Vu, this._pendingMutationCleanupThreshold = (a = this.config.pendingMutationCleanupThreshold) !== null && a !== void 0 ? a : Wu, this._log = Au(e.verbose || dn || Xr, () => this._reactorStats()), this.versions = Object.assign(Object.assign({}, i || {}), { "@instantdb/core": ni }), this.config.schema && (this._linkIndex = ir(this.config.schema)), !!Qu()) {
|
|
5392
5392
|
if (!e.appId)
|
|
5393
5393
|
throw new Error("Instant must be initialized with an appId.");
|
|
5394
5394
|
if (!Ee(e.appId))
|
|
5395
5395
|
throw new Error(`Instant must be initialized with a valid appId. \`${e.appId}\` is not a valid uuid.`);
|
|
5396
|
-
typeof BroadcastChannel == "function" && (this._broadcastChannel = new BroadcastChannel("@instantdb"), this._broadcastChannel.addEventListener("message", (
|
|
5397
|
-
var
|
|
5396
|
+
typeof BroadcastChannel == "function" && (this._broadcastChannel = new BroadcastChannel("@instantdb"), this._broadcastChannel.addEventListener("message", (d) => L(this, void 0, void 0, function* () {
|
|
5397
|
+
var c;
|
|
5398
5398
|
try {
|
|
5399
|
-
if (((
|
|
5399
|
+
if (((c = d.data) === null || c === void 0 ? void 0 : c.type) === "auth") {
|
|
5400
5400
|
const f = yield this.getCurrentUser();
|
|
5401
5401
|
this.updateUser(f.user);
|
|
5402
5402
|
}
|
|
@@ -5405,14 +5405,9 @@ class ea {
|
|
|
5405
5405
|
}
|
|
5406
5406
|
}))), this._initStorage(n), this._syncTable = new qu(this._trySendAuthed.bind(this), new n(this.config.appId, "syncSubs"), {
|
|
5407
5407
|
useDateObjects: this.config.useDateObjects
|
|
5408
|
-
}, this._log, (
|
|
5409
|
-
this.
|
|
5410
|
-
|
|
5411
|
-
const c = yield this.getCurrentUser();
|
|
5412
|
-
this.syncUserToEndpoint(c.user);
|
|
5413
|
-
}), 1e3 * 60 * 20), r.getIsOnline().then((c) => {
|
|
5414
|
-
this._isOnline = c, this._startSocket(), r.listen((d) => {
|
|
5415
|
-
d !== this._isOnline && (this._log.info("[network] online =", d), this._isOnline = d, this._isOnline ? this._startSocket() : (this._log.info("Changing status from", this.status, "to", oe.CLOSED), this._setStatus(oe.CLOSED)));
|
|
5408
|
+
}, this._log, (d) => at(this.ensureAttrs(), d, this.config.enableCardinalityInference, this.config.useDateObjects), () => this.ensureAttrs()), this._oauthCallbackResponse = this._oauthLoginInit(), this.getCurrentUser(), r.getIsOnline().then((d) => {
|
|
5409
|
+
this._isOnline = d, this._startSocket(), r.listen((c) => {
|
|
5410
|
+
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", oe.CLOSED), this._setStatus(oe.CLOSED)));
|
|
5416
5411
|
});
|
|
5417
5412
|
}), typeof addEventListener < "u" && (this._beforeUnload = this._beforeUnload.bind(this), addEventListener("beforeunload", this._beforeUnload));
|
|
5418
5413
|
}
|
|
@@ -5436,7 +5431,7 @@ class ea {
|
|
|
5436
5431
|
this.kv.waitForKeyToLoad("pendingMutations").then(() => this.notifyOne(e));
|
|
5437
5432
|
}
|
|
5438
5433
|
_initStorage(e) {
|
|
5439
|
-
this.querySubs = new
|
|
5434
|
+
this.querySubs = new Qt({
|
|
5440
5435
|
persister: new e(this.config.appId, "querySubs"),
|
|
5441
5436
|
merge: Xu,
|
|
5442
5437
|
serialize: Yu,
|
|
@@ -5456,7 +5451,7 @@ class ea {
|
|
|
5456
5451
|
maxSize: 1e6
|
|
5457
5452
|
// 1 million triples
|
|
5458
5453
|
}
|
|
5459
|
-
}), this.querySubs.onKeyLoaded = (n) => this._onQuerySubLoaded(n), this.kv = new
|
|
5454
|
+
}), this.querySubs.onKeyLoaded = (n) => this._onQuerySubLoaded(n), this.kv = new Qt({
|
|
5460
5455
|
persister: new e(this.config.appId, "kv"),
|
|
5461
5456
|
merge: this._onMergeKv,
|
|
5462
5457
|
serialize: Zu,
|
|
@@ -5469,7 +5464,7 @@ class ea {
|
|
|
5469
5464
|
gc: null
|
|
5470
5465
|
}), this.kv.onKeyLoaded = (n) => {
|
|
5471
5466
|
n === "pendingMutations" && this.notifyAll();
|
|
5472
|
-
}, this.kv.waitForKeyToLoad("pendingMutations"), this.kv.waitForKeyToLoad(
|
|
5467
|
+
}, this.kv.waitForKeyToLoad("pendingMutations"), this.kv.waitForKeyToLoad(De), this._beforeUnloadCbs.push(() => {
|
|
5473
5468
|
this.kv.flush(), this.querySubs.flush();
|
|
5474
5469
|
});
|
|
5475
5470
|
}
|
|
@@ -5508,37 +5503,13 @@ class ea {
|
|
|
5508
5503
|
const i = (r = (n = this._presence[e]) === null || n === void 0 ? void 0 : n.result) === null || r === void 0 ? void 0 : r.user, s = this._broadcastQueue[e];
|
|
5509
5504
|
if (this._broadcastQueue[e] = [], i && this._trySetPresence(e, i), s)
|
|
5510
5505
|
for (const o of s) {
|
|
5511
|
-
const { topic: u, roomType: a, data:
|
|
5512
|
-
this._tryBroadcast(e, a, u,
|
|
5506
|
+
const { topic: u, roomType: a, data: d } = o;
|
|
5507
|
+
this._tryBroadcast(e, a, u, d);
|
|
5513
5508
|
}
|
|
5514
5509
|
}
|
|
5515
|
-
/**
|
|
5516
|
-
* Does the same thing as add-query-ok
|
|
5517
|
-
* but called as a result of receiving query info from ssr
|
|
5518
|
-
* @param {any} q
|
|
5519
|
-
* @param {{ triples: any; pageInfo: any; }} result
|
|
5520
|
-
* @param {boolean} enableCardinalityInference
|
|
5521
|
-
*/
|
|
5522
|
-
_addQueryData(e, n, r) {
|
|
5523
|
-
if (!this.attrs)
|
|
5524
|
-
throw new Error("Attrs in reactor have not been set");
|
|
5525
|
-
const i = N(e), s = this.ensureAttrs(), o = Le(this.attrs, n.triples, r, this.config.useDateObjects);
|
|
5526
|
-
this.querySubs.updateInPlace((u) => {
|
|
5527
|
-
u[i] = {
|
|
5528
|
-
result: {
|
|
5529
|
-
store: o,
|
|
5530
|
-
attrsStore: s,
|
|
5531
|
-
pageInfo: n.pageInfo,
|
|
5532
|
-
processedTxId: void 0,
|
|
5533
|
-
isExternal: !0
|
|
5534
|
-
},
|
|
5535
|
-
q: e
|
|
5536
|
-
};
|
|
5537
|
-
}), this._cleanupPendingMutationsQueries(), this.notifyOne(i), this.notifyOneQueryOnce(i), this._cleanupPendingMutationsTimeout();
|
|
5538
|
-
}
|
|
5539
5510
|
_handleReceive(e, n) {
|
|
5540
5511
|
var r, i, s, o, u, a;
|
|
5541
|
-
const
|
|
5512
|
+
const d = !!this.config.schema && ("cardinalityInference" in this.config ? !!this.config.cardinalityInference : !0);
|
|
5542
5513
|
switch (yr[n.op] || this._log.info("[receive]", e, n.op, n), n.op) {
|
|
5543
5514
|
case "init-ok": {
|
|
5544
5515
|
this._setStatus(oe.AUTHENTICATED), this._reconnectTimeoutMs = 0, this._setAttrs(n.attrs), this._flushPendingMessages(), this._sessionId = n["session-id"];
|
|
@@ -5549,14 +5520,14 @@ class ea {
|
|
|
5549
5520
|
break;
|
|
5550
5521
|
}
|
|
5551
5522
|
case "add-query-exists": {
|
|
5552
|
-
this.notifyOneQueryOnce(
|
|
5523
|
+
this.notifyOneQueryOnce(q(n.q));
|
|
5553
5524
|
break;
|
|
5554
5525
|
}
|
|
5555
5526
|
case "add-query-ok": {
|
|
5556
|
-
const { q: l, result: p } = n, y =
|
|
5527
|
+
const { q: l, result: p } = n, y = q(l);
|
|
5557
5528
|
if (!this._hasQueryListeners() && !this.querySubs.currentValue[y])
|
|
5558
5529
|
break;
|
|
5559
|
-
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"],
|
|
5530
|
+
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"], _ = (a = (u = p == null ? void 0 : p[0]) === null || u === void 0 ? void 0 : u.data) === null || a === void 0 ? void 0 : a.aggregate, w = rr(p), g = this.ensureAttrs(), v = at(g, w, d, this.config.useDateObjects);
|
|
5560
5531
|
this.querySubs.updateInPlace((A) => {
|
|
5561
5532
|
if (!A[y]) {
|
|
5562
5533
|
this._log.info("Missing value in querySubs", { hash: y, q: l });
|
|
@@ -5564,9 +5535,9 @@ class ea {
|
|
|
5564
5535
|
}
|
|
5565
5536
|
A[y].result = {
|
|
5566
5537
|
store: v,
|
|
5567
|
-
attrsStore:
|
|
5538
|
+
attrsStore: g,
|
|
5568
5539
|
pageInfo: b,
|
|
5569
|
-
aggregate:
|
|
5540
|
+
aggregate: _,
|
|
5570
5541
|
processedTxId: n["processed-tx-id"]
|
|
5571
5542
|
};
|
|
5572
5543
|
}), this._cleanupPendingMutationsQueries(), this.notifyOne(y), this.notifyOneQueryOnce(y), this._cleanupPendingMutationsTimeout();
|
|
@@ -5592,37 +5563,37 @@ class ea {
|
|
|
5592
5563
|
const { computations: l, attrs: p } = n, y = n["processed-tx-id"];
|
|
5593
5564
|
p && this._setAttrs(p), this._cleanupPendingMutationsTimeout();
|
|
5594
5565
|
const b = this._rewriteMutations(this.ensureAttrs(), this._pendingMutations(), y);
|
|
5595
|
-
b !== this._pendingMutations() && this.kv.updateInPlace((
|
|
5596
|
-
|
|
5566
|
+
b !== this._pendingMutations() && this.kv.updateInPlace((g) => {
|
|
5567
|
+
g.pendingMutations = b;
|
|
5597
5568
|
});
|
|
5598
|
-
const
|
|
5599
|
-
var v, A, S,
|
|
5600
|
-
const
|
|
5569
|
+
const _ = br(b.entries()), w = l.map((g) => {
|
|
5570
|
+
var v, A, S, C;
|
|
5571
|
+
const $ = g["instaql-query"], R = g["instaql-result"], Pe = q($), Ge = rr(R), Qe = this.ensureAttrs(), _t = at(Qe, Ge, d, this.config.useDateObjects), { store: He, attrsStore: ne } = this._applyOptimisticUpdates(_t, Qe, _, y), se = (A = (v = R == null ? void 0 : R[0]) === null || v === void 0 ? void 0 : v.data) === null || A === void 0 ? void 0 : A["page-info"], le = (C = (S = R == null ? void 0 : R[0]) === null || S === void 0 ? void 0 : S.data) === null || C === void 0 ? void 0 : C.aggregate;
|
|
5601
5572
|
return {
|
|
5602
|
-
q:
|
|
5573
|
+
q: $,
|
|
5603
5574
|
hash: Pe,
|
|
5604
|
-
store:
|
|
5575
|
+
store: He,
|
|
5605
5576
|
attrsStore: ne,
|
|
5606
5577
|
pageInfo: se,
|
|
5607
5578
|
aggregate: le
|
|
5608
5579
|
};
|
|
5609
5580
|
});
|
|
5610
|
-
w.forEach(({ hash:
|
|
5581
|
+
w.forEach(({ hash: g, q: v, store: A, attrsStore: S, pageInfo: C, aggregate: $ }) => {
|
|
5611
5582
|
this.querySubs.updateInPlace((R) => {
|
|
5612
|
-
if (!R[
|
|
5613
|
-
this._log.error("Missing value in querySubs", { hash:
|
|
5583
|
+
if (!R[g]) {
|
|
5584
|
+
this._log.error("Missing value in querySubs", { hash: g, q: v });
|
|
5614
5585
|
return;
|
|
5615
5586
|
}
|
|
5616
|
-
R[
|
|
5587
|
+
R[g].result = {
|
|
5617
5588
|
store: A,
|
|
5618
5589
|
attrsStore: S,
|
|
5619
|
-
pageInfo:
|
|
5620
|
-
aggregate:
|
|
5590
|
+
pageInfo: C,
|
|
5591
|
+
aggregate: $,
|
|
5621
5592
|
processedTxId: y
|
|
5622
5593
|
};
|
|
5623
5594
|
});
|
|
5624
|
-
}), this._cleanupPendingMutationsQueries(), w.forEach(({ hash:
|
|
5625
|
-
this.notifyOne(
|
|
5595
|
+
}), this._cleanupPendingMutationsQueries(), w.forEach(({ hash: g }) => {
|
|
5596
|
+
this.notifyOne(g);
|
|
5626
5597
|
});
|
|
5627
5598
|
break;
|
|
5628
5599
|
}
|
|
@@ -5635,15 +5606,15 @@ class ea {
|
|
|
5635
5606
|
this._updatePendingMutations((w) => {
|
|
5636
5607
|
w.set(l, Object.assign(Object.assign({}, w.get(l)), { "tx-id": p, confirmed: Date.now() }));
|
|
5637
5608
|
});
|
|
5638
|
-
const
|
|
5609
|
+
const _ = [];
|
|
5639
5610
|
for (const w of b["tx-steps"])
|
|
5640
5611
|
if (w[0] === "add-attr") {
|
|
5641
|
-
const
|
|
5642
|
-
|
|
5612
|
+
const g = w[1];
|
|
5613
|
+
_.push(g);
|
|
5643
5614
|
}
|
|
5644
|
-
if (
|
|
5615
|
+
if (_.length) {
|
|
5645
5616
|
const w = Object.values(this.ensureAttrs().attrs);
|
|
5646
|
-
this._setAttrs([...w, ...
|
|
5617
|
+
this._setAttrs([...w, ..._]);
|
|
5647
5618
|
}
|
|
5648
5619
|
this._finishTransaction("synced", l), this._cleanupPendingMutationsTimeout();
|
|
5649
5620
|
break;
|
|
@@ -5678,8 +5649,8 @@ class ea {
|
|
|
5678
5649
|
break;
|
|
5679
5650
|
}
|
|
5680
5651
|
case "join-room-error":
|
|
5681
|
-
const
|
|
5682
|
-
f && (f.error = n.error), this._notifyPresenceSubs(
|
|
5652
|
+
const c = n["room-id"], f = this._rooms[c];
|
|
5653
|
+
f && (f.error = n.error), this._notifyPresenceSubs(c);
|
|
5683
5654
|
break;
|
|
5684
5655
|
case "error":
|
|
5685
5656
|
this._handleReceiveError(n);
|
|
@@ -5719,18 +5690,18 @@ class ea {
|
|
|
5719
5690
|
_handleReceiveError(e) {
|
|
5720
5691
|
var n, r, i, s, o, u, a;
|
|
5721
5692
|
console.log("error", e);
|
|
5722
|
-
const
|
|
5723
|
-
this._inFlightMutationEventIds.delete(
|
|
5724
|
-
const
|
|
5693
|
+
const d = e["client-event-id"];
|
|
5694
|
+
this._inFlightMutationEventIds.delete(d);
|
|
5695
|
+
const c = this._pendingMutations().get(d), f = {
|
|
5725
5696
|
message: e.message || "Uh-oh, something went wrong. Ping Joe & Stopa."
|
|
5726
5697
|
};
|
|
5727
|
-
if (e.hint && (f.hint = e.hint),
|
|
5728
|
-
this._handleMutationError("error",
|
|
5698
|
+
if (e.hint && (f.hint = e.hint), c) {
|
|
5699
|
+
this._handleMutationError("error", d, e);
|
|
5729
5700
|
return;
|
|
5730
5701
|
}
|
|
5731
5702
|
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") {
|
|
5732
|
-
const y = (i = e["original-event"]) === null || i === void 0 ? void 0 : i.q, b =
|
|
5733
|
-
this.notifyQueryError(
|
|
5703
|
+
const y = (i = e["original-event"]) === null || i === void 0 ? void 0 : i.q, b = q(y);
|
|
5704
|
+
this.notifyQueryError(q(y), f), this.notifyQueryOnceError(y, b, d, f);
|
|
5734
5705
|
return;
|
|
5735
5706
|
}
|
|
5736
5707
|
if (((s = e["original-event"]) === null || s === void 0 ? void 0 : s.op) === "init") {
|
|
@@ -5762,7 +5733,7 @@ class ea {
|
|
|
5762
5733
|
this.attrs = new _e(e.reduce((n, r) => (n[r.id] = r, n), {}), this._linkIndex), this.notifyAttrsSubs();
|
|
5763
5734
|
}
|
|
5764
5735
|
_startQuerySub(e, n) {
|
|
5765
|
-
const r =
|
|
5736
|
+
const r = N();
|
|
5766
5737
|
return this.querySubs.updateInPlace((i) => {
|
|
5767
5738
|
i[n] = i[n] || { q: e, result: null, eventId: r }, i[n].lastAccessed = Date.now();
|
|
5768
5739
|
}), this._trySendAuthed(r, { op: "add-query", q: e }), r;
|
|
@@ -5783,7 +5754,7 @@ class ea {
|
|
|
5783
5754
|
subscribeQuery(e, n, r) {
|
|
5784
5755
|
var i;
|
|
5785
5756
|
this.config.disableValidation || or(e, this.config.schema), r && "ruleParams" in r && (e = Object.assign({ $$ruleParams: r.ruleParams }, e));
|
|
5786
|
-
const s =
|
|
5757
|
+
const s = q(e), o = this.getPreviousResult(e);
|
|
5787
5758
|
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), () => {
|
|
5788
5759
|
this._unsubQuery(e, s, n);
|
|
5789
5760
|
};
|
|
@@ -5796,7 +5767,7 @@ class ea {
|
|
|
5796
5767
|
return i.reject(new Error("We can't run `queryOnce`, because the device is offline.")), i.promise;
|
|
5797
5768
|
if (!this.querySubs)
|
|
5798
5769
|
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;
|
|
5799
|
-
const s =
|
|
5770
|
+
const s = q(e), o = this._startQuerySub(e, s);
|
|
5800
5771
|
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")), zu), i.promise;
|
|
5801
5772
|
}
|
|
5802
5773
|
_completeQueryOnce(e, n, r) {
|
|
@@ -5810,7 +5781,7 @@ class ea {
|
|
|
5810
5781
|
return !!(!((n = this.queryCbs[e]) === null || n === void 0) && n.length || !((r = this.queryOnceDfds[e]) === null || r === void 0) && r.length);
|
|
5811
5782
|
}
|
|
5812
5783
|
_cleanupQuery(e, n) {
|
|
5813
|
-
this._hasQueryListeners(n) || (delete this.queryCbs[n], delete this.queryOnceDfds[n], delete this._dataForQueryCache[n], this.querySubs.unloadKey(n), this._trySendAuthed(
|
|
5784
|
+
this._hasQueryListeners(n) || (delete this.queryCbs[n], delete this.queryOnceDfds[n], delete this._dataForQueryCache[n], this.querySubs.unloadKey(n), this._trySendAuthed(N(), { op: "remove-query", q: e }));
|
|
5814
5785
|
}
|
|
5815
5786
|
// When we `pushTx`, it's possible that we don't yet have `this.attrs`
|
|
5816
5787
|
// This means that `tx-steps` in `pendingMutations` will include `add-attr`
|
|
@@ -5834,22 +5805,22 @@ class ea {
|
|
|
5834
5805
|
return n;
|
|
5835
5806
|
if (!n)
|
|
5836
5807
|
return /* @__PURE__ */ new Map();
|
|
5837
|
-
const i = (
|
|
5838
|
-
const [f, l, p] =
|
|
5808
|
+
const i = (c) => {
|
|
5809
|
+
const [f, l, p] = c["forward-identity"];
|
|
5839
5810
|
return F(e, l, p);
|
|
5840
|
-
}, s = (
|
|
5841
|
-
const [f, l, p] =
|
|
5811
|
+
}, s = (c) => {
|
|
5812
|
+
const [f, l, p] = c["forward-identity"];
|
|
5842
5813
|
return me(e, l, p);
|
|
5843
5814
|
}, o = { attrIdMap: {}, refSwapAttrIds: /* @__PURE__ */ new Set() };
|
|
5844
5815
|
let u = !1;
|
|
5845
|
-
const a = (
|
|
5816
|
+
const a = (c, f) => {
|
|
5846
5817
|
const l = [];
|
|
5847
|
-
for (const p of
|
|
5818
|
+
for (const p of c) {
|
|
5848
5819
|
const [y] = p;
|
|
5849
5820
|
if (y === "add-attr") {
|
|
5850
|
-
const [
|
|
5851
|
-
if (
|
|
5852
|
-
o.attrIdMap[w.id] =
|
|
5821
|
+
const [_, w] = p, g = i(w);
|
|
5822
|
+
if (g && w.id !== g.id) {
|
|
5823
|
+
o.attrIdMap[w.id] = g.id, u = !0;
|
|
5853
5824
|
continue;
|
|
5854
5825
|
}
|
|
5855
5826
|
if (w["value-type"] === "ref") {
|
|
@@ -5867,11 +5838,11 @@ class ea {
|
|
|
5867
5838
|
const b = u ? Po(o, p) : p;
|
|
5868
5839
|
l.push(b);
|
|
5869
5840
|
}
|
|
5870
|
-
return u ? l :
|
|
5871
|
-
},
|
|
5872
|
-
for (const [
|
|
5873
|
-
|
|
5874
|
-
return u ?
|
|
5841
|
+
return u ? l : c;
|
|
5842
|
+
}, d = /* @__PURE__ */ new Map();
|
|
5843
|
+
for (const [c, f] of n.entries())
|
|
5844
|
+
d.set(c, Object.assign(Object.assign({}, f), { "tx-steps": a(f["tx-steps"], f["tx-id"]) }));
|
|
5845
|
+
return u ? d : n;
|
|
5875
5846
|
}
|
|
5876
5847
|
_rewriteMutationsSorted(e, n) {
|
|
5877
5848
|
return br(this._rewriteMutations(e, n).entries());
|
|
@@ -5888,8 +5859,8 @@ class ea {
|
|
|
5888
5859
|
if (u === "add-attr")
|
|
5889
5860
|
s.push(a);
|
|
5890
5861
|
else if (u === "update-attr" && a.id && (!((e = this.attrs) === null || e === void 0) && e.getAttr(a.id))) {
|
|
5891
|
-
const
|
|
5892
|
-
s.push(
|
|
5862
|
+
const d = Object.assign(Object.assign({}, this.attrs.getAttr(a.id)), a);
|
|
5863
|
+
s.push(d);
|
|
5893
5864
|
}
|
|
5894
5865
|
if (!i.size && !s.length)
|
|
5895
5866
|
return this.attrs || new _e({}, this._linkIndex);
|
|
@@ -5901,25 +5872,20 @@ class ea {
|
|
|
5901
5872
|
return new _e(o, this._linkIndex);
|
|
5902
5873
|
}
|
|
5903
5874
|
/** Runs instaql on a query and a store */
|
|
5904
|
-
dataForQuery(e
|
|
5905
|
-
const
|
|
5906
|
-
if (
|
|
5907
|
-
return { error:
|
|
5875
|
+
dataForQuery(e) {
|
|
5876
|
+
const n = this._errorMessage;
|
|
5877
|
+
if (n)
|
|
5878
|
+
return { error: n };
|
|
5908
5879
|
if (!this.querySubs || !this.kv.currentValue.pendingMutations)
|
|
5909
5880
|
return;
|
|
5910
|
-
const
|
|
5911
|
-
if (!
|
|
5881
|
+
const r = this.querySubs.version(), i = this.querySubs.currentValue, s = this.kv.version(), o = this._pendingMutations(), { q: u, result: a } = i[e] || {};
|
|
5882
|
+
if (!a)
|
|
5912
5883
|
return;
|
|
5913
5884
|
const d = this._dataForQueryCache[e];
|
|
5914
|
-
if (d &&
|
|
5885
|
+
if (d && r === d.querySubVersion && s === d.pendingMutationsVersion)
|
|
5915
5886
|
return d;
|
|
5916
|
-
|
|
5917
|
-
|
|
5918
|
-
if (n) {
|
|
5919
|
-
const _ = this._applyOptimisticUpdates(f, l, g, b);
|
|
5920
|
-
f = _.store, l = _.attrsStore;
|
|
5921
|
-
}
|
|
5922
|
-
return { data: Br({ store: f, attrsStore: l, pageInfo: p, aggregate: y }, a), querySubVersion: i, pendingMutationsVersion: o };
|
|
5887
|
+
const { store: c, attrsStore: f, pageInfo: l, aggregate: p, processedTxId: y } = a, b = this._rewriteMutationsSorted(f, o), { store: _, attrsStore: w } = this._applyOptimisticUpdates(c, f, b, y);
|
|
5888
|
+
return { data: Gr({ store: _, attrsStore: w, pageInfo: l, aggregate: p }, u), querySubVersion: r, pendingMutationsVersion: s };
|
|
5923
5889
|
}
|
|
5924
5890
|
_applyOptimisticUpdates(e, n, r, i) {
|
|
5925
5891
|
for (const [s, o] of r)
|
|
@@ -6035,7 +6001,7 @@ class ea {
|
|
|
6035
6001
|
return;
|
|
6036
6002
|
}
|
|
6037
6003
|
const e = this._transport;
|
|
6038
|
-
this._transport =
|
|
6004
|
+
this._transport = Gu({
|
|
6039
6005
|
transportType: this._transportType,
|
|
6040
6006
|
appId: this.config.appId,
|
|
6041
6007
|
apiURI: this.config.apiURI,
|
|
@@ -6052,14 +6018,14 @@ class ea {
|
|
|
6052
6018
|
*
|
|
6053
6019
|
*/
|
|
6054
6020
|
getLocalId(e) {
|
|
6055
|
-
return
|
|
6021
|
+
return L(this, void 0, void 0, function* () {
|
|
6056
6022
|
const n = `localToken_${e}`;
|
|
6057
6023
|
if (this.kv.currentValue[n])
|
|
6058
6024
|
return this.kv.currentValue[n];
|
|
6059
6025
|
const r = yield this.kv.waitForKeyToLoad(n);
|
|
6060
6026
|
if (r)
|
|
6061
6027
|
return r;
|
|
6062
|
-
const i =
|
|
6028
|
+
const i = N();
|
|
6063
6029
|
return this.kv.updateInPlace((s) => {
|
|
6064
6030
|
s[n] || (s[n] = i);
|
|
6065
6031
|
}), yield this.kv.waitForKeyToLoad(n);
|
|
@@ -6071,9 +6037,9 @@ class ea {
|
|
|
6071
6037
|
if (typeof URL > "u")
|
|
6072
6038
|
return;
|
|
6073
6039
|
const e = new URL(window.location.href);
|
|
6074
|
-
if (e.searchParams.get(
|
|
6040
|
+
if (e.searchParams.get(It)) {
|
|
6075
6041
|
const n = e.toString();
|
|
6076
|
-
e.searchParams.delete(
|
|
6042
|
+
e.searchParams.delete(It), e.searchParams.delete("code"), e.searchParams.delete("error");
|
|
6077
6043
|
const r = e.pathname + (e.searchParams.size ? "?" + e.searchParams : "") + e.hash;
|
|
6078
6044
|
if (history.replaceState(history.state, "", r), // @ts-ignore (waiting for ts support)
|
|
6079
6045
|
typeof navigation == "object" && // @ts-ignore (waiting for ts support)
|
|
@@ -6093,12 +6059,12 @@ class ea {
|
|
|
6093
6059
|
* @returns Promise<null | {error: {message: string}}>
|
|
6094
6060
|
*/
|
|
6095
6061
|
_oauthLoginInit() {
|
|
6096
|
-
return
|
|
6062
|
+
return L(this, void 0, void 0, function* () {
|
|
6097
6063
|
var e, n, r, i;
|
|
6098
6064
|
if (typeof window > "u" || typeof window.location > "u" || typeof URLSearchParams > "u")
|
|
6099
6065
|
return null;
|
|
6100
6066
|
const s = new URLSearchParams(window.location.search);
|
|
6101
|
-
if (!s.get(
|
|
6067
|
+
if (!s.get(It))
|
|
6102
6068
|
return null;
|
|
6103
6069
|
const o = s.get("error");
|
|
6104
6070
|
if (o)
|
|
@@ -6108,20 +6074,20 @@ class ea {
|
|
|
6108
6074
|
return null;
|
|
6109
6075
|
this._replaceUrlAfterOAuth();
|
|
6110
6076
|
try {
|
|
6111
|
-
const a = yield this._getCurrentUser(),
|
|
6077
|
+
const a = yield this._getCurrentUser(), d = (a == null ? void 0 : a.type) === "guest", { user: c } = yield er({
|
|
6112
6078
|
apiURI: this.config.apiURI,
|
|
6113
6079
|
appId: this.config.appId,
|
|
6114
6080
|
code: u,
|
|
6115
|
-
refreshToken:
|
|
6081
|
+
refreshToken: d ? a.refresh_token : void 0
|
|
6116
6082
|
});
|
|
6117
|
-
return this.setCurrentUser(
|
|
6083
|
+
return this.setCurrentUser(c), null;
|
|
6118
6084
|
} catch (a) {
|
|
6119
6085
|
return ((e = a == null ? void 0 : a.body) === null || e === void 0 ? void 0 : e.type) === "record-not-found" && ((r = (n = a == null ? void 0 : a.body) === null || n === void 0 ? void 0 : n.hint) === null || r === void 0 ? void 0 : r["record-type"]) === "app-oauth-code" && (yield this._hasCurrentUser()) ? null : { error: { message: ((i = a == null ? void 0 : a.body) === null || i === void 0 ? void 0 : i.message) || "Error logging in." } };
|
|
6120
6086
|
}
|
|
6121
6087
|
});
|
|
6122
6088
|
}
|
|
6123
6089
|
_waitForOAuthCallbackResponse() {
|
|
6124
|
-
return
|
|
6090
|
+
return L(this, void 0, void 0, function* () {
|
|
6125
6091
|
return yield this._oauthCallbackResponse;
|
|
6126
6092
|
});
|
|
6127
6093
|
}
|
|
@@ -6136,13 +6102,13 @@ class ea {
|
|
|
6136
6102
|
n.isLoading || e(this._currentUserCached);
|
|
6137
6103
|
let r = !1;
|
|
6138
6104
|
return this.getCurrentUser().then((i) => {
|
|
6139
|
-
r ||
|
|
6105
|
+
r || ut(i, n) || e(i);
|
|
6140
6106
|
}), () => {
|
|
6141
6107
|
r = !0, this.authCbs = this.authCbs.filter((i) => i !== e);
|
|
6142
6108
|
};
|
|
6143
6109
|
}
|
|
6144
6110
|
getAuth() {
|
|
6145
|
-
return
|
|
6111
|
+
return L(this, void 0, void 0, function* () {
|
|
6146
6112
|
const { user: e, error: n } = yield this.getCurrentUser();
|
|
6147
6113
|
if (n)
|
|
6148
6114
|
throw new je("Could not get current user: " + n.message);
|
|
@@ -6175,23 +6141,23 @@ class ea {
|
|
|
6175
6141
|
this.connectionStatusCbs.forEach((n) => n(e));
|
|
6176
6142
|
}
|
|
6177
6143
|
setCurrentUser(e) {
|
|
6178
|
-
return
|
|
6144
|
+
return L(this, void 0, void 0, function* () {
|
|
6179
6145
|
this.kv.updateInPlace((n) => {
|
|
6180
|
-
n[
|
|
6181
|
-
}), yield this.kv.waitForKeyToLoad(
|
|
6146
|
+
n[De] = e;
|
|
6147
|
+
}), yield this.kv.waitForKeyToLoad(De);
|
|
6182
6148
|
});
|
|
6183
6149
|
}
|
|
6184
6150
|
getCurrentUserCached() {
|
|
6185
6151
|
return this._currentUserCached;
|
|
6186
6152
|
}
|
|
6187
6153
|
_getCurrentUser() {
|
|
6188
|
-
return
|
|
6189
|
-
const e = yield this.kv.waitForKeyToLoad(
|
|
6154
|
+
return L(this, void 0, void 0, function* () {
|
|
6155
|
+
const e = yield this.kv.waitForKeyToLoad(De);
|
|
6190
6156
|
return typeof e == "string" ? JSON.parse(e) : e;
|
|
6191
6157
|
});
|
|
6192
6158
|
}
|
|
6193
6159
|
getCurrentUser() {
|
|
6194
|
-
return
|
|
6160
|
+
return L(this, void 0, void 0, function* () {
|
|
6195
6161
|
const e = yield this._waitForOAuthCallbackResponse();
|
|
6196
6162
|
if (e != null && e.error) {
|
|
6197
6163
|
const n = { error: e.error, user: void 0 };
|
|
@@ -6210,16 +6176,16 @@ class ea {
|
|
|
6210
6176
|
});
|
|
6211
6177
|
}
|
|
6212
6178
|
_hasCurrentUser() {
|
|
6213
|
-
return
|
|
6214
|
-
const e = yield this.kv.waitForKeyToLoad(
|
|
6179
|
+
return L(this, void 0, void 0, function* () {
|
|
6180
|
+
const e = yield this.kv.waitForKeyToLoad(De);
|
|
6215
6181
|
return typeof e == "string" ? JSON.parse(e) != null : e != null;
|
|
6216
6182
|
});
|
|
6217
6183
|
}
|
|
6218
6184
|
changeCurrentUser(e) {
|
|
6219
|
-
return
|
|
6185
|
+
return L(this, void 0, void 0, function* () {
|
|
6220
6186
|
var n;
|
|
6221
6187
|
const { user: r } = yield this.getCurrentUser();
|
|
6222
|
-
if (!
|
|
6188
|
+
if (!ut(r, e)) {
|
|
6223
6189
|
yield this.setCurrentUser(e), this.updateUser(e);
|
|
6224
6190
|
try {
|
|
6225
6191
|
(n = this._broadcastChannel) === null || n === void 0 || n.postMessage({ type: "auth" });
|
|
@@ -6229,28 +6195,7 @@ class ea {
|
|
|
6229
6195
|
}
|
|
6230
6196
|
});
|
|
6231
6197
|
}
|
|
6232
|
-
syncUserToEndpoint(e) {
|
|
6233
|
-
return $(this, void 0, void 0, function* () {
|
|
6234
|
-
if (this.config.firstPartyPath)
|
|
6235
|
-
try {
|
|
6236
|
-
fetch(this.config.firstPartyPath + "/", {
|
|
6237
|
-
method: "POST",
|
|
6238
|
-
body: JSON.stringify({
|
|
6239
|
-
type: "sync-user",
|
|
6240
|
-
appId: this.config.appId,
|
|
6241
|
-
user: e
|
|
6242
|
-
}),
|
|
6243
|
-
headers: {
|
|
6244
|
-
"Content-Type": "application/json"
|
|
6245
|
-
}
|
|
6246
|
-
});
|
|
6247
|
-
} catch (n) {
|
|
6248
|
-
console.error("Error syncing user with external endpoint", n);
|
|
6249
|
-
}
|
|
6250
|
-
});
|
|
6251
|
-
}
|
|
6252
6198
|
updateUser(e) {
|
|
6253
|
-
this.syncUserToEndpoint(e);
|
|
6254
6199
|
const n = { error: void 0, user: e };
|
|
6255
6200
|
this._currentUserCached = Object.assign({ isLoading: !1 }, n), this._dataForQueryCache = {}, this.querySubs.updateInPlace((r) => {
|
|
6256
6201
|
Object.keys(r).forEach((i) => {
|
|
@@ -6266,7 +6211,7 @@ class ea {
|
|
|
6266
6211
|
});
|
|
6267
6212
|
}
|
|
6268
6213
|
signInWithMagicCode(e) {
|
|
6269
|
-
return
|
|
6214
|
+
return L(this, arguments, void 0, function* ({ email: n, code: r }) {
|
|
6270
6215
|
var i;
|
|
6271
6216
|
const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", u = yield hu({
|
|
6272
6217
|
apiURI: this.config.apiURI,
|
|
@@ -6279,7 +6224,7 @@ class ea {
|
|
|
6279
6224
|
});
|
|
6280
6225
|
}
|
|
6281
6226
|
signInWithCustomToken(e) {
|
|
6282
|
-
return
|
|
6227
|
+
return L(this, void 0, void 0, function* () {
|
|
6283
6228
|
const n = yield pu({
|
|
6284
6229
|
apiURI: this.config.apiURI,
|
|
6285
6230
|
appId: this.config.appId,
|
|
@@ -6289,7 +6234,7 @@ class ea {
|
|
|
6289
6234
|
});
|
|
6290
6235
|
}
|
|
6291
6236
|
signInAsGuest() {
|
|
6292
|
-
return
|
|
6237
|
+
return L(this, void 0, void 0, function* () {
|
|
6293
6238
|
const e = yield yu({
|
|
6294
6239
|
apiURI: this.config.apiURI,
|
|
6295
6240
|
appId: this.config.appId
|
|
@@ -6316,7 +6261,7 @@ class ea {
|
|
|
6316
6261
|
});
|
|
6317
6262
|
}
|
|
6318
6263
|
signOut(e) {
|
|
6319
|
-
return
|
|
6264
|
+
return L(this, void 0, void 0, function* () {
|
|
6320
6265
|
const n = yield this.getCurrentUser();
|
|
6321
6266
|
this.potentiallyInvalidateToken(n, e), yield this.changeCurrentUser(null);
|
|
6322
6267
|
});
|
|
@@ -6339,7 +6284,7 @@ class ea {
|
|
|
6339
6284
|
* @param {string} [params.codeVerifier] - The code verifier used to generate the code challenge.
|
|
6340
6285
|
*/
|
|
6341
6286
|
exchangeCodeForToken(e) {
|
|
6342
|
-
return
|
|
6287
|
+
return L(this, arguments, void 0, function* ({ code: n, codeVerifier: r }) {
|
|
6343
6288
|
var i;
|
|
6344
6289
|
const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", u = yield er({
|
|
6345
6290
|
apiURI: this.config.apiURI,
|
|
@@ -6362,7 +6307,7 @@ class ea {
|
|
|
6362
6307
|
* @param {string | null | undefined} [params.nonce] - The nonce used when requesting the id_token from the external service
|
|
6363
6308
|
*/
|
|
6364
6309
|
signInWithIdToken(e) {
|
|
6365
|
-
return
|
|
6310
|
+
return L(this, arguments, void 0, function* ({ idToken: n, clientName: r, nonce: i }) {
|
|
6366
6311
|
var s;
|
|
6367
6312
|
const o = yield this.getCurrentUser(), u = (s = o == null ? void 0 : o.user) === null || s === void 0 ? void 0 : s.refresh_token, a = yield bu({
|
|
6368
6313
|
apiURI: this.config.apiURI,
|
|
@@ -6417,17 +6362,17 @@ class ea {
|
|
|
6417
6362
|
s.result.user = o, i.isConnected && (this._trySetPresence(n, o), this._notifyPresenceSubs(n));
|
|
6418
6363
|
}
|
|
6419
6364
|
_trySetPresence(e, n) {
|
|
6420
|
-
this._trySendAuthed(
|
|
6365
|
+
this._trySendAuthed(N(), {
|
|
6421
6366
|
op: "set-presence",
|
|
6422
6367
|
"room-id": e,
|
|
6423
6368
|
data: n
|
|
6424
6369
|
});
|
|
6425
6370
|
}
|
|
6426
6371
|
_tryJoinRoom(e, n) {
|
|
6427
|
-
this._trySendAuthed(
|
|
6372
|
+
this._trySendAuthed(N(), { op: "join-room", "room-id": e, data: n }), delete this._roomsPendingLeave[e];
|
|
6428
6373
|
}
|
|
6429
6374
|
_tryLeaveRoom(e) {
|
|
6430
|
-
this._trySendAuthed(
|
|
6375
|
+
this._trySendAuthed(N(), { op: "leave-room", "room-id": e });
|
|
6431
6376
|
}
|
|
6432
6377
|
_trySetRoomConnected(e, n) {
|
|
6433
6378
|
const r = this._rooms[e];
|
|
@@ -6443,8 +6388,8 @@ class ea {
|
|
|
6443
6388
|
r.initialPresence || r.initialData
|
|
6444
6389
|
), o = Object.assign(Object.assign({}, r), { roomId: n, cb: i, prev: null });
|
|
6445
6390
|
return this._presence[n] = this._presence[n] || {}, this._presence[n].handlers = this._presence[n].handlers || [], this._presence[n].handlers.push(o), this._notifyPresenceSub(n, o), () => {
|
|
6446
|
-
var u, a,
|
|
6447
|
-
this._presence[n].handlers = (
|
|
6391
|
+
var u, a, d;
|
|
6392
|
+
this._presence[n].handlers = (d = (a = (u = this._presence[n]) === null || u === void 0 ? void 0 : u.handlers) === null || a === void 0 ? void 0 : a.filter((c) => c !== o)) !== null && d !== void 0 ? d : [], s();
|
|
6448
6393
|
};
|
|
6449
6394
|
}
|
|
6450
6395
|
_notifyPresenceSubs(e) {
|
|
@@ -6460,22 +6405,22 @@ class ea {
|
|
|
6460
6405
|
_patchPresencePeers(e, n) {
|
|
6461
6406
|
var r, i, s;
|
|
6462
6407
|
const o = ((i = (r = this._presence[e]) === null || r === void 0 ? void 0 : r.result) === null || i === void 0 ? void 0 : i.peers) || {};
|
|
6463
|
-
let u = Object.fromEntries(Object.entries(o).map(([
|
|
6408
|
+
let u = Object.fromEntries(Object.entries(o).map(([d, c]) => [d, { data: c }]));
|
|
6464
6409
|
(s = this._presence[e]) === null || s === void 0 || s.result;
|
|
6465
|
-
const a = ft(u, (
|
|
6466
|
-
for (let [
|
|
6410
|
+
const a = ft(u, (d) => {
|
|
6411
|
+
for (let [c, f, l] of n)
|
|
6467
6412
|
switch (f) {
|
|
6468
6413
|
case "+":
|
|
6469
|
-
Xi(
|
|
6414
|
+
Xi(d, c, l);
|
|
6470
6415
|
break;
|
|
6471
6416
|
case "r":
|
|
6472
|
-
Kn(
|
|
6417
|
+
Kn(d, c, l);
|
|
6473
6418
|
break;
|
|
6474
6419
|
case "-":
|
|
6475
|
-
Pr(
|
|
6420
|
+
Pr(d, c);
|
|
6476
6421
|
break;
|
|
6477
6422
|
}
|
|
6478
|
-
delete
|
|
6423
|
+
delete d[this._sessionId];
|
|
6479
6424
|
});
|
|
6480
6425
|
this._setPresencePeers(e, a);
|
|
6481
6426
|
}
|
|
@@ -6501,7 +6446,7 @@ class ea {
|
|
|
6501
6446
|
}
|
|
6502
6447
|
}
|
|
6503
6448
|
_tryBroadcast(e, n, r, i) {
|
|
6504
|
-
this._trySendAuthed(
|
|
6449
|
+
this._trySendAuthed(N(), {
|
|
6505
6450
|
op: "client-broadcast",
|
|
6506
6451
|
"room-id": e,
|
|
6507
6452
|
roomType: n,
|
|
@@ -6518,22 +6463,22 @@ class ea {
|
|
|
6518
6463
|
_notifyBroadcastSubs(e, n, r) {
|
|
6519
6464
|
var i, s, o;
|
|
6520
6465
|
(o = (s = (i = this._broadcastSubs) === null || i === void 0 ? void 0 : i[e]) === null || s === void 0 ? void 0 : s[n]) === null || o === void 0 || o.forEach((u) => {
|
|
6521
|
-
var a,
|
|
6522
|
-
const y = (a = r.data) === null || a === void 0 ? void 0 : a.data, b = r.data["peer-id"] === this._sessionId ? (
|
|
6466
|
+
var a, d, c, f, l, p;
|
|
6467
|
+
const y = (a = r.data) === null || a === void 0 ? void 0 : a.data, b = r.data["peer-id"] === this._sessionId ? (c = (d = this._presence[e]) === null || d === void 0 ? void 0 : d.result) === null || c === void 0 ? void 0 : c.user : (p = (l = (f = this._presence[e]) === null || f === void 0 ? void 0 : f.result) === null || l === void 0 ? void 0 : l.peers) === null || p === void 0 ? void 0 : p[r.data["peer-id"]];
|
|
6523
6468
|
return u(y, b);
|
|
6524
6469
|
});
|
|
6525
6470
|
}
|
|
6526
6471
|
// --------
|
|
6527
6472
|
// Storage
|
|
6528
6473
|
uploadFile(e, n, r) {
|
|
6529
|
-
return
|
|
6474
|
+
return L(this, void 0, void 0, function* () {
|
|
6530
6475
|
var i;
|
|
6531
6476
|
const s = yield this.getCurrentUser(), o = (i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.refresh_token;
|
|
6532
6477
|
return gu(Object.assign(Object.assign({}, r), { apiURI: this.config.apiURI, appId: this.config.appId, path: e, file: n, refreshToken: o }));
|
|
6533
6478
|
});
|
|
6534
6479
|
}
|
|
6535
6480
|
deleteFile(e) {
|
|
6536
|
-
return
|
|
6481
|
+
return L(this, void 0, void 0, function* () {
|
|
6537
6482
|
var n;
|
|
6538
6483
|
const r = yield this.getCurrentUser(), i = (n = r == null ? void 0 : r.user) === null || n === void 0 ? void 0 : n.refresh_token;
|
|
6539
6484
|
return yield Tu({
|
|
@@ -6547,7 +6492,7 @@ class ea {
|
|
|
6547
6492
|
// Deprecated Storage API (Jan 2025)
|
|
6548
6493
|
// ---------------------------------
|
|
6549
6494
|
upload(e, n) {
|
|
6550
|
-
return
|
|
6495
|
+
return L(this, void 0, void 0, function* () {
|
|
6551
6496
|
var r;
|
|
6552
6497
|
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 wu({
|
|
6553
6498
|
apiURI: this.config.apiURI,
|
|
@@ -6559,7 +6504,7 @@ class ea {
|
|
|
6559
6504
|
});
|
|
6560
6505
|
}
|
|
6561
6506
|
getDownloadUrl(e) {
|
|
6562
|
-
return
|
|
6507
|
+
return L(this, void 0, void 0, function* () {
|
|
6563
6508
|
var n;
|
|
6564
6509
|
const r = yield this.getCurrentUser(), i = (n = r == null ? void 0 : r.user) === null || n === void 0 ? void 0 : n.refresh_token;
|
|
6565
6510
|
return yield vu({
|
|
@@ -6571,16 +6516,16 @@ class ea {
|
|
|
6571
6516
|
});
|
|
6572
6517
|
}
|
|
6573
6518
|
}
|
|
6574
|
-
let
|
|
6519
|
+
let it;
|
|
6575
6520
|
function ta(t, e) {
|
|
6576
|
-
|
|
6521
|
+
it == null || it.dispose();
|
|
6577
6522
|
const n = ua(e), r = ia(e, u), i = ra(na(t));
|
|
6578
|
-
function s(
|
|
6523
|
+
function s(c) {
|
|
6579
6524
|
var f;
|
|
6580
|
-
|
|
6525
|
+
c.source === i.element.contentWindow && ((f = c.data) === null || f === void 0 ? void 0 : f.type) === "close" && n.isVisible() && u();
|
|
6581
6526
|
}
|
|
6582
|
-
function o(
|
|
6583
|
-
const f =
|
|
6527
|
+
function o(c) {
|
|
6528
|
+
const f = c.shiftKey && c.ctrlKey && c.key === "0", l = c.key === "Escape" || c.key === "Esc";
|
|
6584
6529
|
(f || l && n.isVisible()) && u();
|
|
6585
6530
|
}
|
|
6586
6531
|
function u() {
|
|
@@ -6589,12 +6534,12 @@ function ta(t, e) {
|
|
|
6589
6534
|
function a() {
|
|
6590
6535
|
n.element.remove(), r.element.remove(), removeEventListener("keydown", o), removeEventListener("message", s);
|
|
6591
6536
|
}
|
|
6592
|
-
function
|
|
6593
|
-
document.body.appendChild(n.element), document.body.appendChild(r.element), addEventListener("keydown", o), addEventListener("message", s),
|
|
6537
|
+
function d() {
|
|
6538
|
+
document.body.appendChild(n.element), document.body.appendChild(r.element), addEventListener("keydown", o), addEventListener("message", s), it = {
|
|
6594
6539
|
dispose: a
|
|
6595
6540
|
};
|
|
6596
6541
|
}
|
|
6597
|
-
return
|
|
6542
|
+
return d();
|
|
6598
6543
|
}
|
|
6599
6544
|
function na(t) {
|
|
6600
6545
|
return `${dn || ei ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${t}`;
|
|
@@ -6877,19 +6822,19 @@ function gr(t) {
|
|
|
6877
6822
|
const e = _r.get(t);
|
|
6878
6823
|
if (e)
|
|
6879
6824
|
return e;
|
|
6880
|
-
const n =
|
|
6825
|
+
const n = q(t);
|
|
6881
6826
|
return _r.set(t, n), n;
|
|
6882
6827
|
}
|
|
6883
6828
|
function ya(t, e) {
|
|
6884
6829
|
return gr(t._reactor.config.schema) !== gr(e);
|
|
6885
6830
|
}
|
|
6886
6831
|
function ba(t, e, n, r, i) {
|
|
6887
|
-
var s;
|
|
6888
|
-
const
|
|
6889
|
-
if (
|
|
6890
|
-
return ya(
|
|
6891
|
-
const
|
|
6892
|
-
return Yt[Ht(
|
|
6832
|
+
var s, o;
|
|
6833
|
+
const u = Object.assign(Object.assign({}, t), { appId: (s = t.appId) === null || s === void 0 ? void 0 : s.trim(), useDateObjects: (o = t.useDateObjects) !== null && o !== void 0 ? o : !1 }), a = Yt[Ht(u)];
|
|
6834
|
+
if (a)
|
|
6835
|
+
return ya(a, u.schema) && a._reactor.updateSchema(u.schema), a;
|
|
6836
|
+
const d = new ea(Object.assign(Object.assign(Object.assign({}, aa), u), { cardinalityInference: !!u.schema }), e || Jr, n || Zr, Object.assign(Object.assign({}, r || {}), { "@instantdb/core": ni }), i), c = new pa(d);
|
|
6837
|
+
return Yt[Ht(u)] = c, _a(u.appId, u.devtool), c;
|
|
6893
6838
|
}
|
|
6894
6839
|
function _a(t, e) {
|
|
6895
6840
|
if (typeof window > "u" || typeof window.location > "u" || typeof document > "u" || typeof e == "boolean" && !e)
|
|
@@ -6914,21 +6859,21 @@ function Tr(t) {
|
|
|
6914
6859
|
}
|
|
6915
6860
|
function Ta(t, e, n) {
|
|
6916
6861
|
e && n && "ruleParams" in n && (e = { $$ruleParams: n.ruleParams, ...e });
|
|
6917
|
-
const r = e ? ha(e) : null, i =
|
|
6862
|
+
const r = e ? ha(e) : null, i = q(r), s = qe(
|
|
6918
6863
|
Tr(t._reactor.getPreviousResult(r))
|
|
6919
6864
|
), o = fe(
|
|
6920
6865
|
(a) => (s.current = Tr(
|
|
6921
6866
|
t._reactor.getPreviousResult(r)
|
|
6922
|
-
),
|
|
6867
|
+
), r ? t.subscribeQuery(r, (c) => {
|
|
6923
6868
|
s.current = {
|
|
6924
|
-
isLoading: !
|
|
6869
|
+
isLoading: !c,
|
|
6925
6870
|
// @ts-expect-error: ts thinks this will always be overwritten
|
|
6926
6871
|
data: void 0,
|
|
6927
6872
|
// @ts-expect-error: ts thinks this will always be overwritten
|
|
6928
6873
|
pageInfo: void 0,
|
|
6929
6874
|
// @ts-expect-error: ts thinks this will always be overwritten
|
|
6930
6875
|
error: void 0,
|
|
6931
|
-
...
|
|
6876
|
+
...c
|
|
6932
6877
|
}, a();
|
|
6933
6878
|
}) : () => {
|
|
6934
6879
|
}),
|
|
@@ -6942,7 +6887,7 @@ function Ta(t, e, n) {
|
|
|
6942
6887
|
), query: r };
|
|
6943
6888
|
}
|
|
6944
6889
|
function wa() {
|
|
6945
|
-
const t =
|
|
6890
|
+
const t = qe(null);
|
|
6946
6891
|
ge(() => {
|
|
6947
6892
|
n();
|
|
6948
6893
|
}, []);
|
|
@@ -6956,7 +6901,7 @@ function wa() {
|
|
|
6956
6901
|
}
|
|
6957
6902
|
const ma = 1e3;
|
|
6958
6903
|
function va(t, e, n) {
|
|
6959
|
-
const r =
|
|
6904
|
+
const r = qe(n);
|
|
6960
6905
|
r.current = n, ge(() => t.core._reactor.subscribeTopic(
|
|
6961
6906
|
t.id,
|
|
6962
6907
|
e,
|
|
@@ -6988,8 +6933,8 @@ function Oa(t, e = {}) {
|
|
|
6988
6933
|
t.type,
|
|
6989
6934
|
t.id,
|
|
6990
6935
|
e,
|
|
6991
|
-
(
|
|
6992
|
-
r(
|
|
6936
|
+
(d) => {
|
|
6937
|
+
r(d);
|
|
6993
6938
|
}
|
|
6994
6939
|
), [t.id, e.user, (o = e.peers) == null ? void 0 : o.join(), (u = e.keys) == null ? void 0 : u.join()]);
|
|
6995
6940
|
const i = fe(
|
|
@@ -7010,18 +6955,18 @@ function Ea(t, e, n = {}) {
|
|
|
7010
6955
|
const r = wa(), i = ye.usePresence(t, {
|
|
7011
6956
|
keys: [e]
|
|
7012
6957
|
}), s = Mt(() => {
|
|
7013
|
-
const
|
|
6958
|
+
const c = t._core._reactor.getPresence(
|
|
7014
6959
|
t.type,
|
|
7015
6960
|
t.id
|
|
7016
6961
|
);
|
|
7017
|
-
return n != null && n.writeOnly ? [] : Object.values((
|
|
6962
|
+
return n != null && n.writeOnly ? [] : Object.values((c == null ? void 0 : c.peers) ?? {}).filter(
|
|
7018
6963
|
(f) => f[e] === !0
|
|
7019
6964
|
);
|
|
7020
6965
|
}, [n == null ? void 0 : n.writeOnly, i]), o = fe(
|
|
7021
|
-
(
|
|
6966
|
+
(c) => {
|
|
7022
6967
|
t.core._reactor.publishPresence(t.type, t.id, {
|
|
7023
|
-
[e]:
|
|
7024
|
-
}),
|
|
6968
|
+
[e]: c
|
|
6969
|
+
}), c && ((n == null ? void 0 : n.timeout) === null || (n == null ? void 0 : n.timeout) === 0 || r.set((n == null ? void 0 : n.timeout) ?? ma, () => {
|
|
7025
6970
|
t.core._reactor.publishPresence(t.type, t.id, {
|
|
7026
6971
|
[e]: null
|
|
7027
6972
|
});
|
|
@@ -7029,18 +6974,18 @@ function Ea(t, e, n = {}) {
|
|
|
7029
6974
|
},
|
|
7030
6975
|
[t.type, t.id, e, n == null ? void 0 : n.timeout, r]
|
|
7031
6976
|
), u = fe(
|
|
7032
|
-
(
|
|
7033
|
-
const l = !((n == null ? void 0 : n.stopOnEnter) &&
|
|
6977
|
+
(c) => {
|
|
6978
|
+
const l = !((n == null ? void 0 : n.stopOnEnter) && c.key === "Enter");
|
|
7034
6979
|
o(l);
|
|
7035
6980
|
},
|
|
7036
6981
|
[n.stopOnEnter, o]
|
|
7037
6982
|
), a = fe(() => {
|
|
7038
6983
|
o(!1);
|
|
7039
|
-
}, [o]),
|
|
6984
|
+
}, [o]), d = Mt(() => ({ onKeyDown: u, onBlur: a }), [u, a]);
|
|
7040
6985
|
return {
|
|
7041
6986
|
active: s,
|
|
7042
6987
|
setActive: o,
|
|
7043
|
-
inputProps:
|
|
6988
|
+
inputProps: d
|
|
7044
6989
|
};
|
|
7045
6990
|
}
|
|
7046
6991
|
const ye = {
|
|
@@ -7062,7 +7007,7 @@ const ja = {
|
|
|
7062
7007
|
user: void 0,
|
|
7063
7008
|
error: void 0
|
|
7064
7009
|
};
|
|
7065
|
-
class
|
|
7010
|
+
class Ia {
|
|
7066
7011
|
constructor(e, n) {
|
|
7067
7012
|
this.tx = cn(), this.getLocalId = (r) => this.core.getLocalId(r), this.useLocalId = (r) => {
|
|
7068
7013
|
const [i, s] = mr(null);
|
|
@@ -7072,7 +7017,18 @@ class Ca {
|
|
|
7072
7017
|
s(u);
|
|
7073
7018
|
})();
|
|
7074
7019
|
}, [r]), i;
|
|
7075
|
-
}, this.rooms = ye, this.transact = (r) => this.core.transact(r), this.useQuery = (r, i) => Ta(this.core, r, i).state, this.useAuth = () =>
|
|
7020
|
+
}, this.rooms = ye, this.transact = (r) => this.core.transact(r), this.useQuery = (r, i) => Ta(this.core, r, i).state, this.useAuth = () => {
|
|
7021
|
+
const r = qe(
|
|
7022
|
+
this.core._reactor._currentUserCached
|
|
7023
|
+
), i = fe((o) => this.core.subscribeAuth((a) => {
|
|
7024
|
+
r.current = { isLoading: !1, ...a }, o();
|
|
7025
|
+
}), []);
|
|
7026
|
+
return Pt(
|
|
7027
|
+
i,
|
|
7028
|
+
() => r.current,
|
|
7029
|
+
() => ja
|
|
7030
|
+
);
|
|
7031
|
+
}, this.useUser = () => {
|
|
7076
7032
|
const { user: r } = this.useAuth();
|
|
7077
7033
|
if (!r)
|
|
7078
7034
|
throw new je(
|
|
@@ -7080,7 +7036,7 @@ class Ca {
|
|
|
7080
7036
|
);
|
|
7081
7037
|
return r;
|
|
7082
7038
|
}, this.useConnectionStatus = () => {
|
|
7083
|
-
const r =
|
|
7039
|
+
const r = qe(
|
|
7084
7040
|
this.core._reactor.status
|
|
7085
7041
|
), i = fe((o) => this.core.subscribeConnectionStatus((a) => {
|
|
7086
7042
|
a !== r.current && (r.current = a, o());
|
|
@@ -7093,10 +7049,10 @@ class Ca {
|
|
|
7093
7049
|
);
|
|
7094
7050
|
}, this.queryOnce = (r, i) => this.core.queryOnce(r, i), this.SignedIn = ({ children: r }) => {
|
|
7095
7051
|
const i = this.useAuth();
|
|
7096
|
-
return i.isLoading || i.error || !i.user ? null : /* @__PURE__ */
|
|
7052
|
+
return i.isLoading || i.error || !i.user ? null : /* @__PURE__ */ et.jsx(et.Fragment, { children: r });
|
|
7097
7053
|
}, this.SignedOut = ({ children: r }) => {
|
|
7098
7054
|
const i = this.useAuth();
|
|
7099
|
-
return i.isLoading || i.error || i.user ? null : /* @__PURE__ */
|
|
7055
|
+
return i.isLoading || i.error || i.user ? null : /* @__PURE__ */ et.jsx(et.Fragment, { children: r });
|
|
7100
7056
|
}, this.core = ba(
|
|
7101
7057
|
e,
|
|
7102
7058
|
// @ts-expect-error because TS can't resolve subclass statics
|
|
@@ -7123,18 +7079,6 @@ class Ca {
|
|
|
7123
7079
|
room(e = "_defaultRoomType", n = "_defaultRoomId") {
|
|
7124
7080
|
return new ka(this.core, e, n);
|
|
7125
7081
|
}
|
|
7126
|
-
_useAuth() {
|
|
7127
|
-
const e = ze(
|
|
7128
|
-
this.core._reactor._currentUserCached
|
|
7129
|
-
), n = fe((i) => this.core.subscribeAuth((o) => {
|
|
7130
|
-
e.current = { isLoading: !1, ...o }, i();
|
|
7131
|
-
}), []);
|
|
7132
|
-
return Pt(
|
|
7133
|
-
n,
|
|
7134
|
-
() => e.current,
|
|
7135
|
-
() => ja
|
|
7136
|
-
);
|
|
7137
|
-
}
|
|
7138
7082
|
/**
|
|
7139
7083
|
* One time query for the logged in state. This is useful
|
|
7140
7084
|
* for scenarios where you want to know the current auth
|
|
@@ -7150,5 +7094,5 @@ class Ca {
|
|
|
7150
7094
|
}
|
|
7151
7095
|
}
|
|
7152
7096
|
export {
|
|
7153
|
-
|
|
7097
|
+
Ia as InstantReactAbstractDatabase
|
|
7154
7098
|
};
|