@instantdb/react-common 1.0.3-branch-idb-fix.24363677444.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/standalone/index.js +1002 -970
- package/dist/standalone/index.umd.cjs +11 -11
- package/package.json +3 -3
package/dist/standalone/index.js
CHANGED
|
@@ -41,54 +41,54 @@ function Bs() {
|
|
|
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 = kr, 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"),
|
|
44
|
+
var e = kr, 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, w = "@@iterator";
|
|
45
45
|
function S(d) {
|
|
46
46
|
if (d === null || typeof d != "object")
|
|
47
47
|
return null;
|
|
48
|
-
var
|
|
49
|
-
return typeof
|
|
48
|
+
var m = g && d[g] || d[w];
|
|
49
|
+
return typeof m == "function" ? m : null;
|
|
50
50
|
}
|
|
51
|
-
var
|
|
52
|
-
function
|
|
51
|
+
var _ = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
52
|
+
function T(d) {
|
|
53
53
|
{
|
|
54
|
-
for (var
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
for (var m = arguments.length, v = new Array(m > 1 ? m - 1 : 0), I = 1; I < m; I++)
|
|
55
|
+
v[I - 1] = arguments[I];
|
|
56
|
+
R("error", d, v);
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function R(d, m, v) {
|
|
60
60
|
{
|
|
61
|
-
var
|
|
62
|
-
|
|
63
|
-
var
|
|
61
|
+
var I = _.ReactDebugCurrentFrame, W = I.getStackAddendum();
|
|
62
|
+
W !== "" && (m += "%s", v = v.concat([W]));
|
|
63
|
+
var V = v.map(function(D) {
|
|
64
64
|
return String(D);
|
|
65
65
|
});
|
|
66
|
-
|
|
66
|
+
V.unshift("Warning: " + m), Function.prototype.apply.call(console[d], console, V);
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
-
var
|
|
70
|
-
|
|
71
|
-
function
|
|
72
|
-
return !!(typeof d == "string" || typeof d == "function" || d === s || d === o ||
|
|
69
|
+
var O = !1, F = !1, P = !1, C = !1, G = !1, N;
|
|
70
|
+
N = Symbol.for("react.module.reference");
|
|
71
|
+
function B(d) {
|
|
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
|
-
function
|
|
79
|
-
var
|
|
80
|
-
if (
|
|
81
|
-
return
|
|
82
|
-
var
|
|
83
|
-
return
|
|
78
|
+
function z(d, m, v) {
|
|
79
|
+
var I = d.displayName;
|
|
80
|
+
if (I)
|
|
81
|
+
return I;
|
|
82
|
+
var W = m.displayName || m.name || "";
|
|
83
|
+
return W !== "" ? v + "(" + W + ")" : v;
|
|
84
84
|
}
|
|
85
|
-
function
|
|
85
|
+
function ee(d) {
|
|
86
86
|
return d.displayName || "Context";
|
|
87
87
|
}
|
|
88
|
-
function
|
|
88
|
+
function q(d) {
|
|
89
89
|
if (d == null)
|
|
90
90
|
return null;
|
|
91
|
-
if (typeof d.tag == "number" &&
|
|
91
|
+
if (typeof d.tag == "number" && T("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof d == "function")
|
|
92
92
|
return d.displayName || d.name || null;
|
|
93
93
|
if (typeof d == "string")
|
|
94
94
|
return d;
|
|
@@ -109,20 +109,20 @@ function Bs() {
|
|
|
109
109
|
if (typeof d == "object")
|
|
110
110
|
switch (d.$$typeof) {
|
|
111
111
|
case c:
|
|
112
|
-
var
|
|
113
|
-
return
|
|
112
|
+
var m = d;
|
|
113
|
+
return ee(m) + ".Consumer";
|
|
114
114
|
case a:
|
|
115
|
-
var
|
|
116
|
-
return
|
|
115
|
+
var v = d;
|
|
116
|
+
return ee(v._context) + ".Provider";
|
|
117
117
|
case u:
|
|
118
|
-
return
|
|
118
|
+
return z(d, d.render, "ForwardRef");
|
|
119
119
|
case h:
|
|
120
|
-
var
|
|
121
|
-
return
|
|
120
|
+
var I = d.displayName || null;
|
|
121
|
+
return I !== null ? I : q(d.type) || "Memo";
|
|
122
122
|
case y: {
|
|
123
|
-
var
|
|
123
|
+
var W = d, V = W._payload, D = W._init;
|
|
124
124
|
try {
|
|
125
|
-
return
|
|
125
|
+
return q(D(V));
|
|
126
126
|
} catch {
|
|
127
127
|
return null;
|
|
128
128
|
}
|
|
@@ -130,18 +130,18 @@ function Bs() {
|
|
|
130
130
|
}
|
|
131
131
|
return null;
|
|
132
132
|
}
|
|
133
|
-
var E = Object.assign,
|
|
134
|
-
function
|
|
133
|
+
var E = Object.assign, j = 0, M, U, L, A, k, K, H;
|
|
134
|
+
function Y() {
|
|
135
135
|
}
|
|
136
|
-
|
|
137
|
-
function
|
|
136
|
+
Y.__reactDisabledLog = !0;
|
|
137
|
+
function oe() {
|
|
138
138
|
{
|
|
139
|
-
if (
|
|
140
|
-
M = console.log,
|
|
139
|
+
if (j === 0) {
|
|
140
|
+
M = 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,
|
|
144
|
-
value:
|
|
144
|
+
value: Y,
|
|
145
145
|
writable: !0
|
|
146
146
|
};
|
|
147
147
|
Object.defineProperties(console, {
|
|
@@ -154,12 +154,12 @@ function Bs() {
|
|
|
154
154
|
groupEnd: d
|
|
155
155
|
});
|
|
156
156
|
}
|
|
157
|
-
|
|
157
|
+
j++;
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
160
|
function Be() {
|
|
161
161
|
{
|
|
162
|
-
if (
|
|
162
|
+
if (j--, j === 0) {
|
|
163
163
|
var d = {
|
|
164
164
|
configurable: !0,
|
|
165
165
|
enumerable: !0,
|
|
@@ -170,37 +170,37 @@ function Bs() {
|
|
|
170
170
|
value: M
|
|
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
|
-
value:
|
|
179
|
+
value: A
|
|
180
180
|
}),
|
|
181
181
|
group: E({}, d, {
|
|
182
182
|
value: k
|
|
183
183
|
}),
|
|
184
184
|
groupCollapsed: E({}, d, {
|
|
185
|
-
value:
|
|
185
|
+
value: K
|
|
186
186
|
}),
|
|
187
187
|
groupEnd: E({}, d, {
|
|
188
|
-
value:
|
|
188
|
+
value: H
|
|
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
|
|
196
|
-
function ct(d,
|
|
195
|
+
var ge = _.ReactCurrentDispatcher, Rt;
|
|
196
|
+
function ct(d, m, v) {
|
|
197
197
|
{
|
|
198
198
|
if (Rt === void 0)
|
|
199
199
|
try {
|
|
200
200
|
throw Error();
|
|
201
|
-
} catch (
|
|
202
|
-
var
|
|
203
|
-
Rt =
|
|
201
|
+
} catch (W) {
|
|
202
|
+
var I = W.stack.trim().match(/\n( *(at )?)/);
|
|
203
|
+
Rt = I && I[1] || "";
|
|
204
204
|
}
|
|
205
205
|
return `
|
|
206
206
|
` + Rt + d;
|
|
@@ -211,22 +211,22 @@ function Bs() {
|
|
|
211
211
|
var ms = typeof WeakMap == "function" ? WeakMap : Map;
|
|
212
212
|
ut = new ms();
|
|
213
213
|
}
|
|
214
|
-
function kn(d,
|
|
214
|
+
function kn(d, m) {
|
|
215
215
|
if (!d || Mt)
|
|
216
216
|
return "";
|
|
217
217
|
{
|
|
218
|
-
var
|
|
219
|
-
if (
|
|
220
|
-
return
|
|
218
|
+
var v = ut.get(d);
|
|
219
|
+
if (v !== void 0)
|
|
220
|
+
return v;
|
|
221
221
|
}
|
|
222
|
-
var
|
|
222
|
+
var I;
|
|
223
223
|
Mt = !0;
|
|
224
|
-
var
|
|
224
|
+
var W = Error.prepareStackTrace;
|
|
225
225
|
Error.prepareStackTrace = void 0;
|
|
226
|
-
var
|
|
227
|
-
|
|
226
|
+
var V;
|
|
227
|
+
V = ge.current, ge.current = null, oe();
|
|
228
228
|
try {
|
|
229
|
-
if (
|
|
229
|
+
if (m) {
|
|
230
230
|
var D = function() {
|
|
231
231
|
throw Error();
|
|
232
232
|
};
|
|
@@ -237,59 +237,59 @@ function Bs() {
|
|
|
237
237
|
}), typeof Reflect == "object" && Reflect.construct) {
|
|
238
238
|
try {
|
|
239
239
|
Reflect.construct(D, []);
|
|
240
|
-
} catch (
|
|
241
|
-
|
|
240
|
+
} catch (ue) {
|
|
241
|
+
I = ue;
|
|
242
242
|
}
|
|
243
243
|
Reflect.construct(d, [], D);
|
|
244
244
|
} else {
|
|
245
245
|
try {
|
|
246
246
|
D.call();
|
|
247
|
-
} catch (
|
|
248
|
-
|
|
247
|
+
} catch (ue) {
|
|
248
|
+
I = ue;
|
|
249
249
|
}
|
|
250
250
|
d.call(D.prototype);
|
|
251
251
|
}
|
|
252
252
|
} else {
|
|
253
253
|
try {
|
|
254
254
|
throw Error();
|
|
255
|
-
} catch (
|
|
256
|
-
|
|
255
|
+
} catch (ue) {
|
|
256
|
+
I = ue;
|
|
257
257
|
}
|
|
258
258
|
d();
|
|
259
259
|
}
|
|
260
|
-
} catch (
|
|
261
|
-
if (
|
|
262
|
-
for (var
|
|
263
|
-
`),
|
|
264
|
-
`),
|
|
265
|
-
|
|
266
|
-
for (;
|
|
267
|
-
if (
|
|
268
|
-
if (
|
|
260
|
+
} catch (ue) {
|
|
261
|
+
if (ue && I && typeof ue.stack == "string") {
|
|
262
|
+
for (var $ = ue.stack.split(`
|
|
263
|
+
`), ae = I.stack.split(`
|
|
264
|
+
`), Z = $.length - 1, te = ae.length - 1; Z >= 1 && te >= 0 && $[Z] !== ae[te]; )
|
|
265
|
+
te--;
|
|
266
|
+
for (; Z >= 1 && te >= 0; Z--, te--)
|
|
267
|
+
if ($[Z] !== ae[te]) {
|
|
268
|
+
if (Z !== 1 || te !== 1)
|
|
269
269
|
do
|
|
270
|
-
if (
|
|
271
|
-
var
|
|
272
|
-
` +
|
|
273
|
-
return d.displayName &&
|
|
270
|
+
if (Z--, te--, te < 0 || $[Z] !== ae[te]) {
|
|
271
|
+
var ye = `
|
|
272
|
+
` + $[Z].replace(" at new ", " at ");
|
|
273
|
+
return d.displayName && ye.includes("<anonymous>") && (ye = ye.replace("<anonymous>", d.displayName)), typeof d == "function" && ut.set(d, ye), ye;
|
|
274
274
|
}
|
|
275
|
-
while (
|
|
275
|
+
while (Z >= 1 && te >= 0);
|
|
276
276
|
break;
|
|
277
277
|
}
|
|
278
278
|
}
|
|
279
279
|
} finally {
|
|
280
|
-
Mt = !1,
|
|
280
|
+
Mt = !1, ge.current = V, Be(), Error.prepareStackTrace = W;
|
|
281
281
|
}
|
|
282
282
|
var Le = d ? d.displayName || d.name : "", Ce = Le ? ct(Le) : "";
|
|
283
283
|
return typeof d == "function" && ut.set(d, Ce), Ce;
|
|
284
284
|
}
|
|
285
|
-
function ws(d,
|
|
285
|
+
function ws(d, m, v) {
|
|
286
286
|
return kn(d, !1);
|
|
287
287
|
}
|
|
288
288
|
function Ts(d) {
|
|
289
|
-
var
|
|
290
|
-
return !!(
|
|
289
|
+
var m = d.prototype;
|
|
290
|
+
return !!(m && m.isReactComponent);
|
|
291
291
|
}
|
|
292
|
-
function lt(d,
|
|
292
|
+
function lt(d, m, v) {
|
|
293
293
|
if (d == null)
|
|
294
294
|
return "";
|
|
295
295
|
if (typeof d == "function")
|
|
@@ -307,41 +307,41 @@ function Bs() {
|
|
|
307
307
|
case u:
|
|
308
308
|
return ws(d.render);
|
|
309
309
|
case h:
|
|
310
|
-
return lt(d.type,
|
|
310
|
+
return lt(d.type, m, v);
|
|
311
311
|
case y: {
|
|
312
|
-
var
|
|
312
|
+
var I = d, W = I._payload, V = I._init;
|
|
313
313
|
try {
|
|
314
|
-
return lt(
|
|
314
|
+
return lt(V(W), m, v);
|
|
315
315
|
} catch {
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
318
|
}
|
|
319
319
|
return "";
|
|
320
320
|
}
|
|
321
|
-
var Ge = Object.prototype.hasOwnProperty, Cn = {}, In =
|
|
321
|
+
var Ge = Object.prototype.hasOwnProperty, Cn = {}, In = _.ReactDebugCurrentFrame;
|
|
322
322
|
function ft(d) {
|
|
323
323
|
if (d) {
|
|
324
|
-
var
|
|
325
|
-
In.setExtraStackFrame(
|
|
324
|
+
var m = d._owner, v = lt(d.type, d._source, m ? m.type : null);
|
|
325
|
+
In.setExtraStackFrame(v);
|
|
326
326
|
} else
|
|
327
327
|
In.setExtraStackFrame(null);
|
|
328
328
|
}
|
|
329
|
-
function Ss(d,
|
|
329
|
+
function Ss(d, m, v, I, W) {
|
|
330
330
|
{
|
|
331
|
-
var
|
|
331
|
+
var V = Function.call.bind(Ge);
|
|
332
332
|
for (var D in d)
|
|
333
|
-
if (
|
|
334
|
-
var
|
|
333
|
+
if (V(d, D)) {
|
|
334
|
+
var $ = void 0;
|
|
335
335
|
try {
|
|
336
336
|
if (typeof d[D] != "function") {
|
|
337
|
-
var
|
|
338
|
-
throw
|
|
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
|
+
throw ae.name = "Invariant Violation", ae;
|
|
339
339
|
}
|
|
340
|
-
|
|
341
|
-
} catch (
|
|
342
|
-
|
|
340
|
+
$ = d[D](m, D, I, v, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
341
|
+
} catch (Z) {
|
|
342
|
+
$ = Z;
|
|
343
343
|
}
|
|
344
|
-
|
|
344
|
+
$ && !($ instanceof Error) && (ft(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 $), ft(null)), $ instanceof Error && !($.message in Cn) && (Cn[$.message] = !0, ft(W), T("Failed %s type: %s", v, $.message), ft(null));
|
|
345
345
|
}
|
|
346
346
|
}
|
|
347
347
|
}
|
|
@@ -351,8 +351,8 @@ function Bs() {
|
|
|
351
351
|
}
|
|
352
352
|
function As(d) {
|
|
353
353
|
{
|
|
354
|
-
var
|
|
355
|
-
return
|
|
354
|
+
var m = typeof Symbol == "function" && Symbol.toStringTag, v = m && d[Symbol.toStringTag] || d.constructor.name || "Object";
|
|
355
|
+
return v;
|
|
356
356
|
}
|
|
357
357
|
}
|
|
358
358
|
function Os(d) {
|
|
@@ -367,9 +367,9 @@ function Bs() {
|
|
|
367
367
|
}
|
|
368
368
|
function Rn(d) {
|
|
369
369
|
if (Os(d))
|
|
370
|
-
return
|
|
370
|
+
return T("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", As(d)), Pn(d);
|
|
371
371
|
}
|
|
372
|
-
var Mn =
|
|
372
|
+
var Mn = _.ReactCurrentOwner, Es = {
|
|
373
373
|
key: !0,
|
|
374
374
|
ref: !0,
|
|
375
375
|
__self: !0,
|
|
@@ -377,97 +377,97 @@ function Bs() {
|
|
|
377
377
|
}, jn, $n;
|
|
378
378
|
function ks(d) {
|
|
379
379
|
if (Ge.call(d, "ref")) {
|
|
380
|
-
var
|
|
381
|
-
if (
|
|
380
|
+
var m = Object.getOwnPropertyDescriptor(d, "ref").get;
|
|
381
|
+
if (m && m.isReactWarning)
|
|
382
382
|
return !1;
|
|
383
383
|
}
|
|
384
384
|
return d.ref !== void 0;
|
|
385
385
|
}
|
|
386
386
|
function Cs(d) {
|
|
387
387
|
if (Ge.call(d, "key")) {
|
|
388
|
-
var
|
|
389
|
-
if (
|
|
388
|
+
var m = Object.getOwnPropertyDescriptor(d, "key").get;
|
|
389
|
+
if (m && m.isReactWarning)
|
|
390
390
|
return !1;
|
|
391
391
|
}
|
|
392
392
|
return d.key !== void 0;
|
|
393
393
|
}
|
|
394
|
-
function Is(d,
|
|
394
|
+
function Is(d, m) {
|
|
395
395
|
typeof d.ref == "string" && Mn.current;
|
|
396
396
|
}
|
|
397
|
-
function Ps(d,
|
|
397
|
+
function Ps(d, m) {
|
|
398
398
|
{
|
|
399
|
-
var
|
|
400
|
-
jn || (jn = !0,
|
|
399
|
+
var v = function() {
|
|
400
|
+
jn || (jn = !0, T("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", m));
|
|
401
401
|
};
|
|
402
|
-
|
|
403
|
-
get:
|
|
402
|
+
v.isReactWarning = !0, Object.defineProperty(d, "key", {
|
|
403
|
+
get: v,
|
|
404
404
|
configurable: !0
|
|
405
405
|
});
|
|
406
406
|
}
|
|
407
407
|
}
|
|
408
|
-
function Rs(d,
|
|
408
|
+
function Rs(d, m) {
|
|
409
409
|
{
|
|
410
|
-
var
|
|
411
|
-
$n || ($n = !0,
|
|
410
|
+
var v = function() {
|
|
411
|
+
$n || ($n = !0, T("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", m));
|
|
412
412
|
};
|
|
413
|
-
|
|
414
|
-
get:
|
|
413
|
+
v.isReactWarning = !0, Object.defineProperty(d, "ref", {
|
|
414
|
+
get: v,
|
|
415
415
|
configurable: !0
|
|
416
416
|
});
|
|
417
417
|
}
|
|
418
418
|
}
|
|
419
|
-
var Ms = function(d,
|
|
420
|
-
var
|
|
419
|
+
var Ms = function(d, m, 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
|
-
key:
|
|
426
|
-
ref:
|
|
425
|
+
key: m,
|
|
426
|
+
ref: v,
|
|
427
427
|
props: D,
|
|
428
428
|
// Record the component responsible for creating this element.
|
|
429
|
-
_owner:
|
|
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
|
-
value:
|
|
441
|
-
}), Object.defineProperty(
|
|
440
|
+
value: I
|
|
441
|
+
}), Object.defineProperty($, "_source", {
|
|
442
442
|
configurable: !1,
|
|
443
443
|
enumerable: !1,
|
|
444
444
|
writable: !1,
|
|
445
|
-
value:
|
|
446
|
-
}), Object.freeze && (Object.freeze(
|
|
445
|
+
value: W
|
|
446
|
+
}), Object.freeze && (Object.freeze($.props), Object.freeze($)), $;
|
|
447
447
|
};
|
|
448
|
-
function js(d,
|
|
448
|
+
function js(d, m, v, I, W) {
|
|
449
449
|
{
|
|
450
|
-
var
|
|
451
|
-
|
|
452
|
-
for (
|
|
453
|
-
Ge.call(
|
|
450
|
+
var V, D = {}, $ = null, ae = null;
|
|
451
|
+
v !== void 0 && (Rn(v), $ = "" + v), Cs(m) && (Rn(m.key), $ = "" + m.key), ks(m) && (ae = m.ref, Is(m, W));
|
|
452
|
+
for (V in m)
|
|
453
|
+
Ge.call(m, V) && !Es.hasOwnProperty(V) && (D[V] = m[V]);
|
|
454
454
|
if (d && d.defaultProps) {
|
|
455
|
-
var
|
|
456
|
-
for (
|
|
457
|
-
D[
|
|
455
|
+
var Z = d.defaultProps;
|
|
456
|
+
for (V in Z)
|
|
457
|
+
D[V] === void 0 && (D[V] = Z[V]);
|
|
458
458
|
}
|
|
459
|
-
if (
|
|
460
|
-
var
|
|
461
|
-
|
|
459
|
+
if ($ || ae) {
|
|
460
|
+
var te = typeof d == "function" ? d.displayName || d.name || "Unknown" : d;
|
|
461
|
+
$ && Ps(D, te), ae && Rs(D, te);
|
|
462
462
|
}
|
|
463
|
-
return Ms(d,
|
|
463
|
+
return Ms(d, $, ae, W, I, Mn.current, D);
|
|
464
464
|
}
|
|
465
465
|
}
|
|
466
|
-
var $t =
|
|
466
|
+
var $t = _.ReactCurrentOwner, xn = _.ReactDebugCurrentFrame;
|
|
467
467
|
function Ue(d) {
|
|
468
468
|
if (d) {
|
|
469
|
-
var
|
|
470
|
-
xn.setExtraStackFrame(
|
|
469
|
+
var m = d._owner, v = lt(d.type, d._source, m ? m.type : null);
|
|
470
|
+
xn.setExtraStackFrame(v);
|
|
471
471
|
} else
|
|
472
472
|
xn.setExtraStackFrame(null);
|
|
473
473
|
}
|
|
@@ -479,7 +479,7 @@ function Bs() {
|
|
|
479
479
|
function Dn() {
|
|
480
480
|
{
|
|
481
481
|
if ($t.current) {
|
|
482
|
-
var d =
|
|
482
|
+
var d = q($t.current.type);
|
|
483
483
|
if (d)
|
|
484
484
|
return `
|
|
485
485
|
|
|
@@ -494,120 +494,120 @@ Check the render method of \`` + d + "`.";
|
|
|
494
494
|
var Un = {};
|
|
495
495
|
function xs(d) {
|
|
496
496
|
{
|
|
497
|
-
var
|
|
498
|
-
if (!
|
|
499
|
-
var
|
|
500
|
-
|
|
497
|
+
var m = Dn();
|
|
498
|
+
if (!m) {
|
|
499
|
+
var v = typeof d == "string" ? d : d.displayName || d.name;
|
|
500
|
+
v && (m = `
|
|
501
501
|
|
|
502
|
-
Check the top-level render call using <` +
|
|
502
|
+
Check the top-level render call using <` + v + ">.");
|
|
503
503
|
}
|
|
504
|
-
return
|
|
504
|
+
return m;
|
|
505
505
|
}
|
|
506
506
|
}
|
|
507
|
-
function Ln(d,
|
|
507
|
+
function Ln(d, m) {
|
|
508
508
|
{
|
|
509
509
|
if (!d._store || d._store.validated || d.key != null)
|
|
510
510
|
return;
|
|
511
511
|
d._store.validated = !0;
|
|
512
|
-
var
|
|
513
|
-
if (Un[
|
|
512
|
+
var v = xs(m);
|
|
513
|
+
if (Un[v])
|
|
514
514
|
return;
|
|
515
|
-
Un[
|
|
516
|
-
var
|
|
517
|
-
d && d._owner && d._owner !== $t.current && (
|
|
515
|
+
Un[v] = !0;
|
|
516
|
+
var I = "";
|
|
517
|
+
d && d._owner && d._owner !== $t.current && (I = " It was passed a child from " + q(d._owner.type) + "."), Ue(d), T('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', v, I), Ue(null);
|
|
518
518
|
}
|
|
519
519
|
}
|
|
520
|
-
function Fn(d,
|
|
520
|
+
function Fn(d, m) {
|
|
521
521
|
{
|
|
522
522
|
if (typeof d != "object")
|
|
523
523
|
return;
|
|
524
524
|
if (jt(d))
|
|
525
|
-
for (var
|
|
526
|
-
var
|
|
527
|
-
Dt(
|
|
525
|
+
for (var v = 0; v < d.length; v++) {
|
|
526
|
+
var I = d[v];
|
|
527
|
+
Dt(I) && Ln(I, m);
|
|
528
528
|
}
|
|
529
529
|
else if (Dt(d))
|
|
530
530
|
d._store && (d._store.validated = !0);
|
|
531
531
|
else if (d) {
|
|
532
|
-
var
|
|
533
|
-
if (typeof
|
|
534
|
-
for (var
|
|
535
|
-
Dt(D.value) && Ln(D.value,
|
|
532
|
+
var W = S(d);
|
|
533
|
+
if (typeof W == "function" && W !== d.entries)
|
|
534
|
+
for (var V = W.call(d), D; !(D = V.next()).done; )
|
|
535
|
+
Dt(D.value) && Ln(D.value, m);
|
|
536
536
|
}
|
|
537
537
|
}
|
|
538
538
|
}
|
|
539
539
|
function Ds(d) {
|
|
540
540
|
{
|
|
541
|
-
var
|
|
542
|
-
if (
|
|
541
|
+
var m = d.type;
|
|
542
|
+
if (m == null || typeof m == "string")
|
|
543
543
|
return;
|
|
544
|
-
var
|
|
545
|
-
if (typeof
|
|
546
|
-
|
|
547
|
-
else if (typeof
|
|
544
|
+
var v;
|
|
545
|
+
if (typeof m == "function")
|
|
546
|
+
v = m.propTypes;
|
|
547
|
+
else if (typeof m == "object" && (m.$$typeof === u || // Note: Memo only checks outer props here.
|
|
548
548
|
// Inner props are checked in the reconciler.
|
|
549
|
-
|
|
550
|
-
|
|
549
|
+
m.$$typeof === h))
|
|
550
|
+
v = m.propTypes;
|
|
551
551
|
else
|
|
552
552
|
return;
|
|
553
|
-
if (
|
|
554
|
-
var
|
|
555
|
-
Ss(
|
|
556
|
-
} else if (
|
|
553
|
+
if (v) {
|
|
554
|
+
var I = q(m);
|
|
555
|
+
Ss(v, d.props, "prop", I, d);
|
|
556
|
+
} else if (m.PropTypes !== void 0 && !xt) {
|
|
557
557
|
xt = !0;
|
|
558
|
-
var
|
|
559
|
-
|
|
558
|
+
var W = q(m);
|
|
559
|
+
T("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", W || "Unknown");
|
|
560
560
|
}
|
|
561
|
-
typeof
|
|
561
|
+
typeof m.getDefaultProps == "function" && !m.getDefaultProps.isReactClassApproved && T("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
562
562
|
}
|
|
563
563
|
}
|
|
564
564
|
function Us(d) {
|
|
565
565
|
{
|
|
566
|
-
for (var
|
|
567
|
-
var
|
|
568
|
-
if (
|
|
569
|
-
Ue(d),
|
|
566
|
+
for (var m = Object.keys(d.props), v = 0; v < m.length; v++) {
|
|
567
|
+
var I = m[v];
|
|
568
|
+
if (I !== "children" && I !== "key") {
|
|
569
|
+
Ue(d), T("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", I), Ue(null);
|
|
570
570
|
break;
|
|
571
571
|
}
|
|
572
572
|
}
|
|
573
|
-
d.ref !== null && (Ue(d),
|
|
573
|
+
d.ref !== null && (Ue(d), T("Invalid attribute `ref` supplied to `React.Fragment`."), Ue(null));
|
|
574
574
|
}
|
|
575
575
|
}
|
|
576
576
|
var Nn = {};
|
|
577
|
-
function Kn(d,
|
|
577
|
+
function Kn(d, m, v, I, W, V) {
|
|
578
578
|
{
|
|
579
|
-
var D =
|
|
579
|
+
var D = B(d);
|
|
580
580
|
if (!D) {
|
|
581
|
-
var
|
|
582
|
-
(d === void 0 || typeof d == "object" && d !== null && Object.keys(d).length === 0) && (
|
|
583
|
-
var
|
|
584
|
-
|
|
585
|
-
var
|
|
586
|
-
d === null ?
|
|
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
|
+
var ae = $s();
|
|
584
|
+
ae ? $ += ae : $ += Dn();
|
|
585
|
+
var Z;
|
|
586
|
+
d === null ? Z = "null" : jt(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
|
-
var
|
|
589
|
-
if (
|
|
590
|
-
return
|
|
588
|
+
var te = js(d, m, v, W, V);
|
|
589
|
+
if (te == null)
|
|
590
|
+
return te;
|
|
591
591
|
if (D) {
|
|
592
|
-
var
|
|
593
|
-
if (
|
|
594
|
-
if (
|
|
595
|
-
if (jt(
|
|
596
|
-
for (var Le = 0; Le <
|
|
597
|
-
Fn(
|
|
598
|
-
Object.freeze && Object.freeze(
|
|
592
|
+
var ye = m.children;
|
|
593
|
+
if (ye !== void 0)
|
|
594
|
+
if (I)
|
|
595
|
+
if (jt(ye)) {
|
|
596
|
+
for (var Le = 0; Le < ye.length; Le++)
|
|
597
|
+
Fn(ye[Le], d);
|
|
598
|
+
Object.freeze && Object.freeze(ye);
|
|
599
599
|
} else
|
|
600
|
-
|
|
600
|
+
T("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
601
601
|
else
|
|
602
|
-
Fn(
|
|
602
|
+
Fn(ye, d);
|
|
603
603
|
}
|
|
604
|
-
if (Ge.call(
|
|
605
|
-
var Ce =
|
|
604
|
+
if (Ge.call(m, "key")) {
|
|
605
|
+
var Ce = q(d), ue = Object.keys(m).filter(function(Ws) {
|
|
606
606
|
return Ws !== "key";
|
|
607
|
-
}), Ut =
|
|
607
|
+
}), Ut = ue.length > 0 ? "{key: someKey, " + ue.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
608
608
|
if (!Nn[Ce + Ut]) {
|
|
609
|
-
var qs =
|
|
610
|
-
|
|
609
|
+
var qs = ue.length > 0 ? "{" + ue.join(": ..., ") + ": ...}" : "{}";
|
|
610
|
+
T(`A props object containing a "key" prop is being spread into JSX:
|
|
611
611
|
let props = %s;
|
|
612
612
|
<%s {...props} />
|
|
613
613
|
React keys must be passed directly to JSX without using spread:
|
|
@@ -615,14 +615,14 @@ React keys must be passed directly to JSX without using spread:
|
|
|
615
615
|
<%s key={someKey} {...props} />`, Ut, Ce, qs, Ce), Nn[Ce + Ut] = !0;
|
|
616
616
|
}
|
|
617
617
|
}
|
|
618
|
-
return d === s ? Us(
|
|
618
|
+
return d === s ? Us(te) : Ds(te), te;
|
|
619
619
|
}
|
|
620
620
|
}
|
|
621
|
-
function Ls(d,
|
|
622
|
-
return Kn(d,
|
|
621
|
+
function Ls(d, m, v) {
|
|
622
|
+
return Kn(d, m, v, !0);
|
|
623
623
|
}
|
|
624
|
-
function Fs(d,
|
|
625
|
-
return Kn(d,
|
|
624
|
+
function Fs(d, m, v) {
|
|
625
|
+
return Kn(d, m, v, !1);
|
|
626
626
|
}
|
|
627
627
|
var Ns = Fs, Ks = Ls;
|
|
628
628
|
Je.Fragment = s, Je.jsx = Ns, Je.jsxs = Ks;
|
|
@@ -631,7 +631,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
631
631
|
var Gs = {};
|
|
632
632
|
Gs.NODE_ENV === "production" ? Ht.exports = Qs() : Ht.exports = Bs();
|
|
633
633
|
var dt = Ht.exports;
|
|
634
|
-
function
|
|
634
|
+
function ne(n) {
|
|
635
635
|
if (typeof n == "number")
|
|
636
636
|
return (Math.abs(n * 2654435761) >>> 0).toString(16);
|
|
637
637
|
if (typeof n == "boolean")
|
|
@@ -650,7 +650,7 @@ function Z(n) {
|
|
|
650
650
|
let e = 2166136261;
|
|
651
651
|
for (let t = 0; t < n.length; t++) {
|
|
652
652
|
e ^= (t + 1) * 2654435761;
|
|
653
|
-
const r =
|
|
653
|
+
const r = ne(n[t]);
|
|
654
654
|
for (let s = 0; s < r.length; s++)
|
|
655
655
|
e ^= r.charCodeAt(s), e *= 16777619, e = e >>> 0;
|
|
656
656
|
}
|
|
@@ -663,20 +663,20 @@ function Z(n) {
|
|
|
663
663
|
const s = t[r];
|
|
664
664
|
if (n[s] === void 0)
|
|
665
665
|
continue;
|
|
666
|
-
const i =
|
|
666
|
+
const i = ne(s);
|
|
667
667
|
e ^= parseInt(i, 16), e *= 16777619, e = e >>> 0;
|
|
668
|
-
const o =
|
|
668
|
+
const o = ne(n[s]);
|
|
669
669
|
e ^= parseInt(o, 16), e *= 16777619, e = e >>> 0;
|
|
670
670
|
}
|
|
671
671
|
return e.toString(16);
|
|
672
672
|
}
|
|
673
|
-
return
|
|
673
|
+
return ne(String(n));
|
|
674
674
|
}
|
|
675
|
-
const
|
|
675
|
+
const X = {
|
|
676
676
|
Remove: "remove",
|
|
677
677
|
Replace: "replace",
|
|
678
678
|
Add: "add"
|
|
679
|
-
}, Ir = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), Hs = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), _t = Symbol.iterator,
|
|
679
|
+
}, Ir = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), Hs = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), _t = Symbol.iterator, pe = {
|
|
680
680
|
mutable: "mutable",
|
|
681
681
|
immutable: "immutable"
|
|
682
682
|
}, pn = {};
|
|
@@ -700,30 +700,30 @@ function yn(n) {
|
|
|
700
700
|
function bn(n) {
|
|
701
701
|
return Object.getPrototypeOf(n) === Map.prototype;
|
|
702
702
|
}
|
|
703
|
-
function
|
|
703
|
+
function he(n) {
|
|
704
704
|
var e;
|
|
705
705
|
return (e = n.copy) !== null && e !== void 0 ? e : n.original;
|
|
706
706
|
}
|
|
707
707
|
function $e(n) {
|
|
708
|
-
return
|
|
708
|
+
return !!x(n);
|
|
709
709
|
}
|
|
710
|
-
function
|
|
710
|
+
function x(n) {
|
|
711
711
|
return typeof n != "object" ? null : n == null ? void 0 : n[Ir];
|
|
712
712
|
}
|
|
713
713
|
function gn(n) {
|
|
714
714
|
var e;
|
|
715
|
-
const t =
|
|
715
|
+
const t = x(n);
|
|
716
716
|
return t ? (e = t.copy) !== null && e !== void 0 ? e : t.original : n;
|
|
717
717
|
}
|
|
718
|
-
function
|
|
718
|
+
function me(n, e) {
|
|
719
719
|
if (!n || typeof n != "object")
|
|
720
720
|
return !1;
|
|
721
721
|
let t;
|
|
722
|
-
return Object.getPrototypeOf(n) === Object.prototype || Array.isArray(n) || n instanceof Map || n instanceof Set || !!(e != null && e.mark) && ((t = e.mark(n,
|
|
722
|
+
return Object.getPrototypeOf(n) === Object.prototype || Array.isArray(n) || n instanceof Map || n instanceof Set || !!(e != null && e.mark) && ((t = e.mark(n, pe)) === pe.immutable || typeof t == "function");
|
|
723
723
|
}
|
|
724
724
|
function Pr(n, e = []) {
|
|
725
725
|
if (Object.hasOwnProperty.call(n, "key")) {
|
|
726
|
-
const t = n.parent.copy, r =
|
|
726
|
+
const t = n.parent.copy, r = x(Ee(t, n.key));
|
|
727
727
|
if (r !== null && (r == null ? void 0 : r.original) !== n.original)
|
|
728
728
|
return null;
|
|
729
729
|
const s = n.parent.type === 3, i = s ? Array.from(n.parent.setMap.keys()).indexOf(n.key) : n.key;
|
|
@@ -751,8 +751,8 @@ function ot(n, e, t) {
|
|
|
751
751
|
xe(n) === 2 ? n.set(e, t) : n[e] = t;
|
|
752
752
|
}
|
|
753
753
|
function Lt(n, e) {
|
|
754
|
-
const t =
|
|
755
|
-
return (t ?
|
|
754
|
+
const t = x(n);
|
|
755
|
+
return (t ? he(t) : n)[e];
|
|
756
756
|
}
|
|
757
757
|
function Oe(n, e) {
|
|
758
758
|
return n === e ? n !== 0 || 1 / n === 1 / e : n !== n && e !== e;
|
|
@@ -809,8 +809,8 @@ function Rr(n, e) {
|
|
|
809
809
|
return new r(n);
|
|
810
810
|
}
|
|
811
811
|
return new Map(n);
|
|
812
|
-
} else if (e != null && e.mark && (t = e.mark(n,
|
|
813
|
-
if (t ===
|
|
812
|
+
} else if (e != null && e.mark && (t = e.mark(n, pe), t !== void 0) && t !== pe.mutable) {
|
|
813
|
+
if (t === pe.immutable)
|
|
814
814
|
return Ys(n);
|
|
815
815
|
if (typeof t == "function") {
|
|
816
816
|
if (e.enablePatches || e.enableAutoFreeze)
|
|
@@ -828,11 +828,11 @@ function Rr(n, e) {
|
|
|
828
828
|
} else
|
|
829
829
|
throw new Error("Please check mark() to ensure that it is a stable marker draftable function.");
|
|
830
830
|
}
|
|
831
|
-
function
|
|
831
|
+
function ce(n) {
|
|
832
832
|
n.copy || (n.copy = Rr(n.original, n.options));
|
|
833
833
|
}
|
|
834
834
|
function Ze(n) {
|
|
835
|
-
if (!
|
|
835
|
+
if (!me(n))
|
|
836
836
|
return gn(n);
|
|
837
837
|
if (Array.isArray(n))
|
|
838
838
|
return n.map(Ze);
|
|
@@ -930,14 +930,14 @@ function _n(n, e) {
|
|
|
930
930
|
n.forEach((r, s) => e(s, r, n));
|
|
931
931
|
}
|
|
932
932
|
function Mr(n, e, t) {
|
|
933
|
-
if ($e(n) || !
|
|
933
|
+
if ($e(n) || !me(n, t) || e.has(n) || Object.isFrozen(n))
|
|
934
934
|
return;
|
|
935
935
|
const r = n instanceof Set, s = r ? /* @__PURE__ */ new Map() : void 0;
|
|
936
936
|
if (e.add(n), _n(n, (i, o) => {
|
|
937
937
|
var a;
|
|
938
938
|
if ($e(o)) {
|
|
939
|
-
const c =
|
|
940
|
-
|
|
939
|
+
const c = x(o);
|
|
940
|
+
ce(c);
|
|
941
941
|
const u = !((a = c.assignedMap) === null || a === void 0) && a.size || c.operated ? c.copy : c.original;
|
|
942
942
|
ot(r ? s : n, i, u);
|
|
943
943
|
} else
|
|
@@ -968,7 +968,7 @@ function Zt(n, e, t, r) {
|
|
|
968
968
|
}
|
|
969
969
|
}
|
|
970
970
|
function mn(n, e, t, r) {
|
|
971
|
-
const s =
|
|
971
|
+
const s = x(t);
|
|
972
972
|
s && (s.callbacks || (s.callbacks = []), s.callbacks.push((i, o) => {
|
|
973
973
|
var a;
|
|
974
974
|
const c = n.type === 3 ? n.setMap : n.copy;
|
|
@@ -976,7 +976,7 @@ function mn(n, e, t, r) {
|
|
|
976
976
|
let u = s.original;
|
|
977
977
|
s.copy && (u = s.copy), Yt(n), Zt(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)), ot(c, e, u);
|
|
978
978
|
}
|
|
979
|
-
}), n.options.enableAutoFreeze && s.finalities !== n.finalities && (n.options.enableAutoFreeze = !1)),
|
|
979
|
+
}), n.options.enableAutoFreeze && s.finalities !== n.finalities && (n.options.enableAutoFreeze = !1)), me(t, n.options) && n.finalities.draft.push(() => {
|
|
980
980
|
const i = n.type === 3 ? n.setMap : n.copy;
|
|
981
981
|
Oe(Ee(i, e), t) && Xs(n, e);
|
|
982
982
|
});
|
|
@@ -988,12 +988,12 @@ function ei(n, e, t, r, s) {
|
|
|
988
988
|
if (o.get(u.toString()) && c[u] !== i[u]) {
|
|
989
989
|
const l = e.concat([u]), f = Re(l, s);
|
|
990
990
|
t.push({
|
|
991
|
-
op:
|
|
991
|
+
op: X.Replace,
|
|
992
992
|
path: f,
|
|
993
993
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
994
994
|
value: mt(c[u])
|
|
995
995
|
}), r.push({
|
|
996
|
-
op:
|
|
996
|
+
op: X.Replace,
|
|
997
997
|
path: f,
|
|
998
998
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
999
999
|
value: mt(i[u])
|
|
@@ -1002,7 +1002,7 @@ function ei(n, e, t, r, s) {
|
|
|
1002
1002
|
for (let u = i.length; u < c.length; u += 1) {
|
|
1003
1003
|
const l = e.concat([u]), f = Re(l, s);
|
|
1004
1004
|
t.push({
|
|
1005
|
-
op:
|
|
1005
|
+
op: X.Add,
|
|
1006
1006
|
path: f,
|
|
1007
1007
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
1008
1008
|
value: mt(c[u])
|
|
@@ -1013,7 +1013,7 @@ function ei(n, e, t, r, s) {
|
|
|
1013
1013
|
if (u) {
|
|
1014
1014
|
const l = e.concat(["length"]), f = Re(l, s);
|
|
1015
1015
|
r.push({
|
|
1016
|
-
op:
|
|
1016
|
+
op: X.Replace,
|
|
1017
1017
|
path: f,
|
|
1018
1018
|
value: i.length
|
|
1019
1019
|
});
|
|
@@ -1021,7 +1021,7 @@ function ei(n, e, t, r, s) {
|
|
|
1021
1021
|
for (let l = c.length; i.length < l; l -= 1) {
|
|
1022
1022
|
const f = e.concat([l - 1]), h = Re(f, s);
|
|
1023
1023
|
r.push({
|
|
1024
|
-
op:
|
|
1024
|
+
op: X.Remove,
|
|
1025
1025
|
path: h
|
|
1026
1026
|
});
|
|
1027
1027
|
}
|
|
@@ -1029,11 +1029,11 @@ function ei(n, e, t, r, s) {
|
|
|
1029
1029
|
}
|
|
1030
1030
|
function ti({ original: n, copy: e, assignedMap: t }, r, s, i, o) {
|
|
1031
1031
|
t.forEach((a, c) => {
|
|
1032
|
-
const u = Ee(n, c), l = mt(Ee(e, c)), f = a ? rt(n, c) ?
|
|
1033
|
-
if (Oe(u, l) && f ===
|
|
1032
|
+
const u = Ee(n, c), l = mt(Ee(e, c)), f = a ? rt(n, c) ? X.Replace : X.Add : X.Remove;
|
|
1033
|
+
if (Oe(u, l) && f === X.Replace)
|
|
1034
1034
|
return;
|
|
1035
1035
|
const h = r.concat(c), y = Re(h, o);
|
|
1036
|
-
s.push(f ===
|
|
1036
|
+
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 });
|
|
1037
1037
|
});
|
|
1038
1038
|
}
|
|
1039
1039
|
function ni({ original: n, copy: e }, t, r, s, i) {
|
|
@@ -1042,11 +1042,11 @@ function ni({ original: n, copy: e }, t, r, s, i) {
|
|
|
1042
1042
|
if (!e.has(a)) {
|
|
1043
1043
|
const c = t.concat([o]), u = Re(c, i);
|
|
1044
1044
|
r.push({
|
|
1045
|
-
op:
|
|
1045
|
+
op: X.Remove,
|
|
1046
1046
|
path: u,
|
|
1047
1047
|
value: a
|
|
1048
1048
|
}), s.unshift({
|
|
1049
|
-
op:
|
|
1049
|
+
op: X.Add,
|
|
1050
1050
|
path: u,
|
|
1051
1051
|
value: a
|
|
1052
1052
|
});
|
|
@@ -1056,11 +1056,11 @@ function ni({ original: n, copy: e }, t, r, s, i) {
|
|
|
1056
1056
|
if (!n.has(a)) {
|
|
1057
1057
|
const c = t.concat([o]), u = Re(c, i);
|
|
1058
1058
|
r.push({
|
|
1059
|
-
op:
|
|
1059
|
+
op: X.Add,
|
|
1060
1060
|
path: u,
|
|
1061
1061
|
value: a
|
|
1062
1062
|
}), s.unshift({
|
|
1063
|
-
op:
|
|
1063
|
+
op: X.Remove,
|
|
1064
1064
|
path: u,
|
|
1065
1065
|
value: a
|
|
1066
1066
|
});
|
|
@@ -1081,44 +1081,44 @@ function it(n, e, t, r) {
|
|
|
1081
1081
|
}
|
|
1082
1082
|
}
|
|
1083
1083
|
const vt = (n, e, t = !1) => {
|
|
1084
|
-
if (typeof n == "object" && n !== null && (!
|
|
1084
|
+
if (typeof n == "object" && n !== null && (!me(n, e) || t))
|
|
1085
1085
|
throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.");
|
|
1086
1086
|
}, Xt = {
|
|
1087
1087
|
get size() {
|
|
1088
|
-
return
|
|
1088
|
+
return he(x(this)).size;
|
|
1089
1089
|
},
|
|
1090
1090
|
has(n) {
|
|
1091
|
-
return
|
|
1091
|
+
return he(x(this)).has(n);
|
|
1092
1092
|
},
|
|
1093
1093
|
set(n, e) {
|
|
1094
|
-
const t =
|
|
1095
|
-
return (!r.has(n) || !Oe(r.get(n), e)) && (
|
|
1094
|
+
const t = x(this), r = he(t);
|
|
1095
|
+
return (!r.has(n) || !Oe(r.get(n), e)) && (ce(t), Se(t), t.assignedMap.set(n, !0), t.copy.set(n, e), mn(t, n, e, it)), this;
|
|
1096
1096
|
},
|
|
1097
1097
|
delete(n) {
|
|
1098
1098
|
if (!this.has(n))
|
|
1099
1099
|
return !1;
|
|
1100
|
-
const e =
|
|
1101
|
-
return
|
|
1100
|
+
const e = x(this);
|
|
1101
|
+
return ce(e), Se(e), e.original.has(n) ? e.assignedMap.set(n, !1) : e.assignedMap.delete(n), e.copy.delete(n), !0;
|
|
1102
1102
|
},
|
|
1103
1103
|
clear() {
|
|
1104
|
-
const n =
|
|
1104
|
+
const n = x(this);
|
|
1105
1105
|
if (this.size) {
|
|
1106
|
-
|
|
1106
|
+
ce(n), Se(n), n.assignedMap = /* @__PURE__ */ new Map();
|
|
1107
1107
|
for (const [e] of n.original)
|
|
1108
1108
|
n.assignedMap.set(e, !1);
|
|
1109
1109
|
n.copy.clear();
|
|
1110
1110
|
}
|
|
1111
1111
|
},
|
|
1112
1112
|
forEach(n, e) {
|
|
1113
|
-
const t =
|
|
1114
|
-
|
|
1113
|
+
const t = x(this);
|
|
1114
|
+
he(t).forEach((r, s) => {
|
|
1115
1115
|
n.call(e, this.get(s), s, this);
|
|
1116
1116
|
});
|
|
1117
1117
|
},
|
|
1118
1118
|
get(n) {
|
|
1119
1119
|
var e, t;
|
|
1120
|
-
const r =
|
|
1121
|
-
if (r.options.strict && vt(s, r.options, i), i || r.finalized || !
|
|
1120
|
+
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;
|
|
1121
|
+
if (r.options.strict && vt(s, r.options, i), i || r.finalized || !me(s, r.options) || s !== r.original.get(n))
|
|
1122
1122
|
return s;
|
|
1123
1123
|
const o = pn.createDraft({
|
|
1124
1124
|
original: s,
|
|
@@ -1127,10 +1127,10 @@ const vt = (n, e, t = !1) => {
|
|
|
1127
1127
|
finalities: r.finalities,
|
|
1128
1128
|
options: r.options
|
|
1129
1129
|
});
|
|
1130
|
-
return
|
|
1130
|
+
return ce(r), r.copy.set(n, o), o;
|
|
1131
1131
|
},
|
|
1132
1132
|
keys() {
|
|
1133
|
-
return
|
|
1133
|
+
return he(x(this)).keys();
|
|
1134
1134
|
},
|
|
1135
1135
|
values() {
|
|
1136
1136
|
const n = this.keys();
|
|
@@ -1171,8 +1171,8 @@ const vt = (n, e, t = !1) => {
|
|
|
1171
1171
|
return i;
|
|
1172
1172
|
const o = i.value;
|
|
1173
1173
|
let a = n.setMap.get(o);
|
|
1174
|
-
const c =
|
|
1175
|
-
if (n.options.strict && vt(o, n.options, u), !u && !c &&
|
|
1174
|
+
const c = x(a), u = ((s = (r = n.options).mark) === null || s === void 0 ? void 0 : s.call(r, a, pe)) === pe.mutable;
|
|
1175
|
+
if (n.options.strict && vt(o, n.options, u), !u && !c && me(o, n.options) && !n.finalized && n.original.has(o)) {
|
|
1176
1176
|
const l = pn.createDraft({
|
|
1177
1177
|
original: o,
|
|
1178
1178
|
parentDraft: n,
|
|
@@ -1188,40 +1188,40 @@ const vt = (n, e, t = !1) => {
|
|
|
1188
1188
|
};
|
|
1189
1189
|
}, At = {
|
|
1190
1190
|
get size() {
|
|
1191
|
-
return
|
|
1191
|
+
return x(this).setMap.size;
|
|
1192
1192
|
},
|
|
1193
1193
|
has(n) {
|
|
1194
|
-
const e =
|
|
1194
|
+
const e = x(this);
|
|
1195
1195
|
if (e.setMap.has(n))
|
|
1196
1196
|
return !0;
|
|
1197
|
-
|
|
1198
|
-
const t =
|
|
1197
|
+
ce(e);
|
|
1198
|
+
const t = x(n);
|
|
1199
1199
|
return !!(t && e.setMap.has(t.original));
|
|
1200
1200
|
},
|
|
1201
1201
|
add(n) {
|
|
1202
|
-
const e =
|
|
1203
|
-
return this.has(n) || (
|
|
1202
|
+
const e = x(this);
|
|
1203
|
+
return this.has(n) || (ce(e), Se(e), e.assignedMap.set(n, !0), e.setMap.set(n, n), mn(e, n, n, it)), this;
|
|
1204
1204
|
},
|
|
1205
1205
|
delete(n) {
|
|
1206
1206
|
if (!this.has(n))
|
|
1207
1207
|
return !1;
|
|
1208
|
-
const e =
|
|
1209
|
-
|
|
1210
|
-
const t =
|
|
1208
|
+
const e = x(this);
|
|
1209
|
+
ce(e), Se(e);
|
|
1210
|
+
const t = x(n);
|
|
1211
1211
|
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));
|
|
1212
1212
|
},
|
|
1213
1213
|
clear() {
|
|
1214
1214
|
if (!this.size)
|
|
1215
1215
|
return;
|
|
1216
|
-
const n =
|
|
1217
|
-
|
|
1216
|
+
const n = x(this);
|
|
1217
|
+
ce(n), Se(n);
|
|
1218
1218
|
for (const e of n.original)
|
|
1219
1219
|
n.assignedMap.set(e, !1);
|
|
1220
1220
|
n.setMap.clear();
|
|
1221
1221
|
},
|
|
1222
1222
|
values() {
|
|
1223
|
-
const n =
|
|
1224
|
-
|
|
1223
|
+
const n = x(this);
|
|
1224
|
+
ce(n);
|
|
1225
1225
|
const e = n.setMap.keys();
|
|
1226
1226
|
return {
|
|
1227
1227
|
[Symbol.iterator]: () => this.values(),
|
|
@@ -1229,8 +1229,8 @@ const vt = (n, e, t = !1) => {
|
|
|
1229
1229
|
};
|
|
1230
1230
|
},
|
|
1231
1231
|
entries() {
|
|
1232
|
-
const n =
|
|
1233
|
-
|
|
1232
|
+
const n = x(this);
|
|
1233
|
+
ce(n);
|
|
1234
1234
|
const e = n.setMap.keys();
|
|
1235
1235
|
return {
|
|
1236
1236
|
[Symbol.iterator]: () => this.entries(),
|
|
@@ -1286,10 +1286,10 @@ const si = Reflect.ownKeys(At), jr = /* @__PURE__ */ new WeakSet(), $r = {
|
|
|
1286
1286
|
let o;
|
|
1287
1287
|
if (n.options.mark) {
|
|
1288
1288
|
const u = e === "size" && (n.original instanceof Map || n.original instanceof Set) ? Reflect.get(n.original, e) : Reflect.get(n.original, e, t);
|
|
1289
|
-
if (o = n.options.mark(u,
|
|
1289
|
+
if (o = n.options.mark(u, pe), o === pe.mutable)
|
|
1290
1290
|
return n.options.strict && vt(u, n.options, !0), u;
|
|
1291
1291
|
}
|
|
1292
|
-
const a =
|
|
1292
|
+
const a = he(n);
|
|
1293
1293
|
if (a instanceof Map && ri.includes(e)) {
|
|
1294
1294
|
if (e === "size")
|
|
1295
1295
|
return Object.getOwnPropertyDescriptor(Xt, "size").get.call(n.proxy);
|
|
@@ -1312,18 +1312,18 @@ const si = Reflect.ownKeys(At), jr = /* @__PURE__ */ new WeakSet(), $r = {
|
|
|
1312
1312
|
) : void 0;
|
|
1313
1313
|
}
|
|
1314
1314
|
const c = a[e];
|
|
1315
|
-
if (n.options.strict && vt(c, n.options), n.finalized || !
|
|
1315
|
+
if (n.options.strict && vt(c, n.options), n.finalized || !me(c, n.options))
|
|
1316
1316
|
return c;
|
|
1317
1317
|
if (c === Lt(n.original, e)) {
|
|
1318
|
-
if (
|
|
1318
|
+
if (ce(n), n.copy[e] = wn({
|
|
1319
1319
|
original: n.original[e],
|
|
1320
1320
|
parentDraft: n,
|
|
1321
1321
|
key: n.type === 1 ? Number(e) : e,
|
|
1322
1322
|
finalities: n.finalities,
|
|
1323
1323
|
options: n.options
|
|
1324
1324
|
}), typeof o == "function") {
|
|
1325
|
-
const u =
|
|
1326
|
-
return
|
|
1325
|
+
const u = x(n.copy[e]);
|
|
1326
|
+
return ce(u), Se(u), u.copy;
|
|
1327
1327
|
}
|
|
1328
1328
|
return n.copy[e];
|
|
1329
1329
|
}
|
|
@@ -1336,20 +1336,20 @@ const si = Reflect.ownKeys(At), jr = /* @__PURE__ */ new WeakSet(), $r = {
|
|
|
1336
1336
|
let s;
|
|
1337
1337
|
if (n.type === 1 && e !== "length" && !(Number.isInteger(s = Number(e)) && s >= 0 && (e === 0 || s === 0 || String(s) === String(e))))
|
|
1338
1338
|
throw new Error("Only supports setting array indices and the 'length' property.");
|
|
1339
|
-
const i = zn(
|
|
1339
|
+
const i = zn(he(n), e);
|
|
1340
1340
|
if (i != null && i.set)
|
|
1341
1341
|
return i.set.call(n.proxy, t), !0;
|
|
1342
|
-
const o = Lt(
|
|
1343
|
-
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 || rt(n.original, e)) || (
|
|
1342
|
+
const o = Lt(he(n), e), a = x(o);
|
|
1343
|
+
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 || rt(n.original, e)) || (ce(n), Se(n), rt(n.original, e) && Oe(t, n.original[e]) ? n.assignedMap.delete(e) : n.assignedMap.set(e, !0), n.copy[e] = t, mn(n, e, t, it)), !0);
|
|
1344
1344
|
},
|
|
1345
1345
|
has(n, e) {
|
|
1346
|
-
return e in
|
|
1346
|
+
return e in he(n);
|
|
1347
1347
|
},
|
|
1348
1348
|
ownKeys(n) {
|
|
1349
|
-
return Reflect.ownKeys(
|
|
1349
|
+
return Reflect.ownKeys(he(n));
|
|
1350
1350
|
},
|
|
1351
1351
|
getOwnPropertyDescriptor(n, e) {
|
|
1352
|
-
const t =
|
|
1352
|
+
const t = he(n), r = Reflect.getOwnPropertyDescriptor(t, e);
|
|
1353
1353
|
return r && {
|
|
1354
1354
|
writable: !0,
|
|
1355
1355
|
configurable: n.type !== 1 || e !== "length",
|
|
@@ -1368,7 +1368,7 @@ const si = Reflect.ownKeys(At), jr = /* @__PURE__ */ new WeakSet(), $r = {
|
|
|
1368
1368
|
},
|
|
1369
1369
|
deleteProperty(n, e) {
|
|
1370
1370
|
var t;
|
|
1371
|
-
return n.type === 1 ? $r.set.call(this, n, e, void 0, n.proxy) : (Lt(n.original, e) !== void 0 || e in n.original ? (
|
|
1371
|
+
return n.type === 1 ? $r.set.call(this, n, e, void 0, n.proxy) : (Lt(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);
|
|
1372
1372
|
}
|
|
1373
1373
|
};
|
|
1374
1374
|
function wn(n) {
|
|
@@ -1390,19 +1390,19 @@ function wn(n) {
|
|
|
1390
1390
|
const l = t;
|
|
1391
1391
|
l.finalities.draft.push((f, h) => {
|
|
1392
1392
|
var y, b;
|
|
1393
|
-
const
|
|
1394
|
-
let
|
|
1395
|
-
const S = Ee(
|
|
1396
|
-
if (
|
|
1397
|
-
let
|
|
1398
|
-
|
|
1393
|
+
const g = x(c);
|
|
1394
|
+
let w = l.type === 3 ? l.setMap : l.copy;
|
|
1395
|
+
const S = Ee(w, r), _ = x(S);
|
|
1396
|
+
if (_) {
|
|
1397
|
+
let T = _.original;
|
|
1398
|
+
_.operated && (T = gn(S)), Yt(_), Zt(_, it, 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)), ot(w, r, T);
|
|
1399
1399
|
}
|
|
1400
|
-
(b =
|
|
1401
|
-
|
|
1400
|
+
(b = g.callbacks) === null || b === void 0 || b.forEach((T) => {
|
|
1401
|
+
T(f, h);
|
|
1402
1402
|
});
|
|
1403
1403
|
});
|
|
1404
1404
|
} else {
|
|
1405
|
-
const l =
|
|
1405
|
+
const l = x(c);
|
|
1406
1406
|
l.finalities.draft.push((f, h) => {
|
|
1407
1407
|
Yt(l), Zt(l, it, f, h);
|
|
1408
1408
|
});
|
|
@@ -1412,15 +1412,15 @@ function wn(n) {
|
|
|
1412
1412
|
pn.createDraft = wn;
|
|
1413
1413
|
function ii(n, e, t, r, s) {
|
|
1414
1414
|
var i;
|
|
1415
|
-
const o =
|
|
1415
|
+
const o = x(n), a = (i = o == null ? void 0 : o.original) !== null && i !== void 0 ? i : n, c = !!e.length;
|
|
1416
1416
|
if (o != null && o.operated)
|
|
1417
1417
|
for (; o.finalities.draft.length > 0; )
|
|
1418
1418
|
o.finalities.draft.pop()(t, r);
|
|
1419
1419
|
const u = c ? e[0] : o ? o.operated ? o.copy : o.original : n;
|
|
1420
1420
|
return o && Jt(o), s && Ke(u, u, o == null ? void 0 : o.options.updatedValues), [
|
|
1421
1421
|
u,
|
|
1422
|
-
t && c ? [{ op:
|
|
1423
|
-
r && c ? [{ op:
|
|
1422
|
+
t && c ? [{ op: X.Replace, path: [], value: e[0] }] : t,
|
|
1423
|
+
r && c ? [{ op: X.Replace, path: [], value: a }] : r
|
|
1424
1424
|
];
|
|
1425
1425
|
}
|
|
1426
1426
|
function oi(n, e) {
|
|
@@ -1432,7 +1432,7 @@ function oi(n, e) {
|
|
|
1432
1432
|
};
|
|
1433
1433
|
let s, i;
|
|
1434
1434
|
e.enablePatches && (s = [], i = []);
|
|
1435
|
-
const a = ((t = e.mark) === null || t === void 0 ? void 0 : t.call(e, n,
|
|
1435
|
+
const a = ((t = e.mark) === null || t === void 0 ? void 0 : t.call(e, n, pe)) === pe.mutable || !me(n, e) ? n : wn({
|
|
1436
1436
|
original: n,
|
|
1437
1437
|
parentDraft: null,
|
|
1438
1438
|
finalities: r,
|
|
@@ -1449,7 +1449,7 @@ function oi(n, e) {
|
|
|
1449
1449
|
function en(n) {
|
|
1450
1450
|
const { rootDraft: e, value: t, useRawReturn: r = !1, isRoot: s = !0 } = n;
|
|
1451
1451
|
_n(t, (i, o, a) => {
|
|
1452
|
-
const c =
|
|
1452
|
+
const c = x(o);
|
|
1453
1453
|
if (c && e && c.finalities === e.finalities) {
|
|
1454
1454
|
n.isContainDraft = !0;
|
|
1455
1455
|
const u = c.original;
|
|
@@ -1463,8 +1463,8 @@ function en(n) {
|
|
|
1463
1463
|
}
|
|
1464
1464
|
function xr(n) {
|
|
1465
1465
|
var e;
|
|
1466
|
-
const t =
|
|
1467
|
-
if (!
|
|
1466
|
+
const t = x(n);
|
|
1467
|
+
if (!me(n, t == null ? void 0 : t.options))
|
|
1468
1468
|
return n;
|
|
1469
1469
|
const r = xe(n);
|
|
1470
1470
|
if (t && !t.operated)
|
|
@@ -1501,72 +1501,72 @@ function Bn(n) {
|
|
|
1501
1501
|
const ai = (n) => function e(t, r, s) {
|
|
1502
1502
|
var i, o, a;
|
|
1503
1503
|
if (typeof t == "function" && typeof r != "function")
|
|
1504
|
-
return function(
|
|
1505
|
-
return e(
|
|
1504
|
+
return function(O, ...F) {
|
|
1505
|
+
return e(O, (P) => t.call(this, P, ...F), r);
|
|
1506
1506
|
};
|
|
1507
1507
|
const c = t, u = r;
|
|
1508
1508
|
let l = s;
|
|
1509
1509
|
if (typeof r != "function" && (l = r), l !== void 0 && Object.prototype.toString.call(l) !== "[object Object]")
|
|
1510
1510
|
throw new Error(`Invalid options: ${l}, 'options' should be an object.`);
|
|
1511
1511
|
l = Object.assign(Object.assign({}, n), l);
|
|
1512
|
-
const f = $e(c) ? Bn(c) : c, h = Array.isArray(l.mark) ? (
|
|
1513
|
-
for (const
|
|
1514
|
-
if (typeof
|
|
1515
|
-
throw new Error(`Invalid mark: ${
|
|
1516
|
-
const
|
|
1517
|
-
if (
|
|
1518
|
-
return
|
|
1519
|
-
}
|
|
1520
|
-
} : l.mark, y = (i = l.enablePatches) !== null && i !== void 0 ? i : !1, b = (o = l.strict) !== null && o !== void 0 ? o : !1,
|
|
1512
|
+
const f = $e(c) ? Bn(c) : c, h = Array.isArray(l.mark) ? (O, F) => {
|
|
1513
|
+
for (const P of l.mark) {
|
|
1514
|
+
if (typeof P != "function")
|
|
1515
|
+
throw new Error(`Invalid mark: ${P}, 'mark' should be a function.`);
|
|
1516
|
+
const C = P(O, F);
|
|
1517
|
+
if (C)
|
|
1518
|
+
return C;
|
|
1519
|
+
}
|
|
1520
|
+
} : l.mark, y = (i = l.enablePatches) !== null && i !== void 0 ? i : !1, b = (o = l.strict) !== null && o !== void 0 ? o : !1, w = {
|
|
1521
1521
|
enableAutoFreeze: (a = l.enableAutoFreeze) !== null && a !== void 0 ? a : !1,
|
|
1522
1522
|
mark: h,
|
|
1523
1523
|
strict: b,
|
|
1524
1524
|
enablePatches: y
|
|
1525
1525
|
};
|
|
1526
|
-
if (!
|
|
1526
|
+
if (!me(f, w) && typeof f == "object" && f !== null)
|
|
1527
1527
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
1528
|
-
const [S,
|
|
1528
|
+
const [S, _] = oi(f, w);
|
|
1529
1529
|
if (typeof r != "function") {
|
|
1530
|
-
if (!
|
|
1530
|
+
if (!me(f, w))
|
|
1531
1531
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
1532
|
-
return [S,
|
|
1532
|
+
return [S, _];
|
|
1533
1533
|
}
|
|
1534
|
-
let
|
|
1534
|
+
let T;
|
|
1535
1535
|
try {
|
|
1536
|
-
|
|
1537
|
-
} catch (
|
|
1538
|
-
throw Jt(
|
|
1539
|
-
}
|
|
1540
|
-
const
|
|
1541
|
-
const
|
|
1542
|
-
if (!$e(
|
|
1543
|
-
if (
|
|
1536
|
+
T = u(S);
|
|
1537
|
+
} catch (O) {
|
|
1538
|
+
throw Jt(x(S)), O;
|
|
1539
|
+
}
|
|
1540
|
+
const R = (O) => {
|
|
1541
|
+
const F = x(S);
|
|
1542
|
+
if (!$e(O)) {
|
|
1543
|
+
if (O !== void 0 && !Oe(O, S) && (F != null && F.operated))
|
|
1544
1544
|
throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");
|
|
1545
|
-
const
|
|
1546
|
-
if (
|
|
1547
|
-
const
|
|
1548
|
-
return
|
|
1549
|
-
rootDraft:
|
|
1550
|
-
value:
|
|
1545
|
+
const C = O == null ? void 0 : O[Hs];
|
|
1546
|
+
if (C) {
|
|
1547
|
+
const G = C[0];
|
|
1548
|
+
return w.strict && typeof O == "object" && O !== null && en({
|
|
1549
|
+
rootDraft: F,
|
|
1550
|
+
value: O,
|
|
1551
1551
|
useRawReturn: !0
|
|
1552
|
-
}),
|
|
1552
|
+
}), _([G]);
|
|
1553
1553
|
}
|
|
1554
|
-
if (
|
|
1555
|
-
return typeof
|
|
1556
|
-
}
|
|
1557
|
-
if (
|
|
1558
|
-
return
|
|
1559
|
-
const
|
|
1560
|
-
if (
|
|
1561
|
-
if (
|
|
1554
|
+
if (O !== void 0)
|
|
1555
|
+
return typeof O == "object" && O !== null && en({ rootDraft: F, value: O }), _([O]);
|
|
1556
|
+
}
|
|
1557
|
+
if (O === S || O === void 0)
|
|
1558
|
+
return _([]);
|
|
1559
|
+
const P = x(O);
|
|
1560
|
+
if (w === P.options) {
|
|
1561
|
+
if (P.operated)
|
|
1562
1562
|
throw new Error("Cannot return a modified child draft.");
|
|
1563
|
-
return
|
|
1563
|
+
return _([Bn(O)]);
|
|
1564
1564
|
}
|
|
1565
|
-
return
|
|
1565
|
+
return _([O]);
|
|
1566
1566
|
};
|
|
1567
|
-
return
|
|
1568
|
-
throw Jt(
|
|
1569
|
-
}) :
|
|
1567
|
+
return T instanceof Promise ? T.then(R, (O) => {
|
|
1568
|
+
throw Jt(x(S)), O;
|
|
1569
|
+
}) : R(T);
|
|
1570
1570
|
}, Ot = ai();
|
|
1571
1571
|
Object.prototype.constructor.toString();
|
|
1572
1572
|
function Dr(n, e) {
|
|
@@ -1999,7 +1999,7 @@ class Me {
|
|
|
1999
1999
|
for (const e of Object.values(this.attrs))
|
|
2000
2000
|
if (vn(e)) {
|
|
2001
2001
|
const [t, r, s] = e["forward-identity"];
|
|
2002
|
-
|
|
2002
|
+
le(this.blobAttrs, [r, s], e);
|
|
2003
2003
|
}
|
|
2004
2004
|
return this._blobAttrs;
|
|
2005
2005
|
}
|
|
@@ -2010,7 +2010,7 @@ class Me {
|
|
|
2010
2010
|
for (const e of Object.values(this.attrs))
|
|
2011
2011
|
if (e["primary?"]) {
|
|
2012
2012
|
const [t, r] = e["forward-identity"];
|
|
2013
|
-
|
|
2013
|
+
le(this._primaryKeys, [r], e);
|
|
2014
2014
|
}
|
|
2015
2015
|
return this._primaryKeys;
|
|
2016
2016
|
}
|
|
@@ -2020,7 +2020,7 @@ class Me {
|
|
|
2020
2020
|
this._forwardIdents = /* @__PURE__ */ new Map();
|
|
2021
2021
|
for (const e of Object.values(this.attrs)) {
|
|
2022
2022
|
const t = e["forward-identity"], [r, s, i] = t;
|
|
2023
|
-
|
|
2023
|
+
le(this._forwardIdents, [s, i], e);
|
|
2024
2024
|
}
|
|
2025
2025
|
return this._forwardIdents;
|
|
2026
2026
|
}
|
|
@@ -2032,7 +2032,7 @@ class Me {
|
|
|
2032
2032
|
const t = e["reverse-identity"];
|
|
2033
2033
|
if (t) {
|
|
2034
2034
|
const [r, s, i] = t;
|
|
2035
|
-
|
|
2035
|
+
le(this._revIdents, [s, i], e);
|
|
2036
2036
|
}
|
|
2037
2037
|
}
|
|
2038
2038
|
return this._revIdents;
|
|
@@ -2053,7 +2053,7 @@ function vn(n) {
|
|
|
2053
2053
|
function Qe(n, e) {
|
|
2054
2054
|
return e.reduce((t, r) => t && t.get(r), n);
|
|
2055
2055
|
}
|
|
2056
|
-
function
|
|
2056
|
+
function _e(n, e) {
|
|
2057
2057
|
if (e.length === 0)
|
|
2058
2058
|
throw new Error("path must have at least one element");
|
|
2059
2059
|
if (e.length === 1) {
|
|
@@ -2061,9 +2061,9 @@ function ge(n, e) {
|
|
|
2061
2061
|
return;
|
|
2062
2062
|
}
|
|
2063
2063
|
const [t, ...r] = e;
|
|
2064
|
-
n.has(t) &&
|
|
2064
|
+
n.has(t) && _e(n.get(t), r);
|
|
2065
2065
|
}
|
|
2066
|
-
function
|
|
2066
|
+
function le(n, e, t) {
|
|
2067
2067
|
let r = n;
|
|
2068
2068
|
const s = e.length - 1;
|
|
2069
2069
|
for (let i = 0; i < s; i++) {
|
|
@@ -2082,13 +2082,13 @@ function Fr(n, e, t) {
|
|
|
2082
2082
|
console.warn("no such attr", c, a);
|
|
2083
2083
|
continue;
|
|
2084
2084
|
}
|
|
2085
|
-
l["checked-data-type"] === "date" && t && (u = Ct(u), o[2] = u), Sn(l) &&
|
|
2085
|
+
l["checked-data-type"] === "date" && t && (u = Ct(u), o[2] = u), Sn(l) && le(i, [u, c, a], o), le(r, [a, c, u], o), le(s, [c, a, u], o);
|
|
2086
2086
|
}
|
|
2087
2087
|
return { eav: r, aev: s, vae: i };
|
|
2088
2088
|
}
|
|
2089
2089
|
function Nr(n) {
|
|
2090
2090
|
return {
|
|
2091
|
-
triples:
|
|
2091
|
+
triples: fe(n.eav, 3),
|
|
2092
2092
|
cardinalityInference: n.cardinalityInference,
|
|
2093
2093
|
useDateObjects: n.useDateObjects,
|
|
2094
2094
|
version: 1
|
|
@@ -2117,7 +2117,7 @@ function at(n, e) {
|
|
|
2117
2117
|
const [o, a] = e[0], c = n.aev.get(o);
|
|
2118
2118
|
if (!c)
|
|
2119
2119
|
return null;
|
|
2120
|
-
t = (s =
|
|
2120
|
+
t = (s = fe(c, 2).find((l) => l[2] === a)) == null ? void 0 : s[0];
|
|
2121
2121
|
} else
|
|
2122
2122
|
t = e[0];
|
|
2123
2123
|
if (!t)
|
|
@@ -2127,7 +2127,7 @@ function at(n, e) {
|
|
|
2127
2127
|
const [o, a] = r, c = n.aev.get(o);
|
|
2128
2128
|
if (!c)
|
|
2129
2129
|
return null;
|
|
2130
|
-
const l = (i =
|
|
2130
|
+
const l = (i = fe(c, 2).find((g) => g[2] === a)) == null ? void 0 : i[0];
|
|
2131
2131
|
if (!l)
|
|
2132
2132
|
return null;
|
|
2133
2133
|
const [f, h, y, ...b] = e;
|
|
@@ -2142,7 +2142,7 @@ function Wr(n, e, t) {
|
|
|
2142
2142
|
if (!r)
|
|
2143
2143
|
return;
|
|
2144
2144
|
const [s, i, o] = r, a = e.getAttr(i);
|
|
2145
|
-
a && (
|
|
2145
|
+
a && (_e(n.eav, [s, i, o]), _e(n.aev, [i, s, o]), Sn(a) && _e(n.vae, [o, i, s]));
|
|
2146
2146
|
}
|
|
2147
2147
|
let Ii = 0;
|
|
2148
2148
|
function zr(n, e, t) {
|
|
@@ -2161,7 +2161,7 @@ function Vr(n, e, t) {
|
|
|
2161
2161
|
return;
|
|
2162
2162
|
a["checked-data-type"] === "date" && n.useDateObjects && (o = Ct(o));
|
|
2163
2163
|
const c = Qe(n.eav, [s, i, o]), u = (c == null ? void 0 : c[3]) ?? zr(n, a, r), l = [s, i, o, u];
|
|
2164
|
-
ki(a) ? (
|
|
2164
|
+
ki(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)), Sn(a) && le(n.vae, [o, i, s], l);
|
|
2165
2165
|
}
|
|
2166
2166
|
function Pi(n, e, t) {
|
|
2167
2167
|
var y;
|
|
@@ -2185,7 +2185,7 @@ function Pi(n, e, t) {
|
|
|
2185
2185
|
f,
|
|
2186
2186
|
zr(n, a, u)
|
|
2187
2187
|
];
|
|
2188
|
-
|
|
2188
|
+
le(n.eav, [s, i], /* @__PURE__ */ new Map([[f, h]])), le(n.aev, [i, s], /* @__PURE__ */ new Map([[f, h]]));
|
|
2189
2189
|
}
|
|
2190
2190
|
function nn(n, e, t) {
|
|
2191
2191
|
var u, l;
|
|
@@ -2196,23 +2196,23 @@ function nn(n, e, t) {
|
|
|
2196
2196
|
if (a) {
|
|
2197
2197
|
for (const f of a.keys()) {
|
|
2198
2198
|
const h = e.getAttr(f);
|
|
2199
|
-
h && h["on-delete-reverse"] === "cascade" &&
|
|
2200
|
-
var
|
|
2201
|
-
return nn(n, e, [
|
|
2199
|
+
h && h["on-delete-reverse"] === "cascade" && fe(a.get(f), 1).forEach(([y, b, g]) => {
|
|
2200
|
+
var w;
|
|
2201
|
+
return nn(n, e, [g, (w = h["reverse-identity"]) == null ? void 0 : w[1]]);
|
|
2202
2202
|
}), // Fall back to deleting everything if we've rehydrated tx-steps from
|
|
2203
2203
|
// the store that didn't set `etype` in deleteEntity
|
|
2204
2204
|
(!s || // If we don't know about the attr, let's just get rid of it
|
|
2205
2205
|
!h || // Make sure it matches the etype
|
|
2206
|
-
((u = h["forward-identity"]) == null ? void 0 : u[1]) === s) && (
|
|
2206
|
+
((u = h["forward-identity"]) == null ? void 0 : u[1]) === s) && (_e(n.aev, [f, o]), _e(n.eav, [o, f]));
|
|
2207
2207
|
}
|
|
2208
|
-
a.size === 0 &&
|
|
2208
|
+
a.size === 0 && _e(n.eav, [o]);
|
|
2209
2209
|
}
|
|
2210
|
-
const c = n.vae.get(o) &&
|
|
2210
|
+
const c = n.vae.get(o) && fe(n.vae.get(o), 2);
|
|
2211
2211
|
c && c.forEach((f) => {
|
|
2212
|
-
var
|
|
2213
|
-
const [h, y, b] = f,
|
|
2214
|
-
(!s || !
|
|
2215
|
-
}), ((l = n.vae.get(o)) == null ? void 0 : l.size) === 0 &&
|
|
2212
|
+
var w, S, _;
|
|
2213
|
+
const [h, y, b] = f, g = e.getAttr(y);
|
|
2214
|
+
(!s || !g || ((w = g["reverse-identity"]) == null ? void 0 : w[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 && nn(n, e, [h, (_ = g["forward-identity"]) == null ? void 0 : _[1]]);
|
|
2215
|
+
}), ((l = n.vae.get(o)) == null ? void 0 : l.size) === 0 && _e(n.vae, [o]);
|
|
2216
2216
|
}
|
|
2217
2217
|
function Qr(n, e, t) {
|
|
2218
2218
|
const r = Fr(e, t, n.useDateObjects);
|
|
@@ -2224,7 +2224,7 @@ function Ri(n, [e]) {
|
|
|
2224
2224
|
n.addAttr(e);
|
|
2225
2225
|
}
|
|
2226
2226
|
function Br(n) {
|
|
2227
|
-
return
|
|
2227
|
+
return fe(n.eav, 3);
|
|
2228
2228
|
}
|
|
2229
2229
|
function Mi(n, e, [t]) {
|
|
2230
2230
|
if (!e.getAttr(t))
|
|
@@ -2267,7 +2267,7 @@ function $i(n, e, t) {
|
|
|
2267
2267
|
throw new Error(`unhandled transaction action: ${r}`);
|
|
2268
2268
|
}
|
|
2269
2269
|
}
|
|
2270
|
-
function
|
|
2270
|
+
function fe(n, e, t = []) {
|
|
2271
2271
|
if (!n || e === 0)
|
|
2272
2272
|
return t;
|
|
2273
2273
|
if (e === 1) {
|
|
@@ -2276,7 +2276,7 @@ function ue(n, e, t = []) {
|
|
|
2276
2276
|
return t;
|
|
2277
2277
|
}
|
|
2278
2278
|
for (const r of n.values())
|
|
2279
|
-
|
|
2279
|
+
fe(r, e - 1, t);
|
|
2280
2280
|
return t;
|
|
2281
2281
|
}
|
|
2282
2282
|
function ht(n, e, t) {
|
|
@@ -2304,7 +2304,7 @@ function ht(n, e, t) {
|
|
|
2304
2304
|
return r;
|
|
2305
2305
|
}
|
|
2306
2306
|
if (t != null && t.$comparator)
|
|
2307
|
-
return
|
|
2307
|
+
return fe(e, 1).filter(t.$op);
|
|
2308
2308
|
const s = t.in || t.$in || [t];
|
|
2309
2309
|
for (const o of s) {
|
|
2310
2310
|
const a = e.get(o);
|
|
@@ -2321,11 +2321,11 @@ function Di(n, [e, t, r]) {
|
|
|
2321
2321
|
switch (xi(e, t, r)) {
|
|
2322
2322
|
case "e": {
|
|
2323
2323
|
const a = n.eav.get(e);
|
|
2324
|
-
return
|
|
2324
|
+
return fe(a, 2);
|
|
2325
2325
|
}
|
|
2326
2326
|
case "ea": {
|
|
2327
2327
|
const a = (i = n.eav.get(e)) == null ? void 0 : i.get(t);
|
|
2328
|
-
return
|
|
2328
|
+
return fe(a, 1);
|
|
2329
2329
|
}
|
|
2330
2330
|
case "eav": {
|
|
2331
2331
|
const a = (o = n.eav.get(e)) == null ? void 0 : o.get(t);
|
|
@@ -2342,7 +2342,7 @@ function Di(n, [e, t, r]) {
|
|
|
2342
2342
|
}
|
|
2343
2343
|
case "a": {
|
|
2344
2344
|
const a = n.aev.get(t);
|
|
2345
|
-
return
|
|
2345
|
+
return fe(a, 2);
|
|
2346
2346
|
}
|
|
2347
2347
|
case "av": {
|
|
2348
2348
|
const a = n.aev.get(t);
|
|
@@ -2361,7 +2361,7 @@ function Di(n, [e, t, r]) {
|
|
|
2361
2361
|
return a;
|
|
2362
2362
|
}
|
|
2363
2363
|
default:
|
|
2364
|
-
return
|
|
2364
|
+
return fe(n.eav, 3);
|
|
2365
2365
|
}
|
|
2366
2366
|
}
|
|
2367
2367
|
function Ui(n, e, t) {
|
|
@@ -2370,13 +2370,13 @@ function Ui(n, e, t) {
|
|
|
2370
2370
|
if (!e)
|
|
2371
2371
|
return r;
|
|
2372
2372
|
for (const [i, o] of e.entries()) {
|
|
2373
|
-
const a = (s = n.eav.get(t)) == null ? void 0 : s.get(o.id), c =
|
|
2373
|
+
const a = (s = n.eav.get(t)) == null ? void 0 : s.get(o.id), c = fe(a, 1);
|
|
2374
2374
|
for (const u of c)
|
|
2375
2375
|
r[i] = u[2];
|
|
2376
2376
|
}
|
|
2377
2377
|
return r;
|
|
2378
2378
|
}
|
|
2379
|
-
function
|
|
2379
|
+
function re(n, e, t) {
|
|
2380
2380
|
var r;
|
|
2381
2381
|
return (r = n.forwardIdents.get(e)) == null ? void 0 : r.get(t);
|
|
2382
2382
|
}
|
|
@@ -2496,11 +2496,11 @@ const Yi = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a
|
|
|
2496
2496
|
function ze(n) {
|
|
2497
2497
|
return typeof n == "string" && Yi.test(n);
|
|
2498
2498
|
}
|
|
2499
|
-
const
|
|
2499
|
+
const se = [];
|
|
2500
2500
|
for (let n = 0; n < 256; ++n)
|
|
2501
|
-
|
|
2501
|
+
se.push((n + 256).toString(16).slice(1));
|
|
2502
2502
|
function Zi(n, e = 0) {
|
|
2503
|
-
return (
|
|
2503
|
+
return (se[n[e + 0]] + se[n[e + 1]] + se[n[e + 2]] + se[n[e + 3]] + "-" + se[n[e + 4]] + se[n[e + 5]] + "-" + se[n[e + 6]] + se[n[e + 7]] + "-" + se[n[e + 8]] + se[n[e + 9]] + "-" + se[n[e + 10]] + se[n[e + 11]] + se[n[e + 12]] + se[n[e + 13]] + se[n[e + 14]] + se[n[e + 15]]).toLowerCase();
|
|
2504
2504
|
}
|
|
2505
2505
|
let Ft;
|
|
2506
2506
|
const Xi = new Uint8Array(16);
|
|
@@ -2541,7 +2541,7 @@ function ro(n, e) {
|
|
|
2541
2541
|
function so(n, e) {
|
|
2542
2542
|
return ro(Xn(n), Xn(e));
|
|
2543
2543
|
}
|
|
2544
|
-
function
|
|
2544
|
+
function J() {
|
|
2545
2545
|
return no();
|
|
2546
2546
|
}
|
|
2547
2547
|
function io(n, e) {
|
|
@@ -2590,7 +2590,7 @@ function ho(n, e, t) {
|
|
|
2590
2590
|
return n.map((r) => r === e ? t : r);
|
|
2591
2591
|
}
|
|
2592
2592
|
function Jr(n, e, t, r, s) {
|
|
2593
|
-
const i =
|
|
2593
|
+
const i = re(e, t, s), o = De(e, t, s), a = i || o;
|
|
2594
2594
|
if (!a)
|
|
2595
2595
|
throw new Ve(`Could not find attr for ${[t, s]}`);
|
|
2596
2596
|
if (a["value-type"] !== "ref")
|
|
@@ -2679,11 +2679,11 @@ function po(n, e) {
|
|
|
2679
2679
|
return e;
|
|
2680
2680
|
}
|
|
2681
2681
|
function yo(n, e, t, r, s, i) {
|
|
2682
|
-
const o =
|
|
2682
|
+
const o = re(e, t, s), a = De(e, t, s), c = o || a;
|
|
2683
2683
|
if (!c)
|
|
2684
2684
|
throw new Ve(`No attr for etype = ${t} label = ${s}`);
|
|
2685
2685
|
if (i != null && i.hasOwnProperty("$isNull")) {
|
|
2686
|
-
const u =
|
|
2686
|
+
const u = re(e, t, "id");
|
|
2687
2687
|
if (!u)
|
|
2688
2688
|
throw new Ve(`No attr for etype = ${t} label = id`);
|
|
2689
2689
|
return [
|
|
@@ -2702,8 +2702,8 @@ function yo(n, e, t, r, s, i) {
|
|
|
2702
2702
|
}
|
|
2703
2703
|
function bo(n, e, t, r, s) {
|
|
2704
2704
|
const [i, o, a] = s.reduce((c, u) => {
|
|
2705
|
-
const [l, f, h] = c, [y, b,
|
|
2706
|
-
return [y, b, [...h,
|
|
2705
|
+
const [l, f, h] = c, [y, b, g] = Jr(n, e, l, f, u);
|
|
2706
|
+
return [y, b, [...h, g]];
|
|
2707
2707
|
}, [t, r, []]);
|
|
2708
2708
|
return [i, o, a];
|
|
2709
2709
|
}
|
|
@@ -2789,20 +2789,20 @@ function Oo(n, e, t, { etype: r, level: s, form: i }, o) {
|
|
|
2789
2789
|
const a = Object.keys(i).filter((c) => c !== "$");
|
|
2790
2790
|
return a.length ? Object.entries(o).map(function([u, l]) {
|
|
2791
2791
|
return a.map(function(y) {
|
|
2792
|
-
var
|
|
2793
|
-
const b = !!(e.cardinalityInference && ((S = (
|
|
2792
|
+
var g, w, S;
|
|
2793
|
+
const b = !!(e.cardinalityInference && ((S = (w = (g = t.linkIndex) == null ? void 0 : g[r]) == null ? void 0 : w[y]) != null && S.isSingular));
|
|
2794
2794
|
try {
|
|
2795
|
-
const [
|
|
2796
|
-
etype:
|
|
2797
|
-
level:
|
|
2795
|
+
const [_, T, R] = Ao(n, t, r, s, y, u), O = es(e, t, {
|
|
2796
|
+
etype: _,
|
|
2797
|
+
level: T,
|
|
2798
2798
|
form: i[y],
|
|
2799
|
-
join:
|
|
2800
|
-
}),
|
|
2801
|
-
return { [y]:
|
|
2802
|
-
} catch (
|
|
2803
|
-
if (
|
|
2799
|
+
join: R
|
|
2800
|
+
}), F = b ? O[0] : O;
|
|
2801
|
+
return { [y]: F };
|
|
2802
|
+
} catch (_) {
|
|
2803
|
+
if (_ instanceof Ve)
|
|
2804
2804
|
return { [y]: b ? void 0 : [] };
|
|
2805
|
-
throw
|
|
2805
|
+
throw _;
|
|
2806
2806
|
}
|
|
2807
2807
|
}).reduce(function(y, b) {
|
|
2808
2808
|
return { ...y, ...b };
|
|
@@ -2843,7 +2843,7 @@ function Io(n, e) {
|
|
|
2843
2843
|
}
|
|
2844
2844
|
function Po(n, e, t) {
|
|
2845
2845
|
const r = Object.keys(t)[0];
|
|
2846
|
-
return
|
|
2846
|
+
return re(n, e, r);
|
|
2847
2847
|
}
|
|
2848
2848
|
function Ro(n, e, t, r) {
|
|
2849
2849
|
if (t)
|
|
@@ -2857,41 +2857,41 @@ function Mo(n, e, t) {
|
|
|
2857
2857
|
return Li(n, e);
|
|
2858
2858
|
const r = /* @__PURE__ */ new Map();
|
|
2859
2859
|
for (const o of t.fields) {
|
|
2860
|
-
const a =
|
|
2860
|
+
const a = re(n, e, o), c = (s = a == null ? void 0 : a["forward-identity"]) == null ? void 0 : s[2];
|
|
2861
2861
|
c && vn(a) && r.set(c, a);
|
|
2862
2862
|
}
|
|
2863
2863
|
if (!r.has("id")) {
|
|
2864
|
-
const o =
|
|
2864
|
+
const o = re(n, e, "id"), a = (i = o == null ? void 0 : o["forward-identity"]) == null ? void 0 : i[2];
|
|
2865
2865
|
a && r.set(a, o);
|
|
2866
2866
|
}
|
|
2867
2867
|
return r;
|
|
2868
2868
|
}
|
|
2869
2869
|
function jo(n, e, { etype: t, pageInfo: r, dq: s, form: i }) {
|
|
2870
|
-
var
|
|
2871
|
-
const o = (
|
|
2870
|
+
var g, w;
|
|
2871
|
+
const o = (g = i == null ? void 0 : i.$) == null ? void 0 : g.order, a = Xr(i), c = $o(i);
|
|
2872
2872
|
let u = Hi(n, s);
|
|
2873
2873
|
const l = r == null ? void 0 : r["start-cursor"], f = r == null ? void 0 : r["end-cursor"], h = Ro(e, t, l, o);
|
|
2874
|
-
if (h && ((
|
|
2875
|
-
const S = h["checked-data-type"] === "date",
|
|
2876
|
-
u = u.map(([
|
|
2877
|
-
var
|
|
2878
|
-
let
|
|
2879
|
-
return S && (
|
|
2874
|
+
if (h && ((w = h == null ? void 0 : h["forward-identity"]) == null ? void 0 : w[2]) !== "id") {
|
|
2875
|
+
const S = h["checked-data-type"] === "date", _ = h.id;
|
|
2876
|
+
u = u.map(([T]) => {
|
|
2877
|
+
var O, F, P, C, G;
|
|
2878
|
+
let R = (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];
|
|
2879
|
+
return S && (R = on(R)), [T, R];
|
|
2880
2880
|
});
|
|
2881
2881
|
}
|
|
2882
|
-
u.sort(c === "asc" ? function(
|
|
2883
|
-
return Et(
|
|
2884
|
-
} : function(
|
|
2885
|
-
return Et(
|
|
2882
|
+
u.sort(c === "asc" ? function(_, T) {
|
|
2883
|
+
return Et(_, T, h == null ? void 0 : h["checked-data-type"]);
|
|
2884
|
+
} : function(_, T) {
|
|
2885
|
+
return Et(T, _, h == null ? void 0 : h["checked-data-type"]);
|
|
2886
2886
|
});
|
|
2887
2887
|
let y = {};
|
|
2888
2888
|
const b = Mo(e, t, s);
|
|
2889
2889
|
for (const S of u) {
|
|
2890
|
-
const [
|
|
2891
|
-
if (y[
|
|
2890
|
+
const [_] = S;
|
|
2891
|
+
if (y[_] || !a && l && h && ko(l, h, c, S) || !a && f && h && Co(f, h, c, S))
|
|
2892
2892
|
continue;
|
|
2893
|
-
const
|
|
2894
|
-
|
|
2893
|
+
const T = Ui(n, b, _);
|
|
2894
|
+
T && (y[_] = T);
|
|
2895
2895
|
}
|
|
2896
2896
|
return y;
|
|
2897
2897
|
}
|
|
@@ -2906,7 +2906,7 @@ function Xr(n) {
|
|
|
2906
2906
|
return !e && !t && !r;
|
|
2907
2907
|
}
|
|
2908
2908
|
function xo(n, e, { etype: t, level: r, form: s, join: i, pageInfo: o }) {
|
|
2909
|
-
var h, y, b,
|
|
2909
|
+
var h, y, b, g, w;
|
|
2910
2910
|
if (!Xr(s) && (!o || !o["start-cursor"]))
|
|
2911
2911
|
return [];
|
|
2912
2912
|
const a = go(So(e, t, r, (h = s.$) == null ? void 0 : h.where), i), c = vo(It, t, r), u = (y = s.$) == null ? void 0 : y.fields, l = jo(n, e, {
|
|
@@ -2914,7 +2914,7 @@ function xo(n, e, { etype: t, level: r, form: s, join: i, pageInfo: o }) {
|
|
|
2914
2914
|
pageInfo: o,
|
|
2915
2915
|
form: s,
|
|
2916
2916
|
dq: { where: a, find: c, fields: u }
|
|
2917
|
-
}), f = ((b = s.$) == null ? void 0 : b.limit) || ((
|
|
2917
|
+
}), f = ((b = s.$) == null ? void 0 : b.limit) || ((g = s.$) == null ? void 0 : g.first) || ((w = s.$) == null ? void 0 : w.last);
|
|
2918
2918
|
if (f != null) {
|
|
2919
2919
|
r > 0 && co && console.warn("WARNING: Limits in child queries are only run client-side. Data returned from the server will not have a limit.");
|
|
2920
2920
|
const S = Object.entries(l);
|
|
@@ -3056,7 +3056,7 @@ function zo(n) {
|
|
|
3056
3056
|
function Vo(n, e, t) {
|
|
3057
3057
|
return t.indexOf(".") !== -1 && // attr names can have `.` in them, so use the attr we find with a `.`
|
|
3058
3058
|
// before assuming it's a ref lookup.
|
|
3059
|
-
!
|
|
3059
|
+
!re(n, e, t);
|
|
3060
3060
|
}
|
|
3061
3061
|
function cn(n) {
|
|
3062
3062
|
const [e, t, ...r] = n.split(".");
|
|
@@ -3066,8 +3066,8 @@ function cn(n) {
|
|
|
3066
3066
|
}
|
|
3067
3067
|
function Qo(n, e, t) {
|
|
3068
3068
|
if (!Vo(n, e, t))
|
|
3069
|
-
return
|
|
3070
|
-
const r = cn(t), s =
|
|
3069
|
+
return re(n, e, t);
|
|
3070
|
+
const r = cn(t), s = re(n, e, r) || De(n, e, r);
|
|
3071
3071
|
if (s && s["value-type"] !== "ref")
|
|
3072
3072
|
throw new Error(`${t} does not reference a valid link attribute.`);
|
|
3073
3073
|
return s;
|
|
@@ -3075,7 +3075,7 @@ function Qo(n, e, t) {
|
|
|
3075
3075
|
function un(n) {
|
|
3076
3076
|
return typeof n == "string" && !kt(n) ? null : typeof n == "string" && kt(n) ? an(n) : zo(n);
|
|
3077
3077
|
}
|
|
3078
|
-
function
|
|
3078
|
+
function de(n, e, t) {
|
|
3079
3079
|
const r = un(t);
|
|
3080
3080
|
if (r === null)
|
|
3081
3081
|
return t;
|
|
@@ -3086,52 +3086,52 @@ function le(n, e, t) {
|
|
|
3086
3086
|
}
|
|
3087
3087
|
function ns(n, e, t, r) {
|
|
3088
3088
|
var o;
|
|
3089
|
-
const s =
|
|
3089
|
+
const s = de(n, e, t);
|
|
3090
3090
|
return Array.isArray(s) ? [[
|
|
3091
3091
|
"add-triple",
|
|
3092
3092
|
s,
|
|
3093
|
-
(o =
|
|
3093
|
+
(o = re(n, e, "id")) == null ? void 0 : o.id,
|
|
3094
3094
|
s
|
|
3095
3095
|
]].concat(r) : r;
|
|
3096
3096
|
}
|
|
3097
3097
|
function Bo({ attrsStore: n }, [e, t, r]) {
|
|
3098
3098
|
const s = Object.entries(r).flatMap(([i, o]) => {
|
|
3099
|
-
const a = Array.isArray(o) ? o : [o], c =
|
|
3099
|
+
const a = Array.isArray(o) ? o : [o], c = re(n, e, i), u = De(n, e, i);
|
|
3100
3100
|
return a.map((l) => c ? [
|
|
3101
3101
|
"add-triple",
|
|
3102
|
-
|
|
3102
|
+
de(n, e, t),
|
|
3103
3103
|
c.id,
|
|
3104
3104
|
// Uses `!` because if we get here, we should have created the attr if it doesn't
|
|
3105
3105
|
// already exist
|
|
3106
|
-
|
|
3106
|
+
de(n, c["reverse-identity"][1], l)
|
|
3107
3107
|
] : [
|
|
3108
3108
|
"add-triple",
|
|
3109
3109
|
// Uses `!` because if we get here, we should have created the attr if it doesn't
|
|
3110
3110
|
// already exist
|
|
3111
|
-
|
|
3111
|
+
de(n, u["forward-identity"][1], l),
|
|
3112
3112
|
u == null ? void 0 : u.id,
|
|
3113
|
-
|
|
3113
|
+
de(n, e, t)
|
|
3114
3114
|
]);
|
|
3115
3115
|
});
|
|
3116
3116
|
return ns(n, e, t, s);
|
|
3117
3117
|
}
|
|
3118
3118
|
function Go({ attrsStore: n }, [e, t, r]) {
|
|
3119
3119
|
const s = Object.entries(r).flatMap(([i, o]) => {
|
|
3120
|
-
const a = Array.isArray(o) ? o : [o], c =
|
|
3120
|
+
const a = Array.isArray(o) ? o : [o], c = re(n, e, i), u = De(n, e, i);
|
|
3121
3121
|
return a.map((l) => c ? [
|
|
3122
3122
|
"retract-triple",
|
|
3123
|
-
|
|
3123
|
+
de(n, e, t),
|
|
3124
3124
|
c.id,
|
|
3125
3125
|
// Uses `!` because if we get here, we should have created the attr if it doesn't
|
|
3126
3126
|
// already exist
|
|
3127
|
-
|
|
3127
|
+
de(n, c["reverse-identity"][1], l)
|
|
3128
3128
|
] : [
|
|
3129
3129
|
"retract-triple",
|
|
3130
3130
|
// Uses `!` because if we get here, we should have created the attr if it doesn't
|
|
3131
3131
|
// already exist
|
|
3132
|
-
|
|
3132
|
+
de(n, u["forward-identity"][1], l),
|
|
3133
3133
|
u.id,
|
|
3134
|
-
|
|
3134
|
+
de(n, e, t)
|
|
3135
3135
|
]);
|
|
3136
3136
|
});
|
|
3137
3137
|
return ns(n, e, t, s);
|
|
@@ -3143,7 +3143,7 @@ function Ho(n, e, t, r) {
|
|
|
3143
3143
|
for (const a of n || []) {
|
|
3144
3144
|
const c = a == null ? void 0 : a.aev.get(i);
|
|
3145
3145
|
if (c) {
|
|
3146
|
-
for (const [u, l, f] of
|
|
3146
|
+
for (const [u, l, f] of fe(c, 2))
|
|
3147
3147
|
if (f === o)
|
|
3148
3148
|
return !0;
|
|
3149
3149
|
}
|
|
@@ -3163,16 +3163,16 @@ function rs({ stores: n, attrsStore: e }, [t, r, s, i]) {
|
|
|
3163
3163
|
return (i == null ? void 0 : i.upsert) === !1 ? { mode: "update" } : (i == null ? void 0 : i.upsert) === !0 ? null : Ho(n, e, t, r) ? { mode: "update" } : null;
|
|
3164
3164
|
}
|
|
3165
3165
|
function Jo(n, e) {
|
|
3166
|
-
const { attrsStore: t } = n, [r, s, i, o] = e, a = Tn(i), c =
|
|
3166
|
+
const { attrsStore: t } = n, [r, s, i, o] = e, a = Tn(i), c = de(t, r, s);
|
|
3167
3167
|
return [["id", c]].concat(Object.entries(a)).map(([l, f]) => {
|
|
3168
|
-
const h =
|
|
3168
|
+
const h = re(t, r, l);
|
|
3169
3169
|
return h["checked-data-type"] === "date" && n.useDateObjects && (f = Ct(f)), ["add-triple", c, h.id, f, { mode: "create" }];
|
|
3170
3170
|
});
|
|
3171
3171
|
}
|
|
3172
3172
|
function Yo(n, e) {
|
|
3173
|
-
const { attrsStore: t } = n, [r, s, i, o] = e, a = Tn(i), c =
|
|
3173
|
+
const { attrsStore: t } = n, [r, s, i, o] = e, a = Tn(i), c = de(t, r, s), u = rs(n, [r, c, i, o]);
|
|
3174
3174
|
return [["id", c]].concat(Object.entries(a)).map(([f, h]) => {
|
|
3175
|
-
const y =
|
|
3175
|
+
const y = re(t, r, f);
|
|
3176
3176
|
return y["checked-data-type"] === "date" && n.useDateObjects && (h = Ct(h)), [
|
|
3177
3177
|
"add-triple",
|
|
3178
3178
|
c,
|
|
@@ -3183,11 +3183,11 @@ function Yo(n, e) {
|
|
|
3183
3183
|
});
|
|
3184
3184
|
}
|
|
3185
3185
|
function Zo({ attrsStore: n }, [e, t]) {
|
|
3186
|
-
return [["delete-entity",
|
|
3186
|
+
return [["delete-entity", de(n, e, t), e]];
|
|
3187
3187
|
}
|
|
3188
3188
|
function Xo(n, e) {
|
|
3189
|
-
const { attrsStore: t } = n, [r, s, i, o] = e, a = Tn(i), c =
|
|
3190
|
-
const b =
|
|
3189
|
+
const { attrsStore: t } = n, [r, s, i, o] = e, a = Tn(i), c = de(t, r, s), u = rs(n, [r, c, i, o]), l = Object.entries(a).map(([h, y]) => {
|
|
3190
|
+
const b = re(t, r, h);
|
|
3191
3191
|
return [
|
|
3192
3192
|
"deep-merge-triple",
|
|
3193
3193
|
c,
|
|
@@ -3199,13 +3199,13 @@ function Xo(n, e) {
|
|
|
3199
3199
|
return [[
|
|
3200
3200
|
"add-triple",
|
|
3201
3201
|
c,
|
|
3202
|
-
|
|
3202
|
+
re(t, r, "id").id,
|
|
3203
3203
|
c,
|
|
3204
3204
|
...u ? [u] : []
|
|
3205
3205
|
]].concat(l);
|
|
3206
3206
|
}
|
|
3207
3207
|
function ea({ attrsStore: n }, [e, t, r]) {
|
|
3208
|
-
return [["rule-params",
|
|
3208
|
+
return [["rule-params", de(n, e, t), e, r]];
|
|
3209
3209
|
}
|
|
3210
3210
|
function ta(n) {
|
|
3211
3211
|
const [e, t, r, s, i] = n;
|
|
@@ -3261,7 +3261,7 @@ function sa(n, e, t) {
|
|
|
3261
3261
|
};
|
|
3262
3262
|
}
|
|
3263
3263
|
function pt(n, e, t, r) {
|
|
3264
|
-
const s = n ? sa(n, e, t) : null, i =
|
|
3264
|
+
const s = n ? sa(n, e, t) : null, i = J(), a = [J(), e, t];
|
|
3265
3265
|
return {
|
|
3266
3266
|
id: i,
|
|
3267
3267
|
"forward-identity": a,
|
|
@@ -3283,8 +3283,8 @@ function oa(n, e, t) {
|
|
|
3283
3283
|
throw new Error(`Couldn't find the link ${e}.${t} in your schema`);
|
|
3284
3284
|
const { forward: s, reverse: i } = r;
|
|
3285
3285
|
return {
|
|
3286
|
-
"forward-identity": [
|
|
3287
|
-
"reverse-identity": [
|
|
3286
|
+
"forward-identity": [J(), s.on, s.label],
|
|
3287
|
+
"reverse-identity": [J(), i.on, i.label],
|
|
3288
3288
|
cardinality: s.has === "one" ? "one" : "many",
|
|
3289
3289
|
"unique?": i.has === "one",
|
|
3290
3290
|
"on-delete": s.onDelete,
|
|
@@ -3292,7 +3292,7 @@ function oa(n, e, t) {
|
|
|
3292
3292
|
};
|
|
3293
3293
|
}
|
|
3294
3294
|
function sr(n, e, t, r) {
|
|
3295
|
-
const s = n ? oa(n, e, t) : null, i =
|
|
3295
|
+
const s = n ? oa(n, e, t) : null, i = J(), o = [J(), e, t], a = [J(), t, e];
|
|
3296
3296
|
return {
|
|
3297
3297
|
id: i,
|
|
3298
3298
|
// @ts-ignore: ts thinks it's any[]
|
|
@@ -3343,13 +3343,13 @@ function da(n) {
|
|
|
3343
3343
|
function ha({ attrsStore: n, schema: e }, t) {
|
|
3344
3344
|
var h, y;
|
|
3345
3345
|
const r = /* @__PURE__ */ new Set(), s = [], i = [];
|
|
3346
|
-
function o(b,
|
|
3347
|
-
return
|
|
3346
|
+
function o(b, g) {
|
|
3347
|
+
return re(n, b, g) || s.find((w) => w["forward-identity"][1] === b && w["forward-identity"][2] === g);
|
|
3348
3348
|
}
|
|
3349
|
-
function a(b,
|
|
3350
|
-
return De(n, b,
|
|
3351
|
-
var S,
|
|
3352
|
-
return ((S =
|
|
3349
|
+
function a(b, g) {
|
|
3350
|
+
return De(n, b, g) || s.find((w) => {
|
|
3351
|
+
var S, _;
|
|
3352
|
+
return ((S = w["reverse-identity"]) == null ? void 0 : S[1]) === b && ((_ = w["reverse-identity"]) == null ? void 0 : _[2]) === g;
|
|
3353
3353
|
});
|
|
3354
3354
|
}
|
|
3355
3355
|
function c(b) {
|
|
@@ -3358,54 +3358,54 @@ function ha({ attrsStore: n, schema: e }, t) {
|
|
|
3358
3358
|
function u(b) {
|
|
3359
3359
|
b && "isUnsynced" in b && b.isUnsynced && !r.has(b.id) && (s.push(b), i.push(["add-attr", b]), r.add(b.id));
|
|
3360
3360
|
}
|
|
3361
|
-
function l(b,
|
|
3362
|
-
return
|
|
3361
|
+
function l(b, g) {
|
|
3362
|
+
return g.indexOf(".") !== -1 && // attr names can have `.` in them, so use the attr we find with a `.`
|
|
3363
3363
|
// before assuming it's a ref lookup.
|
|
3364
|
-
!o(b,
|
|
3364
|
+
!o(b, g);
|
|
3365
3365
|
}
|
|
3366
|
-
function f(b,
|
|
3367
|
-
const
|
|
3368
|
-
u(
|
|
3366
|
+
function f(b, g) {
|
|
3367
|
+
const w = o(b, g), S = a(b, g);
|
|
3368
|
+
u(w), u(S), !w && !S && c(sr(e, b, g, fa));
|
|
3369
3369
|
}
|
|
3370
3370
|
for (const b of t)
|
|
3371
|
-
for (const { etype:
|
|
3372
|
-
const
|
|
3371
|
+
for (const { etype: g, lookupPair: w, linkLabel: S } of da(b)) {
|
|
3372
|
+
const _ = w[0];
|
|
3373
3373
|
if (S) {
|
|
3374
|
-
f(
|
|
3375
|
-
const
|
|
3376
|
-
u(
|
|
3377
|
-
const
|
|
3378
|
-
if (l(
|
|
3379
|
-
f(
|
|
3374
|
+
f(g, S);
|
|
3375
|
+
const T = o(g, S), R = a(g, S);
|
|
3376
|
+
u(T), u(R);
|
|
3377
|
+
const O = ((h = T == null ? void 0 : T["reverse-identity"]) == null ? void 0 : h[1]) || ((y = R == null ? void 0 : R["forward-identity"]) == null ? void 0 : y[1]) || S;
|
|
3378
|
+
if (l(O, _))
|
|
3379
|
+
f(O, cn(_));
|
|
3380
3380
|
else {
|
|
3381
|
-
const
|
|
3382
|
-
|
|
3381
|
+
const F = o(O, _);
|
|
3382
|
+
F || c(pt(e, O, _, ln)), u(F);
|
|
3383
3383
|
}
|
|
3384
|
-
} else if (l(
|
|
3385
|
-
f(
|
|
3384
|
+
} else if (l(g, _))
|
|
3385
|
+
f(g, cn(_));
|
|
3386
3386
|
else {
|
|
3387
|
-
const
|
|
3388
|
-
|
|
3387
|
+
const T = o(g, _);
|
|
3388
|
+
T || c(pt(e, g, _, ln)), u(T);
|
|
3389
3389
|
}
|
|
3390
3390
|
}
|
|
3391
3391
|
for (const b of t) {
|
|
3392
|
-
const [
|
|
3393
|
-
if (aa.has(
|
|
3394
|
-
const
|
|
3395
|
-
u(
|
|
3396
|
-
for (const
|
|
3397
|
-
const
|
|
3398
|
-
if (u(
|
|
3399
|
-
const
|
|
3400
|
-
!
|
|
3392
|
+
const [g, w, S, _] = b;
|
|
3393
|
+
if (aa.has(g)) {
|
|
3394
|
+
const T = o(w, "id");
|
|
3395
|
+
u(T), T || c(pt(e, w, "id", { "unique?": !0 }));
|
|
3396
|
+
for (const R of Object.keys(_)) {
|
|
3397
|
+
const O = o(w, R);
|
|
3398
|
+
if (u(O), ua.has(g) && (O || c(pt(e, w, R, R === "id" ? { "unique?": !0 } : null))), ca.has(g)) {
|
|
3399
|
+
const F = a(w, R);
|
|
3400
|
+
!O && !F && c(sr(e, w, R)), u(F);
|
|
3401
3401
|
}
|
|
3402
3402
|
}
|
|
3403
3403
|
}
|
|
3404
3404
|
}
|
|
3405
3405
|
if (s.length) {
|
|
3406
3406
|
const b = { ...n.attrs };
|
|
3407
|
-
for (const
|
|
3408
|
-
b[
|
|
3407
|
+
for (const g of s)
|
|
3408
|
+
b[g.id] = g;
|
|
3409
3409
|
return [new Me(b, n.linkIndex), i];
|
|
3410
3410
|
}
|
|
3411
3411
|
return [n, i];
|
|
@@ -3594,13 +3594,13 @@ class fn {
|
|
|
3594
3594
|
for (const [h, y] of Object.entries(r.objects))
|
|
3595
3595
|
!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++);
|
|
3596
3596
|
const a = Object.entries(r.objects);
|
|
3597
|
-
a.sort(([h, y], [b,
|
|
3597
|
+
a.sort(([h, y], [b, g]) => y.updatedAt - g.updatedAt);
|
|
3598
3598
|
const c = a.filter(([h]) => !t.has(h));
|
|
3599
3599
|
if (a.length > this._gcOpts.maxEntries)
|
|
3600
3600
|
for (const [h] of c.slice(0, a.length - this._gcOpts.maxEntries))
|
|
3601
3601
|
s.push(this._persister.removeItem(h)), delete r.objects[h], i.removed.push(h), i.removedThresholdCount++;
|
|
3602
3602
|
const u = Object.entries(r.objects);
|
|
3603
|
-
u.sort(([h, y], [b,
|
|
3603
|
+
u.sort(([h, y], [b, g]) => y.updatedAt - g.updatedAt);
|
|
3604
3604
|
const l = u.filter(([h]) => !t.has(h));
|
|
3605
3605
|
let f = u.reduce((h, [y, b]) => h + b.size, 0);
|
|
3606
3606
|
for (; f > 0 && f > this._gcOpts.maxSize && l.length; ) {
|
|
@@ -3702,17 +3702,17 @@ async function wa(n, e, t) {
|
|
|
3702
3702
|
var l, f, h;
|
|
3703
3703
|
const a = {};
|
|
3704
3704
|
for (const [y, b] of Object.entries(r)) {
|
|
3705
|
-
const
|
|
3706
|
-
if (
|
|
3705
|
+
const g = typeof b == "string" ? JSON.parse(b) : b;
|
|
3706
|
+
if (g.lastAccessed) {
|
|
3707
3707
|
const S = {
|
|
3708
|
-
createdAt:
|
|
3709
|
-
updatedAt:
|
|
3710
|
-
size: ((h = (f = (l =
|
|
3708
|
+
createdAt: g.lastAccessed,
|
|
3709
|
+
updatedAt: g.lastAccessed,
|
|
3710
|
+
size: ((h = (f = (l = g.result) == null ? void 0 : l.store) == null ? void 0 : f.triples) == null ? void 0 : h.length) ?? 0
|
|
3711
3711
|
};
|
|
3712
3712
|
a[y] = S;
|
|
3713
3713
|
}
|
|
3714
|
-
const
|
|
3715
|
-
s.add(
|
|
3714
|
+
const w = t.put(g, y);
|
|
3715
|
+
s.add(w);
|
|
3716
3716
|
}
|
|
3717
3717
|
const c = { objects: a }, u = t.put(c, qe);
|
|
3718
3718
|
s.add(u);
|
|
@@ -3736,19 +3736,19 @@ async function Ta(n, e) {
|
|
|
3736
3736
|
return;
|
|
3737
3737
|
const r = await new Promise((l, f) => {
|
|
3738
3738
|
const b = t.transaction(["kv"], "readonly").objectStore("kv").openCursor();
|
|
3739
|
-
b.onerror = (
|
|
3740
|
-
f(
|
|
3739
|
+
b.onerror = (w) => {
|
|
3740
|
+
f(w);
|
|
3741
3741
|
};
|
|
3742
|
-
const
|
|
3742
|
+
const g = [];
|
|
3743
3743
|
b.onsuccess = () => {
|
|
3744
|
-
const
|
|
3745
|
-
if (
|
|
3746
|
-
const S =
|
|
3747
|
-
|
|
3744
|
+
const w = b.result;
|
|
3745
|
+
if (w) {
|
|
3746
|
+
const S = w.key, _ = w.value;
|
|
3747
|
+
g.push([S, _]), w.continue();
|
|
3748
3748
|
} else
|
|
3749
|
-
l(
|
|
3750
|
-
}, b.onerror = (
|
|
3751
|
-
f(
|
|
3749
|
+
l(g);
|
|
3750
|
+
}, b.onerror = (w) => {
|
|
3751
|
+
f(w);
|
|
3752
3752
|
};
|
|
3753
3753
|
}), s = e.transaction(["kv", "querySubs"], "readwrite"), i = s.objectStore("kv"), o = s.objectStore("querySubs"), a = [], c = { objects: {} };
|
|
3754
3754
|
for (const [l, f] of r)
|
|
@@ -3890,20 +3890,20 @@ class is {
|
|
|
3890
3890
|
};
|
|
3891
3891
|
}
|
|
3892
3892
|
}
|
|
3893
|
-
class
|
|
3893
|
+
class ie extends Error {
|
|
3894
3894
|
constructor(t, r, s) {
|
|
3895
3895
|
super(t);
|
|
3896
3896
|
p(this, "hint");
|
|
3897
3897
|
p(this, "traceId");
|
|
3898
3898
|
this.hint = r, s && (this.traceId = s);
|
|
3899
3899
|
const i = new.target.prototype;
|
|
3900
|
-
Object.setPrototypeOf && Object.setPrototypeOf(this, i), Error.captureStackTrace && Error.captureStackTrace(this,
|
|
3900
|
+
Object.setPrototypeOf && Object.setPrototypeOf(this, i), Error.captureStackTrace && Error.captureStackTrace(this, ie), this.name = "InstantError";
|
|
3901
3901
|
}
|
|
3902
3902
|
get [Symbol.toStringTag]() {
|
|
3903
3903
|
return "InstantError";
|
|
3904
3904
|
}
|
|
3905
3905
|
}
|
|
3906
|
-
class Pt extends
|
|
3906
|
+
class Pt extends ie {
|
|
3907
3907
|
constructor(t) {
|
|
3908
3908
|
var i;
|
|
3909
3909
|
const r = ((i = t.body) == null ? void 0 : i.message) || `API Error (${t.status})`;
|
|
@@ -3917,19 +3917,19 @@ class Pt extends oe {
|
|
|
3917
3917
|
return "InstantAPIError";
|
|
3918
3918
|
}
|
|
3919
3919
|
}
|
|
3920
|
-
async function
|
|
3920
|
+
async function we(n, e) {
|
|
3921
3921
|
const t = await fetch(n, e), r = await t.json();
|
|
3922
3922
|
return t.status === 200 ? Promise.resolve(r) : Promise.reject(new Pt({ status: t.status, body: r }));
|
|
3923
3923
|
}
|
|
3924
3924
|
function Sa({ apiURI: n, appId: e, email: t }) {
|
|
3925
|
-
return
|
|
3925
|
+
return we(`${n}/runtime/auth/send_magic_code`, {
|
|
3926
3926
|
method: "POST",
|
|
3927
3927
|
headers: { "content-type": "application/json" },
|
|
3928
3928
|
body: JSON.stringify({ "app-id": e, email: t })
|
|
3929
3929
|
});
|
|
3930
3930
|
}
|
|
3931
3931
|
async function va({ apiURI: n, appId: e, email: t, code: r, refreshToken: s, extraFields: i }) {
|
|
3932
|
-
return await
|
|
3932
|
+
return await we(`${n}/runtime/auth/verify_magic_code`, {
|
|
3933
3933
|
method: "POST",
|
|
3934
3934
|
headers: { "content-type": "application/json" },
|
|
3935
3935
|
body: JSON.stringify({
|
|
@@ -3942,7 +3942,7 @@ async function va({ apiURI: n, appId: e, email: t, code: r, refreshToken: s, ext
|
|
|
3942
3942
|
});
|
|
3943
3943
|
}
|
|
3944
3944
|
async function Aa({ apiURI: n, appId: e, refreshToken: t }) {
|
|
3945
|
-
return await
|
|
3945
|
+
return await we(`${n}/runtime/auth/verify_refresh_token`, {
|
|
3946
3946
|
method: "POST",
|
|
3947
3947
|
headers: { "content-type": "application/json" },
|
|
3948
3948
|
body: JSON.stringify({
|
|
@@ -3952,7 +3952,7 @@ async function Aa({ apiURI: n, appId: e, refreshToken: t }) {
|
|
|
3952
3952
|
});
|
|
3953
3953
|
}
|
|
3954
3954
|
async function Oa({ apiURI: n, appId: e }) {
|
|
3955
|
-
return await
|
|
3955
|
+
return await we(`${n}/runtime/auth/sign_in_guest`, {
|
|
3956
3956
|
method: "POST",
|
|
3957
3957
|
headers: { "content-type": "application/json" },
|
|
3958
3958
|
body: JSON.stringify({
|
|
@@ -3961,7 +3961,7 @@ async function Oa({ apiURI: n, appId: e }) {
|
|
|
3961
3961
|
});
|
|
3962
3962
|
}
|
|
3963
3963
|
async function cr({ apiURI: n, appId: e, code: t, codeVerifier: r, refreshToken: s, extraFields: i }) {
|
|
3964
|
-
return await
|
|
3964
|
+
return await we(`${n}/runtime/oauth/token`, {
|
|
3965
3965
|
method: "POST",
|
|
3966
3966
|
headers: { "content-type": "application/json" },
|
|
3967
3967
|
body: JSON.stringify({
|
|
@@ -3974,7 +3974,7 @@ async function cr({ apiURI: n, appId: e, code: t, codeVerifier: r, refreshToken:
|
|
|
3974
3974
|
});
|
|
3975
3975
|
}
|
|
3976
3976
|
async function Ea({ apiURI: n, appId: e, nonce: t, idToken: r, clientName: s, refreshToken: i, extraFields: o }) {
|
|
3977
|
-
return await
|
|
3977
|
+
return await we(`${n}/runtime/oauth/id_token`, {
|
|
3978
3978
|
method: "POST",
|
|
3979
3979
|
headers: { "content-type": "application/json" },
|
|
3980
3980
|
body: JSON.stringify({
|
|
@@ -3988,7 +3988,7 @@ async function Ea({ apiURI: n, appId: e, nonce: t, idToken: r, clientName: s, re
|
|
|
3988
3988
|
});
|
|
3989
3989
|
}
|
|
3990
3990
|
async function ka({ apiURI: n, appId: e, refreshToken: t }) {
|
|
3991
|
-
return await
|
|
3991
|
+
return await we(`${n}/runtime/signout`, {
|
|
3992
3992
|
method: "POST",
|
|
3993
3993
|
headers: {
|
|
3994
3994
|
"content-type": "application/json"
|
|
@@ -4006,14 +4006,14 @@ async function Ca({ apiURI: n, appId: e, path: t, file: r, refreshToken: s, cont
|
|
|
4006
4006
|
authorization: `Bearer ${s}`,
|
|
4007
4007
|
"content-type": i || r.type
|
|
4008
4008
|
};
|
|
4009
|
-
return o && (a["content-disposition"] = o), await
|
|
4009
|
+
return o && (a["content-disposition"] = o), await we(`${n}/storage/upload`, {
|
|
4010
4010
|
method: "PUT",
|
|
4011
4011
|
headers: a,
|
|
4012
4012
|
body: r
|
|
4013
4013
|
});
|
|
4014
4014
|
}
|
|
4015
4015
|
async function Ia({ apiURI: n, appId: e, path: t, refreshToken: r }) {
|
|
4016
|
-
const { data: s } = await
|
|
4016
|
+
const { data: s } = await we(`${n}/storage/files?app_id=${e}&filename=${encodeURIComponent(t)}`, {
|
|
4017
4017
|
method: "DELETE",
|
|
4018
4018
|
headers: {
|
|
4019
4019
|
"content-type": "application/json",
|
|
@@ -4023,7 +4023,7 @@ async function Ia({ apiURI: n, appId: e, path: t, refreshToken: r }) {
|
|
|
4023
4023
|
return s;
|
|
4024
4024
|
}
|
|
4025
4025
|
async function Pa({ apiURI: n, appId: e, fileName: t, refreshToken: r, metadata: s = {} }) {
|
|
4026
|
-
const { data: i } = await
|
|
4026
|
+
const { data: i } = await we(`${n}/storage/signed-upload-url`, {
|
|
4027
4027
|
method: "POST",
|
|
4028
4028
|
headers: {
|
|
4029
4029
|
"content-type": "application/json",
|
|
@@ -4046,7 +4046,7 @@ async function Ra(n, e) {
|
|
|
4046
4046
|
})).ok;
|
|
4047
4047
|
}
|
|
4048
4048
|
async function Ma({ apiURI: n, appId: e, path: t, refreshToken: r }) {
|
|
4049
|
-
const { data: s } = await
|
|
4049
|
+
const { data: s } = await we(`${n}/storage/signed-download-url?app_id=${e}&filename=${encodeURIComponent(t)}`, {
|
|
4050
4050
|
method: "GET",
|
|
4051
4051
|
headers: {
|
|
4052
4052
|
"content-type": "application/json",
|
|
@@ -4133,7 +4133,7 @@ function dr(n) {
|
|
|
4133
4133
|
}, e;
|
|
4134
4134
|
}, {});
|
|
4135
4135
|
}
|
|
4136
|
-
const us = "v1.0.3
|
|
4136
|
+
const us = "v1.0.3";
|
|
4137
4137
|
function xa(n, e) {
|
|
4138
4138
|
return {
|
|
4139
4139
|
info: n ? (...t) => console.info(...t, e()) : () => {
|
|
@@ -4177,7 +4177,7 @@ class ve {
|
|
|
4177
4177
|
});
|
|
4178
4178
|
}
|
|
4179
4179
|
}
|
|
4180
|
-
class
|
|
4180
|
+
class Q extends Error {
|
|
4181
4181
|
constructor(e, t) {
|
|
4182
4182
|
const r = t ? `At path '${t}': ${e}` : e;
|
|
4183
4183
|
super(r), this.name = "QueryValidationError";
|
|
@@ -4214,13 +4214,13 @@ const hr = [
|
|
|
4214
4214
|
}, Ua = (n, e, t, r, s, i, o) => {
|
|
4215
4215
|
const a = i.valueType === "json", c = (u, l, f) => {
|
|
4216
4216
|
if (!ls(f, l, a))
|
|
4217
|
-
throw new
|
|
4217
|
+
throw new Q(`Invalid value for operator '${u}' on attribute '${r}' in entity '${s}'. Expected ${l}, but received: ${typeof f}`, o);
|
|
4218
4218
|
};
|
|
4219
4219
|
switch (n) {
|
|
4220
4220
|
case "in":
|
|
4221
4221
|
case "$in":
|
|
4222
4222
|
if (!Array.isArray(e))
|
|
4223
|
-
throw new
|
|
4223
|
+
throw new Q(`Operator '${n}' for attribute '${r}' in entity '${s}' must be an array, but received: ${typeof e}`, o);
|
|
4224
4224
|
for (const u of e)
|
|
4225
4225
|
c(n, t, u);
|
|
4226
4226
|
break;
|
|
@@ -4235,13 +4235,13 @@ const hr = [
|
|
|
4235
4235
|
case "$like":
|
|
4236
4236
|
case "$ilike":
|
|
4237
4237
|
if (c(n, "string", e), n === "$ilike" && !i.isIndexed)
|
|
4238
|
-
throw new
|
|
4238
|
+
throw new Q(`Operator '${n}' can only be used with indexed attributes, but '${r}' in entity '${s}' is not indexed`, o);
|
|
4239
4239
|
break;
|
|
4240
4240
|
case "$isNull":
|
|
4241
4241
|
c(n, "boolean", e);
|
|
4242
4242
|
break;
|
|
4243
4243
|
default:
|
|
4244
|
-
throw new
|
|
4244
|
+
throw new Q(`Unknown operator '${n}' for attribute '${r}' in entity '${s}'`, o);
|
|
4245
4245
|
}
|
|
4246
4246
|
}, We = (n, e, t, r, s) => {
|
|
4247
4247
|
const i = Da(t), o = t.valueType === "json";
|
|
@@ -4252,42 +4252,42 @@ const hr = [
|
|
|
4252
4252
|
for (const [u, l] of Object.entries(c))
|
|
4253
4253
|
Ua(u, l, i, e, r, t, `${s}.${u}`);
|
|
4254
4254
|
} else if (!ls(n, i, o))
|
|
4255
|
-
throw new
|
|
4255
|
+
throw new Q(`Invalid value for attribute '${e}' in entity '${r}'. Expected ${i}, but received: ${typeof n}`, s);
|
|
4256
4256
|
}, La = (n, e, t, r, s) => {
|
|
4257
4257
|
const i = n.split(".");
|
|
4258
4258
|
if (i.length < 2)
|
|
4259
|
-
throw new
|
|
4259
|
+
throw new Q(`Invalid dot notation path '${n}'. Must contain at least one dot.`, s);
|
|
4260
4260
|
let o = t;
|
|
4261
4261
|
for (let l = 0; l < i.length - 1; l++) {
|
|
4262
4262
|
const f = i[l], h = r.entities[o];
|
|
4263
4263
|
if (!h)
|
|
4264
|
-
throw new
|
|
4264
|
+
throw new Q(`Entity '${o}' does not exist in schema while traversing dot notation path '${n}'.`, s);
|
|
4265
4265
|
const y = h.links[f];
|
|
4266
4266
|
if (!y) {
|
|
4267
4267
|
const b = Object.keys(h.links);
|
|
4268
|
-
throw new
|
|
4268
|
+
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);
|
|
4269
4269
|
}
|
|
4270
4270
|
o = y.entityName;
|
|
4271
4271
|
}
|
|
4272
4272
|
const a = i[i.length - 1], c = r.entities[o];
|
|
4273
4273
|
if (!c)
|
|
4274
|
-
throw new
|
|
4274
|
+
throw new Q(`Target entity '${o}' does not exist in schema for dot notation path '${n}'.`, s);
|
|
4275
4275
|
if (a === "id") {
|
|
4276
4276
|
if (typeof e == "string" && !ze(e))
|
|
4277
|
-
throw new
|
|
4277
|
+
throw new Q(`Invalid value for id field in entity '${o}'. Expected a UUID, but received: ${e}`, s);
|
|
4278
4278
|
We(e, n, new ve("string", !1, !0), t, s);
|
|
4279
4279
|
return;
|
|
4280
4280
|
}
|
|
4281
4281
|
const u = c.attrs[a];
|
|
4282
4282
|
if (Object.keys(c.links).includes(a)) {
|
|
4283
4283
|
if (typeof e == "string" && !ze(e))
|
|
4284
|
-
throw new
|
|
4284
|
+
throw new Q(`Invalid value for link '${a}' in entity '${o}'. Expected a UUID, but received: ${e}`, s);
|
|
4285
4285
|
We(e, n, new ve("string", !1, !0), t, s);
|
|
4286
4286
|
return;
|
|
4287
4287
|
}
|
|
4288
4288
|
if (!u) {
|
|
4289
4289
|
const l = Object.keys(c.attrs);
|
|
4290
|
-
throw new
|
|
4290
|
+
throw new Q(`Attribute '${a}' does not exist on entity '${o}' in dot notation path '${n}'. Available attributes: ${l.length > 0 ? l.join(", ") + ", id" : "id"}`, s);
|
|
4291
4291
|
}
|
|
4292
4292
|
We(e, n, u, t, s);
|
|
4293
4293
|
}, fs = (n, e, t, r) => {
|
|
@@ -4312,13 +4312,13 @@ const hr = [
|
|
|
4312
4312
|
const a = o.attrs[s], c = o.links[s];
|
|
4313
4313
|
if (!a && !c) {
|
|
4314
4314
|
const u = Object.keys(o.attrs), l = Object.keys(o.links);
|
|
4315
|
-
throw new
|
|
4315
|
+
throw new Q(`Attribute or link '${s}' does not exist on entity '${e}'. Available attributes: ${u.length > 0 ? u.join(", ") : "none"}. Available links: ${l.length > 0 ? l.join(", ") : "none"}`, `${r}.${s}`);
|
|
4316
4316
|
}
|
|
4317
4317
|
if (a)
|
|
4318
4318
|
We(i, s, a, e, `${r}.${s}`);
|
|
4319
4319
|
else if (c) {
|
|
4320
4320
|
if (typeof i == "string" && !ze(i))
|
|
4321
|
-
throw new
|
|
4321
|
+
throw new Q(`Invalid value for link '${s}' in entity '${e}'. Expected a UUID, but received: ${i}`, `${r}.${s}`);
|
|
4322
4322
|
const u = new ve("string", !1, !0);
|
|
4323
4323
|
We(i, s, u, e, `${r}.${s}`);
|
|
4324
4324
|
}
|
|
@@ -4326,7 +4326,7 @@ const hr = [
|
|
|
4326
4326
|
}, Fa = (n, e, t, r, s = 0) => {
|
|
4327
4327
|
for (const o of Object.keys(n))
|
|
4328
4328
|
if (!hr.includes(o))
|
|
4329
|
-
throw new
|
|
4329
|
+
throw new Q(`Invalid query parameter '${o}' in $ object. Valid parameters are: ${hr.join(", ")}. Found: ${o}`, r);
|
|
4330
4330
|
const i = [
|
|
4331
4331
|
// 'limit', // only supported client side
|
|
4332
4332
|
"offset",
|
|
@@ -4339,21 +4339,21 @@ const hr = [
|
|
|
4339
4339
|
];
|
|
4340
4340
|
for (const o of i)
|
|
4341
4341
|
if (n[o] !== void 0 && s > 0)
|
|
4342
|
-
throw new
|
|
4342
|
+
throw new Q(`'${o}' can only be used on top-level namespaces. It cannot be used in nested queries.`, r);
|
|
4343
4343
|
if (n.where && t) {
|
|
4344
4344
|
if (typeof n.where != "object" || n.where === null)
|
|
4345
|
-
throw new
|
|
4345
|
+
throw new Q(`'where' clause must be an object in entity '${e}', but received: ${typeof n.where}`, r ? `${r}.where` : void 0);
|
|
4346
4346
|
fs(n.where, e, t, r ? `${r}.where` : "where");
|
|
4347
4347
|
}
|
|
4348
4348
|
}, ds = (n, e, t, r, s = 0) => {
|
|
4349
4349
|
var i;
|
|
4350
4350
|
if (!n || typeof n != "object")
|
|
4351
|
-
throw new
|
|
4351
|
+
throw new Q(`Query part for entity '${e}' must be an object, but received: ${typeof n}`, r);
|
|
4352
4352
|
for (const o of Object.keys(n))
|
|
4353
4353
|
if (o !== "$") {
|
|
4354
4354
|
if (t && !(o in t.entities[e].links)) {
|
|
4355
4355
|
const c = Object.keys(t.entities[e].links);
|
|
4356
|
-
throw new
|
|
4356
|
+
throw new Q(`Link '${o}' does not exist on entity '${e}'. Available links: ${c.length > 0 ? c.join(", ") : "none"}`, `${r}.${o}`);
|
|
4357
4357
|
}
|
|
4358
4358
|
const a = n[o];
|
|
4359
4359
|
if (typeof a == "object" && a !== null) {
|
|
@@ -4363,35 +4363,35 @@ const hr = [
|
|
|
4363
4363
|
} else {
|
|
4364
4364
|
const a = n[o];
|
|
4365
4365
|
if (typeof a != "object" || a === null)
|
|
4366
|
-
throw new
|
|
4366
|
+
throw new Q(`Query parameter '$' must be an object in entity '${e}', but received: ${typeof a}`, `${r}.$`);
|
|
4367
4367
|
Fa(a, e, t, `${r}.$`, s);
|
|
4368
4368
|
}
|
|
4369
4369
|
}, pr = (n, e) => {
|
|
4370
4370
|
if (typeof n != "object" || n === null)
|
|
4371
|
-
throw new
|
|
4371
|
+
throw new Q(`Query must be an object, but received: ${typeof n}${n === null ? " (null)" : ""}`);
|
|
4372
4372
|
if (Array.isArray(n))
|
|
4373
|
-
throw new
|
|
4373
|
+
throw new Q(`Query must be an object, but received: ${typeof n}`);
|
|
4374
4374
|
const t = n;
|
|
4375
4375
|
for (const r of Object.keys(t)) {
|
|
4376
4376
|
if (Array.isArray(n[r]))
|
|
4377
|
-
throw new
|
|
4377
|
+
throw new Q(`Query keys must be strings, but found key of type: ${typeof r}`, r);
|
|
4378
4378
|
if (typeof r != "string")
|
|
4379
|
-
throw new
|
|
4379
|
+
throw new Q(`Query keys must be strings, but found key of type: ${typeof r}`, r);
|
|
4380
4380
|
if (r !== "$$ruleParams") {
|
|
4381
4381
|
if (e && !e.entities[r]) {
|
|
4382
4382
|
const s = Object.keys(e.entities);
|
|
4383
|
-
throw new
|
|
4383
|
+
throw new Q(`Entity '${r}' does not exist in schema. Available entities: ${s.length > 0 ? s.join(", ") : "none"}`, r);
|
|
4384
4384
|
}
|
|
4385
4385
|
ds(t[r], r, e, r, 0);
|
|
4386
4386
|
}
|
|
4387
4387
|
}
|
|
4388
4388
|
}, yr = (n) => typeof n != "string" ? !1 : kt(n) ? !0 : ze(n);
|
|
4389
|
-
class
|
|
4389
|
+
class be extends Error {
|
|
4390
4390
|
constructor(e) {
|
|
4391
4391
|
super(e), this.name = "TransactionValidationError";
|
|
4392
4392
|
}
|
|
4393
4393
|
}
|
|
4394
|
-
const hs = (n) => n.length > 0 ? n.join(", ") : "none", Na = (n, e) => new
|
|
4394
|
+
const hs = (n) => n.length > 0 ? n.join(", ") : "none", Na = (n, e) => new be(`Entity '${n}' does not exist in schema. Available entities: ${hs(e)}`), Nt = {
|
|
4395
4395
|
string: (n) => typeof n == "string",
|
|
4396
4396
|
number: (n) => typeof n == "number" && !isNaN(n),
|
|
4397
4397
|
boolean: (n) => typeof n == "boolean",
|
|
@@ -4408,30 +4408,30 @@ const hs = (n) => n.length > 0 ? n.join(", ") : "none", Na = (n, e) => new ye(`E
|
|
|
4408
4408
|
}, Kt = (n, e, t) => {
|
|
4409
4409
|
const r = ps(n, t);
|
|
4410
4410
|
if (typeof e != "object" || e === null)
|
|
4411
|
-
throw new
|
|
4411
|
+
throw new be(`Arguments for data operation on entity '${n}' must be an object, but received: ${typeof e}`);
|
|
4412
4412
|
for (const [s, i] of Object.entries(e)) {
|
|
4413
4413
|
if (s === "id")
|
|
4414
4414
|
continue;
|
|
4415
4415
|
const o = r.attrs[s];
|
|
4416
4416
|
if (o && !Ka(i, o))
|
|
4417
|
-
throw new
|
|
4417
|
+
throw new be(`Invalid value for attribute '${s}' in entity '${n}'. Expected ${o.valueType}, but received: ${typeof i}`);
|
|
4418
4418
|
}
|
|
4419
4419
|
}, br = (n, e, t) => {
|
|
4420
4420
|
const r = ps(n, t);
|
|
4421
4421
|
if (typeof e != "object" || e === null)
|
|
4422
|
-
throw new
|
|
4422
|
+
throw new be(`Arguments for link operation on entity '${n}' must be an object, but received: ${typeof e}`);
|
|
4423
4423
|
for (const [s, i] of Object.entries(e)) {
|
|
4424
4424
|
if (!r.links[s]) {
|
|
4425
4425
|
const a = Object.keys(r.links);
|
|
4426
|
-
throw new
|
|
4426
|
+
throw new be(`Link '${s}' does not exist on entity '${n}'. Available links: ${hs(a)}`);
|
|
4427
4427
|
}
|
|
4428
4428
|
if (i != null) {
|
|
4429
4429
|
if (Array.isArray(i)) {
|
|
4430
4430
|
for (const a of i)
|
|
4431
4431
|
if (!yr(a))
|
|
4432
|
-
throw new
|
|
4432
|
+
throw new be(`Invalid entity ID in link '${s}' for entity '${n}'. Expected a UUID or a lookup, but received: ${a}`);
|
|
4433
4433
|
} else if (!yr(i))
|
|
4434
|
-
throw new
|
|
4434
|
+
throw new be(`Invalid UUID in link '${s}' for entity '${n}'. Expected a UUID, but received: ${i}`);
|
|
4435
4435
|
}
|
|
4436
4436
|
}
|
|
4437
4437
|
}, qa = {
|
|
@@ -4447,21 +4447,21 @@ const hs = (n) => n.length > 0 ? n.join(", ") : "none", Na = (n, e) => new ye(`E
|
|
|
4447
4447
|
return;
|
|
4448
4448
|
const [t, r, s, i] = n;
|
|
4449
4449
|
if (!Array.isArray(s) && !ze(s))
|
|
4450
|
-
throw new
|
|
4450
|
+
throw new be(`Invalid id for entity '${r}'. Expected a UUID, but received: ${s}`);
|
|
4451
4451
|
if (typeof r != "string")
|
|
4452
|
-
throw new
|
|
4452
|
+
throw new be(`Entity name must be a string, but received: ${typeof r}`);
|
|
4453
4453
|
const o = qa[t];
|
|
4454
4454
|
o && i !== void 0 && o(r, i, e);
|
|
4455
4455
|
}, za = (n, e) => {
|
|
4456
4456
|
const t = Array.isArray(n) ? n : [n];
|
|
4457
4457
|
for (const r of t) {
|
|
4458
4458
|
if (!r || typeof r != "object")
|
|
4459
|
-
throw new
|
|
4459
|
+
throw new be(`Transaction chunk must be an object, but received: ${typeof r}`);
|
|
4460
4460
|
if (!Array.isArray(r.__ops))
|
|
4461
|
-
throw new
|
|
4461
|
+
throw new be(`Transaction chunk must have __ops array, but received: ${typeof r.__ops}`);
|
|
4462
4462
|
for (const s of r.__ops) {
|
|
4463
4463
|
if (!Array.isArray(s))
|
|
4464
|
-
throw new
|
|
4464
|
+
throw new be(`Transaction operation must be an array, but received: ${typeof s}`);
|
|
4465
4465
|
Wa(s, e);
|
|
4466
4466
|
}
|
|
4467
4467
|
}
|
|
@@ -4636,7 +4636,7 @@ function qt(n, e, t) {
|
|
|
4636
4636
|
}
|
|
4637
4637
|
function _r(n, e, t, r) {
|
|
4638
4638
|
var o;
|
|
4639
|
-
const s = (o =
|
|
4639
|
+
const s = (o = re(t, n.table, "id")) == null ? void 0 : o.id;
|
|
4640
4640
|
if (!s)
|
|
4641
4641
|
return -1;
|
|
4642
4642
|
const i = Qe(e.eav, [r, s, r]);
|
|
@@ -4685,7 +4685,7 @@ function Ja(n, e) {
|
|
|
4685
4685
|
var r;
|
|
4686
4686
|
if (n.orderFieldType)
|
|
4687
4687
|
return n.orderFieldType;
|
|
4688
|
-
const t = n.orderField === "serverCreatedAt" ? "number" : (r =
|
|
4688
|
+
const t = n.orderField === "serverCreatedAt" ? "number" : (r = re(e(), n.table, n.orderField)) == null ? void 0 : r["checked-data-type"];
|
|
4689
4689
|
return n.orderFieldType = t, t;
|
|
4690
4690
|
}
|
|
4691
4691
|
function Ya(n, e, t) {
|
|
@@ -4744,7 +4744,7 @@ class Za {
|
|
|
4744
4744
|
this.subs.flush();
|
|
4745
4745
|
}
|
|
4746
4746
|
subscribe(e, t) {
|
|
4747
|
-
const r =
|
|
4747
|
+
const r = ne(e);
|
|
4748
4748
|
return this.callbacks[r] = this.callbacks[r] || [], this.callbacks[r].push(t), this.initSubscription(e, r, t), (s) => {
|
|
4749
4749
|
this.unsubscribe(r, t, s == null ? void 0 : s.keepSubscription);
|
|
4750
4750
|
};
|
|
@@ -4760,7 +4760,7 @@ class Za {
|
|
|
4760
4760
|
}
|
|
4761
4761
|
}
|
|
4762
4762
|
sendStart(e) {
|
|
4763
|
-
this.trySend(
|
|
4763
|
+
this.trySend(J(), {
|
|
4764
4764
|
op: "start-sync",
|
|
4765
4765
|
q: e
|
|
4766
4766
|
});
|
|
@@ -4774,7 +4774,7 @@ class Za {
|
|
|
4774
4774
|
});
|
|
4775
4775
|
}
|
|
4776
4776
|
sendRemove(e, t) {
|
|
4777
|
-
this.trySend(
|
|
4777
|
+
this.trySend(J(), {
|
|
4778
4778
|
op: "remove-sync",
|
|
4779
4779
|
"subscription-id": e.subscriptionId,
|
|
4780
4780
|
"keep-subscription": t
|
|
@@ -4812,7 +4812,7 @@ class Za {
|
|
|
4812
4812
|
}
|
|
4813
4813
|
}
|
|
4814
4814
|
onStartSyncOk(e) {
|
|
4815
|
-
const t = e["subscription-id"], r = e.q, s =
|
|
4815
|
+
const t = e["subscription-id"], r = e.q, s = ne(r);
|
|
4816
4816
|
this.idToHash[t] = s, this.subs.updateInPlace((i) => {
|
|
4817
4817
|
const o = i[s];
|
|
4818
4818
|
if (!o)
|
|
@@ -4906,9 +4906,9 @@ class Za {
|
|
|
4906
4906
|
continue;
|
|
4907
4907
|
i.txId = a["tx-id"];
|
|
4908
4908
|
const c = [], u = {};
|
|
4909
|
-
for (const
|
|
4910
|
-
const S = u[
|
|
4911
|
-
u[
|
|
4909
|
+
for (const w of a.changes) {
|
|
4910
|
+
const S = u[w.triple[0]] ?? [];
|
|
4911
|
+
u[w.triple[0]] = S, S.push(w);
|
|
4912
4912
|
}
|
|
4913
4913
|
const l = s.values ?? {
|
|
4914
4914
|
entities: [],
|
|
@@ -4916,44 +4916,44 @@ class Za {
|
|
|
4916
4916
|
}, f = l.entities;
|
|
4917
4917
|
s.values = l;
|
|
4918
4918
|
const h = [];
|
|
4919
|
-
e: for (const [
|
|
4920
|
-
for (let
|
|
4921
|
-
const
|
|
4922
|
-
if (Ci(
|
|
4923
|
-
mr(
|
|
4924
|
-
const
|
|
4925
|
-
|
|
4926
|
-
oldEntity:
|
|
4927
|
-
newEntity:
|
|
4928
|
-
changedFields:
|
|
4929
|
-
}),
|
|
4919
|
+
e: for (const [w, S] of Object.entries(u))
|
|
4920
|
+
for (let _ = 0; _ < f.length; _++) {
|
|
4921
|
+
const T = f[_];
|
|
4922
|
+
if (Ci(T.store, w)) {
|
|
4923
|
+
mr(T.store, l.attrsStore, S);
|
|
4924
|
+
const R = qt(s, T.store, l.attrsStore), O = Ha(T.store, l.attrsStore, S)[w];
|
|
4925
|
+
R ? (h.push({
|
|
4926
|
+
oldEntity: T.entity,
|
|
4927
|
+
newEntity: R,
|
|
4928
|
+
changedFields: O || {}
|
|
4929
|
+
}), T.entity = R) : c.push(_), delete u[w];
|
|
4930
4930
|
continue e;
|
|
4931
4931
|
}
|
|
4932
4932
|
}
|
|
4933
4933
|
const y = [];
|
|
4934
|
-
for (const [
|
|
4935
|
-
const
|
|
4936
|
-
mr(
|
|
4937
|
-
const
|
|
4938
|
-
if (!
|
|
4934
|
+
for (const [w, S] of Object.entries(u)) {
|
|
4935
|
+
const _ = this.createStore([]);
|
|
4936
|
+
mr(_, l.attrsStore, S);
|
|
4937
|
+
const T = qt(s, _, l.attrsStore);
|
|
4938
|
+
if (!T) {
|
|
4939
4939
|
this.log.error("No entity found after applying change", {
|
|
4940
4940
|
sub: s,
|
|
4941
4941
|
changes: S,
|
|
4942
|
-
store:
|
|
4942
|
+
store: _
|
|
4943
4943
|
});
|
|
4944
4944
|
continue;
|
|
4945
4945
|
}
|
|
4946
4946
|
f.push({
|
|
4947
|
-
store:
|
|
4948
|
-
entity:
|
|
4949
|
-
serverCreatedAt: _r(s,
|
|
4950
|
-
}), y.push(
|
|
4947
|
+
store: _,
|
|
4948
|
+
entity: T,
|
|
4949
|
+
serverCreatedAt: _r(s, _, l.attrsStore, T.id)
|
|
4950
|
+
}), y.push(T);
|
|
4951
4951
|
}
|
|
4952
4952
|
const b = [];
|
|
4953
|
-
for (const
|
|
4954
|
-
b.push(f[
|
|
4955
|
-
const
|
|
4956
|
-
Ya(s,
|
|
4953
|
+
for (const w of c.sort().reverse())
|
|
4954
|
+
b.push(f[w].entity), f.splice(w, 1);
|
|
4955
|
+
const g = Ja(s, this.getAttrs);
|
|
4956
|
+
Ya(s, g, f), this.notifyCbs(r, {
|
|
4957
4957
|
type: Ie.SyncTransaction,
|
|
4958
4958
|
data: yt(s, (o = s.values) == null ? void 0 : o.entities),
|
|
4959
4959
|
added: y,
|
|
@@ -4977,7 +4977,7 @@ class Za {
|
|
|
4977
4977
|
}
|
|
4978
4978
|
}
|
|
4979
4979
|
onStartSyncError(e) {
|
|
4980
|
-
const t =
|
|
4980
|
+
const t = ne(e["original-event"].q), r = {
|
|
4981
4981
|
message: e.message || "Uh-oh, something went wrong. Ping Joe & Stopa.",
|
|
4982
4982
|
status: e.status,
|
|
4983
4983
|
type: e.type,
|
|
@@ -4997,197 +4997,197 @@ class Za {
|
|
|
4997
4997
|
function Xa({ WStream: n, opts: e, startStream: t, appendStream: r, registerStream: s }) {
|
|
4998
4998
|
const i = e.clientId;
|
|
4999
4999
|
let o = null, a = null, c = null;
|
|
5000
|
-
const u =
|
|
5000
|
+
const u = J();
|
|
5001
5001
|
let l = !1, f = !1;
|
|
5002
5002
|
const h = [], y = [], b = [];
|
|
5003
|
-
let
|
|
5004
|
-
const
|
|
5005
|
-
function
|
|
5003
|
+
let g = !1, w = 0, S = 0;
|
|
5004
|
+
const _ = [], T = new TextEncoder();
|
|
5005
|
+
function R() {
|
|
5006
5006
|
f = !0;
|
|
5007
|
-
for (const
|
|
5008
|
-
|
|
5007
|
+
for (const A of h)
|
|
5008
|
+
A(a ?? void 0);
|
|
5009
5009
|
}
|
|
5010
|
-
function
|
|
5011
|
-
return h.push(
|
|
5012
|
-
const k = h.indexOf(
|
|
5010
|
+
function O(A) {
|
|
5011
|
+
return h.push(A), f && A(a ?? void 0), () => {
|
|
5012
|
+
const k = h.indexOf(A);
|
|
5013
5013
|
k !== -1 && h.splice(k, 1);
|
|
5014
5014
|
};
|
|
5015
5015
|
}
|
|
5016
|
-
function
|
|
5017
|
-
return b.push(
|
|
5018
|
-
const k = b.indexOf(
|
|
5016
|
+
function F(A) {
|
|
5017
|
+
return b.push(A), () => {
|
|
5018
|
+
const k = b.indexOf(A);
|
|
5019
5019
|
k !== -1 && b.splice(k, 1);
|
|
5020
5020
|
};
|
|
5021
5021
|
}
|
|
5022
|
-
e.waitUntil && e.waitUntil(new Promise((
|
|
5023
|
-
b.push(
|
|
5022
|
+
e.waitUntil && e.waitUntil(new Promise((A) => {
|
|
5023
|
+
b.push(A);
|
|
5024
5024
|
}));
|
|
5025
|
-
function
|
|
5026
|
-
for (const
|
|
5025
|
+
function P() {
|
|
5026
|
+
for (const A of b)
|
|
5027
5027
|
try {
|
|
5028
|
-
|
|
5028
|
+
A();
|
|
5029
5029
|
} catch {
|
|
5030
5030
|
}
|
|
5031
5031
|
}
|
|
5032
|
-
function
|
|
5033
|
-
return y.push(
|
|
5034
|
-
const k = y.indexOf(
|
|
5032
|
+
function C(A) {
|
|
5033
|
+
return y.push(A), o && A(o), () => {
|
|
5034
|
+
const k = y.indexOf(A);
|
|
5035
5035
|
k !== -1 && y.splice(k, 1);
|
|
5036
5036
|
};
|
|
5037
5037
|
}
|
|
5038
|
-
function
|
|
5039
|
-
o =
|
|
5038
|
+
function G(A) {
|
|
5039
|
+
o = A;
|
|
5040
5040
|
for (const k of y)
|
|
5041
5041
|
k(o);
|
|
5042
5042
|
}
|
|
5043
|
-
function
|
|
5044
|
-
|
|
5043
|
+
function N() {
|
|
5044
|
+
g = !0;
|
|
5045
5045
|
}
|
|
5046
|
-
function
|
|
5047
|
-
let k =
|
|
5048
|
-
for (const { byteLen:
|
|
5049
|
-
const
|
|
5050
|
-
if (
|
|
5046
|
+
function B(A) {
|
|
5047
|
+
let k = w, K = 0, H = 0;
|
|
5048
|
+
for (const { byteLen: Y } of _) {
|
|
5049
|
+
const oe = k + Y;
|
|
5050
|
+
if (oe > A)
|
|
5051
5051
|
break;
|
|
5052
|
-
k =
|
|
5052
|
+
k = oe, K++, H += Y;
|
|
5053
5053
|
}
|
|
5054
|
-
|
|
5054
|
+
K > 0 && (w += H, S -= H, _.splice(0, K));
|
|
5055
5055
|
}
|
|
5056
|
-
function
|
|
5057
|
-
a = k,
|
|
5056
|
+
function z(A, k) {
|
|
5057
|
+
a = k, R(), A.error(k), P();
|
|
5058
5058
|
}
|
|
5059
|
-
async function
|
|
5060
|
-
const
|
|
5059
|
+
async function ee() {
|
|
5060
|
+
const A = await t({
|
|
5061
5061
|
clientId: i,
|
|
5062
5062
|
reconnectToken: u,
|
|
5063
5063
|
ruleParams: e.ruleParams
|
|
5064
5064
|
});
|
|
5065
|
-
switch (
|
|
5065
|
+
switch (A.type) {
|
|
5066
5066
|
case "ok": {
|
|
5067
|
-
const { streamId: k, offset:
|
|
5068
|
-
o = k,
|
|
5067
|
+
const { streamId: k, offset: K } = A;
|
|
5068
|
+
o = k, B(K), _.length && r({
|
|
5069
5069
|
streamId: k,
|
|
5070
|
-
chunks:
|
|
5071
|
-
offset:
|
|
5072
|
-
}),
|
|
5070
|
+
chunks: _.map((H) => H.chunk),
|
|
5071
|
+
offset: w
|
|
5072
|
+
}), g = !1;
|
|
5073
5073
|
break;
|
|
5074
5074
|
}
|
|
5075
5075
|
case "disconnect": {
|
|
5076
|
-
|
|
5076
|
+
N();
|
|
5077
5077
|
break;
|
|
5078
5078
|
}
|
|
5079
5079
|
case "error": {
|
|
5080
|
-
c &&
|
|
5080
|
+
c && z(c, A.error);
|
|
5081
5081
|
break;
|
|
5082
5082
|
}
|
|
5083
5083
|
}
|
|
5084
5084
|
}
|
|
5085
|
-
function
|
|
5086
|
-
|
|
5085
|
+
function q() {
|
|
5086
|
+
N(), ee();
|
|
5087
5087
|
}
|
|
5088
|
-
function E({ offset:
|
|
5089
|
-
|
|
5088
|
+
function E({ offset: A, done: k }) {
|
|
5089
|
+
B(A), k && (l = !0, P());
|
|
5090
5090
|
}
|
|
5091
|
-
function
|
|
5092
|
-
return l ? (
|
|
5091
|
+
function j(A) {
|
|
5092
|
+
return l ? (z(A, new ie("Stream has been closed.")), null) : o || (z(A, new ie("Stream has not been initialized.")), null);
|
|
5093
5093
|
}
|
|
5094
|
-
async function M(
|
|
5095
|
-
c =
|
|
5096
|
-
let k = !0,
|
|
5094
|
+
async function M(A) {
|
|
5095
|
+
c = A;
|
|
5096
|
+
let k = !0, K = 0;
|
|
5097
5097
|
for (; k; ) {
|
|
5098
|
-
let
|
|
5098
|
+
let H = Date.now() + Math.min(15e3, 500 * (K - 1));
|
|
5099
5099
|
k = !1;
|
|
5100
|
-
const
|
|
5100
|
+
const Y = await t({
|
|
5101
5101
|
clientId: e.clientId,
|
|
5102
5102
|
reconnectToken: u,
|
|
5103
5103
|
ruleParams: e.ruleParams
|
|
5104
5104
|
});
|
|
5105
|
-
switch (
|
|
5105
|
+
switch (Y.type) {
|
|
5106
5106
|
case "ok": {
|
|
5107
|
-
const { streamId:
|
|
5107
|
+
const { streamId: oe, offset: Be } = Y;
|
|
5108
5108
|
if (Be !== 0) {
|
|
5109
|
-
const
|
|
5110
|
-
|
|
5109
|
+
const ge = new ie("Write stream is corrupted");
|
|
5110
|
+
z(A, ge);
|
|
5111
5111
|
return;
|
|
5112
5112
|
}
|
|
5113
|
-
|
|
5114
|
-
onDisconnect:
|
|
5113
|
+
G(oe), s(oe, {
|
|
5114
|
+
onDisconnect: N,
|
|
5115
5115
|
onFlush: E,
|
|
5116
|
-
onConnectionReconnect:
|
|
5117
|
-
onAppendFailed:
|
|
5118
|
-
}),
|
|
5116
|
+
onConnectionReconnect: ee,
|
|
5117
|
+
onAppendFailed: q
|
|
5118
|
+
}), g = !1;
|
|
5119
5119
|
return;
|
|
5120
5120
|
}
|
|
5121
5121
|
case "disconnect": {
|
|
5122
|
-
k = !0,
|
|
5123
|
-
setTimeout(
|
|
5122
|
+
k = !0, N(), K++, await new Promise((oe) => {
|
|
5123
|
+
setTimeout(oe, Math.max(0, H - Date.now()));
|
|
5124
5124
|
});
|
|
5125
5125
|
break;
|
|
5126
5126
|
}
|
|
5127
5127
|
case "error": {
|
|
5128
|
-
|
|
5128
|
+
z(A, Y.error);
|
|
5129
5129
|
return;
|
|
5130
5130
|
}
|
|
5131
5131
|
}
|
|
5132
5132
|
}
|
|
5133
5133
|
}
|
|
5134
|
-
class
|
|
5135
|
-
constructor(k,
|
|
5136
|
-
super(k,
|
|
5134
|
+
class U extends n {
|
|
5135
|
+
constructor(k, K) {
|
|
5136
|
+
super(k, K);
|
|
5137
5137
|
}
|
|
5138
5138
|
async streamId() {
|
|
5139
|
-
return o || new Promise((k,
|
|
5140
|
-
const
|
|
5141
|
-
for (const
|
|
5142
|
-
|
|
5143
|
-
},
|
|
5144
|
-
k(
|
|
5145
|
-
}, Be = (
|
|
5146
|
-
|
|
5139
|
+
return o || new Promise((k, K) => {
|
|
5140
|
+
const H = [], Y = () => {
|
|
5141
|
+
for (const ge of H)
|
|
5142
|
+
ge();
|
|
5143
|
+
}, oe = (ge) => {
|
|
5144
|
+
k(ge), Y();
|
|
5145
|
+
}, Be = (ge) => {
|
|
5146
|
+
K(ge || new ie("Stream is closed.")), Y();
|
|
5147
5147
|
};
|
|
5148
|
-
|
|
5148
|
+
H.push(C(oe)), H.push(O(Be));
|
|
5149
5149
|
});
|
|
5150
5150
|
}
|
|
5151
5151
|
}
|
|
5152
5152
|
return {
|
|
5153
|
-
stream: new
|
|
5153
|
+
stream: new U({
|
|
5154
5154
|
// TODO(dww): accept a storage so that write streams can survive across
|
|
5155
5155
|
// browser restarts
|
|
5156
|
-
async start(
|
|
5156
|
+
async start(A) {
|
|
5157
5157
|
try {
|
|
5158
|
-
await M(
|
|
5158
|
+
await M(A);
|
|
5159
5159
|
} catch (k) {
|
|
5160
|
-
|
|
5160
|
+
z(A, k);
|
|
5161
5161
|
}
|
|
5162
5162
|
},
|
|
5163
|
-
write(
|
|
5164
|
-
const
|
|
5165
|
-
if (
|
|
5166
|
-
const
|
|
5167
|
-
|
|
5168
|
-
const
|
|
5169
|
-
S +=
|
|
5163
|
+
write(A, k) {
|
|
5164
|
+
const K = j(k);
|
|
5165
|
+
if (K) {
|
|
5166
|
+
const H = T.encode(A).length;
|
|
5167
|
+
_.push({ chunk: A, byteLen: H });
|
|
5168
|
+
const Y = w + S;
|
|
5169
|
+
S += H, g || r({ streamId: K, chunks: [A], offset: Y });
|
|
5170
5170
|
}
|
|
5171
5171
|
},
|
|
5172
5172
|
close() {
|
|
5173
5173
|
o ? r({
|
|
5174
5174
|
streamId: o,
|
|
5175
5175
|
chunks: [],
|
|
5176
|
-
offset:
|
|
5176
|
+
offset: w + S,
|
|
5177
5177
|
isDone: !0
|
|
5178
|
-
}) :
|
|
5178
|
+
}) : P(), R();
|
|
5179
5179
|
},
|
|
5180
|
-
abort(
|
|
5180
|
+
abort(A) {
|
|
5181
5181
|
o ? r({
|
|
5182
5182
|
streamId: o,
|
|
5183
5183
|
chunks: [],
|
|
5184
|
-
offset:
|
|
5184
|
+
offset: w + S,
|
|
5185
5185
|
isDone: !0,
|
|
5186
|
-
abortReason:
|
|
5187
|
-
}) :
|
|
5186
|
+
abortReason: A
|
|
5187
|
+
}) : P(), R();
|
|
5188
5188
|
}
|
|
5189
5189
|
}),
|
|
5190
|
-
addCompleteCb:
|
|
5190
|
+
addCompleteCb: F,
|
|
5191
5191
|
closed() {
|
|
5192
5192
|
return f;
|
|
5193
5193
|
}
|
|
@@ -5231,123 +5231,155 @@ function tc({ RStream: n, opts: e, startStream: t, cancelStream: r }) {
|
|
|
5231
5231
|
let s = e.byteOffset || 0, i = !1;
|
|
5232
5232
|
const o = new TextDecoder("utf-8"), a = new TextEncoder();
|
|
5233
5233
|
let c, u = !1;
|
|
5234
|
-
const l = [];
|
|
5235
|
-
|
|
5234
|
+
const l = [], f = [];
|
|
5235
|
+
let h = null, y = null;
|
|
5236
|
+
function b(P) {
|
|
5236
5237
|
u = !0;
|
|
5237
|
-
for (const
|
|
5238
|
-
|
|
5238
|
+
for (const C of l)
|
|
5239
|
+
C(P);
|
|
5240
|
+
}
|
|
5241
|
+
function g(P) {
|
|
5242
|
+
return l.push(P), () => {
|
|
5243
|
+
const C = l.indexOf(P);
|
|
5244
|
+
C !== -1 && l.splice(C, 1);
|
|
5245
|
+
};
|
|
5239
5246
|
}
|
|
5240
|
-
function
|
|
5241
|
-
return
|
|
5242
|
-
const
|
|
5243
|
-
|
|
5247
|
+
function w(P) {
|
|
5248
|
+
return f.push(P), h && P(h), () => {
|
|
5249
|
+
const C = f.indexOf(P);
|
|
5250
|
+
C !== -1 && f.splice(C, 1);
|
|
5244
5251
|
};
|
|
5245
5252
|
}
|
|
5246
|
-
function
|
|
5247
|
-
|
|
5253
|
+
function S(P, C) {
|
|
5254
|
+
y = C, P.error(C), b(C);
|
|
5248
5255
|
}
|
|
5249
|
-
let
|
|
5250
|
-
async function
|
|
5251
|
-
c =
|
|
5252
|
-
const
|
|
5253
|
-
for await (const
|
|
5256
|
+
let _ = 0;
|
|
5257
|
+
async function T(P, C) {
|
|
5258
|
+
c = J();
|
|
5259
|
+
const G = { ...P || {}, eventId: c };
|
|
5260
|
+
for await (const N of t(G)) {
|
|
5254
5261
|
if (i)
|
|
5255
5262
|
return;
|
|
5256
|
-
if (
|
|
5263
|
+
if (N.type === "reconnect")
|
|
5257
5264
|
return { retry: !0 };
|
|
5258
|
-
if (
|
|
5259
|
-
|
|
5265
|
+
if (N.type === "error") {
|
|
5266
|
+
S(C, N.error);
|
|
5260
5267
|
return;
|
|
5261
5268
|
}
|
|
5262
|
-
if (
|
|
5263
|
-
|
|
5269
|
+
if (N.offset > s) {
|
|
5270
|
+
S(C, new ie("Stream is corrupted.")), i = !0;
|
|
5264
5271
|
return;
|
|
5265
5272
|
}
|
|
5266
|
-
|
|
5267
|
-
|
|
5268
|
-
|
|
5269
|
-
|
|
5270
|
-
|
|
5273
|
+
h = N.streamId;
|
|
5274
|
+
for (const z of f)
|
|
5275
|
+
z(h);
|
|
5276
|
+
let B = s - N.offset;
|
|
5277
|
+
if (N.files && N.files.length) {
|
|
5278
|
+
const z = new AbortController();
|
|
5279
|
+
let ee = fetch(N.files[0].url, {
|
|
5280
|
+
signal: z.signal
|
|
5271
5281
|
});
|
|
5272
|
-
for (let
|
|
5273
|
-
const
|
|
5274
|
-
if (
|
|
5275
|
-
if (
|
|
5276
|
-
|
|
5282
|
+
for (let q = 0; q < N.files.length; q++) {
|
|
5283
|
+
const E = N.files[q + 1], M = await ee;
|
|
5284
|
+
if (E && (ee = fetch(E.url, { signal: z.signal })), !M.ok) {
|
|
5285
|
+
if (_++, _ > 10) {
|
|
5286
|
+
S(C, new ie("Unable to process stream."));
|
|
5277
5287
|
return;
|
|
5278
5288
|
}
|
|
5279
5289
|
return { retry: !0 };
|
|
5280
5290
|
}
|
|
5281
|
-
if (
|
|
5282
|
-
const
|
|
5291
|
+
if (M.body) {
|
|
5292
|
+
const U = M.body.getReader();
|
|
5283
5293
|
try {
|
|
5284
5294
|
for (; ; ) {
|
|
5285
|
-
const { done:
|
|
5286
|
-
if (
|
|
5295
|
+
const { done: L, value: A } = await U.read();
|
|
5296
|
+
if (L)
|
|
5287
5297
|
break;
|
|
5288
5298
|
if (i) {
|
|
5289
|
-
|
|
5299
|
+
z.abort();
|
|
5290
5300
|
return;
|
|
5291
5301
|
}
|
|
5292
|
-
let
|
|
5293
|
-
if (
|
|
5302
|
+
let k = A;
|
|
5303
|
+
if (B > 0 && (k = A.subarray(B), B -= A.length - k.length), !k.length)
|
|
5294
5304
|
continue;
|
|
5295
|
-
s +=
|
|
5296
|
-
const
|
|
5297
|
-
|
|
5305
|
+
s += k.length;
|
|
5306
|
+
const K = o.decode(k);
|
|
5307
|
+
C.enqueue(K);
|
|
5298
5308
|
}
|
|
5299
5309
|
} finally {
|
|
5300
|
-
|
|
5310
|
+
U.releaseLock();
|
|
5301
5311
|
}
|
|
5302
5312
|
} else {
|
|
5303
|
-
const
|
|
5304
|
-
let
|
|
5313
|
+
const U = await M.arrayBuffer();
|
|
5314
|
+
let L = U;
|
|
5305
5315
|
if (i) {
|
|
5306
|
-
|
|
5316
|
+
z.abort();
|
|
5307
5317
|
return;
|
|
5308
5318
|
}
|
|
5309
|
-
if (
|
|
5319
|
+
if (B > 0 && (L = new Uint8Array(U).subarray(B), B -= U.byteLength - L.length), !L.byteLength)
|
|
5310
5320
|
continue;
|
|
5311
|
-
s +=
|
|
5312
|
-
const
|
|
5313
|
-
|
|
5321
|
+
s += L.byteLength;
|
|
5322
|
+
const A = o.decode(L);
|
|
5323
|
+
C.enqueue(A);
|
|
5314
5324
|
}
|
|
5315
5325
|
}
|
|
5316
5326
|
}
|
|
5317
|
-
if (
|
|
5318
|
-
let
|
|
5319
|
-
if (
|
|
5320
|
-
const
|
|
5321
|
-
if (
|
|
5327
|
+
if (_ = 0, N.content) {
|
|
5328
|
+
let z = N.content, ee = a.encode(N.content);
|
|
5329
|
+
if (B > 0) {
|
|
5330
|
+
const q = ee.subarray(B);
|
|
5331
|
+
if (B -= ee.length - q.length, !q.length)
|
|
5322
5332
|
continue;
|
|
5323
|
-
|
|
5333
|
+
ee = q, z = o.decode(q);
|
|
5324
5334
|
}
|
|
5325
|
-
s +=
|
|
5335
|
+
s += ee.length, C.enqueue(z);
|
|
5326
5336
|
}
|
|
5327
5337
|
}
|
|
5328
5338
|
}
|
|
5329
|
-
async function
|
|
5330
|
-
let
|
|
5331
|
-
for (;
|
|
5332
|
-
|
|
5333
|
-
let
|
|
5334
|
-
const
|
|
5335
|
-
|
|
5336
|
-
setTimeout(
|
|
5339
|
+
async function R(P) {
|
|
5340
|
+
let C = !0, G = 0;
|
|
5341
|
+
for (; C; ) {
|
|
5342
|
+
C = !1;
|
|
5343
|
+
let N = Date.now() + Math.min(15e3, 500 * (G - 1));
|
|
5344
|
+
const B = await T({ ...e, offset: s }, P);
|
|
5345
|
+
B != null && B.retry && (C = !0, G++, N < Date.now() - 3e5 && (G = 0), await new Promise((z) => {
|
|
5346
|
+
setTimeout(z, Math.max(0, N - Date.now()));
|
|
5337
5347
|
}));
|
|
5338
5348
|
}
|
|
5339
|
-
!i && !u && (
|
|
5349
|
+
!i && !u && (P.close(), b());
|
|
5350
|
+
}
|
|
5351
|
+
class O extends n {
|
|
5352
|
+
constructor(C, G) {
|
|
5353
|
+
super(C, G);
|
|
5354
|
+
}
|
|
5355
|
+
async streamId() {
|
|
5356
|
+
if (h)
|
|
5357
|
+
return h;
|
|
5358
|
+
if (y)
|
|
5359
|
+
throw y;
|
|
5360
|
+
return new Promise((C, G) => {
|
|
5361
|
+
const N = [], B = () => {
|
|
5362
|
+
for (const q of N)
|
|
5363
|
+
q();
|
|
5364
|
+
}, z = (q) => {
|
|
5365
|
+
C(q), B();
|
|
5366
|
+
}, ee = (q) => {
|
|
5367
|
+
G(q || new ie("Stream is closed.")), B();
|
|
5368
|
+
};
|
|
5369
|
+
N.push(w(z)), N.push(g(ee));
|
|
5370
|
+
});
|
|
5371
|
+
}
|
|
5340
5372
|
}
|
|
5341
5373
|
return {
|
|
5342
|
-
stream: new
|
|
5343
|
-
start(
|
|
5344
|
-
|
|
5374
|
+
stream: new O({
|
|
5375
|
+
start(P) {
|
|
5376
|
+
R(P);
|
|
5345
5377
|
},
|
|
5346
|
-
cancel(
|
|
5347
|
-
i = !0, c && r({ eventId: c }),
|
|
5378
|
+
cancel(P) {
|
|
5379
|
+
i = !0, c && r({ eventId: c }), b();
|
|
5348
5380
|
}
|
|
5349
5381
|
}),
|
|
5350
|
-
addCloseCb:
|
|
5382
|
+
addCloseCb: g,
|
|
5351
5383
|
closed() {
|
|
5352
5384
|
return u;
|
|
5353
5385
|
}
|
|
@@ -5389,7 +5421,7 @@ class nc {
|
|
|
5389
5421
|
}), t;
|
|
5390
5422
|
}
|
|
5391
5423
|
startWriteStream(e) {
|
|
5392
|
-
const t =
|
|
5424
|
+
const t = J();
|
|
5393
5425
|
let r = null;
|
|
5394
5426
|
const s = new Promise((o) => {
|
|
5395
5427
|
r = o;
|
|
@@ -5413,7 +5445,7 @@ class nc {
|
|
|
5413
5445
|
offset: s,
|
|
5414
5446
|
done: !!r
|
|
5415
5447
|
};
|
|
5416
|
-
i && (o["abort-reason"] = i), this.trySend(
|
|
5448
|
+
i && (o["abort-reason"] = i), this.trySend(J(), o);
|
|
5417
5449
|
}
|
|
5418
5450
|
onAppendFailed(e) {
|
|
5419
5451
|
const t = this.writeStreams[e["stream-id"]];
|
|
@@ -5448,10 +5480,9 @@ class nc {
|
|
|
5448
5480
|
op: "unsubscribe-stream",
|
|
5449
5481
|
"subscribe-event-id": e
|
|
5450
5482
|
};
|
|
5451
|
-
this.trySend(
|
|
5483
|
+
this.trySend(J(), t), delete this.readStreamIterators[e];
|
|
5452
5484
|
}
|
|
5453
5485
|
onStreamAppend(e) {
|
|
5454
|
-
var s;
|
|
5455
5486
|
const t = e["client-event-id"], r = this.readStreamIterators[t];
|
|
5456
5487
|
if (!r) {
|
|
5457
5488
|
this.log.info("No iterator for read stream", e);
|
|
@@ -5460,15 +5491,16 @@ class nc {
|
|
|
5460
5491
|
if (e.error) {
|
|
5461
5492
|
e.retry ? r.push({ type: "reconnect" }) : r.push({
|
|
5462
5493
|
type: "error",
|
|
5463
|
-
error: new
|
|
5494
|
+
error: new ie(e.error)
|
|
5464
5495
|
}), r.close(), delete this.readStreamIterators[t];
|
|
5465
5496
|
return;
|
|
5466
5497
|
}
|
|
5467
|
-
|
|
5498
|
+
r.push({
|
|
5468
5499
|
type: "append",
|
|
5469
5500
|
offset: e.offset,
|
|
5470
5501
|
files: e.files,
|
|
5471
|
-
content: e.content
|
|
5502
|
+
content: e.content,
|
|
5503
|
+
streamId: e["stream-id"]
|
|
5472
5504
|
}), e.done && (r.close(), delete this.readStreamIterators[t]);
|
|
5473
5505
|
}
|
|
5474
5506
|
onConnectionStatusChange(e) {
|
|
@@ -5497,7 +5529,7 @@ class nc {
|
|
|
5497
5529
|
const r = e["client-event-id"], s = this.startWriteStreamCbs[r];
|
|
5498
5530
|
s && (s({
|
|
5499
5531
|
type: "error",
|
|
5500
|
-
error: new
|
|
5532
|
+
error: new ie(e.message || "Unknown error", e.hint)
|
|
5501
5533
|
}), delete this.startWriteStreamCbs[r]);
|
|
5502
5534
|
break;
|
|
5503
5535
|
}
|
|
@@ -5505,7 +5537,7 @@ class nc {
|
|
|
5505
5537
|
const r = e["client-event-id"], s = this.readStreamIterators[r];
|
|
5506
5538
|
s && (s.push({
|
|
5507
5539
|
type: "error",
|
|
5508
|
-
error: new
|
|
5540
|
+
error: new ie(e.message || "Unknown error", e.hint)
|
|
5509
5541
|
}), s.close(), delete this.readStreamIterators[r]);
|
|
5510
5542
|
break;
|
|
5511
5543
|
}
|
|
@@ -5680,7 +5712,7 @@ class yc {
|
|
|
5680
5712
|
// Queries
|
|
5681
5713
|
p(this, "getPreviousResult", (e) => {
|
|
5682
5714
|
var r;
|
|
5683
|
-
const t =
|
|
5715
|
+
const t = ne(e);
|
|
5684
5716
|
return (r = this.dataForQuery(t)) == null ? void 0 : r.data;
|
|
5685
5717
|
});
|
|
5686
5718
|
/** Re-run instaql and call all callbacks with new data */
|
|
@@ -5723,7 +5755,7 @@ class yc {
|
|
|
5723
5755
|
* @returns
|
|
5724
5756
|
*/
|
|
5725
5757
|
p(this, "pushOps", (e, t) => {
|
|
5726
|
-
const r =
|
|
5758
|
+
const r = J(), s = [...this._pendingMutations().values()], i = Math.max(0, ...s.map((c) => c.order || 0)) + 1, o = {
|
|
5727
5759
|
op: "transact",
|
|
5728
5760
|
"tx-steps": e,
|
|
5729
5761
|
created: Date.now(),
|
|
@@ -5744,7 +5776,7 @@ class yc {
|
|
|
5744
5776
|
}
|
|
5745
5777
|
this._log.info("[socket][open]", this._transport.id), this._setStatus(Te.OPENED), this.getCurrentUser().then((r) => {
|
|
5746
5778
|
var s;
|
|
5747
|
-
this._trySend(
|
|
5779
|
+
this._trySend(J(), {
|
|
5748
5780
|
op: "init",
|
|
5749
5781
|
"app-id": this.config.appId,
|
|
5750
5782
|
"refresh-token": (s = r.user) == null ? void 0 : s.refresh_token,
|
|
@@ -5934,7 +5966,7 @@ class yc {
|
|
|
5934
5966
|
status: o ?? 0
|
|
5935
5967
|
}));
|
|
5936
5968
|
} else
|
|
5937
|
-
s.reject(new
|
|
5969
|
+
s.reject(new ie((r == null ? void 0 : r.message) || "Unknown error", r == null ? void 0 : r.hint));
|
|
5938
5970
|
}
|
|
5939
5971
|
_setStatus(e, t) {
|
|
5940
5972
|
this.status = e, this._errorMessage = t, this.notifyConnectionStatusSubs(e), this._instantStream.onConnectionStatusChange(e);
|
|
@@ -5958,7 +5990,7 @@ class yc {
|
|
|
5958
5990
|
_addQueryData(e, t, r) {
|
|
5959
5991
|
if (!this.attrs)
|
|
5960
5992
|
throw new Error("Attrs in reactor have not been set");
|
|
5961
|
-
const s =
|
|
5993
|
+
const s = ne(e), i = this.ensureAttrs(), o = et(this.attrs, t.triples, r, this.config.useDateObjects);
|
|
5962
5994
|
this.querySubs.updateInPlace((a) => {
|
|
5963
5995
|
a[s] = {
|
|
5964
5996
|
result: {
|
|
@@ -5979,33 +6011,33 @@ class yc {
|
|
|
5979
6011
|
case "init-ok": {
|
|
5980
6012
|
this._setStatus(Te.AUTHENTICATED), this._reconnectTimeoutMs = 0, this._setAttrs(t.attrs), this._flushPendingMessages(), this._sessionId = t["session-id"];
|
|
5981
6013
|
for (const y of Object.keys(this._rooms)) {
|
|
5982
|
-
const b = (i = (s = this._presence[y]) == null ? void 0 : s.result) == null ? void 0 : i.user,
|
|
5983
|
-
this._tryJoinRoom(
|
|
6014
|
+
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;
|
|
6015
|
+
this._tryJoinRoom(g, y, b);
|
|
5984
6016
|
}
|
|
5985
6017
|
break;
|
|
5986
6018
|
}
|
|
5987
6019
|
case "add-query-exists": {
|
|
5988
|
-
this.notifyOneQueryOnce(
|
|
6020
|
+
this.notifyOneQueryOnce(ne(t.q));
|
|
5989
6021
|
break;
|
|
5990
6022
|
}
|
|
5991
6023
|
case "add-query-ok": {
|
|
5992
|
-
const { q: y, result: b } = t,
|
|
5993
|
-
if (!this._hasQueryListeners() && !this.querySubs.currentValue[
|
|
6024
|
+
const { q: y, result: b } = t, g = ne(y);
|
|
6025
|
+
if (!this._hasQueryListeners() && !this.querySubs.currentValue[g])
|
|
5994
6026
|
break;
|
|
5995
|
-
const
|
|
5996
|
-
this.querySubs.updateInPlace((
|
|
5997
|
-
if (!
|
|
5998
|
-
this._log.info("Missing value in querySubs", { hash:
|
|
6027
|
+
const w = (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, _ = fr(b), T = this.ensureAttrs(), R = et(T, _, r, this.config.useDateObjects);
|
|
6028
|
+
this.querySubs.updateInPlace((O) => {
|
|
6029
|
+
if (!O[g]) {
|
|
6030
|
+
this._log.info("Missing value in querySubs", { hash: g, q: y });
|
|
5999
6031
|
return;
|
|
6000
6032
|
}
|
|
6001
|
-
|
|
6002
|
-
store:
|
|
6003
|
-
attrsStore:
|
|
6004
|
-
pageInfo:
|
|
6033
|
+
O[g].result = {
|
|
6034
|
+
store: R,
|
|
6035
|
+
attrsStore: T,
|
|
6036
|
+
pageInfo: w,
|
|
6005
6037
|
aggregate: S,
|
|
6006
6038
|
processedTxId: t["processed-tx-id"]
|
|
6007
6039
|
};
|
|
6008
|
-
}), this._cleanupPendingMutationsQueries(), this.notifyOne(
|
|
6040
|
+
}), this._cleanupPendingMutationsQueries(), this.notifyOne(g), this.notifyOneQueryOnce(g), this._cleanupPendingMutationsTimeout();
|
|
6009
6041
|
break;
|
|
6010
6042
|
}
|
|
6011
6043
|
case "start-sync-ok": {
|
|
@@ -6041,65 +6073,65 @@ class yc {
|
|
|
6041
6073
|
break;
|
|
6042
6074
|
}
|
|
6043
6075
|
case "refresh-ok": {
|
|
6044
|
-
const { computations: y, attrs: b } = t,
|
|
6076
|
+
const { computations: y, attrs: b } = t, g = t["processed-tx-id"];
|
|
6045
6077
|
b && this._setAttrs(b), this._cleanupPendingMutationsTimeout();
|
|
6046
|
-
const
|
|
6047
|
-
|
|
6048
|
-
|
|
6078
|
+
const w = this._rewriteMutations(this.ensureAttrs(), this._pendingMutations(), g);
|
|
6079
|
+
w !== this._pendingMutations() && this.kv.updateInPlace((T) => {
|
|
6080
|
+
T.pendingMutations = w;
|
|
6049
6081
|
});
|
|
6050
|
-
const S = Vt(
|
|
6051
|
-
var
|
|
6052
|
-
const
|
|
6082
|
+
const S = Vt(w.entries()), _ = y.map((T) => {
|
|
6083
|
+
var q, E, j, M;
|
|
6084
|
+
const R = T["instaql-query"], O = T["instaql-result"], F = ne(R), P = fr(O), C = this.ensureAttrs(), G = et(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 = (M = (j = O == null ? void 0 : O[0]) == null ? void 0 : j.data) == null ? void 0 : M.aggregate;
|
|
6053
6085
|
return {
|
|
6054
|
-
q:
|
|
6055
|
-
hash:
|
|
6056
|
-
store:
|
|
6057
|
-
attrsStore:
|
|
6058
|
-
pageInfo:
|
|
6059
|
-
aggregate:
|
|
6086
|
+
q: R,
|
|
6087
|
+
hash: F,
|
|
6088
|
+
store: N,
|
|
6089
|
+
attrsStore: B,
|
|
6090
|
+
pageInfo: z,
|
|
6091
|
+
aggregate: ee
|
|
6060
6092
|
};
|
|
6061
6093
|
});
|
|
6062
|
-
|
|
6063
|
-
this.querySubs.updateInPlace((
|
|
6064
|
-
if (!
|
|
6065
|
-
this._log.error("Missing value in querySubs", { hash:
|
|
6094
|
+
_.forEach(({ hash: T, q: R, store: O, attrsStore: F, pageInfo: P, aggregate: C }) => {
|
|
6095
|
+
this.querySubs.updateInPlace((G) => {
|
|
6096
|
+
if (!G[T]) {
|
|
6097
|
+
this._log.error("Missing value in querySubs", { hash: T, q: R });
|
|
6066
6098
|
return;
|
|
6067
6099
|
}
|
|
6068
|
-
|
|
6069
|
-
store:
|
|
6070
|
-
attrsStore:
|
|
6071
|
-
pageInfo:
|
|
6072
|
-
aggregate:
|
|
6073
|
-
processedTxId:
|
|
6100
|
+
G[T].result = {
|
|
6101
|
+
store: O,
|
|
6102
|
+
attrsStore: F,
|
|
6103
|
+
pageInfo: P,
|
|
6104
|
+
aggregate: C,
|
|
6105
|
+
processedTxId: g
|
|
6074
6106
|
};
|
|
6075
6107
|
});
|
|
6076
|
-
}), this._cleanupPendingMutationsQueries(),
|
|
6077
|
-
this.notifyOne(
|
|
6108
|
+
}), this._cleanupPendingMutationsQueries(), _.forEach(({ hash: T }) => {
|
|
6109
|
+
this.notifyOne(T);
|
|
6078
6110
|
});
|
|
6079
6111
|
break;
|
|
6080
6112
|
}
|
|
6081
6113
|
case "transact-ok": {
|
|
6082
6114
|
const { "client-event-id": y, "tx-id": b } = t;
|
|
6083
6115
|
this._inFlightMutationEventIds.delete(y);
|
|
6084
|
-
const
|
|
6085
|
-
if (!
|
|
6116
|
+
const w = this._rewriteMutations(this.ensureAttrs(), this._pendingMutations()).get(y);
|
|
6117
|
+
if (!w)
|
|
6086
6118
|
break;
|
|
6087
|
-
this._updatePendingMutations((
|
|
6088
|
-
|
|
6089
|
-
...
|
|
6119
|
+
this._updatePendingMutations((_) => {
|
|
6120
|
+
_.set(y, {
|
|
6121
|
+
..._.get(y),
|
|
6090
6122
|
"tx-id": b,
|
|
6091
6123
|
confirmed: Date.now()
|
|
6092
6124
|
});
|
|
6093
6125
|
});
|
|
6094
6126
|
const S = [];
|
|
6095
|
-
for (const
|
|
6096
|
-
if (
|
|
6097
|
-
const
|
|
6098
|
-
S.push(
|
|
6127
|
+
for (const _ of w["tx-steps"])
|
|
6128
|
+
if (_[0] === "add-attr") {
|
|
6129
|
+
const T = _[1];
|
|
6130
|
+
S.push(T);
|
|
6099
6131
|
}
|
|
6100
6132
|
if (S.length) {
|
|
6101
|
-
const
|
|
6102
|
-
this._setAttrs([...
|
|
6133
|
+
const _ = Object.values(this.ensureAttrs().attrs);
|
|
6134
|
+
this._setAttrs([..._, ...S]);
|
|
6103
6135
|
}
|
|
6104
6136
|
this._finishTransaction("synced", y), this._cleanupPendingMutationsTimeout();
|
|
6105
6137
|
break;
|
|
@@ -6189,8 +6221,8 @@ class yc {
|
|
|
6189
6221
|
return;
|
|
6190
6222
|
}
|
|
6191
6223
|
if ((a = e["original-event"]) != null && a.hasOwnProperty("q") && ((c = e["original-event"]) == null ? void 0 : c.op) === "add-query") {
|
|
6192
|
-
const y = (u = e["original-event"]) == null ? void 0 : u.q, b =
|
|
6193
|
-
this.notifyQueryError(
|
|
6224
|
+
const y = (u = e["original-event"]) == null ? void 0 : u.q, b = ne(y);
|
|
6225
|
+
this.notifyQueryError(ne(y), s), this.notifyQueryOnceError(y, b, t, s);
|
|
6194
6226
|
return;
|
|
6195
6227
|
}
|
|
6196
6228
|
if (((l = e["original-event"]) == null ? void 0 : l.op) === "init") {
|
|
@@ -6231,7 +6263,7 @@ class yc {
|
|
|
6231
6263
|
this.attrs = new Me(e.reduce((t, r) => (t[r.id] = r, t), {}), this._linkIndex), this.notifyAttrsSubs();
|
|
6232
6264
|
}
|
|
6233
6265
|
_startQuerySub(e, t) {
|
|
6234
|
-
const r =
|
|
6266
|
+
const r = J();
|
|
6235
6267
|
return this.querySubs.updateInPlace((s) => {
|
|
6236
6268
|
s[t] = s[t] || { q: e, result: null, eventId: r }, s[t].lastAccessed = Date.now();
|
|
6237
6269
|
}), this._trySendAuthed(r, { op: "add-query", q: e }), r;
|
|
@@ -6251,7 +6283,7 @@ class yc {
|
|
|
6251
6283
|
*/
|
|
6252
6284
|
subscribeQuery(e, t, r) {
|
|
6253
6285
|
this.config.disableValidation || pr(e, this.config.schema), r && "ruleParams" in r && (e = { $$ruleParams: r.ruleParams, ...e });
|
|
6254
|
-
const s =
|
|
6286
|
+
const s = ne(e), i = this.getPreviousResult(e);
|
|
6255
6287
|
return i && t(i), this.queryCbs[s] = this.queryCbs[s] ?? [], this.queryCbs[s].push({ q: e, cb: t }), this._startQuerySub(e, s), () => {
|
|
6256
6288
|
this._unsubQuery(e, s, t);
|
|
6257
6289
|
};
|
|
@@ -6263,7 +6295,7 @@ class yc {
|
|
|
6263
6295
|
return r.reject(new Error("We can't run `queryOnce`, because the device is offline.")), r.promise;
|
|
6264
6296
|
if (!this.querySubs)
|
|
6265
6297
|
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;
|
|
6266
|
-
const s =
|
|
6298
|
+
const s = ne(e), i = this._startQuerySub(e, s);
|
|
6267
6299
|
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")), rc), r.promise;
|
|
6268
6300
|
}
|
|
6269
6301
|
_completeQueryOnce(e, t, r) {
|
|
@@ -6277,7 +6309,7 @@ class yc {
|
|
|
6277
6309
|
return !!((t = this.queryCbs[e]) != null && t.length || (r = this.queryOnceDfds[e]) != null && r.length);
|
|
6278
6310
|
}
|
|
6279
6311
|
_cleanupQuery(e, t) {
|
|
6280
|
-
this._hasQueryListeners(t) || (delete this.queryCbs[t], delete this.queryOnceDfds[t], delete this._dataForQueryCache[t], this.querySubs.unloadKey(t), this._trySendAuthed(
|
|
6312
|
+
this._hasQueryListeners(t) || (delete this.queryCbs[t], delete this.queryOnceDfds[t], delete this._dataForQueryCache[t], this.querySubs.unloadKey(t), this._trySendAuthed(J(), { op: "remove-query", q: e }));
|
|
6281
6313
|
}
|
|
6282
6314
|
// When we `pushTx`, it's possible that we don't yet have `this.attrs`
|
|
6283
6315
|
// This means that `tx-steps` in `pendingMutations` will include `add-attr`
|
|
@@ -6303,7 +6335,7 @@ class yc {
|
|
|
6303
6335
|
return /* @__PURE__ */ new Map();
|
|
6304
6336
|
const s = (l) => {
|
|
6305
6337
|
const [f, h, y] = l["forward-identity"];
|
|
6306
|
-
return
|
|
6338
|
+
return re(e, h, y);
|
|
6307
6339
|
}, i = (l) => {
|
|
6308
6340
|
const [f, h, y] = l["forward-identity"];
|
|
6309
6341
|
return De(e, h, y);
|
|
@@ -6314,15 +6346,15 @@ class yc {
|
|
|
6314
6346
|
for (const y of l) {
|
|
6315
6347
|
const [b] = y;
|
|
6316
6348
|
if (b === "add-attr") {
|
|
6317
|
-
const [
|
|
6318
|
-
if (
|
|
6319
|
-
o.attrIdMap[S.id] =
|
|
6349
|
+
const [w, S] = y, _ = s(S);
|
|
6350
|
+
if (_ && S.id !== _.id) {
|
|
6351
|
+
o.attrIdMap[S.id] = _.id, a = !0;
|
|
6320
6352
|
continue;
|
|
6321
6353
|
}
|
|
6322
6354
|
if (S["value-type"] === "ref") {
|
|
6323
|
-
const
|
|
6324
|
-
if (
|
|
6325
|
-
o.attrIdMap[S.id] =
|
|
6355
|
+
const T = i(S);
|
|
6356
|
+
if (T) {
|
|
6357
|
+
o.attrIdMap[S.id] = T.id, o.refSwapAttrIds.add(S.id), a = !0;
|
|
6326
6358
|
continue;
|
|
6327
6359
|
}
|
|
6328
6360
|
}
|
|
@@ -6331,8 +6363,8 @@ class yc {
|
|
|
6331
6363
|
a = !0;
|
|
6332
6364
|
continue;
|
|
6333
6365
|
}
|
|
6334
|
-
const
|
|
6335
|
-
h.push(
|
|
6366
|
+
const g = a ? Wo(o, y) : y;
|
|
6367
|
+
h.push(g);
|
|
6336
6368
|
}
|
|
6337
6369
|
return a ? h : l;
|
|
6338
6370
|
}, u = /* @__PURE__ */ new Map();
|
|
@@ -6384,10 +6416,10 @@ class yc {
|
|
|
6384
6416
|
if (l && s === l.querySubVersion && o === l.pendingMutationsVersion)
|
|
6385
6417
|
return l;
|
|
6386
6418
|
let f = u.store, h = u.attrsStore;
|
|
6387
|
-
const { pageInfo: y, aggregate: b, processedTxId:
|
|
6419
|
+
const { pageInfo: y, aggregate: b, processedTxId: g } = u, w = this._rewriteMutationsSorted(h, a);
|
|
6388
6420
|
if (t) {
|
|
6389
|
-
const
|
|
6390
|
-
f =
|
|
6421
|
+
const _ = this._applyOptimisticUpdates(f, h, w, g);
|
|
6422
|
+
f = _.store, h = _.attrsStore;
|
|
6391
6423
|
}
|
|
6392
6424
|
return { data: ts({ store: f, attrsStore: h, pageInfo: y, aggregate: b }, c), querySubVersion: s, pendingMutationsVersion: o };
|
|
6393
6425
|
}
|
|
@@ -6535,7 +6567,7 @@ class yc {
|
|
|
6535
6567
|
const r = await this.kv.waitForKeyToLoad(t);
|
|
6536
6568
|
if (r)
|
|
6537
6569
|
return r;
|
|
6538
|
-
const s =
|
|
6570
|
+
const s = J();
|
|
6539
6571
|
return this.kv.updateInPlace((i) => {
|
|
6540
6572
|
i[t] || (i[t] = s);
|
|
6541
6573
|
}), await this.kv.waitForKeyToLoad(t);
|
|
@@ -6622,7 +6654,7 @@ class yc {
|
|
|
6622
6654
|
async getAuth() {
|
|
6623
6655
|
const { user: e, error: t } = await this.getCurrentUser();
|
|
6624
6656
|
if (t)
|
|
6625
|
-
throw new
|
|
6657
|
+
throw new ie("Could not get current user: " + t.message);
|
|
6626
6658
|
return e ?? null;
|
|
6627
6659
|
}
|
|
6628
6660
|
subscribeConnectionStatus(e) {
|
|
@@ -6915,14 +6947,14 @@ class yc {
|
|
|
6915
6947
|
i.result.user = o, s.isConnected && (this._trySetPresence(t, o), this._notifyPresenceSubs(t));
|
|
6916
6948
|
}
|
|
6917
6949
|
_trySetPresence(e, t) {
|
|
6918
|
-
this._trySendAuthed(
|
|
6950
|
+
this._trySendAuthed(J(), {
|
|
6919
6951
|
op: "set-presence",
|
|
6920
6952
|
"room-id": e,
|
|
6921
6953
|
data: t
|
|
6922
6954
|
});
|
|
6923
6955
|
}
|
|
6924
6956
|
_tryJoinRoom(e, t, r) {
|
|
6925
|
-
this._trySendAuthed(
|
|
6957
|
+
this._trySendAuthed(J(), {
|
|
6926
6958
|
op: "join-room",
|
|
6927
6959
|
"room-type": e,
|
|
6928
6960
|
"room-id": t,
|
|
@@ -6930,7 +6962,7 @@ class yc {
|
|
|
6930
6962
|
}), delete this._roomsPendingLeave[t];
|
|
6931
6963
|
}
|
|
6932
6964
|
_tryLeaveRoom(e) {
|
|
6933
|
-
this._trySendAuthed(
|
|
6965
|
+
this._trySendAuthed(J(), { op: "leave-room", "room-id": e });
|
|
6934
6966
|
}
|
|
6935
6967
|
_trySetRoomConnected(e, t) {
|
|
6936
6968
|
const r = this._rooms[e];
|
|
@@ -7004,7 +7036,7 @@ class yc {
|
|
|
7004
7036
|
}
|
|
7005
7037
|
}
|
|
7006
7038
|
_tryBroadcast(e, t, r, s) {
|
|
7007
|
-
this._trySendAuthed(
|
|
7039
|
+
this._trySendAuthed(J(), {
|
|
7008
7040
|
op: "client-broadcast",
|
|
7009
7041
|
"room-id": e,
|
|
7010
7042
|
roomType: t,
|
|
@@ -7021,8 +7053,8 @@ class yc {
|
|
|
7021
7053
|
_notifyBroadcastSubs(e, t, r) {
|
|
7022
7054
|
var s, i, o;
|
|
7023
7055
|
(o = (i = (s = this._broadcastSubs) == null ? void 0 : s[e]) == null ? void 0 : i[t]) == null || o.forEach((a) => {
|
|
7024
|
-
var l, f, h, y, b,
|
|
7025
|
-
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 : (
|
|
7056
|
+
var l, f, h, y, b, g;
|
|
7057
|
+
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"]];
|
|
7026
7058
|
return a(c, u);
|
|
7027
7059
|
});
|
|
7028
7060
|
}
|
|
@@ -7210,200 +7242,200 @@ const vc = (n) => JSON.stringify(n), nt = (n, e = !1) => JSON.stringify([n, e]),
|
|
|
7210
7242
|
];
|
|
7211
7243
|
return { chunks: t, data: r };
|
|
7212
7244
|
}, Qt = ["bootstrap", "bootstrap", "bootstrap", 1], kc = (n, e, t, r) => {
|
|
7213
|
-
var
|
|
7214
|
-
const { entityName: s, entityQuery: i } = gs(e), o = ((
|
|
7215
|
-
let h = !1, y = !0, b = null,
|
|
7216
|
-
const
|
|
7245
|
+
var B, z, ee, q;
|
|
7246
|
+
const { entityName: s, entityQuery: i } = gs(e), o = ((B = i.$) == null ? void 0 : B.limit) || 10, a = s, c = bs((z = i.$) == null ? void 0 : z.order), u = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map();
|
|
7247
|
+
let h = !1, y = !0, b = null, g = null;
|
|
7248
|
+
const w = (E) => {
|
|
7217
7249
|
t({ error: E, data: void 0, canLoadNextPage: !1 });
|
|
7218
7250
|
}, S = () => {
|
|
7219
7251
|
if (!y)
|
|
7220
7252
|
return;
|
|
7221
|
-
const { chunks: E, data:
|
|
7253
|
+
const { chunks: E, data: j } = Ec(u, l);
|
|
7222
7254
|
t({
|
|
7223
|
-
data: { [a]:
|
|
7255
|
+
data: { [a]: j },
|
|
7224
7256
|
// @ts-expect-error hidden debug variable
|
|
7225
7257
|
chunks: E,
|
|
7226
7258
|
canLoadNextPage: Oc(u)
|
|
7227
7259
|
});
|
|
7228
|
-
},
|
|
7229
|
-
u.set(nt(E,
|
|
7230
|
-
},
|
|
7231
|
-
l.set(nt(E),
|
|
7232
|
-
},
|
|
7233
|
-
var
|
|
7234
|
-
const { cursor: M } = Tr(E),
|
|
7235
|
-
|
|
7236
|
-
const
|
|
7260
|
+
}, _ = (E, j) => {
|
|
7261
|
+
u.set(nt(E, j.afterInclusive), j), S();
|
|
7262
|
+
}, T = (E, j) => {
|
|
7263
|
+
l.set(nt(E), j), C(), S();
|
|
7264
|
+
}, R = (E, j) => {
|
|
7265
|
+
var A, k;
|
|
7266
|
+
const { cursor: M } = Tr(E), U = f.get(Ne("reverse", M));
|
|
7267
|
+
U == null || U();
|
|
7268
|
+
const L = n.subscribeQuery({
|
|
7237
7269
|
[a]: {
|
|
7238
7270
|
...i,
|
|
7239
7271
|
$: {
|
|
7240
7272
|
after: M,
|
|
7241
|
-
before:
|
|
7273
|
+
before: j.endCursor,
|
|
7242
7274
|
beforeInclusive: !0,
|
|
7243
|
-
where: (
|
|
7275
|
+
where: (A = i.$) == null ? void 0 : A.where,
|
|
7244
7276
|
fields: (k = i.$) == null ? void 0 : k.fields,
|
|
7245
7277
|
order: Sr(c)
|
|
7246
7278
|
}
|
|
7247
7279
|
}
|
|
7248
|
-
}, (
|
|
7249
|
-
if (
|
|
7250
|
-
return
|
|
7251
|
-
const
|
|
7252
|
-
Ye(
|
|
7253
|
-
data:
|
|
7280
|
+
}, (K) => {
|
|
7281
|
+
if (K.error)
|
|
7282
|
+
return w(K.error);
|
|
7283
|
+
const H = K.data[a], Y = K.pageInfo[a];
|
|
7284
|
+
Ye(H && Y, "Expected query subscription to contain rows and pageInfo"), T(M, {
|
|
7285
|
+
data: H,
|
|
7254
7286
|
status: "frozen",
|
|
7255
|
-
hasMore:
|
|
7256
|
-
endCursor:
|
|
7287
|
+
hasMore: Y.hasNextPage,
|
|
7288
|
+
endCursor: Y.endCursor
|
|
7257
7289
|
});
|
|
7258
7290
|
}, r);
|
|
7259
|
-
f.set(Ne("reverse", M),
|
|
7260
|
-
},
|
|
7261
|
-
var M,
|
|
7262
|
-
const
|
|
7291
|
+
f.set(Ne("reverse", M), L);
|
|
7292
|
+
}, O = (E) => {
|
|
7293
|
+
var M, U;
|
|
7294
|
+
const j = n.subscribeQuery({
|
|
7263
7295
|
[a]: {
|
|
7264
7296
|
...i,
|
|
7265
7297
|
$: {
|
|
7266
7298
|
limit: o,
|
|
7267
7299
|
after: E,
|
|
7268
7300
|
where: (M = i.$) == null ? void 0 : M.where,
|
|
7269
|
-
fields: (
|
|
7301
|
+
fields: (U = i.$) == null ? void 0 : U.fields,
|
|
7270
7302
|
order: Sr(c)
|
|
7271
7303
|
}
|
|
7272
7304
|
}
|
|
7273
|
-
}, (
|
|
7274
|
-
if (
|
|
7275
|
-
return
|
|
7276
|
-
const
|
|
7277
|
-
Ye(
|
|
7278
|
-
data:
|
|
7305
|
+
}, (L) => {
|
|
7306
|
+
if (L.error)
|
|
7307
|
+
return w(L.error);
|
|
7308
|
+
const A = L.data[a], k = L.pageInfo[a];
|
|
7309
|
+
Ye(A && k, "Expected rows and pageInfo"), T(E, {
|
|
7310
|
+
data: A,
|
|
7279
7311
|
status: "bootstrapping",
|
|
7280
7312
|
hasMore: k.hasNextPage,
|
|
7281
7313
|
endCursor: k.endCursor
|
|
7282
7314
|
});
|
|
7283
7315
|
}, r);
|
|
7284
|
-
f.set(Ne("reverse", E),
|
|
7285
|
-
},
|
|
7286
|
-
var
|
|
7316
|
+
f.set(Ne("reverse", E), j);
|
|
7317
|
+
}, F = (E, j = !1) => {
|
|
7318
|
+
var U, L;
|
|
7287
7319
|
const M = n.subscribeQuery({
|
|
7288
7320
|
[a]: {
|
|
7289
7321
|
...i,
|
|
7290
7322
|
$: {
|
|
7291
7323
|
limit: o,
|
|
7292
7324
|
after: E,
|
|
7293
|
-
afterInclusive:
|
|
7294
|
-
where: (
|
|
7295
|
-
fields: (
|
|
7325
|
+
afterInclusive: j,
|
|
7326
|
+
where: (U = i.$) == null ? void 0 : U.where,
|
|
7327
|
+
fields: (L = i.$) == null ? void 0 : L.fields,
|
|
7296
7328
|
order: c
|
|
7297
7329
|
}
|
|
7298
7330
|
}
|
|
7299
|
-
}, (
|
|
7300
|
-
if (
|
|
7301
|
-
return
|
|
7302
|
-
const k =
|
|
7303
|
-
Ye(k &&
|
|
7331
|
+
}, (A) => {
|
|
7332
|
+
if (A.error)
|
|
7333
|
+
return w(A.error);
|
|
7334
|
+
const k = A.data[a], K = A.pageInfo[a];
|
|
7335
|
+
Ye(k && K, "Page info and rows"), _(E, {
|
|
7304
7336
|
data: k,
|
|
7305
7337
|
status: "bootstrapping",
|
|
7306
|
-
hasMore:
|
|
7307
|
-
endCursor:
|
|
7308
|
-
afterInclusive:
|
|
7338
|
+
hasMore: K.hasNextPage,
|
|
7339
|
+
endCursor: K.endCursor,
|
|
7340
|
+
afterInclusive: j
|
|
7309
7341
|
});
|
|
7310
7342
|
}, r);
|
|
7311
|
-
f.set(Ne("forward", E,
|
|
7312
|
-
},
|
|
7313
|
-
var k,
|
|
7314
|
-
const M = nt(E,
|
|
7315
|
-
|
|
7316
|
-
const
|
|
7317
|
-
if (!(
|
|
7343
|
+
f.set(Ne("forward", E, j), M);
|
|
7344
|
+
}, P = (E, j = !1) => {
|
|
7345
|
+
var k, K;
|
|
7346
|
+
const M = nt(E, j), U = f.get(Ne("forward", E, j));
|
|
7347
|
+
U == null || U();
|
|
7348
|
+
const L = u.get(M);
|
|
7349
|
+
if (!(L != null && L.endCursor))
|
|
7318
7350
|
return;
|
|
7319
|
-
const
|
|
7351
|
+
const A = n.subscribeQuery({
|
|
7320
7352
|
[a]: {
|
|
7321
7353
|
...i,
|
|
7322
7354
|
$: {
|
|
7323
7355
|
after: E,
|
|
7324
|
-
afterInclusive:
|
|
7325
|
-
before:
|
|
7356
|
+
afterInclusive: L.afterInclusive,
|
|
7357
|
+
before: L.endCursor,
|
|
7326
7358
|
beforeInclusive: !0,
|
|
7327
7359
|
where: (k = i.$) == null ? void 0 : k.where,
|
|
7328
|
-
fields: (
|
|
7360
|
+
fields: (K = i.$) == null ? void 0 : K.fields,
|
|
7329
7361
|
order: c
|
|
7330
7362
|
}
|
|
7331
7363
|
}
|
|
7332
|
-
}, (
|
|
7333
|
-
if (
|
|
7334
|
-
return
|
|
7335
|
-
const
|
|
7336
|
-
Ye(
|
|
7337
|
-
data:
|
|
7364
|
+
}, (H) => {
|
|
7365
|
+
if (H.error)
|
|
7366
|
+
return w(H.error);
|
|
7367
|
+
const Y = H.data[a], oe = H.pageInfo[a];
|
|
7368
|
+
Ye(Y && oe, "Expected rows and pageInfo"), _(E, {
|
|
7369
|
+
data: Y,
|
|
7338
7370
|
status: "frozen",
|
|
7339
|
-
hasMore:
|
|
7340
|
-
endCursor:
|
|
7341
|
-
afterInclusive:
|
|
7371
|
+
hasMore: oe.hasNextPage,
|
|
7372
|
+
endCursor: oe.endCursor,
|
|
7373
|
+
afterInclusive: L.afterInclusive
|
|
7342
7374
|
});
|
|
7343
7375
|
}, r);
|
|
7344
|
-
f.set(Ne("forward", E,
|
|
7345
|
-
},
|
|
7376
|
+
f.set(Ne("forward", E, j), A);
|
|
7377
|
+
}, C = () => {
|
|
7346
7378
|
const E = Array.from(l.entries()).at(-1);
|
|
7347
7379
|
if (!E)
|
|
7348
7380
|
return;
|
|
7349
|
-
const [
|
|
7381
|
+
const [j, M] = E;
|
|
7350
7382
|
if (!(M != null && M.hasMore) || !Ac(M))
|
|
7351
7383
|
return;
|
|
7352
|
-
const
|
|
7353
|
-
|
|
7354
|
-
},
|
|
7384
|
+
const U = `${j}:${vc(M.endCursor)}`;
|
|
7385
|
+
U != b && (b = U, R(j, M), O(M.endCursor));
|
|
7386
|
+
}, G = () => {
|
|
7355
7387
|
const E = Array.from(u.entries()).at(-1);
|
|
7356
7388
|
if (!E)
|
|
7357
7389
|
return;
|
|
7358
|
-
const [
|
|
7390
|
+
const [j, M] = E;
|
|
7359
7391
|
if (!M.endCursor)
|
|
7360
7392
|
return;
|
|
7361
|
-
const { cursor:
|
|
7362
|
-
|
|
7393
|
+
const { cursor: U, afterInclusive: L } = Tr(j);
|
|
7394
|
+
P(U, L), F(M.endCursor);
|
|
7363
7395
|
};
|
|
7364
|
-
return
|
|
7396
|
+
return g = n.subscribeQuery({
|
|
7365
7397
|
[a]: {
|
|
7366
7398
|
...i,
|
|
7367
7399
|
$: {
|
|
7368
7400
|
limit: o,
|
|
7369
|
-
where: (
|
|
7370
|
-
fields: (
|
|
7401
|
+
where: (ee = i.$) == null ? void 0 : ee.where,
|
|
7402
|
+
fields: (q = i.$) == null ? void 0 : q.fields,
|
|
7371
7403
|
order: c
|
|
7372
7404
|
}
|
|
7373
7405
|
}
|
|
7374
7406
|
}, async (E) => {
|
|
7375
|
-
var
|
|
7407
|
+
var L;
|
|
7376
7408
|
if (h)
|
|
7377
7409
|
return;
|
|
7378
7410
|
if (E.error)
|
|
7379
|
-
return
|
|
7380
|
-
const
|
|
7381
|
-
if (Ye(M &&
|
|
7382
|
-
|
|
7411
|
+
return w(E.error);
|
|
7412
|
+
const j = E.pageInfo[a], M = (L = E == null ? void 0 : E.data) == null ? void 0 : L[a];
|
|
7413
|
+
if (Ye(M && j, "Expected rows and pageInfo"), M.length < o) {
|
|
7414
|
+
_(Qt, {
|
|
7383
7415
|
data: M,
|
|
7384
7416
|
status: "pre-bootstrap"
|
|
7385
7417
|
});
|
|
7386
7418
|
return;
|
|
7387
7419
|
}
|
|
7388
|
-
const
|
|
7389
|
-
if (!
|
|
7390
|
-
|
|
7420
|
+
const U = j.startCursor;
|
|
7421
|
+
if (!U) {
|
|
7422
|
+
_(Qt, {
|
|
7391
7423
|
data: M,
|
|
7392
7424
|
status: "pre-bootstrap"
|
|
7393
7425
|
});
|
|
7394
7426
|
return;
|
|
7395
7427
|
}
|
|
7396
|
-
u.delete(nt(Qt)),
|
|
7428
|
+
u.delete(nt(Qt)), F(U, !0), O(j.startCursor), h = !0;
|
|
7397
7429
|
}, r), {
|
|
7398
7430
|
unsubscribe: () => {
|
|
7399
7431
|
if (y) {
|
|
7400
|
-
y = !1,
|
|
7432
|
+
y = !1, g == null || g(), g = null;
|
|
7401
7433
|
for (const E of f.values())
|
|
7402
7434
|
E == null || E();
|
|
7403
7435
|
f.clear();
|
|
7404
7436
|
}
|
|
7405
7437
|
},
|
|
7406
|
-
loadNextPage:
|
|
7438
|
+
loadNextPage: G
|
|
7407
7439
|
};
|
|
7408
7440
|
}, Cc = (n, e, t) => {
|
|
7409
7441
|
var u, l, f, h;
|
|
@@ -7437,10 +7469,10 @@ const vc = (n) => JSON.stringify(n), nt = (n, e = !1) => JSON.stringify([n, e]),
|
|
|
7437
7469
|
};
|
|
7438
7470
|
}, gs = (n) => {
|
|
7439
7471
|
if (Object.keys(n).length !== 1)
|
|
7440
|
-
throw new
|
|
7472
|
+
throw new Q("subscribeInfiniteQuery expects exactly one entity");
|
|
7441
7473
|
const [t, r] = Object.entries(n)[0];
|
|
7442
7474
|
if (!t || !r)
|
|
7443
|
-
throw new
|
|
7475
|
+
throw new Q("No query provided for infinite query");
|
|
7444
7476
|
return { entityName: t, entityQuery: r };
|
|
7445
7477
|
}, Ic = {
|
|
7446
7478
|
apiURI: "https://api.instantdb.com",
|
|
@@ -7870,7 +7902,7 @@ function Ar(n) {
|
|
|
7870
7902
|
const e = vr.get(n);
|
|
7871
7903
|
if (e)
|
|
7872
7904
|
return e;
|
|
7873
|
-
const t =
|
|
7905
|
+
const t = ne(n);
|
|
7874
7906
|
return vr.set(n, t), t;
|
|
7875
7907
|
}
|
|
7876
7908
|
function Dc(n, e) {
|
|
@@ -7919,7 +7951,7 @@ function Er(n) {
|
|
|
7919
7951
|
}
|
|
7920
7952
|
function Fc(n, e, t, r) {
|
|
7921
7953
|
e && t && "ruleParams" in t && (e = { $$ruleParams: t.ruleParams, ...e });
|
|
7922
|
-
const s = e ? _s(e) : null, i =
|
|
7954
|
+
const s = e ? _s(e) : null, i = ne(s), o = ke(
|
|
7923
7955
|
Er(n._reactor.getPreviousResult(s))
|
|
7924
7956
|
), a = ke(Or), c = Ae(
|
|
7925
7957
|
(l) => (o.current = Er(
|
|
@@ -7963,7 +7995,7 @@ function Kc({
|
|
|
7963
7995
|
query: e,
|
|
7964
7996
|
opts: t
|
|
7965
7997
|
}) {
|
|
7966
|
-
const r = ke(null), s =
|
|
7998
|
+
const r = ke(null), s = ne(e), i = ne(t), o = Cc(n, e, t), a = ke({
|
|
7967
7999
|
...o,
|
|
7968
8000
|
isLoading: !o.data && !o.error
|
|
7969
8001
|
}), c = Ae(
|
|
@@ -8355,7 +8387,7 @@ class Bt {
|
|
|
8355
8387
|
p(this, "useUser", () => {
|
|
8356
8388
|
const { user: e } = this.useAuth();
|
|
8357
8389
|
if (!e)
|
|
8358
|
-
throw new
|
|
8390
|
+
throw new ie(
|
|
8359
8391
|
"useUser must be used within an auth-protected route"
|
|
8360
8392
|
);
|
|
8361
8393
|
return e;
|