@instantdb/react-common 1.0.50-branch-log-dashboard-login-code.29876046282.1 → 1.0.50
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 +1 -14
- package/dist/commonjs/InstantReactAbstractDatabase.d.ts.map +1 -1
- package/dist/commonjs/InstantReactAbstractDatabase.js +0 -30
- package/dist/commonjs/InstantReactAbstractDatabase.js.map +1 -1
- package/dist/esm/InstantReactAbstractDatabase.d.ts +1 -14
- package/dist/esm/InstantReactAbstractDatabase.d.ts.map +1 -1
- package/dist/esm/InstantReactAbstractDatabase.js +0 -30
- package/dist/esm/InstantReactAbstractDatabase.js.map +1 -1
- package/dist/standalone/index.js +839 -921
- package/dist/standalone/index.umd.cjs +11 -11
- package/package.json +3 -3
- package/src/InstantReactAbstractDatabase.tsx +0 -42
package/dist/standalone/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var Gs = Object.defineProperty;
|
|
2
2
|
var Hs = (n, e, t) => e in n ? Gs(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
3
|
var p = (n, e, t) => Hs(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import
|
|
4
|
+
import Mr, { useRef as ke, useCallback as Ae, useSyncExternalStore as At, useEffect as je, useMemo as Jt, useState as Rr } from "react";
|
|
5
5
|
var Yt = { exports: {} }, Je = {};
|
|
6
6
|
/**
|
|
7
7
|
* @license React
|
|
@@ -16,13 +16,13 @@ var zn;
|
|
|
16
16
|
function Js() {
|
|
17
17
|
if (zn) return Je;
|
|
18
18
|
zn = 1;
|
|
19
|
-
var n =
|
|
19
|
+
var n = Mr, e = Symbol.for("react.element"), t = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, s = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, i = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
20
20
|
function o(a, c, u) {
|
|
21
|
-
var l, f = {}, h = null,
|
|
22
|
-
u !== void 0 && (h = "" + u), c.key !== void 0 && (h = "" + c.key), c.ref !== void 0 && (
|
|
21
|
+
var l, f = {}, h = null, y = null;
|
|
22
|
+
u !== void 0 && (h = "" + u), c.key !== void 0 && (h = "" + c.key), c.ref !== void 0 && (y = c.ref);
|
|
23
23
|
for (l in c) r.call(c, l) && !i.hasOwnProperty(l) && (f[l] = c[l]);
|
|
24
24
|
if (a && a.defaultProps) for (l in c = a.defaultProps, c) f[l] === void 0 && (f[l] = c[l]);
|
|
25
|
-
return { $$typeof: e, type: a, key: h, ref:
|
|
25
|
+
return { $$typeof: e, type: a, key: h, ref: y, props: f, _owner: s.current };
|
|
26
26
|
}
|
|
27
27
|
return Je.Fragment = t, Je.jsx = o, Je.jsxs = o, Je;
|
|
28
28
|
}
|
|
@@ -41,39 +41,39 @@ function Ys() {
|
|
|
41
41
|
* LICENSE file in the root directory of this source tree.
|
|
42
42
|
*/
|
|
43
43
|
return n.NODE_ENV !== "production" && function() {
|
|
44
|
-
var e =
|
|
44
|
+
var e = Mr, t = Symbol.for("react.element"), r = Symbol.for("react.portal"), s = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), a = Symbol.for("react.provider"), c = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), l = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), h = Symbol.for("react.memo"), y = Symbol.for("react.lazy"), b = Symbol.for("react.offscreen"), g = Symbol.iterator, m = "@@iterator";
|
|
45
45
|
function S(d) {
|
|
46
46
|
if (d === null || typeof d != "object")
|
|
47
47
|
return null;
|
|
48
|
-
var w = g && d[g] || d[
|
|
48
|
+
var w = g && d[g] || d[m];
|
|
49
49
|
return typeof w == "function" ? w : null;
|
|
50
50
|
}
|
|
51
|
-
var
|
|
51
|
+
var _ = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
52
52
|
function T(d) {
|
|
53
53
|
{
|
|
54
54
|
for (var w = arguments.length, v = new Array(w > 1 ? w - 1 : 0), I = 1; I < w; I++)
|
|
55
55
|
v[I - 1] = arguments[I];
|
|
56
|
-
|
|
56
|
+
M("error", d, v);
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function M(d, w, v) {
|
|
60
60
|
{
|
|
61
|
-
var I =
|
|
61
|
+
var I = _.ReactDebugCurrentFrame, W = I.getStackAddendum();
|
|
62
62
|
W !== "" && (w += "%s", v = v.concat([W]));
|
|
63
|
-
var V = v.map(function(
|
|
64
|
-
return String(
|
|
63
|
+
var V = v.map(function(D) {
|
|
64
|
+
return String(D);
|
|
65
65
|
});
|
|
66
66
|
V.unshift("Warning: " + w), Function.prototype.apply.call(console[d], console, V);
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
-
var O = !1,
|
|
70
|
-
|
|
69
|
+
var O = !1, F = !1, P = !1, C = !1, G = !1, N;
|
|
70
|
+
N = Symbol.for("react.module.reference");
|
|
71
71
|
function B(d) {
|
|
72
|
-
return !!(typeof d == "string" || typeof d == "function" || d === s || d === o || G || d === i || d === l || d === f ||
|
|
72
|
+
return !!(typeof d == "string" || typeof d == "function" || d === s || d === o || G || d === i || d === l || d === f || C || d === b || O || F || P || typeof d == "object" && d !== null && (d.$$typeof === y || d.$$typeof === h || d.$$typeof === a || d.$$typeof === c || d.$$typeof === u || // This needs to include all possible module reference object
|
|
73
73
|
// types supported by any Flight configuration anywhere since
|
|
74
74
|
// we don't know which Flight build this will end up being used
|
|
75
75
|
// with.
|
|
76
|
-
d.$$typeof ===
|
|
76
|
+
d.$$typeof === N || d.getModuleId !== void 0));
|
|
77
77
|
}
|
|
78
78
|
function z(d, w, v) {
|
|
79
79
|
var I = d.displayName;
|
|
@@ -119,10 +119,10 @@ function Ys() {
|
|
|
119
119
|
case h:
|
|
120
120
|
var I = d.displayName || null;
|
|
121
121
|
return I !== null ? I : q(d.type) || "Memo";
|
|
122
|
-
case
|
|
123
|
-
var W = d, V = W._payload,
|
|
122
|
+
case y: {
|
|
123
|
+
var W = d, V = W._payload, D = W._init;
|
|
124
124
|
try {
|
|
125
|
-
return q(
|
|
125
|
+
return q(D(V));
|
|
126
126
|
} catch {
|
|
127
127
|
return null;
|
|
128
128
|
}
|
|
@@ -130,14 +130,14 @@ function Ys() {
|
|
|
130
130
|
}
|
|
131
131
|
return null;
|
|
132
132
|
}
|
|
133
|
-
var E = Object.assign,
|
|
133
|
+
var E = Object.assign, j = 0, R, U, L, A, k, K, H;
|
|
134
134
|
function Y() {
|
|
135
135
|
}
|
|
136
136
|
Y.__reactDisabledLog = !0;
|
|
137
137
|
function oe() {
|
|
138
138
|
{
|
|
139
|
-
if (
|
|
140
|
-
|
|
139
|
+
if (j === 0) {
|
|
140
|
+
R = console.log, U = console.info, L = console.warn, A = console.error, k = console.group, K = console.groupCollapsed, H = console.groupEnd;
|
|
141
141
|
var d = {
|
|
142
142
|
configurable: !0,
|
|
143
143
|
enumerable: !0,
|
|
@@ -154,12 +154,12 @@ function Ys() {
|
|
|
154
154
|
groupEnd: d
|
|
155
155
|
});
|
|
156
156
|
}
|
|
157
|
-
|
|
157
|
+
j++;
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
160
|
function Ge() {
|
|
161
161
|
{
|
|
162
|
-
if (
|
|
162
|
+
if (j--, j === 0) {
|
|
163
163
|
var d = {
|
|
164
164
|
configurable: !0,
|
|
165
165
|
enumerable: !0,
|
|
@@ -167,13 +167,13 @@ function Ys() {
|
|
|
167
167
|
};
|
|
168
168
|
Object.defineProperties(console, {
|
|
169
169
|
log: E({}, d, {
|
|
170
|
-
value:
|
|
170
|
+
value: R
|
|
171
171
|
}),
|
|
172
172
|
info: E({}, d, {
|
|
173
|
-
value:
|
|
173
|
+
value: U
|
|
174
174
|
}),
|
|
175
175
|
warn: E({}, d, {
|
|
176
|
-
value:
|
|
176
|
+
value: L
|
|
177
177
|
}),
|
|
178
178
|
error: E({}, d, {
|
|
179
179
|
value: A
|
|
@@ -189,11 +189,11 @@ function Ys() {
|
|
|
189
189
|
})
|
|
190
190
|
});
|
|
191
191
|
}
|
|
192
|
-
|
|
192
|
+
j < 0 && T("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
|
-
var ge =
|
|
196
|
-
function
|
|
195
|
+
var ge = _.ReactCurrentDispatcher, jt;
|
|
196
|
+
function ut(d, w, v) {
|
|
197
197
|
{
|
|
198
198
|
if (jt === void 0)
|
|
199
199
|
try {
|
|
@@ -206,16 +206,16 @@ function Ys() {
|
|
|
206
206
|
` + jt + d;
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
|
-
var $t = !1,
|
|
209
|
+
var $t = !1, lt;
|
|
210
210
|
{
|
|
211
211
|
var vs = typeof WeakMap == "function" ? WeakMap : Map;
|
|
212
|
-
|
|
212
|
+
lt = new vs();
|
|
213
213
|
}
|
|
214
214
|
function In(d, w) {
|
|
215
215
|
if (!d || $t)
|
|
216
216
|
return "";
|
|
217
217
|
{
|
|
218
|
-
var v =
|
|
218
|
+
var v = lt.get(d);
|
|
219
219
|
if (v !== void 0)
|
|
220
220
|
return v;
|
|
221
221
|
}
|
|
@@ -227,27 +227,27 @@ function Ys() {
|
|
|
227
227
|
V = ge.current, ge.current = null, oe();
|
|
228
228
|
try {
|
|
229
229
|
if (w) {
|
|
230
|
-
var
|
|
230
|
+
var D = function() {
|
|
231
231
|
throw Error();
|
|
232
232
|
};
|
|
233
|
-
if (Object.defineProperty(
|
|
233
|
+
if (Object.defineProperty(D.prototype, "props", {
|
|
234
234
|
set: function() {
|
|
235
235
|
throw Error();
|
|
236
236
|
}
|
|
237
237
|
}), typeof Reflect == "object" && Reflect.construct) {
|
|
238
238
|
try {
|
|
239
|
-
Reflect.construct(
|
|
239
|
+
Reflect.construct(D, []);
|
|
240
240
|
} catch (ue) {
|
|
241
241
|
I = ue;
|
|
242
242
|
}
|
|
243
|
-
Reflect.construct(d, [],
|
|
243
|
+
Reflect.construct(d, [], D);
|
|
244
244
|
} else {
|
|
245
245
|
try {
|
|
246
|
-
|
|
246
|
+
D.call();
|
|
247
247
|
} catch (ue) {
|
|
248
248
|
I = ue;
|
|
249
249
|
}
|
|
250
|
-
d.call(
|
|
250
|
+
d.call(D.prototype);
|
|
251
251
|
}
|
|
252
252
|
} else {
|
|
253
253
|
try {
|
|
@@ -259,18 +259,18 @@ function Ys() {
|
|
|
259
259
|
}
|
|
260
260
|
} catch (ue) {
|
|
261
261
|
if (ue && I && typeof ue.stack == "string") {
|
|
262
|
-
for (var
|
|
262
|
+
for (var $ = ue.stack.split(`
|
|
263
263
|
`), ae = I.stack.split(`
|
|
264
|
-
`), Z =
|
|
264
|
+
`), Z = $.length - 1, te = ae.length - 1; Z >= 1 && te >= 0 && $[Z] !== ae[te]; )
|
|
265
265
|
te--;
|
|
266
266
|
for (; Z >= 1 && te >= 0; Z--, te--)
|
|
267
|
-
if (
|
|
267
|
+
if ($[Z] !== ae[te]) {
|
|
268
268
|
if (Z !== 1 || te !== 1)
|
|
269
269
|
do
|
|
270
|
-
if (Z--, te--, te < 0 ||
|
|
270
|
+
if (Z--, te--, te < 0 || $[Z] !== ae[te]) {
|
|
271
271
|
var ye = `
|
|
272
|
-
` +
|
|
273
|
-
return d.displayName && ye.includes("<anonymous>") && (ye = ye.replace("<anonymous>", d.displayName)), typeof d == "function" &&
|
|
272
|
+
` + $[Z].replace(" at new ", " at ");
|
|
273
|
+
return d.displayName && ye.includes("<anonymous>") && (ye = ye.replace("<anonymous>", d.displayName)), typeof d == "function" && lt.set(d, ye), ye;
|
|
274
274
|
}
|
|
275
275
|
while (Z >= 1 && te >= 0);
|
|
276
276
|
break;
|
|
@@ -279,8 +279,8 @@ function Ys() {
|
|
|
279
279
|
} finally {
|
|
280
280
|
$t = !1, ge.current = V, Ge(), Error.prepareStackTrace = W;
|
|
281
281
|
}
|
|
282
|
-
var Le = d ? d.displayName || d.name : "", Ce = Le ?
|
|
283
|
-
return typeof d == "function" &&
|
|
282
|
+
var Le = d ? d.displayName || d.name : "", Ce = Le ? ut(Le) : "";
|
|
283
|
+
return typeof d == "function" && lt.set(d, Ce), Ce;
|
|
284
284
|
}
|
|
285
285
|
function As(d, w, v) {
|
|
286
286
|
return In(d, !1);
|
|
@@ -289,59 +289,59 @@ function Ys() {
|
|
|
289
289
|
var w = d.prototype;
|
|
290
290
|
return !!(w && w.isReactComponent);
|
|
291
291
|
}
|
|
292
|
-
function
|
|
292
|
+
function ft(d, w, v) {
|
|
293
293
|
if (d == null)
|
|
294
294
|
return "";
|
|
295
295
|
if (typeof d == "function")
|
|
296
296
|
return In(d, Os(d));
|
|
297
297
|
if (typeof d == "string")
|
|
298
|
-
return
|
|
298
|
+
return ut(d);
|
|
299
299
|
switch (d) {
|
|
300
300
|
case l:
|
|
301
|
-
return
|
|
301
|
+
return ut("Suspense");
|
|
302
302
|
case f:
|
|
303
|
-
return
|
|
303
|
+
return ut("SuspenseList");
|
|
304
304
|
}
|
|
305
305
|
if (typeof d == "object")
|
|
306
306
|
switch (d.$$typeof) {
|
|
307
307
|
case u:
|
|
308
308
|
return As(d.render);
|
|
309
309
|
case h:
|
|
310
|
-
return
|
|
311
|
-
case
|
|
310
|
+
return ft(d.type, w, v);
|
|
311
|
+
case y: {
|
|
312
312
|
var I = d, W = I._payload, V = I._init;
|
|
313
313
|
try {
|
|
314
|
-
return
|
|
314
|
+
return ft(V(W), w, v);
|
|
315
315
|
} catch {
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
318
|
}
|
|
319
319
|
return "";
|
|
320
320
|
}
|
|
321
|
-
var He = Object.prototype.hasOwnProperty, Pn = {},
|
|
322
|
-
function
|
|
321
|
+
var He = Object.prototype.hasOwnProperty, Pn = {}, Mn = _.ReactDebugCurrentFrame;
|
|
322
|
+
function dt(d) {
|
|
323
323
|
if (d) {
|
|
324
|
-
var w = d._owner, v =
|
|
325
|
-
|
|
324
|
+
var w = d._owner, v = ft(d.type, d._source, w ? w.type : null);
|
|
325
|
+
Mn.setExtraStackFrame(v);
|
|
326
326
|
} else
|
|
327
|
-
|
|
327
|
+
Mn.setExtraStackFrame(null);
|
|
328
328
|
}
|
|
329
329
|
function Es(d, w, v, I, W) {
|
|
330
330
|
{
|
|
331
331
|
var V = Function.call.bind(He);
|
|
332
|
-
for (var
|
|
333
|
-
if (V(d,
|
|
334
|
-
var
|
|
332
|
+
for (var D in d)
|
|
333
|
+
if (V(d, D)) {
|
|
334
|
+
var $ = void 0;
|
|
335
335
|
try {
|
|
336
|
-
if (typeof d[
|
|
337
|
-
var ae = Error((I || "React class") + ": " + v + " type `" +
|
|
336
|
+
if (typeof d[D] != "function") {
|
|
337
|
+
var ae = Error((I || "React class") + ": " + v + " type `" + D + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof d[D] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
338
338
|
throw ae.name = "Invariant Violation", ae;
|
|
339
339
|
}
|
|
340
|
-
|
|
340
|
+
$ = d[D](w, D, I, v, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
341
341
|
} catch (Z) {
|
|
342
|
-
|
|
342
|
+
$ = Z;
|
|
343
343
|
}
|
|
344
|
-
|
|
344
|
+
$ && !($ instanceof Error) && (dt(W), T("%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).", I || "React class", v, D, typeof $), dt(null)), $ instanceof Error && !($.message in Pn) && (Pn[$.message] = !0, dt(W), T("Failed %s type: %s", v, $.message), dt(null));
|
|
345
345
|
}
|
|
346
346
|
}
|
|
347
347
|
}
|
|
@@ -357,25 +357,25 @@ function Ys() {
|
|
|
357
357
|
}
|
|
358
358
|
function Is(d) {
|
|
359
359
|
try {
|
|
360
|
-
return
|
|
360
|
+
return Rn(d), !1;
|
|
361
361
|
} catch {
|
|
362
362
|
return !0;
|
|
363
363
|
}
|
|
364
364
|
}
|
|
365
|
-
function
|
|
365
|
+
function Rn(d) {
|
|
366
366
|
return "" + d;
|
|
367
367
|
}
|
|
368
368
|
function jn(d) {
|
|
369
369
|
if (Is(d))
|
|
370
|
-
return T("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Cs(d)),
|
|
370
|
+
return T("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Cs(d)), Rn(d);
|
|
371
371
|
}
|
|
372
|
-
var $n =
|
|
372
|
+
var $n = _.ReactCurrentOwner, Ps = {
|
|
373
373
|
key: !0,
|
|
374
374
|
ref: !0,
|
|
375
375
|
__self: !0,
|
|
376
376
|
__source: !0
|
|
377
377
|
}, xn, Dn;
|
|
378
|
-
function
|
|
378
|
+
function Ms(d) {
|
|
379
379
|
if (He.call(d, "ref")) {
|
|
380
380
|
var w = Object.getOwnPropertyDescriptor(d, "ref").get;
|
|
381
381
|
if (w && w.isReactWarning)
|
|
@@ -383,7 +383,7 @@ function Ys() {
|
|
|
383
383
|
}
|
|
384
384
|
return d.ref !== void 0;
|
|
385
385
|
}
|
|
386
|
-
function
|
|
386
|
+
function Rs(d) {
|
|
387
387
|
if (He.call(d, "key")) {
|
|
388
388
|
var w = Object.getOwnPropertyDescriptor(d, "key").get;
|
|
389
389
|
if (w && w.isReactWarning)
|
|
@@ -416,57 +416,57 @@ function Ys() {
|
|
|
416
416
|
});
|
|
417
417
|
}
|
|
418
418
|
}
|
|
419
|
-
var Ds = function(d, w, v, I, W, V,
|
|
420
|
-
var
|
|
419
|
+
var Ds = function(d, w, v, I, W, V, D) {
|
|
420
|
+
var $ = {
|
|
421
421
|
// This tag allows us to uniquely identify this as a React Element
|
|
422
422
|
$$typeof: t,
|
|
423
423
|
// Built-in properties that belong on the element
|
|
424
424
|
type: d,
|
|
425
425
|
key: w,
|
|
426
426
|
ref: v,
|
|
427
|
-
props:
|
|
427
|
+
props: D,
|
|
428
428
|
// Record the component responsible for creating this element.
|
|
429
429
|
_owner: V
|
|
430
430
|
};
|
|
431
|
-
return
|
|
431
|
+
return $._store = {}, Object.defineProperty($._store, "validated", {
|
|
432
432
|
configurable: !1,
|
|
433
433
|
enumerable: !1,
|
|
434
434
|
writable: !0,
|
|
435
435
|
value: !1
|
|
436
|
-
}), Object.defineProperty(
|
|
436
|
+
}), Object.defineProperty($, "_self", {
|
|
437
437
|
configurable: !1,
|
|
438
438
|
enumerable: !1,
|
|
439
439
|
writable: !1,
|
|
440
440
|
value: I
|
|
441
|
-
}), Object.defineProperty(
|
|
441
|
+
}), Object.defineProperty($, "_source", {
|
|
442
442
|
configurable: !1,
|
|
443
443
|
enumerable: !1,
|
|
444
444
|
writable: !1,
|
|
445
445
|
value: W
|
|
446
|
-
}), Object.freeze && (Object.freeze(
|
|
446
|
+
}), Object.freeze && (Object.freeze($.props), Object.freeze($)), $;
|
|
447
447
|
};
|
|
448
448
|
function Us(d, w, v, I, W) {
|
|
449
449
|
{
|
|
450
|
-
var V,
|
|
451
|
-
v !== void 0 && (jn(v),
|
|
450
|
+
var V, D = {}, $ = null, ae = null;
|
|
451
|
+
v !== void 0 && (jn(v), $ = "" + v), Rs(w) && (jn(w.key), $ = "" + w.key), Ms(w) && (ae = w.ref, js(w, W));
|
|
452
452
|
for (V in w)
|
|
453
|
-
He.call(w, V) && !Ps.hasOwnProperty(V) && (
|
|
453
|
+
He.call(w, V) && !Ps.hasOwnProperty(V) && (D[V] = w[V]);
|
|
454
454
|
if (d && d.defaultProps) {
|
|
455
455
|
var Z = d.defaultProps;
|
|
456
456
|
for (V in Z)
|
|
457
|
-
|
|
457
|
+
D[V] === void 0 && (D[V] = Z[V]);
|
|
458
458
|
}
|
|
459
|
-
if (
|
|
459
|
+
if ($ || ae) {
|
|
460
460
|
var te = typeof d == "function" ? d.displayName || d.name || "Unknown" : d;
|
|
461
|
-
|
|
461
|
+
$ && $s(D, te), ae && xs(D, te);
|
|
462
462
|
}
|
|
463
|
-
return Ds(d,
|
|
463
|
+
return Ds(d, $, ae, W, I, $n.current, D);
|
|
464
464
|
}
|
|
465
465
|
}
|
|
466
|
-
var Dt =
|
|
466
|
+
var Dt = _.ReactCurrentOwner, Un = _.ReactDebugCurrentFrame;
|
|
467
467
|
function Ue(d) {
|
|
468
468
|
if (d) {
|
|
469
|
-
var w = d._owner, v =
|
|
469
|
+
var w = d._owner, v = ft(d.type, d._source, w ? w.type : null);
|
|
470
470
|
Un.setExtraStackFrame(v);
|
|
471
471
|
} else
|
|
472
472
|
Un.setExtraStackFrame(null);
|
|
@@ -531,8 +531,8 @@ Check the top-level render call using <` + v + ">.");
|
|
|
531
531
|
else if (d) {
|
|
532
532
|
var W = S(d);
|
|
533
533
|
if (typeof W == "function" && W !== d.entries)
|
|
534
|
-
for (var V = W.call(d),
|
|
535
|
-
Lt(
|
|
534
|
+
for (var V = W.call(d), D; !(D = V.next()).done; )
|
|
535
|
+
Lt(D.value) && Nn(D.value, w);
|
|
536
536
|
}
|
|
537
537
|
}
|
|
538
538
|
}
|
|
@@ -576,19 +576,19 @@ Check the top-level render call using <` + v + ">.");
|
|
|
576
576
|
var qn = {};
|
|
577
577
|
function Wn(d, w, v, I, W, V) {
|
|
578
578
|
{
|
|
579
|
-
var
|
|
580
|
-
if (!
|
|
581
|
-
var
|
|
582
|
-
(d === void 0 || typeof d == "object" && d !== null && Object.keys(d).length === 0) && (
|
|
579
|
+
var D = B(d);
|
|
580
|
+
if (!D) {
|
|
581
|
+
var $ = "";
|
|
582
|
+
(d === void 0 || typeof d == "object" && d !== null && Object.keys(d).length === 0) && ($ += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
583
583
|
var ae = Ls();
|
|
584
|
-
ae ?
|
|
584
|
+
ae ? $ += ae : $ += Ln();
|
|
585
585
|
var Z;
|
|
586
|
-
d === null ? Z = "null" : xt(d) ? Z = "array" : d !== void 0 && d.$$typeof === t ? (Z = "<" + (q(d.type) || "Unknown") + " />",
|
|
586
|
+
d === null ? Z = "null" : xt(d) ? Z = "array" : d !== void 0 && d.$$typeof === t ? (Z = "<" + (q(d.type) || "Unknown") + " />", $ = " Did you accidentally export a JSX literal instead of a component?") : Z = typeof d, T("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", Z, $);
|
|
587
587
|
}
|
|
588
588
|
var te = Us(d, w, v, W, V);
|
|
589
589
|
if (te == null)
|
|
590
590
|
return te;
|
|
591
|
-
if (
|
|
591
|
+
if (D) {
|
|
592
592
|
var ye = w.children;
|
|
593
593
|
if (ye !== void 0)
|
|
594
594
|
if (I)
|
|
@@ -630,9 +630,9 @@ React keys must be passed directly to JSX without using spread:
|
|
|
630
630
|
}
|
|
631
631
|
var Zs = {};
|
|
632
632
|
Zs.NODE_ENV === "production" ? Yt.exports = Js() : Yt.exports = Ys();
|
|
633
|
-
var
|
|
634
|
-
function
|
|
635
|
-
const e =
|
|
633
|
+
var ht = Yt.exports;
|
|
634
|
+
function se(n) {
|
|
635
|
+
const e = mt(n);
|
|
636
636
|
let t = 3735928559 ^ e.length, r = 1103547991 ^ e.length;
|
|
637
637
|
for (let s = 0; s < e.length; s++) {
|
|
638
638
|
const i = e.charCodeAt(s);
|
|
@@ -640,13 +640,13 @@ function ie(n) {
|
|
|
640
640
|
}
|
|
641
641
|
return t = Math.imul(t ^ t >>> 16, 2246822507) ^ Math.imul(r ^ r >>> 13, 3266489909), r = Math.imul(r ^ r >>> 16, 2246822507) ^ Math.imul(t ^ t >>> 13, 3266489909), `${(r >>> 0).toString(16).padStart(8, "0")}${(t >>> 0).toString(16).padStart(8, "0")}`;
|
|
642
642
|
}
|
|
643
|
-
function
|
|
643
|
+
function mt(n) {
|
|
644
644
|
if (n && typeof n.toJSON == "function")
|
|
645
|
-
return
|
|
645
|
+
return mt(n.toJSON());
|
|
646
646
|
if (Array.isArray(n)) {
|
|
647
647
|
let e = "[";
|
|
648
648
|
for (let t = 0; t < n.length; t++)
|
|
649
|
-
t > 0 && (e += ","), e +=
|
|
649
|
+
t > 0 && (e += ","), e += mt(n[t]);
|
|
650
650
|
return e + "]";
|
|
651
651
|
}
|
|
652
652
|
if (n && typeof n == "object") {
|
|
@@ -655,7 +655,7 @@ function wt(n) {
|
|
|
655
655
|
let t = "{", r = !0;
|
|
656
656
|
for (let s = 0; s < e.length; s++) {
|
|
657
657
|
const i = e[s], o = n[i];
|
|
658
|
-
o !== void 0 && (r || (t += ","), t += JSON.stringify(i) + ":" +
|
|
658
|
+
o !== void 0 && (r || (t += ","), t += JSON.stringify(i) + ":" + mt(o), r = !1);
|
|
659
659
|
}
|
|
660
660
|
return t + "}";
|
|
661
661
|
}
|
|
@@ -706,11 +706,11 @@ const X = {
|
|
|
706
706
|
Remove: "remove",
|
|
707
707
|
Replace: "replace",
|
|
708
708
|
Add: "add"
|
|
709
|
-
}, jr = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), Xs = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"),
|
|
709
|
+
}, jr = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), Xs = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), wt = Symbol.iterator, pe = {
|
|
710
710
|
mutable: "mutable",
|
|
711
711
|
immutable: "immutable"
|
|
712
712
|
}, bn = {};
|
|
713
|
-
function
|
|
713
|
+
function st(n, e) {
|
|
714
714
|
return n instanceof Map ? n.has(e) : Object.prototype.hasOwnProperty.call(n, e);
|
|
715
715
|
}
|
|
716
716
|
function Qn(n, e) {
|
|
@@ -735,14 +735,14 @@ function he(n) {
|
|
|
735
735
|
return (e = n.copy) !== null && e !== void 0 ? e : n.original;
|
|
736
736
|
}
|
|
737
737
|
function $e(n) {
|
|
738
|
-
return !!
|
|
738
|
+
return !!x(n);
|
|
739
739
|
}
|
|
740
|
-
function
|
|
740
|
+
function x(n) {
|
|
741
741
|
return typeof n != "object" ? null : n == null ? void 0 : n[jr];
|
|
742
742
|
}
|
|
743
743
|
function mn(n) {
|
|
744
744
|
var e;
|
|
745
|
-
const t =
|
|
745
|
+
const t = x(n);
|
|
746
746
|
return t ? (e = t.copy) !== null && e !== void 0 ? e : t.original : n;
|
|
747
747
|
}
|
|
748
748
|
function me(n, e) {
|
|
@@ -753,11 +753,11 @@ function me(n, e) {
|
|
|
753
753
|
}
|
|
754
754
|
function $r(n, e = []) {
|
|
755
755
|
if (Object.hasOwnProperty.call(n, "key")) {
|
|
756
|
-
const t = n.parent.copy, r =
|
|
756
|
+
const t = n.parent.copy, r = x(Ee(t, n.key));
|
|
757
757
|
if (r !== null && (r == null ? void 0 : r.original) !== n.original)
|
|
758
758
|
return null;
|
|
759
759
|
const s = n.parent.type === 3, i = s ? Array.from(n.parent.setMap.keys()).indexOf(n.key) : n.key;
|
|
760
|
-
if (!(s && t.size > i ||
|
|
760
|
+
if (!(s && t.size > i || st(t, i)))
|
|
761
761
|
return null;
|
|
762
762
|
e.push(i);
|
|
763
763
|
}
|
|
@@ -774,17 +774,17 @@ function $r(n, e = []) {
|
|
|
774
774
|
function xe(n) {
|
|
775
775
|
return Array.isArray(n) ? 1 : n instanceof Map ? 2 : n instanceof Set ? 3 : 0;
|
|
776
776
|
}
|
|
777
|
-
function
|
|
777
|
+
function Ee(n, e) {
|
|
778
778
|
return xe(n) === 2 ? n.get(e) : n[e];
|
|
779
779
|
}
|
|
780
|
-
function
|
|
780
|
+
function at(n, e, t) {
|
|
781
781
|
xe(n) === 2 ? n.set(e, t) : n[e] = t;
|
|
782
782
|
}
|
|
783
783
|
function Nt(n, e) {
|
|
784
|
-
const t =
|
|
784
|
+
const t = x(n);
|
|
785
785
|
return (t ? he(t) : n)[e];
|
|
786
786
|
}
|
|
787
|
-
function
|
|
787
|
+
function Oe(n, e) {
|
|
788
788
|
return n === e ? n !== 0 || 1 / n === 1 / e : n !== n && e !== e;
|
|
789
789
|
}
|
|
790
790
|
function Zt(n) {
|
|
@@ -792,7 +792,7 @@ function Zt(n) {
|
|
|
792
792
|
for (; n.finalities.revoke.length > 0; )
|
|
793
793
|
n.finalities.revoke.pop()();
|
|
794
794
|
}
|
|
795
|
-
function
|
|
795
|
+
function Me(n, e) {
|
|
796
796
|
return e ? n : [""].concat(n).map((t) => {
|
|
797
797
|
const r = `${t}`;
|
|
798
798
|
return r.indexOf("/") === -1 && r.indexOf("~") === -1 ? r : r.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
@@ -801,7 +801,7 @@ function Re(n, e) {
|
|
|
801
801
|
function ei(n, e) {
|
|
802
802
|
for (let t = 0; t < e.length - 1; t += 1) {
|
|
803
803
|
const r = e[t];
|
|
804
|
-
if (n =
|
|
804
|
+
if (n = Ee(xe(n) === 3 ? Array.from(n) : n, r), typeof n != "object")
|
|
805
805
|
throw new Error(`Cannot resolve patch at '${e.join("/")}'.`);
|
|
806
806
|
}
|
|
807
807
|
return n;
|
|
@@ -893,9 +893,9 @@ function Xe(n) {
|
|
|
893
893
|
function Tt(n) {
|
|
894
894
|
return $e(n) ? Xe(n) : n;
|
|
895
895
|
}
|
|
896
|
-
function
|
|
896
|
+
function Se(n) {
|
|
897
897
|
var e;
|
|
898
|
-
n.assignedMap = (e = n.assignedMap) !== null && e !== void 0 ? e : /* @__PURE__ */ new Map(), n.operated || (n.operated = !0, n.parent &&
|
|
898
|
+
n.assignedMap = (e = n.assignedMap) !== null && e !== void 0 ? e : /* @__PURE__ */ new Map(), n.operated || (n.operated = !0, n.parent && Se(n.parent));
|
|
899
899
|
}
|
|
900
900
|
function Bn() {
|
|
901
901
|
throw new Error("Cannot modify frozen object");
|
|
@@ -966,10 +966,10 @@ function Dr(n, e, t) {
|
|
|
966
966
|
if (e.add(n), wn(n, (i, o) => {
|
|
967
967
|
var a;
|
|
968
968
|
if ($e(o)) {
|
|
969
|
-
const c =
|
|
969
|
+
const c = x(o);
|
|
970
970
|
ce(c);
|
|
971
971
|
const u = !((a = c.assignedMap) === null || a === void 0) && a.size || c.operated ? c.copy : c.original;
|
|
972
|
-
|
|
972
|
+
at(r ? s : n, i, u);
|
|
973
973
|
} else
|
|
974
974
|
Dr(o, e, t);
|
|
975
975
|
}), s) {
|
|
@@ -981,7 +981,7 @@ function Dr(n, e, t) {
|
|
|
981
981
|
}
|
|
982
982
|
function ri(n, e) {
|
|
983
983
|
const t = n.type === 3 ? n.setMap : n.copy;
|
|
984
|
-
n.finalities.revoke.length > 1 && n.assignedMap.get(e) && t && Dr(
|
|
984
|
+
n.finalities.revoke.length > 1 && n.assignedMap.get(e) && t && Dr(Ee(t, e), n.finalities.handledSet, n.options);
|
|
985
985
|
}
|
|
986
986
|
function Xt(n) {
|
|
987
987
|
n.type === 3 && n.copy && (n.copy.clear(), n.setMap.forEach((e) => {
|
|
@@ -997,18 +997,18 @@ function en(n, e, t, r) {
|
|
|
997
997
|
n.finalized = !0;
|
|
998
998
|
}
|
|
999
999
|
}
|
|
1000
|
-
function
|
|
1001
|
-
const s =
|
|
1000
|
+
function Tn(n, e, t, r) {
|
|
1001
|
+
const s = x(t);
|
|
1002
1002
|
s && (s.callbacks || (s.callbacks = []), s.callbacks.push((i, o) => {
|
|
1003
1003
|
var a;
|
|
1004
1004
|
const c = n.type === 3 ? n.setMap : n.copy;
|
|
1005
|
-
if (Ee(
|
|
1005
|
+
if (Oe(Ee(c, e), t)) {
|
|
1006
1006
|
let u = s.original;
|
|
1007
|
-
s.copy && (u = s.copy), Xt(n), en(n, r, i, o), n.options.enableAutoFreeze && (n.options.updatedValues = (a = n.options.updatedValues) !== null && a !== void 0 ? a : /* @__PURE__ */ new WeakMap(), n.options.updatedValues.set(u, s.original)),
|
|
1007
|
+
s.copy && (u = s.copy), Xt(n), en(n, r, i, o), n.options.enableAutoFreeze && (n.options.updatedValues = (a = n.options.updatedValues) !== null && a !== void 0 ? a : /* @__PURE__ */ new WeakMap(), n.options.updatedValues.set(u, s.original)), at(c, e, u);
|
|
1008
1008
|
}
|
|
1009
1009
|
}), n.options.enableAutoFreeze && s.finalities !== n.finalities && (n.options.enableAutoFreeze = !1)), me(t, n.options) && n.finalities.draft.push(() => {
|
|
1010
1010
|
const i = n.type === 3 ? n.setMap : n.copy;
|
|
1011
|
-
Ee(
|
|
1011
|
+
Oe(Ee(i, e), t) && ri(n, e);
|
|
1012
1012
|
});
|
|
1013
1013
|
}
|
|
1014
1014
|
function si(n, e, t, r, s) {
|
|
@@ -1016,7 +1016,7 @@ function si(n, e, t, r, s) {
|
|
|
1016
1016
|
c.length < i.length && ([i, c] = [c, i], [t, r] = [r, t]);
|
|
1017
1017
|
for (let u = 0; u < i.length; u += 1)
|
|
1018
1018
|
if (o.get(u.toString()) && c[u] !== i[u]) {
|
|
1019
|
-
const l = e.concat([u]), f =
|
|
1019
|
+
const l = e.concat([u]), f = Me(l, s);
|
|
1020
1020
|
t.push({
|
|
1021
1021
|
op: X.Replace,
|
|
1022
1022
|
path: f,
|
|
@@ -1030,7 +1030,7 @@ function si(n, e, t, r, s) {
|
|
|
1030
1030
|
});
|
|
1031
1031
|
}
|
|
1032
1032
|
for (let u = i.length; u < c.length; u += 1) {
|
|
1033
|
-
const l = e.concat([u]), f =
|
|
1033
|
+
const l = e.concat([u]), f = Me(l, s);
|
|
1034
1034
|
t.push({
|
|
1035
1035
|
op: X.Add,
|
|
1036
1036
|
path: f,
|
|
@@ -1041,7 +1041,7 @@ function si(n, e, t, r, s) {
|
|
|
1041
1041
|
if (i.length < c.length) {
|
|
1042
1042
|
const { arrayLengthAssignment: u = !0 } = a.enablePatches;
|
|
1043
1043
|
if (u) {
|
|
1044
|
-
const l = e.concat(["length"]), f =
|
|
1044
|
+
const l = e.concat(["length"]), f = Me(l, s);
|
|
1045
1045
|
r.push({
|
|
1046
1046
|
op: X.Replace,
|
|
1047
1047
|
path: f,
|
|
@@ -1049,7 +1049,7 @@ function si(n, e, t, r, s) {
|
|
|
1049
1049
|
});
|
|
1050
1050
|
} else
|
|
1051
1051
|
for (let l = c.length; i.length < l; l -= 1) {
|
|
1052
|
-
const f = e.concat([l - 1]), h =
|
|
1052
|
+
const f = e.concat([l - 1]), h = Me(f, s);
|
|
1053
1053
|
r.push({
|
|
1054
1054
|
op: X.Remove,
|
|
1055
1055
|
path: h
|
|
@@ -1059,18 +1059,18 @@ function si(n, e, t, r, s) {
|
|
|
1059
1059
|
}
|
|
1060
1060
|
function ii({ original: n, copy: e, assignedMap: t }, r, s, i, o) {
|
|
1061
1061
|
t.forEach((a, c) => {
|
|
1062
|
-
const u =
|
|
1063
|
-
if (
|
|
1062
|
+
const u = Ee(n, c), l = Tt(Ee(e, c)), f = a ? st(n, c) ? X.Replace : X.Add : X.Remove;
|
|
1063
|
+
if (Oe(u, l) && f === X.Replace)
|
|
1064
1064
|
return;
|
|
1065
|
-
const h = r.concat(c),
|
|
1066
|
-
s.push(f === X.Remove ? { op: f, path:
|
|
1065
|
+
const h = r.concat(c), y = Me(h, o);
|
|
1066
|
+
s.push(f === X.Remove ? { op: f, path: y } : { op: f, path: y, value: l }), i.push(f === X.Add ? { op: X.Remove, path: y } : f === X.Remove ? { op: X.Add, path: y, value: u } : { op: X.Replace, path: y, value: u });
|
|
1067
1067
|
});
|
|
1068
1068
|
}
|
|
1069
1069
|
function oi({ original: n, copy: e }, t, r, s, i) {
|
|
1070
1070
|
let o = 0;
|
|
1071
1071
|
n.forEach((a) => {
|
|
1072
1072
|
if (!e.has(a)) {
|
|
1073
|
-
const c = t.concat([o]), u =
|
|
1073
|
+
const c = t.concat([o]), u = Me(c, i);
|
|
1074
1074
|
r.push({
|
|
1075
1075
|
op: X.Remove,
|
|
1076
1076
|
path: u,
|
|
@@ -1084,7 +1084,7 @@ function oi({ original: n, copy: e }, t, r, s, i) {
|
|
|
1084
1084
|
o += 1;
|
|
1085
1085
|
}), o = 0, e.forEach((a) => {
|
|
1086
1086
|
if (!n.has(a)) {
|
|
1087
|
-
const c = t.concat([o]), u =
|
|
1087
|
+
const c = t.concat([o]), u = Me(c, i);
|
|
1088
1088
|
r.push({
|
|
1089
1089
|
op: X.Add,
|
|
1090
1090
|
path: u,
|
|
@@ -1098,7 +1098,7 @@ function oi({ original: n, copy: e }, t, r, s, i) {
|
|
|
1098
1098
|
o += 1;
|
|
1099
1099
|
});
|
|
1100
1100
|
}
|
|
1101
|
-
function
|
|
1101
|
+
function ot(n, e, t, r) {
|
|
1102
1102
|
const { pathAsArray: s = !0 } = n.options.enablePatches;
|
|
1103
1103
|
switch (n.type) {
|
|
1104
1104
|
case 0:
|
|
@@ -1115,39 +1115,39 @@ const Ot = (n, e, t = !1) => {
|
|
|
1115
1115
|
throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.");
|
|
1116
1116
|
}, tn = {
|
|
1117
1117
|
get size() {
|
|
1118
|
-
return he(
|
|
1118
|
+
return he(x(this)).size;
|
|
1119
1119
|
},
|
|
1120
1120
|
has(n) {
|
|
1121
|
-
return he(
|
|
1121
|
+
return he(x(this)).has(n);
|
|
1122
1122
|
},
|
|
1123
1123
|
set(n, e) {
|
|
1124
|
-
const t =
|
|
1125
|
-
return (!r.has(n) || !
|
|
1124
|
+
const t = x(this), r = he(t);
|
|
1125
|
+
return (!r.has(n) || !Oe(r.get(n), e)) && (ce(t), Se(t), t.assignedMap.set(n, !0), t.copy.set(n, e), Tn(t, n, e, ot)), this;
|
|
1126
1126
|
},
|
|
1127
1127
|
delete(n) {
|
|
1128
1128
|
if (!this.has(n))
|
|
1129
1129
|
return !1;
|
|
1130
|
-
const e =
|
|
1131
|
-
return ce(e),
|
|
1130
|
+
const e = x(this);
|
|
1131
|
+
return ce(e), Se(e), e.original.has(n) ? e.assignedMap.set(n, !1) : e.assignedMap.delete(n), e.copy.delete(n), !0;
|
|
1132
1132
|
},
|
|
1133
1133
|
clear() {
|
|
1134
|
-
const n =
|
|
1134
|
+
const n = x(this);
|
|
1135
1135
|
if (this.size) {
|
|
1136
|
-
ce(n),
|
|
1136
|
+
ce(n), Se(n), n.assignedMap = /* @__PURE__ */ new Map();
|
|
1137
1137
|
for (const [e] of n.original)
|
|
1138
1138
|
n.assignedMap.set(e, !1);
|
|
1139
1139
|
n.copy.clear();
|
|
1140
1140
|
}
|
|
1141
1141
|
},
|
|
1142
1142
|
forEach(n, e) {
|
|
1143
|
-
const t =
|
|
1143
|
+
const t = x(this);
|
|
1144
1144
|
he(t).forEach((r, s) => {
|
|
1145
1145
|
n.call(e, this.get(s), s, this);
|
|
1146
1146
|
});
|
|
1147
1147
|
},
|
|
1148
1148
|
get(n) {
|
|
1149
1149
|
var e, t;
|
|
1150
|
-
const r =
|
|
1150
|
+
const r = x(this), s = he(r).get(n), i = ((t = (e = r.options).mark) === null || t === void 0 ? void 0 : t.call(e, s, pe)) === pe.mutable;
|
|
1151
1151
|
if (r.options.strict && Ot(s, r.options, i), i || r.finalized || !me(s, r.options) || s !== r.original.get(n))
|
|
1152
1152
|
return s;
|
|
1153
1153
|
const o = bn.createDraft({
|
|
@@ -1160,12 +1160,12 @@ const Ot = (n, e, t = !1) => {
|
|
|
1160
1160
|
return ce(r), r.copy.set(n, o), o;
|
|
1161
1161
|
},
|
|
1162
1162
|
keys() {
|
|
1163
|
-
return he(
|
|
1163
|
+
return he(x(this)).keys();
|
|
1164
1164
|
},
|
|
1165
1165
|
values() {
|
|
1166
1166
|
const n = this.keys();
|
|
1167
1167
|
return {
|
|
1168
|
-
[
|
|
1168
|
+
[wt]: () => this.values(),
|
|
1169
1169
|
next: () => {
|
|
1170
1170
|
const e = n.next();
|
|
1171
1171
|
return e.done ? e : {
|
|
@@ -1178,7 +1178,7 @@ const Ot = (n, e, t = !1) => {
|
|
|
1178
1178
|
entries() {
|
|
1179
1179
|
const n = this.keys();
|
|
1180
1180
|
return {
|
|
1181
|
-
[
|
|
1181
|
+
[wt]: () => this.entries(),
|
|
1182
1182
|
next: () => {
|
|
1183
1183
|
const e = n.next();
|
|
1184
1184
|
if (e.done)
|
|
@@ -1191,7 +1191,7 @@ const Ot = (n, e, t = !1) => {
|
|
|
1191
1191
|
}
|
|
1192
1192
|
};
|
|
1193
1193
|
},
|
|
1194
|
-
[
|
|
1194
|
+
[wt]() {
|
|
1195
1195
|
return this.entries();
|
|
1196
1196
|
}
|
|
1197
1197
|
}, ai = Reflect.ownKeys(tn), Gn = (n, e, { isValuesIterator: t }) => () => {
|
|
@@ -1201,7 +1201,7 @@ const Ot = (n, e, t = !1) => {
|
|
|
1201
1201
|
return i;
|
|
1202
1202
|
const o = i.value;
|
|
1203
1203
|
let a = n.setMap.get(o);
|
|
1204
|
-
const c =
|
|
1204
|
+
const c = x(a), u = ((s = (r = n.options).mark) === null || s === void 0 ? void 0 : s.call(r, a, pe)) === pe.mutable;
|
|
1205
1205
|
if (n.options.strict && Ot(o, n.options, u), !u && !c && me(o, n.options) && !n.finalized && n.original.has(o)) {
|
|
1206
1206
|
const l = bn.createDraft({
|
|
1207
1207
|
original: o,
|
|
@@ -1218,39 +1218,39 @@ const Ot = (n, e, t = !1) => {
|
|
|
1218
1218
|
};
|
|
1219
1219
|
}, Et = {
|
|
1220
1220
|
get size() {
|
|
1221
|
-
return
|
|
1221
|
+
return x(this).setMap.size;
|
|
1222
1222
|
},
|
|
1223
1223
|
has(n) {
|
|
1224
|
-
const e =
|
|
1224
|
+
const e = x(this);
|
|
1225
1225
|
if (e.setMap.has(n))
|
|
1226
1226
|
return !0;
|
|
1227
1227
|
ce(e);
|
|
1228
|
-
const t =
|
|
1228
|
+
const t = x(n);
|
|
1229
1229
|
return !!(t && e.setMap.has(t.original));
|
|
1230
1230
|
},
|
|
1231
1231
|
add(n) {
|
|
1232
|
-
const e =
|
|
1233
|
-
return this.has(n) || (ce(e),
|
|
1232
|
+
const e = x(this);
|
|
1233
|
+
return this.has(n) || (ce(e), Se(e), e.assignedMap.set(n, !0), e.setMap.set(n, n), Tn(e, n, n, ot)), this;
|
|
1234
1234
|
},
|
|
1235
1235
|
delete(n) {
|
|
1236
1236
|
if (!this.has(n))
|
|
1237
1237
|
return !1;
|
|
1238
|
-
const e =
|
|
1239
|
-
ce(e),
|
|
1240
|
-
const t =
|
|
1238
|
+
const e = x(this);
|
|
1239
|
+
ce(e), Se(e);
|
|
1240
|
+
const t = x(n);
|
|
1241
1241
|
return t && e.setMap.has(t.original) ? (e.assignedMap.set(t.original, !1), e.setMap.delete(t.original)) : (!t && e.setMap.has(n) ? e.assignedMap.set(n, !1) : e.assignedMap.delete(n), e.setMap.delete(n));
|
|
1242
1242
|
},
|
|
1243
1243
|
clear() {
|
|
1244
1244
|
if (!this.size)
|
|
1245
1245
|
return;
|
|
1246
|
-
const n =
|
|
1247
|
-
ce(n),
|
|
1246
|
+
const n = x(this);
|
|
1247
|
+
ce(n), Se(n);
|
|
1248
1248
|
for (const e of n.original)
|
|
1249
1249
|
n.assignedMap.set(e, !1);
|
|
1250
1250
|
n.setMap.clear();
|
|
1251
1251
|
},
|
|
1252
1252
|
values() {
|
|
1253
|
-
const n =
|
|
1253
|
+
const n = x(this);
|
|
1254
1254
|
ce(n);
|
|
1255
1255
|
const e = n.setMap.keys();
|
|
1256
1256
|
return {
|
|
@@ -1259,7 +1259,7 @@ const Ot = (n, e, t = !1) => {
|
|
|
1259
1259
|
};
|
|
1260
1260
|
},
|
|
1261
1261
|
entries() {
|
|
1262
|
-
const n =
|
|
1262
|
+
const n = x(this);
|
|
1263
1263
|
ce(n);
|
|
1264
1264
|
const e = n.setMap.keys();
|
|
1265
1265
|
return {
|
|
@@ -1272,7 +1272,7 @@ const Ot = (n, e, t = !1) => {
|
|
|
1272
1272
|
keys() {
|
|
1273
1273
|
return this.values();
|
|
1274
1274
|
},
|
|
1275
|
-
[
|
|
1275
|
+
[wt]() {
|
|
1276
1276
|
return this.values();
|
|
1277
1277
|
},
|
|
1278
1278
|
forEach(n, e) {
|
|
@@ -1334,7 +1334,7 @@ const ci = Reflect.ownKeys(Et), Ur = /* @__PURE__ */ new WeakSet(), Lr = {
|
|
|
1334
1334
|
if (u)
|
|
1335
1335
|
return u.bind(n.proxy);
|
|
1336
1336
|
}
|
|
1337
|
-
if (!
|
|
1337
|
+
if (!st(a, e)) {
|
|
1338
1338
|
const u = Qn(a, e);
|
|
1339
1339
|
return u ? "value" in u ? u.value : (
|
|
1340
1340
|
// !case: support for getter
|
|
@@ -1345,15 +1345,15 @@ const ci = Reflect.ownKeys(Et), Ur = /* @__PURE__ */ new WeakSet(), Lr = {
|
|
|
1345
1345
|
if (n.options.strict && Ot(c, n.options), n.finalized || !me(c, n.options))
|
|
1346
1346
|
return c;
|
|
1347
1347
|
if (c === Nt(n.original, e)) {
|
|
1348
|
-
if (ce(n), n.copy[e] =
|
|
1348
|
+
if (ce(n), n.copy[e] = Sn({
|
|
1349
1349
|
original: n.original[e],
|
|
1350
1350
|
parentDraft: n,
|
|
1351
1351
|
key: n.type === 1 ? Number(e) : e,
|
|
1352
1352
|
finalities: n.finalities,
|
|
1353
1353
|
options: n.options
|
|
1354
1354
|
}), typeof o == "function") {
|
|
1355
|
-
const u =
|
|
1356
|
-
return ce(u),
|
|
1355
|
+
const u = x(n.copy[e]);
|
|
1356
|
+
return ce(u), Se(u), u.copy;
|
|
1357
1357
|
}
|
|
1358
1358
|
return n.copy[e];
|
|
1359
1359
|
}
|
|
@@ -1369,8 +1369,8 @@ const ci = Reflect.ownKeys(Et), Ur = /* @__PURE__ */ new WeakSet(), Lr = {
|
|
|
1369
1369
|
const i = Qn(he(n), e);
|
|
1370
1370
|
if (i != null && i.set)
|
|
1371
1371
|
return i.set.call(n.proxy, t), !0;
|
|
1372
|
-
const o = Nt(he(n), e), a =
|
|
1373
|
-
return a &&
|
|
1372
|
+
const o = Nt(he(n), e), a = x(o);
|
|
1373
|
+
return a && Oe(a.original, t) ? (n.copy[e] = t, n.assignedMap = (r = n.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), n.assignedMap.set(e, !1), !0) : (Oe(t, o) && (t !== void 0 || st(n.original, e)) || (ce(n), Se(n), st(n.original, e) && Oe(t, n.original[e]) ? n.assignedMap.delete(e) : n.assignedMap.set(e, !0), n.copy[e] = t, Tn(n, e, t, ot)), !0);
|
|
1374
1374
|
},
|
|
1375
1375
|
has(n, e) {
|
|
1376
1376
|
return e in he(n);
|
|
@@ -1398,10 +1398,10 @@ const ci = Reflect.ownKeys(Et), Ur = /* @__PURE__ */ new WeakSet(), Lr = {
|
|
|
1398
1398
|
},
|
|
1399
1399
|
deleteProperty(n, e) {
|
|
1400
1400
|
var t;
|
|
1401
|
-
return n.type === 1 ? Lr.set.call(this, n, e, void 0, n.proxy) : (Nt(n.original, e) !== void 0 || e in n.original ? (ce(n),
|
|
1401
|
+
return n.type === 1 ? Lr.set.call(this, n, e, void 0, n.proxy) : (Nt(n.original, e) !== void 0 || e in n.original ? (ce(n), Se(n), n.assignedMap.set(e, !1)) : (n.assignedMap = (t = n.assignedMap) !== null && t !== void 0 ? t : /* @__PURE__ */ new Map(), n.assignedMap.delete(e)), n.copy && delete n.copy[e], !0);
|
|
1402
1402
|
}
|
|
1403
1403
|
};
|
|
1404
|
-
function
|
|
1404
|
+
function Sn(n) {
|
|
1405
1405
|
const { original: e, parentDraft: t, key: r, finalities: s, options: i } = n, o = xe(e), a = {
|
|
1406
1406
|
type: o,
|
|
1407
1407
|
finalized: !1,
|
|
@@ -1419,30 +1419,30 @@ function Tn(n) {
|
|
|
1419
1419
|
if (s.revoke.push(u), Ur.add(c), a.proxy = c, t) {
|
|
1420
1420
|
const l = t;
|
|
1421
1421
|
l.finalities.draft.push((f, h) => {
|
|
1422
|
-
var
|
|
1423
|
-
const g =
|
|
1424
|
-
let
|
|
1425
|
-
const S =
|
|
1426
|
-
if (
|
|
1427
|
-
let T =
|
|
1428
|
-
|
|
1422
|
+
var y, b;
|
|
1423
|
+
const g = x(c);
|
|
1424
|
+
let m = l.type === 3 ? l.setMap : l.copy;
|
|
1425
|
+
const S = Ee(m, r), _ = x(S);
|
|
1426
|
+
if (_) {
|
|
1427
|
+
let T = _.original;
|
|
1428
|
+
_.operated && (T = mn(S)), Xt(_), en(_, ot, f, h), l.options.enableAutoFreeze && (l.options.updatedValues = (y = l.options.updatedValues) !== null && y !== void 0 ? y : /* @__PURE__ */ new WeakMap(), l.options.updatedValues.set(T, _.original)), at(m, r, T);
|
|
1429
1429
|
}
|
|
1430
|
-
(
|
|
1430
|
+
(b = g.callbacks) === null || b === void 0 || b.forEach((T) => {
|
|
1431
1431
|
T(f, h);
|
|
1432
1432
|
});
|
|
1433
1433
|
});
|
|
1434
1434
|
} else {
|
|
1435
|
-
const l =
|
|
1435
|
+
const l = x(c);
|
|
1436
1436
|
l.finalities.draft.push((f, h) => {
|
|
1437
|
-
Xt(l), en(l,
|
|
1437
|
+
Xt(l), en(l, ot, f, h);
|
|
1438
1438
|
});
|
|
1439
1439
|
}
|
|
1440
1440
|
return c;
|
|
1441
1441
|
}
|
|
1442
|
-
bn.createDraft =
|
|
1442
|
+
bn.createDraft = Sn;
|
|
1443
1443
|
function ui(n, e, t, r, s) {
|
|
1444
1444
|
var i;
|
|
1445
|
-
const o =
|
|
1445
|
+
const o = x(n), a = (i = o == null ? void 0 : o.original) !== null && i !== void 0 ? i : n, c = !!e.length;
|
|
1446
1446
|
if (o != null && o.operated)
|
|
1447
1447
|
for (; o.finalities.draft.length > 0; )
|
|
1448
1448
|
o.finalities.draft.pop()(t, r);
|
|
@@ -1462,7 +1462,7 @@ function li(n, e) {
|
|
|
1462
1462
|
};
|
|
1463
1463
|
let s, i;
|
|
1464
1464
|
e.enablePatches && (s = [], i = []);
|
|
1465
|
-
const a = ((t = e.mark) === null || t === void 0 ? void 0 : t.call(e, n, pe)) === pe.mutable || !me(n, e) ? n :
|
|
1465
|
+
const a = ((t = e.mark) === null || t === void 0 ? void 0 : t.call(e, n, pe)) === pe.mutable || !me(n, e) ? n : Sn({
|
|
1466
1466
|
original: n,
|
|
1467
1467
|
parentDraft: null,
|
|
1468
1468
|
finalities: r,
|
|
@@ -1479,7 +1479,7 @@ function li(n, e) {
|
|
|
1479
1479
|
function nn(n) {
|
|
1480
1480
|
const { rootDraft: e, value: t, useRawReturn: r = !1, isRoot: s = !0 } = n;
|
|
1481
1481
|
wn(t, (i, o, a) => {
|
|
1482
|
-
const c =
|
|
1482
|
+
const c = x(o);
|
|
1483
1483
|
if (c && e && c.finalities === e.finalities) {
|
|
1484
1484
|
n.isContainDraft = !0;
|
|
1485
1485
|
const u = c.original;
|
|
@@ -1487,13 +1487,13 @@ function nn(n) {
|
|
|
1487
1487
|
const l = Array.from(a);
|
|
1488
1488
|
a.clear(), l.forEach((f) => a.add(i === f ? u : f));
|
|
1489
1489
|
} else
|
|
1490
|
-
|
|
1490
|
+
at(a, i, u);
|
|
1491
1491
|
} else typeof o == "object" && o !== null && (n.value = o, n.isRoot = !1, nn(n));
|
|
1492
1492
|
}), s && (n.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."));
|
|
1493
1493
|
}
|
|
1494
1494
|
function Fr(n) {
|
|
1495
1495
|
var e;
|
|
1496
|
-
const t =
|
|
1496
|
+
const t = x(n);
|
|
1497
1497
|
if (!me(n, t == null ? void 0 : t.options))
|
|
1498
1498
|
return n;
|
|
1499
1499
|
const r = xe(n);
|
|
@@ -1513,10 +1513,10 @@ function Fr(n) {
|
|
|
1513
1513
|
} else
|
|
1514
1514
|
s = n;
|
|
1515
1515
|
if (wn(s, (o, a) => {
|
|
1516
|
-
if (t && Ee(
|
|
1516
|
+
if (t && Oe(Ee(t.original, o), a))
|
|
1517
1517
|
return;
|
|
1518
1518
|
const c = Fr(a);
|
|
1519
|
-
c !== a && (s === n && i(),
|
|
1519
|
+
c !== a && (s === n && i(), at(s, o, c));
|
|
1520
1520
|
}), r === 3) {
|
|
1521
1521
|
const o = (e = t == null ? void 0 : t.original) !== null && e !== void 0 ? e : s;
|
|
1522
1522
|
return gn(o) ? new Set(s) : new (Object.getPrototypeOf(o)).constructor(s);
|
|
@@ -1531,72 +1531,72 @@ function Hn(n) {
|
|
|
1531
1531
|
const fi = (n) => function e(t, r, s) {
|
|
1532
1532
|
var i, o, a;
|
|
1533
1533
|
if (typeof t == "function" && typeof r != "function")
|
|
1534
|
-
return function(O, ...
|
|
1535
|
-
return e(O, (
|
|
1534
|
+
return function(O, ...F) {
|
|
1535
|
+
return e(O, (P) => t.call(this, P, ...F), r);
|
|
1536
1536
|
};
|
|
1537
1537
|
const c = t, u = r;
|
|
1538
1538
|
let l = s;
|
|
1539
1539
|
if (typeof r != "function" && (l = r), l !== void 0 && Object.prototype.toString.call(l) !== "[object Object]")
|
|
1540
1540
|
throw new Error(`Invalid options: ${l}, 'options' should be an object.`);
|
|
1541
1541
|
l = Object.assign(Object.assign({}, n), l);
|
|
1542
|
-
const f = $e(c) ? Hn(c) : c, h = Array.isArray(l.mark) ? (O,
|
|
1543
|
-
for (const
|
|
1544
|
-
if (typeof
|
|
1545
|
-
throw new Error(`Invalid mark: ${
|
|
1546
|
-
const
|
|
1547
|
-
if (
|
|
1548
|
-
return
|
|
1549
|
-
}
|
|
1550
|
-
} : l.mark,
|
|
1542
|
+
const f = $e(c) ? Hn(c) : c, h = Array.isArray(l.mark) ? (O, F) => {
|
|
1543
|
+
for (const P of l.mark) {
|
|
1544
|
+
if (typeof P != "function")
|
|
1545
|
+
throw new Error(`Invalid mark: ${P}, 'mark' should be a function.`);
|
|
1546
|
+
const C = P(O, F);
|
|
1547
|
+
if (C)
|
|
1548
|
+
return C;
|
|
1549
|
+
}
|
|
1550
|
+
} : l.mark, y = (i = l.enablePatches) !== null && i !== void 0 ? i : !1, b = (o = l.strict) !== null && o !== void 0 ? o : !1, m = {
|
|
1551
1551
|
enableAutoFreeze: (a = l.enableAutoFreeze) !== null && a !== void 0 ? a : !1,
|
|
1552
1552
|
mark: h,
|
|
1553
|
-
strict:
|
|
1554
|
-
enablePatches:
|
|
1553
|
+
strict: b,
|
|
1554
|
+
enablePatches: y
|
|
1555
1555
|
};
|
|
1556
|
-
if (!me(f,
|
|
1556
|
+
if (!me(f, m) && typeof f == "object" && f !== null)
|
|
1557
1557
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
1558
|
-
const [S,
|
|
1558
|
+
const [S, _] = li(f, m);
|
|
1559
1559
|
if (typeof r != "function") {
|
|
1560
|
-
if (!me(f,
|
|
1560
|
+
if (!me(f, m))
|
|
1561
1561
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
1562
|
-
return [S,
|
|
1562
|
+
return [S, _];
|
|
1563
1563
|
}
|
|
1564
1564
|
let T;
|
|
1565
1565
|
try {
|
|
1566
1566
|
T = u(S);
|
|
1567
1567
|
} catch (O) {
|
|
1568
|
-
throw Zt(
|
|
1568
|
+
throw Zt(x(S)), O;
|
|
1569
1569
|
}
|
|
1570
|
-
const
|
|
1571
|
-
const
|
|
1570
|
+
const M = (O) => {
|
|
1571
|
+
const F = x(S);
|
|
1572
1572
|
if (!$e(O)) {
|
|
1573
|
-
if (O !== void 0 && !
|
|
1573
|
+
if (O !== void 0 && !Oe(O, S) && (F != null && F.operated))
|
|
1574
1574
|
throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");
|
|
1575
|
-
const
|
|
1576
|
-
if (
|
|
1577
|
-
const G =
|
|
1578
|
-
return
|
|
1579
|
-
rootDraft:
|
|
1575
|
+
const C = O == null ? void 0 : O[Xs];
|
|
1576
|
+
if (C) {
|
|
1577
|
+
const G = C[0];
|
|
1578
|
+
return m.strict && typeof O == "object" && O !== null && nn({
|
|
1579
|
+
rootDraft: F,
|
|
1580
1580
|
value: O,
|
|
1581
1581
|
useRawReturn: !0
|
|
1582
|
-
}),
|
|
1582
|
+
}), _([G]);
|
|
1583
1583
|
}
|
|
1584
1584
|
if (O !== void 0)
|
|
1585
|
-
return typeof O == "object" && O !== null && nn({ rootDraft:
|
|
1585
|
+
return typeof O == "object" && O !== null && nn({ rootDraft: F, value: O }), _([O]);
|
|
1586
1586
|
}
|
|
1587
1587
|
if (O === S || O === void 0)
|
|
1588
|
-
return
|
|
1589
|
-
const
|
|
1590
|
-
if (
|
|
1591
|
-
if (
|
|
1588
|
+
return _([]);
|
|
1589
|
+
const P = x(O);
|
|
1590
|
+
if (m === P.options) {
|
|
1591
|
+
if (P.operated)
|
|
1592
1592
|
throw new Error("Cannot return a modified child draft.");
|
|
1593
|
-
return
|
|
1593
|
+
return _([Hn(O)]);
|
|
1594
1594
|
}
|
|
1595
|
-
return
|
|
1595
|
+
return _([O]);
|
|
1596
1596
|
};
|
|
1597
|
-
return T instanceof Promise ? T.then(
|
|
1598
|
-
throw Zt(
|
|
1599
|
-
}) :
|
|
1597
|
+
return T instanceof Promise ? T.then(M, (O) => {
|
|
1598
|
+
throw Zt(x(S)), O;
|
|
1599
|
+
}) : M(T);
|
|
1600
1600
|
}, kt = fi();
|
|
1601
1601
|
Object.prototype.constructor.toString();
|
|
1602
1602
|
function Nr(n, e) {
|
|
@@ -1606,8 +1606,8 @@ function Nr(n, e) {
|
|
|
1606
1606
|
function Jn(n, e) {
|
|
1607
1607
|
return Object.keys(n).length === Object.keys(e).length && Object.keys(n).every((t) => e.hasOwnProperty(t) && n[t] === e[t]);
|
|
1608
1608
|
}
|
|
1609
|
-
function
|
|
1610
|
-
return typeof n != "object" || typeof e != "object" || n === null || e === null ? n === e : Nr(n, e) ? Object.keys(n).every((t) =>
|
|
1609
|
+
function St(n, e) {
|
|
1610
|
+
return typeof n != "object" || typeof e != "object" || n === null || e === null ? n === e : Nr(n, e) ? Object.keys(n).every((t) => St(n[t], e[t])) : !1;
|
|
1611
1611
|
}
|
|
1612
1612
|
function vn(n) {
|
|
1613
1613
|
if (!et(n))
|
|
@@ -1890,10 +1890,10 @@ function wi(n) {
|
|
|
1890
1890
|
const [e, t] = n.split(" ");
|
|
1891
1891
|
return /* @__PURE__ */ new Date(e + "T" + t + "Z");
|
|
1892
1892
|
}
|
|
1893
|
-
function
|
|
1893
|
+
function Ti(n) {
|
|
1894
1894
|
return new Date(n);
|
|
1895
1895
|
}
|
|
1896
|
-
function
|
|
1896
|
+
function Si(n) {
|
|
1897
1897
|
const e = /^(\w{3}) (\w{3}) (\d{2}) (\d{4})$/;
|
|
1898
1898
|
if (!n.match(e))
|
|
1899
1899
|
throw new Error(`Unable to parse \`${n}\` as a date.`);
|
|
@@ -1912,10 +1912,10 @@ function Ai(n) {
|
|
|
1912
1912
|
const e = /^(\d+)-(\d{1,2})-(\d{1,2})([ T])(\d{1,2})(?::(\d{1,2}))?(?::(\d{1,2}))?(.*)$/, t = n.match(e);
|
|
1913
1913
|
if (t) {
|
|
1914
1914
|
const [, r, s, i, o, a, c, u, l] = t, f = s.padStart(2, "0"), h = i.padStart(2, "0");
|
|
1915
|
-
let
|
|
1916
|
-
c !== void 0 && (
|
|
1917
|
-
const
|
|
1918
|
-
return new Date(
|
|
1915
|
+
let y = a.padStart(2, "0");
|
|
1916
|
+
c !== void 0 && (y += `:${c.padStart(2, "0")}`), u !== void 0 && (y += `:${u.padStart(2, "0")}`);
|
|
1917
|
+
const b = `${r}-${f}-${h}T${y}${l}`;
|
|
1918
|
+
return new Date(b);
|
|
1919
1919
|
}
|
|
1920
1920
|
return null;
|
|
1921
1921
|
}
|
|
@@ -1948,7 +1948,7 @@ function ki(n) {
|
|
|
1948
1948
|
const Ci = [
|
|
1949
1949
|
_i,
|
|
1950
1950
|
wi,
|
|
1951
|
-
|
|
1951
|
+
Si,
|
|
1952
1952
|
Oi,
|
|
1953
1953
|
bi,
|
|
1954
1954
|
vi,
|
|
@@ -1957,7 +1957,7 @@ const Ci = [
|
|
|
1957
1957
|
Ei,
|
|
1958
1958
|
ki,
|
|
1959
1959
|
Ai,
|
|
1960
|
-
|
|
1960
|
+
Ti
|
|
1961
1961
|
];
|
|
1962
1962
|
function Ii(n, e) {
|
|
1963
1963
|
try {
|
|
@@ -1999,7 +1999,7 @@ function Pt(n) {
|
|
|
1999
1999
|
throw new Error(`Invalid date value \`${n}\`. Expected a date, number, or string, got type ${typeof n}.`);
|
|
2000
2000
|
}
|
|
2001
2001
|
}
|
|
2002
|
-
class
|
|
2002
|
+
class Re {
|
|
2003
2003
|
constructor(e, t) {
|
|
2004
2004
|
p(this, "attrs");
|
|
2005
2005
|
p(this, "linkIndex");
|
|
@@ -2074,7 +2074,7 @@ class Me {
|
|
|
2074
2074
|
return { attrs: this.attrs, linkIndex: this.linkIndex };
|
|
2075
2075
|
}
|
|
2076
2076
|
}
|
|
2077
|
-
function
|
|
2077
|
+
function Mi(n) {
|
|
2078
2078
|
return n.cardinality === "one";
|
|
2079
2079
|
}
|
|
2080
2080
|
function An(n) {
|
|
@@ -2132,18 +2132,18 @@ function Vr(n, e) {
|
|
|
2132
2132
|
}
|
|
2133
2133
|
function Qr(n, e) {
|
|
2134
2134
|
if (n)
|
|
2135
|
-
return new
|
|
2135
|
+
return new Re(n.attrs, n.linkIndex);
|
|
2136
2136
|
if (e && "__type" in e)
|
|
2137
|
-
return new
|
|
2137
|
+
return new Re(e.attrs, e.linkIndex);
|
|
2138
2138
|
}
|
|
2139
|
-
function
|
|
2139
|
+
function Ri(n, e) {
|
|
2140
2140
|
return Be(n.eav, [e]) !== void 0;
|
|
2141
2141
|
}
|
|
2142
2142
|
function tt(n, e, t, r) {
|
|
2143
2143
|
const s = Wr(n, e, r);
|
|
2144
2144
|
return s.cardinalityInference = t, s.useDateObjects = r, s;
|
|
2145
2145
|
}
|
|
2146
|
-
function
|
|
2146
|
+
function ct(n, e) {
|
|
2147
2147
|
var s, i;
|
|
2148
2148
|
let t;
|
|
2149
2149
|
if (Array.isArray(e[0])) {
|
|
@@ -2163,15 +2163,15 @@ function ut(n, e) {
|
|
|
2163
2163
|
const l = (i = fe(c, 2).find((g) => g[2] === a)) == null ? void 0 : i[0];
|
|
2164
2164
|
if (!l)
|
|
2165
2165
|
return null;
|
|
2166
|
-
const [f, h,
|
|
2167
|
-
return [t, h, l, ...
|
|
2166
|
+
const [f, h, y, ...b] = e;
|
|
2167
|
+
return [t, h, l, ...b];
|
|
2168
2168
|
} else {
|
|
2169
2169
|
const [o, ...a] = e;
|
|
2170
2170
|
return [t, ...a];
|
|
2171
2171
|
}
|
|
2172
2172
|
}
|
|
2173
2173
|
function Br(n, e, t) {
|
|
2174
|
-
const r =
|
|
2174
|
+
const r = ct(n, t);
|
|
2175
2175
|
if (!r)
|
|
2176
2176
|
return;
|
|
2177
2177
|
const [s, i, o] = r, a = e.getAttr(i);
|
|
@@ -2185,7 +2185,7 @@ function Gr(n, e, t) {
|
|
|
2185
2185
|
return a && (o = a[3]), o || Date.now() * 10 + ji++;
|
|
2186
2186
|
}
|
|
2187
2187
|
function Hr(n, e, t) {
|
|
2188
|
-
const r =
|
|
2188
|
+
const r = ct(n, t);
|
|
2189
2189
|
if (!r)
|
|
2190
2190
|
return;
|
|
2191
2191
|
let [s, i, o] = r;
|
|
@@ -2194,11 +2194,11 @@ function Hr(n, e, t) {
|
|
|
2194
2194
|
return;
|
|
2195
2195
|
a["checked-data-type"] === "date" && n.useDateObjects && (o = Pt(o));
|
|
2196
2196
|
const c = Be(n.eav, [s, i, o]), u = (c == null ? void 0 : c[3]) ?? Gr(n, a, r), l = [s, i, o, u];
|
|
2197
|
-
|
|
2197
|
+
Mi(a) ? (le(n.eav, [s, i], /* @__PURE__ */ new Map([[o, l]])), le(n.aev, [i, s], /* @__PURE__ */ new Map([[o, l]]))) : (le(n.eav, [s, i, o], l), le(n.aev, [i, s, o], l)), An(a) && le(n.vae, [o, i, s], l);
|
|
2198
2198
|
}
|
|
2199
2199
|
function $i(n, e, t) {
|
|
2200
|
-
var
|
|
2201
|
-
const r =
|
|
2200
|
+
var y;
|
|
2201
|
+
const r = ct(n, t);
|
|
2202
2202
|
if (!r)
|
|
2203
2203
|
return;
|
|
2204
2204
|
const [s, i, o] = r, a = e.getAttr(i);
|
|
@@ -2209,7 +2209,7 @@ function $i(n, e, t) {
|
|
|
2209
2209
|
const c = Be(n.eav, [s, i]);
|
|
2210
2210
|
if (!c)
|
|
2211
2211
|
return;
|
|
2212
|
-
const u = (
|
|
2212
|
+
const u = (y = c.values().next()) == null ? void 0 : y.value;
|
|
2213
2213
|
if (!u)
|
|
2214
2214
|
return;
|
|
2215
2215
|
const l = u[2], f = Kr(l, o), h = [
|
|
@@ -2222,16 +2222,16 @@ function $i(n, e, t) {
|
|
|
2222
2222
|
}
|
|
2223
2223
|
function sn(n, e, t) {
|
|
2224
2224
|
var u, l;
|
|
2225
|
-
const [r, s] = t, i =
|
|
2225
|
+
const [r, s] = t, i = ct(n, [r]);
|
|
2226
2226
|
if (!i)
|
|
2227
2227
|
return;
|
|
2228
2228
|
const [o] = i, a = n.eav.get(o);
|
|
2229
2229
|
if (a) {
|
|
2230
2230
|
for (const f of a.keys()) {
|
|
2231
2231
|
const h = e.getAttr(f);
|
|
2232
|
-
h && h["on-delete-reverse"] === "cascade" && fe(a.get(f), 1).forEach(([
|
|
2233
|
-
var
|
|
2234
|
-
return sn(n, e, [g, (
|
|
2232
|
+
h && h["on-delete-reverse"] === "cascade" && fe(a.get(f), 1).forEach(([y, b, g]) => {
|
|
2233
|
+
var m;
|
|
2234
|
+
return sn(n, e, [g, (m = h["reverse-identity"]) == null ? void 0 : m[1]]);
|
|
2235
2235
|
}), // Fall back to deleting everything if we've rehydrated tx-steps from
|
|
2236
2236
|
// the store that didn't set `etype` in deleteEntity
|
|
2237
2237
|
(!s || // If we don't know about the attr, let's just get rid of it
|
|
@@ -2242,9 +2242,9 @@ function sn(n, e, t) {
|
|
|
2242
2242
|
}
|
|
2243
2243
|
const c = n.vae.get(o) && fe(n.vae.get(o), 2);
|
|
2244
2244
|
c && c.forEach((f) => {
|
|
2245
|
-
var
|
|
2246
|
-
const [h,
|
|
2247
|
-
(!s || !g || ((
|
|
2245
|
+
var m, S, _;
|
|
2246
|
+
const [h, y, b] = f, g = e.getAttr(y);
|
|
2247
|
+
(!s || !g || ((m = g["reverse-identity"]) == null ? void 0 : m[1]) === s) && (_e(n.eav, [h, y, b]), _e(n.aev, [y, h, b]), _e(n.vae, [b, y, h])), g && g["on-delete"] === "cascade" && ((S = g["reverse-identity"]) == null ? void 0 : S[1]) === s && sn(n, e, [h, (_ = g["forward-identity"]) == null ? void 0 : _[1]]);
|
|
2248
2248
|
}), ((l = n.vae.get(o)) == null ? void 0 : l.size) === 0 && _e(n.vae, [o]);
|
|
2249
2249
|
}
|
|
2250
2250
|
function Jr(n, e, t) {
|
|
@@ -2312,7 +2312,7 @@ function fe(n, e, t = []) {
|
|
|
2312
2312
|
fe(r, e - 1, t);
|
|
2313
2313
|
return t;
|
|
2314
2314
|
}
|
|
2315
|
-
function
|
|
2315
|
+
function pt(n, e, t) {
|
|
2316
2316
|
var i;
|
|
2317
2317
|
const r = [];
|
|
2318
2318
|
if (t != null && t.hasOwnProperty("$not")) {
|
|
@@ -2362,7 +2362,7 @@ function Ni(n, [e, t, r]) {
|
|
|
2362
2362
|
}
|
|
2363
2363
|
case "eav": {
|
|
2364
2364
|
const a = (o = n.eav.get(e)) == null ? void 0 : o.get(t);
|
|
2365
|
-
return a ?
|
|
2365
|
+
return a ? pt(n, a, r) : [];
|
|
2366
2366
|
}
|
|
2367
2367
|
case "ev": {
|
|
2368
2368
|
const a = n.eav.get(e);
|
|
@@ -2370,7 +2370,7 @@ function Ni(n, [e, t, r]) {
|
|
|
2370
2370
|
return [];
|
|
2371
2371
|
const c = [];
|
|
2372
2372
|
for (const u of a.values())
|
|
2373
|
-
c.push(...
|
|
2373
|
+
c.push(...pt(n, u, r));
|
|
2374
2374
|
return c;
|
|
2375
2375
|
}
|
|
2376
2376
|
case "a": {
|
|
@@ -2383,14 +2383,14 @@ function Ni(n, [e, t, r]) {
|
|
|
2383
2383
|
return [];
|
|
2384
2384
|
const c = [];
|
|
2385
2385
|
for (const u of a.values())
|
|
2386
|
-
c.push(...
|
|
2386
|
+
c.push(...pt(n, u, r));
|
|
2387
2387
|
return c;
|
|
2388
2388
|
}
|
|
2389
2389
|
case "v": {
|
|
2390
2390
|
const a = [];
|
|
2391
2391
|
for (const c of n.eav.values())
|
|
2392
2392
|
for (const u of c.values())
|
|
2393
|
-
a.push(...
|
|
2393
|
+
a.push(...pt(n, u, r));
|
|
2394
2394
|
return a;
|
|
2395
2395
|
}
|
|
2396
2396
|
default:
|
|
@@ -2426,7 +2426,7 @@ function Zr(n, e) {
|
|
|
2426
2426
|
return t || ((r = n.forwardIdents.get(e)) == null ? void 0 : r.get("id"));
|
|
2427
2427
|
}
|
|
2428
2428
|
function Wi(n, e, t) {
|
|
2429
|
-
const r =
|
|
2429
|
+
const r = ct(n, t);
|
|
2430
2430
|
if (!r)
|
|
2431
2431
|
return;
|
|
2432
2432
|
const [s, i, o] = r;
|
|
@@ -2458,7 +2458,7 @@ function zi(n, e, t) {
|
|
|
2458
2458
|
});
|
|
2459
2459
|
}, {
|
|
2460
2460
|
mark: (s) => {
|
|
2461
|
-
if (s instanceof
|
|
2461
|
+
if (s instanceof Re)
|
|
2462
2462
|
return "immutable";
|
|
2463
2463
|
}
|
|
2464
2464
|
});
|
|
@@ -2529,11 +2529,11 @@ const to = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a
|
|
|
2529
2529
|
function Ve(n) {
|
|
2530
2530
|
return typeof n == "string" && to.test(n);
|
|
2531
2531
|
}
|
|
2532
|
-
const
|
|
2532
|
+
const re = [];
|
|
2533
2533
|
for (let n = 0; n < 256; ++n)
|
|
2534
|
-
|
|
2534
|
+
re.push((n + 256).toString(16).slice(1));
|
|
2535
2535
|
function no(n, e = 0) {
|
|
2536
|
-
return (
|
|
2536
|
+
return (re[n[e + 0]] + re[n[e + 1]] + re[n[e + 2]] + re[n[e + 3]] + "-" + re[n[e + 4]] + re[n[e + 5]] + "-" + re[n[e + 6]] + re[n[e + 7]] + "-" + re[n[e + 8]] + re[n[e + 9]] + "-" + re[n[e + 10]] + re[n[e + 11]] + re[n[e + 12]] + re[n[e + 13]] + re[n[e + 14]] + re[n[e + 15]]).toLowerCase();
|
|
2537
2537
|
}
|
|
2538
2538
|
let Kt;
|
|
2539
2539
|
const ro = new Uint8Array(16);
|
|
@@ -2591,10 +2591,10 @@ function lo() {
|
|
|
2591
2591
|
}
|
|
2592
2592
|
const fo = lo();
|
|
2593
2593
|
let ho = !0, po = 0;
|
|
2594
|
-
function
|
|
2595
|
-
return
|
|
2594
|
+
function it(n) {
|
|
2595
|
+
return Mt(`_${n}`, po++);
|
|
2596
2596
|
}
|
|
2597
|
-
function
|
|
2597
|
+
function Mt(n, e) {
|
|
2598
2598
|
return `?${n}-${e}`;
|
|
2599
2599
|
}
|
|
2600
2600
|
class Qe extends Error {
|
|
@@ -2628,18 +2628,18 @@ function es(n, e, t, r, s) {
|
|
|
2628
2628
|
throw new Qe(`Could not find attr for ${[t, s]}`);
|
|
2629
2629
|
if (a["value-type"] !== "ref")
|
|
2630
2630
|
throw new Error(`Attr ${a.id} is not a ref`);
|
|
2631
|
-
const [c, u] = a["forward-identity"], [l, f] = a["reverse-identity"], h = r + 1,
|
|
2631
|
+
const [c, u] = a["forward-identity"], [l, f] = a["reverse-identity"], h = r + 1, y = i ? [
|
|
2632
2632
|
n(u, r),
|
|
2633
2633
|
a.id,
|
|
2634
2634
|
n(f, h),
|
|
2635
|
-
|
|
2635
|
+
it("time")
|
|
2636
2636
|
] : [
|
|
2637
2637
|
n(u, h),
|
|
2638
2638
|
a.id,
|
|
2639
2639
|
n(f, r),
|
|
2640
|
-
|
|
2640
|
+
it("time")
|
|
2641
2641
|
];
|
|
2642
|
-
return [i ? f : u, h,
|
|
2642
|
+
return [i ? f : u, h, y, a, !!i];
|
|
2643
2643
|
}
|
|
2644
2644
|
function rr(n, e) {
|
|
2645
2645
|
if (typeof e != "string")
|
|
@@ -2723,20 +2723,20 @@ function mo(n, e, t, r, s, i) {
|
|
|
2723
2723
|
n(t, r),
|
|
2724
2724
|
u.id,
|
|
2725
2725
|
{ $isNull: { attrId: c.id, isNull: i.$isNull, reverse: !o } },
|
|
2726
|
-
|
|
2726
|
+
it("time")
|
|
2727
2727
|
];
|
|
2728
2728
|
}
|
|
2729
2729
|
return o ? [
|
|
2730
2730
|
n(t, r),
|
|
2731
2731
|
c.id,
|
|
2732
2732
|
_o(c, i),
|
|
2733
|
-
|
|
2734
|
-
] : [i, c.id, n(t, r),
|
|
2733
|
+
it("time")
|
|
2734
|
+
] : [i, c.id, n(t, r), it("time")];
|
|
2735
2735
|
}
|
|
2736
2736
|
function wo(n, e, t, r, s) {
|
|
2737
2737
|
const [i, o, a] = s.reduce((c, u) => {
|
|
2738
|
-
const [l, f, h] = c, [
|
|
2739
|
-
return [
|
|
2738
|
+
const [l, f, h] = c, [y, b, g] = es(n, e, l, f, u);
|
|
2739
|
+
return [y, b, [...h, g]];
|
|
2740
2740
|
}, [t, r, []]);
|
|
2741
2741
|
return [i, o, a];
|
|
2742
2742
|
}
|
|
@@ -2744,10 +2744,10 @@ function an(n, e, t, r, s, i) {
|
|
|
2744
2744
|
const o = s.slice(0, s.length - 1), a = s[s.length - 1], [c, u, l] = wo(n, e, t, r, o), f = mo(n, e, c, u, a, i);
|
|
2745
2745
|
return l.concat([f]);
|
|
2746
2746
|
}
|
|
2747
|
-
function
|
|
2747
|
+
function To(n, e) {
|
|
2748
2748
|
return e ? [e].concat(n) : n;
|
|
2749
2749
|
}
|
|
2750
|
-
function
|
|
2750
|
+
function So([n, e]) {
|
|
2751
2751
|
return n === "or" && Array.isArray(e);
|
|
2752
2752
|
}
|
|
2753
2753
|
function vo([n, e]) {
|
|
@@ -2779,7 +2779,7 @@ function ir(n, e, t, r, s) {
|
|
|
2779
2779
|
}
|
|
2780
2780
|
function ts(n, e, t, r, s) {
|
|
2781
2781
|
return Object.entries(s).flatMap(([i, o]) => {
|
|
2782
|
-
if (
|
|
2782
|
+
if (So([i, o]))
|
|
2783
2783
|
return sr(n, "or", e, t, r, o);
|
|
2784
2784
|
if (vo([i, o]))
|
|
2785
2785
|
return sr(n, "and", e, t, r, o);
|
|
@@ -2808,7 +2808,7 @@ function ts(n, e, t, r, s) {
|
|
|
2808
2808
|
});
|
|
2809
2809
|
}
|
|
2810
2810
|
function Eo(n, e, t, r) {
|
|
2811
|
-
const s =
|
|
2811
|
+
const s = Mt;
|
|
2812
2812
|
return r ? ts(s, n, e, t, r).concat(nr(s, n, e, t)) : nr(s, n, e, t);
|
|
2813
2813
|
}
|
|
2814
2814
|
function ko(n, e, t) {
|
|
@@ -2821,24 +2821,24 @@ function Co(n, e, t, r, s, i) {
|
|
|
2821
2821
|
function Io(n, e, t, { etype: r, level: s, form: i }, o) {
|
|
2822
2822
|
const a = Object.keys(i).filter((c) => c !== "$");
|
|
2823
2823
|
return a.length ? Object.entries(o).map(function([u, l]) {
|
|
2824
|
-
return a.map(function(
|
|
2825
|
-
var g,
|
|
2826
|
-
const
|
|
2824
|
+
return a.map(function(y) {
|
|
2825
|
+
var g, m, S;
|
|
2826
|
+
const b = !!(e.cardinalityInference && ((S = (m = (g = t.linkIndex) == null ? void 0 : g[r]) == null ? void 0 : m[y]) != null && S.isSingular));
|
|
2827
2827
|
try {
|
|
2828
|
-
const [
|
|
2829
|
-
etype:
|
|
2828
|
+
const [_, T, M] = Co(n, t, r, s, y, u), O = ss(e, t, {
|
|
2829
|
+
etype: _,
|
|
2830
2830
|
level: T,
|
|
2831
|
-
form: i[
|
|
2832
|
-
join:
|
|
2833
|
-
}),
|
|
2834
|
-
return { [
|
|
2835
|
-
} catch (
|
|
2836
|
-
if (
|
|
2837
|
-
return { [
|
|
2838
|
-
throw
|
|
2831
|
+
form: i[y],
|
|
2832
|
+
join: M
|
|
2833
|
+
}), F = b ? O[0] : O;
|
|
2834
|
+
return { [y]: F };
|
|
2835
|
+
} catch (_) {
|
|
2836
|
+
if (_ instanceof Qe)
|
|
2837
|
+
return { [y]: b ? void 0 : [] };
|
|
2838
|
+
throw _;
|
|
2839
2839
|
}
|
|
2840
|
-
}).reduce(function(
|
|
2841
|
-
return { ...
|
|
2840
|
+
}).reduce(function(y, b) {
|
|
2841
|
+
return { ...y, ...b };
|
|
2842
2842
|
}, l);
|
|
2843
2843
|
}) : Object.values(o);
|
|
2844
2844
|
}
|
|
@@ -2862,11 +2862,11 @@ function ns(n, e, t) {
|
|
|
2862
2862
|
const [a, c] = t, u = e["checked-data-type"], l = u === "date" ? cn(c) : c, f = u === "date" ? cn(i) : i;
|
|
2863
2863
|
return Ct([a, l], [r, f], u);
|
|
2864
2864
|
}
|
|
2865
|
-
function
|
|
2865
|
+
function Mo(n, e, t, r) {
|
|
2866
2866
|
const s = ns(n, e, r);
|
|
2867
2867
|
return t === "desc" ? s > 0 : s < 0;
|
|
2868
2868
|
}
|
|
2869
|
-
function
|
|
2869
|
+
function Ro(n, e, t, r) {
|
|
2870
2870
|
const s = ns(n, e, r);
|
|
2871
2871
|
return t === "desc" ? s < 0 : s > 0;
|
|
2872
2872
|
}
|
|
@@ -2900,33 +2900,33 @@ function Do(n, e, t) {
|
|
|
2900
2900
|
return r;
|
|
2901
2901
|
}
|
|
2902
2902
|
function Uo(n, e, { etype: t, pageInfo: r, dq: s, form: i }) {
|
|
2903
|
-
var g,
|
|
2903
|
+
var g, m;
|
|
2904
2904
|
const o = (g = i == null ? void 0 : i.$) == null ? void 0 : g.order, a = rs(i), c = Lo(i);
|
|
2905
2905
|
let u = Xi(n, s);
|
|
2906
2906
|
const l = r == null ? void 0 : r["start-cursor"], f = r == null ? void 0 : r["end-cursor"], h = xo(e, t, l, o);
|
|
2907
|
-
if (h && ((
|
|
2908
|
-
const S = h["checked-data-type"] === "date",
|
|
2907
|
+
if (h && ((m = h == null ? void 0 : h["forward-identity"]) == null ? void 0 : m[2]) !== "id") {
|
|
2908
|
+
const S = h["checked-data-type"] === "date", _ = h.id;
|
|
2909
2909
|
u = u.map(([T]) => {
|
|
2910
|
-
var O,
|
|
2911
|
-
let
|
|
2912
|
-
return S && (
|
|
2910
|
+
var O, F, P, C, G;
|
|
2911
|
+
let M = (G = (C = (P = (F = (O = n.eav.get(T)) == null ? void 0 : O.get(_)) == null ? void 0 : F.values()) == null ? void 0 : P.next()) == null ? void 0 : C.value) == null ? void 0 : G[2];
|
|
2912
|
+
return S && (M = cn(M)), [T, M];
|
|
2913
2913
|
});
|
|
2914
2914
|
}
|
|
2915
|
-
u.sort(c === "asc" ? function(
|
|
2916
|
-
return Ct(
|
|
2917
|
-
} : function(
|
|
2918
|
-
return Ct(T,
|
|
2915
|
+
u.sort(c === "asc" ? function(_, T) {
|
|
2916
|
+
return Ct(_, T, h == null ? void 0 : h["checked-data-type"]);
|
|
2917
|
+
} : function(_, T) {
|
|
2918
|
+
return Ct(T, _, h == null ? void 0 : h["checked-data-type"]);
|
|
2919
2919
|
});
|
|
2920
|
-
let
|
|
2921
|
-
const
|
|
2920
|
+
let y = {};
|
|
2921
|
+
const b = Do(e, t, s);
|
|
2922
2922
|
for (const S of u) {
|
|
2923
|
-
const [
|
|
2924
|
-
if (
|
|
2923
|
+
const [_] = S;
|
|
2924
|
+
if (y[_] || !a && l && h && Mo(l, h, c, S) || !a && f && h && Ro(f, h, c, S))
|
|
2925
2925
|
continue;
|
|
2926
|
-
const T = Ki(n,
|
|
2927
|
-
T && (
|
|
2926
|
+
const T = Ki(n, b, _);
|
|
2927
|
+
T && (y[_] = T);
|
|
2928
2928
|
}
|
|
2929
|
-
return
|
|
2929
|
+
return y;
|
|
2930
2930
|
}
|
|
2931
2931
|
function Lo(n) {
|
|
2932
2932
|
var t;
|
|
@@ -2939,15 +2939,15 @@ function rs(n) {
|
|
|
2939
2939
|
return !e && !t && !r;
|
|
2940
2940
|
}
|
|
2941
2941
|
function Fo(n, e, { etype: t, level: r, form: s, join: i, pageInfo: o }) {
|
|
2942
|
-
var h,
|
|
2942
|
+
var h, y, b, g, m;
|
|
2943
2943
|
if (!rs(s) && (!o || !o["start-cursor"]))
|
|
2944
2944
|
return [];
|
|
2945
|
-
const a =
|
|
2945
|
+
const a = To(Eo(e, t, r, (h = s.$) == null ? void 0 : h.where), i), c = ko(Mt, t, r), u = (y = s.$) == null ? void 0 : y.fields, l = Uo(n, e, {
|
|
2946
2946
|
etype: t,
|
|
2947
2947
|
pageInfo: o,
|
|
2948
2948
|
form: s,
|
|
2949
2949
|
dq: { where: a, find: c, fields: u }
|
|
2950
|
-
}), f = ((
|
|
2950
|
+
}), f = ((b = s.$) == null ? void 0 : b.limit) || ((g = s.$) == null ? void 0 : g.first) || ((m = s.$) == null ? void 0 : m.last);
|
|
2951
2951
|
if (f != null) {
|
|
2952
2952
|
r > 0 && ho && console.warn("WARNING: Limits in child queries are only run client-side. Data returned from the server will not have a limit.");
|
|
2953
2953
|
const S = Object.entries(l);
|
|
@@ -2966,7 +2966,7 @@ function No(n, e, t) {
|
|
|
2966
2966
|
}
|
|
2967
2967
|
function ss(n, e, t) {
|
|
2968
2968
|
const r = No(n, e, t);
|
|
2969
|
-
return Io(
|
|
2969
|
+
return Io(Mt, n, e, t, r);
|
|
2970
2970
|
}
|
|
2971
2971
|
function Ko(n) {
|
|
2972
2972
|
const e = {};
|
|
@@ -3005,7 +3005,7 @@ function qo() {
|
|
|
3005
3005
|
return new Set(Object.keys(e));
|
|
3006
3006
|
}
|
|
3007
3007
|
const Wo = qo();
|
|
3008
|
-
function
|
|
3008
|
+
function vt(n, e, t) {
|
|
3009
3009
|
const r = {
|
|
3010
3010
|
__etype: n,
|
|
3011
3011
|
__ops: t
|
|
@@ -3017,7 +3017,7 @@ function At(n, e, t) {
|
|
|
3017
3017
|
if (i === "__etype")
|
|
3018
3018
|
return n;
|
|
3019
3019
|
if (Wo.has(i))
|
|
3020
|
-
return (o, a) =>
|
|
3020
|
+
return (o, a) => vt(n, e, [
|
|
3021
3021
|
...t,
|
|
3022
3022
|
a ? [i, n, e, o, a] : [i, n, e, o]
|
|
3023
3023
|
]);
|
|
@@ -3040,11 +3040,11 @@ function Vo(n) {
|
|
|
3040
3040
|
}, {
|
|
3041
3041
|
get(e, t) {
|
|
3042
3042
|
if (t === "lookup")
|
|
3043
|
-
return (s, i) =>
|
|
3043
|
+
return (s, i) => vt(n, un(zo(s, i)), []);
|
|
3044
3044
|
if (t === "__etype")
|
|
3045
3045
|
return n;
|
|
3046
3046
|
const r = t;
|
|
3047
|
-
return It(r) ?
|
|
3047
|
+
return It(r) ? vt(n, un(r), []) : vt(n, r, []);
|
|
3048
3048
|
}
|
|
3049
3049
|
});
|
|
3050
3050
|
}
|
|
@@ -3205,11 +3205,11 @@ function ea(n, e) {
|
|
|
3205
3205
|
function ta(n, e) {
|
|
3206
3206
|
const { attrsStore: t } = n, [r, s, i, o] = e, a = vn(i), c = de(t, r, s), u = as(n, [r, c, i, o]);
|
|
3207
3207
|
return [["id", c]].concat(Object.entries(a)).map(([f, h]) => {
|
|
3208
|
-
const
|
|
3209
|
-
return
|
|
3208
|
+
const y = ne(t, r, f);
|
|
3209
|
+
return y["checked-data-type"] === "date" && n.useDateObjects && (h = Pt(h)), [
|
|
3210
3210
|
"add-triple",
|
|
3211
3211
|
c,
|
|
3212
|
-
|
|
3212
|
+
y.id,
|
|
3213
3213
|
h,
|
|
3214
3214
|
...u ? [u] : []
|
|
3215
3215
|
];
|
|
@@ -3219,13 +3219,13 @@ function na({ attrsStore: n }, [e, t]) {
|
|
|
3219
3219
|
return [["delete-entity", de(n, e, t), e]];
|
|
3220
3220
|
}
|
|
3221
3221
|
function ra(n, e) {
|
|
3222
|
-
const { attrsStore: t } = n, [r, s, i, o] = e, a = vn(i), c = de(t, r, s), u = as(n, [r, c, i, o]), l = Object.entries(a).map(([h,
|
|
3223
|
-
const
|
|
3222
|
+
const { attrsStore: t } = n, [r, s, i, o] = e, a = vn(i), c = de(t, r, s), u = as(n, [r, c, i, o]), l = Object.entries(a).map(([h, y]) => {
|
|
3223
|
+
const b = ne(t, r, h);
|
|
3224
3224
|
return [
|
|
3225
3225
|
"deep-merge-triple",
|
|
3226
3226
|
c,
|
|
3227
|
-
|
|
3228
|
-
|
|
3227
|
+
b.id,
|
|
3228
|
+
y,
|
|
3229
3229
|
...u ? [u] : []
|
|
3230
3230
|
];
|
|
3231
3231
|
});
|
|
@@ -3293,7 +3293,7 @@ function ca(n, e, t) {
|
|
|
3293
3293
|
"checked-data-type": o
|
|
3294
3294
|
};
|
|
3295
3295
|
}
|
|
3296
|
-
function
|
|
3296
|
+
function yt(n, e, t, r) {
|
|
3297
3297
|
const s = n ? ca(n, e, t) : null, i = J(), a = [J(), e, t];
|
|
3298
3298
|
return {
|
|
3299
3299
|
id: i,
|
|
@@ -3374,72 +3374,72 @@ function ba(n) {
|
|
|
3374
3374
|
return e;
|
|
3375
3375
|
}
|
|
3376
3376
|
function ga({ attrsStore: n, schema: e }, t) {
|
|
3377
|
-
var h,
|
|
3377
|
+
var h, y;
|
|
3378
3378
|
const r = /* @__PURE__ */ new Set(), s = [], i = [];
|
|
3379
|
-
function o(
|
|
3380
|
-
return ne(n,
|
|
3379
|
+
function o(b, g) {
|
|
3380
|
+
return ne(n, b, g) || s.find((m) => m["forward-identity"][1] === b && m["forward-identity"][2] === g);
|
|
3381
3381
|
}
|
|
3382
|
-
function a(
|
|
3383
|
-
return De(n,
|
|
3384
|
-
var S,
|
|
3385
|
-
return ((S =
|
|
3382
|
+
function a(b, g) {
|
|
3383
|
+
return De(n, b, g) || s.find((m) => {
|
|
3384
|
+
var S, _;
|
|
3385
|
+
return ((S = m["reverse-identity"]) == null ? void 0 : S[1]) === b && ((_ = m["reverse-identity"]) == null ? void 0 : _[2]) === g;
|
|
3386
3386
|
});
|
|
3387
3387
|
}
|
|
3388
|
-
function c(
|
|
3389
|
-
s.push(
|
|
3388
|
+
function c(b) {
|
|
3389
|
+
s.push(b), i.push(["add-attr", b]), r.add(b.id);
|
|
3390
3390
|
}
|
|
3391
|
-
function u(
|
|
3392
|
-
|
|
3391
|
+
function u(b) {
|
|
3392
|
+
b && "isUnsynced" in b && b.isUnsynced && !r.has(b.id) && (s.push(b), i.push(["add-attr", b]), r.add(b.id));
|
|
3393
3393
|
}
|
|
3394
|
-
function l(
|
|
3394
|
+
function l(b, g) {
|
|
3395
3395
|
return g.indexOf(".") !== -1 && // attr names can have `.` in them, so use the attr we find with a `.`
|
|
3396
3396
|
// before assuming it's a ref lookup.
|
|
3397
|
-
!o(
|
|
3397
|
+
!o(b, g);
|
|
3398
3398
|
}
|
|
3399
|
-
function f(
|
|
3400
|
-
const
|
|
3401
|
-
u(
|
|
3399
|
+
function f(b, g) {
|
|
3400
|
+
const m = o(b, g), S = a(b, g);
|
|
3401
|
+
u(m), u(S), !m && !S && c(or(e, b, g, ya));
|
|
3402
3402
|
}
|
|
3403
|
-
for (const
|
|
3404
|
-
for (const { etype: g, lookupPair:
|
|
3405
|
-
const
|
|
3403
|
+
for (const b of t)
|
|
3404
|
+
for (const { etype: g, lookupPair: m, linkLabel: S } of ba(b)) {
|
|
3405
|
+
const _ = m[0];
|
|
3406
3406
|
if (S) {
|
|
3407
3407
|
f(g, S);
|
|
3408
|
-
const T = o(g, S),
|
|
3409
|
-
u(T), u(
|
|
3410
|
-
const O = ((h = T == null ? void 0 : T["reverse-identity"]) == null ? void 0 : h[1]) || ((
|
|
3411
|
-
if (l(O,
|
|
3412
|
-
f(O, ln(
|
|
3408
|
+
const T = o(g, S), M = a(g, S);
|
|
3409
|
+
u(T), u(M);
|
|
3410
|
+
const O = ((h = T == null ? void 0 : T["reverse-identity"]) == null ? void 0 : h[1]) || ((y = M == null ? void 0 : M["forward-identity"]) == null ? void 0 : y[1]) || S;
|
|
3411
|
+
if (l(O, _))
|
|
3412
|
+
f(O, ln(_));
|
|
3413
3413
|
else {
|
|
3414
|
-
const
|
|
3415
|
-
|
|
3414
|
+
const F = o(O, _);
|
|
3415
|
+
F || c(yt(e, O, _, dn)), u(F);
|
|
3416
3416
|
}
|
|
3417
|
-
} else if (l(g,
|
|
3418
|
-
f(g, ln(
|
|
3417
|
+
} else if (l(g, _))
|
|
3418
|
+
f(g, ln(_));
|
|
3419
3419
|
else {
|
|
3420
|
-
const T = o(g,
|
|
3421
|
-
T || c(
|
|
3420
|
+
const T = o(g, _);
|
|
3421
|
+
T || c(yt(e, g, _, dn)), u(T);
|
|
3422
3422
|
}
|
|
3423
3423
|
}
|
|
3424
|
-
for (const
|
|
3425
|
-
const [g,
|
|
3424
|
+
for (const b of t) {
|
|
3425
|
+
const [g, m, S, _] = b;
|
|
3426
3426
|
if (fa.has(g)) {
|
|
3427
|
-
const T = o(
|
|
3428
|
-
u(T), T || c(
|
|
3429
|
-
for (const
|
|
3430
|
-
const O = o(
|
|
3431
|
-
if (u(O), ha.has(g) && (O || c(
|
|
3432
|
-
const
|
|
3433
|
-
!O && !
|
|
3427
|
+
const T = o(m, "id");
|
|
3428
|
+
u(T), T || c(yt(e, m, "id", { "unique?": !0 }));
|
|
3429
|
+
for (const M of Object.keys(_)) {
|
|
3430
|
+
const O = o(m, M);
|
|
3431
|
+
if (u(O), ha.has(g) && (O || c(yt(e, m, M, M === "id" ? { "unique?": !0 } : null))), da.has(g)) {
|
|
3432
|
+
const F = a(m, M);
|
|
3433
|
+
!O && !F && c(or(e, m, M)), u(F);
|
|
3434
3434
|
}
|
|
3435
3435
|
}
|
|
3436
3436
|
}
|
|
3437
3437
|
}
|
|
3438
3438
|
if (s.length) {
|
|
3439
|
-
const
|
|
3439
|
+
const b = { ...n.attrs };
|
|
3440
3440
|
for (const g of s)
|
|
3441
|
-
|
|
3442
|
-
return [new
|
|
3441
|
+
b[g.id] = g;
|
|
3442
|
+
return [new Re(b, n.linkIndex), i];
|
|
3443
3443
|
}
|
|
3444
3444
|
return [n, i];
|
|
3445
3445
|
}
|
|
@@ -3555,10 +3555,10 @@ class hn {
|
|
|
3555
3555
|
_writeToStorage(e) {
|
|
3556
3556
|
const t = [], r = e == null ? void 0 : e.skipGc;
|
|
3557
3557
|
if (this._meta.isLoading) {
|
|
3558
|
-
const f = new Promise((h,
|
|
3559
|
-
setTimeout(() => this._enqueuePersist(e ? { ...e, attempts: (e.attempts || 0) + 1 } : { attempts: 1 }).then(h).catch(
|
|
3558
|
+
const f = new Promise((h, y) => {
|
|
3559
|
+
setTimeout(() => this._enqueuePersist(e ? { ...e, attempts: (e.attempts || 0) + 1 } : { attempts: 1 }).then(h).catch(y), 10 + ((e == null ? void 0 : e.attempts) ?? 0) * 1e3);
|
|
3560
3560
|
});
|
|
3561
|
-
return t.push(f), Promise.all(t).then((h) => h.reduce((
|
|
3561
|
+
return t.push(f), Promise.all(t).then((h) => h.reduce((y, b) => y + b, 0));
|
|
3562
3562
|
}
|
|
3563
3563
|
const s = this._meta.value;
|
|
3564
3564
|
if (!s)
|
|
@@ -3576,12 +3576,12 @@ class hn {
|
|
|
3576
3576
|
if (this._loadedKeys.has(f)) {
|
|
3577
3577
|
const h = this.serialize(f, this.currentValue[f]);
|
|
3578
3578
|
c.push([f, h]);
|
|
3579
|
-
const
|
|
3579
|
+
const y = this._objectSize(h), b = u[f] ?? {
|
|
3580
3580
|
createdAt: Date.now(),
|
|
3581
3581
|
updatedAt: Date.now(),
|
|
3582
|
-
size:
|
|
3582
|
+
size: y
|
|
3583
3583
|
};
|
|
3584
|
-
|
|
3584
|
+
b.updatedAt = Date.now(), b.size = y, u[f] = b, this._pendingSaveKeys.delete(f);
|
|
3585
3585
|
} else
|
|
3586
3586
|
a.push(f);
|
|
3587
3587
|
const l = this._persister.multiSet(c);
|
|
@@ -3590,7 +3590,7 @@ class hn {
|
|
|
3590
3590
|
const h = this._loadKey(f).then(() => this._enqueuePersist(e));
|
|
3591
3591
|
t.push(h);
|
|
3592
3592
|
}
|
|
3593
|
-
return r || this.gc(), Promise.all(t).then((f) => f.reduce((h,
|
|
3593
|
+
return r || this.gc(), Promise.all(t).then((f) => f.reduce((h, y) => h + y, 0));
|
|
3594
3594
|
}
|
|
3595
3595
|
async flush() {
|
|
3596
3596
|
return this._nextSave ? (clearTimeout(this._nextSave), this._nextSave = null, this._writeToStorage()) : void 0;
|
|
@@ -3624,21 +3624,21 @@ class hn {
|
|
|
3624
3624
|
for (const h of e)
|
|
3625
3625
|
t.has(h) || h in r.objects || (this._log.info("Lost track of key in meta", h), s.push(this._persister.removeItem(h)), i.removed.push(h), i.removedMissingCount++);
|
|
3626
3626
|
const o = Date.now();
|
|
3627
|
-
for (const [h,
|
|
3628
|
-
!t.has(h) &&
|
|
3627
|
+
for (const [h, y] of Object.entries(r.objects))
|
|
3628
|
+
!t.has(h) && y.updatedAt < o - this._gcOpts.maxAgeMs && (s.push(this._persister.removeItem(h)), delete r.objects[h], i.removed.push(h), i.removedOldCount++);
|
|
3629
3629
|
const a = Object.entries(r.objects);
|
|
3630
|
-
a.sort(([h,
|
|
3630
|
+
a.sort(([h, y], [b, g]) => y.updatedAt - g.updatedAt);
|
|
3631
3631
|
const c = a.filter(([h]) => !t.has(h));
|
|
3632
3632
|
if (a.length > this._gcOpts.maxEntries)
|
|
3633
3633
|
for (const [h] of c.slice(0, a.length - this._gcOpts.maxEntries))
|
|
3634
3634
|
s.push(this._persister.removeItem(h)), delete r.objects[h], i.removed.push(h), i.removedThresholdCount++;
|
|
3635
3635
|
const u = Object.entries(r.objects);
|
|
3636
|
-
u.sort(([h,
|
|
3636
|
+
u.sort(([h, y], [b, g]) => y.updatedAt - g.updatedAt);
|
|
3637
3637
|
const l = u.filter(([h]) => !t.has(h));
|
|
3638
|
-
let f = u.reduce((h, [
|
|
3638
|
+
let f = u.reduce((h, [y, b]) => h + b.size, 0);
|
|
3639
3639
|
for (; f > 0 && f > this._gcOpts.maxSize && l.length; ) {
|
|
3640
|
-
const [[h,
|
|
3641
|
-
f -=
|
|
3640
|
+
const [[h, y]] = l.splice(0, 1);
|
|
3641
|
+
f -= y.size, s.push(this._persister.removeItem(h)), delete r.objects[h], i.removed.push(h), i.removedSizeCount++;
|
|
3642
3642
|
}
|
|
3643
3643
|
for (const h of Object.keys(r.objects))
|
|
3644
3644
|
!e.has(h) && !t.has(h) && delete r.objects[h];
|
|
@@ -3703,8 +3703,8 @@ class hn {
|
|
|
3703
3703
|
e && await this._enqueuePersist();
|
|
3704
3704
|
}
|
|
3705
3705
|
}
|
|
3706
|
-
const wa = 6,
|
|
3707
|
-
function
|
|
3706
|
+
const wa = 6, Ta = ["kv", "querySubs", "syncSubs"];
|
|
3707
|
+
function Sa(n) {
|
|
3708
3708
|
return function(t) {
|
|
3709
3709
|
console.error("Error in IndexedDB event", { source: n, event: t });
|
|
3710
3710
|
};
|
|
@@ -3734,26 +3734,26 @@ async function Aa(n, e, t) {
|
|
|
3734
3734
|
return new Promise((i, o) => {
|
|
3735
3735
|
var l, f, h;
|
|
3736
3736
|
const a = {};
|
|
3737
|
-
for (const [
|
|
3738
|
-
const g = typeof
|
|
3737
|
+
for (const [y, b] of Object.entries(r)) {
|
|
3738
|
+
const g = typeof b == "string" ? JSON.parse(b) : b;
|
|
3739
3739
|
if (g.lastAccessed) {
|
|
3740
3740
|
const S = {
|
|
3741
3741
|
createdAt: g.lastAccessed,
|
|
3742
3742
|
updatedAt: g.lastAccessed,
|
|
3743
3743
|
size: ((h = (f = (l = g.result) == null ? void 0 : l.store) == null ? void 0 : f.triples) == null ? void 0 : h.length) ?? 0
|
|
3744
3744
|
};
|
|
3745
|
-
a[
|
|
3745
|
+
a[y] = S;
|
|
3746
3746
|
}
|
|
3747
|
-
const
|
|
3748
|
-
s.add(
|
|
3747
|
+
const m = t.put(g, y);
|
|
3748
|
+
s.add(m);
|
|
3749
3749
|
}
|
|
3750
3750
|
const c = { objects: a }, u = t.put(c, We);
|
|
3751
3751
|
s.add(u);
|
|
3752
|
-
for (const
|
|
3753
|
-
|
|
3754
|
-
s.delete(
|
|
3755
|
-
},
|
|
3756
|
-
o(
|
|
3752
|
+
for (const y of s)
|
|
3753
|
+
y.onsuccess = () => {
|
|
3754
|
+
s.delete(y), s.size === 0 && i();
|
|
3755
|
+
}, y.onerror = (b) => {
|
|
3756
|
+
o(b);
|
|
3757
3757
|
};
|
|
3758
3758
|
});
|
|
3759
3759
|
}
|
|
@@ -3768,20 +3768,20 @@ async function Oa(n, e) {
|
|
|
3768
3768
|
if (!t)
|
|
3769
3769
|
return;
|
|
3770
3770
|
const r = await new Promise((l, f) => {
|
|
3771
|
-
const
|
|
3772
|
-
|
|
3773
|
-
f(
|
|
3771
|
+
const b = t.transaction(["kv"], "readonly").objectStore("kv").openCursor();
|
|
3772
|
+
b.onerror = (m) => {
|
|
3773
|
+
f(m);
|
|
3774
3774
|
};
|
|
3775
3775
|
const g = [];
|
|
3776
|
-
|
|
3777
|
-
const
|
|
3778
|
-
if (
|
|
3779
|
-
const S =
|
|
3780
|
-
g.push([S,
|
|
3776
|
+
b.onsuccess = () => {
|
|
3777
|
+
const m = b.result;
|
|
3778
|
+
if (m) {
|
|
3779
|
+
const S = m.key, _ = m.value;
|
|
3780
|
+
g.push([S, _]), m.continue();
|
|
3781
3781
|
} else
|
|
3782
3782
|
l(g);
|
|
3783
|
-
},
|
|
3784
|
-
f(
|
|
3783
|
+
}, b.onerror = (m) => {
|
|
3784
|
+
f(m);
|
|
3785
3785
|
};
|
|
3786
3786
|
}), s = e.transaction(["kv", "querySubs"], "readwrite"), i = s.objectStore("kv"), o = s.objectStore("querySubs"), a = [], c = { objects: {} };
|
|
3787
3787
|
for (const [l, f] of r)
|
|
@@ -3794,12 +3794,12 @@ async function Oa(n, e) {
|
|
|
3794
3794
|
default: {
|
|
3795
3795
|
const h = cr(l, f, i);
|
|
3796
3796
|
a.push(h);
|
|
3797
|
-
const
|
|
3797
|
+
const y = {
|
|
3798
3798
|
createdAt: Date.now(),
|
|
3799
3799
|
updatedAt: Date.now(),
|
|
3800
3800
|
size: 0
|
|
3801
3801
|
};
|
|
3802
|
-
c.objects[l] =
|
|
3802
|
+
c.objects[l] = y;
|
|
3803
3803
|
break;
|
|
3804
3804
|
}
|
|
3805
3805
|
}
|
|
@@ -3833,7 +3833,7 @@ class cs extends ma {
|
|
|
3833
3833
|
c.close();
|
|
3834
3834
|
}, s) {
|
|
3835
3835
|
const u = Oa(this._appId, c).catch((l) => {
|
|
3836
|
-
|
|
3836
|
+
Sa("Error upgrading store from version 5 to 6.")(l);
|
|
3837
3837
|
});
|
|
3838
3838
|
ur.set(this.dbName, u), u.then(() => t(c)).catch(() => t(c));
|
|
3839
3839
|
} else {
|
|
@@ -3847,7 +3847,7 @@ class cs extends ma {
|
|
|
3847
3847
|
}
|
|
3848
3848
|
_upgradeStore(t) {
|
|
3849
3849
|
const s = t.target.result;
|
|
3850
|
-
for (const i of
|
|
3850
|
+
for (const i of Ta)
|
|
3851
3851
|
s.objectStoreNames.contains(i) || s.createObjectStore(i);
|
|
3852
3852
|
}
|
|
3853
3853
|
// Browsers can close IndexedDB connections unexpectedly (backgrounded tabs,
|
|
@@ -3923,20 +3923,20 @@ class us {
|
|
|
3923
3923
|
};
|
|
3924
3924
|
}
|
|
3925
3925
|
}
|
|
3926
|
-
class
|
|
3926
|
+
class ie extends Error {
|
|
3927
3927
|
constructor(t, r, s) {
|
|
3928
3928
|
super(t);
|
|
3929
3929
|
p(this, "hint");
|
|
3930
3930
|
p(this, "traceId");
|
|
3931
3931
|
this.hint = r, s && (this.traceId = s);
|
|
3932
3932
|
const i = new.target.prototype;
|
|
3933
|
-
Object.setPrototypeOf && Object.setPrototypeOf(this, i), Error.captureStackTrace && Error.captureStackTrace(this,
|
|
3933
|
+
Object.setPrototypeOf && Object.setPrototypeOf(this, i), Error.captureStackTrace && Error.captureStackTrace(this, ie), this.name = "InstantError";
|
|
3934
3934
|
}
|
|
3935
3935
|
get [Symbol.toStringTag]() {
|
|
3936
3936
|
return "InstantError";
|
|
3937
3937
|
}
|
|
3938
3938
|
}
|
|
3939
|
-
class
|
|
3939
|
+
class Rt extends ie {
|
|
3940
3940
|
constructor(t) {
|
|
3941
3941
|
var i, o;
|
|
3942
3942
|
const r = ((i = t.body) == null ? void 0 : i.message) || `API Error (${t.status})`;
|
|
@@ -3944,7 +3944,7 @@ class Mt extends re {
|
|
|
3944
3944
|
p(this, "body");
|
|
3945
3945
|
p(this, "status");
|
|
3946
3946
|
const s = new.target.prototype;
|
|
3947
|
-
Object.setPrototypeOf && Object.setPrototypeOf(this, s), Error.captureStackTrace && Error.captureStackTrace(this,
|
|
3947
|
+
Object.setPrototypeOf && Object.setPrototypeOf(this, s), Error.captureStackTrace && Error.captureStackTrace(this, Rt), this.name = "InstantAPIError", this.status = t.status, this.body = t.body;
|
|
3948
3948
|
}
|
|
3949
3949
|
get [Symbol.toStringTag]() {
|
|
3950
3950
|
return "InstantAPIError";
|
|
@@ -3952,7 +3952,7 @@ class Mt extends re {
|
|
|
3952
3952
|
}
|
|
3953
3953
|
async function we(n, e) {
|
|
3954
3954
|
const t = await fetch(n, e), r = await t.json();
|
|
3955
|
-
return t.status === 200 ? Promise.resolve(r) : Promise.reject(new
|
|
3955
|
+
return t.status === 200 ? Promise.resolve(r) : Promise.reject(new Rt({ status: t.status, body: r }));
|
|
3956
3956
|
}
|
|
3957
3957
|
function Ea({ apiURI: n, appId: e, email: t }) {
|
|
3958
3958
|
return we(`${n}/runtime/auth/send_magic_code`, {
|
|
@@ -4020,7 +4020,7 @@ async function Pa({ apiURI: n, appId: e, nonce: t, idToken: r, clientName: s, re
|
|
|
4020
4020
|
})
|
|
4021
4021
|
});
|
|
4022
4022
|
}
|
|
4023
|
-
async function
|
|
4023
|
+
async function Ma({ apiURI: n, appId: e, refreshToken: t }) {
|
|
4024
4024
|
return await we(`${n}/runtime/signout`, {
|
|
4025
4025
|
method: "POST",
|
|
4026
4026
|
headers: {
|
|
@@ -4032,7 +4032,7 @@ async function Ra({ apiURI: n, appId: e, refreshToken: t }) {
|
|
|
4032
4032
|
})
|
|
4033
4033
|
});
|
|
4034
4034
|
}
|
|
4035
|
-
async function
|
|
4035
|
+
async function Ra({ apiURI: n, appId: e, path: t, file: r, refreshToken: s, contentType: i, contentDisposition: o }) {
|
|
4036
4036
|
const a = {
|
|
4037
4037
|
app_id: e,
|
|
4038
4038
|
path: t,
|
|
@@ -4166,7 +4166,7 @@ function pr(n) {
|
|
|
4166
4166
|
}, e;
|
|
4167
4167
|
}, {});
|
|
4168
4168
|
}
|
|
4169
|
-
const hs = "v1.0.50
|
|
4169
|
+
const hs = "v1.0.50";
|
|
4170
4170
|
function Fa(n, e, t = console) {
|
|
4171
4171
|
return {
|
|
4172
4172
|
info: n ? (...r) => t.info(...r, e()) : () => {
|
|
@@ -4177,7 +4177,7 @@ function Fa(n, e, t = console) {
|
|
|
4177
4177
|
}
|
|
4178
4178
|
};
|
|
4179
4179
|
}
|
|
4180
|
-
class
|
|
4180
|
+
class ve {
|
|
4181
4181
|
constructor(e, t, r, s = { indexed: !1, unique: !1 }) {
|
|
4182
4182
|
p(this, "valueType");
|
|
4183
4183
|
p(this, "required");
|
|
@@ -4192,19 +4192,19 @@ class Ae {
|
|
|
4192
4192
|
* and enforced for backend
|
|
4193
4193
|
*/
|
|
4194
4194
|
clientRequired() {
|
|
4195
|
-
return new
|
|
4195
|
+
return new ve(this.valueType, !1, this.isIndexed, this.config);
|
|
4196
4196
|
}
|
|
4197
4197
|
optional() {
|
|
4198
|
-
return new
|
|
4198
|
+
return new ve(this.valueType, !1, this.isIndexed, this.config);
|
|
4199
4199
|
}
|
|
4200
4200
|
unique() {
|
|
4201
|
-
return new
|
|
4201
|
+
return new ve(this.valueType, this.required, this.isIndexed, {
|
|
4202
4202
|
...this.config,
|
|
4203
4203
|
unique: !0
|
|
4204
4204
|
});
|
|
4205
4205
|
}
|
|
4206
4206
|
indexed() {
|
|
4207
|
-
return new
|
|
4207
|
+
return new ve(this.valueType, this.required, !0, {
|
|
4208
4208
|
...this.config,
|
|
4209
4209
|
indexed: !0
|
|
4210
4210
|
});
|
|
@@ -4295,12 +4295,12 @@ const yr = [
|
|
|
4295
4295
|
const f = i[l], h = r.entities[o];
|
|
4296
4296
|
if (!h)
|
|
4297
4297
|
throw new Q(`Entity '${o}' does not exist in schema while traversing dot notation path '${n}'.`, s);
|
|
4298
|
-
const
|
|
4299
|
-
if (!
|
|
4300
|
-
const
|
|
4301
|
-
throw new Q(`Link '${f}' does not exist on entity '${o}' in dot notation path '${n}'. Available links: ${
|
|
4298
|
+
const y = h.links[f];
|
|
4299
|
+
if (!y) {
|
|
4300
|
+
const b = Object.keys(h.links);
|
|
4301
|
+
throw new Q(`Link '${f}' does not exist on entity '${o}' in dot notation path '${n}'. Available links: ${b.length > 0 ? b.join(", ") : "none"}`, s);
|
|
4302
4302
|
}
|
|
4303
|
-
o =
|
|
4303
|
+
o = y.entityName;
|
|
4304
4304
|
}
|
|
4305
4305
|
const a = i[i.length - 1], c = r.entities[o];
|
|
4306
4306
|
if (!c)
|
|
@@ -4308,14 +4308,14 @@ const yr = [
|
|
|
4308
4308
|
if (a === "id") {
|
|
4309
4309
|
if (typeof e == "string" && !Ve(e))
|
|
4310
4310
|
throw new Q(`Invalid value for id field in entity '${o}'. Expected a UUID, but received: ${e}`, s);
|
|
4311
|
-
ze(e, n, new
|
|
4311
|
+
ze(e, n, new ve("string", !1, !0), t, s);
|
|
4312
4312
|
return;
|
|
4313
4313
|
}
|
|
4314
4314
|
const u = c.attrs[a];
|
|
4315
4315
|
if (Object.keys(c.links).includes(a)) {
|
|
4316
4316
|
if (typeof e == "string" && !Ve(e))
|
|
4317
4317
|
throw new Q(`Invalid value for link '${a}' in entity '${o}'. Expected a UUID, but received: ${e}`, s);
|
|
4318
|
-
ze(e, n, new
|
|
4318
|
+
ze(e, n, new ve("string", !1, !0), t, s);
|
|
4319
4319
|
return;
|
|
4320
4320
|
}
|
|
4321
4321
|
if (!u) {
|
|
@@ -4332,7 +4332,7 @@ const yr = [
|
|
|
4332
4332
|
continue;
|
|
4333
4333
|
}
|
|
4334
4334
|
if (s === "id") {
|
|
4335
|
-
ze(i, "id", new
|
|
4335
|
+
ze(i, "id", new ve("string", !1, !0), e, `${r}.id`);
|
|
4336
4336
|
continue;
|
|
4337
4337
|
}
|
|
4338
4338
|
if (s.includes(".")) {
|
|
@@ -4352,7 +4352,7 @@ const yr = [
|
|
|
4352
4352
|
else if (c) {
|
|
4353
4353
|
if (typeof i == "string" && !Ve(i))
|
|
4354
4354
|
throw new Q(`Invalid value for link '${s}' in entity '${e}'. Expected a UUID, but received: ${i}`, `${r}.${s}`);
|
|
4355
|
-
const u = new
|
|
4355
|
+
const u = new ve("string", !1, !0);
|
|
4356
4356
|
ze(i, s, u, e, `${r}.${s}`);
|
|
4357
4357
|
}
|
|
4358
4358
|
}
|
|
@@ -4675,7 +4675,7 @@ function wr(n, e, t, r) {
|
|
|
4675
4675
|
const i = Be(e.eav, [r, s, r]);
|
|
4676
4676
|
return i ? i[3] : -1;
|
|
4677
4677
|
}
|
|
4678
|
-
function
|
|
4678
|
+
function Tr(n, e, t) {
|
|
4679
4679
|
for (const { action: r, triple: s } of t)
|
|
4680
4680
|
switch (r) {
|
|
4681
4681
|
case "added":
|
|
@@ -4695,23 +4695,23 @@ function Xa(n, e, t) {
|
|
|
4695
4695
|
continue;
|
|
4696
4696
|
const h = r[c] ?? {};
|
|
4697
4697
|
r[c] = h;
|
|
4698
|
-
const
|
|
4698
|
+
const y = h[f] ?? {};
|
|
4699
4699
|
switch (o) {
|
|
4700
4700
|
case "added":
|
|
4701
|
-
|
|
4701
|
+
y.newValue = l;
|
|
4702
4702
|
break;
|
|
4703
4703
|
case "removed":
|
|
4704
|
-
|
|
4704
|
+
y.oldValue === void 0 && (y.oldValue = l);
|
|
4705
4705
|
break;
|
|
4706
4706
|
}
|
|
4707
|
-
h[f] =
|
|
4707
|
+
h[f] = y;
|
|
4708
4708
|
}
|
|
4709
4709
|
for (const [o, a] of Object.entries(r))
|
|
4710
4710
|
for (const [c, { oldValue: u, newValue: l }] of Object.entries(a))
|
|
4711
4711
|
u === l && delete a[c];
|
|
4712
4712
|
return r;
|
|
4713
4713
|
}
|
|
4714
|
-
function
|
|
4714
|
+
function bt(n, e) {
|
|
4715
4715
|
return { [n.table]: e.map((t) => t.entity) };
|
|
4716
4716
|
}
|
|
4717
4717
|
function ec(n, e) {
|
|
@@ -4777,7 +4777,7 @@ class nc {
|
|
|
4777
4777
|
this.subs.flush();
|
|
4778
4778
|
}
|
|
4779
4779
|
subscribe(e, t) {
|
|
4780
|
-
const r =
|
|
4780
|
+
const r = se(e);
|
|
4781
4781
|
return this.callbacks[r] = this.callbacks[r] || [], this.callbacks[r].push(t), this.initSubscription(e, r, t), (s) => {
|
|
4782
4782
|
this.unsubscribe(r, t, s == null ? void 0 : s.keepSubscription);
|
|
4783
4783
|
};
|
|
@@ -4820,13 +4820,13 @@ class nc {
|
|
|
4820
4820
|
if (s && s.state && s.state.txId) {
|
|
4821
4821
|
this.sendResync(s, s.state, s.state.txId), (u = s.values) != null && u.entities && r && r({
|
|
4822
4822
|
type: Ie.LoadFromStorage,
|
|
4823
|
-
data:
|
|
4823
|
+
data: bt(s, (l = s.values) == null ? void 0 : l.entities)
|
|
4824
4824
|
});
|
|
4825
4825
|
return;
|
|
4826
4826
|
}
|
|
4827
4827
|
const i = Object.keys(e)[0], o = ((h = (f = e[i]) == null ? void 0 : f.$) == null ? void 0 : h.order) || { serverCreatedAt: "asc" }, [a, c] = Object.entries(o)[0];
|
|
4828
|
-
this.subs.updateInPlace((
|
|
4829
|
-
|
|
4828
|
+
this.subs.updateInPlace((y) => {
|
|
4829
|
+
y[t] = {
|
|
4830
4830
|
query: e,
|
|
4831
4831
|
hash: t,
|
|
4832
4832
|
table: i,
|
|
@@ -4845,7 +4845,7 @@ class nc {
|
|
|
4845
4845
|
}
|
|
4846
4846
|
}
|
|
4847
4847
|
onStartSyncOk(e) {
|
|
4848
|
-
const t = e["subscription-id"], r = e.q, s =
|
|
4848
|
+
const t = e["subscription-id"], r = e.q, s = se(r);
|
|
4849
4849
|
this.idToHash[t] = s, this.subs.updateInPlace((i) => {
|
|
4850
4850
|
const o = i[s];
|
|
4851
4851
|
if (!o)
|
|
@@ -4889,7 +4889,7 @@ class nc {
|
|
|
4889
4889
|
u[s] = o, u[s].updatedAt = Date.now();
|
|
4890
4890
|
}), o.values && this.notifyCbs(s, {
|
|
4891
4891
|
type: Ie.InitialSyncBatch,
|
|
4892
|
-
data:
|
|
4892
|
+
data: bt(o, o.values.entities),
|
|
4893
4893
|
batch: i
|
|
4894
4894
|
});
|
|
4895
4895
|
}
|
|
@@ -4914,7 +4914,7 @@ class nc {
|
|
|
4914
4914
|
const s = this.subs.currentValue[r];
|
|
4915
4915
|
s && this.notifyCbs(r, {
|
|
4916
4916
|
type: Ie.InitialSyncComplete,
|
|
4917
|
-
data:
|
|
4917
|
+
data: bt(s, ((i = s.values) == null ? void 0 : i.entities) || [])
|
|
4918
4918
|
});
|
|
4919
4919
|
}
|
|
4920
4920
|
onSyncUpdateTriples(e) {
|
|
@@ -4939,9 +4939,9 @@ class nc {
|
|
|
4939
4939
|
continue;
|
|
4940
4940
|
i.txId = a["tx-id"];
|
|
4941
4941
|
const c = [], u = {};
|
|
4942
|
-
for (const
|
|
4943
|
-
const S = u[
|
|
4944
|
-
u[
|
|
4942
|
+
for (const m of a.changes) {
|
|
4943
|
+
const S = u[m.triple[0]] ?? [];
|
|
4944
|
+
u[m.triple[0]] = S, S.push(m);
|
|
4945
4945
|
}
|
|
4946
4946
|
const l = s.values ?? {
|
|
4947
4947
|
entities: [],
|
|
@@ -4949,48 +4949,48 @@ class nc {
|
|
|
4949
4949
|
}, f = l.entities;
|
|
4950
4950
|
s.values = l;
|
|
4951
4951
|
const h = [];
|
|
4952
|
-
e: for (const [
|
|
4953
|
-
for (let
|
|
4954
|
-
const T = f[
|
|
4955
|
-
if (
|
|
4956
|
-
|
|
4957
|
-
const
|
|
4958
|
-
|
|
4952
|
+
e: for (const [m, S] of Object.entries(u))
|
|
4953
|
+
for (let _ = 0; _ < f.length; _++) {
|
|
4954
|
+
const T = f[_];
|
|
4955
|
+
if (Ri(T.store, m)) {
|
|
4956
|
+
Tr(T.store, l.attrsStore, S);
|
|
4957
|
+
const M = zt(s, T.store, l.attrsStore), O = Xa(T.store, l.attrsStore, S)[m];
|
|
4958
|
+
M ? (h.push({
|
|
4959
4959
|
oldEntity: T.entity,
|
|
4960
|
-
newEntity:
|
|
4960
|
+
newEntity: M,
|
|
4961
4961
|
changedFields: O || {}
|
|
4962
|
-
}), T.entity =
|
|
4962
|
+
}), T.entity = M) : c.push(_), delete u[m];
|
|
4963
4963
|
continue e;
|
|
4964
4964
|
}
|
|
4965
4965
|
}
|
|
4966
|
-
const
|
|
4967
|
-
for (const [
|
|
4968
|
-
const
|
|
4969
|
-
|
|
4970
|
-
const T = zt(s,
|
|
4966
|
+
const y = [];
|
|
4967
|
+
for (const [m, S] of Object.entries(u)) {
|
|
4968
|
+
const _ = this.createStore([]);
|
|
4969
|
+
Tr(_, l.attrsStore, S);
|
|
4970
|
+
const T = zt(s, _, l.attrsStore);
|
|
4971
4971
|
if (!T) {
|
|
4972
4972
|
this.log.error("No entity found after applying change", {
|
|
4973
4973
|
sub: s,
|
|
4974
4974
|
changes: S,
|
|
4975
|
-
store:
|
|
4975
|
+
store: _
|
|
4976
4976
|
});
|
|
4977
4977
|
continue;
|
|
4978
4978
|
}
|
|
4979
4979
|
f.push({
|
|
4980
|
-
store:
|
|
4980
|
+
store: _,
|
|
4981
4981
|
entity: T,
|
|
4982
|
-
serverCreatedAt: wr(s,
|
|
4983
|
-
}),
|
|
4982
|
+
serverCreatedAt: wr(s, _, l.attrsStore, T.id)
|
|
4983
|
+
}), y.push(T);
|
|
4984
4984
|
}
|
|
4985
|
-
const
|
|
4986
|
-
for (const
|
|
4987
|
-
|
|
4985
|
+
const b = [];
|
|
4986
|
+
for (const m of c.sort().reverse())
|
|
4987
|
+
b.push(f[m].entity), f.splice(m, 1);
|
|
4988
4988
|
const g = ec(s, this.getAttrs);
|
|
4989
4989
|
tc(s, g, f), this.notifyCbs(r, {
|
|
4990
4990
|
type: Ie.SyncTransaction,
|
|
4991
|
-
data:
|
|
4992
|
-
added:
|
|
4993
|
-
removed:
|
|
4991
|
+
data: bt(s, (o = s.values) == null ? void 0 : o.entities),
|
|
4992
|
+
added: y,
|
|
4993
|
+
removed: b,
|
|
4994
4994
|
updated: h
|
|
4995
4995
|
});
|
|
4996
4996
|
}
|
|
@@ -5010,7 +5010,7 @@ class nc {
|
|
|
5010
5010
|
}
|
|
5011
5011
|
}
|
|
5012
5012
|
onStartSyncError(e) {
|
|
5013
|
-
const t =
|
|
5013
|
+
const t = se(e["original-event"].q), r = {
|
|
5014
5014
|
message: e.message || "Uh-oh, something went wrong. Ping Joe & Stopa.",
|
|
5015
5015
|
status: e.status,
|
|
5016
5016
|
type: e.type,
|
|
@@ -5032,10 +5032,10 @@ function rc({ WStream: n, opts: e, startStream: t, appendStream: r, registerStre
|
|
|
5032
5032
|
let o = null, a = null, c = null;
|
|
5033
5033
|
const u = J();
|
|
5034
5034
|
let l = !1, f = !1;
|
|
5035
|
-
const h = [],
|
|
5036
|
-
let g = !1,
|
|
5037
|
-
const
|
|
5038
|
-
function
|
|
5035
|
+
const h = [], y = [], b = [];
|
|
5036
|
+
let g = !1, m = 0, S = 0;
|
|
5037
|
+
const _ = [], T = new TextEncoder();
|
|
5038
|
+
function M() {
|
|
5039
5039
|
f = !0;
|
|
5040
5040
|
for (const A of h)
|
|
5041
5041
|
A(a ?? void 0);
|
|
@@ -5046,48 +5046,48 @@ function rc({ WStream: n, opts: e, startStream: t, appendStream: r, registerStre
|
|
|
5046
5046
|
k !== -1 && h.splice(k, 1);
|
|
5047
5047
|
};
|
|
5048
5048
|
}
|
|
5049
|
-
function
|
|
5050
|
-
return
|
|
5051
|
-
const k =
|
|
5052
|
-
k !== -1 &&
|
|
5049
|
+
function F(A) {
|
|
5050
|
+
return b.push(A), () => {
|
|
5051
|
+
const k = b.indexOf(A);
|
|
5052
|
+
k !== -1 && b.splice(k, 1);
|
|
5053
5053
|
};
|
|
5054
5054
|
}
|
|
5055
5055
|
e.waitUntil && e.waitUntil(new Promise((A) => {
|
|
5056
|
-
|
|
5056
|
+
b.push(A);
|
|
5057
5057
|
}));
|
|
5058
|
-
function
|
|
5059
|
-
for (const A of
|
|
5058
|
+
function P() {
|
|
5059
|
+
for (const A of b)
|
|
5060
5060
|
try {
|
|
5061
5061
|
A();
|
|
5062
5062
|
} catch {
|
|
5063
5063
|
}
|
|
5064
5064
|
}
|
|
5065
|
-
function
|
|
5066
|
-
return
|
|
5067
|
-
const k =
|
|
5068
|
-
k !== -1 &&
|
|
5065
|
+
function C(A) {
|
|
5066
|
+
return y.push(A), o && A(o), () => {
|
|
5067
|
+
const k = y.indexOf(A);
|
|
5068
|
+
k !== -1 && y.splice(k, 1);
|
|
5069
5069
|
};
|
|
5070
5070
|
}
|
|
5071
5071
|
function G(A) {
|
|
5072
5072
|
o = A;
|
|
5073
|
-
for (const k of
|
|
5073
|
+
for (const k of y)
|
|
5074
5074
|
k(o);
|
|
5075
5075
|
}
|
|
5076
|
-
function
|
|
5076
|
+
function N() {
|
|
5077
5077
|
g = !0;
|
|
5078
5078
|
}
|
|
5079
5079
|
function B(A) {
|
|
5080
|
-
let k =
|
|
5081
|
-
for (const { byteLen: Y } of
|
|
5080
|
+
let k = m, K = 0, H = 0;
|
|
5081
|
+
for (const { byteLen: Y } of _) {
|
|
5082
5082
|
const oe = k + Y;
|
|
5083
5083
|
if (oe > A)
|
|
5084
5084
|
break;
|
|
5085
5085
|
k = oe, K++, H += Y;
|
|
5086
5086
|
}
|
|
5087
|
-
K > 0 && (
|
|
5087
|
+
K > 0 && (m += H, S -= H, _.splice(0, K));
|
|
5088
5088
|
}
|
|
5089
5089
|
function z(A, k) {
|
|
5090
|
-
a = k,
|
|
5090
|
+
a = k, M(), A.error(k), P();
|
|
5091
5091
|
}
|
|
5092
5092
|
async function ee() {
|
|
5093
5093
|
const A = await t({
|
|
@@ -5098,15 +5098,15 @@ function rc({ WStream: n, opts: e, startStream: t, appendStream: r, registerStre
|
|
|
5098
5098
|
switch (A.type) {
|
|
5099
5099
|
case "ok": {
|
|
5100
5100
|
const { streamId: k, offset: K } = A;
|
|
5101
|
-
o = k, B(K),
|
|
5101
|
+
o = k, B(K), _.length && r({
|
|
5102
5102
|
streamId: k,
|
|
5103
|
-
chunks:
|
|
5104
|
-
offset:
|
|
5103
|
+
chunks: _.map((H) => H.chunk),
|
|
5104
|
+
offset: m
|
|
5105
5105
|
}), g = !1;
|
|
5106
5106
|
break;
|
|
5107
5107
|
}
|
|
5108
5108
|
case "disconnect": {
|
|
5109
|
-
|
|
5109
|
+
N();
|
|
5110
5110
|
break;
|
|
5111
5111
|
}
|
|
5112
5112
|
case "error": {
|
|
@@ -5116,15 +5116,15 @@ function rc({ WStream: n, opts: e, startStream: t, appendStream: r, registerStre
|
|
|
5116
5116
|
}
|
|
5117
5117
|
}
|
|
5118
5118
|
function q() {
|
|
5119
|
-
|
|
5119
|
+
N(), ee();
|
|
5120
5120
|
}
|
|
5121
5121
|
function E({ offset: A, done: k }) {
|
|
5122
|
-
B(A), k && (l = !0,
|
|
5122
|
+
B(A), k && (l = !0, P());
|
|
5123
5123
|
}
|
|
5124
|
-
function
|
|
5125
|
-
return l ? (z(A, new
|
|
5124
|
+
function j(A) {
|
|
5125
|
+
return l ? (z(A, new ie("Stream has been closed.")), null) : o || (z(A, new ie("Stream has not been initialized.")), null);
|
|
5126
5126
|
}
|
|
5127
|
-
async function
|
|
5127
|
+
async function R(A) {
|
|
5128
5128
|
c = A;
|
|
5129
5129
|
let k = !0, K = 0;
|
|
5130
5130
|
for (; k; ) {
|
|
@@ -5139,12 +5139,12 @@ function rc({ WStream: n, opts: e, startStream: t, appendStream: r, registerStre
|
|
|
5139
5139
|
case "ok": {
|
|
5140
5140
|
const { streamId: oe, offset: Ge } = Y;
|
|
5141
5141
|
if (Ge !== 0) {
|
|
5142
|
-
const ge = new
|
|
5142
|
+
const ge = new ie("Write stream is corrupted");
|
|
5143
5143
|
z(A, ge);
|
|
5144
5144
|
return;
|
|
5145
5145
|
}
|
|
5146
5146
|
G(oe), s(oe, {
|
|
5147
|
-
onDisconnect:
|
|
5147
|
+
onDisconnect: N,
|
|
5148
5148
|
onFlush: E,
|
|
5149
5149
|
onConnectionReconnect: ee,
|
|
5150
5150
|
onAppendFailed: q
|
|
@@ -5152,7 +5152,7 @@ function rc({ WStream: n, opts: e, startStream: t, appendStream: r, registerStre
|
|
|
5152
5152
|
return;
|
|
5153
5153
|
}
|
|
5154
5154
|
case "disconnect": {
|
|
5155
|
-
k = !0,
|
|
5155
|
+
k = !0, N(), K++, await new Promise((oe) => {
|
|
5156
5156
|
setTimeout(oe, Math.max(0, H - Date.now()));
|
|
5157
5157
|
});
|
|
5158
5158
|
break;
|
|
@@ -5164,7 +5164,7 @@ function rc({ WStream: n, opts: e, startStream: t, appendStream: r, registerStre
|
|
|
5164
5164
|
}
|
|
5165
5165
|
}
|
|
5166
5166
|
}
|
|
5167
|
-
class
|
|
5167
|
+
class U extends n {
|
|
5168
5168
|
constructor(k, K) {
|
|
5169
5169
|
super(k, K);
|
|
5170
5170
|
}
|
|
@@ -5176,29 +5176,29 @@ function rc({ WStream: n, opts: e, startStream: t, appendStream: r, registerStre
|
|
|
5176
5176
|
}, oe = (ge) => {
|
|
5177
5177
|
k(ge), Y();
|
|
5178
5178
|
}, Ge = (ge) => {
|
|
5179
|
-
K(ge || new
|
|
5179
|
+
K(ge || new ie("Stream is closed.")), Y();
|
|
5180
5180
|
};
|
|
5181
|
-
H.push(
|
|
5181
|
+
H.push(C(oe)), H.push(O(Ge));
|
|
5182
5182
|
});
|
|
5183
5183
|
}
|
|
5184
5184
|
}
|
|
5185
5185
|
return {
|
|
5186
|
-
stream: new
|
|
5186
|
+
stream: new U({
|
|
5187
5187
|
// TODO(dww): accept a storage so that write streams can survive across
|
|
5188
5188
|
// browser restarts
|
|
5189
5189
|
async start(A) {
|
|
5190
5190
|
try {
|
|
5191
|
-
await
|
|
5191
|
+
await R(A);
|
|
5192
5192
|
} catch (k) {
|
|
5193
5193
|
z(A, k);
|
|
5194
5194
|
}
|
|
5195
5195
|
},
|
|
5196
5196
|
write(A, k) {
|
|
5197
|
-
const K =
|
|
5197
|
+
const K = j(k);
|
|
5198
5198
|
if (K) {
|
|
5199
5199
|
const H = T.encode(A).length;
|
|
5200
|
-
|
|
5201
|
-
const Y =
|
|
5200
|
+
_.push({ chunk: A, byteLen: H });
|
|
5201
|
+
const Y = m + S;
|
|
5202
5202
|
S += H, g || r({ streamId: K, chunks: [A], offset: Y });
|
|
5203
5203
|
}
|
|
5204
5204
|
},
|
|
@@ -5206,21 +5206,21 @@ function rc({ WStream: n, opts: e, startStream: t, appendStream: r, registerStre
|
|
|
5206
5206
|
o ? r({
|
|
5207
5207
|
streamId: o,
|
|
5208
5208
|
chunks: [],
|
|
5209
|
-
offset:
|
|
5209
|
+
offset: m + S,
|
|
5210
5210
|
isDone: !0
|
|
5211
|
-
}) :
|
|
5211
|
+
}) : P(), M();
|
|
5212
5212
|
},
|
|
5213
5213
|
abort(A) {
|
|
5214
5214
|
o ? r({
|
|
5215
5215
|
streamId: o,
|
|
5216
5216
|
chunks: [],
|
|
5217
|
-
offset:
|
|
5217
|
+
offset: m + S,
|
|
5218
5218
|
isDone: !0,
|
|
5219
5219
|
abortReason: A
|
|
5220
|
-
}) :
|
|
5220
|
+
}) : P(), M();
|
|
5221
5221
|
}
|
|
5222
5222
|
}),
|
|
5223
|
-
addCompleteCb:
|
|
5223
|
+
addCompleteCb: F,
|
|
5224
5224
|
closed() {
|
|
5225
5225
|
return f;
|
|
5226
5226
|
}
|
|
@@ -5265,68 +5265,68 @@ function ic({ RStream: n, opts: e, startStream: t, cancelStream: r }) {
|
|
|
5265
5265
|
const o = new TextDecoder("utf-8"), a = new TextEncoder();
|
|
5266
5266
|
let c, u = !1;
|
|
5267
5267
|
const l = [], f = [];
|
|
5268
|
-
let h = null,
|
|
5269
|
-
function
|
|
5268
|
+
let h = null, y = null;
|
|
5269
|
+
function b(P) {
|
|
5270
5270
|
u = !0;
|
|
5271
|
-
for (const
|
|
5272
|
-
P
|
|
5271
|
+
for (const C of l)
|
|
5272
|
+
C(P);
|
|
5273
5273
|
}
|
|
5274
|
-
function g(
|
|
5275
|
-
return l.push(
|
|
5276
|
-
const
|
|
5277
|
-
|
|
5274
|
+
function g(P) {
|
|
5275
|
+
return l.push(P), () => {
|
|
5276
|
+
const C = l.indexOf(P);
|
|
5277
|
+
C !== -1 && l.splice(C, 1);
|
|
5278
5278
|
};
|
|
5279
5279
|
}
|
|
5280
|
-
function
|
|
5281
|
-
return f.push(
|
|
5282
|
-
const
|
|
5283
|
-
|
|
5280
|
+
function m(P) {
|
|
5281
|
+
return f.push(P), h && P(h), () => {
|
|
5282
|
+
const C = f.indexOf(P);
|
|
5283
|
+
C !== -1 && f.splice(C, 1);
|
|
5284
5284
|
};
|
|
5285
5285
|
}
|
|
5286
|
-
function S(
|
|
5287
|
-
|
|
5286
|
+
function S(P, C) {
|
|
5287
|
+
y = C, P.error(C), b(C);
|
|
5288
5288
|
}
|
|
5289
|
-
let
|
|
5290
|
-
async function T(
|
|
5289
|
+
let _ = 0;
|
|
5290
|
+
async function T(P, C) {
|
|
5291
5291
|
c = J();
|
|
5292
|
-
const G = { ...
|
|
5293
|
-
for await (const
|
|
5292
|
+
const G = { ...P || {}, eventId: c };
|
|
5293
|
+
for await (const N of t(G)) {
|
|
5294
5294
|
if (i)
|
|
5295
5295
|
return;
|
|
5296
|
-
if (
|
|
5296
|
+
if (N.type === "reconnect")
|
|
5297
5297
|
return { retry: !0 };
|
|
5298
|
-
if (
|
|
5299
|
-
S(
|
|
5298
|
+
if (N.type === "error") {
|
|
5299
|
+
S(C, N.error);
|
|
5300
5300
|
return;
|
|
5301
5301
|
}
|
|
5302
|
-
if (
|
|
5303
|
-
S(
|
|
5302
|
+
if (N.offset > s) {
|
|
5303
|
+
S(C, new ie("Stream is corrupted.")), i = !0;
|
|
5304
5304
|
return;
|
|
5305
5305
|
}
|
|
5306
|
-
h =
|
|
5306
|
+
h = N.streamId;
|
|
5307
5307
|
for (const z of f)
|
|
5308
5308
|
z(h);
|
|
5309
|
-
let B = s -
|
|
5310
|
-
if (
|
|
5309
|
+
let B = s - N.offset;
|
|
5310
|
+
if (N.files && N.files.length) {
|
|
5311
5311
|
const z = new AbortController();
|
|
5312
|
-
let ee = fetch(
|
|
5312
|
+
let ee = fetch(N.files[0].url, {
|
|
5313
5313
|
signal: z.signal
|
|
5314
5314
|
});
|
|
5315
|
-
for (let q = 0; q <
|
|
5316
|
-
const E =
|
|
5317
|
-
if (E && (ee = fetch(E.url, { signal: z.signal })), !
|
|
5318
|
-
if (
|
|
5319
|
-
S(
|
|
5315
|
+
for (let q = 0; q < N.files.length; q++) {
|
|
5316
|
+
const E = N.files[q + 1], R = await ee;
|
|
5317
|
+
if (E && (ee = fetch(E.url, { signal: z.signal })), !R.ok) {
|
|
5318
|
+
if (_++, _ > 10) {
|
|
5319
|
+
S(C, new ie("Unable to process stream."));
|
|
5320
5320
|
return;
|
|
5321
5321
|
}
|
|
5322
5322
|
return { retry: !0 };
|
|
5323
5323
|
}
|
|
5324
|
-
if (
|
|
5325
|
-
const
|
|
5324
|
+
if (R.body) {
|
|
5325
|
+
const U = R.body.getReader();
|
|
5326
5326
|
try {
|
|
5327
5327
|
for (; ; ) {
|
|
5328
|
-
const { done:
|
|
5329
|
-
if (
|
|
5328
|
+
const { done: L, value: A } = await U.read();
|
|
5329
|
+
if (L)
|
|
5330
5330
|
break;
|
|
5331
5331
|
if (i) {
|
|
5332
5332
|
z.abort();
|
|
@@ -5337,79 +5337,79 @@ function ic({ RStream: n, opts: e, startStream: t, cancelStream: r }) {
|
|
|
5337
5337
|
continue;
|
|
5338
5338
|
s += k.length;
|
|
5339
5339
|
const K = o.decode(k);
|
|
5340
|
-
|
|
5340
|
+
C.enqueue(K);
|
|
5341
5341
|
}
|
|
5342
5342
|
} finally {
|
|
5343
|
-
|
|
5343
|
+
U.releaseLock();
|
|
5344
5344
|
}
|
|
5345
5345
|
} else {
|
|
5346
|
-
const
|
|
5347
|
-
let
|
|
5346
|
+
const U = await R.arrayBuffer();
|
|
5347
|
+
let L = U;
|
|
5348
5348
|
if (i) {
|
|
5349
5349
|
z.abort();
|
|
5350
5350
|
return;
|
|
5351
5351
|
}
|
|
5352
|
-
if (B > 0 && (
|
|
5352
|
+
if (B > 0 && (L = new Uint8Array(U).subarray(B), B -= U.byteLength - L.length), !L.byteLength)
|
|
5353
5353
|
continue;
|
|
5354
|
-
s +=
|
|
5355
|
-
const A = o.decode(
|
|
5356
|
-
|
|
5354
|
+
s += L.byteLength;
|
|
5355
|
+
const A = o.decode(L);
|
|
5356
|
+
C.enqueue(A);
|
|
5357
5357
|
}
|
|
5358
5358
|
}
|
|
5359
5359
|
}
|
|
5360
|
-
if (
|
|
5361
|
-
let z =
|
|
5360
|
+
if (_ = 0, N.content) {
|
|
5361
|
+
let z = N.content, ee = a.encode(N.content);
|
|
5362
5362
|
if (B > 0) {
|
|
5363
5363
|
const q = ee.subarray(B);
|
|
5364
5364
|
if (B -= ee.length - q.length, !q.length)
|
|
5365
5365
|
continue;
|
|
5366
5366
|
ee = q, z = o.decode(q);
|
|
5367
5367
|
}
|
|
5368
|
-
s += ee.length,
|
|
5368
|
+
s += ee.length, C.enqueue(z);
|
|
5369
5369
|
}
|
|
5370
5370
|
}
|
|
5371
5371
|
}
|
|
5372
|
-
async function
|
|
5373
|
-
let
|
|
5374
|
-
for (;
|
|
5375
|
-
|
|
5376
|
-
let
|
|
5377
|
-
const B = await T({ ...e, offset: s },
|
|
5378
|
-
B != null && B.retry && (
|
|
5379
|
-
setTimeout(z, Math.max(0,
|
|
5372
|
+
async function M(P) {
|
|
5373
|
+
let C = !0, G = 0;
|
|
5374
|
+
for (; C; ) {
|
|
5375
|
+
C = !1;
|
|
5376
|
+
let N = Date.now() + Math.min(15e3, 500 * (G - 1));
|
|
5377
|
+
const B = await T({ ...e, offset: s }, P);
|
|
5378
|
+
B != null && B.retry && (C = !0, G++, N < Date.now() - 3e5 && (G = 0), await new Promise((z) => {
|
|
5379
|
+
setTimeout(z, Math.max(0, N - Date.now()));
|
|
5380
5380
|
}));
|
|
5381
5381
|
}
|
|
5382
|
-
!i && !u && (
|
|
5382
|
+
!i && !u && (P.close(), b());
|
|
5383
5383
|
}
|
|
5384
5384
|
class O extends n {
|
|
5385
|
-
constructor(
|
|
5386
|
-
super(
|
|
5385
|
+
constructor(C, G) {
|
|
5386
|
+
super(C, G);
|
|
5387
5387
|
}
|
|
5388
5388
|
async streamId() {
|
|
5389
5389
|
if (h)
|
|
5390
5390
|
return h;
|
|
5391
|
-
if (
|
|
5392
|
-
throw
|
|
5393
|
-
return new Promise((
|
|
5394
|
-
const
|
|
5395
|
-
for (const q of
|
|
5391
|
+
if (y)
|
|
5392
|
+
throw y;
|
|
5393
|
+
return new Promise((C, G) => {
|
|
5394
|
+
const N = [], B = () => {
|
|
5395
|
+
for (const q of N)
|
|
5396
5396
|
q();
|
|
5397
5397
|
}, z = (q) => {
|
|
5398
|
-
|
|
5398
|
+
C(q), B();
|
|
5399
5399
|
}, ee = (q) => {
|
|
5400
|
-
G(q || new
|
|
5400
|
+
G(q || new ie("Stream is closed.")), B();
|
|
5401
5401
|
};
|
|
5402
|
-
|
|
5402
|
+
N.push(m(z)), N.push(g(ee));
|
|
5403
5403
|
});
|
|
5404
5404
|
}
|
|
5405
5405
|
}
|
|
5406
5406
|
return {
|
|
5407
5407
|
stream: new O({
|
|
5408
|
-
start(
|
|
5409
|
-
|
|
5408
|
+
start(P) {
|
|
5409
|
+
M(P);
|
|
5410
5410
|
},
|
|
5411
|
-
cancel(
|
|
5412
|
-
i = !0, c && r({ eventId: c }),
|
|
5411
|
+
cancel(P) {
|
|
5412
|
+
i = !0, c && r({ eventId: c }), b();
|
|
5413
5413
|
}
|
|
5414
5414
|
}),
|
|
5415
5415
|
addCloseCb: g,
|
|
@@ -5524,7 +5524,7 @@ class oc {
|
|
|
5524
5524
|
if (e.error) {
|
|
5525
5525
|
e.retry ? r.push({ type: "reconnect" }) : r.push({
|
|
5526
5526
|
type: "error",
|
|
5527
|
-
error: new
|
|
5527
|
+
error: new ie(e.error)
|
|
5528
5528
|
}), r.close(), delete this.readStreamIterators[t];
|
|
5529
5529
|
return;
|
|
5530
5530
|
}
|
|
@@ -5539,7 +5539,7 @@ class oc {
|
|
|
5539
5539
|
onConnectionStatusChange(e) {
|
|
5540
5540
|
for (const t of Object.values(this.startWriteStreamCbs))
|
|
5541
5541
|
t({ type: "disconnect" });
|
|
5542
|
-
if (this.startWriteStreamCbs = {}, e !==
|
|
5542
|
+
if (this.startWriteStreamCbs = {}, e !== Te.AUTHENTICATED)
|
|
5543
5543
|
for (const { onDisconnect: t } of Object.values(this.writeStreams))
|
|
5544
5544
|
t();
|
|
5545
5545
|
else {
|
|
@@ -5562,7 +5562,7 @@ class oc {
|
|
|
5562
5562
|
const r = e["client-event-id"], s = this.startWriteStreamCbs[r];
|
|
5563
5563
|
s && (s({
|
|
5564
5564
|
type: "error",
|
|
5565
|
-
error: new
|
|
5565
|
+
error: new ie(e.message || "Unknown error", e.hint)
|
|
5566
5566
|
}), delete this.startWriteStreamCbs[r]);
|
|
5567
5567
|
break;
|
|
5568
5568
|
}
|
|
@@ -5570,7 +5570,7 @@ class oc {
|
|
|
5570
5570
|
const r = e["client-event-id"], s = this.readStreamIterators[r];
|
|
5571
5571
|
s && (s.push({
|
|
5572
5572
|
type: "error",
|
|
5573
|
-
error: new
|
|
5573
|
+
error: new ie(e.message || "Unknown error", e.hint)
|
|
5574
5574
|
}), s.close(), delete this.readStreamIterators[r]);
|
|
5575
5575
|
break;
|
|
5576
5576
|
}
|
|
@@ -5580,16 +5580,16 @@ class oc {
|
|
|
5580
5580
|
return this.activeStreams.size > 0;
|
|
5581
5581
|
}
|
|
5582
5582
|
}
|
|
5583
|
-
const
|
|
5583
|
+
const Te = {
|
|
5584
5584
|
CONNECTING: "connecting",
|
|
5585
5585
|
OPENED: "opened",
|
|
5586
5586
|
AUTHENTICATED: "authenticated",
|
|
5587
5587
|
CLOSED: "closed",
|
|
5588
5588
|
ERRORED: "errored"
|
|
5589
|
-
}, ac = 3e4, cc = 3e4, uc = 200, lc = 1e3 * 60, fc = lc * 60 * 24,
|
|
5589
|
+
}, ac = 3e4, cc = 3e4, uc = 200, lc = 1e3 * 60, fc = lc * 60 * 24, Sr = "lastSyncedUserCookie", dc = {
|
|
5590
5590
|
apiURI: "https://api.instantdb.com",
|
|
5591
5591
|
websocketURI: "wss://api.instantdb.com/runtime/session"
|
|
5592
|
-
}, Vt = "_instant_oauth_redirect", Qt = "_instant_extra_fields_id",
|
|
5592
|
+
}, Vt = "_instant_oauth_redirect", Qt = "_instant_extra_fields_id", gt = "oauthExtraFields", Fe = "currentUser";
|
|
5593
5593
|
function hc({ transportType: n, appId: e, apiURI: t, wsURI: r, EventSourceImpl: s }) {
|
|
5594
5594
|
if (!s)
|
|
5595
5595
|
return new mr(`${r}?app_id=${e}`);
|
|
@@ -5673,7 +5673,7 @@ class wc {
|
|
|
5673
5673
|
p(this, "attrs");
|
|
5674
5674
|
p(this, "_isOnline", !0);
|
|
5675
5675
|
p(this, "_isShutdown", !1);
|
|
5676
|
-
p(this, "status",
|
|
5676
|
+
p(this, "status", Te.CONNECTING);
|
|
5677
5677
|
/** @type {PersistedObject<string, QuerySub, QuerySubInStorage>} */
|
|
5678
5678
|
p(this, "querySubs");
|
|
5679
5679
|
/** @type {PersistedObject} */
|
|
@@ -5690,13 +5690,6 @@ class wc {
|
|
|
5690
5690
|
p(this, "attrsCbs", []);
|
|
5691
5691
|
p(this, "mutationErrorCbs", []);
|
|
5692
5692
|
p(this, "connectionStatusCbs", []);
|
|
5693
|
-
p(this, "appStatusCbs", []);
|
|
5694
|
-
/**
|
|
5695
|
-
* Carries the raw server status off the public type: `disabled` is an
|
|
5696
|
-
* operator-level state we don't surface to apps.
|
|
5697
|
-
* @type {import('./clientTypes.ts').AppStatusState & { status?: 'active' | 'read-only' | 'disabled' }}
|
|
5698
|
-
*/
|
|
5699
|
-
p(this, "_appStatusState", { isLoading: !0, isReadOnly: void 0 });
|
|
5700
5693
|
p(this, "config");
|
|
5701
5694
|
p(this, "mutationDeferredStore", /* @__PURE__ */ new Map());
|
|
5702
5695
|
p(this, "_reconnectTimeoutId", null);
|
|
@@ -5752,14 +5745,14 @@ class wc {
|
|
|
5752
5745
|
// Queries
|
|
5753
5746
|
p(this, "getPreviousResult", (e) => {
|
|
5754
5747
|
var r;
|
|
5755
|
-
const t =
|
|
5748
|
+
const t = se(e);
|
|
5756
5749
|
return (r = this.dataForQuery(t)) == null ? void 0 : r.data;
|
|
5757
5750
|
});
|
|
5758
5751
|
/** Re-run instaql and call all callbacks with new data */
|
|
5759
5752
|
p(this, "notifyOne", (e) => {
|
|
5760
5753
|
var i;
|
|
5761
5754
|
const t = this.queryCbs[e] ?? [], r = (i = this._dataForQueryCache[e]) == null ? void 0 : i.data, s = this.dataForQuery(e);
|
|
5762
|
-
s != null && s.data && (this._dataForQueryCache[e] = s, !
|
|
5755
|
+
s != null && s.data && (this._dataForQueryCache[e] = s, !St(s.data, r) && t.forEach((o) => o.cb(s.data)));
|
|
5763
5756
|
});
|
|
5764
5757
|
p(this, "notifyOneQueryOnce", (e) => {
|
|
5765
5758
|
var s;
|
|
@@ -5769,16 +5762,10 @@ class wc {
|
|
|
5769
5762
|
});
|
|
5770
5763
|
});
|
|
5771
5764
|
p(this, "notifyQueryError", (e, t) => {
|
|
5772
|
-
|
|
5765
|
+
(this.queryCbs[e] || []).forEach((s) => s.cb({ error: t }));
|
|
5773
5766
|
});
|
|
5774
5767
|
/** Applies transactions locally and sends transact message to server */
|
|
5775
5768
|
p(this, "pushTx", (e) => {
|
|
5776
|
-
if (this._appStatusState.isReadOnly)
|
|
5777
|
-
return Promise.reject(this._appStatusState.status === "disabled" ? new re("This app is currently disabled.", {
|
|
5778
|
-
status: "disabled"
|
|
5779
|
-
}) : new re("This app is in read-only mode.", {
|
|
5780
|
-
status: "read-only"
|
|
5781
|
-
}));
|
|
5782
5769
|
this.config.disableValidation || Ga(e, this.config.schema);
|
|
5783
5770
|
try {
|
|
5784
5771
|
const t = _a({
|
|
@@ -5820,7 +5807,7 @@ class wc {
|
|
|
5820
5807
|
this._log.info("[socket][open]", t.id, "skip; this is no longer the current transport");
|
|
5821
5808
|
return;
|
|
5822
5809
|
}
|
|
5823
|
-
this._log.info("[socket][open]", this._transport.id), this._setStatus(
|
|
5810
|
+
this._log.info("[socket][open]", this._transport.id), this._setStatus(Te.OPENED), this.getCurrentUser().then((r) => {
|
|
5824
5811
|
var s;
|
|
5825
5812
|
this._trySend(J(), {
|
|
5826
5813
|
op: "init",
|
|
@@ -5873,7 +5860,7 @@ class wc {
|
|
|
5873
5860
|
this._log.info("[socket][close]", t.id, "skip; this is no longer the current transport");
|
|
5874
5861
|
return;
|
|
5875
5862
|
}
|
|
5876
|
-
this._setStatus(
|
|
5863
|
+
this._setStatus(Te.CLOSED);
|
|
5877
5864
|
for (const r of Object.values(this._rooms))
|
|
5878
5865
|
r.isConnected = !1;
|
|
5879
5866
|
if (this._isShutdown) {
|
|
@@ -5910,7 +5897,7 @@ class wc {
|
|
|
5910
5897
|
log: this._log
|
|
5911
5898
|
}), this._oauthCallbackResponse = this._oauthLoginInit(), this.setupUserSyncTimer(), r.getIsOnline().then((o) => {
|
|
5912
5899
|
this._isOnline = o, this._startSocket(), r.listen((a) => {
|
|
5913
|
-
a !== this._isOnline && (this._log.info("[network] online =", a), this._isOnline = a, this._isOnline ? this._startSocket() : (this._log.info("Changing status from", this.status, "to",
|
|
5900
|
+
a !== this._isOnline && (this._log.info("[network] online =", a), this._isOnline = a, this._isOnline ? this._startSocket() : (this._log.info("Changing status from", this.status, "to", Te.CLOSED), this._setStatus(Te.CLOSED)));
|
|
5914
5901
|
});
|
|
5915
5902
|
}), typeof addEventListener < "u" && (this._beforeUnload = this._beforeUnload.bind(this), addEventListener("beforeunload", this._beforeUnload));
|
|
5916
5903
|
}
|
|
@@ -6001,13 +5988,13 @@ class wc {
|
|
|
6001
5988
|
s.resolve({ status: e, eventId: t });
|
|
6002
5989
|
else if (r != null && r.type) {
|
|
6003
5990
|
const { status: o, ...a } = r;
|
|
6004
|
-
s.reject(new
|
|
5991
|
+
s.reject(new Rt({
|
|
6005
5992
|
// @ts-expect-error body.type is not constant typed
|
|
6006
5993
|
body: a,
|
|
6007
5994
|
status: o ?? 0
|
|
6008
5995
|
}));
|
|
6009
5996
|
} else
|
|
6010
|
-
s.reject(new
|
|
5997
|
+
s.reject(new ie((r == null ? void 0 : r.message) || "Unknown error", r == null ? void 0 : r.hint, r == null ? void 0 : r.traceId));
|
|
6011
5998
|
}
|
|
6012
5999
|
_setStatus(e, t) {
|
|
6013
6000
|
this.status = e, this._errorMessage = t, this.notifyConnectionStatusSubs(e), this._instantStream.onConnectionStatusChange(e);
|
|
@@ -6031,7 +6018,7 @@ class wc {
|
|
|
6031
6018
|
_addQueryData(e, t, r) {
|
|
6032
6019
|
if (!this.attrs)
|
|
6033
6020
|
throw new Error("Attrs in reactor have not been set");
|
|
6034
|
-
const s =
|
|
6021
|
+
const s = se(e), i = this.ensureAttrs(), o = tt(this.attrs, t.triples, r, this.config.useDateObjects);
|
|
6035
6022
|
this.querySubs.updateInPlace((a) => {
|
|
6036
6023
|
a[s] = {
|
|
6037
6024
|
result: {
|
|
@@ -6046,39 +6033,39 @@ class wc {
|
|
|
6046
6033
|
}), this._cleanupPendingMutationsQueries(), this.notifyOne(s), this.notifyOneQueryOnce(s), this._cleanupPendingMutationsTimeout();
|
|
6047
6034
|
}
|
|
6048
6035
|
_handleReceive(e, t) {
|
|
6049
|
-
var s, i, o, a, c, u, l
|
|
6036
|
+
var s, i, o, a, c, u, l;
|
|
6050
6037
|
const r = !!this.config.schema && ("cardinalityInference" in this.config ? !!this.config.cardinalityInference : !0);
|
|
6051
6038
|
switch (vr[t.op] || this._log.info("[receive]", e, t.op, t), t.op) {
|
|
6052
6039
|
case "init-ok": {
|
|
6053
|
-
this._setStatus(
|
|
6040
|
+
this._setStatus(Te.AUTHENTICATED), this._reconnectTimeoutMs = 0, this._setAttrs(t.attrs), this._flushPendingMessages(), this._sessionId = t["session-id"];
|
|
6054
6041
|
for (const y of Object.keys(this._rooms)) {
|
|
6055
|
-
const
|
|
6056
|
-
this._tryJoinRoom(
|
|
6042
|
+
const b = (i = (s = this._presence[y]) == null ? void 0 : s.result) == null ? void 0 : i.user, g = (o = this._rooms[y]) == null ? void 0 : o.roomType;
|
|
6043
|
+
this._tryJoinRoom(g, y, b);
|
|
6057
6044
|
}
|
|
6058
6045
|
break;
|
|
6059
6046
|
}
|
|
6060
6047
|
case "add-query-exists": {
|
|
6061
|
-
this.notifyOneQueryOnce(
|
|
6048
|
+
this.notifyOneQueryOnce(se(t.q));
|
|
6062
6049
|
break;
|
|
6063
6050
|
}
|
|
6064
6051
|
case "add-query-ok": {
|
|
6065
|
-
const { q: y, result:
|
|
6066
|
-
if (!this._hasQueryListeners() && !this.querySubs.currentValue[
|
|
6052
|
+
const { q: y, result: b } = t, g = se(y);
|
|
6053
|
+
if (!this._hasQueryListeners() && !this.querySubs.currentValue[g])
|
|
6067
6054
|
break;
|
|
6068
|
-
const
|
|
6069
|
-
this.querySubs.updateInPlace((
|
|
6070
|
-
if (!
|
|
6071
|
-
this._log.info("Missing value in querySubs", { hash:
|
|
6055
|
+
const m = (c = (a = b == null ? void 0 : b[0]) == null ? void 0 : a.data) == null ? void 0 : c["page-info"], S = (l = (u = b == null ? void 0 : b[0]) == null ? void 0 : u.data) == null ? void 0 : l.aggregate, _ = hr(b), T = this.ensureAttrs(), M = tt(T, _, r, this.config.useDateObjects);
|
|
6056
|
+
this.querySubs.updateInPlace((O) => {
|
|
6057
|
+
if (!O[g]) {
|
|
6058
|
+
this._log.info("Missing value in querySubs", { hash: g, q: y });
|
|
6072
6059
|
return;
|
|
6073
6060
|
}
|
|
6074
|
-
|
|
6075
|
-
store:
|
|
6076
|
-
attrsStore:
|
|
6077
|
-
pageInfo:
|
|
6078
|
-
aggregate:
|
|
6061
|
+
O[g].result = {
|
|
6062
|
+
store: M,
|
|
6063
|
+
attrsStore: T,
|
|
6064
|
+
pageInfo: m,
|
|
6065
|
+
aggregate: S,
|
|
6079
6066
|
processedTxId: t["processed-tx-id"]
|
|
6080
6067
|
};
|
|
6081
|
-
}), this._cleanupPendingMutationsQueries(), this.notifyOne(
|
|
6068
|
+
}), this._cleanupPendingMutationsQueries(), this.notifyOne(g), this.notifyOneQueryOnce(g), this._cleanupPendingMutationsTimeout();
|
|
6082
6069
|
break;
|
|
6083
6070
|
}
|
|
6084
6071
|
case "start-sync-ok": {
|
|
@@ -6114,65 +6101,65 @@ class wc {
|
|
|
6114
6101
|
break;
|
|
6115
6102
|
}
|
|
6116
6103
|
case "refresh-ok": {
|
|
6117
|
-
const { computations: y, attrs:
|
|
6118
|
-
|
|
6119
|
-
const
|
|
6120
|
-
|
|
6121
|
-
|
|
6104
|
+
const { computations: y, attrs: b } = t, g = t["processed-tx-id"];
|
|
6105
|
+
b && this._setAttrs(b), this._cleanupPendingMutationsTimeout();
|
|
6106
|
+
const m = this._rewriteMutations(this.ensureAttrs(), this._pendingMutations(), g);
|
|
6107
|
+
m !== this._pendingMutations() && this.kv.updateInPlace((T) => {
|
|
6108
|
+
T.pendingMutations = m;
|
|
6122
6109
|
});
|
|
6123
|
-
const
|
|
6124
|
-
var E,
|
|
6125
|
-
const
|
|
6110
|
+
const S = Bt(m.entries()), _ = y.map((T) => {
|
|
6111
|
+
var q, E, j, R;
|
|
6112
|
+
const M = T["instaql-query"], O = T["instaql-result"], F = se(M), P = hr(O), C = this.ensureAttrs(), G = tt(C, P, r, this.config.useDateObjects), { store: N, attrsStore: B } = this._applyOptimisticUpdates(G, C, S, g), z = (E = (q = O == null ? void 0 : O[0]) == null ? void 0 : q.data) == null ? void 0 : E["page-info"], ee = (R = (j = O == null ? void 0 : O[0]) == null ? void 0 : j.data) == null ? void 0 : R.aggregate;
|
|
6126
6113
|
return {
|
|
6127
|
-
q:
|
|
6128
|
-
hash:
|
|
6129
|
-
store:
|
|
6130
|
-
attrsStore:
|
|
6131
|
-
pageInfo:
|
|
6132
|
-
aggregate:
|
|
6114
|
+
q: M,
|
|
6115
|
+
hash: F,
|
|
6116
|
+
store: N,
|
|
6117
|
+
attrsStore: B,
|
|
6118
|
+
pageInfo: z,
|
|
6119
|
+
aggregate: ee
|
|
6133
6120
|
};
|
|
6134
6121
|
});
|
|
6135
|
-
|
|
6136
|
-
this.querySubs.updateInPlace((
|
|
6137
|
-
if (!
|
|
6138
|
-
this._log.error("Missing value in querySubs", { hash:
|
|
6122
|
+
_.forEach(({ hash: T, q: M, store: O, attrsStore: F, pageInfo: P, aggregate: C }) => {
|
|
6123
|
+
this.querySubs.updateInPlace((G) => {
|
|
6124
|
+
if (!G[T]) {
|
|
6125
|
+
this._log.error("Missing value in querySubs", { hash: T, q: M });
|
|
6139
6126
|
return;
|
|
6140
6127
|
}
|
|
6141
|
-
|
|
6142
|
-
store:
|
|
6143
|
-
attrsStore:
|
|
6128
|
+
G[T].result = {
|
|
6129
|
+
store: O,
|
|
6130
|
+
attrsStore: F,
|
|
6144
6131
|
pageInfo: P,
|
|
6145
|
-
aggregate:
|
|
6146
|
-
processedTxId:
|
|
6132
|
+
aggregate: C,
|
|
6133
|
+
processedTxId: g
|
|
6147
6134
|
};
|
|
6148
6135
|
});
|
|
6149
|
-
}), this._cleanupPendingMutationsQueries(),
|
|
6150
|
-
this.notifyOne(
|
|
6136
|
+
}), this._cleanupPendingMutationsQueries(), _.forEach(({ hash: T }) => {
|
|
6137
|
+
this.notifyOne(T);
|
|
6151
6138
|
});
|
|
6152
6139
|
break;
|
|
6153
6140
|
}
|
|
6154
6141
|
case "transact-ok": {
|
|
6155
|
-
const { "client-event-id": y, "tx-id":
|
|
6142
|
+
const { "client-event-id": y, "tx-id": b } = t;
|
|
6156
6143
|
this._inFlightMutationEventIds.delete(y);
|
|
6157
|
-
const
|
|
6158
|
-
if (!
|
|
6144
|
+
const m = this._rewriteMutations(this.ensureAttrs(), this._pendingMutations()).get(y);
|
|
6145
|
+
if (!m)
|
|
6159
6146
|
break;
|
|
6160
|
-
this._updatePendingMutations((
|
|
6161
|
-
|
|
6162
|
-
...
|
|
6163
|
-
"tx-id":
|
|
6147
|
+
this._updatePendingMutations((_) => {
|
|
6148
|
+
_.set(y, {
|
|
6149
|
+
..._.get(y),
|
|
6150
|
+
"tx-id": b,
|
|
6164
6151
|
confirmed: Date.now()
|
|
6165
6152
|
});
|
|
6166
6153
|
});
|
|
6167
|
-
const
|
|
6168
|
-
for (const
|
|
6169
|
-
if (
|
|
6170
|
-
const
|
|
6171
|
-
|
|
6154
|
+
const S = [];
|
|
6155
|
+
for (const _ of m["tx-steps"])
|
|
6156
|
+
if (_[0] === "add-attr") {
|
|
6157
|
+
const T = _[1];
|
|
6158
|
+
S.push(T);
|
|
6172
6159
|
}
|
|
6173
|
-
if (
|
|
6174
|
-
const
|
|
6175
|
-
this._setAttrs([...
|
|
6160
|
+
if (S.length) {
|
|
6161
|
+
const _ = Object.values(this.ensureAttrs().attrs);
|
|
6162
|
+
this._setAttrs([..._, ...S]);
|
|
6176
6163
|
}
|
|
6177
6164
|
this._finishTransaction("synced", y), this._cleanupPendingMutationsTimeout();
|
|
6178
6165
|
break;
|
|
@@ -6188,8 +6175,8 @@ class wc {
|
|
|
6188
6175
|
break;
|
|
6189
6176
|
}
|
|
6190
6177
|
case "server-broadcast": {
|
|
6191
|
-
const y = t["room-id"],
|
|
6192
|
-
this._trySetRoomConnected(y, !0), this._notifyBroadcastSubs(y,
|
|
6178
|
+
const y = t["room-id"], b = t.topic;
|
|
6179
|
+
this._trySetRoomConnected(y, !0), this._notifyBroadcastSubs(y, b, t);
|
|
6193
6180
|
break;
|
|
6194
6181
|
}
|
|
6195
6182
|
case "join-room-ok": {
|
|
@@ -6206,21 +6193,9 @@ class wc {
|
|
|
6206
6193
|
this._trySetRoomConnected(y, !1);
|
|
6207
6194
|
break;
|
|
6208
6195
|
}
|
|
6209
|
-
case "app-status-changed": {
|
|
6210
|
-
const y = this._appStatusState.status;
|
|
6211
|
-
if (this._setAppStatus(t.status), t.status === "disabled" && y !== "disabled") {
|
|
6212
|
-
const g = {
|
|
6213
|
-
message: "This app is currently disabled.",
|
|
6214
|
-
hint: { status: "disabled" }
|
|
6215
|
-
};
|
|
6216
|
-
Object.keys(this.queryCbs).forEach((_) => this.notifyQueryError(_, g));
|
|
6217
|
-
}
|
|
6218
|
-
y === "disabled" && t.status !== "disabled" && this._startSocket();
|
|
6219
|
-
break;
|
|
6220
|
-
}
|
|
6221
6196
|
case "join-room-error":
|
|
6222
|
-
const
|
|
6223
|
-
|
|
6197
|
+
const f = t["room-id"], h = this._rooms[f];
|
|
6198
|
+
h && (h.error = t.error), this._notifyPresenceSubs(f);
|
|
6224
6199
|
break;
|
|
6225
6200
|
case "error":
|
|
6226
6201
|
this._handleReceiveError(t);
|
|
@@ -6263,7 +6238,7 @@ class wc {
|
|
|
6263
6238
|
}
|
|
6264
6239
|
}
|
|
6265
6240
|
_handleReceiveError(e) {
|
|
6266
|
-
var a, c, u, l, f, h,
|
|
6241
|
+
var a, c, u, l, f, h, y, b;
|
|
6267
6242
|
this._log.info("error", e);
|
|
6268
6243
|
const t = e["client-event-id"];
|
|
6269
6244
|
this._inFlightMutationEventIds.delete(t);
|
|
@@ -6271,27 +6246,27 @@ class wc {
|
|
|
6271
6246
|
message: e.message || "Uh-oh, something went wrong. Ping Joe & Stopa."
|
|
6272
6247
|
};
|
|
6273
6248
|
if (e.hint && (s.hint = e.hint), e["trace-id"] || (a = e["original-event"]) != null && a["trace-id"]) {
|
|
6274
|
-
const
|
|
6275
|
-
s.traceId =
|
|
6249
|
+
const m = [e["trace-id"], (c = e["original-event"]) == null ? void 0 : c["trace-id"]].filter(Boolean).join(",");
|
|
6250
|
+
s.traceId = m;
|
|
6276
6251
|
}
|
|
6277
6252
|
if (r) {
|
|
6278
6253
|
this._handleMutationError("error", t, s);
|
|
6279
6254
|
return;
|
|
6280
6255
|
}
|
|
6281
6256
|
if ((u = e["original-event"]) != null && u.hasOwnProperty("q") && ((l = e["original-event"]) == null ? void 0 : l.op) === "add-query") {
|
|
6282
|
-
const g = (f = e["original-event"]) == null ? void 0 : f.q,
|
|
6283
|
-
this.notifyQueryError(
|
|
6257
|
+
const g = (f = e["original-event"]) == null ? void 0 : f.q, m = se(g);
|
|
6258
|
+
this.notifyQueryError(se(g), s), this.notifyQueryOnceError(g, m, t, s);
|
|
6284
6259
|
return;
|
|
6285
6260
|
}
|
|
6286
6261
|
if (((h = e["original-event"]) == null ? void 0 : h.op) === "init") {
|
|
6287
|
-
if (e.type === "record-not-found" && ((
|
|
6262
|
+
if (e.type === "record-not-found" && ((y = e.hint) == null ? void 0 : y["record-type"]) === "app-user") {
|
|
6288
6263
|
this.changeCurrentUser(null);
|
|
6289
6264
|
return;
|
|
6290
6265
|
}
|
|
6291
|
-
this._setStatus(
|
|
6266
|
+
this._setStatus(Te.ERRORED, s), this.notifyAll();
|
|
6292
6267
|
return;
|
|
6293
6268
|
}
|
|
6294
|
-
switch ((
|
|
6269
|
+
switch ((b = e["original-event"]) == null ? void 0 : b.op) {
|
|
6295
6270
|
case "resync-table": {
|
|
6296
6271
|
this._syncTable.onResyncError(e);
|
|
6297
6272
|
return;
|
|
@@ -6318,7 +6293,7 @@ class wc {
|
|
|
6318
6293
|
i && (i.dfd.reject(s), this._completeQueryOnce(e, t, i.dfd));
|
|
6319
6294
|
}
|
|
6320
6295
|
_setAttrs(e) {
|
|
6321
|
-
this.attrs = new
|
|
6296
|
+
this.attrs = new Re(e.reduce((t, r) => (t[r.id] = r, t), {}), this._linkIndex), this.notifyAttrsSubs();
|
|
6322
6297
|
}
|
|
6323
6298
|
_startQuerySub(e, t) {
|
|
6324
6299
|
const r = J();
|
|
@@ -6363,7 +6338,7 @@ class wc {
|
|
|
6363
6338
|
*/
|
|
6364
6339
|
subscribeQuery(e, t, r) {
|
|
6365
6340
|
this.config.disableValidation || br(e, this.config.schema), r && "ruleParams" in r && (e = { $$ruleParams: r.ruleParams, ...e });
|
|
6366
|
-
const s =
|
|
6341
|
+
const s = se(e), i = this.getPreviousResult(e);
|
|
6367
6342
|
return i && t(i), this.queryCbs[s] = this.queryCbs[s] ?? [], this.queryCbs[s].push({ q: e, cb: t }), this._startQuerySub(e, s), () => {
|
|
6368
6343
|
this._unsubQuery(e, s, t);
|
|
6369
6344
|
};
|
|
@@ -6375,7 +6350,7 @@ class wc {
|
|
|
6375
6350
|
return r.reject(new Error("We can't run `queryOnce`, because the device is offline.")), r.promise;
|
|
6376
6351
|
if (!this.querySubs)
|
|
6377
6352
|
return r.reject(new Error("We can't run `queryOnce` on the backend. Use adminAPI.query instead: https://www.instantdb.com/docs/backend#query")), r.promise;
|
|
6378
|
-
const s =
|
|
6353
|
+
const s = se(e), i = this._startQuerySub(e, s);
|
|
6379
6354
|
return this.queryOnceDfds[s] = this.queryOnceDfds[s] ?? [], this.queryOnceDfds[s].push({ q: e, dfd: r, eventId: i }), setTimeout(() => r.reject(new Error("Query timed out")), ac), r.promise;
|
|
6380
6355
|
}
|
|
6381
6356
|
_completeQueryOnce(e, t, r) {
|
|
@@ -6414,21 +6389,21 @@ class wc {
|
|
|
6414
6389
|
if (!t)
|
|
6415
6390
|
return /* @__PURE__ */ new Map();
|
|
6416
6391
|
const s = (l) => {
|
|
6417
|
-
const [f, h,
|
|
6418
|
-
return ne(e, h,
|
|
6392
|
+
const [f, h, y] = l["forward-identity"];
|
|
6393
|
+
return ne(e, h, y);
|
|
6419
6394
|
}, i = (l) => {
|
|
6420
|
-
const [f, h,
|
|
6421
|
-
return De(e, h,
|
|
6395
|
+
const [f, h, y] = l["forward-identity"];
|
|
6396
|
+
return De(e, h, y);
|
|
6422
6397
|
}, o = { attrIdMap: {}, refSwapAttrIds: /* @__PURE__ */ new Set() };
|
|
6423
6398
|
let a = !1;
|
|
6424
6399
|
const c = (l, f) => {
|
|
6425
6400
|
const h = [];
|
|
6426
|
-
for (const
|
|
6427
|
-
const [
|
|
6428
|
-
if (
|
|
6429
|
-
const [
|
|
6430
|
-
if (
|
|
6431
|
-
o.attrIdMap[S.id] =
|
|
6401
|
+
for (const y of l) {
|
|
6402
|
+
const [b] = y;
|
|
6403
|
+
if (b === "add-attr") {
|
|
6404
|
+
const [m, S] = y, _ = s(S);
|
|
6405
|
+
if (_ && S.id !== _.id) {
|
|
6406
|
+
o.attrIdMap[S.id] = _.id, a = !0;
|
|
6432
6407
|
continue;
|
|
6433
6408
|
}
|
|
6434
6409
|
if (S["value-type"] === "ref") {
|
|
@@ -6439,11 +6414,11 @@ class wc {
|
|
|
6439
6414
|
}
|
|
6440
6415
|
}
|
|
6441
6416
|
}
|
|
6442
|
-
if (r && f && r >= f &&
|
|
6417
|
+
if (r && f && r >= f && b === "add-attr" || b === "update-attr" || b === "delete-attr") {
|
|
6443
6418
|
a = !0;
|
|
6444
6419
|
continue;
|
|
6445
6420
|
}
|
|
6446
|
-
const g = a ? Bo(o,
|
|
6421
|
+
const g = a ? Bo(o, y) : y;
|
|
6447
6422
|
h.push(g);
|
|
6448
6423
|
}
|
|
6449
6424
|
return a ? h : l;
|
|
@@ -6474,13 +6449,13 @@ class wc {
|
|
|
6474
6449
|
r.push(u);
|
|
6475
6450
|
}
|
|
6476
6451
|
if (!t.size && !r.length)
|
|
6477
|
-
return this.attrs || new
|
|
6452
|
+
return this.attrs || new Re({}, this._linkIndex);
|
|
6478
6453
|
const s = { ...((o = this.attrs) == null ? void 0 : o.attrs) || {} };
|
|
6479
6454
|
for (const a of r)
|
|
6480
6455
|
s[a.id] = a;
|
|
6481
6456
|
for (const a of t)
|
|
6482
6457
|
delete s[a];
|
|
6483
|
-
return new
|
|
6458
|
+
return new Re(s, this._linkIndex);
|
|
6484
6459
|
}
|
|
6485
6460
|
/** Runs instaql on a query and a store */
|
|
6486
6461
|
dataForQuery(e, t = !0) {
|
|
@@ -6496,12 +6471,12 @@ class wc {
|
|
|
6496
6471
|
if (l && s === l.querySubVersion && o === l.pendingMutationsVersion)
|
|
6497
6472
|
return l;
|
|
6498
6473
|
let f = u.store, h = u.attrsStore;
|
|
6499
|
-
const { pageInfo:
|
|
6474
|
+
const { pageInfo: y, aggregate: b, processedTxId: g } = u, m = this._rewriteMutationsSorted(h, a);
|
|
6500
6475
|
if (t) {
|
|
6501
|
-
const
|
|
6502
|
-
f =
|
|
6476
|
+
const _ = this._applyOptimisticUpdates(f, h, m, g);
|
|
6477
|
+
f = _.store, h = _.attrsStore;
|
|
6503
6478
|
}
|
|
6504
|
-
return { data: is({ store: f, attrsStore: h, pageInfo:
|
|
6479
|
+
return { data: is({ store: f, attrsStore: h, pageInfo: y, aggregate: b }, c), querySubVersion: s, pendingMutationsVersion: o };
|
|
6505
6480
|
}
|
|
6506
6481
|
_applyOptimisticUpdates(e, t, r, s) {
|
|
6507
6482
|
for (const [i, o] of r)
|
|
@@ -6538,7 +6513,7 @@ class wc {
|
|
|
6538
6513
|
});
|
|
6539
6514
|
return;
|
|
6540
6515
|
}
|
|
6541
|
-
if (this.status !==
|
|
6516
|
+
if (this.status !== Te.AUTHENTICATED) {
|
|
6542
6517
|
this._finishTransaction("enqueued", e);
|
|
6543
6518
|
return;
|
|
6544
6519
|
}
|
|
@@ -6596,7 +6571,7 @@ class wc {
|
|
|
6596
6571
|
});
|
|
6597
6572
|
}
|
|
6598
6573
|
_trySendAuthed(...e) {
|
|
6599
|
-
this.status ===
|
|
6574
|
+
this.status === Te.AUTHENTICATED && this._trySend(...e);
|
|
6600
6575
|
}
|
|
6601
6576
|
_trySend(e, t, r) {
|
|
6602
6577
|
if (this._transport.isOpen()) {
|
|
@@ -6696,18 +6671,18 @@ class wc {
|
|
|
6696
6671
|
this._replaceUrlAfterOAuth();
|
|
6697
6672
|
try {
|
|
6698
6673
|
let u;
|
|
6699
|
-
const l = await this.kv.waitForKeyToLoad(
|
|
6700
|
-
s && l && (u = l[s]), l && this.kv.updateInPlace((
|
|
6701
|
-
delete
|
|
6674
|
+
const l = await this.kv.waitForKeyToLoad(gt);
|
|
6675
|
+
s && l && (u = l[s]), l && this.kv.updateInPlace((b) => {
|
|
6676
|
+
delete b[gt];
|
|
6702
6677
|
});
|
|
6703
|
-
const f = await this._getCurrentUser(), h = (f == null ? void 0 : f.type) === "guest", { user:
|
|
6678
|
+
const f = await this._getCurrentUser(), h = (f == null ? void 0 : f.type) === "guest", { user: y } = await lr({
|
|
6704
6679
|
apiURI: this.config.apiURI,
|
|
6705
6680
|
appId: this.config.appId,
|
|
6706
6681
|
code: r,
|
|
6707
6682
|
refreshToken: h ? f.refresh_token : void 0,
|
|
6708
6683
|
extraFields: u
|
|
6709
6684
|
});
|
|
6710
|
-
return this.setCurrentUser(
|
|
6685
|
+
return this.setCurrentUser(y), null;
|
|
6711
6686
|
} catch (u) {
|
|
6712
6687
|
return ((i = u == null ? void 0 : u.body) == null ? void 0 : i.type) === "record-not-found" && ((a = (o = u == null ? void 0 : u.body) == null ? void 0 : o.hint) == null ? void 0 : a["record-type"]) === "app-oauth-code" && await this._hasCurrentUser() ? null : { error: { message: ((c = u == null ? void 0 : u.body) == null ? void 0 : c.message) || "Error logging in." } };
|
|
6713
6688
|
}
|
|
@@ -6726,7 +6701,7 @@ class wc {
|
|
|
6726
6701
|
t.isLoading || e(this._currentUserCached);
|
|
6727
6702
|
let r = !1;
|
|
6728
6703
|
return this.getCurrentUser().then((s) => {
|
|
6729
|
-
r ||
|
|
6704
|
+
r || St(s, t) || e(s);
|
|
6730
6705
|
}), () => {
|
|
6731
6706
|
r = !0, this.authCbs = this.authCbs.filter((s) => s !== e);
|
|
6732
6707
|
};
|
|
@@ -6734,7 +6709,7 @@ class wc {
|
|
|
6734
6709
|
async getAuth() {
|
|
6735
6710
|
const { user: e, error: t } = await this.getCurrentUser();
|
|
6736
6711
|
if (t)
|
|
6737
|
-
throw new
|
|
6712
|
+
throw new ie("Could not get current user: " + t.message);
|
|
6738
6713
|
return e ?? null;
|
|
6739
6714
|
}
|
|
6740
6715
|
subscribeConnectionStatus(e) {
|
|
@@ -6742,21 +6717,6 @@ class wc {
|
|
|
6742
6717
|
this.connectionStatusCbs = this.connectionStatusCbs.filter((t) => t !== e);
|
|
6743
6718
|
};
|
|
6744
6719
|
}
|
|
6745
|
-
/**
|
|
6746
|
-
* @param {'active' | 'read-only' | 'disabled' | undefined} status
|
|
6747
|
-
*/
|
|
6748
|
-
_setAppStatus(e) {
|
|
6749
|
-
!e || e === this._appStatusState.status || (this._appStatusState = {
|
|
6750
|
-
isLoading: !1,
|
|
6751
|
-
isReadOnly: e !== "active",
|
|
6752
|
-
status: e
|
|
6753
|
-
}, this.notifyAppStatusSubs(this._appStatusState));
|
|
6754
|
-
}
|
|
6755
|
-
subscribeAppStatus(e) {
|
|
6756
|
-
return this.appStatusCbs.push(e), e(this._appStatusState), () => {
|
|
6757
|
-
this.appStatusCbs = this.appStatusCbs.filter((t) => t !== e);
|
|
6758
|
-
};
|
|
6759
|
-
}
|
|
6760
6720
|
subscribeAttrs(e) {
|
|
6761
6721
|
return this.attrsCbs.push(e), this.attrs && e(this.attrs.attrs), () => {
|
|
6762
6722
|
this.attrsCbs = this.attrsCbs.filter((t) => t !== e);
|
|
@@ -6777,9 +6737,6 @@ class wc {
|
|
|
6777
6737
|
notifyConnectionStatusSubs(e) {
|
|
6778
6738
|
this.connectionStatusCbs.forEach((t) => t(e));
|
|
6779
6739
|
}
|
|
6780
|
-
notifyAppStatusSubs(e) {
|
|
6781
|
-
this.appStatusCbs.forEach((t) => t(e));
|
|
6782
|
-
}
|
|
6783
6740
|
async setCurrentUser(e) {
|
|
6784
6741
|
this.kv.updateInPlace((t) => {
|
|
6785
6742
|
t[Fe] = e;
|
|
@@ -6828,7 +6785,7 @@ class wc {
|
|
|
6828
6785
|
async changeCurrentUser(e) {
|
|
6829
6786
|
var r;
|
|
6830
6787
|
const { user: t } = await this.getCurrentUser();
|
|
6831
|
-
if (!
|
|
6788
|
+
if (!St(t, e)) {
|
|
6832
6789
|
this._frameworkClient = null, await this.setCurrentUser(e), await this.updateUser(e);
|
|
6833
6790
|
try {
|
|
6834
6791
|
await this.kv.flush(), (r = this._broadcastChannel) == null || r.postMessage({ type: "auth" });
|
|
@@ -6840,7 +6797,7 @@ class wc {
|
|
|
6840
6797
|
async setupUserSyncTimer() {
|
|
6841
6798
|
if (this.config.firstPartyPath)
|
|
6842
6799
|
try {
|
|
6843
|
-
const e = await this.kv.waitForKeyToLoad(
|
|
6800
|
+
const e = await this.kv.waitForKeyToLoad(Sr), t = e ? new Date(e).getTime() : 0;
|
|
6844
6801
|
if (!(!Number.isFinite(t) || Date.now() - t >= fc))
|
|
6845
6802
|
return;
|
|
6846
6803
|
const { user: s } = await this.getCurrentUser();
|
|
@@ -6869,7 +6826,7 @@ class wc {
|
|
|
6869
6826
|
this._log.error("Error syncing user with external endpoint", t);
|
|
6870
6827
|
}
|
|
6871
6828
|
this.kv.updateInPlace((t) => {
|
|
6872
|
-
t[
|
|
6829
|
+
t[Sr] = (/* @__PURE__ */ new Date()).toISOString();
|
|
6873
6830
|
});
|
|
6874
6831
|
}
|
|
6875
6832
|
}
|
|
@@ -6936,7 +6893,7 @@ class wc {
|
|
|
6936
6893
|
this._log.info("[auth-invalidate] skipped invalidateToken");
|
|
6937
6894
|
return;
|
|
6938
6895
|
}
|
|
6939
|
-
|
|
6896
|
+
Ma({
|
|
6940
6897
|
apiURI: this.config.apiURI,
|
|
6941
6898
|
appId: this.config.appId,
|
|
6942
6899
|
refreshToken: r
|
|
@@ -6964,8 +6921,8 @@ class wc {
|
|
|
6964
6921
|
if (r) {
|
|
6965
6922
|
const a = `${Math.random().toString(36).slice(2)}`;
|
|
6966
6923
|
this.kv.updateInPlace((c) => {
|
|
6967
|
-
const u = c[
|
|
6968
|
-
u[a] = r, c[
|
|
6924
|
+
const u = c[gt] || {};
|
|
6925
|
+
u[a] = r, c[gt] = u;
|
|
6969
6926
|
}), o = `${t}${t.includes("?") ? "&" : "?"}${Qt}=${a}`;
|
|
6970
6927
|
}
|
|
6971
6928
|
return `${s}/runtime/oauth/start?app_id=${i}&client_name=${e}&redirect_uri=${encodeURIComponent(o)}`;
|
|
@@ -7169,8 +7126,8 @@ class wc {
|
|
|
7169
7126
|
_notifyBroadcastSubs(e, t, r) {
|
|
7170
7127
|
var s, i, o;
|
|
7171
7128
|
(o = (i = (s = this._broadcastSubs) == null ? void 0 : s[e]) == null ? void 0 : i[t]) == null || o.forEach((a) => {
|
|
7172
|
-
var l, f, h,
|
|
7173
|
-
const c = (l = r.data) == null ? void 0 : l.data, u = r.data["peer-id"] === this._sessionId ? (h = (f = this._presence[e]) == null ? void 0 : f.result) == null ? void 0 : h.user : (g = (
|
|
7129
|
+
var l, f, h, y, b, g;
|
|
7130
|
+
const c = (l = r.data) == null ? void 0 : l.data, u = r.data["peer-id"] === this._sessionId ? (h = (f = this._presence[e]) == null ? void 0 : f.result) == null ? void 0 : h.user : (g = (b = (y = this._presence[e]) == null ? void 0 : y.result) == null ? void 0 : b.peers) == null ? void 0 : g[r.data["peer-id"]];
|
|
7174
7131
|
return a(c, u);
|
|
7175
7132
|
});
|
|
7176
7133
|
}
|
|
@@ -7179,7 +7136,7 @@ class wc {
|
|
|
7179
7136
|
async uploadFile(e, t, r) {
|
|
7180
7137
|
var o;
|
|
7181
7138
|
const s = await this.getCurrentUser(), i = (o = s == null ? void 0 : s.user) == null ? void 0 : o.refresh_token;
|
|
7182
|
-
return
|
|
7139
|
+
return Ra({
|
|
7183
7140
|
...r,
|
|
7184
7141
|
apiURI: this.config.apiURI,
|
|
7185
7142
|
appId: this.config.appId,
|
|
@@ -7221,10 +7178,10 @@ class wc {
|
|
|
7221
7178
|
});
|
|
7222
7179
|
}
|
|
7223
7180
|
}
|
|
7224
|
-
let
|
|
7225
|
-
function
|
|
7226
|
-
|
|
7227
|
-
const t = kc(e), r = Ac(e, a), s = vc(
|
|
7181
|
+
let _t;
|
|
7182
|
+
function Tc(n, e) {
|
|
7183
|
+
_t == null || _t.dispose();
|
|
7184
|
+
const t = kc(e), r = Ac(e, a), s = vc(Sc(n));
|
|
7228
7185
|
function i(l) {
|
|
7229
7186
|
var f;
|
|
7230
7187
|
l.source === s.element.contentWindow && ((f = l.data) == null ? void 0 : f.type) === "close" && t.isVisible() && a();
|
|
@@ -7240,13 +7197,13 @@ function Sc(n, e) {
|
|
|
7240
7197
|
t.element.remove(), r.element.remove(), removeEventListener("keydown", o), removeEventListener("message", i);
|
|
7241
7198
|
}
|
|
7242
7199
|
function u() {
|
|
7243
|
-
document.body.appendChild(t.element), document.body.appendChild(r.element), addEventListener("keydown", o), addEventListener("message", i),
|
|
7200
|
+
document.body.appendChild(t.element), document.body.appendChild(r.element), addEventListener("keydown", o), addEventListener("message", i), _t = {
|
|
7244
7201
|
dispose: c
|
|
7245
7202
|
};
|
|
7246
7203
|
}
|
|
7247
7204
|
return u();
|
|
7248
7205
|
}
|
|
7249
|
-
function
|
|
7206
|
+
function Sc(n) {
|
|
7250
7207
|
return `${Cn || fs ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${n}`;
|
|
7251
7208
|
}
|
|
7252
7209
|
function vc(n) {
|
|
@@ -7348,7 +7305,7 @@ const Cc = (n) => JSON.stringify(n), rt = (n, e = !1) => JSON.stringify([n, e]),
|
|
|
7348
7305
|
};
|
|
7349
7306
|
}, ws = (n) => n && Object.keys(n).length > 0 ? n : {
|
|
7350
7307
|
serverCreatedAt: "asc"
|
|
7351
|
-
},
|
|
7308
|
+
}, Mc = (n, e) => {
|
|
7352
7309
|
const t = [
|
|
7353
7310
|
...Array.from(e.values()).slice().reverse(),
|
|
7354
7311
|
...Array.from(n.values())
|
|
@@ -7357,36 +7314,36 @@ const Cc = (n) => JSON.stringify(n), rt = (n, e = !1) => JSON.stringify([n, e]),
|
|
|
7357
7314
|
...Array.from(n.values()).flatMap((s) => s.data)
|
|
7358
7315
|
];
|
|
7359
7316
|
return { chunks: t, data: r };
|
|
7360
|
-
}, Gt = ["bootstrap", "bootstrap", "bootstrap", 1],
|
|
7317
|
+
}, Gt = ["bootstrap", "bootstrap", "bootstrap", 1], Rc = (n, e, t, r) => {
|
|
7361
7318
|
var B, z, ee, q;
|
|
7362
|
-
const { entityName: s, entityQuery: i } =
|
|
7363
|
-
let h = !1,
|
|
7364
|
-
const
|
|
7319
|
+
const { entityName: s, entityQuery: i } = Ts(e), o = ((B = i.$) == null ? void 0 : B.limit) || 10, a = s, c = ws((z = i.$) == null ? void 0 : z.order), u = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map();
|
|
7320
|
+
let h = !1, y = !0, b = null, g = null;
|
|
7321
|
+
const m = (E) => {
|
|
7365
7322
|
t({ error: E, data: void 0, canLoadNextPage: !1 });
|
|
7366
7323
|
}, S = () => {
|
|
7367
|
-
if (!
|
|
7324
|
+
if (!y)
|
|
7368
7325
|
return;
|
|
7369
|
-
const { chunks: E, data:
|
|
7326
|
+
const { chunks: E, data: j } = Mc(u, l);
|
|
7370
7327
|
t({
|
|
7371
|
-
data: { [a]:
|
|
7328
|
+
data: { [a]: j },
|
|
7372
7329
|
// @ts-expect-error hidden debug variable
|
|
7373
7330
|
chunks: E,
|
|
7374
7331
|
canLoadNextPage: Pc(u)
|
|
7375
7332
|
});
|
|
7376
|
-
},
|
|
7377
|
-
u.set(rt(E,
|
|
7378
|
-
}, T = (E,
|
|
7379
|
-
l.set(rt(E),
|
|
7380
|
-
},
|
|
7333
|
+
}, _ = (E, j) => {
|
|
7334
|
+
u.set(rt(E, j.afterInclusive), j), S();
|
|
7335
|
+
}, T = (E, j) => {
|
|
7336
|
+
l.set(rt(E), j), C(), S();
|
|
7337
|
+
}, M = (E, j) => {
|
|
7381
7338
|
var A, k;
|
|
7382
|
-
const { cursor:
|
|
7383
|
-
|
|
7384
|
-
const
|
|
7339
|
+
const { cursor: R } = Ar(E), U = f.get(Ne("reverse", R));
|
|
7340
|
+
U == null || U();
|
|
7341
|
+
const L = n.subscribeQuery({
|
|
7385
7342
|
[a]: {
|
|
7386
7343
|
...i,
|
|
7387
7344
|
$: {
|
|
7388
|
-
after:
|
|
7389
|
-
before:
|
|
7345
|
+
after: R,
|
|
7346
|
+
before: j.endCursor,
|
|
7390
7347
|
beforeInclusive: !0,
|
|
7391
7348
|
where: (A = i.$) == null ? void 0 : A.where,
|
|
7392
7349
|
fields: (k = i.$) == null ? void 0 : k.fields,
|
|
@@ -7395,33 +7352,33 @@ const Cc = (n) => JSON.stringify(n), rt = (n, e = !1) => JSON.stringify([n, e]),
|
|
|
7395
7352
|
}
|
|
7396
7353
|
}, (K) => {
|
|
7397
7354
|
if (K.error)
|
|
7398
|
-
return
|
|
7355
|
+
return m(K.error);
|
|
7399
7356
|
const H = K.data[a], Y = K.pageInfo[a];
|
|
7400
|
-
Ze(H && Y, "Expected query subscription to contain rows and pageInfo"), T(
|
|
7357
|
+
Ze(H && Y, "Expected query subscription to contain rows and pageInfo"), T(R, {
|
|
7401
7358
|
data: H,
|
|
7402
7359
|
status: "frozen",
|
|
7403
7360
|
hasMore: Y.hasNextPage,
|
|
7404
7361
|
endCursor: Y.endCursor
|
|
7405
7362
|
});
|
|
7406
7363
|
}, r);
|
|
7407
|
-
f.set(Ne("reverse",
|
|
7364
|
+
f.set(Ne("reverse", R), L);
|
|
7408
7365
|
}, O = (E) => {
|
|
7409
|
-
var
|
|
7410
|
-
const
|
|
7366
|
+
var R, U;
|
|
7367
|
+
const j = n.subscribeQuery({
|
|
7411
7368
|
[a]: {
|
|
7412
7369
|
...i,
|
|
7413
7370
|
$: {
|
|
7414
7371
|
limit: o,
|
|
7415
7372
|
after: E,
|
|
7416
|
-
where: (
|
|
7417
|
-
fields: (
|
|
7373
|
+
where: (R = i.$) == null ? void 0 : R.where,
|
|
7374
|
+
fields: (U = i.$) == null ? void 0 : U.fields,
|
|
7418
7375
|
order: Or(c)
|
|
7419
7376
|
}
|
|
7420
7377
|
}
|
|
7421
|
-
}, (
|
|
7422
|
-
if (
|
|
7423
|
-
return
|
|
7424
|
-
const A =
|
|
7378
|
+
}, (L) => {
|
|
7379
|
+
if (L.error)
|
|
7380
|
+
return m(L.error);
|
|
7381
|
+
const A = L.data[a], k = L.pageInfo[a];
|
|
7425
7382
|
Ze(A && k, "Expected rows and pageInfo"), T(E, {
|
|
7426
7383
|
data: A,
|
|
7427
7384
|
status: "bootstrapping",
|
|
@@ -7429,48 +7386,48 @@ const Cc = (n) => JSON.stringify(n), rt = (n, e = !1) => JSON.stringify([n, e]),
|
|
|
7429
7386
|
endCursor: k.endCursor
|
|
7430
7387
|
});
|
|
7431
7388
|
}, r);
|
|
7432
|
-
f.set(Ne("reverse", E),
|
|
7433
|
-
},
|
|
7434
|
-
var
|
|
7435
|
-
const
|
|
7389
|
+
f.set(Ne("reverse", E), j);
|
|
7390
|
+
}, F = (E, j = !1) => {
|
|
7391
|
+
var U, L;
|
|
7392
|
+
const R = n.subscribeQuery({
|
|
7436
7393
|
[a]: {
|
|
7437
7394
|
...i,
|
|
7438
7395
|
$: {
|
|
7439
7396
|
limit: o,
|
|
7440
7397
|
after: E,
|
|
7441
|
-
afterInclusive:
|
|
7442
|
-
where: (
|
|
7443
|
-
fields: (
|
|
7398
|
+
afterInclusive: j,
|
|
7399
|
+
where: (U = i.$) == null ? void 0 : U.where,
|
|
7400
|
+
fields: (L = i.$) == null ? void 0 : L.fields,
|
|
7444
7401
|
order: c
|
|
7445
7402
|
}
|
|
7446
7403
|
}
|
|
7447
7404
|
}, (A) => {
|
|
7448
7405
|
if (A.error)
|
|
7449
|
-
return
|
|
7406
|
+
return m(A.error);
|
|
7450
7407
|
const k = A.data[a], K = A.pageInfo[a];
|
|
7451
|
-
Ze(k && K, "Page info and rows"),
|
|
7408
|
+
Ze(k && K, "Page info and rows"), _(E, {
|
|
7452
7409
|
data: k,
|
|
7453
7410
|
status: "bootstrapping",
|
|
7454
7411
|
hasMore: K.hasNextPage,
|
|
7455
7412
|
endCursor: K.endCursor,
|
|
7456
|
-
afterInclusive:
|
|
7413
|
+
afterInclusive: j
|
|
7457
7414
|
});
|
|
7458
7415
|
}, r);
|
|
7459
|
-
f.set(Ne("forward", E,
|
|
7460
|
-
},
|
|
7416
|
+
f.set(Ne("forward", E, j), R);
|
|
7417
|
+
}, P = (E, j = !1) => {
|
|
7461
7418
|
var k, K;
|
|
7462
|
-
const
|
|
7463
|
-
|
|
7464
|
-
const
|
|
7465
|
-
if (!(
|
|
7419
|
+
const R = rt(E, j), U = f.get(Ne("forward", E, j));
|
|
7420
|
+
U == null || U();
|
|
7421
|
+
const L = u.get(R);
|
|
7422
|
+
if (!(L != null && L.endCursor))
|
|
7466
7423
|
return;
|
|
7467
7424
|
const A = n.subscribeQuery({
|
|
7468
7425
|
[a]: {
|
|
7469
7426
|
...i,
|
|
7470
7427
|
$: {
|
|
7471
7428
|
after: E,
|
|
7472
|
-
afterInclusive:
|
|
7473
|
-
before:
|
|
7429
|
+
afterInclusive: L.afterInclusive,
|
|
7430
|
+
before: L.endCursor,
|
|
7474
7431
|
beforeInclusive: !0,
|
|
7475
7432
|
where: (k = i.$) == null ? void 0 : k.where,
|
|
7476
7433
|
fields: (K = i.$) == null ? void 0 : K.fields,
|
|
@@ -7479,35 +7436,35 @@ const Cc = (n) => JSON.stringify(n), rt = (n, e = !1) => JSON.stringify([n, e]),
|
|
|
7479
7436
|
}
|
|
7480
7437
|
}, (H) => {
|
|
7481
7438
|
if (H.error)
|
|
7482
|
-
return
|
|
7439
|
+
return m(H.error);
|
|
7483
7440
|
const Y = H.data[a], oe = H.pageInfo[a];
|
|
7484
|
-
Ze(Y && oe, "Expected rows and pageInfo"),
|
|
7441
|
+
Ze(Y && oe, "Expected rows and pageInfo"), _(E, {
|
|
7485
7442
|
data: Y,
|
|
7486
7443
|
status: "frozen",
|
|
7487
7444
|
hasMore: oe.hasNextPage,
|
|
7488
7445
|
endCursor: oe.endCursor,
|
|
7489
|
-
afterInclusive:
|
|
7446
|
+
afterInclusive: L.afterInclusive
|
|
7490
7447
|
});
|
|
7491
7448
|
}, r);
|
|
7492
|
-
f.set(Ne("forward", E,
|
|
7493
|
-
},
|
|
7449
|
+
f.set(Ne("forward", E, j), A);
|
|
7450
|
+
}, C = () => {
|
|
7494
7451
|
const E = Array.from(l.entries()).at(-1);
|
|
7495
7452
|
if (!E)
|
|
7496
7453
|
return;
|
|
7497
|
-
const [
|
|
7498
|
-
if (!(
|
|
7454
|
+
const [j, R] = E;
|
|
7455
|
+
if (!(R != null && R.hasMore) || !Ic(R))
|
|
7499
7456
|
return;
|
|
7500
|
-
const
|
|
7501
|
-
|
|
7457
|
+
const U = `${j}:${Cc(R.endCursor)}`;
|
|
7458
|
+
U != b && (b = U, M(j, R), O(R.endCursor));
|
|
7502
7459
|
}, G = () => {
|
|
7503
7460
|
const E = Array.from(u.entries()).at(-1);
|
|
7504
7461
|
if (!E)
|
|
7505
7462
|
return;
|
|
7506
|
-
const [
|
|
7507
|
-
if (!
|
|
7463
|
+
const [j, R] = E;
|
|
7464
|
+
if (!R.endCursor)
|
|
7508
7465
|
return;
|
|
7509
|
-
const { cursor:
|
|
7510
|
-
|
|
7466
|
+
const { cursor: U, afterInclusive: L } = Ar(j);
|
|
7467
|
+
P(U, L), F(R.endCursor);
|
|
7511
7468
|
};
|
|
7512
7469
|
return g = n.subscribeQuery({
|
|
7513
7470
|
[a]: {
|
|
@@ -7520,32 +7477,32 @@ const Cc = (n) => JSON.stringify(n), rt = (n, e = !1) => JSON.stringify([n, e]),
|
|
|
7520
7477
|
}
|
|
7521
7478
|
}
|
|
7522
7479
|
}, async (E) => {
|
|
7523
|
-
var
|
|
7480
|
+
var L;
|
|
7524
7481
|
if (h)
|
|
7525
7482
|
return;
|
|
7526
7483
|
if (E.error)
|
|
7527
|
-
return
|
|
7528
|
-
const
|
|
7529
|
-
if (Ze(
|
|
7530
|
-
|
|
7531
|
-
data:
|
|
7484
|
+
return m(E.error);
|
|
7485
|
+
const j = E.pageInfo[a], R = (L = E == null ? void 0 : E.data) == null ? void 0 : L[a];
|
|
7486
|
+
if (Ze(R && j, "Expected rows and pageInfo"), R.length < o) {
|
|
7487
|
+
_(Gt, {
|
|
7488
|
+
data: R,
|
|
7532
7489
|
status: "pre-bootstrap"
|
|
7533
7490
|
});
|
|
7534
7491
|
return;
|
|
7535
7492
|
}
|
|
7536
|
-
const
|
|
7537
|
-
if (!
|
|
7538
|
-
|
|
7539
|
-
data:
|
|
7493
|
+
const U = j.startCursor;
|
|
7494
|
+
if (!U) {
|
|
7495
|
+
_(Gt, {
|
|
7496
|
+
data: R,
|
|
7540
7497
|
status: "pre-bootstrap"
|
|
7541
7498
|
});
|
|
7542
7499
|
return;
|
|
7543
7500
|
}
|
|
7544
|
-
u.delete(rt(Gt)),
|
|
7501
|
+
u.delete(rt(Gt)), F(U, !0), O(j.startCursor), h = !0;
|
|
7545
7502
|
}, r), {
|
|
7546
7503
|
unsubscribe: () => {
|
|
7547
|
-
if (
|
|
7548
|
-
|
|
7504
|
+
if (y) {
|
|
7505
|
+
y = !1, g == null || g(), g = null;
|
|
7549
7506
|
for (const E of f.values())
|
|
7550
7507
|
E == null || E();
|
|
7551
7508
|
f.clear();
|
|
@@ -7561,8 +7518,8 @@ const Cc = (n) => JSON.stringify(n), rt = (n, e = !1) => JSON.stringify([n, e]),
|
|
|
7561
7518
|
data: void 0,
|
|
7562
7519
|
error: void 0
|
|
7563
7520
|
};
|
|
7564
|
-
const { entityName: r, entityQuery: s } =
|
|
7565
|
-
let a = e ?
|
|
7521
|
+
const { entityName: r, entityQuery: s } = Ts(e), i = ((u = s.$) == null ? void 0 : u.limit) || 10, o = ws((l = s.$) == null ? void 0 : l.order);
|
|
7522
|
+
let a = e ? Ss({
|
|
7566
7523
|
[r]: {
|
|
7567
7524
|
...s,
|
|
7568
7525
|
$: {
|
|
@@ -7583,7 +7540,7 @@ const Cc = (n) => JSON.stringify(n), rt = (n, e = !1) => JSON.stringify([n, e]),
|
|
|
7583
7540
|
data: (c == null ? void 0 : c.data) || void 0,
|
|
7584
7541
|
error: void 0
|
|
7585
7542
|
};
|
|
7586
|
-
},
|
|
7543
|
+
}, Ts = (n) => {
|
|
7587
7544
|
if (Object.keys(n).length !== 1)
|
|
7588
7545
|
throw new Q("subscribeInfiniteQuery expects exactly one entity");
|
|
7589
7546
|
const [t, r] = Object.entries(n)[0];
|
|
@@ -7806,7 +7763,7 @@ class Lc {
|
|
|
7806
7763
|
this.db = e;
|
|
7807
7764
|
}
|
|
7808
7765
|
}
|
|
7809
|
-
function
|
|
7766
|
+
function Ss(n) {
|
|
7810
7767
|
return JSON.parse(JSON.stringify(n));
|
|
7811
7768
|
}
|
|
7812
7769
|
class Fc {
|
|
@@ -7894,7 +7851,7 @@ class Fc {
|
|
|
7894
7851
|
* });
|
|
7895
7852
|
*/
|
|
7896
7853
|
subscribeInfiniteQuery(e, t, r) {
|
|
7897
|
-
return
|
|
7854
|
+
return Rc(this, e, t, r);
|
|
7898
7855
|
}
|
|
7899
7856
|
/**
|
|
7900
7857
|
* Listen for the logged in state. This is useful
|
|
@@ -7950,20 +7907,6 @@ class Fc {
|
|
|
7950
7907
|
subscribeConnectionStatus(e) {
|
|
7951
7908
|
return this._reactor.subscribeConnectionStatus(e);
|
|
7952
7909
|
}
|
|
7953
|
-
/**
|
|
7954
|
-
* Observe the app's maintenance-mode state. While read-only, reads and
|
|
7955
|
-
* live queries keep working but writes are rejected. The callback fires
|
|
7956
|
-
* immediately with the current state and again on every change.
|
|
7957
|
-
*
|
|
7958
|
-
* @example
|
|
7959
|
-
* const unsub = db.subscribeAppStatus(({ isLoading, isReadOnly }) => {
|
|
7960
|
-
* if (isLoading) return;
|
|
7961
|
-
* if (isReadOnly) showMaintenanceBanner();
|
|
7962
|
-
* });
|
|
7963
|
-
*/
|
|
7964
|
-
subscribeAppStatus(e) {
|
|
7965
|
-
return this._reactor.subscribeAppStatus(e);
|
|
7966
|
-
}
|
|
7967
7910
|
/**
|
|
7968
7911
|
* Join a room to publish and subscribe to topics and presence.
|
|
7969
7912
|
*
|
|
@@ -8032,7 +7975,7 @@ function Cr(n) {
|
|
|
8032
7975
|
const e = kr.get(n);
|
|
8033
7976
|
if (e)
|
|
8034
7977
|
return e;
|
|
8035
|
-
const t =
|
|
7978
|
+
const t = se(n);
|
|
8036
7979
|
return kr.set(n, t), t;
|
|
8037
7980
|
}
|
|
8038
7981
|
function Nc(n, e) {
|
|
@@ -8062,7 +8005,7 @@ function qc(n, e) {
|
|
|
8062
8005
|
allowedHosts: ["localhost"],
|
|
8063
8006
|
...typeof e == "object" ? e : {}
|
|
8064
8007
|
};
|
|
8065
|
-
t.allowedHosts.includes(window.location.hostname) &&
|
|
8008
|
+
t.allowedHosts.includes(window.location.hostname) && Tc(n, t);
|
|
8066
8009
|
}
|
|
8067
8010
|
const Ir = {
|
|
8068
8011
|
isLoading: !0,
|
|
@@ -8081,9 +8024,9 @@ function Pr(n) {
|
|
|
8081
8024
|
}
|
|
8082
8025
|
function Wc(n, e, t, r) {
|
|
8083
8026
|
e && t && "ruleParams" in t && (e = { $$ruleParams: t.ruleParams, ...e });
|
|
8084
|
-
const s = e ?
|
|
8027
|
+
const s = e ? Ss(e) : null, i = se(s), o = ke(
|
|
8085
8028
|
Pr(n._reactor.getPreviousResult(s))
|
|
8086
|
-
), a =
|
|
8029
|
+
), a = ke(Ir), c = Ae(
|
|
8087
8030
|
(l) => (o.current = Pr(
|
|
8088
8031
|
n._reactor.getPreviousResult(s)
|
|
8089
8032
|
), l(), s ? n.subscribeQuery(s, (h) => {
|
|
@@ -8102,7 +8045,7 @@ function Wc(n, e, t, r) {
|
|
|
8102
8045
|
// Build a new subscribe function if the query changes
|
|
8103
8046
|
[i]
|
|
8104
8047
|
);
|
|
8105
|
-
return { state:
|
|
8048
|
+
return { state: At(
|
|
8106
8049
|
c,
|
|
8107
8050
|
() => o.current,
|
|
8108
8051
|
() => {
|
|
@@ -8125,10 +8068,10 @@ function Vc({
|
|
|
8125
8068
|
query: e,
|
|
8126
8069
|
opts: t
|
|
8127
8070
|
}) {
|
|
8128
|
-
const r =
|
|
8071
|
+
const r = ke(null), s = se(e), i = se(t), o = Er(n, e, t), a = ke({
|
|
8129
8072
|
...o,
|
|
8130
8073
|
isLoading: !o.data && !o.error
|
|
8131
|
-
}), c =
|
|
8074
|
+
}), c = Ae(
|
|
8132
8075
|
(f) => {
|
|
8133
8076
|
r.current = null;
|
|
8134
8077
|
const h = Er(n, e, t);
|
|
@@ -8138,24 +8081,24 @@ function Vc({
|
|
|
8138
8081
|
}, f(), !e)
|
|
8139
8082
|
return () => {
|
|
8140
8083
|
};
|
|
8141
|
-
const
|
|
8084
|
+
const y = n.subscribeInfiniteQuery(
|
|
8142
8085
|
e,
|
|
8143
|
-
(
|
|
8086
|
+
(b) => {
|
|
8144
8087
|
a.current = {
|
|
8145
|
-
...
|
|
8088
|
+
...b,
|
|
8146
8089
|
isLoading: !1
|
|
8147
8090
|
}, f();
|
|
8148
8091
|
},
|
|
8149
8092
|
t
|
|
8150
8093
|
);
|
|
8151
|
-
return r.current =
|
|
8152
|
-
|
|
8094
|
+
return r.current = y, () => {
|
|
8095
|
+
y.unsubscribe(), r.current === y && (r.current = null);
|
|
8153
8096
|
};
|
|
8154
8097
|
},
|
|
8155
8098
|
[s, i]
|
|
8156
8099
|
);
|
|
8157
8100
|
return {
|
|
8158
|
-
...
|
|
8101
|
+
...At(
|
|
8159
8102
|
c,
|
|
8160
8103
|
() => a.current,
|
|
8161
8104
|
() => zc
|
|
@@ -8167,7 +8110,7 @@ function Vc({
|
|
|
8167
8110
|
};
|
|
8168
8111
|
}
|
|
8169
8112
|
function Qc() {
|
|
8170
|
-
const n =
|
|
8113
|
+
const n = ke(null);
|
|
8171
8114
|
je(() => {
|
|
8172
8115
|
t();
|
|
8173
8116
|
}, []);
|
|
@@ -8181,7 +8124,7 @@ function Qc() {
|
|
|
8181
8124
|
}
|
|
8182
8125
|
const Bc = 1e3;
|
|
8183
8126
|
function Gc(n, e, t) {
|
|
8184
|
-
const r =
|
|
8127
|
+
const r = ke(t);
|
|
8185
8128
|
r.current = t, je(() => n.core._reactor.subscribeTopic(
|
|
8186
8129
|
n.type,
|
|
8187
8130
|
n.id,
|
|
@@ -8192,7 +8135,7 @@ function Gc(n, e, t) {
|
|
|
8192
8135
|
), [n.id, e]);
|
|
8193
8136
|
}
|
|
8194
8137
|
function Hc(n, e) {
|
|
8195
|
-
return je(() => n.core._reactor.joinRoom(n.type, n.id), [n.id]),
|
|
8138
|
+
return je(() => n.core._reactor.joinRoom(n.type, n.id), [n.id]), Ae(
|
|
8196
8139
|
(r) => {
|
|
8197
8140
|
n.core._reactor.publishTopic({
|
|
8198
8141
|
roomType: n.type,
|
|
@@ -8206,7 +8149,7 @@ function Hc(n, e) {
|
|
|
8206
8149
|
}
|
|
8207
8150
|
function Jc(n, e = {}) {
|
|
8208
8151
|
var o, a;
|
|
8209
|
-
const [t, r] =
|
|
8152
|
+
const [t, r] = Rr(() => n.core._reactor.getPresence(n.type, n.id, e) ?? {
|
|
8210
8153
|
peers: {},
|
|
8211
8154
|
isLoading: !0
|
|
8212
8155
|
});
|
|
@@ -8218,7 +8161,7 @@ function Jc(n, e = {}) {
|
|
|
8218
8161
|
r(u);
|
|
8219
8162
|
}
|
|
8220
8163
|
), [n.id, e.user, (o = e.peers) == null ? void 0 : o.join(), (a = e.keys) == null ? void 0 : a.join()]);
|
|
8221
|
-
const s =
|
|
8164
|
+
const s = Ae(
|
|
8222
8165
|
(c) => {
|
|
8223
8166
|
n.core._reactor.publishPresence(n.type, n.id, c);
|
|
8224
8167
|
},
|
|
@@ -8246,7 +8189,7 @@ function Zc(n, e, t = {}) {
|
|
|
8246
8189
|
return t != null && t.writeOnly ? [] : Object.values((l == null ? void 0 : l.peers) ?? {}).filter(
|
|
8247
8190
|
(f) => f[e] === !0
|
|
8248
8191
|
);
|
|
8249
|
-
}, [t == null ? void 0 : t.writeOnly, s]), o =
|
|
8192
|
+
}, [t == null ? void 0 : t.writeOnly, s]), o = Ae(
|
|
8250
8193
|
(l) => {
|
|
8251
8194
|
n.core._reactor.publishPresence(n.type, n.id, {
|
|
8252
8195
|
[e]: l
|
|
@@ -8257,13 +8200,13 @@ function Zc(n, e, t = {}) {
|
|
|
8257
8200
|
}));
|
|
8258
8201
|
},
|
|
8259
8202
|
[n.type, n.id, e, t == null ? void 0 : t.timeout, r]
|
|
8260
|
-
), a =
|
|
8203
|
+
), a = Ae(
|
|
8261
8204
|
(l) => {
|
|
8262
8205
|
const h = !((t == null ? void 0 : t.stopOnEnter) && l.key === "Enter");
|
|
8263
8206
|
o(h);
|
|
8264
8207
|
},
|
|
8265
8208
|
[t.stopOnEnter, o]
|
|
8266
|
-
), c =
|
|
8209
|
+
), c = Ae(() => {
|
|
8267
8210
|
o(!1);
|
|
8268
8211
|
}, [o]), u = Jt(() => ({ onKeyDown: a, onBlur: c }), [a, c]);
|
|
8269
8212
|
return {
|
|
@@ -8370,9 +8313,6 @@ const eu = {
|
|
|
8370
8313
|
isLoading: !0,
|
|
8371
8314
|
user: void 0,
|
|
8372
8315
|
error: void 0
|
|
8373
|
-
}, tu = {
|
|
8374
|
-
isLoading: !0,
|
|
8375
|
-
isReadOnly: void 0
|
|
8376
8316
|
};
|
|
8377
8317
|
class Ht {
|
|
8378
8318
|
constructor(e, t) {
|
|
@@ -8405,7 +8345,7 @@ class Ht {
|
|
|
8405
8345
|
* console.log('Device ID:', deviceId)
|
|
8406
8346
|
*/
|
|
8407
8347
|
p(this, "useLocalId", (e) => {
|
|
8408
|
-
const [t, r] =
|
|
8348
|
+
const [t, r] = Rr(null);
|
|
8409
8349
|
return je(() => {
|
|
8410
8350
|
(async () => {
|
|
8411
8351
|
const i = await this.getLocalId(e);
|
|
@@ -8520,7 +8460,7 @@ class Ht {
|
|
|
8520
8460
|
p(this, "useUser", () => {
|
|
8521
8461
|
const { user: e } = this.useAuth();
|
|
8522
8462
|
if (!e)
|
|
8523
|
-
throw new
|
|
8463
|
+
throw new ie(
|
|
8524
8464
|
"useUser must be used within an auth-protected route"
|
|
8525
8465
|
);
|
|
8526
8466
|
return e;
|
|
@@ -8548,40 +8488,18 @@ class Ht {
|
|
|
8548
8488
|
* }
|
|
8549
8489
|
*/
|
|
8550
8490
|
p(this, "useConnectionStatus", () => {
|
|
8551
|
-
const e =
|
|
8491
|
+
const e = ke(
|
|
8552
8492
|
this.core._reactor.status
|
|
8553
|
-
), t =
|
|
8493
|
+
), t = Ae((s) => this.core.subscribeConnectionStatus((o) => {
|
|
8554
8494
|
o !== e.current && (e.current = o, s());
|
|
8555
8495
|
}), []);
|
|
8556
|
-
return
|
|
8496
|
+
return At(
|
|
8557
8497
|
t,
|
|
8558
8498
|
() => e.current,
|
|
8559
8499
|
// For SSR, always return 'connecting' as the initial state
|
|
8560
8500
|
() => "connecting"
|
|
8561
8501
|
);
|
|
8562
8502
|
});
|
|
8563
|
-
/**
|
|
8564
|
-
* Observe the app's maintenance-mode state. While read-only, reads and
|
|
8565
|
-
* live queries keep working but writes are rejected.
|
|
8566
|
-
*
|
|
8567
|
-
* @example
|
|
8568
|
-
* function App() {
|
|
8569
|
-
* const { isLoading, isReadOnly } = db.useAppStatus()
|
|
8570
|
-
* if (isLoading) return null
|
|
8571
|
-
* if (isReadOnly) return <MaintenanceBanner />
|
|
8572
|
-
* // ...
|
|
8573
|
-
* }
|
|
8574
|
-
*/
|
|
8575
|
-
p(this, "useAppStatus", () => {
|
|
8576
|
-
const e = Oe(this.core._reactor._appStatusState), t = Te((s) => this.core.subscribeAppStatus((i) => {
|
|
8577
|
-
(i.isLoading !== e.current.isLoading || i.isReadOnly !== e.current.isReadOnly) && (e.current = i, s());
|
|
8578
|
-
}), []);
|
|
8579
|
-
return st(
|
|
8580
|
-
t,
|
|
8581
|
-
() => e.current,
|
|
8582
|
-
() => tu
|
|
8583
|
-
);
|
|
8584
|
-
});
|
|
8585
8503
|
/**
|
|
8586
8504
|
* Use this for one-off queries.
|
|
8587
8505
|
* Returns local data if available, otherwise fetches from the server.
|
|
@@ -8636,7 +8554,7 @@ class Ht {
|
|
|
8636
8554
|
*/
|
|
8637
8555
|
p(this, "SignedIn", ({ children: e }) => {
|
|
8638
8556
|
const t = this.useAuth();
|
|
8639
|
-
return t.isLoading || t.error || !t.user ? null : /* @__PURE__ */
|
|
8557
|
+
return t.isLoading || t.error || !t.user ? null : /* @__PURE__ */ ht.jsx(ht.Fragment, { children: e });
|
|
8640
8558
|
});
|
|
8641
8559
|
/**
|
|
8642
8560
|
* Only render children if the user is signed out.
|
|
@@ -8650,7 +8568,7 @@ class Ht {
|
|
|
8650
8568
|
*/
|
|
8651
8569
|
p(this, "SignedOut", ({ children: e }) => {
|
|
8652
8570
|
const t = this.useAuth();
|
|
8653
|
-
return t.isLoading || t.error || t.user ? null : /* @__PURE__ */
|
|
8571
|
+
return t.isLoading || t.error || t.user ? null : /* @__PURE__ */ ht.jsx(ht.Fragment, { children: e });
|
|
8654
8572
|
});
|
|
8655
8573
|
this.core = Kc(
|
|
8656
8574
|
e,
|
|
@@ -8679,12 +8597,12 @@ class Ht {
|
|
|
8679
8597
|
return new Xc(this.core, e, t);
|
|
8680
8598
|
}
|
|
8681
8599
|
_useAuth() {
|
|
8682
|
-
const e =
|
|
8600
|
+
const e = ke(
|
|
8683
8601
|
this.core._reactor._currentUserCached
|
|
8684
|
-
), t =
|
|
8602
|
+
), t = Ae((s) => this.core.subscribeAuth((o) => {
|
|
8685
8603
|
e.current = { isLoading: !1, ...o }, s();
|
|
8686
8604
|
}), []);
|
|
8687
|
-
return
|
|
8605
|
+
return At(
|
|
8688
8606
|
t,
|
|
8689
8607
|
() => e.current,
|
|
8690
8608
|
() => eu
|